/* Screentest design system.
   Dark, filmic, typography led. Deliberately nothing like the blue/green
   Letterboxd palette: warm ivory on near black with a projector amber accent,
   and a hot/cool pair used only for "you rated above/below the crowd". */

@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --ink: #0a0a0c;
  --panel: #131317;
  --panel-2: #1b1b21;
  --line: #2a2a32;
  --text: #f4f1ea;
  --muted: #918e88;
  --amber: #e9b949;
  --hot: #e05242;
  --cool: #5b93d6;
  --radius: 14px;
  --serif: 'Instrument Serif', ui-serif, Georgia, serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --wrap: 1120px;
  --on-amber: #17130a;   /* text that sits on an amber fill */
  --shadow: rgba(0, 0, 0, .5);
  color-scheme: dark;
}

/* Light theme.
   Declared twice on purpose. The media query serves people who never touch the
   toggle, and the attribute rule serves people who did; without both, the
   toggle cannot override a light OS setting. `:not([data-theme='dark'])` is what
   keeps an explicit dark choice from being clobbered by the OS. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme='dark']) {
    --ink: #f7f4ed;
    --panel: #fffdf9;
    --panel-2: #efeae0;
    --line: #ded6c8;
    --text: #16140f;
    --muted: #6d6659;
    --amber: #9a6a08;
    --hot: #b03a2d;
    --cool: #2c6398;
    --on-amber: #fffaf0;
    --shadow: rgba(60, 50, 30, .16);
    color-scheme: light;
  }
}
:root[data-theme='light'] {
  --ink: #f7f4ed;
  --panel: #fffdf9;
  --panel-2: #efeae0;
  --line: #ded6c8;
  --text: #16140f;
  --muted: #6d6659;
  --amber: #9a6a08;
  --hot: #b03a2d;
  --cool: #2c6398;
  --on-amber: #fffaf0;
  --shadow: rgba(60, 50, 30, .16);
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  /* A faint vignette so full bleed poster art never runs flat into the edges. */
  background-image: radial-gradient(120% 80% at 50% -10%,
    color-mix(in srgb, var(--text) 5%, var(--ink)) 0%, var(--ink) 60%);
  min-height: 100dvh;
  /* clip, not hidden: hidden turns body into a scroll container and silently
     kills position: sticky on the nav and the year rail. */
  overflow-x: clip;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

.wrap { width: min(100% - 2.5rem, var(--wrap)); margin-inline: auto; }

/* ------------------------------------------------------------------ nav --- */
.nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.1rem 0; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--ink) 86%, transparent);
  backdrop-filter: blur(14px);
}
.brand { font-family: var(--serif); font-size: 1.5rem; letter-spacing: .01em; }
.brand em { color: var(--amber); font-style: italic; }
.nav-links { display: flex; gap: 1.4rem; font-size: .9rem; color: var(--muted); font-weight: 500; }
.nav-links a:hover, .nav-links a[aria-current] { color: var(--text); }

/* --------------------------------------------------------------- typography */
h1, h2, h3 { font-family: var(--serif); font-weight: 400; letter-spacing: .005em; margin: 0; }
h1 { font-size: clamp(2.4rem, 6vw, 4.2rem); line-height: 1.02; }
h2 { font-size: clamp(1.6rem, 3.4vw, 2.4rem); line-height: 1.1; }
.kicker {
  font-family: var(--sans); font-size: .72rem; font-weight: 600;
  letter-spacing: .18em; text-transform: uppercase; color: var(--amber);
}
.muted { color: var(--muted); }
.lede { font-size: 1.05rem; line-height: 1.6; color: var(--muted); max-width: 56ch; }

