/* =====================================================================
   ENVOY TEARDOWN — a pinned three.js stage with the story scrolling over it.
   Everything is scoped under .td so none of it leaks into the rest of the page.
   ===================================================================== */
.td {
  --accent: #5b8cff;
  --ink: #f3f5f8;          /* light text, also the light end of the story */
  --night: #0c0e11;        /* the dark end: the portfolio's slab black */
  --paper: #f6f8fa;        /* grid paper once the board is taken apart */
  --pencil: #14171b;       /* line work on paper */
  --bg: var(--night);      /* these two are animated by teardown.js */
  --fg: var(--ink);
  --title: "Inter Tight", "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  --gutter: clamp(16px, 3vw, 40px);
  --in-t: 8vh;             /* the black card's inset before it opens to full bleed */
  --in-x: max(16px, 5vw);
  position: relative;
  background: var(--page);
  color: var(--fg);
  font: 400 14px/1.6 var(--mono);
  -webkit-font-smoothing: antialiased;
}
.td ::selection { background: var(--accent); color: #fff; }
.td a { color: inherit; }
.td button { font: inherit; color: inherit; }
.td :focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---------------------------------------------------------------- stage */
.td-stage { position: sticky; top: 0; z-index: 0; height: 100vh; height: 100svh; overflow: hidden; }
.td-frame {
  position: absolute; inset: 0; overflow: hidden;
  background: var(--bg);
  clip-path: inset(var(--in-t) var(--in-x));      /* teardown.js opens this up as you scroll in */
}
.td #gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; opacity: 0; }
.td .paper-grid {
  position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background-image: linear-gradient(rgba(60,76,98,.07) 1px, transparent 1px), linear-gradient(90deg, rgba(60,76,98,.07) 1px, transparent 1px);
  background-size: 44px 44px; background-position: center;
}
/* the to-scale blueprint, laid exactly over the board while the camera looks straight down */
.bp-overlay { position: absolute; inset: 0; pointer-events: none; opacity: 0; }
.bp-overlay .bp { position: absolute; left: 0; top: 0; width: auto; height: auto; max-height: none; flex: none; transform-origin: 0 0; overflow: visible; }
.bp-overlay .bp .bp-lines .enc { stroke-width: .4; }
.bp-overlay .bp .bp-lines .board { stroke: rgba(255,255,255,.35); }

.td #leaders { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; overflow: visible; }
.td #leaders polyline, .td #leaders line { fill: none; stroke: var(--fg); stroke-width: 1; }
.td #leaders circle { fill: var(--accent); }
.td #leaders .dim line { stroke: var(--accent); }
.td #leaders .dim text { fill: var(--accent); font: 500 11px var(--mono); letter-spacing: .06em; }
.td .labels { position: absolute; z-index: 2; top: 50%; margin: 0; padding: 0; list-style: none; pointer-events: none;
  display: grid; gap: 7px; font-size: 12px; letter-spacing: .05em; white-space: nowrap; color: var(--fg); }
.td .labels-l { left: var(--gutter); }
.td .labels-r { right: var(--gutter); text-align: right; }
.td .labels li { display: flex; gap: 8px; }
.td .labels-r li { justify-content: flex-end; }
.td .labels .ref { font-weight: 600; color: var(--accent); }

.td .tip { position: absolute; z-index: 12; pointer-events: none; padding: 5px 9px; font-size: 11.5px; letter-spacing: .05em;
  background: #000; color: #fff; transform: translate(14px, -50%); white-space: nowrap; }
.td .tip b { color: var(--accent); font-weight: 600; margin-right: 6px; }

.td .inspect { position: absolute; z-index: 11; right: var(--gutter); bottom: calc(86px + env(safe-area-inset-bottom, 0px));
  width: min(24rem, calc(100vw - 2 * var(--gutter))); padding: 18px 20px 16px;
  background: #000; color: #f3f5f8; border: 1px solid rgba(255,255,255,.1); }
.td .inspect .eyebrow { margin-bottom: 6px; color: #8e96a3; }
.td .inspect h3 { margin: 0; font-family: var(--title); font-size: 30px; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.td .inspect p { margin: 10px 0 0; font-size: 12.5px; }
.td .inspect dl { margin: 14px 0 0; display: grid; grid-template-columns: auto 1fr; gap: 2px 14px; font-size: 11.5px; font-variant-numeric: tabular-nums; }
.td .inspect dt { text-transform: uppercase; letter-spacing: .1em; opacity: .62; }
.td .inspect dd { margin: 0; }
.td .inspect button { margin-top: 14px; padding: 8px 12px; background: none; cursor: pointer; font-size: 11px; letter-spacing: .14em;
  text-transform: uppercase; border: 1px solid currentColor; color: inherit; }
.td .inspect button:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ticker: scroll position through the teardown as a timeline */
.td .ticker { position: absolute; z-index: 10; left: var(--gutter); right: var(--gutter); opacity: 0;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px)); height: 46px;
  background: #000; color: var(--ink);
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 0 16px; }
.td .tk-label, .td .tk-pct { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; white-space: nowrap; font-variant-numeric: tabular-nums; }
.td .tk-label { min-width: 13ch; }
.td .tk-pct { color: color-mix(in srgb, var(--ink) 55%, transparent); min-width: 4ch; text-align: right; }
.td .tk-track { position: relative; height: 20px; display: flex; align-items: center; justify-content: space-between; }
.td .tk-track i { display: block; width: 1px; height: 9px; background: color-mix(in srgb, var(--ink) 34%, transparent); transform-origin: 50% 50%; }
.td .tk-track i.major { height: 16px; background: color-mix(in srgb, var(--ink) 70%, transparent); }
.td .tk-head { position: absolute; top: -2px; left: 0; width: 3px; height: 24px; margin-left: -1px; background: var(--accent); }

.td .loading { position: absolute; inset: 0; z-index: 20; display: grid; place-items: center; color: var(--ink);
  font-size: 11px; letter-spacing: .16em; text-transform: uppercase; pointer-events: none; }
.td .loading div { display: grid; gap: 14px; justify-items: center; text-align: center; padding: 0 24px; }
.td .loading .bar { width: 180px; height: 1px; background: color-mix(in srgb, var(--ink) 20%, transparent); overflow: hidden; }
.td .loading .bar b { display: block; height: 100%; width: 100%; background: var(--accent); transform-origin: 0 50%; transform: scaleX(0); }

/* ---------------------------------------------------------------- story (scrolls over the stage) */
.td-story { position: relative; z-index: 3; margin-top: -100vh; margin-top: -100svh; pointer-events: none; }
.td .ch { position: relative; height: 170vh; padding-inline: var(--gutter); }
.td .ch-hero { height: 150vh; padding: calc(var(--in-t) + 26px) var(--gutter) 0 calc(var(--in-x) + 26px); }
.td .ch-explore { height: auto; min-height: 100vh; padding-block: 6vh calc(120px + 30vh); }
.td .copy {
  position: sticky; top: 4.5vh; max-width: 31rem; isolation: isolate; pointer-events: auto;
  --fg: var(--ink); --bg: #000; color: var(--fg); background: #000; padding: 30px 32px 28px;
  border: 1px solid rgba(255,255,255,.08);
}
.td .ch-hero .copy { top: calc(var(--in-t) + 26px); max-width: 34rem; }
.td .ch-explore .copy { position: relative; top: 0; }
.td .eyebrow { margin: 0 0 14px; font-size: 11px; font-weight: 600; letter-spacing: .22em; text-transform: uppercase;
  color: color-mix(in srgb, var(--fg) 58%, transparent); }
.td h1, .td h2 { font-family: var(--title); font-weight: 800; line-height: .96; letter-spacing: -.04em; margin: 0; text-wrap: balance; }
.td h1, .td .hero-h { font-size: clamp(38px, min(5vw, 9vh), 80px); max-width: 12ch; }
/* the heading above flows straight into the card */
.envoy-intro { padding-bottom: clamp(24px, 4vw, 48px); }
.envoy-intro .sec-head { margin-bottom: 0; }
.td h2 { font-size: clamp(30px, min(4.3vw, 8vh), 60px); max-width: 12ch; }
.td .dot { color: var(--accent); display: inline-block; }
.td .lede { margin: 20px 0 0; max-width: 46ch; font-size: 13.5px; color: color-mix(in srgb, var(--fg) 82%, transparent); }
.td .facts { margin: 18px 0 0; padding: 0; list-style: none; display: grid; gap: 4px; font-size: 11.5px;
  letter-spacing: .06em; text-transform: uppercase; font-variant-numeric: tabular-nums; }
.td .facts li::before { content: "— "; color: var(--accent); }
.td .notice { margin: 18px 0 0; max-width: 46ch; padding: 10px 13px; font-size: 12px; line-height: 1.55;
  border: 1px dashed color-mix(in srgb, var(--fg) 42%, transparent); background: transparent; }
.td .notice b { display: block; margin-bottom: 3px; font-size: 10.5px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }

/* hero: the Envoy card's specs and calls to action */
.td .specs { margin: 22px 0 0; border-top: 1px solid rgba(255,255,255,.14); }
.td .specs > div { display: grid; grid-template-columns: 96px 1fr; gap: 12px; padding: 9px 0; border-bottom: 1px solid rgba(255,255,255,.1); }
.td .specs dt { font-size: 10.5px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: #8e96a3; }
.td .specs dd { margin: 0; font-size: 12.5px; color: #e9edf2; }
.td .hero-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 24px; }
.td .cta, .td .btn-link {
  display: inline-flex; align-items: center; gap: 12px; padding: 13px 16px; cursor: pointer; text-decoration: none;
  font-size: 11.5px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase;
  transition: background .2s, color .2s, border-color .2s;
}
.td .cta { background: #fff; color: #000; border: 1px solid #fff; }
.td .cta:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.td .cta svg { width: 10px; height: 18px; }
.td .btn-link { background: none; color: #fff; border: 1px solid rgba(255,255,255,.3); }
.td .btn-link:hover { background: #fff; color: #000; }
.td .swatches { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 18px; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; }
.td .swatches > span { margin-right: 4px; color: color-mix(in srgb, var(--fg) 60%, transparent); }
.td .sw { display: inline-flex; align-items: center; gap: 7px; padding: 6px 10px 6px 7px; cursor: pointer; background: none;
  border: 1px solid color-mix(in srgb, var(--fg) 18%, transparent); border-radius: 99px; font-size: 11px; letter-spacing: .08em; }
.td .sw i { width: 14px; height: 14px; border-radius: 50%; background: var(--chip); }
.td .sw[aria-pressed="true"] { border-color: var(--accent); }
.td .sw--ember { --chip: linear-gradient(140deg, #ff4a34, #a80a0a); }
.td .sw--carbon { --chip: linear-gradient(140deg, #3a3a3d, #0b0b0c); }
.td .sw--bone { --chip: linear-gradient(140deg, #f6efe6, #cbbfae); }
.td .fine { margin: 18px 0 0; font-size: 11px; line-height: 1.6; color: #6b7380; }

/* explore: parts list */
.td .totals { margin: 22px 0 0; font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; font-variant-numeric: tabular-nums; }
.td .bom { margin: 26px 0 0; padding: 0; list-style: none; max-width: 30rem; border-top: 1px solid color-mix(in srgb, var(--fg) 22%, transparent); }
.td .bom > li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 11px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--fg) 14%, transparent); }
.td .bom-name { font-weight: 600; font-size: 12.5px; }
.td .bom-qty { font-size: 11px; color: color-mix(in srgb, var(--fg) 60%, transparent); font-variant-numeric: tabular-nums; }
.td .bom .chips { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; }
.td .chip { padding: 3px 8px; cursor: pointer; background: none; font-size: 11px; letter-spacing: .04em;
  border: 1px solid color-mix(in srgb, var(--fg) 26%, transparent); }
.td .chip:hover, .td .chip[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }

/* the last screen fades into the white page below */
.td::after { content: ""; position: absolute; z-index: 4; left: 0; right: 0; bottom: 0; height: 30vh; pointer-events: none;
  background: linear-gradient(rgba(255,255,255,0), var(--page)); }

/* mid widths: slimmer copy boxes so the board has room beside them */
@media (min-width: 761px) and (max-width: 1100px) {
  .td .copy { max-width: 22rem; padding: 24px 24px 22px; }
  .td .ch-hero .copy { max-width: 24rem; }
  .td h2 { font-size: clamp(28px, 3.6vw, 40px); }
  .td .specs > div { grid-template-columns: 82px 1fr; }
}
/* short screens: tighter copy so it clears the ticker */
@media (max-height: 700px) and (min-width: 761px) {
  .td .copy { padding: 20px 24px 18px; }
  .td h1, .td .hero-h { font-size: clamp(32px, 7.5vh, 60px); }
  .td h2 { font-size: clamp(26px, 6.5vh, 46px); }
  .td .lede { margin-top: 12px; font-size: 12.5px; }
  .td .notice { margin-top: 12px; padding: 8px 11px; font-size: 11px; }
  .td .specs > div { padding: 6px 0; }
}
@media (max-height: 560px) and (min-width: 761px) {
  .td .notice, .td .ch-hero .specs { display: none; }
  .td .hero-row { margin-top: 14px; }
}
@media (max-width: 760px) {
  .td .labels, .td #leaders .lead { display: none; }
  .td .ch { height: 150vh; }
  .td .ch-hero { padding: calc(var(--in-t) + 16px) calc(var(--in-x) + 12px) 0; }
  .td .copy, .td .ch-hero .copy { top: 2vh; padding: 20px 20px 18px; max-width: none; }
  .td .tk-label { min-width: 0; }
  .td .tk-pct { display: none; }
  .td .inspect { bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
  .td .specs { display: none; }
}
