:root {
  color-scheme: light;
  --page-bg: #f4ede4;
  --page-bg-2: #efe7d8;
  --page-ink: #1f1c1a;
  --page-muted: #6a635c;
  --page-line: rgba(54, 41, 32, 0.12);
  --page-surface: rgba(255, 251, 246, 0.82);
  --page-surface-strong: rgba(255, 251, 246, 0.94);
  --page-shadow: 0 20px 60px rgba(69, 45, 20, 0.14);
  --page-accent: #c86a4b;
  --page-accent-soft: rgba(200, 106, 75, 0.18);
  --page-accent-deep: #8b422a;
  --serif: "Georgia", "Times New Roman", serif;
  --sans: "Segoe UI Variable Display", "Trebuchet MS", "Segoe UI", sans-serif;
  --safe-top: max(16px, env(safe-area-inset-top));
  --safe-right: max(16px, env(safe-area-inset-right));
  --safe-bottom: max(16px, env(safe-area-inset-bottom));
  --safe-left: max(16px, env(safe-area-inset-left));
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

html {
  background:
    linear-gradient(180deg, var(--page-bg) 0%, var(--page-bg-2) 100%);
}

body {
  min-width: 320px;
  color: var(--page-ink);
  font-family: var(--sans);
  background: transparent;
  overflow: hidden;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

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

.app-shell {
  position: relative;
  min-height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}

.backdrop {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.backdrop-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(12px);
  opacity: 0.78;
  transition:
    transform 0.6s ease,
    background 0.4s ease;
}

.backdrop-glow-a {
  width: 68vw;
  height: 68vw;
  min-width: 280px;
  min-height: 280px;
  right: -14vw;
  top: -10vw;
  background: radial-gradient(circle, var(--page-accent-soft) 0%, rgba(255, 255, 255, 0) 72%);
}

.backdrop-glow-b {
  width: 62vw;
  height: 62vw;
  min-width: 240px;
  min-height: 240px;
  left: -18vw;
  bottom: -14vw;
  background: radial-gradient(circle, rgba(98, 149, 116, 0.13) 0%, rgba(255, 255, 255, 0) 72%);
}

.backdrop-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(89, 63, 41, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(89, 63, 41, 0.03) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.7), transparent 90%);
}

.hud {
  position: fixed;
  z-index: 30;
  top: 0;
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding:
    calc(var(--safe-top) + 6px)
    var(--safe-right)
    0
    var(--safe-left);
  pointer-events: none;
}

.hud-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 10px 14px;
  border-radius: 18px;
  border: 1px solid var(--page-line);
  background: rgba(255, 251, 246, 0.8);
  box-shadow: 0 10px 30px rgba(68, 51, 36, 0.08);
  backdrop-filter: blur(16px);
  pointer-events: auto;
}

.hud-brand {
  justify-self: start;
  min-width: 0;
}

.hud-brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--page-accent), var(--page-accent-deep));
  color: #fff8f1;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.06em;
}

.hud-brand strong,
.hud-brand span {
  display: block;
  line-height: 1.15;
}

.hud-brand strong {
  font-size: 13px;
}

.hud-brand span {
  font-size: 11px;
  color: var(--page-muted);
}

.hud-center {
  grid-column: 1 / -1;
  display: grid;
  gap: 6px;
  align-items: center;
  padding: 0 4px;
}

.hud-context {
  margin: 0;
  padding-left: 6px;
  font-size: 12px;
  line-height: 1.2;
  color: rgba(58, 48, 41, 0.78);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}

.hud-progress-line {
  height: 5px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(64, 49, 39, 0.08);
}

.hud-progress-line span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--page-accent), #dfa05d);
  transition: width 0.28s ease, background 0.28s ease;
}

.hud-status {
  justify-self: end;
  white-space: nowrap;
  font-weight: 700;
  font-size: 13px;
}

.stories {
  position: relative;
  z-index: 5;
  height: 100dvh;
  max-height: 100dvh;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
  overscroll-behavior-y: contain;
}

.story {
  min-height: 100dvh;
  scroll-snap-align: start;
  padding:
    calc(var(--safe-top) + 96px)
    max(18px, var(--safe-right))
    calc(var(--safe-bottom) + 92px)
    max(18px, var(--safe-left));
}

.sheet {
  position: relative;
  width: min(100%, 540px);
  min-height: calc(100dvh - var(--safe-top) - var(--safe-bottom) - 188px);
  margin: 0 auto;
  padding: 22px 20px 20px;
  display: flex;
  flex-direction: column;
  border-radius: 30px;
  border: 1px solid rgba(60, 45, 34, 0.08);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.74) 0%, rgba(255, 251, 246, 0.92) 100%);
  box-shadow: var(--page-shadow);
  backdrop-filter: blur(18px);
}

.sheet::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0) 42%),
    linear-gradient(180deg, rgba(92, 66, 45, 0.02), rgba(92, 66, 45, 0));
}

.story-loading .sheet {
  justify-content: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  color: var(--page-accent-deep);
  font-size: 12px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  width: 28px;
  height: 1px;
  background: currentColor;
  opacity: 0.45;
}

.hero-sheet {
  justify-content: space-between;
}

.hero-stack {
  display: grid;
  gap: 16px;
}

.hero-count {
  width: fit-content;
  padding: 10px 14px;
  border-radius: 18px;
  border: 1px solid rgba(76, 53, 34, 0.08);
  background: rgba(255, 255, 255, 0.6);
  font-size: 14px;
  color: var(--page-muted);
}

