/* Opening scene and invitation header — consolidated V9 implementation. */
:root {
  --site-logo-size: clamp(2.65rem, 3.4vw, 3.25rem);
  --site-logo-left: clamp(1.4rem, 4vw, 3.25rem);
  --site-logo-top: clamp(1.5rem, 3vw, 2.5rem);
  --paper-rise: 225px;
}

/* The same original large monogram appears before and after the transition. */
.scene-header {
  top: var(--site-logo-top);
}

.scene-header__mark,
.announcement__brand-mark,
.announcement__scroll-mover--brand .announcement__brand-mark {
  width: var(--site-logo-size);
  height: var(--site-logo-size);
}

.scene-header__mark {
  left: var(--site-logo-left);
}

.announcement__header {
  top: var(--site-logo-top);
  right: var(--site-logo-left);
  left: var(--site-logo-left);
}

/* The instruction is the only visible copy on the opening scene. */
.scene-header__instruction {
  font-size: 0;
}

.scene-header__instruction::after {
  content: "click the paper to read the news.";
  font-family: Italianno, cursive;
  font-size: clamp(1.8rem, 2.8vw, 2.55rem);
  line-height: 0.88;
}

.scene-footer,
.scene-skip {
  display: none !important;
}

/* The paper begins 100px above its former bench position. */
.newspaper {
  left: 51.95%;
  top: calc(76.43% - 50px);
  width: clamp(340px, 46vw, 700px);
  aspect-ratio: 2048 / 1303;
}

.newspaper__halo {
  inset: 22% 28%;
}

.newspaper__card {
  transform-origin: 50% 50%;
  transform: skewX(-18deg) scaleX(0.42) scaleY(0.26);
}

.newspaper__face {
  padding: 0;
  overflow: hidden;
  background: #fff;
  background-image: none;
  box-shadow: 0 0 0 1px rgba(25, 25, 25, 0.45);
}

.newspaper__face::before {
  display: none;
}

.newspaper__face--front {
  z-index: 2;
  opacity: 1;
  transform: none;
}

.newspaper__face--back {
  z-index: 1;
  opacity: 0;
  transform: none;
}

