/* ============================================================
   KERBSIDE — a journal of ordinary streets
   Thesis: newsprint warmth, road-marking discipline.
   Signature: the kerb double-rule + mono street-plate labels.
   ============================================================ */

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

:root {
  --paper: #F4EEE1;
  --paper-2: #ECE3D0;
  --ink: #221D14;
  --ink-2: #4C4536;
  --muted: #7B7160;
  --line: rgba(34, 29, 20, .22);
  --line-strong: rgba(34, 29, 20, .5);
  --accent: #B03A1E;
  --accent-ink: #8E2D14;
  --paper-on-ink: #F4EEE1;
  --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;
  --gutter: 32px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif-text);
  font-size: 16px;
  line-height: 1.55;
}

body.locked { overflow: hidden; }

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

img { display: block; }

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

.skip-link {
  position: absolute;
  left: 16px; top: -48px;
  z-index: 200;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 12px;
  padding: 10px 16px;
  text-decoration: none;
  transition: top .15s ease;
}
.skip-link:focus { top: 12px; }

.shell {
  max-width: 1360px;
  margin: 0 auto;
  padding-inline: var(--gutter);
}

/* ---------- The signature: kerb double-rule ---------- */
.kerb {
  height: 7px;
  border-top: 3px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}
.kerb--accent { border-top-color: var(--accent); border-bottom-color: var(--accent); }

/* ---------- Masthead ---------- */
.topstrip {
  background: var(--ink);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px var(--gutter);
  max-width: none;
}

.wordmark-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 40px;
  padding-top: 44px;
  padding-bottom: 26px;
}

.wordmark {
  margin: 0;
  font-family: var(--serif-display);
  font-weight: 400;
  font-size: clamp(58px, 10.5vw, 148px);
  line-height: .86;
  letter-spacing: -.015em;
}

.masthead-note {
  margin: 0 0 6px;
  max-width: 300px;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.7;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-2);
}

/* ---------- Toolbar ---------- */
.toolbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: flex-end;
  gap: 28px;
  padding-top: 18px;
  padding-bottom: 14px;
  background: var(--paper);
  border-bottom: 1px solid var(--ink);
}

.tool-label,
.tool label {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 7px;
}

#search {
  width: min(340px, 100%);
  font-family: var(--mono);
  font-size: 14px;
  color: var(--ink);
  padding: 7px 2px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  border-radius: 0;
}
#search::placeholder { color: var(--muted); }
#search:focus {
  outline: none;
  border-bottom: 2px solid var(--accent);
  margin-bottom: -1px;
}

#filter {
  appearance: none;
  -webkit-appearance: none;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink);
  padding: 7px 30px 7px 2px;
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='7'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23221D14' stroke-width='1.5' fill='none'/%3E%3C/svg%3E") no-repeat right 6px center;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  border-radius: 0;
  cursor: pointer;
}
#filter:focus {
  outline: none;
  border-bottom: 2px solid var(--accent);
  margin-bottom: -1px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--ink);
  border-radius: 0;
  padding: 10px 14px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.btn:hover { background: var(--ink); color: var(--paper); }
.btn:focus-visible,
#search:focus-visible,
#filter:focus-visible,
.title-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.toggle[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.toggle[aria-pressed="true"] svg path { fill: currentColor; }

.count {
  margin: 0 0 10px auto;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

/* ---------- Story grid ---------- */
.browse { padding-bottom: 24px; }

.grid { padding-top: 32px; }

.grid--issue {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 30px 28px;
}
.grid--flat {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 30px 28px;
}

.card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  background: transparent;
  transition: border-color .15s ease;
}
.card:hover { border-color: var(--line-strong); }

.v-lead   { grid-column: span 8; }
.v-tall   { grid-column: span 4; grid-row: span 2; }
.v-wide   { grid-column: span 5; }
.v-mid    { grid-column: span 4; }
.v-small  { grid-column: span 3; }
.v-strip  { grid-column: 1 / -1; }

.grid--flat .card { grid-column: auto; grid-row: auto; }

.card-media {
  position: relative;
  margin: 0;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}
.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.v-lead  .card-media { aspect-ratio: 16 / 8.4; }
.v-wide  .card-media,
.v-mid   .card-media { aspect-ratio: 3 / 2; }
.v-small .card-media { aspect-ratio: 4 / 5; }
.v-tall  .card-media { flex: 1; min-height: 380px; }

.card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 12px;
  padding: 18px 20px 20px;
}

