[hidden] {
    display: none !important;
}

:root {
    --font-display: "Playfair Display", Georgia, "Times New Roman", serif;
    --font-body:
        "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --text-xs: 0.8125rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-md: 1.125rem;
    --text-lg: 1.25rem;
    --text-xl: 1.5rem;
    --text-2xl: 1.875rem;
    --text-3xl: 2.25rem;
    --text-4xl: 2.5rem;
    --leading-tight: 1.15;
    --leading-snug: 1.35;
    --leading-control: 1.4;
    --leading-body: 1.6;
    --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
    --radius: 6px;
    --space-tight: 8px;
    --space-snug: 14px;
    --space: 20px;
    --space-loose: 32px;

    --paper: #fefcfa;
    --card: #fefcfa;
    --ink: #201408;
    --muted: #786040;
    --accent: #b8903a;
    --card-border: #f0e0c8;
    --shadow: rgba(32, 20, 8, 0.14);
    --accent-text: #90702d;
    --on-accent: #201408;
    --intro-ink: #201408;
    --placeholder: #867054;
}

[data-theme="pichcha"] {
    --paper: #fefcfa;
    --card: #fefcfa;
    --ink: #201408;
    --muted: #786040;
    --accent: #b8903a;
    --accent-text: #90702d;
    --card-border: #f0e0c8;
    --shadow: rgba(32, 20, 8, 0.14);

    --intro-ink: #201408;

    --on-accent: #201408;
    --placeholder: #867054;
}

[data-theme="nil-manel"] {
    --paper: #f5f4ff;
    --card: #f5f4ff;
    --ink: #180a30;
    --muted: #5848a0;
    --accent: #7060c0;
    --accent-text: #7060c0;
    --card-border: #c8bce8;
    --shadow: rgba(24, 10, 48, 0.13);

    --intro-ink: #180a30;

    --on-accent: #ffffff;
    --placeholder: #7264b0;
}

[data-theme="binara"] {
    --paper: #f2f4ff;
    --card: #f2f4ff;
    --ink: #080a28;
    --muted: #484890;
    --accent: #3848d0;
    --accent-text: #3848d0;
    --card-border: #b0b8f0;
    --shadow: rgba(8, 10, 40, 0.13);

    --intro-ink: #080a28;

    --on-accent: #ffffff;
    --placeholder: #6969a5;
}

[data-theme="nelum"] {
    --paper: #fff5f8;
    --card: #fff5f8;
    --ink: #300018;
    --muted: #904060;
    --accent: #d45080;
    --accent-text: #bd4772;
    --card-border: #f0b8cc;
    --shadow: rgba(48, 0, 24, 0.14);

    --intro-ink: #300018;

    --on-accent: #240014;
    --placeholder: #a05b77;
}

[data-theme="erabudu"] {
    --paper: #fff8f4;
    --card: #fff8f4;
    --ink: #280e00;
    --muted: #885030;
    --accent: #d05820;
    --accent-text: #bf511d;
    --card-border: #f0c8a8;
    --shadow: rgba(40, 14, 0, 0.14);

    --intro-ink: #280e00;

    --on-accent: #1f0a00;
    --placeholder: #98664a;
}

* {
    box-sizing: border-box;
}

html {
    /* The page canvas shows behind the intro on iOS Safari, where the browser bars
       sit outside the fixed intro. Matching the theme keeps those edges the same colour. */
    background: var(--paper);
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    min-height: 100vh;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: var(--text-base);
    line-height: var(--leading-body);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

.is-preview {
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
}

.is-preview:hover,
.is-preview:focus-within {
    scrollbar-color: auto;
}

.is-preview::-webkit-scrollbar {
    width: 4px;
}

.is-preview::-webkit-scrollbar-thumb {
    border-radius: 2px;
}

.hidden {
    display: none !important;
}

.eyebrow {
    margin: 0;
    font-size: var(--text-xs);
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}

.ornament {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--accent-text, var(--accent));
}

.ornament::before,
.ornament::after {
    content: "";
    width: 44px;
    height: 1px;
    background: currentColor;
    opacity: 0.45;
}
.ornament-mark {
    display: block;
    width: 20px;
    height: 20px;
}
.intro {
    position: fixed;
    inset: 0;
    z-index: 2;
    display: grid;
    place-items: center;
    padding: 32px 20px;
    background: var(--paper);
    cursor: pointer;

    overflow: hidden;
}

