/* ============================================================
   Crosswalk, night edition.
   Design read: editorial city journal, transit-signage language.
   Theme lock: dark (asphalt) only. Sharp corners everywhere.
   One accent: signal yellow. Motion: small, motivated, gated.
   ============================================================ */

@font-face {
  font-family: "Space Grotesk";
  src: url("assets/space-grotesk.ttf") format("truetype");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Work Sans";
  src: url("assets/work-sans.ttf") format("truetype");
  font-weight: 100 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;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #131316;
  --bg-raise: #1A1A1F;
  --line: #2A2A30;
  --line-strong: #3A3A42;
  --text: #E9E7E0;
  --text-soft: #C9C6BE;
  --muted: #9C998F;
  --yellow: #F6C445;
  --yellow-ink: #16130B;
  --font-display: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Work Sans", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --wrap: 1320px;
  --pad-x: 40px;
}

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

[hidden] { display: none !important; }

html { color-scheme: dark; }

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

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

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

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

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

.skip {
  position: fixed;
  top: -60px;
  left: 16px;
  z-index: 60;
  padding: 10px 16px;
  background: var(--yellow);
  color: var(--yellow-ink);
  font-family: var(--font-mono);
  font-size: 13px;
  text-decoration: none;
  transition: top 0.2s;
}
.skip:focus { top: 12px; }

.noscript {
  padding: 24px;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text-soft);
}

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

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

.masthead-inner {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 14px var(--pad-x);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark { flex: none; }

.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 24px;
  letter-spacing: -0.02em;
  line-height: 1;
}

.masthead-tag {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted);
}

/* ---------- control strip ---------- */

.controls { border-bottom: 1px solid var(--line); }

.controls-inner {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 18px var(--pad-x) 22px;
  display: grid;
  grid-template-columns: minmax(240px, 2fr) minmax(180px, 1fr) auto minmax(120px, auto);
  gap: 20px 28px;
  align-items: end;
}

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

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

.control-input {
  width: 100%;
  background: var(--bg-raise);
  border: 1px solid var(--line-strong);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 14px;
  padding: 11px 14px;
  border-radius: 0;
}
.control-input::placeholder { color: #8B887F; }
.control-input:focus-visible {
  outline: 2px solid var(--yellow);
  outline-offset: 0;
  border-color: var(--yellow);
}

.selectwrap { position: relative; display: block; }

.selectwrap .control-input {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 36px;
}

.chevron {
  position: absolute;
  right: 12px;
  top: 50%;
  translate: 0 -50%;
  color: var(--muted);
  font-size: 13px;
  pointer-events: none;
}

.count {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted);
  text-align: right;
  padding-bottom: 13px;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.05em;
  padding: 11px 18px;
  border-radius: 0;
  transition: background-color 0.18s, color 0.18s, border-color 0.18s, translate 0.1s;
}
.btn:active { translate: 0 1px; }

.btn-primary {
  background: var(--yellow);
  color: var(--yellow-ink);
  font-weight: 400;
}
.btn-primary:hover { background: #FFD35E; }

.btn-ghost {
  border: 1px solid var(--line-strong);
  color: var(--text-soft);
}
.btn-ghost:hover { border-color: var(--yellow); color: var(--yellow); }

.saved-toggle[aria-pressed="true"] {
  background: var(--yellow);
  border-color: var(--yellow);
  color: var(--yellow-ink);
}
.saved-toggle[aria-pressed="true"]:hover { background: #FFD35E; }

.saved-num { color: inherit; }

/* ---------- layout shell ---------- */

#main {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 var(--pad-x);
}

/* ---------- featured story ---------- */

.featured {
  display: grid;
  grid-template-columns: 7fr 5fr;
  gap: 24px 56px;
  padding: 56px 0 64px;
  align-items: center;
}

.featured-copy { display: flex; flex-direction: column; align-items: flex-start; gap: 20px; }

.kicker {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--yellow);
}

.featured-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(34px, 3.2vw, 54px);
  line-height: 1.06;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.featured-summary {
  font-size: 18px;
  line-height: 1.65;
  color: var(--text-soft);
  max-width: 46ch;
}

.meta-line {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: baseline;
}
.meta-line .cat { color: var(--yellow); }
.meta-line .sep { color: var(--line-strong); }

.featured-media {
  border: 1px solid var(--line);
}

.featured-media img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  filter: grayscale(100%) contrast(1.06) brightness(0.9);
}

.featured:hover .featured-media img { filter: grayscale(25%) contrast(1.04) brightness(0.95); }

/* ---------- story grid ---------- */

.stories { padding: 8px 0 72px; }

.stories-heading {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 28px;
  letter-spacing: -0.01em;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 20px;
}

.span-3 { grid-column: span 3; }
.span-2 { grid-column: span 2; }
.span-6 { grid-column: span 6; }

.item {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--bg-raise);
  border: 1px solid var(--line);
  transition: border-color 0.18s;
}
.item:hover, .item:focus-within { border-color: var(--line-strong); }

