/* Fonts are self-hosted (SIL Open Font License, see fonts/OFL-*.txt). */
@font-face {
  font-family: "Caprasimo";
  src: url("fonts/caprasimo-latin-400.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Nunito";
  src: url("fonts/nunito-latin-wght.woff2") format("woff2-variations"), url("fonts/nunito-latin-wght.woff2") format("woff2");
  font-weight: 200 1000; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Nunito";
  src: url("fonts/nunito-latin-wght-italic.woff2") format("woff2-variations"), url("fonts/nunito-latin-wght-italic.woff2") format("woff2");
  font-weight: 200 1000; font-style: italic; font-display: swap;
}

/* Layout: one night scene fills the screen; a quiet title sits top-left and a single
   control dock floats at the bottom. Committed to one look (a pond at night). */
:root {
  --night: #0a1522;          /* page ground, deep blue-black */
  --night-2: #10202f;        /* raised panels */
  --ink: #eaf2e8;            /* moonlit text */
  --muted: #a3b8b2;          /* secondary text */
  --lamp: #ffc66b;           /* lighthouse amber, the one accent */
  --lamp-ink: #2a1a04;       /* text on amber */
  --lily: #8fd19a;           /* lily-pad green, for "on" states */
  --line: rgba(234, 242, 232, 0.14);
  --panel: rgba(13, 27, 40, 0.80);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --display: "Caprasimo", "Cooper Black", "Cooper Std", Georgia, serif;
  --ui: "Nunito", "Avenir Next", "Trebuchet MS", system-ui, sans-serif;
  --radius: 14px;
  color-scheme: dark;
}
/* Base */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
[hidden] { display: none !important; }
a { color: var(--lamp); }
a:focus-visible { outline: 2px solid var(--lamp); outline-offset: 2px; border-radius: 3px; }
html, body { height: 100%; }
body {
  background: var(--night);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 15px;
  line-height: 1.45;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
button, input { font: inherit; color: inherit; }
.stage { position: fixed; inset: 0; }
#pond {
  position: absolute; inset: 0; width: 100%; height: 100%;
  display: block; touch-action: none; outline: none; cursor: default;
}
#pond:focus-visible { box-shadow: inset 0 0 0 2px var(--lamp); }

/* Title */
.masthead {
  position: fixed; z-index: 3;
  top: calc(env(safe-area-inset-top, 0px) + 14px); left: 16px; right: 16px;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  pointer-events: none;
}
.masthead > * { pointer-events: auto; }
.brand h1 {
  margin: 0; font-family: var(--display); font-weight: 400;
  font-size: clamp(26px, 4.2vw, 40px); line-height: 1; letter-spacing: 0.01em;
  text-shadow: 0 2px 0 rgba(0,0,0,0.35);
}
.brand h1 .dot { color: var(--lamp); }
.brand p {
  margin: 6px 0 0; max-width: 34ch; color: var(--muted); font-size: 13.5px;
  text-wrap: pretty;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; max-width: 52%; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line);
  background: rgba(10, 21, 34, 0.55); color: var(--muted);
  font-size: 12px; font-weight: 700; letter-spacing: 0.04em; white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.chip b { color: var(--ink); font-weight: 800; }
button.chip { cursor: pointer; }
button.chip:hover { color: var(--ink); border-color: rgba(234,242,232,0.3); }

/* Notices */
.notices {
  position: fixed; z-index: 3; left: 50%; transform: translateX(-50%);
  top: calc(env(safe-area-inset-top, 0px) + 86px);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  width: min(440px, calc(100% - 32px)); pointer-events: none;
}
.notice {
  padding: 6px 12px; border-radius: 999px; background: rgba(10, 21, 34, 0.72);
  border: 1px solid var(--line); color: var(--ink); font-size: 13px; text-align: center;
  animation: notice-in 0.35s ease-out both;
}
.notice.out { animation: notice-out 0.6s ease-in both; }
.notice em { font-style: normal; color: var(--lamp); font-weight: 700; }
@keyframes notice-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes notice-out { to { opacity: 0; transform: translateY(-4px); } }

/* Dock */
.dock {
  position: fixed; z-index: 4; left: 50%; transform: translateX(-50%);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 14px);
  width: max-content; max-width: calc(100% - 24px);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 10px;
  padding: 8px 10px; border-radius: 18px;
  background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.group { display: flex; align-items: center; gap: 6px; }
.sep { width: 1px; align-self: stretch; background: var(--line); }
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 38px; padding: 0 12px; border-radius: 11px;
  background: transparent; border: 1px solid transparent; cursor: pointer;
  color: var(--ink); font-size: 13px; font-weight: 700; white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn svg { width: 18px; height: 18px; flex: none; }
.btn:hover { background: rgba(234, 242, 232, 0.07); }
.btn:focus-visible, .pill:focus-visible, .chip:focus-visible, .play:focus-visible, .card button:focus-visible {
  outline: 2px solid var(--lamp); outline-offset: 2px;
}
.btn[aria-pressed="true"] { background: rgba(143, 209, 154, 0.14); border-color: rgba(143, 209, 154, 0.45); color: var(--lily); }
.play {
  width: 46px; height: 46px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; background: var(--lamp); color: var(--lamp-ink);
  box-shadow: 0 0 0 4px rgba(255, 198, 107, 0.16), 0 0 24px rgba(255, 198, 107, 0.35);
  transition: transform 0.12s;
}
.play:active { transform: scale(0.94); }
.play svg { width: 20px; height: 20px; }
.play[aria-pressed="false"] { background: var(--night-2); color: var(--lamp); box-shadow: inset 0 0 0 2px var(--lamp); }
.pills { display: flex; gap: 4px; padding: 3px; border-radius: 12px; background: rgba(0,0,0,0.22); }
.pill {
  border: 0; background: transparent; cursor: pointer; border-radius: 9px;
  padding: 7px 10px; font-size: 13px; font-weight: 700; color: var(--muted); white-space: nowrap;
}
.pill:hover { color: var(--ink); }
.pill[aria-checked="true"] { background: var(--ink); color: var(--night); }
.tempo { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 800; color: var(--muted); }
.tempo output { min-width: 3.2ch; color: var(--ink); font-variant-numeric: tabular-nums; }
input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 104px; height: 22px; background: transparent; cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: rgba(234,242,232,0.22); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 4px; background: rgba(234,242,232,0.22); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 16px; margin-top: -6px; border-radius: 50%;
  background: var(--lamp); border: 2px solid var(--night);
}
input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--lamp); border: 2px solid var(--night); }
input[type="range"]:focus-visible { outline: 2px solid var(--lamp); outline-offset: 2px; border-radius: 6px; }