.intro-stage {
    display: grid;
    place-items: center;
    /* No ch cap. The stage used to be 30ch, which was a guess dressed up as a
     measurement: one ch in Playfair is 0.565em, so 30ch was 17em of width, wider
     than any phone, which made min() always collapse to 100% anyway. The type is
     now sized in vw against this box, so the box is simply as wide as the
     viewport allows and the rem cap only stops the line running the full width of
     a desktop window. */
    width: min(100%, 36rem);
    min-height: 44vh;
    text-align: center;
}

.intro-line {
    grid-area: 1 / 1;
    margin: 0;
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 400;
    /* 9.1vw against 9.6em of copy is the largest size that still fits one line on a
     320px-wide screen with the padding below: 0.091 * 320 * 9.6 = 280px, exactly
     what is left after 20px of padding each side. Raising the coefficient or the
     copy budget past that and the longest lines wrap, and a wrapped line is a
     different height, which makes the block jump between sets. The rem ends stop
     it getting silly on a large phone or a desktop. */
    font-size: clamp(1.75rem, 9.1vw, 2.9rem);
    line-height: var(--leading-snug);
    color: var(--intro-ink);

    opacity: 0;
    text-wrap: balance;
}

/* The names are the point of the whole opener, so they are the one line that
   gets weight. Playfair only ships 400/500 in italic by default, so the 600 in
   the font URL is what stops this being faked by the browser's synthetic
   emboldening, which smears the thin strokes at this size. */
.intro-line-3 {
    font-weight: 600;
    letter-spacing: -0.01em;
}

/* Only a real name gets name size. The three fallback sets, which run before the
   couple has typed theirs, put a short phrase in this slot instead, and a phrase
   at 14vw runs straight off both edges. A very long pair of names wraps to two
   balanced lines rather than shrinking, which is the right failure: the name is
   still the biggest thing on screen. */
.intro.has-names .intro-line-3 {
    font-size: clamp(2.5rem, 14vw, 4.4rem);
}

/* Lines 1, 2 and 4 are 0.6s fading in, 1.2s held, 0.5s fading out, then a 0.2s
   gap before the next, so each starts 2.5s after the last. The stops are that
   recipe as percentages of the 2.3s run: 26% is the end of the fade in, 78% the
   end of the hold. The drift up on the way out is what keeps the exit from
   looking like the entrance played backwards. */
@keyframes intro-line {
    0% {
        opacity: 0;
        transform: translateY(14px);
    }
    26%,
    78% {
        opacity: 1;
        transform: none;
    }
    100% {
        opacity: 0;
        transform: translateY(-10px);
    }
}

/* Every line runs the same animation for the same 2.3s. The names get 3.8s
   instead, because they are the one line a guest actually has to read rather
   than recognize, and 1.5s of extra hold is what makes that readable. The extra
   time is paid for by pushing line 4 out to 9.3s, which keeps the 0.2s gap
   between one line finishing and the next starting the same everywhere. */
.is-playing .intro-line-1 {
    animation: intro-line 2.3s var(--ease-out) 0.3s both;
}
.is-playing .intro-line-2 {
    animation: intro-line 2.3s var(--ease-out) 2.8s both;
}
.is-playing .intro-line-3 {
    animation: intro-line 3.8s var(--ease-out) 5.3s both;
}
.is-playing .intro-line-4 {
    animation: intro-line 2.3s var(--ease-out) 9.3s both;
}

.is-open .invite-card {
    animation: card-in 0.7s var(--ease-out) forwards;
}

.is-reset .intro,
.is-reset .intro-line,
.is-reset .invite-card {
    animation: none !important;
}

.is-skipped .intro,
.is-skipped .intro-line,
.is-skipped .invite-card {
    animation-duration: 1ms !important;
    animation-delay: 0ms !important;
}

.invite-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 16px;
    gap: 20px;
}

