/* TimberCrest Homes
   Palette is lifted from the logo: plum marks "before", sage marks "after".
   The one expressive element is the diagonal before/after split in the hero,
   cut at the angle of the logo's chevrons. Everything else stays square and quiet. */

:root {
  --tar: #2e2e2c;        /* ink, dark bands */
  --heather: #6b5d6e;    /* plum: before */
  --lichen: #647062;     /* sage: after, actions */
  --lichen-dark: #525d51;
  --drywall: #efefec;    /* page */
  --plaster: #e5e5e1;    /* quiet band */
  --quartz: #ffffff;     /* form surface */
  --muted: #5d5d58;
  --rule: rgba(46, 46, 44, .14);
  --radius: 2px;
  --font: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --gutter: 24px;
  --max: 1240px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
body {
  margin: 0;
  background: var(--drywall);
  color: var(--tar);
  font: 400 1.0625rem/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
a { color: inherit; }
h1, h2, h3, h4 { margin: 0; font-family: var(--font); }
p { margin: 0 0 1em; }

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }

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

/* Buttons and links */
.btn {
  display: inline-block; padding: .8rem 1.3rem; border: 0; border-radius: var(--radius);
  background: var(--lichen); color: #fff; font: 600 1rem/1.2 var(--font);
  text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--lichen-dark); }
.text-link { color: #fff; font-weight: 600; text-underline-offset: .25em; text-decoration-thickness: 1px; }
.text-link:hover { text-decoration-thickness: 2px; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--drywall); border-bottom: 1px solid var(--rule);
}
.nav { display: flex; align-items: center; justify-content: space-between; height: 72px; }
.logo { display: flex; align-items: center; gap: .65rem; text-decoration: none; }
.logo-mark { width: 36px; height: 36px; flex: none; }
.logo-text { display: flex; flex-direction: column; line-height: 1; }
.logo-name { font: 400 1.3rem/1 "Russo One", var(--font); color: #333; }
.logo-sub { font: 500 .6rem/1 var(--font); letter-spacing: .45em; text-transform: uppercase; color: var(--muted); margin-top: .3rem; text-align: center; }
.nav-links { display: flex; align-items: center; gap: 2rem; }
.nav-links a:not(.btn) { font-weight: 500; font-size: .95rem; text-decoration: none; }
.nav-links a:not(.btn):hover { text-decoration: underline; text-underline-offset: .3em; }
.nav-toggle { display: none; background: none; border: 0; padding: 8px; cursor: pointer; }
.nav-toggle span { display: block; width: 24px; height: 2px; margin: 5px 0; background: var(--tar); transition: transform .2s, opacity .2s; }

/* HUD text: small monospace readouts, used only for technical labels (after igloo.inc) */
.hud, .index, .explore, .callouts { font-family: "JetBrains Mono", ui-monospace, "Cascadia Mono", monospace; font-weight: 400; }

.hud { position: absolute; z-index: 2; font-size: .8125rem; line-height: 1.5; color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, .75); }
.hud-tl { top: 20px; left: var(--gutter); }
.hud-tr { top: 20px; right: var(--gutter); text-align: right; }
.hud-br { bottom: 24px; right: var(--gutter); text-align: right; }
#intro-pct { font-variant-numeric: tabular-nums; }

/* Intro. Default is a static hero: the finished kitchen with the headline.
   js/intro.js adds .is-3d once WebGL is running; then the stage pins and the 3D scene plays on scroll. */
.intro { position: relative; background: var(--tar); }
.intro-stage { position: relative; height: calc(100svh - 72px); min-height: 560px; overflow: hidden; }
/* the wide hero keeps the house on its right with a dark side for the headline, so crop from the left */
.intro-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 100% 50%; }
@media (max-aspect-ratio: 1/1) { .intro-photo { object-position: 50% 50%; } }
.intro-canvas { display: none; }
.intro .hud-tr, .intro .hud-br { display: none; }

