/* infinidie.com, the pages before the game. Everything is line: hairline dice, thin display type, outline buttons.
   Colour lives only on the lines, and moves. Most of every screen is left empty on purpose. */

@font-face { font-family: "Inter"; src: url(/fonts/inter-roman.woff2) format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }

/* Registered, so a world's colours fade in rather than snap (worlds page), and the button's gradient can turn. */
@property --ground { syntax: "<color>"; inherits: true; initial-value: #fdfcfe; }
@property --ink { syntax: "<color>"; inherits: true; initial-value: #18181a; }
@property --quiet { syntax: "<color>"; inherits: true; initial-value: #55545b; }
@property --g1 { syntax: "<color>"; inherits: true; initial-value: #5b37b8; }
@property --g2 { syntax: "<color>"; inherits: true; initial-value: #a3346a; }
@property --g3 { syntax: "<color>"; inherits: true; initial-value: #0f6b62; }
@property --focus { syntax: "<color>"; inherits: true; initial-value: #18181a; }
@property --shift { syntax: "<percentage>"; inherits: false; initial-value: 0%; }
@property --sheen { syntax: "<percentage>"; inherits: false; initial-value: -30%; }
@property --angle { syntax: "<angle>"; inherits: false; initial-value: 0deg; }

:root {
  --l-ground: #fdfcfe; --l-ink: #18181a; --l-quiet: #55545b; --l-g1: #5b37b8; --l-g2: #a3346a; --l-g3: #0f6b62; --l-focus: #18181a;
  --d-ground: #121019; --d-ink: #ecebef; --d-quiet: #aeacb6; --d-g1: #cbb8ff; --d-g2: #ffb7d5; --d-g3: #a3eed7; --d-focus: #ffffff;
  --ground: var(--l-ground); --ink: var(--l-ink); --quiet: var(--l-quiet);
  --g1: var(--l-g1); --g2: var(--l-g2); --g3: var(--l-g3); --focus: var(--l-focus);
  --glint: rgb(24 24 26 / 0.38); /* the app's sheen: only ever raises contrast */
  --rule: 1.5px; /* buttons and fields; the dice take the brand's line from scene.ts */

  /* A perfect fourth from 19px: 19, 25, 34, 45, 60, 80, 107, 142. */
  --t-body: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem);
  --t-say: clamp(1.3125rem, 1.1rem + 0.6vw, 1.5625rem);
  --t-h3: clamp(1.5625rem, 1.3rem + 0.9vw, 2.125rem);
  --t-h2: clamp(2.5rem, 1.3rem + 4.2vw, 5rem);
  --t-h1: clamp(3rem, 1rem + 7vw, 7rem); /* the app's own h1 */

  --inset: max(16px, 8vw, env(safe-area-inset-left));
  --column: 36rem;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: light dark;
  transition: --ground 0.9s var(--ease), --ink 0.9s var(--ease), --quiet 0.9s var(--ease), --g1 1.2s var(--ease), --g2 1.2s var(--ease), --g3 1.2s var(--ease), --focus 0.9s;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ground: var(--d-ground); --ink: var(--d-ink); --quiet: var(--d-quiet);
    --g1: var(--d-g1); --g2: var(--d-g2); --g3: var(--d-g3); --focus: var(--d-focus);
    --glint: rgb(255 255 255 / 0.75);
  }
}

* { box-sizing: border-box; }
html {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-optical-sizing: auto; font-feature-settings: "cv11", "ss03";
  -webkit-text-size-adjust: 100%; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  background: var(--ground); scroll-padding-top: 2rem;
}
body {
  margin: 0; min-height: 100dvh; color: var(--ink); /* the ground is on html: a body fill would cover the dice */
  font-size: var(--t-body); line-height: 1.6; font-weight: 400;
  overflow-x: clip; overflow-wrap: break-word;
}
p { margin: 0 0 1em; max-width: var(--column); text-wrap: pretty; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.22em; text-decoration-color: color-mix(in srgb, currentColor 45%, transparent); }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; border-radius: 4px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: var(--inset); top: -200px; padding: 10px 16px; background: var(--ink); color: var(--ground); border-radius: 999px; z-index: 2; }
.skip:focus { top: 12px; }

/* ---- The dice ----------------------------------------------------------------------------- */
.scene { position: fixed; inset: 0; width: 100%; height: 100lvh; z-index: -1; pointer-events: none; overflow: visible; }
.scene path { stroke-linejoin: round; stroke-linecap: round; }
.scene-pips { transition: opacity 0.6s; }
.scene-faint { opacity: 0.4; }
.scene-draw .scene-edge { stroke-dasharray: 1 1; animation: draw 2.4s var(--ease) both; }
@keyframes draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@media (max-width: 47.99rem) { .scene { opacity: 0.55; } .scene-faint { opacity: 0.3; } }

/* ---- Header and footer -------------------------------------------------------------------- */
.top {
  position: absolute; inset: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: max(20px, env(safe-area-inset-top)) var(--inset) 0; z-index: 1;
}
.brand { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; font-weight: 900; letter-spacing: -0.03em; font-size: 1.5rem; }
.brand .wordmark { height: 1.55rem; width: auto; display: block; overflow: visible; }
.top nav { display: flex; gap: clamp(0.9rem, 3vw, 2.25rem); }
.top nav a { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; font-size: 1rem; color: var(--quiet); }
.top nav a:hover, .top nav a[aria-current="page"] { color: var(--ink); }
@media (max-width: 30rem) { .top nav .not-narrow { display: none; } }

.foot { padding: 24vh var(--inset) max(40px, env(safe-area-inset-bottom)); font-size: 1rem; color: var(--quiet); }
.foot .brand { color: var(--ink); margin-bottom: 1.25rem; }
.foot nav { display: flex; flex-wrap: wrap; gap: 0 1.75rem; margin-bottom: 1.5rem; }
.foot nav a, .foot button.link { display: inline-flex; align-items: center; min-height: 44px; color: var(--quiet); text-decoration: none; }
.foot nav a:hover, .foot button.link:hover { color: var(--ink); }
.foot p { margin: 0; }
button.link { font: inherit; background: none; border: 0; padding: 0; cursor: pointer; }

/* ---- Type --------------------------------------------------------------------------------- */
/* Headings are the app's: Inter Black, tracked tight, in its drifting emphasis gradient (the wordmark's colours). */
h1, h2, h3 { margin: 0; text-wrap: balance; overflow-wrap: break-word; }
.display {
  font-weight: 900; letter-spacing: -0.04em; line-height: 1.04; font-size: var(--t-h2); max-width: min(100%, 14ch);
  /* Room for descenders and overhangs inside the painted box, so the gradient never clips a letter. */
  padding: 0.04em 0.06em 0.14em; margin: -0.04em -0.06em calc(0.45em - 0.14em);
  --shift: 0%; --sheen: -30%;
  background-image:
    linear-gradient(100deg, transparent calc(var(--sheen) - 9%), var(--glint) var(--sheen), transparent calc(var(--sheen) + 9%)),
    linear-gradient(100deg,
      var(--g1) calc(var(--shift) - 100%), var(--g2) calc(var(--shift) - 66.6%), var(--g3) calc(var(--shift) - 33.3%),
      var(--g1) var(--shift), var(--g2) calc(var(--shift) + 33.3%), var(--g3) calc(var(--shift) + 66.6%), var(--g1) calc(var(--shift) + 100%));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: drift 32s linear infinite, sheen 9s cubic-bezier(0.45, 0, 0.2, 1) 1.4s infinite;
}
h1.display { font-size: var(--t-h1); letter-spacing: -0.045em; max-width: min(100%, 11ch); }
/* On wide screens the words keep to the left, and the dice to the right. */
@media (min-width: 48rem) { .display { max-width: min(14ch, 44vw); } h1.display { max-width: min(11ch, 46vw); } }
.display::selection { color: var(--ground); background: var(--ink); -webkit-text-fill-color: var(--ground); }
@keyframes drift { to { --shift: 100%; } }
@keyframes sheen { 0% { --sheen: -30%; } 22% { --sheen: 130%; } 100% { --sheen: 130%; } }
@media (forced-colors: active) { .display { color: CanvasText; background: none; } }
.say { font-size: var(--t-say); line-height: 1.45; font-weight: 400; max-width: 34rem; letter-spacing: -0.01em; }
.quiet { color: var(--quiet); }
.small { font-size: 1rem; }
h3 { font-size: var(--t-h3); font-weight: 800; letter-spacing: -0.025em; line-height: 1.15; margin-bottom: 0.4em; }

/* ---- Sections ----------------------------------------------------------------------------- */
main { display: block; padding-inline: var(--inset); outline: none; }
.beat { min-height: 118svh; display: grid; align-content: center; justify-items: start; padding-block: 18svh; }
.beat.hero { min-height: 100svh; align-content: end; padding-block: 22svh 16svh; }
.beat.low { align-content: end; }
.beat.high { align-content: start; padding-top: 24svh; }
.beat.shut { min-height: 0; padding-block: 34svh 10svh; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 2rem; margin-top: 1.5rem; }

/* The one button: an outline in the turning gradient, filled with ink when you reach for it. */
.cta {
  --angle: 0deg;
  display: inline-flex; align-items: center; justify-content: center; min-height: 52px; padding: 0 1.75rem;
  font: inherit; font-weight: 500; letter-spacing: -0.005em; color: var(--ink); text-decoration: none; cursor: pointer;
  border: var(--rule) solid transparent; border-radius: 999px;
  background: linear-gradient(var(--ground), var(--ground)) padding-box,
              conic-gradient(from var(--angle), var(--g1), var(--g2), var(--g3), var(--g1)) border-box;
  animation: turn 8s linear infinite;
  transition: color 0.25s, background 0.25s;
}
.cta:hover { color: var(--ground); background: linear-gradient(var(--ink), var(--ink)) padding-box, conic-gradient(from var(--angle), var(--g1), var(--g2), var(--g3), var(--g1)) border-box; }
.cta:disabled { cursor: progress; opacity: 0.7; }
@keyframes turn { to { --angle: 360deg; } }

/* Lists of worlds on the home page: big thin words, one per line. */
.worlds-list { list-style: none; padding: 0; margin: 0.4em 0 1.4em; }
.worlds-list a { display: inline-block; font-size: var(--t-h3); font-weight: 800; letter-spacing: -0.03em; line-height: 1.5; text-decoration: none; }
.worlds-list a:hover { text-decoration: underline; text-decoration-thickness: 1px; }

/* How it works: a real sequence, so it is numbered. */
.steps { list-style: none; padding: 0; margin: 0; counter-reset: step; }
.steps > li { counter-increment: step; }
.steps .num::before { content: counter(step); }
.num { display: block; font-size: var(--t-h3); font-weight: 900; color: var(--quiet); margin-bottom: 0.4em; font-variant-numeric: tabular-nums; }

table.odds { border-collapse: collapse; margin: 1.5rem 0 1.25rem; font-variant-numeric: tabular-nums; }
table.odds th, table.odds td { text-align: left; padding: 0.55rem 2rem 0.55rem 0; border-bottom: 1px solid color-mix(in srgb, var(--quiet) 40%, transparent); font-weight: 400; }
table.odds thead th { color: var(--quiet); font-size: 1rem; }
table.odds td { font-size: var(--t-say); font-weight: 700; }
dl.bands { display: grid; grid-template-columns: max-content 1fr; gap: 0.35rem 1.5rem; margin: 0 0 1.25rem; max-width: var(--column); }
dl.bands dt { font-variant-numeric: tabular-nums; }
dl.bands dd { margin: 0; color: var(--quiet); }

/* Forms: a single hairline to write on. */
.field { display: grid; gap: 0.35rem; margin-bottom: 1.5rem; max-width: 30rem; }
.field label { font-size: 1rem; color: var(--quiet); }
.field input, .field textarea {
  font: inherit; font-size: var(--t-say); font-weight: 400; color: var(--ink); background: transparent;
  border: 0; border-bottom: var(--rule) solid var(--quiet); border-radius: 0; padding: 0.35em 0; min-height: 48px; width: 100%;
}
.field textarea { resize: vertical; min-height: 8rem; line-height: 1.45; }
.field input:focus-visible, .field textarea:focus-visible { outline: none; border-bottom-color: var(--ink); box-shadow: 0 1px 0 0 var(--ink); }
.trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.error { color: var(--ink); border-left: 2px solid var(--g2); padding-left: 0.75rem; }
.done:focus { outline: none; }
.join-form .cta + p { margin-top: 1.25rem; }

/* The legal pages: one quiet column. */
.prose { padding-top: 26svh; padding-bottom: 6svh; max-width: 40rem; }
.prose h1.display { font-size: var(--t-h2); max-width: 14ch; }
.prose h2 { font-size: var(--t-h3); font-weight: 800; letter-spacing: -0.025em; margin: 2.4em 0 0.6em; }
.prose ul { padding-left: 1.2em; max-width: var(--column); margin: 0 0 1em; }
.prose li { margin-bottom: 0.4em; }

@media (prefers-reduced-motion: reduce) {
  .cta, .display { animation: none; }
  :root { transition: none; }
}
:root[data-motion="paused"] :is(.cta, .display) { animation: none; }
