/* Photo skies and time-of-day looks (backdrop.js, period.js, homefx.js).
   The brand never changes with the time of day: the gradient, the tab bar and every solid button stay the same.
   Only backgrounds follow the period, set on <html data-period="morning|afternoon|evening|night">. */

/* ---------- period tint for pages without a photo ---------- */
@property --tint { syntax: "<color>"; inherits: true; initial-value: #2a1640; }
html { --tint: #2a1640; transition: --tint 2s ease-in-out; }           /* morning, evening: purple */
html[data-period="afternoon"] { --tint: #13305a; }                       /* navy */
html[data-period="night"] { --tint: #1a1a4a; }                           /* indigo */
:root {
  --stars-faint: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cg fill='%23fff'%3E%3Ccircle cx='21' cy='34' r='.6' opacity='.45'/%3E%3Ccircle cx='88' cy='12' r='.5' opacity='.35'/%3E%3Ccircle cx='150' cy='61' r='.7' opacity='.5'/%3E%3Ccircle cx='231' cy='27' r='.5' opacity='.3'/%3E%3Ccircle cx='57' cy='118' r='.5' opacity='.3'/%3E%3Ccircle cx='199' cy='131' r='.8' opacity='.55'/%3E%3Ccircle cx='121' cy='170' r='.5' opacity='.35'/%3E%3Ccircle cx='17' cy='206' r='.7' opacity='.4'/%3E%3Ccircle cx='246' cy='214' r='.5' opacity='.3'/%3E%3Ccircle cx='92' cy='241' r='.6' opacity='.4'/%3E%3Ccircle cx='170' cy='233' r='.5' opacity='.3'/%3E%3C/g%3E%3C/svg%3E");
  --stars-bright: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cg fill='%23fff'%3E%3Ccircle cx='14' cy='22' r='.8' opacity='.8'/%3E%3Ccircle cx='71' cy='9' r='.6' opacity='.55'/%3E%3Ccircle cx='133' cy='47' r='1' opacity='.9'/%3E%3Ccircle cx='197' cy='18' r='.6' opacity='.5'/%3E%3Ccircle cx='42' cy='93' r='.6' opacity='.6'/%3E%3Ccircle cx='168' cy='104' r='.9' opacity='.75'/%3E%3Ccircle cx='102' cy='139' r='.6' opacity='.55'/%3E%3Ccircle cx='9' cy='171' r='.8' opacity='.7'/%3E%3Ccircle cx='211' cy='182' r='.6' opacity='.5'/%3E%3Ccircle cx='78' cy='205' r='.7' opacity='.65'/%3E%3Ccircle cx='146' cy='196' r='.5' opacity='.5'/%3E%3C/g%3E%3C/svg%3E");
}
/* Timeline, Journal, Settings, Profile and the other list pages: dark, a soft glow at the top, faint stars. */
.screen, .mt-page {
  background: radial-gradient(140% 420px at 50% -80px, var(--tint) 0%, rgba(5, 3, 11, 0) 72%), var(--stars-faint) 0 0 / 260px 260px, #05030b;
}

/* ---------- one sky layer ---------- */
/* The image keeps its proportions and is only ever scaled up enough to cover; its horizon (or sun) goes to
   --ay of the layer's height. --cover: how far down the image must reach. */
.bgl { position: absolute; inset: 0; overflow: hidden; pointer-events: none; container-type: size; --ay: .51; --cover: 0; }
.bgl-sky { position: absolute; inset: 0; }
.bgl-sky[data-sky="dusk"] { --hf: .637; --ar: .460714; }
.bgl-sky[data-sky="day"] { --hf: .637; --ar: .461291; }
.bgl-sky[data-sky="night"] { --hf: .661; --ar: .461538; }
.bgl-sky picture { display: contents; }
.bgl-sky img {
  --ih: max(100cqw / var(--ar), var(--ay) * 100cqh / var(--hf), (var(--cover) - var(--ay)) * 100cqh / (1 - var(--hf)));
  position: absolute; display: block; max-width: none; max-height: none;
  width: calc(var(--ih) * var(--ar)); height: var(--ih);
  left: calc(50cqw - var(--ih) * var(--ar) / 2); top: calc(var(--ay) * 100cqh - var(--hf) * var(--ih));
  user-select: none; -webkit-user-select: none; -webkit-user-drag: none;
}
@supports not (width: 1cqw) {
  .bgl-sky img {
    --ih: max(min(100vw, 560px) / var(--ar), var(--ay) * 100vh / var(--hf), (var(--cover) - var(--ay)) * 100vh / (1 - var(--hf)));
    left: calc(50% - var(--ih) * var(--ar) / 2); top: calc(var(--ay) * 100vh - var(--hf) * var(--ih));
  }
}
.bgl-shade { position: absolute; inset: 0; }
/* Motion effect (tilt.js): the sky shifts a few px opposite to the phone's tilt, scaled up a little so its
   edges never show. It scales around its horizon (kept within the middle), so the horizon stays put. */
.bgl-sky.tilt { transform-origin: 50% 50%; transform-origin: 50% calc(clamp(.3, var(--ay), .7) * 100%); }
html.tilt-on .bgl-sky.tilt { transform: scale(1.07); will-change: transform; }
/* A new period's sky fading in over the old one. */
.bgl-enter { opacity: 0; transition: opacity 2s ease-in-out; will-change: opacity; }
.bgl-enter.bgl-in { opacity: 1; }

/* Where a page's layer sits: pinned to the screen while the page scrolls, or at the top of the page. */
.pg-bg { pointer-events: none; z-index: -1; }
.pg-stick { position: sticky; top: 0; height: 100vh; height: 100dvh; margin-bottom: -100vh; margin-bottom: -100dvh; }
.pg-top { position: absolute; top: 0; left: 0; right: 0; height: 100vh; height: 100dvh; }
.pg-bg > .bgl { inset: 0; }

/* ---------- Home: the greeting over the period's sky ---------- */
.bgl-home { --ay: .51; --cover: .9; }
.bgl-home [data-p="morning"] .bgl-shade, .bgl-home [data-p="evening"] .bgl-shade {
  background: linear-gradient(180deg, rgba(5,3,11,.8) 0%, rgba(5,3,11,.5) 20%, rgba(5,3,11,0) 45%, rgba(5,3,11,0) 64%, rgba(5,3,11,.5) 75%, rgba(5,3,11,.86) 83%, #05030b 89%); }
.bgl-home [data-p="afternoon"] .bgl-shade {
  background: linear-gradient(180deg, rgba(6,12,40,.86) 0%, rgba(6,12,40,.5) 20%, rgba(6,12,40,0) 40%, rgba(6,12,40,0) 62%, rgba(6,12,40,.5) 74%, rgba(6,10,34,.88) 83%, #05030b 89%); }
.bgl-home [data-p="night"] .bgl-shade {
  background: linear-gradient(180deg, rgba(4,4,14,.72) 0%, rgba(4,4,14,.28) 22%, rgba(4,4,14,0) 40%, rgba(4,4,14,0) 52%, rgba(4,4,14,.5) 57%, rgba(4,4,14,.72) 66%, rgba(4,4,14,.82) 80%, #05030b 89%); }

.pager-page[data-page="home"] { scroll-snap-type: y mandatory; padding-bottom: 0; }
.h-bg { position: sticky; top: 0; z-index: -1; height: 100vh; height: 100dvh; margin-bottom: -100vh; margin-bottom: -100dvh; overflow: hidden; pointer-events: none; background: #05030b; }
.h-sky, .h-night, .h-stars { position: absolute; inset: 0; }
.h-sky { will-change: transform; }
.h-night { opacity: 0; background: #04040e; will-change: opacity; }
.h-stars { opacity: 0; background: var(--stars-bright) 0 0 / 220px 220px; will-change: opacity; }
.screen.home { background: none; }
.h-stop { scroll-snap-align: start; }
/* The first resting point is exactly one screen (it only grows if its content can't fit, e.g. a small phone
   with the mini-player showing; then the page simply scrolls a little further before the moon). */
.h-one { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; padding-bottom: var(--reserve); }
.h-one .top { flex: none; }
.home .h-one .hero { flex: 1 0 auto; min-height: 0; will-change: transform, opacity; }
/* The sky between "Welcome back" and "Watch What Unfolds" takes all the room left, so the buttons sit at the
   bottom of the first screen, just under the horizon (as in the design). */
.home .h-one .hero > .hero-gap { max-height: none; }
.home .greet { display: grid; text-shadow: 0 1px 16px rgba(0,0,0,.45); }
.home .greet .g-txt { grid-area: 1 / 1; }
.g-enter { opacity: 0; transition: opacity 2s ease-in-out; }
.g-enter.g-in { opacity: 1; }
.g-leave { transition: opacity 2s ease-in-out; }
.g-leave.g-out { opacity: 0; }
.home .welcome-back, .home .cta-sub { text-shadow: 0 1px 12px rgba(0,0,0,.55); }
.home .unfold span:not(.unfold-rose) { text-shadow: 0 1px 3px rgba(0,0,0,.45), 0 1px 14px rgba(0,0,0,.6); }

/* ---------- Home: tonight's moon (always night) ---------- */
.bgl-moon { --ay: 1.1; }
.bgl-moon .bgl-shade { background: linear-gradient(180deg, rgba(4,4,14,.82) 0%, rgba(4,4,14,.9) 45%, rgba(4,4,14,.97) 100%); }
.h-moon { --mn: clamp(160px, calc(100dvh - 590px), 236px); position: relative; min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center; padding: calc(env(safe-area-inset-top) + 6px) 22px var(--reserve); text-align: center; }
.tm-up { flex: none; height: 28px; display: grid; place-items: center; color: rgba(255,255,255,.35); }
.tm-up svg { display: block; }
.tm-moon { position: relative; flex: none; width: var(--mn); height: var(--mn); margin-top: clamp(8px, 3dvh, 30px); pointer-events: none; opacity: 0;
  transform-origin: 50% 50%; will-change: transform, opacity; }
.tm-glow { position: absolute; inset: -24%; border-radius: 50%; opacity: 0; will-change: opacity;
  background: radial-gradient(closest-side, rgba(205,220,255,.36) 62%, rgba(185,205,255,.15) 74%, rgba(165,190,255,.05) 87%, rgba(160,185,255,0) 100%); }
.tm-disc { position: absolute; inset: 0; border-radius: 50%; overflow: hidden; }
.tm-disc img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; max-width: none; }
.tm-rim { position: absolute; inset: 0; border-radius: 50%; background: radial-gradient(closest-side, rgba(0,0,0,0) 62%, rgba(0,0,0,.07) 82%, rgba(0,0,0,.18) 100%); }
.tm-shadow { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.tm-dim { position: absolute; inset: 0; border-radius: 50%; background: #04040e; opacity: .7; will-change: opacity; }
.tm-info { width: 100%; max-width: 420px; margin-top: clamp(14px, 3dvh, 28px); }
.tm-phase { margin: 8px 0 0; font-weight: 300; font-size: 28px; line-height: 1.2; }
.tm-sub { margin: 6px 0 0; font-size: 13.5px; color: var(--muted-1); }
.tm-row { display: block; width: 100%; max-width: 302px; height: auto; margin: 14px auto 0; }
.tm-card { display: block; width: 100%; margin-top: 16px; padding: 14px 18px; border-radius: 20px; border: 1px solid var(--card-line); background: rgba(14,9,26,.72);
  color: #fff; font: inherit; text-align: left; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.tm-card .eyebrow { display: block; letter-spacing: .26em; font-size: 10.5px; }
.tm-card-title { display: block; margin-top: 6px; font-size: 19px; font-weight: 400; }
.tm-card-text { display: block; margin-top: 4px; font-size: 13px; line-height: 1.45; color: var(--muted-1); }
.tm-next { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; padding: 14px 18px; border-radius: 18px;
  border: 1px solid var(--card-line); background: rgba(14,9,26,.72); font-size: 13.5px; color: var(--body); }
.tm-next b { font-weight: 500; color: #F9B776; white-space: nowrap; }
.cycle-title { margin: 8px 0 0; text-align: center; font-weight: 300; font-size: 24px; }
.cycle-sub { margin: 4px 0 0; text-align: center; font-size: 12.5px; color: var(--muted-1); }
.ov-sheet .weeks + .btn-line { margin-top: 16px; }

/* ---------- Session: the period's sky in the top half, dark from the middle ---------- */
.bgl-session { --ay: .36; }
.bgl-session .bgl-shade { background: linear-gradient(180deg, rgba(5,3,11,.62) 0%, rgba(5,3,11,.3) 14%, rgba(5,3,11,.12) 24%, rgba(5,3,11,.06) calc(var(--ay) * 100% - 30px),
  rgba(5,3,11,.35) calc(var(--ay) * 100% + 14px), rgba(5,3,11,.86) calc(var(--ay) * 100% + 70px), #05030b calc(var(--ay) * 100% + 140px)); }
.bgl-session [data-p="afternoon"] .bgl-shade { background: linear-gradient(180deg, rgba(6,12,40,.72) 0%, rgba(6,12,40,.42) 14%, rgba(6,12,40,.26) 24%, rgba(6,12,40,.16) calc(var(--ay) * 100% - 30px),
  rgba(6,12,40,.42) calc(var(--ay) * 100% + 14px), rgba(5,6,22,.88) calc(var(--ay) * 100% + 70px), #05030b calc(var(--ay) * 100% + 140px)); }
.session-tab { background: none; }
.session-tab .s-intro { text-shadow: 0 1px 3px rgba(0,0,0,.35), 0 1px 16px rgba(0,0,0,.55); }

/* ---------- Mission and Astrology: the starry part of the period's sky, dimmed ---------- */
.bgl-milky { --ay: 1.14; }
.bgl-milky .bgl-shade { background: linear-gradient(180deg, rgba(5,3,11,.5) 0%, rgba(5,3,11,.36) 30%, rgba(5,3,11,.42) 62%, rgba(5,3,11,.82) 100%); }
.bgl-milky [data-p="afternoon"] .bgl-shade { background: linear-gradient(180deg, rgba(4,10,34,.5) 0%, rgba(4,10,34,.34) 30%, rgba(4,10,34,.42) 62%, rgba(4,8,26,.84) 100%); }
.screen.mission-home, .screen.as { background: none; }

/* Mission's four buttons only: frosted glass over the sky (the brand gradient at ~42%, white text). */
.mission-btn {
  border: 1px solid rgba(255,255,255,.22); color: #fff; font: 500 18px var(--font-body);
  background: linear-gradient(90deg, rgba(249,183,118,.42) 0%, rgba(232,121,176,.42) 55%, rgba(139,92,246,.42) 100%);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.3), inset 0 0 0 .5px rgba(255,255,255,.06), 0 8px 28px rgba(232,121,176,.26);
  text-shadow: 0 1px 8px rgba(0,0,0,.25);
}

/* ---------- Welcome, Log in, Create account: the dusk sky ---------- */
/* The sun sits just below the "Already have an account? / New here?" line (measured, --ay); dark behind the
   logo, title, fields and buttons; the clouds in full color at the bottom. */
.bgl-ob { --ay: .74; --cover: 1; }
.bgl-ob .bgl-shade { background: linear-gradient(180deg, rgba(5,3,11,.78) 0%, rgba(5,3,11,.62) calc(var(--ay) * 100% - 200px), rgba(5,3,11,.3) calc(var(--ay) * 100% - 70px), rgba(5,3,11,0) calc(var(--ay) * 100% - 8px)); }
.welcome { position: relative; grid-template-rows: auto auto minmax(0, 1fr); }
.welcome-bottom { margin-top: clamp(14px, 3svh, 30px); }
.welcome-clouds { min-height: 0; }
.ob-sky { position: relative; overflow: hidden; }
.ob-sky .ob-top { z-index: 1; }
.ob-clouds { flex: 1 0 clamp(150px, 24svh, 260px); }
.welcome .lede, .ob-sky .ob-sub { text-shadow: 0 1px 12px rgba(0,0,0,.6); }

/* ---------- End of session: the dusk sun rising behind "You made X minutes for yourself." ---------- */
.screen.end { background: #05030b; isolation: isolate; }
.bgl-end { --ay: .2; }
.bgl-end .bgl-shade { background: linear-gradient(180deg, rgba(5,3,11,.6) 0%, rgba(5,3,11,.3) calc(var(--ay) * 100% - 70px), rgba(5,3,11,.28) calc(var(--ay) * 100% + 6px), rgba(5,3,11,.8) calc(var(--ay) * 100% + 80px), rgba(5,3,11,.94) calc(var(--ay) * 100% + 170px), #05030b calc(var(--ay) * 100% + 260px)); }
.bgl-end .bgl-sky img { animation: sun-rise 2.6s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes sun-rise { from { transform: translate3d(0, 60px, 0); opacity: 0; } to { transform: none; opacity: 1; } }
.end-title { text-shadow: 0 1px 18px rgba(0,0,0,.55); }

@media (prefers-reduced-motion: reduce) {
  .bgl-end .bgl-sky img { animation: none; }
}
