/* Base styles. All colors and fonts come from the design (catalog.js) as CSS variables. */
:root {
  --paper: #EEF0EA; --ink: #1C2B27; --main: #2F4A40; --on-main: #fff; --accent: #A8844A; --seal: #7A2E3B;
  --cover-bg: var(--main); --cover-ink: var(--paper);
  --muted: color-mix(in srgb, var(--ink) 66%, var(--paper));
  --line: color-mix(in srgb, var(--accent) 50%, var(--paper));
  --f-names: Georgia, serif; --f-display: Georgia, serif; --f-body: Arial, sans-serif;
  --names-style: normal; --names-weight: 400; --names-scale: 1; --names-case: none; --names-track: 0;
  --head-style: normal; --head-weight: 400; --body-weight: 400; --body-size: 1.0625rem;
  --radius: 999px; --align: center; --pattern: none; --pattern-opacity: 0;

  color-scheme: light dark;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
*, *::before, *::after { box-sizing: inherit; }

body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  background: var(--paper); color: var(--ink);
  font-family: var(--f-body); font-weight: var(--body-weight); font-size: var(--body-size); line-height: 1.65;
  text-align: var(--align);
  -webkit-font-smoothing: antialiased;
}
:root[lang="ar"] body { line-height: 1.9; }
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: var(--pattern); opacity: var(--pattern-opacity);
}
body.locked { overflow: hidden; }

