@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: "Literata";
  src: url("assets/literata.ttf") format("truetype");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #f2f2ec;
  --paper-deep: #e7e7de;
  --ink: #16191d;
  --muted: #575d65;
  --line: #c7c7bd;
  --blue: #1b2fa8;
  --blue-deep: #12227e;
  --yellow: #ffd24a;
  --places: #1b2fa8;
  --movement: #a63a0a;
  --people: #2e6b4f;
  --food: #8a5a00;
  --culture: #7b2d57;
  --display: "Oswald", "Arial Narrow", Impact, sans-serif;
  --text: "Literata", Georgia, "Times New Roman", serif;
  --max: 1240px;
  --gutter: 2.5rem;
}

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

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--text);
  font-size: 1rem;
  line-height: 1.6;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
}

body.dialog-open {
  overflow: hidden;
}

img {
  max-width: 100%;
}

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

button {
  cursor: pointer;
}

a {
  color: inherit;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 1rem;
  z-index: 100;
  padding: 0.7rem 1rem;
  background: var(--yellow);
  color: var(--ink);
  font-weight: 600;
  border: 2px solid var(--ink);
  text-decoration: none;
}

.skip-link:focus {
  top: 0.75rem;
}

.curb-stripe {
  height: 10px;
  background: var(--yellow);
  border-bottom: 2px solid var(--ink);
}

/* Masthead */

.masthead {
  padding: 2.25rem 0 0;
}

.masthead-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.brandrow {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
}

.wordmark {
  margin: 0;
  padding: 0.02em 0 0.09em;
  font-family: var(--display);
  font-size: clamp(5.6rem, 15.2vw, 12.8rem);
  font-weight: 600;
  line-height: 0.74;
  letter-spacing: -0.035em;
  text-transform: lowercase;
}

.issue-meta {
  flex: 0 0 auto;
  margin: 0 0 0.55rem;
  font-family: var(--display);
  font-size: 0.92rem;
  font-weight: 400;
  line-height: 1.55;
  letter-spacing: 0.015em;
  text-align: right;
}

.issue-meta span {
  display: block;
}

.deck {
  max-width: 57ch;
  margin: 1.9rem 0 2rem;
  font-family: var(--text);
  font-size: 1.14rem;
  line-height: 1.58;
  letter-spacing: 0.002em;
}

.masthead-rule {
  height: 11px;
  border-top: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  background: var(--yellow);
}

/* Controls */

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

.controls-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.8rem;
  max-width: var(--max);
  margin: 0 auto;
  padding: 1rem var(--gutter);
}

.field {
  position: relative;
}

.search-field {
  flex: 1 1 300px;
  max-width: 460px;
}

.search-icon {
  position: absolute;
  top: 50%;
  left: 0.95rem;
  width: 1.15rem;
  height: 1.15rem;
  transform: translateY(-50%);
  fill: none;
  stroke: var(--ink);
  stroke-width: 2;
  stroke-linecap: square;
  pointer-events: none;
}

.search-field input {
  width: 100%;
  height: 50px;
  padding: 0.6rem 2.7rem 0.6rem 2.8rem;
  border: 2px solid var(--ink);
  border-radius: 2px;
  background: var(--paper);
  font-family: var(--text);
  font-size: 1rem;
  line-height: 1.2;
}

.search-field input::placeholder {
  color: #666b72;
  opacity: 1;
}

.search-field input:focus {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
  border-color: var(--blue);
}

.select-field {
  flex: 0 0 auto;
}

.select-field select {
  width: 11.6rem;
  height: 50px;
  padding: 0 2.5rem 0 0.85rem;
  border: 2px solid var(--ink);
  border-radius: 2px;
  background: var(--paper);
  font-family: var(--text);
  font-size: 0.96rem;
  font-weight: 500;
  appearance: none;
  cursor: pointer;
}

.select-field select:focus {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
  border-color: var(--blue);
}

.select-chevron {
  position: absolute;
  top: 50%;
  right: 0.85rem;
  width: 1rem;
  height: 1rem;
  transform: translateY(-50%);
  fill: none;
  stroke: var(--ink);
  stroke-width: 2;
  stroke-linecap: square;
  pointer-events: none;
}

.saved-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  height: 50px;
  padding: 0 1rem;
  border: 2px solid var(--ink);
  border-radius: 2px;
  background: transparent;
  font-family: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1;
}

.saved-toggle:hover {
  background: var(--yellow);
}

.saved-toggle[aria-pressed="true"] {
  background: var(--blue);
  border-color: var(--blue);
  color: var(--paper);
}

.saved-toggle[aria-pressed="true"]:hover {
  background: var(--blue-deep);
  border-color: var(--blue-deep);
}

.saved-toggle:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

