/* ==========================================================================
   CROSSTOWN — city journal
   Direction: transit-signage editorial. A visible route line runs through the
   masthead, the story index and the reading view. Mono labels, a tight
   grotesk display face, cool newsprint paper and one signal-vermilion accent.
   ========================================================================== */

/* --- Fonts (local) ------------------------------------------------------- */
@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: 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;
  font-style: normal;
  font-display: swap;
}

/* --- Tokens -------------------------------------------------------------- */
:root {
  --ink: #14161c;
  --ink-soft: #1f232d;
  --ink-line: #343a47;
  --paper: #eef0ec;
  --paper-2: #e3e6df;
  --surface: #ffffff;
  --text: #15171c;
  --muted: #5b626e;
  --muted-2: #69707d;
  --line: #d3d7cf;
  --line-strong: #a9b0a5;
  --accent: #ff3d1f;
  --accent-deep: #c8260b;
  --accent-tint: #ffe2da;
  --focus: #1b6ef3;

  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --display: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  --body: "Work Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --step: 8px;
  --page: 1320px;
  --gutter: 40px;
  --topbar-h: 60px;

  --radius: 2px;
  --radius-lg: 3px;

  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* --- Reset --------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { display: block; max-width: 100%; }
h1, h2, h3, p, ul, figure { margin: 0; }
ul { padding: 0; list-style: none; }
button { font: inherit; color: inherit; }
a { color: inherit; }

.wrap {
  width: 100%;
  max-width: var(--page);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.mono {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  font-weight: 400;
}

/* --- Focus --------------------------------------------------------------- */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
.topbar :focus-visible,
.hero :focus-visible,
.save-btn:focus-visible { outline-color: #7fb2ff; }

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 200;
  transform: translateY(-140%);
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  transition: transform 0.18s var(--ease);
}
.skip-link:focus { transform: translateY(0); }

/* ==========================================================================
   Top bar
   ========================================================================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  background: var(--ink);
  color: var(--paper);
  border-bottom: 1px solid var(--ink-line);
}
.topbar-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: var(--topbar-h);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--paper);
}
.brand-mark { width: 22px; height: 22px; color: var(--accent); flex: none; }
.brand-word {
  font-family: var(--display);
  font-weight: 600;
  font-size: 21px;
  letter-spacing: -0.02em;
}
.topbar-tag {
  flex: 1;
  color: #aeb4bf;
  font-size: 13px;
  letter-spacing: 0.02em;
  border-left: 1px solid var(--ink-line);
  padding-left: 20px;
}
.topbar-issue {
  font-size: 12px;
  color: #aeb4bf;
  white-space: nowrap;
}
.topbar-issue .mono { color: var(--paper); }

/* ==========================================================================
   Hero
   ========================================================================== */
.hero {
  background: var(--ink);
  color: var(--paper);
  padding: clamp(36px, 5vw, 68px) 0 clamp(44px, 5vw, 72px);
  overflow: hidden;
}
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: clamp(32px, 5vw, 72px);
  align-items: center;
}
.kicker {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #c3c8d2;
  margin-bottom: 22px;
}
.kicker-line {
  width: 34px;
  height: 3px;
  background: var(--accent);
  display: inline-block;
}
.hero-title {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(44px, 6.3vw, 88px);
  line-height: 0.95;
  letter-spacing: -0.035em;
  margin-bottom: 24px;
  max-width: 11ch;
}
.hero-lede {
  font-size: clamp(17px, 1.4vw, 20px);
  line-height: 1.55;
  color: #c8ccd4;
  max-width: 46ch;
  margin-bottom: 32px;
}
.hero-actions {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  border-radius: var(--radius);
  font-family: var(--display);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.005em;
  text-decoration: none;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: background 0.18s var(--ease), color 0.18s var(--ease), border-color 0.18s var(--ease), transform 0.18s var(--ease);
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover { background: #ff543a; border-color: #ff543a; }
.btn-primary .btn-arrow { transition: transform 0.2s var(--ease); }
.btn-primary:hover .btn-arrow { transform: translateY(3px); }
.btn-ghost {
  background: transparent;
  color: currentColor;
  border-color: currentColor;
}
.hero-note { color: #8f96a3; }

.hero-figure {
  position: relative;
  margin: 0;
}
.hero-figure img {
  width: 100%;
  height: clamp(320px, 40vw, 480px);
  object-fit: cover;
  filter: grayscale(1) contrast(1.06) brightness(0.96);
  border-radius: var(--radius-lg);
}
.hero-figure::after {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: clamp(320px, 40vw, 480px);
  background:
    linear-gradient(180deg, rgba(20, 22, 28, 0.05), rgba(20, 22, 28, 0.72)),
    linear-gradient(120deg, rgba(255, 61, 31, 0.42), rgba(255, 61, 31, 0) 58%);
  mix-blend-mode: multiply;
  pointer-events: none;
  border-radius: var(--radius-lg);
}
.hero-figure figcaption {
  position: relative;
  z-index: 2;
  margin-top: 10px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #8f96a3;
}

.board {
  position: absolute;
  z-index: 3;
  left: clamp(-28px, -2vw, -12px);
  bottom: 34px;
  width: min(320px, 74%);
  background: var(--paper);
  color: var(--text);
  border-radius: var(--radius);
  border-top: 4px solid var(--accent);
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.42);
  padding: 16px 18px 12px;
}
.board-title {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
}
.board-list { display: grid; }
.board-list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px dashed var(--line);
  font-family: var(--display);
  font-size: 15px;
  font-weight: 500;
}
.board-list li:last-child { border-bottom: 0; }
.board-list .board-num {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent-deep);
  letter-spacing: 0.05em;
}
.board-foot {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 10px;
  color: var(--muted-2);
}

/* ==========================================================================
   Toolbar
   ========================================================================== */
.toolbar {
  position: sticky;
  top: var(--topbar-h);
  z-index: 50;
  scroll-margin-top: calc(var(--topbar-h) + 6px);
  background: var(--paper);
  border-bottom: 1px solid var(--line-strong);
  box-shadow: 0 6px 14px -12px rgba(20, 22, 28, 0.6);
}
.toolbar-inner {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(180px, 220px) auto;
  gap: 16px;
  align-items: end;
  padding-top: 16px;
  padding-bottom: 14px;
}
.field { display: grid; gap: 6px; }
.field label,
.field > label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.input-shell, .select-shell { position: relative; display: flex; align-items: center; }
.input-icon, .select-icon {
  position: absolute;
  width: 18px;
  height: 18px;
  color: var(--muted);
  pointer-events: none;
}
.input-icon { left: 13px; }
.select-icon { right: 12px; }
#search, #filter {
  width: 100%;
  height: 46px;
  background: var(--surface);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--body);
  font-size: 16px;
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}
#search { padding: 0 14px 0 40px; }
#filter {
  padding: 0 40px 0 14px;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  font-weight: 500;
}
#search:hover, #filter:hover { border-color: var(--text); }
#search:focus, #filter:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(27, 110, 243, 0.25);
}
#search::placeholder { color: var(--muted-2); }

