/* Engine base styles: structure only. Themes supply colours, fonts and art through
   tokens (see docs/theme-contract.md). Mobile first. No client text lives here. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 1.125rem;
  line-height: 1.6;
  padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px);
}
img, video { max-width: 100%; display: block; }
a { color: var(--color-accent); }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.25; margin: 0; }
p { margin: 0 0 .75rem; }
ul { margin: 0; padding: 0; list-style: none; }
:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 3px; }
html.intro-active { overflow: hidden; }

.invite, .static-fallback { max-width: 34rem; margin: 0 auto; }
.sec { padding: 2.25rem 1.25rem; text-align: center; }
.sec + .sec { border-top: 1px solid color-mix(in srgb, var(--color-accent) 25%, transparent); }

/* cover */
.demo-ribbon { display: inline-block; margin: 0 0 1rem; padding: .15rem .8rem; border: 1px solid var(--color-accent); border-radius: 999px; font-size: .9rem; }
.cover-art { max-width: 16rem; margin: 0 auto 1rem; }
.cover-art img { width: 100%; height: auto; }
.cover-kind { margin-bottom: .5rem; }
.cover-names { font-size: clamp(2rem, 9vw, 3rem); display: flex; flex-direction: column; align-items: center; gap: .1rem; }
.cover-names .amp { color: var(--color-accent); font-size: .6em; }
.nick { display: block; font-size: .45em; font-weight: 400; }
.cover-date { margin-top: 1rem; font-size: 1.2rem; }
.countdown { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; margin: 1.25rem auto 0; max-width: 22rem; }
.cd-unit { background: var(--color-surface); border: 1px solid var(--color-accent); border-radius: .5rem; padding: .5rem .25rem; }
.cd-num { display: block; font-family: var(--font-display); font-size: 1.6rem; font-variant-numeric: tabular-nums; line-height: 1.1; }
.cd-label { display: block; font-size: .8rem; }
.countdown-done { margin-top: 1.25rem; font-family: var(--font-display); font-size: 1.3rem; }

/* text sections */
.blessing-text, .invitation-text p { white-space: pre-line; }
.family-pair { display: grid; gap: 1.5rem; margin-top: 1rem; }
.family-title { font-size: 1.15rem; margin-bottom: .4rem; }
.invited-by { margin-top: 1.5rem; }

/* events */
.event { background: var(--color-surface); border: 1px solid color-mix(in srgb, var(--color-accent) 40%, transparent); border-radius: .75rem; padding: 1.5rem 1.25rem; }
.event + .event { margin-top: 1.25rem; }
.event-title { font-size: 1.6rem; margin-bottom: .5rem; }
.event-address { display: block; }
.event-schedule { margin: 1rem 0; text-align: left; }
.schedule-title { font-size: 1.05rem; margin-bottom: .25rem; }
.event-schedule li { display: flex; gap: .75rem; padding: .15rem 0; }
.sch-time { font-variant-numeric: tabular-nums; min-width: 3.5rem; }
.event-actions { display: flex; flex-direction: column; gap: .6rem; margin-top: 1rem; }

