/* =========================================================================
   Trouwen: base styles (reset, typography, layout primitives, motion)
   Tokens only. Component styles live in scoped .razor.css files.
   ========================================================================= */

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html {
  overflow-x: clip; /* with body: phones never pan sideways, even if one pixel sticks out */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-h);
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  min-height: 100dvh;
  background: var(--texture-paper), var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-synthesis: none; /* no fake italics or bold on the script and display faces */
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
body.menu-open { overflow: hidden; }
img, picture, svg, video { display: block; max-width: 100%; height: auto; }
input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
p, h1, h2, h3, h4, h5, h6 { overflow-wrap: break-word; }
ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }
::selection { background: var(--color-selected-bg); color: var(--color-text); }

/* ---- Typography ---- */
/* Display: tall hand-drawn capitals, like "DAGPLANNING" on the invitation. */
h1, h2, h3, .display {
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-display);
  text-transform: uppercase;
  text-wrap: balance;
}
h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }
/* h4 is too small for the display face: quiet body capitals instead. */
h4 {
  font-family: var(--font-body);
  font-size: var(--fs-h4);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-heading);
  letter-spacing: var(--tracking-button);
}

/* Script: the couple's names and nothing else. */
.script {
  font-family: var(--font-script);
  font-weight: var(--fw-regular);
  text-transform: none;
  letter-spacing: 0;
  line-height: 1;
  color: var(--color-script);
}
p { text-wrap: pretty; }

.lead { font-size: var(--fs-lead); color: var(--color-text-muted); max-width: var(--measure); }
.small { font-size: var(--fs-small); }
.muted { color: var(--color-text-muted); }
.italic { font-style: italic; }
.eyebrow {
  font-family: var(--font-body);
  font-size: var(--fs-micro);
  font-weight: var(--fw-medium);
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--color-text-muted);
}
.numerals { font-family: var(--font-body); font-weight: var(--fw-light); letter-spacing: var(--tracking-date); font-variant-numeric: lining-nums tabular-nums; }
/* The small "en" between the names, as on the invitation */
.amp { font-family: var(--font-body); font-size: var(--fs-small); font-weight: var(--fw-light); letter-spacing: var(--tracking-button); color: var(--color-text-muted); }

a {
  color: var(--color-accent);
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0% 1px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size var(--dur-base) var(--ease-soft);
}
a:hover, a:focus-visible { background-size: 100% 1px; }
.prose a { background-size: 100% 1px; }
.prose a:hover { background-size: 0% 1px; background-position: 100% 100%; }

:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--radius-sm); }

/* Headings and regions focused by code (FocusOnNavigate, stepper) get no ring: they are not controls. */
h1:focus, h2:focus, h3:focus, [tabindex="-1"]:focus { outline: none; box-shadow: none; }

/* ---- Layout primitives ---- */
.container {
  width: min(100% - 2 * var(--gutter), var(--container));
  margin-inline: auto;
}
.container--wide { width: min(100% - 2 * var(--gutter), var(--container-wide)); }
.container--narrow { width: min(100% - 2 * var(--gutter), var(--container-narrow)); }
.section { padding-block: var(--section-pad); }
.section--band { background: var(--color-band); }
.section--surface { background: var(--color-surface); }
.stack > * + * { margin-top: var(--stack-gap, var(--space-5)); }
.center { text-align: center; }
.center .lead, .center .measure { margin-inline: auto; }
.measure { max-width: var(--measure); }
.cluster { display: flex; flex-wrap: wrap; gap: var(--space-4); align-items: center; }

/* Gold foil: letters printed in foil, like the names on the invitation.
   The padding gives the script's swashes room inside the clipped background; the margin cancels it. */
.foil {
  color: var(--color-script);
}

