/* Gorilla Position
 *
 * Dark only, by choice — this gets opened next to Netflix on a sofa.
 *
 * The list is laid out like a broadcast schedule rather than a to-do list: a
 * fixed date column on the left, a coloured rail per show, and metadata set in
 * tabular mono so the dates stack into a readable column. That, plus the ring
 * mark, is where the character comes from — not from decoration.
 */

:root {
  /* surfaces, coolest to warmest */
  --bg:          #0a0c10;
  --surface:     #11141a;
  --raised:      #171b23;
  --line:        #212734;
  --line-strong: #2d3441;

  /* text */
  --text:  #f1f4f9;
  --muted: #8b94a5;
  --faint: #59616f;

  /* brand + shows */
  --gold:      #e8c46a;
  --raw:       #e01e37;
  --smackdown: #2f7de0;
  --nxt:       #f97316;
  --ple:       var(--gold);
  --ok:        #35c47a;
  --danger:    #e5675a;

  /* type */
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;

  /* spacing scale — everything is a step on this, nothing is ad hoc */
  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;
  --s5: 24px; --s6: 32px; --s7: 48px;

  --r-sm: 6px; --r: 10px; --r-lg: 16px; --r-full: 999px;

  --wrap: 680px;
  --ease: cubic-bezier(.4, 0, .2, 1);
}

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

html {
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-wrap: break-word;
}

::selection { background: var(--gold); color: #14161c; }

/* The default scrollbar is a bright slab against this background. */
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border: 3px solid var(--bg);
  border-radius: var(--r-full);
}
::-webkit-scrollbar-thumb:hover { background: var(--faint); }

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* Visible to screen readers only. The date column is presentational — it is
   split across two elements and abbreviated — so rows carry the full text here. */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

main {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: var(--s2) var(--s4) var(--s7);
}

h1, h2, h3 { margin: 0; line-height: 1.15; font-weight: 700; }

/* A single treatment for every piece of small uppercase metadata. */
.eyebrow, .month, .sheet-body h3, .brand-tag, .badge, .date-dow {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}

/* ── top bar ─────────────────────────────────────────────────────────────── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  max-width: var(--wrap);
  margin: 0 auto;
  padding: calc(var(--s3) + env(safe-area-inset-top)) var(--s4) var(--s3);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s var(--ease);
}
.topbar.stuck { border-bottom-color: var(--line); }

.brand {
  display: flex;
  align-items: center;
  gap: var(--s3);
  color: inherit;
  text-decoration: none;
  min-width: 0;
}
.brand-mark { width: 30px; height: 30px; flex: none; color: var(--gold); }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -.01em;
  white-space: nowrap;
}
.brand-tag { color: var(--faint); margin-top: 1px; }

.icon-btn {
  flex: none;
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: var(--r);
  cursor: pointer;
  transition: color .15s var(--ease), border-color .15s var(--ease);
}
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn:hover { color: var(--text); border-color: var(--line-strong); }
.icon-btn:active { transform: translateY(1px); }

/* ── up next ─────────────────────────────────────────────────────────────── */

.card {
  position: relative;
  padding: var(--s5);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
}
/* A wash of the show's colour bleeding down from the top edge, rather than the
   usual left-hand accent stripe. */
.card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 120px;
  background: linear-gradient(to bottom, color-mix(in srgb, var(--tint) 13%, transparent), transparent);
  pointer-events: none;
}
.card::after {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: var(--tint);
}
.card > * { position: relative; }

.card-raw       { --tint: var(--raw); }
.card-smackdown { --tint: var(--smackdown); }
.card-nxt       { --tint: var(--nxt); }
.card-ple       { --tint: var(--ple); }
.card-done      { --tint: var(--ok); }

.eyebrow { color: var(--tint); margin: 0 0 var(--s2); }

.card h2 {
  font-size: clamp(24px, 6vw, 31px);
  font-weight: 800;
  letter-spacing: -.025em;
  text-wrap: balance;
}

/* Date and venue stack rather than sharing a middot line — at this width the
   one-liner wrapped mid-address, which looked like an accident. */
.card-date {
  margin: var(--s3) 0 0;
  font-family: var(--mono);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
  color: var(--muted);
}
.card-venue {
  margin: 3px 0 0;
  font-size: 13.5px;
  color: var(--faint);
}

