:root {
  --bg: #f4efe5;
  --surface: rgba(255, 250, 243, 0.84);
  --surface-strong: #fffaf4;
  --ink: #1f2a2d;
  --muted: #5f6a69;
  --accent: #c96d42;
  --accent-2: #214f55;
  --line: rgba(31, 42, 45, 0.12);
  --shadow: 0 18px 60px rgba(33, 27, 20, 0.12);
  --radius-lg: 28px;
  --radius-md: 18px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(201, 109, 66, 0.18), transparent 35%),
    radial-gradient(circle at top right, rgba(33, 79, 85, 0.16), transparent 28%),
    linear-gradient(180deg, #f7f1e7 0%, #efe7db 100%);
  min-height: 100vh;
}

a {
  color: var(--accent-2);
}

.page-shell {
  width: min(1220px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.hero {
  position: relative;
  overflow: hidden;
  padding: 36px;
  border-radius: var(--radius-lg);
  color: #fdf7f0;
  background:
    linear-gradient(140deg, rgba(17, 31, 34, 0.9), rgba(26, 52, 56, 0.82)),
    url("https://images.unsplash.com/photo-1645084102549-e766a3a24827?auto=format&fit=crop&w=1400&q=80")
      center/cover;
  box-shadow: var(--shadow);
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -10% -30% auto;
  width: 420px;
  height: 420px;
  background: radial-gradient(circle, rgba(201, 109, 66, 0.3), transparent 65%);
  pointer-events: none;
}

.eyebrow,
.meta-label {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.78rem;
}

.eyebrow {
  margin: 0 0 18px;
  opacity: 0.84;
}

.view-switch {
  display: inline-flex;
  gap: 10px;
  margin-bottom: 18px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(255, 248, 240, 0.1);
  border: 1px solid rgba(255, 248, 240, 0.12);
}

.view-switch__button {
  border: 0;
  color: rgba(253, 247, 240, 0.78);
  background: transparent;
  border-radius: 999px;
  padding: 10px 14px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.view-switch__button.active {
  color: var(--ink);
  background: #fff5ea;
}

.hero-copy {
  max-width: 760px;
}

.hero h1 {
  margin: 0;
  font-family: "Fraunces", serif;
  font-size: clamp(2.8rem, 7vw, 5.6rem);
  line-height: 0.95;
  letter-spacing: -0.04em;
}

.hero-text {
  max-width: 620px;
  margin: 18px 0 0;
  font-size: 1.05rem;
  line-height: 1.6;
  color: rgba(253, 247, 240, 0.88);
}

.hero-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 28px;
}

.hero-meta div {
  padding: 16px 18px;
  border-radius: var(--radius-md);
  background: rgba(255, 248, 240, 0.08);
  border: 1px solid rgba(255, 248, 240, 0.1);
  backdrop-filter: blur(10px);
}

.meta-label {
  display: block;
  margin-bottom: 8px;
  color: rgba(253, 247, 240, 0.7);
}

.content {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 24px;
  margin-top: 24px;
}

.search-panel,
.results-panel {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.search-panel {
  position: sticky;
  top: 18px;
  align-self: start;
  padding: 22px;
}

.search-label {
  display: block;
  margin-bottom: 12px;
  font-size: 0.95rem;
  font-weight: 700;
}

#searchInput {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  font: inherit;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.86);
}

#searchInput:focus {
  outline: 2px solid rgba(201, 109, 66, 0.32);
  border-color: rgba(201, 109, 66, 0.55);
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.filter-chip {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  padding: 9px 12px;
  border-radius: 999px;
  font: inherit;
  cursor: pointer;
  transition: transform 140ms ease, background-color 140ms ease, border-color 140ms ease;
}

.filter-chip:hover,
.filter-chip:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(33, 79, 85, 0.4);
}

.filter-chip.active {
  color: #fff8f2;
  background: var(--accent-2);
  border-color: var(--accent-2);
}

.results-copy {
  margin: 18px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.results-panel {
  padding: 24px;
}

.content.source-mode {
  grid-template-columns: 1fr;
}

.content.pages-mode {
  grid-template-columns: 1fr;
}

.section-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  margin-bottom: 18px;
}

.section-header h2 {
  margin: 0;
  font-family: "Fraunces", serif;
  font-size: clamp(1.9rem, 4vw, 2.6rem);
}

.section-header p {
  max-width: 360px;
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

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

.topic-card {
  padding: 20px;
  border-radius: 22px;
  background: var(--surface-strong);
  border: 1px solid rgba(31, 42, 45, 0.08);
  min-height: 100%;
  transform: translateY(0);
  opacity: 0;
  animation: card-in 320ms ease forwards;
}

.card-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 8px 11px;
  border-radius: 999px;
  background: rgba(201, 109, 66, 0.12);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.topic-card h3 {
  margin: 0;
  font-size: 1.22rem;
  line-height: 1.25;
}

.summary {
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.points {
  margin: 18px 0 0;
  padding-left: 18px;
  color: var(--ink);
  display: grid;
  gap: 10px;
  line-height: 1.5;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.links a {
  text-decoration: none;
  font-weight: 700;
  padding: 9px 12px;
  border-radius: 999px;
  background: rgba(33, 79, 85, 0.1);
}

.empty-state {
  padding: 36px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.72);
  text-align: center;
  color: var(--muted);
}

.is-hidden {
  display: none;
}

.source-doc {
  max-width: 900px;
  color: var(--ink);
  line-height: 1.7;
}

.pages-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 20px;
}

.page-nav {
  display: grid;
  gap: 12px;
  align-self: start;
}

.page-nav__button {
  width: 100%;
  text-align: left;
  padding: 16px;
  border-radius: 20px;
  border: 1px solid rgba(31, 42, 45, 0.08);
  background: var(--surface-strong);
  color: var(--ink);
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.page-nav__button:hover,
.page-nav__button:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(33, 79, 85, 0.3);
  box-shadow: 0 14px 30px rgba(31, 42, 45, 0.08);
}

.page-nav__button.active {
  border-color: rgba(201, 109, 66, 0.38);
  background: linear-gradient(180deg, rgba(255, 248, 240, 0.98), rgba(255, 241, 231, 0.95));
}

.page-nav__button strong,
.page-nav__button span {
  display: block;
}

.page-nav__button strong {
  font-size: 1rem;
  margin: 4px 0 6px;
}

.page-nav__button span:last-child {
  color: var(--muted);
  line-height: 1.45;
  font-size: 0.92rem;
}

.page-nav__eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  color: var(--accent);
  font-weight: 700;
}

.page-article {
  padding: 24px;
  border-radius: 24px;
  background: var(--surface-strong);
  border: 1px solid rgba(31, 42, 45, 0.08);
}

.page-hero h2,
.page-checklist h3,
.page-section h3 {
  font-family: "Fraunces", serif;
}

.page-kicker {
  display: inline-flex;
  margin-bottom: 10px;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(201, 109, 66, 0.12);
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.76rem;
  font-weight: 700;
}

.page-hero h2 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 2.9rem);
  line-height: 1.02;
}

