/* InviteKit part: "Our story" chapters on a gold thread (story.js). Every colour comes from the design's --k-* variables. */
.k-story { position: relative; width: 100%; max-width: 640px; margin: 0 auto; padding: clamp(3rem, 9vw, 5rem) 20px clamp(2.5rem, 8vw, 4.5rem); color: var(--k-ink); }
.k-story__hd { display: grid; justify-items: center; gap: .15rem; margin-bottom: 1.6rem; text-align: center; }
.k-story__eye { margin: 0; font: 500 .66rem/1.2 var(--k-label); letter-spacing: .3em; text-transform: uppercase; color: var(--k-accent); }
.k-story__h { margin: 0; padding: 0 .2em; font: 400 clamp(2.6rem, 11vw, 3.6rem)/1.15 var(--k-script); color: var(--k-ink); overflow-wrap: anywhere; }
.k-story__flo { width: 120px; height: 12px; overflow: visible; fill: none; stroke: var(--k-gold); stroke-width: 1.4; stroke-linecap: round; }

.k-story__track { position: relative; }
.k-story__thr { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.k-story__line { fill: none; stroke: var(--k-gold); stroke-width: 1.6; stroke-linecap: round; stroke-dasharray: 1 1; stroke-dashoffset: 0; }
.k-story.is-anim .k-story__line { stroke-dashoffset: 1; }
.k-story__list { position: relative; display: grid; gap: 2.4rem; margin: 0; padding: 0; list-style: none; }
.k-story__ch { position: relative; display: grid; gap: .6rem; padding-left: 44px; }
.k-story__knot { position: absolute; z-index: 2; left: 6px; top: 2px; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  background: var(--k-paper); box-shadow: inset 0 0 0 1.5px var(--k-gold), 0 0 0 4px var(--k-paper); }
.k-story__knot i { width: 8px; height: 8px; border-radius: 50%; background: var(--k-accent); }
.k-story.is-anim .k-story__knot:not(.is-lit) { opacity: 0; }
.k-story__meta { display: grid; gap: .1rem; }
.k-story__date { font: 500 .64rem/1.3 var(--k-label); letter-spacing: .22em; text-transform: uppercase; color: var(--k-accent); }
.k-story__t { margin: 0; font: 500 clamp(1.25rem, 5vw, 1.5rem)/1.2 var(--k-display); color: var(--k-ink); overflow-wrap: anywhere; }

/* the frame: one to four photo spots */
.k-story__fr { display: grid; gap: 6px; padding: 6px; background: var(--k-card); border-radius: calc(var(--k-radius, 6px) * .5); transform: rotate(var(--rot, 0deg));
  box-shadow: 0 16px 26px -16px color-mix(in srgb, var(--k-ink) 55%, transparent), 0 0 0 1px color-mix(in srgb, var(--k-ink) 9%, transparent); }
.k-story__fr[data-n="1"] { grid-template-columns: 1fr; }
.k-story__fr[data-n="1"] .k-story__ph { aspect-ratio: 4 / 3; }
.k-story__fr[data-n="2"] { grid-template-columns: 1fr 1fr; }
.k-story__fr[data-n="2"] .k-story__ph { aspect-ratio: 3 / 4; }
.k-story__fr[data-n="3"] { grid-template-columns: 1.35fr 1fr; grid-template-rows: 1fr 1fr; aspect-ratio: 4 / 3; }
.k-story__fr[data-n="3"] .k-story__ph:first-child { grid-row: 1 / span 2; }
.k-story__fr[data-n="4"] { grid-template-columns: 1fr 1fr; }
.k-story__fr[data-n="4"] .k-story__ph { aspect-ratio: 1; }
.k-story__ph { position: relative; display: block; min-height: 0; width: 100%; height: 100%; margin: 0; padding: 0; border: 0; overflow: hidden; border-radius: 2px; background: color-mix(in srgb, var(--k-paper) 70%, var(--k-card)); cursor: zoom-in; font: inherit; color: inherit; }
.k-story__img { display: block; width: 100%; height: 100%; object-fit: cover; }
.k-story.is-anim .k-story__img { opacity: .45; filter: blur(7px) sepia(.9) saturate(.4) brightness(1.4) contrast(.6); transition: opacity 1.8s var(--k-ease, ease), filter 1.8s var(--k-ease, ease); transition-delay: calc(.35s + var(--j, 0) * .25s); }
.k-story.is-anim .k-story__ch.is-in .k-story__img { opacity: 1; filter: none; }
.k-story.is-anim .k-story__meta, .k-story.is-anim .k-story__fr { opacity: 0; }

/* a spot left empty: a drawing and the date, never a grey box */
.k-story__orn { display: grid; place-items: center; cursor: default; background: color-mix(in srgb, var(--k-card) 85%, var(--k-paper)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--k-gold) 30%, transparent); }
.k-story__motif { position: relative; width: 74%; height: 70%; max-height: 150px; overflow: visible; fill: none; stroke: color-mix(in srgb, var(--k-gold) 85%, var(--k-ink)); stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
.k-story__star { fill: var(--k-gold); stroke: none; }
.k-story__ornd { position: absolute; right: 10px; bottom: 6px; max-width: calc(100% - 20px); font: 400 clamp(1rem, 4.6vw, 1.25rem)/1.2 var(--k-script); color: var(--k-accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.k-story__wash { position: absolute; left: 22%; top: 18%; width: 46%; height: 56%; border-radius: 50%; background: radial-gradient(closest-side, color-mix(in srgb, var(--k-accent) 22%, transparent), transparent); filter: blur(4px); }
.k-story__wash--b { left: 44%; top: 40%; width: 40%; height: 46%; background: radial-gradient(closest-side, color-mix(in srgb, var(--k-gold) 22%, transparent), transparent); }
.k-story.is-anim .k-story__orn .k-story__dr { stroke-dasharray: 1 1; stroke-dashoffset: 1; transition: stroke-dashoffset 1.4s var(--k-ease, ease) .5s; }
.k-story.is-anim .k-story__orn.is-drawn .k-story__dr { stroke-dashoffset: 0; }
.k-story.is-anim .k-story__orn .k-story__wash { opacity: 0; scale: .3; transition: opacity 1s ease 1.1s, scale 1.4s var(--k-spring, ease) 1.1s; }
.k-story.is-anim .k-story__orn.is-drawn .k-story__wash { opacity: 1; scale: 1; }
.k-story.is-anim .k-story__orn .k-story__star { opacity: 0; transition: opacity .5s ease 1.2s; }
.k-story.is-anim .k-story__orn.is-drawn .k-story__star { opacity: 1; }
.k-story.is-anim .k-story__orn .k-story__ornd { clip-path: inset(-40% 100% -40% 0); transition: clip-path 1s linear 1.5s; }
.k-story.is-anim .k-story__orn.is-drawn .k-story__ornd { clip-path: inset(-40% -10% -40% -10%); }

/* the caption writes itself in */
.k-story__cap { margin: .1rem 0 0; font: italic 400 clamp(.98rem, 3.9vw, 1.08rem)/1.55 var(--k-display); color: var(--k-ink-2, var(--k-ink)); overflow-wrap: anywhere; }
.k-story__w { display: inline; }
.k-story.is-anim .k-story__w { opacity: 0; clip-path: inset(-30% 100% -30% 0); transition: opacity .2s linear, clip-path .45s linear; transition-delay: var(--wd, 1s); }
.k-story.is-anim .k-story__ch.is-in .k-story__w { opacity: 1; clip-path: inset(-30% -6% -30% 0); }

/* the heading: the script writes in, the flourish draws under it */
.k-story.is-anim .k-story__h { clip-path: inset(-30% 100% -30% 0); transition: clip-path 1.2s linear .2s; }
.k-story.is-anim .k-story__hd.is-in .k-story__h { clip-path: inset(-30% -10% -30% -10%); }
.k-story.is-anim .k-story__flo .k-story__dr { stroke-dasharray: 1 1; stroke-dashoffset: 1; transition: stroke-dashoffset 1s var(--k-ease, ease) 1s; }
.k-story.is-anim .k-story__hd.is-in .k-story__flo .k-story__dr { stroke-dashoffset: 0; }
.k-story.is-anim .k-story__eye { opacity: 0; transform: translateY(8px); transition: opacity .6s ease, transform .8s var(--k-spring, ease); }
.k-story.is-anim .k-story__hd.is-in .k-story__eye { opacity: 1; transform: none; }

/* tablet and laptop: the thread runs across the page, chapters sit above and below it */
@media (min-width: 760px) { .k-story { max-width: 1160px; padding-inline: 32px; } }
.k-story.is-across .k-story__list { grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); grid-template-rows: auto 72px auto; gap: 0 18px; }
.k-story.is-across .k-story__ch { grid-column: var(--c) / span 2; padding-left: 0; align-content: end; }
.k-story.is-across .k-story__ch:nth-child(odd) { grid-row: 1; }
.k-story.is-across .k-story__ch:nth-child(even) { grid-row: 3; align-content: start; }
.k-story.is-across .k-story__knot { left: calc(50% - 11px); top: auto; bottom: -47px; }
.k-story.is-across .k-story__ch:nth-child(even) .k-story__knot { top: -47px; bottom: auto; }
.k-story.is-across .k-story__meta, .k-story.is-across .k-story__cap { text-align: center; }
.k-story.is-across .k-story__fr { order: -1; }
.k-story.is-across .k-story__fr { max-width: 340px; width: 100%; justify-self: center; }

/* a few designs' own touches */
.k-root[data-template="watercolour"] .k-story__fr { border-radius: 2px; background: color-mix(in srgb, var(--k-card) 80%, #fff); }
.k-root[data-template="evermore"] .k-story__fr { border-radius: 999px 999px 4px 4px / 46% 46% 4px 4px; box-shadow: 0 0 0 1px var(--k-gold), 0 0 0 4px var(--k-paper), 0 0 0 5px color-mix(in srgb, var(--k-gold) 45%, transparent), 0 16px 22px -14px color-mix(in srgb, var(--k-ink) 55%, transparent); }
.k-root[data-template="evermore"] .k-story__ph { border-radius: 999px 999px 2px 2px / 44% 44% 2px 2px; }
.k-root[data-template="evermore"] .k-story__fr[data-n]:not([data-n="1"]) .k-story__ph { border-radius: 2px; }
.k-root[data-template="evermore"] .k-story__h, .k-root[data-kind="memorial"] .k-story__h { font-family: var(--k-display); font-size: clamp(2rem, 8vw, 2.6rem); letter-spacing: -.01em; }
.k-root[data-template="gatsby"] .k-story__fr, .k-root[data-template="premiere"] .k-story__fr { border-radius: 0; box-shadow: 0 0 0 1px var(--k-gold), 0 18px 28px -18px #000; }
.k-root[data-template="gatsby"] .k-story__knot, .k-root[data-template="premiere"] .k-story__knot { border-radius: 2px; rotate: 45deg; }
.k-root[data-template="afterglow"] .k-story__line { filter: drop-shadow(0 0 4px var(--k-accent)); }
.k-root[data-template="afterglow"] .k-story__knot i { box-shadow: 0 0 10px var(--k-accent); }
.k-root[data-template="keepsake"] .k-story__fr { border-radius: 2px; padding: 8px 8px 22px; }
.k-root[data-template="keynote"] .k-story__h, .k-root[data-template="jetset"] .k-story__h, .k-root[data-template="cover-story"] .k-story__h { font-family: var(--k-display); font-size: clamp(2rem, 8vw, 2.8rem); }

@media (prefers-reduced-motion: reduce) {
  .k-story .k-story__line { stroke-dashoffset: 0 !important; }
  .k-story .k-story__img, .k-story .k-story__w, .k-story .k-story__h, .k-story .k-story__ornd { opacity: 1 !important; filter: none !important; clip-path: none !important; transition: none !important; }
}
