/* ============================================================
   CROSSWALK — a journal of everyday city life
   Print-anchored municipal dispatch: book serifs, mono labels,
   warm paper, one signal-brick accent, zebra rules.
   ============================================================ */

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

:root {
  --paper: #f4efe3;
  --paper-deep: #ece4d0;
  --ink: #211d15;
  --muted: #6e6757;
  --line: #d9d0bb;
  --line-strong: #a89b7e;
  --accent: #b3441c;
  --accent-deep: #97381a;
  --on-ink: #f6f1e5;
  --serif-display: "DM Serif Display", Georgia, "Times New Roman", serif;
  --serif-text: "Literata", Georgia, "Times New Roman", serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --wrap: 1200px;
  --gutter: 24px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif-text);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.detail-open { overflow: hidden; }

.wrap {
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.mono { font-family: var(--mono); }

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
img { display: block; max-width: 100%; }
ol, ul { list-style: none; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap;
}

:where(a, button, input, select, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 1px;
}

::selection { background: var(--accent); color: var(--on-ink); }

/* ---------- signature: zebra rule ---------- */
.zebra {
  height: 10px;
  background: repeating-linear-gradient(
    90deg,
    var(--ink) 0 34px,
    transparent 34px 68px
  );
}

/* ============================================================
   Masthead
   ============================================================ */
.masthead {
  padding-top: 14px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.masthead-top {
  display: flex;
  align-items: baseline;
  gap: 14px;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.masthead-top .stamp {
  color: var(--paper);
  background: var(--ink);
  padding: 3px 8px 2px;
  letter-spacing: 0.18em;
}

.masthead-top-right { margin-left: auto; }

.masthead-brand {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  padding: 26px 0 30px;
}

.wordmark {
  font-family: var(--serif-display);
  font-weight: 400;
  font-size: clamp(56px, 8.2vw, 108px);
  line-height: 0.94;
  letter-spacing: -0.015em;
}

.tagline {
  font-family: var(--serif-text);
  font-style: italic;
  font-size: clamp(15px, 1.5vw, 19px);
  color: var(--muted);
  max-width: 30ch;
  text-align: right;
  line-height: 1.45;
  padding-bottom: 10px;
}

/* ============================================================
   Toolbar (search / filter / saved)
   ============================================================ */
.toolbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--paper);
  border-bottom: 2px solid var(--ink);
}

.toolbar-inner {
  display: flex;
  align-items: flex-end;
  gap: 20px;
  padding-block: 12px 14px;
  flex-wrap: wrap;
}

.field { display: flex; flex-direction: column; gap: 5px; }

.field label {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.field input,
.field select {
  font-family: var(--serif-text);
  font-size: 15px;
  color: var(--ink);
  background: transparent;
  border: none;
  border-bottom: 1.5px solid var(--line-strong);
  padding: 2px 2px 4px 2px;
  border-radius: 0;
  min-width: 0;
  appearance: none;
  -webkit-appearance: none;
}

.field-search { flex: 1 1 220px; }
.field-search input { width: 100%; }

.field-topic select {
  appearance: none;
  padding-right: 26px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23211d15' stroke-width='2'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 4px center;
  cursor: pointer;
}

.chip {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: 1.5px solid var(--ink);
  padding: 9px 16px 8px;
  border-radius: 2px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.chip::before {
  content: "";
  width: 9px; height: 9px;
  border: 1.5px solid currentColor;
  border-radius: 1px;
  flex: none;
  transition: background-color 0.15s ease;
}

.chip[aria-pressed="true"] {
  background: var(--ink);
  color: var(--on-ink);
}
.chip[aria-pressed="true"]::before {
  background: var(--accent);
  border-color: var(--accent);
}

.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip[aria-pressed="true"]:hover { border-color: var(--accent); color: var(--on-ink); }

.count {
  margin-left: auto;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  align-self: center;
  padding-bottom: 4px;
  white-space: nowrap;
}

/* ============================================================
   Lead feature
   ============================================================ */
.lead {
  display: grid;
  grid-template-columns: 460px 1fr;
  gap: clamp(28px, 4vw, 64px);
  padding-block: clamp(32px, 4.5vw, 56px) clamp(36px, 5vw, 60px);
  align-items: center;
}

.lead-media {
  position: relative;
  border: 1.5px solid var(--ink);
  padding: 10px;
  background: var(--paper-deep);
}

.lead-media img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  filter: saturate(0.92) contrast(1.02);
}

.lead-no {
  position: absolute;
  top: -18px;
  left: 18px;
  background: var(--accent);
  color: var(--on-ink);
  font-size: 12px;
  letter-spacing: 0.2em;
  padding: 6px 12px 5px;
}

.kicker {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-deep);
  display: flex;
  align-items: center;
  gap: 12px;
}

.kicker::after {
  content: "";
  height: 1px;
  width: 44px;
  background: var(--line-strong);
}

.lead-title {
  font-family: var(--serif-display);
  font-weight: 400;
  font-size: clamp(34px, 3.6vw, 54px);
  line-height: 1.06;
  letter-spacing: -0.01em;
  margin-top: 14px;
  text-wrap: balance;
}

.lead-title button, .row-title button {
  text-align: inherit;
  padding: 0;
  border-radius: 1px;
}

.lead-title button:hover, .row-title button:hover {
  color: var(--accent);
}

.lead-dek {
  margin-top: 18px;
  font-size: clamp(17px, 1.6vw, 20px);
  line-height: 1.55;
  color: var(--ink);
  max-width: 52ch;
}

.meta {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 16px;
}

.lead .meta { margin-top: 20px; }

.lead-actions { margin-top: 26px; display: flex; align-items: center; gap: 16px; }

.btn {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border: 1.5px solid var(--ink);
  padding: 12px 22px 11px;
  border-radius: 2px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.btn:hover { border-color: var(--accent); color: var(--accent); }

.btn-solid { background: var(--ink); color: var(--on-ink); }
.btn-solid:hover { background: var(--accent); border-color: var(--accent); color: var(--on-ink); }

/* ============================================================
   Index
   ============================================================ */
.index-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  border-top: 2px solid var(--ink);
  padding-top: 14px;
}

.index-title {
  font-family: var(--serif-display);
  font-weight: 400;
  font-size: clamp(26px, 2.6vw, 36px);
}

.index-note {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.index { margin-top: 10px; }

.row {
  display: grid;
  grid-template-columns: 58px 1fr 148px;
  gap: clamp(18px, 2.4vw, 36px);
  padding-block: 26px;
  border-bottom: 1px solid var(--line);
  align-items: start;
}

.row-no {
  font-size: 22px;
  color: var(--line-strong);
  padding-top: 2px;
  letter-spacing: 0.04em;
}

.row:hover .row-no { color: var(--accent); }

.row-title {
  font-family: var(--serif-display);
  font-weight: 400;
  font-size: clamp(22px, 2vw, 28px);
  line-height: 1.14;
  margin-top: 8px;
  text-wrap: balance;
}

.row-summary {
  margin-top: 8px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
  max-width: 62ch;
}

.row .meta { margin-top: 12px; }

.row-thumb {
  border: 1px solid var(--line-strong);
  padding: 5px;
  background: var(--paper-deep);
}

.row-thumb img {
  width: 100%;
  aspect-ratio: 5 / 7;
  object-fit: cover;
  filter: saturate(0.9);
  transition: filter 0.2s ease;
}

.row:hover .row-thumb img { filter: saturate(1.05); }

.row[data-saved="true"] .kicker .saved-tag {
  display: inline-block;
  background: var(--accent);
  color: var(--on-ink);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  padding: 3px 7px 2px;
  text-transform: uppercase;
  margin-left: auto;
}

.kicker:has(.saved-tag)::after { display: none; }

.index-section.is-empty .index-head { display: none; }

.index-section.is-empty .empty {
  border-top: 2px solid var(--ink);
  margin-top: 18px;
  padding-top: clamp(40px, 6vw, 72px);
}

/* ============================================================
   Empty state
   ============================================================ */
.empty {
  padding: clamp(56px, 9vw, 110px) 0 clamp(64px, 10vw, 120px);
  text-align: center;
}

.empty-mark { color: var(--line-strong); letter-spacing: 0.3em; font-size: 13px; }

.empty-title {
  font-family: var(--serif-display);
  font-weight: 400;
  font-size: clamp(30px, 3.4vw, 44px);
  margin-top: 16px;
}

.empty-text { margin-top: 10px; color: var(--muted); font-size: 17px; }

.empty-actions {
  margin-top: 28px;
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ============================================================
   Footer
   ============================================================ */
.footer { margin-top: clamp(48px, 7vw, 88px); }

.footer-inner {
  display: grid;
  grid-template-columns: 1.4fr 0.7fr 1fr;
  gap: clamp(28px, 4vw, 56px);
  padding-block: clamp(36px, 5vw, 56px) clamp(44px, 6vw, 64px);
}

.wordmark-sm {
  font-family: var(--serif-display);
  font-size: 30px;
  line-height: 1;
}

.footer-blurb {
  margin-top: 14px;
  color: var(--muted);
  font-size: 15px;
  max-width: 44ch;
}

.footer h3 {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 400;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.footer-list {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: var(--serif-text);
  font-style: italic;
  font-size: 15px;
  color: var(--ink);
}

.footer-col-text { margin-top: 12px; color: var(--muted); font-size: 15px; }

/* ============================================================
   Detail (reading view)
   ============================================================ */
.detail {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  animation: detail-in 0.28s cubic-bezier(0.2, 0.7, 0.3, 1);
}

.detail[hidden] { display: none; }

@keyframes detail-in {
  from { transform: translateY(24px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.detail-top {
  border-bottom: 2px solid var(--ink);
  background: var(--paper);
  flex: none;
}

.detail-top-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
  padding-block: 12px;
}

.detail-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.zebra-mini {
  width: 30px; height: 8px;
  background: repeating-linear-gradient(90deg, var(--ink) 0 8px, transparent 8px 16px);
}

.btn-close { flex: none; }

.detail-scroll { overflow-y: auto; flex: 1; overscroll-behavior: contain; }

.article {
  max-width: 760px;
  margin-inline: auto;
  padding: clamp(36px, 5vw, 64px) var(--gutter) 24px;
}

.article-kicker { justify-content: flex-start; }

.article-title {
  font-family: var(--serif-display);
  font-weight: 400;
  font-size: clamp(32px, 4.6vw, 58px);
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin-top: 16px;
  text-wrap: balance;
}

.article-dek {
  margin-top: 20px;
  font-size: clamp(18px, 1.9vw, 22px);
  line-height: 1.5;
  font-style: italic;
  color: var(--muted);
  max-width: 46ch;
}

.article-byline {
  margin-top: 26px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  align-items: baseline;
}


.article-figure {
  margin-top: clamp(28px, 4vw, 44px);
  display: grid;
  grid-template-columns: minmax(200px, 300px) 1fr;
  gap: clamp(16px, 2.6vw, 32px);
  align-items: end;
}

.article-figure .frame {
  border: 1.5px solid var(--ink);
  padding: 8px;
  background: var(--paper-deep);
}

.article-figure img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  filter: saturate(0.94);
}

.article-caption {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  line-height: 1.7;
  color: var(--muted);
  text-transform: uppercase;
  padding-bottom: 4px;
}

.article-caption strong { color: var(--ink); font-weight: 400; }

.article-body {
  margin-top: clamp(32px, 4.5vw, 52px);
  font-size: clamp(17px, 1.55vw, 19px);
  line-height: 1.72;
}

.article-body p { max-width: 64ch; }
.article-body p + p { margin-top: 1.35em; }
.article-body p:first-of-type::first-letter {
  font-family: var(--serif-display);
  font-size: 3.4em;
  float: left;
  line-height: 0.82;
  padding: 0.06em 0.12em 0 0;
  color: var(--accent);
}

.article-end {
  margin-top: 40px;
  padding-top: 22px;
  border-top: 2px solid var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.article-end .end-note {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

/* save toggle inside detail */
.save-toggle {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: 1.5px solid var(--ink);
  padding: 12px 20px 11px;
  border-radius: 2px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.save-toggle svg { width: 13px; height: 15px; flex: none; }

.save-toggle .bookmark-fill { display: none; }

.save-toggle[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-ink);
}
.save-toggle[aria-pressed="true"] .bookmark-fill { display: block; }
.save-toggle[aria-pressed="true"] .bookmark-line { display: none; }
.save-toggle:hover { border-color: var(--accent); color: var(--accent); }
.save-toggle[aria-pressed="true"]:hover { color: var(--on-ink); }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1020px) {
  .lead { grid-template-columns: 380px 1fr; }
}

@media (max-width: 840px) {
  :root { --gutter: 20px; }

  .masthead-brand { flex-direction: column; align-items: flex-start; gap: 6px; padding: 22px 0 24px; }
  .tagline { text-align: left; max-width: 26ch; padding-bottom: 0; }

  .toolbar-inner { gap: 16px; }
  .count { margin-left: 0; width: 100%; order: 5; padding-bottom: 0; }

  .lead {
    grid-template-columns: 1fr;
    padding-block: 28px 36px;
  }
  .lead-media { max-width: 520px; }
  .lead-media img { aspect-ratio: 16 / 10; }

  .row { grid-template-columns: 40px 1fr 84px; gap: 14px; padding-block: 22px; }
  .row-no { font-size: 16px; }
  .row-thumb img { aspect-ratio: 3 / 4; }

  .article-figure { grid-template-columns: 1fr; }
  .article-figure .frame { max-width: 340px; }

  .footer-inner { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
}

@media (max-width: 480px) {
  .row { grid-template-columns: 32px 1fr; }
  .row-thumb { display: none; }
  .field-search, .field-topic { flex: 1 1 100%; }
  .field input, .field select { font-size: 16px; }
  .toolbar .chip { width: 100%; justify-content: center; }
  .footer-inner { grid-template-columns: 1fr; }
  .article-end { flex-direction: column; align-items: flex-start; }
}

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