/* slab.css: the shared parts of an immersive page. Brand-neutral: set the variables below for the brand.

   --w is one design pixel. The desktop design is 1440 wide, the phone design 390 wide, so write sizes as
   calc(24 * var(--w)) and give text a pixel floor with max(12px, calc(13 * var(--w))).

   Parts: .world (the fixed shader canvas, with a still CSS field under html.nogl), .slab (dark panel with
   big radii and a faint rim light), .glass (blurred glass, use sparingly: it counts as a blurred layer),
   .frost (translucent card with a lit rim and no blur, for many cards at once), .nav-pill, .wordmark
   (giant blurred word), .swap (the serif italic letter), .fade-* (12-stop eased gradients).

   Usage: <link rel="stylesheet" href="slab.css"> then override the variables in your own :root.
*/
:root {
  --w: calc(100vw / 1440);
  --world-1: #eeeeee; --world-2: #d8d8d8; --world-3: #c4c4c4; --world-4: #9a9a9a;   /* light to dark */
  --slab: #141414; --card: #262626; --ink: #141414; --ink-on-dark: #eeeeee; --muted-on-dark: #a0a0a0;
  --accent: #e5482f; --rim: rgba(255, 255, 255, 0.10);
  --sans: system-ui, sans-serif; --serif: Georgia, serif;
  --slab-radius: max(28px, calc(70 * var(--w)));
  --gutter: calc(24 * var(--w));
  --fade: var(--slab);
}
/* Phone path: any narrow window, and any short one (a phone on its side). One design pixel stops growing at
   1.28px, so a tablet gets the phone layout in a centred column, not giant type. */
@media (max-width: 900px), (max-height: 520px) { :root { --w: min(calc(100vw / 390), 1.28px); --slab-radius: max(24px, calc(28 * var(--w))); --gutter: calc(8 * var(--w)); } }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
a, button { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }

html { overflow-x: clip; }
body { margin: 0; font-family: var(--sans); color: var(--ink); background: var(--world-1); -webkit-font-smoothing: antialiased; }

/* the world */
.world { position: fixed; inset: 0; width: 100%; height: 100%; display: block; z-index: 0; pointer-events: none; }
html.nogl .world { display: none; }
html.nogl body {
  background:
    radial-gradient(60% 50% at 22% 18%, var(--world-1) 0%, transparent 70%),
    radial-gradient(55% 60% at 82% 30%, color-mix(in srgb, var(--world-2) 80%, transparent) 0%, transparent 72%),
    radial-gradient(70% 55% at 30% 85%, color-mix(in srgb, var(--world-3) 70%, transparent) 0%, transparent 75%),
    radial-gradient(50% 50% at 90% 90%, color-mix(in srgb, var(--world-4) 45%, transparent) 0%, transparent 70%),
    var(--world-2);
  background-attachment: fixed;
}

/* dark slab that slides over the world */
.slab {
  position: relative; z-index: 2; margin: 0 var(--gutter);
  background: var(--slab); color: var(--ink-on-dark);
  border-radius: var(--slab-radius);
  box-shadow: inset 0 1px 0 var(--rim), inset 0 0 0 1px color-mix(in srgb, var(--rim) 60%, transparent),
    0 calc(-30 * var(--w)) calc(80 * var(--w)) color-mix(in srgb, var(--slab) 18%, transparent);
  isolation: isolate;
}
.slab::before {   /* faint light caught on the top rim */
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: -1;
  background: radial-gradient(60% calc(120 * var(--w)) at 50% 0%, var(--rim), transparent 70%);
}

/* glass: real backdrop blur (counts as a blurred layer) */
.glass {
  background: color-mix(in srgb, var(--world-1) 52%, transparent);
  -webkit-backdrop-filter: blur(18px) saturate(1.1); backdrop-filter: blur(18px) saturate(1.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), inset 0 0 0 1px rgba(255, 255, 255, 0.28),
    0 10px 30px -12px color-mix(in srgb, var(--slab) 35%, transparent);
}
/* frost: looks like glass on a soft field, but no blur, so you can have many */
.frost {
  background: linear-gradient(160deg, color-mix(in srgb, var(--world-1) 72%, transparent),
    color-mix(in srgb, var(--world-1) 38%, transparent));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), inset 0 0 0 1px rgba(255, 255, 255, 0.35),
    0 calc(24 * var(--w)) calc(50 * var(--w)) calc(-20 * var(--w)) color-mix(in srgb, var(--world-4) 70%, transparent);
}

/* nav pill, top centre */
.nav-pill {
  position: fixed; z-index: 50; top: max(12px, calc(20 * var(--w))); left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: max(8px, calc(12 * var(--w)));
  padding: max(5px, calc(6 * var(--w))) max(6px, calc(7 * var(--w))) max(5px, calc(6 * var(--w))) max(12px, calc(16 * var(--w)));
  border-radius: 999px;
}

/* giant blurred wordmark behind a section */
.wordmark {
  position: absolute; pointer-events: none; user-select: none; white-space: nowrap; line-height: 0.8;
  letter-spacing: -0.07em; font-weight: 500; z-index: 0;
}

/* mixed type: the one serif italic letter (type.js adds the span) */
.swap { font-family: var(--serif); font-style: italic; font-weight: 400; letter-spacing: -0.01em; }

/* eased gradients: 12 stops on an ease curve, no band. Set --fade to the colour you fade to. */
.fade-down, .fade-up { pointer-events: none; }
.fade-down { background: linear-gradient(to bottom,
  transparent 0%, color-mix(in srgb, var(--fade) 0.5%, transparent) 8.1%, color-mix(in srgb, var(--fade) 3.5%, transparent) 15.5%,
  color-mix(in srgb, var(--fade) 10.4%, transparent) 22.5%, color-mix(in srgb, var(--fade) 21%, transparent) 29%,
  color-mix(in srgb, var(--fade) 34.7%, transparent) 35.3%, color-mix(in srgb, var(--fade) 50%, transparent) 41.2%,
  color-mix(in srgb, var(--fade) 65.3%, transparent) 47.1%, color-mix(in srgb, var(--fade) 79%, transparent) 52.9%,
  color-mix(in srgb, var(--fade) 89.6%, transparent) 58.8%, color-mix(in srgb, var(--fade) 96.5%, transparent) 64.7%,
  color-mix(in srgb, var(--fade) 99.5%, transparent) 71%, var(--fade) 100%); }
.fade-up { background: linear-gradient(to top,
  transparent 0%, color-mix(in srgb, var(--fade) 0.5%, transparent) 8.1%, color-mix(in srgb, var(--fade) 3.5%, transparent) 15.5%,
  color-mix(in srgb, var(--fade) 10.4%, transparent) 22.5%, color-mix(in srgb, var(--fade) 21%, transparent) 29%,
  color-mix(in srgb, var(--fade) 34.7%, transparent) 35.3%, color-mix(in srgb, var(--fade) 50%, transparent) 41.2%,
  color-mix(in srgb, var(--fade) 65.3%, transparent) 47.1%, color-mix(in srgb, var(--fade) 79%, transparent) 52.9%,
  color-mix(in srgb, var(--fade) 89.6%, transparent) 58.8%, color-mix(in srgb, var(--fade) 96.5%, transparent) 64.7%,
  color-mix(in srgb, var(--fade) 99.5%, transparent) 71%, var(--fade) 100%); }

/* tabular readouts in the grotesque (never a monospace font) */
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto !important; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}
