/* ============================================================
   Waleed & Sarah - wedding RSVP
   Brand: navy #1c3c64 on textured blush paper.
   Type: Marcellus SC (Latin text), Le Jour Script (name accents),
   DecoType Naskh/Thuluth preferred for Arabic with Amiri bundled
   as the open fallback.
   ============================================================ */

@font-face {
  font-family: 'Marcellus SC';
  src: url('../fonts/MarcellusSC.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Le Jour Script';
  src: url('../fonts/LeJourScript.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Le Jour Serif';
  src: url('../fonts/LeJourSerif.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Amiri';
  src: url('../fonts/Amiri-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Amiri';
  src: url('../fonts/Amiri-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --navy: #1c3c64;
  --navy-70: rgba(28, 60, 100, 0.78);
  --navy-45: rgba(28, 60, 100, 0.45);
  --hairline: rgba(28, 60, 100, 0.28);
  --paper: #f9f0ed;
  --paper-raise: rgba(255, 252, 250, 0.55);
  --error: #8a3033;
  --caps: 'Marcellus SC', 'DecoType Naskh', 'Amiri', serif;
  --script: 'Le Jour Script', 'DecoType Thuluth', 'Amiri', cursive;
  --arabic: 'DecoType Naskh', 'Amiri', serif;
  --radius: 2px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--caps);
  color: var(--navy);
  background-color: var(--paper);
  line-height: 1.6;
  min-height: 100dvh;
}

/* Fixed paper texture layer: avoids iOS background-attachment bugs */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background: url('../assets/paper.jpg') center / cover no-repeat;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* headings focused programmatically for screen readers */
[tabindex='-1']:focus {
  outline: none;
}

/* ---------- entrance motion (guest page) ---------- */

@media (prefers-reduced-motion: no-preference) {
  /* opening choreography: the bismillah resolves like ink, the family
     line settles, Waleed signs, "and", Sarah signs, the birds arrive,
     then date and venue take their turn */
  .invite__bismillah {
    animation: ink-in 1.5s ease 0.1s both;
  }
  @keyframes ink-in {
    from { opacity: 0; filter: blur(4px); }
    to { opacity: 1; filter: blur(0); }
  }

  .invite__families {
    animation: line-settle 1.1s cubic-bezier(0.16, 1, 0.3, 1) 0.3s both;
  }

  .invite__date {
    animation: rise-soft 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.8s both;
  }
  .invite__where {
    animation: rise-soft 0.9s cubic-bezier(0.16, 1, 0.3, 1) 1.05s both;
  }
  @keyframes rise-soft {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: none; }
  }
  @keyframes line-settle {
    from { opacity: 0; transform: scaleX(1.06) translateY(8px); }
    to { opacity: 1; transform: none; }
  }
  .invite__groom {
    animation: sign-in 1.15s cubic-bezier(0.4, 0, 0.2, 1) 0.55s both;
  }
  .invite__and {
    animation: and-fade 0.7s ease 1.45s both;
  }
  .invite__bride {
    animation: sign-in 1.15s cubic-bezier(0.4, 0, 0.2, 1) 1.6s both;
  }
  @keyframes sign-in {
    from { clip-path: inset(0 100% 0 0); opacity: 0.55; }
    to { clip-path: inset(0 0 0 0); opacity: 1; }
  }
  @keyframes and-fade {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: none; }
  }
  .invite__birds {
    animation: fly-in 1.9s cubic-bezier(0.16, 1, 0.3, 1) 2s both;
  }
  @keyframes fly-in {
    from { opacity: 0; transform: translate(-64px, 30px); }
    to { opacity: 1; transform: translate(0, 0); }
  }
  .bird {
    animation: bird-glide 5.5s ease-in-out infinite alternate;
  }
  .bird--small {
    animation-duration: 4.2s;
    animation-delay: -1.6s;
  }
  .bird--far {
    animation-duration: 6.6s;
    animation-delay: -3.1s;
  }
  @keyframes bird-glide {
    0% { transform: translate(0, 0) rotate(0deg); }
    50% { transform: translate(4px, -7px) rotate(2.2deg); }
    100% { transform: translate(-3px, 3px) rotate(-1.6deg); }
  }

  /* guests appear name by name when an invitation opens */
  .guest {
    animation: row-in 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
    animation-delay: calc(var(--i, 0) * 90ms);
  }
  .confirm__names li {
    animation: row-in 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
    animation-delay: calc(0.25s + var(--i, 0) * 110ms);
  }
  @keyframes row-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
  }

  .confirm__birds {
    animation: confirm-drift 6.5s ease-in-out infinite alternate;
  }
  @keyframes confirm-drift {
    from { transform: translateY(0); }
    to { transform: translateY(-5px); }
  }

  /* feedback while a request is in flight */
  .btn--busy {
    animation: busy-pulse 1.2s ease-in-out infinite;
  }
  @keyframes busy-pulse {
    50% { opacity: 0.6; }
  }

  /* panel titles settle their tracking, like the invite line */
  .rsvp__title {
    animation: title-settle 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.1s both;
  }
  @keyframes title-settle {
    from { opacity: 0; transform: scaleX(1.12); }
    to { opacity: 1; transform: none; }
  }

  /* below-the-fold pieces reveal as they are scrolled into view;
     app.js arms these and adds .is-in via IntersectionObserver.
     The wipe clips a CHILD, never the observed element itself: a fully
     clipped target has zero visible area and the observer never fires. */
  .reveal-armed [data-reveal] {
    transition: opacity 1s cubic-bezier(0.16, 1, 0.3, 1),
      transform 1s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .reveal-armed [data-reveal]:not(.is-in) {
    opacity: 0;
    transform: translateY(18px);
  }
  /* the sea surfaces with the same left-to-right stroke as the signatures */
  .reveal-armed [data-reveal='wipe']:not(.is-in) {
    opacity: 1;
    transform: none;
  }
  .reveal-armed [data-reveal='wipe'] .sea {
    transition: clip-path 1.5s cubic-bezier(0.16, 1, 0.3, 1);
    clip-path: inset(0 0 0 0);
  }
  .reveal-armed [data-reveal='wipe']:not(.is-in) .sea {
    clip-path: inset(0 100% 0 0);
  }
}

/* ---------- invitation ---------- */

.invite {
  max-width: 680px;
  margin: 0 auto;
  padding: clamp(3rem, 9vh, 5.5rem) 1.5rem 0;
  text-align: center;
}

.invite__bismillah {
  width: clamp(150px, 44vw, 210px);
  margin: 0 auto clamp(2.2rem, 6vh, 3.5rem);
}

.invite__families {
  font-size: clamp(0.82rem, 2.6vw, 1.05rem);
  letter-spacing: 0.22em;
  line-height: 1.7;
  margin-bottom: clamp(1.8rem, 5vh, 2.8rem);
}

.invite__names {
  position: relative;
  margin-bottom: clamp(1.6rem, 4.5vh, 2.6rem);
}

.invite__groom {
  width: min(66%, 400px);
  margin-right: auto;
}

.invite__birds {
  position: absolute;
  top: -4%;
  right: 2%;
  width: min(38%, 230px);
  aspect-ratio: 437 / 191;
}

/* each bird is a crop of the flock sprite (437x191) so it can fly on its own */
.bird {
  position: absolute;
  background: url('../assets/birds.png') no-repeat;
}

.bird--lead {
  /* crop x 10-115, y 65-160 */
  left: 2.29%;
  top: 34.03%;
  width: 24.03%;
  height: 49.74%;
  background-size: 416.19% auto;
  background-position: 3.01% 67.71%;
}

.bird--small {
  /* crop x 175-270, y 100-155 */
  left: 40.05%;
  top: 52.36%;
  width: 21.74%;
  height: 28.8%;
  background-size: 460% auto;
  background-position: 51.17% 73.53%;
}

.bird--far {
  /* crop x 270-400, y 80-160 */
  left: 61.78%;
  top: 41.88%;
  width: 29.75%;
  height: 41.88%;
  background-size: 336.15% auto;
  background-position: 87.95% 72.07%;
}

.invite__and {
  font-size: clamp(0.8rem, 2.4vw, 1rem);
  letter-spacing: 0.5em;
  text-indent: 0.5em; /* balances the trailing letter-space */
  margin: 0.4rem 0;
}

.invite__bride {
  width: min(52%, 330px);
  margin-left: auto;
  margin-top: -0.5rem;
}

.invite__when {
  font-size: clamp(0.9rem, 2.9vw, 1.15rem);
  letter-spacing: 0.24em;
  line-height: 2;
}

.invite__where {
  font-size: clamp(0.82rem, 2.6vw, 1rem);
  letter-spacing: 0.2em;
  margin-top: 1rem;
}

.invite__sea {
  /* closes the page below the RSVP card, full-bleed as printed */
  margin-top: clamp(1.5rem, 4vh, 2.5rem);
  display: flex;
  justify-content: center;
  overflow: hidden;
}

.sea {
  position: relative;
  width: min(100vw, 900px);
}

.sea img {
  width: 100%;
  display: block;
}

/* looping swell video, clipped to the engraving's feathered silhouette
   so it melts into the textured paper; fades in once actually playing */
.sea__loop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 1.2s ease;
  -webkit-mask-image: url('../assets/sea-mask.png');
  mask-image: url('../assets/sea-mask.png');
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
}

.sea__loop--on {
  opacity: 1;
}

/* ---------- rsvp section ---------- */

.rsvp {
  max-width: 560px;
  margin: 0 auto;
  padding: clamp(2.5rem, 7vh, 4rem) 1.5rem clamp(3rem, 8vh, 5rem);
}

.rsvp__panel {
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--paper-raise);
  padding: clamp(1.8rem, 5vw, 2.8rem) clamp(1.2rem, 4vw, 2.2rem);
  text-align: center;
}

