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

@font-face {
  font-family: "Space Grotesk Local";
  src: url("assets/space-grotesk.ttf") format("truetype");
  font-weight: 300 700;
  font-display: swap;
}

:root {
  --night: #17233b;
  --signal: #ffd447;
  --chalk: #f7f8f2;
  --concrete: #d8dcd5;
  --blue: #246bce;
  --culture: #7650a6;
  --food: #da5b42;
  --movement: #246bce;
  --people: #16856f;
  --places: #c19112;
  --display: "Literata Local", Georgia, serif;
  --sans: "Space Grotesk Local", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background: var(--chalk);
}

body {
  margin: 0;
  color: var(--night);
  background: var(--chalk);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

button,
a,
input,
select {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

a {
  color: inherit;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 10px;
  left: 10px;
  padding: 10px 14px;
  color: white;
  background: var(--night);
  transform: translateY(-180%);
}

.skip-link:focus {
  transform: translateY(0);
}

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

.site-header {
  min-height: 82px;
  padding: 0 clamp(24px, 5vw, 76px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  border-bottom: 1px solid var(--night);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: 0.045em;
  text-decoration: none;
}

.wordmark-mark {
  width: 30px;
  height: 30px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 3px;
  padding: 4px;
  background: var(--night);
}

.wordmark-mark i {
  display: block;
  background: var(--chalk);
}

.issue-line {
  margin: 0;
  display: flex;
  gap: 30px;
  font-size: 0.82rem;
}

.issue-line span {
  font-weight: 600;
}

.intro {
  min-height: 430px;
  padding: clamp(54px, 7vw, 100px) clamp(24px, 5vw, 76px) 70px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 0.34fr);
  align-items: end;
  gap: 8vw;
  color: white;
  background:
    linear-gradient(90deg, transparent 0 9%, rgba(255, 255, 255, 0.09) 9% 9.15%, transparent 9.15% 18%, rgba(255, 255, 255, 0.09) 18% 18.15%, transparent 18.15%),
    var(--night);
}

.intro-copy {
  max-width: 900px;
}

.intro-kicker {
  margin: 0 0 18px;
  font-size: clamp(1rem, 1.5vw, 1.25rem);
  color: var(--signal);
}

.intro h1 {
  max-width: 19ch;
  margin: 0;
  font-family: var(--display);
  font-size: clamp(3.2rem, 6.3vw, 6.3rem);
  font-weight: 520;
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.intro-note {
  max-width: 340px;
  padding-left: 24px;
  border-left: 8px solid var(--signal);
}

.intro-note p {
  margin: 0 0 30px;
  font-size: 1.02rem;
  line-height: 1.55;
}

.intro-note a {
  display: inline-block;
  padding-bottom: 5px;
  border-bottom: 2px solid var(--signal);
  font-weight: 650;
  text-decoration: none;
}

.browse-layout {
  display: grid;
  grid-template-columns: minmax(285px, 0.32fr) minmax(0, 1fr);
}

.route-panel {
  position: relative;
  border-right: 1px solid var(--night);
  background: var(--signal);
}

.route-panel-inner {
  position: sticky;
  top: 0;
  padding: 58px clamp(24px, 4vw, 60px) 60px;
}

.panel-title {
  margin: 0 0 42px;
  font-family: var(--display);
  font-size: clamp(1.8rem, 2.5vw, 2.55rem);
  font-weight: 600;
  letter-spacing: -0.035em;
}

.search-field,
.filter-field {
  display: block;
  margin-bottom: 27px;
  font-size: 0.82rem;
  font-weight: 650;
}

.search-input-wrap,
.select-wrap {
  position: relative;
  display: block;
  margin-top: 9px;
}

.search-input-wrap svg {
  position: absolute;
  top: 50%;
  left: 15px;
  width: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  transform: translateY(-50%);
  pointer-events: none;
}

.search-field input,
.filter-field select {
  width: 100%;
  height: 51px;
  border: 1px solid var(--night);
  border-radius: 0;
  color: var(--night);
  background: var(--chalk);
  font-size: 0.95rem;
}

.search-field input {
  padding: 0 14px 0 47px;
}

.search-field input::placeholder {
  color: #6a6d72;
  opacity: 1;
}

.filter-field select {
  padding: 0 42px 0 15px;
  appearance: none;
}

.select-wrap::after {
  content: "";
  position: absolute;
  top: 19px;
  right: 18px;
  width: 8px;
  height: 8px;
  border-right: 2px solid;
  border-bottom: 2px solid;
  transform: rotate(45deg);
  pointer-events: none;
}

.saved-toggle {
  width: 100%;
  min-height: 51px;
  padding: 0 13px;
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--night);
  border-radius: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.saved-toggle svg,
.save-button svg,
.saved-indicator svg {
  width: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
}

.saved-toggle span {
  font-weight: 650;
}

.saved-count {
  min-width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--night);
  font-size: 0.76rem;
}

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

.saved-toggle[aria-pressed="true"] .saved-count {
  color: var(--night);
  background: var(--signal);
}

.route-key {
  margin-top: 55px;
  padding-top: 20px;
  border-top: 1px solid rgba(23, 35, 59, 0.45);
}

.route-key p {
  margin: 0 0 15px;
  font-size: 0.78rem;
  font-weight: 700;
}

.route-key ul {
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px 16px;
  list-style: none;
  font-size: 0.78rem;
}

.route-key li {
  display: flex;
  align-items: center;
  gap: 8px;
}

.route-key i {
  width: 10px;
  height: 10px;
  display: inline-block;
  border-radius: 50%;
  background: var(--category);
}

.key-culture { --category: var(--culture); }
.key-food { --category: var(--food); }
.key-movement { --category: var(--movement); }
.key-people { --category: var(--people); }
.key-places { --category: var(--places); }

.story-board {
  min-width: 0;
  padding: 58px clamp(28px, 6vw, 92px) 90px;
  overflow: hidden;
}

.story-board-head {
  margin-bottom: 34px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
}

.board-label {
  margin: 0 0 5px;
  color: #626a74;
  font-size: 0.85rem;
}

.story-board-head h2 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(2.6rem, 4.4vw, 4.8rem);
  font-weight: 540;
  letter-spacing: -0.05em;
  line-height: 1;
}

#result-count {
  margin: 0 0 7px;
  font-size: 0.84rem;
  font-weight: 650;
}

