/* ============================================================================
   Speaker Ranking — editorial theme
   Self-contained, lightweight (no Bootstrap/jQuery/webfonts). Palette mirrors
   cardgen.py so on-page UI and generated share cards read as one system.
   ========================================================================== */

:root {
  --ink: #1a2230;
  --ink-soft: #33404f;
  --muted: #636e7c;
  --accent: #0b69d4;
  --accent-dk: #094e9e;
  --accent-soft: #eaf2fc;
  --bg: #ffffff;
  --panel: #f4f6f9;
  --panel-2: #eef1f5;
  --border: #dfe4ea;
  --border-strong: #cbd3dc;

  --pos: #1a7f42;
  --pos-bg: #eaf7ef;
  --neg: #c0392b;
  --neg-bg: #fdeeec;
  --note: #a06a00;
  --note-bg: #fbf3e2;
  --setup: #0b69d4;
  --setup-bg: #eaf2fc;

  --maxw: 880px;
  --nav-h: 64px;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 30, 54, .06), 0 6px 20px rgba(16, 30, 54, .06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
          Arial, "Noto Sans", sans-serif;
}

/* ---- Reset / base -------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dk); text-decoration: underline; }
hr { border: 0; border-top: 1px solid var(--border); margin: 2rem 0; }
code, pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .9em;
}
code { background: var(--panel); padding: .12em .4em; border-radius: 5px; }
pre { background: var(--panel); padding: 1rem; border-radius: var(--radius); overflow-x: auto; }
:target { scroll-margin-top: calc(var(--nav-h) + 16px); }

/* ---- Layout -------------------------------------------------------------- */
.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
main { display: block; min-height: 60vh; }

/* ---- Navbar -------------------------------------------------------------- */
.site-nav {
  position: sticky; top: 0; z-index: 1000;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--border);
}
.site-nav__inner {
  max-width: 1180px; margin: 0 auto; padding: 0 20px;
  height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.site-nav__brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 800; font-size: 20px; color: var(--ink); letter-spacing: -.01em; }
.site-nav__brand:hover { text-decoration: none; color: var(--ink); }
.site-nav__brand img { height: 34px; width: auto; display: block; }
/* Inline SVG logo mark: recolors itself for light/dark via theme tokens. */
.site-nav__mark { display: block; color: var(--ink); flex: none; }
.site-nav__mark-dot { fill: var(--accent); }
.site-nav__brand .mark-2 { color: var(--accent); }

.nav-toggle {
  display: none; background: none; border: 0; cursor: pointer; padding: 8px;
  color: var(--ink);
}
.nav-toggle svg { display: block; }

.nav-menu { display: flex; align-items: center; gap: 4px; list-style: none; margin: 0; padding: 0; }
.nav-item { position: relative; }
.nav-link {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 9px 12px; border-radius: 8px;
  color: var(--ink-soft); font-size: 15.5px; font-weight: 600;
  background: none; border: 0; cursor: pointer; font-family: inherit;
  white-space: nowrap;
}
.nav-link:hover { background: var(--panel); color: var(--ink); text-decoration: none; }
.nav-item.has-dropdown > .nav-link::after {
  content: ""; width: 6px; height: 6px; margin-left: 2px;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-1px); opacity: .6;
}
.dropdown {
  position: absolute; right: 0; top: calc(100% + 6px);
  min-width: 300px; max-width: 360px;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 8px;
  list-style: none; margin: 0;
  max-height: 74vh; overflow-y: auto;
  display: none;
}
.nav-item.open > .dropdown { display: block; }
@media (hover: hover) and (min-width: 1000px) {
  .nav-item.has-dropdown:hover > .dropdown { display: block; }
}
.dropdown a {
  display: block; padding: 8px 12px; border-radius: 7px;
  color: var(--ink-soft); font-size: 14.5px; line-height: 1.35;
}
.dropdown a:hover { background: var(--accent-soft); color: var(--accent-dk); text-decoration: none; }
.dropdown-header {
  padding: 9px 12px 4px; margin-top: 4px; border-top: 1px solid var(--border);
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted);
}
.dropdown-header:first-child { margin-top: 0; border-top: 0; padding-top: 4px; }

/* ---- Breadcrumbs --------------------------------------------------------- */
.breadcrumbs { font-size: 14px; color: var(--muted); padding: 18px 0 0; }
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; }
.breadcrumbs li { display: inline-flex; align-items: center; gap: 6px; }
.breadcrumbs li + li::before { content: "\203A"; color: var(--border-strong); }
.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--accent); }
.breadcrumbs [aria-current="page"] { color: var(--ink-soft); font-weight: 600; }

