/* ==============================
   Design Tokens
   ============================== */
:root {
  --paper: #FAF8F3;
  --ink: #1C1B19;
  --rivera-red: #C8262E;
  --rivera-red-dark: #9E1D23;
  --blueprint: #2E4A63;
  --kraft: #E4D8BE;
  --concrete: #6D675F;

  --font-display: 'Big Shoulders Display', 'Arial Narrow', sans-serif;
  --font-body: 'IBM Plex Sans', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;

  --max-width: 1140px;
  --section-pad: clamp(3.5rem, 8vw, 6rem);
  --gutter: clamp(1.25rem, 4vw, 2rem);
}

/* ==============================
   Reset & Base
   ============================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

body {
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--ink);
  background-color: var(--paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img {
  max-width: 100%;
  display: block;
}

ul, ol {
  list-style: none;
}

a {
  color: var(--rivera-red);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--rivera-red-dark);
}

fieldset {
  border: none;
}

:focus-visible {
  outline: 2px solid var(--blueprint);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ==============================
   Layout
   ============================== */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.section {
  padding: var(--section-pad) 0;
}

.section--alt {
  background-color: var(--kraft);
}

/* ==============================
   Typography — eyebrow + dimension-line headings
   ============================== */
.eyebrow {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--rivera-red);
  margin-bottom: 0.75rem;
}

.section-intro {
  margin-bottom: 2.75rem;
}

.section-heading {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: 0.005em;
  text-transform: uppercase;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.dim-rule {
  flex: 1;
  min-width: 2rem;
  height: 1px;
  background-color: var(--blueprint);
  opacity: 0.55;
  position: relative;
  margin-top: 0.3rem;
}

.dim-rule::before,
.dim-rule::after {
  content: '';
  position: absolute;
  top: -4px;
  width: 1px;
  height: 9px;
  background-color: var(--blueprint);
  opacity: 0.8;
}

.dim-rule::before { left: 0; }
.dim-rule::after { right: 0; }

/* ==============================
   Buttons
   ============================== */
.btn {
  display: inline-block;
  padding: 0.875rem 2rem;
  background-color: var(--rivera-red);
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  line-height: 1;
  border: none;
  border-radius: 2px;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.15s ease;
  text-align: center;
}

.btn:hover {
  background-color: var(--rivera-red-dark);
  color: #fff;
}

.btn:active {
  transform: scale(0.98);
}

.btn--full {
  display: block;
  width: 100%;
  padding: 1rem;
  font-size: 0.9375rem;
}

.btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* ==============================
   Navigation
   ============================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--paper);
  border-bottom: 1px solid rgba(28, 27, 25, 0.08);
  transition: box-shadow 0.25s ease;
}

.site-header.is-scrolled {
  box-shadow: 0 1px 10px rgba(0, 0, 0, 0.06);
}

.nav {
  display: flex;
  align-items: center;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.875rem var(--gutter);
  gap: 2rem;
}

.nav-wordmark {
  flex-shrink: 0;
  line-height: 0;
}

.nav-logo {
  height: 52px;
  width: auto;
  display: block;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  z-index: 102;
}

.nav-toggle-bar {
  display: block;
  width: 24px;
  height: 2px;
  background-color: var(--ink);
  transition: transform 0.3s ease, opacity 0.3s ease;
  transform-origin: center;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 2rem;
  margin-left: auto;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-link {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--concrete);
  padding: 0.375rem 0.75rem;
  transition: color 0.2s ease;
}

.nav-link:hover {
  color: var(--ink);
}

.nav-link.active {
  color: var(--rivera-red);
}

.btn--nav {
  padding: 0.625rem 1.25rem;
  font-size: 0.8125rem;
  white-space: nowrap;
}

/* ==============================
   Hero
   ============================== */
.hero {
  padding: clamp(3rem, 10vw, 6.5rem) 0 var(--section-pad);
  overflow: hidden;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: clamp(2rem, 6vw, 5rem);
}

