/* CppDesk landing page: "The Wire". Paper, ink and one orange cable. */

@font-face { font-family: "Young Serif"; src: url(fonts/young-serif-latin-400-normal.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Hanken Grotesk"; src: url(fonts/hanken-grotesk-latin-400-normal.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Hanken Grotesk"; src: url(fonts/hanken-grotesk-latin-600-normal.woff2) format("woff2"); font-weight: 600; font-display: swap; }
/* Metric-matched stand-ins so the swap does not shift the layout. */
@font-face { font-family: "Young Serif Fallback"; src: local("Georgia"); size-adjust: 112.5%; ascent-override: 93%; descent-override: 32.5%; line-gap-override: 0%; }
@font-face { font-family: "Hanken Grotesk Fallback"; src: local("Arial"); size-adjust: 100.8%; ascent-override: 99.2%; descent-override: 30%; line-gap-override: 0%; }

:root {
  --paper: #EEE8DE;
  --paper-2: #E4DCCD;
  --cream: #FBF8F2;
  --ink: #1B1714;
  --ink-2: #4A423B;            /* secondary text on paper: 8:1 */
  --orange: #C4542E;           /* cable, plugs, fills, large display only */
  --orange-text: #A8421F;      /* orange that passes 4.5:1 on paper and cream */
  --orange-lit: #E56F45;       /* orange text on the ink band: 5.5:1 */
  --line: 1.5px solid var(--ink);
  --shadow: 6px 6px 0 var(--ink);
  --radius: 10px;
  --ring: var(--ink);
  --serif: "Young Serif", "Young Serif Fallback", Georgia, serif;
  --sans: "Hanken Grotesk", "Hanken Grotesk Fallback", Arial, sans-serif;
  --edge: clamp(1.25rem, 5vw, 4rem);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 1.0625rem/1.6 var(--sans); font-variant-numeric: tabular-nums;
}
img, svg { display: block; max-width: 100%; }
h1, h2, h3, h4, p, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-decoration-thickness: 1.5px; text-underline-offset: 0.2em; }
a:hover { text-decoration-color: var(--orange); }
code { font: 600 0.92em var(--sans); background: var(--paper-2); padding: 0.05em 0.35em; border-radius: 4px; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 3px; border-radius: 4px; }
.btn:focus-visible, .pick:focus-visible { outline: 3px solid var(--ring); outline-offset: 5px; } /* clear of the hard shadow */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.dim { color: var(--ink-2); }

.wrap { width: min(100% - 2 * var(--edge), 80rem); margin-inline: auto; }
.section { padding-block: clamp(4.5rem, 10vw, 9rem); overflow-x: clip; } /* scroll-driven scale/rotate starts must not widen the page */
.section-lede { max-width: 38rem; margin-top: 1.25rem; font-size: 1.1875rem; }

h1, h2 { font: 400 clamp(2.1rem, 1rem + 4.4vw, 4.5rem)/1.04 var(--serif); letter-spacing: -0.012em; text-wrap: balance; }
h1 { font-size: clamp(2.6rem, 0.9rem + 6.2vw, 6rem); line-height: 1; }
h3 { font: 600 1.0625rem/1.3 var(--sans); }

/* ---- Header / footer ---- */
.top-in, .foot-in { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.top-in { padding-block: 1.1rem; }
.brand { display: inline-flex; align-items: center; gap: 0.6rem; font: 600 1.125rem var(--sans); text-decoration: none; }
.brand img { border-radius: 7px; }
nav { display: flex; gap: clamp(0.9rem, 3vw, 2rem); }
nav a { text-decoration: none; padding-block: 0.7rem; }
nav a:hover { text-decoration: underline; text-decoration-color: var(--orange); }
.foot { border-top: var(--line); padding-block: 2rem; font-size: 0.9375rem; }
.foot-in { flex-wrap: wrap; }

/* ---- The window: the one component ---- */
.win { background: var(--cream); border: var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; text-align: left; color: var(--ink); font: inherit; padding: 0; }
.win-bar { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 1rem; padding: 0.55rem 0.95rem; background: var(--paper-2); border-bottom: var(--line); }
.win-name { font: 600 0.9375rem/1.3 var(--sans); }
.win-id { white-space: nowrap; font: 600 0.875rem/1.3 var(--sans); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.win-body { display: block; padding: 1rem 0.95rem 1.1rem; }
.win-body > * + * { margin-top: 0.6rem; }

/* ---- Buttons ---- */
.btn { display: inline-flex; align-items: center; gap: 0.6rem; min-height: 3rem; padding: 0.7rem 1.35rem; background: var(--orange-text); color: var(--cream); border: var(--line); border-radius: 8px; box-shadow: 4px 4px 0 var(--ink); font: 600 1.0625rem/1.2 var(--sans); text-decoration: none; cursor: pointer; transition: transform 0.12s, box-shadow 0.12s; }
.btn:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--ink); }
.btn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }

