/* Музыка — мастерская Валентина Трусевича.
   Ничего внешнего: системные шрифты, без библиотек. Палитра — та же, что на
   atmos.ho.ua; цвет каждой атмосферы приходит в --atm. */

:root {
  color-scheme: light;
  --ground:  #f4f1ea;
  --surface: #fffdf8;
  --ink:     #22201c;
  --ink-2:   #5d584f;
  --ink-3:   #857e71;
  --rule:    #ddd6c8;
  --accent:  #8a4b22;
  --atm:     var(--accent);
  --on-atm:  #fff;
  --shadow:  0 1px 2px rgba(50, 42, 26, .06), 0 16px 34px -20px rgba(50, 42, 26, .4);
  --serif:   Georgia, "Times New Roman", serif;
  --sans:    "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --top-h:   4.25rem;
  --player-h: 0px;

  /* караоке */
  --k-hl:    color-mix(in oklab, var(--atm) 80%, var(--ink));
  --k-rest:  color-mix(in oklab, var(--ink) 62%, transparent);
  --k-past:  color-mix(in oklab, var(--ink) 22%, transparent);
  --k-next:  color-mix(in oklab, var(--ink) 40%, transparent);
  --k-soon:  color-mix(in oklab, var(--ink) 66%, transparent);
  --k-glow:  color-mix(in oklab, var(--atm) 45%, transparent);
  --stage-bg: color-mix(in oklab, var(--atm) 7%, var(--ground));
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --ground:  #0f0e0c;
    --surface: #1a1814;
    --ink:     #ece6d8;
    --ink-2:   #b0a999;
    --ink-3:   #8c8577;
    --rule:    #312c22;
    --accent:  #d98b55;
    --on-atm:  #0f0e0c;
    --shadow:  0 1px 2px rgba(0, 0, 0, .5), 0 16px 34px -20px rgba(0, 0, 0, .9);
    --k-hl:    color-mix(in oklab, var(--atm) 62%, #fff);
    --k-rest:  color-mix(in oklab, var(--ink) 60%, transparent);
    --k-past:  color-mix(in oklab, var(--ink) 22%, transparent);
    --k-next:  color-mix(in oklab, var(--ink) 38%, transparent);
    --k-soon:  color-mix(in oklab, var(--ink) 64%, transparent);
    --k-glow:  color-mix(in oklab, var(--atm) 70%, transparent);
    --stage-bg: color-mix(in oklab, var(--atm) 9%, var(--ground));
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--ground);
  color: var(--ink);
  font: 400 1.0625rem/1.65 var(--sans);
  overflow-x: hidden;
}
body.has-player { --player-h: 4.75rem; padding-bottom: var(--player-h); }
@media (max-width: 40rem) { body.has-player { --player-h: 6.9rem; } }

a { color: inherit; }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--atm); outline-offset: 3px; border-radius: 6px;
}
[hidden] { display: none !important; }
.wrap { width: min(100% - 2rem, 60rem); margin-inline: auto; }
.skip { position: absolute; left: -999px; top: .5rem; }
.skip:focus { left: 1rem; z-index: 50; background: var(--surface); padding: .4rem .8rem; }
main:focus { outline: none; }

/* ---------- шапка ---------- */

.top {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  height: var(--top-h);
}
.mark { display: flex; align-items: center; gap: .7rem; text-decoration: none; }
.mark__seal {
  display: grid; place-items: center; flex: none;
  width: 2.5rem; height: 2.5rem; border-radius: 50%;
  border: 1.5px solid var(--accent); color: var(--accent);
  font: 400 1rem/1 var(--serif); letter-spacing: .02em;
}
.mark__name { font: 600 .8125rem/1.2 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); }
.mark:hover .mark__name { color: var(--accent); }
.top__title {
  font: italic 400 1.35rem/1 var(--serif); color: var(--ink); text-decoration: none;
}
.top__title::before { content: "♪ "; font-style: normal; color: var(--atm); transition: color .6s; }

/* ---------- общее ---------- */

