@font-face { font-family: "Inter"; src: url("/fonts/inter.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Instrument Serif"; src: url("/fonts/instrument-serif.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Instrument Serif"; src: url("/fonts/instrument-serif-italic.woff2") format("woff2"); font-style: italic; font-weight: 400; font-display: swap; }

:root {
  --paper: #f4f1ea;
  --ink: #1d1f23;
  --muted: #6d6a63;
  --hair: rgba(29, 31, 35, 0.12);
  --well: rgba(29, 31, 35, 0.06);
  --on: #1d1f23;
  --on-ink: #f4f1ea;
  --veil: #e9e4da;
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #17181b;
    --ink: #ecebe6;
    --muted: #9b9a94;
    --hair: rgba(236, 235, 230, 0.13);
    --well: rgba(236, 235, 230, 0.07);
    --on: #ecebe6;
    --on-ink: #17181b;
    --veil: #121316;
  }
}

html, body { height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; }
body {
  position: fixed;
  inset: 0;
  background: var(--veil); /* replaced by the sky's colour once the scene runs */
  font: 15px/1.4 var(--sans);
  font-feature-settings: "tnum" 1, "cv11" 1;
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
button { font: inherit; color: inherit; }

.stage { position: fixed; inset: 0; height: 100dvh; overflow: hidden; overscroll-behavior: none; }
.stage canvas { display: block; width: 100%; height: 100%; touch-action: none; outline: none; }
body.pixel .stage canvas { image-rendering: pixelated; }

/* ---- the caption: a quiet label over a soft shade at the foot of the picture ---- */
.scrim {
  position: fixed;
  inset: auto 0 0 0;
  height: 34dvh;
  background: linear-gradient(to top, rgba(10, 12, 16, 0.42), rgba(10, 12, 16, 0.16) 45%, rgba(10, 12, 16, 0));
  pointer-events: none;
  transition: opacity 1.2s ease;
}
.caption {
  position: fixed;
  left: 24px;
  right: 88px;
  bottom: 30px;
  margin: 0;
  color: #f7f5ef;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  transition: opacity 1.2s ease;
}
.place {
  display: block;
  font: 400 clamp(28px, 4.2vw, 46px) / 1.05 var(--serif);
  letter-spacing: -0.005em;
}
.facts {
  display: block;
  margin-top: 8px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  opacity: 0.86;
}
.facts:empty { display: none; }
body.quiet .caption, body.quiet .scrim, body.quiet .open { opacity: 0; }
body.sheet-open .caption, body.sheet-open .scrim { opacity: 0; }

.open {
  position: fixed;
  right: 20px;
  bottom: 22px;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(20, 22, 26, 0.32);
  color: #f7f5ef;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transition: opacity 1.2s ease, background 0.2s ease;
}
.open:active { background: rgba(20, 22, 26, 0.5); }
body.sheet-open .open { opacity: 0; pointer-events: none; }

/* ---- the settings sheet ---- */
.sheet {
  position: fixed;
  left: 10px;
  right: 10px;
  bottom: 20px;
  max-width: 400px;
  margin: 0 auto;
  padding: 18px 18px 14px;
  box-sizing: border-box;
  border-radius: 22px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 1px 0 var(--hair) inset, 0 24px 60px rgba(0, 0, 0, 0.28);
  overscroll-behavior: none;
  animation: rise 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.sheet[hidden] { display: none; }
@keyframes rise { from { transform: translateY(16px); opacity: 0; } }
@media (min-width: 720px) { .sheet { left: auto; right: 24px; bottom: 24px; width: 380px; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin: -4px -4px 10px 0; }
h1 { margin: 0; font: 400 26px/1.1 var(--serif); letter-spacing: -0.005em; }
.close { width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--muted); }
.close:active { background: var(--well); }

.field { padding: 12px 0; border-top: 1px solid var(--hair); }
.label { display: block; margin-bottom: 9px; font-size: 11px; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); }
.label-row { display: flex; align-items: baseline; justify-content: space-between; }
.value { font-size: 13px; font-weight: 500; color: var(--ink); }
.note { margin: 9px 0 0; font-size: 13px; color: var(--muted); }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; padding: 3px; border-radius: 13px; background: var(--well); }
.segmented button {
  min-height: 44px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  font-size: 14px;
  font-weight: 550;
  color: var(--muted);
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}
.segmented button[aria-checked="true"] { background: var(--paper); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 0 0 1px var(--hair); }

.time-row { display: flex; align-items: center; gap: 12px; }
input[type="range"] {
  flex: 1;
  height: 44px;
  margin: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
}
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(90deg, #2a3350, #c98f6a 26%, #e8d6a8 50%, #c98f6a 74%, #2a3350); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 2px; background: linear-gradient(90deg, #2a3350, #c98f6a 26%, #e8d6a8 50%, #c98f6a 74%, #2a3350); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px; height: 22px; margin-top: -9px; border-radius: 50%;
  background: var(--paper); border: 1.5px solid var(--ink); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}
input[type="range"]::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: var(--paper); border: 1.5px solid var(--ink); }
.live {
  min-width: 64px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--hair);
  border-radius: 22px;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.live[aria-pressed="true"] { background: var(--on); color: var(--on-ink); border-color: transparent; }
