.lunar-cycle-is-active .site-main { padding-block-start: 0; }
.lunar-cycle-is-active .site-footer { position: relative; }
/* The whole page is one night sky: the root carries its colour, a fixed layer its
   stars, and every section below the Moon is transparent over it. */
body.lunar-cycle-is-active { background: var(--home-canvas-deep); }

.lunar-page { color: var(--home-text); }
.lunar-page [hidden] { display: none !important; }
.lunar-page__sky {
    position: fixed;
    z-index: -1;
    inset: 0 0 auto;
    width: 100%;
    /* The large viewport: the sky is not redrawn when a phone shows or hides its bars. */
    height: 100lvh;
    background:
        radial-gradient(ellipse 58% 62% at 50% 42%, rgba(49, 62, 83, 0.22), transparent 78%),
        radial-gradient(ellipse 44% 60% at 88% 20%, rgba(67, 79, 106, 0.1), transparent 80%),
        radial-gradient(ellipse 50% 60% at 8% 88%, rgba(58, 68, 96, 0.1), transparent 80%);
    pointer-events: none;
}

/* ── The first screen ─────────────────────────────────────────────────────────
   The Moon in the middle, the name of its phase under it and the line of time
   pinned to the bottom. Everything that explains the page lives below it. */
.lunar-hero {
    /* The line of time is a fixed-height layer at the bottom; the rest of the
       screen keeps exactly that much room free for it, so nothing ever meets it. */
    --lunar-bottom: max(var(--home-space-6), calc(env(safe-area-inset-bottom) + var(--home-space-4)));
    --lunar-top: 6.25rem;
    --lunar-controls: 4.25rem;
    --lunar-title: 5.25rem;
    position: relative;
    isolation: isolate;
    min-height: 100svh;
}
.lunar-hero::before {
    position: absolute;
    inset: 0;
    z-index: -1;
    background: radial-gradient(circle at var(--lunar-sun-x, 75%) var(--lunar-sun-y, 36%), rgba(197, 207, 219, 0.08), transparent 37%);
    content: "";
    pointer-events: none;
}
.lunar-hero__inner {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    min-height: 100svh;
    padding-block: var(--lunar-top) calc(var(--lunar-controls) + var(--lunar-bottom) + var(--home-space-4));
}

/* The Moon takes the largest square the stage has once its name has room under it. */
.lunar-hero__stage {
    position: relative;
    flex: 1 1 0;
    min-height: 17rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    container-type: size;
    transition: transform 700ms cubic-bezier(0.22, 0.7, 0.2, 1);
}
.lunar-hero__orb { position: relative; flex: none; width: min(100cqw, 100cqh - var(--lunar-title), 52rem); aspect-ratio: 1; }
.lunar-hero__orb::before { position: absolute; inset: 7% 6%; border-radius: 50%; background: radial-gradient(circle, rgba(103, 121, 152, 0.13), transparent 65%); content: ""; pointer-events: none; }
.lunar-hero__canvas, .lunar-hero__fallback { position: absolute; inset: 0; width: 100%; height: 100%; }
.lunar-hero__canvas { opacity: 0; transition: opacity 480ms ease; }
.lunar-hero__orb[data-graphic="ready"] .lunar-hero__canvas { opacity: 1; }
.lunar-hero__fallback { object-fit: contain; }
.lunar-hero__orb[data-graphic="ready"] .lunar-hero__fallback { visibility: hidden; }
.lunar-hero__graphic-status, .lunar-hero__retry { position: absolute; inset: auto 0 0; width: max-content; max-width: 100%; margin-inline: auto; }
.lunar-hero__graphic-status { color: var(--home-text-faint); font-size: var(--home-type-caption); text-align: center; }
.lunar-hero__retry { z-index: 2; }

/* The name of the phase, set like a title card: wide capitals, quiet colour, no
   plate behind it. Its box has a fixed height, so a longer name never moves the
   Moon or the line of time. */
