@font-face {
  font-family: "Literata";
  src: url("assets/literata.ttf") format("truetype");
  font-display: swap;
  font-weight: 200 900;
}

@font-face {
  font-family: "Plex Mono";
  src: url("assets/ibm-plex-mono.ttf") format("truetype");
  font-display: swap;
  font-weight: 400;
}

:root {
  --paper: #dcd6eb;
  --paper-bright: #f2eff8;
  --ink: #18151a;
  --wine: #5a1535;
  --wine-dark: #3f0d25;
  --acid: #ddf238;
  --muted: #625c67;
  --rule: rgba(24, 21, 26, 0.32);
  --gutter: clamp(20px, 4vw, 64px);
  --mono: "Plex Mono", ui-monospace, monospace;
  --reading: "Literata", Georgia, serif;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  background: var(--wine-dark);
  scrollbar-color: var(--wine) var(--paper);
  scrollbar-width: thin;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--reading);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar { width: 12px; }
::-webkit-scrollbar-track { background: var(--paper); }
::-webkit-scrollbar-thumb { background: var(--wine); border: 3px solid var(--paper); }

::selection { color: var(--wine-dark); background: var(--acid); }

:focus-visible {
  outline: 3px solid var(--acid);
  outline-offset: 4px;
  box-shadow: 0 0 0 6px var(--wine);
}

a { color: inherit; text-underline-offset: 0.2em; }
button, input, select { font: inherit; }
button { color: inherit; }

.skip-link {
  position: fixed;
  z-index: 100;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  color: var(--paper-bright);
  background: var(--wine-dark);
  transform: translateY(-160%);
}
.skip-link:focus { transform: translateY(0); }

.site-header {
  min-height: 86px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  padding: 14px var(--gutter);
  border-bottom: 1px solid var(--ink);
}

.wordmark {
  width: max-content;
  font-size: clamp(1.5rem, 2.6vw, 2.5rem);
  font-weight: 850;
  line-height: 1;
  letter-spacing: -0.04em;
  text-decoration: none;
}

