:root {
  --pine: #12100e;
  --pine-2: #1c1914;
  --fog: #c9c4b8;
  --fog-2: #9a9488;
  --motel: #8c2f2b;
  --motel-2: #c45c4a;
  --sodium: #d4a017;
  --paper: #e7dfd0;
  --ink: #1a1714;
  --line: #3d3830;
  --ease: 220ms ease-out;
  --nav-h: 3.75rem;
  --pad-x: 1rem;
  color-scheme: dark;
}

html[data-theme="fog"] {
  --pine: #e7dfd0;
  --pine-2: #d8d0c0;
  --fog: #2a261f;
  --fog-2: #5a5348;
  --motel: #8c2f2b;
  --motel-2: #6a1f1c;
  --sodium: #8a6a10;
  --paper: #f4eee3;
  --ink: #1a1714;
  --line: #b7ae9e;
  color-scheme: light;
}

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

html,
body {
  margin: 0;
  padding: 0;
}

html {
  background: var(--pine);
}

body {
  font-family: "IBM Plex Serif", "Iwanami Mincho", "Noto Serif KR", "Noto Serif SC", Georgia, serif;
  background:
    repeating-linear-gradient(90deg, transparent, transparent 47px, rgba(212, 160, 23, 0.06) 48px),
    repeating-linear-gradient(0deg, transparent, transparent 47px, rgba(140, 47, 43, 0.05) 48px),
    var(--pine);
  color: var(--fog);
  min-height: 100%;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 2rem);
}

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

a {
  color: var(--sodium);
}

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--sodium);
  outline-offset: 3px;
}

.skip {
  position: absolute;
  left: 0.5rem;
  top: 0.5rem;
  z-index: 40;
  background: var(--sodium);
  color: var(--pine);
  padding: 0.75rem 1rem;
  min-height: 44px;
  transform: translateY(-140%);
}

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

.grain {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 30;
  opacity: 0.09;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
}

.wrap {
  width: min(1080px, 100% - 2 * var(--pad-x));
  margin-inline: auto;
}

.site-head {
  position: relative;
  z-index: 6;
  border-bottom: 1px dashed var(--line);
  background: linear-gradient(180deg, rgba(18, 16, 14, 0.92), transparent);
}

html[data-theme="fog"] .site-head {
  background: linear-gradient(180deg, rgba(231, 223, 208, 0.94), transparent);
}

.hbar {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.6rem;
  min-height: 3.75rem;
  padding: 0.4rem 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  color: var(--fog);
  min-height: 44px;
}

.brand img {
  width: 44px;
  height: 17px;
  object-fit: cover;
  border: 1px solid var(--motel);
  filter: saturate(0.85) contrast(1.05);
}

.brand-name {
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand-name span {
  color: var(--motel-2);
}

.desk-nav {
  display: none;
  flex: 1 1 auto;
  min-width: 0;
}

.desk-nav ul {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.15rem 0.55rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.desk-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  text-decoration: none;
  color: var(--fog);
  font-size: 0.88rem;
  white-space: nowrap;
  border-bottom: 1px solid transparent;
}

.desk-nav a:hover {
  border-bottom-color: var(--sodium);
}

.tools {
  margin-left: auto;
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 0.25rem;
}

.icon-btn,
.locale-btn,
.theme-btn {
  min-width: 44px;
  min-height: 44px;
  border: 1px solid var(--line);
  background: var(--pine-2);
  color: var(--fog);
  font: inherit;
  cursor: pointer;
}

.drawer {
  display: none;
  border-top: 1px solid var(--line);
  background: var(--pine-2);
}

.drawer.is-open {
  display: block;
}

.drawer ul {
  list-style: none;
  margin: 0;
  padding: 0.5rem 0 1rem;
}

.drawer a {
  display: flex;
  align-items: center;
  min-height: 44px;
  text-decoration: none;
  color: var(--fog);
  border-bottom: 1px dotted var(--line);
}

.hero {
  position: relative;
  padding: 1.25rem 0 2rem;
}

.hero-art {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--motel);
  box-shadow: 8px 8px 0 rgba(140, 47, 43, 0.25);
}

