/* ============================================================
   Sky hero — warm sunset (home) and dusk (The Gray Cloud)
   The sky and clouds are drawn by sky-canvas.js (WebGL). The CSS
   gradient below is the fallback when WebGL is unavailable.
   sky-hero.js splits the title into letters and starts the sequence.
   ============================================================ */

.sky-hero {
    --letter-delay: 1.0s;    /* when the first letter begins */
    --letter-step: 0.17s;    /* gap between letters */
    --letter-dur: 1.4s;      /* each letter's rise */
    --after-title: 0.25s;    /* pause before the rule and subtitle */
    --intro-total: 5.6s;     /* used by JS to announce completion */

    position: relative;
    min-height: 100vh;
    min-height: 100svh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: #fff;
    isolation: isolate;
    text-align: center;
    background: #0a1428;
}

/* The Gray Cloud: the screen starts under cloud, the light comes up behind it,
   the cover thins, and only then is the title written out. */
.sky-hero--dusk {
    --letter-delay: 2.9s;
    --letter-step: 0.07s;
    --letter-dur: 1.2s;
    --after-title: 0.35s;
    --intro-total: 7.2s;
    min-height: 88vh;
    min-height: 88svh;
}

/* ---------- Sky ---------- */
.sky {
    position: absolute;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    background:
        radial-gradient(ellipse 140% 55% at 50% 106%, rgba(255, 221, 150, 0.95) 0%, rgba(250, 170, 100, 0.75) 22%, rgba(230, 120, 95, 0.45) 45%, transparent 70%),
        linear-gradient(180deg,
            #0a1428 0%,
            #15224c 18%,
            #3a3367 36%,
            #74456c 50%,
            #a9555f 62%,
            #d2745a 73%,
            #e9985f 83%,
            #f3b96f 92%,
            #f8d48d 100%);
}

.sky-hero--dusk .sky {
    background:
        radial-gradient(ellipse 120% 50% at 50% 108%, rgba(246, 206, 140, 0.9) 0%, rgba(230, 160, 110, 0.6) 25%, rgba(140, 95, 120, 0.3) 50%, transparent 72%),
        linear-gradient(180deg,
            #0a1428 0%,
            #132449 24%,
            #2d3362 42%,
            #5a4470 56%,
            #8d5d72 68%,
            #bd8470 80%,
            #dba97a 91%,
            #ecc48f 100%);
}

.sky__canvas {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
}

/* fabric-like grain so the gradients don't look flat */
.sky__grain {
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.6 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
    background-size: 220px 220px;
    opacity: 0.03;
    mix-blend-mode: soft-light;
    pointer-events: none;
}

/* a light touch behind the title only, so the sky itself stays clear */
.sky__vignette {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 50% 40% at 50% 46%, rgba(10, 14, 28, 0.22) 0%, rgba(10, 14, 28, 0.06) 55%, transparent 75%);
    pointer-events: none;
}

/* ---------- Sparkles ----------
   A handful of four-point stars placed around the title. They fade in once
   the title has been written and then twinkle slowly, each on its own clock. */
.sky-sparkles {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    opacity: 0;
    transition: opacity 2.4s ease;
    transition-delay: calc(var(--letter-delay) + (var(--n, 4) - 1) * var(--letter-step) + 0.9s);
}

.sky-hero.is-ready .sky-sparkles {
    opacity: 1;
}

.sparkle {
    position: absolute;
    left: var(--x);
    top: var(--y);
    width: var(--s, 12px);
    height: var(--s, 12px);
    transform: translate(-50%, -50%) scale(0.8);
    opacity: 0.45;
    background:
        radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.95) 0%, rgba(255, 246, 222, 0.5) 18%, rgba(255, 246, 222, 0) 42%),
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23fff8e6' d='M12 0C12.5 7.4 13.2 11.1 24 12 13.2 12.9 12.5 16.6 12 24 11.5 16.6 10.8 12.9 0 12 10.8 11.1 11.5 7.4 12 0Z'/></svg>") center / 100% 100% no-repeat;
    filter: drop-shadow(0 0 3px rgba(255, 240, 205, 0.75));
    will-change: opacity, transform;
}

