/* ==========================================================================
   Jar - a rustic wedding at night, by a campfire. Over a dark photo, the light of the fire flickers up from below
   (.jr-firelight) and sparks rise and swirl (canvas.jr-sparks, script.js); the names are written letter by letter, as
   if by hand, glowing like embers. At a touch the fire flares and a burst of sparks flies up. Titles write themselves
   over a line of glowing embers, portraits and story photos fade into the dark, the days left sit in turning rings of
   firelight, embers drift up behind the page and the campfire itself burns at the end.
   Palette (dark): --inv-primary (the names, warm light), --inv-accent (the fire), --inv-bg, --inv-text.
   ========================================================================== */

.jar {
    --jr-glow: color-mix(in srgb, var(--inv-accent) 55%, transparent);
    --jr-line: color-mix(in srgb, var(--inv-primary) 22%, transparent);
    --jr-muted: color-mix(in srgb, var(--inv-text) 68%, var(--inv-bg));
    --jr-surface: color-mix(in srgb, var(--inv-accent) 7%, var(--inv-bg));
    --jr-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(--jr-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;
}
.jar h1, .jar h2, .jar h3 { font-family: var(--inv-font-heading); font-weight: 400; line-height: 1; }
:where(.jar) :is(h1, h2, h3) { margin: 0; }
.jar strong { font-weight: 600; }
.jar a { color: var(--inv-primary); }
.jr-kicker { font-size: .72rem; letter-spacing: .3em; text-transform: uppercase; color: var(--jr-muted); margin: 0 0 10px; }
.jr-drift { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.jar > header, .jar > main, .jar > footer { position: relative; z-index: 1; }

/* ---------- Handwriting ---------- */
.jr-word { display: inline-block; white-space: nowrap; }
.jr-letter { display: inline-block; white-space: pre; clip-path: inset(-20% 100% -30% -10%); opacity: 0; }
.jr-hero .jr-letter, .is-visible .jr-letter { animation: jr-write .5s calc(var(--i) * .11s + var(--jr-delay, 0s)) cubic-bezier(.5, 0, .3, 1) forwards; }
@keyframes jr-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 glowing embers under the names and titles: drawn from left to right, then shimmering */
.jr-stroke { display: block; height: 2px; width: 180px; margin: 6px auto 0; background: var(--jr-band); background-size: 200% 100%; border-radius: 2px; box-shadow: 0 0 12px var(--jr-glow); clip-path: inset(0 100% 0 0); }
.is-visible .jr-stroke { animation: jr-underline 1.1s 1s ease-out forwards, jr-shimmer 6s 2s linear infinite; }
.jr-stroke--hero { width: min(420px, 70vw); animation: jr-underline 1.4s 2.6s ease-out forwards, jr-shimmer 6s 4s linear infinite; }
@keyframes jr-underline { to { clip-path: inset(0 0 0 0); } }
@keyframes jr-shimmer { from { background-position: 0% 0; } to { background-position: -200% 0; } }

/* ---------- The fire ---------- */
.jr-sparks { position: absolute; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; z-index: -1; }
/* the firelight: a warm glow rising from below the photo, flickering */
.jr-firelight { position: absolute; left: 50%; bottom: -35%; width: min(1400px, 220vw); aspect-ratio: 1.6; translate: -50% 0; z-index: -2; pointer-events: none; border-radius: 50%;
    background: radial-gradient(closest-side, color-mix(in srgb, var(--inv-accent) 46%, transparent), color-mix(in srgb, var(--inv-accent) 16%, transparent) 45%, transparent 72%);
    mix-blend-mode: screen; animation: jr-flicker 2.8s ease-in-out infinite; transform-origin: 50% 100%; }
@keyframes jr-flicker { 0%, 100% { opacity: .85; scale: 1; } 18% { opacity: .7; scale: .98; } 33% { opacity: 1; scale: 1.02; } 52% { opacity: .78; } 70% { opacity: .95; scale: 1.01; } 86% { opacity: .74; } }
.jr-hero.is-flaring .jr-firelight { animation: jr-flare 1.6s ease-out; }
@keyframes jr-flare { 0% { opacity: .9; scale: 1; } 20% { opacity: 1; scale: 1.16; filter: brightness(1.4); } 100% { opacity: .85; scale: 1; } }

/* ---------- Navigation ---------- */
.jr-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; }
.jr-nav .kit-nav-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 22px; }
.jr-nav a { text-decoration: none; font-size: .74rem; letter-spacing: .2em; text-transform: uppercase; color: var(--jr-muted); padding: 4px 0; }
.jr-nav a:hover, .jr-nav a.is-current { color: var(--inv-primary); text-shadow: 0 0 10px var(--jr-glow); }
.jr-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; }
.jr-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(--jr-line); }
.jar .kit-to-top { background: var(--inv-primary); color: var(--inv-bg); }
@media (max-width: 899px) {
    .jr-nav { justify-content: flex-end; padding: 10px 14px; }
    .jr-nav .kit-nav-toggle { margin-left: auto; font-size: 1.5rem; color: var(--inv-primary); }
    .jr-nav .kit-nav-links { display: none; }
    .jr-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(--jr-line); }
}

