@font-face { font-family: "Oswald"; src: url("assets/oswald.ttf") format("truetype"); font-weight: 200 700; font-display: swap; }
@font-face { font-family: "Literata"; src: url("assets/literata.ttf") format("truetype"); font-weight: 200 900; font-display: swap; }
@font-face { font-family: "Work Sans"; src: url("assets/work-sans.ttf") format("truetype"); font-weight: 100 900; font-display: swap; }

:root {
  --paper: oklch(0.965 0.014 92);
  --paper-2: oklch(0.925 0.024 92);
  --ink: oklch(0.2 0.04 262);
  --ink-2: oklch(0.4 0.03 262);
  --rule: oklch(0.78 0.025 262);
  --cobalt: oklch(0.38 0.17 264);
  --cobalt-soft: oklch(0.9 0.05 264);
  --kerb: oklch(0.86 0.17 95);

  --c-culture: oklch(0.42 0.16 335);   --c-culture-ink: oklch(0.98 0.01 335);
  --c-food: oklch(0.74 0.15 55);       --c-food-ink: oklch(0.2 0.04 55);
  --c-movement: oklch(0.45 0.09 195);  --c-movement-ink: oklch(0.98 0.01 195);
  --c-people: oklch(0.86 0.17 95);     --c-people-ink: oklch(0.2 0.04 95);
  --c-places: oklch(0.42 0.11 150);    --c-places-ink: oklch(0.98 0.01 150);

  --display: "Oswald", "Arial Narrow", sans-serif;
  --text: "Literata", Georgia, serif;
  --ui: "Work Sans", system-ui, sans-serif;

  --gutter: clamp(1.1rem, 4vw, 3rem);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scrollbar-color: var(--cobalt) var(--paper-2); }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--ui); font-size: 1rem; line-height: 1.5;
  accent-color: var(--cobalt); caret-color: var(--cobalt);
}
::selection { background: var(--kerb); color: var(--ink); }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--cobalt); outline-offset: 3px; }

.skip { position: absolute; left: 1rem; top: -4rem; z-index: 50; background: var(--ink); color: var(--paper); padding: .6rem 1rem; }
.skip:focus { top: 1rem; }

/* ---------- masthead ---------- */
.masthead { background: var(--cobalt); color: var(--paper); position: relative; }
.masthead-inner {
  max-width: 78rem; margin: 0 auto; padding: clamp(1.25rem, 3vw, 2.25rem) var(--gutter) clamp(1.5rem, 3vw, 2.5rem);
  display: grid; grid-template-columns: 1fr auto; align-items: end; gap: .75rem 2rem;
}
.brand { display: inline-flex; align-items: flex-end; gap: clamp(.6rem, 2vw, 1.1rem); color: var(--paper); text-decoration: none; justify-self: start; grid-column: 1 / -1; }
.brand:focus-visible { outline-color: var(--kerb); }
.flag { color: var(--kerb); height: clamp(3rem, 7vw, 4.6rem); width: auto; flex: none; margin-bottom: .1em; }
.wordmark { font-family: var(--display); font-weight: 700; font-size: clamp(3.6rem, 10vw, 6rem); line-height: .95; letter-spacing: -.01em; text-transform: uppercase; }
.strap { font-family: var(--text); font-size: clamp(1.1rem, 2.2vw, 1.45rem); font-style: italic; color: var(--cobalt-soft); }
.issue { font-size: .95rem; color: var(--cobalt-soft); font-variant-numeric: tabular-nums; text-align: right; }
.kerb { height: 14px; border-top: 4px solid var(--kerb); border-bottom: 4px solid var(--kerb); background: var(--cobalt); box-sizing: border-box; }

