/* =========================================================
   The Late Window — a city journal after dark
   ========================================================= */

@font-face {
  font-family: "DM Serif Display";
  src: url("assets/dm-serif.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Work Sans";
  src: url("assets/work-sans.ttf") format("truetype");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

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

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

:root {
  --night: #070b14;
  --night-soft: #0c1321;
  --panel: #101827;
  --panel-2: #151e30;
  --cream: #f4ecd9;
  --cream-2: #e7dac0;
  --paper: #f1e7d1;
  --ink: #17130e;
  --ink-soft: #50493d;
  --muted: #c6beae;
  --muted-2: #9e978a;
  --line: rgba(244, 236, 217, 0.22);
  --line-soft: rgba(244, 236, 217, 0.12);
  --amber: #ffb454;
  --amber-deep: #a25500;
  --coral: #ff8063;
  --teal: #7bcdc0;
  --display: "DM Serif Display", Georgia, serif;
  --sans: "Work Sans", "Helvetica Neue", sans-serif;
  --mono: "IBM Plex Mono", "Courier New", monospace;
  --serif: "Literata", Georgia, serif;
  --shadow-deep: 0 32px 70px -34px #000, 0 12px 28px -20px #000;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--cream);
  background:
    radial-gradient(ellipse at 18% -5%, rgba(255, 180, 84, 0.12), transparent 52%),
    radial-gradient(ellipse at 95% 4%, rgba(255, 128, 99, 0.075), transparent 46%),
    linear-gradient(180deg, #070b14 0%, #0a1020 50%, #070b14 100%);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.modal-open {
  overflow: hidden;
}

::selection {
  color: #17130e;
  background: var(--amber);
}

button,
input,
select {
  font: inherit;
}

button,
select {
  cursor: pointer;
  touch-action: manipulation;
}

main:focus {
  outline: none;
}

img {
  max-width: 100%;
}

a {
  color: inherit;
}

[hidden] {
  display: none !important;
}

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

.shell {
  width: min(1380px, calc(100% - 64px));
  margin-inline: auto;
}

.night-sky {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    radial-gradient(1.2px 1.2px at 7% 11%, rgba(244, 236, 217, 0.7) 50%, transparent 51%),
    radial-gradient(1px 1px at 19% 27%, rgba(244, 236, 217, 0.42) 50%, transparent 51%),
    radial-gradient(1.4px 1.4px at 32% 8%, rgba(255, 180, 84, 0.55) 50%, transparent 51%),
    radial-gradient(1px 1px at 46% 36%, rgba(244, 236, 217, 0.35) 50%, transparent 51%),
    radial-gradient(1px 1px at 62% 13%, rgba(244, 236, 217, 0.55) 50%, transparent 51%),
    radial-gradient(1.3px 1.3px at 78% 29%, rgba(244, 236, 217, 0.42) 50%, transparent 51%),
    radial-gradient(1px 1px at 91% 9%, rgba(255, 180, 84, 0.5) 50%, transparent 51%),
    radial-gradient(1px 1px at 87% 43%, rgba(244, 236, 217, 0.26) 50%, transparent 51%);
  opacity: 0.8;
}

.site-header,
main,
.site-footer {
  position: relative;
  z-index: 1;
}

.skip-link {
  position: fixed;
  top: -100px;
  left: 20px;
  z-index: 100;
  padding: 12px 18px;
  color: var(--ink);
  background: var(--amber);
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-decoration: none;
}

.skip-link:focus {
  top: 16px;
}

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

/* ---------- Header ---------- */

.site-header {
  padding-top: 16px;
}

.topline {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
  padding-bottom: 13px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.topline-centre {
  color: var(--cream);
}

.topline-status {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 4px rgba(255, 180, 84, 0.12), 0 0 15px rgba(255, 180, 84, 0.7);
}

.brand-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.32fr) minmax(280px, 0.68fr);
  gap: clamp(36px, 6vw, 100px);
  align-items: end;
  padding: clamp(28px, 3.4vw, 44px) 0 clamp(28px, 3vw, 36px);
}

.kicker {
  margin: 0 0 16px;
  color: var(--amber);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.19em;
  line-height: 1.5;
  text-transform: uppercase;
}

.masthead {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin: 0 0 18px;
  font-family: var(--display);
  font-weight: 400;
  line-height: 0.78;
  letter-spacing: -0.055em;
}

.masthead-the {
  margin-bottom: 13px;
  color: var(--amber);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.52em;
  text-transform: uppercase;
}

.masthead-late {
  color: var(--cream);
  font-size: clamp(4.8rem, 8.8vw, 7.1rem);
}

.masthead-window {
  position: relative;
  padding-right: 0.16em;
  color: var(--cream);
  font-size: clamp(4.4rem, 8.2vw, 6.7rem);
  -webkit-text-stroke: 1.4px var(--cream);
  -webkit-text-fill-color: transparent;
  text-stroke: 1.4px var(--cream);
}

.lit-full-stop {
  position: absolute;
  right: 0;
  bottom: 0.17em;
  width: 0.12em;
  height: 0.12em;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 18px 4px rgba(255, 180, 84, 0.48);
  -webkit-text-stroke: 0;
}

.dek {
  max-width: 47ch;
  margin: 0;
  color: #d5cec0;
  font-size: clamp(1rem, 1.12vw, 1.13rem);
  line-height: 1.65;
}

.window-map {
  position: relative;
  padding: 14px;
  background:
    linear-gradient(145deg, rgba(244, 236, 217, 0.075), rgba(244, 236, 217, 0.02)),
    rgba(10, 16, 29, 0.7);
  border: 1px solid rgba(244, 236, 217, 0.28);
  border-radius: 2px 18px 2px 2px;
  box-shadow: 0 26px 60px -38px #000, inset 0 1px rgba(255, 255, 255, 0.05);
  transform: rotate(1.1deg);
  transition: transform 0.45s var(--ease), border-color 0.3s ease;
}

.window-map:hover {
  transform: rotate(0deg);
  border-color: rgba(255, 180, 84, 0.55);
}

.window-map-head,
.window-map-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.window-map-head {
  padding: 0 2px 10px;
  border-bottom: 1px solid var(--line-soft);
}

.window-map-foot {
  justify-content: flex-start;
  padding: 11px 2px 0;
  border-top: 1px solid var(--line-soft);
  line-height: 1.4;
}

.map-star {
  color: var(--amber);
  font-size: 14px;
}

.map-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
  padding: 12px 0;
}

.map-window {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  aspect-ratio: 1.15;
  padding: 4px;
  overflow: hidden;
  border: 1px solid rgba(244, 236, 217, 0.2);
  background:
    linear-gradient(180deg, rgba(255, 180, 84, 0.11), rgba(255, 180, 84, 0.03)),
    #05080f;
  box-shadow: inset 0 0 16px rgba(0, 0, 0, 0.65);
}

.map-window::before,
.map-window::after {
  content: "";
  position: absolute;
  background: rgba(244, 236, 217, 0.16);
}

.map-window::before {
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
}

.map-window::after {
  top: 50%;
  right: 0;
  left: 0;
  height: 1px;
}

.map-window i {
  position: relative;
  z-index: 1;
  color: rgba(244, 236, 217, 0.45);
  font-family: var(--mono);
  font-size: 7px;
  font-style: normal;
  letter-spacing: 0.07em;
}

.map-window.is-saved {
  background:
    radial-gradient(circle at 50% 45%, rgba(255, 180, 84, 0.7), transparent 64%),
    #ffb454;
  border-color: var(--amber);
  box-shadow: 0 0 22px rgba(255, 180, 84, 0.32);
}

.map-window.is-saved i {
  color: #2b1b05;
}

.map-window.is-saved::after {
  content: "✦";
  position: absolute;
  top: 2px;
  left: 4px;
  z-index: 2;
  width: auto;
  height: auto;
  color: #2b1b05;
  background: none;
  font-size: 10px;
}

/* ---------- Directory / controls ---------- */

.directory {
  position: relative;
  padding: 18px 22px 13px;
  background: rgba(15, 23, 38, 0.88);
  border: 1px solid rgba(244, 236, 217, 0.22);
  border-radius: 2px 16px 2px 2px;
  box-shadow: 0 24px 50px -42px #000, inset 0 1px rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(12px);
}

.directory::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 22px;
  width: 116px;
  height: 3px;
  background: var(--amber);
}

