/* alicia & ryan — shared stylesheet for every page.

   Every page is ONE fixed stage exactly the size of the screen. The body never scrolls.
   - Phones / portrait: title band on top, one scrolling text panel, a small collage accent and the next arrow below.
   - Wide screens: a 1366 x 768 design (Canva's canvas) scaled to fit; collage pieces sit where they were recorded, text is real
     HTML seated in the same boxes, and long text scrolls inside its own panel.
   Text is always ordinary HTML text on one type scale; only collage pieces are positioned. */

@font-face { font-family: "29LT Makina"; src: url("../assets/fonts/29lt-makina-regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Courier Prime"; src: url("../assets/fonts/courier-prime-regular.woff") format("woff"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Courier Prime"; src: url("../assets/fonts/courier-prime-bold.woff") format("woff"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Courier Prime"; src: url("../assets/fonts/courier-prime-italic.woff") format("woff"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Courier Prime"; src: url("../assets/fonts/courier-prime-bold-italic.woff") format("woff"); font-weight: 700; font-style: italic; font-display: swap; }

:root {
  --paper: #f1eee3;
  --ink: #222;
  --blue: #7790bb;
  --olive: #696d44;
  --rose: #b96f67;
  --rose-text: #a4554d;
  --wine: #6c2118;

  --font-display: "29LT Makina", "Courier Prime", "Courier New", monospace;
  --font-body: "Courier Prime", "Courier New", Courier, monospace;

  /* type scale (phone values; the wide stage redefines them relative to the stage) */
  --fs-display: clamp(1.75rem, 0.9rem + 4.1vw, 4.5rem);
  --fs-h2: clamp(1.3rem, 1.03rem + 1.3vw, 2.25rem);
  --fs-h3: clamp(1.125rem, 1.03rem + 0.45vw, 1.5rem);
  --fs-body: clamp(1rem, 0.95rem + 0.25vw, 1.1875rem);
  --fs-small: clamp(0.9375rem, 0.9rem + 0.15vw, 1.0625rem);

  --measure: 34rem;
  --gutter: clamp(1rem, 0.4rem + 3vw, 3.5rem);
  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: clamp(1.75rem, 1.3rem + 2vw, 3rem);
  --u: 1vw;               /* unit for entrance offsets */
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  background: var(--paper); color: var(--ink);
  font-family: var(--font-body); font-size: var(--fs-body); line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; }
h1, h2, h3, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }

h1, h2, h3, .display { font-family: var(--font-display); font-weight: 400; text-wrap: balance; }
h1, .display { font-size: var(--fs-display); line-height: 1.05; }
h2 { font-size: var(--fs-h2); line-height: 1.15; }
h3 { font-size: var(--fs-h3); line-height: 1.25; }
p, li { text-wrap: pretty; overflow-wrap: break-word; }
.prose { max-width: var(--measure); }
.prose > * + * { margin-top: var(--space-2); }

a { color: inherit; text-decoration: underline; text-decoration-thickness: 0.08em; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 0.14em; }
a:focus-visible, button:focus-visible, [tabindex]:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; border-radius: 2px; }
.callout { color: var(--wine); font-weight: 700; }

/* ---------- collage pieces ---------- */
.collage { position: relative; width: 100%; aspect-ratio: var(--ar); pointer-events: none; user-select: none; }
.collage--clip { overflow: clip; }
.piece, .clipbox { position: absolute; left: var(--x); top: var(--y); width: var(--w); height: var(--h); max-width: none; display: block; }
.piece { transform: rotate(var(--r, 0deg)) scaleX(var(--fx, 1)); }
.clipbox { overflow: hidden; }
.piece.crop { overflow: hidden; }
.piece.crop > img { position: absolute; max-width: none; display: block; transform: scaleX(var(--fx, 1)); }
svg.piece { overflow: visible; }

/* a box that holds a cluster as large as fits, keeping its shape */
.fitbox { container-type: size; display: grid; place-items: center; min-height: 0; min-width: 0; }
.fitbox > .collage, .fitbox > .fit-in { width: min(100cqw, calc(100cqh * var(--ar))); }
.fit-in { aspect-ratio: var(--ar); display: grid; container-type: inline-size; }
.fit-in > * { grid-area: 1 / 1; }

/* ---------- the stage: phones and portrait screens ---------- */
.stage {
  position: fixed; inset: 0; height: 100dvh; overflow: hidden;
  display: flex; flex-direction: column; gap: var(--space-1);
  padding: 0.6rem var(--gutter) 0;
}
.stage-art { display: none; }

.head { flex: 0 0 auto; height: clamp(4.5rem, 18dvh, 9.5rem); display: flex; align-items: center; gap: var(--space-1); }
.home-link { flex: none; font-family: var(--font-display); font-size: var(--fs-small); line-height: 1.1; padding: 0.6rem 0.25rem; }
.banner { flex: 1 1 0; height: 100%; justify-items: start; }
.banner h1 {
  align-self: center; justify-self: center; text-align: center; z-index: 1; white-space: nowrap; padding: 0.1em 0;
  /* as large as on Canva's banner, but never wider than the banner */
  font-size: min(var(--title-size, 15cqw), calc(100cqw / (var(--chars, 8) * 0.64)), 4.5rem);
  translate: calc(var(--sx, 0) * 1cqw) calc(var(--sy, 0) * 1cqw);
}

/* the one scroller: the text / form panel */
.panel { flex: 1 1 0; min-height: 0; width: 100%; max-width: 40rem; margin-inline: auto; padding: 0.25rem 0.5rem 1.5rem 0; }
.panel, .scroll-wide { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; scrollbar-width: thin; scrollbar-color: #b9b2a0 transparent; }
.panel { overflow-y: auto; }
.can-scroll:not(.at-end) { -webkit-mask-image: linear-gradient(#000 calc(100% - 3.5rem), transparent); mask-image: linear-gradient(#000 calc(100% - 3.5rem), transparent); }
.panel > * + * { margin-top: var(--space-2); }

/* phones: the page's photos shown whole at the END of the scrolling panel (inside the scroller, after the text).
   Usage, as the last child of the panel:
     <div class="panel-art phone-only"><!--collage page=".." name="photos" ids=".." alts=".."--></div>
   The cluster keeps its shape and takes the full width of the panel; add more than one for separate clusters. */
.panel-art { width: 100%; margin: var(--space-4) auto 0; }
.panel-art + .panel-art { margin-top: var(--space-3); }
.panel-art > .collage { width: 100%; }

/* bottom band: collage accent in a corner, sign-off, and room for the arrow in the middle */
.band { flex: 0 0 auto; height: clamp(4.25rem, 14dvh, 8rem); display: flex; align-items: flex-end; justify-content: space-between; gap: 4.5rem; padding-bottom: 0.3rem; }
.band > .fitbox { flex: 1 1 0; height: 100%; place-items: end; }
.band > .fitbox:first-child { place-items: end start; }
.band > .signoff { flex: 1 1 0; align-self: center; font-family: var(--font-display); font-size: var(--fs-small); line-height: 1.3; white-space: nowrap; }
.band--empty { height: 3.75rem; }

/* label on alternative-layout pages (added by the builder, same on all of them): small, top right corner */
.alt-tag {
  position: absolute; top: 0.35rem; right: 0.5rem; z-index: 21; margin: 0; padding: 0.1rem 0.45rem;
  font-family: var(--font-display); font-size: 0.8125rem; line-height: 1.3; letter-spacing: 0.04em; white-space: nowrap;
  color: #5c5750; background: rgb(241 238 227 / 0.9); border: 1px dashed #b9b2a0; border-radius: 0.3rem; pointer-events: none;
}

/* next-page arrow */
.next {
  position: absolute; left: 50%; bottom: 0.35rem; z-index: 20; transform: translateX(-50%);
  display: grid; justify-items: center; gap: 0; min-width: 4.5rem; min-height: 3rem; padding: 0.15rem 0.5rem;
  font-family: var(--font-display); font-size: 0.9375rem; line-height: 1.1; text-decoration: none; color: var(--ink); white-space: nowrap;
  background: rgb(241 238 227 / 0.86); border-radius: 0.6rem;
}
.next svg { width: 3.4rem; height: auto; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.next:hover .next__label { text-decoration: underline; }

/* ---------- home (phone) ---------- */
.home { align-items: center; gap: 0.6rem; padding-bottom: 3.9rem; }
.home__photo { flex: 0 1 40dvh; width: 100%; }
.home h1 { text-align: center; flex: none; font-size: min(var(--fs-display), 5.2dvh); }
.home__splash { flex: 0 1 31dvh; width: 100%; }
.home__splash-text { z-index: 1; padding-top: 11%; display: grid; gap: 0.35rem; justify-items: center; align-content: start; text-align: center; }
.home__splash-text .display { font-size: min(var(--fs-display), 4.6dvh, 9cqw); }
.home__more { font-family: var(--font-display); font-size: max(1rem, min(var(--fs-h3), 5cqw)); padding: 0.3rem 0.5rem; }
.home__trinkets { flex: 0 0 9.5dvh; width: min(100%, 22rem); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-2); }
.home__trinkets > .fitbox { height: 100%; }

/* ---------- content styles (shared by both layouts) ---------- */
.lead { font-family: var(--font-display); font-size: var(--fs-h3); line-height: 1.35; text-wrap: balance; }
.subhead { font-family: var(--font-body); font-weight: 700; font-size: var(--fs-body); line-height: 1.4; text-wrap: balance; }
.tone-blue { color: var(--blue); }
.tone-olive { color: var(--olive); }
.tone-rose { color: var(--rose); }

.faq > .qa + .qa { margin-top: var(--space-3); }
.qa > * + * { margin-top: 0.35rem; }
.hotels > li { font-style: italic; padding-left: 1.2em; text-indent: -1.2em; }
.hotels > li + li { margin-top: 0.5rem; }
.stars { font-style: normal; white-space: nowrap; }

.schedule > .day + .day { margin-top: var(--space-4); }
.day > * + * { margin-top: 0.5rem; }
.day > h3 { margin-top: var(--space-3); font-size: var(--fs-h2); }
.day > h3 + p { margin-top: 0.25rem; }
.events { margin-top: var(--space-2) !important; display: grid; gap: 0.5rem; }
.events > li { padding-left: 1.4em; text-indent: -1.4em; }
.events > li::before { content: "\2014\00a0"; }

address { font-style: normal; font-weight: 700; }
.directions > address { margin-top: 0; }
.directions > h2 { margin-top: var(--space-3); }
.arrows { display: grid; gap: 0.35rem; }
.arrows > li { padding-left: 1.9em; text-indent: -1.9em; }
.arrows > li::before { content: "\27F6\00a0"; }
.directions > .arrows + .arrows { margin-top: var(--space-3); }
.directions > .callout { margin-top: var(--space-3); }

.map { height: 100%; display: grid; place-items: start center; }
.map > img { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; }

.form-placeholder { border: 2px dashed var(--rose); border-radius: 0.5rem; padding: var(--space-3); min-height: 12rem; display: grid; align-content: center; gap: var(--space-1); background: rgb(255 255 255 / 0.35); }
.form-placeholder > h2 { font-family: var(--font-body); font-weight: 700; font-size: var(--fs-body); letter-spacing: 0.04em; text-transform: uppercase; color: var(--rose-text); }
.form-placeholder > p { font-size: var(--fs-small); }

/* RSVP form component (built separately, /rsvp/rsvp.css). Its own header repeats the page title and home
   link, so it is hidden; its auto margins would let it size to its content inside a grid, so it is pinned. */
.rsvp-col { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-2); }
.rsvp-col > .rsvp { width: 100%; min-width: 0; margin-inline: 0; }
.preview-note { font-size: var(--fs-small); color: var(--rose-text); border: 1px dashed var(--rose); border-radius: 0.35rem; padding: 0.4rem 0.7rem; justify-self: start; }

.day__deco { width: min(50%, 11rem); margin-bottom: var(--space-1); }
.wide-only { display: none; }

/* ---------- the stage: wide screens (a 1366 x 768 design (Canva's canvas) scaled to fit) ---------- */
@media (min-width: 37.5rem) and (min-aspect-ratio: 1/1) {
  :root { --u: 1cqw; }
  .stage {
    inset: auto; left: 50%; top: 50%; width: min(100vw, 177.865dvh); height: auto; aspect-ratio: 1366 / 768;
    transform: translate(-50%, -50%); container-type: size; overflow: visible; display: block; padding: 0;
    /* type scale relative to the stage; body text never drops below 16px, the panel scrolls instead */
    --fs-h2: max(1.25rem, 2.5cqw);
    --fs-h3: max(1.0625rem, 1.67cqw);
    --fs-body: max(1rem, 1.22cqw);
    --fs-small: max(0.9375rem, 1.1cqw);
    font-size: var(--fs-body);
  }
  .stage-art { display: block; position: absolute; inset: 0; pointer-events: none; user-select: none; }
  .phone-only { display: none !important; }
  .wide-only { display: block; }
  .head, .banner, .fit-in, .band, .panel.split, .home__photo, .home__splash, .home__splash-text, .home__trinkets { display: contents; }

  /* text seated where Canva had it */
  .region { position: absolute; left: var(--rx); top: var(--ry); width: var(--rw); z-index: 2; margin: 0; max-width: none; }
  /* never taller than the room above the arrow (the arrow keeps a minimum size when the stage is small) */
  .region.box { height: min(var(--rh), calc(100% - var(--ry) - 1.2cqw - 4rem)); }
  .fit { font-size: max(var(--fs-min, 0.9375rem), var(--fs)); line-height: var(--lh, 1.1); text-align: var(--ta, left); padding: 0; }
  .fit:not(.lead) { white-space: nowrap; }
  .band > .signoff.fit { font-size: max(1rem, var(--fs)); line-height: var(--lh, 1.15); }
  .banner h1, .home h1 { translate: none; white-space: nowrap; font-size: max(1.5rem, var(--fs)); }
  .home .display.fit { font-size: max(1.5rem, var(--fs)); text-align: center; }
  .home__more { font-size: inherit; padding: 0; }
  .home-link { padding: 0; }
  .panel { padding: 0 0.6rem 1.5rem 0; }
  .panel.region, .scroll-wide { overflow-y: auto; }
  .panel.split { overflow: visible; }
  .signoff { font-family: var(--font-display); white-space: nowrap; }
  .lead { text-wrap: balance; }
  .form-placeholder.region { min-height: 0; overflow: hidden; }
  /* just left of centre: the one spot along the bottom edge that is clear of the collage on all 8 pages */
  .next { left: 44.5%; bottom: 1.2cqw; font-size: max(0.9375rem, 1.15cqw); }
  .next svg { width: max(3.2rem, 4.2cqw); }
}

/* ---------- one header arrangement on every inner page, wide stage (review comment #40) ----------
   Home link at the left edge, then the page's title on its banner, in one fixed slot at the top left.
   Page CSS must not position .head, .home-link, .banner or the h1 on the wide stage, and should keep the slot
   (x 0-36cqw, y 0-15cqw) free of other pieces. */
@media (min-width: 37.5rem) and (min-aspect-ratio: 1/1) {
  .stage .head.head--std {
    display: flex; position: absolute; left: 2.2cqw; top: 1.8cqw; width: 33cqw; height: 12.5cqw; z-index: 3;
    align-items: center; gap: 1cqw;
  }
  .stage .head--std .home-link.region { position: static; width: auto; flex: none; padding: 0.4rem 0.2rem; font-size: max(0.9375rem, 1.43cqw); line-height: 1.1; }
  .stage .head--std .banner { display: grid; container-type: size; flex: 1 1 0; height: 100%; place-items: center start; min-width: 0; }
  .stage .head--std .fit-in { display: grid; container-type: inline-size; width: min(100cqw, calc(100cqh * var(--ar))); aspect-ratio: var(--ar); }
  .stage .head--std .fit-in > * { grid-area: 1 / 1; }
  .stage .head--std .phone-only { display: block !important; }
  .stage .head--std h1.region {
    position: static; width: auto; align-self: center; justify-self: center; text-align: center; white-space: nowrap; padding: 0.1em 0;
    font-size: min(var(--title-size, 15cqw), calc(100cqw / (var(--chars, 8) * 0.64))); line-height: 1.05;
    translate: calc(var(--sx, 0) * 1cqw) calc(var(--sy, 0) * 1cqw);
  }
}

/* ---------- entrance animation ---------- */
/* Runs only with JS on and motion welcome. Nothing shows until the stage's images are decoded (html.ready),
   then every piece glides in from where Canva starts it. Only transform and opacity are animated. */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: 220ms; }

  .js:not(.ready) .piece, .js:not(.ready) [data-type], .js:not(.ready) .rise { opacity: 0; }

  .js.ready .piece.a-fly { animation: fly var(--dur, 800ms) cubic-bezier(0.2, 0.75, 0.25, 1) var(--d, 0ms) both; will-change: transform, opacity; }
  @keyframes fly {
    0% { opacity: 0; transform: translate(calc(var(--dx, 0) * var(--u)), calc(var(--dy, 0) * var(--u))) rotate(calc(var(--r, 0deg) + var(--r0, 0deg))) scaleX(var(--fx, 1)); }
    10% { opacity: 1; }
    100% { opacity: 1; transform: translate(0, 0) rotate(var(--r, 0deg)) scaleX(var(--fx, 1)); }
  }
  .js.ready .piece.a-fade { animation: fade 450ms ease-out var(--d, 0ms) both; }
  @keyframes fade { from { opacity: 0; } to { opacity: 1; } }

  /* watercolour wash uncovered from the left: the frame slides in while the picture slides back, so the
     picture stays put and only the visible part grows */
  .js.ready .piece.a-wipe { animation: wipe-frame var(--dur, 2200ms) cubic-bezier(0.3, 0.2, 0.3, 1) var(--d, 0ms) both; will-change: transform; }
  .js.ready .piece.a-wipe > img { animation: wipe-pic var(--dur, 2200ms) cubic-bezier(0.3, 0.2, 0.3, 1) var(--d, 0ms) both; will-change: transform; }
  @keyframes wipe-frame { from { transform: translateX(-100%); } to { transform: translateX(0); } }
  @keyframes wipe-pic { from { transform: translateX(100%); } to { transform: translateX(0); } }

  /* text: display lines type on evenly, other text rises in */
  .js.ready [data-type]:not(.typed) { opacity: 0; }
  .js [data-type] .ch { opacity: 0; }
  .js.ready [data-type] .ch { animation: fade 70ms linear both; animation-delay: calc(var(--t0, 150ms) + var(--i) * var(--dt, 42ms)); }
  .js.ready .rise { animation: rise 520ms cubic-bezier(0.2, 0.7, 0.2, 1) var(--d, 200ms) both; }
  @keyframes rise { from { opacity: 0; transform: translateY(1.75rem); } to { opacity: 1; transform: translateY(0); } }

  .next svg { animation: bob 2.6s ease-in-out 3s infinite; }
  @keyframes bob { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(0.4rem); } }
}
.word { display: inline-block; white-space: nowrap; }