/* ---- 1. Hero ---- */
.hero { min-height: calc(100svh - 5.4rem); display: grid; align-content: center; padding-block: clamp(1.5rem, 4vw, 3rem); }
.hero-copy { margin-top: clamp(1.5rem, 3vw, 2.5rem); max-width: 38rem; }
.lede { text-wrap: pretty; font-size: clamp(1.1875rem, 1rem + 0.6vw, 1.4rem); line-height: 1.5; }
.actions { margin-top: 1.5rem; }
.alt { margin-top: 1.1rem; font-size: 0.9375rem; color: var(--ink-2); }
.wire {
  --w: min(19rem, 40cqw);
  --gap: clamp(3rem, 12cqw, 9rem);
  --spread: calc((100cqw - 2 * var(--w) - var(--gap)) / 2);
  container-type: inline-size; position: relative; display: flex; align-items: center; justify-content: center; gap: var(--gap);
  margin-top: clamp(2rem, 4vw, 3rem);
}
.wire .win { position: relative; z-index: 1; width: var(--w); }
/* Spans window-centre to window-centre when the windows are far apart; the clip trims it to the gap once they close in. */
.cable { position: absolute; z-index: 0; left: calc(var(--w) / 2); width: calc(100% - var(--w)); top: 50%; height: 7.5rem; transform: translateY(-50%); overflow: visible; clip-path: inset(0 var(--spread) 0 var(--spread)); }
.cable path { fill: none; stroke: var(--orange); stroke-width: 4; stroke-linecap: round; }
.cable .cable-pulse { stroke: var(--ink); stroke-dasharray: 3 97; }

/* Hero motion. Without these queries the page rests in its finished state: windows close, cable joined. */
@media (prefers-reduced-motion: no-preference) {
  .cable-line { stroke-dasharray: 100; animation: cable-draw 1.5s 0.2s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  .cable-pulse { animation: cable-pulse 2.8s linear 1.8s infinite; }
  @keyframes cable-draw { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 0; } }
  @keyframes cable-pulse { from { stroke-dashoffset: 3; } to { stroke-dashoffset: -97; } }
  @media (min-width: 48rem) {
    @supports (animation-timeline: scroll()) {
      .wire-a { animation: spread-a linear both; animation-timeline: scroll(root); animation-range: 0vh 60vh; }
      .wire-b { animation: spread-b linear both; animation-timeline: scroll(root); animation-range: 0vh 60vh; }
      .cable { animation: cable-trim linear both; animation-timeline: scroll(root); animation-range: 0vh 60vh; }
      @keyframes spread-a { from { translate: calc(-1 * var(--spread)) 0; } }
      @keyframes spread-b { from { translate: var(--spread) 0; } }
      @keyframes cable-trim { from { clip-path: inset(0 0 0 0); } }
    }
  }
}
@media (prefers-reduced-motion: reduce) { .cable-pulse { display: none; } }

/* ---- 2. What isn't there ---- */
.gone { display: grid; gap: clamp(1rem, 3vw, 2.5rem); }
.gone li { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 2rem; }
.word { position: relative; font: 400 clamp(3.5rem, 1rem + 13vw, 11rem)/1.05 var(--serif); letter-spacing: -0.02em; }
.word::after { content: ""; position: absolute; left: -1%; right: -1%; top: 54%; height: clamp(6px, 1.2vw, 14px); background: var(--orange); transform-origin: left center; }
@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    /* Each bar draws once its word reaches mid-screen. */
    .word::after { animation: strike linear both; animation-timeline: view(); animation-range: entry 60% cover 50%; }
    @keyframes strike { from { transform: scaleX(0); } }
  }
}
.none { font: 600 1.0625rem var(--sans); color: var(--ink-2); }

