:root {
  --bg: #efe6d5;
  --bg-deep: #e5d8bf;
  --surface: rgba(255, 252, 246, 0.8);
  --surface-strong: #fffaf1;
  --ink: #19120c;
  --muted: #6d5d4f;
  --line: rgba(70, 44, 18, 0.14);
  --gold: #b7852d;
  --rust: #8d3f24;
  --forest: #365246;
  --navy: #1f4152;
  --shadow: 0 20px 50px rgba(47, 30, 9, 0.12);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --max-width: 1220px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Plus Jakarta Sans", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(183, 133, 45, 0.28), transparent 24%),
    radial-gradient(circle at top right, rgba(31, 65, 82, 0.18), transparent 18%),
    linear-gradient(180deg, #f5eddf 0%, #efe4d2 52%, #eadfcb 100%);
}

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

button,
input {
  font: inherit;
}

.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.08;
  background-image:
    linear-gradient(rgba(255,255,255,0.4) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.4) 1px, transparent 1px);
  background-size: 18px 18px;
}

.hero,
.section,
.site-footer {
  width: min(calc(100% - 32px), var(--max-width));
  margin: 0 auto;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 24px 0 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
}

.brand-seal {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--rust), #bd8740);
  color: #fff8ef;
  font-weight: 800;
  letter-spacing: 0.08em;
  box-shadow: var(--shadow);
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--muted);
  font-size: 0.94rem;
}

.brand-copy strong {
  color: var(--ink);
}

.nav-links {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}

.nav-links a {
  color: var(--muted);
  font-weight: 700;
}

.hero-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(340px, 0.8fr);
  gap: 28px;
  padding: 28px 0 30px;
}

.hero-copy {
  padding: 28px 0 18px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--rust);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: 800;
}

h1,
h2,
h3 {
  font-family: "Literata", serif;
}

h1 {
  margin: 0;
  max-width: 11ch;
  font-size: clamp(3.4rem, 7.5vw, 6rem);
  line-height: 0.94;
  letter-spacing: -0.04em;
}

.lead,
.section-copy,
.panel-note p,
.method-grid p,
.atlas-card p,
.featured-card p,
.shelf-card p,
.library-card p,
.reader-content,
.reader-byline {
  color: var(--muted);
  line-height: 1.8;
}

.lead {
  max-width: 60ch;
  margin-top: 20px;
  font-size: 1.08rem;
}

.hero-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 28px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 20px;
  border-radius: 999px;
  font-weight: 800;
  border: 1px solid transparent;
}