/* ---- Page hero ----------------------------------------------------------- */
.page-hero { padding: 8px 0 22px; border-bottom: 1px solid var(--border); margin-bottom: 30px; }
.page-hero h1 {
  font-size: clamp(30px, 5vw, 46px); line-height: 1.12; letter-spacing: -.02em;
  font-weight: 800; margin: 12px 0 0; color: var(--ink);
}
.page-hero .subtitle { color: var(--muted); font-size: 19px; margin: 12px 0 0; }
.page-hero .hero-meta { margin: 14px 0 0; font-size: 14.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 8px 14px; }
.page-hero .hero-meta strong { color: var(--ink-soft); }

/* ---- Content typography -------------------------------------------------- */
.content { padding-bottom: 64px; }
.content h2 { font-size: 27px; line-height: 1.22; font-weight: 800; letter-spacing: -.01em; margin: 2.4rem 0 .8rem; color: var(--ink); }
.content h3 { font-size: 21px; font-weight: 700; margin: 2rem 0 .6rem; color: var(--ink); }
.content h4 { font-size: 18px; font-weight: 700; margin: 1.6rem 0 .5rem; }
.content p { margin: 0 0 1.1rem; }
.content ul, .content ol { margin: 0 0 1.1rem; padding-left: 1.4rem; }
.content li { margin: .3rem 0; }
.content blockquote {
  margin: 1.4rem 0; padding: .4rem 1.1rem; border-left: 4px solid var(--accent);
  background: var(--accent-soft); color: var(--ink-soft); border-radius: 0 8px 8px 0;
}
.content img { border-radius: var(--radius); }

