:root {
  --bg: #f4ede2;
  --surface: rgba(255, 250, 242, 0.82);
  --surface-strong: #fff9f0;
  --surface-muted: rgba(255, 255, 255, 0.52);
  --text: #1f1b1a;
  --muted: #5f5753;
  --accent: #d35436;
  --accent-deep: #8f251d;
  --accent-soft: #f8c9a6;
  --line: rgba(50, 27, 20, 0.12);
  --shadow: 0 16px 40px rgba(92, 40, 29, 0.14);
  --hero: linear-gradient(135deg, rgba(244, 171, 89, 0.95), rgba(211, 84, 54, 0.96));
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --max-width: 980px;
  --safe-bottom: calc(env(safe-area-inset-bottom, 0px) + 1rem);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Avenir Next", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(255, 233, 197, 0.85), transparent 38%),
    radial-gradient(circle at top right, rgba(211, 84, 54, 0.16), transparent 32%),
    linear-gradient(180deg, #f6efe7 0%, #f0e6d8 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.22) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.22) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.25), transparent 75%);
  pointer-events: none;
}

img {
  max-width: 100%;
}

a {
  color: inherit;
}

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

button,
input {
  font: inherit;
}

.app-shell {
  width: min(100%, var(--max-width));
  margin: 0 auto;
  padding: 1rem 1rem calc(5.5rem + var(--safe-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0 1.25rem;
}

.eyebrow,
.meta-label {
  margin: 0;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-deep);
  font-size: 0.72rem;
  font-weight: 700;
}

#app-title,
.hero-title,
.page-title {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  line-height: 0.96;
}

#app-title {
  font-size: clamp(1.85rem, 5vw, 2.7rem);
}

.ghost-button,
.primary-button,
.secondary-button,
.chip,
.nav-link {
  border: 0;
  border-radius: 999px;
  transition: transform 180ms ease, background-color 180ms ease, color 180ms ease, border-color 180ms ease;
}

.ghost-button,
.secondary-button {
  padding: 0.8rem 1rem;
  color: var(--accent-deep);
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(143, 37, 29, 0.12);
  cursor: pointer;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.95rem 1.1rem;
  background: var(--text);
  color: #fff4ed;
  text-decoration: none;
  cursor: pointer;
}

.secondary-button {
  text-decoration: none;
}

.hero-card,
.page-panel,
.card,
.meta-card,
.empty-state {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.hero-card {
  overflow: hidden;
}

.hero-band {
  padding: 1.6rem;
  color: #fff7f0;
  background: var(--hero);
}

.hero-tags,
.page-tags,
.chip-row,
.page-actions,
.stats-grid,
.page-grid,
.home-grid {
  display: grid;
  gap: 0.85rem;
}

.hero-tags,
.page-tags,
.chip-row {
  grid-template-columns: repeat(auto-fit, minmax(120px, max-content));
}

.hero-title,
.page-title {
  font-size: clamp(2.25rem, 8vw, 4.8rem);
  max-width: 12ch;
}

.hero-copy,
.page-summary,
.page-copy,
.card-copy,
.empty-state p {
  margin: 0;
  font-size: 1rem;
  line-height: 1.65;
  color: var(--muted);
}

.hero-copy {
  color: rgba(255, 247, 240, 0.9);
  max-width: 54ch;
}

.hero-content,
.page-content {
  padding: 1.35rem;
}

.hero-chip,
.page-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  width: fit-content;
  padding: 0.55rem 0.85rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  color: inherit;
  font-size: 0.88rem;
  font-weight: 600;
}

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  padding: 0.68rem 0.95rem;
  background: var(--surface-muted);
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--line);
}

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

.chip.is-active,
.nav-link.is-active {
  color: #fff7f0;
  background: var(--accent);
}

.hero-actions,
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.toolbar {
  justify-content: space-between;
  margin: 1rem 0 1.2rem;
}

.search {
  width: min(100%, 360px);
  padding: 0.95rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.64);
  color: var(--text);
}

.section-title {
  margin: 0 0 0.7rem;
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-deep);
}

.stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  margin: 1.25rem 0 0;
}

.meta-card {
  padding: 1rem;
}

.meta-value {
  display: block;
  margin-top: 0.35rem;
  font-size: 1.4rem;
  font-weight: 700;
}

.home-grid,
.page-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.card,
.page-panel {
  padding: 1.1rem;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.card-title {
  margin: 0;
  font-size: 1.32rem;
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
}

.card-meta {
  color: var(--accent-deep);
  font-weight: 700;
  font-size: 0.86rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.page-layout {
  display: grid;
  gap: 1rem;
}

.page-body {
  display: grid;
  gap: 1rem;
}

.page-copy h2,
.page-copy h3 {
  margin: 1.25rem 0 0.45rem;
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
}

.page-copy p,
.page-copy ul,
.page-copy ol {
  margin: 0 0 1rem;
}

.page-copy ul,
.page-copy ol {
  padding-left: 1.2rem;
}

.page-copy li + li {
  margin-top: 0.45rem;
}

.empty-state {
  padding: 1.25rem;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 1rem;
  z-index: 20;
  display: flex;
  gap: 0.45rem;
  align-items: center;
  width: min(calc(100% - 1.5rem), 760px);
  padding: 0.55rem;
  transform: translateX(-50%);
  border-radius: 999px;
  border: 1px solid rgba(61, 32, 24, 0.12);
  background: rgba(255, 249, 240, 0.88);
  backdrop-filter: blur(16px);
  box-shadow: 0 18px 38px rgba(78, 35, 26, 0.18);
}

.nav-link {
  flex: 1 1 auto;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 0.4rem;
  padding: 0.85rem 0.55rem;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 700;
}

[data-reveal] {
  opacity: 0;
  transform: translateY(14px);
  animation: rise-in 420ms ease forwards;
}

[data-reveal="2"] {
  animation-delay: 90ms;
}

[data-reveal="3"] {
  animation-delay: 180ms;
}

[data-reveal="4"] {
  animation-delay: 270ms;
}

@keyframes rise-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (min-width: 760px) {
  .hero-content,
  .page-content {
    padding: 1.6rem;
  }

  .page-body {
    grid-template-columns: minmax(0, 2fr) minmax(240px, 0.8fr);
    align-items: start;
  }

  .page-panel.is-sticky {
    position: sticky;
    top: 1rem;
  }
}

@media (max-width: 759px) {
  .app-shell {
    padding-inline: 0.8rem;
  }

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

  .bottom-nav {
    gap: 0.3rem;
    overflow-x: auto;
    justify-content: flex-start;
  }

  .nav-link {
    min-width: max-content;
    padding-inline: 1rem;
  }
}