/* Background-photo variant: the couple's own photos fill the background, stacked one above the other, fixed behind everything */
#bgSlides {
  position: fixed !important; top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important;
  width: 100vw; height: 100vh; z-index: -1; overflow: hidden;
  display: flex; flex-direction: column;
}
#bgSlides::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgb(0 0 0 / .35), rgb(0 0 0 / .5) 50%, rgb(0 0 0 / .75));
}
.bg-slide {
  flex: 1 1 0; min-height: 0;
  background-position: center; background-size: cover; background-repeat: no-repeat;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
/* Stops the browser's double-tap-to-zoom gesture from misfiring on taps —
   pinch-zoom (e.g. on a gallery photo) still works, this only removes the
   extra "tap twice quickly = zoom" behavior on interactive elements. */
button, a, [role="button"] { touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ================= COVERS ================= */
.cover {
  position: fixed; inset: 0; z-index: 50;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2rem;
  padding: 2rem; text-align: center;
  background: var(--cover-bg); color: var(--cover-ink);
  transition: transform .9s cubic-bezier(.7, 0, .2, 1), opacity .8s;
}
.cover::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: var(--pattern); opacity: calc(var(--pattern-opacity) * .8);
}
.cover > * { position: relative; }
.cover-to { margin: 0; font-family: var(--f-display); font-style: var(--head-style); font-weight: var(--head-weight); font-size: clamp(1.6rem, 6vw, 2.2rem); line-height: 1.2; }
.cover-hint { margin: 0; font-size: .9rem; opacity: .75; }
.cc-names { margin: 0; font-family: var(--f-names); font-style: var(--names-style); font-weight: var(--names-weight); text-transform: var(--names-case); letter-spacing: var(--names-track); font-size: calc(clamp(2.2rem, 10vw, 3.2rem) * var(--names-scale)); line-height: 1.1; }

/* Seal */
.seal {
  position: relative; width: 9.5rem; aspect-ratio: 1;
  border: 0; padding: 0; cursor: pointer;
  border-radius: 48% 52% 50% 50% / 52% 48% 53% 47%;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--seal) 68%, #fff) 0%, var(--seal) 38%, color-mix(in srgb, var(--seal) 68%, #000) 100%);
  box-shadow: 0 10px 28px rgb(0 0 0 / .35), inset 0 -6px 14px rgb(0 0 0 / .3), inset 0 4px 10px rgb(255 255 255 / .15);
  transition: transform .5s cubic-bezier(.3, 1.6, .5, 1), opacity .5s;
}
.seal::before { content: ""; position: absolute; inset: 14%; border-radius: 50%; border: 2px solid rgb(0 0 0 / .18); box-shadow: inset 0 0 0 1px rgb(255 255 255 / .12); }
.seal:hover { transform: rotate(-4deg) scale(1.03); }
.seal .monogram {
  position: relative; font-family: var(--f-names); font-style: var(--names-style); font-weight: 500; font-size: 1.9rem; line-height: 1;
  color: color-mix(in srgb, var(--seal) 40%, #f3dcc5);
  text-shadow: 0 -1px 0 rgb(0 0 0 / .35), 0 1px 0 rgb(255 255 255 / .15);
}
.cover-seal.opening .seal { transform: scale(1.35) rotate(18deg); opacity: 0; }
.cover-seal.opening { transform: translateY(-100%); transition-delay: .35s; }

/* Card */
.cc-frame {
  display: flex; flex-direction: column; align-items: center; gap: 1.1rem;
  width: min(20rem, 84vw); padding: 2.5rem 1.5rem;
  border: 1px solid color-mix(in srgb, var(--cover-ink) 45%, transparent);
  outline: 1px solid color-mix(in srgb, var(--cover-ink) 25%, transparent); outline-offset: 6px;
  border-radius: min(var(--radius), 1.5rem);
}
.cover-card .monogram { margin: 0; font-family: var(--f-names); font-style: var(--names-style); font-weight: var(--names-weight); font-size: 3.2rem; line-height: 1; color: var(--cover-ink); }
.cover-btn { background: var(--cover-ink) !important; color: var(--cover-bg) !important; }
.cover-card.opening { opacity: 0; transform: scale(1.06); }

/* Ribbon */
.cover-ribbon { gap: 1.5rem; }
.cover-ribbon .cc-names { max-width: 20ch; }
.ribbon {
  position: relative; display: block; width: 100vw; height: 64px; margin: 1.5rem 0;
  padding: 0; border: 0; background: none; cursor: pointer;
}
.rb-l, .rb-r {
  position: absolute; top: 0; bottom: 0; width: 50%;
  background: linear-gradient(180deg, color-mix(in srgb, var(--seal) 80%, #fff) 0 6%, var(--seal) 6% 94%, color-mix(in srgb, var(--seal) 70%, #000) 94%);
  box-shadow: 0 6px 16px rgb(0 0 0 / .25);
  transition: transform .9s cubic-bezier(.6, 0, .3, 1);
}
.rb-l { left: 0; } .rb-r { right: 0; }
.rb-knot {
  position: absolute; left: 50%; top: 50%; z-index: 2; width: 70px; height: 70px; translate: -50% -50%;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--seal) 60%, #fff), var(--seal) 45%, color-mix(in srgb, var(--seal) 65%, #000));
  box-shadow: 0 6px 16px rgb(0 0 0 / .3);
  transition: opacity .3s, scale .3s;
}
.rb-knot::before, .rb-knot::after {
  content: ""; position: absolute; top: 50%; width: 46px; height: 34px; translate: 0 -50%;
  background: var(--seal); border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; z-index: -1;
}
.rb-knot::before { right: 50px; rotate: -12deg; } .rb-knot::after { left: 50px; rotate: 12deg; }
.ribbon:hover .rb-knot { scale: 1.06; }
.cover-ribbon.opening .rb-knot { opacity: 0; scale: .5; }
.cover-ribbon.opening .rb-l { transform: translateX(-105%) rotate(-6deg); }
.cover-ribbon.opening .rb-r { transform: translateX(105%) rotate(6deg); }
.cover-ribbon.opening { opacity: 0; transition-delay: .6s; }

/* Envelope */
.cover-envelope { gap: 1.75rem; }
.cover-envelope .cc-names { max-width: 22ch; }
.envelope {
  position: relative; width: min(19rem, 80vw); aspect-ratio: 3 / 2;
  border: 0; padding: 0; background: none; cursor: pointer; perspective: 900px;
}
.env-back {
  /* Mixed well past the page backdrop (--cover-bg) so the envelope reads as
     its own shape instead of blending into the background behind it. */
  position: absolute; inset: 0; border-radius: 10px;
  background: color-mix(in srgb, var(--cover-ink) 32%, var(--cover-bg));
  box-shadow: 0 16px 40px rgb(0 0 0 / .45), inset 0 0 0 1px rgb(255 255 255 / .08);
  z-index: 0;
}
.env-card {
  /* Starts tucked behind env-pocket (z-index 2 > this 1), so it's physically
     hidden — not just invisible — until it slides up past the pocket's edge.
     The z-index jump to go above the flap (see .opening below) is delayed
     until the card has actually cleared the pocket — otherwise it renders
     above the pocket the instant you tap, before it's visibly moved at all. */
  position: absolute; left: 8%; right: 8%; bottom: 3%; height: 34%;
  display: grid; place-items: center;
  background: var(--paper); border-radius: 6px;
  box-shadow: 0 8px 18px rgb(0 0 0 / .35);
  transition: transform 1s cubic-bezier(.6, 0, .3, 1), z-index 0s linear .35s;
  z-index: 1;
}
.env-card .monogram {
  font-family: var(--f-names); font-style: var(--names-style); font-weight: var(--names-weight);
  font-size: 1.6rem; color: var(--main);
}
.env-pocket {
  /* The envelope's front panel — covers the card while closed. Static (it
     doesn't animate); the card slides up from behind it, the flap folds
     open above it. */
  position: absolute; left: 0; right: 0; bottom: 0; height: 40%;
  background: color-mix(in srgb, var(--cover-ink) 32%, var(--cover-bg));
  border-radius: 0 0 10px 10px;
  z-index: 2;
}
.env-flap {
  /* Noticeably darker than env-back so the fold reads as a distinct layer,
     plus a seam shadow under its point for a hint of depth. */
  position: absolute; top: 0; left: 0; right: 0; height: 58%;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  background: linear-gradient(165deg, color-mix(in srgb, var(--cover-ink) 58%, var(--cover-bg)), color-mix(in srgb, var(--cover-ink) 38%, var(--cover-bg)));
  filter: drop-shadow(0 3px 4px rgb(0 0 0 / .3));
  transform-origin: top center; transform-style: preserve-3d;
  transition: transform 1.1s cubic-bezier(.6, 0, .3, 1);
  z-index: 3;
}
.env-seal {
  /* A sibling of env-flap, not a child — the flap's triangular clip-path
     would otherwise slice off most of this circle near the flap's tip. */
  position: absolute; left: 50%; top: 58%; translate: -50% -50%;
  width: 2.2rem; height: 2.2rem; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--seal) 65%, #fff), var(--seal) 45%, color-mix(in srgb, var(--seal) 65%, #000));
  box-shadow: 0 4px 10px rgb(0 0 0 / .35);
  z-index: 4;
  transition: opacity .25s ease, scale .25s ease;
}
.envelope:hover .env-seal { scale: 1.06; }
.cover-envelope.opening .env-flap { transform: rotateX(-175deg); }
.cover-envelope.opening .env-card { transform: translateY(-230%); z-index: 5; }
.cover-envelope.opening .env-seal { opacity: 0; scale: .4; }
.cover-envelope.opening { opacity: 0; transition-delay: .95s; }

/* ================= TOOLBAR ================= */
.toolbar {
  position: fixed; top: 0; inset-inline-end: 0; z-index: 20; display: flex; gap: .5rem;
  padding: calc(env(safe-area-inset-top, 0px) + .75rem) .75rem .75rem;
}
.tool {
  min-width: 2.75rem; height: 2.75rem; padding: 0 .85rem;
  border: 1px solid var(--line); border-radius: 999px;
  background: color-mix(in srgb, var(--paper) 85%, transparent); backdrop-filter: blur(6px);
  color: var(--main); font: 500 .9rem var(--f-body); cursor: pointer;
}
.tool.music { width: 2.75rem; padding: 0; display: grid; place-items: center; }
.bars { display: flex; align-items: flex-end; gap: 2px; height: 14px; }
.bars i { width: 2px; height: 5px; background: currentColor; border-radius: 1px; }
.music.playing .bars i { animation: eq 1s ease-in-out infinite; }
.music.playing .bars i:nth-child(2) { animation-delay: -.3s; }
.music.playing .bars i:nth-child(3) { animation-delay: -.6s; }
.music.playing .bars i:nth-child(4) { animation-delay: -.15s; }
@keyframes eq { 0%, 100% { height: 4px; } 50% { height: 14px; } }

/* ================= CARD ================= */
.card { max-width: 34rem; margin: 0 auto; padding: 5rem 1.5rem 3rem; }
:root[data-align="left"] .card { max-width: 36rem; }
.hero { padding-top: 1rem; }
.intro { max-width: 24rem; margin: 0 0 1.5rem; color: var(--muted); }
:root[data-align="center"] .intro { margin-inline: auto; }
.names {
  margin: 0; color: var(--main);
  font-family: var(--f-names); font-style: var(--names-style); font-weight: var(--names-weight);
  text-transform: var(--names-case); letter-spacing: var(--names-track);
  font-size: calc(clamp(2.75rem, 13vw, 4.2rem) * var(--names-scale)); line-height: 1.05;
  overflow-wrap: anywhere;
}
:root[lang="ar"] .names { font-style: normal; letter-spacing: 0; line-height: 1.35; text-transform: none; }
.event-type { margin: 1.1rem 0 .25rem; font-family: var(--f-display); font-style: var(--head-style); font-weight: var(--head-weight); font-size: 1.35rem; color: var(--accent); }
:root[data-design="citrus"] .event-type, :root[data-design="slate"] .event-type, :root[data-design="lullaby"] .event-type { color: var(--main); }
:root[data-design="lullaby"] .schedule time { color: var(--main); }
.date-line { margin: 0; font-weight: 500; }

/* Photo shapes */
.hero-photo { margin: 0 0 2.25rem; }
:root[data-align="center"] .hero-photo { margin-inline: auto; }
.hero-photo img { width: 100%; object-fit: cover; background: color-mix(in srgb, var(--main) 14%, var(--paper)); }
:root[data-photo="arch"] .hero-photo { width: min(17rem, 72vw); padding: .45rem; border: 1px solid var(--line); border-radius: 999px 999px 0 0; }
:root[data-photo="arch"] .hero-photo img { aspect-ratio: 3 / 4; border-radius: 999px 999px 0 0; }
:root[data-photo="circle"] .hero-photo { width: min(15rem, 64vw); padding: .5rem; border: 2px dashed var(--line); border-radius: 50%; }
:root[data-photo="circle"] .hero-photo img { aspect-ratio: 1; border-radius: 50%; }
:root[data-photo="rect"] .hero-photo img { aspect-ratio: 4 / 3; }
:root[data-photo="rect"][data-align="left"] .hero-photo { margin-inline: -1.5rem; }
:root[data-photo="frame"] .hero-photo { width: min(18rem, 76vw); padding: .6rem; border: 3px double var(--main); }
:root[data-photo="frame"] .hero-photo img { aspect-ratio: 4 / 5; }

/* Hero layout B: photo as a full-bleed backdrop behind the names */
:root[data-hero="b"] .hero {
  position: relative; margin: 0 0 2.25rem; padding: 3rem 1.5rem 2rem; border-radius: min(var(--radius), 1.25rem);
  min-height: 24rem; display: flex; flex-direction: column; justify-content: flex-end;
  background: var(--main); overflow: hidden; text-align: center;
}
:root[data-hero="b"] .hero-photo {
  position: absolute; inset: 0; width: 100%; margin: 0; padding: 0; border: 0; border-radius: 0; z-index: 0;
}
:root[data-hero="b"] .hero-photo img { width: 100%; height: 100%; aspect-ratio: auto; object-fit: cover; border-radius: 0; }
:root[data-hero="b"] .hero::after {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(180deg, rgb(0 0 0 / .1), rgb(0 0 0 / .6));
}
:root[data-hero="b"] .intro, :root[data-hero="b"] .names, :root[data-hero="b"] .event-type, :root[data-hero="b"] .date-line {
  position: relative; z-index: 2; color: #fff;
}
:root[data-hero="b"] .intro { color: rgb(255 255 255 / .85); margin-inline: auto; }
:root[data-hero="b"] .event-type { color: rgb(255 255 255 / .9); }
:root[data-hero="b"] .names { text-shadow: 0 2px 16px rgb(0 0 0 / .5); }

/* Hero layout C: small inset photo beside a stacked names/event-type/date block */
:root[data-hero="c"] .hero {
  display: grid; grid-template-columns: auto 1fr; column-gap: 1.25rem; align-items: center;
  text-align: start; margin-bottom: 2.25rem;
}
:root[dir="rtl"][data-hero="c"] .hero { direction: rtl; }
:root[data-hero="c"] .hero-photo { grid-column: 1; grid-row: 1 / -1; width: 6rem; margin: 0; }
:root[data-hero="c"] .hero-photo img { aspect-ratio: 1; border-radius: 50%; }
:root[data-hero="c"] .intro { display: none; }
:root[data-hero="c"] .names, :root[data-hero="c"] .event-type, :root[data-hero="c"] .date-line { grid-column: 2; }
:root[data-hero="c"] .names { font-size: calc(clamp(2.1rem, 9vw, 3.1rem) * var(--names-scale)); }
/* Under ~400px there isn't room for photo + text side by side — stack them like the default hero instead */
@media (max-width: 26rem) {
  :root[data-hero="c"] .hero { display: block; text-align: var(--align); }
  :root[data-hero="c"] .hero-photo { width: min(15rem, 64vw); margin: 0 0 1.5rem; }
  :root[data-align="center"][data-hero="c"] .hero-photo { margin-inline: auto; }
}

.orn {
  height: 28px; max-width: 200px; margin: 2.75rem auto;
  background: var(--orn-color, var(--accent));
  -webkit-mask: var(--orn) center / contain no-repeat; mask: var(--orn) center / contain no-repeat;
}
:root[data-align="left"] .orn { margin-inline: 0; -webkit-mask-position: left center; mask-position: left center; width: 120px; }
:root[dir="rtl"][data-align="left"] .orn { -webkit-mask-position: right center; mask-position: right center; }

.block h2 { margin: 0 0 1.25rem; font-family: var(--f-display); font-style: var(--head-style); font-weight: var(--head-weight); font-size: 1.9rem; line-height: 1.2; color: var(--main); }
:root[lang="ar"] .block h2, :root[lang="ar"] .cover-to, :root[lang="ar"] .event-type { font-style: normal; }
.muted { color: var(--muted); margin: .15rem 0; }

/* Our story */
.story-photo { margin: 0 0 1.25rem; width: min(16rem, 70vw); }
:root[data-align="center"] .story-photo { margin-inline: auto; }
.story-photo img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: min(var(--radius), 14px); }
.story-text { margin: 0; font-family: var(--f-display); font-style: var(--head-style); font-size: 1.2rem; line-height: 1.55; color: var(--ink); white-space: pre-line; }
.bank-iban {
  display: block; margin: .5rem 0 0; color: var(--ink);
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  letter-spacing: .02em; direction: ltr; unicode-bidi: isolate; overflow-wrap: anywhere;
}
.venue { margin: 0 0 .25rem; font-family: var(--f-display); font-weight: var(--head-weight); font-size: 1.5rem; line-height: 1.3; }
#timeLine { color: var(--ink); font-weight: var(--head-weight); }