/* ---- Home-page featured picks -------------------------------------------- */
.home-picks {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px; margin: 4px 0 8px;
}
.home-pick {
  display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; color: var(--ink); box-shadow: var(--shadow);
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.home-pick:hover {
  border-color: var(--accent); transform: translateY(-3px);
  box-shadow: 0 10px 26px rgba(16, 30, 54, .12); text-decoration: none; color: var(--ink);
}
.home-pick:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.home-pick__media { display: block; background: #fff; aspect-ratio: 16 / 10; }
.home-pick__media img { width: 100%; height: 100%; object-fit: contain; padding: 16px; }
.home-pick__body { display: flex; flex-direction: column; gap: 3px; padding: 13px 15px 15px; border-top: 1px solid var(--border); }
.home-pick__eyebrow { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--accent); }
.home-pick__name { font-size: 16px; font-weight: 700; line-height: 1.25; color: var(--ink); }
.home-pick__price { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.home-pick__cta { margin-top: 7px; font-size: 13px; font-weight: 600; color: var(--accent); }

/* ---- Ranked speaker heading (styled as a card lead) ---------------------- */
.content h2.rank-heading {
  font-size: 20px; line-height: 1.3;
  margin-top: 3rem; padding: 22px 0 4px 18px;
  border-top: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  scroll-margin-top: calc(var(--nav-h) + 16px);
  display: flex; align-items: center; gap: 14px;
}
.content h2.rank-heading a { color: var(--ink); }
.content h2.rank-heading a:hover { color: var(--accent); }
.rank-heading-text { flex: 1 1 auto; min-width: 0; }
.rank-thumb {
  flex: none; width: 56px; height: 56px; object-fit: cover;
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
}

/* ---- Spec table ---------------------------------------------------------- */
.spec-table {
  width: 100%; border-collapse: collapse; margin: 0 0 1.4rem;
  font-size: 15.5px; border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden;
}
.spec-table tr:nth-child(even) { background: var(--panel); }
.spec-table th, .spec-table td { text-align: left; padding: 10px 14px; vertical-align: top; border-bottom: 1px solid var(--border); }
.spec-table tr:last-child th, .spec-table tr:last-child td { border-bottom: 0; }
.spec-table th { color: var(--muted); font-weight: 600; width: 38%; white-space: nowrap; }
.spec-table td { color: var(--ink-soft); }

/* ---- Ranking comparison table (sort / filter / compare) ----------------- */
.rank-tools { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 0 0 16px; }
.rank-search {
  flex: 1 1 220px; min-width: 180px; padding: 10px 14px; font: inherit; font-size: 16px;
  color: var(--ink); background: var(--bg);
  border: 1px solid var(--border-strong); border-radius: 10px;
}
.rank-search:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.rank-compare-open {
  padding: 10px 16px; font: inherit; font-weight: 700; font-size: 15px; cursor: pointer;
  color: #fff; background: var(--accent); border: 0; border-radius: 10px;
}
.rank-compare-open[disabled] { background: var(--border-strong); color: var(--muted); cursor: not-allowed; }

.rank-table-wrap { overflow-x: auto; margin: 0 0 1.6rem; -webkit-overflow-scrolling: touch; }
.rank-compare {
  width: 100%; border-collapse: collapse; font-size: 15px;
  border: 1px solid var(--border); border-radius: var(--radius);
}
.rank-compare thead th {
  background: var(--panel-2); text-align: left; white-space: nowrap;
  border-bottom: 2px solid var(--border-strong); padding: 0;
}
.rank-compare thead th button {
  width: 100%; text-align: left; font: inherit; font-weight: 700; font-size: 13px;
  color: var(--ink-soft); background: none; border: 0; cursor: pointer;
  padding: 11px 14px; text-transform: uppercase; letter-spacing: .02em; white-space: nowrap;
}
.rank-compare thead th button:hover { color: var(--accent); }
.rank-compare thead th[data-sort] button::after { content: " ↕"; opacity: .45; font-size: 11px; }
.rank-compare thead th[aria-sort="ascending"] button::after { content: " ▲"; opacity: 1; color: var(--accent); }
.rank-compare thead th[aria-sort="descending"] button::after { content: " ▼"; opacity: 1; color: var(--accent); }
.rank-compare th.col-pick, .rank-compare td.col-pick { width: 34px; padding: 0; text-align: center; }
.rank-compare tbody td {
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  vertical-align: middle; white-space: nowrap; color: var(--ink-soft);
}
.rank-compare tbody tr:nth-child(even) { background: var(--panel); }
.rank-compare tbody tr:hover { background: var(--accent-soft); }
.rank-compare .col-rank { width: 46px; color: var(--muted); font-variant-numeric: tabular-nums; }
.rank-compare .col-name { min-width: 165px; white-space: normal; font-weight: 600; }
.rank-compare .col-name a { color: var(--ink); }
.rank-compare .col-name a:hover { color: var(--accent); }
.rank-compare .col-price { font-variant-numeric: tabular-nums; }
.rank-pick { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; margin: 0; }

/* Compare-2-3 panel */
.rank-compare-panel { margin: 0 0 1.8rem; border: 1px solid var(--accent); border-radius: var(--radius); overflow: hidden; }
.rank-compare-panel__head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; background: var(--accent-soft);
}
.rank-compare-panel__head h3 { margin: 0; font-size: 17px; }
.rank-compare-close { font-size: 24px; line-height: 1; background: none; border: 0; cursor: pointer; color: var(--muted); padding: 2px 8px; }
.rank-compare-close:hover { color: var(--neg); }
.compare-grid th, .compare-grid td { white-space: normal; min-width: 140px; vertical-align: top; }
.compare-grid thead th { color: var(--ink); font-weight: 700; }
.compare-grid thead th a { color: var(--accent); }

/* Detailed per-speaker sections collapse into accordions (via compare.js) */
.rank-detail { border-top: 1px solid var(--border); }
.rank-detail + .rank-detail { border-top: 0; }
.rank-detail > summary { list-style: none; cursor: pointer; display: block; }
.rank-detail > summary::-webkit-details-marker { display: none; }
.rank-detail > summary h2.rank-heading {
  margin: 0; padding: 18px 42px 18px 18px; border-top: 0; position: relative;
}
.rank-detail > summary:hover h2.rank-heading { background: var(--panel); }
.rank-detail > summary h2.rank-heading::after {
  content: ""; position: absolute; right: 16px; top: 50%; width: 9px; height: 9px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: translateY(-65%) rotate(45deg); transition: transform .15s ease;
}
.rank-detail[open] > summary h2.rank-heading::after { transform: translateY(-35%) rotate(225deg); }
.rank-detail[open] { padding-bottom: 14px; }

/* Auto-generated "Related rankings" cross-links (replaces hand-written links) */
.related-rankings { margin: 0 0 30px; }
.related-rankings__title {
  font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); margin: 0 0 10px;
}
.related-links + .related-rankings__title { margin-top: 18px; }
.related-links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 10px; }
.related-links li { margin: 0; }
.related-links a {
  display: inline-block; padding: 7px 13px; border-radius: 999px;
  font-size: 14.5px; font-weight: 600; color: var(--ink-soft);
  background: var(--panel); border: 1px solid var(--border);
}
.related-links a:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); text-decoration: none; }

