:root {
  --ink: #09213f;
  --muted: #526176;
  --line: #d9e1ec;
  --panel: #ffffff;
  --soft: #f5f8fc;
  --teal: #007f87;
  --teal-dark: #005d65;
  --gold: #c98a10;
  --coral: #ed574b;
  --navy: #07345d;
  --purple: #6750a4;
  --green: #2f8f5b;
  --shadow: 0 16px 38px rgba(18, 43, 75, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--soft);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
a {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(190px, 1fr) auto minmax(130px, 1fr);
  align-items: center;
  gap: 24px;
  padding: 16px clamp(16px, 4vw, 48px);
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: #fff;
  background: var(--teal);
  border-radius: 8px;
  font-weight: 800;
}

.brand strong {
  display: block;
  color: var(--ink);
  font-size: 1.45rem;
  line-height: 1;
}

.brand small {
  color: var(--teal);
  font-weight: 700;
}

.desktop-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.desktop-nav a {
  min-width: 76px;
  padding: 10px 12px;
  border-bottom: 3px solid transparent;
  color: var(--muted);
  text-align: center;
  font-weight: 700;
}

.desktop-nav a.active,
.desktop-nav a:hover {
  color: var(--teal);
  border-color: var(--teal);
}

.dashboard-button,
.primary-button,
.secondary-button,
.chip,
.text-button,
.timeline-arrow,
.tab,
.quiz-row,
.answer-choice,
.icon-button {
  border: 0;
  cursor: pointer;
}

.dashboard-button {
  justify-self: end;
  padding: 10px 14px;
  color: #fff;
  background: var(--navy);
  border-radius: 8px;
  font-weight: 800;
}

main {
  max-width: 1440px;
  margin: 0 auto;
  padding: 22px clamp(14px, 3vw, 36px) 110px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.eyebrow,
.featured-label {
  margin: 0 0 6px;
  color: var(--teal-dark);
  font-size: 0.9rem;
  font-weight: 900;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 760px;
  margin-bottom: 0;
  font-size: clamp(2rem, 4vw, 4.6rem);
  line-height: 0.98;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 12px;
  font-size: 1.05rem;
}

.curriculum-badge {
  display: inline-flex;
  align-items: center;
  padding: 10px 12px;
  color: var(--navy);
  background: #fff;
  border: 1px solid #9ecbd1;
  border-radius: 8px;
  font-weight: 800;
}

.timeline-section {
  padding: 10px 0 20px;
}

.timeline-shell {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 10px;
  margin-top: 26px;
}

.timeline-arrow {
  width: 42px;
  height: 42px;
  color: var(--navy);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 1.8rem;
}

.timeline-track {
  display: grid;
  grid-auto-columns: minmax(118px, 1fr);
  grid-auto-flow: column;
  gap: 12px;
  overflow-x: auto;
  padding: 6px 2px 16px;
  scrollbar-width: thin;
}

.timeline-item {
  position: relative;
  min-height: 118px;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: center;
}

.timeline-item.active {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(0, 127, 135, 0.14);
}

.timeline-icon {
  display: grid;
  width: 44px;
  height: 44px;
  margin: 0 auto 8px;
  place-items: center;
  color: #fff;
  background: var(--timeline-color, var(--teal));
  border-radius: 50%;
  font-weight: 900;
}

.timeline-item strong {
  display: block;
  font-size: 0.82rem;
}

.timeline-item small {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
}

.filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  padding: 18px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.search-filter {
  grid-column: 1 / -1;
}

.search-filter label {
  display: block;
  margin-bottom: 8px;
  color: var(--navy);
  font-weight: 900;
}

.search-filter input {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #b9c7d8;
  border-radius: 8px;
  font: inherit;
}

.search-filter input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(0, 127, 135, 0.14);
  outline: none;
}

.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.chip {
  min-height: 38px;
  padding: 8px 16px;
  color: var(--navy);
  background: #fff;
  border: 1px solid #b9c7d8;
  border-radius: 8px;
  font-weight: 800;
}

.chip.active {
  color: #fff;
  background: var(--teal);
  border-color: var(--teal);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(250px, 0.85fr) minmax(420px, 1.35fr) minmax(250px, 0.8fr);
  gap: 18px;
  margin-top: 20px;
}

.topic-panel,
.lesson-panel,
.quiz-card,
.resource-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.topic-panel,
.lesson-panel,
.right-rail {
  min-width: 0;
}

.topic-panel,
.lesson-panel {
  padding: 16px;
}

.panel-title-row,
.lesson-actions,
.lesson-meta,
.quiz-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.text-button {
  color: var(--teal);
  background: transparent;
  font-weight: 800;
}

.result-count {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.reset-button {
  margin-top: 12px;
  padding: 0;
}

.topic-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.topic-card {
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
}

.topic-card.active {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(0, 127, 135, 0.14);
}

.topic-card img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  display: block;
}

.topic-card-body {
  padding: 10px;
}

.topic-card h3 {
  margin-bottom: 3px;
  font-size: 1rem;
}

.topic-card p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.empty-state {
  grid-column: 1 / -1;
  display: grid;
  gap: 4px;
  padding: 18px;
  color: var(--navy);
  background: #f8fbfd;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.empty-state span {
  color: var(--muted);
}

.lesson-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(190px, 280px);
  gap: 18px;
  align-items: start;
}

