:root {
  --gutter: clamp(20px, 5vw, 72px);
  --frame: 1240px;
  --masthead: 88px;
  --site-accent: var(--op-red);

  /* Landing-page type: Fraunces for headlines, Instrument Sans for the rest. */
  --site-font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --site-font-body: "Instrument Sans", "Helvetica Neue", Arial, system-ui, sans-serif;
  --site-body: 400 17px/1.5 var(--site-font-body);
  --site-small: 400 15px/1.5 var(--site-font-body);
  --site-ui: 500 15px/1.2 var(--site-font-body);

  /* The intro: how long the disc takes to close around Opli. */
  --intro-time: 1100ms;
  --intro-ease: cubic-bezier(0.76, 0, 0.24, 1);

  /* Light: cream ground, Prussian Blue ink and disc. */
  --ground: var(--op-cream);
  --ink: var(--op-blue);
  --muted: var(--op-slate);
  --field: var(--op-paper);
  --hover: var(--op-sand);
  --disc: var(--op-blue);
  --rain: var(--op-deep-ink);
  --good: var(--op-success);
  --bad: var(--op-red-deep);
  --line: 1.5px solid var(--ink);
  color-scheme: light;
}

/* Dark: Prussian Blue ground, cream ink, and the disc drops to Deep Ink. */
:root[data-theme="dark"] {
  --ground: var(--op-blue);
  --ink: var(--op-cream);
  --muted: var(--op-cream);
  --field: var(--op-deep-ink);
  --hover: var(--op-deep-ink);
  --disc: var(--op-deep-ink);
  --rain: var(--op-blue);
  --good: var(--op-cream);
  --bad: var(--op-cream);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html.locked, html.locked body { overflow: hidden; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: var(--site-body);
  -webkit-font-smoothing: antialiased;
}

h1, p, fieldset { margin: 0; padding: 0; }
fieldset { border: 0; min-width: 0; }
img, svg { display: block; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
p { text-wrap: pretty; }

.frame {
  width: min(var(--frame), 100% - 2 * var(--gutter));
  margin-inline: auto;
}

.ui { font: var(--site-ui); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Changing theme: the new colours open from the toggle as a disc. */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }

/* Masthead: sits over the stage. Cream logo whenever the ground is dark. */

.masthead {
  position: absolute;
  inset: 0 0 auto;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: var(--masthead);
}

.home { position: relative; display: block; border-radius: 4px; }
.logo-cream { position: absolute; inset: 0; opacity: 0; }
.intro .logo-navy, [data-theme="dark"] .logo-navy { opacity: 0; }
.intro .logo-cream, [data-theme="dark"] .logo-cream { opacity: 1; }
.playing .logo-navy, .playing .logo-cream { transition: opacity 300ms ease 350ms; }
.intro .home:focus-visible { outline-color: var(--op-cream); }

.tools { display: flex; align-items: center; gap: 12px; }
.playing .tools { transition: opacity 400ms ease 700ms; }
.intro .tools { visibility: hidden; opacity: 0; }

.marker { display: flex; align-items: center; gap: 10px; }
.marker::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--site-accent);
}

.theme {
  display: grid;
  place-items: center;
  width: var(--op-touch-min);
  height: var(--op-touch-min);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
}

.theme:hover { background: var(--hover); }
.theme svg { transition: rotate 500ms var(--intro-ease); }
[data-theme="dark"] .theme svg { rotate: 180deg; }

/* Stage. The disc is the logo's disc: it fills the screen, then closes around Opli. */

.stage {
  --r: min(40svh, 26vw);
  --cx: 72%;
  --cy: 54%;
  /* Opli's box: centre and size. */
  --ox: var(--cx);
  --oy: var(--cy);
  --os: calc(var(--r) * 2);

  position: relative;
  display: grid;
  align-items: center;
  min-height: max(100svh, 640px);
  padding-block: var(--masthead) 32px;
  overflow: clip;
}

.intro .stage {
  --ox: 50%;
  --oy: 51svh;
  --os: min(106svh, 150vw);
}

.disc {
  position: absolute;
  inset: 0;
  background: var(--disc);
  clip-path: circle(var(--r) at var(--cx) var(--cy));
}

.intro .disc { clip-path: circle(150vmax at var(--cx) var(--cy)); }
.playing .disc { transition: clip-path var(--intro-time) var(--intro-ease); }

.rain { position: absolute; inset: 0; width: 100%; height: 100%; }

.opli {
  position: absolute;
  left: calc(var(--ox) - var(--os) / 2);
  top: calc(var(--oy) - var(--os) / 2);
  width: var(--os);
  aspect-ratio: 1;
}

