:root {
  color-scheme: dark;
  --night: #050608;
  --ink: #eef0e8;
  --muted: #94998f;
  --faint: #2a2e2c;
  --panel: rgba(10, 12, 14, 0.94);
  --line: rgba(205, 218, 207, 0.18);
  --focus: #cfd8ca;
  font-family: Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--night);
  color: var(--ink);
}

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

#sky {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  image-rendering: pixelated;
  cursor: grab;
}

#sky:active { cursor: grabbing; }

.landing {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 44%, rgba(21, 25, 27, 0.5), rgba(5, 6, 8, 0.88) 55%, #050608 100%);
  transition: opacity 900ms ease, visibility 900ms;
}

.landing.is-leaving {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.landing__content { text-align: center; padding: 2rem; }
.eyebrow, .hint, input, .results, .loading {
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  letter-spacing: 0.08em;
}

.eyebrow {
  margin: 0 0 1.5rem;
  color: var(--muted);
  font-size: 0.68rem;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(3rem, 9vw, 7rem);
  font-weight: 400;
  letter-spacing: 0.025em;
}

.mantra {
  margin: 1.25rem 0 2.75rem;
  color: #bdc1b9;
  font-size: clamp(1rem, 2.5vw, 1.35rem);
  font-style: italic;
}

.primary-button {
  min-width: 11rem;
  padding: 0.8rem 1.25rem;
  border: 1px solid #626861;
  background: transparent;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 180ms, color 180ms;
}
.primary-button:hover, .primary-button:focus-visible { background: var(--ink); color: var(--night); }

.interface { position: fixed; inset: 0; z-index: 5; pointer-events: none; }
.toolbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) 1rem max(1rem, env(safe-area-inset-left));
  background: linear-gradient(to bottom, rgba(5, 6, 8, 0.92), transparent);
  pointer-events: none;
}

.wordmark {
  border: 0;
  background: none;
  padding: 0;
  font-size: 1.15rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  pointer-events: auto;
}

.search-wrap { position: relative; width: min(20rem, 45vw); pointer-events: auto; }
#search {
  width: 100%;
  border: 0;
  border-bottom: 1px solid #4a4f4b;
  border-radius: 0;
  outline: 0;
  padding: 0.6rem 0.15rem;
  background: rgba(5, 6, 8, 0.65);
  color: var(--ink);
  font-size: 0.76rem;
}
#search:focus { border-color: var(--focus); }
#search::placeholder { color: #747973; }

.results {
  position: absolute;
  top: calc(100% + 0.5rem);
  width: 100%;
  max-height: 17rem;
  overflow-y: auto;
  border: 1px solid var(--faint);
  background: rgba(7, 9, 10, 0.98);
  font-size: 0.72rem;
}
.result {
  display: block;
  width: 100%;
  padding: 0.75rem;
  border: 0;
  border-bottom: 1px solid #1d211f;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.result:hover, .result:focus-visible { background: #151917; }
.result span { display: block; margin-top: 0.25rem; color: var(--muted); font-size: 0.64rem; }
.no-results { margin: 0; padding: 0.8rem; color: var(--muted); }

.hint { margin-left: auto; color: #767b76; font-size: 0.61rem; }

.memorial {
  position: absolute;
  right: max(1.25rem, env(safe-area-inset-right));
  bottom: max(1.25rem, env(safe-area-inset-bottom));
  width: min(25rem, calc(100vw - 2.5rem));
  padding: 2.2rem 2.25rem 2.35rem;
  border: 1px solid #303532;
  background: var(--panel);
  box-shadow: 0 1.25rem 4rem rgba(0, 0, 0, 0.4);
  pointer-events: auto;
  animation: memorial-in 350ms ease-out;
}

@keyframes memorial-in { from { opacity: 0; transform: translateY(0.75rem); } }
.memorial h2 { margin: 0; font-size: 1.75rem; font-weight: 400; }
.years { margin: 0.65rem 0 1.75rem; color: var(--muted); font-size: 0.95rem; }
.memorial blockquote { margin: 0; line-height: 1.6; font-size: 1.05rem; font-style: italic; }
.close-button {
  position: absolute;
  top: 0.65rem;
  right: 0.75rem;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 1.4rem;
  cursor: pointer;
}

.scale-controls {
  position: absolute;
  left: max(1rem, env(safe-area-inset-left));
  bottom: max(1rem, env(safe-area-inset-bottom));
  display: flex;
  border: 1px solid #303532;
  pointer-events: auto;
}
.scale-controls button {
  width: 2.35rem;
  height: 2.25rem;
  border: 0;
  background: rgba(8, 10, 11, 0.9);
  cursor: pointer;
}
.scale-controls button + button { border-left: 1px solid #303532; }
.scale-controls button:hover { background: #191d1b; }

.loading {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  z-index: 20;
  transform: translateX(-50%);
  color: var(--muted);
  font-size: 0.65rem;
}

.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; }
[hidden] { display: none !important; }
:focus-visible { outline: 1px solid var(--focus); outline-offset: 3px; }

@media (max-width: 680px) {
  .toolbar { gap: 1rem; align-items: flex-start; }
  .wordmark { margin-top: 0.45rem; }
  .search-wrap { width: auto; flex: 1; }
  .hint { display: none; }
  .memorial { left: 1rem; right: 1rem; bottom: 4.25rem; width: auto; padding: 1.7rem 1.6rem 1.8rem; }
  .memorial h2 { font-size: 1.45rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
