/* ============================================================
   EJ General Construction — design system
   Palette + type derived from the real project materials.
   ============================================================ */

:root {
  /* Palette sampled from EJ's actual work */
  --oat: #f4eee3;        /* ground / background */
  --oat-deep: #ece3d3;
  --terrazzo: #d9cfc0;   /* alt bands / surfaces */
  --oak: #a88b6a;        /* borders, captions, muted text */
  --brass: #b8954f;      /* accent, CTA, hairlines (large/decorative use) */
  --brass-bright: #c9a86a;
  --brass-text: #8a6d2f; /* darker brass that passes WCAG for small text on light bg */
  --stone: #6e6453;      /* muted text on light bg (passes 4.5:1), distinct from --oak borders */
  --sage: #7c8466;       /* secondary accent */
  --char: #1e1b17;       /* text / near-black stone */
  --char-soft: #3a352e;
  --pink: #d8a7a0;       /* rare punctuation accent */
  --white: #fbf8f2;

  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "IBM Plex Sans", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;

  --maxw: 1240px;
  --gutter: clamp(1.25rem, 5vw, 4rem);
  --radius: 2px;            /* flat, not rounded-2xl */
  --hair: 1px solid color-mix(in srgb, var(--oak) 45%, transparent);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--char);
  background-color: var(--oat);
  /* barely-there paper texture so flat areas aren't dead-clean */
  background-image:
    radial-gradient(circle at 18% 12%, rgba(168, 139, 106, 0.05), transparent 38%),
    radial-gradient(circle at 84% 78%, rgba(124, 132, 102, 0.05), transparent 42%);
  background-attachment: fixed;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

a { color: inherit; }

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.025em;
  margin: 0 0 0.5em;
  font-optical-sizing: auto;
}

h1 { font-size: clamp(2.6rem, 6.2vw, 5.3rem); }
h2 { font-size: clamp(1.9rem, 3.8vw, 3.1rem); }
h3 { font-size: clamp(1.2rem, 1.8vw, 1.5rem); }

p { margin: 0 0 1rem; max-width: 68ch; }

em { font-style: italic; color: var(--sage); }

.eyebrow {
  font-family: var(--sans);
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--brass-text);
  margin: 0 0 1.1rem;
}

.section { padding: clamp(4rem, 9vw, 8.5rem) var(--gutter); }
.section-head { max-width: 60ch; margin: 0 auto clamp(2.5rem, 5vw, 4rem); text-align: center; }
.section-sub { color: var(--char-soft); margin-inline: auto; }

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 200;
  background: var(--char); color: var(--oat); padding: 0.6rem 1rem;
}
.skip-link:focus { left: 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--sans); font-weight: 600; font-size: 0.95rem;
  letter-spacing: 0.01em; text-decoration: none; cursor: pointer;
  padding: 0.9rem 1.6rem; border-radius: var(--radius);
  border: 1px solid transparent; transition: background-color 0.25s var(--ease), color 0.25s var(--ease), border-color 0.25s var(--ease), transform 0.2s var(--ease);
}
.btn-primary { background: var(--char); color: var(--oat); }
.btn-primary:hover { background: var(--brass); color: var(--char); }
.btn-ghost { background: transparent; color: var(--char); border-color: color-mix(in srgb, var(--char) 30%, transparent); }
.btn-ghost:hover { border-color: var(--char); transform: translateX(2px); }
.btn-block { width: 100%; }

.text-link {
  display: inline-block; font-weight: 600; text-decoration: none;
  color: var(--char); border-bottom: 2px solid var(--brass);
  padding-bottom: 2px; transition: color 0.2s var(--ease);
}
.text-link:hover { color: var(--brass); }

/* ============================================================
   HEADER
   ============================================================ */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--oat) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease), background-color 0.3s var(--ease);
}
.site-header[data-scrolled] { border-bottom: var(--hair); }
.header-inner {
  max-width: var(--maxw); margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1.5rem; padding: 0.85rem var(--gutter);
}
.brand { display: flex; align-items: center; gap: 0.65rem; text-decoration: none; }
.brand-logo { width: 38px; height: 38px; object-fit: contain; }
.brand-name { font-family: var(--serif); font-weight: 600; font-size: 1.12rem; letter-spacing: -0.02em; }

