/* ============================================
   THE WEB REBELLION PROJECT
   ============================================
   this stylesheet is the argument.

   no frameworks. no preprocessors. no apologies.
   every selector uses the cascade. classes only
   show up when there's genuinely no other option.

   mobile-first. base styles = small screens.
   @media (min-width: ...) = desktop gets more.

   things in here you don't see every day:
   → @property for animatable custom properties
   → @container queries for intrinsic components
   → :has() relational selector
   → animation-timeline: scroll() & view()
   → color-mix() for dynamic colour
   → text-wrap: balance
   → CSS counters & content()
   → mix-blend-mode & isolation
   → layered gradients as generative art
   → intrinsic sizing (min/max/clamp/fit-content)

   Viola Cherchi, 2025–26
   ============================================ */


/* ============================================
   I. @PROPERTY
   registered so the browser knows how to animate them.
   without this, CSS can't transition custom properties.
   ============================================ */
@property --corruption {
  syntax: "<number>";
  inherits: true;
  initial-value: 0;
}
@property --hue-shift {
  syntax: "<angle>";
  inherits: true;
  initial-value: 0deg;
}
@property --skew {
  syntax: "<angle>";
  inherits: true;
  initial-value: 0deg;
}
@property --glitch-x {
  syntax: "<length>";
  inherits: false;
  initial-value: 0px;
}
@property --glitch-y {
  syntax: "<length>";
  inherits: false;
  initial-value: 0px;
}
@property --gradient-stop {
  syntax: "<percentage>";
  inherits: false;
  initial-value: 0%;
}
@property --blob-x {
  syntax: "<percentage>";
  inherits: false;
  initial-value: 50%;
}
@property --blob-y {
  syntax: "<percentage>";
  inherits: false;
  initial-value: 50%;
}


/* ============================================
   II. DESIGN TOKENS
   modular scale, augmented fourth (1.414 ratio).
   each step = 1.414x the last. all spacing and
   type sizes derive from this scale.

   1rem = browser base font size, usually 16px.
   rem instead of px so everything scales with
   user font size preferences.
   ============================================ */
:root {

  /* ---- COLOURS ---- */
  --black: #0d0d0d;
  --dark: #1a1a1a;
  --mid: #2a2a2a;
  --grey: #919191;      /* was #808080 - retuned to clear 4.5:1 on --dark and --mid (measured 5.52 / 4.55) */
  --light: #b0b0b0;
  --off-white: #e8e8e8;
  --white: #ffffff;
  --red: #e63b2e;
  --red-text: #eb665c;  /* body-size red text on dark surfaces - 4.5:1 on --mid; display red stays --red (passes 3:1 large-text) */
  --orange: #e8632b;
  --cyan: #00d4ff;

  /* color-mix() creates dimmed/brightened variants
     without hand-picking hex codes. 40% red + 60% black
     = dark muted red. 80% red + 20% white = brighter. */
  --red-dim: color-mix(in oklch, var(--red) 40%, var(--black));
  --red-bright: color-mix(in oklch, var(--red) 80%, var(--white));
  --orange-dim: color-mix(in oklch, var(--orange) 40%, var(--black));

  /* ---- FONTS ---- */
  --font-display: "Arial Black", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Consolas", "Monaco", "Courier New", monospace;
  --font-body: "Georgia", "Times New Roman", serif;

  /* ---- TYPE SCALE ----
     each step = 1.414x bigger. spacing tokens below
     reference these. */
  --scale-000: 0.5rem;   /*  8px */
  --scale-00: 0.7rem;    /* 11px */
  --scale-0: 1rem;       /* 16px (base) */
  --scale-1: 1.414rem;   /* 23px */
  --scale-2: 2rem;       /* 32px */
  --scale-3: 2.827rem;   /* 45px */
  --scale-4: 4rem;       /* 64px */
  --scale-5: 5.653rem;   /* 90px */
  --scale-6: 8rem;       /* 128px */

  /* ---- SPACING ----
     named by size so var(--s-m) is obvious.
     --s-xs  = 0.5rem  =  8px
     --s-s   = 0.7rem  = 11px
     --s-m   = 1rem    = 16px
     --s-l   = 2rem    = 32px
     --s-xl  = 4rem    = 64px
     --s-2xl = 8rem    = 128px */
  --s-xs: 0.5rem;
  --s-s: 0.7rem;
  --s-m: 1rem;
  --s-l: 2rem;
  --s-xl: 4rem;
  --s-2xl: 8rem;

  /* ---- LINE LENGTH ----
     ch = width of "0" in the current font.
     65ch ~ 65 characters per line */
  --measure: 65ch;
  --measure-narrow: 42ch;

  /* ---- CORRUPTION SYSTEM ----
     start at zero. JS changes them as the user
     scrolls through the manifesto. */
  --corruption: 0;
  --hue-shift: 0deg;
  --skew: 0deg;
}


/* ============================================
   III. RESET (opinionated)
   nuke everything. build it back better.
   ============================================ */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: clamp(100%, 0.5vw + 90%, 130%); /* min 16px, grows slightly with screen width, max ~21px */
  -webkit-text-size-adjust: 100%;
  hanging-punctuation: first last;
}

body {
  background: var(--black);
  /* SC 1.4.10: both phone participants in the August pilot hit
     horizontal overflow on the experiment pages and read it as a
     genuine defect - which contaminated their reading of the
     deliberate strangeness around it. clip contains any translated
     element's spill without creating a scroll container. */
  overflow-x: clip;
  color: var(--off-white);
  font-family: var(--font-body);
  font-size: var(--scale-0);
  line-height: 1.65;
  overflow-x: hidden;
  min-height: 100dvh;
  /* CRT scanline texture - generative, no images */
  background-image:
    repeating-linear-gradient(
      0deg,

      transparent,
      transparent 2px,
      rgba(255, 255, 255, 0.013) 2px,
      rgba(255, 255, 255, 0.013) 4px
    ),
    radial-gradient(ellipse at 50% 0%, rgba(230, 59, 46, 0.03) 0%, transparent 60%);
  background-attachment: fixed;
  cursor: crosshair;
}

/* lock body scroll when mobile nav is open.
   JS sets [data-nav-open]; CSS owns the overflow rule. */
[data-nav-open] { overflow: hidden; }

a, button, [role="link"] { cursor: pointer; }

img, video, svg {
  display: block;
  max-inline-size: 100%;
  block-size: auto;
}


/* ============================================
   IV. BASE TYPOGRAPHY & LINKS
   global type styles. page-specific overrides
   live in their own sections below.
   ============================================ */

/* h1: display type. giant, uppercase, unapologetic. */
h1 {
  font-family: var(--font-display);
  font-size: clamp(3rem, 3rem + 8vw, 13rem); /* min 48px on mobile, grows with screen, max 208px on wide screens */
  line-height: 0.88;
  letter-spacing: -0.045em;
  color: var(--white);
  text-transform: uppercase;
  overflow-wrap: break-word;
  hyphens: none;
  text-wrap: balance;
  margin-inline-start: -0.06em;
}

/* h2: context-dependent, sensible base */
h2 {
  font-family: var(--font-display);
  text-transform: uppercase;
  color: var(--white);
  letter-spacing: -0.035em;
  text-wrap: balance;
}

/* links: RGB split hover, deliberate glitch aesthetic */
a {
  color: var(--red-text);
  text-decoration: none;
  text-underline-offset: 0.2em;
  transition: color 0.15s, text-shadow 0.2s, letter-spacing 0.3s;
}

a:hover,
a:focus-visible {
  color: var(--orange);
  text-shadow:
    2px 0 0 var(--red),
    -2px 0 0 var(--cyan);
}

a:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 4px;
}

::selection {
  background: var(--red);
  color: var(--white);
}


/* ============================================
   V. SKIP LINK
   [data-skip] instead of a class.
   first interactive element on every page.
   ============================================ */
[data-skip] {
  position: absolute;
  top: -100%;
  left: var(--s-m);
  background: var(--red);
  color: var(--white);
  padding: var(--s-s) var(--s-m);
  font-family: var(--font-mono);
  font-size: var(--scale-00);
  z-index: 1000;
  transition: top 0.2s;
}
[data-skip]:focus { top: var(--s-s); }


/* ============================================
   VI. MARQUEE STRIP
   persistent scrolling strip at the top.
   [data-marquee] + aria-hidden = purely decorative.
   JS makes it clickable as a home link.
   ============================================ */
[data-marquee] {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: clamp(2.5rem, 5vh, 3.5rem); /* min 40px, scales with viewport height, max 56px */
  background: var(--red);
  overflow: hidden;
  z-index: 100;
  cursor: pointer;
  border-bottom: 3px solid var(--black);
  isolation: isolate;
}

/* vertical interference lines via gradients -
   inspired by Lynn Fisher's generative CSS art */
[data-marquee]::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      90deg,
      transparent 0 3px,
      rgba(0, 0, 0, 0.12) 3px 5px
    ),
    repeating-linear-gradient(
      0deg,
      transparent 0 1px,
      rgba(255, 255, 255, 0.06) 1px 2px
    );
  mix-blend-mode: multiply;
  pointer-events: none;
}

/* track: the scrolling container */
[data-marquee] > div {
  display: flex;
  white-space: nowrap;
  animation: marquee 14s linear infinite;
  height: 100%;
  align-items: center;
}

/* text blocks inside the track */
[data-marquee] p {
  font-family: var(--font-display);
  font-size: clamp(0.7rem, 1.2vw, 0.95rem); /* min 11px, max 15px */
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding-right: 2em;
  user-select: none;
}

/* alternate colour rhythm - not uniform, that's the point */
[data-marquee] span { color: var(--white); }
[data-marquee] span:nth-child(3n+2) { color: var(--black); font-style: italic; }
[data-marquee] span:nth-child(3n) { color: rgba(255,255,255,0.45); }

@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}


/* ============================================
   VII. LAYOUT
   .container is the one class kept - it's a
   layout primitive used on every page. the cascade
   can't replace it because it wraps arbitrary
   content in arbitrary contexts.
   ============================================ */
main {
  margin-top: clamp(2.5rem, 5vh, 3.5rem); /* min 40px, max 56px, clears the marquee bar */
}

.container {
  width: min(100% - var(--s-l) * 2, 90rem);
  margin-inline: auto;
  container-type: inline-size;
}


/* ============================================
   VIII. MOBILE NAVIGATION
   toggle on mobile, hidden on desktop.
   slides in from the right. escape closes.
   aria-controls + #mobile-nav for relationship,
   [data-open] for state.
   ============================================ */

/* toggle button: visible on mobile by default */
button[aria-controls="mobile-nav"] {
  display: flex;
  position: fixed;
  inset-block-end: var(--s-l);
  inset-inline-end: var(--s-l);
  z-index: 200;
  width: 3.5rem;
  height: 3.5rem;
  background: var(--red);
  border: none;
  border-radius: 0;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: 3px 3px 0 var(--black);
  transition: transform 0.2s;
  /* pilot + presentation feedback: a naked burger is an easter egg,
     and the navigation was never meant to be one. the word does
     what the icon could not. */
  flex-direction: column;
  gap: 0.6rem;
}

button[aria-controls="mobile-nav"]:hover {
  transform: translate(-2px, -2px);
  box-shadow: 5px 5px 0 var(--black);
}

/* the visible word - hidden again on desktop with the icon */
button[aria-controls="mobile-nav"] > [data-menu-label] {
  font-family: var(--font-mono);
  font-size: 0.5rem;
  color: var(--white);
  letter-spacing: 0.2em;
  margin-block-start: 0.15rem;
}

/* hamburger icon: three lines via span + pseudo-elements */
button[aria-controls="mobile-nav"] > span:first-child {
  display: block;
  width: 1.5rem;
  height: 2px;
  background: var(--white);
  position: relative;
  transition: background 0.2s;
}
button[aria-controls="mobile-nav"] > span:first-child::before,
button[aria-controls="mobile-nav"] > span:first-child::after {
  content: "";
  position: absolute;
  width: 100%;
  height: 2px;
  background: var(--white);
  left: 0;
  transition: transform 0.3s, top 0.3s;
}
button[aria-controls="mobile-nav"] > span:first-child::before { top: -7px; }
button[aria-controls="mobile-nav"] > span:first-child::after  { top: 7px; }

