:root {
  color-scheme: dark;
  --ink: #f8efe1;
  --muted: #c9bfae;
  --soft: rgba(255, 255, 255, 0.72);
  --line: rgba(255, 255, 255, 0.16);
  --panel: rgba(18, 23, 39, 0.78);
  --panel-solid: #161c2f;
  --bg: #080d19;
  --gold: #ddbe83;
  --gold-2: #a8792a;
  --blue: #61b6ff;
  --red: #ed6b61;
  --green: #69d28b;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background: var(--bg);
  overflow-x: clip;
}

body {
  margin: 0;
  position: relative;
  overflow-x: clip;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% -2%, rgba(97, 182, 255, 0.16), transparent 26rem),
    radial-gradient(circle at 85% 4%, rgba(243, 200, 106, 0.14), transparent 24rem),
    linear-gradient(180deg, #0c1223, var(--bg) 40rem);
}

a {
  color: inherit;
}

/* ---------- Header ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px clamp(18px, 4vw, 58px);
  border-bottom: 1px solid var(--line);
  background: rgba(8, 13, 25, 0.78);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  text-decoration: none;
}

.brand-logo {
  display: block;
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  border-radius: 14px;
  filter: drop-shadow(0 10px 24px rgba(243, 200, 106, 0.2));
}

.brand-mark {
  display: none;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(243, 200, 106, 0.7);
  border-radius: 14px;
  color: #241407;
  background: linear-gradient(135deg, #f0d9a6, #c4912f);
  box-shadow: 0 10px 30px rgba(243, 200, 106, 0.22);
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
  line-height: 1.12;
}

.brand strong {
  font-size: 18px;
  letter-spacing: 0.01em;
}

.brand small {
  color: var(--muted);
  font-size: 12px;
}

.topbar-end {
  display: flex;
  align-items: center;
  gap: 18px;
}

.topbar-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.topbar-stats strong {
  color: var(--ink);
  font-weight: 700;
}

.topbar-stats .dot {
  opacity: 0.5;
}

.nav {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.nav a {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 9px 13px;
  color: var(--soft);
  text-decoration: none;
  font-weight: 600;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease;
}

.nav a:hover {
  border-color: rgba(243, 200, 106, 0.42);
  color: var(--gold);
  background: rgba(255, 255, 255, 0.06);
}

main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

/* ---------- Typography ---------- */
.eyebrow {
  margin: 0 0 12px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1,
h2,
h3 {
  font-weight: 800;
  letter-spacing: -0.01em;
}

/* ---------- Intro ---------- */
.intro {
  padding: 56px 0 36px;
  max-width: 720px;
}

.intro h1 {
  margin: 0;
  text-wrap: balance;
  font-size: clamp(34px, 5vw, 54px);
  line-height: 1.02;
  letter-spacing: -0.02em;
}

.intro-text {
  margin: 18px 0 0;
  color: var(--soft);
  font-size: 17px;
  line-height: 1.6;
}

/* ---------- Browse / filters ---------- */
.browse {
  padding-bottom: 56px;
}

.filter-block {
  margin-bottom: 22px;
}

.filter-title {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.filter-block-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 24px;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 16px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.05);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 150ms ease, background 150ms ease, color 150ms ease, border-color 150ms ease;
}

.pill:hover {
  border-color: rgba(221, 190, 131, 0.5);
  transform: translateY(-1px);
}

.pill.is-active {
  color: #211406;
  background: var(--gold);
  border-color: var(--gold);
}

.browse-tools {
  display: flex;
  gap: 10px;
  flex: 1 1 320px;
  max-width: 460px;
  margin-left: auto;
}

.browse-tools #search {
  flex: 1 1 auto;
}

.browse-tools #sortFilter {
  flex: 0 0 auto;
  width: auto;
  min-width: 130px;
}

input,
select {
  min-height: 44px;
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  padding: 0 13px;
  color: var(--ink);
  background: rgba(8, 13, 25, 0.82);
  font: inherit;
}

input::placeholder {
  color: rgba(248, 239, 225, 0.48);
}

input:focus,
select:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(243, 200, 106, 0.28);
  outline-offset: 2px;
}

.result-bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin: 26px 0 16px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  scroll-margin-top: 84px;
}

.result-bar h2 {
  margin: 0;
  font-size: clamp(22px, 3vw, 30px);
  line-height: 1.1;
}

.count {
  white-space: nowrap;
  color: var(--muted);
  font-weight: 600;
}

/* ---------- Guide cards ---------- */
.guide-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.guide-card {
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 22px;
  background: rgba(22, 28, 47, 0.86);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
  transition: transform 200ms ease, border-color 200ms ease, box-shadow 200ms ease;
}

.guide-card:hover {
  transform: translateY(-4px);
  border-color: rgba(243, 200, 106, 0.4);
  box-shadow: 0 26px 60px rgba(0, 0, 0, 0.4);
}

