/* =============================================================
   The Tracking Line — VHS-specific styles, layered over styles.css
   ============================================================= */

/* Retro VHS theme — VCR-menu blue + magnetic-tape neon */
[data-theme="vhs"] {
  --bg:      #0b0f2a;
  --bg-alt:  #131a3d;
  --black:   #f5f7ff;
  --text:    #d8def5;
  --dim:     #8a93c7;
  --faint:   #5a6398;
  --muted:   #3a4170;
  --rule:    #232a52;
  --success: #00f0c8;
  --shadow:    0 1px 3px rgba(0,0,0,0.5);
  --shadow-lg: 0 4px 18px rgba(0,0,0,0.6);
}
[data-theme="vhs"] nav.site-nav { background: rgba(11, 15, 42, 0.92); }
[data-theme="vhs"] .hero h1 { text-shadow: 1px 0 #ff00c8, -1px 0 #00f0c8; }
[data-theme="vhs"] .section-body p { color: #aeb6e0; }
[data-theme="vhs"] .num-value { color: #00f0c8; }

/* Shell icons --------------------------------------------- */
.shell-ico { width: 1.05em; height: 1.05em; vertical-align: -0.18em; flex: none; }

/* Shell-type legend --------------------------------------- */
.shell-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 26px;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  background: var(--bg-alt);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  transition: all 0.18s;
}
.legend-item .shell-ico { width: 20px; height: 20px; color: var(--text); }
.legend-item:hover { border-color: var(--dim); transform: translateY(-1px); box-shadow: var(--shadow); }
.legend-item.active { border-color: var(--success); color: var(--black); }
.legend-item.active .shell-ico { color: var(--success); }
.legend-name { color: var(--text); }
.legend-count { color: var(--faint); font-size: 10px; }

/* shell-tag colour variants for the new icon */
.shell-tag.s-unknown { border-color: var(--faint); color: var(--faint); }
.shell-tag { display: inline-flex; align-items: center; gap: 6px; }

/* === Extra fun themes ==================================== */

/* Synthwave — 80s neon outrun: deep purple, magenta + cyan glow */
[data-theme="synthwave"] {
  --bg: #140720; --bg-alt: #1f0d30; --black: #f7f0ff; --text: #e6d2ff;
  --dim: #b48ad6; --faint: #7a5ca0; --muted: #4a3268; --rule: #321f4d;
  --success: #05ffa1;
  --shadow: 0 1px 3px rgba(0,0,0,0.5); --shadow-lg: 0 4px 22px rgba(255,43,214,0.25);
}
[data-theme="synthwave"] nav.site-nav { background: rgba(20,7,32,0.92); }
[data-theme="synthwave"] .hero h1 { text-shadow: 0 0 18px rgba(255,43,214,0.55), 2px 2px 0 #05c3ff; }
[data-theme="synthwave"] .num-value { color: #ff2bd6; }
[data-theme="synthwave"] .section-body p { color: #c9b3e6; }
[data-theme="synthwave"] .shell-tag.s-clamshell { border-color:#05ffa1; color:#05ffa1; }

/* Blockbuster — the rental store: ticket-blue + popcorn-yellow (light) */
[data-theme="blockbuster"] {
  --bg: #f4f7fc; --bg-alt: #ffffff; --black: #0b3a8c; --text: #13233f;
  --dim: #5a6b8c; --faint: #93a3c2; --muted: #c4cfe0; --rule: #e1e8f4;
  --success: #ffb300;
  --shadow: 0 1px 3px rgba(11,58,140,0.08); --shadow-lg: 0 4px 14px rgba(11,58,140,0.14);
}
[data-theme="blockbuster"] nav.site-nav { background: rgba(244,247,252,0.95); border-bottom:2px solid #ffb300; }
[data-theme="blockbuster"] .hero h1 { color:#0b3a8c; }
[data-theme="blockbuster"] .status-dot { background:#ffb300; }
[data-theme="blockbuster"] .section-body strong { color:#0b3a8c; }

/* VHS Nasty — pitch black + blood red, video-nasty horror */
[data-theme="nasty"] {
  --bg: #0a0606; --bg-alt: #140a0a; --black: #f5e6e6; --text: #dcc6c6;
  --dim: #8a6a6a; --faint: #5a3f3f; --muted: #3a2424; --rule: #241414;
  --success: #d11212;
  --shadow: 0 1px 3px rgba(0,0,0,0.6); --shadow-lg: 0 4px 22px rgba(209,18,18,0.3);
}
[data-theme="nasty"] nav.site-nav { background: rgba(10,6,6,0.93); border-bottom:1px solid #3a0d0d; }
[data-theme="nasty"] .hero h1 { color:#fff; text-shadow: 0 0 16px rgba(209,18,18,0.6); }
[data-theme="nasty"] .num-value { color:#d11212; }
[data-theme="nasty"] .section-body p { color:#c2a8a8; }
[data-theme="nasty"] .section-body strong { color:#ff4040; }

/* Hero logo (transparent black line-art emblem) -------------- */
.hero-logo {
  display: block;
  width: 100%;
  max-width: 250px;
  height: auto;
  margin: 0 0 24px;
}
/* The artwork is solid black, so it disappears on dark-background
   themes. Invert it to white there; leave it black on the light themes. */
[data-theme="dark"] .hero-logo,
[data-theme="dracula"] .hero-logo,
[data-theme="vhs"] .hero-logo,
[data-theme="synthwave"] .hero-logo,
[data-theme="nasty"] .hero-logo { filter: invert(1); }

/* Controls bar -------------------------------------------- */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 22px;
  align-items: center;
}
.controls input[type="search"] {
  flex: 1 1 280px;
  min-width: 0;
  font-family: var(--sans);
  font-size: 15px;
  color: var(--text);
  background: var(--bg-alt);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 12px 16px;
  transition: border-color 0.2s;
}
.controls input[type="search"]:focus { outline: none; border-color: var(--dim); }
.controls select {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text);
  background: var(--bg-alt);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 10px 12px;
  cursor: pointer;
}
.controls .own-only {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--dim);
  display: flex; align-items: center; gap: 7px;
  cursor: pointer;
}
.controls .own-only input { accent-color: var(--success); width: 15px; height: 15px; }

.result-bar {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 14px;
}

/* Catalog list -------------------------------------------- */
.vhs-list { max-width: 1000px; }
.vhs-row {
  border-bottom: 1px solid var(--rule);
}
.vhs-row > details > summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 0;
  cursor: pointer;
  transition: padding-left 0.25s;
}
.vhs-row > details > summary::-webkit-details-marker { display: none; }
.vhs-row > details[open] > summary,
.vhs-row > details > summary:hover { padding-left: 10px; }

.r-thumb {
  flex: none;
  width: 40px; height: 56px;
  border-radius: 3px;
  overflow: hidden;
  background: var(--bg);
  border: 1px solid var(--rule);
  display: flex; align-items: center; justify-content: center;
}
.r-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.r-thumb.noimg { background: repeating-linear-gradient(45deg, var(--bg-alt), var(--bg-alt) 4px, var(--bg) 4px, var(--bg) 8px); }
.r-thumb.noimg img { display: none; }

.r-main { flex: 1; min-width: 0; }
.r-title {
  font-size: 16.5px;
  font-weight: 600;
  color: var(--black);
  letter-spacing: -0.2px;
}
.r-title .yr { font-family: var(--mono); font-size: 12px; font-weight: 400; color: var(--dim); margin-left: 9px; letter-spacing: 1px; }
.r-sub {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 1px;
  color: var(--dim);
  margin-top: 4px;
  display: flex; flex-wrap: wrap; gap: 6px 14px;
}
.r-sub .studio { color: var(--text); }

.shell-tag {
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 4px 9px;
  border: 1px solid var(--rule);
  border-radius: 100px;
  color: var(--dim);
  white-space: nowrap;
}
.shell-tag.s-clamshell { border-color: var(--success); color: var(--success); }
.shell-tag.s-big-box   { border-color: #ff8c42; color: #ff8c42; }
.shell-tag.s-oddity    { border-color: #c77dff; color: #c77dff; }

.rarity {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--faint);
  white-space: nowrap;
  min-width: 56px;
  text-align: right;
}
.rarity b { color: var(--black); font-weight: 500; }

/* Own / Want buttons */
.r-actions { display: flex; gap: 6px; }
.tag-btn {
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 6px 11px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: none;
  color: var(--dim);
  cursor: pointer;
  transition: all 0.18s;
}
.tag-btn:hover { border-color: var(--dim); color: var(--black); }
.tag-btn.on.own  { background: var(--success); border-color: var(--success); color: #05231c; }
.tag-btn.on.want { background: #c77dff; border-color: #c77dff; color: #1a0a2e; }

.chev { color: var(--faint); font-size: 18px; transition: transform 0.2s; }
.vhs-row > details[open] .chev { transform: rotate(90deg); }

/* Expanded body */
.r-body { padding: 4px 0 20px 10px; }
.r-detail {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px 28px;
  max-width: 760px;
  margin-bottom: 14px;
}
.r-field .k {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--faint);
  display: block;
  margin-bottom: 3px;
}
.r-field .v { font-size: 14px; color: var(--text); }
.r-notes { font-size: 14px; color: var(--text); line-height: 1.6; max-width: 720px; margin-bottom: 10px; }
.r-sources { font-family: var(--mono); font-size: 11px; color: var(--dim); }
.r-sources a { color: var(--text); border-bottom: 1px solid var(--rule); }
.r-sources a:hover { border-color: var(--black); }
.r-sources .sep { color: var(--faint); margin: 0 8px; }

/* Case-types guide ---------------------------------------- */
.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
  margin-top: 24px;
  max-width: 1100px;
}
.guide-card {
  display: flex;
  flex-direction: column;
  text-align: left;
  background: var(--bg-alt);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  padding: 0;
  color: inherit;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.guide-card:hover { border-color: var(--dim); transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.guide-photo {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  object-position: center;
  background: #0a0a0a;
  border-bottom: 1px solid var(--rule);
  display: block;
}
.guide-ico {
  width: 100%;
  aspect-ratio: 4 / 3;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
  color: var(--dim);
}
.guide-ico .shell-ico { width: 64px; height: 64px; }
.guide-body { padding: 16px 18px 20px; }
.guide-name {
  font-size: 16px; font-weight: 600; color: var(--black);
  letter-spacing: -0.2px;
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
}
.guide-n {
  font-family: var(--mono); font-size: 11px; font-weight: 400;
  color: var(--faint); letter-spacing: 1px;
}
.guide-desc { font-size: 13px; color: var(--dim); line-height: 1.55; margin-top: 8px; }
.guide-credit {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.5px;
  color: var(--faint); margin-top: 22px; max-width: 900px; line-height: 1.6;
}

/* clickable thumbnail affordance */
.r-thumb img { cursor: zoom-in; transition: transform 0.15s; }
.r-thumb:hover img { transform: scale(1.04); }

/* Lightbox ------------------------------------------------ */
.lightbox {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.86);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  padding: 32px;
}
.lightbox[hidden] { display: none; }
.lb-fig { display: flex; flex-direction: column; align-items: center; gap: 14px; max-width: 100%; max-height: 100%; }
.lb-fig img {
  max-width: min(680px, 90vw); max-height: 80vh;
  width: auto; height: auto;
  border-radius: 6px;
  box-shadow: 0 12px 48px rgba(0,0,0,0.6);
  background: #111;
  object-fit: contain;
}
.lb-fig figcaption {
  font-family: var(--mono); font-size: 12px; letter-spacing: 1px;
  color: #ddd; text-align: center; max-width: 90vw; line-height: 1.5;
}
.lb-close {
  position: absolute; top: 18px; right: 22px;
  width: 42px; height: 42px;
  font-size: 30px; line-height: 1;
  color: #fff; background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.25); border-radius: 50%;
  cursor: pointer; transition: background 0.2s;
}
.lb-close:hover { background: rgba(255,255,255,0.22); }

/* Collection ---------------------------------------------- */
.coll-grid { margin-top: 24px; max-width: 900px; }
.coll-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 28px 0 8px; }
/* render the collection action links as proper bordered buttons */
.coll-actions .mono-link {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--bg-alt);
  color: var(--dim);
  padding: 10px 18px;
  line-height: 1;
  transition: all 0.18s;
}
.coll-actions .mono-link:hover {
  color: var(--black);
  border-color: var(--dim);
  background: var(--bg);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.coll-actions .mono-link.danger { color: #ff5470; border-color: rgba(255,84,112,0.4); background: var(--bg-alt); }
.coll-actions .mono-link.danger:hover { color: #fff; border-color: #ff5470; background: #ff5470; box-shadow: var(--shadow-lg); }
.coll-empty { font-size: 14px; color: var(--dim); margin-top: 20px; }
.coll-empty a { color: var(--black); border-bottom: 1px solid var(--rule); }

/* Stats --------------------------------------------------- */
.stats-cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 36px 48px;
  margin-top: 20px;
  max-width: 1100px;
}
.stat-block h3 {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 14px;
}
.stat-list li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 14px;
}
.stat-list .sl-k { color: var(--text); }
.stat-list .sl-v { font-family: var(--mono); font-size: 12px; color: var(--dim); white-space: nowrap; }

.load-more-wrap { margin-top: 28px; }

/* Tablet / small ------------------------------------------ */
@media (max-width: 760px) {
  .hero-logo { max-width: 190px; margin-bottom: 16px; }
  /* controls: search full width, selects in a 2-up grid, no overflow */
  .controls { gap: 10px; }
  .controls input[type="search"] { flex: 1 1 100%; font-size: 16px; } /* 16px = no iOS zoom */
  .controls select { flex: 1 1 calc(50% - 5px); min-width: 0; }
  .controls .own-only { flex: 1 1 100%; padding: 4px 0; }

  /* legend: horizontal scroll strip instead of wrapping into a tall block */
  .shell-legend {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
    margin: 0 -20px 22px;
    padding-left: 20px; padding-right: 20px;
    scrollbar-width: none;
  }
  .shell-legend::-webkit-scrollbar { display: none; }
  .legend-item { flex: 0 0 auto; }

  /* catalog rows reflow */
  .vhs-row > details > summary { flex-wrap: wrap; gap: 8px 12px; padding: 14px 0; }
  .r-main { flex: 1 1 100%; }
  .r-title { font-size: 16px; }
  .shell-tag { order: 2; }
  .rarity { order: 3; min-width: 0; text-align: left; margin-left: auto; }
  .chev { display: none; }
  .r-actions { order: 5; width: 100%; gap: 8px; }
  .r-actions .tag-btn { flex: 1; text-align: center; padding: 10px; }
  .r-detail { grid-template-columns: 1fr 1fr; gap: 10px 18px; }

  .coll-actions { flex-wrap: wrap; gap: 12px; }
  .stats-cols { gap: 28px; }
}

/* Phones -------------------------------------------------- */
@media (max-width: 440px) {
  .controls select { flex: 1 1 100%; }
  .r-detail { grid-template-columns: 1fr; }
  .legend-item { padding: 8px 11px; font-size: 10px; }
}

/* ---- Matrix mode (Konami code easter egg) ---- */
[data-theme="matrix"] {
  --bg: #000000; --bg-alt: #0a0a0a; --black: #00ff41; --text: #00ff41;
  --dim: #00aa33; --faint: #006622; --rule: #006622;
}
[data-theme="matrix"] body { background: #000; color: #00ff41; }
[data-theme="matrix"] * { font-family: 'Courier New', monospace !important; text-shadow: 0 0 4px rgba(0,255,65,0.55); }
[data-theme="matrix"] img, [data-theme="matrix"] canvas { text-shadow: none; }
[data-theme="matrix"] img { filter: hue-rotate(110deg) saturate(2.5) brightness(0.65) contrast(1.4); }
[data-theme="matrix"] nav.site-nav { background: rgba(0,0,0,0.95); border-bottom: 1px solid #006622; }
[data-theme="matrix"] .hero-logo { filter: invert(1) sepia(1) saturate(5) hue-rotate(70deg) brightness(0.9); }
