/* ==========================================================================
   VOLUTE STAIRMAKERS
   Design language: workshop technical. A CAD viewport crossed with a spec
   sheet. Hairline rules, tracked mono microlabels, one warm timber accent
   against cold graphite. Motion is mechanical and precise, never soft.
   All animation is transform and opacity only.
   ========================================================================== */

/* --- Layer 1: primitives ------------------------------------------------ */
:root {
  --ink:        #0B0C0D;
  --graphite:   #111315;
  --steel:      #17191C;
  --steel-2:    #1E2226;

  --bone:       #E9E5DB;
  --bone-2:     #A8A399;
  --bone-3:     #8A857C;   /* 5.3:1 on ink, so the mono microlabels still pass */

  --oak:        #C9954C;
  --oak-lift:   #E0B26E;
  --blueprint:  #7FA6BE;
  --verdict-ok: #86A87F;
  --verdict-no: #C97F4A;

  --hair:       rgba(233, 229, 219, 0.11);
  --hair-2:     rgba(233, 229, 219, 0.06);

  --s1: 0.25rem;  --s2: 0.5rem;   --s3: 0.75rem;  --s4: 1rem;
  --s5: 1.5rem;   --s6: 2rem;     --s7: 3rem;     --s8: 4.5rem;
  --s9: 7rem;

  --sans: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Spline Sans Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Motion: precise, mechanical, decisive. Never bouncy. */
  --ease:    cubic-bezier(0.22, 1, 0.36, 1);
  --ease-io: cubic-bezier(0.68, 0, 0.26, 1);
  --t-fast: 200ms;
  --t-med:  420ms;
  --t-slow: 640ms;
}

/* --- Layer 2: semantics ------------------------------------------------- */
:root {
  --bg:        var(--ink);
  --bg-raise:  var(--graphite);
  --bg-panel:  var(--steel);
  --fg:        var(--bone);
  --fg-mute:   var(--bone-2);
  --fg-faint:  var(--bone-3);
  --accent:    var(--oak);
  --rule:      var(--hair);
  --shell:     1440px;
  --gutter:    clamp(1.25rem, 4.5vw, 4rem);
}

/* --- Reset -------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.62;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
h1, h2, h3, p, dl, dd, figure, ol, ul { margin: 0; }
ol, ul { padding: 0; list-style: none; }
img, svg, canvas { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
legend { padding: 0; }

::selection { background: var(--oak); color: var(--ink); }

:focus-visible {
  outline: 2px solid var(--oak-lift);
  outline-offset: 3px;
  border-radius: 1px;
}

.skip {
  position: absolute; top: 0; left: 0; z-index: 200;
  padding: var(--s3) var(--s4);
  background: var(--oak); color: var(--ink);
  font-family: var(--mono); font-size: 0.75rem;
  transform: translateY(-110%);
  transition: transform var(--t-fast) var(--ease);
}
.skip:focus { transform: translateY(0); }

/* --- Texture ------------------------------------------------------------ */
.grain {
  position: fixed; inset: 0; z-index: 90; pointer-events: none;
  opacity: 0.05; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* --- Shell -------------------------------------------------------------- */
.shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* --- Shared type -------------------------------------------------------- */
.eyebrow {
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 400;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-faint);
  display: flex; align-items: center; gap: 0.7em;
}
.dot { width: 3px; height: 3px; background: var(--oak); border-radius: 50%; flex: none; }
.sep { color: var(--fg-faint); }

.sect__h {
  font-size: clamp(1.5rem, 2.4vw, 2rem);
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1.14;
}
.sect__h--big {
  font-size: clamp(1.9rem, 4.2vw, 3.35rem);
  line-height: 1.06;
  letter-spacing: -0.035em;
  max-width: 19ch;
}
.sect__head { margin-bottom: clamp(2.5rem, 5vw, 4.5rem); display: grid; gap: var(--s4); }
.sect__note { color: var(--fg-mute); max-width: 46ch; }