/* When & where icons — plain CSS masks, not DOM children: the venue/time/dress
   text and the map/calendar button labels are overwritten via textContent on
   every render() (language toggle etc.), which would wipe out a nested <svg>. */
.venue::before, #timeLine::before, #dress::before, #mapBtn::before, .cal-links a::before {
  content: ""; display: inline-block; flex: none;
  width: 1em; height: 1em; margin-inline-end: .4em; vertical-align: -0.15em;
  background: currentColor;
  -webkit-mask-size: contain; mask-size: contain;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: center; mask-position: center;
}
.venue::before, #mapBtn::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2C7.58 2 4 5.58 4 10c0 5.25 6.72 11.19 7.02 11.45a1.5 1.5 0 0 0 1.96 0C13.28 21.19 20 15.25 20 10c0-4.42-3.58-8-8-8zm0 11a3 3 0 1 1 0-6 3 3 0 0 1 0 6z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2C7.58 2 4 5.58 4 10c0 5.25 6.72 11.19 7.02 11.45a1.5 1.5 0 0 0 1.96 0C13.28 21.19 20 15.25 20 10c0-4.42-3.58-8-8-8zm0 11a3 3 0 1 1 0-6 3 3 0 0 1 0 6z'/%3E%3C/svg%3E");
}
#timeLine::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm1 10.59 4.2 2.43-1 1.73-5.2-3V6h2z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm1 10.59 4.2 2.43-1 1.73-5.2-3V6h2z'/%3E%3C/svg%3E");
}
#dress::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 4a1.6 1.6 0 1 1-1 2.86V7.3L19.5 13a1.8 1.8 0 0 1 .9 1.56v.44a1 1 0 0 1-1 1H4.6a1 1 0 0 1-1-1v-.44A1.8 1.8 0 0 1 4.5 13L11 7.3v-.44A1.6 1.6 0 0 1 12 4z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 4a1.6 1.6 0 1 1-1 2.86V7.3L19.5 13a1.8 1.8 0 0 1 .9 1.56v.44a1 1 0 0 1-1 1H4.6a1 1 0 0 1-1-1v-.44A1.8 1.8 0 0 1 4.5 13L11 7.3v-.44A1.6 1.6 0 0 1 12 4z'/%3E%3C/svg%3E");
}
.cal-links a::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 2a1 1 0 0 1 1 1v1h8V3a1 1 0 1 1 2 0v1h1a2 2 0 0 1 2 2v13a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h1V3a1 1 0 0 1 1-1zM4 10v9a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1v-9H4z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 2a1 1 0 0 1 1 1v1h8V3a1 1 0 1 1 2 0v1h1a2 2 0 0 1 2 2v13a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h1V3a1 1 0 0 1 1-1zM4 10v9a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1v-9H4z'/%3E%3C/svg%3E");
}