.directory-label {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 20px;
  margin-bottom: 13px;
}

.directory-label h2 {
  margin: 0;
  color: var(--cream);
  font-family: var(--display);
  font-size: 1.45rem;
  font-weight: 400;
  letter-spacing: -0.015em;
}

.directory-label p {
  margin: 0;
  color: var(--muted-2);
  font-size: 12.5px;
}

.directory-tape {
  display: none;
}

.directory-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 210px minmax(236px, auto);
  gap: 14px;
  align-items: end;
}

.field {
  min-width: 0;
}

.field label {
  display: block;
  margin-bottom: 7px;
  color: var(--amber);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.input-wrap,
.select-wrap {
  position: relative;
}

.field-icon {
  position: absolute;
  top: 50%;
  left: 15px;
  width: 17px;
  height: 17px;
  color: var(--muted-2);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  transform: translateY(-50%);
  pointer-events: none;
}

.field input,
.field select {
  width: 100%;
  height: 50px;
  color: var(--cream);
  background: #080d18;
  border: 1px solid rgba(244, 236, 217, 0.27);
  border-radius: 1px 9px 1px 1px;
  font-family: var(--sans);
  font-size: 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.field input {
  padding: 0 16px 0 44px;
}

.field input::placeholder {
  color: #a29b8e;
  opacity: 1;
}

.field select {
  appearance: none;
  padding: 0 42px 0 14px;
}

.field input:hover,
.field select:hover {
  border-color: rgba(255, 180, 84, 0.58);
}

.field input:focus,
.field select:focus {
  border-color: var(--amber);
  background: #0b1220;
  box-shadow: 0 0 0 3px rgba(255, 180, 84, 0.16);
  outline: none;
}

.select-arrow {
  position: absolute;
  top: 50%;
  right: 14px;
  width: 17px;
  height: 17px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.7;
  transform: translateY(-50%);
  pointer-events: none;
}

.saved-toggle {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 50px;
  padding: 6px 12px;
  color: var(--cream);
  background: #080d18;
  border: 1px solid rgba(244, 236, 217, 0.27);
  border-radius: 9px 1px 1px 1px;
  text-align: left;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.saved-toggle:hover {
  border-color: var(--amber);
}

.saved-toggle .bulb {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  color: var(--muted);
  border: 1px solid rgba(244, 236, 217, 0.2);
  border-radius: 50%;
  transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.saved-toggle .bulb svg,
.save-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.55;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.saved-toggle-copy {
  min-width: 0;
  flex: 1;
}

.saved-toggle-title,
.saved-toggle-hint {
  display: block;
}

.saved-toggle-title {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  line-height: 1.35;
  text-transform: uppercase;
}

.saved-toggle-hint {
  margin-top: 2px;
  color: var(--muted-2);
  font-size: 10.5px;
  line-height: 1.25;
}

.saved-count {
  display: grid;
  place-items: center;
  min-width: 26px;
  height: 26px;
  padding: 0 6px;
  color: var(--amber);
  background: rgba(255, 180, 84, 0.12);
  border: 1px solid rgba(255, 180, 84, 0.38);
  border-radius: 50%;
  font-family: var(--mono);
  font-size: 10px;
}

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

.saved-toggle[aria-pressed="true"] .bulb {
  color: #241704;
  background: rgba(36, 23, 4, 0.1);
  border-color: rgba(36, 23, 4, 0.35);
  box-shadow: 0 0 18px rgba(255, 255, 255, 0.24);
}

.saved-toggle[aria-pressed="true"] .saved-toggle-hint {
  color: #4d3209;
}

.saved-toggle[aria-pressed="true"] .saved-count {
  color: #241704;
  background: rgba(36, 23, 4, 0.1);
  border-color: rgba(36, 23, 4, 0.33);
}

.directory-status {
  margin: 13px 0 0;
  padding-top: 11px;
  color: var(--muted-2);
  border-top: 1px dotted rgba(244, 236, 217, 0.19);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ---------- Street / cards ---------- */

.street {
  padding: clamp(38px, 4.2vw, 58px) 0 96px;
}

.street-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 13px;
  border-bottom: 1px solid var(--line);
}

.street-head h2 {
  margin: 0;
  color: var(--cream);
  font-family: var(--display);
  font-size: clamp(1.55rem, 2.2vw, 2.1rem);
  font-weight: 400;
  letter-spacing: -0.02em;
}

.street-count {
  margin: 0;
  color: var(--amber);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.window-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 38px 22px;
  align-items: start;
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
}

.story-item {
  min-width: 0;
}

.window-card {
  --tilt: -0.28deg;
  position: relative;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid #241d14;
  border-top: 9px solid #211a12;
  border-bottom-width: 15px;
  box-shadow: var(--shadow-deep), inset 0 0 0 1px rgba(255, 255, 255, 0.32);
  transform: rotate(var(--tilt));
  transition: transform 0.4s var(--ease), box-shadow 0.35s ease, border-color 0.3s ease;
}

.window-grid > .story-item:nth-child(even) .window-card {
  --tilt: 0.32deg;
}

.window-grid > .story-item:nth-child(3n) .window-card {
  --tilt: 0.12deg;
}

.window-card:hover,
.window-card:focus-within {
  z-index: 2;
  border-color: #4a371d;
  transform: rotate(0deg) translateY(-6px);
  box-shadow: 0 40px 70px -36px #000, 0 18px 32px -22px #000, 0 0 34px rgba(255, 180, 84, 0.1);
}

.window-card.is-saved {
  border-color: #6a4b17;
  box-shadow: 0 32px 70px -36px #000, 0 0 0 2px rgba(255, 180, 84, 0.5), 0 0 42px rgba(255, 180, 84, 0.16);
}

.window-view {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #080c14;
  border: 7px solid #1b1610;
  box-shadow: inset 0 0 22px rgba(0, 0, 0, 0.8);
}

.window-view img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.78) contrast(1.05) brightness(0.82);
  transform: scale(1.01);
  transition: transform 0.7s var(--ease), filter 0.5s ease;
}

.window-card:hover .window-view img,
.window-card:focus-within .window-view img {
  transform: scale(1.055);
  filter: saturate(0.9) contrast(1.03) brightness(0.92);
}

.window-view::before,
.window-view::after {
  content: "";
  position: absolute;
  z-index: 1;
  pointer-events: none;
  background: rgba(20, 15, 10, 0.52);
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.3);
}

.window-view::before {
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
}

.window-view::after {
  top: 55%;
  right: 0;
  left: 0;
  height: 2px;
}

.window-view .glass-shine {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(122deg, transparent 22%, rgba(255, 244, 216, 0.12) 22.5%, transparent 41%),
    linear-gradient(180deg, rgba(7, 11, 20, 0.05), rgba(7, 11, 20, 0.36));
}

.window-no {
  position: absolute;
  top: 9px;
  right: 9px;
  z-index: 3;
  padding: 4px 6px;
  color: var(--cream);
  background: rgba(7, 11, 20, 0.72);
  border: 1px solid rgba(244, 236, 217, 0.27);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.1em;
}

.window-lamp {
  position: absolute;
  top: 9px;
  left: 9px;
  z-index: 3;
  display: none;
  align-items: center;
  gap: 5px;
  padding: 4px 7px;
  color: #2b1b05;
  background: var(--amber);
  border: 1px solid #2b1b05;
  font-family: var(--mono);
  font-size: 8.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow: 0 0 18px rgba(255, 180, 84, 0.6);
}

.window-lamp::before {
  content: "✦";
  font-size: 10px;
}

.window-card.is-saved .window-lamp {
  display: flex;
}

.category-tag {
  position: absolute;
  bottom: 10px;
  left: 10px;
  z-index: 3;
  padding: 5px 8px;
  color: var(--ink);
  background: var(--cream);
  border-left: 4px solid var(--cat, var(--amber));
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.cat-culture {
  --cat: #a53b53;
}

.cat-food {
  --cat: #9b5600;
}

.cat-movement {
  --cat: #0f6c6a;
}

.cat-people {
  --cat: #684696;
}

.cat-places {
  --cat: #38653e;
}

.window-note {
  padding: 18px 14px 13px;
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0;
  color: #6c6456;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.07em;
  line-height: 1.4;
  text-transform: uppercase;
}

.card-meta span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-title {
  margin: 10px 0 8px;
  color: var(--ink);
  font-family: var(--display);
  font-size: clamp(1.32rem, 1.7vw, 1.62rem);
  font-weight: 400;
  line-height: 1.04;
  letter-spacing: -0.022em;
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.card-summary {
  display: -webkit-box;
  margin: 0 0 15px;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 13.4px;
  line-height: 1.52;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid rgba(23, 19, 14, 0.18);
}

.card-date {
  color: #6c6456;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.open-button {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  min-height: 44px;
  margin: -10px -3px -10px 0;
  padding: 0 3px;
  color: var(--ink);
  background: transparent;
  border: 0;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  transition: color 0.2s ease;
}

.open-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  transition: transform 0.3s var(--ease);
}

.open-button:hover {
  color: var(--amber-deep);
}

.open-button:hover svg {
  transform: translateX(3px);
}

.window-card :focus-visible {
  outline: 3px solid #7c3d00;
  outline-offset: 4px;
}

.save-button:focus-visible,
.detail-actions .button-quiet:focus-visible {
  outline-color: #7c3d00;
}

button:active,
.saved-toggle:active,
.open-button:active {
  transform: translateY(1px);
}

/* ---------- Empty state ---------- */

.empty-state {
  display: grid;
  justify-items: center;
  max-width: 720px;
  margin: 56px auto 0;
  padding: 54px 28px;
  text-align: center;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 180, 84, 0.1), transparent 58%),
    rgba(15, 23, 38, 0.72);
  border: 1px dashed rgba(255, 180, 84, 0.52);
  border-radius: 2px 20px 2px 2px;
}