.intro.is-3d { height: 340vh; }
.intro.is-3d .intro-stage, .intro-pending .intro-stage {
  position: sticky; top: 72px;
  /* dark grey drafting sheet: a faint grid (heavier every fifth line) over a gradient that's a touch lighter
     behind the logo; the WebGL fog matches the middle tone */
  --grid-minor: rgba(255, 255, 255, .045);
  --grid-major: rgba(255, 255, 255, .085);
  background:
    linear-gradient(var(--grid-major) 1px, transparent 1px) center / 140px 140px,
    linear-gradient(90deg, var(--grid-major) 1px, transparent 1px) center / 140px 140px,
    linear-gradient(var(--grid-minor) 1px, transparent 1px) center / 28px 28px,
    linear-gradient(90deg, var(--grid-minor) 1px, transparent 1px) center / 28px 28px,
    radial-gradient(120% 90% at 50% 45%, #45474b 0%, #36383b 55%, #26282a 100%);
}
/* sheet border, drawn under the 3D canvas */
.intro.is-3d .intro-stage::before, .intro-pending .intro-stage::before {
  content: ""; position: absolute; inset: 14px; pointer-events: none;
  border: 1px solid rgba(255, 255, 255, .2); outline: 1px solid rgba(255, 255, 255, .07); outline-offset: 5px;
}
.intro.is-3d .intro-canvas { display: block; position: absolute; inset: 0; width: 100%; height: 100%; }
.intro.is-3d .intro-photo { opacity: 0; }
.intro.is-3d .hud-tr, .intro.is-3d .hud-br { display: block; }
.intro.is-3d .hud-br { opacity: 0; }
.intro.is-3d .hero-panel { opacity: 0; visibility: hidden; }
/* while the 3D intro loads, show only its backdrop: no photo, headline box or corner text yet */
.intro-pending .intro-photo, .intro-pending .hero-panel, .intro-pending .hud { visibility: hidden !important; }

.hero-panel {
  position: absolute; z-index: 3; bottom: clamp(24px, 5vh, 56px);
  left: max(var(--gutter), calc((100vw - var(--max)) / 2 + var(--gutter)));
  /* stay on the dark side of the hero photo; the house starts about 88% of the stage height in from the right */
  width: min(560px, calc(100% - 2 * var(--gutter)), 42vw);
  background: var(--tar); color: #fff; padding: clamp(1.75rem, 3vw, 2.75rem);
}
.hero-panel h1 {
  font-size: clamp(2.5rem, 5.2vw, 4.25rem); font-stretch: 125%; font-weight: 800;
  line-height: .98; letter-spacing: -.015em; margin-bottom: 1.25rem;
}
.hero-panel p { color: rgba(255, 255, 255, .82); max-width: 44ch; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.75rem; margin-top: 1.5rem; }

/* Sections */
.section { padding: clamp(4.5rem, 9vw, 8rem) 0; }
.section-quiet { background: var(--plaster); }
.section-dark { background: var(--tar); color: #fff; }

/* faint drafting grid across the site, like the intro: dark lines on light bands, light lines on dark ones.
   Fixed to the viewport so the grid lines up from one section to the next. */
body { --grid-minor: rgba(46, 46, 44, .045); --grid-major: rgba(46, 46, 44, .08); }
.section-dark, .site-footer { --grid-minor: rgba(255, 255, 255, .04); --grid-major: rgba(255, 255, 255, .075); }
body, .section-quiet, .section-dark, .site-footer {
  background-image:
    linear-gradient(var(--grid-major) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-major) 1px, transparent 1px),
    linear-gradient(var(--grid-minor) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-minor) 1px, transparent 1px);
  background-size: 140px 140px, 140px 140px, 28px 28px, 28px 28px;
  background-attachment: fixed;
}
.section-title {
  font-size: clamp(2rem, 4.2vw, 3.1rem); font-stretch: 125%; font-weight: 800;
  line-height: 1.02; letter-spacing: -.01em; margin-bottom: 2.75rem; max-width: 18ch;
}

/* Photos that open in the lightbox */
/* overflow:hidden drops aspect-ratio's content-based minimum so tall photos crop instead of stretching the box */
.zoom { display: block; width: 100%; padding: 0; border: 0; background: var(--plaster); cursor: zoom-in; overflow: hidden; }
.zoom img { width: 100%; height: 100%; object-fit: cover; }