@supports (background-clip: text) or (-webkit-background-clip: text) {
  .foil {
    padding: .2em .3em;
    margin: -.2em -.3em;
    background-image: var(--foil-glint), var(--foil-base);
    background-size: 300% 100%, 100% 100%;
    background-position: 100% 0, 0 0;
    background-repeat: no-repeat;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(var(--foil-emboss));
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
  }

  /* Now and then a reflection glides over the letters, as if the card is tilted under a lamp.
     Background-position is the one paint-only animation allowed besides opacity and transform (design system §6). */
  .foil--shine {
    animation: foil-glint var(--dur-foil) var(--ease-flow) var(--foil-delay, 0s) infinite;
  }
}

@keyframes foil-glint {
  0%        { background-position: 100% 0, 0 0; }
  32%, 100% { background-position: 0% 0, 0 0; }
}

@media (prefers-reduced-motion: reduce) {
  .foil--shine { animation: none; }
}

/* Stationery: the coloured inserts of the invitation. Shape and colour are combined freely. */
.stationery {
  --stationery-pad: var(--space-6);
  position: relative;
  padding: var(--stationery-pad);
  border-radius: var(--radius-lg);
  background: var(--texture-paper), var(--color-surface);
  box-shadow: var(--shadow-paper);
  color: var(--color-text);
}
.stationery--arch-start { border-radius: var(--radius-arch-start); padding-top: calc(var(--stationery-pad) * 2); }
.stationery--arch-end   { border-radius: var(--radius-arch-end);   padding-top: calc(var(--stationery-pad) * 2); }
/* A hand-drawn gold outline around an arch card, a little off its edge and turned, like the hero's pen line. */
/* Tighter at the sides and only half a degree: on a tall card a bigger turn swings past the screen edge. */
.stationery--drawn::after {
  content: "";
  position: absolute;
  inset: calc(-1 * var(--space-2)) calc(-1 * var(--space-1));
  border: 1px solid var(--color-ornament);
  border-radius: var(--radius-arch-start-alt);
  rotate: -.5deg;
  pointer-events: none;
}
.stationery--arch-end.stationery--drawn::after { border-radius: var(--radius-arch-end-alt); rotate: .5deg; }
.stationery--sage       { background: var(--texture-paper), var(--color-card-sage); color: var(--color-card-sage-text); }
.stationery--terracotta { background: var(--texture-paper), var(--color-card-terracotta); color: var(--color-card-terracotta-text); }
.stationery--sage :is(h1, h2, h3, .display) { color: var(--color-card-sage-title); }
.stationery :is(.eyebrow, .muted, .lead) { color: inherit; }

/* Organic pebble frame: a sand pebble with a clay outline that is slightly bigger, turned and a different shape. */
.pebble {
  position: relative;
  display: grid;
  place-items: center;
  border-radius: var(--radius-organic);
  background: var(--color-band);
}

.pebble::after {
  content: "";
  position: absolute;
  inset: calc(-1 * var(--space-3));
  border: 1px solid var(--color-ornament);
  border-radius: var(--radius-organic-alt);
  rotate: -3deg;
  pointer-events: none;
}
.center .cluster { justify-content: center; }

/* ---- Pages: narrative screens scroll one full "page" at a time (design system §5b) ----
   Mark the wrapper with .pages and every screen with .page. Only for guest-facing story pages,
   never for forms or admin screens. A page taller than the screen still scrolls freely inside. */
html:has(.pages) {
  scroll-snap-type: y mandatory;
  scroll-padding-top: 0;
}

/* Short landscape phones: snapping would fight the user, so only suggest it. */
@media (max-height: 34rem) {
  html:has(.pages) { scroll-snap-type: y proximity; }
}

.page {
  position: relative;
  display: grid;
  align-content: center;
  min-height: 100svh;
  padding-block: calc(var(--header-h) + var(--space-6)) var(--space-8);
  scroll-snap-align: start;
  scroll-snap-stop: always; /* one page per gesture, even after a fast flick */
}

.page--band { background: var(--color-band); }
.page--surface { background: var(--color-surface); }

