@font-face {
  font-family: Invitation Sans;
  src: url("assets/persian-regular.woff2") format("woff2");
  font-display: swap;
}

@font-face {
  font-family: Invitation Script;
  src: url("assets/persian-display.woff2") format("woff2");
  font-display: swap;
}

:root {
  color-scheme: light;
  --wine: #631e30;
  --wine-deep: #421121;
  --ink: #3f302c;
  --muted: #71635b;
  --gold: #997642;
  --line: #d3bfa0;
  --cream: #fcf4e7;
  --rounded: 0.75rem;
  font-family: "Invitation Sans", Tahoma, sans-serif;
  color: var(--ink);
  background: #370d1b;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden], .icon-library { display: none !important; }
body {
  --stage-padding: clamp(1.2rem, 3.3vw, 3.4rem);
  min-height: 100svh;
  margin: 0;
  padding: var(--stage-padding);
  display: grid;
  place-items: center;
  isolation: isolate;
}
h1, h2, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; }
button, summary { cursor: pointer; }
:focus-visible { outline: 3px solid #aa844e; outline-offset: 4px; }

.silk-stage {
  z-index: -1;
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  background: radial-gradient(ellipse at 30% 5%, #733045, #3c0d1d 60%, #240914);
}
.silk {
  position: absolute;
  inset: -4%;
  background: linear-gradient(110deg, #26031126, #2e071324), url("assets/merlot-silk.webp") center / cover;
}
.silk::after {
  content: "";
  position: absolute;
  inset: -6%;
  background: linear-gradient(119deg, transparent 19%, #ffc1af14 30%, transparent 42%, #24000e20 67%, transparent 83%);
}
body:has([data-cover]) .silk { animation: silk-sway 14s ease-in-out infinite alternate; }
body:has([data-cover]) .silk::after { animation: silk-light 11s ease-in-out infinite alternate; }
@keyframes silk-sway {
  from { transform: scale(1.02) translate(-0.7%, -0.5%) skewX(-0.6deg); }
  to { transform: scale(1.06, 1.035) translate(0.7%, 0.7%) skewX(0.8deg); }
}
@keyframes silk-light {
  from { transform: translateX(-6%); opacity: 0.25; }
  to { transform: translateX(6%); opacity: 0.95; }
}

.invitation { width: min(100%, 64rem); min-width: 0; container-type: inline-size; }
.topbar {
  display: flex;
  align-items: center;
  gap: 1.3rem;
  margin: 0 0 1.4rem;
  color: #f7e9d8;
}
.header-rule { flex: 1; height: 1px; background: linear-gradient(90deg, #f8ddb71f, #f8ddb760, #f8ddb71f); }
.masthead, .cover-link { display: inline-flex; align-items: center; gap: 0.6rem; font-size: 0.94rem; }
.masthead svg { width: 2rem; height: 1.7rem; color: #e6c19a; }
[data-cover] .cover-link, .invitation:not([data-cover]) .masthead { display: none; }
.music-control {
  display: flex;
  align-items: center;
  gap: 0.66rem;
  padding: 0.42rem 1rem;
  min-height: 2.75rem;
  border: 1px solid #e8c99e69;
  border-radius: 2rem;
  background: #300b168f;
  color: #f9eddd;
  font-size: 0.8rem;
  transition: background 180ms ease;
}
.music-control:hover { background: #641e32; }
.music-control .icon { width: 1.05rem; height: 1.05rem; }
.equalizer { display: flex; align-items: center; gap: 2px; height: 1rem; color: #d3ad80; }
.equalizer i { width: 2px; height: 40%; border-radius: 3px; background: currentColor; }
.equalizer i:nth-child(2) { height: 85%; animation-delay: -0.4s; }
.equalizer i:nth-child(3) { height: 60%; animation-delay: -0.2s; }
[aria-pressed="true"] .equalizer i { animation-name: equalize; animation-duration: 0.65s; animation-direction: alternate; animation-iteration-count: infinite; }
@keyframes equalize { to { transform: scaleY(0.42); } }

main {
  display: grid;
  position: relative;
  isolation: isolate;
  border: 1px solid #dac491;
  border-radius: 0.45rem;
  background: linear-gradient(#fffcf66b, #fffcf66b), #faf1df url("assets/rose-paper.webp") center / 100% 100% no-repeat;
  box-shadow: 0 1.3rem 3.5rem #1c020c69, 0 3px 0 -1px #e6d5bd, 0 6px 0 -3px #be9e77;
}
main::before, main::after {
  content: "";
  position: absolute;
  pointer-events: none;
  inset: 0.65rem;
  border: 1px solid #ad8c5487;
  border-radius: 0.16rem;
  z-index: 1;
}
main::after { inset: 0.9rem; border-color: #b3946645; }
.icon {
  width: 1.3rem;
  height: 1.3rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
.screen { min-width: 0; text-align: center; }
.screen:focus { outline: none; }
.screen:not([hidden]) { animation: reveal 520ms cubic-bezier(.2,.7,.25,1) both; }
@keyframes reveal {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: no-preference) {
  [data-cover] .portrait-block { animation: mount-settle 950ms cubic-bezier(.16,.78,.3,1) both; }
  [data-cover] .cover-content { animation: reveal 750ms 80ms ease-out both; }
}
@keyframes mount-settle {
  from { opacity: 0; transform: translateY(9px) rotate(-1.3deg); }
  to { opacity: 1; transform: translateY(0) rotate(0); }
}

.cover-screen {
  display: grid;
  grid-template-columns: 1.08fr 1fr;
  align-items: center;
  column-gap: clamp(1.7rem, 4vw, 4rem);
  grid-template-rows: 1fr auto auto 1fr;
  grid-template-areas: ". portrait" "letter portrait" "action portrait" ". portrait";
  padding: clamp(3.35rem, 5vw, 5rem) clamp(2.65rem, 5.2vw, 5.1rem);
}
.cover-letter { display: contents; }
.cover-content { grid-area: letter; }
.portrait-block { grid-area: portrait; }
.entry-action { grid-area: action; text-align: center; }
.cover-content, .cover-heading { display: grid; justify-items: center; }
.crest { display: block; width: 3.25rem; height: 2.62rem; color: var(--gold); }
.cover-kicker {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.65rem 0 0;
  color: #6a5944;
  font-size: 0.95rem;
}
.cover-kicker::before, .cover-kicker::after {
  content: "";
  width: 1.65rem;
  height: 1px;
  background: #b39569;
}
.couple {
  color: var(--wine);
  font-family: "Invitation Script", Tahoma, serif;
  font-weight: 700;
}
.cover-names, .home-names {
  display: flex;
  align-items: baseline;
  justify-content: center;
  flex-wrap: wrap;
  column-gap: 0.21em;
  font-size: clamp(3rem, 5.1vw, 4.7rem);
  line-height: 1.95;
  padding-bottom: 0.18em;
}
.couple-and { color: var(--gold); font-size: 0.55em; }
.ornament, .end-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.48rem;
  color: var(--gold);
  font: 0.86rem/1 Georgia, serif;
}
.ornament::before, .ornament::after, .end-mark::before, .end-mark::after {
  content: "";
  width: 2.85rem;
  height: 1px;
  background: linear-gradient(90deg, transparent, currentColor);
}
.ornament::before, .end-mark::before { transform: scaleX(-1); }
.cover-message { margin: 1.1rem 0 1rem; font-size: 1.03rem; line-height: 2.12; color: #544338; }
.cover-date { display: flex; align-items: center; gap: 0.5rem; color: #79664c; font-size: 0.9rem; }
.cover-date .icon { width: 1rem; height: 1rem; }

.portrait-block { display: grid; place-items: center; min-width: 0; padding: 0.6rem; }
.portrait-mount {
  position: relative;
  width: min(100%, 21rem);
  aspect-ratio: 0.78;
  padding: 0.36rem;
  border: 1px solid #9a7642;
  border-radius: 50% 50% 2px 2px / 39% 39% 2px 2px;
  background: #faedda;
  box-shadow: 0 8px 18px #41271326;
}
.portrait-mount::before {
  content: "";
  position: absolute;
  inset: -0.47rem;
  border: 1px solid #bba072;
  border-radius: 50% 50% 3px 3px / 39% 39% 3px 3px;
  pointer-events: none;
}
.cover-photo { width: 100%; height: 100%; display: block; object-fit: cover; object-position: center; border-radius: inherit; }
.wax-seal {
  position: absolute;
  right: -1.15rem;
  bottom: -1.05rem;
  width: 4.55rem;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 1px solid #a34a55;
  border-radius: 47% 54% 46% 52% / 50% 44% 57% 47%;
  transform: rotate(-12deg);
  background: radial-gradient(ellipse at 33% 14%, #b15765, #793241 47%, #611c2e 75%, #943b47);
  box-shadow: inset 1px 2px 3px #e59aa280, inset -2px -3px 3px #471020, 1px 4px 6px #36071852;
  color: #e8bd9b;
}
.wax-seal::before {
  content: "";
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  border: 1px solid #b76770;
  box-shadow: inset 0 1px 3px #421020, 0 1px 1px #db889277;
}
.wax-seal svg { width: 58%; height: 58%; filter: drop-shadow(0 1px 1px #39101c); }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  min-height: 3rem;
  max-width: 100%;
  padding: 0.55rem 1.35rem;
  border-radius: 0.62rem;
  border: 1px solid transparent;
  text-align: center;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.65;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}
.button.primary {
  color: #fff6ea;
  background: linear-gradient(110deg, #501627, #792b41);
  border-color: #662134;
  box-shadow: inset 0 1px 0 #f6ccab25, 0 4px 10px #44102220;
}
.cover-button { margin-top: 1.35rem; min-width: 13.6rem; min-height: 3.25rem; }
.cover-button .icon { width: 1.1rem; height: 1.1rem; }
.cover-button .enter-arrow { margin-inline-start: auto; }
.button.outline { color: var(--wine); background: #fff7eb; border-color: #ba9a73; }
@media (hover: hover) {
  .button:hover { transform: translateY(-2px); box-shadow: 0 5px 15px #57233538; }
}
.button:active { transform: translateY(1px); }
.button:disabled { opacity: 0.65; cursor: wait; }
.button.full { width: 100%; }
.end-mark { color: #d7b58b; font-size: 0.9rem; margin: 1.8rem auto 0; gap: 0.85rem; }
.end-mark::after, .end-mark::before { width: 4.3rem; }

.invitation:not([data-cover]) {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  width: min(100%, 32rem);
  height: min(52rem, calc(100dvh - 2 * var(--stage-padding)));
}
.invitation:not([data-cover]) main {
  min-height: 0;
  grid-template-rows: minmax(0, 1fr);
  overflow: hidden;
}
.inner-screen, .home-screen {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scroll-padding-block: 1.6rem;
}
.inner-screen, .home-screen { padding: clamp(3.6rem, 7vw, 5rem) clamp(1.65rem, 5vw, 2.65rem) 2.45rem; }
.inner-screen h1 { margin-bottom: 0.55rem; color: var(--wine); font-size: 1.8rem; line-height: 1.6; }
.invocation { font-size: 0.95rem; color: #775a3c; }
.home-screen .ornament { margin: 0.55rem 0 0.05rem; }
.home-names { font-size: clamp(2.7rem, 6vw, 3.5rem); }
.lead { margin: 0.8rem auto 1rem; max-width: 23rem; font-size: 1rem; line-height: 1.9; }
.home-screen .lead { margin: 0.1rem auto 1.15rem; }
.wedding-photo {
  display: block;
  width: 100%;
  aspect-ratio: 1.64;
  object-fit: cover;
  height: auto;
  object-position: 50% 44%;
  margin: 0 auto 1.2rem;
  padding: 0.25rem;
  background: #fff8ec;
  border: 1px solid #bfa172;
  border-radius: 0.2rem;
  box-shadow: 0 4px 12px #50301d24;
}

.details {
  display: grid;
  gap: 0.55rem;
  margin: 1.15rem 0 1rem;
  text-align: start;
}
.detail {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.55rem 0.85rem;
}
.detail, .venue-card {
  background: linear-gradient(150deg, #fff8eccf, #f8e6d3db);
  border: 1px solid #e9cda6;
  border-radius: var(--rounded);
  box-shadow: inset 0 1px 0 #fffcf4, 0 3px 7px #80502e15;
}
.detail .icon { width: 1.65rem; height: 1.65rem; color: var(--gold); }
.detail dt { color: var(--muted); font-size: 0.88rem; }
.detail dd { margin: 0; color: var(--wine); font-weight: 700; line-height: 1.7; }

.venue-card { padding: 1.4rem 0.85rem; margin: 1.2rem 0 0.8rem; }
.venue-card h2 { color: var(--wine); font-size: 1.25rem; }
.venue-card p { color: var(--muted); font-size: 0.95rem; line-height: 1.8; }
.venue-pin { width: 3rem; height: 3rem; color: var(--gold); }
.stack { display: grid; gap: 0.55rem; }

.guest-form, .decline-note {
  display: grid;
  gap: 0.4rem;
  text-align: start;
}
.guest-form label:not(.choice), legend, dialog label { color: var(--wine); font-size: 0.92rem; font-weight: 700; }
.guest-form input[type="text"], textarea {
  width: 100%;
  min-width: 0;
  padding: 0.47rem 0.77rem;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: #fffaf0;
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.7;
  box-shadow: inset 0 2px 3px #8f4e2010;
}
.guest-form input[type="text"] { min-height: 2.8rem; }
textarea { resize: vertical; }
.guest-form fieldset {
  display: grid;
  gap: 0.43rem;
  min-width: 0;
  margin: 0.3rem 0 0.4rem;
  padding: 0;
  border: 0;
}
.guest-form legend { padding: 0 0 0.35rem; }
.choice {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 2.75rem;
  padding: 0.38rem 0.66rem;
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  background: #fff5e6;
  cursor: pointer;
}
.choice:has(:checked) { border-color: #a54953; background: #f7ded6; color: var(--wine); }
.choice input { margin: 0; width: 1.1rem; height: 1.1rem; accent-color: var(--wine); }
.guest-form > .button { margin-top: 0.45rem; }
.form-status { text-align: center; color: var(--wine); font-size: 0.9rem; }
.form-status:empty { margin-top: -0.4rem; }

.tabs {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.18rem;
  margin: 0.85rem 0 0;
  padding: 0.33rem;
  border: 1px solid #e4c6a0;
  border-radius: 1.15rem;
  background: #fff5e6f5;
  box-shadow: 0 3px 8px #73452d2c;
  backdrop-filter: blur(10px);
}
.tabs a {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 0.22rem;
  min-height: 3.45rem;
  border-radius: 0.79rem;
  color: #713e18;
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1.2;
}
.tabs a[aria-current="page"] {
  color: #fff0d4;
  background: linear-gradient(120deg, #703046, #531a29);
  box-shadow: inset 0 1px 0 #e8ba7a99, 0 2px 5px #6e2d2b40;
}

dialog {
  width: min(calc(100% - 1.5rem), 25.75rem);
  max-height: calc(100% - 1.5rem);
  margin: auto;
  padding: 1rem;
  border: 1px solid #c38d51;
  border-radius: 1.4rem;
  background: var(--cream);
  color: var(--ink);
  box-shadow: 0 1rem 2.75rem #33000b76;
}
dialog::backdrop { background: #24020bb8; }
.dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.dialog-header h2 { color: var(--wine); font-size: 1.23rem; }
.dialog-close {
  width: 2.75rem;
  height: 2.75rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #fff9ee;
  color: var(--wine);
}
#bale-instructions { margin: 0.4rem 0 0.75rem; line-height: 1.7; }
#prepared-message { display: block; margin: 0.25rem 0 0.7rem; }
#copy-status:not(:empty) { margin-top: 0.35rem; font-size: 0.88rem; color: var(--muted); }
.noscript { padding: 0.7rem; text-align: center; color: #fff3e1; }

/* Keep the botanical engravings in proportion on a portrait-format card. */
@container (max-width: 32rem) {
  main { background-size: auto, 330% auto; }
  .screen { position: relative; isolation: isolate; }
  .screen::before, .screen::after {
    content: "";
    position: absolute;
    z-index: -1;
    pointer-events: none;
    width: 35%;
    aspect-ratio: 1;
    background: url("assets/rose-paper.webp") no-repeat;
    background-size: 325% auto;
    opacity: 0.65;
  }
  .screen::before {
    top: 0;
    right: 0;
    border-top-right-radius: 0.45rem;
    background-position: top right;
    mask-image: radial-gradient(ellipse at top right, black 62%, transparent 90%);
  }
  .screen::after {
    bottom: 0;
    left: 0;
    border-bottom-left-radius: 0.45rem;
    background-position: bottom left;
    mask-image: radial-gradient(ellipse at bottom left, black 62%, transparent 90%);
  }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
