@font-face { font-family: "B612"; src: url(fonts/b612-400.woff2) format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "B612"; src: url(fonts/b612-400i.woff2) format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "B612"; src: url(fonts/b612-700.woff2) format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "B612 Mono"; src: url(fonts/b612mono-400.woff2) format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "B612 Mono"; src: url(fonts/b612mono-700.woff2) format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }

:root {
  --bg: #ffffff;
  --ink: #101012;
  --dim: #8b8c91;
  --rule: #ececee;
  --hover: #f6f6f7;
  --faint: #c4c5ca;
  --magenta: #d0158f;   /* the FMS "magenta line" */
  --sans: "B612", system-ui, sans-serif;
  --mono: "B612 Mono", ui-monospace, monospace;
  --bar-h: 3.5rem;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0c0d;
    --ink: #e9e9ea;
    --dim: #76777c;
    --rule: #1f1f22;
    --hover: #161618;
    --faint: #3d3e43;
    --magenta: #ff4fc8;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--bar-h) + 1.5rem); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 14px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--magenta); color: var(--bg); }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; }
b { font-weight: 700; }
.dim { color: var(--dim); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 2px solid var(--magenta); outline-offset: 2px; }

.wrap { width: min(100% - 3rem, 84rem); margin-inline: auto; }

/* header: one quiet line */
.top {
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
  padding: 1.6rem 0 .6rem;
}
.top p { margin: 0; }
.top b { margin-right: .6rem; }
#stats { font-family: var(--mono); font-size: 12px; }

/* sticky controls */
.bar {
  position: sticky; top: 0; z-index: 5;
  background: var(--bg);
  border-bottom: 1px solid var(--ink);
}
.bar-in { min-height: var(--bar-h); display: flex; align-items: center; gap: 2.5rem; }
.search { flex: 0 1 17rem; display: flex; align-items: center; gap: .5rem; }
.search svg { flex: none; width: 13px; height: 13px; fill: none; stroke: var(--dim); stroke-width: 1.6; stroke-linecap: round; }
.search:focus-within svg { stroke: var(--magenta); }
.search input {
  flex: 1; min-width: 0; padding: .5rem 0;
  border: 0; outline: 0; background: none; color: var(--ink); caret-color: var(--magenta);
  font: inherit; font-size: 14px;
}
.search input::placeholder { color: var(--dim); }
.search input::-webkit-search-cancel-button { display: none; }
.hint { font: 400 11px var(--mono); color: var(--dim); }
kbd { font: inherit; padding: 0 .3rem; border: 1px solid var(--rule); border-radius: 2px; }

.views { display: flex; gap: 1.4rem; }
.views button, .extras button {
  position: relative; padding: .3rem 0; color: var(--dim); white-space: nowrap;
}
.views button:hover, .extras button:hover, #survived[aria-pressed="true"] { color: var(--ink); }
.views button[aria-current="true"] { color: var(--ink); }
.views button[aria-current="true"]::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -.1rem;
  height: 2px; background: var(--magenta);
}
.extras { margin-left: auto; display: flex; gap: 1.6rem; }
#survived i {
  display: inline-block; width: .5rem; height: .5rem; margin-right: .45rem;
  border: 1.5px solid currentColor; border-radius: 50%; vertical-align: .05rem;
}
#survived[aria-pressed="true"] i { background: var(--magenta); border-color: var(--magenta); }

/* groups */
#list { padding: .5rem 0 5rem; }
.group {
  display: grid; grid-template-columns: 12rem minmax(0, 1fr); gap: 0 2rem;
  padding-top: 2.4rem;
}
.label { align-self: start; position: sticky; top: calc(var(--bar-h) + 1.1rem); padding-top: .55rem; }
.label h2 { margin: 0; font: 700 14px/1.3 var(--sans); }
.label p { margin: .3rem 0 0; color: var(--dim); font-size: 12.5px; line-height: 1.45; }
.label .n { display: block; margin-top: .45rem; font: 400 11.5px var(--mono); color: var(--dim); }