.invite-card {
    width: 100%;
    max-width: 540px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-snug);
    padding: var(--space-loose) 28px;
    background-color: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    box-shadow: 0 24px 60px -34px var(--shadow);
    text-align: center;
    opacity: 0;
    position: relative;
    isolation: isolate;
}
.card-pattern {
    display: none;
}
[data-theme="pichcha"] .card-pattern,
[data-theme="nil-manel"] .card-pattern,
[data-theme="binara"] .card-pattern,
[data-theme="nelum"] .card-pattern,
[data-theme="erabudu"] .card-pattern,
[data-theme="kohomba"] .card-pattern,
[data-theme="lily"] .card-pattern,
[data-theme="rosamal"] .card-pattern {
    display: flex;
    position: absolute;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    container-type: size;
    border-radius: inherit;
    pointer-events: none;
}
.card-pattern {
    background-repeat: repeat-y;
    background-position: center top;
    background-size: 100% auto;
}
[data-theme="pichcha"] .card-pattern {
    background-image: url("/flowers/covers/pichcha.webp");
}
[data-theme="nil-manel"] .card-pattern {
    background-image: url("/flowers/covers/nil-manel.webp");
}
[data-theme="binara"] .card-pattern {
    background-image: url("/flowers/covers/binara.webp");
}
[data-theme="nelum"] .card-pattern {
    background-image: url("/flowers/covers/nelum.webp");
}
[data-theme="erabudu"] .card-pattern {
    background-image: url("/flowers/covers/erabudu.webp");
}
[data-theme="kohomba"] .card-pattern {
    background-image: url("/flowers/covers/kohomba.webp");
}
[data-theme="lily"] .card-pattern {
    background-image: url("/flowers/covers/lily.webp");
}
[data-theme="rosamal"] .card-pattern {
    background-image: url("/flowers/covers/rosamal.webp");
}
.is-preview-immediate .invite-card {
    animation: none;
    opacity: 1;
}

.countdown-wrap {
    width: 100%;
}

@keyframes card-in {
    from {
        opacity: 0;
        transform: translateY(18px) scale(0.985);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

.greeting {
    margin: 0;
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    font-style: italic;
    color: var(--accent-text, var(--accent));
    line-height: 1.2;
}

.invitation-note {
    margin: 0;
    max-width: 34ch;
    font-size: var(--text-sm);
    line-height: 1.7;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.couple {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: 100%;
}

.couple-name {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 500;
    font-size: clamp(2.5rem, 11vw, 3.9rem);
    line-height: var(--leading-tight);
    letter-spacing: -0.015em;
    overflow-wrap: break-word;
    text-wrap: pretty;
}

.couple-amp {
    font-family: var(--font-display);
    font-size: var(--text-4xl);
    font-style: italic;
    color: var(--accent-text, var(--accent));
}

.wedding-date {
    margin: 0;
    font-family: var(--font-display);
    font-size: var(--text-xl);
    line-height: var(--leading-control);
}

.wedding-time {
    margin: 6px 0 0;
    font-size: var(--text-md);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}

.photo {
    width: 100%;
    max-width: 300px;
    aspect-ratio: 4 / 5;
    object-fit: cover;
    border-radius: var(--radius);
    border: 1px solid var(--card-border);
}

.venue-name {
    margin: 0;
    font-family: var(--font-display);
    font-size: var(--text-xl);
    line-height: var(--leading-snug);
}

.venue-address {
    display: block;
    margin: 0;
    font-size: var(--text-base);
    line-height: 1.7;
    color: var(--muted);
    white-space: pre-line;
    text-decoration: underline;
    text-decoration-color: var(--accent-text, var(--accent));
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

.venue-address:hover,
.venue-address:focus-visible {
    color: var(--ink);
}

.map-link {
    font-size: var(--text-xs);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent-text, var(--accent));
    text-decoration: none;
    border-bottom: 1px solid transparent;
    padding-bottom: 2px;
}

.map-link:hover,
.calendar-link:hover {
    border-bottom-color: currentColor;
}

.calendar-link {
    font-size: var(--text-xs);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent-text, var(--accent));
    text-decoration: none;
    border-bottom: 1px solid transparent;
    padding-bottom: 2px;
    margin-top: var(--space-tight);
}

.countdown {
    display: flex;
    align-items: stretch;
    justify-content: center;
    gap: var(--space-tight);
    width: 100%;
    padding: var(--space-snug) 0 2px;
    border-top: 1px solid var(--card-border);
}

.countdown-unit {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.countdown-value {
    display: inline-block;
    font-family: var(--font-display);
    font-size: clamp(1.7rem, 7vw, 2.3rem);
    line-height: 1.1;
    color: var(--accent-text, var(--accent));
    font-variant-numeric: tabular-nums;
    text-align: center;
}

#cdHours,
#cdMinutes,
#cdSeconds {
    min-width: 2ch;
}

#cdDays {
    min-width: 3ch;
}

.countdown-label {
    font-size: var(--text-xs);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}

.countdown-done {
    margin: 0;
    font-family: var(--font-display);
    font-style: italic;
    font-size: var(--text-lg);
    color: var(--accent-text, var(--accent));
}

.message {
    margin: 0;
    max-width: 40ch;
    font-family: var(--font-display);
    font-size: var(--text-md);
    font-style: italic;
    line-height: 1.75;
    white-space: pre-line;
}

.legal-links {
    width: 100%;
    margin: var(--space-snug) 0 0;
    padding: var(--space-snug) 0 2px;
    border-top: 1px solid var(--card-border);
    font-size: var(--text-xs);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    line-height: 1;
    padding-top: 25px;
}

.legal-links a {
    color: var(--muted);
    text-decoration: none;
}

.legal-links a:hover {
    color: var(--ink);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.legal-links a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 2px;
}

.state-screen {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    padding: 40px 24px;
    text-align: center;
}

.state-title {
    margin: 0;
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    font-weight: 500;
    color: var(--ink);
    text-wrap: balance;
}

.state-body {
    margin: 0;
    max-width: 32ch;
    font-size: var(--text-sm);
    line-height: 1.7;
    color: var(--muted);
    text-wrap: pretty;
}

.state-title:focus {
    outline: none;
}

.state-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 4px;
}

