/* ==========================================================================
   Crosstown — a journal of everyday city life
   Visual system: dark "wayfinding" index, condensed display type,
   acid-lime signal accent, hairline rules, sharp corners.
   ========================================================================== */

@font-face {
  font-family: "Oswald";
  src: url("assets/oswald.ttf") format("truetype");
  font-weight: 200 700;
  font-style: normal;
  font-display: swap;
}
@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: "IBM Plex Mono";
  src: url("assets/ibm-plex-mono.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #0b0b0d;
  --surface: #131316;
  --surface-2: #191920;
  --line: #292930;
  --line-strong: #3b3b45;
  --text: #f4f2ea;
  --muted: #a6a69c;
  --muted-2: #71717a;
  --accent: #d9ff3f;
  --accent-soft: rgba(217, 255, 63, 0.12);
  --accent-line: rgba(217, 255, 63, 0.35);
  --rail-w: 320px;
  --pad: clamp(20px, 4.2vw, 64px);
  --display: "Oswald", "Arial Narrow", Impact, sans-serif;
  --body: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

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

body.is-locked {
  overflow: hidden;
}

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

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

input,
select {
  font: inherit;
  color: inherit;
}

h1,
h2,
h3,
p {
  margin: 0;
}

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

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  background: var(--accent);
  color: #0b0b0d;
  padding: 10px 14px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  transition: top 0.15s ease;
}
.skip-link:focus {
  top: 12px;
}

/* --------------------------------------------------------------------------
   Shell
   -------------------------------------------------------------------------- */

.app {
  min-height: 100vh;
}

@media (min-width: 960px) {
  .app {
    display: grid;
    grid-template-columns: var(--rail-w) minmax(0, 1fr);
    align-items: start;
  }
}

/* --------------------------------------------------------------------------
   Left rail
   -------------------------------------------------------------------------- */

.rail {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

@media (min-width: 960px) {
  .rail {
    position: sticky;
    top: 0;
    height: 100vh;
    border-bottom: 0;
    border-right: 1px solid var(--line);
  }
  .rail-inner {
    height: 100%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
  }
}

.rail-inner {
  padding: 22px var(--pad) 28px;
}

@media (min-width: 960px) {
  .rail-inner {
    padding: 30px 30px 28px;
  }
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  flex: 0 0 auto;
  display: block;
  width: 46px;
  height: 46px;
  color: var(--accent);
}
.brand-mark svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}
.brand-mark line {
  stroke: var(--surface);
  stroke-width: 3.5;
}
.brand-mark:hover {
  color: #eaff8a;
}

.brand-name {
  font-family: var(--display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.015em;
  line-height: 1;
  font-size: clamp(26px, 3.4vw, 34px);
}

.brand-tag {
  margin-top: 5px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

/* controls */

.controls {
  display: grid;
  gap: 18px;
  padding: 24px 0 22px;
  border-bottom: 1px solid var(--line);
}

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

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

input[type="search"] {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 0;
  padding: 13px 14px;
  font-size: 15px;
  color: var(--text);
}
input[type="search"]::placeholder {
  color: var(--muted-2);
}
input[type="search"]:hover {
  border-color: #55555f;
}
input[type="search"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.select-wrap {
  position: relative;
}
select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 0;
  padding: 13px 40px 13px 14px;
  font-size: 15px;
  color: var(--text);
}
select:hover {
  border-color: #55555f;
}
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.select-chevron {
  position: absolute;
  right: 14px;
  top: 50%;
  width: 12px;
  height: 8px;
  transform: translateY(-50%);
  pointer-events: none;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.6;
}

.saved-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  background: var(--bg);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  transition:
    background 0.15s ease,
    color 0.15s ease,
    border-color 0.15s ease;
}
.saved-toggle svg {
  width: 12px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linejoin: round;
}
.saved-toggle:hover {
  border-color: var(--accent-line);
  color: var(--text);
}
.saved-toggle[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #0b0b0d;
}
.saved-toggle .saved-count {
  margin-left: auto;
  font-size: 12px;
  color: inherit;
  opacity: 0.75;
}

/* topic list */

.topics {
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}
.topics ul {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
}
.topics button {
  width: 100%;
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 9px 0;
  text-align: left;
  color: var(--muted);
  border-bottom: 1px solid transparent;
  transition: color 0.15s ease;
}
.topics button .t-name {
  font-family: var(--display);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}
.topics button .t-count {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted-2);
}
.topics button:hover {
  color: var(--text);
}
.topics button[aria-current="true"] {
  color: var(--text);
}
.topics button[aria-current="true"] .t-name {
  color: var(--accent);
}
.topics button[aria-current="true"] .t-count {
  color: var(--accent);
}

