/* Binga Contracting, decks, fences and interlock (dev preview).
   Design plan lives in README.md. Every colour, family and weight used on the
   page is a token here; a hex value anywhere below this block is a bug. */

:root {
  /* colour, each with the only things it may touch */
  --ground:  #ffffff;  /* the page, and the paper the drawing sits on */
  --ink:     #1f2b34;  /* text and the drawing's structural linework */
  --ink-2:   #56636d;  /* secondary text, hidden lines, paver joints, gravel */
  --draft:   #aab4bb;  /* secondary drawing: the house, soil hatching */
  --rule:    #e3e8eb;  /* hairlines, borders, empty photo plates */
  --cedar:   #8a4a1f;  /* buttons, links, focus ring, step numbers. Binga's brand colour (draft) */
  --cedar-deep: #6a3613; /* button hover only */
  --wood:    #efdcc4;  /* lumber in the drawing: board tops */
  --wood-2:  #dfc19d;  /* lumber: faces toward us */
  --wood-3:  #d2ad84;  /* lumber: faces in shade */
  --paver:   #d9dee1;  /* interlock field pavers */
  --paver-2: #c3cace;  /* interlock border course, cut faces */
  --sand:    #f0e3c4;  /* the sand bed in section only */
  --line:    #f0388f;  /* mason line: string lines in the drawing only. Never text, never a button */
  --lawn:    #6e8f52;  /* grass tufts and planter leaves only */

  /* type: Barlow Condensed for display, Barlow for reading. Weights are
     tokens so headings stay light. */
  --display: "Barlow Condensed", "Arial Narrow", "Segoe UI", sans-serif;
  --text: "Barlow", "Segoe UI", system-ui, sans-serif;
  --w-hair: 300;   /* hero and closing headlines */
  --w-head: 400;   /* every other heading */
  --w-body: 400;   /* running text */
  --w-mid: 500;    /* labels, nav, captions that need to hold up small */
  --w-strong: 600; /* buttons; the heaviest weight on the page */

  /* layout */
  --head: 64px;
  --gutter: max(20px, 5vw);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: var(--w-body) 1.0625rem/1.6 var(--text);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
h1, h2, h3 { font-family: var(--display); margin: 0; font-weight: var(--w-head); letter-spacing: -0.005em; line-height: 1.02; }
p { margin: 0 0 1em; }
a { color: var(--cedar); }
[id] { scroll-margin-top: calc(var(--head) + 16px); }

:focus-visible { outline: 3px solid var(--cedar); outline-offset: 3px; border-radius: 4px; }

.skip {
  position: absolute; left: 12px; top: -60px; z-index: 50;
  background: var(--cedar); color: var(--ground); padding: 10px 16px; border-radius: 6px;
  font-weight: var(--w-strong); text-decoration: none;
}
.skip:focus { top: 12px; }

.devbar {
  margin: 0; padding: 7px var(--gutter);
  font-size: 0.8rem; line-height: 1.4; color: var(--ink-2); text-align: center;
  border-bottom: 1px solid var(--rule);
}

/* ── header ─────────────────────────────────────────────────────────────── */
.top {
  position: sticky; top: 0; z-index: 30;
  height: var(--head);
  display: flex; align-items: center; gap: 24px;
  padding: 0 var(--gutter);
  background: rgb(255 255 255 / 0.88);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--rule);
}
.brand { display: flex; align-items: center; min-height: 44px; text-decoration: none; margin-right: auto; }
.brand__name { font: var(--w-strong) 1.45rem/1 var(--display); letter-spacing: 0.01em; color: var(--ink); text-transform: none; }
.brand__name span { font-weight: var(--w-hair); color: var(--ink-2); }
.top__nav { display: flex; gap: 26px; }
.top__nav a { color: var(--ink); text-decoration: none; font-weight: var(--w-mid); font-size: 0.95rem; padding: 8px 0; }
.top__nav a:hover { color: var(--cedar); text-decoration: underline; text-underline-offset: 5px; }

