/* ————————————————————————————————————————————————
   KERB — ink on cool paper, one ultramarine accent
   ———————————————————————————————————————————————— */

@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: "Plex Mono";
  src: url("assets/ibm-plex-mono.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}

:root {
  --paper: #f4f2ed;
  --paper-deep: #ece9e1;
  --ink: #17150f;
  --ink-soft: #4c483d;
  --ink-faint: rgba(23, 21, 15, 0.72);
  --hairline: rgba(23, 21, 15, 0.22);
  --accent: #2438c8;
  --accent-deep: #1c2ca0;
  --accent-tint: rgba(36, 56, 200, 0.08);
  --serif: "Literata", Georgia, "Times New Roman", serif;
  --sans: "Oswald", "Arial Narrow", sans-serif;
  --mono: "Plex Mono", "Courier New", monospace;
  --wrap: 1180px;
  --gutter: clamp(18px, 4vw, 48px);
  --speed: 220ms;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

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

body.locked { overflow: hidden; }

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

img { display: block; max-width: 100%; }

/* Photos print as grayscale halftone, never as documentary evidence */
.photo {
  filter: grayscale(1) contrast(1.08) brightness(1.03);
}

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

/* ——— masthead ——— */

.masthead { padding-top: 14px; }

.topline {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--hairline);
}

.wordmark-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: clamp(14px, 2.5vw, 30px) 0 clamp(12px, 2vw, 24px);
}

.wordmark {
  margin: 0;
  font-family: var(--sans);
  font-weight: 600;
  font-size: clamp(64px, 11vw, 148px);
  line-height: 0.86;
  letter-spacing: -0.015em;
  text-transform: uppercase;
  color: var(--ink);
}

.dot {
  display: inline-block;
  width: 0.14em;
  height: 0.14em;
  margin-left: 0.05em;
  background: var(--accent);
}

.dot-small { width: 0.35em; height: 0.35em; vertical-align: baseline; }

.wordmark-note {
  margin: 0 0 10px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
  color: var(--ink-soft);
  text-align: right;
}

.rule-heavy {
  border-top: 3px solid var(--ink);
  max-width: none;
}
.wrap-rule { max-width: none; }

/* ——— toolbar ——— */

.toolbar-holder {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--paper);
  border-bottom: 1px solid var(--hairline);
  box-shadow: 0 6px 14px -12px rgba(23, 21, 15, 0.5);
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  gap: clamp(14px, 2.5vw, 32px);
  align-items: end;
  padding-top: 12px;
  padding-bottom: 12px;
}

.field { display: grid; gap: 4px; }

.field label,
.field-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--ink);
  background: #fbfaf7;
  padding: 0 12px;
  min-height: 42px;
}

.search-box:focus-within {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.search-box .icon { width: 16px; height: 16px; color: var(--ink-soft); flex: none; }

#search-input {
  border: 0;
  background: transparent;
  font-family: var(--serif);
  font-size: 16px;
  color: var(--ink);
  width: 100%;
  min-width: 0;
  padding: 8px 0;
}
#search-input:focus { outline: none; }
#search-input::placeholder { color: var(--ink-faint); opacity: 1; }

select#filter-select {
  appearance: none;
  border: 1px solid var(--ink);
  background: #fbfaf7 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 8l5 5 5-5' fill='none' stroke='%2317150f' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 10px center / 14px;
  font-family: var(--serif);
  font-size: 16px;
  color: var(--ink);
  min-height: 42px;
  padding: 8px 36px 8px 12px;
  cursor: pointer;
}

#saved-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 8px 16px;
  border: 1px solid var(--ink);
  background: #fbfaf7;
  font-family: var(--serif);
  font-size: 15px;
  color: var(--ink);
  cursor: pointer;
}

#saved-toggle .icon { width: 15px; height: 15px; }

#saved-toggle:hover { background: var(--ink); color: var(--paper); }

#saved-toggle[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent-deep);
  color: var(--paper);
}

.saved-count {
  font-family: var(--mono);
  font-size: 11px;
  min-width: 20px;
  text-align: center;
  border: 1px solid currentColor;
  padding: 1px 4px;
}

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

.result-line {
  margin: 0;
  padding: 14px 0 4px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.03em;
  color: var(--ink-faint);
}