/* The footer is the last snap point, otherwise mandatory snapping could not reach it. */
html:has(.pages) .site-footer { scroll-snap-align: end; }

/* Page dots: built by site.js from [data-page] elements. */
.page-dots {
  position: fixed;
  top: 50%;
  right: var(--space-4);
  z-index: var(--z-header);
  display: grid;
  gap: var(--space-1);
  translate: 0 -50%;
}

.page-dots button {
  display: grid;
  place-items: center;
  width: var(--space-6);
  height: var(--space-6);
  border-radius: var(--radius-pill);
}

.page-dots button::before {
  content: "";
  width: .4rem;
  height: .4rem;
  border-radius: var(--radius-pill);
  background: var(--color-line-strong);
  transition: transform var(--dur-base) var(--ease-soft), background-color var(--dur-base) var(--ease-soft);
}

.page-dots button:hover::before { background: var(--color-text-muted); }
.page-dots button[aria-current="true"]::before { background: var(--color-accent); transform: scale(1.5); }

@media (max-width: 47.99rem) {
  .page-dots { right: var(--space-1); }
  .page-dots button { width: var(--space-5); height: var(--space-5); }
}

body.menu-open .page-dots { opacity: 0; pointer-events: none; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed;
  top: var(--space-3);
  left: var(--space-3);
  z-index: calc(var(--z-dialog) + 1);
  padding: var(--space-3) var(--space-5);
  background: var(--color-primary);
  color: var(--color-text-inverse);
  border-radius: var(--radius-pill);
  transform: translateY(-200%);
  transition: transform var(--dur-quick) var(--ease-soft);
}
.skip-link:focus-visible { transform: translateY(0); }

/* ---- Motion: reveal on scroll (only hidden when JS can reveal it) ---- */
@media (scripting: enabled) {
  .reveal {
    opacity: 0;
    transform: translateY(var(--rise));
    transition:
      opacity var(--dur-slow) var(--ease-soft),
      transform var(--dur-slow) var(--ease-soft);
    transition-delay: calc(var(--reveal-index, 0) * var(--stagger));
  }
  .reveal.is-visible { opacity: 1; transform: none; }
}

@keyframes fade-rise {
  from { opacity: 0; transform: translateY(var(--rise)); }
  to { opacity: 1; transform: none; }
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes soft-pulse {
  0%, 100% { opacity: .35; transform: scale(.85); }
  50% { opacity: 1; transform: scale(1); }
}
.pulse-dot {
  display: inline-block;
  width: .5em; height: .5em;
  border-radius: var(--radius-pill);
  background: currentColor;
  animation: soft-pulse 1.4s var(--ease-soft) infinite;
}

/* ---- Print: only the content, on white ---- */
@media print {

  .site-header, .site-menu, .site-footer, .skip-link, .no-print, #blazor-error-ui, #components-reconnect-modal { display: none !important; }
  .site-main { padding-top: 0; }
  .reveal { opacity: 1 !important; transform: none !important; }
  /* Printers drop backgrounds: foil falls back to solid gold so it never prints invisible. */
  .foil { background: none !important; -webkit-text-fill-color: currentColor; filter: none; }
}

/* ---- Blazor error UI (restyled) ---- */
#blazor-error-ui {
  display: none;
  position: fixed;
  inset: auto var(--space-4) var(--space-4) var(--space-4);
  z-index: var(--z-toast);
  max-width: 32rem;
  margin-inline: auto;
  padding: var(--space-4) var(--space-5);
  background: var(--color-text);
  color: var(--color-text-inverse);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  font-size: var(--fs-small);
}
#blazor-error-ui a { color: var(--color-text-inverse); background-size: 100% 1px; margin-left: var(--space-3); }
#blazor-error-ui .dismiss { float: right; cursor: pointer; margin-left: var(--space-4); }

/* ---------- Song rows (music step + DJ board) ---------- */
.song {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--space-2) var(--space-4);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.song > :nth-child(n + 4) {
  grid-column: 2 / -1;
  justify-self: start;
}