.rail-foot {
  margin-top: auto;
  padding-top: 24px;
  display: grid;
  gap: 12px;
}
.issue {
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.7;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.note {
  font-family: var(--mono);
  font-size: 10.5px;
  line-height: 1.6;
  color: var(--muted-2);
  max-width: 34ch;
}

/* --------------------------------------------------------------------------
   Main feed
   -------------------------------------------------------------------------- */

.main {
  min-width: 0;
}
.main:focus {
  outline: none;
}

/* hero band */
.feed-hero {
  position: relative;
  min-height: clamp(230px, 30vw, 360px);
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: #000;
}
.hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 62%;
  filter: grayscale(0.5) contrast(1.05) brightness(0.72);
}
.hero-veil {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(
      180deg,
      rgba(11, 11, 13, 0.15) 0%,
      rgba(11, 11, 13, 0.55) 55%,
      rgba(11, 11, 13, 0.97) 100%
    ),
    linear-gradient(90deg, rgba(11, 11, 13, 0.85) 0%, rgba(11, 11, 13, 0) 70%);
}
.feed-head {
  position: relative;
  width: 100%;
  padding: clamp(22px, 4vw, 44px) var(--pad) clamp(20px, 3vw, 34px);
}
.kicker {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}
.feed-head h1 {
  font-family: var(--display);
  font-weight: 700;
  text-transform: uppercase;
  line-height: 0.94;
  letter-spacing: 0.005em;
  font-size: clamp(40px, 8vw, 88px);
  max-width: 12ch;
}
.feed-meta {
  margin-top: 18px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

/* story list */
.stories {
  padding: 0 var(--pad);
}

.story-list {
  display: block;
}

.story {
  position: relative;
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) 56px;
  gap: clamp(14px, 2.4vw, 34px);
  align-items: start;
  padding: clamp(24px, 3.4vw, 40px) 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.18s ease;
}
.story:hover {
  background: linear-gradient(
    90deg,
    var(--surface) 0%,
    rgba(19, 19, 22, 0) 85%
  );
}
.story.is-lead {
  padding-top: clamp(30px, 4vw, 50px);
}

.story-index {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(30px, 4vw, 52px);
  line-height: 0.9;
  color: var(--line-strong);
  letter-spacing: 0.01em;
  transition: color 0.18s ease;
}
.story:hover .story-index,
.story:focus-within .story-index {
  color: var(--accent);
}

.story-main {
  min-width: 0;
}

.story-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: 12px;
}
.tag {
  color: var(--accent);
  border: 1px solid var(--accent-line);
  padding: 3px 8px;
  font-size: 10.5px;
}
.meta-dot {
  color: var(--line-strong);
}

.story-title {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(23px, 3vw, 38px);
  line-height: 1.05;
  letter-spacing: 0.002em;
}
.story.is-lead .story-title {
  font-size: clamp(28px, 4vw, 50px);
  font-weight: 600;
}
.open-item {
  display: inline;
  text-align: left;
  color: var(--text);
  background-image: linear-gradient(var(--accent), var(--accent));
  background-size: 0% 2px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  padding-bottom: 3px;
  transition: background-size 0.25s ease;
}
.story:hover .open-item,
.open-item:hover,
.open-item:focus-visible {
  background-size: 100% 2px;
}

.story-summary {
  margin-top: 12px;
  max-width: 62ch;
  font-size: 16px;
  line-height: 1.6;
  color: var(--muted);
}

.story-byline {
  margin-top: 14px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.saved-flag {
  display: none;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}
.story.is-saved .saved-flag {
  display: inline-flex;
}
.saved-flag svg {
  width: 10px;
  height: 13px;
  fill: var(--accent);
}

.story-arrow {
  justify-self: end;
  font-family: var(--display);
  font-size: 30px;
  line-height: 1;
  color: var(--muted-2);
  transition:
    color 0.18s ease,
    transform 0.18s ease;
}
.story:hover .story-arrow,
.story:focus-within .story-arrow {
  color: var(--accent);
  transform: translate(4px, -4px);
}

/* empty state */
.empty-state {
  padding: clamp(48px, 10vw, 120px) 0;
  max-width: 52ch;
}
.empty-mark {
  font-family: var(--display);
  font-size: 56px;
  line-height: 1;
  color: var(--accent);
  margin-bottom: 20px;
}
.empty-state h2 {
  font-family: var(--display);
  font-weight: 600;
  text-transform: uppercase;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1;
}
.empty-state p {
  margin-top: 16px;
  color: var(--muted);
}
.btn-reset {
  margin-top: 26px;
  padding: 13px 20px;
  background: var(--accent);
  color: #0b0b0d;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: background 0.15s ease;
}
.btn-reset:hover {
  background: #eaff8a;
}

.page-foot {
  margin-top: 40px;
  padding: 26px var(--pad) 48px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-2);
}