.playing .opli {
  transition:
    left var(--intro-time) var(--intro-ease),
    top var(--intro-time) var(--intro-ease),
    width var(--intro-time) var(--intro-ease);
}

.opli canvas { position: absolute; inset: 0; width: 100%; height: 100%; visibility: hidden; cursor: pointer; }
.gl .opli canvas { visibility: visible; }

/* Without WebGL: the engraving as a still, inked through a mask so it follows the theme. */
.opli-still { display: none; position: absolute; inset: 0; background: var(--op-cream); }

@supports (mask-mode: luminance) {
  .no-gl .opli-still {
    display: block;
    mask: url("/mascot/opli/opli-ink.webp") center / cover no-repeat;
    mask-mode: luminance;
  }
}

/* Pitch */

.pitch { position: relative; z-index: 1; pointer-events: none; }
.pitch > * { max-width: min(540px, 46vw - var(--gutter) - 24px); pointer-events: auto; }
.playing .pitch > * { transition: opacity 700ms ease, translate 700ms var(--intro-ease); }
.playing .pitch > :nth-child(1) { transition-delay: 450ms; }
.playing .pitch > :nth-child(2) { transition-delay: 570ms; }
.playing .pitch > :nth-child(3) { transition-delay: 690ms; }
.intro .pitch { visibility: hidden; }
.intro .pitch > * { opacity: 0; translate: 0 20px; }

h1 {
  font-family: var(--site-font-display);
  font-variation-settings: "SOFT" 100, "WONK" 1;
  font-weight: 600;
  font-size: clamp(46px, 5.9vw, 88px);
  line-height: 0.98;
  letter-spacing: -0.03em;
}

h1 em { display: block; font-weight: 500; }

.intro-copy { margin-block-start: 24px; font-size: clamp(17px, 1.4vw, 19px); }

/* Chips: the role choice */

.chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: var(--op-touch-min);
  padding: 0 18px;
  border: var(--line);
  border-radius: var(--op-radius-pill);
  font: var(--site-ui);
  white-space: nowrap;
  cursor: pointer;
}

.chip:hover { background: var(--hover); }
.chip:has(input:checked) { background: var(--ink); color: var(--ground); }
.chip input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.chip:has(input:focus-visible) { outline: 2px solid var(--ink); outline-offset: 2px; }

/* Waitlist form */

.signup { display: grid; margin-block-start: 32px; }
.roles { display: flex; flex-wrap: wrap; gap: 8px; }
.field-label { margin-block: 20px 8px; font: var(--site-small); font-weight: 500; }

.field {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border: var(--line);
  border-radius: var(--op-radius-pill);
  background: var(--field);
}

.field:has(input:focus-visible) { outline: 2px solid var(--ink); outline-offset: 2px; }

.field input {
  flex: 1;
  min-width: 0;
  min-height: 48px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--op-radius-pill);
  outline: 0;
  background: transparent;
}

.field input::placeholder { color: var(--muted); opacity: 1; }

.join {
  min-height: 48px;
  padding: 0 24px;
  border: var(--line);
  border-radius: var(--op-radius-pill);
  background: var(--site-accent);
  color: var(--op-cream);
  font: 700 19px/1.2 var(--site-font-body);
  white-space: nowrap;
}

.join:hover:not(:disabled) { text-decoration: underline; text-underline-offset: 4px; }
.join:active:not(:disabled) { translate: 0 1px; }
.join:disabled { cursor: wait; }

.signup-status {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-height: 1.5em;
  margin-block-start: 12px;
  color: var(--muted);
  font: var(--site-small);
}

.signup-status[data-state="pending"] { color: var(--ink); }
.signup-status[data-state="success"] { color: var(--good); font-weight: 700; }
.signup-status[data-state="error"] { color: var(--bad); font-weight: 700; }
.status-icon:empty { display: none; }

/* Narrow screens: the pitch on top, the disc below it */

@media (max-width: 959px) {
  .stage {
    --r: min(44vw, 230px);
    --cx: 50%;
    --cy: calc(100% - var(--r) - 40px);
    display: block;
    min-height: 100svh;
    padding-block: calc(var(--masthead) + 16px) calc(var(--r) * 2 + 80px);
  }
  .pitch > * { max-width: 560px; }
  h1 { font-size: clamp(44px, 12vw, 72px); }
  .marker { display: none; }
}

@media (max-width: 520px) {
  .field { flex-direction: column; align-items: stretch; gap: 12px; padding: 0; border: 0; border-radius: 0; background: transparent; }
  .field:has(input:focus-visible) { outline: 0; }
  .field input, .join { min-height: 56px; }
  .field input { flex: none; border: var(--line); background: var(--field); }
  .field input:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
}

@media (prefers-reduced-motion: reduce) {
  .theme svg { transition: none; }
}
