:root {
  --paper: #f2ead9;
  --card: #fbf6ea;
  --ink: #1b2420;
  --muted: #55605a;
  --rule: #1b2420;
  --accent: #b3321a;
  --focus: #1b4fd8;

  --c-Culture: #6b3a5e;
  --c-Food: #c93a1f;
  --c-Movement: #1f6f6b;
  --c-People: #e0a526;
  --c-Places: #3f6b3a;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: ui-sans-serif, "Avenir Next", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --gutter: clamp(1rem, 4vw, 2.5rem);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html.locked { overflow: hidden; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.5;
}
.wrap { width: 100%; max-width: 1240px; margin: 0 auto; padding-inline: var(--gutter); }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 2px; }
.skip {
  position: absolute; left: 1rem; top: -4rem; z-index: 50;
  background: var(--ink); color: var(--paper); padding: .6rem 1rem; text-decoration: none;
}
.skip:focus { top: 1rem; }

/* ---------- Masthead ---------- */
.masthead { padding: clamp(1.25rem, 3vw, 2.25rem) 0 0; border-bottom: 3px solid var(--rule); }
.dateline {
  display: flex; gap: .6rem; margin: 0 0 .25rem;
  font: 700 .75rem/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--muted);
}
.brand {
  margin: 0; font-family: var(--serif); font-weight: 800;
  font-size: clamp(3.4rem, 12.5vw, 9rem); line-height: .88; letter-spacing: -.035em;
}
.brand-the { font-style: italic; font-weight: 500; font-size: .42em; letter-spacing: 0; margin-right: .1em; vertical-align: .55em; }
.tagline { margin: .9rem 0 0; font-family: var(--serif); font-size: clamp(1.05rem, 2.2vw, 1.4rem); font-style: italic; color: var(--muted); max-width: 34ch; }

/* Route map: the signature device. A line with stops, one per topic. */
.linemap { margin: clamp(1.25rem, 3vw, 2rem) -8px 0; padding: 8px 8px 0; overflow-x: auto; scrollbar-width: none; }
.linemap::-webkit-scrollbar { display: none; }
.linemap ol {
  list-style: none; margin: 0; padding: 0 0 0; display: flex; gap: 0; min-width: max-content; width: 100%;
  position: relative;
}
.linemap li { flex: 1 1 0; position: relative; }
.linemap li::before { /* the line */
  content: ""; position: absolute; left: 0; right: 0; top: 13px; height: 6px; background: var(--stopc, var(--ink));
}
.linemap li:first-child::before { left: 13px; }
.linemap li:last-child::before { right: calc(100% - 13px); }
.stop {
  position: relative; display: block; width: 100%; text-align: left; background: none; border: 0; cursor: pointer;
  padding: 0 .75rem 1rem 0; color: var(--ink); font: 700 .8rem/1.2 var(--sans); letter-spacing: .08em; text-transform: uppercase;
  min-width: 6.5rem;
}
.stop .dot {
  display: block; width: 26px; height: 26px; border-radius: 50%; margin-bottom: .55rem; position: relative; z-index: 1;
  background: var(--paper); border: 5px solid var(--stopc, var(--ink));
  transition: background-color .15s;
}
.stop:hover .dot { background: var(--stopc, var(--ink)); }
.stop[aria-pressed="true"] .dot { background: var(--stopc, var(--ink)); box-shadow: 0 0 0 4px var(--paper), 0 0 0 7px var(--stopc, var(--ink)); }
.stop[aria-pressed="true"] .lbl { text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 5px; }
.stop .n { display: block; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--muted); font-size: .78rem; margin-top: .15rem; }

