@import url('https://fonts.googleapis.com/css2?family=Archivo+Black&family=Space+Mono:wght@400;700&family=Work+Sans:wght@400;500;600&display=swap');

:root {
  --maroon: #942232;        /* maroon — primary dark: nav, headings, dark panels */
  --maroon-light: #800000;  /* lighter maroon — secondary dark panels */
  --orange: #FFFFFF;      /* tan — accent: buttons, numbers, labels */
  --cream: #e6e7e8;       /* soft tan wash — page background */
  --ink: #4A4A4A;         /* near-black warm brown — body text */
  --white: #FFFFFF;
  --cut: 48px; /* signature diagonal-cut size, echoed on every framed image */
}

* { box-sizing: border-box; }

/* Also on html, not just body: mobile browsers otherwise count the closed
   off-canvas menu (parked past the right edge) toward page width and zoom out. */
html { overflow-x: hidden; }

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: 'Work Sans', sans-serif;
  font-size: 17px;
  line-height: 1.6;
  overflow-x: hidden;
}

h1, h2, h3 {
  font-family: 'Archivo Black', sans-serif;
  line-height: 1.05;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: -0.01em;
}

.eyebrow {
  font-family: 'Space Mono', monospace;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--orange);
  margin: 0 0 16px;
}
.eyebrow-center { text-align: center; }
.eyebrow-light { color: var(--maroon); }

.section-title { text-align: center; font-size: clamp(28px, 4vw, 44px); margin-bottom: 56px; }

/* Buttons */
.btn {
  display: inline-block;
  padding: 14px 28px;
  font-family: 'Space Mono', monospace;
  font-size: 14px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  border-radius: 2px;
  border: 2px solid transparent;
  cursor: pointer;
}
.btn-orange { background: var(--orange); color: var(--ink); }
.btn-orange:hover { background: #b3905c; }
.btn-maroon {
  background: var(--maroon);
  color: var(--white);
  width: 100%;
  transition: all 0.2s ease;
}
.btn-maroon:hover {
  background: #6b1824;
  transform: scale(1.05);
}
.btn-outline { border-color: var(--maroon); color: var(--maroon); background: transparent; }
.btn-outline:hover { background: var(--maroon); color: var(--white); }

/* Nav */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--maroon);
  backdrop-filter: blur(6px);
}
.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 18px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  position: relative;
}
.nav-logo {
  font-family: 'Archivo Black', sans-serif;
  color: var(--white);
  text-decoration: none;
  font-size: 18px;
  letter-spacing: -0.02em;
  display: inline-block;
}
.nav-logo span { color: var(--orange); }
.nav-logo-image {
  height: 90px;
  width: auto;
}
.nav-links { display: flex; gap: 28px; }
.nav-links a {
  color: var(--white);
  text-decoration: none;
  font-family: 'Space Mono', monospace;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.85;
}
.nav-links a:hover { opacity: 1; color: var(--orange); }

.admin-links {
  display: flex;
  gap: 16px;
  align-items: center;
}

.admin-link, .login-link, .logout-link {
  color: var(--white);
  text-decoration: none;
  font-family: 'Space Mono', monospace;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.85;
  transition: opacity 0.2s ease;
}

.admin-link:hover, .login-link:hover, .logout-link:hover {
  opacity: 1;
  color: var(--orange);
}

.logout-form { display: inline; margin: 0; }

button.logout-link {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font: inherit;
}