@media (min-width: 40rem) {
  .song {
    grid-template-columns: auto 1fr auto auto;
  }

  .song > :nth-child(n + 4) {
    grid-column: auto;
  }
}

.song__text {
  display: grid;
  min-width: 0;
}

.song__title {
  font-weight: var(--fw-medium);
  overflow-wrap: anywhere;
}

.song__artists,
.song__duration {
  font-size: var(--fs-small);
  color: var(--color-text-muted);
}

.song__note {
  margin-top: var(--space-1);
  font-size: var(--fs-small);
  font-style: italic;
  color: var(--color-text-muted);
}

.song__explicit {
  display: inline-grid;
  place-items: center;
  width: 1.1em;
  height: 1.1em;
  margin-left: var(--space-1);
  border-radius: var(--radius-xs);
  background: var(--color-line-strong);
  font-size: .7em;
  vertical-align: middle;
}

.song-art {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--color-band);
}

.song-art--empty {
  display: grid;
  place-items: center;
  color: var(--color-ornament);
}

.song-art--empty svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.25;
}

.songs {
  display: grid;
  gap: var(--space-6);
}

.songs__search,
.songs__manual {
  display: grid;
  gap: var(--space-3);
}

.songs__notice {
  margin-top: calc(-1 * var(--space-2));
}

.songs__results,
.songs__list {
  display: grid;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

/* Search results scroll inside their own box, so "Jullie verzoekjes" stays close below the search field.
   A soft shadow shows at the top or bottom edge only while results are hidden that way (as on the day planning). */
.songs__results {
  --hint-cover: var(--color-bg);
  --hint-shadow: color-mix(in srgb, var(--color-text) 14%, transparent);
  max-height: min(28rem, 55svh);
  padding-block: var(--space-1);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--color-line-strong) transparent;
  background:
    linear-gradient(var(--hint-cover) 40%, transparent) top / 100% var(--space-6) no-repeat local,
    linear-gradient(transparent, var(--hint-cover) 60%) bottom / 100% var(--space-6) no-repeat local,
    linear-gradient(var(--hint-shadow), transparent) top / 100% var(--space-4) no-repeat scroll,
    linear-gradient(transparent, var(--hint-shadow)) bottom / 100% var(--space-4) no-repeat scroll;
}

/* "Jullie verzoekjes": a folded panel that sticks to the bottom of the screen while the music step scrolls.
   On mobile it rests on top of the stepper's sticky action bar (button + its padding). */
.songs__mine {
  --songs-mine-bottom: 0;
  position: sticky;
  bottom: var(--songs-mine-bottom);
  z-index: 1;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  background: var(--color-surface);
  box-shadow: 0 -1px 0 var(--color-line), var(--shadow-soft);
}

@media (max-width: 47.99rem) {
  .songs__mine {
    --songs-mine-bottom: calc(var(--tap-lg) + 2 * var(--space-4) + env(safe-area-inset-bottom));
    margin-inline: calc(-1 * var(--gutter));
  }
}

.songs__mine-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: var(--tap-min);
  padding: var(--space-3) var(--space-5);
  font-weight: var(--fw-semibold);
  cursor: pointer;
  list-style: none;
}

.songs__mine-title::-webkit-details-marker {
  display: none;
}

/* A thin hand-weight chevron: points up while folded (the panel opens upwards), down when open. */
.songs__mine-title::after {
  content: "";
  flex: none;
  width: 0.55em;
  height: 0.55em;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  transform: translateY(25%) rotate(-135deg);
  transition: transform var(--dur-base) var(--ease-soft);
}

.songs__mine[open] .songs__mine-title::after {
  transform: translateY(-25%) rotate(45deg);
}

.songs__mine-body {
  max-height: 45svh;
  padding: 0 var(--space-5) var(--space-5);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.songs__mine-body .songs__list {
  margin-top: 0;
}

.songs__mine-body .song {
  background: var(--color-bg);
}