/* ---------- Toolbar ---------- */
.toolbar { position: sticky; top: 0; z-index: 20; background: var(--paper); border-bottom: 1px solid rgba(27,36,32,.35); }
.toolbar-in { display: grid; grid-template-columns: minmax(0, 1fr) 14rem auto; gap: 1rem; align-items: end; padding-block: .85rem; }
.field label { display: block; font: 700 .7rem/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; margin-bottom: .4rem; color: var(--muted); }
input[type="search"], select {
  width: 100%; height: 3rem; border: 2px solid var(--ink); border-radius: 0; background: var(--card); color: var(--ink);
  font: 500 1rem var(--sans); padding: 0 .85rem;
}
input[type="search"]::placeholder { color: #6f7873; }
select { appearance: none; padding-right: 2.4rem;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; }
.saved-toggle {
  height: 3rem; display: inline-flex; align-items: center; gap: .55rem; padding: 0 1.1rem; cursor: pointer;
  border: 2px solid var(--ink); background: var(--card); color: var(--ink); font: 700 .95rem var(--sans);
}
.saved-toggle .bm { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linejoin: round; }
.saved-toggle .count {
  display: inline-block; min-width: 1.5rem; padding: 0 .35rem; text-align: center; border-radius: 99px;
  background: var(--ink); color: var(--paper); font-size: .8rem; line-height: 1.5rem; margin-left: .15rem;
}
.saved-toggle[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.saved-toggle[aria-pressed="true"] .bm { fill: var(--paper); }
.saved-toggle[aria-pressed="true"] .count { background: var(--paper); color: var(--ink); }

/* ---------- List ---------- */
main { padding-block: 1.25rem 4rem; outline: none; }
.status { margin: 0 0 1.25rem; font: 700 .75rem/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); min-height: .75rem; }
.list { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: clamp(1.75rem, 3.5vw, 3rem) clamp(1.25rem, 2.5vw, 2.25rem); }
.list > .item { grid-column: span 4; }
.list > .item:nth-child(1) { grid-column: 1 / -1; }
.list > .item:nth-child(8n+2), .list > .item:nth-child(8n+3),
.list > .item:nth-child(8n+7), .list > .item:nth-child(8n+8) { grid-column: span 6; }

.item {
  --cc: var(--ink);
  position: relative; display: flex; flex-direction: column; gap: .9rem;
  padding-top: 1rem; border-top: 3px solid var(--cc);
}
.item[data-category="Culture"] { --cc: var(--c-Culture); }
.item[data-category="Food"] { --cc: var(--c-Food); }
.item[data-category="Movement"] { --cc: var(--c-Movement); }
.item[data-category="People"] { --cc: var(--c-People); }
.item[data-category="Places"] { --cc: var(--c-Places); }
.item .art { aspect-ratio: 8 / 5; overflow: hidden; background: var(--cc); }
.item:nth-child(8n+2) .art, .item:nth-child(8n+3) .art, .item:nth-child(8n+7) .art, .item:nth-child(8n+8) .art { aspect-ratio: 2 / 1; }
.art svg { display: block; width: 100%; height: 100%; }
.item .art svg { transition: transform .5s ease; }
.item:hover .art svg { transform: scale(1.04); }

.tag { display: flex; align-items: center; gap: .6rem; font: 700 .75rem/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; }
.tag .badge {
  display: inline-grid; place-items: center; min-width: 2.2rem; height: 1.6rem; padding: 0 .4rem; border-radius: 99px;
  background: var(--cc); color: #fff; font-size: .72rem; letter-spacing: .06em;
}
.item[data-category="People"] .badge { color: var(--ink); }
.item .saved-mark { margin-left: auto; display: none; align-items: center; gap: .3rem; color: var(--accent); }
.item[data-saved="true"] .saved-mark { display: inline-flex; }
.saved-mark svg { fill: currentColor; }

.item h2 { margin: 0; font-family: var(--serif); font-weight: 800; letter-spacing: -.015em; line-height: 1.08; font-size: clamp(1.45rem, 2.3vw, 1.95rem); text-wrap: balance; }
.item:nth-child(1) h2 { font-size: clamp(2rem, 5.5vw, 3.9rem); line-height: 1; letter-spacing: -.025em; }
.open-item { all: unset; cursor: pointer; display: inline; }
.open-item::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.open-item:hover { text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 5px; text-decoration-color: var(--cc); }
.open-item:focus-visible { outline: none; }
.item:has(.open-item:focus-visible) { outline: 3px solid var(--focus); outline-offset: 6px; }
.item .summary { margin: 0; font-family: var(--serif); font-size: 1.1rem; line-height: 1.45; color: #2d3833; max-width: 46ch; }
.item .by { margin: auto 0 0; font: 500 .85rem/1.4 var(--sans); color: var(--muted); }
.item .by b { color: var(--ink); font-weight: 700; }

/* Lead story: image beside copy */
@media (min-width: 900px) {
  .item:nth-child(1) { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); column-gap: clamp(1.5rem, 3vw, 3rem); row-gap: .9rem; grid-template-rows: auto auto auto 1fr; }
  .item:nth-child(1) .art { grid-row: 1 / span 4; aspect-ratio: auto; min-height: 26rem; }
  .item:nth-child(1) .by { margin-top: 0; align-self: end; }
  .item:nth-child(1) .summary { font-size: 1.3rem; }
}

/* ---------- Empty ---------- */
.empty { max-width: 30rem; margin: 2rem auto 0; text-align: center; padding: 2.5rem 1rem; border: 2px dashed var(--ink); background: var(--card); }
.empty[hidden] { display: none; }
.empty svg { color: var(--accent); }
.empty h2 { font-family: var(--serif); font-size: 2rem; margin: .5rem 0; line-height: 1.1; }
.empty p { margin: 0 0 1.25rem; color: var(--muted); }
.btn {
  display: inline-flex; align-items: center; gap: .5rem; height: 3rem; padding: 0 1.3rem; cursor: pointer;
  background: var(--ink); color: var(--paper); border: 2px solid var(--ink); font: 700 .95rem var(--sans);
}
.btn:hover { background: var(--accent); border-color: var(--accent); }

.colophon { border-top: 3px solid var(--rule); padding-block: 1.75rem 2.5rem; color: var(--muted); font-size: .9rem; }
.colophon p { margin: 0; max-width: 60ch; }
.colophon strong { color: var(--ink); font-family: var(--serif); font-size: 1.1rem; }

/* ---------- Detail sheet ---------- */
.sheet {
  --cc: var(--ink);
  padding: 0; border: 0; background: var(--paper); color: var(--ink);
  width: min(100vw, 52rem); max-width: 100vw; height: 100dvh; max-height: 100dvh;
  margin: 0 0 0 auto; overflow-y: auto; overscroll-behavior: contain;
  box-shadow: -12px 0 0 rgba(27,36,32,.15);
}
.sheet::backdrop { background: rgba(27,36,32,.62); }
.sheet:not([open]) { display: none; }
.sheet[open] { animation: slide .28s ease-out; }
@keyframes slide { from { transform: translateX(3rem); opacity: 0; } to { transform: none; opacity: 1; } }

.detail[data-category="Culture"] { --cc: var(--c-Culture); }
.detail[data-category="Food"] { --cc: var(--c-Food); }
.detail[data-category="Movement"] { --cc: var(--c-Movement); }
.detail[data-category="People"] { --cc: var(--c-People); }
.detail[data-category="Places"] { --cc: var(--c-Places); }
.detail { padding-bottom: 4rem; }
.detail-bar {
  position: sticky; top: 0; z-index: 5; display: flex; gap: .75rem; justify-content: space-between; align-items: center;
  padding: .75rem var(--gutter); background: var(--paper); border-bottom: 3px solid var(--cc);
}
.bar-brand { font: 800 1.1rem var(--serif); letter-spacing: -.02em; }
.bar-actions { display: flex; gap: .6rem; }
.bar-actions button {
  height: 2.9rem; padding: 0 1rem; display: inline-flex; align-items: center; gap: .5rem; cursor: pointer;
  border: 2px solid var(--ink); background: var(--card); color: var(--ink); font: 700 .92rem var(--sans);
}
.bar-actions button:hover { background: var(--ink); color: var(--paper); }
.save-btn .bm { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linejoin: round; }
.save-btn[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.save-btn[aria-pressed="true"] .bm { fill: currentColor; }
.save-btn[aria-pressed="true"]:hover { background: var(--accent); border-color: var(--accent); }

.detail-art { aspect-ratio: 2.4 / 1; background: var(--cc); }
.detail-art svg { display: block; width: 100%; height: 100%; }
.detail-head, .detail-body { padding-inline: var(--gutter); }
.detail-head { padding-top: 1.75rem; max-width: 42rem; }
.detail-head .tag { margin-bottom: 1rem; }
.detail-head .tag .badge { background: var(--cc); color: #fff; }
.detail[data-category="People"] .badge { color: var(--ink); }
.detail-head h2 { margin: 0; font-family: var(--serif); font-weight: 800; letter-spacing: -.025em; line-height: 1.02; font-size: clamp(2.1rem, 6vw, 3.5rem); text-wrap: balance; }
.detail-head .standfirst { margin: 1.1rem 0 0; font: italic 400 clamp(1.15rem, 2.4vw, 1.4rem)/1.4 var(--serif); color: #2d3833; }
.detail-head .byline { margin: 1.25rem 0 0; padding-top: .9rem; border-top: 1px solid rgba(27,36,32,.4); font-size: .9rem; color: var(--muted); }
.detail-head .byline b { color: var(--ink); }

/* Article text rides along the route: a line with a stop at each paragraph */
.detail-body { max-width: 42rem; margin-top: 2rem; }
.prose { position: relative; margin-left: 14px; padding-left: clamp(1.25rem, 4vw, 2.25rem); border-left: 6px solid var(--cc); }
.prose p { position: relative; margin: 0 0 1.4em; font-family: var(--serif); font-size: clamp(1.12rem, 2.2vw, 1.28rem); line-height: 1.65; }
.prose p::before {
  content: ""; position: absolute; left: calc(-1 * clamp(1.25rem, 4vw, 2.25rem) - 6px - 10px); top: .55em;
  width: 20px; height: 20px; border-radius: 50%; background: var(--paper); border: 5px solid var(--cc); transform: translateX(3px);
}
.prose p:first-child::first-letter { font-weight: 800; float: left; font-size: 4.2em; line-height: .8; padding: .07em .1em 0 0; color: var(--cc); }
.detail[data-category="People"] .prose p:first-child::first-letter { color: #8a6107; }
.prose p:last-child { margin-bottom: 0; }
.prose p:last-child::after { content: ""; display: block; }
.end-stop { margin: 1.5rem 0 0 14px; font: 700 .75rem/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); padding-left: 1.25rem; }

/* ---------- Mobile ---------- */
@media (max-width: 899px) {
  .list > .item, .list > .item:nth-child(n) { grid-column: span 6; }
  .list > .item:nth-child(1) { grid-column: 1 / -1; }
  .item:nth-child(n+2) .art { aspect-ratio: 8 / 5; }
}
@media (max-width: 640px) {
  .toolbar-in { grid-template-columns: minmax(0, 1fr) auto; gap: .6rem .75rem; padding-block: .6rem; }
  .field-search { grid-column: 1 / -1; }
  .field label { margin-bottom: .3rem; }
  input[type="search"], select, .saved-toggle { height: 2.9rem; }
  .list { grid-template-columns: 1fr; }
  .list > .item, .list > .item:nth-child(n) { grid-column: 1 / -1; }
  .item .art, .item:nth-child(n) .art { aspect-ratio: 16 / 9; }
  .item:nth-child(1) .art { aspect-ratio: 4 / 3; }
  .stop { min-width: 5.6rem; font-size: .75rem; }
  .masthead .wrap { padding-right: 0; }
  .linemap { padding-right: var(--gutter); margin-right: 0; }
  .detail-art { aspect-ratio: 16 / 9; }
  .bar-brand { display: none; }
  .detail-bar { justify-content: flex-end; }
  .bar-actions { width: 100%; }
  .bar-actions button { flex: 1; justify-content: center; }
  .bar-actions .save-btn { flex: 1.6; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .item:hover .art svg { transform: none; }
}