.hero-headline {
  font-family: var(--font-display);
  font-size: clamp(3.25rem, 8vw, 6.5rem);
  font-weight: 800;
  line-height: 0.9;
  text-transform: uppercase;
  color: var(--ink);
  letter-spacing: 0.005em;
  margin-bottom: 1.5rem;
  opacity: 0;
  animation: rise-in 0.7s 0.5s ease forwards;
}

.hero-sub {
  font-size: clamp(1rem, 1.5vw, 1.1875rem);
  color: var(--concrete);
  max-width: 44ch;
  margin-bottom: 2.25rem;
  line-height: 1.5;
  opacity: 0;
  animation: rise-in 0.7s 0.7s ease forwards;
}

.hero-copy .eyebrow,
.hero-copy .btn {
  opacity: 0;
}

.hero-copy .eyebrow {
  animation: rise-in 0.6s 0.3s ease forwards;
}

.hero-copy .btn {
  animation: rise-in 0.6s 0.85s ease forwards;
}

@keyframes rise-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .hero-headline, .hero-sub, .hero-copy .eyebrow, .hero-copy .btn {
    animation: none;
    opacity: 1;
  }
}

/* Elevation diagram — signature element */
.hero-elevation {
  position: relative;
  width: 150px;
  height: clamp(260px, 32vw, 400px);
  justify-self: end;
  flex-shrink: 0;
}

.elevation-spine {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 1px;
  background-color: var(--blueprint);
  opacity: 0;
  transform-origin: top;
  transform: scaleY(0);
  animation: spine-grow 0.8s 0.15s ease forwards;
}

@keyframes spine-grow {
  from { opacity: 0.7; transform: scaleY(0); }
  to { opacity: 0.4; transform: scaleY(1); }
}

.elevation-mark {
  position: absolute;
  left: 0;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  opacity: 0;
  animation: rise-in 0.5s ease forwards;
}

.elevation-mark--roof { top: 0; animation-delay: 0.55s; }
.elevation-mark--ceiling { top: 52%; margin-top: -15px; animation-delay: 0.75s; }
.elevation-mark--counter { bottom: 0; animation-delay: 0.95s; }

.elevation-tick {
  width: 16px;
  height: 1px;
  background-color: var(--blueprint);
  flex-shrink: 0;
}

.elevation-label {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.35;
  white-space: nowrap;
}

.elevation-label small {
  display: block;
  font-family: var(--font-body);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--concrete);
}

@media (prefers-reduced-motion: reduce) {
  .elevation-spine, .elevation-mark {
    animation: none;
    opacity: 1;
    transform: none;
  }
  .elevation-spine { opacity: 0.4; }
}

/* ==============================
   Services
   ============================== */
.services-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.75rem;
}

.service-card {
  position: relative;
  border-top: 3px solid var(--ink);
  padding: 1.75rem 1.5rem 2rem;
}

.spec-tag {
  position: absolute;
  top: 1.5rem;
  right: 0;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--blueprint);
  border: 1px solid var(--blueprint);
  padding: 0.2rem 0.5rem;
}

.service-card h3 {
  font-family: var(--font-body);
  font-size: 1.1875rem;
  font-weight: 700;
  max-width: 80%;
  margin-bottom: 0.75rem;
}

.service-card p {
  color: var(--concrete);
  font-size: 0.9375rem;
  line-height: 1.6;
  margin-bottom: 1.25rem;
}

.service-list {
  font-size: 0.9375rem;
}

.service-list li {
  padding: 0.3rem 0;
  padding-left: 1.25rem;
  position: relative;
  color: var(--ink);
}

.service-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.7rem;
  width: 6px;
  height: 1px;
  background-color: var(--rivera-red);
}

/* ==============================
   About
   ============================== */
.about-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  margin-bottom: 3.5rem;
}

.about-content p {
  font-size: 1rem;
  line-height: 1.7;
}

.why-us-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.75rem 2.5rem;
}

.why-us-heading {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--blueprint);
  margin-bottom: 1.75rem;
  grid-column: 1 / -1;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(46, 74, 99, 0.25);
}