.saved-toggle[aria-pressed="true"]:focus-visible {
  outline-color: var(--yellow);
}

.bookmark-icon {
  width: 0.95rem;
  height: 1.15rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linejoin: miter;
}

.saved-toggle[aria-pressed="true"] .bookmark-icon {
  fill: currentColor;
}

.saved-count {
  display: inline-grid;
  place-items: center;
  min-width: 1.45rem;
  height: 1.45rem;
  padding: 0 0.3rem;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-family: var(--display);
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1;
}

.results {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.35rem var(--gutter) 0.15rem;
  font-family: var(--display);
  font-size: 0.95rem;
  font-weight: 400;
  letter-spacing: 0.015em;
}

/* Story grid */

.stories {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3.25rem 2rem;
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.6rem var(--gutter) 5.5rem;
}

.stories:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 4px;
}

.story {
  display: flex;
  flex-direction: column;
  min-width: 0;
  cursor: pointer;
}

.story .media {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  aspect-ratio: 3 / 2;
  background: var(--blue);
}

.story .media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1) contrast(1.06);
  mix-blend-mode: luminosity;
  opacity: 0.92;
}

.story[data-category="Places"] .media {
  background: var(--places);
}

.story[data-category="Movement"] .media {
  background: var(--movement);
}

.story[data-category="People"] .media {
  background: var(--people);
}

.story[data-category="Food"] .media {
  background: var(--food);
}

.story[data-category="Culture"] .media {
  background: var(--culture);
}

.story-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
  padding-top: 1rem;
}

.chip {
  display: inline-block;
  padding: 0.36rem 0.55rem 0.32rem;
  border-radius: 2px;
  background: var(--blue);
  color: #fff;
  font-family: var(--text);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: 0.015em;
}

.chip[data-category="Places"] {
  background: var(--places);
}

.chip[data-category="Movement"] {
  background: var(--movement);
}

.chip[data-category="People"] {
  background: var(--people);
}

.chip[data-category="Food"] {
  background: var(--food);
}

.chip[data-category="Culture"] {
  background: var(--culture);
}

.story-title {
  margin: 0.85rem 0 0.55rem;
  font-family: var(--display);
  font-size: 1.65rem;
  font-weight: 500;
  line-height: 1.04;
  letter-spacing: -0.008em;
  text-wrap: balance;
}

.summary {
  margin: 0 0 1.05rem;
  max-width: 42ch;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.64;
}

.byline {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.5;
  letter-spacing: 0.01em;
}

.saved-mark {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0.65rem 0 0;
  color: var(--blue);
  font-family: var(--display);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.saved-mark svg {
  width: 0.7rem;
  height: 0.9rem;
  fill: currentColor;
}

.read-btn {
  margin: 1.25rem 0 0;
  padding: 0.33rem 0.45rem;
  border: 0;
  border-bottom: 2px solid var(--ink);
  border-radius: 0;
  background: transparent;
  font-family: var(--text);
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0.01em;
  align-self: flex-start;
  transition: background-color 140ms ease;
}

.story:not(.feature) .read-btn {
  margin-top: auto;
  margin-left: -0.45rem;
}

.read-btn:hover {
  background: var(--yellow);
}

.read-btn:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

/* Lead story */

.story.feature {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1.06fr) minmax(0, 0.94fr);
  align-items: stretch;
  background: var(--blue);
  color: var(--paper);
}

.story.feature .media {
  aspect-ratio: auto;
  min-height: 480px;
}

.story.feature .media img {
  position: absolute;
  inset: 0;
  opacity: 0.94;
}

.story.feature .story-body {
  padding: 2.9rem 3rem 2.7rem;
  justify-content: flex-start;
}

.story.feature .chip {
  background: var(--yellow);
  color: var(--ink);
}

.story.feature .story-title {
  max-width: 17ch;
  margin: 1.1rem 0 1rem;
  font-size: clamp(2.45rem, 4.2vw, 3.85rem);
  font-weight: 500;
  line-height: 0.99;
  letter-spacing: -0.014em;
}

.story.feature .summary {
  max-width: 46ch;
  margin-bottom: 1.4rem;
  color: #dbdef2;
  font-size: 1.03rem;
  line-height: 1.6;
}

.story.feature .byline {
  color: #c5c9e5;
}

.story.feature .saved-mark {
  color: var(--yellow);
}

.story.feature .read-btn {
  margin-top: auto;
  padding: 0.8rem 1.2rem 0.76rem;
  border: 2px solid var(--ink);
  background: var(--yellow);
  color: var(--ink);
  font-size: 0.92rem;
}

.story.feature .read-btn:hover {
  background: var(--paper);
}

.story.feature .read-btn:focus-visible {
  outline: 3px solid var(--paper);
  outline-offset: 3px;
}

