/* Karma Kid — Controller
   All sizes are in em, derived from the 3200px-wide design where the type is 30px.
   (e.g. 72px margin / 30px = 2.4em). The type size scales with the viewport. */

@font-face {
  font-family: "Neue Haas Display";
  src: url("fonts/NeueHaasDisplay-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #191919;
  --muted: #bababa;
  --paper: #ffffff;
  --video-paper: #fefefe;           /* matches the video background */
  --line: max(1px, 0.0667em);       /* 2px at 30px */
  --line-thick: max(2px, 0.1333em); /* 4px at 30px */
  --column: 41.94vw;                /* centre column: 1342 / 3200 */
}

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; height: 100%; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: "Neue Haas Display", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-weight: 500;
  font-size: clamp(20px, 0.9375vw, 36px); /* 20px on laptops/tablets; from ~2130px wide it scales up with the screen */
  line-height: 0.967;               /* 29 / 30 */
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

ul { list-style: none; margin: 0; padding: 0; }
h1, p { margin: 0; font: inherit; }
small { font-size: inherit; }

/* ---------- states: hard cut between layers ---------- */

.intro, .page { position: fixed; inset: 0; }
/* The page always stays rendered underneath (main.js makes it inert while the intro covers it) */
.is-page .intro { visibility: hidden; }

/* ---------- intro video ---------- */

.intro {
  z-index: 2;
  background: var(--video-paper) url("video/poster.jpg") center / contain no-repeat;
  cursor: pointer;
  outline: none;
}
.intro video {
  width: 100%;
  height: 100%;
  object-fit: contain;              /* white-on-white, so letterboxing is invisible
                                       and the wide type is never cropped */
  display: block;
}
@media (orientation: portrait) {
  .intro { background-image: url("video/poster-portrait.jpg"); }
}

/* "[click for controller]" next to the mouse pointer (desktop only).
   White + difference blend = black on the white video, white over the black type. */
.cursor-label {
  position: absolute;
  top: 0;
  left: 0;
  font-size: 0.8em;                 /* 20% smaller than the page text */
  color: #fff;
  mix-blend-mode: difference;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  will-change: transform;
}
.cursor-label.is-visible { opacity: 1; }
@media not ((hover: hover) and (pointer: fine)) {
  .cursor-label { display: none; }
}

/* ---------- page ---------- */

.page > * { position: absolute; }

.title { top: 2em; left: 2.4em; }
.copy  { bottom: 2em; left: 2.4em; }

.date  { top: 2em; left: var(--column); }
.dot {
  position: absolute;
  left: -2.167em;                   /* 1277 -> 1342 */
  top: 0.11em;
  width: 0.667em;                   /* 20px */
  height: 0.667em;
  border-radius: 50%;
  background: var(--ink);
}

.links {
  bottom: 2em;
  left: var(--column);
  display: flex;
  gap: 0;
}
.links ul { width: 8.6em; }         /* second column starts 258px later */

/* ---------- links ---------- */

.link {
  color: inherit;
  text-decoration: none;
  text-decoration-thickness: var(--line);
  text-underline-offset: 0.17em;
}
.link:hover,
.link:focus-visible {
  text-decoration-line: underline;
  outline: none;
}
/* underlines don't reach inside the glitch's letter boxes, so each letter draws its own piece */
.link:hover .glitch-letters > span,
.link:focus-visible .glitch-letters > span {
  text-decoration: underline;
  text-decoration-thickness: var(--line);
  text-underline-offset: 0.17em;
}
.signup__status:disabled .glitch-letters > span { text-decoration: none; }

/* text buttons (cookie choices) look exactly like links */
button.link {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  line-height: inherit;
  cursor: pointer;
}

/* ---------- footer + cookie choice ---------- */

.copy { display: flex; align-items: baseline; gap: 1.2em; }
.copy small,
.copy .link { font-size: 0.8em; }   /* © 2026 + Privacy: same size as the cookie banner */
/* while the banner is up, its own "privacy" link is enough */
.consent:not([hidden]) ~ .copy .copy__privacy { display: none; }

/* desktop: top right, the one empty corner of the layout (phones: above the links, below) */
.consent {
  top: 2em;
  right: 2.4em;
  width: 12.5em;
}
.consent p { font-size: 0.8em; text-wrap: balance; } /* 20% smaller, like the mouse label */
.consent__actions { display: flex; gap: 1.2em; }

/* ---------- sign-up ---------- */

.signup {
  top: calc(50% - 1.03em);          /* input baseline sits on the vertical centre */
  left: var(--column);
  width: min(23.67em, calc(100vw - var(--column) - 2.4em)); /* 710px */
}

.signup__input {
  display: block;
  box-sizing: border-box;
  width: 100%;
  height: calc(0.967em + 0.133em + var(--line)); /* inputs ignore line-height in some browsers */
  margin: 0;
  padding: 0 0 0.133em;
  border: 0;
  border-bottom: var(--line) solid var(--ink);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  letter-spacing: inherit;
  line-height: inherit;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.signup__input::placeholder { color: var(--muted); opacity: 1; }

/* glitching placeholder: sits exactly over the real one, which hides while it shows */
.signup__placeholder {
  position: absolute;
  top: 0;
  left: 0;
  height: 0.967em;                  /* same box as the input's text area; text centred in it, like an input */
  display: none;
  align-items: center;
  line-height: normal;
  color: var(--muted);
  white-space: nowrap;
  pointer-events: none;
}
.is-ph-glitch .signup__placeholder { display: flex; }
.is-ph-glitch .signup__input::placeholder { color: transparent; }

/* main.js splits glitching text into letters so each can shift, slice and swap */
.glitch-letters > span { display: inline-block; }

/* focus + error: thicker line growing downward, text below stays put */
.signup__input:focus,
.is-error .signup__input {
  border-bottom-width: var(--line-thick);
  height: calc(0.967em + 0.133em + var(--line-thick));
}
.signup__input:focus ~ .signup__status,
.is-error .signup__status { margin-top: 0; }

.signup__input:disabled {
  color: var(--ink);
  -webkit-text-fill-color: var(--ink);
  opacity: 1;
}

.signup__status {
  display: block;
  margin: calc(var(--line-thick) - var(--line)) 0 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  line-height: inherit;
  text-align: left;
  cursor: pointer;
}
.signup__status:disabled { cursor: default; text-decoration: none; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- privacy page (normal scrolling text, same type) ---------- */

.doc { height: auto; }
.doc__title { position: absolute; top: 2em; left: 2.4em; }
.doc__back { position: absolute; top: 4.9em; left: 2.4em; } /* one empty line under the title */
.doc__body {
  max-width: 30em;
  margin: 0 0 0 var(--column);
  padding: 2em 2.4em 4em 0;
}
.doc h1, .doc h2 { margin: 0; font: inherit; }
.doc h2 { margin-top: 1.934em; }    /* one empty line before each section */
.doc p { margin: 0; line-height: 1.2; }
.doc p + p { margin-top: 0.967em; }
.doc__muted { color: var(--muted); }
.doc__body .link { text-decoration-line: underline; } /* links inside text stay visible */
.doc a[href^="mailto:"] { white-space: nowrap; } /* keep the email address on one line */

/* ---------- phones ---------- */

@media (max-width: 767px) {
  /* the two link columns are ~11em wide: end them at the right margin and line the date up with them */
  :root { --column: calc(100vw - 12.8em); }
  body { font-size: clamp(15px, 4.5vw, 17px); } /* 17px on most phones, eases to 15px on very small ones */
  .title, .copy { left: 1.6em; }
  .title, .date { top: max(1.6em, env(safe-area-inset-top)); }
  .copy, .links { bottom: max(1.6em, env(safe-area-inset-bottom)); }
  .links { gap: 1.2em; }
  .links ul { width: auto; }
  /* stacked, so it never runs into the link columns; © stays on the bottom line */
  .copy { flex-direction: column; align-items: flex-start; gap: 0; }
  .copy small { order: 1; }
  .copy .copy__privacy { font-size: 0.7em; margin-bottom: 0.8em; } /* smaller, with room above © 2026 */
  /* full width, one empty line above the links (4 lines tall) */
  .consent {
    top: auto;
    bottom: calc(max(1.6em, env(safe-area-inset-bottom)) + 4.84em);
    left: 1.6em;
    right: auto;
    width: calc(100vw - 3.2em);
  }
  .signup {
    left: 1.6em;
    width: calc(100vw - 3.2em);
  }
  .doc__title { top: max(1.6em, env(safe-area-inset-top)); left: 1.6em; }
  .doc__back { top: max(1.6em, env(safe-area-inset-top)); left: var(--column); } /* where the date sits */
  .doc__body { margin-left: 0; padding: calc(max(1.6em, env(safe-area-inset-top)) + 4em) 1.6em 3em; }
  .signup__input,
  .signup__placeholder { font-size: max(16px, 1em); } /* under 16px, iPhones zoom in when the field is tapped */
}