/* --- Buttons ------------------------------------------------------------ */
.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px;
  padding: 0.85rem 1.4rem;
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  border: 1px solid var(--rule);
  overflow: hidden;
  isolation: isolate;
  cursor: pointer;
  touch-action: manipulation;
}
.btn > span { position: relative; z-index: 2; }
.btn::before {
  content: ""; position: absolute; inset: 0; z-index: 1;
  transform: scaleY(0); transform-origin: 50% 100%;
  transition: transform var(--t-med) var(--ease);
}
.btn--solid { background: var(--oak); color: var(--ink); border-color: var(--oak); font-weight: 600; }
.btn--solid::before { background: var(--oak-lift); }
.btn--line::before, .btn--ghost::before { background: var(--bone); }
.btn--line:hover, .btn--ghost:hover, .btn--line:focus-visible, .btn--ghost:focus-visible { color: var(--ink); }
.btn:hover::before, .btn:focus-visible::before { transform: scaleY(1); }
.btn--ghost { font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; min-height: 44px; padding: 0.6rem 1.1rem; }

/* --- Masthead ----------------------------------------------------------- */
.masthead {
  position: sticky; top: 0; z-index: 80;
  background: rgba(11, 12, 13, 0.88);
  border-bottom: 1px solid var(--rule);
}
@supports (backdrop-filter: blur(8px)) {
  .masthead { backdrop-filter: blur(10px); }
}
.masthead__in {
  display: flex; align-items: center; gap: var(--s5);
  min-height: 68px;
}
.mark { display: flex; align-items: center; gap: 0.6rem; margin-right: auto; align-self: stretch; }
.mark__glyph { width: 22px; height: 22px; fill: none; stroke: var(--oak); stroke-width: 1.4; stroke-linecap: round; }
.mark__word {
  font-size: 0.9375rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.24em;
}
.nav { display: none; gap: var(--s5); }
.nav a {
  position: relative;
  font-family: var(--mono); font-size: 0.75rem;
  letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--fg-mute); padding-block: 0.4rem;
}
/* The nav shows from 900px up, which includes touch tablets, so each link
   gets a 44px hit area without the visual box moving. */
.nav a::before { content: ""; position: absolute; inset: -7px -8px; }
.nav a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: var(--oak);
  transform: scaleX(0); transform-origin: 0 50%;
  transition: transform var(--t-med) var(--ease);
}
.nav a:hover, .nav a:focus-visible { color: var(--fg); }
.nav a:hover::after, .nav a:focus-visible::after { transform: scaleX(1); }
.masthead__cta { padding-inline: 0.8rem; }
.t-long { display: none; }
@media (min-width: 480px) { .t-long { display: inline; } }
@media (min-width: 900px) {
  .nav { display: flex; }
  .masthead__cta { padding-inline: 1.1rem; }
}

/* --- Hero --------------------------------------------------------------- */
.hero { position: relative; padding-block: clamp(2.5rem, 6vw, 5rem) clamp(3rem, 7vw, 6rem); }
.rules { display: none; }
@media (min-width: 900px) {
  .rules {
    display: grid; grid-template-columns: repeat(12, 1fr);
    position: absolute; inset: 0;
    max-width: var(--shell); margin-inline: auto;
    padding-inline: var(--gutter);
    pointer-events: none;
  }
  .rules i { border-left: 1px solid var(--hair-2); }
  .rules i:last-child { border-right: 1px solid var(--hair-2); }
}
.hero__in { position: relative; display: grid; gap: clamp(2.5rem, 5vw, 4rem); }
@media (min-width: 1000px) {
  .hero__in { grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr); align-items: center; }
}

.hero__h1 {
  font-size: clamp(2.3rem, 5.2vw, 4.25rem);
  font-weight: 500;
  line-height: 1.06;
  letter-spacing: -0.04em;
  margin-block: var(--s5) var(--s6);
}
/* The mask box is deliberately much taller than the text box. Ascenders and
   descenders overflow a 1.06 line box by about 0.08em each side, so 0.3em of
   padding leaves a wide margin before the overflow that drives the reveal
   could ever shave a glyph. */
.line {
  display: block; overflow: hidden;
  padding-block: 0.3em; margin-block: -0.3em;
}
.line > span {
  display: block;
  transform: translateY(115%);
  transition: transform 900ms var(--ease);
}
.line:nth-child(2) > span { transition-delay: 80ms; }
.line:nth-child(3) > span { transition-delay: 160ms; }
.is-in .line > span, .hero.is-in .line > span { transform: translateY(0); }

.hero__lede { color: var(--fg-mute); max-width: 48ch; font-size: clamp(0.9375rem, 1.1vw, 1.0625rem); }
.hero__acts { display: flex; flex-wrap: wrap; gap: var(--s3); margin-top: var(--s6); }

