/* Project Noodles — holding page for noodlesproject.com.
   Every colour, radius, shadow, duration and easing below comes from the design-system
   tokens in ds/tokens/. Nothing here invents a value; if something needs changing,
   change the token. */

/* ── Page shell ─────────────────────────────────────────────────────────────── */

html {
  background: var(--bg-canvas);
}
[data-theme="dark"] html,
html[data-theme="dark"] {
  background: var(--brand-ink);
}

body {
  background: transparent;
}

.page {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  /* Clip BOTH axes. The background is drawn at its true size and hangs off every
     edge, and `overflow-x: clip` alone makes the other axis compute to `auto` —
     which put a scrollbar on the page as soon as the artwork was taller than its
     band. Nothing here is meant to scroll. */
  overflow: clip;
  background: var(--bg-canvas);
  font-family: var(--font-ui);
  color: var(--text-1);
}
[data-theme="dark"] .page {
  background: var(--brand-ink);
}

.page__grid {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(var(--canvas-dot) 1px, transparent 1px);
  background-size: 22px 22px;
  opacity: 0.8;
}

/* ── Wire corridors ─────────────────────────────────────────────────────────
   The two bands of noodle wire above and below the content. page.js measures the
   content stack and writes --corridor-top / --corridor-bottom; the values here are
   the pre-measurement fallback, and are what a no-JS visitor keeps. */

.corridor {
  position: absolute;
  left: 0;
  right: 0;
  overflow: visible;
  pointer-events: none;
}
.corridor--top {
  top: 0;
  height: var(--corridor-top, 22vh);
}
.corridor--bottom {
  bottom: 0;
  height: var(--corridor-bottom, 24vh);
}
/* THE BACKGROUND IS NEVER RESIZED TO FIT. (User instruction, 2026-08-11.)

   It is drawn 1440x260 and it stays 1440x260 — centred, at 1:1, cropped by
   whatever the window happens to be, exactly like looking at a real canvas
   through a smaller window. Only the text reflows for a narrow screen. Every
   earlier attempt to make it fit — squashing the width, stretching the height to
   fill the band — is what produced bunched-up wires, oval dots and lozenge
   diamonds, because none of those scale the two axes equally.

   page.js sets width and height, and only ever scales UP, uniformly, to cover a
   window wider than the drawing. `.page { overflow-x: clip }` takes the overhang.

   Each layer hangs off the edge of its band FACING THE CONTENT, so when the band
   is shorter than 260 what gets cropped is the far side, never the side that
   frames the words. Nothing in the background may cross the text. */
/* The artwork is CROPPED to its band rather than allowed to spill out of it. That
   is what makes "never resize the background" safe: on a window too short to hold
   the full 260 the drawing keeps its size and simply loses its far edge, instead
   of running across the words. The bottom band stops at the footer, because the
   copyright line is text too and a wire was passing through it. `.deco-nodes` is
   outside this box on purpose — a card rides its wire and may sit beyond the band. */