.sky-hero.is-ready .sparkle {
    animation: sparkle-twinkle var(--d, 4.5s) ease-in-out var(--t, 0s) infinite;
}

@keyframes sparkle-twinkle {
    0%, 100% { opacity: 0.45; transform: translate(-50%, -50%) scale(0.8) rotate(0deg); }
    50%      { opacity: 1;    transform: translate(-50%, -50%) scale(1) rotate(6deg); }
}

/* ---------- Content ---------- */
.sky-hero__content {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 1100px;
    padding: calc(var(--header-h, 72px) + 2rem) 1.5rem 5rem;
    margin: 0 auto;
}

/* Titles: Libre Caslon Display, a proper book-face Caslon cut for large sizes.
   Set in ivory like a film title; gold is kept for the hairline only. */
.sky-hero {
    --title-gold: #e3c87e;
    --title-ink: #fbf4e4;
    --font-title: 'Libre Caslon Display', 'Cormorant Garamond', Georgia, serif;
}

/* MIND — capitals, lightly tracked */
.sky-title {
    margin: 0;
    font-family: var(--font-title);
    font-weight: 400;
    font-size: clamp(4.8rem, 17.5vw, 14.5rem);
    letter-spacing: 0.04em;
    text-indent: 0.04em; /* visually centre despite trailing tracking */
    line-height: 1;
    color: var(--title-ink);
    white-space: nowrap;
    -webkit-font-smoothing: antialiased;
    text-shadow: 0 1px 3px rgba(10, 15, 30, 0.45), 0 0 24px rgba(10, 15, 30, 0.18);
}

/* The raw title text is hidden until sky-hero.js has split it into letters;
   otherwise it shows for a moment before the animation starts. Pages carry a
   <noscript> override so the title still shows without JavaScript. */
.sky-title[data-letters]:not(.is-split) {
    visibility: hidden;
}

.sky-word {
    display: inline-block;
    white-space: nowrap;
}

/* Each letter rises into view from behind an invisible line just under the
   baseline. The outer span is the mask; the slack on each side keeps serifs
   and italic overhangs from being cut. */
.sky-letter {
    display: inline-block;
    clip-path: inset(-0.3em -0.3em -0.22em -0.3em);
}

.sky-letter__in {
    display: inline-block;
    transform: translateY(1.3em);
    will-change: transform;
}

.sky-hero.is-ready .sky-letter__in {
    animation: sky-letter-in var(--letter-dur) cubic-bezier(0.16, 1, 0.3, 1) forwards;
    animation-delay: calc(var(--letter-delay) + var(--i, 0) * var(--letter-step));
}

@keyframes sky-letter-in {
    to { transform: none; }
}

/* hairline between the title and what follows */
.sky-rule {
    display: block;
    width: 56px;
    height: 1px;
    margin: 1.9rem auto 0;
    background: var(--title-gold);
    transform: scaleX(0);
    transform-origin: center;
}

.sky-hero.is-ready .sky-rule {
    animation-name: sky-rule-in;
}

@keyframes sky-rule-in {
    to { opacity: 1; transform: none; }
}

/* small line above the script title (Gray Cloud page) */
.sky-kicker {
    margin: 0 0 0.4rem;
    font-family: var(--font-text);
    font-size: 0.76rem;
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(255, 246, 225, 0.9);
    text-shadow: 0 1px 2px rgba(10, 15, 30, 0.5), 0 0 12px rgba(10, 15, 30, 0.25);
    opacity: 0;
    transition: opacity 1.4s ease;
    transition-delay: calc(var(--letter-delay) - 0.4s);
}

.sky-hero.is-ready .sky-kicker {
    opacity: 1;
}