/* ------------------------------------------------------------------ cards -- */
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
}
.grid { display: grid; gap: 1rem; }
.games-grid { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

.game-card { padding: 1.4rem; display: flex; flex-direction: column; gap: .5rem; min-height: 190px;
  transition: border-color .18s ease, transform .18s ease; }
.game-card:hover { border-color: color-mix(in srgb, var(--text) 24%, var(--line)); transform: translateY(-2px); }
.game-card[data-status='soon'] { opacity: .55; }
.game-card h3 { font-size: 1.7rem; }
.game-card .tag {
  align-self: flex-start; margin-top: auto; font-size: .68rem; font-weight: 600;
  letter-spacing: .14em; text-transform: uppercase; padding: .3rem .55rem;
  border: 1px solid var(--line); border-radius: 999px; color: var(--muted);
}
.game-card[data-status='live'] .tag { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 40%, transparent); }

/* ------------------------------------------------------------------ button - */
.btn {
  font-family: var(--sans); font-size: .95rem; font-weight: 600;
  padding: .85rem 1.4rem; border-radius: 999px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text); cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .1s ease;
}
.btn:hover { border-color: color-mix(in srgb, var(--text) 30%, var(--line)); }
.btn:active { transform: scale(.985); }
.btn-primary { background: var(--amber); color: var(--on-amber); border-color: var(--amber); }
.btn-primary:hover { background: color-mix(in srgb, var(--amber) 82%, var(--text)); border-color: transparent; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-ghost { background: transparent; }

/* --------------------------------------------------------- poster / card - */
/* Two things live in the same 2/3 box: a real licensed poster (an <img>) and a
   generated one for the ~95% of films where no free artwork exists. The
   generated card is built to read as a poster rather than as a database row,
   because a grid of sixty plain labels is what makes a catalogue feel dead. */
.poster {
  position: relative; aspect-ratio: 2/3; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--line); background: var(--panel-2);
  transition: border-color .18s ease, transform .18s ease;
}
.poster img { width: 100%; height: 100%; object-fit: cover; display: block; }
a:hover > .poster { border-color: color-mix(in srgb, var(--text) 28%, var(--line)); transform: translateY(-3px); }

