@font-face {
  font-family: "DM Serif Display";
  src: local("DM Serif Display"), url("assets/dm-serif.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Work Sans";
  src: local("Work Sans"), url("assets/work-sans.ttf") format("truetype");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --ground: #ece8f8;
  --paper: #fbfaff;
  --ink: #1d1a33;
  --ink-soft: #48446a;
  --serif: "DM Serif Display", "Iowan Old Style", Georgia, serif;
  --sans: "Work Sans", "Helvetica Neue", Arial, sans-serif;
  --bar: 4rem;
}

[data-cat="Places"]   { --door: #1f7a56; --door-ink: #ffffff; --glass: rgba(255, 255, 255, 0.18); }
[data-cat="Food"]     { --door: #f26b38; --door-ink: #1d1a33; --glass: rgba(255, 255, 255, 0.32); }
[data-cat="Movement"] { --door: #2848b8; --door-ink: #ffffff; --glass: rgba(255, 255, 255, 0.18); }
[data-cat="People"]   { --door: #f4a6c0; --door-ink: #1d1a33; --glass: rgba(255, 255, 255, 0.4); }
[data-cat="Culture"]  { --door: #f6c945; --door-ink: #1d1a33; --glass: rgba(255, 255, 255, 0.4); }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
html.locked { overflow: hidden; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.5;
}

h1, h2, h3, p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { display: block; }

:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 0;
  box-shadow: 0 0 0 6px var(--ink);
}
.open:focus-visible { outline: none; box-shadow: none; }

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

.wrap { max-width: 1400px; margin: 0 auto; padding: 0 3rem; }

/* ---------- masthead ---------- */
.masthead { padding: 2.25rem 0 1.5rem; }
.masthead .wrap {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
}
.wordmark {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(5.5rem, 13vw, 10.5rem);
  line-height: 0.82;
  letter-spacing: -0.03em;
}
.wordmark a { color: inherit; text-decoration: none; }
.masthead-note { max-width: 22rem; padding-bottom: 0.4rem; }
.masthead-note .lede {
  font-family: var(--serif);
  font-size: 1.5rem;
  line-height: 1.2;
  text-wrap: balance;
}
.masthead-note .issue { margin-top: 0.6rem; color: var(--ink-soft); font-size: 0.9375rem; }

/* ---------- controls ---------- */
.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1rem 1.25rem;
  padding: 1.25rem 0 1.5rem;
  border-top: 3px solid var(--ink);
}
.field { display: flex; flex-direction: column; gap: 0.3rem; }
.field label { font-size: 0.875rem; font-weight: 600; }
.field.grow { flex: 1 1 18rem; }
.field input,
.field select,
.saved-toggle {
  height: 3rem;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: #fff;
  padding: 0 1.25rem;
}
.field input { width: 100%; }
.field input::placeholder { color: var(--ink-soft); opacity: 1; }
.field select {
  appearance: none;
  -webkit-appearance: none;
  min-width: 12rem;
  padding-right: 2.75rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1.5 1.5 7 7l5.5-5.5' fill='none' stroke='%231d1a33' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1.1rem center;
}
.saved-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 600;
}
.saved-toggle svg { width: 1.1rem; height: 1.1rem; }
.saved-toggle[aria-pressed="true"] { background: var(--ink); color: #fff; }
.saved-toggle[aria-pressed="true"] svg path { fill: currentColor; }
.saved-toggle:focus-visible { box-shadow: 0 0 0 6px var(--ink); }
.saved-toggle[aria-pressed="true"]:focus-visible { outline-color: var(--ground); }

.count { margin-left: auto; align-self: center; color: var(--ink-soft); font-size: 0.9375rem; }

/* ---------- doors ---------- */
.doors {
  list-style: none;
  margin: 0;
  padding: 1rem 0 5rem;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 3.5rem 2rem;
  align-items: end;
}
.doors > li { display: flex; }

.door {
  --arch: 20rem;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  min-height: calc(25rem + var(--m) * 1.5rem);
  margin-bottom: 0.75rem;
  padding: 3.25rem 1.5rem 1.75rem;
  background: var(--door);
  color: var(--door-ink);
  border-radius: var(--arch) var(--arch) 0 0;
  text-align: center;
}
.door::after {
  content: "";
  position: absolute;
  left: -0.6rem; right: -0.6rem; bottom: -0.75rem;
  height: 0.75rem;
  background: var(--ink);
}
.door:has(.open:focus-visible) {
  outline: 3px solid #fff;
  box-shadow: 0 0 0 6px var(--ink);
}
.door-glyph { width: 3.5rem; height: 3.5rem; }
.door-glyph svg { width: 100%; height: 100%; fill: currentColor; }
.door-cat {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.6rem;
  font-size: 0.9375rem;
  font-weight: 600;
  min-height: 1.6rem;
}
.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.05rem 0.6rem 0.05rem 0.45rem;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 0.8125rem;
}
.tag svg { width: 0.7rem; height: 0.7rem; fill: currentColor; }
.door-title {
  margin-top: 0.9rem;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.65rem;
  line-height: 1.14;
  text-wrap: balance;
}
.open {
  all: unset;
  cursor: pointer;
}
.open::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.door-sum { margin-top: 0.8rem; font-size: 0.9375rem; line-height: 1.45; }
.door-meta { margin-top: auto; padding-top: 1.1rem; font-size: 0.875rem; font-weight: 500; }
.door:hover .door-title { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.2em; }

/* ---------- empty ---------- */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.75rem;
  padding: 3rem 1rem 6rem;
}
.empty-arch {
  width: 7rem; height: 9rem;
  border: 3px solid var(--ink);
  border-bottom-width: 12px;
  border-radius: 7rem 7rem 0 0;
  margin-bottom: 0.5rem;
}
.empty h2 { font-family: var(--serif); font-weight: 400; font-size: 2rem; line-height: 1.15; }
.empty p { max-width: 30rem; color: var(--ink-soft); }
.btn {
  height: 3rem;
  padding: 0 1.5rem;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-weight: 600;
}
.btn:hover { background: #3a3560; }

.foot { border-top: 3px solid var(--ink); padding: 1.25rem 0 2.5rem; color: var(--ink-soft); font-size: 0.875rem; }

/* ---------- detail ---------- */
dialog.detail {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--paper);
  color: var(--ink);
  overflow-y: auto;
}
dialog.detail:not([open]) { display: none; }
dialog.detail[open] { animation: rise 0.24s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(1.25rem); } }

.d-bar {
  position: sticky;
  top: 0;
  z-index: 2;
  height: var(--bar);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0 clamp(0.75rem, 3vw, 3rem);
  background: var(--ink);
  color: #fff;
}
.d-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  height: 2.75rem;
  padding: 0 1.1rem;
  border: 2px solid #fff;
  border-radius: 999px;
  background: transparent;
  color: #fff;
  font-weight: 600;
  font-size: 0.9375rem;
}
.d-btn svg { width: 1rem; height: 1rem; flex: none; }
.d-btn:hover { background: rgba(255, 255, 255, 0.14); }
.d-btn[aria-pressed="true"] { background: #fff; color: var(--ink); }
.d-btn[aria-pressed="true"] svg path { fill: currentColor; }
.d-bar :focus-visible { outline-color: #fff; box-shadow: 0 0 0 5px var(--door); }

.d-grid { display: grid; grid-template-columns: minmax(20rem, 5fr) 7fr; }
.d-side {
  position: sticky;
  top: var(--bar);
  align-self: start;
  height: calc(100vh - var(--bar));
  height: calc(100dvh - var(--bar));
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 1.1rem;
  padding: 2.5rem clamp(1.5rem, 4vw, 4rem) 3rem;
  background: var(--door);
  color: var(--door-ink);
  overflow: hidden;
}
.d-arch {
  width: min(13rem, 55%);
  aspect-ratio: 4 / 5;
  max-height: 38vh;
  margin-bottom: auto;
  display: grid;
  place-items: center;
  border-radius: 20rem 20rem 0 0;
  background: var(--glass);
  border-bottom: 10px solid var(--door-ink);
}
.d-arch svg { width: 44%; height: auto; fill: currentColor; }
.d-cat { font-weight: 600; }
.d-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.1rem, 3.4vw, 3.4rem);
  line-height: 1.06;
  text-wrap: balance;
}
.d-meta { font-weight: 500; }

