/* ---- Theme tokens --------------------------------------------------- */
:root {
    --twilight: #0b1a3a;
    --sky-1: #3a6ea8;
    --sky-2: #9ec6e8;
    --sky-soft: #cfe3f5;
    --cream: #f6efdc;
    --cream-soft: #fbf6e8;
    --brass: #e0a96d;
    --copper: #b46a3d;
}

/* Body inherits sky so hero fades seamlessly into it. */
body {
    background: var(--sky-soft);
}

/* Honeypot — visually hidden but not display:none. */
.hp-field {
    position: absolute;
    left: -10000px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* ---- Hero ----------------------------------------------------------- */

.hero {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    min-height: 90vh;
    padding-bottom: 4rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ---- Cogs --------------------------------------------------------- */

.cog {
    display: inline-block;
    width: 1.1em;
    height: 1.1em;
    color: currentColor;
    animation: spin 8s linear infinite;
    transform-origin: 50% 50%;
    flex-shrink: 0;
}
.cog-sm { width: 0.95em; height: 0.95em; }
.cog-reverse { animation: spin-reverse 8s linear infinite; }

@keyframes spin         { to { transform: rotate(360deg); } }
@keyframes spin-reverse { to { transform: rotate(-360deg); } }

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

/* ---- Countdown ---------------------------------------------------- */

/* One unified pill-card holding label + cells + date, with a big watermark
   cog spinning in the background. */
.countdown {
    position: relative;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 0.65rem;
    padding: 0.85rem 1.5rem 1rem;
    border-radius: 1.5rem;
    background: rgba(11, 26, 58, 0.32);
    backdrop-filter: blur(12px) saturate(120%);
    -webkit-backdrop-filter: blur(12px) saturate(120%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.08) inset,
        0 22px 50px -25px rgba(11, 26, 58, 0.6);
    overflow: hidden;
}

.cog-watermark {
    position: absolute;
    right: -28px;
    bottom: -28px;
    width: 130px;
    height: 130px;
    color: rgba(224, 169, 109, 0.18);
    animation: spin 18s linear infinite;
    z-index: 0;
    pointer-events: none;
}

.countdown-label {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--brass);
    font-weight: 700;
    letter-spacing: 0.22em;
    font-size: 0.7rem;
    text-transform: uppercase;
    text-shadow: 0 1px 2px rgba(11, 26, 58, 0.55);
}

.countdown-grid {
    position: relative;
    z-index: 1;
    display: inline-flex;
    gap: 0.5rem;
}

.countdown-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 4.4rem;
    padding: 0.6rem 0.75rem 0.5rem;
    background: linear-gradient(180deg, rgba(246, 239, 220, 0.98) 0%, rgba(246, 239, 220, 0.88) 100%);
    border: 1px solid rgba(180, 106, 61, 0.35);
    border-radius: 0.85rem;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.9) inset,
        0 -2px 0 rgba(180, 106, 61, 0.15) inset,
        0 10px 20px -12px rgba(11, 26, 58, 0.6);
    transition: transform 220ms ease;
}

.countdown-num {
    display: block;
    font-family: 'Unbounded', system-ui, sans-serif;
    font-weight: 700;
    font-size: 1.75rem;
    line-height: 1;
    color: var(--copper);
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.countdown-unit {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.58rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: rgba(11, 26, 58, 0.65);
    font-weight: 600;
}

/* Seconds pulse on every tick. */
.countdown-cell[data-unit="secs"].tick {
    animation: tick-pulse 600ms ease-out;
}
@keyframes tick-pulse {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.09); }
    100% { transform: scale(1); }
}

.countdown-date {
    position: relative;
    z-index: 1;
    color: var(--cream);
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    text-shadow: 0 1px 2px rgba(11, 26, 58, 0.7);
}

.countdown.is-live .countdown-num { color: #1f7a44; }

@media (prefers-reduced-motion: reduce) {
    .countdown-cell[data-unit="secs"].tick { animation: none; }
    .cog-watermark { animation: none; }
}

/* ------------------------------------------------------------------- */

/* Soft blurred backdrop behind the hero headline + subtitle. Keeps cream copy
   readable over the busy cloud texture without looking like a hard card. */
.hero-copy {
    display: block;
    width: fit-content;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
    padding: 1.25rem 2rem 1.5rem;
    border-radius: 1.75rem;
    background:
        radial-gradient(
            ellipse at center,
            rgba(11, 26, 58, 0.55) 0%,
            rgba(11, 26, 58, 0.35) 55%,
            rgba(11, 26, 58, 0.15) 100%
        );
    backdrop-filter: blur(10px) saturate(120%);
    -webkit-backdrop-filter: blur(10px) saturate(120%);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.08) inset,
        0 30px 60px -30px rgba(11, 26, 58, 0.55);
}