.poster.gen {
  display: flex; flex-direction: column; padding: 1rem .85rem .9rem;
  /* Three stacked layers, top to bottom:
     1. a soft accent glow where the light falls,
     2. a vignette so the type stays legible over any colour pair,
     3. the genre gradient itself, running from --a to --b.
     For a single-genre film --b is that genre's own dark shade, so the card
     looks exactly as it did. For a rom-com --b is the second genre's colour and
     the card reads as both at once. */
  background:
    radial-gradient(110% 80% at var(--gx, 50%) var(--gy, 0%),
      color-mix(in srgb, var(--ac) 22%, transparent) 0%, transparent 58%),
    radial-gradient(150% 108% at 50% 40%,
      transparent 30%, color-mix(in srgb, var(--dk, #000) 70%, transparent) 100%),
    linear-gradient(158deg, var(--a) 6%, var(--b) 94%);
  color: #f6f3ec;
}
/* Light source moves per film so a screenful is not one repeated gradient. */
.poster.gen[data-light='0'] { --gx: 22%; --gy: 8%; }
.poster.gen[data-light='1'] { --gx: 78%; --gy: 10%; }
.poster.gen[data-light='2'] { --gx: 50%; --gy: 96%; }
.poster.gen[data-light='3'] { --gx: 88%; --gy: 62%; }

/* Film grain. An SVG turbulence tile rather than an image request: it is a few
   hundred bytes, scales to any card size, and stops the flat gradients from
   looking like CSS. */
.poster.gen::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  opacity: .32; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");
}
/* A hairline frame inset from the edge, the way a printed one-sheet is trimmed. */
.poster.gen::before {
  content: ''; position: absolute; inset: 6px; border-radius: 5px;
  border: 1px solid color-mix(in srgb, var(--ac) 22%, transparent);
  pointer-events: none;
}

.gen-top {
  position: relative; z-index: 1; flex: 0 0 auto;
  font-size: .58rem; letter-spacing: .18em; text-transform: uppercase;
  color: color-mix(in srgb, #fff 46%, transparent);
}
.gen-mid { position: relative; z-index: 1; margin: auto 0; text-align: center; }
.gen-tag {
  font-size: .55rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--ac); margin-bottom: .5rem;
  /* Never let a long genre run past the card edge and get clipped. */
  overflow-wrap: anywhere; line-height: 1.5;
}
/* On a two-genre card each label wears its own colour, so the gradient is
   readable as a pairing rather than as an arbitrary wash. */
.gen-tag .g2 { color: var(--ac2, var(--ac)); }
.gen-tag .sep { color: color-mix(in srgb, #fff 34%, transparent); margin: 0 .35em; }
.gen-title {
  font-family: var(--serif); font-weight: 400; line-height: 1.04;
  font-size: clamp(.92rem, var(--ts, 1.4rem), 1.7rem);
  text-wrap: balance;
  /* Five lines is the most a 2/3 card holds before the billing block is pushed
     off. Beyond that the title truncates rather than breaking the layout. */
  display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden;
  text-shadow: 0 1px 18px rgba(0, 0, 0, .45);
}
.gen-foot {
  position: relative; z-index: 1; flex: 0 0 auto; text-align: center;
  font-size: .54rem; letter-spacing: .08em; text-transform: uppercase;
  line-height: 1.35;
  color: color-mix(in srgb, #fff 52%, transparent);
  /* Wraps to two lines instead of truncating. "Directed by Francis F…" reads as
     a bug; the billing block on a real poster wraps. */
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.gen-foot .rule {
  display: block; width: 26px; height: 1px; margin: 0 auto .55rem;
  background: color-mix(in srgb, var(--ac) 70%, transparent);
}
.poster.is-notable { border-color: color-mix(in srgb, var(--amber) 40%, var(--line)); }

footer { border-top: 1px solid var(--line); margin-top: 5rem; padding: 2rem 0 3rem;
  color: var(--muted); font-size: .82rem; line-height: 1.7; }

/* ------------------------------------------------------------ theme togg --- */
.theme-btn {
  width: 34px; height: 34px; border-radius: 50%; padding: 0;
  display: grid; place-items: center; font-size: .95rem; line-height: 1;
  background: transparent; border: 1px solid var(--line); color: var(--muted);
  cursor: pointer; transition: color .15s ease, border-color .15s ease;
}
.theme-btn:hover { color: var(--text); border-color: color-mix(in srgb, var(--text) 30%, var(--line)); }
.nav-links { align-items: center; }

/* The generated posters keep their own dark palette in both themes. A printed
   one-sheet does not change colour depending on the wall it hangs on, and
   lightening them made the grid look washed out rather than bright. */

/* ------------------------------------------------------ streak account --- */
.claim {
  border: 1px solid color-mix(in srgb, var(--amber) 30%, var(--line));
  background: color-mix(in srgb, var(--amber) 5%, var(--panel));
  border-radius: var(--radius); padding: 1.4rem; margin-top: 1.6rem;
}
.claim-title { font-family: var(--serif); font-size: 1.35rem; margin: 0 0 .4rem; }
.claim-note { color: var(--muted); font-size: .88rem; line-height: 1.55; margin: 0 0 1.1rem; max-width: 48ch; }
.claim-row { display: flex; gap: .6rem; flex-wrap: wrap; }
.claim-input {
  flex: 1 1 15rem; min-width: 0; padding: .8rem 1rem; border-radius: 999px;
  border: 1px solid var(--line); background: var(--ink); color: var(--text);
  font-family: var(--sans); font-size: .95rem;
}
.claim-input:focus { outline: none; border-color: var(--amber); }
.claim-actions { margin-top: .7rem; }
.claim-no { font-size: .82rem; padding: .5rem .9rem; color: var(--muted); }
.claim-status { font-size: .85rem; color: var(--muted); margin: .9rem 0 0; line-height: 1.5; }
.signed-in { font-size: .82rem; color: var(--muted); }
.signed-in b { color: var(--text); font-weight: 600; }