.lesson-hero h2 {
  margin-bottom: 6px;
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1;
}

.period {
  color: var(--muted);
  font-size: 1.25rem;
  font-weight: 700;
}

.lesson-hero img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 8px;
}

.semantic-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0;
}

.tag {
  padding: 7px 10px;
  background: #f9fbfe;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--navy);
  font-size: 0.83rem;
  font-weight: 800;
}

.lesson-detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 0.9fr);
  gap: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.tab {
  padding: 9px 8px;
  background: transparent;
  border-bottom: 3px solid transparent;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.tab.active {
  color: var(--teal);
  border-color: var(--teal);
}

.tab-content {
  min-height: 180px;
}

.evidence-list,
.event-stack,
.vocab-grid {
  display: grid;
  gap: 10px;
}

.evidence-list,
.event-stack div,
.vocab-grid div {
  padding: 12px;
  background: #f8fbfd;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.event-stack div,
.vocab-grid div {
  display: grid;
  gap: 4px;
}

.event-stack span,
.vocab-grid span,
.evidence-list span {
  color: var(--muted);
}

.inquiry-card {
  display: grid;
  gap: 4px;
  margin: 12px 0;
  padding: 12px;
  color: var(--navy);
  background: #fffaf0;
  border: 1px solid #ead8b7;
  border-radius: 8px;
}

.inquiry-card span {
  color: var(--muted);
}

.map-card {
  min-height: 220px;
  padding: 14px;
  background:
    linear-gradient(90deg, rgba(0, 127, 135, 0.14), rgba(255, 255, 255, 0.1)),
    #eef6f7;
  border: 1px solid #9ecbd1;
  border-radius: 8px;
}

.map-card strong {
  display: block;
  margin-bottom: 14px;
  color: var(--teal-dark);
}

.map-card p {
  color: var(--navy);
  font-weight: 800;
}

.practice-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
}

.practice-tags span {
  padding: 6px 8px;
  color: var(--teal-dark);
  background: #fff;
  border: 1px solid #9ecbd1;
  border-radius: 8px;
  font-size: 0.76rem;
  font-weight: 800;
}

.mini-timeline {
  margin-top: 14px;
  padding: 14px;
  background: #fffaf0;
  border: 1px solid #ead8b7;
  border-radius: 8px;
}

.mini-timeline-items {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.mini-timeline-item {
  color: var(--muted);
  font-size: 0.75rem;
}

.mini-timeline-item strong {
  display: block;
  color: var(--navy);
}

.primary-button,
.secondary-button {
  min-height: 42px;
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 900;
}

.primary-button {
  color: #fff;
  background: var(--teal);
}

.secondary-button {
  color: var(--navy);
  background: #fff;
  border: 1px solid var(--line);
}

.right-rail {
  display: grid;
  gap: 18px;
}

.quiz-card {
  padding: 18px;
  color: #fff;
  background: var(--navy);
  border-color: #0d477a;
}

.progress-ring {
  display: grid;
  width: 104px;
  height: 104px;
  margin: 10px auto 14px;
  place-items: center;
  border: 10px solid rgba(255, 255, 255, 0.28);
  border-top-color: #20c1bd;
  border-radius: 50%;
}

.progress-ring span {
  display: block;
  font-size: 1.4rem;
  font-weight: 900;
}

.progress-ring small {
  margin-top: -28px;
  color: #d3e9ef;
}

.quiz-row {
  width: 100%;
  padding: 9px 0;
  color: #fff;
  background: transparent;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  font-size: 0.86rem;
  text-align: left;
}

.quiz-row span:last-child {
  color: #b7edf0;
  font-weight: 900;
}

.full-width {
  width: 100%;
  margin-top: 14px;
  background: var(--coral);
}

.resource-card {
  padding: 18px;
}

.resource-card a {
  display: block;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  color: var(--navy);
  font-weight: 800;
}

.resource-card small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-weight: 600;
  line-height: 1.35;
}

.wide-section {
  margin-top: 18px;
  padding: 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.curriculum-note {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.historian-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.glossary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.glossary-card {
  display: grid;
  gap: 7px;
  padding: 14px;
  color: var(--navy);
  background: #f8fbfd;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: left;
}

.glossary-card span {
  color: var(--muted);
  line-height: 1.4;
}

.glossary-card small {
  color: var(--teal-dark);
  font-weight: 900;
}

.historian-card {
  padding: 14px;
  background: #f8fbfd;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.historian-card p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.quiz-dialog {
  width: min(640px, calc(100vw - 28px));
  padding: 0;
  border: 0;
  border-radius: 8px;
  box-shadow: 0 28px 70px rgba(5, 23, 44, 0.35);
}

.quiz-dialog::backdrop {
  background: rgba(4, 18, 34, 0.48);
}

.quiz-modal {
  padding: 18px;
  background: #fff;
}

.icon-button {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  color: var(--navy);
  background: #eef3f8;
  border-radius: 8px;
  font-weight: 900;
}

.quiz-question {
  margin: 10px 0 14px;
  color: var(--navy);
  font-size: 1.15rem;
  font-weight: 800;
}

.answer-grid {
  display: grid;
  gap: 10px;
}

.answer-choice {
  width: 100%;
  padding: 13px 14px;
  color: var(--navy);
  background: #f8fbfd;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: left;
  font-weight: 800;
}

.answer-choice.selected {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(0, 127, 135, 0.14);
}

.answer-choice.correct {
  background: #eaf8f0;
  border-color: var(--green);
}

.answer-choice.incorrect {
  background: #fff0ef;
  border-color: var(--coral);
}

.answer-choice:disabled,
.primary-button:disabled,
.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.answer-feedback {
  min-height: 48px;
  margin-top: 14px;
  padding: 12px;
  border-radius: 8px;
  color: var(--muted);
}

.answer-feedback.correct {
  color: #145c36;
  background: #eaf8f0;
}

.answer-feedback.incorrect {
  color: #8f251e;
  background: #fff0ef;
}

.quiz-progress-line,
.quiz-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.quiz-progress-line {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.quiz-actions {
  margin-top: 16px;
}

.quiz-summary {
  display: grid;
  gap: 4px;
  padding: 16px;
  color: var(--navy);
  background: #eef7f8;
  border: 1px solid #9ecbd1;
  border-radius: 8px;
  text-align: center;
}

.quiz-summary strong {
  font-size: 2rem;
}

.review-stack {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.review-stack div {
  display: grid;
  gap: 4px;
  padding: 12px;
  border-radius: 8px;
}

.review-stack .correct {
  color: #145c36;
  background: #eaf8f0;
}

.review-stack .incorrect {
  color: #8f251e;
  background: #fff0ef;
}

.review-stack span {
  font-size: 0.9rem;
}

.mobile-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 30;
  display: none;
  grid-template-columns: repeat(5, 1fr);
  background: #fff;
  border-top: 1px solid var(--line);
}

.mobile-nav a {
  padding: 10px 4px 12px;
  color: var(--muted);
  text-align: center;
  font-size: 0.78rem;
  font-weight: 800;
}

.mobile-nav a.active {
  color: var(--teal);
}

@media (max-width: 1120px) {
  .content-grid {
    grid-template-columns: minmax(280px, 0.85fr) minmax(0, 1.15fr);
  }

  .right-rail {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .site-header {
    grid-template-columns: 1fr auto;
  }

  .desktop-nav,
  .dashboard-button {
    display: none;
  }

  .section-heading,
  .filters,
  .content-grid,
  .lesson-hero,
  .lesson-detail,
  .right-rail {
    grid-template-columns: 1fr;
  }

  .content-grid {
    gap: 14px;
  }

  .topic-panel {
    order: 2;
  }

  .lesson-panel {
    order: 1;
  }

  .right-rail {
    order: 3;
  }

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

  .timeline-shell {
    grid-template-columns: 34px minmax(0, 1fr) 34px;
  }

  .timeline-arrow {
    width: 34px;
    height: 34px;
  }

  .curriculum-badge {
    align-self: start;
  }

  .historian-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .glossary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mobile-nav {
    display: grid;
  }
}

@media (max-width: 560px) {
  main {
    padding-inline: 12px;
  }

  .brand strong {
    font-size: 1.25rem;
  }

  h1 {
    font-size: 2.15rem;
  }

  .topic-panel,
  .lesson-panel,
  .quiz-card,
  .resource-card,
  .wide-section {
    box-shadow: none;
  }

  .lesson-hero h2 {
    font-size: 2rem;
  }

  .mini-timeline-items {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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