/* Pavement — city-life journal. Cool concrete + municipal cobalt. */

@font-face {
  font-family: 'Space Grotesk';
  src: url('assets/space-grotesk.ttf') format('truetype');
  font-weight: 300 700;
  font-display: swap;
}
@font-face {
  font-family: 'Work Sans';
  src: url('assets/work-sans.ttf') format('truetype');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --paper:      #e7e7ea;   /* cool concrete */
  --paper-2:    #dedee2;   /* slightly deeper concrete for blocks */
  --surface:    #f6f6f8;   /* reading surface (detail) */
  --ink:        #1b1d22;
  --ink-soft:   #44474f;
  --mute:       #71747c;
  --rule:       #d0d0d6;
  --accent:     #2247d6;   /* municipal cobalt */
  --accent-ink: #f3f5ff;   /* text on cobalt */
  --accent-deep:#1530a0;

  --gutter: clamp(20px, 5vw, 64px);
  --measure: 68ch;
  --radius: 2px;
  --ease: cubic-bezier(.2,.7,.2,1);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Work Sans', system-ui, -apple-system, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

/* faint pavement grain — a single quiet system texture */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: linear-gradient(var(--rule) 1px, transparent 1px);
  background-size: 100% 14px;
  opacity: .035;
}

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

h1, h2, h3, .wordmark, .topmark, .footer-wordmark, .story-title, .detail-title {
  font-family: 'Space Grotesk', system-ui, sans-serif;
}

a { color: var(--accent-deep); }

button { font-family: inherit; }

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

.skip-link {
  position: absolute;
  left: 8px;
  top: -40px;
  background: var(--ink);
  color: var(--paper);
  padding: 8px 12px;
  z-index: 50;
  transition: top .15s var(--ease);
  border-radius: 0;
}
.skip-link:focus { top: 8px; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 12px var(--gutter);
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}
.topmark {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--ink);
  text-decoration: none;
}
.topbar-meta {
  margin: 0;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .01em;
  color: var(--mute);
}

main { position: relative; z-index: 1; }

/* ---------- Cover ---------- */
.cover {
  padding: clamp(56px, 10vh, 120px) var(--gutter) clamp(36px, 6vh, 64px);
  max-width: 1240px;
  margin: 0 auto;
}
.cover-kicker {
  margin: 0 0 18px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: var(--mute);
}
.wordmark {
  margin: 0;
  font-size: clamp(72px, 17vw, 196px);
  font-weight: 700;
  letter-spacing: -.05em;
  line-height: .82;
  color: var(--ink);
}
.tagline {
  margin: 26px 0 0;
  max-width: 46ch;
  font-size: clamp(18px, 2.2vw, 22px);
  line-height: 1.5;
  color: var(--ink-soft);
  font-weight: 400;
}
.cover-meta {
  margin: 20px 0 0;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--mute);
  letter-spacing: .01em;
}

/* the cobalt road-marking under the cover */
.cover::after {
  content: "";
  display: block;
  margin-top: clamp(36px, 6vh, 56px);
  height: 6px;
  width: 100%;
  background: var(--accent);
  max-width: 220px;
}

/* ---------- Controls ---------- */
.controls {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 var(--gutter) 28px;
  display: grid;
  gap: 18px;
  grid-template-columns: 1fr;
  align-items: end;
  border-bottom: 1px solid var(--rule);
}
@media (min-width: 760px) {
  .controls {
    grid-template-columns: 1fr auto auto;
    gap: 28px;
  }
}
.field { display: flex; flex-direction: column; gap: 7px; }
.field-label {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--mute);
  letter-spacing: .02em;
}

