:root {
  color-scheme: light;
  --ink: #17221e;
  --muted: #5d6862;
  --paper: #f4efe5;
  --surface: #fffdf8;
  --surface-soft: #ece4d5;
  --forest: #214f40;
  --forest-dark: #15382d;
  --gold: #b68142;
  --line: #d8cebc;
  --shadow: 0 18px 55px rgba(35, 39, 31, 0.09);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background: radial-gradient(circle at 9% 2%, rgba(33, 79, 64, 0.11), transparent 25rem), var(--paper);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.55;
}

a {
  color: var(--forest);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover { color: #8a5524; }

.site-header {
  width: min(1180px, calc(100% - 40px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin: 0 auto;
  padding: 22px 0;
}

.brand {
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.15rem;
  font-weight: 700;
  text-decoration: none;
}

.site-header nav,
.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
}

.site-header nav a,
.site-footer nav a {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
}

.site-header nav a:hover,
.site-header nav a[aria-current="page"] { color: var(--forest); }

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

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(280px, 0.75fr);
  gap: clamp(28px, 6vw, 76px);
  align-items: end;
  padding: clamp(58px, 10vw, 112px) 0 clamp(52px, 8vw, 88px);
}

.eyebrow,
.note-label,
.topic-number {
  margin: 0 0 10px;
  color: var(--forest);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1, h2, h3 {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
}

h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(2.8rem, 7vw, 5.7rem);
  letter-spacing: -0.055em;
  line-height: 0.97;
}

.lede {
  max-width: 760px;
  margin: 28px 0 0;
  color: #3f4c46;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.15rem, 2vw, 1.45rem);
  line-height: 1.55;
}

.hero-search { max-width: 760px; margin-top: 34px; }

.hero-search label {
  display: block;
  margin-bottom: 9px;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

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

.search-row input {
  min-width: 0;
  flex: 1;
  padding: 15px 17px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid #bfb5a4;
  border-radius: 10px;
  font: inherit;
  box-shadow: 0 8px 25px rgba(35, 39, 31, 0.05);
}

.search-row input:focus {
  border-color: var(--forest);
  outline: 3px solid rgba(33, 79, 64, 0.13);
}

.search-row button,
.button-link {
  padding: 15px 20px;
  color: white;
  background: var(--forest);
  border: 0;
  border-radius: 10px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
}

.search-row button:hover,
.button-link:hover { color: white; background: var(--forest-dark); }

.hero-search > p { margin: 10px 0 0; color: var(--muted); font-size: 0.84rem; }

.preservation-note {
  padding: 26px;
  background: rgba(255, 253, 248, 0.72);
  border: 1px solid var(--line);
  border-top: 4px solid var(--gold);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.preservation-note p { margin: 0 0 14px; color: var(--muted); font-size: 0.92rem; }
.preservation-note a { font-weight: 800; }

.start-section,
.topic-section { padding: clamp(52px, 8vw, 88px) 0; border-top: 1px solid var(--line); }
.section-heading { max-width: 680px; margin-bottom: 32px; }

.section-heading h2 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.4rem);
  letter-spacing: -0.035em;
  line-height: 1.05;
}

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

.feature-card,
.topic-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.feature-card {
  min-height: 290px;
  display: flex;
  flex-direction: column;
  padding: 24px;
  color: inherit;
  text-decoration: none;
  transition: transform 160ms ease, border-color 160ms ease;
}

.feature-card:hover { color: inherit; border-color: var(--forest); transform: translateY(-4px); }
.feature-card > span { color: var(--gold); font-size: 0.78rem; font-weight: 800; }
.feature-card h3 { margin: auto 0 12px; font-size: 1.55rem; line-height: 1.18; }
.feature-card p, .topic-intro { margin: 0; color: var(--muted); font-size: 0.92rem; }

.topic-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.topic-card { padding: clamp(24px, 3vw, 34px); }
.topic-card h3 { margin: 0 0 18px; font-size: 1.55rem; line-height: 1.15; }
.topic-card ul { display: grid; gap: 9px; margin: 0; padding-left: 20px; }
.topic-card li::marker { color: var(--gold); }
.topic-card a { font-size: 0.92rem; }
.topic-intro { margin-bottom: 18px; }

.chapter-links { display: grid; grid-template-columns: repeat(7, minmax(32px, 1fr)); gap: 7px; }
.chapter-links a {
  display: grid;
  place-items: center;
  min-height: 36px;
  color: var(--forest-dark);
  background: var(--surface-soft);
  border-radius: 7px;
  font-size: 0.82rem;
  font-weight: 800;
  text-decoration: none;
}

.chapter-links a:hover { color: white; background: var(--forest); }
.accent-card { color: white; background: var(--forest); border-color: var(--forest); }
.accent-card .topic-number, .accent-card a { color: #f4d4a7; }

.site-footer {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 38px 0 48px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
}

.site-footer p { margin: 3px 0; }
.site-footer nav { margin-top: 18px; }

/* Search page */
.search-page main { min-height: calc(100vh - 180px); }
.search-intro { max-width: 820px; padding: clamp(50px, 9vw, 96px) 0 32px; }
.search-intro h1 { font-size: clamp(2.7rem, 6vw, 5rem); }
.search-intro .lede { font-size: 1.1rem; }
.search-panel { padding-bottom: 80px; }
.search-panel .hero-search { max-width: none; margin: 0; }
.topic-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 0; }

.topic-chips button {
  padding: 8px 12px;
  color: var(--forest);
  background: rgba(255, 253, 248, 0.75);
  border: 1px solid var(--line);
  border-radius: 999px;
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}

.topic-chips button:hover { background: var(--surface-soft); }
.search-status { min-height: 1.6em; margin: 28px 0 14px; color: var(--muted); font-size: 0.9rem; font-weight: 700; }
.result-list { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.search-result { padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.result-meta { margin: 0 0 5px; color: var(--gold); font-size: 0.7rem; font-weight: 800; letter-spacing: 0.13em; text-transform: uppercase; }
.search-result h2 { margin: 0; font-size: 1.3rem; }
.search-result h2 a { text-decoration: none; }
.search-result p:last-child { margin: 10px 0 0; color: #48544e; font-family: Georgia, "Times New Roman", serif; }
mark { padding: 0.05em 0.14em; color: inherit; background: #f2d798; border-radius: 2px; }
.featured-links { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 26px; }
.featured-links a { padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; font-weight: 800; text-decoration: none; }

/* Document library */
.library-intro { max-width: 850px; padding: clamp(52px, 9vw, 100px) 0 38px; }
.library-intro h1 { font-size: clamp(2.7rem, 6vw, 5rem); }
.document-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; padding-bottom: 80px; }
.document-card { display: grid; gap: 14px; padding: 25px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.document-card h2 { margin: 0; font-size: 1.35rem; line-height: 1.2; }
.document-card p { margin: 0; color: var(--muted); font-size: 0.9rem; }
.document-actions { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; }
.document-actions a:first-child { font-weight: 800; }
.download-link { color: var(--muted); font-size: 0.82rem; }

@media (max-width: 980px) {
  .hero, .topic-grid { grid-template-columns: 1fr 1fr; }
  .feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-copy { grid-column: 1 / -1; }
}

@media (max-width: 680px) {
  .site-header { width: min(100% - 28px, 1180px); align-items: flex-start; flex-direction: column; }
  main, .site-footer { width: min(100% - 28px, 1180px); }
  .hero, .topic-grid, .feature-grid, .featured-links, .document-grid { grid-template-columns: 1fr; }
  .hero { padding-top: 44px; }
  .search-row { flex-direction: column; }
  .feature-card { min-height: 230px; }
}