/* Countdown */
.countdown { display: grid; grid-template-columns: repeat(4, 1fr); max-width: 24rem; margin: 0 auto; }
:root[data-align="left"] .countdown { margin: 0; text-align: start; }
.countdown > div { display: flex; flex-direction: column; }
.countdown > div + div { border-inline-start: 1px solid var(--line); padding-inline-start: .75rem; }
:root[data-align="center"] .countdown > div + div { padding: 0; }
.countdown span { font-family: var(--f-display); font-weight: var(--head-weight); font-size: clamp(2rem, 9vw, 2.75rem); line-height: 1.1; font-variant-numeric: lining-nums tabular-nums; color: var(--main); }
.countdown small { font-size: .85rem; color: var(--muted); }
.cd-done { margin: 0; font-family: var(--f-display); font-style: var(--head-style); font-size: 1.6rem; line-height: 1.3; color: var(--main); }

/* Countdown layout B: one compact pill */
:root[data-countdown-layout="b"] .countdown {
  display: inline-flex; max-width: none; gap: .5rem; padding: .65rem 1.25rem;
  border-radius: 999px; background: color-mix(in srgb, var(--main) 8%, var(--paper));
}
:root[data-align="center"][data-countdown-layout="b"] .countdown { margin-inline: auto; }
:root[data-countdown-layout="b"] .countdown > div { flex-direction: row; align-items: baseline; gap: .3rem; }
:root[data-countdown-layout="b"] .countdown > div + div { border-inline-start: 0; padding-inline-start: 0; }
:root[data-countdown-layout="b"] .countdown > div:not(:last-child)::after { content: "·"; margin-inline-start: .5rem; color: var(--muted); }
:root[data-countdown-layout="b"] .countdown span { font-size: 1.15rem; }
:root[data-countdown-layout="b"] .countdown small { font-size: .72rem; }