.kicker {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin: 0;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .13em;
  text-transform: uppercase;
}
.kicker-no { color: var(--accent); font-weight: 700; }
.kicker-cat { color: var(--ink); }
.kicker-min { color: var(--muted); margin-left: auto; }

.card-title { margin: 0; }
.title-btn {
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  display: block;
  width: 100%;
  text-align: left;
  font-family: var(--serif-display);
  font-weight: 400;
  color: inherit;
  cursor: pointer;
  line-height: 1.12;
  letter-spacing: .002em;
}
.title-btn:hover {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
}
.v-lead  .title-btn { font-size: clamp(30px, 3vw, 44px); }
.v-wide  .title-btn,
.v-mid   .title-btn { font-size: 25px; }
.v-small .title-btn { font-size: 21px; }
.v-ink   .title-btn { font-size: 24px; }
.v-strip .title-btn { font-size: clamp(24px, 2.4vw, 32px); }

.card-summary {
  margin: 0;
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink-2);
}

.card-meta {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin: 16px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}
.card-meta time { margin-left: auto; }

.saved-flag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--accent);
  font-weight: 700;
}
.saved-flag svg path { fill: currentColor; }

/* Typographic cards — the numeral device */
.v-ink {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper-on-ink);
}
.v-ink:hover { border-color: var(--ink); }
.v-ink .kicker-cat { color: var(--paper-on-ink); }
.v-ink .kicker-min { color: rgba(244, 238, 225, .55); }
.v-ink .card-summary { color: rgba(244, 238, 225, .78); }
.v-ink .card-meta { color: rgba(244, 238, 225, .6); border-top-color: rgba(244, 238, 225, .25); }
.v-ink .numeral {
  font-family: var(--serif-display);
  font-size: 92px;
  line-height: .9;
  color: var(--accent);
  margin: 4px 0 2px;
}

.v-strip {
  flex-direction: row;
  align-items: center;
  gap: 28px;
  padding: 22px 28px;
}
.v-strip .numeral {
  font-family: var(--serif-display);
  font-size: 84px;
  line-height: .85;
  flex: none;
  color: var(--accent);
}
@supports (-webkit-text-stroke: 1px black) {
  .v-strip .numeral {
    color: transparent;
    -webkit-text-stroke: 1.5px var(--accent);
  }
}
.v-strip .card-summary { margin-top: 8px; max-width: 60ch; }
.v-strip .card-meta { border-top: 0; padding-top: 0; margin-left: auto; text-align: right; flex: none; }
.card-strip-body { min-width: 0; }

/* In the filtered (flat) grid the tall card behaves like a normal card */
.grid--flat .v-tall .card-media { flex: none; min-height: 0; aspect-ratio: 3 / 2; }

/* ---------- Empty state ---------- */
.empty {
  margin: 48px 0 64px;
  padding: 64px 24px;
  border: 1px solid var(--line);
  text-align: center;
}
.empty-plate {
  display: inline-block;
  margin: 0 0 18px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--paper);
  background: var(--ink);
  padding: 8px 14px;
}
.empty-title {
  margin: 0 0 10px;
  font-family: var(--serif-display);
  font-weight: 400;
  font-size: clamp(26px, 3.4vw, 38px);
}
.empty-note {
  margin: 0 0 26px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--muted);
}

/* ---------- Footer ---------- */
.footer {
  margin-top: 88px;
  background: var(--ink);
  color: var(--paper-on-ink);
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 0.8fr 1.2fr;
  gap: 48px;
  padding-top: 64px;
  padding-bottom: 48px;
}
.footer-wordmark {
  margin: 0;
  font-family: var(--serif-display);
  font-size: clamp(30px, 3.4vw, 46px);
  line-height: 1;
}
.footer-line {
  margin: 10px 0 0;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
}
.footer-head {
  margin: 0 0 12px;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: rgba(244, 238, 225, .55);
}
.footer-col p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.7;
  color: rgba(244, 238, 225, .78);
  max-width: 34ch;
}
.footer-topics {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.footer-topic {
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(244, 238, 225, .85);
  cursor: pointer;
  text-align: left;
}
.footer-topic:hover { color: var(--accent); }
.footer-topic:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.footer-topic span { color: rgba(244, 238, 225, .45); }
.footer-bottom {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-top: 16px;
  padding-bottom: 18px;
  border-top: 1px solid rgba(244, 238, 225, .25);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(244, 238, 225, .55);
}

/* ---------- Detail / reading sheet ---------- */
.detail-root { position: fixed; inset: 0; z-index: 100; }

.detail {
  position: absolute;
  inset: 0;
  background: var(--paper);
  overflow-y: auto;
  overscroll-behavior: contain;
}

@media (prefers-reduced-motion: no-preference) {
  .detail { animation: sheet-in .28s ease both; }
  @keyframes sheet-in {
    from { transform: translateY(24px); opacity: 0; }
    to   { transform: none; opacity: 1; }
  }
}

.detail-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px var(--gutter);
  background: var(--paper);
  border-bottom: 1px solid var(--ink);
}
.detail-bar-brand {
  margin: 0;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.detail-bar-brand span { color: var(--accent); }
.detail-bar-actions { display: flex; gap: 10px; }

.save-btn[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--paper);
}
.save-btn[aria-pressed="true"]:hover { background: var(--accent-ink); border-color: var(--accent-ink); }