/* X state when open */
button[aria-expanded="true"] > span:first-child { background: transparent; }
button[aria-expanded="true"] > span:first-child::before { top: 0; transform: rotate(45deg); }
button[aria-expanded="true"] > span:first-child::after  { top: 0; transform: rotate(-45deg); }

/* desktop: restyle hamburger into a brutalist text trigger.
   fullscreen nav stays available via visibility + transform. */
@media (min-width: 48em) {

  /* replace hamburger icon with monospace text label */
  button[aria-controls="mobile-nav"] {
    width: auto;
    height: auto;
    padding: 0.5rem 0.75rem;
    bottom: 2rem;
    right: 2rem;
    background: transparent;
    border: 1px solid var(--grey);
    font-family: var(--font-mono);
    font-size: var(--scale-000);
    color: var(--grey);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s, box-shadow 0.2s;
  }

  button[aria-controls="mobile-nav"]:hover {
    color: var(--red-text);
    border-color: var(--red-text);
    background: transparent;
    box-shadow: 0 0 12px rgba(230, 59, 46, 0.2);
  }

  /* hide the icon AND the mobile word on desktop. must match the
     base rule's span:first-child specificity or the lines reappear. */
  button[aria-controls="mobile-nav"] > span:first-child,
  button[aria-controls="mobile-nav"] > [data-menu-label] {
    display: none;
  }
  button[aria-controls="mobile-nav"]::after {
    content: "[  ///  ]";
    display: block;
  }

  /* swap label to close indicator when open */
  button[aria-expanded="true"][aria-controls="mobile-nav"]::after {
    content: "[  ×  ]";
  }
  button[aria-expanded="true"][aria-controls="mobile-nav"] {
    color: var(--white);
    border-color: var(--white);
    z-index: 200; /* sits above the nav overlay */
  }

  /* visibility instead of display:none - hidden but animatable */
  #mobile-nav {
    visibility: hidden;
    display: flex;
  }

  #mobile-nav[data-open] {
    visibility: visible;
  }
}

/* nav panel */
#mobile-nav {
  position: fixed;
  inset: 0;
  background: var(--black);
  z-index: 150;
  display: flex;
  flex-direction: column;
  /* flex-start + auto margins on first/last child, not
     justify-content: center - centering a scrollable column
     clips both ends once the list outgrows the screen */
  justify-content: flex-start;
  align-items: flex-start;
  padding: var(--s-l) 8vw;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  counter-reset: nav-item;
}

/* centred when it fits, scrollable when it doesn't.
   direct-child selectors so it works whether the menu
   renders bare <a> tags (fallback) or <li> items (WP menu) */
#mobile-nav > :first-child { margin-block-start: auto; }
#mobile-nav > :last-child  { margin-block-end: auto; }

#mobile-nav[data-open] {
  transform: translateX(0);
}

#mobile-nav a {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 0.4rem + 5vw, 3.2rem); /* ten links now - sized so the full list fits a phone screen */
  color: var(--white);
  display: block;
  padding: var(--s-xs) 0;
  text-transform: uppercase;
  letter-spacing: -0.02em;
  line-height: 1.1;
  transition: color 0.2s, transform 0.2s, letter-spacing 0.35s;
}

#mobile-nav a:hover {
  color: var(--red-text);
  transform: translateX(1.5rem) skewX(-2deg);
  letter-spacing: 0.06em;
}

/* number each link with a CSS counter */
#mobile-nav a::before {
  content: counter(nav-item, decimal-leading-zero) " ";
  counter-increment: nav-item;
  font-family: var(--font-mono);
  font-size: 0.35em;
  color: var(--red-text);
  vertical-align: super;
  margin-inline-end: 0.5em;
  letter-spacing: 0.1em;
}


/* ============================================
   IX. FOOTER
   ground-level. ghost watermark. mono links.
   no classes needed - it's the only <footer>.
   ============================================ */
footer {
  border-block-start: 3px solid var(--red);
  padding: var(--s-2xl) clamp(var(--s-m), 5vw, 8vw); /* top/bottom 128px, left/right min 16px, max ~128px */
  margin-block-start: var(--s-2xl);
  position: relative;
  overflow: hidden;
}

/* ghost watermark via ::before */
footer::before {
  content: "THE WEB REBELLION PROJECT";
  font-family: var(--font-display);
  font-size: clamp(4rem, 2rem + 8vw, 12rem); /* min 64px, max 192px, the ghost watermark text */
  color: var(--mid);
  opacity: 0.06;
  position: absolute;
  inset-block-end: var(--s-m);
  inset-inline-end: 3vw;
  line-height: 1;
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
  text-transform: uppercase;
}

footer nav {
  display: flex;
  flex-direction: column;
  gap: var(--s-m);
  margin-block-end: var(--s-xl);
}

footer nav a {
  font-family: var(--font-mono);
  font-size: var(--scale-00);
  color: var(--grey);
  letter-spacing: 0.08em;
  transition: color 0.2s, letter-spacing 0.3s;
}

footer nav a:hover {
  color: var(--white);
  letter-spacing: 0.16em;
}

footer > .container > p {
  font-family: var(--font-body);
  font-size: var(--scale-0);
  color: var(--grey);
  font-style: italic;
  max-inline-size: var(--measure-narrow);
}

@media (min-width: 48em) {
  footer nav {
    flex-direction: row;
    /* nine links now - wrap into tidy lines instead of
       marching off the right edge of the screen */
    flex-wrap: wrap;
    column-gap: var(--s-l);
    row-gap: var(--s-s);
    max-inline-size: 60rem;
  }
}


/* ============================================
   X. HOME PAGE - HERO
   opening salvo. full viewport, layered depth.
   [data-hero] and [data-effect] attributes
   target sub-elements without classes.

   inspired by:
   - Lynn Fisher: layered pseudo-elements as art,
     CSS-only grain/texture, single-div thinking
   - jason.works: bold typographic scale, interactive
     cursor effects, scroll-driven depth
   ============================================ */
[data-hero] {
  /* SC 1.4.10: the glitch spans' translations extended the scrollable
     area ~16px at 320px. clip contains them without creating a scroll
     container, so sticky and fixed descendants are unaffected. */
  overflow-x: clip;
  min-block-size: 100dvh;
  display: grid;
  align-content: end;
  padding: var(--s-xl) 3vw;
  padding-block-end: 6vh;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  animation: crt-boot 0.6s 0.1s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes crt-boot {
  0%   { clip-path: inset(49.5% 10% 49.5% 10%); filter: brightness(3) saturate(0); }
  30%  { clip-path: inset(48% 0% 48% 0%); filter: brightness(2) saturate(0.2); }
  60%  { clip-path: inset(20% 0% 20% 0%); filter: brightness(1.3) saturate(0.7); }
  100% { clip-path: inset(0% 0% 0% 0%); filter: brightness(1) saturate(1); }
}

/* decorative overlays: each identified by data-effect -
   Lynn Fisher technique of generative CSS texture */

[data-effect="noise"] {
  position: absolute;
  inset: -50%;
  width: 300%;
  height: 300%;
  z-index: 10;
  pointer-events: none;
  opacity: 0.03;
  background-image:
    url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: noise-drift 0.15s steps(3) infinite;
}

@keyframes noise-drift {
  0%   { transform: translate(0, 0); }
  33%  { transform: translate(-5%, -8%); }
  66%  { transform: translate(3%, 5%); }
  100% { transform: translate(-2%, -3%); }
}

[data-effect="scanlines"] {
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.12) 2px,
    rgba(0, 0, 0, 0.12) 4px
  );
  opacity: 0;
  animation: scanlines-in 0.3s 0.5s ease forwards;
}

@keyframes scanlines-in { to { opacity: 1; } }

/* sweeping scan beam across the hero */
[data-effect="scanlines"]::after {
  content: "";
  position: absolute;
  left: 0; width: 100%; height: 2px;
  background: rgba(230, 59, 46, 0.15);
  box-shadow: 0 0 12px 4px rgba(230, 59, 46, 0.08);
  z-index: 1;
  animation: hero-scan-line 4s 1.5s linear infinite;
}

@keyframes hero-scan-line {
  0%   { top: -2px; opacity: 0; }
  5%   { opacity: 1; }
  95%  { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}

[data-effect="vignette"] {
  position: absolute;
  inset: 0;
  z-index: 9;
  pointer-events: none;
  background: radial-gradient(
    ellipse 80% 70% at 50% 50%,
    transparent 40%,
    rgba(0, 0, 0, 0.55) 100%
  );
}

/* decorative rings on the vignette layer */
[data-effect="vignette"]::before {
  content: "";
  position: absolute;
  top: -20vh; right: -15vw;
  width: clamp(20rem, 50vw, 50rem); /* min 320px, max 800px, decorative ring */
  aspect-ratio: 1;
  border: 2px solid var(--red);
  border-radius: 50%;
  opacity: 0.06;
  pointer-events: none;
  animation: slow-spin 120s linear infinite;
}

[data-effect="vignette"]::after {
  content: "";
  position: absolute;
  bottom: -15vh; left: -10vw;
  width: clamp(14rem, 35vw, 35rem); /* min 224px, max 560px, smaller decorative ring */
  aspect-ratio: 1;
  border: 1px solid var(--cyan);
  border-radius: 50%;
  opacity: 0.04;
  pointer-events: none;
  animation: slow-spin 90s linear infinite reverse;
}

@keyframes slow-spin { to { transform: rotate(360deg); } }

/* cursor-reactive gradient blob */
[data-effect="blob"] {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0.7;
  background: radial-gradient(
    circle 35vmax at var(--blob-x, 50%) var(--blob-y, 50%),
    rgba(230, 59, 46, 0.18) 0%,
    rgba(232, 99, 43, 0.1) 25%,
    rgba(0, 212, 255, 0.03) 50%,
    transparent 70%
  );
  mix-blend-mode: screen;
}

/* second blob layer for depth */
[data-effect="blob"]::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle 20vmax at calc(100% - var(--blob-x, 50%)) calc(100% - var(--blob-y, 50%)),
    rgba(0, 212, 255, 0.08) 0%,
    transparent 50%
  );
  mix-blend-mode: screen;
}

/* perspective grid background (cyberpunk floor) */
[data-hero]::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(230, 59, 46, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(230, 59, 46, 0.04) 1px, transparent 1px);
  background-size: 4rem 4rem;
  mask-image: linear-gradient(to top, rgba(0,0,0,0.4) 0%, transparent 60%);
  -webkit-mask-image: linear-gradient(to top, rgba(0,0,0,0.4) 0%, transparent 60%);
  transform: perspective(600px) rotateX(45deg);
  transform-origin: bottom center;
  animation: grid-pulse 4s ease-in-out infinite;
}

@keyframes grid-pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* power surge flash on boot */
[data-hero]::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  background: white;
  animation: power-surge 2.2s ease-out forwards;
}

@keyframes power-surge {
  0%    { opacity: 0; }
  3%    { opacity: 0.8; }
  6%    { opacity: 0; }
  8%    { opacity: 0.4; }
  10%   { opacity: 0; }
  12%   { opacity: 0.15; }
  15%   { opacity: 0; }
  100%  { opacity: 0; }
}

/* hero content wrapper */
[data-hero] .container {
  position: relative;
  z-index: 20;
  will-change: transform, opacity;
  /* JS sets --parallax-y and --parallax-opacity.
     CSS owns the visual rules. */
  transform: translateY(var(--parallax-y, 0));
  opacity: var(--parallax-opacity, 1);
}