.art-clip {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.corridor--bottom .art-clip {
  bottom: var(--footer-h, 0px);
}

/* WIDTH is never squashed; HEIGHT fills the band.

   This split is the whole answer, and it took getting both halves wrong to find.
   Crushing the WIDTH is what bunched the wires into squiggles — a 1440-wide curve
   in a 620 window arrives four times too fast — so the width stays true and the
   drawing runs off both edges.

   Refusing to touch the HEIGHT as well sounds like the same principle, but it
   crops: on a 1440x950 desktop the band is 147px and the drawing is 260, so the
   green wire vanished halfway across. Filling the band vertically keeps every
   wire running edge to edge, which is what a wire is for. It costs a vertical
   stretch, which reads as a bigger sweep — and the accents cancel it on
   themselves in page.js, so dots stay round and diamonds square. */
.corridor svg {
  position: absolute;
  left: 50%;
  top: 0;
  height: 100%;
  overflow: visible;
  /* Width is set by page.js; this is the no-JS fallback. */
  width: 1440px;
  margin-left: -720px;
}

@keyframes wire-drift {
  to { stroke-dashoffset: -320; }
}
.wire--drift {
  animation: wire-drift 26s linear infinite;
}

/* ── Decorative node cards ──────────────────────────────────────────────────
   Skeleton cards that sit on a wire. page.js nudges each one vertically so the
   wire runs through it, and moves the two ports to where the wire actually meets
   the card's left and right edges. Purely decorative: aria-hidden on the corridor. */

.deco-node {
  position: absolute;
}

.deco-card {
  position: relative;
  width: 216px;
  border-radius: var(--r-4);
  background: var(--surface-card);
  border: var(--stroke-node) solid color-mix(in srgb, var(--h) 55%, transparent);
  box-shadow: var(--shadow-node);
}

/* One custom property set per hue, so the card markup carries no colour of its own. */
.deco-node[data-hue="violet"] { --h: var(--hue-violet); --h-ink: var(--hue-violet-ink); --h-tint: var(--hue-violet-tint); --h-wash: var(--hue-violet-wash); }
.deco-node[data-hue="blue"]   { --h: var(--hue-blue);   --h-ink: var(--hue-blue-ink);   --h-tint: var(--hue-blue-tint);   --h-wash: var(--hue-blue-wash); }
.deco-node[data-hue="green"]  { --h: var(--hue-green);  --h-ink: var(--hue-green-ink);  --h-tint: var(--hue-green-tint);  --h-wash: var(--hue-green-wash); }

.deco-port {
  position: absolute;
  top: 50%;
  width: 10px;
  height: 10px;
  border-radius: var(--r-pill);
  background: var(--surface-card);
  border: 2px solid var(--h-ink);
}
.deco-port[data-port="left"]  { left: -5px; }
.deco-port[data-port="right"] { right: -5px; }

.deco-card__head {
  display: flex;
  align-items: center;
  height: 22px;
  padding: 0 var(--sp-4);
  background: var(--h-tint);
  border-radius: 9px 9px 0 0;
}
.deco-card__head > span {
  width: 52%;
  height: 7px;
  border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--h-ink) 45%, transparent);
}

.deco-card__body {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: var(--sp-5);
}

.deco-lines {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}
.deco-lines > span {
  height: 7px;
  border-radius: var(--r-pill);
  background: var(--border-strong);
}
.deco-lines > span:first-child { width: 100%; }
.deco-lines > span:last-child  { width: 68%; }

.deco-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
}
.deco-grid > span {
  height: 22px;
  border-radius: var(--r-3);
  background: var(--surface-sunken);
  border: var(--stroke-hairline) solid var(--border-hairline);
}
.deco-grid > span.is-hue {
  background: var(--h-tint);
  border-color: color-mix(in srgb, var(--h) 45%, transparent);
}

.deco-bar {
  display: block;
  width: 100%;
  height: 22px;
  border-radius: var(--r-3);
  background: var(--h-wash);
  border: var(--stroke-hairline) solid color-mix(in srgb, var(--h) 35%, transparent);
}

.deco-foot {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
.deco-dot {
  width: 16px;
  height: 16px;
  border-radius: var(--r-pill);
  background: var(--bg-bar);
}
.deco-dot.is-hue {
  background: var(--h-tint);
  border: var(--stroke-hairline) solid color-mix(in srgb, var(--h) 45%, transparent);
}
.deco-pill {
  margin-left: auto;
  width: 40%;
  height: 22px;
  border-radius: var(--r-3);
  background: var(--surface-sunken);
  border: var(--stroke-hairline) solid var(--border-hairline);
}

/* ── Content ────────────────────────────────────────────────────────────────── */

.stack {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: var(--sp-12) var(--sp-12) 28px;
  text-align: center;
}

.lockup {
  width: min(526px, 46vw);
  height: auto;
}
.lockup--dark { display: none; }
[data-theme="dark"] .lockup--light { display: none; }
[data-theme="dark"] .lockup--dark  { display: block; }

.words {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-7);
  max-width: 820px;
}

/* A flex line rather than a run of text, for one reason: the phrases must be able
   to wrap between themselves but the gap between them is the icon's own margin,
   not a word space. Inline markup cannot have both — no whitespace means no break
   opportunity, and a space is wider than the design's gap. Flex drops the source
   whitespace entirely and lets `gap` say the truth. */
