/* ------------------------------------------------------------------
   Tread Softly — night sky, stars, and aurora
   No external fonts or assets are loaded: everything is same-origin so
   the CSP can stay at 'self' with no third-party allowances.
   ------------------------------------------------------------------ */

:root {
    --sky-top: #020308;
    --sky-mid: #060b1a;
    --sky-horizon: #0a1a2c;
    --ink: #eef6f1;
    --ink-soft: #b9d5c6;
    --ink-muted: #7fa392;
    --aurora: #4dffa2;
    --aurora-deep: #14b870;
    --serif: "Cormorant Garamond", "EB Garamond", "Baskerville", "Palatino Linotype",
             "Book Antiqua", "Hoefler Text", Georgia, "Times New Roman", serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    height: 100%;
    background: var(--sky-top);
    color-scheme: dark;
    -webkit-text-size-adjust: 100%;
}

body {
    min-height: 100%;
    min-height: 100dvh;
    font-family: var(--serif);
    color: var(--ink);
    background: linear-gradient(180deg,
        var(--sky-top) 0%,
        var(--sky-mid) 55%,
        var(--sky-horizon) 100%);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ---------- Sky layers ------------------------------------------- */

.sky-layer,
.aurora-fallback,
.horizon,
.vignette {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

#stars { z-index: 0; }

/* Low-resolution canvas upscaled by the browser; the blur turns the
   column-by-column render into soft, continuous curtains of light. */
#aurora {
    z-index: 2;
    filter: blur(4px) saturate(1.2);
    transform: translateZ(0);
    opacity: 0;
    transition: opacity 2.4s ease-out;
    mix-blend-mode: screen;
}
#aurora.is-ready { opacity: 1; }

/* CSS-only aurora shown until the JS canvas is ready (and permanently
   if scripting is unavailable). */
.aurora-fallback {
    z-index: 1;
    opacity: 0.9;
    background:
        radial-gradient(60% 45% at 30% 30%, rgba(46, 230, 140, 0.22), transparent 70%),
        radial-gradient(50% 40% at 70% 22%, rgba(40, 210, 160, 0.18), transparent 70%),
        radial-gradient(70% 30% at 50% 45%, rgba(110, 80, 200, 0.10), transparent 70%);
    filter: blur(24px);
    animation: fallback-drift 24s ease-in-out infinite alternate;
    transition: opacity 2.4s ease-out;
}
.js .aurora-fallback.is-hidden { opacity: 0; }

@keyframes fallback-drift {
    from { transform: translate3d(-3%, -2%, 0) scale(1.05); }
    to   { transform: translate3d(3%, 2%, 0) scale(1.12); }
}

.horizon {
    z-index: 3;
    background: linear-gradient(180deg,
        transparent 0%,
        transparent 70%,
        rgba(6, 12, 24, 0.35) 76%,
        rgba(3, 5, 10, 0.92) 86%,
        rgba(2, 3, 7, 1) 100%);
}

.vignette {
    z-index: 4;
    background: radial-gradient(120% 90% at 50% 40%, transparent 55%, rgba(0, 0, 0, 0.55) 100%);
}

/* ---------- Content --------------------------------------------- */

/* A soft pool of darkness behind the words keeps them legible when the
   aurora flares, without boxing them in. */
.stage::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: radial-gradient(58% 48% at 50% 50%, rgba(2, 4, 10, 0.62) 0%, rgba(2, 4, 10, 0.28) 55%, transparent 100%);
    pointer-events: none;
}

.stage {
    position: relative;
    z-index: 10;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: clamp(2.2rem, 5vh, 4rem);
    padding: clamp(2.5rem, 8vh, 6rem) 16px;
    text-align: center;
}

.eyebrow {
    display: flex;
    align-items: center;
    gap: 1.1rem;
    animation: rise 1.6s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.eyebrow h1 {
    font-size: clamp(0.7rem, 1.3vw, 0.85rem);
    font-weight: 400;
    letter-spacing: 0.42em;
    text-indent: 0.42em; /* balance the trailing letter-spacing */
    text-transform: uppercase;
    color: var(--ink-muted);
    white-space: nowrap;
}

.eyebrow .rule {
    display: block;
    width: clamp(2rem, 8vw, 5rem);
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--ink-muted));
    opacity: 0.7;
}
.eyebrow .rule:last-child {
    background: linear-gradient(90deg, var(--ink-muted), transparent);
}

.quote {
    width: 100%;
    max-width: 60rem;
    display: flex;
    flex-direction: column;
    gap: clamp(1.6rem, 4vh, 2.6rem);
}