/* ---------- controls ---------- */
main { max-width: 78rem; margin: 0 auto; padding: 0 var(--gutter); }
.controls { display: grid; grid-template-columns: minmax(0, 1fr) 14rem auto; gap: 1rem; align-items: end; padding: 2rem 0 1rem; }
.field label { display: block; font-size: .85rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-2); margin-bottom: .4rem; }
.input-wrap { position: relative; }
.input-wrap svg { position: absolute; left: .9rem; top: 50%; transform: translateY(-50%); color: var(--ink-2); pointer-events: none; }
input[type="search"], select {
  width: 100%; height: 3.25rem; background: #fff; border: 2px solid var(--ink); border-radius: 3px;
  padding: 0 1rem; font-size: 1rem;
}
input[type="search"] { padding-left: 2.8rem; appearance: none; }
input[type="search"]::placeholder { color: oklch(0.48 0.02 262); opacity: 1; }
input[type="search"]::-webkit-search-cancel-button { cursor: pointer; }
select {
  appearance: none; cursor: pointer; padding-right: 2.6rem; font-weight: 500;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='10' viewBox='0 0 16 10'%3E%3Cpath d='M1.5 1.5 8 8l6.5-6.5' fill='none' stroke='%23161b3a' stroke-width='2.4'/%3E%3C/svg%3E") no-repeat right 1rem center;
}
.saved-toggle {
  height: 3.25rem; display: inline-flex; align-items: center; gap: .6rem; padding: 0 1.1rem;
  background: transparent; border: 2px solid var(--ink); border-radius: 3px; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background-color .2s, color .2s;
}
.saved-toggle .bm { fill: none; }
.saved-toggle .count {
  min-width: 1.6rem; height: 1.6rem; padding: 0 .4rem; display: inline-grid; place-items: center;
  background: var(--ink); color: var(--paper); border-radius: 99px; font-size: .85rem; font-variant-numeric: tabular-nums;
}
.saved-toggle:hover { background: var(--paper-2); }
.saved-toggle[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.saved-toggle[aria-pressed="true"] .bm { fill: var(--kerb); stroke: var(--kerb); }
.saved-toggle[aria-pressed="true"] .count { background: var(--kerb); color: var(--ink); }

.lines { display: flex; flex-wrap: wrap; gap: .5rem; padding: .5rem 0 2rem; }
.line-chip {
  display: inline-flex; align-items: center; gap: .55rem; height: 2.5rem; padding: 0 1rem 0 .75rem;
  background: transparent; border: 1.5px solid var(--rule); border-radius: 99px; cursor: pointer; font-weight: 500; font-size: .95rem;
  transition: background-color .2s, border-color .2s;
}
.line-chip i { width: .9rem; height: .9rem; border-radius: 2px; background: var(--ink); flex: none; }
.line-chip:hover { border-color: var(--ink); }
.line-chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
[data-cat="Culture"] { --cat: var(--c-culture); --cat-ink: var(--c-culture-ink); }
[data-cat="Food"] { --cat: var(--c-food); --cat-ink: var(--c-food-ink); }
[data-cat="Movement"] { --cat: var(--c-movement); --cat-ink: var(--c-movement-ink); }
[data-cat="People"] { --cat: var(--c-people); --cat-ink: var(--c-people-ink); }
[data-cat="Places"] { --cat: var(--c-places); --cat-ink: var(--c-places-ink); }
.line-chip[data-cat] i { background: var(--cat); }
.line-chip[data-cat][aria-pressed="true"] i { outline: 1.5px solid var(--paper); }

/* ---------- list ---------- */
.stories { scroll-margin-top: 1rem; outline: none; }
.stories-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding-bottom: .9rem; border-bottom: 4px solid var(--ink); flex-wrap: wrap; }
.stories-head h1 { font-family: var(--display); font-weight: 600; font-size: 1.9rem; text-transform: uppercase; letter-spacing: .02em; }
.status { color: var(--ink-2); font-size: .95rem; font-variant-numeric: tabular-nums; }
.status button { background: none; border: 0; padding: 0; margin-left: .6rem; color: var(--cobalt); font-weight: 600; text-decoration: underline; text-underline-offset: .2em; cursor: pointer; }

.item {
  position: relative; display: grid; grid-template-columns: 6.5rem minmax(0, 1fr) 15rem; gap: 0 2rem; align-items: start;
  padding: 1.75rem 0; border-bottom: 1px solid var(--rule);
  transition: background-color .25s;
}
.item:hover { background: var(--paper-2); }
.item:has(.open:focus-visible) { outline: 3px solid var(--cobalt); outline-offset: -3px; }
.day { font-family: var(--display); font-weight: 600; line-height: .9; font-variant-numeric: tabular-nums; padding-left: .25rem; }
.day b { display: block; font-size: 3.8rem; font-weight: 600; }
.day span { display: block; margin-top: .35rem; font-family: var(--ui); font-size: .8rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); }
.body-col { min-width: 0; }
.plate {
  display: inline-block; background: var(--cat); color: var(--cat-ink); font-family: var(--display); font-weight: 500; font-size: .85rem;
  letter-spacing: .1em; text-transform: uppercase; padding: .2rem .65rem .15rem; border-radius: 2px; margin-bottom: .7rem; line-height: 1.4;
}
.item h2 { font-family: var(--display); font-weight: 500; font-size: clamp(1.6rem, 2.4vw, 2.15rem); line-height: 1.12; text-wrap: balance; }
.open { all: unset; cursor: pointer; display: inline; }
.open::after { content: ""; position: absolute; inset: 0; }
.item:hover .open { text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: .15em; text-decoration-color: var(--cobalt); }
.summary { font-family: var(--text); font-size: 1.08rem; line-height: 1.55; color: var(--ink-2); margin-top: .75rem; max-width: 52ch; text-wrap: pretty; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem 1rem; margin-top: 1rem; font-size: .92rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.meta .is-saved { display: inline-flex; align-items: center; gap: .35rem; color: var(--ink); font-weight: 600; }
.meta .is-saved svg { color: var(--cobalt); }
.thumb { aspect-ratio: 4 / 3; overflow: hidden; border-radius: 3px; background: var(--paper-2); }
.thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease); }
.item:hover .thumb img { transform: scale(1.04); }