.spoiler-text {
  margin: var(--s4) 0 0;
  padding-left: var(--s3);
  border-left: 2px solid var(--line-strong);
  font-size: 13.5px;
  color: var(--muted);
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  margin-top: var(--s5);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  padding: 11px var(--s4);
  background: var(--raised);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--r);
  font: 600 14px/1 var(--sans);
  text-decoration: none;
  cursor: pointer;
  transition: background .15s var(--ease), border-color .15s var(--ease);
}
.btn svg { width: 15px; height: 15px; opacity: .6; }
.btn:hover { border-color: var(--line-strong); background: #1d222b; }
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--gold);
  color: #14161c;
  border-color: transparent;
}
.btn-primary:hover { background: #f0d182; border-color: transparent; }
.btn-danger { color: var(--danger); border-color: #3a2a2c; }
.btn-danger:hover { border-color: var(--danger); background: var(--raised); }

.card-foot {
  margin: var(--s4) 0 0;
  font-size: 12.5px;
  color: var(--faint);
}

/* ── progress ────────────────────────────────────────────────────────────── */

.progress { margin: var(--s5) 0; }

.progress-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s3);
  margin-bottom: var(--s2);
  font-family: var(--mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.progress-pct { color: var(--gold); font-weight: 600; }

.bar {
  height: 4px;
  background: var(--line);
  border-radius: var(--r-full);
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #b8863a, var(--gold));
  border-radius: var(--r-full);
  transition: width .4s var(--ease);
}

/* ── filters ─────────────────────────────────────────────────────────────── */

.filters {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--s3);
  padding-bottom: var(--s3);
}

.chips { display: flex; flex-wrap: wrap; gap: var(--s1); }

.chip {
  padding: 6px 13px;
  background: transparent;
  color: var(--faint);
  border: 1px solid var(--line);
  border-radius: var(--r-full);
  font: 600 12.5px/1.4 var(--sans);
  cursor: pointer;
  transition: color .15s var(--ease), border-color .15s var(--ease), background .15s var(--ease);
}
.chip:hover { color: var(--muted); border-color: var(--line-strong); }
.chip.on {
  color: var(--chip);
  border-color: color-mix(in srgb, var(--chip) 45%, transparent);
  background: color-mix(in srgb, var(--chip) 11%, transparent);
}
.chip-raw       { --chip: var(--raw); }
.chip-smackdown { --chip: var(--smackdown); }
.chip-nxt       { --chip: var(--nxt); }
.chip-ple       { --chip: var(--ple); }

.switches { display: flex; gap: var(--s4); }
.switch {
  display: flex;
  align-items: center;
  gap: var(--s2);
  font-size: 12.5px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.switch input { accent-color: var(--gold); width: 15px; height: 15px; margin: 0; }

/* ── the list ────────────────────────────────────────────────────────────── */

.month {
  position: sticky;
  top: 62px;
  z-index: 10;
  margin: var(--s5) 0 0;
  padding: var(--s3) 0 var(--s2);
  color: var(--faint);
  /* Opaque, not translucent: the coloured rails of rows sliding underneath
     showed through as stray slivers. */
  background: var(--bg);
}
.month:first-child { margin-top: 0; }

.row {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--line);
}

.row-main {
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--s3);
  min-width: 0;
  /* One fixed height for every row, so the date column keeps an even rhythm
     whether or not TVmaze knew the venue. Titles ellipsis rather than wrap. */
  min-height: 64px;
  padding: 0;
  background: none;
  border: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.row-main:hover { background: #ffffff06; }
.row-main:active { background: #ffffff0d; }

/* the show's colour, carried down the left edge */
.rail {
  flex: none;
  width: 3px;
  align-self: stretch;
  background: var(--tint);
  opacity: .85;
  transition: opacity .15s var(--ease);
}
.row-raw       { --tint: var(--raw); }
.row-smackdown { --tint: var(--smackdown); }
.row-nxt       { --tint: var(--nxt); }
.row-ple       { --tint: var(--ple); }

.date {
  flex: none;
  width: 34px;
  text-align: center;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}
.date-dow { display: block; color: var(--faint); letter-spacing: .06em; }
.date-day { display: block; font-size: 16px; font-weight: 600; color: var(--muted); line-height: 1.25; }

.row-text { flex: 1; min-width: 0; }
.row-title {
  display: block;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -.005em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row-sub {
  display: block;
  margin-top: 1px;
  font-size: 12px;
  color: var(--faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row-ple .row-title { color: var(--gold); }

/* Fixed width so the labels stack into a column instead of ragging. */
.badge {
  flex: none;
  width: 30px;
  text-align: right;
  color: var(--tint);
  opacity: .7;
}

/* 219 bright empty circles would be noise, so unwatched is barely a hairline
   and only firms up under the pointer. Watched is unmistakable. */
.tick {
  flex: none;
  display: grid;
  place-items: center;
  width: 20px; height: 20px;
  margin-right: var(--s3);
  border: 1.5px solid var(--line);
  border-radius: 50%;
  color: transparent;
  transition: background .15s var(--ease), border-color .15s var(--ease);
}
.tick svg { width: 11px; height: 11px; transform: scale(.4); transition: transform .18s var(--ease); }
.row-main:hover .tick { border-color: var(--faint); }

/* Watched rows recede as a whole rather than growing a loud green badge —
   fading the row uniformly keeps the unwatched ones the only thing with colour. */
.row.done { opacity: .38; }
.row.done .tick { border-color: var(--ok); color: var(--ok); }
.row.done .tick svg { transform: scale(1); }
.row.done .row-title { font-weight: 500; }
.row:hover.done { opacity: .6; }

.row-bulk {
  flex: none;
  display: grid;
  place-items: center;
  width: 42px;
  background: none;
  border: 0;
  color: var(--faint);
  cursor: pointer;
  transition: color .15s var(--ease), background .15s var(--ease), opacity .15s var(--ease);
}
.row-bulk svg { width: 17px; height: 17px; }
.row-bulk:hover { color: var(--gold); background: #ffffff06; }

/* On touch it has to stay put — there is no hover to reveal it. With a real
   pointer it recedes until the row is under the cursor. */
@media (hover: hover) {
  .row-bulk { opacity: 0; }
  .row:hover .row-bulk,
  .row-bulk:focus-visible { opacity: 1; }
}
@media (hover: none) {
  .row-bulk { opacity: .45; }
}

.empty {
  padding: var(--s7) 0;
  text-align: center;
  font-size: 14px;
  color: var(--faint);
}

/* ── footer ──────────────────────────────────────────────────────────────── */

.foot {
  margin-top: var(--s7);
  padding-top: var(--s5);
  border-top: 1px solid var(--line);
  font-size: 12px;
  line-height: 1.65;
  color: var(--faint);
}
.foot p { margin: 0 0 var(--s1); }
.foot a { color: var(--muted); text-decoration-color: var(--line-strong); text-underline-offset: 2px; }
.foot a:hover { color: var(--gold); }
.foot strong { color: var(--muted); font-weight: 600; }

/* ── settings sheet ──────────────────────────────────────────────────────── */

.sheet {
  width: min(520px, calc(100% - var(--s6)));
  max-height: 85vh;
  margin: auto;
  padding: 0;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  box-shadow: 0 24px 60px #00000080;
}
.sheet::backdrop { background: color-mix(in srgb, #05070a 72%, transparent); }

.sheet-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s4) var(--s5);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.sheet-head h2 { font-size: 15px; letter-spacing: -.01em; }

.sheet-body { padding: var(--s5); overflow-y: auto; }
.sheet-body h3 { margin: var(--s6) 0 var(--s2); color: var(--faint); }
.sheet-body h3:first-child { margin-top: 0; }

.hint { margin: 0 0 var(--s3); font-size: 12.5px; line-height: 1.6; color: var(--muted); }
.hint strong { color: var(--text); font-weight: 600; }

.code {
  display: block;
  width: 100%;
  padding: var(--s3);
  background: var(--bg);
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: var(--r);
  font: 400 11.5px/1.6 var(--mono);
  word-break: break-all;
  resize: vertical;
}
.code:focus { color: var(--text); border-color: var(--line-strong); outline: none; }

.btn-row { display: flex; gap: var(--s2); margin: var(--s2) 0 var(--s5); }

/* ── toast ───────────────────────────────────────────────────────────────── */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--s5) + env(safe-area-inset-bottom));
  z-index: 30;
  transform: translate(-50%, 12px);
  padding: 11px var(--s4);
  background: var(--raised);
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  box-shadow: 0 12px 32px #0009;
  font-size: 13.5px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s var(--ease), transform .2s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ── narrow phones ───────────────────────────────────────────────────────── */

@media (max-width: 400px) {
  main { padding-left: var(--s3); padding-right: var(--s3); }
  .topbar { padding-left: var(--s3); padding-right: var(--s3); }
  .card { padding: var(--s4); }
  .switches { gap: var(--s3); }
  .row-bulk { width: 36px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
