/* Shared by every page of the web player. */
:root {
  --width: 600px; /* the page column; the player bar matches it */
  --bg: #fafaf9; --fg: #1c1b1a; --muted: #8a8780; --line: #e8e6e1; --hover: #f1f0ec;
  --accent: #2a8fc4; --accent-soft: #e3f1f8;
  color-scheme: light;
}
/* Dark mode. js/theme.js sets data-theme from the visitor's choice, or else the system's, before the page draws. */
:root[data-theme=dark] {
  --bg: #151514; --fg: #ecebe8; --muted: #7d7a74; --line: #262624; --hover: #1d1d1b;
  --accent: #7fd4f5; --accent-soft: #182a33;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); }
body { font: 14px/1.4 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; }
main { max-width: var(--width); margin: 0 auto; padding: 48px 16px 150px; }

/* The title, centred, with the page links centred under it. */
header { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 24px; }
/* Rubik Black (SIL OFL 1.1), subset to just the glyphs of "Re-SiON". */
@font-face { font-family: "Rubik Black Title"; src: url(fonts/rubik-black-title.woff2) format("woff2"); font-weight: 900; font-display: swap; }
/* The title: heavy, spaced-out letters filled with an ice-blue sine wave
   that flows endlessly through the glyphs (background clipped to the text). */
:root {
  --ice-top: var(--fg);
  --ice-wave: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 40' preserveAspectRatio='none'%3E%3Cpath d='M0 20C13 10 27 10 40 20S67 30 80 20V40H0Z' fill='%23167bb0' fill-opacity='1'/%3E%3C/svg%3E");
}
:root[data-theme=dark] {
  --ice-wave: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 40' preserveAspectRatio='none'%3E%3Cpath d='M0 20C13 10 27 10 40 20S67 30 80 20V40H0Z' fill='%2363c4ee' fill-opacity='1'/%3E%3C/svg%3E");
}
h1 { font: 900 28px/1.1 "Rubik Black Title", ui-sans-serif, system-ui, sans-serif; letter-spacing: 0.1em; margin: 0; }
h1 a {
  display: inline-block; margin-right: -0.1em; /* cancel the trailing letter-space so it stays centred */
  text-decoration: none; color: var(--accent);
  background: var(--ice-wave) 0 100% / 90px 76% repeat-x,
              linear-gradient(var(--ice-top) 0 0);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: ice-flow 6s linear infinite;
}
@keyframes ice-flow { to { background-position: -180px 100%, 0 0; } }
@media (prefers-reduced-motion: reduce) { h1 a { animation: none; } }
@media (forced-colors: active) { h1 a { background: none; -webkit-text-fill-color: currentColor; } }
/* The light/dark switch (added by js/theme.js), in the top left corner. It shows the mode it switches to. */
button.theme, a.github {
  position: absolute; top: 12px; left: 12px; width: 34px; height: 34px; display: grid; place-items: center; padding: 0;
  color: var(--muted); background: transparent; border: 1px solid var(--line); border-radius: 50%; cursor: pointer;
}
/* The GitHub link (also added by js/theme.js), the same size, in the top right corner. */
a.github { left: auto; right: 12px; }
:is(button.theme, a.github):hover { color: var(--fg); background: var(--hover); }
:is(button.theme, a.github):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
:is(button.theme, a.github) svg { width: 16px; height: 16px; fill: currentColor; }
:root[data-theme=dark] button.theme .moon, :root:not([data-theme=dark]) button.theme .sun { display: none; }
header nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; }
header nav a {
  color: var(--muted); font-size: 13px; text-decoration: none; padding: 4px 10px; border-radius: 6px;
}
header nav a:hover { background: var(--hover); color: var(--fg); }
header nav a[aria-current] { color: var(--fg); background: var(--hover); font-weight: 550; }