/* ---------- Hero ---------- */
.jr-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; }
.jr-hero-photo { position: absolute; inset: 0; margin: 0; z-index: -4; }
.jr-hero-photo img { width: 100%; height: 100%; object-fit: cover; opacity: .62; filter: sepia(.25) saturate(.85) contrast(1.05); }
/* the example photo has the couple on the right: on narrow screens show them rather than the middle (a couple's own
   photo keeps the focus point they chose) */
@media (max-aspect-ratio: 1/1) { .jr-hero-photo--example img { object-position: 76% 50% !important; } }
.jr-hero::before { content: ""; position: absolute; inset: 0; z-index: -3; 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%); }
.jr-hero-content { position: relative; z-index: 1; max-width: 900px; }
/* a soft shade behind the text, so it reads on any photo */
.jr-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; }
.jr-names { font-size: clamp(5rem, 16vw, 10.5rem); color: var(--inv-primary); line-height: .95; text-shadow: 0 0 28px var(--jr-glow), 0 0 2px color-mix(in srgb, var(--inv-primary) 60%, transparent); }
.jr-name { display: inline-block; }
.jr-and { display: inline-block; font-size: .5em; margin: 0 .15em; color: var(--inv-accent); vertical-align: middle; }
@media (max-width: 640px) { .jr-name, .jr-and { display: block; } .jr-and { margin: -.1em 0; } }
.jr-hero .jr-letter { --jr-delay: .8s; }
.jr-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: jr-fade 1.4s 3.2s forwards; }
.jr-hero-date { margin: 22px 0 0; font-size: .78rem; letter-spacing: .28em; text-transform: uppercase; line-height: 2.1; opacity: 0; animation: jr-fade 1.4s 3.6s forwards; }
@keyframes jr-fade { to { opacity: 1; } }

/* ---------- Sections ---------- */
.jr-section { max-width: 1040px; margin: 0 auto; padding: clamp(70px, 10vw, 110px) 22px; }
.jr-welcome, .jr-family, .jr-countdown, .jr-contact { text-align: center; }
.jr-title { margin-bottom: 34px; text-align: center; }
.jr-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); }
.jr-prose { max-width: 620px; margin: 0 auto; font-size: 1.06rem; text-align: center; }
.jr-prose p { margin: 0 0 1.1em; }
.jr-quote-author { font-style: italic; color: var(--jr-muted); }
.jr-lead { color: var(--jr-muted); margin: 0 0 24px; }
/* a soft band of firelight behind the welcome */
.jr-welcome { position: relative; isolation: isolate; }
.jr-welcome::before { content: ""; position: absolute; left: 10%; right: 10%; top: 30%; height: 120px; z-index: -1; background: var(--jr-band); background-size: 200% 100%; filter: blur(60px); opacity: .22; border-radius: 50%; animation: jr-shimmer 14s linear infinite; }

/* Couple: portraits fading into the dark, rimmed with light */
.jr-couple-grid { display: grid; gap: 56px; }
@media (min-width: 760px) { .jr-couple-grid { grid-template-columns: 1fr 1fr; gap: 64px; } }
.jr-person { text-align: center; }
.jr-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%); }
.jr-portrait img, .jr-initial { width: 100%; height: 100%; object-fit: cover; display: block; filter: brightness(.9); }
.jr-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; }
.jr-initial { display: grid; place-items: center; background: var(--jr-surface); font-family: var(--inv-font-heading); font-size: 7rem; color: var(--inv-primary); }
.jr-person h3 { font-size: 3.2rem; color: var(--inv-primary); margin-bottom: 6px; }
.jr-person p { color: var(--jr-muted); max-width: 380px; margin: 0 auto; }
.kit-js .jr-person { opacity: 0; translate: 0 24px; }
.kit-js .jr-person.is-visible { opacity: 1; translate: 0 0; transition: opacity 1.2s ease, translate 1.4s ease; }

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