/* hero title: animated gradient fill + chromatic split */
[data-hero] h1 {
  font-size: clamp(3.5rem, 2rem + 12vw, 16rem); /* min 56px on mobile, max 256px on wide screens */
  line-height: 0.82;
  margin-inline-start: -0.07em;
  max-inline-size: none;
  --chroma-x: 0px;
  --chroma-y: 0px;
  background: linear-gradient(
    135deg,
    var(--white) 0%,
    var(--white) 30%,
    var(--red) 45%,
    var(--orange) 55%,
    var(--cyan) 65%,
    var(--white) 75%,
    var(--white) 100%
  );
  background-size: 400% 400%;
  -webkit-text-stroke: 0.5px rgba(255,255,255,0.05);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: hero-gradient-shift 8s ease-in-out infinite;
  filter:
    drop-shadow(4px 0 0 rgba(230, 59, 46, 0.3))
    drop-shadow(-3px 0 0 rgba(0, 212, 255, 0.2))
    drop-shadow(0 2px 0 rgba(232, 99, 43, 0.1));
  transition: filter 0.3s ease;
}

@keyframes hero-gradient-shift {
  0%   { background-position: 0% 50%; }
  25%  { background-position: 100% 0%; }
  50%  { background-position: 100% 100%; }
  75%  { background-position: 0% 100%; }
  100% { background-position: 0% 50%; }
}

/* word-by-word kinetic entrance - each span gets staggered delay via --i */
[data-hero] h1 > span {
  display: inline-block;
  opacity: 1;
}

[data-js] [data-hero] h1 > span {
  opacity: 0;
  transform: translateY(0.4em) skewX(-8deg);
  filter: blur(6px);
  animation: word-slam 0.45s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  animation-delay: calc(0.5s + var(--i) * 0.08s);
}

/* stagger indices assigned structurally - no style attributes
   in the markup. the count runs continuously across the h1 and
   the paragraph after it, so the paragraph rules pick up where
   the headline leaves off (9, 10, 11). */
[data-hero] h1 > span:nth-child(1) { --i: 0; }
[data-hero] h1 > span:nth-child(2) { --i: 1; }
[data-hero] h1 > span:nth-child(3) { --i: 2; }
[data-hero] h1 > span:nth-child(4) { --i: 3; }
[data-hero] h1 > span:nth-child(5) { --i: 4; }
[data-hero] h1 > span:nth-child(6) { --i: 5; }
[data-hero] h1 > span:nth-child(7) { --i: 6; }
[data-hero] h1 > span:nth-child(8) { --i: 7; }
[data-hero] h1 > span:nth-child(9) { --i: 8; }
[data-hero] h1 + p > span:nth-child(1) { --i: 9; }
[data-hero] h1 + p > span:nth-child(2) { --i: 10; }
[data-hero] h1 + p > span:nth-child(3) { --i: 11; }

@keyframes word-slam {
  0%   { opacity: 0; transform: translateY(1.2em) scaleY(1.8) skewX(-15deg); filter: blur(12px) brightness(3); }
  30%  { opacity: 1; transform: translateY(-0.15em) scaleY(0.9) skewX(5deg); filter: blur(0) brightness(1.2); }
  50%  { transform: translateY(0.05em) scaleY(1.05) skewX(-2deg); filter: blur(0) brightness(1); }
  70%  { transform: translateY(-0.02em) scaleY(1) skewX(0.5deg); }
  100% { opacity: 1; transform: translateY(0) scaleY(1) skewX(0deg); filter: blur(0) brightness(1); }
}

/* mobile + clip-safety: gradient-clipped text with animated,
   filtered child spans breaks background-clip on iOS Safari -
   the spans get promoted to their own layers and the transparent
   fill is left with nothing behind it. below 48em the headline
   drops the gradient trick for a solid fill; the word-slam and
   the chromatic drop-shadows carry the character instead. */
@media (max-width: 48em) {
  [data-hero] h1 {
    /* the declaration must be readable without heroic scrolling:
       triangulated by two pilot phone participants and the final
       presentation feedback */
    font-size: clamp(2.1rem, 11vw, 3rem);
    background: none;
    -webkit-text-fill-color: var(--white);
    color: var(--white);
    animation: none;
  }
}

/* browsers without text-clip support get solid white everywhere */
@supports not ((-webkit-background-clip: text) or (background-clip: text)) {
  [data-hero] h1 {
    background: none;
    -webkit-text-fill-color: var(--white);
    color: var(--white);
    animation: none;
  }
}

/* chromatic aberration intensifies on mouse tracking */
[data-hero][data-tracking] h1 {
  filter:
    drop-shadow(calc(var(--chroma-x) * 1.5) calc(var(--chroma-y) * 0.5) 0 rgba(230, 59, 46, 0.35))
    drop-shadow(calc(var(--chroma-x) * -1) calc(var(--chroma-y) * -0.3) 0 rgba(0, 212, 255, 0.25))
    drop-shadow(calc(var(--chroma-x) * 0.5) calc(var(--chroma-y) * 0.8) 0 rgba(232, 99, 43, 0.15));
  transition: filter 0.08s linear;
}

/* hero subtitle: mono text with left border */
[data-hero] h1 + p {
  font-family: var(--font-mono);
  font-size: clamp(var(--scale-00), 1vw + 0.4rem, var(--scale-0)); /* min 11px, max 16px */
  color: var(--grey);
  letter-spacing: 0.02em;
  line-height: 1.85;
  max-inline-size: 55ch;
  margin-block-start: var(--s-xl);
  border-inline-start: 3px solid var(--red);
  padding-inline-start: var(--s-l);
  position: relative;
}

[data-hero] h1 + p > span { display: block; opacity: 1; }

[data-js] [data-hero] h1 + p > span {
  opacity: 0;
  transform: translateX(-1em);
  animation: line-slide 0.4s ease forwards;
  animation-delay: calc(0.5s + var(--i) * 0.08s);
}

@keyframes line-slide {
  0%   { opacity: 0; transform: translateX(-1em); }
  100% { opacity: 1; transform: translateX(0); }
}

/* dot marker on the subtitle border */
[data-hero] h1 + p::before {
  content: "";
  position: absolute;
  left: -5px; top: 0;
  width: 7px; height: 7px;
  background: var(--red);
  border-radius: 50%;
}

/* punch line: "THIS ISN'T THAT." - the statement.
   [data-punch] separates it from the standard
   [data-glitch] system to avoid CSS conflicts. */
[data-hero] [data-punch] {
  font-family: var(--font-display);
  font-size: clamp(3rem, 1rem + 10vw, 12rem); /* min 48px, max 192px, the punch line */
  line-height: 0.88;
  letter-spacing: -0.045em;
  color: var(--red);
  text-transform: uppercase;
  margin-block-start: var(--s-xl);
  display: inline-block;
  position: relative;
  text-shadow:
    0.04em 0.02em 0 var(--red-dim),
    -0.02em -0.01em 0 rgba(0, 212, 255, 0.12);
  filter: drop-shadow(0 0 30px rgba(230, 59, 46, 0.3));
}

[data-hero] [data-punch] > span { display: inline-block; opacity: 1; }

[data-js] [data-hero] [data-punch] > span {
  opacity: 0;
  animation: punch-glitch 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  animation-delay: 1.6s;
}

@keyframes punch-glitch {
  0%   { opacity: 0; transform: translateX(-40px) scaleX(1.4) skewX(-25deg); filter: blur(15px) brightness(4); clip-path: inset(0 100% 0 0); }
  8%   { opacity: 1; transform: translateX(15px) scaleX(0.9) skewX(15deg); filter: blur(3px) brightness(2); clip-path: inset(0 10% 0 0); }
  16%  { transform: translateX(-8px) scaleX(1.05) skewX(-8deg); filter: blur(0) brightness(1); clip-path: inset(25% 0 45% 0); }
  24%  { transform: translateX(4px) skewX(4deg); clip-path: inset(0 0 55% 0); }
  35%  { transform: translateX(-2px) skewX(-1deg); clip-path: inset(40% 0 0 0); }
  50%  { transform: translateX(0) skewX(0); clip-path: inset(0 0 0 0); }
  100% { opacity: 1; transform: none; clip-path: inset(0 0 0 0); }
}

/* underline strike-in after the punch lands */
[data-hero] [data-punch]::after {
  content: "";
  position: absolute;
  bottom: 0.12em; left: 0;
  width: 100%; height: 0.07em;
  background: var(--red);
  transform: scaleX(0);
  transform-origin: left;
  animation: strike-in 0.35s 2.1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes strike-in { to { transform: scaleX(1); } }

/* glitch layer on the punch (cyan ghost) */
[data-hero] [data-punch]::before {
  content: attr(data-punch);
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  color: var(--cyan);
  opacity: 0;
  pointer-events: none;
}

[data-hero][data-active] [data-punch]::before {
  animation: glitch-top 3s steps(1) infinite;
}

@keyframes glitch-top {
  0%, 89%  { opacity: 0; }
  90%      { opacity: 0.6; transform: translate(-3px, -2px); clip-path: inset(10% 0 70% 0); }
  91%      { opacity: 0.4; transform: translate(2px, 1px); clip-path: inset(40% 0 30% 0); }
  92%      { opacity: 0; }
  95%      { opacity: 0.5; transform: translate(-1px, 3px); clip-path: inset(60% 0 10% 0); }
  96%, 100% { opacity: 0; }
}

/* scroll cue chevron */
[data-scroll-cue] {
  position: absolute;
  bottom: 2vh; left: 50%;
  transform: translateX(-50%);
  z-index: 20;
}

[data-scroll-cue] span {
  display: block;
  width: 1.5rem; height: 1.5rem;
  border-right: 2px solid var(--red);
  border-bottom: 2px solid var(--red);
  transform: rotate(45deg);
  opacity: 0.4;
  animation: scroll-bounce 1.8s ease-in-out infinite;
}

@keyframes scroll-bounce {
  0%, 100% { transform: rotate(45deg) translateY(0); opacity: 0.4; }
  50%      { transform: rotate(45deg) translateY(8px); opacity: 0.8; }
}


/* ============================================
   HOME PAGE - QUESTION SECTION
   ============================================ */
[data-section="question"] {
  display: grid;
  grid-template-columns: 1fr;
  place-content: center;
  background: var(--dark);
  padding-inline: clamp(var(--s-l), 8vw, 10vw); /* left/right: min 32px, max ~160px */
  padding-block: clamp(var(--s-xl), 10vh, var(--s-2xl)); /* top/bottom: min 64px, max 128px */
  position: relative;
  border-block: 1px solid var(--mid);
}

/* giant decorative "?" behind the text */
[data-section="question"]::before {
  content: "?";
  font-family: var(--font-display);
  font-size: clamp(15rem, 5rem + 35vw, 55rem); /* min 240px, max 880px, giant decorative question mark */
  color: var(--mid);
  position: absolute;
  right: -5vw; top: 50%;
  transform: translateY(-50%);
  line-height: 0.8;
  pointer-events: none;
  user-select: none;
  opacity: 0.35;
  mix-blend-mode: lighten;
}

[data-section="question"] p {
  font-family: var(--font-body);
  font-size: clamp(1.3rem, 1rem + 1.5vw, 2.2rem); /* min 21px, max 35px */
  line-height: 1.55;
  color: var(--off-white);
  max-inline-size: 45ch;
  font-style: italic;
}


/* ============================================
   HOME PAGE - PROVOCATION WALL
   scrolling text rows, each at a different speed.
   rows targeted by :nth-child - order IS the design.
   ============================================ */
[data-section="wall"] {
  padding-block: var(--s-xl);
  overflow: hidden;
  background:
    radial-gradient(ellipse at 20% 25%, rgba(230, 59, 46, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 75% 70%, rgba(232, 99, 43, 0.04) 0%, transparent 45%),
    radial-gradient(ellipse at 50% 50%, var(--dark) 0%, var(--black) 100%);
}

[data-section="wall"] > div {
  display: flex;
  white-space: nowrap;
  padding-block: var(--s-s);
  animation: wall-scroll 30s linear infinite;
}

[data-section="wall"] > div > span {
  font-family: var(--font-display);
  font-size: clamp(2rem, 1rem + 5vw, 6rem); /* min 32px, max 96px */
  text-transform: uppercase;
  color: var(--mid);
  padding-inline: clamp(1.5rem, 4vw, var(--s-xl)); /* min 24px, max 64px, space between phrases */
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

[data-section="wall"] > div > span + span::before {
  content: "\00b7";
  padding-inline-end: clamp(1.5rem, 4vw, var(--s-xl)); /* min 24px, max 64px */
  opacity: 0.3;
}

/* each row gets unique character: speed, direction, colour */
[data-section="wall"] > div:nth-child(1) { animation-duration: 45s; }
[data-section="wall"] > div:nth-child(1) > span { color: var(--red); opacity: 0.15; font-size: clamp(2.5rem, 1rem + 6vw, 7rem); /* min 40px, max 112px */ }
[data-section="wall"] > div:nth-child(2) { animation-direction: reverse; }
[data-section="wall"] > div:nth-child(2) > span { color: var(--white); opacity: 0.08; font-size: clamp(1.8rem, 1rem + 4vw, 5rem); /* min 29px, max 80px */ }
[data-section="wall"] > div:nth-child(3) { animation-duration: 20s; }
[data-section="wall"] > div:nth-child(3) > span { color: var(--orange); opacity: 0.12; }

@keyframes wall-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

@media (max-width: 48em) {
  [data-section="wall"] > div > span {
    font-size: clamp(1.2rem, 3vw, 2rem); /* min 19px, max 32px, smaller wall text on mobile */
  }
}


/* ============================================
   HOME PAGE - CTA SECTION
   simple links. let the hero do the talking.
   marquee = emotional hook; links = functional exit.
   ============================================ */
[data-section="cta"] {
  display: grid;
  place-content: center;
  text-align: center;
  padding: clamp(var(--s-xl), 10vh, var(--s-2xl)) clamp(var(--s-m), 5vw, var(--s-xl)); /* top/bottom: 64-128px, left/right: 16-64px */
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(230, 59, 46, 0.08) 0%, transparent 60%),
    linear-gradient(to bottom, var(--black), var(--dark) 80%);
}

/* decorative rings */
[data-section="cta"]::before,
[data-section="cta"]::after {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

[data-section="cta"]::before {
  width: min(70vw, 600px);
  aspect-ratio: 1;
  border: 1.5px solid var(--red);
  opacity: 0.1;
}

[data-section="cta"]::after {
  width: min(45vw, 380px);
  aspect-ratio: 1;
  border: 1px solid var(--orange);
  opacity: 0.06;
  animation: slow-spin 90s linear infinite reverse;
}

/* marquee wrapper */
[data-section="cta"] > div:first-child {
  width: 100%;
  overflow: hidden;
  padding-block: var(--s-l);
  -webkit-mask-image: linear-gradient(90deg, transparent, black 10%, black 90%, transparent);
  mask-image: linear-gradient(90deg, transparent, black 10%, black 90%, transparent);
}

/* marquee track */
[data-section="cta"] > div:first-child > p {
  display: flex;
  gap: 0;
  white-space: nowrap;
  width: max-content;
  animation: cta-scroll 18s linear infinite;
}

[data-section="cta"] > div:first-child > p > span {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 1rem + 8vw, 8rem); /* min 40px, max 128px */
  line-height: 1;
  letter-spacing: -0.03em;
  text-transform: uppercase;
  color: var(--red);
  padding-inline: 0.5em;
  text-shadow:
    0.04em 0.02em 0 var(--red-dim),
    -0.02em -0.01em 0 rgba(0, 212, 255, 0.12);
}

@keyframes cta-scroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-33.333%); }
}