.thumb-link {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  background: #111827;
}

.thumb-link img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: saturate(0.82) contrast(0.96) brightness(0.9);
  transition: transform 220ms ease, filter 220ms ease;
}

.guide-card:hover .thumb-link img {
  transform: scale(1.04);
  filter: saturate(1.05) contrast(1) brightness(1);
}

.thumb-link::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 45%, rgba(8, 13, 25, 0.78));
}

.source-badge {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  color: #fff;
  background: rgba(8, 13, 25, 0.6);
  backdrop-filter: blur(8px);
  font-size: 12px;
  font-weight: 600;
}

.source-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--red);
}

.guide-body {
  padding: 18px;
}

.guide-topline,
.actions,
.tags {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.guide-topline {
  justify-content: space-between;
}

.freshness,
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 10px;
  background: rgba(97, 182, 255, 0.12);
  color: var(--blue);
  font-size: 12px;
  font-weight: 600;
}

.freshness[data-status="Fresh"] {
  color: var(--green);
  background: rgba(105, 210, 139, 0.13);
}

.freshness[data-status="Watch"] {
  color: var(--gold);
  background: rgba(243, 200, 106, 0.13);
}

.freshness[data-status="Older"] {
  color: #ff9b92;
  background: rgba(237, 107, 97, 0.13);
}

.date {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.guide-card h3 {
  margin: 10px 0 6px;
  font-size: 18px;
  line-height: 1.25;
}

.card-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  transition: color 150ms ease;
}

.card-title:hover {
  color: var(--gold);
}

.summary {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.take {
  margin: 10px 0 0;
  color: var(--soft);
  font-size: 14px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.take-label {
  color: var(--gold);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.tags {
  margin: 12px 0;
}

.actions {
  justify-content: space-between;
}

.watch,
.embed-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border-radius: 999px;
  padding: 0 17px;
  font-weight: 700;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, border-color 160ms ease;
}

.watch {
  color: #261606;
  background: linear-gradient(135deg, #f0d9a6, #cc9a46);
  box-shadow: 0 12px 26px rgba(204, 154, 70, 0.2);
}

.watch:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 32px rgba(216, 149, 52, 0.34);
}

.embed-toggle {
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.08);
}

.embed-toggle:hover {
  border-color: rgba(243, 200, 106, 0.5);
  background: rgba(255, 255, 255, 0.12);
}

.embed {
  margin-top: 14px;
  aspect-ratio: 16 / 9;
}

.embed iframe {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 14px;
}

.empty {
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: 22px;
  color: var(--muted);
  background: rgba(22, 28, 47, 0.72);
  text-align: center;
}

/* ---------- Pagination ---------- */
.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 32px;
}

.page-btn {
  min-width: 40px;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.05);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
}

.page-btn:hover:not(:disabled):not(.is-active) {
  border-color: rgba(221, 190, 131, 0.5);
}

.page-btn.is-active {
  color: #211406;
  background: var(--gold);
  border-color: var(--gold);
  cursor: default;
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.page-gap {
  padding: 0 4px;
  color: var(--muted);
}

/* ---------- Footer ---------- */
.footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 28px clamp(18px, 4vw, 58px);
  border-top: 1px solid var(--line);
  color: var(--muted);
  background: rgba(8, 13, 25, 0.78);
  font-size: 14px;
}

.footer span:last-child {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.footer a {
  color: var(--gold);
  text-decoration: none;
  font-weight: 600;
}

.footer a:hover {
  text-decoration: underline;
}

/* ---------- Content pages ---------- */
.content-page {
  max-width: 900px;
  padding: 58px 0;
}

.content-page h1 {
  font-size: clamp(34px, 6vw, 58px);
}

.content-page h2 {
  margin-top: 34px;
}

.content-page p,
.content-page li {
  color: var(--muted);
  line-height: 1.7;
}

.content-page code {
  padding: 2px 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.12);
}

/* ---------- Guide detail page ---------- */
.guide-detail {
  max-width: 860px;
  padding: 32px 0 64px;
}

.loading {
  color: var(--muted);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
  padding: 10px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.05);
  text-decoration: none;
  font-weight: 700;
  transition: transform 150ms ease, background 150ms ease, color 150ms ease, border-color 150ms ease;
}

.back-link:hover {
  color: #211406;
  background: var(--gold);
  border-color: var(--gold);
  transform: translateY(-1px);
}

.guide-article-head h1 {
  margin: 6px 0 0;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.08;
  letter-spacing: -0.01em;
}

.guide-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 14px;
}

.guide-meta .by {
  font-weight: 600;
}

.guide-media {
  margin: 26px 0 18px;
  aspect-ratio: 16 / 9;
  border-radius: 18px;
  overflow: hidden;
  background: #111827;
  box-shadow: var(--shadow);
}

