@font-face {
  font-family: "Arabic Ejaza";
  src: url("assets/arabic-ejaza.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: light;
  --forest: #254f3b;
  --ink: #263b30;
  --sage: #78917a;
  --line: #d6dfd1;
  --ground: #f0f3e9;
  --paper: #fffffc;
  --ease: cubic-bezier(.16, 1, .3, 1);
  font-family: "Arabic Ejaza", "Traditional Arabic", Tahoma, serif;
  color: var(--ink);
  background: var(--ground);
  scrollbar-color: var(--sage) var(--ground);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }
button, a { touch-action: manipulation; }
::selection { color: #fff; background: var(--forest); }
svg { display: block; }
[hidden] { display: none !important; }

.garden { position: fixed; inset: 0; overflow: hidden; pointer-events: none; }
.garden-branch { position: absolute; width: clamp(280px, 30vw, 560px); height: auto; opacity: .42; }
.garden-branch--left { top: -180px; left: -120px; transform: rotate(12deg); }
.garden-branch--right { bottom: -220px; right: -110px; transform: rotate(184deg); }
.page { position: relative; padding: 32px 16px 64px; }

/* The no-JavaScript default is the complete, readable invitation. */
.opening { display: none; }
.js:not(.is-open), .js:not(.is-open) body { overflow: hidden; }
.js:not(.is-open) .opening { position: fixed; inset: 0; display: grid; place-content: center; justify-items: center; gap: 36px; perspective: 1400px; }
.envelope { position: relative; width: min(78vw, 590px, 95svh); aspect-ratio: 600 / 390; perspective: 1400px; }
.envelope-piece { position: absolute; inset: 0; pointer-events: none; }
.envelope-back { z-index: 1; background: #477155; border-radius: 3px; box-shadow: 0 22px 48px -14px #27443440, 0 3px 6px #2744341a; }
.envelope-back::after { content: ""; position: absolute; inset: 10px; border: 1px solid #afc2a66b; }
.envelope-pocket { z-index: 4; }
.envelope-pocket > svg { width: 100%; height: 100%; }
.envelope-inscription { position: absolute; top: 73%; width: 100%; text-align: center; color: var(--forest); font-size: clamp(23px, 4.5vw, 35px); line-height: 1.25; }
.envelope-and { display: inline-block; padding: 0 .25em; color: var(--forest); font-size: .8em; }
.envelope-date { display: block; margin-top: 10px; color: #50694e; font: 11px/1.4 Georgia, serif; letter-spacing: .2em; }
.envelope-flap { z-index: 5; height: 61%; transform-origin: top center; transform-style: preserve-3d; }
.flap-side { position: absolute; inset: 0; clip-path: polygon(0 0, 100% 0, 50% 100%); backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.flap-front { background: linear-gradient(165deg, #ffffff, #f0f3e7); }
.flap-back { background: #7c9577; transform: rotateY(180deg); }
.wax-seal { position: absolute; z-index: 6; top: 49%; left: 50%; width: 15%; aspect-ratio: 1; transform: translate(-50%, -50%); display: grid; place-items: center; border-radius: 49% 47% 48% 46%; background: linear-gradient(135deg, #6c8a60, #36583b 55%, #728a60); box-shadow: inset 1px 2px 3px #c4d1aa7a, inset -2px -2px 3px #17372299, 0 5px 9px #16302038; }
.wax-seal::before { content: ""; position: absolute; inset: 9%; border: 1px solid #a6b88e99; border-radius: 50%; box-shadow: inset 0 1px 3px #1d3d2499; }
.wax-seal svg { width: 66%; fill: none; stroke: #d9e2bf; stroke-width: 1.2; stroke-linecap: round; stroke-linejoin: round; }
.open-trigger { position: absolute; inset: 0; z-index: 8; width: 100%; height: 100%; padding: 0; border: 0; background: transparent; cursor: pointer; border-radius: 3px; }
.open-trigger:focus-visible { outline: 2px solid var(--forest); outline-offset: 10px; }
.open-trigger:disabled { cursor: default; }
.open-hint { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 0; font-size: 23px; color: #4b644c; }
.open-hint svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.2; }
@media (hover: hover) {
  .envelope:has(.open-trigger:hover:not(:disabled)) .wax-seal { filter: brightness(1.12); }
}

.letter { position: relative; width: min(100%, 760px); margin: 0 auto; overflow: hidden; background: var(--paper); box-shadow: 0 15px 70px -25px #24433133; transform-origin: top left; outline: none; }
.js:not(.is-open) .letter { position: fixed; top: 32px; left: max(16px, calc((100vw - 760px) / 2)); width: min(calc(100vw - 32px), 760px); margin: 0; visibility: hidden; pointer-events: none; z-index: 3; }
.js.is-expanding .letter { z-index: 10; }
.letter-content { position: relative; z-index: 1; padding: 78px 84px 58px; text-align: center; }
.letter-botanical { position: absolute; pointer-events: none; width: 218px; height: auto; opacity: .7; }
.letter-botanical--top { top: -45px; left: -106px; transform: rotate(-5deg); }
.letter-botanical--bottom { bottom: -38px; right: -109px; transform: rotate(176deg); }
.bismillah { margin: 0 0 25px; font-size: clamp(33px, 5.5vw, 51px); line-height: 1.6; color: var(--forest); }
.verse { max-width: 540px; margin: 0 auto; font-size: 24px; line-height: 1.95; }
.leaf-divider { display: flex; align-items: center; justify-content: center; gap: 15px; margin: 32px 0; }
.leaf-divider span { width: 52px; height: 1px; background: var(--line); }
.leaf-divider svg { width: 27px; height: 27px; fill: none; stroke: #6e8e6e; stroke-width: 1.1; stroke-linecap: round; stroke-linejoin: round; }
.welcome { margin: 0; font-size: 29px; line-height: 1.85; }
.families { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; column-gap: 11px; margin: 20px -12px 12px; font-size: 29px; color: var(--forest); line-height: 1.7; }
.families > span:not(.family-and) { white-space: nowrap; }
.family-and { color: var(--forest); font-size: 23px; }
.inviting { margin: 0; font-size: 26px; line-height: 1.8; }
.couple-names { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px 20px; margin: 28px -25px 34px; color: var(--forest); font-size: clamp(46px, 7.5vw, 70px); line-height: 1.6; font-weight: 400; }
.couple-names > span { white-space: nowrap; }
.couple-and { font-size: .5em; color: #75926b; }
.by-grace { margin: 0 0 20px; font-size: 25px; line-height: 1.7; }
.date-line { display: flex; align-items: center; justify-content: center; gap: 30px; margin: 0 auto; padding: 24px 0; border-block: 1px solid var(--line); font-size: 28px; line-height: 1.5; }
.date-line > time { display: flex; align-items: center; gap: 30px; }
.day-number { font: 62px/1 Georgia, serif; color: var(--forest); font-variant-numeric: lining-nums; }
.date-line bdi { font: 20px/1.5 Georgia, serif; }
.ceremony-details { display: flex; justify-content: center; align-items: start; gap: 35px; padding: 28px 0 23px; }
.detail { display: flex; flex-direction: column; align-items: center; gap: 10px; font-size: 23px; line-height: 1.6; flex: 1; }
.detail svg { width: 25px; height: 25px; fill: none; stroke: var(--forest); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.detail address { font-style: normal; }
.map-link { display: inline-flex; align-items: center; justify-content: center; gap: 14px; min-height: 50px; padding: 10px 29px; border-radius: 2px; color: #fff; background: var(--forest); text-decoration: none; font-size: 22px; line-height: 1.5; transition: background-color 180ms, transform 180ms; }
.map-link svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.map-link:hover { background: #183c2a; transform: translateY(-2px); }
.map-link:focus-visible { outline: 2px solid var(--forest); outline-offset: 5px; }
.closing { margin-top: 48px; }
.closing p { margin: 0; color: var(--forest); font-size: 26px; line-height: 1.8; }
.closing-sprig { width: 40px; height: 40px; margin: 20px auto 0; fill: none; stroke: #78916d; stroke-width: 1; stroke-linecap: round; stroke-linejoin: round; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 600px) {
  .page { padding: 16px 12px 32px; }
  .js:not(.is-open) .letter { top: 16px; left: 12px; width: calc(100vw - 24px); }
  .envelope { width: min(88vw, 95svh); }
  .js:not(.is-open) .opening { gap: 30px; }
  .garden-branch { opacity: .3; width: 300px; }
  .garden-branch--left { left: -150px; top: -120px; }
  .garden-branch--right { right: -150px; bottom: -100px; }
  .letter-content { padding: 67px 32px 48px; }
  .letter-botanical { width: 160px; opacity: .48; }
  .letter-botanical--top { left: -95px; top: -35px; }
  .letter-botanical--bottom { right: -90px; bottom: -15px; }
  .bismillah { font-size: 34px; line-height: 1.65; margin-bottom: 22px; }
  .verse { font-size: 23px; line-height: 1.95; }
  .welcome { font-size: 26px; }
  .families { flex-direction: column; margin: 20px 0 16px; gap: 0; font-size: 29px; }
  .family-and { line-height: 1.1; font-size: 20px; }
  .inviting { font-size: 25px; }
  .couple-names { flex-direction: column; gap: 0; margin: 28px -8px 32px; font-size: 61px; line-height: 1.4; }
  .couple-and { font-size: 28px; line-height: 1.2; }
  .date-line, .date-line > time { gap: 18px; }
  .date-line { font-size: 23px; }
  .day-number { font-size: 50px; }
  .date-line bdi { display: block; font-size: 16px; }
  .ceremony-details { gap: 15px; padding: 28px 0; }
  .detail { font-size: 22px; }
  .map-link { padding-inline: 22px; font-size: 21px; }
  .closing { margin-top: 39px; }
  .closing p { font-size: 24px; }
}

@media (max-width: 360px) {
  .letter-content { padding-inline: 24px; }
  .families { font-size: 26px; }
  .couple-names { font-size: 54px; }
  .bismillah { font-size: 30px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}

@media print {
  .garden, .opening, .map-link { display: none !important; }
  html, body { overflow: visible !important; background: white; }
  .page { padding: 0; }
  .letter, .js:not(.is-open) .letter { position: relative; inset: auto; width: 100%; visibility: visible; height: auto !important; transform: none !important; box-shadow: none; }
}