/* navigation links */
[data-section="cta"] nav {
  display: flex;
  flex-direction: column;
  gap: var(--s-m);
  margin-block-start: var(--s-xl);
  align-items: center;
}

[data-section="cta"] nav a {
  font-family: var(--font-mono);
  font-size: clamp(var(--scale-0), 1vw + 0.5rem, var(--scale-1)); /* min 16px, max 23px */
  color: var(--off-white);
  border-block-end: 3px solid var(--red);
  padding-block-end: var(--s-s);
  transition: border-color 0.2s, transform 0.2s, letter-spacing 0.4s, color 0.2s;
  letter-spacing: 0.04em;
}

[data-section="cta"] nav a:hover {
  border-block-end-color: var(--white);
  transform: translateY(-3px);
  letter-spacing: 0.14em;
  color: var(--white);
}

@media (min-width: 48em) {
  [data-section="cta"] nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: var(--s-xl);
    justify-content: center;
  }
}


/* ============================================
   XI. INTRO SECTIONS
   used on manifesto (intro + closing), experiments,
   and archive pages. full viewport, centered content.
   identified with [data-section="intro"].
   ============================================ */
[data-section="intro"] {
  min-block-size: 100dvh;
  display: grid;
  grid-template-columns: 1fr;
  place-content: center;
  padding: var(--s-xl) clamp(var(--s-m), 5vw, var(--s-xl)); /* top/bottom 64px, left/right: 16-64px */
  position: relative;
}

/* intro subtitle (mono text below h1) */
[data-section="intro"] h1 + p {
  font-family: var(--font-mono);
  font-size: clamp(var(--scale-00), 1vw + 0.5rem, var(--scale-1)); /* min 11px, max 23px */
  color: var(--red-text);
  letter-spacing: 0.06em;
  line-height: 1.65;
  max-inline-size: var(--measure-narrow);
  margin-block-start: var(--s-l);
}

/* intro section with only a p (manifesto intro/closing) */
[data-section="intro"] .container > p:only-child {
  font-family: var(--font-mono);
  font-size: clamp(var(--scale-00), 1vw + 0.4rem, var(--scale-0)); /* min 11px, max 16px */
  color: var(--grey);
  letter-spacing: 0.02em;
  line-height: 1.7;
  text-align: center;
}


/* ============================================
   TERMINAL OUTPUT
   narrow-section paragraphs styled as CLI output.
   JS types them out character by character on
   scroll; without JS the text is visible with
   terminal styling only. prompt char via ::before,
   blinking cursor injected as a child <span>.
   ============================================ */
[data-terminal] {
  position: relative;
  padding-inline-start: 1.5em;
}

/* prompt character */
[data-terminal]::before {
  content: ">";
  position: absolute;
  inset-inline-start: 0;
  inset-block-start: 0;
  color: var(--red-text);
  font-family: var(--font-mono);
  font-weight: 700;
  font-style: normal;
}

/* override existing narrow-paragraph styles so all
   [data-terminal] paragraphs look the same.
   specificity must match or beat the original rules. */
[data-section="question"] p[data-terminal],
[data-section="intro"] h1 + p[data-terminal],
[data-section="intro"] .container > p[data-terminal]:only-child {
  font-family: var(--font-mono);
  font-size: clamp(var(--scale-00), 1vw + 0.4rem, var(--scale-0));
  line-height: 1.8;
  color: var(--cyan);
  letter-spacing: 0.03em;
  font-style: normal;
  max-inline-size: none;
  text-align: left;
}

/* blinking cursor - injected by JS as a child <span> */
[data-terminal-cursor] {
  color: var(--red-text);
  animation: terminal-blink 0.7s step-end infinite;
  margin-inline-start: 0.1em;
  font-style: normal;
}

/* cursor fades after typing completes */
[data-terminal-cursor][data-terminal-done] {
  animation: terminal-fade 0.5s ease forwards;
}

@keyframes terminal-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

@keyframes terminal-fade {
  to { opacity: 0; }
}


/* ============================================
   XII. MANIFESTO PAGE
   full-conviction layout. each statement fills
   the viewport. on wide screens, head and body
   split into a sticky two-column grid that
   alternates sides.

   mobile (base): everything stacks.
   desktop (60em+): split grid with sticky headers.
   ============================================ */
article[data-index] {
  padding: var(--s-2xl) var(--s-m);
  position: relative;
  overflow: hidden;
  container-type: inline-size;
}

/* <header> and <div> are direct children of article,
   grid works without display:contents. */

/* giant watermark number via data-index */
article[data-index]::before {
  content: attr(data-index);
  font-family: var(--font-display);
  font-size: clamp(12rem, 8rem + 30vw, 50rem); /* min 192px, max 800px, giant watermark number */
  color: var(--mid);
  opacity: 0.1;
  position: absolute;
  line-height: 0.75;
  pointer-events: none;
  user-select: none;
}

article[data-index]:nth-child(odd of article)::before {
  right: -3vw;
  top: 50%;
  transform: translateY(-55%);
}

article[data-index]:nth-child(even of article)::before {
  left: -3vw;
  top: 50%;
  transform: translateY(-55%);
}

/* divider between statements */
article[data-index] + article[data-index]::after {
  content: "///";
  font-family: var(--font-mono);
  font-size: var(--scale-00);
  color: var(--red-text);
  letter-spacing: 0.5em;
  position: absolute;
  top: 0;
  left: clamp(var(--s-m), 5vw, 5vw); /* min 16px, scales with viewport */
}

/* mobile: even articles get left border for rhythm */
article[data-index]:nth-child(even of article) {
  border-inline-start: 4px solid var(--red);
}

/* statement number */
article[data-index] > header > p {
  font-family: var(--font-mono);
  font-size: var(--scale-000);
  color: var(--red-text);
  margin-block-end: var(--s-m);
  letter-spacing: 0.15em;
}

/* statement title */
article[data-index] h2 {
  font-size: clamp(2.2rem, 1rem + 7vw, 7.5rem); /* min 35px, max 120px */
  line-height: 0.88;
  color: var(--white);
  margin-block-end: var(--s-xl);
  max-inline-size: 18em;
  letter-spacing: -0.035em;
}

/* red titles with chromatic split */
article[data-index] h2[data-glitch] {
  color: var(--red-text);
  text-shadow:
    0.04em 0 0 var(--red-dim),
    -0.03em 0 0 rgba(0, 212, 255, 0.13);
}

/* body section */
article[data-index] > div {
  max-inline-size: 48em;
}

/* body paragraphs */
article[data-index] > div > p {
  font-family: var(--font-body);
  font-size: clamp(1.1rem, 0.5vw + 1rem, 1.45rem); /* min 18px, max 23px, comfortable reading size */
  line-height: 1.8;
  color: var(--off-white);
  margin-block-end: var(--s-l);
}

/* final paragraph: emphasis, pulled left */
article[data-index] > div > p:last-child {
  color: var(--white);
  font-size: clamp(1.2rem, 0.5vw + 1.1rem, 1.65rem); /* min 19px, max 26px, emphasis on final paragraph */
  font-style: italic;
  border-inline-start: 3px solid var(--red);
  padding-inline-start: var(--s-l);
  margin-block-start: var(--s-l);
}

/* desktop: two-column split with sticky headers */
@media (min-width: 60em) {
  article[data-index] {
    display: grid;
    grid-template-columns: 1.2fr 1fr; /* header gets 55% so the big type fits */
    align-items: stretch;
    gap: 0;
    padding: 0;
    overflow: visible;
  }

  article[data-index] h2 {
    font-size: clamp(3rem, 5.5vw, 7rem); /* min 48px, max 112px - sized to fit the 40% grid column */
    line-height: 0.85;
    max-inline-size: 100%;
  }

  article[data-index] > div {
    max-inline-size: 100%;
    padding: var(--s-2xl);
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-block-size: 100dvh;
  }

  article[data-index] > header {
    position: sticky;
    top: 0;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: var(--s-xl);
    overflow: hidden; /* clips any text that still exceeds the column */
  }

  /* odd: head left, body right.
     outer edge (left) gets viewport-relative padding.
     inner edge (right, next to border) gets fixed padding -
     small enough that long words like AUTHORSHIP fit. */
  article[data-index]:nth-child(odd of article) > header {
    padding-inline: clamp(var(--s-m), 5vw, 5vw) var(--s-l); /* left: 5vw, right: 32px */
    border-inline-end: 6px solid var(--red);
  }

  article[data-index]:nth-child(odd of article) > div {
    padding-inline: var(--s-xl) clamp(var(--s-m), 10vw, 10vw); /* left: 64px, right: 10vw */
  }

  /* even: head right, body left (reversed with order) */
  article[data-index]:nth-child(even of article) {
    border-inline-start: none;
  }

  article[data-index]:nth-child(even of article) > header {
    order: 2;
    padding-inline: var(--s-l) clamp(var(--s-m), 5vw, 5vw); /* left: 32px, right: 5vw */
    border-inline-start: 6px solid var(--red);
  }

  article[data-index]:nth-child(even of article) > div {
    order: 1;
    padding-inline: clamp(var(--s-m), 10vw, 10vw) var(--s-xl); /* left: 10vw, right: 64px */
  }
}