/* Song lists (songs.html, and the examples on the home page). */
ol.songs { list-style: none; margin: 0; padding: 0; }
ol.songs li { border-radius: 8px; cursor: pointer; user-select: none; }
ol.songs li:hover { background: var(--hover); }
/* Each row is a link to its song file; the link fills the whole row (padding included), so every pixel of it is clickable. */
ol.songs li > a {
  display: grid; grid-template-columns: 22px 1fr; gap: 8px; align-items: baseline;
  padding: 8px 10px; border-radius: inherit; color: inherit; text-decoration: none;
}
ol.songs li > a:focus-visible { outline: 2px solid var(--accent); }
ol.songs li .n { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
ol.songs li .t { display: flex; gap: 8px; align-items: baseline; min-width: 0; white-space: nowrap; }
ol.songs li .t span { overflow: hidden; text-overflow: ellipsis; }
ol.songs li .t .a { flex: none; max-width: 40%; margin-left: auto; color: var(--muted); font-size: 12px; font-weight: 400; }
ol.songs li.on { background: var(--accent-soft); }
ol.songs li.on .t { color: var(--accent); font-weight: 550; }
ol.songs li.on .n { color: transparent; position: relative; }
ol.songs li.on .n::after {
  content: ""; position: absolute; left: 0; top: 50%; width: 10px; height: 10px; margin-top: -5px;
  background: linear-gradient(var(--accent) 0 0) 0 100% / 2px 100%,
              linear-gradient(var(--accent) 0 0) 4px 100% / 2px 60%,
              linear-gradient(var(--accent) 0 0) 8px 100% / 2px 80%;
  background-repeat: no-repeat;
}
body.playing ol.songs li.on .n::after { animation: eq 0.9s steps(3) infinite; }
@keyframes eq { 50% { background-size: 2px 40%, 2px 100%, 2px 30%; } }

footer {
  --btn: 36px;
  position: fixed; left: 0; right: 0; bottom: 0; background: var(--bg); border-top: 1px solid var(--line);
}
footer div.bar { max-width: var(--width); margin: 0 auto; padding: 10px 16px 14px; }
footer button[hidden] { display: none; }
footer div.row { display: flex; align-items: center; gap: 12px; }
footer div.seek { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
footer .now { flex: 1; min-width: 0; }
footer .now .t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 550; }
/* Long titles slide back and forth (js/player.js sets .scroll, --over and --dur). */
@media (prefers-reduced-motion: no-preference) {
  footer .now .t.scroll { text-overflow: clip; }
  footer .now .t.scroll span { display: inline-block; animation: marquee var(--dur) linear infinite alternate; }
}
@keyframes marquee { 0%, 20% { transform: none; } 80%, 100% { transform: translateX(var(--over)); } }
footer .now .a {
  color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  /* A 1px outline in the page background, so the label stays readable over the visualizer. */
  text-shadow: -1px -1px 0 var(--bg), 0 -1px 0 var(--bg), 1px -1px 0 var(--bg), -1px 0 0 var(--bg),
    1px 0 0 var(--bg), -1px 1px 0 var(--bg), 0 1px 0 var(--bg), 1px 1px 0 var(--bg);
}
/* As wide as the buttons under them, and centred, so the length sits right above the download button. */
footer time { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; min-width: var(--btn); text-align: center; }

input[type=range] {
  --p: 0%; flex: 1; height: 16px; margin: 0; background: transparent; cursor: pointer; -webkit-appearance: none; appearance: none;
}
input[type=range]:disabled { cursor: default; }
input[type=range]::-webkit-slider-runnable-track {
  height: 4px; border-radius: 2px; background: linear-gradient(var(--accent) 0 0) 0 / var(--p) 100% no-repeat, var(--line);
}
input[type=range]::-moz-range-track { height: 4px; border-radius: 2px; background: var(--line); }
input[type=range]::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--accent); }
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 12px; height: 12px; margin-top: -4px; border: 0; border-radius: 50%;
  background: var(--accent); transform: scale(0); transition: transform 0.12s;
}
input[type=range]::-moz-range-thumb {
  width: 12px; height: 12px; border: 0; border-radius: 50%; background: var(--accent); transform: scale(0); transition: transform 0.12s;
}
input[type=range]:not(:disabled):is(:hover, :active, :focus-visible)::-webkit-slider-thumb { transform: scale(1); }
input[type=range]:not(:disabled):is(:hover, :active, :focus-visible)::-moz-range-thumb { transform: scale(1); }
input[type=range]:focus { outline: none; }
footer button {
  width: var(--btn); height: var(--btn); flex: none; display: grid; place-items: center; padding: 0; cursor: pointer;
  color: var(--fg); background: transparent; border: 1px solid var(--line); border-radius: 50%;
}
/* Above the visualizer (which would otherwise paint over them), on a mostly opaque fill of the page background. */
footer button:where(#prev, #next) { position: relative; z-index: 1; background: color-mix(in srgb, var(--bg) 80%, transparent); }
footer button:hover:not(:disabled) { background: var(--hover); }
footer button:disabled { opacity: 0.35; cursor: default; }
footer button.main { background: var(--fg); color: var(--bg); border-color: var(--fg); width: 40px; height: 40px; }
footer button.main:hover:not(:disabled) { background: var(--fg); opacity: 0.85; }
svg { width: 14px; height: 14px; fill: currentColor; }
/* Volume: the mute button with a short slider beside it, whose thumb always shows (it's a setting, not a position). */
footer div.vol { display: flex; align-items: center; gap: 6px; flex: none; position: relative; z-index: 1; }
footer div.vol input[type=range] { flex: none; width: 72px; --f: 1; }
footer div.vol button { border-color: transparent; }
footer div.vol svg { width: 16px; height: 16px; }
/* The thumb stays inside the track, so its centre travels from 5px in to 5px short of the end: the fill (--f, 0 to 1)
   ends at its centre, and at full volume the thumb's edge meets the track's end. */
footer div.vol input[type=range]::-webkit-slider-runnable-track {
  background: linear-gradient(var(--accent) 0 0) 0 / calc(5px + (100% - 10px) * var(--f)) 100% no-repeat, var(--line);
}
footer div.vol input[type=range]::-webkit-slider-thumb { width: 10px; height: 10px; margin-top: -3px; transform: none; }
footer div.vol input[type=range]::-moz-range-thumb { width: 10px; height: 10px; transform: none; }
/* Phones have volume buttons of their own: no volume control there, leaving room for the title. */
@media (max-width: 440px) { footer div.vol { display: none; } }
/* Phones: list titles wrap to two lines. overflow-wrap lets titles with no spaces (most Japanese ones) break. */
@media (max-width: 600px) {
  ol.songs li .t span:first-child {
    white-space: normal; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2;
  }
}

/* The spectrum heatmap (js/heatmap.js): inside the player bar, rising from the bottom of the window under its controls. */
footer canvas.heatmap { position: absolute; left: 0; bottom: 0; width: 100%; height: min(64px, 12vh); pointer-events: none; }
footer div.bar { position: relative; }
footer canvas.heatmap[hidden] { display: none; }
/* Its on/off checkbox: a tab standing on top of the bar at its right, over the bar's top border. */
footer label.viz {
  position: absolute; bottom: 100%; right: 16px; display: flex; align-items: center; gap: 5px; padding: 4px 9px 3px;
  background: var(--bg); border: 1px solid var(--line); border-bottom: 0; border-radius: 7px 7px 0 0;
  color: var(--muted); font-size: 11px; cursor: pointer; user-select: none;
}
footer label.viz[hidden] { display: none; }
footer label.viz input { margin: 0; accent-color: var(--accent); cursor: pointer; }