.lunar-hero__title {
    flex: none;
    display: grid;
    align-content: start;
    justify-items: center;
    gap: var(--home-space-3);
    width: 100%;
    height: var(--lunar-title);
    /* The disc fills 92 % of its square, so the name may start in the empty rim under it. */
    margin-block-start: calc(var(--home-space-3) * -1);
    text-align: center;
}
.lunar-hero__phase {
    max-width: 100%;
    min-height: 1.35em;
    margin: 0;
    /* Tracking follows every letter, the last one too; the same space on the left keeps the word centred. */
    padding-inline-start: 0.42em;
    color: rgb(236 239 244 / 0.84);
    font-size: clamp(1.125rem, 2vw, 1.875rem);
    font-weight: 400;
    line-height: 1.35;
    letter-spacing: 0.42em;
    text-transform: uppercase;
    text-wrap: balance;
    text-shadow: 0 0 1.5rem rgb(5 6 10 / 0.8);
    transition: opacity 900ms ease, filter 900ms ease;
}
.lunar-hero__phase[data-state="hidden"] { opacity: 0; filter: blur(4px); transition-duration: 380ms; }
.lunar-hero__caption { display: flex; flex-wrap: wrap; justify-content: center; margin: 0; color: var(--home-text-faint); font-size: var(--home-type-caption); letter-spacing: var(--home-track-label); text-transform: uppercase; font-variant-numeric: lining-nums tabular-nums; }
.lunar-hero__caption span + span::before { margin-inline: var(--home-space-3); content: "·"; }

/* The line of time: a hairline and a small ring, pinned to the bottom of the screen. */
.lunar-hero__controls {
    position: absolute;
    z-index: 2;
    inset-inline: var(--home-layout-gutter);
    bottom: var(--lunar-bottom);
    max-width: 60rem;
    height: var(--lunar-controls);
    margin-inline: auto;
}
.lunar-time-slider { position: relative; display: flex; align-items: center; height: 2.75rem; outline: none; touch-action: none; cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent; }
.lunar-time-slider__track { position: relative; display: block; width: 100%; height: 1px; background: rgb(224 230 238 / 0.16); }
.lunar-time-slider__fill { position: absolute; inset: 0 auto 0 0; width: 50%; background: rgb(224 230 238 / 0.42); }
.lunar-time-slider__thumb {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0.75rem;
    height: 0.75rem;
    border: 1px solid rgb(236 239 244 / 0.85);
    border-radius: 50%;
    background: var(--home-canvas-deep);
    box-shadow: 0 0 0.75rem rgb(224 230 238 / 0.22);
    transform: translate(-50%, -50%);
    transition: transform var(--home-duration-fast) ease-out, box-shadow var(--home-duration-fast) ease-out;
}
.lunar-time-slider:is(:hover, :active) .lunar-time-slider__thumb { transform: translate(-50%, -50%) scale(1.3); }
/* Focus from the keyboard rings the thumb itself; the line never gets a frame. */
.lunar-time-slider:focus-visible .lunar-time-slider__thumb { box-shadow: 0 0 0 0.3rem rgb(228 234 242 / 0.22), 0 0 0.75rem rgb(224 230 238 / 0.3); transform: translate(-50%, -50%) scale(1.3); }
.lunar-hero__range { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: baseline; gap: var(--home-space-3); color: var(--home-text-faint); font-size: var(--home-type-caption); letter-spacing: 0.04em; font-variant-numeric: lining-nums tabular-nums; }
.lunar-hero__range > time:last-child { text-align: end; }
.lunar-hero__moment { display: flex; align-items: baseline; gap: var(--home-space-4); margin: 0; color: var(--home-text-soft); white-space: nowrap; }
.lunar-hero__link { padding: 0; border: 0; background: none; color: var(--home-silver-strong); font: inherit; letter-spacing: inherit; text-decoration: underline; text-decoration-color: rgb(224 230 238 / 0.35); text-underline-offset: 0.3em; cursor: pointer; transition: text-decoration-color var(--home-duration-fast) ease-out; }
.lunar-hero__link:hover, .lunar-hero__link[aria-expanded="true"] { text-decoration-color: currentColor; }
.lunar-hero__link:focus-visible { outline: var(--home-focus-width) solid var(--home-focus); outline-offset: 3px; }

/* ── The calendar ─────────────────────────────────────────────────────────────
   On a wide screen it stands at the right beside the Moon, which stays in view and
   turns as days are chosen. Elsewhere it opens in the middle over the page, with
   a button to apply the choice. */