.saved-toggle {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: 46px;
  padding: 0 16px;
  background: var(--surface);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius);
  font-family: var(--display);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: border-color 0.16s var(--ease), background 0.16s var(--ease), color 0.16s var(--ease);
}
.saved-toggle:hover { border-color: var(--text); }
.saved-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1.5px solid var(--muted);
  transition: background 0.16s var(--ease), border-color 0.16s var(--ease);
}
.saved-toggle .saved-count {
  min-width: 22px;
  text-align: center;
  background: var(--paper-2);
  border-radius: 999px;
  padding: 3px 6px;
  color: var(--muted);
}
.saved-toggle[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.saved-toggle[aria-pressed="true"] .saved-dot { background: var(--accent); border-color: var(--accent); }
.saved-toggle[aria-pressed="true"] .saved-count { background: var(--accent); color: #fff; }

.toolbar-status {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 12px;
}
.results-line {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.results-filter { display: flex; gap: 8px; }
.results-filter[hidden] { display: none; }
.filter-tag {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--ink);
  color: var(--paper);
  padding: 4px 9px;
  border-radius: 999px;
}
.filter-tag.is-accent { background: var(--accent); color: #fff; }

/* ==========================================================================
   Story route list
   ========================================================================== */
.browse { padding: clamp(30px, 4vw, 54px) 0 24px; }

.route-list {
  position: relative;
  border-top: 1px solid var(--line-strong);
}
.route-list.is-empty { border-top: 0; }
.route-list.is-empty::before { display: none; }
.route-list::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 111px;
  width: 2px;
  background: var(--line-strong);
  pointer-events: none;
  z-index: 1;
}

.item {
  position: relative;
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) 300px;
  gap: 32px;
  align-items: start;
  padding: 34px 0 34px 0;
  border-bottom: 1px solid var(--line);
  transition: background 0.2s var(--ease);
}
.item.is-hidden { display: none; }
.item:hover { background: rgba(255, 255, 255, 0.55); }
.item.is-open { background: var(--surface); }

.rail {
  position: relative;
  min-height: 100%;
  padding-left: 2px;
}
.rail-num {
  display: block;
  font-family: var(--mono);
  font-size: 30px;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--text);
}
.rail-topic {
  display: block;
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.rail-node {
  position: absolute;
  top: 5px;
  left: 103px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--paper);
  border: 3px solid var(--ink);
  z-index: 2;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
}
.item:hover .rail-node { background: var(--accent); border-color: var(--accent); }
.item.is-open .rail-node { background: var(--accent); border-color: var(--accent); }