.story-list {
  position: relative;
}

.story-list::before {
  content: "";
  position: absolute;
  z-index: 0;
  top: 0;
  bottom: 0;
  left: 31px;
  width: 4px;
  background: var(--concrete);
}

.story-item {
  --category: var(--movement);
  position: relative;
  z-index: 1;
  min-height: 176px;
  padding: 31px 74px 31px 91px;
  display: grid;
  grid-template-columns: minmax(92px, 0.2fr) minmax(0, 1fr);
  align-items: start;
  gap: 26px;
  border-top: 1px solid var(--concrete);
}

.story-item:last-child {
  border-bottom: 1px solid var(--concrete);
}

.story-item[data-category="Culture"] { --category: var(--culture); }
.story-item[data-category="Food"] { --category: var(--food); }
.story-item[data-category="Movement"] { --category: var(--movement); }
.story-item[data-category="People"] { --category: var(--people); }
.story-item[data-category="Places"] { --category: var(--places); }

.route-node {
  position: absolute;
  top: 34px;
  left: 18px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 4px solid var(--chalk);
  border-radius: 50%;
  background: var(--category);
}

.route-node span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: white;
}

.story-category {
  padding-top: 5px;
  color: var(--category);
  font-size: 0.79rem;
  font-weight: 700;
}

