:root {
  --bg: #f6f1ea;
  --surface: #fffdf9;
  --surface-alt: #ede4d8;
  --ink: #1a111b;
  --muted: #5e4f5f;
  --accent: #9e1b32;
  --accent-soft: #f5dde2;
  --gold: #b88d3a;
  --border: #ddd0c2;
  --shadow: 0 10px 28px rgba(26, 17, 27, 0.08);
}

[data-theme="dark"] {
  --bg: #120d13;
  --surface: #1d151f;
  --surface-alt: #281d2a;
  --ink: #f2eae0;
  --muted: #b9a9b9;
  --accent: #e0586e;
  --accent-soft: rgba(224, 88, 110, 0.16);
  --gold: #d8ab54;
  --border: #3a2b3d;
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body.broadcom-guide {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.sr-only,
.skip-link {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link:focus {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  width: auto;
  height: auto;
  padding: 0.5rem 0.9rem;
  background: var(--accent);
  color: #fff;
  border-radius: 6px;
  z-index: 100;
}

.site-bar {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.site-bar__inner,
main,
.site-footer {
  width: min(1240px, calc(100% - 2rem));
  margin-inline: auto;
}

.site-bar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.site-bar__nav {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.site-bar__nav a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
}

.site-bar__nav a:hover {
  color: var(--accent);
}

.pill-btn,
.icon-btn,
.filter-btn,
.compare-launch,
.card-btn,
.variant-chip,
.variant-tab {
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  border-radius: 999px;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.pill-btn,
.filter-btn,
.compare-launch {
  padding: 0.42rem 0.9rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.pill-btn:hover,
.filter-btn:hover,
.compare-launch:not(:disabled):hover,
.icon-btn:hover,
.card-btn:hover,
.variant-chip:hover,
.variant-tab:hover {
  border-color: var(--accent);
}

.filter-btn.is-active,
.pill-btn.is-pinned,
.card-btn--primary,
.card-btn.is-pinned,
.variant-chip.is-active,
.variant-tab.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.compare-launch:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

/* Hero */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 1fr);
  gap: 2rem;
  padding: 2.2rem 0 1.8rem;
  border-bottom: 1px solid var(--border);
  align-items: start;
}

.eyebrow {
  margin: 0 0 0.45rem;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.1rem, 4.4vw, 3.3rem);
  line-height: 1.08;
}

.hero h1 span {
  color: var(--accent);
}

.hero__lead {
  margin: 1rem 0 1.4rem;
  font-size: 1.06rem;
  color: var(--muted);
  max-width: 62ch;
}

.variant-legend {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem 1.15rem;
  box-shadow: var(--shadow);
}

.variant-legend h2 {
  margin: 0;
  font-size: 1rem;
}

.legend-sub {
  margin: 0.25rem 0 0.7rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.legend-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem 0.9rem;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.88rem;
}

.legend-grid li {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.badge {
  display: inline-block;
  align-self: flex-start;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.78rem;
}

.hero__anchors {
  display: grid;
  grid-template-columns: 1.25fr 0.95fr;
  gap: 0.85rem;
}

.anchor-card {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.anchor-card img {
  display: block;
  width: 100%;
  height: auto;
  background: #eee;
}

.anchor-card figcaption {
  padding: 0.65rem 0.8rem;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.45;
}

/* Sticky Controls */
.controls {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 93%, transparent);
  backdrop-filter: blur(8px);
  padding: 0.9rem 0 0.7rem;
  border-bottom: 1px solid var(--border);
}

.controls__row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

.search-box {
  flex: 1 1 240px;
}

.search-box input {
  width: 100%;
  padding: 0.52rem 0.95rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.chapter-nav {
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
  padding: 0.65rem 0 0.25rem;
}

.chapter-pill {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.32rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  font-size: 0.83rem;
  font-weight: 600;
}

.chapter-pill strong {
  color: var(--accent);
}

.chapter-pill:hover {
  border-color: var(--accent);
}

.status-line {
  margin: 0.35rem 0 0;
  font-size: 0.86rem;
  color: var(--muted);
}

/* Chapters & Grid */
.chapter-section {
  padding: 2.2rem 0 1.4rem;
  border-bottom: 1px solid var(--border);
  scroll-margin-top: 8.5rem;
}

.chapter-head {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(260px, 1.15fr);
  gap: 1.5rem;
  margin-bottom: 1.4rem;
  align-items: start;
}

.chapter-head__num {
  margin: 0;
  color: var(--accent);
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.chapter-head h2 {
  margin: 0.2rem 0 0.3rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.5rem, 2.8vw, 2.1rem);
  line-height: 1.15;
}

.chapter-head__sub {
  margin: 0;
  color: var(--gold);
  font-size: 0.96rem;
  font-weight: 600;
}

.chapter-head__intro {
  margin: 0 0 0.75rem;
  color: var(--muted);
}

.chapter-head__goal {
  margin: 0;
  font-size: 0.92rem;
  padding: 0.65rem 0.9rem;
  border-left: 3px solid var(--gold);
  background: var(--surface);
  border-radius: 0 8px 8px 0;
  color: var(--muted);
}

.chapter-head__goal strong {
  display: block;
  color: var(--ink);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.15rem;
}

.style-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.15rem;
}

.style-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.style-card__media {
  position: relative;
  aspect-ratio: 3 / 4;
  background: var(--surface-alt);
  overflow: hidden;
}

.style-card__media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
}

.style-card__count {
  position: absolute;
  right: 0.55rem;
  bottom: 0.55rem;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  background: rgba(26, 17, 27, 0.78);
  color: #fff;
  font-size: 0.74rem;
  font-weight: 700;
}

.variant-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.25rem;
  padding: 0.45rem 0.5rem 0;
}

.variant-chip {
  padding: 0.22rem 0.12rem;
  font-size: 0.66rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-radius: 6px;
}

.style-card__body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 0.85rem 0.9rem 0.95rem;
}

.style-card__era {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.style-card__title {
  margin: 0.15rem 0 0.4rem;
  font-size: 1.05rem;
  line-height: 1.25;
}

.style-card__hook {
  margin: 0 0 0.85rem;
  font-size: 0.88rem;
  color: var(--muted);
  flex: 1;
}

.style-card__actions {
  display: flex;
  gap: 0.45rem;
}

.card-btn {
  flex: 1;
  padding: 0.42rem 0.65rem;
  font-size: 0.84rem;
  font-weight: 600;
}

.empty-state {
  padding: 3rem 1rem;
  text-align: center;
  color: var(--muted);
}

/* Modals */
.modal {
  width: min(1040px, calc(100% - 1.5rem));
  max-height: calc(100dvh - 1.5rem);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

.modal::backdrop {
  background: rgba(14, 9, 15, 0.72);
  backdrop-filter: blur(4px);
}

.modal__shell {
  padding: 1.15rem 1.3rem 1.4rem;
}

.modal__head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border);
}

.modal__kicker {
  margin: 0;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.modal__head h2 {
  margin: 0.15rem 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.3rem, 2.5vw, 1.85rem);
}

.modal__nav {
  display: flex;
  gap: 0.45rem;
  flex-shrink: 0;
}

.icon-btn {
  padding: 0.38rem 0.75rem;
  font-size: 0.86rem;
  font-weight: 600;
}

.study-modal__body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 1.4rem;
  margin-top: 1.1rem;
  align-items: start;
}