.item-media { overflow: hidden; }

.item-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(100%) contrast(1.06) brightness(0.9);
}

.span-3 .item-media img, .span-6 .item-media img { aspect-ratio: 16 / 10; }
.span-2 .item-media img { aspect-ratio: 4 / 3; }
.span-6 .item-media img { aspect-ratio: 21 / 9; }

.item-body {
  padding: 16px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.item-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 21px;
  line-height: 1.22;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.item-title .open {
  text-align: left;
  font: inherit;
  color: inherit;
}
.item:hover .item-title .open, .item:focus-within .item-title .open { color: var(--yellow); }
.item:hover .item-media img { filter: grayscale(20%) contrast(1.04) brightness(0.95); }

/* stretched hit area for the whole card */
.item .open::after {
  content: "";
  position: absolute;
  inset: 0;
}

.item-summary {
  font-size: 15px;
  line-height: 1.55;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.item-meta .saved-flag { color: var(--yellow); }

mark {
  background: transparent;
  color: var(--yellow);
  text-decoration: underline 2px;
  text-underline-offset: 3px;
}

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

.empty {
  padding: 88px 0 104px;
  max-width: 56ch;
}

.empty-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(30px, 3vw, 44px);
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 14px;
}

.empty-copy {
  font-size: 17px;
  color: var(--text-soft);
  margin-bottom: 28px;
}

.empty-actions { display: flex; flex-wrap: wrap; gap: 12px; }

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

.detail {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--bg);
  overflow-y: auto;
  border-top: 4px solid var(--yellow);
}

.detail-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px var(--pad-x);
}

.detail-bar-left, .detail-bar-right { display: flex; align-items: center; gap: 12px; }

.detail-article {
  max-width: 720px;
  margin: 0 auto;
  padding: 56px 24px 96px;
}

.detail-meta {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: baseline;
  margin-bottom: 20px;
}
.detail-meta .cat { color: var(--yellow); }
.detail-meta .sep { color: var(--line-strong); }

.detail-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(32px, 4vw, 46px);
  line-height: 1.08;
  letter-spacing: -0.02em;
  text-wrap: balance;
  margin-bottom: 18px;
}

.detail-byline {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text-soft);
  margin-bottom: 36px;
}

.detail-figure { margin-bottom: 36px; }

.detail-figure img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  filter: grayscale(100%) contrast(1.06) brightness(0.9);
  border: 1px solid var(--line);
}

.detail-figure figcaption {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  padding-top: 10px;
}

.detail-body p {
  font-size: 17.5px;
  line-height: 1.75;
  color: #D6D3CC;
  margin-bottom: 1.25em;
}
.detail-body p:first-child { font-size: 19.5px; color: var(--text); }

/* ---------- footer ---------- */

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

.colophon-inner {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 40px var(--pad-x) 48px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 40px;
  flex-wrap: wrap;
}

.colophon-brand { display: flex; align-items: center; gap: 10px; }

.colophon-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.01em;
}

.colophon-notes { max-width: 52ch; }
.colophon-notes p {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.7;
}

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

@media (prefers-reduced-motion: no-preference) {
  .rise {
    animation: rise 0.55s cubic-bezier(0.16, 1, 0.3, 1) both;
    animation-delay: var(--d, 0ms);
  }
  @keyframes rise {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: none; }
  }
  .detail:not([hidden]) { animation: fade-in 0.24s ease-out both; }
  @keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
  }
  .featured-media img, .item-media img, .detail-figure img {
    transition: filter 0.4s ease;
  }
}

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

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

@media (max-width: 1020px) {
  :root { --pad-x: 28px; }
  .featured { grid-template-columns: 1fr; gap: 32px; padding: 44px 0 52px; }
  .featured-media img { aspect-ratio: 16 / 9; }
}

@media (max-width: 880px) {
  .controls-inner {
    grid-template-columns: 1fr 1fr;
    gap: 16px 16px;
  }
  .field-search { grid-column: 1 / -1; }
  .count { text-align: left; padding-bottom: 0; grid-column: 1 / -1; }
  .grid { grid-template-columns: 1fr; }
  .span-2, .span-3, .span-6 { grid-column: 1 / -1; }
  .item-media img { aspect-ratio: 16 / 9; }
}

@media (max-width: 620px) {
  :root { --pad-x: 20px; }
  .masthead-inner { padding: 12px var(--pad-x); }
  .brand-name { font-size: 21px; }
  .masthead-tag { display: none; }
  .controls-inner { grid-template-columns: 1fr; }
  .field-saved { justify-content: flex-start; }
  .field-saved .btn { align-self: flex-start; }
  .featured { padding: 32px 0 44px; }
  .featured-summary { font-size: 16.5px; }
  .detail-bar { flex-wrap: wrap; }
  .detail-bar-right { margin-left: auto; }
  .detail-article { padding: 36px 20px 72px; }
  .detail-body p { font-size: 16.5px; }
  .colophon-inner { flex-direction: column; gap: 20px; padding: 32px var(--pad-x) 40px; }
}