/* Hero */
.hero {
  max-width: 1200px;
  margin: 0 auto;
  padding: 64px 32px 96px;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 56px;
  align-items: center;
}
.hero-media {
  aspect-ratio: 4 / 5;
  overflow: hidden;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%);
  background: var(--maroon);
}
.hero-media img { width: 100%; height: 100%; object-fit: cover; }
.hero-copy h1 { font-size: clamp(34px, 5vw, 56px); color: var(--maroon); }
.hero-copy .lede { max-width: 46ch; color: #3a4150; margin: 24px 0 32px; font-size: 18px; }
.hero-actions { display: flex; gap: 16px; flex-wrap: wrap; }

/* Services */
.services { padding: 96px 32px; background: var(--white); }
.service-grid {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: #e4e0d6;
}
.service-card { background: var(--cream); padding: 40px 28px; }
.service-photo {
  aspect-ratio: 4 / 3;
  margin-bottom: 24px;
  overflow: hidden;
  background: #e4e0d6;
}
.service-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.service-photo.is-empty {
  border: 2px dashed #c9c4b6;
  display: flex;
  align-items: center;
  justify-content: center;
}
.service-photo.is-empty::after {
  content: "Photo";
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #a8a290;
}
.service-number {
  font-family: 'Space Mono', monospace;
  color: var(--orange);
  font-size: 14px;
  display: block;
  margin-bottom: 20px;
}
.service-card h3 { font-size: 20px; color: var(--maroon); margin-bottom: 12px; }
.service-card p { font-size: 15px; color: #4a5060; }

/* Prev/next arrows for sections that show one card at a time on phones */
.carousel-nav { display: none; }
.carousel-arrow {
  width: 44px;
  height: 44px;
  border: 2px solid var(--maroon);
  border-radius: 50%;
  background: transparent;
  color: var(--maroon);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}
.carousel-arrow:hover { background: var(--maroon); color: var(--white); }
.carousel-arrow-light { border-color: var(--white); color: var(--white); }
.carousel-arrow-light:hover { background: var(--white); color: var(--maroon); }

/* Show/hide toggle for sections collapsed on phones; the chevron points down, then up once expanded */
.section-toggle { display: none; }
.section-toggle span { display: inline-block; transform: rotate(90deg); transition: transform 0.2s ease; }
.section-toggle[aria-expanded="true"] span { transform: rotate(-90deg); }

/* History */
.history { background: var(--maroon); padding: 96px 32px; }
.history-inner { max-width: 1200px; margin: 0 auto; }
.history .section-title { color: var(--white); }
.history-content {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 56px;
  align-items: center;
}
.history-media {
  aspect-ratio: 4 / 5;
  max-width: 320px;
  overflow: hidden;
  clip-path: polygon(0 0, 100% 0, 100% 100%, var(--cut) 100%, 0 calc(100% - var(--cut)));
  background: var(--maroon-light);
}
.history-media img { width: 100%; height: 100%; object-fit: cover; }
.history-copy p { color: #d8dce6; font-size: 16px; line-height: 1.7; margin-bottom: 20px; }
.history-copy p:last-child { margin-bottom: 0; }

/* Projects — Featured Program Spotlight */
.projects { padding: 96px 32px; max-width: 1200px; margin: 0 auto; }
.project-spotlight {
  display: grid;
  grid-template-columns: auto auto;
  justify-content: center;
  gap: 64px;
  align-items: center;
}
.project-spotlight-media {
  display: block;
  aspect-ratio: 3 / 4;
  max-width: 360px;
  overflow: hidden;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%);
  background: var(--maroon);
}
.project-spotlight-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  transition: transform 0.4s ease;
}
.project-spotlight-media:hover img { transform: scale(1.04); }

.project-spotlight-copy h3 {
  font-size: 14px;
  font-family: 'Space Mono', monospace;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--maroon);
  margin-bottom: 20px;
}

.contract-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid #d0ccc2;
}
.contract-list li { border-bottom: 1px solid #d0ccc2; }
.contract-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 4px;
  font-family: 'Space Mono', monospace;
  font-size: 16px;
  letter-spacing: 0.02em;
  color: var(--maroon);
  text-decoration: none;
  transition: color 0.2s ease, padding-left 0.2s ease;
}
.contract-list a::after {
  content: "\2197";
  opacity: 0;
  transition: opacity 0.2s ease;
}
.contract-list a:hover {
  color: var(--maroon-light);
  padding-left: 8px;
}
.contract-list a:hover::after { opacity: 1; }

/* Testimonials */
.testimonials { background: var(--maroon); padding: 96px 32px; }
.testimonial-inner { max-width: 1200px; margin: 0 auto; }
.testimonial-viewport { overflow: hidden; width: 100%; }
.testimonial-track { display: flex; gap: 24px; }
.testimonial-card {
  box-sizing: border-box;
  min-width: 0;
  border: 0; margin: 0; padding: 32px;
  background: var(--maroon-light);
  border-radius: 2px;
  text-align: center;
}
.quote-mark { font-family: 'Archivo Black', sans-serif; color: var(--orange); font-size: 48px; margin: 0; line-height: 0.5; }
.quote-text { color: var(--white); font-size: 18px; margin: 16px 0 24px; overflow-wrap: break-word; }
.testimonial-card footer { display: flex; flex-direction: column; align-items: center; color: #b9c2d4; font-size: 13px; }
.testimonial-card footer strong { color: var(--white); font-size: 14px; }

.testimonial-dots { display: flex; justify-content: center; gap: 10px; margin-top: 28px; }
.testimonial-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  border: none;
  background: var(--white);
  cursor: pointer;
  padding: 0;
}
.testimonial-dot.is-active { background: var(--orange); }