/* demo-only preview notes (inline, toggled by the demo buttons) */
.demo-action-note { margin: .85rem auto 0; max-width: 24rem; padding: .75rem 1rem; border: 1px solid var(--color-accent); border-radius: .5rem; background: var(--color-surface); font-size: .95rem; line-height: 1.7; text-align: center; }
.demo-action-note[hidden] { display: none; }
/* :where keeps specificity at 0 so a theme's .btn font still wins */
:where(button.btn) { font-family: inherit; font-size: inherit; line-height: inherit; cursor: pointer; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 2.9rem; padding: .5rem 1.25rem; border: 1.5px solid var(--color-accent); border-radius: .6rem; background: transparent; color: var(--color-accent); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn-primary { background: var(--color-accent); color: var(--color-bg); }
.btn-wide { width: 100%; max-width: 22rem; }
.icon { flex: none; }

/* photos: layout chosen by PACKAGE; theme only styles it */
.photo { margin: 0; }
.photo img { width: 100%; height: auto; border-radius: .75rem; }
.photo-missing { display: grid; place-items: center; min-height: 10rem; border: 1px dashed var(--color-accent); border-radius: .75rem; font-size: .95rem; }
.photo-featured { display: grid; gap: 1rem; max-width: 22rem; margin: 0 auto; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: .75rem; }
.photo-rail { display: flex; gap: .75rem; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: .5rem; -webkit-overflow-scrolling: touch; }
.photo-rail .photo { flex: 0 0 78%; scroll-snap-align: center; }

/* video */
.video-heading { margin-bottom: 1rem; }
.video-box { max-width: 20rem; margin: 0 auto; }
.video-poster { position: relative; display: block; width: 100%; padding: 0; border: 0; border-radius: .75rem; overflow: hidden; background: var(--color-surface); cursor: pointer; }
.video-poster img { width: 100%; height: auto; }
.video-play { position: absolute; inset: 0; display: grid; place-items: center; color: var(--color-bg); }
.video-play::before { content: ""; position: absolute; width: 4.2rem; height: 4.2rem; border-radius: 50%; background: var(--color-accent); opacity: .92; }
.video-play .icon { position: relative; }
.video-el { width: 100%; max-height: 70vh; border-radius: .75rem; background: #000; }
.video-error { padding: 1rem; border: 1px dashed var(--color-accent); border-radius: .5rem; }

/* rsvp + footer */
.rsvp-heading { font-size: 1.5rem; margin-bottom: .5rem; }
.rsvp-deadline { margin-bottom: 1rem; }
.sec-footer { padding-bottom: 6rem; font-size: .95rem; }
.music-credit { font-size: .78rem; opacity: .68; margin-top: .6rem; overflow-wrap: anywhere; }
.studio-credit { opacity: .75; font-size: .85rem; margin-top: 1rem; }

/* footer hosts: 1-5 names one centred column, 6+ balanced 2 columns (DOM order kept, no overflow at 360px) */
.footer-hosts-list { list-style: none; margin: 0; padding: 0; }
.footer-hosts--single .footer-hosts-list { display: grid; justify-items: center; }
.footer-hosts--two-col .footer-hosts-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .4rem .75rem; }
.footer-hosts-list li { min-width: 0; overflow-wrap: anywhere; }

/* controls (language + music), fixed bottom */
.controls { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; align-items: flex-end; gap: .5rem; padding: .75rem calc(.75rem + env(safe-area-inset-right, 0px)) calc(.75rem + env(safe-area-inset-bottom, 0px)) calc(.75rem + env(safe-area-inset-left, 0px)); pointer-events: none; }
.controls > * { pointer-events: auto; }
.lang-toggle { display: flex; background: var(--color-surface); border: 1px solid var(--color-accent); border-radius: 999px; overflow: hidden; }
.lang-btn { min-height: 2.75rem; padding: 0 .9rem; border: 0; background: transparent; color: var(--color-text); font: inherit; font-size: .95rem; cursor: pointer; }
.lang-btn[aria-pressed="true"] { background: var(--color-accent); color: var(--color-bg); }
.music-wrap { display: flex; align-items: center; gap: .5rem; margin-left: auto; }
.music-status { background: var(--color-surface); border-radius: .5rem; padding: .2rem .6rem; font-size: .85rem; }
.music-status:empty { display: none; }
.fab { display: grid; place-items: center; width: 3rem; height: 3rem; border: 1.5px solid var(--color-accent); border-radius: 50%; background: var(--color-surface); color: var(--color-accent); cursor: pointer; }
.fab[aria-pressed="true"] { background: var(--color-accent); color: var(--color-bg); }
.fab-music .fab-label { display: none; }   /* themes opt in to the labelled pill (modern-floral) */
.fab-music svg { flex: none; }

/* intro (simple) */
.intro { position: fixed; inset: 0; z-index: 10; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.25rem; padding: 1.5rem; background: var(--color-bg); text-align: center; opacity: 1; transition: opacity .45s ease; }
.intro-leaving { opacity: 0; }
.intro-art { width: min(70vw, 16rem); }
.intro-art img { width: 100%; height: auto; }
.intro-names { font-family: var(--font-display); font-size: 1.8rem; margin: 0; }

/* static fallback (before JS runs, or if it fails): stays hidden for 0.8s so JS loads cleanly with zero text flash */
@keyframes fallback-show { from { opacity: 0; } to { opacity: 1; } }
.static-fallback { padding: 2.5rem 1.25rem; text-align: center; opacity: 0; animation: fallback-show .25s ease .8s forwards; }
@media (scripting: none) { .static-fallback { opacity: 1; animation: none; } }
.static-fallback h1 { font-size: 2rem; margin-bottom: .5rem; }
.static-fallback h2 { font-size: 1.3rem; margin-top: 1.5rem; }

@media (min-width: 40rem) {
  .event-actions { flex-direction: row; justify-content: center; }
  .family-pair { grid-template-columns: 1fr 1fr; }
}
/* calm ceremonial motion: gentle hero entrance + slow reveal on scroll (both off for reduced motion) */
@keyframes hero-rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.sec-cover > .cover-kind, .sec-cover > .cover-names, .sec-cover > .cover-date, .sec-cover > .countdown, .sec-cover > .countdown-done { animation: hero-rise 1s ease-out both; }
.sec-cover > .cover-names { animation-delay: .18s; }
.sec-cover > .cover-date { animation-delay: .36s; }
.sec-cover > .countdown, .sec-cover > .countdown-done { animation-delay: .5s; }
/* language switch: the hero entrance already played, so it must not replay (class set by the engine) */
.no-entrance .sec-cover > * { animation: none !important; }
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s ease, transform .7s ease; }
.reveal.is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .sec-cover > * { animation: none !important; }
  .reveal { opacity: 1 !important; transform: none !important; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