/* The Gray Cloud — same face, mixed case, as on a title page */
.sky-title--script {
    font-size: clamp(3.6rem, 11.5vw, 9rem);
    letter-spacing: 0.005em;
    text-indent: 0;
    line-height: 1.1;
    white-space: normal;
}

.sky-title--script .sky-word {
    margin: 0;
}

/* Elements that follow the title: subtitle, tagline, actions */
.sky-after {
    opacity: 0;
    transform: translateY(10px);
    will-change: opacity, transform;
    --title-end: calc(var(--letter-delay) + (var(--n, 4) - 1) * var(--letter-step) + var(--letter-dur) * 0.6);
}

.sky-hero.is-ready .sky-after {
    animation: sky-fade-up 1.4s cubic-bezier(0.2, 0.65, 0.25, 1) forwards;
    animation-delay: calc(var(--title-end) + var(--after-title) + var(--k, 0) * 0.45s);
}

@keyframes sky-fade-up {
    to { opacity: 1; transform: none; }
}

.sky-subtitle {
    margin: 1.5rem auto 0;
    font-family: var(--font-text);
    font-size: clamp(0.78rem, 0.68rem + 0.4vw, 0.98rem);
    font-weight: 500;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: rgba(255, 250, 240, 0.95);
    text-shadow: 0 1px 2px rgba(10, 15, 30, 0.5), 0 0 14px rgba(10, 15, 30, 0.25);
    max-width: 48rem;
    line-height: 1.7;
}

.sky-hero--dusk .sky-subtitle {
    font-family: var(--font-display);
    font-size: clamp(1.2rem, 1rem + 1vw, 1.75rem);
    font-style: italic;
    font-weight: 500;
    letter-spacing: 0.02em;
    text-transform: none;
    margin-top: 1.2rem;
}

.sky-tagline {
    margin: 2rem auto 0;
    font-family: var(--font-display);
    font-size: clamp(1.25rem, 1.05rem + 1vw, 1.7rem);
    font-style: italic;
    font-weight: 500;
    color: rgba(255, 250, 240, 0.94);
    text-shadow: 0 1px 2px rgba(10, 15, 30, 0.5), 0 0 14px rgba(10, 15, 30, 0.25);
}

.sky-hero--dusk .sky-tagline {
    font-family: var(--font-text);
    font-style: normal;
    font-size: 0.8rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(255, 246, 232, 0.8);
    margin-top: 1.1rem;
}

.sky-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.85rem;
    margin-top: 2.4rem;
}

.sky-actions .btn-light {
    border-color: rgba(255, 255, 255, 0.7);
    background: rgba(10, 15, 30, 0.18);
    text-shadow: 0 1px 6px rgba(10, 15, 30, 0.45);
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .sky-title {
        letter-spacing: 0.03em;
        text-indent: 0.03em;
    }

    /* on narrow screens the title fills the width; drop the stars beside it */
    .sparkle--wide {
        display: none;
    }

    .sky-hero--dusk {
        min-height: 78vh;
        min-height: 78svh;
    }
}

@media (max-width: 560px) {
    .sky-hero__content {
        padding-bottom: 5rem;
    }

    .sky-actions .btn,
    .sky-actions .btn-mayo {
        width: 100%;
    }

    .sky-title--script {
        font-size: clamp(2.8rem, 12.5vw, 3.9rem);
        line-height: 1.08;
    }
}

/* ---------- Reduced motion: show everything at once ---------- */
@media (prefers-reduced-motion: reduce) {
    .sky-letter__in,
    .sky-rule,
    .sky-after,
    .sky-kicker {
        animation: none !important;
        transition: none !important;
        opacity: 1 !important;
        transform: none !important;
    }

    .sky-sparkles {
        transition: none !important;
        opacity: 1 !important;
    }

    .sparkle {
        animation: none !important;
        opacity: 0.7 !important;
    }
}
