/* =========================================================
   In Hafteh — Coming Soon
   Pixel-art sky. Plain CSS, no frameworks.
   ========================================================= */

:root {
  --ink: #1A0B3D;
  --white: #FFFFFF;

  --cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' shape-rendering='crispEdges'%3E%3Cpath fill='%231A0B3D' d='M2 0h3v3H2zM2 3h3v3H2zM2 6h3v3H2zM2 9h3v3H2zM2 12h3v3H2zM2 15h3v3H2zM5 3h3v3H5zM8 6h3v3H8zM11 9h3v3h-3zM14 12h3v3h-3zM5 15h3v3H5zM8 15h3v3H8zM11 15h3v3h-3zM5 18h3v3H5zM11 18h3v3h-3z'/%3E%3Cpath fill='%23FFFFFF' d='M5 6h3v9H5zM8 9h3v6H8zM11 12h3v3h-3z'/%3E%3C/svg%3E") 2 0, auto;
}

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

html, body { height: 100%; }

body {
  margin: 0;
  background: #2E0F6E;
  color: var(--white);
  font-family: ui-monospace, monospace;
  -webkit-text-size-adjust: 100%;
  cursor: var(--cursor);
  overflow: hidden;
}

canvas, svg { display: block; image-rendering: pixelated; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* =========================================================
   HERO
   ========================================================= */
.hero {
  position: relative;
  height: 100vh;
  height: 100svh;
  min-height: 520px;
  overflow: hidden;
  isolation: isolate;
  background: linear-gradient(#2E0F6E, #6A22B5 30%, #D2449F 50%, #F06C6C 62%, #F79A68 80%, #FBC08A);
}

.sky, .sky-front {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}
.sky { z-index: 0; }
.sky-front { z-index: 3; }

.stage {
  position: absolute; z-index: 2;
  left: 0; right: 0; top: 14%;
  display: flex; flex-direction: column; align-items: center;
  pointer-events: none;
}

.px-label { margin-bottom: 10px; position: relative; z-index: 2; }

.title-wrap { position: relative; }
.title { position: relative; z-index: 1; }
.moon { position: absolute; z-index: 0; }

/* =========================================================
   BOTTOM GROUP: label, ON AIR sign, mic
   ========================================================= */
.bottom {
  position: absolute; z-index: 4;
  left: 0; right: 0; bottom: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  gap: 14px;
  padding-bottom: max(14px, env(safe-area-inset-bottom));
  pointer-events: none;
}

/* ---------- ON AIR sign ---------- */
.onair {
  position: relative;
  animation: bob 2.4s steps(2) infinite alternate;
}
.onair-on {
  position: absolute; inset: 0;
  filter: drop-shadow(0 0 6px rgba(255, 64, 64, .85));
  animation: onair-blink 2.4s steps(1) infinite;
}
.is-playing .onair-on { animation: none; opacity: 1; }

/* ---------- Mic ---------- */
.mic-wrap { position: relative; }

.mic {
  display: block;
  width: 104px;
  padding: 0; border: 0; background: none;
  pointer-events: auto;
  cursor: var(--cursor);
  filter: drop-shadow(6px 6px 0 rgba(26, 11, 61, .25));
  transition: transform .08s steps(1);
  -webkit-tap-highlight-color: transparent;
}
.mic svg { width: 100%; height: auto; }
.mic:hover { transform: translateY(-4px); }
.mic:active { transform: translateY(2px); }
.mic:focus-visible { outline: 3px solid #FFE7A4; outline-offset: 6px; }
.is-playing .mic svg { animation: thump .24s steps(1) infinite; }

/* ---------- Sound waves ---------- */
.waves {
  position: absolute; top: 2%;
  display: flex; align-items: center; gap: 3px;
  pointer-events: none;
}
.waves-r { left: 100%; margin-left: 2px; }
.waves-l { right: 100%; margin-right: 2px; transform: scaleX(-1); }
.arc { display: block; opacity: 0; }
.arc svg { width: 100%; height: auto; }

/* idle: a small wave flashes now and then to invite a click */
.waves .arc:first-child { animation: hint 5s steps(1) infinite; }
/* playing: waves pulse outward */
.is-playing .waves .arc { animation: wave .6s steps(1) infinite; }
.is-playing .waves .arc:nth-child(2) { animation-delay: .15s; }
.is-playing .waves .arc:nth-child(3) { animation-delay: .3s; }

/* ---------- Music notes ---------- */
.note {
  position: absolute;
  width: 24px;
  opacity: 0;
  animation: rise 5s steps(12) infinite;
}
.note svg { width: 100%; height: auto; }
.n1 { left: 16%; bottom: 20%; animation-duration: 5.5s; }
.n2 { left: 31%; bottom: 46%; width: 20px; animation-delay: -2s; }
.n3 { right: 28%; bottom: 28%; animation-duration: 6s; animation-delay: -3.5s; }
.n4 { right: 14%; bottom: 52%; width: 20px; animation-delay: -1s; }
.n5 { left: 7%; bottom: 60%; animation-duration: 6.5s; animation-delay: -4.2s; }

.note-burst {
  position: absolute; left: 50%; top: 6%;
  width: 22px;
  pointer-events: none;
  animation: burst 1.3s steps(10) forwards;
}
.note-burst svg { width: 100%; height: auto; }

/* =========================================================
   INTRO (added by JS on load, removed when done)
   ========================================================= */
.intro .hero { animation: shake .3s steps(3) .78s; }
.intro .title-wrap { animation: drop 1.1s .15s both; }
.intro .stage > .px-label { animation: pop .45s steps(3) .9s both; }
.intro .moon { animation: rise-in .8s steps(5) 1.05s both; }
.intro .coming { animation: pop .45s steps(3) 1.3s both; }
.intro .onair { animation: pop .45s steps(3) 1.45s both, bob 2.4s steps(2) 1.9s infinite alternate; }
.intro .mic-wrap { animation: rise-up .6s steps(4) 1.1s both; }
.intro .note { visibility: hidden; }

/* =========================================================
   KEYFRAMES
   ========================================================= */
@keyframes bob { to { transform: translateY(-4px); } }
@keyframes onair-blink { 0%, 64% { opacity: 1; } 65%, 100% { opacity: 0; } }
@keyframes thump { 50% { transform: translateY(-3px); } }
@keyframes hint { 0%, 88% { opacity: 0; } 90%, 96% { opacity: 1; } 98%, 100% { opacity: 0; } }
@keyframes wave { 0% { opacity: 0; } 25%, 75% { opacity: 1; } 100% { opacity: 0; } }
@keyframes rise {
  0%   { translate: 0 0; opacity: 0; }
  12%  { opacity: 1; }
  50%  { translate: 6px -40px; }
  85%  { opacity: 1; }
  100% { translate: -4px -80px; opacity: 0; }
}
@keyframes burst {
  0%   { translate: -50% 0; opacity: 0; }
  12%  { opacity: 1; }
  100% { translate: calc(-50% + var(--dx, 0px)) -150px; rotate: var(--rot, 0deg); opacity: 0; }
}
@keyframes drop {
  0%   { translate: 0 -120vh; animation-timing-function: cubic-bezier(.55, 0, 1, .45); }
  55%  { translate: 0 0;      animation-timing-function: cubic-bezier(0, .55, .45, 1); }
  70%  { translate: 0 -22px;  animation-timing-function: cubic-bezier(.55, 0, 1, .45); }
  82%  { translate: 0 0;      animation-timing-function: cubic-bezier(0, .55, .45, 1); }
  91%  { translate: 0 -6px;   animation-timing-function: cubic-bezier(.55, 0, 1, .45); }
  100% { translate: 0 0; }
}
@keyframes shake { 0% { translate: 0 0; } 33% { translate: 0 6px; } 66% { translate: 0 -3px; } 100% { translate: 0 0; } }
@keyframes pop { 0% { scale: 0; } 70% { scale: 1.25; } 100% { scale: 1; } }
@keyframes rise-in { 0% { translate: 0 24px; opacity: 0; } 100% { translate: 0 0; opacity: 1; } }
@keyframes rise-up { 0% { translate: 0 140%; } 100% { translate: 0 0; } }

/* Background tab: freeze every CSS animation */
.is-hidden *,
.is-hidden *::before,
.is-hidden *::after { animation-play-state: paused !important; }

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

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 720px) {
  .stage { top: 20%; }
  .bottom { gap: 12px; }
  .mic { width: 82px; }
  .note { width: 18px; }
  .n2, .n4 { width: 16px; }
  .n1 { left: 8%; }
  .n4 { right: 8%; }
}

@media (max-height: 620px) {
  .stage { top: 9%; }
  .bottom { gap: 8px; }
  .mic { width: 68px; }
}