.story-copy h3 {
  max-width: 22ch;
  margin: 0;
  font-family: var(--display);
  font-size: clamp(1.65rem, 2.2vw, 2.45rem);
  font-weight: 560;
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.story-summary {
  max-width: 60ch;
  margin: 12px 0 17px;
  color: #515968;
  font-size: 0.93rem;
  line-height: 1.5;
}

.story-byline {
  font-size: 0.76rem;
  font-weight: 600;
}

.story-byline span + span::before {
  content: "/";
  margin: 0 8px;
  color: #90959d;
}

.open-story {
  position: absolute;
  top: 50%;
  right: 5px;
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border: 1px solid var(--night);
  border-radius: 50%;
  background: transparent;
  transform: translateY(-50%);
  cursor: pointer;
}

.open-story svg {
  width: 27px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
}

.open-story:hover,
.open-story:focus-visible {
  color: white;
  background: var(--night);
}

.saved-indicator {
  position: absolute;
  top: 34px;
  right: 68px;
  color: var(--night);
}

.empty-state {
  min-height: 430px;
  padding: 100px 20px;
  text-align: center;
}

.empty-state[hidden] {
  display: none;
}

.empty-marker {
  width: 42px;
  height: 42px;
  display: block;
  margin: 0 auto 24px;
  border: 10px solid var(--concrete);
  border-radius: 50%;
}

.empty-state h3 {
  margin: 0 0 10px;
  font-family: var(--display);
  font-size: 2rem;
}

.empty-state p {
  margin: 0 auto 26px;
  color: #515968;
}

.empty-state button {
  padding: 12px 18px;
  border: 1px solid var(--night);
  background: var(--signal);
  font-weight: 650;
  cursor: pointer;
}

.site-footer {
  min-height: 140px;
  padding: 36px clamp(24px, 5vw, 76px);
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  color: white;
  background: var(--night);
  font-size: 0.8rem;
}

.site-footer p {
  margin: 0;
}

.site-footer strong {
  color: var(--signal);
}

.detail-dialog {
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  color: var(--night);
  background: var(--chalk);
}

.detail-dialog::backdrop {
  background: rgba(23, 35, 59, 0.82);
}

.detail-dialog[open] {
  display: block;
}

.dialog-shell {
  min-height: 100%;
}

.dialog-topbar {
  position: sticky;
  z-index: 4;
  top: 0;
  min-height: 78px;
  padding: 0 clamp(22px, 5vw, 74px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  color: white;
  background: var(--night);
}

.dialog-brand {
  color: var(--signal);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-decoration: none;
}

.close-detail {
  min-height: 44px;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 13px;
  border: 0;
  color: white;
  background: transparent;
  font-weight: 600;
  cursor: pointer;
}

.close-detail svg {
  width: 25px;
  fill: none;
  stroke: var(--signal);
  stroke-width: 1.7;
}

.article-layout {
  min-height: calc(100vh - 78px);
  display: grid;
  grid-template-columns: minmax(270px, 0.36fr) minmax(0, 1fr);
}

.article-meta {
  position: relative;
  padding: clamp(64px, 8vw, 118px) clamp(30px, 6vw, 88px);
  color: var(--night);
  background: var(--signal);
}

.article-meta p {
  margin: 0 0 11px;
  font-size: 0.85rem;
}

.article-meta .detail-category {
  margin-bottom: 38px;
  font-size: 1.05rem;
  font-weight: 700;
}

.article-stop {
  width: 48px;
  height: 48px;
  margin-bottom: 35px;
  display: grid;
  place-items: center;
  border: 6px solid var(--night);
  border-radius: 50%;
}

.article-stop span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--night);
}

.save-button {
  width: 100%;
  max-width: 260px;
  min-height: 54px;
  margin-top: 34px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  border: 1px solid var(--night);
  border-radius: 0;
  background: transparent;
  font-weight: 650;
  cursor: pointer;
}

.save-button[aria-pressed="true"] {
  color: white;
  background: var(--night);
}

.save-button[aria-pressed="true"] svg {
  fill: var(--signal);
  stroke: var(--signal);
}

.article-main {
  width: 100%;
  max-width: 930px;
  padding: clamp(64px, 9vw, 125px) clamp(30px, 9vw, 130px) 110px;
}

.article-main h2 {
  max-width: 15ch;
  margin: 0;
  font-family: var(--display);
  font-size: clamp(3rem, 6vw, 6.2rem);
  font-weight: 520;
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.detail-summary {
  max-width: 53ch;
  margin: 38px 0 58px;
  padding-left: 22px;
  border-left: 7px solid var(--signal);
  font-size: clamp(1.1rem, 1.5vw, 1.35rem);
  line-height: 1.5;
}

.detail-body {
  max-width: 65ch;
}

.detail-body p {
  margin: 0 0 1.35em;
  font-family: var(--display);
  font-size: clamp(1.08rem, 1.25vw, 1.22rem);
  line-height: 1.78;
}

.detail-body p:first-child::first-letter {
  float: left;
  margin: 0.06em 0.1em 0 0;
  color: var(--blue);
  font-size: 4.4em;
  font-weight: 600;
  line-height: 0.78;
}

.article-end {
  margin-top: 68px;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 0.78rem;
  font-weight: 700;
}

.article-end span {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--blue);
}

.article-end p {
  margin: 0;
}

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

