:root {
  --bg: #f2ecdd;
  --paper: rgba(250, 245, 232, 0.84);
  --ink: #1d2a2a;
  --muted: #5f655d;
  --accent: #9b5b3d;
  --accent-deep: #6f3521;
  --line: rgba(29, 42, 42, 0.12);
  --shadow: 0 24px 60px rgba(39, 32, 22, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: 'IBM Plex Sans', sans-serif;
  background:
    radial-gradient(circle at top left, rgba(155, 91, 61, 0.18), transparent 24%),
    radial-gradient(circle at right center, rgba(65, 96, 88, 0.14), transparent 20%),
    linear-gradient(180deg, #d8d0bb 0%, var(--bg) 30%, #e8e1d2 100%);
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(29, 42, 42, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(29, 42, 42, 0.03) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.45), transparent 90%);
}

.page-shell {
  width: min(1180px, calc(100% - 2rem));
  margin: 1rem auto 3rem;
}

.hero,
.intro-strip,
.filters,
.story-card,
.sidebar-card,
.stat-card {
  backdrop-filter: blur(8px);
}

.hero {
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: 30px;
  background: linear-gradient(180deg, rgba(251, 247, 237, 0.96), rgba(242, 235, 220, 0.84));
  box-shadow: var(--shadow);
}

.topbar,
.hero-grid,
.section-grid,
.story-layout,
.story-detail-grid,
.story-footer,
.hero-actions,
.filters {
  display: grid;
  gap: 1.25rem;
}

.topbar {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  margin-bottom: 3rem;
}

.eyebrow,
.kicker,
.section-label,
.card-label,
.detail-label,
.story-period,
.source-note,
.stat-label,
.search-field span {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.73rem;
}

h1,
h2,
h3,
h4,
blockquote {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  margin: 0;
}

h1 {
  font-size: clamp(2.6rem, 6vw, 4.4rem);
  line-height: 0.92;
}

h2 {
  font-size: clamp(2.1rem, 4.8vw, 4rem);
  line-height: 0.98;
  max-width: 12ch;
}

h3 {
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  line-height: 1;
}

h4 {
  font-size: 2rem;
  line-height: 1;
}

p,
li,
input,
button,
a {
  font: inherit;
}

p {
  margin: 0;
  line-height: 1.6;
}

.ghost-link,
.primary-link,
.secondary-link,
.tag-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  text-decoration: none;
  cursor: pointer;
  transition: transform 180ms ease, background-color 180ms ease, color 180ms ease, border-color 180ms ease;
}

.ghost-link,
.secondary-link,
.tag-button {
  color: var(--ink);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.52);
}

.ghost-link {
  justify-self: end;
  padding: 0.9rem 1.3rem;
}

.primary-link,
.secondary-link {
  padding: 1rem 1.5rem;
}

.primary-link {
  color: #f8f2e8;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  border: 1px solid transparent;
}

.secondary-link,
.tag-button {
  border: 1px solid rgba(29, 42, 42, 0.16);
}

.secondary-link {
  background: transparent;
}

.hero-grid,
.story-layout {
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.82fr);
}

.hero-copy {
  display: grid;
  gap: 1.2rem;
}

.lede {
  max-width: 60ch;
  color: var(--muted);
}

.hero-card,
.intro-strip,
.filters,
.sidebar-card,
.story-card,
.stat-card {
  border: 1px solid var(--line);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.hero-card {
  align-self: end;
  padding: 1.5rem;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(34, 55, 54, 0.96), rgba(22, 31, 31, 0.92));
  color: #f6eedf;
}

blockquote {
  margin-top: 0.7rem;
  font-size: 2rem;
  line-height: 1.05;
}

.card-meta {
  margin-top: 1.2rem;
  color: rgba(246, 238, 223, 0.78);
}

main {
  margin-top: 1.6rem;
  display: grid;
  gap: 1.5rem;
}

.intro-strip,
.filters,
.story-card,
.sidebar-card {
  padding: 1.35rem;
  border-radius: 24px;
}

.section-grid,
.filters {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: end;
}

.search-field {
  display: grid;
  gap: 0.55rem;
}

.search-field input {
  width: 100%;
  padding: 1rem 1.15rem;
  border-radius: 16px;
  border: 1px solid rgba(29, 42, 42, 0.12);
  background: rgba(255, 252, 245, 0.84);
  color: var(--ink);
}

.tag-filters {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.tag-button {
  padding: 0.7rem 1rem;
}

.tag-button.is-active,
.tag-button:hover,
.ghost-link:hover,
.primary-link:hover,
.secondary-link:hover {
  transform: translateY(-2px);
}

.tag-button.is-active {
  color: #f8f2e8;
  background: var(--ink);
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.stat-card {
  padding: 1.2rem;
  border-radius: 22px;
}

.stat-value {
  font-family: 'Cormorant Garamond', serif;
  font-size: 3rem;
  line-height: 0.9;
}

.story-column,
.sidebar-column {
  display: grid;
  gap: 1rem;
}

.list-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
}

.story-list {
  display: grid;
  gap: 1rem;
}

.story-card {
  display: grid;
  gap: 1rem;
}

.story-summary,
.source-note,
.trail-list,
.sidebar-card p,
#results-count {
  color: var(--muted);
}

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

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.tag-row span {
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  background: rgba(155, 91, 61, 0.1);
  color: var(--accent-deep);
  font-size: 0.88rem;
}

.trail-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 1rem;
}

.trail-list li {
  display: grid;
  gap: 0.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.trail-list li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.empty-state {
  text-align: center;
  place-items: center;
  min-height: 220px;
}

@media (max-width: 900px) {
  .topbar,
  .hero-grid,
  .section-grid,
  .filters,
  .story-layout,
  .story-detail-grid,
  .stats-row {
    grid-template-columns: 1fr;
  }

  .ghost-link {
    justify-self: start;
  }

  .page-shell {
    width: min(100% - 1rem, 1180px);
  }

  h2 {
    max-width: 100%;
  }
}