.lunar-picker {
    width: min(22rem, calc(100vw - 2rem));
    max-height: calc(100svh - 2rem);
    margin: auto;
    padding: var(--home-space-6);
    overflow: auto;
    border: 1px solid rgb(224 230 238 / 0.12);
    border-radius: var(--home-radius-surface);
    background: rgb(9 11 17 / 0.82);
    color: var(--home-text);
    font-variant-numeric: lining-nums;
    box-shadow: 0 1.5rem 4rem rgb(0 0 0 / 0.45);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
}
.lunar-picker[open] { animation: lunar-picker-in 320ms ease-out; }
.lunar-picker::backdrop { background: rgb(5 6 10 / 0.6); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
@keyframes lunar-picker-in { from { opacity: 0; transform: translateY(0.5rem); } }
.lunar-picker__form { display: grid; gap: var(--home-space-5); }
.lunar-picker__head { display: flex; align-items: center; justify-content: space-between; gap: var(--home-space-4); }
.lunar-picker__title { margin: 0; color: var(--home-text-faint); font-size: var(--home-type-caption); letter-spacing: var(--home-track-label); text-transform: uppercase; }
.lunar-picker__close { position: relative; width: 2rem; height: 2rem; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--home-text-soft); cursor: pointer; }
.lunar-picker__close span::before, .lunar-picker__close span::after { position: absolute; top: 50%; left: 25%; width: 50%; height: 1px; background: currentColor; content: ""; }
.lunar-picker__close span::before { transform: rotate(45deg); }
.lunar-picker__close span::after { transform: rotate(-45deg); }
.lunar-picker__close:hover { color: var(--home-text); }
.lunar-picker :is(button, input, select):focus-visible { outline: var(--home-focus-width) solid var(--home-focus); outline-offset: 2px; }
.lunar-picker__month { display: grid; grid-template-columns: 2.25rem minmax(0, 1fr) 2.25rem; align-items: center; }
.lunar-picker__month p { margin: 0; font-size: var(--home-type-title); text-align: center; text-transform: capitalize; }
.lunar-picker__month button { height: 2.25rem; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--home-text-soft); font: inherit; cursor: pointer; }
.lunar-picker__month button:hover:not(:disabled) { color: var(--home-text); }
.lunar-picker__month button:disabled { opacity: 0.3; cursor: default; }
.lunar-picker__week, .lunar-picker__days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0.25rem 2px; text-align: center; }
.lunar-picker__week { color: var(--home-text-faint); font-size: var(--home-type-micro); letter-spacing: var(--home-track-label); text-transform: uppercase; }
.lunar-picker__day {
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 0.375rem;
    min-width: 0;
    aspect-ratio: 1 / 1.08;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 0.75rem;
    background: none;
    color: var(--home-text-soft);
    font: inherit;
    font-size: var(--home-type-label);
    font-variant-numeric: lining-nums tabular-nums;
    line-height: 1;
    cursor: pointer;
    transition: border-color var(--home-duration-fast) ease-out, color var(--home-duration-fast) ease-out;
}
.lunar-picker__day:hover { border-color: rgb(224 230 238 / 0.14); color: var(--home-text); }
.lunar-picker__day[aria-current="date"] { color: var(--home-text); }
.lunar-picker__day[aria-pressed="true"] { border-color: rgb(236 239 244 / 0.7); color: var(--home-text); box-shadow: 0 0 1rem rgb(224 230 238 / 0.12); }
.lunar-picker__day[data-outside] { opacity: 0.35; }
.lunar-picker__glyph { width: 0.9375rem; height: 0.9375rem; }
.lunar-picker__glyph circle { fill: rgb(224 230 238 / 0.12); }
.lunar-picker__glyph path { fill: rgb(236 239 244 / 0.82); }
.lunar-picker__time { display: flex; flex-wrap: wrap; gap: var(--home-space-4); padding-block-start: var(--home-space-4); border-block-start: 1px solid rgb(224 230 238 / 0.1); }
.lunar-picker__time label { display: grid; flex: 1 1 8rem; gap: var(--home-space-2); color: var(--home-text-faint); font-size: var(--home-type-caption); letter-spacing: var(--home-track-label); text-transform: uppercase; }
.lunar-picker__time :is(input, select) { width: 100%; min-height: var(--home-control-height); padding: 0 var(--home-space-4); border: 1px solid rgb(224 230 238 / 0.14); border-radius: var(--home-radius-surface); background: rgb(224 230 238 / 0.04); color: var(--home-text); color-scheme: dark; font: inherit; font-size: var(--home-type-label); letter-spacing: normal; text-transform: none; }
.lunar-picker__feedback { margin: 0; color: var(--home-silver-strong); font-size: var(--home-type-caption); }
.lunar-picker__feedback[data-error="true"] { color: var(--color-danger); }
.lunar-picker__actions { display: flex; justify-content: flex-end; gap: var(--home-space-3); }
.lunar-picker__actions .button { min-height: var(--home-control-height); }