.rows { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.rows li { position: relative; border-bottom: 1px solid var(--rule); --pad: .55rem; }

/* watched mark: an empty ring that fills magenta */
.tick {
  position: absolute; z-index: 1; left: -.35rem; top: calc(var(--pad) + 10.5px - .75rem);
  width: 1.5rem; height: 1.5rem; display: grid; place-items: center;
}
.tick::before {
  content: ""; width: .6rem; height: .6rem; border-radius: 50%;
  border: 1.5px solid var(--faint); transition: border-color .12s, background .12s;
}
.tick:hover::before { border-color: var(--ink); }
li.watched .tick::before { background: var(--magenta); border-color: var(--magenta); }
.row {
  display: grid; grid-template-columns: 3rem minmax(0, 1fr) 10.5rem 3.6rem;
  gap: 0 1rem; align-items: baseline;
  padding: var(--pad) .5rem var(--pad) 1.75rem;
  margin: 0 -.5rem;
  text-decoration: none;
}
.rows li:hover .row { background: var(--hover); }
.row:hover .name { color: var(--magenta); }
.yr, .meta { font: 400 12px/1 var(--mono); color: var(--dim); font-variant-numeric: tabular-nums; }
.meta { text-align: right; }
.main { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.name { color: var(--ink); }
.hook { color: var(--dim); margin-left: .9rem; }
.ac { color: var(--dim); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row.flash { animation: flash 2s ease-out; }
@keyframes flash { 0%, 45% { background: color-mix(in srgb, var(--magenta) 12%, transparent); } 100% { background: transparent; } }

.empty { padding: 3rem 0; color: var(--dim); }
.empty button { color: var(--ink); text-decoration: underline; text-underline-offset: .2em; }

.foot {
  display: flex; justify-content: space-between; gap: 2rem;
  padding: 1.25rem 0 2.5rem; border-top: 1px solid var(--rule);
  color: var(--dim); font-size: 12px;
}
.foot p { margin: 0; }
.foot a { text-underline-offset: .2em; }

/* hover preview */
.peek {
  position: fixed; left: 0; top: 0; z-index: 10;
  width: 288px; pointer-events: none;
  background: var(--bg); border: 1px solid var(--ink);
  opacity: 0; transition: opacity .12s;
  will-change: transform;
}
.peek.on { opacity: 1; }
.peek img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--rule); }
.peek p { margin: 0; padding: 0 .65rem; }
.peek-t { padding-top: .55rem !important; font-size: 12.5px; line-height: 1.4; }
.peek-m { padding: .3rem .65rem .6rem !important; font: 400 11px var(--mono); color: var(--dim); }
@media (hover: none), (max-width: 900px) { .peek { display: none; } }
@media (hover: none) { .hint kbd { display: none; } }

/* medium: name and hook on separate lines */
@media (max-width: 1150px) {
  .bar-in { flex-wrap: wrap; gap: 0 2rem; padding: .4rem 0; }
  .search { flex-basis: 100%; }
  .label { top: 7.5rem; }
  html { scroll-padding-top: 8rem; }
  .main { white-space: normal; }
  .name, .hook { display: block; }
  .hook { margin: .1rem 0 0; font-size: 13px; }
}

@media (max-width: 760px) {
  .wrap { width: min(100% - 2rem, 84rem); }
  .top { flex-direction: column; gap: .15rem; padding-top: 1.2rem; }
  .bar { position: static; }
  .bar-in { gap: 0 1.2rem; }
  .views { gap: 1.1rem; overflow-x: auto; scrollbar-width: none; }
  .extras { margin-left: 0; gap: 1.2rem; }
  .group { grid-template-columns: 1fr; padding-top: 2rem; }
  .label { position: static; padding: 0 0 .7rem; }
  .rows li { --pad: .65rem; }
  .row { grid-template-columns: 2.6rem minmax(0, 1fr) auto; gap: 0 .75rem; }
  .ac { grid-column: 2; grid-row: 2; margin-top: .2rem; font-size: 12px; }
  .meta { grid-column: 3; grid-row: 1; }
  .foot { flex-direction: column; gap: .5rem; }
}

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