/* Frog card */
.card {
  position: fixed; z-index: 5; width: min(300px, calc(100% - 32px));
  padding: 14px 16px 12px; border-radius: var(--radius);
  background: #f3ecd9; color: #1d2a22; box-shadow: 0 14px 40px rgba(0,0,0,0.45);
  border: 1px solid rgba(0,0,0,0.1);
}
.card::before {
  content: ""; position: absolute; inset: 5px; border-radius: 10px; pointer-events: none;
  border: 1px dashed rgba(29, 42, 34, 0.25);
}
.card .eyebrow { font-size: 11px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: #6b5a2e; }
.card h2 { margin: 2px 0 2px; font-family: var(--display); font-weight: 400; font-size: 22px; line-height: 1.1; text-wrap: balance; }
.card .part { font-size: 13px; font-weight: 700; color: #3f5546; font-variant-numeric: tabular-nums; }
.card .quirk { margin: 8px 0 10px; font-style: italic; font-size: 14px; color: #2c3a30; text-wrap: pretty; }
.card .row { display: flex; gap: 6px; flex-wrap: wrap; position: relative; }
.card button {
  border: 1px solid rgba(29,42,34,0.25); background: #fffaf0; color: #1d2a22; cursor: pointer;
  border-radius: 9px; padding: 6px 10px; font-size: 13px; font-weight: 800;
}
.card button:hover { background: #fff; }
.card button.warn { color: #8a2f1d; }
.card .close { position: absolute; top: 8px; right: 8px; border: 0; background: transparent; padding: 4px 6px; font-size: 18px; line-height: 1; z-index: 1; }

/* Intro + help */
.veil {
  position: fixed; inset: 0; z-index: 6; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(ellipse at 50% 60%, rgba(10,21,34,0.25), rgba(10,21,34,0.78));
}
.sheet {
  width: min(420px, 100%); padding: 24px 24px 20px; border-radius: 18px; text-align: center;
  background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.sheet h2 { margin: 0; font-family: var(--display); font-weight: 400; font-size: 40px; line-height: 1; }
.sheet h2 .dot { color: var(--lamp); }
.sheet p { margin: 10px auto 0; color: var(--muted); max-width: 32ch; text-wrap: pretty; }
.sheet .go {
  margin-top: 18px; border: 0; cursor: pointer; border-radius: 12px; padding: 12px 20px;
  background: var(--lamp); color: var(--lamp-ink); font-weight: 800; font-size: 15px;
  box-shadow: 0 0 30px rgba(255, 198, 107, 0.35);
}
.sheet .go:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.sheet .small { font-size: 12.5px; margin-top: 12px; }
.sheet ul { text-align: left; margin: 14px 0 0; padding-left: 20px; color: var(--ink); display: grid; gap: 6px; font-size: 14px; }
.sheet ul b { color: var(--lamp); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 720px) {
  .brand p { display: none; }
  .chips { max-width: 58%; }
  .btn .lbl { display: none; }
  .btn { padding: 0 9px; }
  .sep { display: none; }
  .dock { gap: 6px; padding: 8px; }
  input[type="range"] { width: 84px; }
  .notices { top: calc(env(safe-area-inset-top, 0px) + 62px); }
}
@media (max-width: 400px) {
  .pill { padding: 7px 8px; font-size: 12.5px; }
  .chip { font-size: 11px; padding: 3px 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .notice, .notice.out { animation-duration: 0.01s; }
}

.sheet h2.sheet-title { font-size: 30px; }
.sheet .credit { font-size: 12.5px; margin-top: 14px; color: var(--muted); }
.sheet .credit a { color: var(--lamp); }

/* Still mode (?still=<mood>) renders a clean picture for the catalogue and link previews. */
body.still .masthead, body.still .dock, body.still .notices, body.still .veil, body.still .card { display: none !important; }