/* ——— lead story ——— */

.feature {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: clamp(20px, 3.5vw, 44px);
  align-items: stretch;
  padding: clamp(20px, 3.5vw, 36px) 0 clamp(22px, 3.5vw, 34px);
}

.feature-text { display: flex; flex-direction: column; }

.headline {
  margin: 0 0 14px;
  font-family: var(--sans);
  font-weight: 500;
  line-height: 1.04;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.open {
  appearance: none;
  border: 0;
  background: none;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  text-align: inherit;
  cursor: pointer;
}

.feature .headline { font-size: clamp(30px, 3.6vw, 46px); }

.open:hover { color: var(--accent); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }

.summary {
  margin: 0 0 18px;
  font-size: clamp(16px, 1.4vw, 18.5px);
  line-height: 1.55;
  color: var(--ink-soft);
  max-width: 58ch;
}

.byline {
  margin: auto 0 0;
  padding-top: 14px;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.02em;
  color: var(--ink-faint);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
}

.byline .sep { color: var(--hairline); }

.stamp {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink);
  border: 1px solid var(--ink);
  padding: 3px 9px;
  white-space: nowrap;
}

.stamp-accent { background: var(--accent); border-color: var(--accent-deep); color: var(--paper); }

.feature-figure { margin: 0; position: relative; }
.feature-figure img {
  width: 100%;
  height: 100%;
  min-height: 260px;
  object-fit: cover;
  border: 1px solid var(--ink);
}

/* ——— index rows ——— */

.index-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  border-top: 3px solid var(--ink);
  padding-top: 10px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) auto;
  gap: clamp(16px, 2.5vw, 30px);
  padding: 22px 0;
  border-bottom: 1px solid var(--hairline);
  align-items: start;
}

.row-thumb { margin: 0; }
.row-thumb img {
  width: 150px;
  height: 100px;
  object-fit: cover;
  border: 1px solid var(--ink);
}

.row .headline { font-size: clamp(21px, 2vw, 26px); margin-bottom: 8px; }
.row .summary { font-size: 15px; margin-bottom: 0; max-width: 62ch; }
.row .byline { margin-top: 10px; padding-top: 0; }

.row-meta {
  display: grid;
  gap: 6px;
  justify-items: end;
  text-align: right;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-faint);
  padding-top: 4px;
  min-width: 84px;
}

.saved-flag {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-deep);
  border: 1px solid var(--accent-deep);
  padding: 2px 7px;
}

/* ——— empty state ——— */

.empty-state {
  text-align: center;
  padding: clamp(48px, 9vw, 96px) 20px;
  border-top: 1px solid var(--hairline);
}

.empty-head {
  margin: 0 0 10px;
  font-family: var(--sans);
  font-weight: 500;
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.05;
}

.empty-copy {
  margin: 0 auto 26px;
  max-width: 44ch;
  color: var(--ink-soft);
}

/* ——— buttons ——— */

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 10px 16px;
  cursor: pointer;
}

.btn:hover { background: var(--ink); color: var(--paper); }

.btn-plain { border-color: transparent; background: transparent; padding-inline: 6px; }
.btn-plain:hover { background: transparent; color: var(--accent); }

/* ——— colophon ——— */

.colophon {
  margin-top: clamp(40px, 7vw, 80px);
  border-top: 3px solid var(--ink);
  background: var(--paper-deep);
}

.colophon .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 48px;
  align-items: baseline;
  justify-content: space-between;
  padding-top: 22px;
  padding-bottom: 34px;
}

.colophon-name {
  margin: 0;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 24px;
  text-transform: uppercase;
  letter-spacing: -0.01em;
}

.colophon p:last-child {
  margin: 0;
  max-width: 62ch;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.7;
  color: var(--ink-soft);
}

/* ——— detail (pulled-out article) ——— */

.detail-root { position: fixed; inset: 0; z-index: 50; }

.scrim {
  position: absolute;
  inset: 0;
  background: rgba(23, 21, 15, 0.5);
}

.detail {
  position: absolute;
  inset: 0;
  margin-inline: auto;
  width: min(820px, 100%);
  background: var(--paper);
  border-inline: 1px solid var(--ink);
  display: flex;
  flex-direction: column;
  transform: translateY(18px);
  opacity: 0;
  transition: transform var(--speed) var(--ease), opacity var(--speed) var(--ease);
}