.site-nav { display: flex; align-items: center; gap: clamp(1rem, 2vw, 2rem); }
.site-nav > a { text-decoration: none; font-weight: 500; font-size: 0.95rem; transition: color 0.2s var(--ease); }
.site-nav > a:not(.nav-cta):not(.nav-call):hover { color: var(--brass); }
.nav-call { color: var(--brass-text); font-weight: 600; }
.nav-cta { background: var(--char); color: var(--oat); padding: 0.6rem 1.1rem; border-radius: var(--radius); }
.nav-cta:hover { background: var(--brass); color: var(--char); }

.menu-toggle { display: none; background: none; border: 0; cursor: pointer; width: 44px; height: 44px; padding: 10px; }
.menu-toggle span { display: block; height: 2px; background: var(--char); margin: 5px 0; transition: transform 0.3s var(--ease), opacity 0.2s var(--ease); }
.menu-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.menu-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.mobile-nav { display: flex; flex-direction: column; padding: 0.5rem var(--gutter) 1.5rem; border-top: var(--hair); }
.mobile-nav[hidden] { display: none; }
.mobile-nav a { padding: 0.85rem 0; text-decoration: none; font-family: var(--serif); font-size: 1.3rem; border-bottom: var(--hair); }
.mobile-nav a:last-child { color: var(--brass); }

/* ============================================================
   HERO  — asymmetric, image bleeds right
   ============================================================ */
.hero { padding: clamp(2rem, 5vw, 4.5rem) 0 0; overflow: hidden; }
.hero-grid {
  max-width: var(--maxw); margin: 0 auto;
  display: grid; grid-template-columns: 1.05fr 0.95fr; align-items: center;
  gap: clamp(2rem, 5vw, 4.5rem);
  padding-left: var(--gutter);
}
.hero-copy { padding: clamp(1rem, 4vw, 3rem) 0; }
.hero-copy h1 { margin-bottom: 0.4em; }
.hero-lead { font-size: clamp(1.05rem, 1.5vw, 1.25rem); color: var(--char-soft); max-width: 40ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.9rem; margin: 1.8rem 0 1.4rem; }
.hero-meta { font-size: 0.85rem; letter-spacing: 0.03em; color: var(--stone); text-transform: uppercase; }

.hero-media { position: relative; margin: 0; }
.hero-video {
  width: 100%; height: clamp(420px, 70vh, 760px); object-fit: cover;
  border-top-left-radius: 140px; /* organic arch nod to the trusses */
  background: var(--char);
}
.hero-media figcaption {
  position: absolute; left: 1.2rem; bottom: 1.2rem;
  background: color-mix(in srgb, var(--char) 78%, transparent);
  color: var(--oat); font-size: 0.78rem; letter-spacing: 0.02em;
  padding: 0.5rem 0.85rem; border-radius: var(--radius); max-width: 16rem;
}

/* ============================================================
   TRUST STRIP
   ============================================================ */
.trust { background: var(--char); color: var(--oat); padding: 1.1rem var(--gutter); }
.trust-list {
  max-width: var(--maxw); margin: 0 auto; list-style: none; padding: 0;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: 0.8rem 2rem; font-size: 0.9rem; letter-spacing: 0.02em;
}
.trust-list li { display: flex; align-items: center; gap: 2rem; color: color-mix(in srgb, var(--oat) 85%, transparent); }
.trust-list li:not(:last-child)::after { content: "✦"; color: var(--brass); font-size: 0.7rem; }
.trust-list a { color: var(--brass-bright); text-decoration: none; font-weight: 600; }
.trust-list a:hover { text-decoration: underline; }

/* ============================================================
   PROMISE  — offset text + bleeding image
   ============================================================ */
.promise-grid {
  max-width: var(--maxw); margin: 0 auto;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 5rem); align-items: center;
}
.promise-copy { max-width: 34rem; }
.bleed-right { margin: 0; margin-right: calc(-1 * var(--gutter)); }
.bleed-right img { width: 100%; height: clamp(360px, 48vw, 620px); object-fit: cover; border-bottom-left-radius: 120px; }
.bleed-left { margin: 0; margin-left: calc(-1 * var(--gutter)); }
.bleed-left img { width: 100%; height: clamp(360px, 48vw, 640px); object-fit: cover; border-top-right-radius: 120px; }