/* Countdown layout C: days in large emphasis, rest smaller */
:root[data-countdown-layout="c"] .countdown { grid-template-columns: 1.7fr 1fr 1fr 1fr; }
:root[data-countdown-layout="c"] .countdown > div:first-child span { font-size: clamp(3rem, 15vw, 4.5rem); color: var(--accent); }

/* Buttons */
.actions { margin-top: 1.5rem; display: flex; flex-wrap: wrap; gap: .75rem; }
:root[data-align="center"] .actions { justify-content: center; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 3rem; padding: .7rem 1.9rem;
  border: 0; border-radius: var(--radius);
  background: var(--main); color: var(--on-main);
  font: 600 1rem var(--f-body); text-decoration: none; cursor: pointer;
  transition: filter .2s;
}
.btn:hover { filter: brightness(.92); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn-wide { width: 100%; margin-top: .5rem; }
.cal-links { display: flex; gap: .75rem; flex-wrap: wrap; margin: 1.25rem 0 0; font-size: .9rem; }
:root[data-align="center"] .cal-links { justify-content: center; }
.cal-links a {
  display: inline-flex; align-items: center; min-height: 2.75rem; padding: 0 1.1rem;
  border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--main); font-weight: 500; text-decoration: none; cursor: pointer;
  transition: background .2s, border-color .2s;
}
.cal-links a:hover { background: color-mix(in srgb, var(--main) 8%, var(--paper)); border-color: var(--main); }