/* Empty state */

.empty-state {
  grid-column: 1 / -1;
  max-width: 780px;
  padding: 2.5rem clamp(1.5rem, 4vw, 3rem) 2.75rem;
  border: 2px solid var(--ink);
  border-left: 12px solid var(--yellow);
  background: var(--paper-deep);
}

.empty-state h2 {
  margin: 0 0 0.8rem;
  font-family: var(--display);
  font-size: clamp(1.8rem, 3.4vw, 2.4rem);
  font-weight: 500;
  line-height: 1.02;
  letter-spacing: -0.01em;
}

.empty-state p {
  max-width: 54ch;
  margin: 0 0 1.5rem;
  font-size: 1rem;
  line-height: 1.68;
}

.clear-btn {
  padding: 0.72rem 1rem;
  border: 2px solid var(--blue);
  border-radius: 2px;
  background: var(--blue);
  color: var(--paper);
  font-family: var(--text);
  font-size: 0.92rem;
  font-weight: 600;
}

.clear-btn:hover {
  background: var(--blue-deep);
  border-color: var(--blue-deep);
}

.clear-btn:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}

/* Footer */

.site-footer {
  background: var(--ink);
  color: #e9e9e1;
}

.footer-rule {
  height: 10px;
  background: var(--yellow);
}

.footer-inner {
  display: grid;
  grid-template-columns: minmax(150px, 0.8fr) minmax(0, 1.4fr);
  gap: 2rem;
  max-width: var(--max);
  margin: 0 auto;
  padding: 2.6rem var(--gutter) 4rem;
}

.footer-wordmark {
  margin: 0 0 0.5rem;
  color: var(--yellow);
  font-family: var(--display);
  font-size: 2.7rem;
  font-weight: 500;
  line-height: 0.9;
  letter-spacing: -0.025em;
}

.footer-issue {
  margin: 0;
  font-family: var(--display);
  font-size: 0.86rem;
  letter-spacing: 0.02em;
}

.footer-notes {
  max-width: 62ch;
}

.footer-notes p {
  margin: 0 0 0.7rem;
  font-size: 0.85rem;
  line-height: 1.65;
  color: #cfd0ca;
}

.footer-notes p:last-child {
  margin-bottom: 0;
}

/* Detail dialog */

dialog {
  width: min(800px, calc(100vw - 3rem));
  max-width: none;
  max-height: min(900px, 90vh);
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 2px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 30px 80px rgba(6, 8, 14, 0.36);
  overflow-y: auto;
  overscroll-behavior: contain;
}

dialog::backdrop {
  background: rgba(8, 10, 16, 0.68);
}

dialog[open] {
  animation: dialog-in 200ms ease-out;
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.detail-bar {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem;
  padding: 1.1rem 2rem;
  border-bottom: 1px solid rgba(242, 242, 236, 0.22);
  background: var(--blue);
  color: var(--paper);
}

.detail-bar .chip {
  background: var(--yellow);
  color: var(--ink);
}

.detail-head {
  padding: 0.35rem 2rem 2.1rem;
  background: var(--blue);
  color: var(--paper);
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.save-btn,
.close-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid rgba(242, 242, 236, 0.6);
  border-radius: 2px;
  background: transparent;
  color: var(--paper);
  font-family: var(--text);
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.2;
}

.save-btn:hover,
.close-btn:hover {
  background: rgba(255, 210, 74, 0.16);
  border-color: var(--yellow);
}

.save-btn[aria-pressed="true"] {
  background: var(--yellow);
  border-color: var(--yellow);
  color: var(--ink);
}

.save-btn[aria-pressed="true"]:hover {
  background: #ffe18a;
  border-color: #ffe18a;
}

.save-btn:focus-visible,
.close-btn:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 2px;
}

.save-btn svg {
  width: 0.85rem;
  height: 1.05rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linejoin: miter;
}

.save-btn[aria-pressed="true"] svg {
  fill: currentColor;
}

.close-btn .close-glyph {
  font-family: var(--display);
  font-size: 1.25rem;
  font-weight: 400;
  line-height: 0.8;
}

.detail-title {
  max-width: 21ch;
  margin: 1.35rem 0 0;
  font-family: var(--display);
  font-size: clamp(2.05rem, 4.2vw, 3rem);
  font-weight: 500;
  line-height: 1.01;
  letter-spacing: -0.014em;
  text-wrap: balance;
}

.detail-summary {
  max-width: 53ch;
  margin: 0.95rem 0 1.15rem;
  color: #d9dcf0;
  font-size: 1.02rem;
  line-height: 1.56;
}

.detail-byline {
  margin: 0;
  color: #c5c9e5;
  font-size: 0.82rem;
  line-height: 1.5;
}

