/* v692: the in-meditation breath screen (sit/breath-screen.js). Full screen, black and gold.
   The gold mandala fills most of the screen: min(92vw, the height left after the words and
   buttons, 40rem). It is drawn at full size and only scaled down (0.6..1), so it stays crisp.
   Only transform and opacity move. Every row has a fixed height: no layout shift. */
.breath-screen {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  justify-items: center;
  align-items: center;
  padding:
    calc(env(safe-area-inset-top, 0px) + 1.1rem)
    1rem
    calc(env(safe-area-inset-bottom, 0px) + 1.25rem);
  background: radial-gradient(120% 70% at 50% 46%, #120d03 0%, #050402 48%, #000 100%);
  color: var(--cream, #f4efe6);
  overflow: hidden;
  overscroll-behavior: contain;
  touch-action: manipulation;
  outline: none;
  --bs-size: min(92vw, calc(100dvh - 19.5rem), 40rem);
}
.breath-screen[hidden] { display: none; }
html.is-breath-screen, html.is-breath-screen body { overflow: hidden; }

.bs-chrome, .bs-cue, .bs-stage { transition: opacity 0.45s ease; }
.bs-top { text-align: center; }
.bs-name {
  height: 1.3em;
  margin: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  max-width: 86vw;
  font-family: var(--body, Outfit, system-ui, sans-serif);
  font-size: 0.78rem;
  font-weight: 400;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold-bright, #f0c85a);
  opacity: 0.85;
}
.bs-clock {
  height: 1.1em;
  margin: 0.15rem 0 0;
  font-family: var(--display, "Cormorant Garamond", Georgia, serif);
  font-size: clamp(2.9rem, 12vw, 4.2rem);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  color: #fff5df;
}

.bs-stage {
  position: relative;
  width: var(--bs-size);
  height: var(--bs-size);
  display: grid;
  place-items: center;
  pointer-events: none;
}
.bs-glow {
  position: absolute;
  inset: -14%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 214, 128, 0.34) 0%, rgba(236, 184, 62, 0.16) 34%, rgba(232, 176, 150, 0.06) 56%, rgba(0, 0, 0, 0) 70%);
  opacity: 0.4;
  transform: scale(0.85);
  will-change: transform, opacity;
}
.bs-turn {
  position: relative;
  width: 100%;
  height: 100%;
  animation: dd-bs-turn 240s linear infinite;
  will-change: transform;
}
.bs-flower {
  --bloom: 0.85;
  display: block;
  width: 100%;
  height: 100%;
  transform: scale(0.6);
  transform-origin: 50% 50%;
  will-change: transform, opacity;
}
.bs-mandala {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: drop-shadow(0 0 4px rgba(255, 220, 140, 0.6)) drop-shadow(0 0 18px rgba(255, 205, 120, 0.28));
}
/* The page's own mandala turn animates inside the SVG (a repaint each frame); here the whole
   flower turns on the compositor instead (.bs-turn), so the SVG never repaints. */
.bs-mandala .md-spin { animation: none; }
@keyframes dd-bs-turn { to { transform: rotate(360deg); } }

.bs-words { text-align: center; }
.bs-cue {
  height: 1.5em;
  margin: 0.4rem 0 0;
  font-family: var(--body, Outfit, system-ui, sans-serif);
  font-size: 1.02rem;
  font-weight: 400;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #ffe2a3;
  text-shadow: 0 0 14px rgba(255, 213, 107, 0.45);
}
.bs-line {
  height: 2.7em;
  max-width: 24rem;
  margin: 0.2rem auto 0;
  overflow: hidden;
  font-family: var(--display, "Cormorant Garamond", Georgia, serif);
  font-style: italic;
  /* v694: one line at 390 and up; if a narrow phone must wrap, balance it (no lone last word). */
  font-size: clamp(1.02rem, 4.3vw, 1.22rem);
  line-height: 1.35;
  text-wrap: balance;
  color: rgba(244, 239, 230, 0.72);
}
/* v694/v695: a hidden line (languages without its translation) keeps its room, so the
   flower and cue sit in the identical spot in every language. */
.bs-line.is-off {
  visibility: hidden;
}

.bs-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  margin-top: calc(0.85rem + 12px); /* v694: about 12px more air above the buttons */
}
.bs-btn {
  min-width: 8.5rem;
  min-height: 48px;
  padding: 0 1.3rem;
  border-radius: 999px;
  border: 0;
  font-family: var(--body, Outfit, system-ui, sans-serif);
  font-size: 0.82rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #0a0800;
  background: linear-gradient(180deg, var(--gold-bright, #f0c85a) 0%, var(--gold, #ecb83e) 55%, var(--gold-deep, #c49228) 100%);
  box-shadow: 0 0 0 1px rgba(236, 184, 62, 0.2), 0 10px 30px rgba(236, 184, 62, 0.12);
  cursor: pointer;
}
.bs-btn-quiet {
  color: var(--gold-bright, #f0c85a);
  background: transparent;
  box-shadow: inset 0 0 0 1px rgba(236, 184, 62, 0.55);
}
.bs-btn:focus-visible { outline: 1px solid rgba(243, 226, 168, 0.9); outline-offset: 3px; }

/* v693: the in/out cue fades after the first breaths (and while paused); its row keeps its height. */
.breath-screen.is-cue-off .bs-cue { opacity: 0; transition-duration: 1.6s; }

/* Paused: the flower rests where it is and quiets a little. */
.breath-screen.is-paused .bs-stage { opacity: 0.7; }

/* Screen care: after 60 s untouched the words, time and buttons dim and the flower softens.
   The first tap only wakes the screen. */
.breath-screen.is-dim .bs-chrome,
.breath-screen.is-dim .bs-cue { opacity: 0.16; transition-duration: 2.5s; }
.breath-screen.is-dim .bs-top { opacity: 0.3; }
.breath-screen.is-dim .bs-stage { opacity: 0.55; transition-duration: 2.5s; }

/* Reduced motion: no turn, no scaling; breath-screen.js only fades the flower's light. */
.breath-screen.is-still .bs-turn { animation: none; }
.breath-screen.is-still .bs-flower { transform: none !important; transition: opacity 1.2s ease; }
.breath-screen.is-still .bs-glow { transform: none !important; transition: opacity 1.2s ease; }
@media (prefers-reduced-motion: reduce) {
  .bs-turn { animation: none; }
}

/* Short screens (landscape phones): keep the words and buttons, let the flower give way. */
@media (max-height: 560px) {
  .breath-screen { --bs-size: min(70vw, calc(100dvh - 14rem)); padding-top: 0.6rem; }
  .bs-line { height: 1.4em; }
}

/* Devanagari, Gurmukhi, Hangul, Kana and Han do not take wide tracking. */
html:is([data-lang="hi"], [data-lang="pa"], [data-lang="ko"], [data-lang="ja"], [data-lang^="zh"]) .breath-screen :is(.bs-name, .bs-cue, .bs-btn) {
  letter-spacing: 0.04em;
}