/* ============================================
   XIII. EXPERIMENTS PAGE
   intrinsic grid - no breakpoints needed.
   cards overlap and collide deliberately.
   ============================================ */

/* smaller cap than the global h1 - EXPERIMENTS is eleven
   characters and the global 13rem max wraps the final S onto
   its own line inside the 90rem container on wide screens. */
[data-page="experiments"] [data-section="intro"] h1 {
  font-size: clamp(3rem, 2.5rem + 6.5vw, 10.5rem);
}

/* mobile: EXPERIMENTS is one long word; the desktop clamp sized it
   wider than a phone screen, so it broke mid-word (EXPERI / MENTS).
   cap it below the tablet breakpoint so the whole word stays on one
   line, from 320px up. desktop scaling is untouched. */
@media (max-width: 47.99em) {
  [data-page="experiments"] [data-section="intro"] h1 {
    font-size: clamp(1.5rem, 8vw, 3.4rem);
  }
}

/* wider intro paragraph - 42ch was too narrow */
[data-page="experiments"] [data-section="intro"] h1 + p {
  max-inline-size: var(--measure);
}

[data-page="experiments"] [data-grid] {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(22rem, 100%), 1fr));
  gap: var(--s-m);
  padding-block: var(--s-xl) var(--s-2xl);
}

[data-page="experiments"] article {
  container-type: inline-size;
  position: relative;
  background: var(--dark);
  padding: var(--s-xl) var(--s-l);
  overflow: hidden;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s;
  isolation: isolate;
}

/* each card gets unique character - no two alike */
[data-page="experiments"] article:nth-child(1) { border-inline-start: 5px solid var(--red); }
[data-page="experiments"] article:nth-child(2) { border-inline-end: 5px solid var(--orange); margin-block-start: 3rem; }
[data-page="experiments"] article:nth-child(3) { border-block-end: 5px solid var(--red); transform: rotate(-0.6deg); }
[data-page="experiments"] article:nth-child(4) { border-inline-start: 5px solid var(--orange); margin-block-start: -2rem; transform: rotate(0.4deg); }

/* diagonal corner mark */
[data-page="experiments"] article::before {
  content: "";
  position: absolute;
  top: 0; right: 0;
  width: 2.5rem; height: 2.5rem;
  background: linear-gradient(135deg, transparent 50%, var(--red) 50%);
  opacity: 0.5;
  transition: opacity 0.3s;
}
[data-page="experiments"] article:nth-child(even)::before {
  background: linear-gradient(135deg, transparent 50%, var(--orange) 50%);
}
[data-page="experiments"] article:hover::before { opacity: 1; }

/* brutalist offset shadow on hover */
[data-page="experiments"] article:hover {
  transform: translate(-4px, -4px) rotate(0deg);
  box-shadow: 4px 4px 0 var(--red);
}
[data-page="experiments"] article:nth-child(even):hover {
  transform: translate(4px, -4px) rotate(0deg);
  box-shadow: -4px 4px 0 var(--orange);
}

/* stretched link - the whole card is the target,
   not just the 'enter experiment' text */
[data-page="experiments"] article > a::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}

/* focus ring on the card boundary, not the link text */
[data-page="experiments"] article:has(a:focus-visible) {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

[data-page="experiments"] article > a:focus-visible {
  outline: none;
}

/* card number */
[data-page="experiments"] article > p:first-child {
  font-family: var(--font-display);
  font-size: clamp(3rem, 5cqi, 5.5rem); /* min 48px, max 88px, scales with card width (cqi = container query) */
  color: var(--mid);
  line-height: 1;
  margin-block-end: var(--s-s);
  letter-spacing: -0.04em;
  opacity: 0.4;
}

/* card title */
[data-page="experiments"] article h2 {
  font-size: clamp(1.2rem, 3cqi, 2.2rem); /* min 19px, max 35px, scales with card width */
  margin-block-end: var(--s-m);
  letter-spacing: -0.02em;
  line-height: 1.1;
}

/* card excerpt */
[data-page="experiments"] article > p:nth-of-type(2) {
  font-family: var(--font-body);
  font-size: clamp(0.9rem, 1.5cqi, 1.15rem); /* min 14px, max 18px, scales with card width */
  color: var(--light);
  line-height: 1.7;
  margin-block-end: var(--s-l);
  max-inline-size: 35ch;
}

/* card link */
[data-page="experiments"] article > a {
  font-family: var(--font-mono);
  font-size: var(--scale-000);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  position: relative;
  display: inline-block;
}

[data-page="experiments"] article > a::after {
  content: "";
  position: absolute;
  bottom: -2px; left: 0;
  width: 100%; height: 2px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.3s ease;
}

[data-page="experiments"] article:hover > a::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* stretched link - makes the whole card clickable */
[data-page="experiments"] article > a::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}

@media (max-width: 48em) {
  [data-page="experiments"] article:nth-child(even) {
    margin-inline-start: 6vw;
  }
}

/* experiment page navigation - prev/next + back */
[data-exp-nav] {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--s-xl);
  margin-block-start: var(--s-xl);
  font-family: var(--font-mono);
  font-size: var(--scale-00);
}

[data-exp-nav] a {
  color: var(--cyan);
  text-decoration: none;
  letter-spacing: 0.05em;
  transition: color 0.3s;
}

[data-exp-nav] a:hover,
[data-exp-nav] a:focus-visible {
  color: var(--white);
}

[data-exp-nav] [data-exp-back] {
  color: var(--grey);
}

[data-exp-nav] [data-exp-back]:hover,
[data-exp-nav] [data-exp-back]:focus-visible {
  color: var(--white);
}

@media (max-width: 30em) {
  [data-exp-nav] { gap: var(--s-m); font-size: var(--scale-000); }
}

/* explore grid - all experiment cards shown at the
   bottom of each individual experiment page so users
   can deliberately choose which to visit next. */
[data-exp-explore] {
  padding: var(--s-2xl) var(--s-m) var(--s-xl);
  border-block-start: 1px solid var(--mid);
}

[data-exp-explore] > h2 {
  font-family: var(--font-mono);
  font-size: var(--scale-00);
  color: var(--grey);
  text-align: center;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-block-end: var(--s-xl);
}

[data-exp-explore] [data-exp-grid] {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(18rem, 100%), 1fr));
  gap: var(--s-m);
  max-width: min(100%, 80rem);
  margin-inline: auto;
}

[data-exp-explore] article {
  background: var(--dark);
  padding: var(--s-l);
  position: relative;
  overflow: hidden;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s;
  border-inline-start: 3px solid var(--red);
}

[data-exp-explore] article:nth-child(even) {
  border-inline-start-color: var(--orange);
}

[data-exp-explore] article:hover {
  transform: translate(-3px, -3px);
  box-shadow: 3px 3px 0 var(--red);
}

[data-exp-explore] article:nth-child(even):hover {
  box-shadow: 3px 3px 0 var(--orange);
}

/* mute the card for the current experiment */
[data-exp-explore] article[data-current] {
  opacity: 0.35;
  pointer-events: none;
  border-inline-start-color: var(--mid);
}

[data-exp-explore] article > p:first-child {
  font-family: var(--font-display);
  font-size: clamp(2rem, 3vw, 3.5rem);
  color: var(--mid);
  line-height: 1;
  margin-block-end: var(--s-xs);
  opacity: 0.5;
}

[data-exp-explore] article h3 {
  font-size: clamp(1rem, 1.5vw, 1.4rem);
  margin-block-end: var(--s-s);
  line-height: 1.15;
}

[data-exp-explore] article > p:nth-of-type(2) {
  font-family: var(--font-body);
  font-size: clamp(0.8rem, 1vw, 0.95rem);
  color: var(--light);
  line-height: 1.65;
  margin-block-end: var(--s-m);
}

[data-exp-explore] article > a {
  font-family: var(--font-mono);
  font-size: var(--scale-000);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* stretched link - whole card clickable */
[data-exp-explore] article > a::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}