/* Schedule */
.schedule { list-style: none; margin: 0 auto; padding: 0; max-width: 22rem; text-align: start; }
:root[data-align="left"] .schedule { margin: 0; }
.schedule li { display: grid; grid-template-columns: 4.5rem 1fr; gap: 1rem; align-items: baseline; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.schedule li:last-child { border-bottom: 0; }
.schedule time { font-family: var(--f-display); font-size: 1.2rem; color: var(--accent); font-variant-numeric: lining-nums; direction: ltr; unicode-bidi: isolate; }
:root[data-design="citrus"] .schedule time, :root[data-design="slate"] .schedule time { color: var(--main); font-weight: 700; }

/* Schedule layout B: vertical timeline */
:root[data-schedule-layout="b"] .schedule { position: relative; padding-inline-start: 1.5rem; }
:root[data-schedule-layout="b"] .schedule::before {
  content: ""; position: absolute; inset-inline-start: .3rem; top: .5rem; bottom: .5rem; width: 2px; background: var(--line);
}
:root[data-schedule-layout="b"] .schedule li { display: block; position: relative; border-bottom: 0; padding: 0 0 1.25rem; }
:root[data-schedule-layout="b"] .schedule li:last-child { padding-bottom: 0; }
:root[data-schedule-layout="b"] .schedule li::before {
  content: ""; position: absolute; inset-inline-start: -1.65rem; top: .3rem; width: .6rem; height: .6rem; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 3px var(--paper), 0 0 0 4px color-mix(in srgb, var(--accent) 35%, var(--line));
}
:root[data-schedule-layout="b"] .schedule time {
  display: block; font-size: .8rem; font-weight: 600; letter-spacing: .04em; margin-bottom: .2rem;
}
:root[data-schedule-layout="b"] .schedule li span { display: block; font-size: 1.08rem; color: var(--ink); }

/* Schedule layout C: card grid */
:root[data-schedule-layout="c"] .schedule { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: .75rem; max-width: none; }
:root[data-schedule-layout="c"] .schedule li {
  display: flex; flex-direction: column; gap: .5rem; border: 1px solid var(--line); border-radius: min(var(--radius), 12px); padding: .85rem;
}
:root[data-schedule-layout="c"] .schedule time {
  display: inline-flex; align-self: flex-start; padding: .25rem .65rem; border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 14%, var(--paper)); font-weight: 700; font-size: .85rem;
}