.rsvp__panel[hidden] {
  display: none;
}

@media (prefers-reduced-motion: no-preference) {
  .rsvp__panel {
    animation: panel 0.45s cubic-bezier(0.16, 1, 0.3, 1);
  }
  @keyframes panel {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
  }
}

.rsvp__title {
  font-weight: 400;
  font-size: clamp(1.3rem, 4vw, 1.6rem);
  letter-spacing: 0.45em;
  text-indent: 0.45em;
  margin-bottom: 0.4rem;
}

.rsvp__hint {
  font-size: clamp(0.72rem, 2.3vw, 0.85rem);
  letter-spacing: 0.2em;
  color: var(--navy-70);
  margin-bottom: 2rem;
}

.field {
  text-align: left;
  margin-bottom: 1.6rem;
}

.field__label {
  display: block;
  text-align: center;
  font-size: 0.72rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--navy-70);
  margin-bottom: 0.5rem;
}

.field__input,
.field__textarea {
  width: 100%;
  font-family: var(--caps);
  font-size: 1.05rem;
  color: var(--navy);
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--navy-45);
  border-radius: 0;
  padding: 0.55rem 0.1rem;
  text-align: center;
  transition: border-color 0.25s ease;
}

.field__textarea {
  text-align: left;
  resize: vertical;
  min-height: 4.5rem;
  line-height: 1.7;
}