/* Story */
.jr-story-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 70px; }
.jr-story-item { display: grid; gap: 28px; align-items: center; }
@media (min-width: 760px) { .jr-story-item { grid-template-columns: 1fr 1fr; gap: 56px; } .jr-story-item:nth-child(even) .jr-story-photo { order: 2; } }
.jr-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%); }
.jr-story-photo img { width: 100%; height: 100%; object-fit: cover; filter: brightness(.9); }
.jr-story-text h3 { font-size: 2.8rem; color: var(--inv-primary); margin-bottom: 8px; }
.jr-story-text p { margin: 0 0 .6em; color: var(--jr-muted); }
.kit-js .jr-story-item { opacity: 0; translate: 0 24px; }
.kit-js .jr-story-item.is-visible { opacity: 1; translate: 0 0; transition: opacity 1.2s ease, translate 1.4s ease; }

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

/* Countdown: rings of light turning slowly */
.jr-countdown .kit-countdown { gap: clamp(12px, 4vw, 40px); margin-top: 14px; }
.jr-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; }
.jr-countdown .kit-countdown-unit::before { content: ""; position: absolute; inset: 0; border-radius: 50%; padding: 1.5px;
    background: conic-gradient(from var(--jr-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(--jr-glow)); animation: jr-turn 9s linear infinite; }
.jr-countdown .kit-countdown-unit:nth-child(2)::before { animation-delay: -2s; }
.jr-countdown .kit-countdown-unit:nth-child(3)::before { animation-delay: -4s; }
.jr-countdown .kit-countdown-unit:nth-child(4)::before { animation-delay: -6s; }
@property --jr-turn { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@keyframes jr-turn { to { --jr-turn: 360deg; } }
.jr-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(--jr-glow); }
.jr-countdown .kit-countdown-label { font-size: .56rem; letter-spacing: .22em; color: var(--jr-muted); opacity: 1; }

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

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

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

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

/* Footer: the campfire burning under the names */
.jr-footer { position: relative; padding: 70px 22px 70px; text-align: center; overflow: hidden; isolation: isolate; }
.jr-fire { position: relative; width: 120px; height: 150px; margin: 0 auto 26px; }
.jr-fire span { position: absolute; left: 50%; bottom: 14px; width: 54px; height: 110px; margin-left: -27px; border-radius: 50% 50% 46% 46% / 62% 62% 38% 38%; transform-origin: 50% 100%; mix-blend-mode: screen; filter: blur(2px);
    background: radial-gradient(ellipse at 50% 80%, #fff6d8 0 12%, color-mix(in srgb, var(--inv-accent) 70%, #ffd27a) 34%, color-mix(in srgb, var(--inv-accent) 80%, #b2300c) 62%, transparent 72%);
    animation: jr-dance 1.4s ease-in-out infinite alternate; }
.jr-fire span:nth-child(2) { width: 40px; margin-left: -46px; height: 80px; animation-duration: 1.1s; animation-delay: -.4s; }
.jr-fire span:nth-child(3) { width: 40px; margin-left: 6px; height: 86px; animation-duration: 1.25s; animation-delay: -.8s; }
.jr-fire span:nth-child(4) { width: 30px; margin-left: -15px; height: 130px; opacity: .7; animation-duration: .9s; animation-delay: -.2s; }
@keyframes jr-dance { 0% { scale: 1 1; rotate: -3deg; } 50% { scale: .9 1.08; rotate: 2deg; } 100% { scale: 1.05 .94; rotate: -1deg; } }
/* the logs */
.jr-fire i { position: absolute; left: 50%; bottom: 6px; width: 110px; height: 12px; margin-left: -55px; border-radius: 6px; background: color-mix(in srgb, var(--inv-accent) 18%, #2a1a10); box-shadow: 0 -2px 0 color-mix(in srgb, var(--inv-accent) 40%, transparent); rotate: -8deg; }
.jr-fire i::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: inherit; rotate: 16deg; }
.jr-fire::after { content: ""; position: absolute; left: 50%; bottom: -30px; width: 340px; height: 120px; margin-left: -170px; border-radius: 50%; z-index: -1;
    background: radial-gradient(closest-side, color-mix(in srgb, var(--inv-accent) 35%, transparent), transparent); animation: jr-flicker 2.8s ease-in-out infinite; }
.jr-footer-message { margin: 0 0 4px; color: var(--jr-muted); }
.jr-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(--jr-glow); }
.jr-hashtag { margin: 0 0 8px; letter-spacing: .12em; }

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