.live[aria-pressed="true"]::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 7px; border-radius: 50%; background: #e05a47; vertical-align: 1px; }

.weathers { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.weathers button {
  min-height: 58px;
  padding: 6px 0 5px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 550;
  letter-spacing: 0.02em;
}
.weathers button svg { width: 22px; height: 22px; }
.weathers button[aria-checked="true"] { background: var(--well); color: var(--ink); }
.how { margin: 0; padding: 12px 0 0; border-top: 1px solid var(--hair); font-size: 12px; line-height: 1.45; color: var(--ink); }
.credits { margin: 10px 0 0; padding-top: 12px; border-top: 1px solid var(--hair); font-size: 11px; line-height: 1.45; color: var(--muted); }

button:focus-visible, input:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }

/* ---- loading / problem ---- */
.veil {
  position: fixed;
  inset: 0;
  height: 100dvh;
  display: grid;
  place-items: center;
  padding: 32px;
  box-sizing: border-box;
  background: var(--veil);
  color: var(--ink);
  transition: opacity 0.9s ease;
  z-index: 5;
}
.veil[hidden] { display: none; }
.veil.gone { opacity: 0; pointer-events: none; }
.veil-in { width: min(300px, 100%); text-align: center; }
.veil-title { margin: 0 0 18px; font: 400 34px/1.1 var(--serif); letter-spacing: -0.005em; }
.veil-note { margin: 14px 0 0; font-size: 13px; color: var(--muted); }
.bar { height: 2px; background: var(--hair); overflow: hidden; }
.bar i { display: block; height: 100%; width: 3%; background: var(--ink); transition: width 0.3s ease; }
.retry { margin-top: 18px; min-height: 44px; padding: 0 22px; border: 1px solid var(--hair); border-radius: 22px; background: transparent; font-weight: 600; }

/* ---- install prompt, in this site's colours ---- */
install-prompt {
  --ip-bg: #f4f1ea;
  --ip-fg: #1d1f23;
  --ip-muted: #6d6a63;
  --ip-line: rgba(29, 31, 35, 0.12);
  --ip-chip: rgba(29, 31, 35, 0.06);
  --ip-accent: #1d1f23;
  --ip-on-accent: #f4f1ea;
  --ip-font: var(--sans);
  --ip-radius: 22px;
  --ip-radius-inner: 12px;
}
@media (prefers-color-scheme: dark) {
  install-prompt {
    --ip-bg: #17181b;
    --ip-fg: #ecebe6;
    --ip-muted: #9b9a94;
    --ip-line: rgba(236, 235, 230, 0.13);
    --ip-chip: rgba(236, 235, 230, 0.08);
    --ip-accent: #ecebe6;
    --ip-on-accent: #17181b;
  }
}