/* Projects */
.project + .project { margin-top: clamp(4.5rem, 9vw, 7rem); }
.project-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: 1rem 3rem; margin-bottom: 2rem; }
.project-head h3 { font-size: clamp(1.4rem, 2.2vw, 1.75rem); font-stretch: 112%; font-weight: 700; line-height: 1.15; }
.project-head p { color: var(--muted); max-width: 62ch; margin: 0; }
.index { font-size: .8125rem; color: var(--muted); margin: 0 0 .4rem; }

/* Annotated feature photo: leader-line callouts pointing at the actual work (after igloo.inc's HUD labels).
   js/main.js wraps each <li> and adds the numbered dot layer. */
.annotated { position: relative; margin: 0 0 1rem; container-type: inline-size; }
.annotated .zoom { position: relative; }
.annotated .zoom img { height: auto; }
/* landscape features are center-cropped to 16:9 so they fit a laptop screen; callout y values in the HTML account for the crop */
.annotated.wide .zoom img { aspect-ratio: 16 / 9; object-fit: cover; }
.explore {
  position: absolute; bottom: 12px; left: 12px; pointer-events: none;
  font-size: .75rem; color: #fff; background: rgba(46, 46, 44, .72); padding: .3rem .55rem; border-radius: var(--radius);
}
.dots { position: absolute; inset: 0; pointer-events: none; }
.dot {
  position: absolute; left: calc(var(--x) * 1%); top: calc(var(--y) * 1%); width: 22px; height: 22px; margin: -11px 0 0 -11px;
  display: grid; place-items: center; border-radius: 50%; border: 2px solid #fff; background: var(--lichen); color: #fff;
  font: 400 .6875rem/1 "JetBrains Mono", monospace; box-shadow: 0 0 0 1px rgba(0, 0, 0, .35);
  transform: scale(0); transition: transform .35s cubic-bezier(.34, 1.56, .64, 1) calc(var(--i) * 90ms);
}
.callouts { list-style: none; margin: 0; padding: 0; position: absolute; inset: 0; pointer-events: none; font-size: .8125rem; }
.callouts li { position: absolute; left: calc(var(--x) * 1%); top: calc(var(--y) * 1%); width: 0; height: 0; white-space: nowrap; }
.callouts .c-num { display: none; }
.c-label {
  position: absolute; top: 0; left: 52px; transform: translate(-8px, -50%); opacity: 0;
  color: #fff; background: rgba(46, 46, 44, .85); padding: .35rem .6rem; border-radius: var(--radius);
  transition: opacity .4s ease calc(var(--i) * 90ms + 150ms), transform .4s ease calc(var(--i) * 90ms + 150ms);
}
.c-label::before {
  content: ""; position: absolute; top: 50%; right: 100%; width: 40px; height: 1px; background: #fff;
  box-shadow: 0 0 2px rgba(0, 0, 0, .6); transform: scaleX(0); transform-origin: right;
  transition: transform .3s ease calc(var(--i) * 90ms + 100ms);
}
.callouts .to-left .c-label { left: auto; right: 52px; transform: translate(8px, -50%); }
.callouts .to-left .c-label::before { right: auto; left: 100%; transform-origin: left; }
.annotated.is-in .dot { transform: scale(1); }
.annotated.is-in .c-label { opacity: 1; transform: translate(0, -50%); }
.annotated.is-in .c-label::before { transform: scaleX(1); }

/* When the photo is narrow, labels move into a numbered list under it; the dots stay on the photo */
@container (max-width: 560px) {
  .callouts { position: static; display: grid; gap: .45rem; margin-top: .9rem; color: var(--tar); }
  .callouts li { position: static; width: auto; height: auto; display: flex; align-items: center; gap: .6rem; white-space: normal; }
  .callouts .c-num {
    display: grid; place-items: center; flex: none; width: 22px; height: 22px; border-radius: 50%;
    background: var(--lichen); color: #fff; font-size: .6875rem;
  }
  .c-label, .callouts .to-left .c-label { position: static; transform: none; opacity: 1; background: none; color: inherit; padding: 0; }
  .c-label::before { display: none; }
}