.empty-window {
  position: relative;
  display: grid;
  place-items: center;
  width: 72px;
  height: 86px;
  margin-bottom: 22px;
  border: 5px solid #2a2218;
  background: #080d16;
  box-shadow: inset 0 0 18px #000;
}

.empty-window::before,
.empty-window::after {
  content: "";
  position: absolute;
  background: rgba(244, 236, 217, 0.13);
}

.empty-window::before {
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1px;
}

.empty-window::after {
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
}

.empty-window span {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #2b3a58;
  box-shadow: 0 0 20px rgba(255, 180, 84, 0.08);
}

.empty-state h3 {
  margin: 0 0 8px;
  color: var(--cream);
  font-family: var(--display);
  font-size: clamp(1.75rem, 3vw, 2.3rem);
  font-weight: 400;
  letter-spacing: -0.02em;
}

.empty-state p {
  max-width: 46ch;
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.6;
}

/* ---------- Buttons ---------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 20px;
  border: 1px solid transparent;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.button-dark {
  color: var(--ink);
  background: var(--amber);
  border-color: var(--amber);
}

.button-dark:hover {
  background: #ffc77e;
}

.button-quiet {
  color: var(--ink);
  background: transparent;
  border-color: rgba(23, 19, 14, 0.35);
}

.button-quiet:hover {
  background: rgba(23, 19, 14, 0.06);
  border-color: var(--ink);
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--line);
  background: rgba(5, 8, 15, 0.52);
}

.footer-grid {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) auto;
  gap: 34px;
  align-items: center;
  padding: 38px 0 44px;
}

.footer-mark {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  height: 92px;
}

.lamp-post {
  position: absolute;
  bottom: 0;
  left: 26px;
  width: 42px;
  height: 90px;
}

.lamp-pole {
  position: absolute;
  bottom: 0;
  left: 20px;
  width: 2px;
  height: 64px;
  background: #736b5d;
}

.lamp-head {
  position: absolute;
  top: 0;
  left: 10px;
  width: 23px;
  height: 18px;
  border: 2px solid #a69a85;
  border-radius: 9px 9px 2px 2px;
  background: #1a2232;
}

.lamp-head::after {
  content: "";
  position: absolute;
  right: 3px;
  bottom: 3px;
  left: 3px;
  height: 8px;
  background: var(--amber);
  box-shadow: 0 0 18px 5px rgba(255, 180, 84, 0.6);
}

.lamp-glow {
  position: absolute;
  top: 9px;
  left: -18px;
  width: 80px;
  height: 64px;
  background: radial-gradient(ellipse at 50% 20%, rgba(255, 180, 84, 0.25), transparent 70%);
  pointer-events: none;
}

.sleeping-cat {
  position: relative;
  z-index: 1;
  width: 88px;
  height: auto;
  margin: 0 0 4px 30px;
  overflow: visible;
  fill: #090d15;
  stroke: #6f675a;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.footer-title {
  margin: 0 0 7px;
  color: var(--cream);
  font-family: var(--display);
  font-size: 1.2rem;
  letter-spacing: -0.01em;
}

.footer-copy p {
  max-width: 66ch;
  margin: 0;
  color: var(--muted-2);
  font-size: 12.5px;
  line-height: 1.65;
}

.footer-copy p.footer-title {
  color: var(--cream);
  font-size: 1.2rem;
}

.footer-note {
  margin: 0;
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 9.5px;
  line-height: 1.7;
  letter-spacing: 0.1em;
  text-align: right;
  text-transform: uppercase;
}

.noscript {
  position: fixed;
  right: 16px;
  bottom: 16px;
  left: 16px;
  z-index: 100;
  margin: 0;
  padding: 16px;
  color: var(--ink);
  background: var(--amber);
  font-family: var(--mono);
  font-size: 12px;
  text-align: center;
}

/* ---------- Detail dialog ---------- */