/* Team */
.team { padding: 96px 32px; max-width: 1200px; margin: 0 auto; }
.team-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 40px; }
.team-card { text-align: center; }
.team-photo {
  width: 160px; height: 160px; margin: 0 auto 20px;
  overflow: hidden;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 24px), calc(100% - 24px) 100%, 0 100%);
  background: var(--maroon);
}
.team-photo img { width: 100%; height: 100%; object-fit: cover; }
.team-card h3 { font-size: 17px; color: var(--maroon); }
.team-card p { font-size: 14px; font-family: 'Space Mono', monospace; color: var(--orange); margin-top: 6px; }

/* Calculators Page */
.calculators-page { padding: 96px 32px; background: var(--white); }
.calculators-inner { max-width: 1200px; margin: 0 auto; }
.calculators-page h1 { font-size: clamp(28px, 4vw, 48px); color: var(--maroon); margin-bottom: 16px; }
.calculators-intro { font-size: 18px; color: #4a5060; margin-bottom: 56px; max-width: 700px; }

.calc-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; }
.calculator-card {
  background: var(--cream);
  padding: 40px 28px;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.calculator-card h3 { font-size: 20px; color: var(--maroon); margin-bottom: 12px; }
.calc-description { font-size: 14px; color: #6a7a8e; margin-bottom: 24px; line-height: 1.5; }

.calc-input-group { margin-bottom: 16px; }
.calc-input-group label { display: block; font-family: 'Space Mono', monospace; font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--maroon); margin-bottom: 6px; }
.calc-input-group input, .calc-input-group select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d0ccc2;
  border-radius: 2px;
  font-family: 'Work Sans', sans-serif;
  font-size: 15px;
  background: var(--white);
}
.calc-input-group input:focus, .calc-input-group select:focus { outline: none; border-color: var(--maroon); background: #fafaf8; }
.calc-input-group select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23942232' stroke-width='2'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 20px;
  padding-right: 40px;
}

.calc-mode-toggle { display: flex; gap: 8px; margin-bottom: 24px; }
.mode-btn {
  flex: 1;
  padding: 10px 16px;
  border: 1px solid #d0ccc2;
  background: var(--white);
  color: var(--ink);
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 2px;
  transition: all 0.2s ease;
}
.mode-btn.active { background: var(--maroon); color: var(--white); border-color: var(--maroon); }
.mode-btn:hover { border-color: var(--maroon); }

.quality-mode { display: none; }

.calc-output {
  background: var(--white);
  padding: 16px;
  border-left: 4px solid var(--orange);
  display: none;
  align-items: center;
  margin-bottom: 0;
}
.calc-output.show {
  display: flex;
}
.calc-output p { margin: 0; color: var(--maroon); font-size: 15px; line-height: 1.6; }
.calc-output .error { color: #c44; font-weight: 600; }

.calc-buttons { display: flex; gap: 12px; margin-top: 16px; }
.calc-buttons .btn { flex: 1; padding: 12px 16px; font-size: 14px; }

.calc-action-buttons { display: flex; gap: 16px; margin-top: 40px; justify-content: center; }
.calc-action-buttons .btn { padding: 14px 32px; font-size: 14px; }

/* Contact CTA */
.contact-cta { background: var(--orange); padding: 96px 32px; }
.contact-inner { max-width: 640px; margin: 0 auto; text-align: center; }
.contact-cta h2 { color: var(--ink); font-size: clamp(28px, 4vw, 40px); margin-bottom: 32px; }
.contact-form { display: flex; flex-direction: column; gap: 14px; text-align: left; }
.form-row { display: flex; gap: 14px; }
.contact-form input:not([type="submit"]), .contact-form textarea, .contact-form select {
  padding: 14px 16px;
  border: none;
  border-radius: 2px;
  font-family: 'Work Sans', sans-serif;
  font-size: 15px;
  width: 100%;
  background: var(--white);
}

.contact-form select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23942232' stroke-width='2'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 20px;
  padding-right: 40px;
}
.contact-form button { margin-top: 6px; }
.contact-form input:not([type="submit"]) { border: double; }
.contact-form textarea { border: double; }
.contact-form select { border: double; }

.recaptcha-container { margin: 16px 0; }
.g-recaptcha { display: flex; justify-content: flex-start; }