.quote .verse {
    max-width: 50ch; /* ch is measured at this element's own font-size */
    margin: 0 auto;
    font-size: clamp(1.45rem, 3.6vw, 2.75rem);
    font-style: italic;
    font-weight: 400;
    line-height: 1.5;
    letter-spacing: 0.01em;
    text-wrap: balance;
}

.line {
    display: block;
    animation: rise 1.8s cubic-bezier(0.2, 0.7, 0.2, 1) both;
    text-shadow:
        0 0 24px rgba(77, 255, 162, 0.18),
        0 2px 18px rgba(0, 0, 0, 0.6);
}

/* Stagger the three lines: index is taken from document order so no
   inline style attributes are needed (they would violate the CSP). */
.line:nth-child(1) { animation-delay: 0.35s; }
.line:nth-child(2) { animation-delay: 0.85s; }
.line:nth-child(3) { animation-delay: 1.45s; }

.line--emphasis {
    margin-top: 0.35em;
    color: #ffffff;
    text-shadow:
        0 0 34px rgba(77, 255, 162, 0.42),
        0 0 8px rgba(255, 255, 255, 0.25),
        0 2px 18px rgba(0, 0, 0, 0.6);
}

.quote figcaption {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.45rem;
    animation: rise 1.8s cubic-bezier(0.2, 0.7, 0.2, 1) 2.1s both;
}

.quote .author {
    font-size: clamp(0.85rem, 1.6vw, 1.05rem);
    letter-spacing: 0.28em;
    text-indent: 0.28em;
    text-transform: uppercase;
    color: var(--ink-soft);
}

.quote .author::before {
    content: "— ";
    letter-spacing: 0;
    color: var(--aurora-deep);
}

.quote .work {
    font-size: clamp(0.8rem, 1.4vw, 0.95rem);
    color: var(--ink-muted);
}

.quote .work cite {
    font-style: italic;
}

@keyframes rise {
    from {
        opacity: 0;
        transform: translate3d(0, 14px, 0);
        filter: blur(6px);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
        filter: blur(0);
    }
}

/* ---------- Accessibility & small screens ------------------------ */

@media (prefers-reduced-motion: reduce) {
    .eyebrow,
    .line,
    .quote figcaption,
    .aurora-fallback {
        animation: none;
    }
    #aurora,
    .aurora-fallback {
        transition: none;
    }
}

@media (max-width: 480px) {
    .eyebrow .rule { width: 1.5rem; }
    .quote .verse { line-height: 1.45; }
}

@media (max-height: 520px) {
    .stage { gap: 1.4rem; }
}

/* ---------- Inner pages ----------------------------------------- */

/* Pages other than the homepage keep the footer on the first screen:
   the stage takes whatever height the footer leaves. */
body.has-footer {
    display: flex;
    flex-direction: column;
}
.has-footer .stage {
    flex: 1 0 auto;
    min-height: 0;
}

/* Long-form pages (About): the text starts near the top instead of
   being centred, and carries its own scrim instead of the stage's. */
.stage--prose {
    justify-content: flex-start;
    padding-top: clamp(3.5rem, 12vh, 7rem);
}
.stage--prose::before { display: none; }

/* Without the stage's scrim the eyebrow needs its own shadow. */
.stage--prose .eyebrow h1 {
    color: var(--ink-soft);
    text-shadow: 0 0 6px rgba(2, 4, 10, 0.9), 0 1px 14px rgba(2, 4, 10, 0.9);
}

.prose {
    position: relative;
    width: 100%;
    max-width: 38rem;
    font-size: clamp(1.1rem, 1.9vw, 1.28rem);
    line-height: 1.75;
    text-align: left;
    color: #dcebe3;
    text-shadow: 0 1px 12px rgba(0, 0, 0, 0.65);
    animation: rise 1.8s cubic-bezier(0.2, 0.7, 0.2, 1) 0.4s both;
}

/* A feathered pool of darkness behind the column so the aurora never
   washes out a paragraph. */
.prose::before {
    content: "";
    position: absolute;
    inset: -2rem -1.5rem;
    z-index: -1;
    border-radius: 2rem;
    background: rgba(2, 4, 10, 0.58);
    filter: blur(28px);
    pointer-events: none;
}

.prose p + p { margin-top: 1.2em; }

/* Section headings in longer documents (Privacy). */
.prose h2 {
    margin: 2.4em 0 0.9em;
    font-size: 0.78em;
    font-weight: 400;
    letter-spacing: 0.26em;
    text-transform: uppercase;
    color: var(--ink-soft);
}

.prose ul {
    margin: 1em 0 1.2em;
    padding-left: 1.2em;
}
.prose li + li { margin-top: 0.4em; }
.prose li::marker { color: var(--aurora-deep); }