.study-modal__stage img {
  display: block;
  width: 100%;
  max-height: 70dvh;
  object-fit: contain;
  border-radius: 10px;
  background: var(--surface-alt);
}

.variant-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.7rem;
}

.variant-tab {
  padding: 0.32rem 0.7rem;
  font-size: 0.82rem;
  font-weight: 600;
}

.variant-note {
  margin: 0.5rem 0 0;
  font-size: 0.86rem;
  color: var(--muted);
}

.lesson-era {
  margin: 0;
  color: var(--gold);
  font-size: 0.84rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.lesson-hook {
  margin: 0.35rem 0 1rem;
  font-size: 1.08rem;
  font-weight: 600;
}

.lesson-block {
  margin-bottom: 1rem;
}

.lesson-block h3 {
  margin: 0 0 0.3rem;
  font-size: 0.92rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.lesson-block p,
.lesson-block ul {
  margin: 0;
  font-size: 0.95rem;
  color: var(--ink);
}

.lesson-block ul {
  padding-left: 1.2rem;
}

.lesson-block li + li {
  margin-top: 0.35rem;
}

.lesson-block--tip {
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  background: var(--surface-alt);
  border-left: 3px solid var(--gold);
}

.lesson-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.8rem 0 1rem;
}

.tag-chip {
  padding: 0.18rem 0.6rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
}

.compare-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
  margin-top: 1rem;
}

.compare-col img {
  display: block;
  width: 100%;
  max-height: 55dvh;
  object-fit: contain;
  border-radius: 10px;
  background: var(--surface-alt);
  margin-bottom: 0.75rem;
}

.compare-col h3 {
  margin: 0.2rem 0 0.4rem;
  font-size: 1.15rem;
}

.compare-col ul {
  margin: 0.4rem 0 0;
  padding-left: 1.15rem;
  font-size: 0.9rem;
}

.site-footer {
  padding: 2rem 0 3rem;
  color: var(--muted);
  font-size: 0.88rem;
}

@media (max-width: 900px) {
  .hero,
  .chapter-head,
  .study-modal__body {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .legend-grid,
  .compare-grid,
  .hero__anchors {
    grid-template-columns: 1fr;
  }
}