input#search,
.select-wrap {
  position: relative;
}
.field-search { position: relative; }
input#search {
  appearance: none;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-bottom: 2px solid var(--ink);
  border-radius: var(--radius);
  padding: 12px 14px;
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  width: 100%;
  transition: border-color .15s var(--ease), background .15s var(--ease);
}
input#search::placeholder { color: var(--mute); }
input#search:focus { outline: none; border-bottom-color: var(--accent); background: #fff; }
.search-control { position: relative; }
/* a small cobalt lens glyph in the field corner — functional hint */
.field-search::after {
  content: "";
  position: absolute;
  right: 14px;
  bottom: 16px;
  width: 12px;
  height: 12px;
  border: 2px solid var(--mute);
  border-radius: 50%;
  pointer-events: none;
}

.select-wrap::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
}
#filter {
  appearance: none;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-bottom: 2px solid var(--ink);
  border-radius: var(--radius);
  padding: 12px 38px 12px 14px;
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  cursor: pointer;
  min-width: 11rem;
}
#filter:focus { outline: none; border-bottom-color: var(--accent); background: #fff; }

.toggle {
  appearance: none;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-bottom: 2px solid var(--ink);
  border-radius: var(--radius);
  padding: 12px 16px;
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition: background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}
.toggle:hover { background: #e2e2e6; }
.toggle[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
  border-bottom-color: var(--accent-deep);
}

/* ---------- Contents list ---------- */
.contents {
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px var(--gutter) 64px;
}
.contents-heading {
  margin: 0 0 4px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--mute);
}
.story-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.story {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: clamp(14px, 3vw, 36px);
  padding: clamp(22px, 3.4vh, 34px) 0;
  border-top: 1px solid var(--rule);
  position: relative;
}
.story-list .story:last-child { border-bottom: 1px solid var(--rule); }

/* the memorable element: oversized cobalt index numerals */
.story-index {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(40px, 6vw, 64px);
  font-weight: 700;
  line-height: .9;
  color: var(--accent);
  letter-spacing: -.04em;
  min-width: 1.4em;
  font-variant-numeric: tabular-nums;
  margin-top: -.04em;
}

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

.story-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  margin: 0 0 10px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--mute);
}
.cat {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-soft);
  font-weight: 600;
}
.cat-dot {
  width: 9px; height: 9px;
  background: var(--accent);
  display: inline-block;
}
.story-meta .sep { color: var(--rule); }

.story-title {
  margin: 0 0 10px;
  font-size: clamp(22px, 2.5vw, 30px);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -.015em;
  color: var(--ink);
}
.open-item {
  appearance: none;
  background: none;
  border: 0;
  margin: 0;
  padding: 2px 0;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
  line-height: inherit;
  transition: color .15s var(--ease);
  border-radius: 0;
}
.open-item:hover { color: var(--accent); }
.open-item:focus { outline-offset: 4px; }

.story-summary {
  margin: 0 0 14px;
  max-width: 60ch;
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1.55;
}

.story-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 13px;
  color: var(--mute);
}
.byline { color: var(--ink-soft); font-weight: 500; }
.saved-mark {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--accent-deep);
  font-weight: 600;
}
.saved-mark::before {
  content: "";
  width: 9px; height: 9px;
  background: var(--accent);
  display: inline-block;
}

/* ---------- Empty state ---------- */
.empty-state {
  padding: 56px 0;
  text-align: left;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.empty-title {
  margin: 0 0 8px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 22px;
  font-weight: 600;
  color: var(--ink);
}
.empty-body { margin: 0 0 20px; max-width: 48ch; color: var(--ink-soft); }
.recover {
  appearance: none;
  background: var(--ink);
  color: var(--paper);
  border: 0;
  border-bottom: 3px solid var(--accent);
  padding: 12px 18px;
  font: inherit;
  font-size: 15px;
  cursor: pointer;
  border-radius: var(--radius);
}
.recover:hover { background: #2a2d34; }

/* ---------- Footer ---------- */
.site-footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--rule);
  background: var(--paper-2);
  padding: 56px var(--gutter);
}
.footer-inner { max-width: 1240px; margin: 0 auto; }
.footer-wordmark {
  margin: 0 0 18px;
  font-size: clamp(40px, 8vw, 72px);
  font-weight: 700;
  letter-spacing: -.05em;
  color: var(--ink);
}
.footer-note {
  margin: 0 0 10px;
  max-width: 64ch;
  color: var(--ink-soft);
  font-size: 15px;
}
.footer-colophon {
  margin: 0;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 13px;
  color: var(--mute);
}

