:root {
  --ink: #13283a;
  --muted: #66727c;
  --paper: #fbfaf6;
  --card: #ffffff;
  --line: #dddcd5;
  --gold: #b67b22;
  --gold-dark: #865813;
  --gold-soft: #f5ead3;
  --navy: #16354f;
  --navy-light: #254d6b;
  --success: #326b4d;
  --serif: "Libre Caslon Text", Georgia, serif;
  --sans: "DM Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }

.site-header {
  width: min(1180px, calc(100% - 48px));
  min-height: 82px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  width: 39px;
  height: 39px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--navy);
  font: 700 22px/1 var(--serif);
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.12);
}

.brand strong, .brand small { display: block; }
.brand strong { font: 700 17px/1.1 var(--serif); }
.brand small { margin-top: 4px; color: var(--muted); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; }

.site-header nav { display: flex; align-items: center; gap: 26px; }
.site-header nav a { color: #394956; font-size: 14px; font-weight: 600; text-decoration: none; }
.site-header nav a:hover { color: var(--gold-dark); }

.hero {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  padding: 76px 0 62px;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, .75fr);
  align-items: end;
  gap: 72px;
}

.eyebrow {
  margin: 0 0 13px;
  color: var(--gold-dark);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
}

h1, h2, h3, blockquote { font-family: var(--serif); }
h1 { max-width: 720px; margin: 0; font-size: clamp(44px, 6vw, 73px); line-height: .99; letter-spacing: -.045em; }
.hero-copy > p:last-child { max-width: 650px; margin: 24px 0 0; color: var(--muted); font-size: 17px; line-height: 1.65; }

