@font-face {
  font-family: "DM Serif Display";
  src: url("assets/dm-serif.ttf") format("truetype");
  font-display: swap;
  font-weight: 400;
}
@font-face {
  font-family: "DM Sans";
  src: url("assets/dm-sans.ttf") format("truetype");
  font-display: swap;
  font-weight: 400 700;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("assets/ibm-plex-mono.ttf") format("truetype");
  font-display: swap;
  font-weight: 400 500;
}

:root {
  --paper: #FAF6EF;
  --paper-2: #F3EBDD;
  --card: #FFFDF8;
  --ink: #1E1B16;
  --ink-soft: #57503F;
  --line: #E2D5C0;
  --accent: #C2452A;
  --accent-dark: #93301D;
  --moss: #2F5D46;
  --gold: #E8A33D;
  --plum: #5B3A8E;
  --radius: 16px;
  --shadow: 0 18px 45px -22px rgba(30, 27, 22, .35);
  --focus: 0 0 0 3px #FAF6EF, 0 0 0 6px #1E1B16;
  color-scheme: light;
}

* { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: rgba(194, 69, 42, .25);
}
body {
  margin: 0;
  overflow-x: clip;
  background: var(--paper);
  color: var(--ink);
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
body:has(.detail-open) { overflow: hidden; }

img { display: block; max-width: 100%; }
a { color: var(--accent-dark); touch-action: manipulation; }
button { touch-action: manipulation; font: inherit; }

:focus-visible {
  outline: none;
  box-shadow: var(--focus);
  border-radius: 6px;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 200;
  background: var(--ink);
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  text-decoration: none;
  transition: top .18s ease;
}
.skip-link:focus-visible { top: 12px; color: #fff; }

/* ticker */
.ticker {
  background: var(--ink);
  color: #F6EEDF;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
  padding: 8px 16px calc(8px + env(safe-area-inset-top, 0px));
}

/* masthead */
.masthead {
  border-bottom: 2px solid var(--ink);
  background: var(--paper);
}
.masthead-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}
.brand-kicker {
  margin: 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--accent-dark);
}
.brand-wordmark {
  margin: 0;
  font-family: "DM Serif Display", Georgia, serif;
  font-size: clamp(30px, 4vw, 44px);
  line-height: 1;
  letter-spacing: -.01em;
  text-wrap: balance;
}
.masthead-nav {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.masthead-nav a {
  text-decoration: none;
  color: var(--ink);
  font-weight: 600;
  font-size: 14px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid transparent;
}
.masthead-nav a:hover {
  background: var(--ink);
  color: var(--paper);
}

/* hero */
.hero {
  max-width: 1160px;
  margin: 0 auto;
  padding: 36px 20px 8px;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  gap: 32px;
  align-items: center;
}
.kicker {
  font-family: "IBM Plex Mono", monospace;
  text-transform: uppercase;
  letter-spacing: .18em;
  font-size: 12px;
  color: var(--accent-dark);
  margin: 0 0 10px;
}
.hero h1 {
  font-family: "DM Serif Display", Georgia, serif;
  font-weight: 400;
  font-size: clamp(38px, 5.2vw, 68px);
  line-height: .98;
  letter-spacing: -.015em;
  margin: 0 0 14px;
  text-wrap: balance;
}
.dek {
  font-size: 18px;
  color: var(--ink-soft);
  max-width: 34em;
  margin: 0 0 20px;
}
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 22px; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 12px 20px;
  font-weight: 700;
  font-size: 15px;
  border: 1.5px solid var(--ink);
  cursor: pointer;
  text-decoration: none;
  transition: transform .16s ease, background-color .16s ease, color .16s ease;
}
.btn-primary { background: var(--accent); border-color: var(--accent-dark); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost:hover { background: var(--ink); color: var(--paper); }
.hero-stats {
  display: flex;
  gap: 28px;
  margin: 0;
  padding: 16px 0 0;
  border-top: 1px solid var(--line);
}
.hero-stats dt {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--ink-soft);
}
.hero-stats dd {
  margin: 0;
  font-family: "DM Serif Display", Georgia, serif;
  font-size: 26px;
}
.hero-figure { margin: 0; }
.hero-figure img {
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2.4;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1.5px solid var(--ink);
  box-shadow: var(--shadow);
}
.hero-figure figcaption,
.card-figcap {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 8px;
}