.hero-title {
    text-shadow:
        0 2px 0 rgba(11, 26, 58, 0.55),
        0 6px 20px rgba(11, 26, 58, 0.7);
}
.hero-sub {
    text-shadow:
        0 1px 2px rgba(11, 26, 58, 0.8),
        0 2px 14px rgba(11, 26, 58, 0.55);
}

/* Minecraft cloud photo on top, soft tint over it, and a long fade
   into the page background so there's no hard seam at the bottom. */
.sky-backdrop {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(
            180deg,
            rgba(11, 26, 58, 0.45) 0%,
            rgba(58, 110, 168, 0.10) 22%,
            rgba(207, 227, 245, 0.00) 55%,
            rgba(207, 227, 245, 0.55) 82%,
            var(--sky-soft) 100%
        ),
        url('/images/sky.jpg');
    background-size: cover, cover;
    background-position: center top, center center;
    background-repeat: no-repeat, no-repeat;
    image-rendering: pixelated;
    z-index: 0;
}

/* Puffy drifting clouds on top of the backdrop. */
.clouds {
    position: absolute;
    inset: 0;
    overflow: hidden;
    z-index: 1;
    pointer-events: none;
}
.cloud {
    position: absolute;
    background: radial-gradient(ellipse at center,
        rgba(255, 255, 255, 0.9) 0%,
        rgba(255, 255, 255, 0) 70%);
    border-radius: 50%;
    filter: blur(6px);
    opacity: 0.75;
}
.cloud { will-change: transform; transition: transform 80ms linear; }
.cloud-a { width: 420px; height: 140px; top: 18%; left: -220px; animation: drift 70s linear infinite; }
.cloud-b { width: 320px; height: 110px; top: 52%; left: -260px; animation: drift 95s linear infinite; animation-delay: -30s; }
.cloud-c { width: 520px; height: 170px; top: 80%; left: -340px; animation: drift 120s linear infinite; animation-delay: -60s; opacity: 0.55; }

@keyframes drift {
    from { transform: translateX(0); }
    to   { transform: translateX(135vw); }
}

/* Airship illustration.
   The bobbing animation is applied to a wrapper-inner idea via a CSS variable
   so JS can stack a scroll-driven transform on top without fighting the keyframe. */
.hero-airship {
    display: block;
    margin: 2rem auto -2rem;
    width: min(620px, 88%);
    height: auto;
    filter: drop-shadow(0 28px 40px rgba(11, 26, 58, 0.35));
    will-change: transform, opacity;
    /* Initial state: parked off-screen right, nose-down a touch, invisible. */
    transform: translateX(80vw) rotate(-6deg) scale(0.6);
    opacity: 0;
    transition: transform 1.6s cubic-bezier(.22,.61,.36,1),
                opacity 900ms ease-out;
    /* Idle bob uses `translate` (independent from `transform`) so scroll JS
       can stack an inline transform on top without killing it. */
    animation: bob 6s ease-in-out 2s infinite;
}

/* Landed: the entrance transition animates into this state. */
.hero-airship.is-landed {
    transform: none;
    opacity: 1;
}

/* Once scroll has taken over, we want snappy updates rather than a 1.6s lag. */
.hero-airship.is-scrolling {
    transition: transform 80ms linear, opacity 120ms linear;
}

@keyframes bob {
    0%, 100% { translate: 0 0; }
    50%      { translate: 0 -14px; }
}

@media (prefers-reduced-motion: reduce) {
    .cloud, .hero-airship { animation: none; }
    .reveal { opacity: 1 !important; transform: none !important; }
}

/* ---- Reveal-on-scroll -------------------------------------------- */

.reveal {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 700ms cubic-bezier(.22,.61,.36,1),
                transform 700ms cubic-bezier(.22,.61,.36,1);
}
.reveal.is-visible {
    opacity: 1;
    transform: none;
}
.reveal.delay-1 { transition-delay: 120ms; }
.reveal.delay-2 { transition-delay: 240ms; }
.reveal.delay-3 { transition-delay: 360ms; }

/* ---- Sections ------------------------------------------------------- */

