/* ===========================================================
   TunerPro — shared stylesheet
   One file for the whole site. Sectioned: tokens, reset, layout,
   nav, footer, components (cards/buttons/tables/details/badges/
   forms/lightbox), utilities, responsive.
   =========================================================== */

/* ---------- Tokens ---------- */
:root {
  --bg: #f7f7f5;
  --bg-alt: #ffffff;
  --bg-inset: #efeee9;
  --text: #1a1a1a;
  --text-muted: #55564f;
  --border: #e4e4e0;
  --border-strong: #cfcfc8;
  --accent: #c8102e;
  --accent-dark: #9c0c23;
  --accent-contrast: #ffffff;
  --link: #1a56db;
  --success: #1a7f4e;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 4px 14px rgba(0, 0, 0, 0.05);
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "SFMono-Regular", Consolas,
    "Liberation Mono", Menlo, monospace;
  --content-max: 1080px;
  --header-h: 64px;
}

/* ---------- Dark theme (trial — see toggle line in js/chrome.js) ---------- */
:root[data-theme="dark"] {
  --bg: #17161a;
  --bg-alt: #272329;
  --bg-inset: #211e23;
  --text: #f1efec;
  --text-muted: #a8a5a0;
  --border: #333035;
  --border-strong: #4a454d;
  --accent: #d92f46;
  --accent-dark: #b81f38;
  --accent-text: #ea5a6c;
  --link: #6fa1ff;
  --success: #3fc088;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 20px rgba(0, 0, 0, 0.55);
  color-scheme: dark;
}
:root[data-theme="dark"] a:hover,
:root[data-theme="dark"] .main-nav a[aria-current="page"],
:root[data-theme="dark"] .subnav a[aria-current="page"],
:root[data-theme="dark"] .site-footer nav a:hover,
:root[data-theme="dark"] .form-card__price {
  color: var(--accent-text);
}
:root[data-theme="dark"] .badge--accent {
  background: rgba(226, 57, 79, 0.18);
  color: #ff96a6;
  border-color: rgba(226, 57, 79, 0.4);
}
:root[data-theme="dark"] .badge--success {
  background: rgba(63, 192, 136, 0.18);
  color: #7be0b8;
  border-color: rgba(63, 192, 136, 0.4);
}
:root[data-theme="dark"] .main-nav {
  border: 1px solid var(--border);
}

/* ---------- Reset ---------- */
* {
  box-sizing: border-box;
}
html {
  color-scheme: light;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
img {
  max-width: 100%;
  display: block;
}
a {
  color: var(--link);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
  color: var(--accent);
}
h1, h2, h3, h4 {
  line-height: 1.2;
  margin: 0 0 0.5em;
  font-weight: 700;
}
h1 { font-size: clamp(1.9rem, 1.5rem + 1.5vw, 2.75rem); }
h2 { font-size: clamp(1.4rem, 1.2rem + 0.8vw, 1.9rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }
ul, ol { margin: 0 0 1em; padding-left: 1.3em; }
code, kbd, .mono {
  font-family: var(--font-mono);
  font-size: 0.92em;
}

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 0.6em 1em;
  z-index: 200;
}
.skip-link:focus {
  left: 0.5em;
  top: 0.5em;
}

/* ---------- Header / Nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  height: var(--header-h);
}
.site-header__inner {
  max-width: var(--content-max);
  margin: 0 auto;
  height: 100%;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.logo {
  display: flex;
  align-items: center;
}
.logo:hover {
  text-decoration: none;
}
.logo img {
  display: block;
  height: 44px;
  width: auto;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.main-nav a {
  color: var(--text);
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
}
.main-nav a:hover {
  background: var(--bg-inset);
  text-decoration: none;
  color: var(--text);
}
.main-nav a[aria-current="page"] {
  color: var(--accent);
}
.main-nav a.nav-cta {
  background: var(--accent);
  color: #fff;
}
.main-nav a.nav-cta:hover {
  background: var(--accent-dark);
  color: #fff;
}

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.nav-toggle span,
.nav-toggle span::before,
.nav-toggle span::after {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text);
  position: relative;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.nav-toggle span::before,
.nav-toggle span::after {
  content: "";
  position: absolute;
}
.nav-toggle span::before { top: -6px; }
.nav-toggle span::after { top: 6px; }

/* ---------- Downloads sub-nav ---------- */
.subnav {
  background: var(--bg-inset);
  border-bottom: 1px solid var(--border);
}
.subnav__inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0.6rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.75rem;
  align-items: center;
  font-size: 0.88rem;
}
.subnav__label {
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.72rem;
  margin-right: 0.25rem;
}
.subnav a {
  color: var(--text);
  font-weight: 600;
}
.subnav a[aria-current="page"] {
  color: var(--accent);
}

