/* Maja & Filip: one page. Top: the painted scroll story. Below: details and the RSVP, drawn by hand. */
:root {
  --ground: #EEF0E6;   /* bare canvas, also the painter's ground colour in story.js */
  --ink: #22324A;
  --green: #3F6130;
  --muted: #4C5A6C;
  --paper: #FFFDF6;
  --card: #F6F7F0;
  --cream: #FBF8EE;
  /* one hand for the whole page: Playwrite GB S, modern British school handwriting, joined but open and easy to read. It has weights 100 to 400 only, so text is
     300 and everything emphasised is 400 (font-synthesis is off, so the browser never fakes a bolder cut). */
  --hand: 'Playwrite GB S', 'Segoe Print', 'Bradley Hand', cursive;
  /* Outlines are never quite straight: these uneven corner curves bow every edge a little, as a pen would. */
  --wob-a: 255px 18px 225px 18px / 18px 225px 18px 255px;
  --wob-b: 18px 225px 18px 255px / 255px 18px 225px 18px;
  --wob-c: 225px 22px 255px 26px / 24px 255px 20px 225px;
  --pen: 1.7px solid rgba(34, 50, 74, .78);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font-family: var(--hand); font-weight: 300; font-size: 16px; line-height: 1.5; font-synthesis: none; overflow-x: hidden; }
p, h1, h2, h3, ol, fieldset { margin: 0; padding: 0; }
fieldset { border: 0; min-width: 0; }
canvas { display: block; }
a { color: var(--ink); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }

.lbl { font-size: 15px; font-weight: 400; color: var(--green); }
.h { font-weight: 300; font-size: 21px; line-height: 1.3; }
.names { font-weight: 400; line-height: 1.5; }
.mut { font-size: 14px; color: var(--muted); }
.small { font-size: 14px; }
.strong { font-weight: 400; }
.center { text-align: center; justify-content: center; }

/* ---------- the painted story ---------- */
.story { position: relative; height: 640vh; height: 640svh; }           /* five chapters then the invitation; story.js re-sizes this so a chapter is never under 1100px */
/* dvh, not svh: the stage must follow the phone's URL bar as it collapses, or the first scroll
   exposes a strip of the page below the painting. The painter takes the resize cheaply. */
