/* Nunito: a soft, rounded typeface (SIL Open Font License, see /vendor/nunito-LICENSE.txt) */
@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 200 1000;
  font-display: swap;
  src: url("/vendor/nunito-5.3.0-latin-wght.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: dark;
  --bg-0: #04060d;
  --bg-1: #0c1430;
  --ink: #e9ecf5;
  --ink-soft: #aeb6cc;
  --ink-faint: #7b84a0;
  --line: rgba(233, 236, 245, 0.16);
  --line-strong: rgba(233, 236, 245, 0.34);
  --fill: rgba(233, 236, 245, 0.09);
  --sea: #8fd3d0;
  --dusk: #6b7fe0;
  --lilac: #a58ae0;
  --focus: #c3ccff;
  --font: "Nunito", ui-rounded, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --breath: 10s; /* in for 4 seconds, out for 6 */
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: radial-gradient(120% 80% at 50% 28%, var(--bg-1) 0%, var(--bg-0) 72%) fixed, var(--bg-0);
  color: var(--ink);
  font-family: var(--font);
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  overflow-x: hidden;
}

/* ---- slow drifting light behind everything */

.sky { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.sky span {
  position: absolute;
  width: 70vmax;
  height: 70vmax;
  border-radius: 50%;
  opacity: 0.16;
  background: radial-gradient(circle, var(--c) 0%, transparent 65%);
  animation: drift 90s ease-in-out infinite alternate;
}
.sky span:nth-child(1) { --c: var(--dusk); left: -25vmax; top: -22vmax; }
.sky span:nth-child(2) { --c: var(--sea); right: -32vmax; bottom: -30vmax; opacity: 0.11; animation-duration: 120s; animation-delay: -40s; }
.sky span:nth-child(3) { --c: var(--lilac); left: 15vmax; bottom: -48vmax; opacity: 0.09; animation-duration: 150s; animation-delay: -80s; }

@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(8vmax, 6vmax) scale(1.15); }
}

/* ---- layout */

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 16px 8px;
  text-align: center;
}

h1 {
  margin: 0;
  font-weight: 400;
  font-size: clamp(2.2rem, 9vw, 3.5rem);
  line-height: 1.1;
  letter-spacing: 0;
}

.tagline {
  margin: 0.6rem 0 0;
  color: var(--ink-soft);
  font-size: clamp(1rem, 3.8vw, 1.15rem);
}

/* ---- the orb: play button and breathing guide */

.orb {
  --size: min(62vw, 44vh, 300px);
  position: relative;
  display: grid;
  place-items: center;
  width: var(--size);
  height: var(--size);
  margin: clamp(32px, 7vh, 64px) 0 clamp(24px, 5vh, 44px);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: #fff;
  cursor: pointer;
}
.orb:focus-visible { outline: 2px solid var(--focus); outline-offset: 10px; }

.orb .halo,
.orb .core { position: absolute; border-radius: 50%; }

.orb .halo {
  inset: -26%;
  background: radial-gradient(circle, rgba(143, 211, 208, 0.34) 0%, rgba(107, 127, 224, 0.16) 42%, transparent 68%);
  opacity: 0.45;
  animation: glow var(--breath) ease-in-out infinite paused;
}

.orb .core {
  inset: 0;
  background:
    radial-gradient(circle at 34% 26%, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0) 40%),
    radial-gradient(circle at 50% 56%, var(--sea) 0%, var(--dusk) 52%, var(--lilac) 100%);
  box-shadow: 0 0 70px 4px rgba(107, 127, 224, 0.3), inset 0 -22px 50px rgba(4, 6, 13, 0.3);
  filter: saturate(0.7) brightness(0.78);
  transform: scale(0.86);
  transition: filter 2s ease;
  animation: breathe var(--breath) ease-in-out infinite paused;
}

.orb .icon {
  position: relative;
  width: 22%;
  height: 22%;
  fill: currentColor;
  opacity: 0.9;
  transition: opacity 0.4s ease;
  filter: drop-shadow(0 1px 6px rgba(4, 6, 13, 0.35));
}
.orb .pause { display: none; }

[data-state="playing"] .orb .core { filter: none; }
[data-state="playing"] .orb .core,
[data-state="playing"] .orb .halo { animation-play-state: running; }