/* Beside the Moon: no backdrop and no buttons below — a chosen day turns the Moon at
   once, and the cross closes the panel. It stands between the header and the line
   of time, centred in that band. */
@media (min-width: 80rem) {
    .lunar-picker:not(:modal) {
        --lunar-band-end: calc(var(--lunar-controls) + var(--lunar-bottom) + var(--home-space-4));
        position: absolute;
        z-index: 3;
        inset: var(--lunar-top) var(--home-layout-gutter) var(--lunar-band-end) auto;
        width: 21rem;
        max-height: calc(100% - var(--lunar-top) - var(--lunar-band-end));
        margin: auto 0;
    }
    .lunar-picker:not(:modal)[open] { animation-name: lunar-picker-aside; }
    .lunar-picker:not(:modal) .lunar-picker__actions { display: none; }
}
/* Where the screen is not wide enough for both, the Moon steps aside for the panel. */
@media (min-width: 80rem) and (max-width: 109.9375rem) {
    .lunar-hero:has(.lunar-picker[open]:not(:modal)) .lunar-hero__stage { transform: translateX(calc((21rem + var(--home-space-8)) / -2)); }
}
/* A low screen gets a denser calendar, so it fits without a scroll. */
@media (min-width: 80rem) and (max-height: 56rem) {
    .lunar-picker:not(:modal) { padding: var(--home-space-4) var(--home-space-5); }
    .lunar-picker:not(:modal) .lunar-picker__form { gap: var(--home-space-3); }
    .lunar-picker:not(:modal) .lunar-picker__day { aspect-ratio: 1 / 0.86; gap: 0.25rem; }
    .lunar-picker:not(:modal) .lunar-picker__time { padding-block-start: var(--home-space-3); }
}
@keyframes lunar-picker-aside { from { opacity: 0; transform: translateX(0.75rem); } }

/* ── Below the first screen ──────────────────────────────────────────────────── */
.lunar-moment { position: relative; padding-block: clamp(var(--home-space-12), 6vw, var(--home-space-24)) 0; }
.lunar-moment__inner { max-width: 86rem; }
.lunar-moment .account-breadcrumbs { margin: 0; color: var(--home-text-soft); }
.lunar-moment__intro { max-width: 38rem; margin-block: var(--home-space-8) var(--home-space-12); }
.lunar-moment__intro .home-overline { margin: 0 0 var(--home-space-3); }
.lunar-moment__intro h1 { max-width: none; margin: 0; font-size: var(--home-type-section); font-weight: 400; line-height: var(--home-line-section); }
.lunar-moment__intro h1 em { color: var(--home-silver-strong); font-weight: 400; }
.lunar-moment__intro > p:last-child { margin: var(--home-space-4) 0 0; color: var(--home-text-muted); font-size: var(--home-type-lead); line-height: var(--home-line-lead); }
.lunar-moment__facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--home-space-8); margin: 0; }
.lunar-moment__facts > div { display: grid; align-content: start; gap: var(--home-space-3); min-width: 0; padding-block-start: var(--home-space-5); border-block-start: 1px solid var(--color-line); }
.lunar-moment__facts dt { color: var(--home-text-muted); font-size: var(--home-type-caption); letter-spacing: var(--home-track-label); text-transform: uppercase; }
.lunar-moment__facts dd { display: grid; gap: var(--home-space-2); margin: 0; }
.lunar-moment__facts strong { font-size: var(--home-type-title); font-weight: 400; font-variant-numeric: lining-nums tabular-nums; }
.lunar-moment__facts time { color: var(--home-text-soft); font-size: var(--home-type-label); }
.lunar-moment__facts small { color: var(--home-text-muted); font-size: var(--home-type-caption); line-height: 1.4; }
.lunar-moment__timezone { margin-block: var(--home-space-6) 0; color: var(--home-text-muted); font-size: var(--home-type-caption); }
.lunar-moment__timezone a, .lunar-cycle a { color: var(--home-silver-strong); text-underline-offset: 0.25em; }