/* Footer */
.site-footer { background: var(--maroon); color: #b9c2d4; padding: 48px 32px; text-align: center; }
.footer-inner { max-width: 1200px; margin: 0 auto; }
.footer-inner p { margin: 14px 0 0; font-size: 14px; }
.footer-copy { color: #6f7a8e; font-size: 12px; margin-top: 8px; }

/* Hamburger Menu */
.nav-toggle {
  display: flex;
  flex-direction: column;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  gap: 6px;
}
.nav-toggle span {
  width: 24px;
  height: 2px;
  background: var(--white);
  border-radius: 2px;
  transition: all 0.3s ease;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: rotate(45deg) translate(8px, 8px);
}
.nav-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}
.nav-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: rotate(-45deg) translate(8px, -8px);
}
.nav-menu {
  display: flex;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 280px;
  flex-direction: column;
  gap: 0;
  background: var(--cream);
  padding: 80px 24px 32px;
  z-index: 99;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  box-shadow: -4px 0 12px rgba(0, 0, 0, 0.15);
  overflow-y: auto;
  height: 100vh;
}

.nav-menu::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.nav-menu.is-open::before {
  opacity: 1;
  pointer-events: auto;
}
.nav-menu a {
  padding: 16px 0;
  border-bottom: 1px solid #e0ddd3;
  color: var(--maroon);
  text-decoration: none;
  font-family: 'Space Mono', monospace;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: color 0.2s ease;
}
.nav-menu a:hover {
  color: var(--maroon);
}
.nav-menu a:last-of-type {
  border-bottom: none;
}

.nav-menu-mobile-only { display: none; }

.nav-menu-divider {
  height: 1px;
  background: #d0ccc2;
  margin: 16px 0;
}

.nav-menu.is-open {
  transform: translateX(0);
}

/* Responsive */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding-top: 32px; }
  .history-content { grid-template-columns: 1fr; gap: 32px; }
  .project-spotlight { grid-template-columns: 1fr; gap: 32px; }
  .service-grid, .calc-grid { grid-template-columns: repeat(2, 1fr); }
  .testimonial-track, .team-grid { grid-template-columns: 1fr; }
  .nav-toggle { display: flex; }
  .nav-links { display: none; }
  .nav-menu-mobile-only { display: flex; flex-direction: column; }
  .nav-inner { padding: 12px 16px; gap: 12px; }
  .nav-logo-image { height: 48px; }
  .site-nav .btn-orange { padding: 10px 14px; font-size: 12px; }
  .form-row { flex-direction: column; }
}

@media (max-width: 600px) {
  .service-grid, .calc-grid { grid-template-columns: 1fr; }
  .service-card { display: none; }
  .service-card.is-active { display: block; }
  .carousel-nav { display: flex; justify-content: center; gap: 16px; margin-top: 24px; }
  .testimonial-card { display: none; }
  .testimonial-card.is-active { display: block; flex: 1 1 100%; }
  .testimonial-dots { display: none; }
  .section-toggle { display: flex; align-items: center; justify-content: center; margin: -32px auto 0; }
  .collapsible-mobile:not(.is-expanded) { display: none; }
  .collapsible-mobile.is-expanded { margin-top: 32px; }
}

/* Auth (Devise) pages */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--cream);
  padding: 32px;
}

.auth-card {
  background: var(--white);
  width: 100%;
  max-width: 420px;
  padding: 48px 40px;
  border-radius: 4px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
  text-align: center;
}

.auth-logo { display: inline-block; margin-bottom: 24px; }
.auth-logo-image { height: 70px; width: auto; }

.auth-card h1 {
  font-size: 28px;
  color: var(--maroon);
  margin-bottom: 8px;
}

.auth-subtitle {
  color: #6a7a8e;
  font-size: 14px;
  margin-bottom: 32px;
  line-height: 1.5;
}

.auth-form { display: flex; flex-direction: column; gap: 18px; text-align: left; }

.auth-input-group label {
  display: block;
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--maroon);
  margin-bottom: 6px;
}

.auth-input-group input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #d0ccc2;
  border-radius: 2px;
  font-family: 'Work Sans', sans-serif;
  font-size: 15px;
  background: var(--cream);
}

.auth-input-group input:focus {
  outline: none;
  border-color: var(--maroon);
  background: var(--white);
}

.password-field-wrapper { position: relative; }
.password-field-wrapper input { padding-right: 44px; }

.password-toggle {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 4px;
  color: #6a7a8e;
  cursor: pointer;
  display: flex;
  align-items: center;
}

.password-toggle:hover { color: var(--maroon); }

.auth-checkbox-group {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--ink);
}

.auth-checkbox-group label { margin: 0; }

.auth-submit {
  width: 100%;
  margin-top: 8px;
  border: none;
  font-size: 15px;
}

.auth-links {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
}

.auth-links a {
  color: #6a7a8e;
  text-decoration: none;
  transition: color 0.2s ease;
}

.auth-links a:hover { color: var(--maroon); }