.eyebrow {
  margin: 0 0 .9rem;
  font: 600 .75rem/1.3 var(--sans); letter-spacing: .16em; text-transform: uppercase; color: var(--atm);
}
.btn {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .6rem 1.1rem; border-radius: 999px; border: 0;
  background: var(--atm); color: var(--on-atm); text-decoration: none;
  font: 600 .9375rem/1.2 var(--sans); cursor: pointer;
  transition: filter .2s, transform .2s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(.97); }
.btn--ghost { background: transparent; color: var(--ink-2); border: 1px solid var(--rule); }
.link { color: var(--ink-2); font-size: .9375rem; text-underline-offset: .22em; }
.link:hover { color: var(--atm); }
.chip {
  padding: .3rem .8rem; border-radius: 999px;
  border: 1px solid var(--rule); background: transparent; color: var(--ink-2);
  font: 500 .8125rem/1.3 var(--sans); cursor: pointer;
}
.chip:hover { border-color: var(--atm); color: var(--ink); }
.chip.is-on { background: var(--atm); border-color: var(--atm); color: var(--on-atm); }

.crumbs {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding-block: .5rem 1.5rem; font-size: .9rem;
}
.crumbs a { color: var(--ink-3); text-decoration: none; }
.crumbs a:hover { color: var(--atm); }
.crumbs__right { display: flex; align-items: center; gap: .9rem; }
.crumbs__count { color: var(--ink-3); font: 400 .9rem/1 var(--serif); letter-spacing: .06em; }

/* ---------- главная ---------- */

.hero { padding-block: clamp(1.5rem, 6vw, 4rem) clamp(1.5rem, 4vw, 2.5rem); }
h1 {
  margin: 0 0 1.1rem;
  font: 400 clamp(2.2rem, 1.1rem + 4.6vw, 4rem)/1.06 var(--serif);
  letter-spacing: -.015em;
}
h1 em { font-style: italic; color: var(--atm); }
.lede { margin: 0; max-width: 40rem; color: var(--ink-2); font-size: clamp(1.02rem, 1rem + .35vw, 1.2rem); }

.moods { display: flex; flex-wrap: wrap; gap: .45rem; margin-bottom: 1.5rem; }
.moods:empty { display: none; }

.atms { list-style: none; margin: 0 0 3rem; padding: 0; display: grid; gap: 2.5rem; }
.atms__empty { color: var(--ink-3); padding: 2rem 0; }
.atms__grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
@media (min-width: 48rem) { .atms__grid { grid-template-columns: 1fr 1fr; gap: 1.25rem; } }
.theme__title {
  margin: 0 0 1rem; padding-bottom: .5rem; border-bottom: 1px solid var(--rule);
  font: 400 clamp(1.4rem, 1.1rem + 1vw, 1.8rem)/1.2 var(--serif);
}
.theme__title small, .chip small { font: 400 .8em/1 var(--sans); color: var(--ink-3); margin-left: .25em; }
.chip.is-on small { color: inherit; opacity: .75; }