/* --- Stage (3D viewport) ------------------------------------------------ */
.stage { position: relative; }
.stage__frame {
  position: relative;
  border: 1px solid var(--rule);
  background:
    radial-gradient(120% 90% at 50% 8%, rgba(127,166,190,0.07), transparent 62%),
    linear-gradient(180deg, var(--steel) 0%, var(--ink) 100%);
  padding: var(--s4);
}
.bracket { position: absolute; width: 13px; height: 13px; pointer-events: none; }
.bracket--tl { top: -1px; left: -1px; border-top: 1px solid var(--oak); border-left: 1px solid var(--oak); }
.bracket--tr { top: -1px; right: -1px; border-top: 1px solid var(--oak); border-right: 1px solid var(--oak); }
.bracket--bl { bottom: -1px; left: -1px; border-bottom: 1px solid var(--oak); border-left: 1px solid var(--oak); }
.bracket--br { bottom: -1px; right: -1px; border-bottom: 1px solid var(--oak); border-right: 1px solid var(--oak); }

.stage__tag {
  position: absolute; z-index: 3;
  font-family: var(--mono); font-size: 0.625rem;
  letter-spacing: 0.13em; text-transform: uppercase;
  color: var(--fg-faint);
}
.stage__tag--a { top: 1.15rem; left: 1.15rem; }
.stage__tag--b { top: 1.15rem; right: 1.15rem; color: var(--blueprint); }
.stage__tag--b.is-idle { animation: pulse 2.6s var(--ease-io) infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.42; } }

.stage__canvas {
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
}
@media (min-width: 700px) { .stage__canvas { aspect-ratio: 16 / 12; } }
@media (min-width: 1000px) { .stage__canvas { aspect-ratio: auto; height: clamp(400px, 56svh, 620px); } }

#scene {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  /* Vertical swipes scroll the page, horizontal drags turn the stair. */
  touch-action: pan-y;
  cursor: grab;
}
#scene.is-drag { cursor: grabbing; }
#scene:focus-visible { outline-offset: -3px; }

.stage__fallback {
  position: absolute; inset: 0; z-index: 2;
  display: grid; place-content: center; gap: var(--s4);
  transition: opacity var(--t-slow) var(--ease);
}
.stage__fallback.is-gone { opacity: 0; pointer-events: none; }
.stage__fallback svg { width: min(70%, 320px); margin-inline: auto; }
.fb-stair path { fill: none; stroke: var(--blueprint); stroke-width: 1.5; opacity: 0.85; }
.fb-thin { stroke-width: 0.75; opacity: 0.4 !important; }
.fb-dash { stroke-dasharray: 5 5; }
.stage__fbtext {
  font-family: var(--mono); font-size: 0.6875rem; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--fg-faint); text-align: center;
}

.stage__ticks {
  display: flex; justify-content: space-between;
  margin-top: var(--s3); padding-inline: 2px;
}
.stage__ticks i { width: 1px; height: 6px; background: var(--hair); }
.stage__ticks i:nth-child(4n+1) { height: 11px; background: var(--hair); }

/* --- Readout ------------------------------------------------------------ */
.readout {
  border: 1px solid var(--rule); border-top: 0;
  background: var(--bg-raise);
}
.readout__grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
}
@media (min-width: 560px) { .readout__grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1000px) { .readout__grid { grid-template-columns: repeat(6, 1fr); } }

.cell {
  padding: var(--s4) var(--s4) 0.9rem;
  border-right: 1px solid var(--hair-2);
  border-bottom: 1px solid var(--hair-2);
}
.cell dt {
  font-family: var(--mono); font-size: 0.5625rem;
  letter-spacing: 0.15em; text-transform: uppercase;
  color: var(--fg-faint); margin-bottom: 0.5rem;
}
.cell dd {
  margin: 0;
  font-size: clamp(1.25rem, 2.1vw, 1.6rem);
  font-weight: 500; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  display: flex; align-items: baseline; gap: 0.28em;
}
.cell dd i {
  font-family: var(--mono); font-style: normal;
  font-size: 0.625rem; letter-spacing: 0.09em;
  color: var(--fg-faint); text-transform: uppercase;
}