.detail-root.is-open .detail { transform: translateY(0); opacity: 1; }

.progress {
  height: 3px;
  background: var(--paper-deep);
  flex: none;
}

.progress span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
}

.detail-bar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px clamp(14px, 3vw, 28px);
  border-bottom: 1px solid var(--hairline);
  background: var(--paper);
}

.btn-save { border: 1px solid var(--ink); }
.btn-save .icon { width: 14px; height: 14px; }

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

.detail-scroll {
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  scrollbar-width: thin;
  scrollbar-color: var(--ink-faint) transparent;
}

.detail-inner {
  max-width: 68ch;
  margin-inline: auto;
  padding: clamp(24px, 4vw, 44px) clamp(18px, 4vw, 32px) clamp(40px, 6vw, 72px);
}

.stamp-line { margin: 0 0 14px; }

.detail-title {
  margin: 0 0 14px;
  font-family: var(--sans);
  font-weight: 500;
  font-size: clamp(30px, 4.5vw, 44px);
  line-height: 1.06;
  letter-spacing: -0.01em;
  outline: none;
}

.detail-byline {
  margin: 0 0 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--hairline);
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-faint);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
}

.detail-title + .detail-byline { margin-top: 0; }

.detail-byline .stamp { transform: translateY(-1px); }

.detail-figure { margin: 0 0 26px; }
.detail-figure img {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border: 1px solid var(--ink);
}
.detail-figure figcaption {
  padding-top: 8px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.02em;
  color: var(--ink-faint);
}

.detail-body p {
  margin: 0 0 1.15em;
  font-size: 17.5px;
  line-height: 1.72;
}

.detail-body p:first-of-type::first-letter {
  font-family: var(--sans);
  font-weight: 500;
  float: left;
  font-size: 3.35em;
  line-height: 0.82;
  padding: 0.06em 0.12em 0 0;
  color: var(--accent);
}

.detail-next {
  margin-top: clamp(30px, 5vw, 48px);
  border-top: 3px solid var(--ink);
  padding-top: 14px;
}

.next-label {
  margin: 0 0 8px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.next-link {
  appearance: none;
  border: 0;
  background: none;
  padding: 0;
  font-family: var(--sans);
  font-weight: 500;
  font-size: clamp(20px, 2.5vw, 26px);
  line-height: 1.15;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.next-link::after { content: " →"; color: var(--accent); }
.next-link:hover { color: var(--accent); }

/* ——— skip link + visually hidden ——— */

.vh {
  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: 12px;
  top: -48px;
  z-index: 100;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 12px;
  padding: 10px 14px;
  transition: top var(--speed) var(--ease);
}
.skip-link:focus { top: 12px; }

/* ——— motion preferences ——— */

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

/* ——— responsive ——— */

@media (max-width: 900px) {
  .feature { grid-template-columns: 1fr; }
  .feature-figure { order: -1; }
  .feature-figure img { min-height: 0; aspect-ratio: 16 / 9; }
  .feature-text .byline { margin-top: 0; }
  .row { grid-template-columns: 110px minmax(0, 1fr); }
  .row-thumb img { width: 110px; height: 78px; }
  .row-meta { grid-column: 1 / -1; grid-template-columns: auto auto; justify-items: start; justify-content: start; text-align: left; padding-top: 0; }
}

@media (max-width: 640px) {
  .toolbar { grid-template-columns: 1fr auto; }
  .field-search { grid-column: 1 / -1; }
  .wordmark-row { flex-direction: column; align-items: flex-start; gap: 10px; }
  .wordmark-note { text-align: left; margin-bottom: 0; }
  .topline-mid { display: none; }
  .row { grid-template-columns: 96px minmax(0, 1fr); gap: 14px; padding: 18px 0; }
  .row-thumb img { width: 96px; height: 68px; }
  .row .headline { font-size: 20px; }
  .detail-bar .btn-plain .close-text { display: none; } /* icon-only; aria-label carries the name */
  .detail-bar .btn-plain { border: 1px solid var(--ink); padding: 8px 10px; }
  .btn, #saved-toggle, select#filter-select { min-height: 44px; }
}