.detail-byline span {
  display: block;
}

.detail-media {
  margin: 0;
  aspect-ratio: 16 / 7;
  overflow: hidden;
  isolation: isolate;
  background: var(--blue);
}

.detail-media[data-category="Places"] {
  background: var(--places);
}

.detail-media[data-category="Movement"] {
  background: var(--movement);
}

.detail-media[data-category="People"] {
  background: var(--people);
}

.detail-media[data-category="Food"] {
  background: var(--food);
}

.detail-media[data-category="Culture"] {
  background: var(--culture);
}

.detail-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1) contrast(1.06);
  mix-blend-mode: luminosity;
  opacity: 0.92;
}

.detail-credit {
  margin: 0;
  padding: 0.7rem clamp(1.5rem, 5vw, 3.5rem) 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.5;
}

.detail-body {
  padding: 2.4rem clamp(1.5rem, 5vw, 3.5rem) 3.3rem;
}

.detail-body p {
  max-width: 60ch;
  margin: 0 0 1.25em;
  font-size: 1.05rem;
  line-height: 1.76;
}

.detail-body p:first-child {
  font-size: 1.14rem;
  line-height: 1.72;
}

.detail-body::after {
  content: "";
  display: block;
  width: 2.6rem;
  height: 0.55rem;
  margin-top: 2.2rem;
  background: var(--yellow);
}

/* Responsive */

@media (max-width: 1040px) {
  .stories {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .story.feature .story-body {
    padding: 2.3rem 2.2rem 2.2rem;
  }

  .story.feature .media {
    min-height: 430px;
  }
}

@media (max-width: 760px) {
  :root {
    --gutter: 1.25rem;
  }

  .masthead {
    padding-top: 1.5rem;
  }

  .wordmark {
    font-size: clamp(4.5rem, 19vw, 7rem);
  }

  .brandrow {
    align-items: flex-end;
    gap: 1rem;
  }

  .issue-meta {
    margin-bottom: 0.3rem;
    font-size: 0.78rem;
  }

  .deck {
    margin: 1.35rem 0 1.55rem;
    font-size: 1.02rem;
    line-height: 1.55;
  }

  .controls-inner {
    padding-top: 0.85rem;
    padding-bottom: 0.9rem;
  }

  .search-field {
    flex-basis: 100%;
    max-width: none;
  }

  .select-field {
    flex: 1 1 auto;
  }

  .select-field select {
    width: 100%;
  }

  .saved-toggle {
    flex: 0 0 auto;
  }

  .results {
    padding-top: 1.15rem;
  }

  .stories {
    grid-template-columns: minmax(0, 1fr);
    gap: 2.5rem;
    padding-top: 1.35rem;
    padding-bottom: 4rem;
  }

  .story.feature {
    grid-template-columns: minmax(0, 1fr);
  }

  .story.feature .media {
    order: -1;
    min-height: 0;
    aspect-ratio: 16 / 10;
  }

  .story.feature .story-body {
    padding: 1.6rem 1.35rem 1.7rem;
  }

  .story.feature .story-title {
    max-width: 20ch;
    margin-top: 0.9rem;
    font-size: clamp(2.1rem, 10.2vw, 2.8rem);
  }

  .story.feature .summary {
    font-size: 1rem;
  }

  .story-title {
    font-size: 1.55rem;
  }

  .summary {
    font-size: 0.96rem;
  }

  .story:not(.feature) .media {
    aspect-ratio: 16 / 9;
  }

  .footer-inner {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
    padding-bottom: 3rem;
  }

  .footer-notes {
    max-width: 46ch;
  }

  dialog {
    width: 100%;
    max-width: none;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border-radius: 0;
  }

  .detail-bar {
    padding: 0.85rem 1.1rem;
    gap: 0.7rem;
  }

  .detail-head {
    padding: 0.25rem 1.1rem 1.55rem;
  }

  .detail-title {
    margin-top: 1.1rem;
    font-size: clamp(1.9rem, 8.4vw, 2.5rem);
  }

  .detail-summary {
    font-size: 0.98rem;
  }

  .detail-media {
    aspect-ratio: 4 / 3;
  }

  .detail-body {
    padding: 1.7rem 1.25rem 2.5rem;
  }

  .detail-credit {
    padding: 0.65rem 1.25rem 0;
  }

  .detail-body p {
    font-size: 1rem;
    line-height: 1.72;
  }

  .detail-body p:first-child {
    font-size: 1.08rem;
  }
}

@media (max-width: 400px) {
  .saved-toggle {
    padding: 0 0.75rem;
  }

  .select-field select {
    font-size: 0.92rem;
  }

  .close-btn {
    padding: 0.5rem 0.6rem;
  }
}

@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;
  }
}