.detail-dialog {
  width: min(980px, calc(100vw - 48px));
  max-width: 980px;
  max-height: calc(100dvh - 48px);
  padding: 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  overflow: visible;
}

.detail-dialog::backdrop {
  background: rgba(3, 6, 12, 0.82);
  backdrop-filter: blur(5px);
}

.detail-dialog[open] {
  animation: dialog-in 0.36s var(--ease) both;
}

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

.site-ready .window-card {
  animation: window-glow 0.55s ease both;
  animation-delay: calc(var(--card-index, 0) * 45ms);
}

@keyframes window-glow {
  from {
    opacity: 0.35;
  }
  to {
    opacity: 1;
  }
}

.detail-shell {
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 48px);
  overflow: hidden;
  background: var(--paper);
  border: 1px solid #3c3021;
  border-radius: 3px 22px 3px 3px;
  box-shadow: 0 46px 120px -36px #000, 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.detail-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex: 0 0 auto;
  padding: 12px 14px 12px 20px;
  color: var(--cream);
  background: #0a101d;
  border-bottom: 1px solid rgba(255, 180, 84, 0.24);
}

.detail-location {
  margin: 0;
  overflow: hidden;
  color: var(--amber);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 0 10px 0 14px;
  color: var(--cream);
  background: transparent;
  border: 1px solid rgba(244, 236, 217, 0.3);
  border-radius: 1px 8px 1px 1px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.icon-button:hover {
  color: var(--ink);
  background: var(--amber);
  border-color: var(--amber);
}

.icon-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
}