.newspaper__artwork {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/*
 * ================================================================
 * ANIMATION PATH — EDIT THIS SECTION TO CHANGE THE PAPER'S CURVE
 * ================================================================
 * Desktop cubic path:
 *   start       M   0,   0
 *   control 1   C  42, -64
 *   control 2     -36,-168
 *   finish          0,-225
 *
 * The curve is continuous: there are no corner points or rigid turns.
 */
.newspaper__card {
  offset-path: path("M 0 0 C 42 -64 -36 -168 0 -225");
  offset-anchor: top left;
  offset-position: top left;
  offset-rotate: 0deg;
  offset-distance: 0%;
}

.newspaper--lift .newspaper__card {
  animation: liftPaperAlongCurve 950ms cubic-bezier(0.22, 0.78, 0.24, 1) forwards;
}

.newspaper--hover .newspaper__card {
  offset-distance: 100%;
  animation: holdPaperFront 1s linear both;
  transform: rotate(-0.35deg) scale(1);
}

.newspaper--turn .newspaper__card {
  offset-distance: 100%;
  animation: flipNewspaper 480ms cubic-bezier(0.77, 0, 0.175, 1) forwards;
  transform: rotate(-0.35deg) scale(1);
}

.newspaper--turn .newspaper__face--front {
  animation: hideFrontAtFlipMidpoint 480ms steps(1, end) forwards;
}

.newspaper--turn .newspaper__face--back {
  animation: showBackAtFlipMidpoint 480ms steps(1, end) forwards;
}

.newspaper--zoom {
  transform-origin: 50% calc(50% - var(--paper-rise));
  animation: zoomThroughPaper 1600ms cubic-bezier(0.45, 0, 0.2, 1) 1s forwards;
}

.newspaper--zoom .newspaper__card {
  offset-distance: 100%;
  transform: rotate(-0.35deg) scale(1);
}

.newspaper--zoom .newspaper__face--front {
  opacity: 0;
}

.newspaper--zoom .newspaper__face--back {
  opacity: 1;
}

@keyframes liftPaperAlongCurve {
  0% {
    offset-distance: 0%;
    filter: drop-shadow(0 9px 5px rgba(0, 0, 0, 0.3));
    transform: skewX(-18deg) scaleX(0.42) scaleY(0.26);
  }
  42% {
    filter: drop-shadow(0 19px 14px rgba(0, 0, 0, 0.3));
    transform: skewX(-7deg) scaleX(0.68) scaleY(0.58) rotate(-0.7deg);
  }
  76% {
    filter: drop-shadow(0 28px 20px rgba(0, 0, 0, 0.31));
    transform: skewX(-1deg) scaleX(0.93) scaleY(0.89) rotate(0.2deg);
  }
  100% {
    offset-distance: 100%;
    filter: drop-shadow(0 32px 24px rgba(0, 0, 0, 0.3));
    transform: rotate(-0.35deg) scale(1);
  }
}

@keyframes holdPaperFront {
  from,
  to {
    offset-distance: 100%;
    filter: drop-shadow(0 32px 24px rgba(0, 0, 0, 0.3));
    transform: rotate(-0.35deg) scale(1);
  }
}

@keyframes flipNewspaper {
  0% {
    offset-distance: 100%;
    filter: drop-shadow(0 32px 24px rgba(0, 0, 0, 0.3));
    transform: rotate(-0.35deg) rotateY(0deg) scale(1);
  }
  49.9% {
    offset-distance: 100%;
    transform: rotate(-0.35deg) rotateY(89deg) scale(1);
  }
  50.1% {
    offset-distance: 100%;
    transform: rotate(-0.35deg) rotateY(-89deg) scale(1);
  }
  100% {
    offset-distance: 100%;
    filter: drop-shadow(0 32px 24px rgba(0, 0, 0, 0.3));
    transform: rotate(-0.35deg) rotateY(0deg) scale(1);
  }
}

@keyframes hideFrontAtFlipMidpoint {
  0%, 49.9% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

@keyframes showBackAtFlipMidpoint {
  0%, 49.9% { opacity: 0; }
  50%, 100% { opacity: 1; }
}

@keyframes zoomThroughPaper {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  38% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(2.15);
  }
  72% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(5.1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(8.5);
  }
}

/* Gradient invitation reveal without creating a fixed-position containing block. */
.announcement {
  animation: invitationGradientReveal 900ms cubic-bezier(0.23, 1, 0.32, 1) both;
}

@keyframes invitationGradientReveal {
  0% {
    opacity: 0;
    background-color: #eef1e9;
  }
  45% {
    opacity: 1;
    background-color: #f5f2e9;
  }
  100% {
    opacity: 1;
    background-color: #faf6ee;
  }
}

/*
 * The mover contains the original large monogram only. The static original
 * logo is hidden while its Nandini & Saumil text remains in place, preventing
 * any duplicate logo during the drop-down header transition.
 */
.announcement--scroll-motion-ready .announcement__brand {
  opacity: 1;
}

.announcement--scroll-motion-ready .announcement__brand > .announcement__brand-mark {
  visibility: hidden;
}

.announcement--scroll-motion-ready .announcement__scroll-mover--brand {
  display: flex !important;
}

.announcement__scroll-mover--brand > span:last-child {
  display: none !important;
}

.announcement__scroll-mover--brand .announcement__brand-mark {
  visibility: visible;
  flex: 0 0 auto;
}

/* Transform-path fallback for browsers without CSS Motion Path. */
@supports not (offset-path: path("M 0 0 L 1 1")) {
  .newspaper__card {
    offset-path: none;
  }

  .newspaper--lift .newspaper__card {
    animation-name: liftPaperFallback;
  }

  .newspaper--hover .newspaper__card,
  .newspaper--turn .newspaper__card,
  .newspaper--zoom .newspaper__card {
    transform: translate3d(0, calc(-1 * var(--paper-rise)), 0) rotate(-0.35deg) scale(1);
  }

  @keyframes liftPaperFallback {
    0% { transform: translate3d(0, 0, 0) skewX(-18deg) scaleX(0.42) scaleY(0.26); }
    28% { transform: translate3d(22px, -79px, 0) skewX(-10deg) scaleX(0.62) scaleY(0.51) rotate(-0.9deg); }
    57% { transform: translate3d(-18px, -183px, 0) skewX(-4deg) scaleX(0.82) scaleY(0.74) rotate(0.6deg); }
    82% { transform: translate3d(8px, -258px, 0) skewX(-1deg) scaleX(0.95) scaleY(0.92) rotate(-0.15deg); }
    100% { transform: translate3d(0, calc(-1 * var(--paper-rise)), 0) rotate(-0.35deg) scale(1); }
  }
}

@media (max-width: 700px) {
  :root {
    --paper-rise: 225px;
  }

  .newspaper {
    left: 52%;
    top: calc(76.4% - 50px);
    width: min(82vw, 390px);
  }

  .newspaper__card {
    offset-path: path("M 0 0 C 28 -54 -26 -158 0 -225");
  }

  .announcement__scroll-mover--kicker,
  .announcement__scroll-mover--date {
    right: auto !important;
    left: 50% !important;
    width: max-content !important;
    max-width: calc(100vw - 2rem);
    text-align: center;
    transform: translateX(-50%) !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .announcement {
    animation: none;
  }
}

/*
 * FIRST INVITATION PAGE GRID
 * The wording canvas uses the exact visible dimensions of the invitation
 * border. Portrait screens show the portrait border; landscape desktop/iPad
 * rotate that same artwork 90 degrees while the wording remains upright.
 */
.announcement__first-page {
  --invitation-width: min(92vw, calc(90svh * 9 / 16));
  --invitation-height: calc(var(--invitation-width) * 16 / 9);
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
  place-items: center;
}

.announcement__floral-background {
  width: var(--invitation-width);
  height: var(--invitation-height);
  aspect-ratio: 9 / 16;
  background-size: 100% 100%;
  transform: translate(-50%, -50%);
}

.announcement__content {
  width: calc(var(--invitation-width) * 0.72);
  height: calc(var(--invitation-height) * 0.72);
  padding: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto auto auto;
  align-items: center;
  align-content: center;
  gap: clamp(0.65rem, 1.6svh, 1.35rem);
}

.announcement__kicker,
.announcement__names,
.announcement__date-lockup,
.announcement__message,
.announcement__rule,
.announcement__fine-print {
  margin-top: 0;
  margin-bottom: 0;
}

.announcement__names {
  justify-content: center;
  font-size: clamp(3.45rem, calc(var(--invitation-width) * 0.2), 7.2rem);
}

.announcement__date-lockup {
  gap: 0.45rem;
}

.announcement__message {
  width: 100%;
  max-width: calc(var(--invitation-width) * 0.64);
  font-size: clamp(1.25rem, calc(var(--invitation-width) * 0.045), 2rem);
}

.announcement__rule {
  width: min(10rem, 52%);
}

@media (min-width: 701px) and (orientation: landscape) {
  .announcement__first-page {
    --invitation-width: min(94vw, calc(88svh * 16 / 9));
    --invitation-height: calc(var(--invitation-width) * 9 / 16);
  }

  .announcement__floral-background {
    width: var(--invitation-height);
    height: var(--invitation-width);
    aspect-ratio: 9 / 16;
    transform: translate(-50%, -50%) rotate(90deg);
  }

  .announcement__content {
    width: calc(var(--invitation-width) * 0.72);
    height: calc(var(--invitation-height) * 0.74);
    grid-template-columns: 1fr;
    gap: clamp(0.45rem, 1.2svh, 1rem);
  }

  .announcement__names {
    flex-direction: row;
    justify-content: center;
    gap: 0.16em;
    font-size: clamp(4rem, calc(var(--invitation-height) * 0.2), 7.8rem);
    line-height: 0.86;
  }

  .announcement__names em {
    margin: 0;
  }

  .announcement__message {
    max-width: calc(var(--invitation-width) * 0.55);
    font-size: clamp(1.35rem, calc(var(--invitation-height) * 0.045), 2.15rem);
  }
}

@media (max-width: 700px) {
  .announcement__first-page {
    --invitation-width: min(94vw, calc(88svh * 9 / 16));
    --invitation-height: calc(var(--invitation-width) * 16 / 9);
  }

  .announcement__content {
    width: calc(var(--invitation-width) * 0.74);
    height: calc(var(--invitation-height) * 0.7);
    gap: clamp(0.45rem, 1.25svh, 0.8rem);
  }

  .announcement__names {
    font-size: clamp(3.2rem, calc(var(--invitation-width) * 0.2), 4.35rem);
  }

  .announcement__message {
    max-width: 100%;
    font-size: clamp(1.15rem, 5.5vw, 1.55rem);
  }
}

/* V9 clarified asset: 1.png is the 1366×768 wedding invitation background. */
.announcement__first-page {
  --invitation-width: min(94vw, calc(88svh * 1366 / 768));
  --invitation-height: calc(var(--invitation-width) * 768 / 1366);
}

.announcement__floral-background {
  width: var(--invitation-width);
  height: var(--invitation-height);
  aspect-ratio: 1366 / 768;
  background-image: url("/media/invitation-background.png");
  background-size: 100% 100%;
  transform: translate(-50%, -50%);
}

.announcement__content {
  width: calc(var(--invitation-width) * 0.78);
  height: calc(var(--invitation-height) * 0.74);
  gap: clamp(0.35rem, 1svh, 0.85rem);
}

@media (min-width: 701px) {
  .announcement__names {
    flex-direction: row;
    justify-content: center;
    gap: 0.16em;
    font-size: clamp(4rem, calc(var(--invitation-height) * 0.2), 7.8rem);
    line-height: 0.86;
  }

  .announcement__names em {
    margin: 0;
  }
}

@media (max-width: 700px) {
  .announcement__first-page {
    --invitation-width: min(94vw, calc(88svh * 768 / 1366));
    --invitation-height: calc(var(--invitation-width) * 1366 / 768);
  }

  .announcement__floral-background {
    width: var(--invitation-height);
    height: var(--invitation-width);
    aspect-ratio: 1366 / 768;
    transform: translate(-50%, -50%) rotate(90deg);
  }

  .announcement__content {
    width: calc(var(--invitation-width) * 0.72);
    height: calc(var(--invitation-height) * 0.7);
  }
}

/* V10: invitation background fills the complete viewport edge to edge. */
.announcement__first-page {
  --invitation-width: 100vw;
  --invitation-height: 100svh;
  width: 100%;
  min-height: 100svh;
}

.announcement__floral-background {
  inset: 0;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  background-position: center;
  background-size: cover;
  transform: none;
}

.announcement__content {
  width: min(78vw, 980px);
  height: min(74svh, 650px);
}

/* A subtle paper texture is visible across every invitation background. */
.announcement__first-page::after,
.announcement__second-page::after,
.announcement__third-page::after {
  content: "";
  position: absolute;
  z-index: 0;
  inset: 0;
  pointer-events: none;
  background: var(--paper-texture) center / cover repeat;
  mix-blend-mode: multiply;
  opacity: 0.13;
}

.announcement__header,
.announcement__content,
.gallery-page {
  z-index: 2;
}

@media (max-width: 700px) {
  .announcement__floral-background {
    top: 50%;
    left: 50%;
    width: 100svh;
    height: 100vw;
    background-size: cover;
    transform: translate(-50%, -50%) rotate(90deg);
  }

  .announcement__content {
    width: min(82vw, 22rem);
    height: min(72svh, 39rem);
  }
}

/* V12: original three-line invitation name lockup on every viewport. */
.announcement__names {
  flex-direction: column;
  justify-content: center;
  gap: 0;
  line-height: 0.72;
}

.announcement__names em {
  margin: 0.24em 0;
}

/* V13 requestAnimationFrame engine owns all motion transforms. */
.newspaper[data-raf-motion="true"],
.newspaper[data-raf-motion="true"] .newspaper__card {
  animation: none !important;
  transition: none !important;
}

.newspaper[data-raf-motion="true"] .newspaper__card {
  offset-path: none !important;
  will-change: transform;
}

.newspaper[data-raf-motion="true"] .newspaper__face {
  transition: opacity 100ms cubic-bezier(0.23, 1, 0.32, 1);
}

.newspaper[data-raf-motion="true"] {
  will-change: transform, opacity;
}

/* V14: one continuous paper color across every invitation page. */
.announcement {
  --wedding-paper-color: #f9f6ee;
  background: var(--wedding-paper-color);
}

.announcement__first-page,
.announcement__second-page,
.announcement__third-page {
  background: var(--wedding-paper-color);
  background-color: var(--wedding-paper-color);
}

.gallery-page,
.wedding-countdown {
  background-color: transparent;
}

/* V15: the 225px curve endpoint is the exact viewport center. */
.newspaper {
  left: 50%;
  top: calc(50% + 225px);
}

@media (max-width: 700px) {
  .newspaper {
    left: 50%;
    top: calc(50% + 225px);
  }
}

/* Preserve crisp newspaper type and photography at the settled scale. */
.newspaper__face,
.newspaper__artwork {
  image-rendering: auto;
  -webkit-font-smoothing: antialiased;
  filter: contrast(1.06) saturate(0.96);
}

.newspaper__artwork {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* V16: restore the original bench-paper start; rAF computes the exact center-ending rise. */
.newspaper {
  left: 50%;
  top: calc(76.43% - 50px);
}

@media (max-width: 700px) {
  .newspaper {
    left: 50%;
    top: calc(76.4% - 50px);
  }
}
