/* ==========================================================================
   Perseide - a summer night under the Perseids. Over a dark photo of the sky, shooting stars streak across now and then,
   sometimes a little shower of them (canvas.pe-sky, script.js); the names are written letter by letter, as if by hand,
   glowing like starlight. At a touch a bright star falls, for a wish. Titles write themselves over a line of starlight,
   portraits and story photos fade into the dark, the days left sit in turning rings of light, faint stars twinkle
   behind the page and the shooting stars return above the names at the end.
   Palette (dark): --inv-primary (the names, starlight), --inv-accent (the glow of the meteors), --inv-bg, --inv-text.
   ========================================================================== */

.perseide {
    --pe-glow: color-mix(in srgb, var(--inv-accent) 55%, transparent);
    --pe-line: color-mix(in srgb, var(--inv-primary) 22%, transparent);
    --pe-muted: color-mix(in srgb, var(--inv-text) 68%, var(--inv-bg));
    --pe-surface: color-mix(in srgb, var(--inv-accent) 7%, var(--inv-bg));
    --pe-band: linear-gradient(90deg, transparent, var(--inv-accent) 22%, color-mix(in srgb, var(--inv-accent) 40%, var(--inv-primary)) 50%, var(--inv-accent) 78%, transparent);
    --kit-radius: 4px;
    --kit-field-bg: color-mix(in srgb, var(--inv-text) 6%, transparent);
    --kit-field-border: var(--pe-line);
    font-family: var(--inv-font-body);
    font-weight: 300;
    font-size: 1.02rem;
    line-height: 1.85;
    letter-spacing: .01em;
    color: var(--inv-text);
    background: var(--inv-bg);
    overflow-x: clip;
}
.perseide h1, .perseide h2, .perseide h3 { font-family: var(--inv-font-heading); font-weight: 400; line-height: 1; }
:where(.perseide) :is(h1, h2, h3) { margin: 0; }
.perseide strong { font-weight: 600; }
.perseide a { color: var(--inv-primary); }
.pe-kicker { font-size: .72rem; letter-spacing: .3em; text-transform: uppercase; color: var(--pe-muted); margin: 0 0 10px; }
.pe-stars { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.perseide > header, .perseide > main, .perseide > footer { position: relative; z-index: 1; }

/* ---------- Handwriting ---------- */
.pe-word { display: inline-block; white-space: nowrap; }
.pe-letter { display: inline-block; white-space: pre; clip-path: inset(-20% 100% -30% -10%); opacity: 0; }
.pe-hero .pe-letter, .is-visible .pe-letter { animation: pe-write .5s calc(var(--i) * .11s + var(--pe-delay, 0s)) cubic-bezier(.5, 0, .3, 1) forwards; }
@keyframes pe-write {
    0% { clip-path: inset(-20% 100% -30% -10%); opacity: 0; filter: blur(3px); }
    30% { opacity: 1; }
    92% { clip-path: inset(-20% -30% -30% -10%); opacity: 1; filter: none; }
    /* once written, the mask opens far beyond the letter so its glow is never cut into a box */
    100% { clip-path: inset(-500% -500% -500% -500%); opacity: 1; filter: none; }
}
/* the line of starlight under the names and titles: drawn from left to right, then shimmering */
.pe-stroke { display: block; height: 2px; width: 180px; margin: 6px auto 0; background: var(--pe-band); background-size: 200% 100%; border-radius: 2px; box-shadow: 0 0 12px var(--pe-glow); clip-path: inset(0 100% 0 0); }
.is-visible .pe-stroke { animation: pe-underline 1.1s 1s ease-out forwards, pe-shimmer 6s 2s linear infinite; }
.pe-stroke--hero { width: min(420px, 70vw); animation: pe-underline 1.4s 2.6s ease-out forwards, pe-shimmer 6s 4s linear infinite; }
@keyframes pe-underline { to { clip-path: inset(0 0 0 0); } }
@keyframes pe-shimmer { from { background-position: 0% 0; } to { background-position: -200% 0; } }

/* ---------- The sky ---------- */
.pe-sky { position: absolute; left: 0; width: 100%; pointer-events: none; mix-blend-mode: screen; }
.pe-sky--hero { top: 0; height: 78%; z-index: -1; }
.pe-sky--footer { top: 0; height: 100%; z-index: -1; opacity: .85; }

/* ---------- Navigation ---------- */
.pe-nav { position: absolute; top: 0; left: 0; right: 0; z-index: 6; padding: 18px clamp(16px, 4vw, 44px); display: flex; align-items: center; justify-content: center; }
.pe-nav .kit-nav-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 22px; }
.pe-nav a { text-decoration: none; font-size: .74rem; letter-spacing: .2em; text-transform: uppercase; color: var(--pe-muted); padding: 4px 0; }
.pe-nav a:hover, .pe-nav a.is-current { color: var(--inv-primary); text-shadow: 0 0 10px var(--pe-glow); }
.pe-nav .kit-nav-brand { font-family: var(--inv-font-heading); font-size: 2.2rem; letter-spacing: 0; text-transform: none; color: var(--inv-primary); margin-right: auto; }
.pe-nav.is-stuck { padding: 8px clamp(16px, 4vw, 44px); justify-content: flex-end; background: color-mix(in srgb, var(--inv-bg) 90%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--pe-line); }
.perseide .kit-to-top { background: var(--inv-primary); color: var(--inv-bg); }
@media (max-width: 899px) {
    .pe-nav { justify-content: flex-end; padding: 10px 14px; }
    .pe-nav .kit-nav-toggle { margin-left: auto; font-size: 1.5rem; color: var(--inv-primary); }
    .pe-nav .kit-nav-links { display: none; }
    .pe-nav.is-open .kit-nav-links { display: flex; flex-direction: column; gap: 14px; position: absolute; top: 58px; left: 12px; right: 12px; padding: 24px; background: var(--inv-bg); border: 1px solid var(--pe-line); }
}