.item-body { max-width: 62ch; }
.item-cat {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-deep);
  margin-bottom: 10px;
}
.item-cat::before {
  content: "";
  width: 7px;
  height: 7px;
  background: var(--accent);
}
.item-title {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(25px, 2.6vw, 36px);
  line-height: 1.04;
  letter-spacing: -0.025em;
  margin-bottom: 12px;
}
.open-item {
  display: inline;
  background: none;
  border: 0;
  padding: 0;
  text-align: left;
  cursor: pointer;
  color: var(--text);
  background-image: linear-gradient(var(--accent), var(--accent));
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 100% 3px;
  transition: background-size 0.2s var(--ease), color 0.2s var(--ease);
  padding-bottom: 4px;
}
.open-item:hover { background-size: 100% 42%; }
.item-summary {
  color: var(--muted);
  font-size: 16.5px;
  line-height: 1.58;
  max-width: 54ch;
  margin-bottom: 16px;
}
.item-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.item-meta .meta-sep { color: var(--line-strong); }
.item-read {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  padding: 0;
  background: none;
  border: 0;
  cursor: pointer;
  font-family: var(--display);
  font-weight: 600;
  font-size: 14px;
  color: var(--accent-deep);
}
.item-read .arrow { transition: transform 0.2s var(--ease); }
.item:hover .item-read .arrow { transform: translateX(4px); }

.item-thumb {
  margin: 0;
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--ink);
}
.item-thumb img {
  width: 100%;
  height: 190px;
  object-fit: cover;
  filter: grayscale(1) contrast(1.08) brightness(0.98);
  transition: transform 0.5s var(--ease), filter 0.3s var(--ease);
}
.item-thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, rgba(255, 61, 31, 0.5), rgba(20, 22, 28, 0.35));
  mix-blend-mode: multiply;
  pointer-events: none;
}
.item-thumb .thumb-tag {
  position: absolute;
  z-index: 2;
  left: 8px;
  bottom: 8px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #fff;
  background: rgba(20, 22, 28, 0.72);
  padding: 3px 7px;
}
.item:hover .item-thumb img { transform: scale(1.035); filter: grayscale(0.55) contrast(1.05) brightness(1); }

/* ==========================================================================
   Empty state
   ========================================================================== */
.empty-state {
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: clamp(36px, 6vw, 72px);
  text-align: center;
  background: var(--surface);
  max-width: 620px;
  margin: 8px auto 24px;
}
.empty-mark { color: var(--accent-deep); margin-bottom: 14px; display: block; }
.empty-title {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(26px, 3vw, 38px);
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin-bottom: 12px;
}
.empty-body { color: var(--muted); max-width: 44ch; margin: 0 auto 24px; }

/* ==========================================================================
   Footer
   ========================================================================== */