.atm {
  display: grid; grid-template-columns: auto 1fr; gap: 1.1rem; align-items: start;
  padding: 1.1rem; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--rule); box-shadow: var(--shadow);
  transition: border-color .3s, transform .3s;
}
.atm:hover { border-color: color-mix(in oklab, var(--atm) 55%, var(--rule)); transform: translateY(-2px); }
.atm__orb {
  position: relative; display: block; width: 5.5rem; aspect-ratio: 1; border-radius: 14px; overflow: hidden;
  background:
    radial-gradient(circle at 30% 25%, color-mix(in oklab, var(--atm) 30%, #fff) 0, transparent 55%),
    radial-gradient(circle at 75% 80%, color-mix(in oklab, var(--atm) 60%, #000) 0, transparent 60%),
    var(--atm);
}
.atm__orb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.atm__orb.has-cover::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(transparent 45%, rgba(0, 0, 0, .55));
}
.atm__orb.has-cover .atm__num, .atm__orb.has-cover .atm__wave { z-index: 1; }
.atm__orb.has-cover .atm__num { text-shadow: 0 1px 3px rgba(0, 0, 0, .6); }
.atm__num {
  position: absolute; left: .55rem; top: .45rem;
  font: 400 .85rem/1 var(--serif); color: rgba(255, 255, 255, .85); letter-spacing: .06em;
}
.atm__wave { position: absolute; left: .55rem; right: .55rem; bottom: .55rem; height: 1.3rem; display: flex; align-items: flex-end; gap: 3px; }
.atm__wave i { flex: 1; height: 25%; background: rgba(255, 255, 255, .75); border-radius: 2px; transition: height .3s; }
.atm__wave i:nth-child(2) { height: 55%; } .atm__wave i:nth-child(3) { height: 35%; }
.atm__wave i:nth-child(4) { height: 70%; } .atm__wave i:nth-child(5) { height: 40%; }
.is-playing .atm__wave i { animation: bar 1s ease-in-out infinite alternate; }
.is-playing .atm__wave i:nth-child(2n) { animation-delay: -.4s; }
.is-playing .atm__wave i:nth-child(3n) { animation-delay: -.7s; }
@keyframes bar { from { height: 15%; } to { height: 100%; } }

.atm__body { min-width: 0; display: flex; flex-direction: column; gap: .3rem; }
.atm__mood { font: 600 .7rem/1.2 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--atm); }
.atm__name { margin: 0; font: 400 1.5rem/1.2 var(--serif); }
.atm__name a { text-decoration: none; }
.atm__name a:hover { color: var(--atm); }
.atm__tag { margin: 0; color: var(--ink-2); font-size: .95rem; font-style: italic; }
.atm__meta { margin: .1rem 0 0; font-size: .78rem; color: var(--ink-3); }
.atm__links { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin-top: .6rem; }
.atm__soon { font-size: .8rem; color: var(--ink-3); }

/* ---------- история ---------- */

.view--story { max-width: 42rem; padding-bottom: 3rem; }
.story__title { font-size: clamp(2rem, 1.2rem + 3.4vw, 3.2rem); }
.story__pic { margin: 0 0 1.5rem; }
.story__pic img { display: block; width: 100%; border-radius: 12px; }
.story__body { font: 400 clamp(1.1rem, 1rem + .4vw, 1.3rem)/1.75 var(--serif); color: var(--ink); }
.story__body p { margin: 0 0 1.1em; }
.story__body p:first-child::first-letter {
  float: left; font-size: 3.1em; line-height: .9; padding: .06em .08em 0 0; color: var(--atm);
}
.story__body img { max-width: 100%; height: auto; }
.story__body .facts {
  list-style: none; margin: 1.5rem 0 0; padding: 1rem 1.2rem; display: grid; gap: .35rem;
  background: var(--surface); border: 1px solid var(--rule); border-left: 3px solid var(--atm); border-radius: 10px;
  font: 400 .95rem/1.5 var(--sans); color: var(--ink-2);
}
.story__body .facts b { color: var(--ink); font-weight: 600; }.story__nav { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 2.5rem; flex-wrap: wrap; }
.story__nav .btn[hidden] + .dots { margin-left: 0; }
.btn--song { box-shadow: 0 0 0 0 var(--k-glow); animation: call 2.4s ease-out infinite; }
@keyframes call { 0% { box-shadow: 0 0 0 0 var(--k-glow); } 70%, 100% { box-shadow: 0 0 0 14px transparent; } }
.dots { display: flex; align-items: center; gap: .45rem; margin-inline: auto; }
.dot { width: .55rem; height: .55rem; border-radius: 50%; background: var(--rule); text-decoration: none; transition: background .2s, transform .2s; }
.dot:hover { background: var(--ink-3); }
.dot.is-on { background: var(--atm); transform: scale(1.25); }
.dot--song { width: auto; height: auto; background: none; color: var(--atm); font-size: .95rem; line-height: 1; }

/* ---------- сцена ---------- */

.view--stage {
  position: relative; isolation: isolate; overflow: hidden;
  height: calc(100vh - var(--top-h) - var(--player-h));
  height: calc(100dvh - var(--top-h) - var(--player-h));
  min-height: 22rem;
  background: var(--stage-bg);
  border-top: 1px solid var(--rule);
}
body[data-view="stage"] .foot { display: none; }
.stage__glow {
  position: absolute; inset: -20%; z-index: -1; pointer-events: none;
  background:
    radial-gradient(40% 45% at 78% 22%, color-mix(in oklab, var(--atm) 30%, transparent), transparent 70%),
    radial-gradient(35% 40% at 12% 85%, color-mix(in oklab, var(--atm) 18%, transparent), transparent 70%);
  transform: scale(calc(1 + var(--energy, 0) * .12));
  opacity: calc(.65 + var(--energy, 0) * .5);
  transition: transform .12s linear, opacity .12s linear;
  animation: drift 24s ease-in-out infinite alternate;
}
@keyframes drift { to { translate: -4% 3%; } }
.stage__viz { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 38%; z-index: -1; pointer-events: none; }
.stage__inner { position: relative; height: 100%; display: flex; flex-direction: column; }
.stage__inner .crumbs { padding-block: 1rem .25rem; }
.stage__head h1 { margin: 0; font-size: clamp(1.9rem, 1.1rem + 3.2vw, 3.1rem); }
.stage__head .eyebrow { margin-bottom: .5rem; }
.stage__note { margin: .4rem 0 0; min-height: 1.2em; color: var(--ink-3); font-size: .85rem; }

.lyrics {
  position: relative; flex: 1; min-height: 0; margin-top: .5rem;
  overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none;
  -webkit-mask-image: linear-gradient(transparent, #000 14%, #000 78%, transparent);
          mask-image: linear-gradient(transparent, #000 14%, #000 78%, transparent);
}
.lyrics::-webkit-scrollbar { display: none; }
.lyrics__back {
  position: absolute; left: 50%; bottom: 1rem; translate: -50% 0;
  padding: .45rem 1rem; border-radius: 999px; border: 1px solid var(--rule);
  background: var(--surface); color: var(--ink); font: 500 .85rem/1.2 var(--sans); cursor: pointer;
  box-shadow: var(--shadow);
}

/* ---------- караоке ---------- */

.kar__inner { padding: 26vh 0 50vh; }
.kar__sec { margin-bottom: 1.6rem; }
.kar__label {
  margin: 0 0 .35rem;
  font: 600 .7rem/1.2 var(--sans); letter-spacing: .18em; text-transform: uppercase;
  color: var(--ink-3);
}
.kar__sec--chorus { padding-left: 1rem; border-left: 2px solid color-mix(in oklab, var(--atm) 50%, transparent); }
.kar__line {
  margin: 0 0 .28em;
  font: 700 clamp(1.3rem, .85rem + 2.3vw, 2.45rem)/1.28 var(--sans);
  letter-spacing: -.01em;
  color: var(--k-next);
  cursor: pointer;
  transform-origin: 0 50%;
  transition: color .5s, opacity .5s, transform .45s cubic-bezier(.2, .7, .2, 1), filter .5s;
}
@media (hover: hover) { .kar__line:not(.is-cur):hover { color: var(--k-soon); } }
.kar__line.is-past { color: var(--k-past); }
.kar__line.is-soon { color: var(--k-soon); }
.kar__line.is-cur { transform: scale(1.04); }
.kar--approx .kar__line.is-past { filter: none; }

.kar__w { display: inline-block; transition: transform .25s ease, filter .25s ease; }
.kar__line.is-cur .kar__w {
  color: transparent;
  background-image: linear-gradient(90deg,
    var(--k-hl) calc(var(--p, 0) * 115% - 15%),
    var(--k-rest) calc(var(--p, 0) * 115%));
  -webkit-background-clip: text; background-clip: text;
}
.kar__line.is-cur .kar__w.is-on { transform: translateY(-.06em); filter: drop-shadow(0 0 .4em var(--k-glow)); }
.kar__line.is-cur.is-done { transform: none; }
.kar__line.is-cur.is-done .kar__w { filter: none; opacity: .6; transition: opacity 1.2s ease; }

/* Отсчёт перед строкой после длинного проигрыша */
.kar__gap { display: none; gap: .45rem; align-items: center; height: 1.6rem; margin: .2rem 0 .5rem; }
.kar__gap.is-on { display: flex; animation: breathe 2.2s ease-in-out infinite; }
.kar__gap i {
  width: .7rem; height: .7rem; border-radius: 50%; background: var(--k-hl);
  opacity: clamp(.18, calc(var(--p, 0) * 3), 1);
}
.kar__gap i:nth-child(2) { opacity: clamp(.18, calc(var(--p, 0) * 3 - 1), 1); }
.kar__gap i:nth-child(3) { opacity: clamp(.18, calc(var(--p, 0) * 3 - 2), 1); }
@keyframes breathe { 50% { transform: scale(1.12); } }

.kar__empty { color: var(--ink-3); font-style: italic; }

/* ---------- плеер ---------- */

.player {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in oklab, var(--surface) 88%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(1.3); backdrop-filter: blur(14px) saturate(1.3);
  border-top: 1px solid var(--rule);
}
.player__inner {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .9rem;
  min-height: 4.75rem; padding-block: .6rem;
}
.player__play {
  display: grid; place-items: center; width: 3rem; height: 3rem; border-radius: 50%; border: 0;
  background: var(--atm); color: var(--on-atm); cursor: pointer; transition: transform .15s, filter .2s;
}
.player__play:hover { filter: brightness(1.08); }
.player__play:active { transform: scale(.94); }
.player__play svg { width: 1.35rem; height: 1.35rem; fill: currentColor; }
.player__play .i-pause, .is-playing .player__play .i-play { display: none; }
.is-playing .player__play .i-pause { display: block; }
.player__main { min-width: 0; display: grid; gap: .15rem; }
.player__meta { display: flex; gap: .6rem; align-items: baseline; min-width: 0; text-decoration: none; }
.player__title { flex: none; max-width: 45%; font: 600 .95rem/1.3 var(--sans); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player__line {
  min-width: 0; color: var(--ink-3); font: italic 400 .95rem/1.3 var(--serif);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
body[data-view="stage"] .player__line { visibility: hidden; }
.player__bar { display: flex; align-items: center; gap: .6rem; }
.player__time { flex: none; min-width: 2.6rem; font: 400 .75rem/1 var(--sans); font-variant-numeric: tabular-nums; color: var(--ink-3); }
.player__time:last-child { text-align: right; }
.player__side { display: flex; align-items: center; gap: .4rem; }
.icon-btn {
  display: grid; place-items: center; width: 2.25rem; height: 2.25rem; border-radius: 50%;
  border: 0; background: transparent; color: var(--ink-2); cursor: pointer;
}
.icon-btn:hover { color: var(--atm); background: color-mix(in oklab, var(--atm) 10%, transparent); }
.icon-btn svg { width: 1.1rem; height: 1.1rem; fill: currentColor; }
.vol { display: flex; align-items: center; gap: .35rem; color: var(--ink-3); }
.vol svg { width: 1.1rem; height: 1.1rem; fill: currentColor; flex: none; }
.vol input { width: 5.5rem; }

input[type="range"] {
  -webkit-appearance: none; appearance: none; background: transparent; height: 1.1rem; margin: 0; cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: var(--rule); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 4px; background: var(--rule); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 13px; height: 13px; margin-top: -4.5px; border-radius: 50%; background: var(--atm); border: 0;
}
input[type="range"]::-moz-range-thumb { width: 13px; height: 13px; border-radius: 50%; background: var(--atm); border: 0; }
.seek { flex: 1; min-width: 0; }
.seek::-webkit-slider-runnable-track { background: linear-gradient(90deg, var(--atm) var(--p, 0%), var(--rule) var(--p, 0%)); }
.seek::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--atm); }

@media (max-width: 40rem) {
  .player__inner { grid-template-columns: auto 1fr; grid-template-rows: auto auto; row-gap: .35rem; }
  .player__side { grid-column: 1 / -1; grid-row: 2; justify-content: space-between; }
  .player__play { grid-column: 1; grid-row: 1; }
  .player__main { grid-column: 2; grid-row: 1; }
  .vol input { width: 7rem; }
  .player__title { max-width: 60%; }
}

/* ---------- подвал ---------- */

.foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 1.5rem;
  padding-block: 1.75rem 2.5rem; border-top: 1px solid var(--rule);
  color: var(--ink-3); font-size: .8125rem;
}
.foot a { color: var(--ink-3); text-underline-offset: .2em; }
@media (hover: none) { .foot__keys { display: none; } }

@media (max-width: 30rem) {
  .mark__name { display: none; }
  .atm { grid-template-columns: 1fr; }
  .atm__orb { width: 100%; aspect-ratio: 3 / 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .kar__line.is-cur { transform: none; }
}