[data-state="playing"] .orb .play,
[data-state="loading"] .orb .play,
[data-state="retrying"] .orb .play { display: none; }
[data-state="playing"] .orb .pause,
[data-state="loading"] .orb .pause,
[data-state="retrying"] .orb .pause { display: block; opacity: 0.28; }
.orb:hover .pause,
.orb:focus-visible .pause { opacity: 0.75 !important; }

[data-state="loading"] .orb .halo,
[data-state="retrying"] .orb .halo { animation: shimmer 1.6s ease-in-out infinite; }

[data-state="missing"] .orb,
[data-state="unsupported"] .orb { cursor: default; opacity: 0.5; }

@keyframes breathe {
  0%, 100% { transform: scale(0.86); }
  40% { transform: scale(1); }
}
@keyframes glow {
  0%, 100% { opacity: 0.35; transform: scale(0.9); }
  40% { opacity: 0.9; transform: scale(1.04); }
}
@keyframes shimmer {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.7; }
}

/* ---- words under the orb */

.status {
  margin: 0;
  min-height: 1.5em;
  color: var(--ink-soft);
  font-size: 1.05rem;
}

.countdown {
  margin: 0.3rem 0 0;
  min-height: 1.4em;
  color: var(--ink-faint);
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}

/* ---- sleep / meditation timer */

.timer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  max-width: 420px;
  margin-top: clamp(16px, 4vh, 32px);
}

.timer-label {
  width: 100%;
  margin-bottom: 2px;
  color: var(--ink-faint);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.timer button {
  min-height: 40px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}
.timer button:hover { border-color: var(--line-strong); color: var(--ink); }
.timer button[aria-pressed="true"] { background: var(--fill); border-color: var(--line-strong); color: var(--ink); }
.timer button:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* the player fills the first screen; the footer line sits at its bottom edge */
body:has(.why) main { min-height: calc(100svh - 66px); }

footer {
  padding: 20px 16px 28px;
  color: var(--ink-faint);
  font-size: 0.85rem;
  text-align: center;
}

/* ---- why people use it, below the player */

.why {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 48px 20px 72px;
  line-height: 1.6;
}
.why h2 {
  margin: 0 0 1.4rem;
  font-size: clamp(1.4rem, 5.5vw, 1.8rem);
  font-weight: 400;
  line-height: 1.25;
  text-align: center;
  text-wrap: balance;
}
.why ul { margin: 0; padding: 0; list-style: none; }
.why li {
  margin: 0;
  padding: 1rem 0;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
}
.why li:first-child { border-top: 0; }
.why strong { display: block; color: var(--ink); font-weight: 600; font-size: 1.08rem; }

/* ---- text pages: privacy and support */

.doc main {
  display: block;
  width: 100%;
  max-width: 660px;
  margin: 0 auto;
  padding: 40px 20px 64px;
  text-align: left;
  line-height: 1.6;
}
.doc h1 { font-size: clamp(2rem, 8vw, 2.8rem); }
.doc h2 { margin: 2.2rem 0 0.4rem; font-size: 1.3rem; font-weight: 600; }
.doc h3 { margin: 1.4rem 0 0.2rem; font-size: 1.05rem; font-weight: 600; }
.doc p, .doc li { color: var(--ink-soft); }
.doc p { margin: 0.5rem 0; }
.doc ul { margin: 0.5rem 0; padding-left: 1.2rem; }
.doc li { margin: 0.35rem 0; }
.doc strong { color: var(--ink); font-weight: 600; }
.doc a { color: var(--sea); text-underline-offset: 3px; }
.doc a:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
.doc .back { margin: 0 0 1.6rem; font-size: 0.95rem; }
.doc .updated { margin-top: 0.4rem; color: var(--ink-faint); font-size: 0.9rem; }
.doc .contact { margin-top: 0.6rem; font-size: 1.15rem; }

.debug {
  position: fixed;
  left: 8px;
  bottom: 8px;
  z-index: 10;
  margin: 0;
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.7);
  color: #cfe8e6;
  font: 11px/1.45 ui-monospace, Menlo, monospace;
  text-align: left;
  white-space: pre;
}

@media (prefers-reduced-motion: reduce) {
  .sky span { animation: none; }
  .orb .core { animation: none; transform: scale(0.94); }
  .orb .halo { animation-name: glow-still; }
}
@keyframes glow-still {
  0%, 100% { opacity: 0.3; }
  40% { opacity: 0.9; }
}