/* Gallery */
.gallery { display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem; }
.gallery button { padding: 0; border: 0; background: none; cursor: zoom-in; overflow: hidden; border-radius: min(var(--radius), 14px); }
.gallery img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; }
.gallery button:first-child { grid-column: 1 / -1; }
.gallery button:first-child img { aspect-ratio: 4 / 3; }
.gallery button:nth-child(even):last-child { grid-column: 1 / -1; }
.gallery button:nth-child(even):last-child img { aspect-ratio: 16 / 9; }

/* Gallery layout B: horizontal scroll filmstrip */
:root[data-gallery-layout="b"] .gallery { display: flex; gap: .6rem; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: .3rem; }
:root[data-gallery-layout="b"] .gallery button { flex: 0 0 auto; width: min(70vw, 16rem); scroll-snap-align: start; }
:root[data-gallery-layout="b"] .gallery button:first-child,
:root[data-gallery-layout="b"] .gallery button:nth-child(even):last-child { grid-column: unset; }
:root[data-gallery-layout="b"] .gallery img,
:root[data-gallery-layout="b"] .gallery button:first-child img,
:root[data-gallery-layout="b"] .gallery button:nth-child(even):last-child img { aspect-ratio: 3 / 4; }

/* Gallery layout C: offset masonry-style grid */
:root[data-gallery-layout="c"] .gallery { grid-template-columns: repeat(3, 1fr); }
:root[data-gallery-layout="c"] .gallery button:first-child,
:root[data-gallery-layout="c"] .gallery button:nth-child(even):last-child { grid-column: auto; }
:root[data-gallery-layout="c"] .gallery button:first-child img,
:root[data-gallery-layout="c"] .gallery button:nth-child(even):last-child img { aspect-ratio: 1; }
:root[data-gallery-layout="c"] .gallery button:nth-child(3n+2) { margin-top: 1.4rem; }
.lightbox { position: fixed; padding: 0; border: 0; max-width: 94vw; max-height: 90vh; background: transparent; overflow: visible; }
.lightbox::backdrop { background: rgb(0 0 0 / .85); }
.lightbox img { max-height: 85vh; width: auto; max-width: 94vw; margin: 0 auto; display: block; }
.lb-close, .lb-prev, .lb-next {
  position: fixed; z-index: 2; display: grid; place-items: center;
  width: 2.75rem; height: 2.75rem; padding: 0; border: 0; border-radius: 50%;
  background: rgb(0 0 0 / .45); color: #fff; cursor: pointer;
}
.lb-close svg, .lb-prev svg, .lb-next svg { width: 1.3rem; height: 1.3rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.lb-close { top: calc(env(safe-area-inset-top, 0px) + 1rem); right: calc(env(safe-area-inset-right, 0px) + 1rem); }
.lb-prev { top: 50%; left: calc(env(safe-area-inset-left, 0px) + .75rem); translate: 0 -50%; }
.lb-next { top: 50%; right: calc(env(safe-area-inset-right, 0px) + .75rem); translate: 0 -50%; }

/* RSVP */
.rsvp { text-align: start; margin-top: 1.5rem; }
.field { display: block; margin-bottom: 1.25rem; }
.field > span { display: block; font-size: .9rem; color: var(--muted); margin-bottom: .2rem; }
.field input, .field textarea {
  width: 100%; padding: .55rem 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 0;
  background: transparent; color: var(--ink); font: 400 1.05rem var(--f-body);
}
.field textarea { resize: vertical; }
.field input:focus, .field textarea:focus { outline: 0; border-bottom-color: var(--main); }
.field input[aria-invalid="true"] { border-bottom-color: var(--seal); }

.choice { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; border: 0; padding: 0; margin: 0 0 1.5rem; }
.choice label { position: relative; }
.choice input { position: absolute; opacity: 0; }
.choice span { display: block; height: 100%; padding: .7rem .5rem; text-align: center; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; transition: background .2s, color .2s, border-color .2s; }
.choice input:checked + span { background: var(--main); border-color: var(--main); color: var(--on-main); }
.choice input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 3px; }