.footer {
  background: var(--ink);
  color: #aeb4bf;
  margin-top: 40px;
  padding: 44px 0 40px;
}
.footer-inner { display: grid; gap: 14px; }
.footer-brand {
  font-family: var(--display);
  font-weight: 600;
  font-size: 30px;
  letter-spacing: -0.03em;
  color: var(--paper);
}
.footer-note { max-width: 62ch; font-size: 14px; }
.footer-meta { color: #8f96a3; }

/* ==========================================================================
   Detail dialog
   ========================================================================== */
.detail {
  width: min(920px, calc(100vw - 40px));
  max-height: min(92vh, 940px);
  padding: 0;
  border: 0;
  border-radius: var(--radius-lg);
  background: var(--paper);
  color: var(--text);
  overflow: hidden;
  box-shadow: 0 40px 90px rgba(0, 0, 0, 0.5);
}
.detail::backdrop {
  background: rgba(11, 12, 16, 0.72);
  backdrop-filter: blur(3px);
}
.detail-article { display: flex; flex-direction: column; height: min(92vh, 940px); max-height: 100%; }

.detail-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
  background: var(--ink);
  color: var(--paper);
  position: sticky;
  top: 0;
  z-index: 4;
}
.detail-route {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.detail-node {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
}
.detail-line { width: 46px; height: 2px; background: var(--ink-line); flex: none; }
.detail-cat { color: #c3c8d2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.detail-close {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 1.5px solid #4a5160;
  color: var(--paper);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  flex: none;
  transition: background 0.16s var(--ease), border-color 0.16s var(--ease);
}
.detail-close svg { width: 15px; height: 15px; }
.detail-close:hover { background: var(--accent); border-color: var(--accent); }

.detail-scroll { overflow-y: auto; min-height: 0; flex: 1 1 auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: clamp(24px, 4vw, 48px) clamp(22px, 5vw, 68px) 40px; }
.detail-head { max-width: 40ch; margin-bottom: 26px; }
.detail-no {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-deep);
  margin-bottom: 12px;
}
.detail-title {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(30px, 4.4vw, 54px);
  line-height: 1.0;
  letter-spacing: -0.032em;
  margin-bottom: 16px;
}
.detail-meta {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
}
.detail-meta .meta-sep { color: var(--line-strong); }
.detail-figure { margin: 0 0 30px; }
.detail-figure img {
  width: 100%;
  height: clamp(220px, 34vw, 380px);
  object-fit: cover;
  border-radius: var(--radius);
  filter: grayscale(1) contrast(1.06) brightness(0.97);
}
.detail-figure { position: relative; }
.detail-figure::after {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: clamp(220px, 34vw, 380px);
  background: linear-gradient(150deg, rgba(255, 61, 31, 0.4), rgba(20, 22, 28, 0.28));
  mix-blend-mode: multiply;
  pointer-events: none;
  border-radius: var(--radius);
}
.detail-figure figcaption {
  position: relative;
  z-index: 2;
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.detail-body {
  max-width: 64ch;
  font-size: 18px;
  line-height: 1.72;
  color: #2a2e36;
}
.detail-body p + p { margin-top: 20px; }
.detail-body p:first-of-type::first-letter {
  font-family: var(--display);
  font-weight: 600;
  font-size: 3.4em;
  line-height: 0.8;
  float: left;
  padding: 6px 12px 0 0;
  color: var(--ink);
}
.detail-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-top: 38px;
  padding-top: 26px;
  border-top: 1px solid var(--line-strong);
}
.save-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  border-radius: var(--radius);
  border: 1.5px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  font-family: var(--display);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.16s var(--ease), color 0.16s var(--ease), border-color 0.16s var(--ease);
}
.save-btn .save-icon { width: 17px; height: 17px; }
.save-btn:hover { background: var(--accent); border-color: var(--accent); }
.save-btn[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.save-btn[aria-pressed="true"] .save-icon path { fill: currentColor; }
.detail-back {
  background: transparent;
  color: var(--text);
  border-color: var(--line-strong);
}
.detail-back:hover { border-color: var(--text); background: transparent; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1080px) {
  .hero-grid { grid-template-columns: 1fr; gap: 40px; }
  .hero-title { max-width: 16ch; }
  .hero-figure img, .hero-figure::after { height: clamp(300px, 52vw, 440px); }
  .board {
    position: static;
    width: 100%;
    margin-top: 18px;
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.28);
  }
  .item { grid-template-columns: 96px minmax(0, 1fr) 240px; gap: 24px; }
  .route-list::before { left: 95px; }
  .rail-node { left: 87px; }
}

@media (max-width: 820px) {
  :root { --gutter: 22px; --topbar-h: 56px; }
  .topbar-tag { display: none; }
  .topbar-inner { justify-content: space-between; }
  .toolbar { position: static; }
  .toolbar-inner {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .item {
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 18px;
    padding: 26px 0;
  }
  .route-list::before { left: 63px; }
  .rail-num { font-size: 24px; }
  .rail-topic { display: none; }
  .rail-node { left: 56px; width: 14px; height: 14px; border-width: 2.5px; top: 3px; }
  .item-thumb { grid-column: 2; margin-top: 18px; }
  .item-thumb img { height: 200px; }
  .item-body { max-width: none; }
  .item-title { font-size: clamp(24px, 6vw, 32px); }
  .detail { width: 100vw; max-width: 100vw; height: 100vh; height: 100dvh; max-height: 100vh; max-height: 100dvh; border-radius: 0; }
  .detail-article { height: 100vh; height: 100dvh; max-height: 100vh; max-height: 100dvh; }
  .detail-close span { display: none; }
  .detail-close { padding: 9px; }
}

@media (max-width: 480px) {
  .hero { padding-top: 30px; }
  .hero-title { font-size: clamp(38px, 11.5vw, 54px); }
  .toolbar-inner { grid-template-columns: 1fr; }
  .item-thumb img { height: 170px; }
  .detail-body { font-size: 17px; }
}

/* ==========================================================================
   Motion preferences
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .open-item:hover { background-size: 100% 3px; }
  .item:hover .item-thumb img { transform: none; }
}
