/* Кофемания FM, coffeemania.fm. Visual language follows coffeemania.ru. */

:root {
  --coral: #EC4C41;         /* logo */
  --ink: #212121;           /* text, primary button */
  --ink-2: #5C5D61;         /* secondary text */
  --muted: #8E8F93;
  --gold: #8A724B;          /* labels, as "Заказать еду" on coffeemania.ru */
  --frame: #D8C4A1;         /* thin frame, as the stories on coffeemania.ru */
  --surface: #F5F5F5;
  --surface-warm: #F1EEEA;
  --line: #E9E9E9;
  --bg: #FFFFFF;
  --r-s: 12px;
  --r-l: 24px;
  --font: "Suisse Intl", "Inter", Arial, sans-serif;
  --page: 1120px;
  --gutter: 16px;
  --bleed: 0px;             /* how far the now-playing card reaches beyond the header line */
}

@media (min-width: 768px) {
  :root { --gutter: 32px; --bleed: 24px; }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }
html.modal-open { overflow: hidden; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/21px var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--coral); outline-offset: 2px; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* header */

/* transparent and not sticky: the glow of the cover spreads under the logo; above .stage so it is never tinted */
.header {
  position: relative;
  z-index: 1;
}

.header__inner {
  max-width: var(--page);
  height: 64px;
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--coral);
  text-decoration: none;
}

.logo__word { width: 168px; height: auto; fill: currentColor; }

.logo__fm {
  color: var(--gold);
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: .06em;
  transform: translateY(.5px);
}

.header__link {
  padding: 8px 4px;
  border: 0;
  border-radius: 8px;
  background: none;
  font-size: 16px;
  cursor: pointer;
  transition: color .15s ease;
}

.header__link:hover { color: var(--coral); }

@media (max-width: 380px) {
  .logo__word { width: 136px; }
  .logo__fm { font-size: 14px; }
}

/* page */

/* the card is a little wider than the header; its content, the history and the footer keep the header line */
.page {
  max-width: var(--page);
  margin: 0 auto;
  padding: 8px calc(var(--gutter) - var(--bleed)) 40px;
}

/* now playing */

/* the glow lives under the content of .stage; clip keeps it from widening the page */
.stage {
  position: relative;
  isolation: isolate;
  overflow-x: hidden;
}

@supports (overflow: clip) {
  .stage { overflow-x: clip; }
}

.now {
  position: relative;
  display: grid;
  gap: 20px;
  padding: 16px;
  border-radius: var(--r-l);
}

/* frosted glass. A separate layer: backdrop-filter on .now itself would pull the glow into the card
   and paint it over the history. The cover and the text are positioned, so they stay above it. */
.now::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: rgba(245, 245, 245, .74);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .5), inset 0 1px 0 rgba(255, 255, 255, .8);
  pointer-events: none;
}

@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .now::before {
    /* on white it is still #F5F5F5; over the glow it lets the colour through, softened */
    background:
      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .5 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.06'/%3E%3C/svg%3E"),
      rgba(236, 236, 236, .55);
    -webkit-backdrop-filter: blur(28px) saturate(1.3);
    backdrop-filter: blur(28px) saturate(1.3);
  }
}

@media (min-width: 768px) {
  .now {
    grid-template-columns: minmax(260px, 360px) 1fr;
    align-items: center;
    gap: 44px;
    padding: 24px;
  }
}

.now__cover {
  position: relative;
  width: 100%;
  max-width: 420px;
  justify-self: center;
  padding: 4px;
  border: 1.5px solid var(--frame);
  border-radius: 20px;
  background: var(--bg);
}

/* cover: the new picture fades in over the old one, the old one leaves once it is hidden */

.now__art {
  position: relative;
  isolation: isolate;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 16px;
  background: var(--surface-warm);
}

.now__art-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.03);
  transition: opacity 0s linear 1s, transform 0s linear 1s;
}

.now__art-layer.is-active {
  z-index: 1;
  opacity: 1;
  transform: none;
  transition: opacity 1s ease, transform 1.6s cubic-bezier(.2, .7, .2, 1);
}

/* glow: the cover, heavily blurred, spreads from behind it onto the page */

.glow {
  position: absolute;
  inset: -60%;
  z-index: -1;
  pointer-events: none;
  -webkit-mask-image: radial-gradient(closest-side, #000 30%, transparent);
  mask-image: radial-gradient(closest-side, #000 30%, transparent);
}

.glow__layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  filter: blur(72px) saturate(1.5) contrast(.85) brightness(1.08);    /* dark covers give a lighter haze, not a shadow */
  transition: opacity 2.4s ease-in-out;
  will-change: opacity;
}

.glow__layer.is-active { opacity: .5; }

.now__body { position: relative; min-width: 0; padding: 4px 4px 0; }

.now__label {
  margin: 0 0 18px;
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  font-weight: 500;
  color: var(--gold);
}

.live {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--coral);
}

.is-playing .live { animation: live 1.6s ease-out infinite; }