/* ---- Callouts ------------------------------------------------------------ */
.callout {
  margin: 0 0 .7rem; padding: 12px 16px; border-radius: 10px;
  border-left: 4px solid var(--border-strong); background: var(--panel); font-size: 16px;
}
.callout > strong:first-child { font-weight: 700; }
.callout-pos { background: var(--pos-bg); border-left-color: var(--pos); }
.callout-pos > strong:first-child { color: var(--pos); }
.callout-neg { background: var(--neg-bg); border-left-color: var(--neg); }
.callout-neg > strong:first-child { color: var(--neg); }
.callout-note { background: var(--note-bg); border-left-color: var(--note); }
.callout-note > strong:first-child { color: var(--note); }
.callout-setup { background: var(--setup-bg); border-left-color: var(--setup); }
.callout-setup > strong:first-child { color: var(--setup); }

/* ---- Speaker images ------------------------------------------------------ */
.speaker-hero {
  display: block; width: 100%; height: auto; margin: 8px 0 24px;
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.speaker-thumb-link { display: block; max-width: 520px; margin: 6px 0 18px; }
.speaker-thumb {
  display: block; width: 100%; height: auto;
  border: 1px solid var(--border); border-radius: 10px;
}
.speaker-thumb-link:hover .speaker-thumb { border-color: var(--accent); }

/* Real Amazon product photos (usually on a white background) */
.product-photo {
  display: block; width: auto; max-width: 340px; height: auto;
  margin: 8px 0 24px; padding: 18px; background: #fff;
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  object-fit: contain;
}
.product-photo-thumb { max-width: 190px; margin: 6px 0 18px; padding: 12px; box-shadow: none; }
.speaker-thumb-link:hover .product-photo { border-color: var(--accent); }

/* ---- Footer -------------------------------------------------------------- */
.site-footer { background: var(--panel); border-top: 1px solid var(--border); color: var(--muted); font-size: 15px; }
.site-footer__inner { max-width: var(--maxw); margin: 0 auto; padding: 34px 20px; text-align: center; }
.site-footer a { color: var(--ink-soft); }
.site-footer .social { display: inline-flex; gap: 10px; margin-bottom: 12px; }
.site-footer .social a {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%;
  background: #fff; border: 1px solid var(--border); color: var(--ink-soft);
}
.site-footer .social a:hover { border-color: var(--accent); color: var(--accent); }
.site-footer .disclosure { font-size: 13px; margin-top: 10px; opacity: .9; }

/* ---- Utility ------------------------------------------------------------- */
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---- Responsive nav ------------------------------------------------------ */
@media (max-width: 999px) {
  .nav-toggle { display: inline-flex; }
  .nav-menu {
    position: fixed; inset: var(--nav-h) 0 auto 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: #fff; border-bottom: 1px solid var(--border);
    padding: 8px; max-height: calc(100vh - var(--nav-h)); overflow-y: auto;
    box-shadow: var(--shadow);
    display: none;
  }
  .nav-menu.open { display: flex; }
  .nav-item { position: static; }
  .nav-link { width: 100%; justify-content: space-between; font-size: 16px; padding: 12px 14px; }
  .dropdown {
    position: static; display: none; min-width: 0; max-width: none;
    border: 0; box-shadow: none; padding: 0 0 6px 10px; max-height: none;
  }
  .nav-item.open > .dropdown { display: block; }
}

@media (max-width: 600px) {
  body { font-size: 17px; }
  .spec-table th { width: 46%; white-space: normal; }
}

/* ---- Dark mode (auto, follows the OS/browser preference) ----------------- */
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e7ebf1;
    --ink-soft: #c3ccd8;
    --muted: #8a95a3;
    --accent: #5aa2f2;
    --accent-dk: #86bcf7;
    --accent-soft: #16273c;
    --bg: #0f141b;
    --panel: #171e27;
    --panel-2: #1e2732;
    --border: #29323f;
    --border-strong: #3a4757;

    --pos: #5cc482;  --pos-bg: #12251b;
    --neg: #f0776a;  --neg-bg: #2a1614;
    --note: #dca94b; --note-bg: #241d10;
    --setup: #5aa2f2; --setup-bg: #16273c;

    --shadow: 0 1px 2px rgba(0, 0, 0, .45), 0 6px 20px rgba(0, 0, 0, .45);
  }
  /* A few components use literal #fff and need explicit dark values. */
  .site-nav { background: rgba(15, 20, 27, .9); }
  .dropdown { background: var(--panel); }
  .site-footer .social a { background: var(--panel); }
  /* Generated cards and Amazon photos are baked on white; keep a light mat so
     product shots stay readable rather than glaring against the dark page. */
  .product-photo { background: #eef1f5; }
}
