/* ==========================================================================
   elektromekka.com — app layer (public page)
   Everything the live app adds on top of the design package:
   album switcher chips, like hearts, error states, loading bits.
   Uses only the design tokens from css/styles.css.
   ========================================================================== */

/* ---- Album switcher chips ----------------------------------------------- */
.album-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 28px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  transition: border-color 120ms, background 120ms, color 120ms;
}
.chip:hover { border-color: var(--border-strong); }

.chip__genre {
  font-family: var(--font-label);
  font-size: 9px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  padding: 4px 7px 3px;
  border-radius: 3px;
  background: var(--surface-2);
  color: var(--muted);
}
.chip[data-genre="hardcore"] .chip__genre { color: var(--violet-text); background: var(--violet-dim); }
.chip[data-genre="elektro"] .chip__genre { color: var(--lime); background: rgba(198, 255, 0, 0.08); }

.chip__title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60vw; }

/* lime = active album */
.chip.is-active {
  background: var(--lime);
  border-color: var(--lime);
  color: var(--ink);
  font-weight: 600;
  box-shadow: var(--glow-lime);
}
.chip.is-active .chip__genre { background: rgba(10, 10, 10, 0.14); color: var(--ink); }
.chip.is-active:hover { border-color: var(--lime); }

/* ---- Like hearts --------------------------------------------------------- */
.like-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 8px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
}
.like-btn .icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linejoin: round;
  transition: transform 140ms ease;
}
.like-btn:hover { color: var(--lime); }
.like-btn.is-liked { color: var(--lime); }
.like-btn.is-liked .icon {
  fill: currentColor;
  stroke: none;
  animation: like-pop 260ms ease;
}
@keyframes like-pop {
  0% { transform: scale(0.6); }
  55% { transform: scale(1.25); }
  100% { transform: scale(1); }
}

/* heart in the now-playing bar */
.player__like { flex: 0 0 auto; }
.player__like[hidden] { display: none; }

/* mini-player thumb before anything has been played (no src yet) */
.player__thumb:not([src]) { visibility: hidden; }

/* ---- Error / empty states ------------------------------------------------ */
.app-error {
  margin: 56px auto 24px;
  max-width: 520px;
  padding: 32px 28px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.app-error[hidden] { display: none; }
.app-error h2 {
  margin: 0;
  font-family: var(--font-label);
  font-size: 13px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  font-weight: 400;
  color: var(--violet-text);
}
.app-error p { margin: 0; font-size: 14px; color: var(--muted); max-width: 40ch; }
.app-error .btn { margin-top: 8px; }

.tracks__empty {
  padding: 24px 8px;
  font-size: 14px;
  color: var(--muted);
}

/* loading shimmer on the track list while an album is fetched */
#tracks[aria-busy="true"] { opacity: 0.45; transition: opacity 160ms; }

/* ---- Small bits ----------------------------------------------------------- */
.field__optional { color: var(--placeholder); font-size: 12px; }

/* sections start hidden until the API answered; keep layout calm */
.hero[hidden], .player[hidden], #tracks-section[hidden], .album-switch[hidden] { display: none; }

/* ---- Language switcher ----------------------------------------------------
   Five native short labels in the footer; lime = active language.
   The 日本語 label needs Japanese glyphs in EVERY language, so the chain
   falls back from Michroma to system Japanese sans. */
.lang-switch {
  display: flex;
  align-items: center;
}
.lang-switch__btn {
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  background: transparent;
  font-family: "Michroma", "Eurostile", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", "Meiryo", sans-serif;
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  transition: color 120ms;
}
.lang-switch__btn + .lang-switch__btn { border-left: 1px solid var(--border); }
.lang-switch__btn:hover { color: var(--text); }
.lang-switch__btn.is-active { color: var(--lime); }

/* ---- Japanese font fallbacks ----------------------------------------------
   The display fonts (Audiowide/Michroma/Space Grotesk) ship Latin glyphs only.
   When the UI language is Japanese, extend the token chains with good system
   Japanese sans faces — Latin text still renders exactly as designed because
   the Latin fonts stay first in each chain. (Tokens live in css/styles.css,
   which is shared/read-only; this override belongs to the app layer.) */
html[lang="ja"] {
  --font-ui: "Space Grotesk", "Helvetica Neue", Helvetica, Arial, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", "Meiryo", sans-serif;
  --font-mark: "Audiowide", "Orbitron", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", "Meiryo", sans-serif;
  --font-label: "Michroma", "Eurostile", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", "Meiryo", sans-serif;
}

/* ---- Phone (≤ 759px) ------------------------------------------------------ */
@media (max-width: 759px) {
  .album-switch { padding-top: 20px; gap: 8px; }
  .chip { min-height: 40px; padding: 0 14px; font-size: 13px; gap: 8px; }

  /* keep the heart visible in the compact row, drop its count to save space */
  .track .like-btn { padding: 0 4px; }
  .track .like-btn [data-like="count"] { display: none; }

  /* heart in the mini player, between info and the transport */
  .player__like {
    order: 1;
    min-height: 44px;
    padding: 0 4px;
  }
  .player__like [data-like="count"] { display: none; }
}

/* ---------------------------------------------------- PWA install banner */
.install-banner {
  position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 60;
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 14px 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .55);
  max-width: 520px; margin-inline: auto;
}
.install-banner__icon .icon { width: 34px; height: 34px; display: block; }
.install-banner__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.install-banner__title { font-size: 14.5px; }
.install-banner__hint { color: var(--muted); font-size: 12.5px; line-height: 1.4; }
.install-banner__btn { flex: none; }
.install-banner__close {
  flex: none; width: 34px; height: 34px; border: 0; border-radius: 50%;
  background: var(--surface-2); color: var(--muted); font-size: 18px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.install-banner__close:hover { color: var(--text); }
/* keep clear of the sticky mini player on phones */
@media (max-width: 759px) {
  .install-banner { bottom: calc(86px + env(safe-area-inset-bottom, 0px)); }
}

/* ------------------------------------------- animated EQ on the playing row */
.eq .eq__bar { transform-box: fill-box; transform-origin: 50% 100%; }
.track-item.is-playing .eq .eq__bar {
  animation: eq-bounce 0.9s ease-in-out infinite;
}
.track-item.is-playing .eq .eq__bar:nth-child(2) { animation-duration: 0.7s; animation-delay: -0.25s; }
.track-item.is-playing .eq .eq__bar:nth-child(3) { animation-duration: 1.1s; animation-delay: -0.5s; }
@keyframes eq-bounce {
  0%, 100% { transform: scaleY(0.4); }
  50%      { transform: scaleY(1); }
}
@media (prefers-reduced-motion: reduce) {
  .track-item.is-playing .eq .eq__bar { animation: none; }
}

/* ------------------------------------------------------ now-playing sheet
   Slide-up sheet on phones, centered overlay on desktop (js/sheet.js).
   Backdrop dims with the ground token; panel uses surface + border. */

/* player-bar open triggers (index.html) */
button.player__info {
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
}
.player__thumb[data-action="open-sheet"] { cursor: pointer; }

.sheet {
  position: fixed;
  inset: 0;
  z-index: 80; /* above the mini player (20) and the install banner (60) */
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet[hidden] { display: none; }

body.sheet-open { overflow: hidden; }

.sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 10, 0.78); /* --ground, dimmed */
  opacity: 0;
  transition: opacity 240ms ease;
}