.issue-date, .header-note, .note-label, .story-meta, .story-byline,
.results-status, .image-label, .detail-meta, .detail-section, .detail-image-note {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.issue-date { margin: 0; font-variant-numeric: tabular-nums; }
.header-note { justify-self: end; margin: 0; }

.issue-cover {
  min-height: 425px;
  display: grid;
  grid-template-columns: minmax(220px, 0.72fr) minmax(400px, 1.55fr) minmax(260px, 0.73fr);
  border-bottom: 1px solid var(--ink);
}

.issue-number {
  display: flex;
  align-items: flex-end;
  padding: 10px 0 18px var(--gutter);
  overflow: hidden;
  color: var(--wine);
  border-right: 1px solid var(--ink);
  font-family: var(--mono);
  font-size: clamp(8.5rem, 17vw, 15.5rem);
  line-height: 0.72;
  letter-spacing: -0.13em;
  font-variant-numeric: tabular-nums;
}

.issue-intro {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px clamp(32px, 5vw, 80px);
}

.issue-intro h1 {
  max-width: 740px;
  margin: 0 0 22px;
  font-size: clamp(3rem, 5.8vw, 5.75rem);
  font-weight: 520;
  line-height: 0.92;
  letter-spacing: -0.04em;
  text-wrap: balance;
}

.issue-intro > p {
  max-width: 570px;
  margin: 0 0 30px;
  font-size: clamp(1rem, 1.4vw, 1.25rem);
  line-height: 1.45;
}

.jump-link {
  width: max-content;
  padding-bottom: 4px;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration-thickness: 2px;
}

.issue-note {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100%;
  padding: 38px clamp(24px, 3vw, 46px) 30px;
  overflow: hidden;
  color: var(--paper-bright);
  background: var(--wine);
}

.issue-note > p:not(.note-label) {
  max-width: 24ch;
  margin: auto 0;
  font-size: clamp(1.35rem, 2vw, 2rem);
  line-height: 1.12;
}
.note-label { margin: 0; color: var(--acid); }
.route-mark { display: flex; align-items: center; margin-top: 34px; }
.route-mark span { width: 12px; height: 12px; border: 2px solid var(--acid); border-radius: 50%; }
.route-mark span + span { margin-left: 36px; }
.route-mark span + span::before {
  content: "";
  display: block;
  width: 36px;
  height: 2px;
  margin: 3px 0 0 -38px;
  background: var(--acid);
}

.browse-tools {
  position: sticky;
  z-index: 20;
  top: 0;
  display: grid;
  grid-template-columns: minmax(260px, 1.4fr) minmax(190px, 0.7fr) auto minmax(160px, 0.5fr);
  align-items: end;
  gap: 0;
  color: var(--paper-bright);
  background: var(--wine-dark);
  border-bottom: 1px solid var(--ink);
}

.search-field, .filter-field { padding: 14px 20px 13px; border-right: 1px solid rgba(242,239,248,.35); }
.search-field { padding-left: var(--gutter); }
.search-field label, .filter-field label {
  display: block;
  margin-bottom: 4px;
  color: #c8bdc6;
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.input-wrap { display: flex; align-items: center; gap: 9px; }
.input-wrap svg { width: 18px; fill: none; stroke: var(--acid); stroke-width: 1.8; }
.search-field input, .filter-field select {
  width: 100%;
  min-height: 30px;
  padding: 0;
  color: var(--paper-bright);
  background: transparent;
  border: 0;
  border-radius: 0;
  outline: none;
}
.search-field input::placeholder { color: #9f909b; opacity: 1; }
.search-field:focus-within, .filter-field:focus-within { background: var(--wine); }
.filter-field select { cursor: pointer; }
.filter-field option { color: var(--ink); background: var(--paper-bright); }

.saved-toggle {
  align-self: stretch;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 184px;
  padding: 18px 20px;
  color: var(--paper-bright);
  background: transparent;
  border: 0;
  border-right: 1px solid rgba(242,239,248,.35);
  cursor: pointer;
}
.saved-toggle svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.saved-toggle[aria-pressed="true"] { color: var(--wine-dark); background: var(--acid); }
.saved-toggle[aria-pressed="true"] svg { fill: currentColor; }
.saved-count {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin-left: auto;
  color: var(--wine-dark);
  background: var(--acid);
  font-family: var(--mono);
  font-size: 0.72rem;
  border-radius: 50%;
  font-variant-numeric: tabular-nums;
}
.saved-toggle[aria-pressed="true"] .saved-count { color: var(--paper-bright); background: var(--wine-dark); }
.results-status { align-self: center; margin: 0; padding: 16px 20px; color: #c8bdc6; text-align: right; }

.story-index { padding: 72px var(--gutter) 120px; }
.index-heading {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: end;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--ink);
}
.index-heading h2 { margin: 0; font-size: clamp(2.5rem, 5vw, 4.75rem); font-weight: 550; line-height: 1; letter-spacing: -0.04em; }
.index-heading p { justify-self: end; max-width: 34ch; margin: 0; color: var(--muted); }
.story-list { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); }

.story-item {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
  padding: 22px 20px 30px;
  border-bottom: 1px solid var(--ink);
  border-right: 1px solid var(--ink);
}
.story-item:nth-child(1) { grid-column: span 7; padding-left: 0; }
.story-item:nth-child(2) { grid-column: span 5; padding-right: 0; border-right: 0; }
.story-item:nth-child(3), .story-item:nth-child(4), .story-item:nth-child(5) { grid-column: span 4; }
.story-item:nth-child(3) { padding-left: 0; }
.story-item:nth-child(5) { padding-right: 0; border-right: 0; }
.story-item:nth-child(6), .story-item:nth-child(7), .story-item:nth-child(8) { grid-column: span 4; }
.story-item:nth-child(6) { padding-left: 0; }
.story-item:nth-child(8) { padding-right: 0; border-right: 0; }

.story-index-number {
  position: absolute;
  z-index: 2;
  top: 34px;
  left: 32px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  color: var(--paper-bright);
  background: var(--wine);
  font-family: var(--mono);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}
.story-index-number.is-transitioning { view-transition-name: story-number; }
.story-item:nth-child(1) .story-index-number,
.story-item:nth-child(3) .story-index-number,
.story-item:nth-child(6) .story-index-number { left: 12px; }

.story-image-wrap { position: relative; height: 260px; margin-bottom: 26px; overflow: hidden; background: #b8afc3; }
.story-item:nth-child(1) .story-image-wrap { height: 400px; }
.story-item:nth-child(n+3) .story-image-wrap { height: 195px; }
.story-image { width: 100%; height: 100%; display: block; object-fit: cover; filter: saturate(.72) contrast(1.05); transition: transform 600ms cubic-bezier(.16,1,.3,1), filter 600ms ease; }
.story-item:hover .story-image { transform: scale(1.025); filter: saturate(.9) contrast(1.05); }
.image-label { position: absolute; right: 0; bottom: 0; padding: 6px 8px; color: var(--paper-bright); background: var(--wine-dark); }

.story-copy { display: flex; flex-direction: column; }
.story-meta { display: flex; justify-content: space-between; gap: 16px; margin: 0 0 12px; color: var(--wine); }
.story-title { max-width: 17ch; margin: 0 0 14px; font-size: clamp(1.65rem, 2.4vw, 2.7rem); font-weight: 620; line-height: 1.02; letter-spacing: -0.035em; text-wrap: balance; }
.story-item:nth-child(n+3) .story-title { font-size: clamp(1.45rem, 2vw, 2.1rem); }
.story-summary { max-width: 48ch; margin: 0 0 20px; color: #38323b; }
.story-byline { margin: auto 0 20px; color: var(--muted); }
.open-story {
  width: max-content;
  display: inline-flex;
  align-items: center;
  gap: 13px;
  padding: 8px 0;
  background: transparent;
  border: 0;
  border-bottom: 2px solid var(--ink);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.open-story svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; transition: transform 250ms ease; }
.open-story:hover svg { transform: translateX(5px); }

.empty-state { max-width: 760px; margin: 70px auto 0; padding: 42px; text-align: center; border: 1px solid var(--ink); }
.empty-state[hidden] { display: none; }
.empty-mark { margin: 0; color: var(--wine); font-family: var(--mono); font-size: 5rem; line-height: 1; }
.empty-state h3 { margin: 8px 0; font-size: 2rem; }
.empty-state p:not(.empty-mark) { color: var(--muted); }
.empty-state button { margin-top: 12px; padding: 12px 16px; color: var(--paper-bright); background: var(--wine); border: 1px solid var(--wine); cursor: pointer; }

.site-footer {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  align-items: end;
  gap: 32px;
  min-height: 250px;
  padding: 52px var(--gutter);
  color: var(--paper-bright);
  background: var(--wine-dark);
}
.footer-mark { margin: 0; font-size: clamp(2rem, 4vw, 4rem); font-weight: 800; line-height: .9; letter-spacing: -.04em; }
.site-footer p:not(.footer-mark) { max-width: 32ch; margin: 0; color: #cec2cc; }
.site-footer a { font-family: var(--mono); font-size: .75rem; text-transform: uppercase; }

#detail-host:empty { display: none; }
body.detail-open { overflow-x: hidden; }
body.detail-open #browse-view { display: none; }

.detail-view { min-height: 100vh; background: var(--paper-bright); }
.detail-bar {
  position: sticky;
  z-index: 10;
  top: 0;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  min-height: 68px;
  color: var(--paper-bright);
  background: var(--wine-dark);
  border-bottom: 1px solid var(--wine-dark);
}
.close-detail, .save-item {
  align-self: stretch;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px var(--gutter);
  color: inherit;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.close-detail { border-right: 1px solid rgba(242,239,248,.35); }
.save-item { border-left: 1px solid rgba(242,239,248,.35); }
.close-detail svg, .save-item svg { width: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.save-item[aria-pressed="true"] { color: var(--wine-dark); background: var(--acid); }
.save-item[aria-pressed="true"] svg { fill: currentColor; }
.detail-wordmark { justify-self: center; font-weight: 800; letter-spacing: -.02em; }

.detail-hero {
  display: grid;
  grid-template-columns: minmax(100px, .45fr) minmax(480px, 1.55fr) minmax(300px, 1fr);
  min-height: 570px;
  color: var(--paper-bright);
  background: var(--wine);
}
.detail-number {
  display: flex;
  align-items: flex-start;
  padding: 42px 20px 0 var(--gutter);
  color: var(--acid);
  font-family: var(--mono);
  font-size: clamp(3.5rem, 7vw, 7rem);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  view-transition-name: story-number;
}
.detail-heading { display: flex; flex-direction: column; justify-content: center; padding: 64px clamp(36px, 6vw, 96px); border-left: 1px solid rgba(242,239,248,.35); }
.detail-heading h1 { max-width: 15ch; margin: 0 0 28px; font-size: clamp(3.2rem, 6vw, 6rem); font-weight: 520; line-height: .94; letter-spacing: -.04em; text-wrap: balance; }
.detail-section { margin: 0 0 18px; color: var(--acid); }
.detail-dek { max-width: 52ch; margin: 0; font-size: 1.15rem; color: #e7dce3; }
.detail-image-wrap { position: relative; min-height: 440px; overflow: hidden; }
.detail-image { width: 100%; height: 100%; display: block; object-fit: cover; filter: saturate(.75); }
.detail-image-note { position: absolute; right: 0; bottom: 0; margin: 0; padding: 8px 10px; color: var(--paper-bright); background: var(--wine-dark); }

.detail-body-grid { display: grid; grid-template-columns: minmax(220px, .8fr) minmax(460px, 1.35fr) minmax(220px, .85fr); padding: 78px var(--gutter) 120px; }
.detail-aside { padding-right: 34px; }
.detail-meta { margin: 0; padding-top: 10px; color: var(--muted); border-top: 1px solid var(--ink); line-height: 2; }
.article-body { max-width: 70ch; padding: 0 clamp(30px, 5vw, 74px); border-left: 1px solid var(--rule); border-right: 1px solid var(--rule); }
.article-body p { margin: 0 0 1.45em; font-size: clamp(1.12rem, 1.35vw, 1.3rem); line-height: 1.75; }
.article-body p:first-child::first-letter { float: left; margin: .07em .12em 0 0; color: var(--wine); font-size: 5rem; font-weight: 700; line-height: .7; }
.article-end { display: flex; align-items: center; gap: 16px; margin-top: 58px; color: var(--wine); font-family: var(--mono); font-size: .72rem; text-transform: uppercase; }
.article-end::before { content: ""; width: 42px; height: 3px; background: var(--wine); }
.detail-related { padding-left: 34px; }
.detail-related h2 { margin: 0 0 16px; font-size: 1.45rem; line-height: 1.1; }
.detail-related button { padding: 0 0 5px; text-align: left; background: transparent; border: 0; border-bottom: 1px solid var(--ink); cursor: pointer; }

::view-transition-old(root), ::view-transition-new(root) { animation-duration: 420ms; animation-timing-function: cubic-bezier(.16,1,.3,1); }
::view-transition-old(story-number), ::view-transition-new(story-number) { animation-duration: 540ms; }

@media (max-width: 980px) {
  .header-note { display: none; }
  .site-header { grid-template-columns: 1fr auto; }
  .issue-cover { grid-template-columns: 190px 1fr; }
  .issue-note { grid-column: 1 / -1; min-height: 230px; display: grid; grid-template-columns: .5fr 1fr; gap: 24px; }
  .route-mark { grid-column: 1 / -1; }
  .browse-tools { position: relative; grid-template-columns: 1fr 1fr; }
  .saved-toggle { border-top: 1px solid rgba(242,239,248,.35); }
  .results-status { border-top: 1px solid rgba(242,239,248,.35); }
  .story-item:nth-child(1), .story-item:nth-child(2) { grid-column: span 6; }
  .story-item:nth-child(n+3) { grid-column: span 6; }
  .story-item:nth-child(even) { padding-right: 0; border-right: 0; }
  .story-item:nth-child(odd) { padding-left: 0; border-right: 1px solid var(--ink); }
  .story-item:nth-child(1) .story-image-wrap { height: 310px; }
  .detail-hero { grid-template-columns: 125px 1fr; }
  .detail-image-wrap { grid-column: 1 / -1; height: 430px; }
  .detail-body-grid { grid-template-columns: 190px 1fr; }
  .detail-related { grid-column: 2; padding: 48px clamp(30px,5vw,74px); }
}

@media (max-width: 640px) {
  :root { --gutter: 18px; }
  .site-header { min-height: 68px; gap: 10px; }
  .wordmark { font-size: 1.45rem; }
  .issue-date { font-size: .58rem; text-align: right; }
  .issue-cover { min-height: 0; grid-template-columns: 105px 1fr; }
  .issue-number { min-height: 310px; align-items: flex-start; padding: 35px 8px 0 14px; font-size: 6.5rem; line-height: .78; letter-spacing: -.17em; }
  .issue-intro { min-height: 310px; padding: 30px 22px; }
  .issue-intro h1 { margin-bottom: 18px; font-size: clamp(2.35rem, 11vw, 3.1rem); line-height: .95; }
  .issue-intro > p { margin-bottom: 18px; font-size: .92rem; }
  .jump-link { font-size: .66rem; }
  .issue-note { min-height: 210px; grid-template-columns: 1fr; padding: 25px var(--gutter); }
  .issue-note > p:not(.note-label) { margin: 12px 0; font-size: 1.45rem; }
  .route-mark { grid-column: auto; margin-top: 6px; }
  .browse-tools { grid-template-columns: 1fr; }
  .search-field, .filter-field { padding: 12px var(--gutter); border-right: 0; border-bottom: 1px solid rgba(242,239,248,.35); }
  .saved-toggle { min-height: 54px; padding: 10px var(--gutter); border: 0; border-bottom: 1px solid rgba(242,239,248,.35); }
  .results-status { padding: 10px var(--gutter); border: 0; text-align: left; }
  .story-index { padding-top: 50px; padding-bottom: 78px; }
  .index-heading { grid-template-columns: 1fr; gap: 10px; }
  .index-heading h2 { font-size: 2.6rem; }
  .index-heading p { justify-self: start; font-size: .9rem; }
  .story-list { display: block; }
  .story-item, .story-item:nth-child(n) { padding: 20px 0 30px; border-right: 0; }
  .story-item:nth-child(n) .story-index-number { top: 32px; left: 12px; }
  .story-image-wrap, .story-item:nth-child(1) .story-image-wrap, .story-item:nth-child(n+3) .story-image-wrap { height: 220px; margin-bottom: 22px; }
  .story-title, .story-item:nth-child(n+3) .story-title { max-width: 16ch; font-size: 2rem; }
  .empty-state { margin-top: 35px; padding: 28px 18px; }
  .site-footer { grid-template-columns: 1fr; min-height: 300px; align-items: start; gap: 28px; }
  .detail-bar { grid-template-columns: 1fr 1fr; }
  .detail-wordmark { display: none; }
  .close-detail, .save-item { justify-content: center; padding: 12px 10px; }
  .detail-hero { grid-template-columns: 74px 1fr; min-height: 0; }
  .detail-number { padding: 28px 10px 0 var(--gutter); font-size: 3rem; }
  .detail-heading { min-height: 385px; padding: 42px 20px; }
  .detail-heading h1 { margin-bottom: 22px; font-size: clamp(2.5rem, 11vw, 3.55rem); }
  .detail-dek { font-size: .98rem; }
  .detail-image-wrap { grid-column: 1 / -1; height: 290px; min-height: 0; }
  .detail-body-grid { display: block; padding: 48px var(--gutter) 82px; }
  .detail-aside { padding: 0 0 34px; }
  .article-body { padding: 36px 0 0; border: 0; border-top: 1px solid var(--rule); }
  .article-body p { font-size: 1.08rem; line-height: 1.7; }
  .detail-related { padding: 54px 0 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation-duration: .01ms !important; }
}