.detail-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: #9b8f7b var(--paper);
  scrollbar-width: thin;
}

.detail-figure {
  position: relative;
  max-height: 330px;
  margin: 0;
  overflow: hidden;
  background: #0a0e16;
  border-bottom: 8px solid #211a12;
}

.detail-figure::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, transparent 55%, rgba(5, 8, 14, 0.66)),
    linear-gradient(115deg, transparent 35%, rgba(255, 244, 216, 0.07) 35.4%, transparent 52%);
}

.detail-figure img {
  display: block;
  width: 100%;
  height: 330px;
  object-fit: cover;
  filter: saturate(0.82) contrast(1.03) brightness(0.85);
}

.detail-figure figcaption {
  position: absolute;
  right: 22px;
  bottom: 13px;
  left: 22px;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 7px;
  color: rgba(244, 236, 217, 0.78);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.08em;
  line-height: 1.4;
  text-transform: uppercase;
}

.caption-mark {
  color: var(--amber);
  font-size: 11px;
}

.detail-body {
  width: min(760px, 100%);
  margin-inline: auto;
  padding: 32px clamp(22px, 5vw, 52px) 24px;
}

.detail-kicker {
  margin: 0 0 13px;
  color: var(--detail-cat, var(--amber-deep));
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.detail-body h2 {
  max-width: 18ch;
  margin: 0 0 18px;
  color: var(--ink);
  font-family: var(--display);
  font-size: clamp(2.4rem, 4.5vw, 3.85rem);
  font-weight: 400;
  line-height: 0.96;
  letter-spacing: -0.035em;
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.detail-dek {
  max-width: 54ch;
  margin: 0 0 24px;
  color: #4b4438;
  font-family: var(--sans);
  font-size: clamp(1rem, 1.35vw, 1.12rem);
  line-height: 1.62;
}

.detail-byline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin-bottom: 28px;
  padding: 13px 0;
  color: #6a6153;
  border-top: 1px solid rgba(23, 19, 14, 0.2);
  border-bottom: 1px solid rgba(23, 19, 14, 0.2);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.06em;
  line-height: 1.5;
  text-transform: uppercase;
}

.detail-byline span + span::before {
  content: "·";
  margin-right: 16px;
  color: #9a8f7d;
}

.detail-prose {
  max-width: 65ch;
  color: #262117;
  font-family: var(--serif);
  font-size: clamp(1.03rem, 1.35vw, 1.15rem);
  line-height: 1.82;
}

.detail-prose p {
  margin: 0 0 1.35em;
}

.detail-prose p:first-child::first-letter {
  float: left;
  padding: 0.08em 0.12em 0 0;
  color: var(--detail-cat, var(--amber-deep));
  font-family: var(--display);
  font-size: 3.8em;
  line-height: 0.72;
}

.detail-end {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 30px;
  color: #7d725f;
}

.detail-end::before,
.detail-end::after {
  content: "";
  height: 1px;
  flex: 1;
  background: rgba(23, 19, 14, 0.17);
}

.detail-end span {
  color: var(--detail-cat, var(--amber-deep));
  font-size: 12px;
}

.detail-end p {
  margin: 0;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.09em;
  text-align: center;
  text-transform: uppercase;
}

.detail-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex: 0 0 auto;
  padding: 14px 18px calc(14px + env(safe-area-inset-bottom));
  background: var(--cream-2);
  border-top: 1px solid rgba(23, 19, 14, 0.24);
}