/* ── buttons and links ──────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 52px; padding: 0 26px;
  background: var(--cedar); color: var(--ground);
  font: var(--w-strong) 1rem/1 var(--text); letter-spacing: 0.02em; text-decoration: none;
  border: 2px solid var(--cedar); border-radius: 6px; cursor: pointer;
  transition: background-color 0.2s var(--ease-out), border-color 0.2s var(--ease-out);
}
.btn:hover { background: var(--cedar-deep); border-color: var(--cedar-deep); }
.btn--small { min-height: 42px; padding: 0 16px; font-size: 0.93rem; }
.btn--big { min-height: 60px; padding: 0 34px; font-size: 1.1rem; }
.textlink { display: inline-block; padding: 11px 0; color: var(--cedar); font-weight: var(--w-strong); text-decoration: underline; text-underline-offset: 5px; text-decoration-thickness: 1.5px; }
.textlink:hover { text-decoration-thickness: 3px; }

/* ── the build ──────────────────────────────────────────────────────────── */
.build {
  overflow-x: clip; /* a label near the edge must never widen the page */
  display: grid;
  grid-template-columns: minmax(0, 4.6fr) minmax(0, 7.4fr);
  column-gap: 3.5vw;
  padding: 0 var(--gutter);
}
.build__hero {
  grid-column: 1; grid-row: 1;
  min-height: calc(100svh - var(--head) - 34px);
  display: flex; flex-direction: column; justify-content: center;
  padding: 48px 0 64px;
}
.hero__title {
  font-weight: var(--w-hair);
  font-size: clamp(3.4rem, 6.6vw, 7.4rem);
  line-height: 0.94;
  letter-spacing: -0.01em;
  margin-bottom: 30px;
}
.hero__title .line { display: block; overflow: hidden; padding-bottom: 0.06em; margin-bottom: -0.06em; }
.hero__title .line > span { display: inline-block; }
.hero__lede { font-size: 1.16rem; color: var(--ink-2); max-width: 36ch; margin-bottom: 30px; }
.hero__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 26px; margin-bottom: 18px; }
.hero__fine { font-size: 0.92rem; color: var(--ink-2); margin: 0; }

.build__stage { grid-column: 2; grid-row: 1 / 3; }
.stage {
  position: sticky; top: var(--head);
  height: calc(100svh - var(--head));
  margin: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.stage__frame {
  position: relative;
  width: min(100%, calc((100svh - var(--head) - 70px) * 1.111));
  aspect-ratio: 1000 / 900;
}
.stage__cap { font-size: 0.8rem; color: var(--ink-2); margin-top: 6px; text-align: center; }

.steps { grid-column: 1; grid-row: 2; list-style: none; margin: 0; padding: 0; }
.step { min-height: 100svh; }
.step--long { min-height: 170svh; }
.step__in { position: sticky; top: calc(var(--head) + 18svh); padding: 32px 0 64px; max-width: 30rem; }
.step__n {
  width: 44px; height: 44px; margin: 0 0 22px;
  display: grid; place-items: center;
  border: 1.5px solid var(--cedar); border-radius: 50%;
  font: var(--w-head) 1.2rem/1 var(--display); color: var(--cedar);
}
.step h2 { font-size: clamp(2.3rem, 3.8vw, 3.5rem); margin-bottom: 18px; }
.step p { color: var(--ink-2); font-size: 1.12rem; }

/* the drawing */
.scene { display: block; width: 100%; height: 100%; overflow: visible; }
.scene path, .scene ellipse {
  fill: none; stroke: var(--ink); stroke-width: 0.8; stroke-linecap: round; stroke-linejoin: round;
}
.scene .lot-top, .scene .cut { fill: var(--ground); stroke-width: 1.4; }
.scene .lot .hatch { stroke: var(--draft); stroke-width: 0.7; }
.scene .grass { stroke: var(--lawn); stroke-width: 1.1; }
.scene .house path { stroke: var(--draft); fill: var(--ground); stroke-width: 1.3; }
.scene .house .thin { fill: none; stroke-width: 0.55; }
.scene .wood .tp { fill: var(--wood); }
.scene .wood .fr { fill: var(--wood-2); }
.scene .wood .sd { fill: var(--wood-3); }
.scene .wood .bal { stroke-width: 0.75; }
.scene .wood .hand { stroke-width: 2.2; }
.scene .ghost path { stroke: var(--ink-2); stroke-width: 0.9; stroke-dasharray: 4 3; }
.scene .str { stroke: var(--line); stroke-width: 1.3; }
.scene .frost { stroke: var(--ink-2); stroke-width: 1.1; stroke-dasharray: 10 5; }
.scene .stake { stroke: var(--ink); stroke-width: 1.8; }
.scene .gravel .layer { fill: var(--ground); stroke-width: 1; }
.scene .gravel .stones { stroke: var(--ink-2); stroke-width: 0.6; }
.scene .sand .layer { fill: var(--sand); stroke-width: 1; }
.scene .prow path { fill: var(--paver); stroke: var(--ink-2); stroke-width: 0.5; }
.scene .pborder path { fill: var(--paver-2); stroke: var(--ink-2); stroke-width: 0.6; }
.scene .pot { fill: var(--ground); stroke-width: 1.1; }
.scene .leaves { stroke: var(--lawn); stroke-width: 1.5; }

/* labels laid over the drawing; main.js shows the ones for the current step */
.notes { position: absolute; inset: 0; pointer-events: none; }
.note { position: absolute; display: flex; align-items: center; opacity: 0; transform-origin: 0 50%; }
.note i { width: 11px; height: 11px; margin: -5.5px 0 0 -5.5px; border-radius: 50%; background: var(--ground); border: 2.5px solid var(--cedar); flex: none; position: absolute; left: 0; top: 0; }
.note b {
  position: absolute; top: -14px; left: 14px;
  font: var(--w-mid) 0.84rem/1.25 var(--text); color: var(--ink); letter-spacing: 0.01em;
  background: var(--ground); border: 1px solid var(--rule); border-radius: 6px;
  padding: 5px 9px; white-space: nowrap;
}
.note--l b { left: auto; right: 14px; }

/* JS is running: the yard starts empty and the steps build it. With no JS
   the finished yard shows, which is the useful picture. */
html.js .scene .b { opacity: 0; }
html:not(.js) .scene .strings { display: none; } /* string lines come down before the yard is finished */
html.js .scene .str { stroke-dasharray: 1; stroke-dashoffset: 1; }
@media (prefers-reduced-motion: no-preference) {
  html.js .scene .lot [pathLength], html.js .scene .house [pathLength] { stroke-dasharray: 1; stroke-dashoffset: 1; }
  html.js .scene .lot .hatch, html.js .scene .house .thin, html.js .scene .house .eave, html.js .scene .grass { opacity: 0; }
  html.js .hero__title .line > span { transform: translateY(110%); }
}

/* ── services ───────────────────────────────────────────────────────────── */
.services, .photos { padding: 130px var(--gutter) 110px; border-top: 1px solid var(--rule); }
.services h2, .photos h2, .area h2, .quote h2 { font-size: clamp(2.4rem, 4.6vw, 4rem); margin-bottom: 40px; }
.services__list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 4vw; border-top: 1px solid var(--ink); }
.service { padding: 26px 0 10px; }
.service h3 { font-size: clamp(1.7rem, 2.4vw, 2.2rem); margin-bottom: 12px; }
.service p { color: var(--ink-2); font-size: 1.08rem; max-width: 34ch; }
.fine { font-size: 0.9rem; color: var(--ink-2); margin: 26px 0 0; }