.readout__check {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.85rem var(--s4);
  font-family: var(--mono); font-size: 0.6875rem;
  letter-spacing: 0.06em;
}
.readout__pip { width: 6px; height: 6px; border-radius: 50%; flex: none; }
.readout__check[data-state="ok"] { color: var(--verdict-ok); }
.readout__check[data-state="ok"] .readout__pip { background: var(--verdict-ok); }
.readout__check[data-state="no"] { color: var(--verdict-no); }
.readout__check[data-state="no"] .readout__pip { background: var(--verdict-no); }

/* --- Control desk ------------------------------------------------------- */
.desk {
  border-block: 1px solid var(--rule);
  background: var(--bg-raise);
  padding-block: clamp(3rem, 6vw, 5.5rem);
}
.desk__head { display: grid; gap: var(--s3); margin-bottom: clamp(2rem, 4vw, 3rem); }

.console { display: grid; gap: var(--s6); }
@media (min-width: 780px) {
  .console {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    column-gap: var(--s6); row-gap: var(--s7);
  }
  .grp--ftf { grid-column: 1 / 2; }
  .grp--treads { grid-column: 2 / 4; }
}

.grp legend {
  display: flex; align-items: baseline; gap: 0.6rem;
  font-family: var(--mono); font-size: 0.6875rem;
  letter-spacing: 0.15em; text-transform: uppercase;
  color: var(--fg-mute);
  padding-bottom: var(--s3); margin-bottom: var(--s4);
  border-bottom: 1px solid var(--rule);
  width: 100%;
}
.idx { color: var(--oak); }

.pills { display: flex; flex-wrap: wrap; gap: var(--s2); }
.pills input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.pills label {
  position: relative;
  display: inline-flex; align-items: center; gap: 0.5rem;
  min-height: 44px; padding: 0.55rem 0.95rem;
  border: 1px solid var(--rule);
  font-size: 0.8125rem; color: var(--fg-mute);
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  transition: transform var(--t-fast) var(--ease);
}
/* The selected state carries a real background rather than a painted pseudo
   element, so the label stays legible even where decorative layers do not
   render. A console switch should flip, not fade, so there is no colour
   transition here at all. The press scale is the only motion. */
.pills label > * { position: relative; }
.pills label:hover { color: var(--fg); border-color: var(--bone-2); }
.pills label:active { transform: scale(0.97); }
.pills input:checked + label {
  background: var(--bone);
  color: var(--ink);
  border-color: var(--bone);
  font-weight: 500;
}
.pills input:focus-visible + label { outline: 2px solid var(--oak-lift); outline-offset: 2px; }
.pills--num label { min-width: 56px; justify-content: center; font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 0.8125rem; }