.page-summary {
  margin: 16px 0 0;
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--muted);
  max-width: 760px;
}

.page-callout {
  margin-top: 18px;
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(33, 79, 85, 0.08);
  border: 1px solid rgba(33, 79, 85, 0.12);
  line-height: 1.6;
}

.page-checklist,
.page-section {
  margin-top: 26px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.page-checklist h3,
.page-section h3 {
  margin: 0 0 12px;
  font-size: 1.35rem;
}

.page-checklist ul,
.page-section ul {
  margin: 0;
  padding-left: 1.2rem;
  display: grid;
  gap: 10px;
  line-height: 1.6;
}

.page-section p {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.65;
}

.source-doc h1,
.source-doc h2,
.source-doc h3,
.source-doc h4 {
  font-family: "Fraunces", serif;
  line-height: 1.1;
  margin: 1.6em 0 0.65em;
}

.source-doc h1 {
  font-size: clamp(2rem, 4vw, 3rem);
}

.source-doc h2 {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
}

.source-doc h3 {
  font-size: 1.35rem;
}

.source-doc p,
.source-doc ul,
.source-doc ol,
.source-doc blockquote,
.source-doc table {
  margin: 0 0 1rem;
}

.source-doc ul,
.source-doc ol {
  padding-left: 1.35rem;
}

.source-doc li + li {
  margin-top: 0.45rem;
}

.source-doc blockquote {
  margin-left: 0;
  padding: 14px 16px;
  border-left: 4px solid rgba(201, 109, 66, 0.55);
  background: rgba(255, 249, 242, 0.9);
  border-radius: 0 16px 16px 0;
}

.source-doc img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1rem 0 1.5rem;
  border-radius: 18px;
  border: 1px solid rgba(31, 42, 45, 0.08);
  box-shadow: var(--shadow);
}

.source-doc hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 1.5rem 0;
}

.source-doc code {
  padding: 0.15em 0.35em;
  border-radius: 0.4em;
  background: rgba(31, 42, 45, 0.08);
}

.source-doc pre {
  overflow: auto;
  padding: 18px;
  border-radius: 18px;
  background: #1f2a2d;
  color: #fffaf4;
}

.source-doc pre code {
  padding: 0;
  background: transparent;
  color: inherit;
}

.source-doc table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.8);
}

.source-doc th,
.source-doc td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.source-doc th {
  background: rgba(33, 79, 85, 0.08);
}

.source-doc tr:last-child td {
  border-bottom: 0;
}

mark {
  background: rgba(201, 109, 66, 0.18);
  color: inherit;
  padding: 0 0.1em;
  border-radius: 0.3em;
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 980px) {
  .content {
    grid-template-columns: 1fr;
  }

  .search-panel {
    position: static;
  }

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

  .pages-layout {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 700px) {
  .page-shell {
    width: min(100% - 20px, 1220px);
    padding-top: 10px;
  }

  .hero {
    padding: 24px;
  }

  .hero-meta {
    grid-template-columns: 1fr;
  }

  .section-header {
    display: block;
  }

  .section-header p {
    margin-top: 8px;
  }

  .view-switch {
    flex-wrap: wrap;
  }

  .page-nav {
    grid-template-columns: 1fr;
  }

  .page-article {
    padding: 20px;
  }
}