.why-us-item {
  border-left: 2px solid var(--ink);
  padding-left: 1.1rem;
}

.why-us-item h4 {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.375rem;
}

.why-us-item p {
  font-size: 0.9375rem;
  color: var(--concrete);
  line-height: 1.55;
}

/* ==============================
   Gallery
   ============================== */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.gallery-placeholder {
  aspect-ratio: 4 / 3;
  background-color: var(--paper);
  background-image: repeating-linear-gradient(
    45deg,
    rgba(46, 74, 99, 0.07) 0,
    rgba(46, 74, 99, 0.07) 1px,
    transparent 1px,
    transparent 9px
  );
  border: 1px solid rgba(28, 27, 25, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1rem;
  position: relative;
}

.gallery-placeholder::before {
  content: '+';
  font-family: var(--font-mono);
  font-size: 1.5rem;
  color: var(--concrete);
  opacity: 0.5;
}

.gallery-placeholder span {
  position: absolute;
  bottom: 0.9rem;
  left: 0.9rem;
  right: 0.9rem;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--concrete);
}

/* ==============================
   Testimonials
   ============================== */
.testimonials-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}

.testimonial {
  border-left: 3px solid var(--ink);
  padding-left: 1.5rem;
}

.testimonial p {
  font-size: 0.9375rem;
  line-height: 1.65;
  color: var(--ink);
  margin-bottom: 1.25rem;
}

.testimonial cite {
  font-style: normal;
  display: block;
}

.testimonial cite strong {
  display: block;
  font-size: 0.9375rem;
  font-weight: 700;
}

.testimonial cite span {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--blueprint);
  margin-top: 0.3rem;
}

/* ==============================
   Contact
   ============================== */
.contact-intro {
  max-width: 50ch;
  margin-bottom: 2.5rem;
  color: var(--concrete);
}

.contact-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 3rem;
  align-items: start;
}

/* Form */
.form-field {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  color: var(--ink);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid rgba(28, 27, 25, 0.25);
  border-radius: 2px;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--ink);
  background-color: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--blueprint);
  outline: none;
  box-shadow: 0 0 0 3px rgba(46, 74, 99, 0.12);
}

.form-select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' stroke='%236D675F' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

.form-textarea {
  resize: vertical;
  min-height: 7rem;
}

.form-fieldset {
  padding: 0;
}

.form-radios {
  display: flex;
  gap: 1.5rem;
  margin-top: 0.25rem;
}

.form-radio-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.9375rem;
  color: var(--ink);
}

.form-radio {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(28, 27, 25, 0.25);
  border-radius: 50%;
  position: relative;
  cursor: pointer;
  transition: border-color 0.2s ease;
  flex-shrink: 0;
}

.form-radio:checked {
  border-color: var(--rivera-red);
}

.form-radio:checked::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--rivera-red);
}

.form-radio:focus-visible {
  outline: 2px solid var(--blueprint);
  outline-offset: 2px;
}

/* Contact info sidebar */
.contact-info {
  padding-top: 0.5rem;
}

.contact-info-item {
  margin-bottom: 1.75rem;
}

.contact-info-item h3 {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--blueprint);
  margin-bottom: 0.5rem;
}

.contact-info-item p {
  font-size: 1rem;
  line-height: 1.5;
}

.contact-info-item a {
  color: var(--ink);
}

.contact-info-item a:hover {
  color: var(--rivera-red);
}

/* Form states */
.form-success {
  padding: 2rem;
  background-color: var(--kraft);
  border-left: 3px solid var(--rivera-red);
}

.form-success p {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 1.0625rem;
  line-height: 1.5;
}

.form-error {
  padding: 0.875rem 1rem;
  background-color: #FDF0EF;
  color: #8A231F;
  border-radius: 2px;
  margin-bottom: 1.25rem;
  font-size: 0.9375rem;
}

/* ==============================
   Footer
   ============================== */
.site-footer {
  background-color: var(--ink);
  color: rgba(250, 248, 243, 0.7);
  padding: 3rem 0 2rem;
  font-size: 0.9375rem;
}

