/* KERB. Dark street-signage editorial. One theme (dark), one accent (signal yellow), all-sharp radii. */

@font-face {
  font-family: "Oswald";
  src: url("assets/oswald.ttf") format("truetype");
  font-display: swap;
  font-weight: 200 700;
}
@font-face {
  font-family: "Space Grotesk";
  src: url("assets/space-grotesk.ttf") format("truetype");
  font-display: swap;
  font-weight: 300 700;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("assets/ibm-plex-mono.ttf") format("truetype");
  font-display: swap;
  font-weight: 400 700;
}

:root {
  --bg: #14161b;
  --panel: #1b1e25;
  --panel-2: #20242d;
  --line: #2d323d;
  --text: #eceee7;
  --muted: #a6abb6;
  --faint: #8a909c;
  --accent: #f2c53d;
  --ink: #14161b;
  --font-display: "Oswald", "Arial Narrow", Arial, sans-serif;
  --font-body: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", "Courier New", monospace;
}

* { box-sizing: border-box; }

html { background: var(--bg); }

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

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

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

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

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

.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: -9999px;
  top: 0;
  z-index: 60;
  background: var(--accent);
  color: var(--ink);
  padding: 10px 18px;
  font-family: var(--font-mono);
  font-size: 13px;
}
.skip-link:focus { left: 0; }

.shell {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 28px;
}

/* ---------- Masthead ---------- */

.masthead-grid {
  padding-top: 56px;
  padding-bottom: 44px;
}

.kicker {
  margin: 0 0 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}

.wordmark {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(72px, 10vw, 132px);
  line-height: 0.95;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.wordmark-dot { color: var(--accent); }

.masthead-sub {
  margin: 18px 0 0;
  max-width: 54ch;
  color: var(--muted);
  font-size: 17px;
}

.banner {
  margin: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  height: 300px;
  overflow: hidden;
  position: relative;
}

.banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(0.35) contrast(1.05) brightness(0.72);
}

.banner::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(20, 22, 27, 0.25), rgba(20, 22, 27, 0) 35%, rgba(20, 22, 27, 0.85));
  pointer-events: none;
}

/* ---------- Toolbar ---------- */

.toolbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.toolbar-grid {
  display: flex;
  align-items: flex-end;
  gap: 22px;
  padding-top: 16px;
  padding-bottom: 16px;
}

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

.field-search { flex: 1 1 340px; }
.field-topic { flex: 0 1 210px; }

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

.field-input {
  font: inherit;
  font-size: 15px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 10px 12px;
  width: 100%;
}

.field-input::placeholder { color: var(--faint); }

.field-input:hover { border-color: #3c424f; }

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

.toolbar-end {
  display: flex;
  align-items: flex-end;
  gap: 18px;
  margin-left: auto;
}

.toggle-btn {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.06em;
  padding: 11px 16px;
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--panel);
  white-space: nowrap;
  transition: background-color 150ms ease, border-color 150ms ease;
}

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

.toggle-btn[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--ink);
  font-weight: 700;
}

.toggle-btn:active { transform: translateY(1px); }

.count {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  padding-bottom: 11px;
}

/* ---------- Story index ---------- */

.index { padding: 8px 0 24px; }

.row {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) auto;
  gap: 28px;
  align-items: baseline;
  padding: 30px 0;
  border-bottom: 1px solid var(--line);
  position: relative;
}

.row:first-child { border-top: 1px solid var(--line); }

.row-num {
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--faint);
  align-self: start;
  padding-top: 6px;
}

.row-topic {
  margin: 0 0 10px;
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 3px 8px;
}

.row-title { margin: 0; }

.row-link {
  display: inline;
  text-align: left;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 30px;
  line-height: 1.2;
  letter-spacing: 0.01em;
  color: var(--text);
  text-transform: uppercase;
  transition: color 150ms ease;
}

.row-link .arrow {
  display: inline-block;
  color: var(--faint);
  margin-left: 10px;
  transition: transform 150ms ease, color 150ms ease;
}

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

.row:hover .arrow,
.row-link:hover .arrow {
  color: var(--accent);
  transform: translate(2px, -2px);
}