.save-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 22px;
  color: var(--cream);
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 2px 12px 2px 2px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.save-button:hover {
  background: #2c271f;
}

.save-icon {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border: 1px solid rgba(244, 236, 217, 0.32);
  border-radius: 50%;
}

.save-button[aria-pressed="true"] {
  color: #241704;
  background: var(--amber);
  border-color: #8d570b;
  box-shadow: 0 0 0 3px rgba(255, 180, 84, 0.2), 0 0 28px rgba(255, 180, 84, 0.34);
}

.save-button[aria-pressed="true"] .save-icon {
  color: #241704;
  border-color: rgba(36, 23, 4, 0.35);
  background: rgba(255, 255, 255, 0.17);
}

.detail-actions .button-quiet {
  min-height: 52px;
}

/* ---------- Motion opt-out ---------- */

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

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }

  .window-card,
  .window-card:hover,
  .window-card:focus-within,
  .window-map,
  .window-map:hover {
    transform: none;
  }
}

/* ---------- Responsive ---------- */

@media (max-width: 1120px) {
  .window-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 34px 26px;
  }

  .card-title {
    font-size: clamp(1.45rem, 2.4vw, 1.8rem);
  }

  .brand-grid {
    grid-template-columns: minmax(0, 1.18fr) minmax(260px, 0.82fr);
    gap: 44px;
  }

  .directory-controls {
    grid-template-columns: minmax(0, 1fr) 190px;
  }

  .saved-toggle {
    grid-column: 1 / -1;
    justify-self: start;
    min-width: 285px;
  }
}