.detail-article {
  max-width: 760px;
  margin: 0 auto;
  padding: 44px 24px 88px;
}

.detail-kicker {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin: 0 0 20px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.detail-kicker .kicker-no { color: var(--accent); font-weight: 700; }
.detail-kicker .kicker-min { color: var(--muted); }

#detail-title {
  margin: 0 0 22px;
  font-family: var(--serif-display);
  font-weight: 400;
  font-size: clamp(38px, 5.2vw, 62px);
  line-height: 1.04;
  letter-spacing: -.005em;
}

.detail-standfirst {
  margin: 0 0 26px;
  font-size: 20px;
  line-height: 1.55;
  font-style: italic;
  color: var(--ink-2);
}

.detail-byline {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  padding: 14px 0;
  margin-bottom: 34px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}
.detail-byline strong { color: var(--ink); font-weight: 700; }

.detail-media {
  margin: 0 0 30px;
}
.detail-media img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border: 1px solid var(--line);
}
.detail-media figcaption {
  padding-top: 10px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

.prose p {
  margin: 0 0 26px;
  font-size: 18px;
  line-height: 1.72;
  max-width: 66ch;
}
.prose p:first-of-type::first-letter {
  font-family: var(--serif-display);
  font-size: 76px;
  line-height: .78;
  float: left;
  padding: 8px 12px 0 0;
  color: var(--accent);
}

.detail-end {
  margin-top: 40px;
}
.detail-end .kerb { margin-bottom: 24px; }
.detail-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .grid--issue { grid-template-columns: repeat(6, 1fr); }
  .v-lead, .v-strip { grid-column: span 6; }
  .v-wide, .v-mid, .v-small, .v-ink { grid-column: span 3; }
  .v-tall { grid-column: span 3; grid-row: auto; }
  .v-tall .card-media { flex: none; min-height: 0; aspect-ratio: 3 / 4; }
  .v-lead .card-media { aspect-ratio: 16 / 9; }
  .grid--flat { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 680px) {
  :root { --gutter: 20px; }
  .topstrip { flex-wrap: wrap; gap: 4px 16px; padding-block: 8px; }
  .wordmark-row { flex-direction: column; align-items: flex-start; gap: 14px; padding-top: 28px; padding-bottom: 20px; }
  .masthead-note { max-width: none; margin-bottom: 0; }
  .toolbar { flex-wrap: wrap; align-items: flex-end; gap: 14px 20px; padding-top: 14px; }
  .tool-search { width: 100%; }
  #search { width: 100%; }
  .tool-topic { flex: 1; }
  .count { margin-left: 0; width: 100%; order: 10; }
  .grid, .grid--issue, .grid--flat { grid-template-columns: 1fr; }
  .grid--issue .card, .grid--flat .card { grid-column: auto; grid-row: auto; }
  .v-tall .card-media { aspect-ratio: 3 / 2; }
  .v-small .card-media { aspect-ratio: 3 / 2; }
  .card-body { padding: 16px 16px 18px; }
  .v-strip { flex-direction: column; align-items: flex-start; gap: 14px; padding: 20px; }
  .v-strip .numeral { font-size: 56px; }
  .v-strip .card-meta { margin-left: 0; text-align: left; }
  .v-ink .numeral { font-size: 64px; }
  .grid { padding-top: 24px; }
  .footer { margin-top: 64px; }
  .footer-grid { grid-template-columns: 1fr; gap: 32px; padding-top: 48px; }
  .footer-col p { max-width: none; }
  .detail-article { padding: 30px 20px 64px; }
  .detail-bar { padding-inline: 20px; }
  .detail-bar-brand { font-size: 10px; }
  .btn { padding: 9px 11px; }
  .detail-nav { flex-direction: column; }
  .detail-nav .btn { justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