.hero-art img {
  width: 100%;
  min-height: 160px;
  object-fit: cover;
  filter: contrast(1.08) saturate(0.9);
}

.hero-stamp {
  position: absolute;
  right: 0.6rem;
  bottom: 0.6rem;
  background: var(--paper);
  color: var(--ink);
  padding: 0.55rem 0.7rem;
  transform: rotate(-2deg);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  max-width: min(70%, 16rem);
}

.kicker {
  margin: 1rem 0 0.2rem;
  color: var(--sodium);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.72rem;
}

h1 {
  font-weight: 600;
  font-size: clamp(1.6rem, 6vw, 2.7rem);
  line-height: 1.15;
  margin: 0 0 0.8rem;
  overflow-wrap: anywhere;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 1rem;
  background: var(--motel);
  color: var(--paper);
  text-decoration: none;
  border: 1px solid var(--sodium);
}

.btn-ghost {
  background: transparent;
  color: var(--fog);
}

.ledger {
  margin: 1.5rem 0 0;
  display: grid;
  gap: 0.7rem;
}

.ledger dl {
  margin: 0;
  padding: 0.7rem 0.8rem;
  border-left: 3px solid var(--sodium);
  background: rgba(28, 25, 20, 0.7);
}

html[data-theme="fog"] .ledger dl {
  background: rgba(244, 238, 227, 0.7);
}

.ledger dt {
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fog-2);
}

.ledger dd {
  margin: 0.2rem 0 0;
  font-size: 1.05rem;
}

.strip-label {
  margin: 0 0 0.6rem;
  font-size: 0.8rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--motel-2);
}

.highway {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  max-width: 100%;
  padding-bottom: 0.6rem;
  scroll-snap-type: x mandatory;
}

.mile {
  flex: 0 0 auto;
  scroll-snap-align: start;
  width: min(70vw, 220px);
  min-height: 7.5rem;
  padding: 1rem 0.9rem;
  text-decoration: none;
  color: var(--fog);
  background: var(--pine-2);
  border: 1px solid var(--line);
  border-top: 4px solid var(--motel);
  position: relative;
}

.mile:nth-child(2n) {
  border-top-color: var(--sodium);
  transform: rotate(0.4deg);
}

.mile:nth-child(3n) {
  width: min(78vw, 260px);
  border-top-color: var(--fog-2);
}

.mile h2 {
  margin: 0;
  font-size: 1.15rem;
}

.mile::after {
  content: "";
  position: absolute;
  left: 0.9rem;
  right: 0.9rem;
  bottom: 0.7rem;
  height: 2px;
  background: repeating-linear-gradient(90deg, var(--sodium) 0 10px, transparent 10px 16px);
}

.polaroids {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  margin: 2rem 0;
}

.polaroid {
  background: var(--paper);
  color: var(--ink);
  padding: 0.55rem 0.55rem 1.4rem;
  transform: rotate(-1.2deg);
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.25);
}

.polaroid:nth-child(2) {
  transform: rotate(1.4deg);
  align-self: flex-end;
  width: 92%;
}

.polaroid figcaption {
  margin-top: 0.45rem;
  font-size: 0.8rem;
}

.page {
  padding: 1.2rem 0 3rem;
}

.crumbs {
  font-size: 0.9rem;
  margin-bottom: 0.8rem;
}

.dossier {
  background:
    linear-gradient(180deg, rgba(231, 223, 208, 0.04), transparent 40%),
    var(--pine-2);
  border: 1px solid var(--line);
  padding: 1rem 1rem 1.4rem;
}

html[data-theme="fog"] .dossier {
  background: var(--paper);
  color: var(--ink);
}

.chapter {
  margin: 1.4rem 0;
  padding-top: 0.4rem;
  border-top: 1px dashed var(--line);
}

.chapter h2 {
  font-size: 1.25rem;
  margin: 0 0 0.5rem;
  overflow-wrap: anywhere;
}