/* ---------- Layout ---------- */
main {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
}
.hero {
  padding: 3rem 0 2.5rem;
  text-align: center;
}
.hero__banner {
  display: block;
  margin: 0 auto 1.5rem;
  width: 100%;
  max-width: 480px;
  height: auto;
}
.hero.hero--left {
  text-align: left;
}
.hero p.lede {
  font-size: 1.15rem;
  color: var(--text-muted);
  max-width: 640px;
  margin: 0 auto 1.5rem;
}
.hero--left p.lede {
  margin: 0 0 1.5rem;
}
.hero__ctas {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}
.hero--left .hero__ctas {
  justify-content: flex-start;
}

section {
  margin: 3rem 0;
}
#overview {
  scroll-margin-top: var(--header-h);
}
section > h2 {
  margin-bottom: 0.35em;
}
.section-intro {
  color: var(--text-muted);
  max-width: 720px;
  margin-bottom: 1.5rem;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.7em 1.3em;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.98rem;
  border: 1px solid transparent;
  cursor: pointer;
  background: var(--bg-alt);
}
.btn:hover {
  text-decoration: none;
}
.btn--primary {
  background: var(--accent);
  color: #fff;
}
.btn--primary:hover {
  background: var(--accent-dark);
  color: #fff;
}
.btn--secondary {
  background: var(--bg-alt);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn--secondary:hover {
  background: var(--bg-inset);
  color: var(--text);
}
.btn--ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}
.btn--ghost:hover {
  background: var(--bg-inset);
  color: var(--text);
}
.btn--block {
  width: 100%;
  justify-content: center;
}
.btn--sm {
  padding: 0.45em 0.9em;
  font-size: 0.85rem;
}

/* ---------- Cards / grids ---------- */
.grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

.card {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}
.card h3 {
  margin-bottom: 0.4em;
}
.card--callout {
  background: var(--bg-inset);
  border: 1px solid var(--border);
}
.card--edition {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.card--edition .price {
  font-size: 1.6rem;
  font-weight: 800;
}
.card--edition .price small {
  font-size: 0.55em;
  font-weight: 600;
  color: var(--text-muted);
}
.card__meta {
  color: var(--text-muted);
  font-size: 0.88rem;
}
.card__icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--bg-inset);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  margin-bottom: 0.75rem;
}
.card__shot {
  display: block;
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.card__shot-link {
  display: block;
  margin-bottom: 0.9rem;
}
.card__shot-link:hover .card__shot {
  opacity: 0.85;
}

/* ---------- Badges / pills ---------- */
.badge {
  display: inline-block;
  padding: 0.2em 0.65em;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--bg-inset);
  color: var(--text-muted);
  border: 1px solid var(--border-strong);
}
.badge--accent {
  background: rgba(200, 16, 46, 0.09);
  color: var(--accent-dark);
  border-color: rgba(200, 16, 46, 0.25);
}
.badge--success {
  background: rgba(26, 127, 78, 0.1);
  color: var(--success);
  border-color: rgba(26, 127, 78, 0.25);
}
.badge--mono {
  font-family: var(--font-mono);
}