.search-panel { padding: 24px; background: var(--navy); border-radius: 5px; box-shadow: 0 18px 45px rgba(21, 42, 57, .16); }
.search-panel label { display: block; margin-bottom: 10px; color: white; font-size: 13px; font-weight: 600; }
.search-box { position: relative; display: flex; align-items: center; }
.search-box svg { position: absolute; left: 15px; width: 20px; fill: none; stroke: #768795; stroke-width: 1.8; }
.search-box input { width: 100%; min-height: 54px; padding: 0 45px 0 46px; border: 1px solid transparent; border-radius: 3px; outline: none; color: var(--ink); background: white; }
.search-box input:focus { border-color: #d3a24d; box-shadow: 0 0 0 3px rgba(211,162,77,.24); }
.search-box button { position: absolute; right: 7px; width: 38px; height: 38px; border: 0; color: #62727f; background: transparent; font-size: 24px; cursor: pointer; opacity: 0; pointer-events: none; }
.search-box button.visible { opacity: 1; pointer-events: auto; }

.discovery { width: min(1180px, calc(100% - 48px)); margin: 0 auto; padding: 44px 0 84px; border-top: 1px solid var(--line); }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.section-heading h2 { margin: 0; font-size: clamp(29px, 4vw, 42px); line-height: 1.1; letter-spacing: -.025em; }
.section-heading > a { color: var(--gold-dark); font-size: 13px; font-weight: 700; text-decoration: none; }
.results-count { margin: 0; color: var(--muted); font-size: 13px; }

.filter-bar { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; margin-bottom: 30px; }
.topic-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-chip { padding: 8px 13px; border: 1px solid var(--line); border-radius: 999px; color: #465561; background: transparent; font-size: 12px; font-weight: 600; cursor: pointer; }
.filter-chip:hover, .filter-chip.active { color: white; border-color: var(--navy); background: var(--navy); }
.select-filters { display: flex; gap: 12px; }
.select-filters label { display: grid; gap: 6px; color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.select-filters select { min-width: 160px; height: 40px; padding: 0 34px 0 11px; border: 1px solid var(--line); border-radius: 3px; color: var(--ink); background: white; font-size: 12px; text-transform: none; }
.select-filters label:first-child select { width: 250px; }

.quote-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.quote-card { min-width: 0; padding: 27px; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 4px; background: var(--card); box-shadow: 0 4px 18px rgba(28, 42, 53, .035); }
.card-topline { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.topic-pill { color: var(--gold-dark); font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.permalink { width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: #6e7c86; text-decoration: none; }
.permalink:hover { color: var(--gold-dark); border-color: #cba768; }
.quote-card blockquote { margin: 19px 0 14px; font-size: clamp(20px, 2vw, 27px); line-height: 1.42; letter-spacing: -.02em; }
.card-attribution { margin: 0 0 22px; color: #4f5f6b; font-size: 13px; font-weight: 600; }
.card-source { margin-top: auto; padding-top: 17px; display: grid; gap: 4px; border-top: 1px solid #eceae3; font-size: 12px; }
.card-source span { color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.card-source a { width: fit-content; color: #324958; font-weight: 600; text-decoration-color: #bbc0c3; text-underline-offset: 3px; }
.card-actions { margin-top: 19px; display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }

.primary-button, .secondary-button, .source-button, .light-button, .load-more {
  min-height: 42px;
  padding: 0 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: 3px;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
.primary-button { color: white; background: var(--navy); }
.primary-button:hover { background: var(--navy-light); }
.source-button, .secondary-button { color: var(--ink); border-color: var(--line); background: #f8f7f2; }
.source-button:hover, .secondary-button:hover { border-color: #bea56f; }
.text-button { padding: 5px 3px; border: 0; color: #6a747c; background: transparent; font-size: 11px; font-weight: 600; text-decoration: underline; text-decoration-color: #c7c8c5; text-underline-offset: 3px; cursor: pointer; }
.text-button:hover { color: var(--gold-dark); }
.load-more { min-width: 210px; margin: 32px auto 0; color: var(--ink); border-color: #cfc9bc; background: transparent; }
.load-more[hidden] { display: none; }
.empty-state { padding: 70px 20px; text-align: center; border: 1px dashed #cbc7bd; }
.empty-state h3 { margin: 0 0 7px; font-size: 27px; }
.empty-state p { margin: 0 0 12px; color: var(--muted); }

.mission-band { padding: 78px max(24px, calc((100vw - 900px) / 2)); color: white; background: var(--navy); text-align: center; }
.mission-band .eyebrow { color: #e6be75; }
.mission-band h2 { margin: 0; font-size: clamp(32px, 5vw, 52px); line-height: 1.12; }
.mission-band > p:not(.eyebrow) { max-width: 650px; margin: 20px auto 28px; color: #d1dae1; line-height: 1.65; }
.light-button { color: var(--navy); background: #f7f0df; }

footer { width: min(1180px, calc(100% - 48px)); min-height: 82px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 24px; color: var(--muted); font-size: 11px; }

.toast { position: fixed; right: 24px; bottom: 24px; z-index: 20; padding: 13px 18px; transform: translateY(18px); color: white; background: var(--success); border-radius: 3px; box-shadow: 0 12px 32px rgba(0,0,0,.22); font-size: 13px; font-weight: 700; opacity: 0; pointer-events: none; transition: .2s ease; }
.toast.visible { transform: translateY(0); opacity: 1; }

.detail-main { width: min(1060px, calc(100% - 48px)); margin: 0 auto; padding: 38px 0 90px; }
.breadcrumb { display: flex; gap: 10px; color: var(--muted); font-size: 12px; }
.breadcrumb a { text-decoration-color: #babdbd; text-underline-offset: 3px; }
.quote-detail { margin-top: 34px; padding: 58px 62px 0; border: 1px solid var(--line); background: white; }
.detail-topic { display: flex; align-items: center; justify-content: space-between; gap: 20px; color: var(--gold-dark); font-size: 10px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
.detail-topic span:last-child { color: var(--success); }
.quote-detail > blockquote { max-width: 880px; margin: 40px auto 24px; font-size: clamp(31px, 5.1vw, 59px); line-height: 1.25; letter-spacing: -.035em; text-align: center; }
.attribution { margin: 0; color: #51616e; font-size: 15px; font-weight: 600; text-align: center; }
.detail-actions { margin: 35px auto 52px; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 11px; }
.detail-actions .primary-button, .detail-actions .secondary-button { min-height: 48px; padding: 0 20px; }
.source-panel { margin: 0 -62px; padding: 35px 62px; display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 55px; align-items: center; color: white; background: var(--navy); }
.source-panel .eyebrow { color: #e9bf72; }
.source-panel h2 { margin: 0; font-size: 27px; }
.source-panel > p:not(.eyebrow) { margin: 8px 0 0; color: #bdcbd5; font-size: 13px; }
.source-panel dl { grid-row: span 2; margin: 0; display: flex; gap: 32px; }
.source-panel dl div { display: grid; gap: 5px; }
.source-panel dt { color: #9fb0bc; font-size: 9px; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; }
.source-panel dd { margin: 0; font-size: 12px; }
.source-panel > a { width: fit-content; margin-top: 15px; color: #f1dba9; font-size: 12px; font-weight: 700; text-decoration: none; }
.related-section { padding-top: 74px; }
.related-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.quote-card.compact { padding: 22px; }
.quote-card.compact blockquote { font-size: 18px; }
.quote-card.compact .card-actions { align-items: stretch; }
.quote-card.compact .primary-button { width: 100%; }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; align-items: stretch; gap: 35px; padding-top: 55px; }
  .filter-bar { align-items: stretch; flex-direction: column; }
  .select-filters { align-self: stretch; }
  .select-filters label, .select-filters label:first-child { flex: 1; }
  .select-filters select, .select-filters label:first-child select { width: 100%; }
  .quote-detail { padding: 45px 36px 0; }
  .source-panel { margin: 0 -36px; padding: 32px 36px; grid-template-columns: 1fr; }
  .source-panel dl { grid-row: auto; margin-top: 24px; }
  .related-grid { grid-template-columns: 1fr; }
}

@media (max-width: 650px) {
  .site-header { width: calc(100% - 32px); min-height: 72px; }
  .site-header nav { gap: 14px; }
  .site-header nav a:first-child { display: none; }
  .site-header nav a { font-size: 12px; }
  .brand small { display: none; }
  .hero, .discovery, .detail-main, footer { width: calc(100% - 32px); }
  .hero { padding: 44px 0; }
  h1 { font-size: 43px; }
  .hero-copy > p:last-child { font-size: 15px; }
  .search-panel { padding: 18px; }
  .discovery { padding-top: 35px; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 9px; }
  .section-heading > a { line-height: 1.4; }
  .topic-filters { flex-wrap: nowrap; width: calc(100vw - 16px); margin-right: -16px; overflow-x: auto; padding-right: 16px; scrollbar-width: none; }
  .filter-chip { flex: 0 0 auto; }
  .select-filters { flex-direction: column; }
  .quote-grid { grid-template-columns: 1fr; }
  .quote-card { padding: 22px 19px; }
  .quote-card blockquote { font-size: 22px; }
  .card-actions .primary-button { width: 100%; min-height: 48px; }
  .card-actions .source-button { flex: 1; min-height: 45px; }
  .toast { right: 16px; bottom: 16px; left: 16px; text-align: center; }
  .mission-band { padding: 60px 22px; }
  footer { min-height: 100px; align-items: flex-start; justify-content: center; flex-direction: column; gap: 8px; }
  .detail-main { padding-top: 25px; }
  .quote-detail { margin-top: 25px; padding: 30px 18px 0; }
  .detail-topic { align-items: flex-start; }
  .quote-detail > blockquote { margin-top: 32px; font-size: 31px; }
  .detail-actions { align-items: stretch; flex-direction: column; margin-bottom: 38px; }
  .detail-actions .primary-button, .detail-actions .secondary-button { width: 100%; }
  .source-panel { margin: 0 -18px; padding: 28px 20px; }
  .source-panel dl { align-items: flex-start; flex-direction: column; gap: 17px; }
  .related-section { padding-top: 55px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; }
}
