/* Termina palette (Settings > Palette): a Majora's Mask take on the dashboard. A test run, added 2026-11-20.
   Everything here only applies with html[data-palette="termina"]; Hyrule (green) stays the default.
   Night-sky purples, Majora's magenta for buttons and highlights, the falling moon's amber in place of gold,
   and a faint moon glow with a few stars behind the page. */
:root[data-palette="termina"] {
  --bg: #F1ECF3;
  --surface: #FCFAFF;
  --sunken: #E8E0EE;
  --ink: #261A30;
  --muted: #6B5D78;
  --line: #D5C9DE;
  --accent: #7A3F96;
  --on-accent: #FFFFFF;
  --gold: #A85F0D;
  --gold-fill: #D9892A;
  --danger: #B23A48;
  --glow: rgba(122, 63, 150, .25);
  --gold-glow: rgba(217, 137, 42, .32);
}
@media (prefers-color-scheme: dark) {
  :root[data-palette="termina"]:not([data-theme="light"]) {
    --bg: #120C1C;
    --surface: #1D1429;
    --sunken: #160F21;
    --ink: #ECE4F2;
    --muted: #A597B6;
    --line: #3A2B4D;
    --accent: #C77DDE;
    --on-accent: #170D20;
    --gold: #F2A541;
    --gold-fill: #F2A541;
    --danger: #F0767A;
    --glow: rgba(199, 125, 222, .35);
    --gold-glow: rgba(242, 165, 65, .38);
  }
}
:root[data-palette="termina"][data-theme="dark"] {
  --bg: #120C1C;
  --surface: #1D1429;
  --sunken: #160F21;
  --ink: #ECE4F2;
  --muted: #A597B6;
  --line: #3A2B4D;
  --accent: #C77DDE;
  --on-accent: #170D20;
  --gold: #F2A541;
  --gold-fill: #F2A541;
  --danger: #F0767A;
  --glow: rgba(199, 125, 222, .35);
  --gold-glow: rgba(242, 165, 65, .38);
}

/* Stars on the page itself (html), so the moon (a fixed layer at z-index -1, drawn by js/termina.js) sits between
   the sky and the page's content. */
:root[data-palette="termina"] {
  background:
    radial-gradient(1.5px 1.5px at 12% 18%, color-mix(in srgb, var(--ink) 50%, transparent) 50%, transparent 51%),
    radial-gradient(1px 1px at 28% 7%, color-mix(in srgb, var(--ink) 45%, transparent) 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 47% 22%, color-mix(in srgb, var(--ink) 35%, transparent) 50%, transparent 51%),
    radial-gradient(1px 1px at 63% 11%, color-mix(in srgb, var(--ink) 45%, transparent) 50%, transparent 51%),
    radial-gradient(1px 1px at 74% 31%, color-mix(in srgb, var(--ink) 30%, transparent) 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 8% 42%, color-mix(in srgb, var(--ink) 30%, transparent) 50%, transparent 51%),
    radial-gradient(1px 1px at 36% 38%, color-mix(in srgb, var(--ink) 25%, transparent) 50%, transparent 51%),
    radial-gradient(1px 1px at 55% 46%, color-mix(in srgb, var(--ink) 25%, transparent) 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 88% 58%, color-mix(in srgb, var(--ink) 25%, transparent) 50%, transparent 51%),
    var(--bg);
  background-attachment: fixed;
}
:root[data-palette="termina"] body { background: transparent; }

/* The moon, with its scowl. It grows and drops toward midnight Central (--moon, --drop set by js/termina.js). */
.tm-moon { position: fixed; z-index: -1; pointer-events: none; right: 7vw; top: var(--drop, 80px);
  width: var(--moon, 120px); height: var(--moon, 120px); border-radius: 50%; opacity: .55;
  background:
    radial-gradient(circle at 70% 70%, rgba(110, 50, 20, .35) 0 9%, transparent 10%),
    radial-gradient(circle at 25% 72%, rgba(110, 50, 20, .3) 0 6%, transparent 7%),
    radial-gradient(circle at 78% 30%, rgba(110, 50, 20, .25) 0 5%, transparent 6%),
    radial-gradient(circle at 38% 32%, #FFE2B0, #F2A541 45%, #C8642C 78%, #7A3518 100%);
  box-shadow: 0 0 40px 10px rgba(242, 140, 60, .25), inset -10px -12px 24px rgba(60, 20, 10, .45);
  transition: width 2s, height 2s, top 2s, filter 2s; }
/* Its eyes and brow: two glaring slits under a heavy frown. */
.tm-moon::before { content: ""; position: absolute; left: 22%; right: 22%; top: 34%; height: 13%;
  background:
    radial-gradient(ellipse at 22% 70%, #2A0E08 0 32%, transparent 34%),
    radial-gradient(ellipse at 78% 70%, #2A0E08 0 32%, transparent 34%);
  border-top: 3px solid rgba(60, 20, 10, .6); border-radius: 40% 40% 0 0; }
.tm-moon::after { content: ""; position: absolute; left: 32%; right: 32%; top: 66%; height: 8%;
  border-top: 3px solid rgba(50, 15, 8, .55); border-radius: 50% 50% 0 0; }
@media (prefers-color-scheme: light) { :root[data-palette="termina"]:not([data-theme="dark"]) .tm-moon { opacity: .4; } }
:root[data-palette="termina"][data-theme="light"] .tm-moon { opacity: .4; }
/* The final hour: it reddens and trembles. */
:root[data-final] .tm-moon { filter: hue-rotate(-14deg) saturate(1.35); animation: tm-tremble .5s linear infinite; }
@keyframes tm-tremble { 25% { translate: 1px 0; } 50% { translate: 0 1px; } 75% { translate: -1px 0; } }

/* The Clock Town countdown chip (next to the wallet). */
.tmclock { color: var(--gold); font-weight: 600; }
:root[data-final] .tmclock { color: var(--danger); border-color: var(--danger); }
:root:not([data-palette="termina"]) .tmclock { display: none; }

/* "Dawn of the First Day" title card. */
.tm-dawn { position: fixed; inset: 0; z-index: 95; display: grid; place-items: center; background: rgba(8, 4, 14, .86);
  color: #F5EEDC; text-align: center; cursor: pointer; animation: tm-fade-in .7s ease-out both; }
.tm-dawn.out { animation: tm-fade-out .8s ease-in both; }
.tm-dawn small { display: block; font-family: var(--display); letter-spacing: .3em; text-transform: uppercase; font-size: 1rem; opacity: .85; }
.tm-dawn b { display: block; font-family: var(--display); font-size: clamp(2.2rem, 7vw, 4.4rem); letter-spacing: .06em; margin: 6px 0 10px;
  text-shadow: 0 0 24px rgba(242, 165, 65, .45); }
.tm-dawn i { font-style: normal; font-family: var(--display); letter-spacing: .14em; color: #F2A541; }
@keyframes tm-fade-in { from { opacity: 0; } }
@keyframes tm-fade-out { to { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .tm-moon { animation: none !important; transition: none; } .tm-dawn, .tm-dawn.out { animation: none; } }

/* The logo ring glows moon-amber with a magenta edge, like Majora's Mask's spikes. */
:root[data-palette="termina"] .brand .logo {
  box-shadow: 0 0 0 1px var(--line), 0 0 0 4px var(--surface), 0 0 0 5px var(--gold-fill), 0 0 0 7px color-mix(in srgb, var(--accent) 45%, transparent),
    0 0 18px 5px var(--gold-glow);
}