/* ---------- Tables ---------- */
.table-wrap {
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
caption {
  text-align: left;
  font-weight: 700;
  margin-bottom: 0.5rem;
}
th, td {
  text-align: left;
  padding: 0.6em 0.75em;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
thead th {
  color: var(--text-muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 2px solid var(--border-strong);
}
tbody tr:hover {
  background: var(--bg-inset);
}
.data-mono {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

/* ---------- Details / collapsibles ---------- */
details {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.25rem 0;
  margin-bottom: 0.75rem;
}
details > summary {
  cursor: pointer;
  list-style: none;
  padding: 0.85rem 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
details > summary::-webkit-details-marker {
  display: none;
}
details > summary::after {
  content: "+";
  font-weight: 400;
  color: var(--text-muted);
  transition: transform 0.15s ease;
}
details[open] > summary::after {
  content: "\2212";
}
details .details-body {
  padding: 0 1.1rem 1.1rem;
}
details[open] > summary {
  border-bottom: 1px solid var(--border);
}

/* ---------- Compact per-row notes toggle (Notes cell in archive tables) ---------- */
details.notes-toggle {
  background: none;
  border: 0;
  border-radius: 0;
  padding: 0;
  margin-bottom: 0;
  font-size: inherit;
}
details.notes-toggle > summary {
  display: inline;
  list-style: none;
  cursor: pointer;
  padding: 0;
  font-weight: inherit;
}
details.notes-toggle > summary::-webkit-details-marker {
  display: none;
}
details.notes-toggle > summary::after {
  content: " \25B8";
  display: inline-block;
  margin-left: 0.35em;
  font-size: 0.85em;
  color: var(--text-muted);
  transition: transform 0.15s ease;
}
details.notes-toggle[open] > summary::after {
  transform: rotate(90deg);
}
details.notes-toggle[open] > summary {
  border-bottom: 0;
}
details.notes-toggle .details-body {
  padding: 0.45em 0 0;
  margin: 0;
}
details.notes-toggle .details-body ul {
  margin: 0;
  padding-left: 1.15em;
}
details.notes-toggle .details-body li {
  margin-bottom: 0.3em;
  font-size: 0.95em;
}
details.notes-toggle .details-body li:last-child {
  margin-bottom: 0;
}

/* ---------- Sticky jump-nav (definitions page) ---------- */
.jumpnav {
  position: sticky;
  top: var(--header-h);
  z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 0;
  margin: 0 0 2rem;
}
.jumpnav__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  max-height: 4.6em;
  overflow-y: auto;
}
.chip {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.35em 0.75em;
  border-radius: 999px;
  background: var(--bg-alt);
  border: 1px solid var(--border-strong);
  color: var(--text);
}
.chip:hover {
  background: var(--bg-inset);
  text-decoration: none;
}

/* ---------- Filter bar ---------- */
.filter-bar {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.filter-bar input[type="search"] {
  flex: 1 1 320px;
  padding: 0.7em 1em;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  background: var(--bg-alt);
}
.filter-bar input[type="search"]:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.filter-count {
  color: var(--text-muted);
  font-size: 0.88rem;
  white-space: nowrap;
}

/* ---------- Forms (registration/donation) ---------- */
.form-card {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow);
}
.form-card + .form-card {
  margin-top: 1.5rem;
}
.form-card__price {
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 0.25rem;
}

/* ---------- Callouts ---------- */
.callout {
  border-left: 4px solid var(--accent);
  background: var(--bg-inset);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1.1rem 1.4rem;
  margin: 1.5rem 0;
}
.callout--warn {
  border-left-color: #b06a00;
}
.callout p:last-child {
  margin-bottom: 0;
}

/* ---------- Screenshot gallery / lightbox ---------- */
.shot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}
.shot-grid a {
  display: block;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-alt);
}
.shot-grid img {
  width: 100%;
  height: 140px;
  object-fit: cover;
}
.shot-grid figcaption,
.shot-grid .cap {
  font-size: 0.82rem;
  padding: 0.5em 0.7em;
  color: var(--text-muted);
}

.lightbox {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 10, 0.82);
  z-index: 200;
  padding: 2rem;
}
.lightbox:target {
  display: flex;
}
.lightbox__backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.lightbox img {
  position: relative;
  z-index: 1;
  max-height: 88vh;
  border-radius: var(--radius-sm);
}
.lightbox__close {
  position: absolute;
  top: 1.25rem;
  right: 1.5rem;
  color: #fff;
  font-size: 1.75rem;
  line-height: 1;
  z-index: 2;
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
  margin-top: 4rem;
}
.site-footer__inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 2.5rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  justify-content: space-between;
}
.site-footer nav {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.site-footer nav a {
  color: var(--text-muted);
  font-size: 0.92rem;
}
.site-footer nav a:hover {
  color: var(--accent);
}
.site-footer__col h4 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}
.site-footer__bottom {
  border-top: 1px solid var(--border);
  text-align: center;
  padding: 1.25rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ---------- Utilities ---------- */
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.stack { display: flex; flex-direction: column; gap: 0.5rem; }
.row { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: center; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.placeholder-photo {
  background: repeating-linear-gradient(
    45deg,
    var(--bg-inset),
    var(--bg-inset) 10px,
    var(--bg) 10px,
    var(--bg) 20px
  );
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  min-height: 220px;
  text-align: center;
  padding: 1rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 700px) {
  .nav-toggle {
    display: inline-flex;
  }
  .main-nav {
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    background: var(--bg-alt);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: stretch;
    padding: 0.5rem;
    display: none;
    box-shadow: var(--shadow);
  }
  .main-nav.is-open {
    display: flex;
  }
  .main-nav a {
    padding: 0.75rem 0.9rem;
  }

  .table-wrap table.stack-mobile,
  table.stack-mobile {
    border: 0;
  }
  table.stack-mobile thead {
    display: none;
  }
  table.stack-mobile tr {
    display: block;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 0.75rem;
    padding: 0.5rem 0.75rem;
  }
  table.stack-mobile td {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    border-bottom: 1px dashed var(--border);
    padding: 0.5em 0;
    text-align: right;
  }
  table.stack-mobile td:last-child {
    border-bottom: 0;
  }
  table.stack-mobile td::before {
    content: attr(data-label);
    font-weight: 700;
    color: var(--text-muted);
    text-align: left;
  }
  table.stack-mobile td:has(details.notes-toggle) {
    display: block;
    text-align: left;
  }
  table.stack-mobile td:has(details.notes-toggle)::before {
    display: block;
    margin-bottom: 0.25em;
  }
}
