/* ============================================================
   KERBSIDE — a journal of everyday city life
   Direction: Nordic Minimal (EDITORIAL-QUIET)
   Overrides: dense ruled survey-index grammar · oversized
   observation numbering · full-bleed inverted interlude
   ============================================================ */

@font-face {
  font-family: 'Space Grotesk';
  src: url('assets/space-grotesk.ttf') format('truetype');
  font-weight: 300 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: 'IBM Plex Mono';
  src: url('assets/ibm-plex-mono.ttf') format('truetype');
  font-weight: 400 700;
  font-display: swap;
}

:root {
  --bg: #EDEAE3;
  --surface: #F5F2EB;
  --paper: #F4F1EA;
  --ink: #20242A;
  --muted: #5E5C54;
  --faint: #8B887D;
  --line: #C7C2B4;
  --line-strong: #A9A496;
  --accent: #AC3E10;
  --accent-deep: #8F320C;
  --accent-ink: #FDFBF6;
  --birch: #D9C7A7;
  --f-display: 'Space Grotesk', 'Helvetica Neue', system-ui, sans-serif;
  --f-body: 'Literata', Georgia, 'Times New Roman', serif;
  --f-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --pad-x: clamp(20px, 4vw, 48px);
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }
html, body { overflow-x: clip; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.65 var(--f-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.locked { overflow: hidden; }

img { display: block; max-width: 100%; }
figure { margin: 0; }
blockquote { margin: 0; }
dl, dt, dd { margin: 0; }

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

.wrap {
  max-width: 1240px;
  margin-inline: auto;
  padding-inline: var(--pad-x);
}

/* ---------- focus & press ---------- */

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button { font: inherit; }

/* ---------- topline ---------- */

.topline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 28px;
  padding-block: 8px;
  border-bottom: 1px solid var(--line);
  font: 400 12px/1.4 var(--f-mono);
  letter-spacing: 0.04em;
  color: var(--muted);
}
.topline p { margin: 0; padding-block: 4px; }
.topline nav {
  display: flex;
  gap: 4px;
  margin-inline: auto;
}
.topline nav a {
  display: inline-block;
  padding: 13px 12px;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1.5px solid transparent;
  transition: border-color 0.18s var(--ease), color 0.18s var(--ease);
}
.clockwrap { font-variant-numeric: tabular-nums; }
.clockwrap span { color: var(--ink); font-weight: 600; }

/* ---------- masthead ---------- */

.masthead { padding-block: clamp(40px, 6vw, 84px) clamp(36px, 4vw, 56px); }

.wordmark {
  margin: 0;
  font: 700 clamp(58px, 12.5vw, 170px)/0.9 var(--f-display);
  letter-spacing: -0.035em;
  text-transform: uppercase;
  color: var(--ink);
}
.mark {
  display: inline-block;
  width: 0.13em;
  height: 0.13em;
  margin-left: 0.07em;
  background: var(--accent);
}

.mast-sub {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: clamp(28px, 4vw, 64px);
  align-items: start;
  margin-top: clamp(28px, 4vw, 52px);
  padding-top: clamp(20px, 2.5vw, 32px);
  border-top: 2px solid var(--ink);
}

.standfirst {
  margin: 0 0 28px;
  font: 400 clamp(18px, 1.6vw, 21px)/1.55 var(--f-body);
  max-width: 54ch;
}
.standfirst strong { font-weight: 600; }

.facts { border-top: none; }
.facts > div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding-block: 12px;
  border-bottom: 1px solid var(--line);
}
.facts dt {
  font: 500 11.5px/1.4 var(--f-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.facts dd {
  font: 600 clamp(30px, 3.2vw, 44px)/1 var(--f-display);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.facts dd small {
  font: 500 13px var(--f-mono);
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-left: 4px;
}

.mast-cta { margin-top: 24px; }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  padding: 11px 22px;
  font: 500 15px/1.2 var(--f-display);
  letter-spacing: 0.01em;
  border: 1.5px solid var(--ink);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.18s var(--ease), color 0.18s var(--ease),
    border-color 0.18s var(--ease);
}
.btn-solid {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.btn-ghost { border-color: var(--line-strong); }

/* ---------- controls ---------- */

.controls {
  border-top: 2px solid var(--ink);
  padding-block: 26px 6px;
  margin-top: clamp(28px, 4vw, 56px);
}
.controls-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px 250px;
  gap: 20px 24px;
  align-items: end;
}
.control label,
.control .control-label {
  display: block;
  margin-bottom: 8px;
  font: 500 11.5px/1.4 var(--f-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.control input,
.control select {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  font: 400 16px/1.3 var(--f-display);
  color: var(--ink);
  background: var(--paper);
  border: 1.5px solid var(--line-strong);
  border-radius: 0;
  transition: border-color 0.18s var(--ease), background-color 0.18s var(--ease);
}
.control select { cursor: pointer; }
.control input::placeholder { color: var(--faint); }
.control input:focus-visible, .control select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}
.control-toggle .btn { width: 100%; justify-content: center; }

.count {
  margin: 18px 0 0;
  font: 400 12.5px/1.5 var(--f-mono);
  letter-spacing: 0.05em;
  color: var(--muted);
}
.noscript-note { padding-block: 24px 8px; }

/* ---------- index list ---------- */

.index {
  list-style: none;
  margin: 22px 0 0;
  padding: 0;
  border-top: 1px solid var(--line);
}
.entry {
  display: grid;
  grid-template-columns: 108px 96px minmax(0, 1fr) 150px;
  grid-template-areas: "obs thumb main aside";
  gap: clamp(16px, 2.5vw, 30px);
  align-items: start;
  padding: 28px 14px;
  border-bottom: 1px solid var(--line);
  transition: background-color 0.18s var(--ease);
}
.obs { grid-area: obs; }
.thumb { grid-area: thumb; }
.entry-main { grid-area: main; }
.entry-aside { grid-area: aside; }
.obs {
  margin: 2px 0 0;
  font: 600 clamp(40px, 4.5vw, 58px)/1 var(--f-mono);
  font-variant-numeric: tabular-nums;
  color: var(--line-strong);
  transition: color 0.2s var(--ease);
}
.thumb {
  width: 96px;
  height: 96px;
  object-fit: cover;
  filter: sepia(0.14) saturate(0.92);
  transition: filter 0.2s var(--ease);
}
.entry-main { min-width: 0; }
.entry-aside {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  align-self: stretch;
  min-width: 0;
}
.entry-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin: 0 0 10px;
  font: 400 12px/1.4 var(--f-mono);
  letter-spacing: 0.05em;
  color: var(--muted);
}
.tag {
  padding: 3px 9px;
  border: 1px solid var(--line-strong);
  font: 500 10.5px/1.4 var(--f-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
}
.entry-title { margin: 0; }
.entry-title .open {
  appearance: none;
  background: none;
  border: 0;
  padding: 6px 0;
  margin: 0;
  display: block;
  width: 100%;
  min-height: 44px;
  text-align: left;
  cursor: pointer;
  color: var(--ink);
  font: 600 clamp(21px, 2.2vw, 28px)/1.18 var(--f-display);
  letter-spacing: -0.02em;
  transition: color 0.18s var(--ease);
}
.arr2 {
  display: inline-block;
  color: var(--muted);
  font: 400 26px/1 var(--f-display);
  transition: transform 0.2s var(--ease), color 0.2s var(--ease);
}
.entry-sum {
  margin: 8px 0 10px;
  max-width: 64ch;
  font: 400 16px/1.6 var(--f-body);
  color: var(--muted);
}
.entry-by {
  margin: 0;
  font: 400 12px/1.6 var(--f-mono);
  letter-spacing: 0.04em;
  color: var(--muted);
}
.savedchip {
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 10.5px;
}

/* ---------- empty state ---------- */

.empty {
  margin-top: 22px;
  border: 1.5px solid var(--line-strong);
  border-left: 6px solid var(--accent);
  background: var(--surface);
  padding: clamp(28px, 4vw, 48px);
}
.empty-title {
  margin: 0 0 8px;
  font: 600 clamp(22px, 2.6vw, 30px)/1.15 var(--f-display);
  letter-spacing: -0.02em;
}
.empty-body {
  margin: 0 0 20px;
  max-width: 52ch;
  color: var(--muted);
}

/* ---------- interlude (full-bleed inverted band) ---------- */

.interlude {
  margin-top: clamp(64px, 8vw, 120px);
  background: var(--ink);
  color: #EFEBE2;
  padding-block: clamp(64px, 8vw, 110px);
}
.interlude-label {
  margin: 0 0 20px;
  font: 500 11.5px/1.4 var(--f-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--birch);
}
.quote {
  margin: 0 0 28px;
  max-width: 22ch;
  font: 500 clamp(30px, 4.6vw, 56px)/1.12 var(--f-display);
  letter-spacing: -0.025em;
}
.quotelink {
  appearance: none;
  background: none;
  border: 0;
  padding: 10px 0;
  min-height: 44px;
  cursor: pointer;
  color: #EFEBE2;
  font: 500 14px/1.4 var(--f-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-bottom: 1.5px solid var(--birch);
  transition: color 0.18s var(--ease), border-color 0.18s var(--ease);
}

/* ---------- colophon ---------- */

.colophon {
  border-top: 2px solid var(--ink);
  padding-block: clamp(48px, 6vw, 80px) 28px;
}
.colophon-grid {
  display: grid;
  grid-template-columns: 1.1fr 1.4fr 0.7fr;
  gap: 32px 48px;
}
.colophon-label {
  margin: 0 0 10px;
  font: 500 11.5px/1.4 var(--f-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.colophon p { margin: 0; font-size: 15px; line-height: 1.65; color: var(--muted); }
.colophon p + p { margin-top: 10px; }
.colophon ul { list-style: none; margin: 0; padding: 0; }
.colophon ul a {
  display: inline-block;
  padding-block: 10px;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--line-strong);
  transition: color 0.18s var(--ease), text-decoration-color 0.18s var(--ease);
}
.baseline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  margin-top: clamp(40px, 5vw, 64px);
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font: 400 12px/1.5 var(--f-mono);
  letter-spacing: 0.05em;
  color: var(--muted);
}
.baseline a { color: var(--ink); padding-block: 8px; display: inline-block; }

/* ---------- detail view ---------- */

.detail {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  overflow-y: auto;
}
.detail[hidden] { display: none; }

.detail-bar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 12px var(--pad-x);
  background: rgba(244, 241, 234, 0.94);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.detail-plate {
  margin: 0;
  font: 500 12px/1.4 var(--f-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.detail-inner {
  width: min(720px, 100% - 2 * var(--pad-x));
  margin-inline: auto;
  padding-block: clamp(36px, 5vw, 56px) 40px;
  flex: 1;
}
.detail-title {
  margin: 0 0 14px;
  font: 600 clamp(29px, 4.6vw, 46px)/1.08 var(--f-display);
  letter-spacing: -0.025em;
}
.detail-meta {
  margin: 0 0 30px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
  font: 400 12.5px/1.6 var(--f-mono);
  letter-spacing: 0.05em;
  color: var(--muted);
}
.detail-fig { margin-bottom: 36px; }
.detail-fig img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  filter: sepia(0.12) saturate(0.95);
}
.detail-fig figcaption {
  margin-top: 10px;
  font: 400 11.5px/1.6 var(--f-mono);
  letter-spacing: 0.04em;
  color: var(--muted);
}
.detail-body p {
  margin: 0 0 1.4em;
  max-width: 66ch;
  font: 400 18.5px/1.75 var(--f-body);
}
.detail-body p:first-child::first-letter {
  float: left;
  padding: 8px 12px 0 0;
  font: 600 3.3em/0.8 var(--f-display);
  color: var(--accent);
}
.detail-savebar {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px 24px;
  padding: 12px var(--pad-x);
  background: rgba(244, 241, 234, 0.95);
  backdrop-filter: blur(6px);
  border-top: 1px solid var(--line);
}
.savebar-label {
  margin: 0;
  font: 500 12px/1.5 var(--f-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
#saveItem { border-color: var(--ink); }
#saveItem[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

/* ---------- hover states (fine pointers only) ---------- */

@media (hover: hover) and (pointer: fine) {
  .topline nav a:hover {
    color: var(--accent);
    border-bottom-color: var(--accent);
  }
  .btn-solid:hover { background: var(--accent-deep); border-color: var(--accent-deep); }
  .btn-ghost:hover { background: var(--ink); border-color: var(--ink); color: var(--bg); }
  #saveItem[aria-pressed="true"]:hover { background: var(--accent-deep); border-color: var(--accent-deep); }
  .entry:hover { background: var(--surface); }
  .entry:hover .obs { color: var(--accent); -webkit-text-stroke-color: var(--accent); }
  @supports not (-webkit-text-stroke: 1.5px black) {
    .entry:hover .obs { color: var(--accent); }
  }
  .entry:hover .thumb { filter: sepia(0) saturate(1.02); }
  .entry:hover .arr2 { transform: translateX(6px); color: var(--accent); }
  .entry-title .open:hover { color: var(--accent-deep); }
  .quotelink:hover { color: var(--birch); border-bottom-color: var(--birch); }
  .colophon ul a:hover { color: var(--accent-deep); text-decoration-color: var(--accent-deep); }
  .baseline a:hover { color: var(--accent-deep); }
  .control input:hover, .control select:hover { border-color: var(--ink); }
}

/* focus-within rows */
.entry:focus-within { background: var(--surface); }
.entry:focus-within .obs { color: var(--accent); -webkit-text-stroke-color: var(--accent); }

/* focus ring must stay visible on the dark interlude */
.interlude :focus-visible { outline-color: var(--birch); }
.entry:focus-within .arr2 { transform: translateX(6px); color: var(--accent); }

/* outline numerals: fill with the accent when the row is alive */
@supports (-webkit-text-stroke: 1.5px black) {
  .obs {
    color: transparent;
    -webkit-text-stroke: 1.5px var(--line-strong);
    transition: color 0.2s var(--ease), -webkit-text-stroke-color 0.2s var(--ease);
  }
}

/* ---------- press feedback ---------- */

.btn:active,
.quotelink:active,
.entry-title .open:active { transform: scale(0.97); }

/* ---------- entrances ---------- */

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
@keyframes fadein {
  from { opacity: 0; }
  to { opacity: 1; }
}
.wordmark { animation: rise 0.55s var(--ease) both; }
.mast-sub { animation: rise 0.55s var(--ease) 0.09s both; }
.topline { animation: fadein 0.5s var(--ease) both; }

/* ---------- responsive ---------- */

@media (max-width: 960px) {
  .mast-sub { grid-template-columns: 1fr; }
  .controls-grid { grid-template-columns: 1fr 1fr; }
  .control-search { grid-column: 1 / -1; }
  .entry {
    grid-template-columns: 84px 80px minmax(0, 1fr) 120px;
    grid-template-areas: "obs thumb main aside";
  }
  .thumb { width: 80px; height: 80px; }
  .colophon-grid { grid-template-columns: 1fr 1fr; }
  .colophon-grid > div:first-child { grid-column: 1 / -1; }
}

@media (max-width: 600px) {
  .topline nav { margin-inline: 0; }
  .controls-grid { grid-template-columns: 1fr; }
  .entry {
    grid-template-columns: 52px minmax(0, 1fr);
    grid-template-areas:
      "obs main"
      ". aside";
    padding: 22px 10px;
  }
  .thumb { display: none; }
  .obs { font-size: 34px; margin-top: 0; }
  .entry-aside {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    margin-top: 12px;
  }
  .arr2 { font-size: 20px; }
  .entry-sum { font-size: 15px; }
  .quote { max-width: none; }
  .colophon-grid { grid-template-columns: 1fr; }
  .detail-savebar { align-items: stretch; flex-direction: column; }
  .detail-savebar .btn { width: 100%; }
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .wordmark, .mast-sub, .topline { animation: none; }
  .entry, .obs, .thumb, .arr2, .btn, .quotelink,
  .entry-title .open, .control input, .control select,
  .topline nav a, .colophon ul a {
    transition: none;
  }
  .btn:active, .quotelink:active, .entry-title .open:active { transform: none; }
}