.sw { width: 11px; height: 11px; flex: none; border-radius: 1px; }
.sw--oak { background: #C08B4E; }
.sw--ash { background: #2C2926; box-shadow: inset 0 0 0 1px rgba(233,229,219,0.28); }
.sw--walnut { background: #6B4530; }

.desk__foot {
  margin-top: clamp(2rem, 4vw, 3rem);
  padding-top: var(--s5);
  border-top: 1px solid var(--rule);
  max-width: 78ch;
  color: var(--fg-faint);
  font-size: 0.875rem;
}

/* --- Workshop steps ----------------------------------------------------- */
.work-sec { padding-block: clamp(4rem, 9vw, 8rem); }
.steps { display: grid; gap: 1px; background: var(--rule); border: 1px solid var(--rule); }
@media (min-width: 640px) { .steps { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1060px) { .steps { grid-template-columns: repeat(4, 1fr); } }
.step {
  background: var(--bg);
  padding: var(--s5) var(--s5) var(--s7);
  display: grid; align-content: start; gap: var(--s3);
}
.step__n {
  font-family: var(--mono); font-size: 0.6875rem;
  letter-spacing: 0.16em; color: var(--oak);
}
.step h3 { font-size: 1.125rem; font-weight: 500; letter-spacing: -0.015em; }
.step p { color: var(--fg-mute); font-size: 0.9375rem; }

/* --- Timbers ------------------------------------------------------------ */
.timbers { padding-block: clamp(4rem, 9vw, 8rem); border-top: 1px solid var(--rule); }
.tgrid { display: grid; gap: var(--s5); }
@media (min-width: 820px) { .tgrid { grid-template-columns: repeat(3, 1fr); gap: var(--s6); } }
.tcard {
  display: grid; align-content: start; gap: var(--s3);
  padding-top: var(--s5);
  border-top: 1px solid var(--bone);
}
.tcard__chip { width: 100%; height: 3px; border-radius: 0; }
.tcard h3 { font-size: 1.25rem; font-weight: 500; letter-spacing: -0.02em; }
.tcard__meta {
  font-family: var(--mono); font-size: 0.625rem;
  letter-spacing: 0.13em; text-transform: uppercase; color: var(--fg-faint);
}
.tcard p:last-child { color: var(--fg-mute); font-size: 0.9375rem; }

/* --- Jobs table --------------------------------------------------------- */
.jobs { padding-block: clamp(4rem, 9vw, 8rem); border-top: 1px solid var(--rule); }
.jtable { border-top: 1px solid var(--rule); }
.jrow {
  display: grid; gap: var(--s2);
  padding-block: var(--s5);
  border-bottom: 1px solid var(--rule);
}
@media (min-width: 900px) {
  .jrow {
    grid-template-columns: 3fr 1.4fr 5fr 1.4fr;
    gap: var(--s5); align-items: start;
  }
}
.jrow--head { display: none; }
@media (min-width: 900px) {
  .jrow--head {
    display: grid; padding-block: var(--s3);
    font-family: var(--mono); font-size: 0.5625rem;
    letter-spacing: 0.16em; text-transform: uppercase; color: var(--fg-faint);
  }
}
.jrow__t { font-size: clamp(1.0625rem, 1.6vw, 1.375rem); font-weight: 500; letter-spacing: -0.02em; }
.jrow__f { font-family: var(--mono); font-size: 0.6875rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--oak); }
.jrow__s { color: var(--fg-mute); font-size: 0.9375rem; }
.jrow__d { font-family: var(--mono); font-size: 0.8125rem; color: var(--fg-faint); font-variant-numeric: tabular-nums; }

/* --- Contact ------------------------------------------------------------ */
.contact { padding-block: clamp(4rem, 9vw, 8rem); border-top: 1px solid var(--rule); background: var(--bg-raise); }
.contact__in { display: grid; gap: clamp(2.5rem, 5vw, 4.5rem); }
@media (min-width: 940px) { .contact__in { grid-template-columns: 1.25fr 0.75fr; } }
.contact__lead { display: grid; gap: var(--s4); align-content: start; }
.contact__p { color: var(--fg-mute); max-width: 52ch; }
.vcard { display: grid; gap: var(--s5); align-content: start; }
.vcard div { display: grid; gap: var(--s2); padding-top: var(--s4); border-top: 1px solid var(--rule); }
.vcard dt {
  font-family: var(--mono); font-size: 0.5625rem;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--fg-faint);
}
.vcard dd { margin: 0; font-size: 0.9375rem; color: var(--fg-mute); line-height: 1.55; }

/* --- Footer ------------------------------------------------------------- */
.foot { border-top: 1px solid var(--rule); padding-block: var(--s6); }
.foot__in { display: grid; gap: var(--s3); }
@media (min-width: 780px) {
  .foot__in { grid-template-columns: auto 1fr auto; align-items: center; gap: var(--s6); }
}
.foot__mark { font-size: 0.8125rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.2em; }
.foot__reg, .foot__credit { font-family: var(--mono); font-size: 0.6875rem; letter-spacing: 0.06em; color: var(--fg-faint); }
@media (min-width: 780px) { .foot__credit { text-align: right; } }
.foot__credit a { position: relative; color: var(--fg-mute); }
.foot__credit a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -3px; height: 1px;
  background: var(--oak); transform: scaleX(0); transform-origin: 0 50%;
  transition: transform var(--t-med) var(--ease);
}
.foot__credit a:hover { color: var(--fg); }
.foot__credit a:hover::after, .foot__credit a:focus-visible::after { transform: scaleX(1); }

/* --- Scroll reveal ------------------------------------------------------ */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity var(--t-slow) var(--ease), transform var(--t-slow) var(--ease);
}
.reveal[data-d="1"] { transition-delay: 70ms; }
.reveal[data-d="2"] { transition-delay: 140ms; }
.reveal[data-d="3"] { transition-delay: 210ms; }
.reveal.is-in { opacity: 1; transform: none; }
.no-js .reveal, .no-js .line > span { opacity: 1; transform: none; }

/* --- Reduced motion ----------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
  .reveal { opacity: 1; transform: none; }
  .line > span { transform: none; }
  .stage__tag--b.is-idle { animation: none; }
}