.sheet__panel {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: calc(100% - 32px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: 16px 16px 0 0;
  padding: 10px 24px calc(28px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 18px;
  transform: translateY(100%);
  transition: transform 320ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.sheet.is-open .sheet__backdrop { opacity: 1; }
.sheet.is-open .sheet__panel { transform: translateY(0); }
.sheet__panel.is-dragging { transition: none; }

.sheet__grip {
  flex: 0 0 auto;
  width: 40px;
  height: 4px;
  margin: 2px auto 0;
  border-radius: 999px;
  background: var(--border-strong);
}

.sheet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.sheet__eyebrow { font-size: 10px; }
.sheet__close {
  flex: none;
  width: 36px;
  height: 36px;
  margin-right: -8px;
  border: 0;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.sheet__close:hover { color: var(--text); }

.sheet__cover {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: var(--radius-lg);
  background: var(--surface-2);
  box-shadow: 0 0 60px rgba(122, 0, 255, 0.25); /* quiet violet halo, like the hero */
}
.sheet__cover:not([src]) { visibility: hidden; }

.sheet__meta {
  display: flex;
  align-items: center;
  gap: 16px;
}
.sheet__text {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sheet__title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sheet__sub {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sheet__like { flex: 0 0 auto; }
.sheet__like[hidden] { display: none; }

.sheet__wavewrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sheet__wave { height: 56px; touch-action: none; }
.sheet__times {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
}

.sheet__transport {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding-top: 2px;
}
.sheet__skip { width: 48px; height: 48px; }
.sheet__skip .icon { width: 24px; height: 24px; }
.sheet__play {
  width: 68px;
  height: 68px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--lime);
  color: var(--ink);
  box-shadow: var(--glow-lime);
}
.sheet__play:hover { background: #D9FF4D; }
.sheet__play .icon { width: 28px; height: 28px; }

/* desktop and tablet: still a bottom slide-out — just not full-bleed.
   The panel stays anchored to the bottom edge and slides up, same gesture
   language as the phone, capped in width and centered horizontally. */
@media (min-width: 760px) {
  .sheet { align-items: flex-end; justify-content: center; }
  .sheet__panel {
    width: min(520px, calc(100% - 48px));
    max-height: calc(100% - 64px);
    border: 1px solid var(--border);
    border-bottom: 0;
    border-radius: 16px 16px 0 0;
    padding: 12px 28px 28px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sheet__backdrop, .sheet__panel { transition: none; }
}

/* ------------------------------------------------------- footer layout -----
   styles.css lays the footer out as one space-between flex row; translated
   taglines (DE!) are wider than the English original and pushed the language
   switcher onto a stray wrapped line. Fixed layout instead: two deliberate
   rows that are identical in every language — branding up top, legal +
   language below. */
.site-footer .container {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas:
    "logo line"
    "nav  lang";
  align-items: center;
  row-gap: 14px;
}
.site-footer .logo { grid-area: logo; }
.site-footer__line { grid-area: line; justify-self: end; text-align: right; }
.site-footer nav { grid-area: nav; }
.site-footer .lang-switch { grid-area: lang; justify-self: end; }

@media (max-width: 759px) {
  .site-footer .container {
    grid-template-columns: 1fr;
    grid-template-areas: "logo" "line" "nav" "lang";
    row-gap: 6px;
  }
  .site-footer__line { justify-self: start; text-align: left; }
  .site-footer .lang-switch { justify-self: start; margin-left: -12px; }
}