.prose a {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px solid rgba(77, 255, 162, 0.45);
    transition: border-color 0.3s ease;
}
.prose a:hover,
.prose a:focus-visible { border-color: var(--aurora); }
.prose a:focus-visible {
    outline: 2px solid var(--aurora);
    outline-offset: 3px;
}

.prose .meta {
    margin-top: 0.6em;
    font-size: 0.8em;
    letter-spacing: 0.06em;
    color: var(--ink-muted);
}

.prose .lead {
    font-size: 1.4em;
    font-style: italic;
    line-height: 1.45;
    color: #ffffff;
    text-shadow:
        0 0 30px rgba(77, 255, 162, 0.32),
        0 2px 18px rgba(0, 0, 0, 0.6);
}

/* ---------- Site footer ----------------------------------------- */

.site-footer {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.2rem;
    padding: 2.5rem 16px max(2rem, env(safe-area-inset-bottom));
    text-align: center;
}

/* Homepage: the footer sits a full screen below the verse. */
.site-footer--reveal {
    min-height: 45vh;
    justify-content: center;
}

.site-footer .rule {
    display: block;
    width: clamp(3rem, 10vw, 6rem);
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--ink-muted), transparent);
    opacity: 0.7;
}

.site-nav ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.2rem clamp(1.2rem, 3.5vw, 2.4rem);
}

.site-nav a {
    display: inline-block;
    padding: 0.8rem 0 0.8rem 0.3em; /* left pad balances the trailing letter-spacing */
    font-size: clamp(0.78rem, 1.4vw, 0.9rem);
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--ink-soft);
    text-decoration: none;
    text-shadow: 0 1px 10px rgba(0, 0, 0, 0.7);
    transition: color 0.3s ease, text-shadow 0.3s ease;
}
.site-nav a:hover,
.site-nav a:focus-visible {
    color: #ffffff;
    text-shadow: 0 0 18px rgba(77, 255, 162, 0.55), 0 1px 10px rgba(0, 0, 0, 0.7);
}
.site-nav a:focus-visible {
    outline: 2px solid var(--aurora);
    outline-offset: 2px;
}
.site-nav a[aria-current="page"] { color: var(--aurora); }

.colophon {
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    color: var(--ink-muted);
}
.colophon a {
    display: inline-block;
    padding: 0.6rem 0.2rem;
    color: inherit;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: color 0.3s ease;
}
.colophon a:hover,
.colophon a:focus-visible { color: var(--ink); }
.colophon a:focus-visible {
    outline: 2px solid var(--aurora);
    outline-offset: 2px;
}
.colophon a[aria-current="page"] { color: #ffffff; }

/* Scroll reveal. reveal.js adds .is-armed only when it can also add
   .is-revealed, so without it the footer is simply visible. */
.site-footer.is-armed .rule,
.site-footer.is-armed .site-nav li,
.site-footer.is-armed .colophon {
    opacity: 0;
    transform: translate3d(0, 14px, 0);
    filter: blur(6px);
    transition:
        opacity 1.4s cubic-bezier(0.2, 0.7, 0.2, 1),
        transform 1.4s cubic-bezier(0.2, 0.7, 0.2, 1),
        filter 1.4s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.site-footer.is-revealed .rule,
.site-footer.is-revealed .site-nav li,
.site-footer.is-revealed .colophon,
.site-footer.is-armed:focus-within .rule,
.site-footer.is-armed:focus-within .site-nav li,
.site-footer.is-armed:focus-within .colophon {
    opacity: 1;
    transform: translate3d(0, 0, 0);
    filter: blur(0);
}
.site-footer .site-nav li:nth-child(1) { transition-delay: 0.15s; }
.site-footer .site-nav li:nth-child(2) { transition-delay: 0.27s; }
.site-footer .site-nav li:nth-child(3) { transition-delay: 0.39s; }
.site-footer .site-nav li:nth-child(4) { transition-delay: 0.51s; }
.site-footer .site-nav li:nth-child(5) { transition-delay: 0.63s; }
.site-footer .site-nav li:nth-child(6) { transition-delay: 0.75s; }
.site-footer .colophon { transition-delay: 0.95s; }

@media (prefers-reduced-motion: reduce) {
    .prose { animation: none; }
}

/* ---------- Links (404 page) ------------------------------------ */

.line a {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px solid rgba(77, 255, 162, 0.45);
    transition: border-color 0.3s ease;
}
.line a:hover,
.line a:focus-visible {
    border-color: var(--aurora);
    outline: none;
}
.line a:focus-visible {
    outline: 2px solid var(--aurora);
    outline-offset: 6px;
}