.stages { display: grid; gap: 1rem; }
.stages-deck { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stages-deck .stage-wide { grid-column: span 2; }
.stages-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.gallery-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.gallery-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin-top: 1rem; }
.gallery-3 .zoom { aspect-ratio: 4 / 3; }
.stages + .gallery-4, .gallery-3 + .gallery-4 { margin-top: 1rem; }
.gallery-4 .zoom, .clip { aspect-ratio: 3 / 4; }
.clip { position: relative; overflow: hidden; background: var(--plaster); }
.clip video { width: 100%; height: 100%; object-fit: cover; object-position: 50% 60%; display: block; }
.clip-toggle {
  position: absolute; bottom: 12px; left: 12px; border: 0; cursor: pointer;
  font: .75rem "JetBrains Mono", ui-monospace, "Cascadia Mono", monospace; color: #fff; background: rgba(46, 46, 44, .72); padding: .3rem .55rem; border-radius: var(--radius);
}
.clip-toggle:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.stage { display: flex; flex-direction: column; gap: .75rem; }
.stage .zoom, .stage-pair .zoom { aspect-ratio: 4 / 3; }
.stage-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.stage-label { font-size: .95rem; font-weight: 700; padding-top: .55rem; border-top: 4px solid; }
.stage-label.is-before { color: var(--heather); }
.stage-label.is-after { color: var(--lichen); }
.stage-label.is-during { color: var(--tar); }

.feature-split { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 1rem; align-items: stretch; }
.feature-split .annotated { margin: 0; }
/* zero intrinsic height, then stretch: the photo sets the row height and the mosaic fills it */
.feature-split .mosaic { height: 0; min-height: 100%; }
/* six tall photos in a 2x3 grid: near-square tiles beside the main photo keep most of each picture */
.mosaic { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(3, minmax(0, 1fr)); gap: 1rem; }
/* each thumbnail's crop is set on its <img> (object-position) to frame the best part of that photo */

/* Services */
.services { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 2rem 3rem; }
.services .section-title { margin: 0; }
.service-list { margin: 0; }
.service-list > div { display: grid; grid-template-columns: 15rem minmax(0, 1fr); gap: .25rem 2rem; padding: 1.4rem 0; border-top: 1px solid var(--rule); }
.service-list > div:last-child { border-bottom: 1px solid var(--rule); }
.service-list dt { font-size: 1.25rem; font-stretch: 112%; font-weight: 700; line-height: 1.3; }
.service-list dd { margin: 0; color: var(--muted); max-width: 52ch; }

/* About */
.about { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: clamp(2rem, 6vw, 5.5rem); align-items: start; }
.about-text > p { max-width: 58ch; color: var(--muted); }
.facts { list-style: none; padding: 0; margin: 2rem 0 0; display: grid; gap: .7rem; }
.facts li { position: relative; padding-left: 1.6rem; font-weight: 500; }
.facts li::before {
  content: ""; position: absolute; left: .15rem; top: .55em; width: .5rem; height: .5rem;
  background: var(--lichen); transform: rotate(45deg);
}
.about-photo { margin: 0; }
.about-photo img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; object-position: center 75%; }
.about-photo figcaption { margin-top: .7rem; font-size: .9rem; color: var(--muted); }