/* ---- 3. Connect ---- */
.scene-pin h2 { margin-bottom: clamp(1.5rem, 4vw, 3rem); }
.steps { display: grid; gap: clamp(2rem, 4vw, 3rem); grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); align-items: start; }
.step-text { max-width: 30rem; margin-bottom: 1.25rem; }
.big-id { font: 600 clamp(1.8rem, 1.2rem + 1.8vw, 2.5rem)/1.1 var(--sans); color: var(--orange-text); letter-spacing: 0.01em; }
.code { display: inline-block; font: 600 1.125rem var(--sans); background: var(--paper-2); border-radius: 6px; padding: 0.3rem 0.75rem; }
.ready, .live-line { display: flex; align-items: center; gap: 0.6rem; font-weight: 600; }
.ready::before { content: ""; width: 0.65rem; height: 0.65rem; border-radius: 50%; background: #2F7A5F; flex: none; }
.field { display: block; background: var(--paper); border: var(--line); border-radius: 6px; padding: 0.6rem 0.85rem; font: 600 1.5rem/1.2 var(--sans); letter-spacing: 0.04em; }
.typed { display: inline; }
.sp { display: inline-block; width: 0.35em; }
.plug-dot { width: 0.9rem; height: 0.9rem; border-radius: 50%; background: var(--orange); border: var(--line); flex: none; }

/* Pinned scene: tall track, sticky stage, choreography on the track's own view timeline.
   The pinned phase is cover 28.6% to 71.4% (track 250vh, stage 100vh). Only where the animation can run, and only
   with two columns and a tall screen: phones, tablets in portrait, short screens, reduced motion and no-support
   browsers get the plain two-step list. */
@media (min-width: 52rem) and (min-height: 41rem) {
  @media (prefers-reduced-motion: no-preference) {
    @supports (animation-timeline: view()) {
      .scene { height: 250vh; view-timeline: --scene block; }
      .scene-pin { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; justify-content: flex-start; padding-top: clamp(3rem, 12vh, 8rem); }
      .step + .step .win, .step + .step .step-text { animation: step-in linear both; animation-timeline: --scene; animation-range: cover 30% cover 38%; }
      .dg { animation: type-in linear both; animation-timeline: --scene; animation-range: cover calc(40% + var(--i) * 2.4%) cover calc(41.5% + var(--i) * 2.4%); }
      .live-line { animation: step-in linear both; animation-timeline: --scene; animation-range: cover 64% cover 68%; }
      .plug-dot { animation: plug-snap linear both; animation-timeline: --scene; animation-range: cover 63% cover 67%; }
      @keyframes step-in { from { opacity: 0.2; translate: 0 1.5rem; } }
      @keyframes type-in { from { opacity: 0; } }
      @keyframes plug-snap { from { transform: scale(0); } 70% { transform: scale(1.35); } }
    }
  }
}

.toy { margin-top: clamp(3rem, 7vw, 6rem); }
.toy h3 { font: 400 clamp(1.6rem, 1rem + 2vw, 2.4rem)/1.1 var(--serif); }
.toy-lede { max-width: 38rem; margin-top: 0.9rem; }
.net { position: relative; margin-top: 2rem; display: grid; gap: 1.5rem; }
.link { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; z-index: 2; }
.link path { fill: none; stroke: var(--orange); stroke-width: 5; stroke-linecap: round; }
.link circle { fill: var(--orange); stroke: var(--ink); stroke-width: 1.5; }
#cable.draw { stroke-dasharray: var(--len); animation: draw 0.5s ease-out both; }
@keyframes draw { from { stroke-dashoffset: var(--len); } to { stroke-dashoffset: 0; } }
.picks { display: grid; gap: 1.25rem; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 48rem) { .picks { grid-template-columns: repeat(3, 1fr); } }
.pick { cursor: pointer; width: 100%; transition: transform 0.12s, box-shadow 0.12s; box-shadow: 4px 4px 0 var(--ink); }
.pick:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--ink); }
.pick:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--ink); }
.pick[aria-pressed="true"] .win-bar, .pick.live .win-bar { background: var(--orange-text); color: var(--cream); }
.pick[aria-pressed="true"] .win-id, .pick.live .win-id { color: var(--cream); }
.slot { border: 1.5px dashed var(--ink-2); border-radius: var(--radius); padding: 1rem 1.1rem; color: var(--ink-2); }
.slot-name { font: 400 1.6rem/1.1 var(--serif); }
.live-card { max-width: 26rem; }
.pair { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; font-weight: 600; font-size: 1.125rem; }
.arrow { color: var(--orange-text); }