.guest-chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .6rem; }
.chip {
  min-width: 2.75rem; height: 2.75rem; padding: 0 .5rem;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: transparent; color: var(--ink); font: 600 1rem var(--f-body); cursor: pointer;
  transition: background .2s, color .2s, border-color .2s;
}
.chip:hover:not(.active) { border-color: var(--main); }
.chip.active { background: var(--main); border-color: var(--main); color: var(--on-main); }
.guests-out { margin: .5rem 0 0; font-size: .85rem; color: var(--muted); }

.hp { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; pointer-events: none; clip: rect(0 0 0 0); }
.status { min-height: 1.5em; margin: .75rem 0 0; text-align: center; color: var(--seal); }
:root[data-design="noir"] .status, :root[data-design="midnight"] .status, :root[data-design="andalus"] .status { color: var(--main); }
.rsvp-done { margin-top: 1.5rem; font-family: var(--f-display); font-style: var(--head-style); font-size: 1.5rem; line-height: 1.4; color: var(--main); }

/* Footer */
.foot { padding-bottom: 1rem; }
.closing { margin: 0 0 2.5rem; font-family: var(--f-display); font-style: var(--head-style); font-size: 1.45rem; line-height: 1.4; color: var(--main); }
:root[lang="ar"] .closing, :root[lang="ar"] .rsvp-done, :root[lang="ar"] .cd-done { font-style: normal; }
.credit { font-size: .8rem; color: var(--muted); text-decoration: none; }
.credit:hover { text-decoration: underline; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; transition-delay: 0s !important; animation: none !important; }
}