.d-article { padding: 4rem clamp(1.5rem, 5vw, 6rem) 6rem; }
.d-article-inner { max-width: 38rem; }
.d-dek {
  font-family: var(--serif);
  font-size: clamp(1.4rem, 2vw, 1.85rem);
  line-height: 1.28;
  padding-bottom: 1.75rem;
  margin-bottom: 2rem;
  border-bottom: 3px solid var(--ink);
  text-wrap: pretty;
}
.d-body p { font-size: 1.1875rem; line-height: 1.72; }
.d-body p + p { margin-top: 1.25rem; }
.d-end { margin-top: 3rem; }

/* ---------- small screens ---------- */
@media (max-width: 1100px) {
  .doors { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .door { --arch: 22rem; }
}
@media (max-width: 760px) {
  :root { --bar: 3.5rem; }
  .wrap { padding: 0 1.25rem; }
  .masthead { padding-top: 1.5rem; }
  .masthead .wrap { flex-direction: column; align-items: flex-start; gap: 1rem; }
  .masthead-note .lede { font-size: 1.25rem; }
  .controls { padding-top: 1rem; }
  .field select { width: 100%; }
  .field:has(select) { flex: 1 1 100%; }
  .count { margin-left: 0; flex: 1 1 100%; order: 5; }
  .saved-toggle { width: 100%; justify-content: center; }
  .doors { grid-template-columns: minmax(0, 1fr); gap: 3rem; padding-bottom: 3.5rem; }
  .door { min-height: 22rem; padding-inline: 1.5rem; }
  .door-title { font-size: 1.75rem; }

  .d-btn { padding: 0 0.9rem; font-size: 0.875rem; }
  .d-grid { display: block; }
  .d-side { position: static; height: auto; padding: 2rem 1.25rem 2.25rem; }
  .d-arch { width: 8rem; max-height: none; margin-bottom: 0.5rem; }
  .d-article { padding: 2rem 1.25rem 4rem; }
  .d-body p { font-size: 1.125rem; }
}

@media (prefers-reduced-motion: reduce) {
  dialog.detail[open] { animation: none; }
}