.field__input::placeholder,
.field__textarea::placeholder {
  color: var(--navy-45);
  letter-spacing: 0.06em;
}

.field__input:focus,
.field__textarea:focus {
  outline: none;
  border-bottom-color: var(--navy);
}

.field__input:focus-visible,
.field__textarea:focus-visible {
  outline: 2px solid var(--navy-45);
  outline-offset: 4px;
}

.btn {
  display: inline-block;
  text-decoration: none;
  text-align: center;
  font-family: var(--caps);
  font-size: 0.82rem;
  letter-spacing: 0.28em;
  text-indent: 0.28em;
  text-transform: uppercase;
  color: var(--paper);
  background: var(--navy);
  border: 1px solid var(--navy);
  border-radius: var(--radius);
  padding: 0.95rem 2rem;
  min-width: min(100%, 260px);
  cursor: pointer;
  transition: opacity 0.25s ease, transform 0.15s ease;
}

.btn:hover {
  opacity: 0.92;
}

.btn:active {
  transform: translateY(1px);
}

.btn:focus-visible {
  outline: 2px solid var(--navy);
  outline-offset: 3px;
}

.btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.btn--ghost {
  color: var(--navy);
  background: transparent;
  border-color: var(--navy-45);
}

.link {
  display: inline-block;
  font-family: var(--caps);
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--navy-70);
  background: none;
  border: none;
  border-bottom: 1px solid var(--navy-45);
  padding: 0.15rem 0;
  margin-top: 1.6rem;
  cursor: pointer;
  transition: color 0.25s ease, border-color 0.25s ease;
}