.chapter p {
  margin: 0;
  line-height: 1.6;
}

.unknown {
  display: inline-block;
  margin-top: 0.45rem;
  font-size: 0.8rem;
  color: var(--motel-2);
}

.sources {
  margin-top: 2rem;
}

.sources ul {
  padding-left: 1.1rem;
}

.foot {
  border-top: 1px dashed var(--line);
  padding: 1.2rem 0 2rem;
  font-size: 0.88rem;
}

.foot-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 0.6rem;
}

.foot-nav a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.fixed-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(5, minmax(44px, 1fr));
  gap: 0.15rem;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  min-height: var(--nav-h);
  padding: 0.3rem 0.3rem calc(0.3rem + env(safe-area-inset-bottom, 0px));
  background: #0d0c0a;
  border-top: 1px solid var(--sodium);
  overflow: hidden;
}

.fixed-nav .icon-btn {
  width: 100%;
  min-width: 44px;
  min-height: 44px;
  padding: 0 0.15rem;
  font-size: 0.72rem;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

html[data-theme="fog"] .fixed-nav {
  background: #d8d0c0;
}

.search-panel,
.locale-menu,
.bookmark-panel {
  position: fixed;
  z-index: 25;
  right: 0.6rem;
  left: 0.6rem;
  bottom: calc(var(--nav-h) + 0.4rem);
  background: var(--pine-2);
  border: 1px solid var(--sodium);
  padding: 0.7rem;
  max-height: min(60vh, 22rem);
  overflow: auto;
}

.search-panel[hidden],
.locale-menu[hidden],
.bookmark-panel[hidden] {
  display: none;
}

.search-panel input {
  width: 100%;
  min-height: 44px;
  font: inherit;
  padding: 0.4rem 0.6rem;
  background: var(--pine);
  color: var(--fog);
  border: 1px solid var(--line);
}

.search-hits a,
.locale-menu button,
.bookmark-panel a {
  display: flex;
  align-items: center;
  min-height: 44px;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  border-bottom: 1px dotted var(--line);
  color: var(--fog);
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}

.fade-in {
  animation: fade 220ms ease-out;
}

@keyframes fade {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (min-width: 768px) {
  body {
    padding-bottom: 1rem;
  }

  .desk-nav {
    display: block;
  }

  #menu-btn {
    display: none;
  }

  .drawer {
    display: none !important;
  }

  .fixed-nav {
    position: static;
    display: flex;
    grid-template-columns: none;
    background: transparent;
    border: 0;
    min-height: 44px;
    padding: 0;
    width: auto;
    max-width: none;
    overflow: visible;
    justify-content: flex-end;
    gap: 0.25rem;
  }

  .fixed-nav .icon-btn {
    width: auto;
    padding: 0 0.55rem;
    font-size: 0.8rem;
    overflow: visible;
    text-overflow: unset;
  }

  .search-panel,
  .locale-menu,
  .bookmark-panel {
    left: auto;
    width: 18rem;
    bottom: auto;
    top: 4.2rem;
  }

  .hero-grid {
    display: grid;
    grid-template-columns: 1.3fr 0.7fr;
    gap: 1.4rem;
    align-items: end;
  }

  .polaroids {
    flex-direction: row;
    align-items: flex-start;
  }

  .polaroid,
  .polaroid:nth-child(2) {
    width: 48%;
    align-self: auto;
  }

  .dossier {
    max-width: 42rem;
  }
}

@media (min-width: 1280px) {
  :root {
    --pad-x: 1.5rem;
  }

  .wrap {
    width: min(1360px, 100% - 2 * var(--pad-x));
  }

  .highway {
    overflow: visible;
    flex-wrap: wrap;
  }

  .mile,
  .mile:nth-child(3n) {
    width: calc(33.33% - 0.55rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .fade-in,
  .mile:nth-child(2n),
  .polaroid,
  .hero-stamp {
    animation: none;
    transform: none;
  }

  * {
    scroll-behavior: auto;
  }
}