/* ---------- Hero ---------- */
.pe-hero { position: relative; min-height: 100svh; display: grid; place-items: center; padding: 100px 20px 80px; text-align: center; overflow: clip; isolation: isolate; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.pe-hero-photo { position: absolute; inset: 0; margin: 0; z-index: -3; }
.pe-hero-photo img { width: 100%; height: 100%; object-fit: cover; opacity: .74; filter: saturate(.9) contrast(1.05); }
.pe-hero::before { content: ""; position: absolute; inset: 0; z-index: -2; background: linear-gradient(180deg, color-mix(in srgb, var(--inv-bg) 55%, transparent), transparent 40%), radial-gradient(ellipse at 50% 55%, transparent 25%, var(--inv-bg) 88%); }
.pe-hero-content { position: relative; z-index: 1; max-width: 900px; }
/* a soft shade behind the text, so it reads on any photo */
.pe-hero-content::before { content: ""; position: absolute; inset: -12% -18%; z-index: -1; background: radial-gradient(ellipse 50% 50% at 50% 55%, color-mix(in srgb, var(--inv-bg) 62%, transparent), transparent 100%); pointer-events: none; }
.pe-names { font-size: clamp(5rem, 16vw, 10.5rem); color: var(--inv-primary); line-height: .95; text-shadow: 0 0 28px var(--pe-glow), 0 0 2px color-mix(in srgb, var(--inv-primary) 60%, transparent); }
.pe-name { display: inline-block; }
.pe-and { display: inline-block; font-size: .5em; margin: 0 .15em; color: var(--inv-accent); vertical-align: middle; }
@media (max-width: 640px) { .pe-name, .pe-and { display: block; } .pe-and { margin: -.1em 0; } }
.pe-hero .pe-letter { --pe-delay: .8s; }
.pe-subtitle { max-width: 520px; margin: 28px auto 0; color: color-mix(in srgb, var(--inv-text) 86%, var(--inv-bg)); text-shadow: 0 1px 12px var(--inv-bg); opacity: 0; animation: pe-fade 1.4s 3.2s forwards; }
.pe-hero-date { margin: 22px 0 0; font-size: .78rem; letter-spacing: .28em; text-transform: uppercase; line-height: 2.1; opacity: 0; animation: pe-fade 1.4s 3.6s forwards; }
@keyframes pe-fade { to { opacity: 1; } }

/* ---------- Sections ---------- */
.pe-section { max-width: 1040px; margin: 0 auto; padding: clamp(70px, 10vw, 110px) 22px; }
.pe-welcome, .pe-family, .pe-countdown, .pe-contact { text-align: center; }
.pe-title { margin-bottom: 34px; text-align: center; }
.pe-title h2 { font-size: clamp(3.6rem, 9vw, 5.4rem); color: var(--inv-primary); text-shadow: 0 0 22px color-mix(in srgb, var(--inv-accent) 30%, transparent); }
.pe-prose { max-width: 620px; margin: 0 auto; font-size: 1.06rem; text-align: center; }
.pe-prose p { margin: 0 0 1.1em; }
.pe-quote-author { font-style: italic; color: var(--pe-muted); }
.pe-lead { color: var(--pe-muted); margin: 0 0 24px; }
/* a soft band of starlight behind the welcome */
.pe-welcome { position: relative; isolation: isolate; }
.pe-welcome::before { content: ""; position: absolute; left: 10%; right: 10%; top: 30%; height: 120px; opacity: .14 !important; z-index: -1; background: var(--pe-band); background-size: 200% 100%; filter: blur(60px); opacity: .22; border-radius: 50%; animation: pe-shimmer 14s linear infinite; }

/* Couple: portraits fading into the dark, rimmed with light */
.pe-couple-grid { display: grid; gap: 56px; }
@media (min-width: 760px) { .pe-couple-grid { grid-template-columns: 1fr 1fr; gap: 64px; } }
.pe-person { text-align: center; }
.pe-portrait { position: relative; margin: 0 auto 18px; width: min(320px, 78vw); aspect-ratio: 4 / 5; -webkit-mask: radial-gradient(ellipse 50% 50% at 50% 50%, #000 58%, transparent 100%); mask: radial-gradient(ellipse 50% 50% at 50% 50%, #000 58%, transparent 100%); }
.pe-portrait img, .pe-initial { width: 100%; height: 100%; object-fit: cover; display: block; filter: brightness(.9); }
.pe-portrait::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, color-mix(in srgb, var(--inv-accent) 22%, transparent), transparent 45%); mix-blend-mode: screen; pointer-events: none; }
.pe-initial { display: grid; place-items: center; background: var(--pe-surface); font-family: var(--inv-font-heading); font-size: 7rem; color: var(--inv-primary); }
.pe-person h3 { font-size: 3.2rem; color: var(--inv-primary); margin-bottom: 6px; }
.pe-person p { color: var(--pe-muted); max-width: 380px; margin: 0 auto; }
.kit-js .pe-person { opacity: 0; translate: 0 24px; }
.kit-js .pe-person.is-visible { opacity: 1; translate: 0 0; transition: opacity 1.2s ease, translate 1.4s ease; }

/* Family */
.pe-family-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 24px 56px; margin: 0; }
.pe-family-list dt { font-size: .7rem; letter-spacing: .26em; text-transform: uppercase; color: var(--pe-muted); }
.pe-family-list dd { margin: 0; font-family: var(--inv-font-heading); font-size: 2.3rem; color: var(--inv-primary); line-height: 1.3; }