.headline {
  margin: 0;
  max-width: min(760px, 60vw);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: 0;
  font-family: var(--font-display);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--tracking-display);
  line-height: 1.06;
  font-size: clamp(38px, 6.4vw, 76px);
  color: var(--text-1);
}

/* Four beats, four colours, in the logo's own order — now an icon per beat.
   `nowrap` keeps a phrase welded to its glyph; the headline breaks between
   phrases instead. The sizes are the design's 40px and 48px against its 76px
   headline, expressed as em so they hold that proportion when the headline
   shrinks on a phone. */
.phrase {
  white-space: nowrap;
}
.phrase__icon {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  margin: 0 0.16em 0 0.12em;
}
.phrase__icon--last {
  margin-right: 0;
}
.phrase__icon svg {
  width: 0.53em;
  height: 0.53em;
}
.phrase__icon--last svg {
  width: 0.63em;
  height: 0.63em;
}

.headline__sub {
  /* Always its own line under the four phrases, with air above it — the two sat
     too close at both ends of the range, so the space scales with the viewport
     rather than being a single fixed value. */
  flex: 0 0 100%;
  margin-top: clamp(12px, 1.7vw, 24px);
  color: var(--hue-violet);
  font-size: clamp(24px, 3.9vw, 45px);
  font-weight: var(--fw-semibold);
}

.blurb {
  margin: 0;
  max-width: 560px;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-2);
  text-wrap: pretty;
}

/* ── Status row ─────────────────────────────────────────────────────────────── */

.status {
  display: flex;
  align-items: center;
  gap: var(--sp-5);
}
.status__when {
  color: var(--text-3);
  white-space: nowrap;
}

/* NoodlingTag, from the design system's components/core/NoodlingTag.jsx. */
.noodling-tag {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  height: 18px;
  padding: 0 7px 0 var(--sp-5);
  border-radius: var(--r-2);
  background: var(--hue-orange-tint);
  color: var(--hue-orange-ink);
  font-size: var(--fs-ui-s);
  font-weight: var(--fw-semibold);
  white-space: nowrap;
  border: var(--stroke-hairline) dashed color-mix(in srgb, var(--hue-orange-ink) 35%, transparent);
}
.noodling-tag__icon {
  font-size: 11px;
}

/* ── Theme toggle ───────────────────────────────────────────────────────────── */

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin-top: var(--sp-2);
  /* The switch itself is 22px tall by design. The padding is invisible and exists
     only to bring the pressable area up to a 44px touch target. */
  min-height: 44px;
  padding: var(--sp-3) var(--sp-4);
  border: 0;
  border-radius: var(--r-3);
  background: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
  user-select: none;
}

.theme-toggle__track {
  position: relative;
  display: block;
  width: 42px;
  height: 22px;
  border-radius: var(--r-pill);
  background: var(--surface-sunken);
  border: var(--stroke-hairline) solid var(--border-field);
  transition:
    background var(--dur-fast) var(--ease-standard),
    border-color var(--dur-fast) var(--ease-standard);
}
[data-theme="dark"] .theme-toggle__track {
  background: var(--surface-selected);
  border-color: var(--brand-violet);
}

.theme-toggle__thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: var(--r-pill);
  background: var(--surface-card);
  border: var(--stroke-hairline) solid var(--border-hairline);
  box-shadow: var(--shadow-node);
  transition: left var(--dur-base) var(--ease-noodle);
}
[data-theme="dark"] .theme-toggle__thumb {
  left: 22px;
}

/* ── Footer ─────────────────────────────────────────────────────────────────── */

.footer {
  position: relative;
  display: flex;
  justify-content: center;
  padding: 0 var(--sp-12) 18px;
}
.footer span {
  font-size: var(--fs-ui-s);
  letter-spacing: 0.02em;
  color: var(--text-3);
}

/* ── Small screens ──────────────────────────────────────────────────────────
   Below 820px there is no room beside the text for a node card, so the cards go
   and the wires carry the canvas idea on their own. The logo stops tracking 46vw,
   which would shrink it to a stamp on a phone. */

@media (max-width: 820px) {
  .deco-nodes { display: none; }
  .lockup { width: min(526px, 78vw); }
  .headline { max-width: 100%; }
}

/* ── Reduced motion ────────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; }
}