.stage { position: sticky; top: 0; height: 100vh; height: 100svh; height: 100dvh; overflow: hidden; display: flex; justify-content: center; background: var(--ground); }
.frame { position: relative; width: min(100vw, 62vh); width: min(100vw, 62svh); height: 100%; }   /* a portrait painting, centred on mid-size screens */
.frame canvas[data-scene] { position: absolute; inset: 0; width: 100%; height: 100%; }
@media (min-aspect-ratio: 63/100) {
  .frame canvas[data-scene], .scrim { -webkit-mask-image: linear-gradient(to right, transparent, #000 7%, #000 93%, transparent); mask-image: linear-gradient(to right, transparent, #000 7%, #000 93%, transparent); }
}
/* shown until the painting has loaded */
.wait { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; transition: opacity .8s; pointer-events: none; }
.wait .names { font-size: clamp(29px, 9vw, 37px); }
.story-on .wait { opacity: 0; }
.scrim { position: absolute; left: 0; right: 0; bottom: 0; height: 40%; opacity: 0; pointer-events: none; background: linear-gradient(to bottom, rgba(14, 30, 44, 0), rgba(14, 30, 44, .62) 26%, rgba(14, 30, 44, .84) 52%, rgba(14, 30, 44, .95)); }
.caps { position: absolute; left: 0; right: 0; bottom: 0; height: 260px; opacity: 0; pointer-events: none; color: var(--cream); text-align: center; text-shadow: 0 1px 14px rgba(8, 18, 30, .55); }
.cap { position: absolute; left: 16px; right: 16px; bottom: calc(64px + env(safe-area-inset-bottom)); opacity: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.cap .lbl { color: #F6E7A8; font-size: 15px; }
.cap .names { font-size: clamp(27px, 8.5vw, 35px); }
.cap .line { font-weight: 300; font-size: clamp(19px, 5.7vw, 23px); line-height: 1.5; }
.cap .sub, .cap .hint { font-size: 16px; color: #E6EAE2; }
.cap .hint { display: flex; align-items: center; gap: 6px; font-size: 14px; margin-top: 6px; }
.dots { position: absolute; left: 0; right: 0; bottom: calc(26px + env(safe-area-inset-bottom)); display: flex; justify-content: center; gap: 10px; }
.dots span { width: 7px; height: 7px; border-radius: 50%; background: #F6E7A8; opacity: .38; transition: opacity .3s, transform .3s; }
.invite { position: absolute; inset: 0; opacity: 0; visibility: hidden; padding: 40px 28px 24vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; pointer-events: none; }
.invite .names { font-size: clamp(29px, 9vw, 37px); }
.invite .rule { width: 56px; height: 1px; background: #4F7340; }
.invite .when { font-size: 19px; font-weight: 400; line-height: 1.4; }
.invite .go { margin-top: 10px; pointer-events: auto; } /* the one clickable thing on the invitation */
.invite .more { margin-top: 4px; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 14px; color: var(--muted); }

/* without the story (no WebGL) the invitation is shown as plain text instead */
.plain-head { display: none; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding-bottom: 12px; }
.plain-head .names { font-size: 35px; }
.plain-head .when { font-size: 19px; }
.no-story .story { display: none; }
.no-story .plain-head { display: flex; }

/* ---------- drawn components ----------
   Outlines are pen lines: uneven corners (--wob-*) and, where the element can carry one, a second layer (::after)
   pushed through the #sketch filter in index.html so the line wavers. Fills are brush strokes: pictures made once by
   drawn.js and handed over as --paint-* / --dab-*; until they arrive (or without scripts) a flat colour stands in. */
.card, .tile, .btn2, .opt, .chip { position: relative; border: 0; }
.card::after, .tile::after, .btn2::after, .opt::after, .chip::after { content: ''; position: absolute; inset: 0; border: var(--pen); border-radius: inherit; filter: url(#sketch); pointer-events: none; }
.card { background: var(--card); border-radius: var(--wob-a); }
.card:nth-of-type(even) { border-radius: var(--wob-c); }
.pad { padding: 22px 22px; }
.btn, .btn2 { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 400; text-decoration: none; cursor: pointer; }
.btn { min-height: 54px; padding: 0 30px; border: 0; border-radius: var(--wob-b); background: var(--ink); color: var(--cream); }
.painted .btn { background: var(--paint-ink) center / 100% 100% no-repeat; }
.btn2 { min-height: 48px; padding: 0 20px; border-radius: var(--wob-b); background: transparent; color: var(--ink); font-size: 15px; }
.btn:disabled { opacity: .6; cursor: default; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
svg { overflow: visible; }
.btn2 svg, .tip svg, .hint svg, .more svg { filter: url(#sketch); }

/* ---------- the page below ---------- */
.page { width: 100%; max-width: 440px; margin: 0 auto; padding: 18px 20px 0; display: flex; flex-direction: column; gap: 26px; }
.col { display: flex; flex-direction: column; gap: 26px; min-width: 0; }

.count { display: flex; gap: 8px; }
.tile { flex: 1; padding: 12px 0; display: flex; flex-direction: column; align-items: center; background: var(--card); border-radius: var(--wob-b); }
.tile:nth-child(even) { border-radius: var(--wob-c); }
.tile .num { font-weight: 400; font-size: 26px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile .unit { font-size: 13px; color: var(--muted); }

.venue { overflow: hidden; }
.venue canvas[data-deco] { width: 100%; height: 118px; }
.venue .pad { display: flex; flex-direction: column; gap: 6px; padding-top: 18px; }
.place { display: flex; flex-direction: column; gap: 6px; }
.place + .place { margin-top: 14px; }

.timeline { list-style: none; margin-top: 14px; display: flex; flex-direction: column; }
.timeline li { position: relative; display: flex; flex-direction: column; padding: 0 0 18px 38px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before { content: ''; position: absolute; left: 2px; top: 6px; width: 18px; height: 18px; border-radius: 50%; background: var(--green); }
.painted .timeline li::before { background: var(--dab-green) center / contain no-repeat; border-radius: 0; }
.timeline li::after { content: ''; position: absolute; left: 10.5px; top: 27px; bottom: -4px; border-left: 1.6px dashed rgba(63, 97, 48, .7); filter: url(#sketch); }
.timeline li:last-child::after { display: none; }
.timeline .time { font-weight: 400; font-size: 17px; line-height: 1.5; color: var(--green); }
.timeline .inf { width: 1.7em; height: .8em; vertical-align: -.06em; overflow: visible; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; } /* the party has no end time: a pen-drawn loop, since the hand font has no ∞ */
.timeline .what { font-weight: 400; }

.info { display: flex; flex-direction: column; gap: 12px; }
.info .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tip { padding: 16px 14px; display: flex; flex-direction: column; gap: 6px; }
.tip svg { color: var(--green); }
.tip h3 { font-weight: 400; font-size: 17px; line-height: 1.2; }
.tip .mut { font-size: 14px; line-height: 1.4; }

/* ---------- RSVP ---------- */
.rsvp { padding-top: 10px; scroll-margin-top: 16px; }
.stick { display: flex; flex-direction: column; gap: 16px; }
.rsvp .intro { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.letter { display: flex; flex-direction: column; gap: 16px; scroll-margin-top: 16px; }
.letter .intro { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.bars { display: flex; gap: 6px; width: 200px; margin-top: 6px; }
.bars span { flex: 1; height: 7px; border-radius: 4px; background: rgba(63, 97, 48, .22); transition: background-color .3s; }
.bars span[data-on] { background: var(--green); }
.painted .bars span { background: var(--paint-bar-off) center / 100% 100% no-repeat; border-radius: 0; }
.painted .bars span[data-on] { background-image: var(--paint-bar); }
.steps { display: flex; flex-direction: column; gap: 16px; }
.steps fieldset { display: flex; flex-direction: column; gap: 14px; }
.steps legend { display: flex; align-items: center; gap: 12px; padding: 0; margin-bottom: 14px; }
.steps legend > span:last-child { display: flex; flex-direction: column; }
.steps .n { width: 34px; height: 34px; flex: none; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--ink); color: var(--cream); font-size: 14px; font-weight: 400; }
.painted .steps .n { background: var(--dab-ink) center / contain no-repeat; border-radius: 0; }
.q { font-weight: 400; font-size: 20px; line-height: 1.2; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.guest { display: flex; flex-direction: column; gap: 8px; }
.kid, .seats { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.kid-more { display: contents; } /* its parts flow with the Dijete chip; [hidden] still hides it */
.age { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 400; }
.age .in { width: 58px; min-height: 42px; padding: 0 8px; text-align: center; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 400; }
.in { width: 100%; min-height: 50px; padding: 0 16px; border: var(--pen); border-radius: var(--wob-c); background: var(--paper); color: var(--ink); font: inherit; font-weight: 400; font-size: 16px; }
.field:nth-child(even) .in { border-radius: var(--wob-a); }
textarea.in { padding: 12px 16px; resize: none; }
.in[aria-invalid="true"] { border-color: #A3352B; border-width: 2.4px; }
.opt { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 16px; border-radius: var(--wob-a); background: var(--paper); cursor: pointer; }
.opt + .opt { border-radius: var(--wob-c); }
.opt.big { min-height: 66px; }
.opt > span { display: flex; flex-direction: column; }
/* radio and tick boxes: a pen ring, filled with a dab of paint when chosen */
.opt input { -webkit-appearance: none; appearance: none; width: 26px; height: 26px; margin: 0; flex: none; border: var(--pen); border-radius: var(--wob-b); background: transparent center / 68% no-repeat; cursor: pointer; }
.opt input:checked { background-color: var(--green); box-shadow: inset 0 0 0 4px var(--paper); }
.painted .opt input:checked { background-color: transparent; background-image: var(--dab-green); box-shadow: none; }
.opt:has(input:checked)::after { border-color: var(--green); border-width: 2.4px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; font-weight: 400; }
.chip { display: inline-flex; align-items: center; min-height: 42px; padding: 0 16px; border-radius: var(--wob-b); background: var(--paper); font-size: 14px; cursor: pointer; }
.chip:nth-child(even) { border-radius: var(--wob-c); }
.chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip:has(input:checked) { background: var(--green); color: var(--cream); }
.painted .chip:has(input:checked) { background: var(--paint-green) center / 100% 100% no-repeat; }
.chip:has(input:checked)::after { border-color: transparent; }
.chip:has(input:focus-visible) { outline: 2px solid var(--green); outline-offset: 3px; }
.stepper { display: flex; align-items: center; gap: 14px; }
.stepper .num { font-weight: 400; font-size: 24px; min-width: 20px; text-align: center; }
.round { width: 48px; padding: 0; font-size: 22px; border-radius: 50%; }
.extra { display: flex; flex-direction: column; gap: 14px; }
.nav { display: flex; gap: 10px; }
.nav .btn { flex: 1; }
.error { color: #8F2B22; font-size: 14px; font-weight: 400; }
.trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.thanks { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; background: #E4EBDD; }
.thanks .tick { width: 52px; height: 52px; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--green); color: var(--cream); }
.painted .thanks .tick { background: var(--dab-green) center / contain no-repeat; border-radius: 0; }

/* the page ends in water lilies from edge to edge */
.foot { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; margin-top: 34px; }
.foot p { padding: 0 32px; }
.foot .who { white-space: nowrap; } /* a name and its phone number never split */
.foot .small-names { font-size: 24px; margin-top: 6px; }
.foot canvas[data-deco] { width: 100%; height: 210px; margin-top: 10px; }

/* ---------- wide screens: the painting fills the window; below it, large pictures beside the text, one section at a time ---------- */
@media (min-width: 900px) and (min-aspect-ratio: 1/1) {
  .frame { width: 100%; }
  .frame canvas[data-scene], .scrim { -webkit-mask-image: none; mask-image: none; }
  .scrim { height: 40%; }
  .caps { height: 300px; }
  .cap { left: 0; right: 0; margin: 0 auto; max-width: 900px; bottom: 66px; gap: 8px; }
  .cap .lbl { font-size: 18px; }
  .cap .names { font-size: 56px; }
  .cap .line { font-size: 34px; }
  .cap .sub { font-size: 20px; }
  .cap .hint { font-size: 17px; margin-top: 8px; }
  .cap .hint svg { width: 19px; height: 19px; }
  .dots { bottom: 32px; gap: 12px; }
  .dots span { width: 9px; height: 9px; }
  .invite { padding-bottom: 27vh; }
  .invite .names { font-size: 51px; }
  .invite .when { font-size: 23px; }

  .page { max-width: none; padding: 80px 0 0; gap: 120px; }
  .col { gap: 120px; }
  .page > :not(.col), .col > * { width: min(1140px, calc(100% - 112px)); margin-left: auto; margin-right: auto; }
  .page > .count { width: min(680px, calc(100% - 112px)); gap: 16px; }
  .tile { padding: 22px 0 18px; }
  .tile .num { font-size: 46px; }
  .tile .unit { font-size: 14px; }

  /* venue and schedule: no card, a large picture on one side and the words on the other, sides alternating */
  .venue { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 64px; align-items: center; background: none; overflow: visible; }
  .venue::after { display: none; }
  .venue canvas[data-deco] { height: 440px; border-radius: var(--wob-a); }
  .venue .pad { padding: 0; gap: 12px; }
  .venue .h { font-size: 32px; }
  .venue .mut { font-size: 17px; }
  #raspored { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); }
  #raspored canvas[data-deco] { order: 2; border-radius: var(--wob-c); }
  .timeline { margin-top: 22px; }
  .timeline li { padding-bottom: 24px; }
  .timeline .time { font-size: 20px; }
  .timeline .what { font-size: 18px; }
  .timeline .mut { font-size: 15px; }

  .info { gap: 26px; }
  .info .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
  .tip { padding: 24px 22px; gap: 8px; }
  .tip h3 { font-size: 20px; }
  .tip .mut { font-size: 15px; }

  .page > .rsvp, .page > .letter { width: min(620px, calc(100% - 112px)); }
  .rsvp .h, .letter .h { font-size: 29px; }
  .pad { padding: 30px 30px; }
  .foot { margin-top: 110px; }
  .foot .small-names { font-size: 32px; }
  .foot canvas[data-deco] { height: 360px; margin-top: 26px; }
}

/* ---------- life in the components (only when scripts run, and not for people who asked for less motion) ---------- */
.btn, .btn2, .opt, .chip, .in { transition: transform .18s, filter .18s, color .18s; }
.btn:active, .btn2:active, .chip:active { transform: scale(.97) rotate(-.4deg); }
@media (hover: hover) {
  .btn:hover { transform: translateY(-2px) rotate(-.5deg); filter: brightness(1.12); }
  .btn2:hover { transform: rotate(-.6deg); }
  .btn2:hover::after, .opt:hover::after, .chip:hover::after { border-color: var(--green); border-width: 2.4px; }
  .tip { transition: transform .25s; }
  .tip:hover { transform: translateY(-3px) rotate(.5deg); }
}
/* things rise into place as they are reached */
.js [data-rise] { opacity: 0; transform: translateY(18px); transition: opacity .7s ease, transform .7s cubic-bezier(.2, .7, .2, 1); transition-delay: calc(var(--i, 0) * 90ms); }
.js [data-rise][data-in] { opacity: 1; transform: none; }
/* the schedule draws itself: each dab lands, then its line runs down to the next */
.js .timeline li::before { transform: scale(0); transition: transform .45s cubic-bezier(.3, 1.6, .5, 1); transition-delay: calc(var(--i) * 260ms + 200ms); }
.js .timeline li::after { transform: scaleY(0); transform-origin: top; transition: transform .5s ease; transition-delay: calc(var(--i) * 260ms + 380ms); }
.js .timeline li > span { opacity: 0; transform: translateX(-8px); transition: opacity .5s, transform .5s; transition-delay: calc(var(--i) * 260ms + 260ms); }
.js [data-in] .timeline li::before { transform: scale(1); }
.js [data-in] .timeline li::after { transform: scaleY(1); }
.js [data-in] .timeline li > span { opacity: 1; transform: none; }
/* the countdown breathes with each second */
.tile .num[data-tick] { animation: tick .5s ease; }
@keyframes tick { 0% { transform: translateY(-5px); opacity: .35; } 100% { transform: none; opacity: 1; } }
/* each RSVP step slides in */
.steps fieldset:not([hidden]) { animation: step .45s cubic-bezier(.2, .7, .2, 1); }
@keyframes step { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
.thanks:not([hidden]) .tick { animation: pop .6s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes pop { from { transform: scale(0); } to { transform: scale(1); } }

@media (prefers-reduced-motion: reduce) {
  .bars span, .dots span, .btn, .btn2, .opt, .chip, .in, .tip { transition: none; }
  .js [data-rise], .js .timeline li::before, .js .timeline li::after, .js .timeline li > span { opacity: 1; transform: none; transition: none; }
  .tile .num[data-tick], .steps fieldset:not([hidden]), .thanks:not([hidden]) .tick { animation: none; }
}
