:root {
  color-scheme: light;
  --ink: #392d34;
  --muted: #766b72;
  --wine: #7a1d3d;
  --wine-deep: #5c1730;
  --gold: #b3935e;
  --olive: #788068;
  --ivory: #fbf8f0;
  --paper: #fffefa;
  --line: #e5dacf;
  --display-font: "B Nazanin", "Noto Naskh Arabic UI", "Noto Naskh Arabic", serif;
  --body-font: Tahoma, "Segoe UI", sans-serif;
  font-family: var(--body-font);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--ivory); color: var(--ink); font-size: 1rem; line-height: 1.9; }
a { color: inherit; }
button, input { font: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid var(--gold); outline-offset: 4px; }
[hidden] { display: none !important; }

.site-header { position: relative; z-index: 2; width: min(100% - 2rem, 680px); min-height: 4.5rem; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 1rem; border-bottom: 1px solid #b3935e35; }
.brand { display: inline-flex; align-items: center; gap: .55rem; color: var(--wine); text-decoration: none; font-weight: 700; letter-spacing: -.03em; }
.brand svg { width: 1.9rem; height: 1.9rem; fill: #fbf8f0; stroke: var(--gold); stroke-width: 1.1; stroke-linecap: round; stroke-linejoin: round; }
.header-link { color: var(--muted); text-decoration: none; font-size: .92rem; padding: .4rem 0; border-bottom: 1px solid transparent; transition: border-color .2s ease; }
.header-link:hover { border-color: var(--gold); }
.eyebrow { color: #8d7757; font-size: .86rem; font-weight: 600; letter-spacing: .02em; margin: 0; }
.eyebrow--center { text-align: center; }

/* The archive keeps its own visual identity while using the same invitation palette. */
.archive-hero { position: relative; overflow: hidden; min-height: 375px; padding: 4.5rem 1.25rem 3.5rem; text-align: center; display: grid; place-content: center; background: radial-gradient(ellipse at 50% 36%, #fffefa 0, #fffefa 27%, #f8f2e8d9 80%, transparent 100%); }
.archive-hero::before, .archive-hero::after { content: ""; position: absolute; width: clamp(100px, 17vw, 220px); height: 90%; top: 5%; background: url("./floral-branch.svg") center / contain no-repeat; opacity: .5; pointer-events: none; }
.archive-hero::before { right: max(2%, calc((100% - 1280px) / 2)); }
.archive-hero::after { left: max(2%, calc((100% - 1280px) / 2)); transform: scaleX(-1); }
.archive-hero h1 { margin: .25rem 0; color: var(--wine); font-family: var(--display-font); font-size: clamp(3rem, 9vw, 5.7rem); font-weight: 500; line-height: 1.3; letter-spacing: -.04em; }
.archive-hero p:last-child { margin: .3rem auto 0; color: var(--muted); max-width: 34rem; }
.archive-main { width: min(100% - 2rem, 1120px); margin: 0 auto; padding: 1.5rem 0 3.75rem; }
.section-title { text-align: center; color: var(--ink); font-size: 1.6rem; font-weight: 600; margin: 0 0 1.45rem; }
.section-title::after { content: ""; display: block; width: 3.1rem; height: 1px; margin: .55rem auto 0; background: var(--gold); }
.event-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.25rem; justify-items: center; }
.event-card-link { display: block; width: min(100%, 610px); color: inherit; text-decoration: none; border-radius: 1rem; }
.event-card { position: relative; isolation: isolate; overflow: hidden; min-height: 350px; padding: 1.8rem 1.5rem; text-align: center; background: linear-gradient(145deg, #fffefa 18%, #f8f1e6 100%); border: 1px solid #c8ae80; border-radius: .6rem; box-shadow: 0 14px 40px #5420310c, inset 0 0 0 6px #fffefa; transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease; }
.event-card::before { position: absolute; z-index: -1; content: ""; inset: 10px; border: 1px solid #b3935e55; border-radius: .35rem; }
.event-card::after { position: absolute; z-index: -1; content: ""; width: 15rem; height: 15rem; right: 50%; top: -10rem; transform: translateX(50%); border-radius: 50%; background: #f0e7d8a6; }
.event-card-link:hover .event-card, .event-card-link:focus-visible .event-card { transform: translateY(-4px); border-color: var(--wine); box-shadow: 0 20px 52px #54203118, inset 0 0 0 6px #fffefa; }
.event-card__seal { display: block; width: 2.9rem; height: 2.9rem; margin: .15rem auto .7rem; color: var(--gold); fill: none; stroke: currentColor; stroke-width: 1.2; stroke-linecap: round; stroke-linejoin: round; }
.event-card h2 { margin: .15rem 0 0; color: var(--wine); font-family: var(--display-font); font-size: clamp(2.8rem, 7vw, 4.1rem); font-weight: 500; letter-spacing: -.04em; line-height: 1.35; }
.event-card h2 span { color: var(--gold); font-size: .55em; vertical-align: .18em; }
.event-card__rule { display: block; width: 4rem; height: 1px; margin: .5rem auto .3rem; background: var(--gold); }
.event-card__type { margin: 0; color: var(--muted); }
.event-card__details { display: grid; gap: .1rem; color: var(--ink); font-size: .96rem; margin: .7rem 0 1rem; }
.button { display: inline-flex; justify-content: center; align-items: center; min-height: 3rem; padding: .58rem 1.55rem; border-radius: .25rem; text-align: center; text-decoration: none; font-weight: 600; transition: transform .2s ease, background .2s ease, box-shadow .2s ease; }
.button:hover:not(:disabled) { transform: translateY(-2px); }
.button--primary { background: var(--wine); color: #fffefa; border: 1px solid var(--wine); box-shadow: 0 6px 16px #7a1d3d20; }
.button--primary:hover { background: var(--wine-deep); box-shadow: 0 9px 20px #7a1d3d30; }
.site-footer { border-top: 1px solid #b3935e35; padding: 1rem; text-align: center; color: var(--muted); font-size: .9rem; background: #fffefa88; }

/* Main invitation */
.invitation-hero { position: relative; isolation: isolate; overflow: hidden; min-height: 0; padding: 2rem 1rem 2.6rem; text-align: center; display: grid; place-items: center; background: radial-gradient(ellipse at 50% 0, #fffefa 0, var(--ivory) 72%); }
.invitation-hero::before, .invitation-hero::after { content: ""; position: absolute; z-index: 0; width: clamp(7rem, 24vw, 12rem); height: clamp(10rem, 42vw, 18rem); background: url("./floral-branch.svg") center / contain no-repeat; opacity: .24; pointer-events: none; animation: botanical-float 8s ease-in-out infinite; }
.invitation-hero::before { right: -2.5rem; top: 3%; transform: rotate(14deg); }
.invitation-hero::after { left: -2.5rem; bottom: 3%; transform: scaleX(-1) rotate(14deg); animation-delay: -4s; }
.invitation-cover { position: relative; z-index: 2; overflow: hidden; width: min(100%, 680px); padding: 7px; background: #fffefa; border: 1px solid var(--gold); box-shadow: 0 18px 46px #67533317, inset 0 0 0 2px #fffefa, inset 0 0 0 3px #b3935e46; animation: cover-arrive .9s cubic-bezier(.2,.75,.25,1) both; }
.cover-photo { height: clamp(260px, 88vw, 410px); margin: 0; padding: 6px 6px 0; background: #fffefa; }
.cover-photo img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center 34%; border: 1px solid #d7c5a4; animation: photo-arrive 1.25s ease-out both; }
.hero-frame { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 0; padding: 1.5rem 1rem 1.8rem; background: var(--ivory); border: 0; border-top: 1px solid #b3935e66; border-radius: 0; box-shadow: none; }
.hero-frame::after { content: ""; position: absolute; inset: 7px; border: 1px solid #b3935e35; pointer-events: none; }
.flower-seal { position: relative; z-index: 1; width: 3.2rem; height: 3.2rem; margin: 0 auto 1rem; color: var(--gold); animation: seal-bloom .8s .35s cubic-bezier(.2,.8,.2,1) both; transform-origin: center; }
.hero-kicker { position: relative; z-index: 1; margin: 0; color: var(--ink); font-size: 1.02rem; }
.hero-names { position: relative; z-index: 1; margin: .15rem 0 .25rem; color: var(--wine); font-family: var(--display-font); font-size: clamp(3.5rem, 10vw, 5rem); font-weight: 500; line-height: 1.3; letter-spacing: -.05em; text-shadow: 0 2px #fff; }
.hero-divider { position: relative; z-index: 1; display: flex; gap: 1rem; align-items: center; justify-content: center; color: var(--olive); font-size: 1rem; }
.hero-divider::before, .hero-divider::after { content: ""; width: clamp(2rem, 7vw, 5rem); height: 1px; background: var(--gold); }
.hero-date { position: relative; z-index: 1; margin: .5rem 0 1rem; color: var(--ink); font-size: 1.05rem; }
.hero-scroll { position: relative; z-index: 1; min-width: 12rem; animation: button-arrive .65s .8s ease both; }

/* Invitation message and ceremony schedule */
.content-section { position: relative; padding: 2.6rem 1rem; background: var(--paper); }
.content-section--white { background-color: #fffefa; }
.content-wrap { width: min(100%, 680px); margin: 0 auto; }
.invitation-copy { position: relative; width: 100%; padding: 2rem clamp(1.2rem, 5vw, 2.5rem); text-align: center; border: 1px solid #c8ae80; background: #fffefa; box-shadow: inset 0 0 0 7px #fffefa, inset 0 0 0 8px #b3935e42, 0 14px 35px #54203108; }
.invitation-copy::before, .invitation-copy::after { content: ""; position: absolute; width: .75rem; height: .75rem; border: 1px solid var(--gold); background: var(--paper); transform: rotate(45deg); }
.invitation-copy::before { top: -.4rem; right: calc(50% - .4rem); }
.invitation-copy::after { bottom: -.4rem; right: calc(50% - .4rem); }
.invitation-copy .eyebrow { margin-bottom: .55rem; }
.invitation-copy h2 { margin: 0 0 .65rem; color: var(--ink); font-family: var(--display-font); font-size: 2rem; font-weight: 500; }
.invitation-copy p { margin: 0 auto; max-width: 50rem; font-size: 1.12rem; }
.invitation-signature { display: block; margin-top: .75rem; color: var(--wine); font-family: var(--display-font); font-size: 1.8rem; font-weight: 600; }
.invitation-date { color: var(--muted); margin-top: 0 !important; font-size: 1rem !important; }
.schedule-section { background-color: #f7f1e7; }
.schedule-section .content-wrap { max-width: 680px; }
.schedule-heading { text-align: center; margin-bottom: 1.7rem; }
.schedule-heading .eyebrow { margin-bottom: .15rem; }
.timeline { position: relative; list-style: none; padding: .2rem 0; margin: 0 auto; max-width: 480px; }
.timeline::before { content: ""; position: absolute; top: .9rem; bottom: .9rem; right: 6.4rem; width: 1px; background: linear-gradient(var(--gold), #9b7e57 50%, var(--gold)); }
.timeline__item { display: grid; grid-template-columns: 5.2rem 1.5rem 1fr; align-items: center; min-height: 3.2rem; gap: .5rem; position: relative; }
.timeline__item time { color: #827354; font-size: 1.05rem; font-weight: 700; direction: ltr; text-align: right; }
.timeline__dot { z-index: 1; width: .68rem; height: .68rem; justify-self: center; border: 1px solid var(--gold); border-radius: 50%; background: #fffefa; box-shadow: 0 0 0 4px #f7f1e7; }
.timeline__item p { margin: 0; }

.calendar-section { background: var(--ivory); }
.calendar-wrap { width: min(100%, 680px); margin: 0 auto; }
.calendar-heading { text-align: center; margin-bottom: 1.15rem; }
.calendar-heading .section-title { margin-bottom: 0; }
.calendar-card { padding: 1rem 1.1rem 1.15rem; border: 1px solid #c8ae80; background: var(--paper); box-shadow: inset 0 0 0 5px #fffefa, inset 0 0 0 6px #b3935e35, 0 14px 35px #54203108; }
.calendar-month { display: flex; justify-content: center; align-items: baseline; gap: .5rem; margin: .1rem 0 .8rem; color: var(--ink); font-family: var(--display-font); font-size: 1.45rem; }
.calendar-month strong { color: #8d7757; font-family: var(--body-font); font-size: .95rem; font-weight: 500; }
.calendar-table { width: 100%; border-collapse: collapse; table-layout: fixed; text-align: center; }
.calendar-table th { height: 2.3rem; color: #8d7757; font-size: .82rem; font-weight: 600; }
.calendar-table td { height: 2.65rem; padding: 0; }
.calendar-table td span { display: grid; place-items: center; width: 2.15rem; height: 2.15rem; margin: 0 auto; border-radius: 50%; color: var(--ink); font-size: .95rem; }
.calendar-table td .calendar-event-day { background: var(--wine); color: #fffefa; box-shadow: 0 3px 10px #7a1d3d28; font-weight: 700; }
.calendar-note { margin: .85rem 0 0; padding-top: .7rem; border-top: 1px solid #e5dacf; color: var(--wine); text-align: center; font-size: .95rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* Location and RSVP share one composed spread instead of isolated generic cards. */
.details-section { display: grid; grid-template-columns: 1fr; width: min(100% - 2rem, 680px); margin: 0 auto; background: #fffefa; padding: 0; }
.place-panel, .rsvp-panel { position: relative; padding: 2rem clamp(1.2rem, 4vw, 2rem); text-align: center; }
.place-panel { border-bottom: 1px solid #c8ae805c; background: linear-gradient(110deg, #fffefa 45%, #faf4e9); }
.rsvp-panel { background: linear-gradient(250deg, #fffefa 45%, #f9f1f2); }
.place-panel::before, .rsvp-panel::before { content: ""; position: absolute; top: 1.2rem; right: 1.2rem; bottom: 1.2rem; left: 1.2rem; border: 1px solid #b3935e35; pointer-events: none; }
.panel-heading { position: relative; z-index: 1; margin-bottom: .75rem; }
.panel-heading h2 { margin: .1rem 0; color: var(--ink); font-family: var(--display-font); font-size: 1.8rem; font-weight: 500; }
.place-mark { position: relative; z-index: 1; width: 2.6rem; height: 2.6rem; margin: .15rem auto .35rem; fill: none; stroke: var(--gold); stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
.place-panel h3 { position: relative; margin: 0 0 .2rem; color: var(--ink); font-size: 1.2rem; }
.place-panel > p { position: relative; margin: 0 auto 1rem; color: var(--muted); }
.place-panel .button { position: relative; }
.section-intro { position: relative; margin: -.15rem auto .8rem; text-align: center; color: var(--muted); }
.rsvp-box { position: relative; max-width: 520px; margin: 0 auto; padding: 1rem; border: 1px solid #c8ae8059; background: #fffefaed; }
.rsvp-note { margin: 0; text-align: center; color: var(--muted); }
.rsvp-form { display: grid; gap: .8rem; text-align: right; }
.field-label, .rsvp-legend { display: block; margin-bottom: .3rem; font-weight: 600; }
.rsvp-form input[type="text"] { width: 100%; min-height: 2.8rem; padding: .5rem .75rem; border: 1px solid #d8c9b9; border-radius: .2rem; background: white; color: var(--ink); }
.rsvp-form fieldset { margin: 0; padding: 0; border: 0; }
.radio-option { display: flex; align-items: center; gap: .5rem; margin: .3rem 0; }
.radio-option input { accent-color: var(--wine); width: 1.1rem; height: 1.1rem; }
.rsvp-form .button { width: 100%; }
.button:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.protected-photo { user-select: none; -webkit-user-drag: none; }

/* Gallery appears only when the event data contains photographs. */
.gallery-section { background-color: var(--ivory); }
.gallery-heading { text-align: center; margin-bottom: 1.2rem; }
.gallery-heading .section-title { margin-bottom: 0; }
.gallery { display: grid; gap: .75rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.gallery__item { margin: 0; overflow: hidden; background: #fffefa; border: 1px solid #c8ae80; padding: 5px; }
.gallery__item img { display: block; width: 100%; height: 100%; min-height: 10rem; object-fit: cover; user-select: none; -webkit-user-drag: none; }
.gallery__item { transition: transform .35s ease, box-shadow .35s ease; }
.gallery__item:hover { transform: translateY(-4px) rotate(-.35deg); box-shadow: 0 12px 25px #392d3418; }
.gallery__item img { transition: transform .7s cubic-bezier(.2,.7,.2,1); }
.gallery__item:hover img { transform: scale(1.035); }
.motion-pending { opacity: 0; transform: translateY(22px); transition: opacity .7s ease, transform .7s cubic-bezier(.2,.7,.2,1); transition-delay: var(--reveal-delay, 0ms); }
.motion-pending.is-visible { opacity: 1; transform: translateY(0); }
.timeline__item.motion-pending { transform: translateX(14px); }
.timeline__item.motion-pending.is-visible { transform: translateX(0); }
.gallery__item.motion-pending { transform: translateY(18px) scale(.97); }
.gallery__item.motion-pending.is-visible { transform: translateY(0) scale(1); }
.gallery__item.motion-pending.is-visible:hover { transform: translateY(-4px) rotate(-.35deg) scale(1); }
.calendar-event-day { animation: date-glow 2.8s ease-in-out infinite; }
@keyframes cover-arrive { from { opacity: 0; transform: translateY(22px) scale(.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes photo-arrive { from { transform: scale(1.045); filter: saturate(.82); } to { transform: scale(1); filter: saturate(1); } }
@keyframes seal-bloom { from { opacity: 0; transform: scale(.6) rotate(-18deg); } to { opacity: 1; transform: scale(1) rotate(0); } }
@keyframes button-arrive { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: translateY(0); } }
@keyframes botanical-float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -8px; } }
@keyframes date-glow { 0%, 100% { box-shadow: 0 3px 10px #7a1d3d28; } 50% { box-shadow: 0 4px 16px #7a1d3d55; } }
.not-found { min-height: 65vh; display: grid; place-content: center; text-align: center; padding: 2rem; }
.not-found h1 { color: var(--ink); }

@media (min-width: 760px) and (max-width: 1024px) {
  .archive-hero { min-height: 420px; padding: 5rem 1.5rem 4rem; }
  .archive-main { padding: 1.3rem 0 3.5rem; }
  .event-card { min-height: 380px; padding: 2rem; }
  .invitation-hero { padding: 3rem 2rem; }
  .invitation-cover { width: min(100%, 680px); }
  .cover-photo { height: 390px; }
  .hero-frame { padding: 1.9rem 2.5rem 2.2rem; }
  .content-section { padding: 2.9rem 1.5rem; }
  .invitation-copy { padding: 2.2rem 2rem; }
  .details-section { grid-template-columns: 1fr; }
  .place-panel, .rsvp-panel { padding: 2rem 1.8rem; }
  .place-panel { border-bottom: 1px solid #c8ae805c; border-left: 0; }
  .gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
}

@media (max-width: 759px) {
  .archive-hero::before, .archive-hero::after { width: 90px; height: 75%; opacity: .4; }
  .archive-hero::before { right: -1.4rem; }
  .archive-hero::after { left: -1.4rem; }
  .invitation-hero { padding: 1.5rem .8rem 2rem; }
  .invitation-hero::before, .invitation-hero::after { width: 5.5rem; height: 9rem; opacity: .2; }
  .invitation-hero::before { right: -2.5rem; top: 2%; }
  .invitation-hero::after { left: -2.5rem; bottom: 2%; }
  .invitation-cover { width: min(100%, 560px); }
  .cover-photo { height: clamp(270px, 96vw, 390px); }
  .hero-frame { padding: 1.4rem .7rem 1.7rem; }
  .hero-names { font-size: clamp(3.1rem, 13vw, 4.5rem); }
  .content-section { padding: 3rem 1rem; }
  .details-section { padding: 0 1rem; }
  .place-panel, .rsvp-panel { padding: 2.5rem 1.1rem; }
  .timeline { max-width: 560px; }
}

@media (max-width: 390px) {
  .site-header { min-height: 4rem; }
  .header-link { font-size: .82rem; }
  .cover-photo { height: 270px; }
  .flower-seal { width: 2.7rem; height: 2.7rem; }
  .hero-names { font-size: 3rem; }
  .timeline__item { grid-template-columns: 4.6rem 1.25rem 1fr; }
  .timeline::before { right: 5.7rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
  .motion-pending { opacity: 1 !important; transform: none !important; }
}