/* Story */
.pe-story-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 70px; }
.pe-story-item { display: grid; gap: 28px; align-items: center; }
@media (min-width: 760px) { .pe-story-item { grid-template-columns: 1fr 1fr; gap: 56px; } .pe-story-item:nth-child(even) .pe-story-photo { order: 2; } }
.pe-story-photo { margin: 0; aspect-ratio: 4 / 3; -webkit-mask: radial-gradient(ellipse 50% 50% at 50% 50%, #000 52%, transparent 100%); mask: radial-gradient(ellipse 50% 50% at 50% 50%, #000 52%, transparent 100%); }
.pe-story-photo img { width: 100%; height: 100%; object-fit: cover; filter: brightness(.9); }
.pe-story-text h3 { font-size: 2.8rem; color: var(--inv-primary); margin-bottom: 8px; }
.pe-story-text p { margin: 0 0 .6em; color: var(--pe-muted); }
.kit-js .pe-story-item { opacity: 0; translate: 0 24px; }
.kit-js .pe-story-item.is-visible { opacity: 1; translate: 0 0; transition: opacity 1.2s ease, translate 1.4s ease; }

/* Events: dark glass, a line of starlight on top */
.pe-event-list { display: grid; gap: 22px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.pe-event { position: relative; padding: 34px 24px 30px; text-align: center; background: color-mix(in srgb, var(--pe-surface) 80%, transparent); border: 1px solid var(--pe-line); border-radius: 6px; overflow: hidden; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.pe-event::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: var(--pe-band); background-size: 200% 100%; box-shadow: 0 0 16px var(--pe-glow); animation: pe-shimmer 8s linear infinite; }
.pe-event-time { font-family: var(--inv-font-heading); font-size: 3.6rem; line-height: 1; color: var(--inv-primary); margin: 0 0 4px; }
.pe-event h3 { font-family: var(--inv-font-body); font-weight: 400; font-size: .9rem; letter-spacing: .24em; text-transform: uppercase; margin-bottom: 8px; }
.pe-event-place { margin: 12px 0 0; }
.pe-event-address, .pe-event-notes { margin: 2px 0 0; color: var(--pe-muted); font-size: .92rem; }
.perseide .kit-event-actions { justify-content: center; margin-top: 16px; }
.perseide .kit-button { border-radius: 999px; border: 1px solid var(--pe-line); background: transparent; color: var(--inv-primary); font-size: .72rem; letter-spacing: .2em; text-transform: uppercase; }
.perseide .kit-button:hover { border-color: var(--inv-accent); box-shadow: 0 0 14px var(--pe-glow); }
.kit-js .pe-event { opacity: 0; translate: 0 22px; }
.kit-js .pe-event.is-visible { opacity: 1; translate: 0 0; transition: opacity .9s ease, translate 1.1s ease; }

/* Countdown: rings of light turning slowly */
.pe-countdown .kit-countdown { gap: clamp(12px, 4vw, 40px); margin-top: 14px; }
.pe-countdown .kit-countdown-unit { position: relative; width: clamp(80px, 20vw, 120px); min-width: 0; aspect-ratio: 1; padding: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; background: none; }
.pe-countdown .kit-countdown-unit::before { content: ""; position: absolute; inset: 0; border-radius: 50%; padding: 1.5px;
    background: conic-gradient(from var(--pe-turn, 0deg), transparent, var(--inv-accent), color-mix(in srgb, var(--inv-accent) 30%, var(--inv-primary)), transparent 60%, transparent);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
    filter: drop-shadow(0 0 6px var(--pe-glow)); animation: pe-turn 9s linear infinite; }
.pe-countdown .kit-countdown-unit:nth-child(2)::before { animation-delay: -2s; }
.pe-countdown .kit-countdown-unit:nth-child(3)::before { animation-delay: -4s; }
.pe-countdown .kit-countdown-unit:nth-child(4)::before { animation-delay: -6s; }
@property --pe-turn { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@keyframes pe-turn { to { --pe-turn: 360deg; } }
.pe-countdown .kit-countdown-value { font-family: var(--inv-font-heading); font-size: clamp(2.4rem, 8vw, 3.6rem); line-height: 1; color: var(--inv-primary); text-shadow: 0 0 16px var(--pe-glow); }
.pe-countdown .kit-countdown-label { font-size: .56rem; letter-spacing: .22em; color: var(--pe-muted); opacity: 1; }

/* Gallery: photos fading in from the dark */
.pe-gallery-grid.kit-gallery { grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 760px) { .pe-gallery-grid.kit-gallery { grid-template-columns: repeat(3, 1fr); } }
.pe-gallery-grid.kit-gallery a { aspect-ratio: 3 / 4; border-radius: 4px; }
.pe-gallery-grid.kit-gallery img { filter: brightness(.82) saturate(.9); transition: filter .6s ease, scale 1.2s ease; }
.pe-gallery-grid.kit-gallery a:hover img { filter: none; scale: 1.03; }
.kit-js .pe-gallery .pe-gallery-grid a { opacity: 0; }
.kit-js .pe-gallery.is-visible .pe-gallery-grid a { opacity: 1; transition: opacity 1.2s ease; }
.kit-js .pe-gallery.is-visible .pe-gallery-grid a:nth-child(3n+2) { transition-delay: .15s; }
.kit-js .pe-gallery.is-visible .pe-gallery-grid a:nth-child(3n) { transition-delay: .3s; }

/* RSVP */
.pe-rsvp-card { position: relative; max-width: 660px; margin: 0 auto; padding: clamp(26px, 5vw, 50px); border: 1px solid var(--pe-line); border-radius: 8px; overflow: hidden; background: color-mix(in srgb, var(--inv-bg) 70%, var(--pe-surface)); text-align: center; }
.pe-rsvp-card::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: var(--pe-band); background-size: 200% 100%; box-shadow: 0 0 16px var(--pe-glow); animation: pe-shimmer 8s linear infinite; }
.perseide .inv-rsvp__field input:not([type=checkbox]):not([type=radio]), .perseide .inv-rsvp__field select, .perseide .inv-rsvp__field textarea { color: var(--inv-text); background: color-mix(in srgb, var(--inv-text) 6%, transparent); border-color: var(--pe-line); }
.perseide .inv-rsvp__field select option { background: var(--inv-bg); }
.perseide .inv-rsvp__submit { border-radius: 999px; background: var(--inv-primary); color: var(--inv-bg); letter-spacing: .2em; text-transform: uppercase; font-size: .8rem; box-shadow: 0 0 22px var(--pe-glow); }
.perseide input[type=radio], .perseide input[type=checkbox] { accent-color: var(--inv-accent); }

/* Info */
.pe-info-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.pe-info-item { padding: 26px; text-align: center; border: 1px solid var(--pe-line); border-radius: 6px; }
.pe-info-item h3 { font-size: 2.4rem; color: var(--inv-primary); margin-bottom: 6px; }
.pe-info-item p { margin: 0 0 .5em; color: var(--pe-muted); }
.pe-faq { max-width: 700px; margin: 50px auto 0; text-align: center; }
.pe-faq details { text-align: left; padding: 14px 4px; border-bottom: 1px solid var(--pe-line); }
.pe-faq summary { cursor: pointer; }
.pe-faq details[open] summary { color: var(--inv-primary); }
.pe-faq details p { margin: 8px 0 0; color: var(--pe-muted); }

/* Contact */
.pe-contact-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 20px 64px; }
.pe-contact-name { font-family: var(--inv-font-heading); font-size: 2.8rem; color: var(--inv-primary); margin: 0; line-height: 1.2; }
.pe-contact-person a { color: var(--inv-text); text-decoration: none; letter-spacing: .08em; }

/* Footer: the shooting stars again, above the names */
.pe-footer { position: relative; padding: 150px 22px 70px; text-align: center; overflow: hidden; isolation: isolate; }
.pe-footer-message { margin: 0 0 4px; color: var(--pe-muted); }
.pe-footer-names { font-family: var(--inv-font-heading); font-size: clamp(4rem, 12vw, 7rem); line-height: 1.05; color: var(--inv-primary); margin: 0 0 12px; text-shadow: 0 0 26px var(--pe-glow); }
.pe-hashtag { margin: 0 0 8px; letter-spacing: .12em; }

@media (prefers-reduced-motion: reduce) {
    .pe-letter, .pe-stroke, .pe-subtitle, .pe-hero-date { animation: none !important; clip-path: none; opacity: 1; }
    .pe-welcome::before, .pe-event::before, .pe-rsvp-card::before, .pe-countdown .kit-countdown-unit::before { animation: none; }
    .kit-js .pe-person, .kit-js .pe-story-item, .kit-js .pe-event, .kit-js .pe-gallery .pe-gallery-grid a { opacity: 1; translate: 0 0; transition: none; }
}