@media (max-width: 880px) {
  .intro {
    grid-template-columns: 1fr;
    gap: 48px;
  }

  .intro-note {
    max-width: 500px;
  }

  .browse-layout {
    display: block;
  }

  .route-panel {
    border-right: 0;
    border-bottom: 1px solid var(--night);
  }

  .route-panel-inner {
    position: static;
    padding: 34px 24px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }

  .panel-title,
  .route-key {
    display: none;
  }

  .search-field,
  .filter-field {
    margin: 0;
  }

  .saved-toggle {
    grid-column: 1 / -1;
  }

  .article-layout {
    display: block;
  }

  .article-meta {
    padding: 42px 30px;
  }

  .article-stop {
    display: none;
  }

  .article-meta .detail-category {
    margin-bottom: 18px;
  }

  .save-button {
    margin-top: 24px;
  }
}

@media (max-width: 600px) {
  .site-header {
    min-height: 68px;
    padding: 0 18px;
  }

  .wordmark {
    font-size: 0.95rem;
  }

  .wordmark-mark {
    width: 26px;
    height: 26px;
  }

  .issue-line {
    display: block;
    max-width: 110px;
    font-size: 0.68rem;
    text-align: right;
  }

  .issue-line span {
    display: none;
  }

  .intro {
    min-height: 450px;
    padding: 55px 22px 47px;
    align-content: space-between;
    gap: 50px;
    background:
      linear-gradient(90deg, transparent 0 14%, rgba(255, 255, 255, 0.09) 14% 14.5%, transparent 14.5% 28%, rgba(255, 255, 255, 0.09) 28% 28.5%, transparent 28.5%),
      var(--night);
  }

  .intro-kicker {
    margin-bottom: 16px;
    font-size: 0.95rem;
  }

  .intro h1 {
    max-width: 12ch;
    font-size: clamp(2.75rem, 13.4vw, 3.45rem);
    line-height: 1;
  }

  .intro-note {
    padding-left: 16px;
    border-left-width: 6px;
  }

  .intro-note p {
    margin-bottom: 18px;
    font-size: 0.87rem;
  }

  .route-panel-inner {
    padding: 28px 20px;
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .saved-toggle {
    grid-column: auto;
  }

  .story-board {
    padding: 40px 18px 64px;
  }

  .story-board-head {
    margin-bottom: 25px;
  }

  .story-board-head h2 {
    font-size: 2.6rem;
  }

  #result-count {
    max-width: 75px;
    text-align: right;
  }

  .story-list::before {
    left: 18px;
    width: 3px;
  }

  .story-item {
    min-height: 205px;
    padding: 26px 52px 27px 57px;
    display: block;
  }

  .route-node {
    top: 27px;
    left: 7px;
    width: 25px;
    height: 25px;
    border-width: 4px;
  }

  .route-node span {
    width: 6px;
    height: 6px;
  }

  .story-category {
    margin-bottom: 14px;
    padding-top: 0;
  }

  .story-copy h3 {
    font-size: 1.62rem;
  }

  .story-summary {
    margin: 10px 0 15px;
    font-size: 0.85rem;
  }

  .story-byline span:last-child {
    display: none;
  }

  .open-story {
    right: 0;
    width: 42px;
    height: 42px;
  }

  .saved-indicator {
    top: 28px;
    right: 45px;
  }

  .site-footer {
    min-height: 150px;
    padding: 34px 22px;
    display: block;
  }

  .site-footer p + p {
    margin-top: 18px;
  }

  .dialog-topbar {
    min-height: 66px;
    padding: 0 20px;
  }

  .close-detail span {
    font-size: 0.8rem;
  }

  .article-meta {
    padding: 30px 22px;
  }

  .article-meta p {
    display: inline;
    font-size: 0.78rem;
  }

  .article-meta p + p::before {
    content: "/";
    margin: 0 7px;
    opacity: 0.55;
  }

  .article-meta .detail-category {
    display: block;
    margin-bottom: 14px;
    font-size: 0.95rem;
  }

  .article-meta .detail-category + p::before {
    content: none;
  }

  .save-button {
    width: 100%;
    max-width: none;
    margin-top: 24px;
  }

  .article-main {
    padding: 48px 22px 80px;
  }

  .article-main h2 {
    font-size: clamp(2.7rem, 13vw, 3.4rem);
  }

  .detail-summary {
    margin: 30px 0 42px;
    padding-left: 15px;
    border-left-width: 5px;
    font-size: 1rem;
  }

  .detail-body p {
    font-size: 1.04rem;
    line-height: 1.7;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