.section {
    position: relative;
    z-index: 2;
}

/* Soft cream panel used for blocks that sit over the sky-tinted body. */
.panel {
    background: var(--cream-soft);
    border-radius: 1.75rem;
    padding: 2rem 1.75rem;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.6) inset,
        0 18px 40px -20px rgba(11, 26, 58, 0.25);
}

@media (min-width: 640px) {
    .panel { padding: 2.5rem; }
}

/* Form card — the richer variant used around the application form. */
.form-card {
    position: relative;
    background:
        linear-gradient(180deg, #ffffff 0%, var(--cream-soft) 100%);
    border-radius: 1.75rem;
    padding: 2rem 1.75rem;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.9) inset,
        0 1px 0 rgba(224, 169, 109, 0.25),
        0 30px 60px -25px rgba(11, 26, 58, 0.45),
        0 10px 25px -15px rgba(11, 26, 58, 0.3);
    overflow: hidden;
}
.form-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 4px;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(224, 169, 109, 0.7) 20%,
        rgba(180, 106, 61, 0.9) 50%,
        rgba(224, 169, 109, 0.7) 80%,
        transparent 100%);
}
.form-card::after {
    content: "";
    position: absolute;
    right: -60px;
    bottom: -60px;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(224, 169, 109, 0.18), transparent 65%);
    pointer-events: none;
}

@media (min-width: 640px) {
    .form-card { padding: 2.75rem; }
}

/* Callout used for the "only rule of movement" line. */
.callout {
    background: linear-gradient(135deg, rgba(224, 169, 109, 0.18), rgba(180, 106, 61, 0.08));
    border: 1px solid rgba(224, 169, 109, 0.35);
    border-radius: 1.25rem;
    padding: 1.25rem 1.5rem;
}

/* ---- Form ----------------------------------------------------------- */

.form-input {
    width: 100%;
    padding: 0.7rem 0.95rem;
    border-radius: 0.85rem;
    border: 1px solid rgba(11, 26, 58, 0.18);
    background: #ffffff;
    color: var(--twilight);
    font-size: 1rem;
    line-height: 1.4;
    transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}
.form-input::placeholder { color: rgba(11, 26, 58, 0.45); }
.form-input:hover { border-color: rgba(11, 26, 58, 0.3); }
.form-input:focus {
    outline: none;
    border-color: var(--brass);
    box-shadow: 0 0 0 3px rgba(224, 169, 109, 0.35);
}

textarea.form-input { resize: vertical; min-height: 7rem; }

/* Age bracket radio chips. */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1.1rem;
    border-radius: 999px;
    border: 1px solid rgba(11, 26, 58, 0.15);
    background: #fff;
    cursor: pointer;
    font-size: 0.9rem;
    user-select: none;
    transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}
.chip input { accent-color: var(--brass); }
.chip:hover { border-color: var(--brass); transform: translateY(-1px); }
.chip:has(input:checked) {
    background: #fdf2e0;
    border-color: var(--brass);
    box-shadow: 0 0 0 3px rgba(224, 169, 109, 0.25);
}

/* Primary button polish — arrow nudges on hover. */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.9rem 2.1rem;
    background: linear-gradient(180deg, #e9b880 0%, var(--brass) 50%, #d69855 100%);
    color: var(--twilight);
    font-weight: 600;
    border-radius: 1rem;
    border: 1px solid rgba(180, 106, 61, 0.45);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.55) inset,
        0 -2px 0 rgba(180, 106, 61, 0.35) inset,
        0 10px 25px -10px rgba(180, 106, 61, 0.7),
        0 4px 10px -4px rgba(11, 26, 58, 0.25);
    transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
    cursor: pointer;
}
.btn-primary:hover {
    transform: translateY(-2px);
    filter: brightness(1.05);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.6) inset,
        0 -2px 0 rgba(180, 106, 61, 0.4) inset,
        0 16px 32px -10px rgba(180, 106, 61, 0.8),
        0 6px 14px -4px rgba(11, 26, 58, 0.3);
}
.btn-primary:active { transform: translateY(0); filter: brightness(0.98); }
.btn-primary:focus-visible {
    outline: none;
    box-shadow:
        0 0 0 3px rgba(224, 169, 109, 0.5),
        0 10px 25px -10px rgba(180, 106, 61, 0.7);
}
.btn-primary .arrow {
    display: inline-block;
    transition: transform 160ms ease;
}
.btn-primary:hover .arrow { transform: translateX(4px); }