@keyframes live {
  0% { box-shadow: 0 0 0 0 rgba(236, 76, 65, .45); }
  100% { box-shadow: 0 0 0 10px rgba(236, 76, 65, 0); }
}

.now__artist {
  margin: 0 0 6px;
  font-size: 17px;
  line-height: 22px;
  color: var(--ink-2);
  overflow-wrap: anywhere;
}

.now__title {
  margin: 0;
  font-size: 26px;
  line-height: 31px;
  font-weight: 500;
  letter-spacing: -.01em;
  overflow-wrap: anywhere;
}

.now__meta {
  margin: 14px 0 0;
  font-size: 14px;
  color: var(--muted);
}

/* track change: the name goes out quickly and comes in softly, together with the cover */
.now__track,
.now__meta {
  transition: opacity .5s ease, transform .7s cubic-bezier(.2, .7, .2, 1);
}

.now.is-switching .now__track,
.now.is-switching .now__meta {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .25s ease, transform .25s ease;
}

@media (min-width: 768px) {
  .now__title { font-size: 36px; line-height: 41px; }
}

/* player */

.player {
  margin-top: 28px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px 24px;
}

.play {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 172px;
  height: 52px;
  padding: 0 24px;
  border: 0;
  border-radius: var(--r-s);
  background: var(--ink);
  color: #FFFFFF;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s ease, transform .1s ease;
}

.play:hover { background: #000000; }
.play:active { transform: scale(.98); }

.play__icon { width: 22px; height: 22px; fill: currentColor; }

.play__icon--pause,
.play__spinner { display: none; }

.is-playing .play__icon--play,
.is-loading .play__icon--play { display: none; }

.is-playing .play__icon--pause,
.is-loading .play__spinner { display: block; }

.play__spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: #FFFFFF;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 767px) {
  .play { flex: 1 1 100%; }
}

.volume {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-2);
}

.volume[hidden] { display: none; }

/* phones and tablets: volume belongs to the hardware buttons (iOS does not let pages change it at all) */
@media (hover: none) and (pointer: coarse) {
  .volume { display: none; }
}
.volume__icon { width: 22px; height: 22px; fill: currentColor; }
.volume input { width: 148px; margin: 0; accent-color: var(--ink); }

.player__status {
  margin: 12px 0 0;
  font-size: 14px;
  color: var(--muted);
}

.player__status:empty { display: none; }    /* no empty line under the button */

/* history */

.history { margin-top: 44px; padding-inline: var(--bleed); }

.history__title {
  margin: 0 0 6px;
  font-size: 20px;
  line-height: 24px;
  font-weight: 500;
}

.history__list { margin: 0; padding: 0; list-style: none; }

.track {
  display: grid;
  grid-template-columns: 48px 48px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.track:last-child { border-bottom: 0; }

.track__time {
  font-size: 14px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.track__cover {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--surface-warm);
}

.track__title,
.track__artist {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.track__title { font-size: 15px; line-height: 20px; font-weight: 500; }
.track__artist { font-size: 14px; line-height: 19px; color: var(--ink-2); }

@media (min-width: 768px) {
  .track { grid-template-columns: 60px 56px minmax(0, 1fr); gap: 18px; }
  .track__cover { width: 56px; height: 56px; border-radius: 12px; }
}

.history__empty { padding: 12px 0; color: var(--muted); }

/* footer */

.footer { border-top: 1px solid var(--line); }

.footer__inner {
  max-width: var(--page);
  margin: 0 auto;
  padding: 20px var(--gutter) calc(20px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
  font-size: 13px;
  line-height: 18px;
  color: var(--muted);
}

.footer a {
  color: inherit;
  text-decoration: none;
  transition: color .15s ease;
}

.footer a:hover { color: var(--ink); }

/* about */

.about {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: var(--r-l);
  background: var(--bg);
  color: var(--ink);
  box-shadow: 0 24px 64px rgba(0, 0, 0, .18);
  overflow: auto;
}

.about::backdrop {
  background: rgba(33, 33, 33, .45);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

.about[open] { animation: pop .2s ease-out; }

@keyframes pop {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to { opacity: 1; transform: none; }
}

/* browsers without <dialog> */
.about.is-fallback { display: none; }

.about.is-fallback[open] {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 100;
  height: fit-content;
  box-shadow: 0 0 0 100vmax rgba(33, 33, 33, .45);
}

.about__inner { position: relative; padding: 28px 24px 24px; }

.about__close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: var(--r-s);
  background: var(--surface);
  cursor: pointer;
  transition: background .15s ease;
}

.about__close:hover { background: #ECECEC; }
.about__close svg { width: 20px; height: 20px; }

.about__title {
  margin: 0 52px 16px 0;
  font-size: 24px;
  line-height: 28px;
  font-weight: 500;
}

.about p {
  margin: 0 0 12px;
  font-size: 16px;
  line-height: 24px;
  color: var(--ink-2);
}

.about p:last-child { margin-bottom: 0; }

@media (min-width: 768px) {
  .about__inner { padding: 36px 36px 32px; }
}

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