/* focus ring on the card boundary, not the link text */
[data-exp-explore] article:has(a:focus-visible) {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

[data-exp-explore] article > a:focus-visible {
  outline: none;
}


/* ============================================
   XIV. ARCHIVE PAGE
   chaotic mosaic on desktop, clean stack on mobile.
   mobile-first: single column base.
   ============================================ */
[data-page="archive"] [data-grid] {
  display: grid;
  gap: var(--s-s);
  padding-block: var(--s-xl) var(--s-2xl);
}

[data-page="archive"] article {
  background: var(--dark);
  padding: var(--s-l);
  position: relative;
  overflow: hidden;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s;
  container-type: inline-size;
}

[data-page="archive"] article h2 {
  font-size: clamp(0.85rem, 2cqi, 1.15rem); /* min 14px, max 18px, scales with card width */
  margin-block-end: var(--s-s);
  letter-spacing: 0.02em;
  line-height: 1.2;
}

[data-page="archive"] article p {
  font-family: var(--font-body);
  font-size: clamp(0.8rem, 1.5cqi, 1rem); /* min 13px, max 16px, scales with card width */
  color: var(--light);
  line-height: 1.65;
}

/* red underline reveal on hover */
[data-page="archive"] article::after {
  content: "";
  position: absolute;
  inset-block-end: 0;
  inset-inline: 0;
  block-size: 2px;
  background: var(--red);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.35s ease;
}
[data-page="archive"] article:hover::after { transform: scaleX(1); }

/* subtle rotation on mobile - cards feel hand-placed */
[data-page="archive"] article:nth-child(3n+1) { transform: rotate(-0.5deg); }
[data-page="archive"] article:nth-child(3n+2) { transform: rotate(0.3deg); }

[data-page="archive"] article:hover {
  transform: rotate(0deg) translate(-3px, -3px);
  box-shadow: 3px 3px 0 var(--red);
  z-index: 2;
}

/* tablet: two-column staggered grid */
@media (min-width: 30em) {
  [data-page="archive"] [data-grid] {
    grid-template-columns: 1fr 1fr;
  }
  [data-page="archive"] article:nth-child(even) {
    margin-block-start: 1.5rem;
  }
}

/* desktop: 12-column chaotic placement */
@media (min-width: 48em) {
  [data-page="archive"] [data-grid] {
    grid-template-columns: repeat(12, 1fr);
    grid-auto-rows: minmax(8rem, auto);
  }
  [data-page="archive"] article:nth-child(1)  { grid-column: 1 / 5; }
  [data-page="archive"] article:nth-child(2)  { grid-column: 5 / 9;  border-block-start: 3px solid var(--red); }
  [data-page="archive"] article:nth-child(3)  { grid-column: 9 / 13; margin-block-start: 2rem; }
  [data-page="archive"] article:nth-child(4)  { grid-column: 2 / 7;  border-inline-start: 3px solid var(--orange); }
  [data-page="archive"] article:nth-child(5)  { grid-column: 7 / 11; margin-block-start: -1rem; }
  [data-page="archive"] article:nth-child(6)  { grid-column: 1 / 4;  border-block-start: 3px solid var(--red); }
  [data-page="archive"] article:nth-child(7)  { grid-column: 4 / 8; }
  [data-page="archive"] article:nth-child(8)  { grid-column: 8 / 13; margin-block-start: 1.5rem; border-inline-end: 3px solid var(--red); }
  [data-page="archive"] article:nth-child(9)  { grid-column: 1 / 6; }
  [data-page="archive"] article:nth-child(10) { grid-column: 6 / 10; border-block-start: 3px solid var(--orange); }
  [data-page="archive"] article:nth-child(11) { grid-column: 10 / 13; margin-block-start: 2rem; }
  [data-page="archive"] article:nth-child(12) { grid-column: 3 / 10; border-block-end: 3px solid var(--red); }

  [data-page="archive"] article:nth-child(3n+1) { transform: rotate(-0.7deg); }
  [data-page="archive"] article:nth-child(3n+2) { transform: rotate(0.4deg); }
  [data-page="archive"] article:nth-child(5n)   { transform: rotate(-1deg) translateY(0.4rem); }
}


/* ============================================
   XV. ABOUT & COLOPHON PAGES
   both use [data-layout="prose"] - Heydon-style
   wide, left-border prose with code-comment headings.
   ============================================ */
[data-layout="prose"] {
  padding: var(--s-2xl) clamp(var(--s-m), 5vw, 8vw); /* top/bottom 128px, left/right min 16px, max ~128px */
}

[data-layout="prose"] h1 {
  margin-block-end: var(--s-xl);
}

[data-layout="prose"] h2 {
  font-size: clamp(1.5rem, 1rem + 3vw, 3.2rem); /* min 24px, max 51px */
  color: var(--red);
  margin-block-start: var(--s-2xl);
  margin-block-end: var(--s-l);
  letter-spacing: -0.02em;
  position: relative;
  padding-inline-start: var(--s-l);
}

/* code-comment prefix on h2 */
[data-layout="prose"] h2::before {
  content: "//";
  position: absolute;
  left: 0;
  color: var(--mid);
  font-family: var(--font-mono);
  font-size: 0.6em;
}

[data-layout="prose"] > .container > p {
  font-family: var(--font-body);
  font-size: clamp(1.1rem, 0.5vw + 1rem, 1.4rem); /* min 18px, max 22px, comfortable reading size */
  line-height: 1.75;
  color: var(--off-white);
  max-inline-size: var(--measure-narrow);
  padding-inline-start: var(--s-l);
  border-inline-start: 1px solid var(--mid);
}

[data-layout="prose"] > .container > p + p {
  margin-block-start: var(--s-m);
}

/* :has() - if section contains a hovered h2, shift border colour */
[data-layout="prose"]:has(h2:hover) > .container > p {
  border-inline-start-color: var(--red-text);
  transition: border-color 0.3s;
}

/* colophon definition list */
[data-page="colophon"] dl {
  font-family: var(--font-mono);
  font-size: clamp(var(--scale-000), 1vw + 0.4rem, var(--scale-0)); /* min ~11px, max 16px */
  color: var(--off-white);
  line-height: 2.2;
  margin-block-start: var(--s-xl);
  max-inline-size: 50rem;
}

[data-page="colophon"] dt {
  color: var(--red-text);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.8em;
  margin-block-start: var(--s-m);
}

[data-page="colophon"] dd {
  margin: 0;
  border-block-end: 1px solid var(--mid);
  padding-block-end: var(--s-xs);
}

@media (min-width: 48em) {
  [data-page="colophon"] dl {
    display: grid;
    grid-template-columns: fit-content(14rem) 1fr;
    gap: 0 var(--s-l);
  }

  [data-page="colophon"] dt {
    margin-block-start: 0;
  }
}


/* ============================================
   XVI. VEEFAX - Teletext / Ceefax inspired
   ============================================
   references BBC Ceefax (1974-2012):
   - black background, bright primary colours
   - monospace only, no anti-aliasing feel
   - page numbers (P200, P201...)
   - header bar: service name + page + clock
   - block graphic separators (coloured bars)
   - double-height headlines (CSS transform)
   - coloured index navigation bar at bottom
   ============================================ */

[data-veefax] {
  --ceefax-black:   #000000;
  --ceefax-red:     #ee0000;  /* was #ff0000 - white text now measures 4.53:1 */
  --ceefax-green:   #00ff00;
  --ceefax-yellow:  #ffff00;
  --ceefax-blue:    #0000ff;
  --ceefax-magenta: #ff00ff;
  --ceefax-cyan:    #00ffff;
  --ceefax-white:   #ffffff;

  background: var(--ceefax-black);
  color: var(--ceefax-white);
  font-family: var(--font-mono);
  font-size: clamp(0.8rem, 0.5vw + 0.7rem, 1.05rem); /* min 13px, max 17px, teletext base text */
  line-height: 1.5;
  padding: 0;
  max-width: 48rem;
  margin-inline: auto;
  image-rendering: pixelated;
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: unset;
}

/* CRT curvature vignette */
[data-veefax]::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 99;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 65%, rgba(0, 0, 0, 0.35) 100%);
  mix-blend-mode: multiply;
}

/* CRT scanlines */
[data-veefax]::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 98;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 1px,
    rgba(0, 0, 0, 0.15) 1px,
    rgba(0, 0, 0, 0.15) 2px
  );
}

/* header bar */
[data-veefax] > header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--ceefax-black);
  padding: 0.4em 0.8em;
  border-block-end: 2px solid var(--ceefax-white);
  font-size: clamp(0.75rem, 1vw + 0.4rem, 1rem); /* min 12px, max 16px */
  position: sticky;
  top: clamp(2.5rem, 5vh, 3.5rem); /* min 40px, max 56px, clears the marquee bar */
  z-index: 50;
}

[data-veefax] > header > span:first-child { color: var(--ceefax-white); font-weight: bold; }
[data-veefax] > header > span:nth-child(2) { color: var(--ceefax-yellow); font-weight: bold; letter-spacing: 0.2em; text-transform: uppercase; }
[data-veefax] > header > span:nth-child(3) { color: var(--ceefax-cyan); }
[data-veefax] > header > span:last-child { color: var(--ceefax-green); }
[data-veefax-clock] { color: var(--ceefax-yellow); }
[data-veefax-day] { color: var(--ceefax-green); margin-inline-end: 0.5em; }

/* block graphic separators */
[data-blocks] {
  display: flex;
  height: 0.6em;
  gap: 2px;
  margin: 0.5em 0.8em;
}

[data-blocks="thin"] {
  height: 0.3em;
  margin: 0.3em 0.8em;
}

[data-blocks] > span { flex: 1; }
[data-blocks] > span[data-color="red"]     { background: var(--ceefax-red); }
[data-blocks] > span[data-color="yellow"]  { background: var(--ceefax-yellow); }
[data-blocks] > span[data-color="green"]   { background: var(--ceefax-green); }
[data-blocks] > span[data-color="cyan"]    { background: var(--ceefax-cyan); }
[data-blocks] > span[data-color="magenta"] { background: var(--ceefax-magenta); }
[data-blocks] > span[data-color="blue"]    { background: var(--ceefax-blue); }
[data-blocks] > span[data-color="white"]   { background: var(--ceefax-white); }

/* text colour utility via data-color (within veefax context) */
[data-veefax] [data-color="white"]   { color: var(--ceefax-white); }
[data-veefax] [data-color="yellow"]  { color: var(--ceefax-yellow); }
[data-veefax] [data-color="cyan"]    { color: var(--ceefax-cyan); }
[data-veefax] [data-color="green"]   { color: var(--ceefax-green); }
[data-veefax] [data-color="red"]     { color: var(--ceefax-red); }
[data-veefax] [data-color="magenta"] { color: var(--ceefax-magenta); }

/* veefax text blocks */
[data-veefax] > section > p,
[data-veefax] article p { padding: 0.3em 0.8em; }

/* title block (index page) */
[data-veefax-index] > div:first-child {
  padding: 1em 0.8em;
  text-align: center;
}

/* ASCII art */
[data-veefax-index] pre {
  font-family: var(--font-mono);
  font-size: clamp(0.3rem, 0.8vw, 0.65rem); /* min 5px, max 10px, tiny ASCII art characters */
  color: var(--ceefax-cyan);
  line-height: 1.1;
  white-space: pre;
  overflow-x: auto;
  margin-block-end: 0.5em;
  text-shadow: 0 0 8px rgba(0, 255, 255, 0.5);
}

/* veefax pages (articles) */
[data-veefax] article {
  padding: 1em 0.8em;
  border-block-end: 1px solid var(--ceefax-blue);
  min-block-size: auto;
}

/* page-load flicker when JS is active */
[data-js] [data-veefax] article {
  opacity: 0;
  transform: translateY(0.5rem);
  transition: opacity 0.4s ease, transform 0.3s ease;
}

[data-veefax] article[data-loaded],
[data-veefax-index] {
  opacity: 1;
  transform: translateY(0);
}

/* index section always visible */
[data-veefax-index] {
  border-block-end: 2px solid var(--ceefax-yellow);
}

/* page header inside articles */
[data-veefax] article > div:first-child {
  display: flex;
  justify-content: space-between;
  margin-block-end: 0.5em;
}

[data-veefax] article > div:first-child > span:first-child { color: var(--ceefax-white); font-weight: bold; }
[data-veefax] article > div:first-child > span:last-child { color: var(--ceefax-cyan); letter-spacing: 0.1em; }

/* headlines: double-height simulation */
[data-veefax] h2 {
  font-family: var(--font-mono);
  font-size: clamp(1.2rem, 1vw + 1rem, 1.8rem); /* min 19px, max 29px, double-height headline */
  color: var(--ceefax-yellow);
  text-transform: uppercase;
  line-height: 1.3;
  font-weight: bold;
  transform: scaleY(1.35);
  transform-origin: top left;
  margin-block-end: 0.8em;
  letter-spacing: 0.04em;
  text-shadow:
    0 0 6px rgba(255, 255, 0, 0.4),
    0 0 15px rgba(255, 255, 0, 0.15);
}

/* alternate headline colours */
[data-veefax] article:nth-child(even of article) h2 {
  color: var(--ceefax-cyan);
  text-shadow:
    0 0 6px rgba(0, 255, 255, 0.4),
    0 0 15px rgba(0, 255, 255, 0.15);
}

/* meta line */
[data-veefax] [data-meta] {
  color: var(--ceefax-green);
  font-size: 0.85em;
  margin-block-end: 0.8em;
  letter-spacing: 0.05em;
}

/* body text */
[data-veefax] [data-body] p {
  color: var(--ceefax-white);
  font-family: var(--font-mono);
  margin-block-end: 0.8em;
  max-inline-size: 40em;
}

/* emphasis paragraphs */
[data-veefax] [data-body] [data-color="yellow"] {
  font-weight: bold;
  margin-block-start: 0.5em;
  text-shadow: 0 0 4px rgba(255, 255, 0, 0.25);
}

/* navigation hints */
[data-veefax] [data-nav] {
  margin-block-start: 1em;
  padding-block-start: 0.5em;
  border-block-start: 1px solid var(--ceefax-blue);
  font-size: 0.9em;
}

/* index navigation bar (bottom) */
[data-veefax-nav] {
  padding: 0.5em 0;
  margin-block-start: 1em;
  background: var(--ceefax-black);
  position: sticky;
  bottom: 0;
  z-index: 50;
}

[data-veefax-nav] > div {
  display: flex;
  gap: 2px;
  margin-block-end: 2px;
}

[data-veefax-nav] a {
  flex: 1;
  text-align: center;
  padding: 0.3em 0.5em;
  font-family: var(--font-mono);
  font-size: clamp(0.65rem, 0.8vw + 0.4rem, 0.9rem); /* min 10px, max 14px */
  font-weight: bold;
  text-transform: uppercase;
  text-decoration: none;
  letter-spacing: 0.05em;
  transition: filter 0.2s;
}

[data-veefax-nav] a:hover {
  filter: brightness(1.3);
  text-shadow: none;
  color: inherit;
}

