:root {
  --paper: #f4f0e8;
  --paper-deep: #e9e2d6;
  --ink: #191815;
  --ink-soft: #615d55;
  --rule: #cbc2b2;
  --accent: #9a352e;
  --accent-dark: #71231f;
  --read: #3f5947;
  --sans: "IBM Plex Sans", sans-serif;
  --serif: "Newsreader", Georgia, serif;
  --content: 1180px;
  color-scheme: light;
}

* { box-sizing: border-box; }

html { min-height: 100%; scroll-behavior: smooth; background: var(--paper); }

body {
  margin: 0;
  min-height: 100svh;
  padding-top: env(safe-area-inset-top);
  padding-bottom: calc(106px + env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at 18% 0%, rgba(255,255,255,.72), transparent 28rem),
    var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .24;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.10'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
  z-index: 20;
}

a { color: inherit; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
[hidden] { display: none !important; }

.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;
}

.reading-progress {
  position: fixed;
  inset: 0 0 auto;
  height: 3px;
  z-index: 30;
}

.reading-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width .12s linear;
}

.site-header {
  width: min(calc(100% - 48px), var(--content));
  min-height: 82px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  border-bottom: 1px solid var(--ink);
}

.brand {
  width: max-content;
  display: inline-flex;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: .065em;
  line-height: 1;
}

.header-date {
  margin: 0;
  color: var(--ink-soft);
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.header-date { justify-self: end; }

#app:focus { outline: none; }

.feed-shell {
  width: min(calc(100% - 48px), var(--content));
  margin: 0 auto;
  padding-bottom: 96px;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.feed-tools {
  position: sticky;
  top: 12px;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 210px 190px;
  gap: 8px;
  padding: 8px;
  background: rgba(244,240,232,.92);
  border: 1px solid var(--ink);
  border-radius: 4px;
  box-shadow: 0 14px 40px rgba(49,41,30,.08);
  backdrop-filter: blur(14px);
  margin-top: 72px;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 54px;
  padding: 0 15px;
  background: rgba(255,255,255,.36);
  border: 1px solid transparent;
}

.search-field:focus-within { border-color: var(--accent); }
.search-field svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.search-field input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); }
.search-field input::placeholder { color: #807a70; }
.search-field kbd { padding: 2px 7px; border: 1px solid var(--rule); border-radius: 3px; color: var(--ink-soft); font-size: 12px; }

.filter-trigger { display: none; }

.select-wrap {
  position: relative;
  display: grid;
  align-content: center;
  padding: 6px 36px 6px 15px;
  border-left: 1px solid var(--rule);
}

.select-wrap::after {
  content: "↓";
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-soft);
  pointer-events: none;
}

