/* ============================================================
   Design tokens
   ============================================================ */
:root {
  --ink:      #1b1f2a;
  --ink-soft: #3c4252;
  --paper:    #e8ddc3;
  --paper-lo: #ddd0b1;
  --card:     #f3ecd9;
  --maroon:   #7a2331;
  --maroon-lo:#5c1a25;
  --teal:     #1f5c56;
  --amber:    #b97a1f;
  --line:     #b8ab8c;
  --line-lo:  #cabf9f;

  --font-display: 'Oswald', sans-serif;
  --font-mono:    'JetBrains Mono', monospace;
  --font-serif:   'Source Serif 4', serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.5;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

a { color: var(--maroon); }
a:hover { color: var(--maroon-lo); }

/* ============================================================
   Header — video-sleeve label strip is the signature element
   ============================================================ */
.mobile-notice {
  display: none;
  background: var(--amber);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  text-align: center;
  padding: 0.5rem 1rem;
}

@media (max-width: 720px) {
  .mobile-notice { display: block; }
}

.site-head {
  position: relative;
  background: var(--maroon);
  color: var(--paper);
  padding: 2.5rem 1.5rem 2rem;
  overflow: hidden;
}

.head-inner { max-width: 960px; margin: 0 auto; position: relative; z-index: 2; }

.head-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  color: #d8a9a9;
  margin-bottom: 0.6rem;
}

.head-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2rem, 6vw, 3.4rem);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin: 0;
  line-height: 1.05;
}

.head-sub {
  display: block;
  font-weight: 500;
  font-size: 0.42em;
  letter-spacing: 0.3em;
  color: var(--amber);
  margin-top: 0.5rem;
}

.head-tag {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  color: #eadfc4;
  max-width: 42ch;
  margin: 1rem 0 0;
}

/* diagonal cassette-stripe motif, restrained, one accessory only */
.tape-strip {
  position: absolute;
  right: -10%;
  top: 0;
  bottom: 0;
  width: 55%;
  background: repeating-linear-gradient(
    115deg,
    transparent 0 28px,
    rgba(201,138,31,0.18) 28px 32px,
    transparent 32px 60px,
    rgba(31,92,86,0.16) 60px 64px
  );
  z-index: 1;
  pointer-events: none;
}

/* ============================================================
   About card
   ============================================================ */
main { max-width: 960px; margin: 0 auto; padding: 1.5rem; }

.stats-strip {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin-bottom: 0.9rem;
}

.about-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 2px;
  margin-bottom: 1.5rem;
}

.about-toggle {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: none;
  border: none;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--ink);
  padding: 0.9rem 1.1rem;
  cursor: pointer;
}

.about-toggle:hover { color: var(--maroon); }
.about-toggle:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

.about-toggle-icon {
  font-family: var(--font-mono);
  font-size: 1.2rem;
  color: var(--amber);
  transition: transform 0.15s ease;
}

.about-toggle[aria-expanded="true"] .about-toggle-icon { transform: rotate(45deg); }

.about-body {
  padding: 0 1.1rem 1.1rem;
  font-family: var(--font-serif);
  font-size: 0.98rem;
  color: var(--ink-soft);
}

.about-body p { margin: 0 0 0.9rem; }
.about-body p:last-child { margin-bottom: 0; }

.about-callout {
  background: var(--paper);
  border-left: 3px solid var(--amber);
  padding: 0.7rem 0.9rem;
  font-size: 0.92rem;
}

/* ============================================================
   Controls
   ============================================================ */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  align-items: center;
  margin-bottom: 1rem;
}

.search-wrap {
  flex: 1 1 260px;
  position: relative;
  display: flex;
  align-items: center;
}

#searchBox {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: 2px;
}

#searchBox:focus-visible { outline: 2px solid var(--teal); outline-offset: 1px; }

.filter-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.82rem;
}

.filter-wrap label { color: var(--ink-soft); }

.filter-wrap select {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: 2px;
}

/* fixed widths so the box doesn't resize (and shift everything after
   it in the row) depending on how long the currently-selected option's
   text happens to be */
#networkFilter { width: 190px; }
#decadeFilter { width: 90px; }
#completenessFilter { width: 260px; }

.clear-filters-btn {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--maroon);
  background: none;
  color: var(--maroon);
  border-radius: 2px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}

.clear-filters-btn:hover { background: var(--maroon); color: var(--paper); }

/* ============================================================
   Table
   ============================================================ */
.table-wrap {
  border: 1px solid var(--line);
  border-radius: 2px;
  overflow-x: auto;
  background: var(--card);
}

table { width: 100%; min-width: 970px; border-collapse: collapse; table-layout: fixed; }