/* toolbar */
.toolbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(250, 246, 239, .94);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin-top: 28px;
}
.toolbar-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 14px 20px;
  display: grid;
  grid-template-columns: 1.4fr .8fr auto;
  gap: 12px 16px;
  align-items: end;
}
.field label, .field-label {
  display: block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 6px;
  font-weight: 500;
}
.field-search input {
  width: 100%;
  padding: 12px 14px 12px 40px;
  border-radius: 999px;
  border: 1.5px solid var(--ink);
  background: #fff url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="%231E1B16" stroke-width="2"><circle cx="11" cy="11" r="7"/><path d="m20 20-3.5-3.5"/></svg>') no-repeat 13px center;
  font-size: 15px;
  color: var(--ink);
}
.field-search input::placeholder { color: #8A8171; }
.field-filter select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 999px;
  border: 1.5px solid var(--ink);
  background-color: #fff;
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
}
#saved-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: 999px;
  border: 1.5px solid var(--ink);
  background: #fff;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
#saved-filter .heart { font-size: 17px; line-height: 1; }
#saved-filter:hover { background: var(--paper-2); }
#saved-filter[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.result-count {
  grid-column: 1 / -1;
  margin: 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12.5px;
  color: var(--ink-soft);
}

/* stories */
.stories, .topics, .about { scroll-margin-top: 110px; }
.stories, .topics { max-width: 1160px; margin: 0 auto; padding: 30px 20px 8px; }
.section-head h2 {
  font-family: "DM Serif Display", Georgia, serif;
  font-weight: 400;
  font-size: clamp(28px, 3.4vw, 40px);
  margin: 0;
  letter-spacing: -.01em;
  text-wrap: balance;
  scroll-margin-top: 150px;
}
.section-head p { color: var(--ink-soft); margin: 6px 0 20px; }
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.card {
  background: var(--card);
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 26px -20px rgba(30,27,22,.5);
  transition: transform .18s ease, box-shadow .18s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.card-media { position: relative; margin: 0; }
.card-media img {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9.5;
  object-fit: cover;
  border-bottom: 1.5px solid var(--ink);
}
.chip {
  position: absolute;
  left: 12px;
  top: 12px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  background: var(--paper);
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  padding: 4px 10px;
  font-weight: 500;
}
.chip.Culture { background: #E9DDFB; }
.chip.Food { background: #FCE8C8; }
.chip.Movement { background: #D5E8DC; }
.chip.People { background: #FADBD2; }
.chip.Places { background: #D7E6F5; }
.saved-dot {
  position: absolute;
  right: 12px;
  top: 12px;
  background: var(--ink);
  color: #fff;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
}
.card-body { padding: 16px 16px 18px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.card-body h3 {
  font-family: "DM Serif Display", Georgia, serif;
  font-weight: 400;
  font-size: 22px;
  line-height: 1.15;
  margin: 0;
  text-wrap: pretty;
  overflow-wrap: break-word;
}
.card-body h3 a { color: inherit; text-decoration: none; }
.card-body h3 a:hover { text-decoration: underline; text-decoration-thickness: 2px; }
.card-summary { margin: 0; color: var(--ink-soft); font-size: 15px; overflow-wrap: break-word; }
.card-meta {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  color: var(--ink-soft);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.card-actions { margin-top: auto; display: flex; gap: 10px; padding-top: 6px; }
.card-actions .btn { padding: 10px 16px; font-size: 14px; }

.empty {
  border: 2px dashed var(--ink);
  border-radius: var(--radius);
  padding: 36px 24px;
  text-align: center;
  background: #fff;
}
.empty h3 { font-family: "DM Serif Display", Georgia, serif; font-size: 26px; margin: 0 0 8px; font-weight: 400; }
.empty p { color: var(--ink-soft); margin: 0 0 16px; }

/* topics */
.topic-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}
.topic-list button {
  width: 100%;
  border: 1.5px solid var(--ink);
  background: var(--card);
  border-radius: 14px;
  padding: 16px 12px;
  font-family: "DM Serif Display", Georgia, serif;
  font-size: 19px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
  text-align: left;
}
.topic-list button span {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  color: var(--ink-soft);
}
.topic-list button:hover { background: var(--ink); color: var(--paper); }
.topic-list button:hover span { color: var(--paper); }

/* about */
.about { max-width: 1160px; margin: 0 auto; padding: 30px 20px 40px; }
.about-card {
  border: 2px solid var(--ink);
  border-radius: 20px;
  background: var(--ink);
  color: #F6EEDF;
  padding: clamp(22px, 4vw, 40px);
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 28px;
}
.about-card .kicker { color: var(--gold); }
.about-card h2 {
  font-family: "DM Serif Display", Georgia, serif;
  font-weight: 400;
  font-size: clamp(26px, 3vw, 38px);
  line-height: 1.05;
  margin: 0 0 12px;
  text-wrap: balance;
}
.about-card p { color: #D9CFBC; margin: 0 0 12px; }
.dispatch {
  background: var(--paper);
  color: var(--ink);
  border-radius: 14px;
  padding: 20px;
}
.dispatch h3 { font-family: "DM Serif Display", Georgia, serif; margin: 0 0 6px; font-weight: 400; font-size: 22px; }
.dispatch p { color: var(--ink-soft); font-size: 14px; }
.dispatch label {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .14em;
  display: block;
  margin: 12px 0 6px;
}
.dispatch input {
  width: 100%;
  border: 1.5px solid var(--ink);
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 15px;
  margin-bottom: 12px;
  background: #fff;
  color: var(--ink);
}
.dispatch .btn { width: 100%; justify-content: center; }
.form-note { min-height: 1.4em; font-size: 14px; }

.footer {
  border-top: 2px solid var(--ink);
  padding: 22px 20px calc(30px + env(safe-area-inset-bottom, 0px));
  text-align: center;
  color: var(--ink-soft);
  font-size: 14px;
}
.footer p:first-child {
  font-family: "DM Serif Display", Georgia, serif;
  color: var(--ink);
  font-size: 22px;
  margin: 0;
}

/* detail overlay */
.detail-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(30, 27, 22, .55);
  display: flex;
  justify-content: flex-end;
  overscroll-behavior: contain;
}
.detail {
  background: var(--paper);
  width: min(680px, 100%);
  height: 100dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-left: 2px solid var(--ink);
  animation: slide-in .24s ease;
}
.detail-topbar {
  position: sticky;
  top: 0;
  background: rgba(250, 246, 239, .96);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  z-index: 2;
}
.detail-topbar .crumb {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--ink-soft);
}
.icon-btn {
  border: 1.5px solid var(--ink);
  background: #fff;
  border-radius: 999px;
  padding: 9px 15px;
  font-weight: 700;
  cursor: pointer;
  font-size: 14px;
}
.icon-btn:hover { background: var(--ink); color: #fff; }
.detail-hero { margin: 0; }
.detail-hero img {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 8.5;
  object-fit: cover;
  border-bottom: 1.5px solid var(--ink);
}
.detail-article { padding: 24px clamp(20px, 4vw, 40px) 40px; }
.detail-article h2 {
  font-family: "DM Serif Display", Georgia, serif;
  font-weight: 400;
  font-size: clamp(30px, 4vw, 44px);
  line-height: 1.02;
  margin: 10px 0 10px;
  text-wrap: balance;
  overflow-wrap: break-word;
  scroll-margin-top: 20px;
}
.detail-dek { font-size: 18px; color: var(--ink-soft); margin: 0 0 12px; }
.detail-byline {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12.5px;
  color: var(--ink-soft);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}
.detail-prose p {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  line-height: 1.75;
  margin: 0 0 1.1em;
  overflow-wrap: break-word;
}
.detail-prose p:first-child::first-letter {
  font-family: "DM Serif Display", Georgia, serif;
  font-size: 3.1em;
  float: left;
  line-height: .85;
  padding-right: 10px;
  color: var(--accent-dark);
}
.detail-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 20px 0;
  padding: 16px;
  background: #fff;
  border: 1.5px solid var(--ink);
  border-radius: 14px;
}
.save-btn {
  flex: 1;
  min-width: 220px;
  border-radius: 999px;
  border: 1.5px solid var(--ink);
  padding: 12px 18px;
  font-weight: 700;
  cursor: pointer;
  background: #fff;
}
.save-btn[aria-pressed="true"] { background: var(--moss); border-color: var(--moss); color: #fff; }
.save-btn:hover { transform: translateY(-1px); }
.detail-note { font-size: 13px; color: var(--ink-soft); margin: 0; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  z-index: 300;
  box-shadow: var(--shadow);
  max-width: min(90vw, 480px);
  text-align: center;
}

@keyframes slide-in {
  from { transform: translateX(30px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; }
  .grid { grid-template-columns: repeat(2, 1fr); }
  .topic-list { grid-template-columns: repeat(2, 1fr); }
  .about-card { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .masthead-inner { flex-direction: column; align-items: flex-start; }
  .toolbar-inner { grid-template-columns: 1fr; }
  .grid { grid-template-columns: 1fr; }
  .topic-list { grid-template-columns: 1fr 1fr; }
  .detail-backdrop { justify-content: stretch; }
  .detail { width: 100%; border-left: none; }
}

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