.item.lead { grid-template-columns: 6.5rem minmax(0, 1fr) minmax(0, 28rem); padding: 2.25rem 0; }
.item.lead h2 { font-size: clamp(2.2rem, 4.4vw, 3.6rem); line-height: 1.04; }
.item.lead .summary { font-size: 1.22rem; }
.item.lead .day b { font-size: 5rem; }

.empty { padding: 4rem 0 5rem; max-width: 36rem; }
.empty h2 { font-family: var(--display); font-weight: 600; font-size: 2.4rem; text-transform: uppercase; }
.empty p { font-family: var(--text); color: var(--ink-2); margin: .75rem 0 1.5rem; font-size: 1.1rem; }
.btn {
  height: 3rem; padding: 0 1.4rem; background: var(--ink); color: var(--paper); border: 2px solid var(--ink); border-radius: 3px;
  font-weight: 600; cursor: pointer; transition: background-color .2s, color .2s;
}
.btn:hover { background: var(--cobalt); border-color: var(--cobalt); }
.load-error { padding: 3rem 0; font-family: var(--text); }

.colophon { margin-top: 5rem; background: var(--ink); color: oklch(0.88 0.02 262); }
.colophon p { max-width: 78rem; margin: 0 auto; padding: 2rem var(--gutter) 2.5rem; font-size: .92rem; max-width: 78rem; }
.colophon strong { color: var(--kerb); font-family: var(--display); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }

/* ---------- detail ---------- */
#detail-host { min-height: 100vh; }
.detail { position: relative; }
.detail-bar {
  position: sticky; top: 0; z-index: 20; background: var(--paper); border-bottom: 2px solid var(--ink);
}
.detail-bar-inner { max-width: 78rem; margin: 0 auto; padding: .7rem var(--gutter); display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.progress { position: absolute; left: 0; bottom: -2px; height: 4px; width: 100%; background: var(--kerb); transform: scaleX(0); transform-origin: 0 50%; }
.bar-btn {
  height: 2.9rem; display: inline-flex; align-items: center; gap: .6rem; padding: 0 1.1rem; background: transparent; color: var(--ink);
  border: 2px solid var(--ink); border-radius: 3px; font-weight: 600; cursor: pointer; transition: background-color .2s, color .2s;
}
.bar-btn:hover { background: var(--paper-2); }
.bar-btn[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.bar-btn .bm { fill: none; }
.bar-btn[aria-pressed="true"] .bm { fill: var(--kerb); stroke: var(--kerb); }

.article-head { background: var(--cat); color: var(--cat-ink); }
.article-head-inner { max-width: 78rem; margin: 0 auto; padding: clamp(2rem, 5vw, 4rem) var(--gutter) clamp(2rem, 4vw, 3.25rem); }
.article-head .tag { font-family: var(--display); font-weight: 500; font-size: 1rem; letter-spacing: .14em; text-transform: uppercase; }
.article-head h1 { font-family: var(--display); font-weight: 600; font-size: clamp(2.5rem, 7.2vw, 5.5rem); line-height: 1; letter-spacing: -.005em; margin-top: .8rem; max-width: 18ch; text-wrap: balance; outline: none; }
.article-head .dek { font-family: var(--text); font-style: italic; font-size: clamp(1.15rem, 2.2vw, 1.6rem); line-height: 1.4; margin-top: 1.25rem; max-width: 36ch; text-wrap: pretty; }

.article-wrap { max-width: 78rem; margin: 0 auto; padding: 0 var(--gutter); }
.hero { margin: calc(-1 * clamp(1.5rem, 4vw, 3rem)) 0 0; position: relative; }
.hero img { width: 100%; aspect-ratio: 21 / 9; object-fit: cover; border-radius: 3px; border: 2px solid var(--paper); }
.hero figcaption { font-size: .85rem; color: var(--ink-2); padding-top: .6rem; }
.article-grid { display: grid; grid-template-columns: 14rem minmax(0, 40rem); gap: 2rem clamp(2rem, 6vw, 5rem); padding: clamp(2rem, 4vw, 3.5rem) 0 3rem; }
.byline { font-size: .95rem; color: var(--ink-2); font-variant-numeric: tabular-nums; display: grid; gap: 1rem; align-content: start; }
.byline dt { font-size: .78rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
.byline dd { margin: .1rem 0 0; font-size: 1.05rem; color: var(--ink); }
.byline-list { margin: 0; display: grid; gap: 1rem; position: sticky; top: 6rem; }
.prose { font-family: var(--text); font-size: 1.2rem; line-height: 1.72; }
.prose p + p { margin-top: 1.3em; }
.prose p:first-child { font-size: 1.36rem; line-height: 1.6; }
.save-note { margin-top: 2.5rem; padding-top: 1.25rem; border-top: 1px solid var(--rule); font-family: var(--ui); font-size: .95rem; color: var(--ink-2); min-height: 3.2rem; }
.next { border-top: 4px solid var(--ink); background: var(--paper-2); }
.next-inner { max-width: 78rem; margin: 0 auto; padding: 0 var(--gutter); }
.next button {
  all: unset; box-sizing: border-box; cursor: pointer; width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 1.5rem;
  padding: 2rem 0;
}
.next button:focus-visible { outline: 3px solid var(--cobalt); outline-offset: -3px; }
.next small { display: block; font-size: .85rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); }
.next strong { display: block; font-family: var(--display); font-weight: 500; font-size: clamp(1.5rem, 3.4vw, 2.5rem); line-height: 1.1; margin-top: .3rem; text-wrap: balance; }
.next button:hover strong { text-decoration: underline; text-decoration-thickness: 3px; text-decoration-color: var(--cobalt); text-underline-offset: .15em; }
.next svg { transition: transform .4s var(--ease); }
.next button:hover svg { transform: translateX(6px); }

/* ---------- motion: one moment, content visible by default ---------- */
@media (prefers-reduced-motion: no-preference) {
  .item { animation: rise .7s var(--ease) backwards; animation-delay: calc(var(--i, 0) * 60ms); }
  @keyframes rise { from { opacity: 0; transform: translateY(18px); } }
  .detail .article-head { animation: sign .6s var(--ease) backwards; }
  @keyframes sign { from { clip-path: inset(0 0 100% 0); } }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .controls { grid-template-columns: minmax(0, 1fr) 13rem; }
  .saved-toggle { grid-column: 1 / -1; justify-content: center; }
  .item, .item.lead { grid-template-columns: 5rem minmax(0, 1fr) 11rem; gap: 0 1.25rem; }
  .item.lead { grid-template-columns: 5rem minmax(0, 1fr) 16rem; }
  .day b, .item.lead .day b { font-size: 3rem; }
  .article-grid { grid-template-columns: minmax(0, 40rem); }
  .byline-list { position: static; grid-auto-flow: column; justify-content: start; gap: 1.5rem 2.5rem; }
}
@media (max-width: 700px) {
  .masthead-inner { grid-template-columns: 1fr; }
  .issue { text-align: left; }
  .controls { grid-template-columns: 1fr; padding-top: 1.5rem; }
  .saved-toggle { grid-column: auto; }
  .lines { flex-wrap: nowrap; overflow-x: auto; margin: 0 calc(-1 * var(--gutter)); padding: .5rem var(--gutter) 1.5rem; scrollbar-width: none; }
  .line-chip { flex: none; }
  .stories-head h1 { font-size: 1.6rem; }

  .item, .item.lead {
    grid-template-columns: minmax(0, 1fr) 6.5rem; grid-template-areas: "plate thumb" "title thumb" "summary summary" "meta meta"; gap: 0 1rem; padding: 1.4rem 0;
  }
  .day { display: none; }
  .body-col { display: contents; }
  .plate { grid-area: plate; justify-self: start; align-self: end; }
  .item h2 { grid-area: title; font-size: 1.5rem; }
  .summary { grid-area: summary; font-size: 1rem; margin-top: .8rem; }
  .meta { grid-area: meta; margin-top: .7rem; }
  .thumb { grid-area: thumb; aspect-ratio: 1; align-self: start; }
  .item.lead { grid-template-areas: "thumb thumb" "plate plate" "title title" "summary summary" "meta meta"; grid-template-columns: 1fr; }
  .item.lead .thumb { aspect-ratio: 16 / 10; margin-bottom: 1rem; }
  .item.lead h2 { font-size: 2.2rem; }
  .item.lead .summary { font-size: 1.05rem; }

  .detail-bar-inner { padding: .55rem var(--gutter); }
  .bar-btn { padding: 0 .85rem; }
  .article-head h1 { font-size: clamp(2.3rem, 11vw, 3.4rem); }
  .hero img { aspect-ratio: 4 / 3; }
  .prose { font-size: 1.12rem; }
  .prose p:first-child { font-size: 1.22rem; }
  .byline-list { grid-auto-flow: row; grid-template-columns: 1fr 1fr; }
  .next button { padding: 1.5rem 0; gap: 1rem; }
}