[data-veefax-nav] a[data-color="red"]     { background: var(--ceefax-red);     color: var(--ceefax-white); }
[data-veefax-nav] a[data-color="green"]   { background: var(--ceefax-green);   color: var(--ceefax-black); }
[data-veefax-nav] a[data-color="yellow"]  { background: var(--ceefax-yellow);  color: var(--ceefax-black); }
[data-veefax-nav] a[data-color="cyan"]    { background: var(--ceefax-cyan);    color: var(--ceefax-black); }
[data-veefax-nav] a[data-color="magenta"] { background: var(--ceefax-magenta); color: var(--ceefax-black); }
[data-veefax-nav] a[data-color="white"]   { background: var(--ceefax-white);   color: var(--ceefax-black); }

/* veefax listing links (index page) */
[data-veefax-index] a {
  display: block;
  padding: 0.6em 0.8em;
  text-decoration: none;
  border-block-end: 1px solid rgba(0, 0, 255, 0.3);
  transition: background 0.15s;
}

[data-veefax-index] a:hover {
  background: rgba(255, 255, 255, 0.05);
}

[data-veefax-index] a > span:first-child {
  color: var(--ceefax-yellow);
  font-weight: bold;
  margin-inline-end: 1em;
  font-size: 1.1em;
}

[data-veefax-index] a > span:nth-child(2) {
  color: var(--ceefax-cyan);
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

[data-veefax-index] a > span:last-child {
  display: block;
  color: var(--ceefax-white);
  padding-inline-start: 3.5em;
  margin-block-start: 0.2em;
  opacity: 0.8;
}

[data-veefax-index] a:nth-child(even) > span:nth-child(2) {
  color: var(--ceefax-green);
}

/* veefax responsive */
@media (max-width: 30em) {
  [data-veefax-index] pre { font-size: 0.22rem; }
  [data-veefax] h2 { transform: scaleY(1.2); }
  [data-veefax-nav] a { font-size: 0.6rem; padding: 0.2em 0.3em; }
}


/* ============================================
   XVII. SCROLL-REVEAL
   JS adds [data-visible] when elements enter the
   viewport. only hidden when JS is active (via
   [data-js] on body) so content is never invisible
   without JS.
   ============================================ */
[data-js] [data-reveal] {
  opacity: 0;
  transform: translateY(2rem);
  transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
[data-js] [data-reveal][data-visible] {
  opacity: 1;
  transform: translateY(0);
}


/* ============================================
   XVIII. GLITCH / CORRUPTION
   CSS-only chromatic split using pseudo-elements.
   Lynn Fisher technique: cloned layers with clip-path.
   only applies to [data-glitch] - the hero punch
   uses [data-punch] with its own separate system.
   ============================================ */
/* JS sets --glitch-x, --glitch-y, --glitch-clip.
   CSS owns the visual rules for jitter and burst. */
[data-glitch] {
  position: relative;
  transform: translate(var(--glitch-x, 0), var(--glitch-y, 0));
  clip-path: var(--glitch-clip, none);
}

[data-glitch]::before,
[data-glitch]::after {
  content: attr(data-glitch);
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  overflow: hidden;
  pointer-events: none;
  z-index: -1;
}

[data-glitch]::before {
  color: var(--cyan);
  animation: glitch-cyan 4s infinite linear alternate-reverse;
}
[data-glitch]::after {
  color: var(--red-text);
  animation: glitch-red 3s infinite linear alternate-reverse;
}

@keyframes glitch-cyan {
  0%, 82%  { clip-path: inset(0); transform: translate(0); }
  84%      { clip-path: inset(25% 0 55% 0); transform: translate(-4px, 0); }
  86%      { clip-path: inset(55% 0 15% 0); transform: translate(3px, 0); }
  88%      { clip-path: inset(8% 0 72% 0); transform: translate(-2px, 0); }
  90%, 100% { clip-path: inset(0); transform: translate(0); }
}

@keyframes glitch-red {
  0%, 87%  { clip-path: inset(0); transform: translate(0); }
  89%      { clip-path: inset(65% 0 5% 0); transform: translate(3px, 0); }
  91%      { clip-path: inset(35% 0 35% 0); transform: translate(-5px, 0); }
  93%      { clip-path: inset(72% 0 3% 0); transform: translate(2px, 0); }
  95%, 100% { clip-path: inset(0); transform: translate(0); }
}


/* ============================================
   XIX. SCROLL-DRIVEN ANIMATIONS (progressive)
   Chrome 115+ only. wrapped in @supports so
   they're truly optional.
   ============================================ */
@supports (animation-timeline: scroll()) {
  article[data-index] h2 {
    animation: title-reveal linear both;
    animation-timeline: view();
    animation-range: entry 0% entry 35%;
  }

  @keyframes title-reveal {
    from { opacity: 0.2; transform: translateX(-4vw) skewX(2deg); filter: blur(6px); }
    to   { opacity: 1; transform: translateX(0) skewX(0deg); filter: blur(0); }
  }

  [data-page="archive"] article {
    animation: card-drift linear both;
    animation-timeline: view();
    animation-range: entry 0% entry 45%;
  }

  @keyframes card-drift {
    from { opacity: 0; transform: translateY(2rem) rotate(1.5deg); }
    to   { opacity: 1; transform: translateY(0) rotate(var(--card-rotate, 0deg)); }
  }

  [data-page="experiments"] article {
    animation: card-scale linear both;
    animation-timeline: view();
    animation-range: entry 0% entry 40%;
  }

  @keyframes card-scale {
    from { opacity: 0; scale: 0.94; }
    to   { opacity: 1; scale: 1; }
  }
}


/* ============================================
   XX. CORRUPTION BAR
   sticky progress bar that fills as you scroll
   through the manifesto page.
   ============================================ */
[data-corruption-bar] {
  position: sticky;
  top: clamp(2.5rem, 5vh, 3.5rem); /* min 40px, max 56px, matches marquee bar height */
  height: 3px;
  background: linear-gradient(
    90deg,
    var(--red) var(--gradient-stop, 0%),
    transparent var(--gradient-stop, 0%)
  );
  z-index: 50;
  pointer-events: none;
  mix-blend-mode: screen;
}


/* ============================================
   XXI. NOISE OVERLAY (optional, on <body>)
   ============================================ */
[data-noise]::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 200px 200px;
  mix-blend-mode: overlay;
}


/* ============================================
   XXII. CUSTOM CURSOR & TRAIL
   desktop only. hide default cursor when JS is
   active AND a fine pointer is present. restored
   on keydown (handled in JS) so keyboard users
   aren't affected.
   ============================================ */
@media (pointer: fine) {
  [data-cursor-active] * { cursor: none !important; }
}

/* JS sets --cursor-x, --cursor-y, --cursor-opacity.
   CSS owns positioning and visibility. */
[data-cursor] {
  position: fixed;
  top: 0; left: 0;
  width: 0; height: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: var(--cursor-opacity, 0);
  transition: opacity 0.3s;
  transform: translate(var(--cursor-x, -200px), var(--cursor-y, -200px));
  will-change: transform;
}

/* ring: invisible by default, appears on hover of
   interactive elements. square, rotated 45deg (diamond). */
[data-cursor-ring] {
  position: absolute;
  top: 50%; left: 50%;
  width: 0; height: 0;
  border: 1px solid var(--red);
  border-radius: 0;
  transform: translate(-50%, -50%) rotate(45deg);
  transition: width 0.2s ease, height 0.2s ease, border-color 0.2s, opacity 0.2s;
  opacity: 0;
}

/* pointer: triangle cursor shape pointing upper-left.
   clip-path draws a simplified arrow. the tip (0 0) sits
   at the mouse hotspot. */
[data-cursor-dot] {
  position: absolute;
  top: 0; left: 0;
  width: 16px; height: 20px;
  background: var(--red);
  border-radius: 0;
  clip-path: polygon(0 0, 0 100%, 65% 72%);
  transform: none;
  transition: filter 0.15s ease;
  /* white outline so the pointer stays visible on red backgrounds */
  filter:
    drop-shadow(0 0 1px var(--off-white))
    drop-shadow(0 0 1px var(--off-white));
}

/* hover: diamond ring expands around the pointer */
[data-cursor-hover] [data-cursor-ring] {
  width: 40px; height: 40px;
  border-color: var(--cyan);
  opacity: 0.5;
}

/* click: pointer flashes orange - keep the outline visible */
[data-cursor-click] [data-cursor-dot] {
  filter:
    brightness(1.8)
    drop-shadow(0 0 1px var(--off-white))
    drop-shadow(0 0 1px var(--off-white));
  background: var(--orange);
}

/* trail dots - JS sets --trail-x, --trail-y,
   --trail-opacity, --trail-size. CSS owns all visual rules. */
[data-trail] {
  position: fixed;
  top: 0; left: 0;
  width: var(--trail-size, 5px);
  height: var(--trail-size, 5px);
  background: var(--red);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9998;
  opacity: var(--trail-opacity, 0);
  transform: translate(var(--trail-x, -300px), var(--trail-y, -300px));
  will-change: transform, opacity;
  margin-top: -2.5px;
  margin-left: -2.5px;
}


/* ============================================
   XXIII. EASTER EGGS
   safe mode overlay, idle chatter, progressive
   corruption. the fun stuff.
   ============================================ */

/* safe mode (Konami code) */
[data-safe-mode] {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: #f4f4f4;
  font-family: Arial, Helvetica, sans-serif;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transition: opacity 0.4s ease;
  overflow: hidden;
}

[data-safe-mode="in"]  { opacity: 1; }
[data-safe-mode="out"] { opacity: 0; transition: opacity 0.6s ease; }

[data-safe-mode] > nav {
  background: #0057b7;
  padding: 12px 28px;
  display: flex;
  align-items: center;
  gap: 2rem;
}

[data-safe-mode] > nav > span {
  color: white;
  font-size: 1.1rem;
  font-weight: bold;
  letter-spacing: 0.03em;
}

[data-safe-mode] > nav > div {
  display: flex;
  gap: 1.5rem;
  margin-inline-start: auto;
}

[data-safe-mode] > nav a {
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  font-size: 0.9rem;
  cursor: default;
}

[data-safe-mode] > div {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem 2rem;
  gap: 1.2rem;
}

[data-safe-mode] > div > p:first-child {
  color: #0057b7;
  font-size: 0.8rem;
  font-weight: bold;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

[data-safe-mode] > div > h1 {
  font-size: clamp(1.6rem, 4vw, 3rem); /* min 26px, max 48px */
  color: #1a1a1a;
  max-width: 16ch;
  line-height: 1.2;
  text-transform: none;
  font-family: Arial, Helvetica, sans-serif;
  letter-spacing: normal;
}

[data-safe-mode] > div > p:nth-of-type(2) {
  color: #555;
  font-size: 1rem;
  max-width: 40ch;
  line-height: 1.6;
}

[data-safe-mode] button {
  background: #0057b7;
  color: white;
  border: none;
  padding: 14px 36px;
  font-size: 1rem;
  font-family: Arial;
  border-radius: 4px;
  cursor: default;
  margin-top: 0.5rem;
}

[data-safe-mode] [data-cards] {
  display: flex;
  gap: 1.5rem;
  margin-top: 2rem;
}

[data-safe-mode] [data-cards] > div {
  background: white;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 1.5rem 2rem;
  text-align: center;
  min-width: 120px;
}

[data-safe-mode] [data-cards] > div > span {
  color: #0057b7;
  font-size: 1.5rem;
  display: block;
  margin-bottom: 0.5rem;
}

[data-safe-mode] [data-cards] p { color: #444; font-size: 0.9rem; }

[data-safe-mode] [data-verdict] {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  font-family: "Arial Black", Arial, sans-serif;
  font-size: clamp(1rem, 2.5vw, 1.8rem); /* min 16px, max 29px */
  font-weight: 900;
  color: #e63b2e;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  animation: verdict-pulse 1s ease-in-out infinite alternate;
}

@keyframes verdict-pulse {
  from { opacity: 0.6; }
  to   { opacity: 1; }
}

/* idle message */
[data-idle] {
  position: fixed;
  bottom: 2.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  z-index: 9000;
  font-family: var(--font-mono);
  font-size: clamp(0.75rem, 1.5vw, 0.9rem); /* min 12px, max 14px */
  color: var(--grey);
  letter-spacing: 0.1em;
  text-transform: lowercase;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s ease, transform 0.5s ease;
  white-space: nowrap;
}

[data-idle="in"] {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* progressive corruption levels */
[data-corruption="1"] [data-glitch] {
  animation-duration: 2s;
}
[data-corruption="1"] [data-hero] h1 {
  filter:
    drop-shadow(5px 0 0 rgba(230, 59, 46, 0.4))
    drop-shadow(-4px 0 0 rgba(0, 212, 255, 0.3))
    drop-shadow(0 3px 0 rgba(232, 99, 43, 0.15));
}

[data-corruption="2"] [data-hero] h1 {
  animation: hero-gradient-shift 3s ease-in-out infinite,
             corrupt-shake 0.2s steps(2) infinite;
}

@keyframes corrupt-shake {
  0%   { letter-spacing: -0.045em; }
  50%  { letter-spacing: -0.02em; word-spacing: 0.1em; }
  100% { letter-spacing: -0.045em; }
}

[data-corruption="2"] [data-marquee] > div {
  animation-duration: 8s;
}

[data-corruption="3"] {
  animation: full-corrupt 0.5s steps(3) infinite;
}

@keyframes full-corrupt {
  0%   { filter: none; }
  33%  { filter: hue-rotate(180deg) contrast(1.1); }
  66%  { filter: hue-rotate(0deg) invert(0.04); }
  100% { filter: none; }
}



/* ============================================
   SR-ONLY - visually hidden, present for
   assistive tech. the one justified utility
   class: it applies to unrelated elements no
   structural selector could cover.
   ============================================ */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ============================================
   POCKET CONSOLE - the devtools greeting,
   delivered to people who have no devtools.
   JS creates the panel and toggles the "in"
   state; every visual rule lives here.
   ============================================ */
[data-pocket-console] {
  position: fixed;
  inset: auto var(--s-m) var(--s-m) var(--s-m);
  z-index: 9500;
  background: var(--black);
  border: 1px solid var(--red);
  box-shadow: 4px 4px 0 var(--red);
  padding: var(--s-m);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

[data-pocket-console="in"] {
  opacity: 1;
  transform: translateY(0);
}

[data-pocket-console] pre {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1.7;
  color: var(--cyan);
  white-space: pre-wrap;
  margin-block-end: var(--s-s);
}

[data-pocket-console] button {
  font-family: var(--font-mono);
  font-size: var(--scale-00);
  color: var(--red-text);
  background: none;
  border: 1px solid var(--red);
  padding: var(--s-xs) var(--s-s);
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  transition: background 0.2s, color 0.2s;
}

[data-pocket-console] button:hover,
[data-pocket-console] button:focus-visible {
  background: var(--red);
  color: var(--black);
}


/* ============================================
   XXIV. REDUCED MOTION - always, always respect
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  [data-marquee] > div { animation: none; }
  [data-section="wall"] > div { animation: none; }
  [data-hero] { animation: none; clip-path: none; filter: none; }
  [data-hero] h1 { animation: none; -webkit-text-fill-color: var(--white); background: none; filter: none; }
  [data-hero] [data-punch] { filter: none; }
  [data-js] [data-hero] h1 > span { animation: none; opacity: 1; transform: none; filter: none; }
  [data-js] [data-hero] h1 + p > span { animation: none; opacity: 1; transform: none; }
  [data-js] [data-hero] [data-punch] > span { animation: none; opacity: 1; transform: none; filter: none; clip-path: none; }
  [data-effect="noise"] { animation: none; display: none; }
  [data-effect="scanlines"]::after { animation: none; display: none; }
  [data-reveal] { opacity: 1; transform: none; }
  [data-terminal-cursor] { animation: none; }
  [data-glitch]::before,
  [data-glitch]::after { display: none; }
  [data-hero]::before,
  [data-hero]::after { animation: none; opacity: 0; }
  [data-veefax] article { opacity: 1; transform: none; }
}


/* ============================================
   XXV. MANUAL REDUCED MOTION TOGGLE
   ============================================
   mirrors every rule from @media
   (prefers-reduced-motion: reduce) under
   [data-reduced-motion] so users can toggle
   motion off manually even if their OS setting
   is "no preference." JS sets this attribute on
   <body> and stores the choice in localStorage.
   ============================================ */

/* kill all animation/transition timing when
   motion is toggled off via the button. */
[data-reduced-motion],
[data-reduced-motion] *,
[data-reduced-motion] *::before,
[data-reduced-motion] *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
  scroll-behavior: auto !important;
}
[data-reduced-motion] [data-marquee] > div { animation: none; }
[data-reduced-motion] [data-section="wall"] > div { animation: none; }
[data-reduced-motion] [data-hero] { animation: none; clip-path: none; filter: none; }
[data-reduced-motion] [data-hero] h1 { animation: none; -webkit-text-fill-color: var(--white); background: none; filter: none; }
[data-reduced-motion] [data-hero] [data-punch] { filter: none; }
[data-reduced-motion][data-js] [data-hero] h1 > span,
[data-reduced-motion] [data-js] [data-hero] h1 > span { animation: none; opacity: 1; transform: none; filter: none; }
[data-reduced-motion][data-js] [data-hero] h1 + p > span,
[data-reduced-motion] [data-js] [data-hero] h1 + p > span { animation: none; opacity: 1; transform: none; }
[data-reduced-motion][data-js] [data-hero] [data-punch] > span,
[data-reduced-motion] [data-js] [data-hero] [data-punch] > span { animation: none; opacity: 1; transform: none; filter: none; clip-path: none; }
[data-reduced-motion] [data-effect="noise"] { animation: none; display: none; }
[data-reduced-motion] [data-effect="scanlines"]::after { animation: none; display: none; }
[data-reduced-motion] [data-reveal] { opacity: 1; transform: none; }
[data-reduced-motion] [data-terminal-cursor] { animation: none; }
[data-reduced-motion] [data-glitch]::before,
[data-reduced-motion] [data-glitch]::after { display: none; }
[data-reduced-motion] [data-hero]::before,
[data-reduced-motion] [data-hero]::after { animation: none; opacity: 0; }
[data-reduced-motion] [data-veefax] article { opacity: 1; transform: none; }
/* hide trail particles but keep custom cursor dot visible -
   it just follows the mouse, no animation. */
[data-reduced-motion] [data-trail] { display: none; }
[data-reduced-motion] [data-corruption-bar] { display: none; }
/* idle chatter and favicon/title corruption
   handled by JS checking the attribute. */


/* ============================================
   XXVI. MOTION TOGGLE BUTTON
   ============================================
   mobile-first: bottom-right thumb zone on small
   screens, then moves to less intrusive position
   on larger viewports.

   [data-motion-toggle] matches the data-attribute
   architecture. mobile layout (320px min): hamburger
   sits at bottom-right (bottom: 2rem, right: 2rem,
   3.5rem x 3.5rem). this button positioned to its
   left with a gap so both are reachable by thumb.
   at 48em+ the hamburger hides, so this moves to
   bottom-left.
   ============================================ */
[data-motion-toggle] {
  position: fixed;
  z-index: 9990;
  /* mobile-first: same row as hamburger, to its left */
  bottom: 2rem;                              /* align with hamburger's bottom: var(--s-l) */
  right: calc(var(--s-l) + 3.5rem + 0.75rem); /* hamburger offset + hamburger width + gap */
  padding: 0.5rem 0.75rem;  /* 8px 12px */
  border: 1px solid var(--red);
  border-radius: 0;
  background: var(--black);  /* was var(--bg), an undefined token - the button was transparent and inherited whatever sat behind it */
  color: var(--red-text);
  font-family: var(--font-mono);
  font-size: clamp(0.6rem, 0.4rem + 0.5vw, 0.7rem); /* min 10px at 320, max 11px, scales fluidly */
  line-height: 1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  /* subtle glow - visible against dark backgrounds without distraction */
  box-shadow: 0 0 8px rgba(230, 59, 46, 0.15);
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

/* focus-visible for keyboard users */
[data-motion-toggle]:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 3px;
}

/* hover/active states */
[data-motion-toggle]:hover {
  background: var(--red);
  color: var(--bg);
  box-shadow: 0 0 16px rgba(230, 59, 46, 0.3);
}

[data-motion-toggle]:active {
  transform: scale(0.96);
}

/* show "on" label by default, hide "off" */
[data-motion-toggle] [data-label-off] { display: none; }
[data-motion-toggle] [data-label-on]  { display: inline; }

/* when motion is reduced, swap labels */
[data-reduced-motion] [data-motion-toggle] [data-label-off] { display: inline; }
[data-reduced-motion] [data-motion-toggle] [data-label-on]  { display: none; }

/* accent switches to cyan to confirm state change */
[data-reduced-motion] [data-motion-toggle] {
  border-color: var(--cyan);
  color: var(--cyan);
  box-shadow: 0 0 8px rgba(0, 212, 255, 0.15);
}
[data-reduced-motion] [data-motion-toggle]:hover {
  background: var(--cyan);
  color: var(--bg);
  box-shadow: 0 0 16px rgba(0, 212, 255, 0.3);
}

/* mobile shake hint - only visible on touch devices,
   fades out after first interaction */
[data-motion-toggle] [data-shake-hint] {
  display: none;
}

@media (pointer: coarse) {
  /* show shake hint only on touch devices.
     JS sets --shake-hint-opacity to 0 after first shake. */
  [data-motion-toggle] [data-shake-hint] {
    display: block;
    font-size: 0.55rem;  /* 9px */
    /* quiet through colour, not transparency: half opacity halved
       the effective contrast to ~2.4:1 (Lighthouse mobile, 28 Aug).
       grey at full opacity measures 6.17:1 and still reads as a
       whisper. the JS fade to 0 after the first shake is unchanged. */
    color: var(--grey);
    opacity: var(--shake-hint-opacity, 1);
    margin-top: 0.25rem;
    letter-spacing: 0.04em;
    transition: opacity 0.3s;
  }
  /* min 44x44px tap target for WCAG 2.2 Target Size (Level AA).
     padding kept compact so the button fits at 320px viewports
     alongside the hamburger without overflowing. */
  [data-motion-toggle] {
    min-width: 44px;
    min-height: 44px;
    padding: 0.5rem 0.625rem;  /* 8px 10px */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }
}

/* tablet and up: hamburger hides at this breakpoint,
   toggle moves to bottom-left, out of the way. */
@media (min-width: 48em) {
  [data-motion-toggle] {
    bottom: 1.5rem;    /* 24px */
    left: 1.5rem;      /* 24px */
    right: auto;
    font-size: 0.65rem;  /* 10px */
  }
}

/* wide screens: slightly more breathing room */
@media (min-width: 80em) {
  [data-motion-toggle] {
    bottom: 2rem;     /* 32px */
    left: 2rem;       /* 32px */
    font-size: 0.7rem;
  }
}

/* hide toggle in print - no interactive elements on paper */
@media print {
  [data-motion-toggle] { display: none !important; }
}

/* motion toggle should not have cursor:none applied */
[data-cursor-active] [data-motion-toggle] { cursor: pointer !important; }


/* ============================================
   XXVII. PRINT (nice try)
   ============================================
   hit Ctrl+P and everything disappears.
   you get one message instead. rebellions
   don't fit on A4. */
@media print {
  /* hide every direct child of body */
  body > * { display: none !important; }

  /* ::after pseudo-element injects the print message.
     only exists in print context - costs nothing on screen. */
  body {
    background: white !important;
    color: black !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 100vh !important;
    cursor: auto !important;
  }

  body::after {
    content:
      "You can't print a rebellion.\A\A"
      "This site exists on screens.\A"
      "It was built to glow, to glitch, to move.\A"
      "Paper can't do that.\A\A"
      "Come back: youdidntdesignthis.com";
    display: block !important;
    white-space: pre-wrap;
    text-align: center;
    font-family: monospace;
    font-size: 14pt;
    line-height: 2;
    color: #000;
    max-width: 40em;
  }
}