thead th:nth-child(1) { width: 44px; }
thead th:nth-child(2) { width: 245px; }
thead th:nth-child(3) { width: 185px; }
thead th:nth-child(4) { width: 135px; }
thead th:nth-child(5) { width: 62px; }
thead th:nth-child(6) { width: 299px; }

thead th {
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: left;
  padding: 0.6rem 0.7rem;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 3;
}

th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--amber); }
.sort-icon { font-size: 0.65rem; color: var(--amber); margin-left: 0.25rem; }
th.is-sorted { color: var(--amber); }

tbody tr {
  border-bottom: 1px solid var(--line-lo);
  transition: background 0.1s ease;
}

tbody tr:hover { background: var(--paper); }

tbody td {
  padding: 0.55rem 0.7rem;
  vertical-align: top;
}

.col-poster { width: 44px; padding-right: 0 !important; }

.poster-btn {
  display: block;
  padding: 0;
  border: none;
  background: none;
  cursor: zoom-in;
}

.poster-thumb {
  display: block;
  width: 34px;
  height: 48px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--paper-lo);
}

.col-vn {
  font-weight: 600;
  color: var(--ink);
  line-height: 1.35;
}

.alt-name {
  font-family: var(--font-serif);
  font-weight: 400;
  font-style: italic;
  font-size: 0.82rem;
  color: var(--ink-soft);
  margin-top: 0.15rem;
}

.col-en { color: var(--ink-soft); }
.col-cn { color: var(--ink-soft); font-size: 0.92rem; }
.col-year { color: var(--ink-soft); white-space: nowrap; }

.notes-links-cell { vertical-align: top; max-width: 0; }

.links-cell { display: flex; flex-wrap: wrap; align-items: center; gap: 0.28rem; width: 100%; }

.info-dot {
  font-size: 0.9rem;
  color: var(--teal);
  cursor: help;
  border: none;
  background: none;
  padding: 0 0.1rem;
  line-height: 1;
  flex-shrink: 0;
}

.info-dot:hover, .info-dot:focus-visible { color: var(--maroon); }

.link-pill {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 600;
  padding: 0.15rem 0.32rem;
  border-radius: 2px;
  border: none;
  text-decoration: none;
  color: var(--paper);
  letter-spacing: 0;
  white-space: nowrap;
  cursor: pointer;
}

.link-pill.tmdb { background: var(--teal); }
.link-pill.tvdb { background: var(--maroon); }
.link-pill.copy { background: var(--line); color: var(--ink); }
.link-pill.suggest { background: var(--ink-soft); }

.empty-state {
  padding: 2.5rem 1rem;
  text-align: center;
  font-family: var(--font-serif);
  color: var(--ink-soft);
}

/* ============================================================
   Jump bar — real structural device: letters this list actually has
   ============================================================ */
.jumpbar {
  position: sticky;
  bottom: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem;
  background: var(--ink);
  padding: 0.5rem;
  border-radius: 2px;
  margin-top: 1rem;
}

.jump-btn {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--paper);
  background: none;
  border: 1px solid transparent;
  padding: 0.2rem 0.4rem;
  cursor: pointer;
  border-radius: 2px;
}

.jump-btn:hover, .jump-btn:focus-visible {
  color: var(--amber);
  border-color: var(--amber);
}

/* ============================================================
   Footer
   ============================================================ */
/* ============================================================
   Lightbox (poster viewer)
   ============================================================ */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(27, 31, 42, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
  cursor: zoom-out;
  padding: 3rem 1.5rem;
}

/* [hidden] and .lightbox both have equal CSS specificity (0,1,0), so
   without this, .lightbox's own "display: flex" can win over the
   browser's default "[hidden] { display: none }" depending on source
   order - showing the lightbox full-screen on every page load instead
   of only when triggered. This compound selector (0,2,0) always wins. */
.lightbox[hidden] { display: none; }

/* ============================================================
   Popover (hover info)
   ============================================================ */
.popover {
  position: fixed;
  max-width: 320px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-serif);
  font-size: 0.85rem;
  line-height: 1.45;
  padding: 0.7rem 0.85rem;
  border-radius: 2px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.35);
  z-index: 50;
  pointer-events: none;
}

/* see .lightbox[hidden] above for why this compound selector is needed */
.popover[hidden] { display: none; }

.popover strong { color: var(--amber); }

.lightbox-img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 3px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  cursor: default;
}

.lightbox-close {
  position: fixed;
  top: 1rem;
  right: 1.2rem;
  font-family: var(--font-mono);
  font-size: 1.1rem;
  color: var(--paper);
  background: var(--maroon);
  border: none;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  cursor: pointer;
  z-index: 61;
}

.lightbox-close:hover { background: var(--maroon-lo); }

.site-foot {
  max-width: 960px;
  margin: 2rem auto 3rem;
  padding: 0 1.5rem;
  font-size: 0.78rem;
  color: var(--ink-soft);
  text-align: center;
}

/* respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