/* ---------- Detail dialog ---------- */
dialog#detail {
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  max-height: 100vh;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--surface);
  color: var(--ink);
  overflow: hidden;
}
dialog#detail::backdrop {
  background: rgba(15, 18, 26, .55);
  backdrop-filter: blur(2px);
}
.detail-article {
  height: 100vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.detail-bar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(18px, 5vw, 64px);
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
}
.close-detail {
  appearance: none;
  background: none;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  padding: 9px 14px;
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.close-detail::before {
  content: "";
  width: 14px; height: 14px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  display: inline-block;
}
.close-detail:hover { background: var(--ink); color: var(--surface); }

.save-item {
  appearance: none;
  border: 2px solid var(--ink);
  background: none;
  color: var(--ink);
  padding: 8px 14px;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}
.save-item::before {
  content: "";
  width: 13px; height: 13px;
  border: 2px solid currentColor;
  display: inline-block;
  border-radius: 1px;
}
.save-item[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.save-item[aria-pressed="true"]::before {
  background: var(--accent-ink);
  border-color: var(--accent-ink);
}

.detail-body {
  max-width: 760px;
  margin: 0 auto;
  padding: clamp(32px, 6vh, 64px) clamp(18px, 5vw, 32px) 96px;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  align-items: center;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: var(--mute);
  margin: 0 0 22px;
}
.detail-cat {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-weight: 600;
}
.detail-cat .cat-dot { width: 10px; height: 10px; }

.detail-title {
  margin: 0 0 22px;
  font-size: clamp(32px, 5.2vw, 56px);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -.025em;
  color: var(--ink);
}
.detail-author {
  margin: 0 0 28px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 15px;
  color: var(--ink-soft);
}
.detail-author strong { font-weight: 600; color: var(--ink); }

/* duotone image — cobalt system, clearly stylized, not documentary */
.duo-wrap { margin: 0; }
.duo {
  margin: 0 0 14px;
  background: var(--accent);
  height: clamp(220px, 38vh, 340px);
  width: 100%;
  overflow: hidden;
  position: relative;
}
.duo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  mix-blend-mode: luminosity;
  filter: contrast(1.12) brightness(1.02);
  display: block;
}
.duo::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(20,30,90,.05), rgba(20,30,90,.35));
  pointer-events: none;
}
.detail-caption {
  margin: 0 0 36px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 12px;
  color: var(--mute);
  max-width: 60ch;
}

.detail-prose p {
  margin: 0 0 1.3em;
  font-size: clamp(18px, 2vw, 20px);
  line-height: 1.72;
  color: var(--ink);
  max-width: var(--measure);
}
.detail-prose p:first-of-type::first-letter {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 4.2em;
  line-height: .82;
  float: left;
  margin: .06em .12em 0 -.04em;
  color: var(--accent);
}

.detail-tail {
  margin: 40px 0 0;
  padding-top: 22px;
  border-top: 1px solid var(--rule);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}
.detail-tail .close-detail { border-bottom-width: 3px; }
.detail-tail-note {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 13px;
  color: var(--mute);
}

/* ---------- Mobile ---------- */
@media (max-width: 600px) {
  .story { grid-template-columns: 1fr; gap: 6px; }
  .story-index {
    font-size: 34px;
    line-height: 1;
    margin-bottom: 2px;
  }
  .topbar { padding: 11px 16px; }
  .cover { padding-top: 44px; }
  .cover::after { margin-top: 32px; }
}

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