.button.primary {
  background: linear-gradient(135deg, var(--rust), #ae7330);
  color: #fff9f2;
  box-shadow: 0 16px 36px rgba(141, 63, 36, 0.18);
}

.button.secondary {
  background: rgba(255, 250, 241, 0.75);
  border-color: var(--line);
}

.hero-panel {
  display: grid;
  gap: 18px;
}

.panel-card,
.atlas-card,
.featured-card,
.shelf-card,
.library-card,
.method-grid article {
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.panel-card {
  padding: 22px;
}

.panel-main {
  background: linear-gradient(180deg, rgba(255, 250, 243, 0.96), rgba(242, 232, 215, 0.96));
}

.panel-note {
  background: linear-gradient(180deg, rgba(239, 247, 241, 0.92), rgba(224, 236, 228, 0.9));
}

.card-label {
  margin: 0 0 16px;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

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

.stat-box {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(70, 44, 18, 0.09);
}

.stat-box strong {
  display: block;
  font-size: 1.6rem;
}

.stat-box span {
  color: var(--muted);
  font-size: 0.9rem;
}

.section {
  padding: 34px 0;
}

.section-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
  gap: 20px;
  align-items: end;
  margin-bottom: 22px;
}

.section-head h2 {
  margin: 0;
  max-width: 13ch;
  font-size: clamp(2.3rem, 4.5vw, 4rem);
  line-height: 0.98;
  letter-spacing: -0.03em;
}

.atlas-grid,
.featured-grid,
.shelf-grid,
.library-grid,
.method-grid {
  display: grid;
  gap: 18px;
}

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

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

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

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

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

.atlas-card,
.featured-card,
.shelf-card,
.library-card,
.method-grid article {
  padding: 22px;
}

.atlas-card {
  min-height: 180px;
  position: relative;
  overflow: hidden;
}

.atlas-card::after {
  content: "";
  position: absolute;
  inset: auto -20px -30px auto;
  width: 110px;
  height: 110px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(183, 133, 45, 0.18), transparent 70%);
}

.category-kicker,
.article-kicker {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(25, 18, 12, 0.06);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.atlas-card h3,
.featured-card h3,
.shelf-card h3,
.library-card h3,
.method-grid h3,
.reader-shell h3 {
  margin: 14px 0 10px;
  font-size: 1.2rem;
  line-height: 1.3;
}

.category-total {
  display: block;
  margin-top: 18px;
  font-size: 2rem;
  font-weight: 800;
}

.featured-card {
  background: linear-gradient(180deg, rgba(255, 249, 238, 0.96), rgba(241, 233, 217, 0.96));
}

.featured-card button,
.shelf-card button,
.library-card button {
  margin-top: 14px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--navy);
  font-weight: 800;
  cursor: pointer;
}

.shelf-card,
.library-card {
  display: flex;
  flex-direction: column;
}

.meta-line {
  margin-top: auto;
  color: var(--muted);
  font-size: 0.9rem;
}

.library-toolbar {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
}

.search-wrap input {
  width: 100%;
  min-height: 54px;
  padding: 0 18px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 251, 245, 0.88);
  color: var(--ink);
}

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

.chip {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 249, 240, 0.82);
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
}

.chip.is-active {
  background: linear-gradient(135deg, var(--navy), #326076);
  color: #f8fbff;
  border-color: transparent;
}

.library-results-meta {
  display: flex;
  gap: 8px;
  align-items: baseline;
  margin-bottom: 16px;
  color: var(--muted);
}

.library-results-meta strong {
  font-size: 1.5rem;
  color: var(--ink);
}

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

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-end;
  padding: 14px 0 40px;
}

.site-footer p,
.footer-note {
  margin: 6px 0 0;
  color: var(--muted);
}

.reader-modal {
  width: min(900px, calc(100% - 20px));
  border: 0;
  border-radius: 26px;
  padding: 0;
  box-shadow: 0 30px 80px rgba(20, 14, 8, 0.28);
  background: transparent;
}

.reader-modal::backdrop {
  background: rgba(13, 10, 7, 0.58);
  backdrop-filter: blur(4px);
}

.reader-shell {
  background: #fffaf3;
  border-radius: 26px;
  padding: 26px;
  max-height: 82vh;
  overflow: auto;
}

.reader-close {
  display: inline-flex;
  margin-left: auto;
  border: 0;
  border-radius: 999px;
  padding: 10px 14px;
  background: rgba(25, 18, 12, 0.08);
  cursor: pointer;
  font-weight: 700;
}

.reader-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 18px;
}

.reader-tag {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(183, 133, 45, 0.12);
  color: var(--rust);
  font-size: 0.78rem;
  font-weight: 800;
}

.reader-byline {
  margin: 10px 0 18px;
}

.reader-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.reader-chip {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(25, 18, 12, 0.06);
  color: var(--muted);
  font-size: 0.82rem;
}

.reader-content {
  white-space: pre-wrap;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 1100px) {
  .hero-layout,
  .section-head,
  .atlas-grid,
  .featured-grid,
  .shelf-grid,
  .library-grid,
  .method-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .hero,
  .section,
  .site-footer {
    width: min(calc(100% - 20px), var(--max-width));
  }

  .topbar,
  .site-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .nav-links,
  .hero-actions {
    width: 100%;
  }

  .button {
    width: 100%;
  }

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