:root {
    --ink: #2C2519;
    --ink-deep: #1B1610;
    --cream: #F7F2EA;
    --cream-dark: #EDE6D6;
    --terracotta: #C1674A;
    --terracotta-lt: #D4846A;
    --terracotta-dk: #A0503A;
    --sage: #7A9E87;
    --sage-lt: #A8C5B0;
    --muted-on-dark: #A89C8E;
    --font-logo: Arial, "Helvetica Neue", Helvetica, "Liberation Sans", sans-serif;
    --font-body: "Cormorant Garamond", Garamond, "Times New Roman", serif;
    --font-ui: "DM Sans", system-ui, sans-serif;
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --gutter: clamp(16px, 4vw, 48px);
    --lit: 1;
}

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

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-size-adjust: 100%;
}

body {
    min-height: 100vh;
    min-height: 100svh;
    background: var(--ink-deep);
    color: var(--cream);
    font-family: var(--font-body);
    font-size: 1.125rem;
    line-height: 1.6;
    overflow-x: hidden;
    touch-action: manipulation;
}

a {
    color: var(--cream);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.22em;
    text-decoration-color: rgba(212, 132, 106, 0.6);
    transition: text-decoration-color 0.3s, color 0.3s;
}
a:hover { text-decoration-color: var(--terracotta-lt); }
a:focus-visible {
    outline: 2px solid var(--terracotta-lt);
    outline-offset: 4px;
    border-radius: 2px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

.scene {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    pointer-events: none;
    z-index: 0;
}

.page {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    min-height: 100svh;
    display: flex;
    flex-direction: column;
    padding: 0 var(--gutter);
    padding-left: max(var(--gutter), env(safe-area-inset-left));
    padding-right: max(var(--gutter), env(safe-area-inset-right));
}

.hero {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: clamp(24px, 5vh, 64px) 0 clamp(16px, 3vh, 40px);
}

.wordmark {
    position: relative;
    font-family: var(--font-logo);
    font-style: italic;
    font-weight: 700;
    letter-spacing: -0.03em;
    font-size: clamp(5.25rem, min(34vw, 30vh), 20rem);
    line-height: 1;
    padding-top: 0.44em;
    margin-bottom: -0.06em;
    user-select: none;
}

.wordmark__text {
    display: inline-block;
    color: var(--cream-dark);
}
html.js .wordmark__text { color: transparent; }

html:not(.js) .countdown__units { display: none; }

.message {
    margin-top: clamp(1rem, 3.2vh, 2.5rem);
    max-width: 40rem;
}

.message__title {
    font-family: var(--font-body);
    font-style: italic;
    font-weight: 400;
    font-size: clamp(1.625rem, 1.05rem + 2.3vw, 2.75rem);
    line-height: 1.12;
    letter-spacing: -0.005em;
    text-wrap: balance;
}

.message__text {
    margin: 0.75rem auto 0;
    max-width: min(24em, 86%);
    text-align: center;
    text-wrap: balance;
    font-size: clamp(1.125rem, 1.02rem + 0.35vw, 1.3125rem);
    line-height: 1.6;
    color: rgba(247, 242, 234, 0.74);
    text-wrap: pretty;
}

.countdown {
    margin-top: clamp(1.75rem, 5vh, 3.25rem);
}

.countdown__units {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(4, clamp(4.25rem, 19vw, 7.25rem));
    justify-content: center;
    column-gap: clamp(0rem, 1.6vw, 1.25rem);
}

.countdown__unit {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.countdown__num {
    display: inline-flex;
    min-height: 1.16em;
    font-family: var(--font-body);
    font-weight: 300;
    font-size: clamp(2.5rem, 1.5rem + 4vw, 4.75rem);
    line-height: 1;
    font-variant-numeric: lining-nums tabular-nums;
    font-feature-settings: "lnum" 1, "tnum" 1;
    color: var(--cream);
}

.cd-slot {
    position: relative;
    display: block;
    overflow: hidden;
    padding: 0.08em 0;
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 18%, #000 82%, transparent 100%);
    mask-image: linear-gradient(to bottom, transparent 0, #000 18%, #000 82%, transparent 100%);
}
.cd-digit {
    display: block;
    will-change: transform;
}
.cd-digit.is-leaving {
    position: absolute;
    top: 0.08em;
    left: 0;
    right: 0;
}

.countdown__label {
    margin-top: 0.55rem;
    font-family: var(--font-ui);
    font-weight: 300;
    font-size: 0.8125rem;
    letter-spacing: 0.04em;
    color: var(--muted-on-dark);
}

.countdown__date {
    margin-top: clamp(1rem, 2.6vh, 1.6rem);
    font-style: italic;
    font-size: 1.0625rem;
    color: rgba(247, 242, 234, 0.62);
}

.countdown__done {
    font-style: italic;
    font-size: clamp(1.25rem, 1rem + 1vw, 1.625rem);
}

@media (max-height: 760px) {
    .hero { padding-top: clamp(12px, 3vh, 32px); }
    .wordmark { font-size: clamp(4.5rem, min(34vw, 26vh), 20rem); }
    .message { margin-top: 2vh; }
    .message__title { font-size: clamp(1.5rem, 0.9rem + 2vw, 2.25rem); }
    .message__text { margin-top: 0.4rem; font-size: 1.0625rem; }
    .countdown { margin-top: 3.2vh; }
    .countdown__num { font-size: clamp(2.25rem, 7.5vh, 3.75rem); }
    .countdown__label { margin-top: 0.3rem; }
    .countdown__date { margin-top: 1.6vh; }
    .footer { padding-top: 0.75rem; }
}

.footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.35rem 1.5rem;
    padding: 1.25rem 0 max(1.25rem, env(safe-area-inset-bottom));
    font-family: var(--font-ui);
    font-weight: 300;
    font-size: 0.8125rem;
    letter-spacing: 0.02em;
    color: var(--muted-on-dark);
}

@media (max-width: 560px) {
    .footer {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
}

html.is-3d .message,
html.is-3d .countdown > *,
html.is-3d .footer > * {
    opacity: calc(0.8 + 0.2 * var(--lit));
}

html.js [data-reveal] {
    opacity: 0;
    filter: blur(10px);
}

html.is-playing [data-reveal] {
    opacity: 1;
    filter: blur(0);
    transition:
        opacity 1.6s var(--ease-out),
        filter 1.8s var(--ease-out);
    transition-delay: calc(3.3s + var(--d) * 0.38s);
}

html.no-3d [data-reveal] {
    opacity: 1;
    filter: blur(0);
    transition: opacity 1.2s var(--ease-out), filter 1.4s var(--ease-out);
    transition-delay: calc(0.35s + var(--d) * 0.15s);
}

html.no-3d body {
    background:
        radial-gradient(ellipse 60% 55% at 50% 30%, rgba(193, 103, 74, 0.22), transparent 70%),
        radial-gradient(ellipse 120% 90% at 50% 20%, var(--ink) 0%, var(--ink-deep) 60%, #121411 100%);
    background-attachment: fixed;
}

html.no-3d .wordmark__text {
    color: var(--cream-dark);
    text-shadow:
        0 0 0.08em rgba(212, 132, 106, 0.35),
        0 0 0.6em rgba(193, 103, 74, 0.25);
    animation: wordmark-in 1.4s var(--ease-out) both;
}

html.no-3d .wordmark::before,
html.no-3d .wordmark::after {
    content: "";
    position: absolute;
    left: var(--flame-x, 30%);
    top: var(--flame-y, 20%);
    pointer-events: none;
}
html.no-3d .wordmark::before {
    width: 0.9em;
    height: 0.9em;
    transform: translate(-50%, -62%);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 214, 160, 0.35), rgba(193, 103, 74, 0.12) 45%, transparent 70%);
    animation: halo-flicker 3.1s ease-in-out infinite;
}
html.no-3d .wordmark::after {
    width: 0.13em;
    height: 0.4em;
    transform: translate(-50%, -100%);
    border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%;
    background: radial-gradient(ellipse 60% 70% at 50% 72%, #FFF7E8 0%, #FFD9A0 35%, #E8905A 70%, rgba(193, 103, 74, 0) 100%);
    transform-origin: 50% 100%;
    animation: flame-sway 2.3s ease-in-out infinite;
}

@keyframes wordmark-in {
    from { opacity: 0; filter: blur(12px); }
    to { opacity: 1; filter: blur(0); }
}
@keyframes flame-sway {
    0%, 100% { transform: translate(-50%, -100%) rotate(-2deg) scaleY(1); }
    35% { transform: translate(-50%, -100%) rotate(2.5deg) scaleY(1.06); }
    70% { transform: translate(-50%, -100%) rotate(-1deg) scaleY(0.96); }
}
@keyframes halo-flicker {
    0%, 100% { opacity: 0.9; }
    45% { opacity: 1; }
    60% { opacity: 0.8; }
}

@media (prefers-reduced-motion: reduce) {
    html.js [data-reveal],
    html.is-playing [data-reveal],
    html.no-3d [data-reveal] {
        opacity: 1;
        filter: none;
        transition: none;
    }
    html.no-3d .wordmark__text,
    html.no-3d .wordmark::before,
    html.no-3d .wordmark::after { animation: none; }
}