/* ── photos (empty plates until the owner sends real ones) ──────────────── */
.photos { padding-top: 110px; }
.photos__grid { display: grid; grid-template-columns: 5fr 4fr 4fr; gap: 18px; }
.plate {
  aspect-ratio: 4 / 3; border: 1.5px dashed var(--draft); border-radius: 6px;
  display: grid; place-items: center;
  font: var(--w-mid) 0.95rem/1 var(--text); color: var(--ink-2);
}
.plate--a { aspect-ratio: auto; grid-row: span 1; }

/* ── area ───────────────────────────────────────────────────────────────── */
.area { padding: 120px var(--gutter); border-top: 1px solid var(--rule); text-align: center; }
.area h2 { font-weight: var(--w-hair); font-size: clamp(2.8rem, 7.4vw, 6.6rem); margin-bottom: 22px; }
.area p { font-size: 1.16rem; color: var(--ink-2); max-width: 40ch; margin: 0 auto; }

/* ── quote ──────────────────────────────────────────────────────────────── */
.quote {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 6vw; align-items: start;
  padding: 120px var(--gutter) 130px; border-top: 1px solid var(--rule);
}
.quote__text p { font-size: 1.16rem; color: var(--ink-2); max-width: 36ch; }
.form { display: grid; gap: 18px; }
.form__note { margin: 0; padding: 12px 14px; border: 1px solid var(--rule); border-left: 3px solid var(--cedar); border-radius: 4px; font-size: 0.92rem; color: var(--ink-2); }
.field { display: grid; gap: 6px; font-weight: var(--w-mid); font-size: 0.95rem; color: var(--ink); margin: 0; }
.field input, .field select, .field textarea {
  font: var(--w-body) 1rem/1.4 var(--text); color: var(--ink);
  min-height: 48px; padding: 10px 12px;
  border: 1px solid var(--draft); border-radius: 4px; background: var(--ground);
}
.field textarea { resize: vertical; }
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible { border-color: var(--cedar); }
.field--set { border: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 22px; }
.field--set legend { padding: 0; margin-bottom: 6px; width: 100%; }
.check { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-weight: var(--w-body); font-size: 1rem; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--cedar); margin: 0; }
.form .btn { justify-self: start; }
.form__sent { margin: 0; font-weight: var(--w-mid); color: var(--cedar); }

.foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px;
  padding: 28px var(--gutter) 40px; border-top: 1px solid var(--rule);
  font-size: 0.85rem; color: var(--ink-2);
}
.foot p { margin: 0; }