/* ============================================================
   BEFORE / AFTER
   ============================================================ */
.transform { background: var(--terrazzo); }
.ba-row {
  max-width: var(--maxw); margin: 0 auto;
  display: grid; grid-template-columns: repeat(2, 1fr); gap: clamp(1.5rem, 4vw, 3rem);
}
.ba { margin: 0; }
.ba-frame {
  position: relative; aspect-ratio: 4 / 3; overflow: hidden;
  border-radius: var(--radius); background: var(--char);
  --pos: 50%; user-select: none; touch-action: pan-y; cursor: ew-resize;
}
/* pointer-events:none + user-drag:none stop the browser's native image-drag,
   which otherwise hijacks the pointer mid-drag on desktop and freezes the handle */
.ba-frame img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; -webkit-user-drag: none; user-select: none; }
.ba-before { clip-path: inset(0 calc(100% - var(--pos)) 0 0); }
.ba-range {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0;
  -webkit-appearance: none; appearance: none; background: transparent; cursor: ew-resize; z-index: 3;
  pointer-events: none; /* the frame handles pointer drag; range stays for keyboard/AT */
}
.ba-range:focus-visible { outline: 3px solid var(--brass); outline-offset: -3px; }
.ba-range::-webkit-slider-thumb { -webkit-appearance: none; width: 44px; height: 100%; cursor: ew-resize; }
.ba-range::-moz-range-thumb { width: 44px; height: 100%; border: 0; background: transparent; cursor: ew-resize; }
.ba-handle {
  position: absolute; top: 0; bottom: 0; left: var(--pos); width: 2px;
  background: var(--oat); transform: translateX(-50%); z-index: 2; pointer-events: none;
}
.ba-handle span {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 42px; height: 42px; border-radius: 50%; background: var(--oat);
  border: 2px solid var(--brass);
  box-shadow: 0 2px 12px rgba(30, 27, 23, 0.4);
}
.ba-handle span::before, .ba-handle span::after {
  content: ""; position: absolute; top: 50%; width: 0; height: 0;
  border-block: 5px solid transparent;
}
.ba-handle span::before { left: 9px; border-right: 7px solid var(--char); transform: translateY(-50%); }
.ba-handle span::after { right: 9px; border-left: 7px solid var(--char); transform: translateY(-50%); }
.ba-tag {
  position: absolute; top: 1rem; z-index: 2; font-size: 0.72rem; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase; padding: 0.35rem 0.7rem;
  background: color-mix(in srgb, var(--char) 75%, transparent); color: var(--oat); border-radius: var(--radius); pointer-events: none;
}
.ba-tag-before { left: 1rem; }
.ba-tag-after { right: 1rem; background: color-mix(in srgb, var(--brass) 88%, transparent); color: var(--char); }
.ba figcaption { margin-top: 0.9rem; font-size: 0.95rem; color: var(--char-soft); }

/* ============================================================
   WORK / GALLERY
   ============================================================ */
.filters { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.6rem; margin-bottom: 2.5rem; }
.filter {
  font-family: var(--sans); font-weight: 500; font-size: 0.9rem; cursor: pointer;
  background: transparent; color: var(--char-soft);
  border: 1px solid color-mix(in srgb, var(--oak) 50%, transparent);
  padding: 0.5rem 1.1rem; border-radius: 100px; transition: all 0.2s var(--ease);
}
.filter:hover { border-color: var(--char); color: var(--char); }
.filter.is-active { background: var(--char); color: var(--oat); border-color: var(--char); }