.lunar-cycle { position: relative; padding-block: clamp(var(--home-space-16), 7vw, var(--home-space-32)); }
.lunar-cycle__inner { max-width: 86rem; }
.lunar-cycle__heading { display: flex; justify-content: space-between; align-items: end; flex-wrap: wrap; gap: var(--home-space-6); }
.lunar-cycle__heading .home-overline { margin-block: 0 var(--home-space-4); }
.lunar-cycle__heading h2 { margin: 0; font-size: var(--home-type-section); font-weight: 400; line-height: var(--home-line-section); }
.lunar-cycle__heading h2 em { color: var(--home-silver-strong); font-weight: 400; }
.lunar-cycle__line { position: relative; height: 1px; margin-block: var(--home-space-16) var(--home-space-6); background: var(--color-line); }
.lunar-cycle__progress { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--home-silver-strong); }
.lunar-cycle__marker { position: absolute; top: 50%; left: 0; width: 0.875rem; height: 0.875rem; border: 1px solid var(--home-silver-strong); border-radius: 50%; background: var(--home-canvas-deep); transform: translate(-50%, -50%); }
.lunar-cycle__events { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--home-space-4); margin: 0; padding: 0; list-style: none; }
.lunar-cycle__events li { display: grid; align-content: start; gap: var(--home-space-2); min-width: 0; }
.lunar-cycle__events li::before { width: 0.375rem; height: 0.375rem; margin-block-end: var(--home-space-2); border-radius: 50%; background: var(--home-silver); content: ""; }
.lunar-cycle__events strong { font-size: var(--home-type-label); font-weight: 400; }
.lunar-cycle__events time { color: var(--home-text-muted); font-size: var(--home-type-caption); }
.lunar-cycle__note, .lunar-cycle__sources { max-width: 57rem; margin-block: var(--home-space-8) 0; color: var(--home-text-muted); font-size: var(--home-type-label); line-height: var(--home-line-lead); }
.lunar-cycle__sources { margin-block-start: var(--home-space-4); font-size: var(--home-type-caption); }

/* A short screen gives the Moon every spare line of height. */
@media (max-height: 46rem) {
    .lunar-hero { --lunar-top: 5.75rem; --lunar-title: 4.75rem; }
}

@media (max-width: 47.9375rem) {
    .lunar-hero { --lunar-top: 5.75rem; --lunar-title: 5.75rem; --lunar-controls: 5.25rem; }
    .lunar-hero__phase { font-size: 1rem; letter-spacing: 0.3em; padding-inline-start: 0.3em; }
    /* A phone has no room for the moment between the ends of the line: the ends
       stay under the line and the moment with its buttons goes one row lower. */
    .lunar-hero__range { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-areas: "start end" "moment moment"; row-gap: var(--home-space-2); margin-block-start: -0.375rem; }
    .lunar-hero__range > time:first-child { grid-area: start; }
    .lunar-hero__range > time:last-child { grid-area: end; }
    .lunar-hero__moment { grid-area: moment; justify-self: center; gap: var(--home-space-4); }
    .lunar-picker { padding: var(--home-space-5); }
    .lunar-moment__facts { grid-template-columns: minmax(0, 1fr); gap: var(--home-space-6); }
    .lunar-cycle__line { margin-block-start: var(--home-space-12); }
    .lunar-cycle__events { gap: var(--home-space-2); }
    .lunar-cycle__events strong, .lunar-cycle__events time { font-size: var(--home-type-micro); overflow-wrap: anywhere; }
}
@media (max-width: 23rem) {
    .lunar-hero__range { font-size: var(--home-type-micro); }
}
@media (prefers-reduced-motion: reduce) {
    .lunar-hero__canvas, .lunar-hero__phase, .lunar-hero__stage { transition: none; }
    .lunar-picker[open] { animation: none; }
}