.state-action {
    padding: 11px 20px;
    font-family: var(--font-body);
    font-size: var(--text-sm);
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--on-accent, var(--card));
    background: var(--accent);
    border: 0;
    border-radius: var(--radius);
    cursor: pointer;
    transition: filter 0.15s ease;
}

.state-action:hover {
    filter: brightness(0.93);
}

.state-action:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

@media (min-width: 640px) {
    .invite-page {
        padding: 72px 24px 48px;
    }

    .invite-card {
        padding: 60px 48px 60px;
        gap: var(--space);
    }
}

@media (prefers-reduced-motion: reduce) {
    .intro,
    .intro-line,
    .is-open .invite-card {
        animation-duration: 1ms !important;
        animation-delay: 0ms !important;
        animation-play-state: running !important;
    }
}

[data-theme="kohomba"] {
    --paper: #f4f8f0;
    --card: #f4f8f0;
    --ink: #161e08;
    --muted: #607048;
    --accent: #6a7a38;
    --accent-text: #687837;
    --card-border: #c8d4a8;
    --shadow: rgba(22, 30, 8, 0.14);

    --intro-ink: #161e08;

    --on-accent: #ffffff;
    --placeholder: #66754f;
}

[data-theme="lily"] {
    --paper: #fefdf8;
    --card: #fefdf8;
    --ink: #201008;
    --muted: #8f6f4f;
    --accent: #c07840;
    --accent-text: #a36636;
    --card-border: #f0dfc0;
    --shadow: rgba(32, 16, 8, 0.14);

    --intro-ink: #201008;

    --on-accent: #201008;
    --placeholder: #8f6f4f;
}

[data-theme="rosamal"] {
    --paper: #fef8f5;
    --card: #fef8f5;
    --ink: #281008;
    --muted: #956859;
    --accent: #d08870;
    --accent-text: #9a6553;
    --card-border: #f0d0c0;
    --shadow: rgba(40, 16, 8, 0.14);

    --intro-ink: #281008;

    --on-accent: #281008;
    --placeholder: #956859;
}

.rsvp-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 0px;
}

.rsvp-label {
    font-size: var(--text-base);
    font-weight: 500;
    color: var(--ink);
    margin-top: 12px;
}

.rsvp-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    padding-top: 10px;
}

.rsvp-btn {
    flex: 1;
    min-width: 85px;
    padding: 12px 16px;
    font-family: var(--font-body);
    font-size: var(--text-sm);
    font-weight: 500;
    letter-spacing: 0.05em;
    border: 2px solid var(--accent);
    border-radius: var(--radius);
    background: transparent;
    color: var(--accent);
    cursor: pointer;
    transition: all 0.15s ease;
}

.rsvp-btn:hover:not(:disabled) {
    background: var(--accent);
    color: var(--on-accent);
}

.rsvp-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.rsvp-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.rsvp-status-text {
    font-size: var(--text-base);
    color: var(--accent);
    margin: 0;
    font-weight: 500;
}