@media (max-width: 820px) {
  .shell {
    width: min(100% - 40px, 680px);
  }

  .topline {
    grid-template-columns: 1fr auto;
  }

  .topline-centre {
    display: none;
  }

  .brand-grid {
    grid-template-columns: 1fr;
    gap: 40px;
    align-items: start;
    padding-top: 44px;
  }

  .masthead-late {
    font-size: clamp(4.3rem, 14.5vw, 6.6rem);
  }

  .masthead-window {
    font-size: clamp(3.9rem, 13.3vw, 6.1rem);
  }

  .window-map {
    width: min(100%, 390px);
    transform: rotate(0.8deg);
  }

  .directory-controls {
    grid-template-columns: 1fr;
  }

  .saved-toggle {
    grid-column: auto;
    justify-self: stretch;
    min-width: 0;
  }

  .street-head {
    align-items: flex-end;
  }

  .detail-dialog {
    width: calc(100vw - 28px);
    max-height: calc(100dvh - 28px);
  }

  .detail-shell {
    max-height: calc(100dvh - 28px);
  }

  .detail-actions {
    flex-wrap: wrap;
  }

  .save-button {
    flex: 1 1 260px;
  }
}

@media (max-width: 640px) {
  .shell {
    width: calc(100% - 32px);
  }

  .site-header {
    padding-top: 10px;
  }

  .topline {
    gap: 10px;
    font-size: 9px;
    letter-spacing: 0.09em;
  }

  .topline-status {
    gap: 6px;
  }

  .brand-grid {
    gap: 0;
    padding: 26px 0 28px;
  }

  .kicker {
    margin-bottom: 13px;
    font-size: 9.5px;
    letter-spacing: 0.15em;
  }

  .masthead {
    margin-bottom: 18px;
  }

  .masthead-the {
    margin-bottom: 10px;
    font-size: 9px;
  }

  .masthead-late {
    font-size: clamp(3.7rem, 19vw, 4.8rem);
  }

  .masthead-window {
    font-size: clamp(3.35rem, 17.3vw, 4.4rem);
  }

  .window-map {
    display: none;
  }

  .dek {
    font-size: 15px;
    line-height: 1.6;
  }

  .directory {
    padding: 16px 14px 13px;
  }

  .directory-label {
    display: block;
    margin-bottom: 12px;
  }

  .directory-label p {
    margin-top: 4px;
    font-size: 11.5px;
  }

  .directory-controls {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 10px;
  }

  .search-field {
    grid-column: 1 / -1;
  }

  .filter-field,
  .saved-toggle {
    grid-column: auto;
  }

  .field input,
  .field select,
  .saved-toggle {
    height: 52px;
  }

  .field input,
  .field select {
    font-size: 16px;
  }

  .saved-toggle {
    gap: 7px;
    padding: 5px 8px;
  }

  .saved-toggle .bulb {
    width: 28px;
    height: 28px;
    flex-basis: 28px;
  }

  .saved-toggle-title {
    font-size: 8.5px;
    letter-spacing: 0.03em;
  }

  .saved-toggle-hint {
    display: none;
  }

  .saved-count {
    min-width: 22px;
    height: 22px;
    padding: 0 4px;
    font-size: 8.5px;
  }

  .street {
    padding: 40px 0 70px;
  }

  .street-head {
    display: block;
  }

  .street-head h2 {
    font-size: 1.5rem;
  }

  .street-count {
    margin-top: 5px;
  }

  .window-grid {
    grid-template-columns: 1fr;
    gap: 32px;
    margin-top: 20px;
  }

  .window-card,
  .window-grid > .story-item:nth-child(even) .window-card,
  .window-grid > .story-item:nth-child(3n) .window-card {
    --tilt: 0deg;
  }

  .card-title {
    font-size: 1.75rem;
  }

  .card-summary {
    font-size: 14px;
    -webkit-line-clamp: unset;
  }

  .empty-state {
    margin-top: 38px;
    padding: 38px 20px;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 22px;
    padding: 32px 0 40px;
  }

  .footer-mark {
    justify-content: flex-start;
    height: 80px;
  }

  .footer-note {
    text-align: left;
  }

  .detail-dialog {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
  }

  .detail-shell {
    height: 100dvh;
    max-height: 100dvh;
    border: 0;
    border-radius: 0;
  }

  .detail-topbar {
    padding: 9px 10px 9px 14px;
  }

  .icon-button span {
    display: none;
  }

  .icon-button {
    width: 44px;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
  }

  .detail-figure {
    max-height: 42vh;
    border-bottom-width: 6px;
  }

  .detail-figure img {
    height: 34vh;
    min-height: 220px;
  }

  .detail-figure figcaption {
    right: 15px;
    bottom: 9px;
    left: 15px;
    font-size: 7.5px;
  }

  .detail-body {
    padding: 25px 20px 20px;
  }

  .detail-body h2 {
    max-width: none;
    margin-bottom: 14px;
    font-size: clamp(2.35rem, 11vw, 3.25rem);
  }

  .detail-dek {
    margin-bottom: 20px;
    font-size: 15px;
  }

  .detail-byline {
    margin-bottom: 22px;
    font-size: 8.5px;
  }

  .detail-prose {
    font-size: 1rem;
    line-height: 1.78;
  }

  .detail-prose p:first-child::first-letter {
    font-size: 3.3em;
  }

  .detail-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  }

  .save-button,
  .detail-actions .button-quiet {
    width: 100%;
    min-height: 50px;
  }

  .detail-actions .button-quiet {
    min-height: 44px;
  }
}