.hero-count strong {
  font-size: 24px;
  color: var(--page-ink);
  font-family: var(--serif);
}

.hero-sheet h1,
.project-title,
.list-sheet h2 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 700;
  line-height: 0.96;
  letter-spacing: -0.03em;
  color: #2b221d;
}

.hero-sheet h1 {
  font-size: clamp(42px, 12vw, 72px);
  max-width: 10ch;
}

.project-title {
  font-size: clamp(34px, 9vw, 56px);
  max-width: 11ch;
  text-wrap: balance;
}

.hero-lead,
.project-description,
.list-lead,
.micro-note {
  margin: 0;
  color: #453a33;
  font-size: clamp(15px, 3.9vw, 18px);
  line-height: 1.45;
}

.hero-lead {
  max-width: 34ch;
}

.micro-note {
  font-size: 13px;
  color: var(--page-muted);
}

.hero-points {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.hero-points li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.54);
  font-size: 14px;
  line-height: 1.4;
}

.hero-points li::before {
  content: "•";
  color: var(--page-accent);
  font-size: 18px;
  line-height: 1;
}

.hero-actions,
.project-footer,
.list-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.hero-button,
.ghost-link,
.source-link {
  min-height: 48px;
  padding: 0 16px;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid rgba(74, 54, 40, 0.12);
  background: rgba(255, 255, 255, 0.68);
  color: var(--page-ink);
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(75, 53, 33, 0.08);
}

.hero-button {
  background: linear-gradient(135deg, var(--page-accent), #e1a05b);
  color: #fffaf3;
  border-color: transparent;
}

.project-card {
  gap: 18px;
}

.project-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.project-meta {
  display: grid;
  gap: 8px;
}

.card-number {
  margin: 0;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--page-accent-deep);
}

.card-official {
  margin: 0;
  max-width: 26ch;
  font-size: 12px;
  line-height: 1.35;
  color: var(--page-muted);
}

.icon-stamp {
  flex: 0 0 auto;
  min-width: 68px;
  padding: 12px 10px;
  border-radius: 22px;
  background:
    linear-gradient(145deg, var(--card-accent), color-mix(in srgb, var(--card-accent) 58%, #fff 42%));
  color: #fffaf3;
  text-align: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

.icon-stamp strong {
  display: block;
  font-size: 20px;
  line-height: 1;
  letter-spacing: 0.08em;
}

.icon-stamp span {
  display: block;
  margin-top: 6px;
  font-size: 10px;
  line-height: 1.2;
  opacity: 0.86;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.project-copy {
  display: grid;
  gap: 16px;
}

.project-description {
  max-width: 34ch;
}

.chip-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip-list li {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(66, 49, 36, 0.08);
  background: color-mix(in srgb, var(--card-accent-soft) 56%, #fff 44%);
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  color: #43352b;
}

.project-footer {
  margin-top: auto;
  justify-content: space-between;
}

.project-hint {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(67, 53, 43, 0.06);
  color: var(--page-muted);
  font-size: 13px;
}

.project-hint::before {
  content: "↕";
  font-size: 16px;
  color: var(--page-accent);
}

.source-link::after {
  content: "↗";
  font-size: 14px;
}

.list-sheet {
  gap: 18px;
}

.list-sheet h2 {
  font-size: clamp(34px, 9vw, 52px);
}

.project-index {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.project-index button {
  width: 100%;
  min-height: 54px;
  padding: 10px 14px;
  border: 1px solid rgba(67, 52, 41, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.62);
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  text-align: left;
  color: inherit;
  box-shadow: 0 8px 22px rgba(75, 53, 33, 0.06);
}

.project-index button:focus-visible,
.dock-button:focus-visible,
.hero-button:focus-visible,
.source-link:focus-visible,
.ghost-link:focus-visible {
  outline: 2px solid var(--page-accent);
  outline-offset: 3px;
}

.project-index button strong {
  font-size: 14px;
}

.project-index button span {
  font-size: 12px;
  color: var(--page-muted);
}

.project-index button em {
  font-style: normal;
  font-size: 13px;
  color: var(--page-accent-deep);
  font-weight: 800;
}

.thumb-dock {
  position: fixed;
  z-index: 35;
  left: 50%;
  bottom: calc(var(--safe-bottom) + 10px);
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  width: min(calc(100% - 24px), 420px);
  padding: 8px;
  border-radius: 22px;
  border: 1px solid rgba(65, 49, 38, 0.1);
  background: rgba(255, 251, 246, 0.78);
  box-shadow: 0 18px 44px rgba(77, 56, 35, 0.14);
  backdrop-filter: blur(20px);
}

.dock-button {
  min-height: 48px;
  border: 0;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--page-ink);
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(70, 50, 35, 0.08);
}

.dock-button-accent {
  background: linear-gradient(135deg, var(--page-accent), #e1a05b);
  color: #fffaf3;
  box-shadow: none;
}

.dock-button[disabled] {
  opacity: 0.42;
  cursor: default;
}

.story[data-accent] .sheet {
  border-color: color-mix(in srgb, var(--card-accent) 18%, white 82%);
}

@media (min-width: 700px) {
  .hud {
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: start;
  }

  .hud-center {
    grid-column: auto;
    padding-top: 10px;
  }

  .story {
    padding-top: calc(var(--safe-top) + 78px);
    padding-bottom: calc(var(--safe-bottom) + 82px);
  }

  .sheet {
    min-height: calc(100dvh - var(--safe-top) - var(--safe-bottom) - 164px);
    padding: 28px 28px 24px;
  }

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

  .project-footer {
    gap: 16px;
  }
}