.footer-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 2.5rem;
}

.footer-wordmark {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 800;
  text-transform: uppercase;
  color: #fff;
}

.footer-wordmark:hover {
  color: rgba(255, 255, 255, 0.85);
}

.footer-tagline {
  margin-top: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--rivera-red);
}

.footer-nav {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.footer-nav a {
  color: rgba(250, 248, 243, 0.6);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  transition: color 0.2s ease;
}

.footer-nav a:hover {
  color: #fff;
}

.footer-contact p {
  text-align: right;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.7;
}

.footer-contact a {
  color: rgba(250, 248, 243, 0.7);
}

.footer-contact a:hover {
  color: #fff;
}

.footer-copyright {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: rgba(250, 248, 243, 0.3);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 1.5rem;
}

/* ==============================
   Contact Page (contact.html)
   ============================== */
.contact-page {
  padding-top: 2rem;
  padding-bottom: var(--section-pad);
  min-height: calc(100vh - 10rem);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--concrete);
  margin-bottom: 2.5rem;
  transition: color 0.2s ease;
}

.back-link:hover {
  color: var(--rivera-red);
}

.contact-page .section-intro {
  margin-bottom: 1.25rem;
}

.contact-page .contact-grid {
  margin-top: 2.5rem;
}

/* ==============================
   Responsive — Tablet
   ============================== */
@media (max-width: 868px) {
  .nav-toggle {
    display: flex;
  }

  .nav-menu {
    position: fixed;
    inset: 0;
    background-color: var(--paper);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 101;
  }

  .nav-menu.is-open {
    opacity: 1;
    visibility: visible;
  }

  .nav-links {
    flex-direction: column;
    gap: 0.25rem;
  }

  .nav-link {
    font-size: 1.25rem;
    padding: 0.5rem 1rem;
  }

  .btn--nav {
    font-size: 0.9375rem;
    padding: 0.875rem 2rem;
    margin-top: 0.5rem;
  }

  body.nav-open {
    overflow: hidden;
  }

  .hero-grid {
    grid-template-columns: 1fr;
  }

  .hero-elevation {
    justify-self: stretch;
    width: 100%;
    height: 72px;
    margin-top: 2.5rem;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
  }

  .elevation-spine {
    left: 0;
    right: 0;
    top: auto;
    bottom: 28px;
    height: 1px;
    width: auto;
    transform-origin: left;
    transform: scaleX(0);
    animation-name: spine-grow-x;
  }

  @keyframes spine-grow-x {
    from { opacity: 0.7; transform: scaleX(0); }
    to { opacity: 0.4; transform: scaleX(1); }
  }

  .elevation-mark {
    position: static;
    flex-direction: column-reverse;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0;
    transform: none;
  }

  .elevation-mark--counter { align-items: flex-start; animation-delay: 0.55s; }
  .elevation-mark--ceiling { animation-delay: 0.75s; }
  .elevation-mark--roof { align-items: flex-end; animation-delay: 0.95s; }

  .elevation-tick {
    width: 1px;
    height: 12px;
  }

  .elevation-label {
    text-align: center;
    white-space: normal;
  }

  .services-grid {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }

  .about-content {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .why-us-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .testimonials-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .contact-grid {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }

  .footer-inner {
    flex-direction: column;
    gap: 1.5rem;
  }

  .footer-contact p {
    text-align: left;
  }
}

/* ==============================
   Responsive — Mobile
   ============================== */
@media (max-width: 480px) {
  .hero {
    padding-top: clamp(2.5rem, 10vw, 4rem);
  }

  .hero-headline {
    font-size: clamp(2.75rem, 13vw, 3.5rem);
  }

  .section-heading {
    font-size: 1.75rem;
    gap: 1rem;
  }

  .service-card h3 {
    max-width: 100%;
  }

  .gallery-grid {
    grid-template-columns: 1fr;
  }

  .form-radios {
    flex-direction: column;
    gap: 0.75rem;
  }

  .footer-nav {
    flex-direction: column;
    gap: 0.75rem;
  }
}