.link:hover {
  color: var(--navy);
  border-color: var(--navy);
}

.link:focus-visible {
  outline: 2px solid var(--navy-45);
  outline-offset: 3px;
}

.message {
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  line-height: 1.9;
  color: var(--navy-70);
}

.message--error {
  color: var(--error);
}

/* ---------- pick list ---------- */

.options {
  list-style: none;
  text-align: left;
}

.options li + li {
  margin-top: 0.8rem;
}

.option {
  width: 100%;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  font-family: var(--caps);
  color: var(--navy);
  background: transparent;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  cursor: pointer;
  transition: border-color 0.25s ease, background-color 0.25s ease;
}

.option:hover {
  border-color: var(--navy);
  background: rgba(255, 253, 251, 0.7);
}

.option:focus-visible {
  outline: 2px solid var(--navy);
  outline-offset: 2px;
}

.option__name {
  font-size: 1.02rem;
  letter-spacing: 0.05em;
}

.option__seats {
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--navy-70);
  white-space: nowrap;
}

/* ---------- invitation card ---------- */

.card__holder {
  font-family: var(--script);
  font-size: clamp(2.4rem, 9vw, 3.4rem);
  line-height: 1.25;
  font-weight: 400;
  margin: 0.6rem 0 0.2rem;
}

.card__eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  text-transform: uppercase;
  color: var(--navy-70);
}

.card__seats {
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  color: var(--navy-70);
  margin-bottom: 1.4rem;
}

.notice {
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  line-height: 1.8;
  color: var(--navy-70);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 0.8rem 1rem;
  margin-bottom: 1.6rem;
}

.guests {
  list-style: none;
  text-align: left;
  border-top: 1px solid var(--hairline);
  margin-bottom: 1.6rem;
}

.guest {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.6rem 1rem;
  padding: 1.05rem 0.2rem;
  border-bottom: 1px solid var(--hairline);
}

@media (max-width: 480px) {
  .guest {
    grid-template-columns: 1fr;
  }
}

.guest--missing {
  box-shadow: inset 3px 0 0 var(--error);
  padding-left: 0.8rem;
}

.guest__name {
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  overflow-wrap: anywhere;
}

.choice {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.choice__btn {
  font-family: var(--caps);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--navy-70);
  background: transparent;
  border: 1px solid var(--navy-45);
  border-radius: var(--radius);
  padding: 0.6rem 0.9rem;
  min-height: 44px;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease;
}

.choice__btn:hover {
  border-color: var(--navy);
  color: var(--navy);
}

.choice__btn:focus-visible {
  outline: 2px solid var(--navy);
  outline-offset: 2px;
}

.choice__btn[aria-pressed='true'] {
  background: var(--navy);
  border-color: var(--navy);
  color: var(--paper);
}

.form-error {
  margin: 0 0 1.2rem;
}

/* ---------- confirmation ---------- */

.confirm__birds {
  width: clamp(90px, 24vw, 120px);
  margin: 0 auto 0.4rem;
}

.confirm__script {
  font-family: var(--script);
  font-size: clamp(2.6rem, 10vw, 3.6rem);
  line-height: 1.3;
  font-weight: 400;
  margin-bottom: 0.8rem;
}

.confirm__names {
  list-style: none;
  margin: 1.4rem 0;
}

.confirm__names li {
  font-size: 1rem;
  letter-spacing: 0.1em;
  line-height: 2.1;
}

/* ---------- footer ---------- */

.footer {
  text-align: center;
  padding: clamp(1.5rem, 4vh, 2.5rem) 1.5rem clamp(2.5rem, 6vh, 4rem);
  font-size: 0.7rem;
  letter-spacing: 0.28em;
  color: var(--navy-70);
}