/* --------------------------------------------------------------------------
   Reader dialog
   -------------------------------------------------------------------------- */

.reader {
  width: min(1000px, calc(100vw - 48px));
  max-width: 1000px;
  max-height: min(92vh, 940px);
  padding: 0;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  overflow: hidden;
}
.reader::backdrop {
  background: rgba(5, 5, 7, 0.74);
}
.reader[open] {
  display: flex;
  flex-direction: column;
  animation: reader-in 0.22s ease both;
}
@keyframes reader-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.reader-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px clamp(16px, 3vw, 30px);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.btn-close,
.btn-save {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  transition:
    border-color 0.15s ease,
    color 0.15s ease,
    background 0.15s ease;
}
.btn-close:hover,
.btn-save:hover {
  border-color: var(--accent-line);
  color: var(--text);
}
.btn-save {
  margin-left: auto;
}
.btn-save svg {
  width: 11px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linejoin: round;
}
.btn-save[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #0b0b0d;
}
.btn-save[aria-pressed="true"] svg {
  fill: #0b0b0d;
  stroke: #0b0b0d;
}
.reader-chip {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.reader-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.reader-figure {
  margin: 0;
  position: relative;
  background: #000;
}
.reader-img {
  width: 100%;
  height: clamp(200px, 34vw, 380px);
  object-fit: cover;
  filter: grayscale(0.35) contrast(1.04) brightness(0.85);
}
.reader-caption {
  position: absolute;
  left: 0;
  bottom: 0;
  padding: 8px clamp(16px, 3vw, 30px);
  background: rgba(11, 11, 13, 0.78);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.reader-article {
  padding: clamp(28px, 5vw, 56px) clamp(18px, 5vw, 72px) clamp(40px, 6vw, 80px);
  max-width: 820px;
  margin: 0 auto;
}
.reader-meta {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}
.reader-title {
  margin-top: 16px;
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(34px, 5.5vw, 64px);
  line-height: 1;
  letter-spacing: 0.002em;
}
.reader-byline {
  margin-top: 20px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.reader-dek {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  font-size: clamp(18px, 2.2vw, 22px);
  line-height: 1.5;
  color: var(--text);
}
.reader-body {
  margin-top: 28px;
  white-space: pre-line;
  font-size: clamp(17px, 1.5vw, 19px);
  line-height: 1.78;
  color: #dcdad2;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 959px) {
  .controls {
    grid-template-columns: 1fr 1fr;
    align-items: end;
  }
  .controls .saved-toggle {
    grid-column: 1 / -1;
  }
  /* Keep the mobile header compact: the topic select already covers
     browsing, and the disclaimer moves into the page footer. */
  .topics,
  .rail-foot {
    display: none;
  }
}

@media (max-width: 620px) {
  .controls {
    grid-template-columns: 1fr;
  }
  .feed-hero {
    min-height: 250px;
  }
  .story {
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 14px;
    padding: 22px 0;
  }
  .story-index {
    font-size: 26px;
  }
  .story-arrow {
    display: none;
  }
  .story.is-lead .story-title,
  .story-title {
    font-size: 24px;
  }
  .story.is-lead {
    padding-top: 24px;
  }
  .reader {
    width: 100vw;
    max-width: none;
    height: 100vh;
    height: 100dvh;
    max-height: none;
    margin: 0;
    border: 0;
  }
  .reader-bar {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 14px;
  }
  .btn-close,
  .btn-save {
    padding: 9px 12px;
    font-size: 11px;
  }
  .reader-chip {
    order: 3;
    width: 100%;
  }
  .reader-article {
    padding-left: 20px;
    padding-right: 20px;
  }
}

/* --------------------------------------------------------------------------
   Reduced motion & print-ish niceties
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