.gallery {
  max-width: var(--maxw); margin: 0 auto;
  display: grid; grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 12px; gap: clamp(0.8rem, 1.5vw, 1.4rem);
}
.tile {
  position: relative; margin: 0; overflow: hidden; border-radius: var(--radius);
  grid-row: span 22; background: var(--oat-deep);
}
.tile-tall { grid-row: span 30; }
.tile img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.7s var(--ease); }
.tile:hover img { transform: scale(1.04); }
.tile figcaption {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 1.6rem 1rem 0.85rem; color: var(--oat); font-size: 0.9rem; font-weight: 500;
  background: linear-gradient(to top, rgba(30, 27, 23, 0.82), transparent);
  transform: translateY(0.4rem); opacity: 0; transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
}
.tile:hover figcaption, .tile:focus-within figcaption { opacity: 1; transform: translateY(0); }
.tile.is-hidden { display: none; }

/* "See more work" toggle under the gallery */
.more-wrap { display: flex; justify-content: center; margin-top: clamp(1.5rem, 3vw, 2.5rem); }

/* ============================================================
   PROCESS
   ============================================================ */
.process { background: var(--char); color: var(--oat); }
.process .eyebrow { color: var(--brass-bright); }
.process .section-head h2 { color: var(--oat); }
.steps {
  max-width: var(--maxw); margin: 0 auto; list-style: none; padding: 0;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: clamp(1.5rem, 3vw, 2.5rem);
}
.step { border-top: 2px solid var(--brass); padding-top: 1.2rem; }
.step-num { font-family: var(--serif); font-size: 1.1rem; color: var(--brass-bright); letter-spacing: 0.05em; }
.step h3 { color: var(--oat); margin: 0.5rem 0 0.5rem; }
.step p { color: color-mix(in srgb, var(--oat) 78%, transparent); font-size: 0.95rem; margin: 0; }

/* ============================================================
   MATERIALS
   ============================================================ */
.swatches {
  max-width: var(--maxw); margin: 0 auto;
  display: grid; grid-template-columns: repeat(6, 1fr); gap: clamp(0.8rem, 1.5vw, 1.3rem);
}
.swatch { margin: 0; text-align: left; }
.swatch img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: var(--radius); margin-bottom: 0.7rem; }
.swatch figcaption { display: flex; flex-direction: column; }
.swatch strong { font-family: var(--serif); font-weight: 600; font-size: 1.05rem; }
.swatch span { font-size: 0.82rem; color: var(--stone); }

/* ============================================================
   PROOF
   ============================================================ */
.proof { background: color-mix(in srgb, var(--sage) 80%, var(--char)); color: var(--white); }
.proof .eyebrow { color: color-mix(in srgb, var(--white) 85%, transparent); }
.proof-card { max-width: 44rem; margin: 0 auto; text-align: center; }
.proof-card h2 { color: var(--white); }
.proof-card p { margin-inline: auto; color: var(--white); }
.proof-card .btn-primary { margin-top: 1rem; background: var(--white); color: var(--char); }
.proof-card .btn-primary:hover { background: var(--char); color: var(--white); }

/* ============================================================
   ABOUT
   ============================================================ */
.about-grid {
  max-width: var(--maxw); margin: 0 auto;
  display: grid; grid-template-columns: 0.85fr 1fr; gap: clamp(2rem, 5vw, 5rem); align-items: center;
}
.about-copy { max-width: 36rem; }

/* ============================================================
   CONTACT
   ============================================================ */
.contact { background: var(--oat-deep); }
.contact-grid {
  max-width: var(--maxw); margin: 0 auto;
  display: grid; grid-template-columns: 1fr 1fr; gap: clamp(2rem, 5vw, 4.5rem);
}
.contact-points { list-style: none; padding: 0; margin: 2rem 0 0; }
.contact-points li { padding: 1rem 0; border-top: var(--hair); display: flex; flex-direction: column; gap: 0.2rem; }
.contact-points span { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--stone); }
.contact-points a, .contact-points address {
  font-family: var(--serif); font-style: normal; font-size: 1.25rem; text-decoration: none; color: var(--char);
}
.contact-points a:hover { color: var(--brass); }