/* ── tablet and phone ───────────────────────────────────────────────────── */
@media (max-width: 959px) {
  :root { --head: 58px; }
  .top__nav { display: none; }
  .build { display: block; padding: 0; }
  .build__hero { min-height: 0; padding: 44px var(--gutter) 28px; }
  .build__stage {
    position: sticky; top: var(--head); z-index: 5;
    background: var(--ground);
    border-bottom: 1px solid var(--rule);
  }
  .stage { position: static; height: auto; padding: 6px var(--gutter) 4px; }
  .stage__frame { width: min(100%, calc(46svh * 1.111)); }
  .stage__cap { display: none; }
  .steps { padding: 0 var(--gutter); }
  .step { min-height: 78svh; }
  .step--long { min-height: 125svh; }
  /* narrow phones wrap the text taller; give it room to stay pinned */
  @media (max-width: 380px) { .step { min-height: 92svh; } .step--long { min-height: 135svh; } }
  /* the text sticks just under the pinned drawing while its step plays */
  .step__in { top: calc(var(--head) + min((100vw - 2 * max(20px, 5vw)) * 0.9, 46svh) + 12px); padding: 22px 0 40px; }
  .step__n { width: 38px; height: 38px; margin-bottom: 14px; }
  .note b { font-size: 0.72rem; padding: 3px 6px; top: -11px; left: 10px; white-space: normal; width: max-content; max-width: 9.5em; }
  .note--l b { left: auto; right: 10px; }

  .services, .photos { padding: 90px var(--gutter); }
  .services__list { grid-template-columns: 1fr; }
  .service { border-bottom: 1px solid var(--rule); padding-bottom: 14px; }
  .photos__grid { grid-template-columns: 1fr 1fr; }
  .plate--a { grid-column: 1 / -1; aspect-ratio: 16 / 9; }
  .area { padding: 100px var(--gutter); }
  .quote { grid-template-columns: 1fr; gap: 30px; padding: 90px var(--gutter); }
}
@media (max-width: 640px) {
  .top .btn--small { padding: 0 14px; font-size: 0.88rem; min-height: 44px; }
  .brand__name { font-size: 1.3rem; }
  .form .btn { justify-self: stretch; }
}

/* ── short phones held upright (iPhone SE and similar) ─────────────────────
   The step text cannot fit under the pinned drawing, so it scrolls normally
   instead of pinning, and the drawing gets a little smaller. */
@media (max-width: 959px) and (orientation: portrait) and (max-height: 700px) {
  .stage__frame { width: min(100%, calc(40svh * 1.111)); }
  /* the text sits below a run of empty scroll, so when its step finishes
     playing the text is in view under the drawing, not hidden behind it */
  .step__in { position: relative; top: auto; padding: 0 0 24px; }
  .step { min-height: 0; padding-top: 55svh; }
  .step--long { min-height: 0; padding-top: 86svh; }
  .step h2 { font-size: 2rem; }
  .step p { font-size: 1.02rem; }
}

/* ── phones turned sideways ────────────────────────────────────────────────
   Stacking leaves a strip of drawing and a strip of text, both too small.
   Side by side, like the desktop, with everything scaled to the short screen. */
@media (max-width: 959px) and (orientation: landscape) and (max-height: 600px) {
  .build {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
    column-gap: 24px; padding: 0 var(--gutter);
  }
  .build__hero { grid-column: 1; grid-row: 1; min-height: calc(100svh - var(--head)); padding: 24px 0; }
  .hero__title { font-size: clamp(2.2rem, 12svh, 3.4rem); margin-bottom: 14px; }
  .hero__lede { font-size: 0.98rem; line-height: 1.5; margin-bottom: 16px; }
  .hero__actions { margin-bottom: 6px; }
  .build__stage { grid-column: 2; grid-row: 1 / 3; position: static; z-index: auto; background: none; border: 0; }
  .stage { position: sticky; top: var(--head); height: calc(100svh - var(--head)); padding: 8px 0; justify-content: flex-start; }
  /* sized so the whole drawing fits on first load too, under the dev notice */
  .stage__frame { width: min(100%, calc((100svh - var(--head) - 68px) * 1.111)); }
  .steps { grid-column: 1; grid-row: 2; padding: 0; }
  .step { min-height: 100svh; }
  .step--long { min-height: 160svh; }
  .step__in { position: sticky; top: calc(var(--head) + 3svh); padding: 10px 0 20px; }
  .step__n { width: 30px; height: 30px; margin-bottom: 8px; font-size: 0.95rem; }
  .step h2 { font-size: 1.7rem; margin-bottom: 8px; }
  .step p { font-size: 0.96rem; line-height: 1.5; margin-bottom: 0.6em; }
}

/* small print gets a little more weight so it holds up */
.devbar, .stage__cap, .hero__fine, .foot, .fine { font-weight: var(--w-mid); }