/* Contact */
.contact { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: clamp(2.5rem, 6vw, 5.5rem); align-items: start; }
.contact-info > p { color: rgba(255, 255, 255, .8); max-width: 42ch; }
.contact-list { margin: 2.25rem 0 0; display: grid; gap: 1.2rem; }
.contact-list dt { font-size: .9rem; font-weight: 600; color: #b8c2b5; }
.contact-list dd { margin: .1rem 0 0; font-size: 1.1rem; overflow-wrap: anywhere; }
.contact-list a { text-decoration-color: rgba(255, 255, 255, .35); text-underline-offset: .25em; }
.contact-list a:hover { text-decoration-color: #fff; }
.phone-people { display: grid; gap: .3rem; }
.phone-people a { white-space: nowrap; }
.contact-note { font-size: .95rem; color: rgba(255, 255, 255, .72); }
.contact-form { background: var(--quartz); color: var(--tar); padding: clamp(1.5rem, 4vw, 2.5rem); border-radius: var(--radius); }
.field { display: flex; flex-direction: column; gap: .35rem; margin-bottom: 1.1rem; min-width: 0; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
label { font-size: .9rem; font-weight: 600; }
.optional { font-weight: 400; color: var(--muted); }
input, select, textarea {
  font: inherit; color: var(--tar); background: #f6f6f4; width: 100%;
  border: 1px solid #cdcdc7; border-radius: var(--radius); padding: .7rem .85rem;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--lichen); box-shadow: 0 0 0 3px rgba(100, 112, 98, .25); }
.field.invalid input, .field.invalid textarea { border-color: #a63d2a; }
textarea { resize: vertical; }
.form-note { margin: 1rem 0 0; font-size: .92rem; color: var(--muted); min-height: 1.4em; }
.contact-form .botcheck { display: none; }
.contact-form button:disabled { opacity: .6; cursor: progress; }

/* Footer */
.site-footer { background-color: #242422; color: rgba(255, 255, 255, .7); padding: 2.25rem 0; font-size: .9rem; }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem 2rem; }
.footer-inner p { margin: 0; }
.footer-logo { width: 110px; height: auto; }

/* Lightbox */
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(20, 20, 19, .95); display: flex; align-items: center; justify-content: center; padding: 3rem 4.5rem; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lightbox button { position: absolute; background: rgba(255, 255, 255, .1); color: #fff; border: 0; border-radius: var(--radius); width: 48px; height: 48px; font-size: 2rem; line-height: 1; cursor: pointer; }
.lightbox button:hover { background: rgba(255, 255, 255, .22); }
.lb-close { top: 16px; right: 16px; }
.lb-prev { left: 16px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 16px; top: 50%; transform: translateY(-50%); }

/* Responsive */
@media (max-width: 1000px) {
  .project-head, .services, .about, .contact { grid-template-columns: 1fr; }
  .service-list > div { grid-template-columns: 12rem minmax(0, 1fr); }
  .feature-split { grid-template-columns: 1fr; }
  /* stacked below the main photo, tiles take the photos' own tall shape so nothing is cropped */
  .mosaic, .feature-split .mosaic { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: none; height: auto; min-height: 0; }
  .mosaic .zoom { aspect-ratio: 3 / 4; }
  .about-photo { max-width: 440px; }
}
@media (max-width: 760px) {
  .nav-toggle { display: block; }
  .nav-links {
    position: absolute; top: 72px; left: 0; right: 0; flex-direction: column; align-items: stretch; gap: 0;
    background: var(--drywall); border-bottom: 1px solid var(--rule); padding: .25rem var(--gutter) 1.25rem;
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links a:not(.btn) { padding: .85rem 0; border-bottom: 1px solid var(--rule); }
  .nav-links .btn { margin-top: 1rem; text-align: center; }
  .nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  .intro.is-3d { height: 280vh; }
  .intro .hud-br { bottom: auto; top: 76px; }
  /* on phones the scroll counter shares the bottom corner with the headline box, so it fades out as the box fades in */
  .intro .hud-tr { top: auto; bottom: 20px; right: auto; left: var(--gutter); text-align: left; opacity: max(0, 1 - 2 * var(--reveal, 0)); }
  .hero-panel { left: 12px; right: 12px; bottom: 12px; width: auto; padding: 1.4rem 1.25rem; }
  .hero-panel h1 { font-size: clamp(2.1rem, 9vw, 2.6rem); margin-bottom: .8rem; }

  .stages-deck, .stages-2 { grid-template-columns: 1fr; gap: 2rem; }
  .gallery-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
  .gallery-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
  .gallery-3 > :first-child { grid-column: span 2; }
  .stages-deck .stage-wide { grid-column: auto; }
  .service-list > div { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  :root { --gutter: 16px; }
  .mosaic, .feature-split .mosaic { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
  .field-row { grid-template-columns: 1fr; gap: 0; }
  .lightbox { padding: 4rem .75rem; }
  .lb-prev, .lb-next { top: auto; bottom: 16px; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