/* ---- 4. The real thing ---- */
.real .shot { margin-top: clamp(2rem, 4vw, 3rem); }
.shot img { width: 100%; height: auto; aspect-ratio: 1280 / 800; }
/* The frame keeps its full size in the layout; only its transform grows with the scroll. */
@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    .shot { transform-origin: 50% 0; animation: shot-grow linear both; animation-timeline: view(); animation-range: entry 0% cover 30%; }
    @keyframes shot-grow { from { transform: scale(0.6); } }
  }
}
.promo { margin-top: 1.5rem; }

/* ---- 5 / 7. Window decks ---- */
.deck { margin-top: clamp(2rem, 4vw, 3rem); display: grid; gap: clamp(1.25rem, 2.5vw, 2rem); grid-template-columns: repeat(12, 1fr); }
.f { grid-column: span 12; }
.numerals { display: flex; gap: 1.25rem; font: 400 2.4rem/1 var(--serif); }
@media (min-width: 48rem) {
  .features .f:nth-child(odd) { rotate: -0.7deg; }
  .features .f:nth-child(even) { rotate: 0.6deg; }
  .features .f:nth-child(n+4) { margin-top: -0.75rem; }
}
@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    /* Cards are dealt in as each reaches the lower half of the screen. */
    .features .f { animation: deal linear both; animation-timeline: view(); animation-range: entry 0% entry 70%; }
    .features .f:nth-child(3n+2) { animation-range: entry 8% entry 78%; }
    .features .f:nth-child(3n) { animation-range: entry 16% entry 86%; }
    @keyframes deal { from { opacity: 0; translate: 0 3.5rem; rotate: 5deg; } }
  }
}
.hot .win-bar { background: var(--orange-text); color: var(--cream); }
.hot .win-id { color: var(--cream); }
.notes { margin-top: 2.5rem; display: grid; gap: 1rem; max-width: 44rem; }

/* ---- 6. Security: the ink band ---- */
.security { background: var(--ink); color: var(--paper); --ring: var(--paper); }
.security .section-lede { color: var(--paper); }
.stamp { display: inline-block; rotate: -2deg; margin-top: 1.75rem; padding: 0.4rem 1.1rem; border: 3px solid var(--orange-lit); border-radius: 8px; color: var(--orange-lit); font: 400 clamp(1.5rem, 1rem + 1.6vw, 2.2rem)/1.2 var(--serif); }
@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    .stamp { animation: stamp-land linear both; animation-timeline: view(); animation-range: entry 40% entry 100%; }
    @keyframes stamp-land { from { opacity: 0; scale: 1.7; rotate: -9deg; } }
  }
}
.locks { margin-top: 2rem; display: grid; gap: 0.6rem; max-width: 38rem; }
.locks li { padding-left: 1.5rem; position: relative; }
.locks li::before { content: ""; position: absolute; left: 0; top: 0.7em; width: 0.7rem; height: 3px; background: var(--orange); }

@media (min-width: 48rem) {
  .w4 { grid-column: span 4; }
  .w6 { grid-column: span 6; }
}
@media (max-width: 47.99rem) {
  .hide-sm { display: none; }
  .wire { flex-direction: column; align-items: stretch; gap: 3rem; }
  .wire .win { width: 100%; }
  .cable { display: none; }
  .wire::after { content: ""; position: absolute; z-index: 0; left: 50%; top: 20%; bottom: 20%; width: 4px; background: var(--orange); transform: translateX(-50%); }
}