.guide-media iframe,
.guide-media img {
  width: 100%;
  height: 100%;
  border: 0;
  object-fit: cover;
  display: block;
}

.watch-cta {
  margin-bottom: 8px;
}

.guide-content {
  margin-top: 14px;
}

.guide-content section {
  padding: 22px 0;
  border-top: 1px solid var(--line);
}

.guide-content h2 {
  margin: 0 0 10px;
  color: var(--gold);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.guide-content p {
  margin: 0;
  color: var(--soft);
  font-size: 17px;
  line-height: 1.7;
}

.guide-content p + p {
  margin-top: 12px;
}

.guide-article .tags {
  margin: 8px 0 24px;
}

.source-credit {
  margin: 0;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  background: rgba(255, 255, 255, 0.03);
}

.source-credit a {
  color: var(--gold);
  font-weight: 600;
  text-decoration: none;
}

.source-credit a:hover {
  text-decoration: underline;
}

/* ---------- Theme toggle ---------- */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.theme-toggle:hover {
  color: var(--gold);
  border-color: rgba(221, 190, 131, 0.5);
  transform: translateY(-2px);
}

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- Responsive ---------- */
@media (max-width: 1040px) {
  .guide-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .browse-tools {
    margin-left: 0;
    max-width: none;
    width: 100%;
  }
}

@media (max-width: 680px) {
  main {
    width: min(100% - 24px, 1180px);
  }

  .guide-grid {
    grid-template-columns: 1fr;
  }

  /* Compact single-row header */
  .topbar {
    gap: 12px;
    padding: 12px 18px;
  }

  .topbar-stats {
    display: none;
  }

  .topbar-end {
    gap: 8px;
  }

  .brand small {
    display: none;
  }

  .brand strong {
    font-size: 17px;
  }

  /* Tighter intro so the filters and content sit higher */
  .intro {
    padding: 28px 0 22px;
  }

  .intro h1 {
    font-size: clamp(28px, 8vw, 38px);
  }

  .intro-text {
    font-size: 15px;
  }

  /* Filters become single horizontally-scrollable strips instead of many rows */
  .filter-block {
    margin-bottom: 16px;
  }

  .pill-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    scroll-padding-left: 2px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
  }

  .pill-row::-webkit-scrollbar {
    display: none;
  }

  .pill {
    flex: 0 0 auto;
  }
}

/* ---------- Light theme ---------- */
:root[data-theme="light"] {
  color-scheme: light;
  --ink: #1b2330;
  --muted: #586173;
  --soft: rgba(20, 26, 38, 0.74);
  --line: rgba(20, 26, 38, 0.12);
  --panel: rgba(255, 255, 255, 0.82);
  --panel-solid: #ffffff;
  --bg: #e7eaee;
  --gold: #b07c00;
  --shadow: 0 18px 50px rgba(30, 41, 59, 0.14);
}

:root[data-theme="light"] body {
  background: linear-gradient(180deg, #f1f3f6, var(--bg) 34rem);
}

:root[data-theme="light"] .topbar,
:root[data-theme="light"] .footer {
  background: rgba(255, 255, 255, 0.84);
}

:root[data-theme="light"] .brand-logo {
  filter: drop-shadow(0 10px 20px rgba(30, 41, 59, 0.12));
}

:root[data-theme="light"] .theme-toggle,
:root[data-theme="light"] .embed-toggle,
:root[data-theme="light"] .pill:not(.is-active),
:root[data-theme="light"] .page-btn:not(.is-active),
:root[data-theme="light"] .back-link {
  background: rgba(20, 26, 38, 0.05);
  border-color: rgba(20, 26, 38, 0.14);
}

/* Cool-neutral selected state suits the light theme better than warm gold. */
:root[data-theme="light"] .pill.is-active,
:root[data-theme="light"] .page-btn.is-active,
:root[data-theme="light"] .back-link:hover {
  color: #ffffff;
  background: #1f2735;
  border-color: #1f2735;
}

:root[data-theme="light"] .pill:not(.is-active):hover,
:root[data-theme="light"] .page-btn:not(.is-active):hover {
  border-color: rgba(31, 39, 53, 0.4);
}

:root[data-theme="light"] input,
:root[data-theme="light"] select {
  color: var(--ink);
  background: #ffffff;
  border-color: rgba(20, 24, 36, 0.18);
}

:root[data-theme="light"] input::placeholder {
  color: rgba(20, 24, 36, 0.42);
}

:root[data-theme="light"] .guide-card {
  background: #ffffff;
  border-color: rgba(20, 24, 36, 0.1);
}

:root[data-theme="light"] .empty,
:root[data-theme="light"] .source-credit {
  background: rgba(255, 255, 255, 0.72);
}

:root[data-theme="light"] .content-page code {
  background: rgba(20, 24, 36, 0.07);
}