.row-link:active { transform: translateY(1px); }

.row-summary {
  margin: 10px 0 0;
  max-width: 62ch;
  color: var(--muted);
  font-size: 15.5px;
}

.row-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--faint);
  white-space: nowrap;
  align-self: start;
  padding-top: 6px;
}

/* ---------- Empty state ---------- */

.empty {
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 56px 32px;
  text-align: center;
  margin: 32px 0 48px;
}

.empty-title {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.empty-body {
  margin: 0 0 24px;
  color: var(--muted);
}

/* ---------- Colophon ---------- */

.colophon {
  border-top: 1px solid var(--line);
  margin-top: 40px;
}

.colophon-grid {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  padding-top: 28px;
  padding-bottom: 36px;
  flex-wrap: wrap;
}

.colophon-brand {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 24px;
  text-transform: uppercase;
}

.colophon-note {
  margin: 0;
  max-width: 58ch;
  color: var(--faint);
  font-size: 13.5px;
}

/* ---------- Detail overlay ---------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(10, 11, 14, 0.72);
}

.dialog {
  position: absolute;
  inset: 0;
  margin: 0 auto;
  max-width: 860px;
  background: var(--bg);
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}

.dialog-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.dialog-topic {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

.dialog-actions { display: flex; gap: 10px; }

.save-btn,
.close-btn {
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  white-space: nowrap;
  transition: border-color 150ms ease, background-color 150ms ease;
}

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

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

.save-btn:active, .close-btn:active { transform: translateY(1px); }

.dialog-scroll { overflow-y: auto; flex: 1; }

.reader { padding: 44px 48px 56px; }

.reader-title {
  margin: 0 0 16px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(34px, 4.5vw, 52px);
  line-height: 1.12;
  text-transform: uppercase;
  letter-spacing: 0.01em;
}

.reader-meta {
  margin: 0 0 28px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted);
}

.reader-figure {
  margin: 0 0 32px;
  border: 1px solid var(--line);
}

.reader-figure img {
  width: 100%;
  height: 320px;
  object-fit: cover;
  filter: grayscale(0.35) contrast(1.05) brightness(0.82);
}

.reader-body p {
  margin: 0 0 20px;
  font-size: 17px;
  line-height: 1.75;
  color: var(--text);
  max-width: 64ch;
}

.reader-body p:first-child::first-letter {
  font-family: var(--font-display);
  font-size: 3.1em;
  font-weight: 600;
  float: left;
  line-height: 0.82;
  padding: 4px 12px 0 0;
  color: var(--accent);
}

.reader-foot {
  margin-top: 36px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

/* ---------- Motion ---------- */

@media (prefers-reduced-motion: no-preference) {
  .overlay:not([hidden]) .dialog {
    animation: dialog-in 220ms cubic-bezier(0.16, 1, 0.3, 1);
  }
  @keyframes dialog-in {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
  }
}

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

/* ---------- Mobile ---------- */

@media (max-width: 760px) {
  .shell { padding: 0 18px; }

  .masthead-grid { padding-top: 36px; padding-bottom: 30px; }
  .banner { height: 200px; }

  .toolbar-grid {
    flex-wrap: wrap;
    gap: 14px;
  }
  .field-search { flex: 1 1 100%; }
  .field-topic { flex: 1 1 60%; }
  .toolbar-end { margin-left: 0; flex: 1 1 100%; justify-content: space-between; align-items: center; }
  .count { padding-bottom: 0; }

  .row {
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 14px;
    padding: 24px 0;
  }
  .row-num { padding-top: 3px; }
  .row-meta {
    grid-column: 2;
    flex-direction: row;
    gap: 14px;
    text-align: left;
    padding-top: 12px;
  }
  .row-link { font-size: 23px; }

  .empty { padding: 40px 20px; }

  .dialog { border-left: none; border-right: none; }
  .dialog-bar { padding: 12px 18px; }
  .dialog-topic { display: none; }
  .dialog-actions { margin-left: auto; }
  .reader { padding: 28px 18px 44px; }
  .reader-figure img { height: 210px; }
  .reader-body p { font-size: 16px; }
}