.select-wrap label { color: var(--ink-soft); font-size: 10px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
.select-wrap select { width: 100%; padding: 3px 0 0; border: 0; outline: 0; appearance: none; background: transparent; color: var(--ink); font-weight: 500; }

.feed-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 40px 0 12px;
  border-bottom: 1px solid var(--ink);
  color: var(--ink-soft);
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.feed-meta p { margin: 0; }
.text-button { padding: 0; border: 0; background: none; color: var(--accent); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }

.filter-dialog {
  width: min(calc(100% - 30px), 480px);
  max-height: calc(100dvh - 30px);
  padding: 0;
  border: 1px solid var(--ink);
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 24px 90px rgba(25,24,21,.24);
  overflow: auto;
}

.filter-dialog::backdrop { background: rgba(25,24,21,.42); backdrop-filter: blur(3px); }
.filter-dialog-panel { min-width: 0; padding: 24px; }
.filter-dialog-panel header, .filter-dialog-panel footer { display: flex; align-items: center; justify-content: space-between; }
.filter-dialog-panel header { margin-bottom: 30px; padding-bottom: 18px; border-bottom: 1px solid var(--ink); }
.filter-dialog-panel h2 { margin: 0; font-family: var(--serif); font-size: 32px; font-weight: 500; }
.dialog-close { width: 36px; height: 36px; padding: 0; border: 0; background: none; color: var(--ink); font-size: 30px; font-weight: 300; line-height: 1; }
.dialog-field { min-width: 0; display: grid; gap: 8px; margin-bottom: 20px; }
.dialog-label { color: var(--ink-soft); font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
.dialog-options { min-width: 0; max-height: 184px; display: grid; border: 1px solid var(--rule); border-radius: 2px; overflow-x: hidden; overflow-y: auto; }
.filter-option { width: 100%; min-width: 0; min-height: 46px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 13px; border: 0; border-bottom: 1px solid var(--rule); background: rgba(255,255,255,.22); color: var(--ink); text-align: left; }
.filter-option:last-child { border-bottom: 0; }
.filter-option[aria-checked="true"] { background: var(--paper-deep); font-weight: 600; }
.filter-option span:first-child { min-width: 0; overflow-wrap: anywhere; }
.filter-option .option-check { flex: 0 0 auto; color: var(--accent); opacity: 0; }
.filter-option[aria-checked="true"] .option-check { opacity: 1; }
.filter-dialog-panel footer { margin-top: 34px; }

.feed-item {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr) 88px;
  gap: 36px;
  align-items: start;
  padding: 34px 0 38px;
  border-bottom: 0;
  text-decoration: none;
}

.feed-card { position: relative; border-bottom: 1px solid var(--rule); }

.reader-favorite svg { width: 19px; fill: none; stroke: currentColor; stroke-width: 1.45; }
.reader-favorite.is-saved { color: var(--accent); }
.reader-favorite.is-saved svg { fill: currentColor; }

.feed-item:hover .feed-title { color: var(--accent); }
.feed-item:hover .feed-arrow { border-color: var(--accent); background: rgba(154,53,46,.05); color: var(--accent); transform: translateX(4px); }

.feed-identity { align-self: center; }
.feed-kicker { margin: 2px 0 6px; color: var(--accent); font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
.feed-author { margin: 0; color: var(--ink); font-family: var(--serif); font-size: 17px; line-height: 1.25; }
.feed-date { margin: 4px 0 0; color: var(--ink-soft); font-size: 11px; line-height: 1.25; }
.feed-read { display: inline-flex; align-items: center; gap: 5px; margin: 1px 0 8px; color: var(--read); font-size: 9px; font-weight: 600; letter-spacing: .15em; line-height: 1; text-transform: uppercase; }
.feed-read::after { content: "✓"; font-size: 10px; font-weight: 600; letter-spacing: 0; transform: translateY(-.5px); }
.feed-title { margin: 0 0 12px; font-family: var(--serif); font-size: clamp(28px, 3vw, 42px); font-weight: 500; letter-spacing: -.025em; line-height: 1.05; transition: color .2s ease; }
.feed-excerpt { max-width: 700px; margin: 0; color: var(--ink-soft); font-family: var(--serif); font-size: 18px; line-height: 1.5; }
.feed-arrow-wrap { min-width: 88px; align-self: stretch; display: grid; place-items: center; }
.feed-arrow {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--rule);
  border-radius: 50%;
  color: var(--ink-soft);
  transition: color .2s ease, border-color .2s ease, background .2s ease, transform .2s ease;
}
.feed-arrow svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.empty-state { padding: 100px 0; text-align: center; }
.empty-state .eyebrow { margin: 0 0 12px; }
.empty-state h2 { margin: 0 0 28px; font-family: var(--serif); font-size: 42px; font-weight: 500; }
.button { padding: 13px 20px; border: 1px solid var(--ink); border-radius: 2px; background: var(--ink); color: var(--paper); }

.reader-shell { width: min(calc(100% - 48px), var(--content)); margin: 0 auto; padding-bottom: 100px; }
.reader-nav { display: flex; justify-content: space-between; align-items: center; padding: 28px 0; border-bottom: 1px solid var(--rule); font-size: 13px; }
.reader-nav a { color: var(--ink-soft); text-decoration: none; }
.reader-nav a:hover { color: var(--accent); }
.reader-nav-actions { min-height: 32px; display: flex; align-items: stretch; gap: 0; }
.reader-favorite {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 18px 0 0;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1;
}
.reader-favorite:hover { color: var(--accent); }
.reader-nav .original-link { display: inline-flex; align-items: center; padding-left: 18px; border-left: 1px solid var(--rule); line-height: 1; }
.reader-favorite svg { display: block; flex: 0 0 auto; }
.reader-header { max-width: 930px; margin: 0 auto; padding: 86px 0 66px; text-align: center; }
.reader-publication { margin: 0 0 24px; color: var(--accent); font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; }
.reader-header h1 { margin: 0; font-family: var(--serif); font-size: clamp(48px, 7vw, 84px); font-weight: 500; letter-spacing: -.045em; line-height: .98; text-wrap: balance; }
.reader-byline { width: max-content; margin: 36px auto 0; text-align: center; }
.reader-byline a { font-family: var(--serif); font-size: 18px; font-weight: 500; text-decoration: none; }
.reader-byline p { margin: 5px 0 0; color: var(--ink-soft); font-size: 12px; }
.reader-layout { position: relative; max-width: 900px; margin: 0 auto; }
.article-body { max-width: 700px; margin: 0 auto; font-family: var(--serif); font-size: 22px; line-height: 1.68; }
.article-body p { margin: 0 0 1.35em; }
.article-pullquote {
  position: relative;
  margin: 2.25em -3.6em;
  padding: .55em 1.65em .5em 1.5em;
  border: 0;
  border-left: 3px solid var(--accent);
  color: var(--ink);
  font-size: 1.32em;
  font-weight: 500;
  letter-spacing: -.018em;
  line-height: 1.38;
}
.article-pullquote p { margin: 0; }
.reader-footer { max-width: 700px; margin: 80px auto 0; padding-top: 28px; border-top: 1px solid var(--ink); }
.next-label { margin: 0 0 10px; color: var(--accent); font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
.next-link { display: flex; align-items: center; justify-content: space-between; gap: 24px; font-family: var(--serif); font-size: 30px; line-height: 1.1; text-decoration: none; }
.next-copy { display: grid; gap: 7px; }
.next-author { color: var(--ink-soft); font-size: 16px; font-weight: 400; line-height: 1.2; }

.app-nav {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 50;
  width: min(390px, calc(100% - 28px));
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 5px;
  border: 1px solid var(--ink);
  border-radius: 12px;
  background: rgba(244,240,232,.96);
  box-shadow: 0 14px 34px rgba(32,27,21,.18);
  backdrop-filter: blur(18px);
  transform: translateX(-50%);
}

.app-nav > a {
  min-height: 52px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 3px;
  border-radius: 7px;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .02em;
  text-decoration: none;
}

.app-nav > a:hover { color: var(--ink); background: rgba(255,255,255,.36); }
.app-nav > a.is-active { background: var(--ink); color: var(--paper); }
.app-nav svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.app-nav-icon { position: relative; height: 20px; }

.collection-shell { width: min(calc(100% - 48px), var(--content)); min-height: calc(100svh - 82px); margin: 0 auto; padding-bottom: 80px; }
.collection-header { display: flex; align-items: baseline; justify-content: space-between; gap: 24px; padding: 70px 0 24px; border-bottom: 1px solid var(--ink); }
.collection-header h1 { margin: 0; font-family: var(--serif); font-size: clamp(48px, 7vw, 76px); font-weight: 500; letter-spacing: -.04em; line-height: 1; }
.collection-header p { margin: 0; color: var(--ink-soft); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }
.collection-shell .button { display: inline-block; text-decoration: none; }
.collection-shell > .empty-state {
  min-height: calc(100svh - 285px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 0 120px;
}

.quote-list { max-width: 880px; margin: 0 auto; }
.quote-card { padding: 48px 0 40px; border-bottom: 1px solid var(--rule); }
.quote-card > a { text-decoration: none; }
.quote-card blockquote { margin: 0; font-family: var(--serif); font-size: clamp(28px, 4vw, 42px); letter-spacing: -.025em; line-height: 1.22; }
.quote-card > a:hover blockquote { color: var(--accent); }
.quote-card footer { display: flex; justify-content: space-between; align-items: end; gap: 30px; margin-top: 28px; }
.quote-author { margin: 0; font-family: var(--serif); font-size: 17px; }
.quote-source { margin: 4px 0 0; color: var(--ink-soft); font-size: 11px; line-height: 1.4; }
.quote-delete { padding: 4px 0; border: 0; border-bottom: 1px solid transparent; background: transparent; color: var(--ink-soft); font-size: 11px; }
.quote-delete:hover { border-color: currentColor; color: var(--accent); }

.quote-tooltip {
  position: fixed;
  z-index: 70;
  filter: drop-shadow(0 8px 18px rgba(25,24,21,.24));
}
.quote-tooltip[data-placement="above"] { transform: translate(-50%, -100%); }
.quote-tooltip[data-placement="below"] { transform: translate(-50%, 0); }
.quote-tooltip[data-placement="touch"] { transform: translate(-100%, 0); }
.quote-tooltip button { display: flex; align-items: center; gap: 8px; padding: 10px 13px; border: 0; border-radius: 5px; background: var(--ink); color: var(--paper); font-size: 12px; white-space: nowrap; }
.quote-tooltip button:hover { background: var(--accent-dark); }
.quote-tooltip svg { width: 17px; fill: none; stroke: currentColor; stroke-width: 1.6; }

@media (pointer: coarse) {
  .quote-tooltip button { min-height: 44px; padding: 11px 14px; touch-action: manipulation; }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(94px + env(safe-area-inset-bottom));
  z-index: 80;
  padding: 10px 15px;
  border-radius: 4px;
  background: var(--ink);
  color: var(--paper);
  box-shadow: 0 8px 24px rgba(25,24,21,.2);
  font-size: 12px;
  opacity: 0;
  transform: translate(-50%, 8px);
  transition: opacity .18s ease, transform .18s ease;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 820px) {
  .site-header, .feed-shell, .reader-shell, .collection-shell { width: min(calc(100% - 30px), var(--content)); }
  .site-header { grid-template-columns: 1fr auto; min-height: 68px; }
  .feed-tools { position: static; grid-template-columns: minmax(0,1fr) auto; margin-top: 36px; }
  .search-field { min-width: 0; }
  .search-field input, .select-wrap select { font-size: 16px; }
  .search-field kbd { display: none; }
  .desktop-filter { display: none; }
  .filter-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-width: 92px;
    padding: 0 14px;
    border: 0;
    border-left: 1px solid var(--rule);
    background: transparent;
    color: var(--ink);
    font-size: 13px;
    font-weight: 500;
  }
  .filter-count { min-width: 20px; height: 20px; padding: 0 5px; display: grid; place-items: center; border-radius: 999px; background: var(--accent); color: var(--paper); font-size: 11px; }
  .feed-item { grid-template-columns: 140px minmax(0,1fr) 72px; gap: 20px; }
  .feed-arrow-wrap { min-width: 72px; }
}

@media (max-width: 580px) {
  .brand { font-size: 20px; letter-spacing: .055em; }
  .header-date { font-size: 10px; }
  .feed-tools { grid-template-columns: minmax(0,1fr) auto; }
  .feed-item { grid-template-columns: 1fr 58px; gap: 12px; padding: 28px 0 30px; }
  .feed-arrow-wrap { min-width: 58px; grid-column: 2; grid-row: 1; }
  .feed-identity { grid-column: 1; grid-row: 1; display: block; }
  .feed-copy { grid-column: 1 / -1; grid-row: 2; }
  .feed-kicker { margin: 0 0 6px; }
  .feed-title { font-size: 31px; }
  .feed-excerpt { font-size: 17px; }
  .reader-nav { padding: 22px 0; }
  .reader-favorite { padding-right: 13px; }
  .reader-nav .original-link { padding-left: 13px; }
  .reader-favorite span { display: none; }
  .reader-header { padding: 56px 0 44px; }
  .reader-header h1 { font-size: 48px; }
  .article-body { font-size: 20px; line-height: 1.62; }
  .article-pullquote { margin: 2em 0; padding: .4em 0 .35em 1em; font-size: 1.18em; line-height: 1.42; }
  .next-link { font-size: 26px; }
  .collection-header { padding-top: 50px; }
  .collection-header h1 { font-size: 50px; }
  .quote-card { padding: 36px 0 32px; }
  .quote-card blockquote { font-size: 29px; }
  .quote-card footer { align-items: start; }
  .quote-source { max-width: 240px; }
  .app-nav { bottom: calc(12px + env(safe-area-inset-bottom)); }
  .toast { bottom: calc(86px + env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