.contact-form { background: var(--oat); border: var(--hair); border-radius: var(--radius); padding: clamp(1.5rem, 3vw, 2.4rem); }
.field { margin-bottom: 1.2rem; }
.field label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.45rem; }
.field input, .field textarea {
  width: 100%; font-family: var(--sans); font-size: 1rem; color: var(--char);
  background: var(--white); border: 1px solid color-mix(in srgb, var(--oak) 55%, transparent);
  border-radius: var(--radius); padding: 0.8rem 0.9rem; transition: border-color 0.2s var(--ease);
}
.field input:focus, .field textarea:focus { outline: none; border-color: var(--brass); }
.field textarea { resize: vertical; }
.form-note { font-size: 0.78rem; color: var(--stone); margin: 0.8rem 0 0; }

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer { background: var(--char); color: var(--oat); padding: clamp(2.5rem, 5vw, 4rem) var(--gutter) 5.5rem; }
.footer-inner { max-width: var(--maxw); margin: 0 auto; display: grid; gap: 1.4rem; }
.footer-brand { display: flex; align-items: center; gap: 0.6rem; font-family: var(--serif); font-size: 1.2rem; }
.footer-nap p { margin: 0.2rem 0; color: color-mix(in srgb, var(--oat) 80%, transparent); font-size: 0.95rem; }
.footer-nap a { color: var(--brass-bright); text-decoration: none; }
.footer-legal { font-size: 0.82rem; color: color-mix(in srgb, var(--oat) 55%, transparent); margin: 0; }

/* ============================================================
   STICKY MOBILE BAR  (shown < 760px)
   ============================================================ */
.mobile-bar { display: none; }

/* ============================================================
   REVEAL ANIMATION
   ============================================================ */
/* Only hide for animation when JS is confirmed running — no-JS / JS-error = visible */
.js [data-reveal] { opacity: 0; transform: translateY(16px); transition: opacity 0.6s var(--ease), transform 0.6s var(--ease); }
.js [data-reveal].is-visible { opacity: 1; transform: none; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 980px) {
  .hero-grid { grid-template-columns: 1fr; padding-left: 0; }
  .hero-copy { padding: 0 var(--gutter); order: 1; }
  .hero-media { order: 2; }
  .hero-video { height: clamp(360px, 60vh, 520px); border-top-left-radius: 0; }
  .hero-media figcaption { left: 1rem; }
  .promise-grid, .about-grid, .contact-grid { grid-template-columns: 1fr; }
  .bleed-right, .bleed-left { margin-inline: 0; }
  .bleed-right img, .bleed-left img { border-radius: var(--radius); height: clamp(300px, 70vw, 460px); }
  .about-media { order: 2; }
  .steps { grid-template-columns: repeat(2, 1fr); }
  .swatches { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 760px) {
  .site-nav { display: none; }
  .menu-toggle { display: block; }
  .ba-row { grid-template-columns: 1fr; }
  /* drop the fixed row-span masonry (tuned for 3-up) so tiles track their width */
  .gallery { grid-template-columns: repeat(2, 1fr); grid-auto-rows: auto; }
  .tile, .tile-tall { grid-row: auto; aspect-ratio: 4 / 3; }
  h1 { font-size: clamp(2.4rem, 11vw, 3.4rem); }
  body { padding-bottom: 3.4rem; } /* clear the fixed mobile call bar */

  /* sticky bottom call/text/book bar */
  .mobile-bar {
    display: grid; grid-template-columns: repeat(3, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
    background: color-mix(in srgb, var(--char) 96%, transparent); backdrop-filter: blur(8px);
    border-top: 1px solid color-mix(in srgb, var(--brass) 50%, transparent);
  }
  .mobile-bar-btn {
    text-align: center; padding: 0.95rem 0.5rem; text-decoration: none; color: var(--oat);
    font-weight: 600; font-size: 0.95rem; border-right: 1px solid rgba(255,255,255,0.08);
  }
  .mobile-bar-btn:last-child { border-right: 0; }
  .mobile-bar-btn.is-primary { background: var(--brass); color: var(--char); }
}

@media (max-width: 460px) {
  .gallery { grid-template-columns: 1fr; }
  .tile, .tile-tall { aspect-ratio: 3 / 2; }
  .swatches { grid-template-columns: repeat(2, 1fr); }
  .steps { grid-template-columns: 1fr; }
  .hero-actions .btn { flex: 1; }
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
  [data-reveal] { opacity: 1; transform: none; }
}
