@import url("layers/portal.css");

@font-face {
  font-family: "DM Sans";
  src: url("assets/DMSans.ttf") format("truetype");
  font-weight: 100 900;
  font-display: swap;
}

@font-face {
  font-family: "Instrument Serif";
  src: url("assets/InstrumentSerif-Regular.ttf") format("truetype");
  font-display: swap;
}

@font-face {
  font-family: "Instrument Serif";
  src: url("assets/InstrumentSerif-Italic.ttf") format("truetype");
  font-style: italic;
  font-display: swap;
}

:root {
  --ink: #30161a;
  --ivory: #fff2d7;
  --gold: #f2ca88;
  --paper: #fff3dc;
  --serif: "Instrument Serif", Georgia, serif;
  --sans: "DM Sans", system-ui, sans-serif;
  --mast: calc(3.25rem + env(safe-area-inset-top, 0px));
  --available-height: calc(100vh - var(--mast));
  --available-height: calc(100svh - var(--mast));
  color: var(--ivory);
  background: #32272b;
  font: 1rem/1.5 var(--sans);
  scroll-padding-top: var(--mast);
}

*, *::before, *::after { box-sizing: border-box; }
body, h1, h2, h3, p, ul { margin: 0; }
/* One two-to-one portrait leaf. On wide screens the desk around the
   invitation is empty; the page and its navigation have the same edges. */
body {
  width: min(100%, max(20rem, var(--available-height) / 2), 31rem);
  margin-inline: auto;
}
a { color: inherit; }
button { font: inherit; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
[hidden] { display: none !important; }

.screen-reader-only, .sr-only, .visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip {
  position: fixed;
  z-index: 30;
  top: .45rem;
  left: 50%;
  padding: .65rem 1rem;
  color: var(--ink);
  background: var(--ivory);
  transform: translate(-50%, -170%);
  white-space: nowrap;
}
.skip:focus { transform: translate(-50%, 0); }

.masthead {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--mast);
  padding-top: env(safe-area-inset-top, 0px);
  color: var(--ivory);
  background: #30161a;
  border-bottom: 1px solid #8c653f;
}
.masthead-inner {
  width: 100%;
  height: 100%;
  margin-inline: auto;
  padding-inline: .6rem .25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .2rem;
}
.brand, .primary-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  text-decoration: none;
  white-space: nowrap;
}
.brand {
  gap: .4rem;
  font: 1.3rem/1 var(--serif);
  letter-spacing: .01em;
}
.brand-mark {
  width: .43rem;
  height: .43rem;
  background: #e7b66e;
  box-shadow: inset 0 0 0 1px #806044;
  transform: rotate(45deg);
}
.primary-nav {
  display: flex;
  align-items: center;
  gap: 0;
  font-size: .875rem;
}
.primary-nav a { justify-content: center; min-width: 44px; padding-inline: .28rem; }
.primary-nav a:hover, .brand:hover, .download-arrow { color: var(--gold); }
.download-arrow { margin-inline-start: .21rem; }
.motion-toggle {
  flex: 0 0 auto;
  display: grid;
  width: 44px;
  height: 44px;
  padding: 0;
  place-items: center;
  cursor: pointer;
  color: var(--gold);
  background: transparent;
  border: 0;
}
.motion-symbol {
  width: 10px;
  height: 12px;
  border-inline: 2px solid currentColor;
}
.motion-toggle[aria-pressed="true"] .motion-symbol {
  width: 0;
  height: 0;
  border: 6px solid transparent;
  border-left: 9px solid currentColor;
  border-right: 0;
}
.journey-progress {
  display: none;
  position: absolute;
  inset: auto 0 -2px;
  height: 2px;
  overflow: hidden;
  pointer-events: none;
}
.motion-enabled .journey-progress { display: block; }
.journey-progress div {
  width: 100%;
  height: 100%;
  background: #e2a962;
  transform: scaleX(var(--journey-progress, 0));
  transform-origin: left center;
}

.journey { position: relative; display: block; }
.scene-stack { position: relative; }
.scene {
  position: relative;
  isolation: isolate;
  width: 100%;
  aspect-ratio: 1 / 2;
  overflow: hidden;
  overflow: clip;
  background: var(--stage-base, #55283a);
}
.scene--courtyard { --stage-base: #e6cfad; }
.scene--chakbhaat, .scene--sangeet, .scene--diljod { --stage-base: #f6e6cb; }
.scene--haldi { --stage-base: #c4934f; }
.scene--mehendi { --stage-base: #6c6745; }
.scene--lunch { --stage-base: #7b6846; }
.scene--final { --stage-base: #ad8057; }
.scene-art {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  container-type: size;
}
.scene-canvas, .portal-world {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 100%;
  height: 100%;
  transform: translate(-50%, -50%);
}
.scene-picture, .scene-picture img {
  display: block;
  width: 100%;
  height: 100%;
}
.scene-picture img {
  object-fit: contain;
  object-position: center;
}
.scene-copy {
  position: absolute;
  inset: 0;
  z-index: 5;
  opacity: var(--copy-opacity, 1);
  pointer-events: none;
}
.scene-copy a, .scene-copy button { pointer-events: auto; }
.art-status {
  position: absolute;
  z-index: 8;
  top: .9rem;
  left: 50%;
  width: max-content;
  max-width: calc(100% - 2rem);
  transform: translateX(-50%);
  padding: .4rem .7rem;
  background: #3e1929;
  color: #ffebc8;
  border: 1px solid #b58754;
  font-size: .75rem;
  line-height: 1.3;
}
[data-art-failed="true"] .scene-art { display: none; }
[data-art-failed="true"] .scene-copy { color: inherit; }
.chapter-markers { display: none; }

.motion-enabled .journey { height: var(--journey-height); }
.motion-enabled .scene-stack {
  position: sticky;
  top: var(--mast);
  width: 100%;
  aspect-ratio: 1 / 2;
  isolation: isolate;
  overflow: hidden;
  overflow: clip;
}
.motion-enabled .scene {
  position: absolute;
  inset: 0;
  display: none;
  min-height: 0;
  clip-path: var(--scene-clip, none);
  opacity: var(--scene-opacity, 1);
}
.motion-enabled .scene[data-shown] { display: block; }
.motion-enabled .chapter-markers {
  display: block;
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.chapter-markers span {
  position: absolute;
  left: 0;
  width: 1px;
  height: 1px;
}

.portal {
  position: absolute;
  inset: 0;
  transform: scale(var(--portal-scale, 1));
  transform-origin: 50% 58%;
}
.portal-world { perspective: 145cqw; }
.portal-world .scene-canvas {
  inset: 0;
  width: 100%;
  height: 100%;
  transform: none;
}
.portal-frame {
  z-index: 3;
  clip-path: var(--frame-cutout);
}
.portal-world .portal-leaf {
  z-index: 2;
  backface-visibility: hidden;
}
.portal-world .portal-leaf--left {
  clip-path: var(--leaf-left);
  transform: rotateY(var(--door-angle, 0deg));
  transform-origin: var(--hinge-left) 50%;
}
.portal-world .portal-leaf--right {
  clip-path: var(--leaf-right);
  transform: rotateY(calc(-1 * var(--door-angle, 0deg)));
  transform-origin: var(--hinge-right) 50%;
}
.scene--entrance[data-open] { background: transparent; }

.envelope-display {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 59%;
  width: 70%;
  transform: translate(-50%, -50%) scale(var(--envelope-scale, 1));
  transform-origin: 50% 62%;
}
.envelope {
  position: relative;
  width: 100%;
  aspect-ratio: 450/284;
  perspective: 800px;
  filter: drop-shadow(0 .65rem .7rem #39192565);
}
.envelope-back {
  position: absolute;
  inset: 0;
  z-index: 0;
  border: 2px solid #d7a563;
  border-radius: 3px 3px 7px 7px;
  background: #50192e;
}
.envelope-front, .envelope-flap {
  position: absolute;
  inset: 0;
}
.envelope-front {
  z-index: 3;
  overflow: hidden;
  border-radius: 3px 3px 7px 7px;
}
.envelope-flap {
  z-index: 4;
  bottom: auto;
  aspect-ratio: 450/196;
  transform: rotateX(var(--flap-angle, 0deg));
  transform-origin: 50% 0%;
}
.scene--final[data-flap-up] .envelope-flap { z-index: 1; }
.envelope-front svg, .envelope-flap svg { display: block; width: 100%; height: 100%; }
.rising-paper {
  position: absolute;
  z-index: 2;
  left: 6.5%;
  bottom: 5%;
  width: 87%;
  aspect-ratio: 380/245;
  overflow: hidden;
  border: 1px solid #e6c28a;
  border-radius: 3px;
  color: #a97642;
  background: linear-gradient(146deg, #fff6dd, #e9c695);
  transform: translateY(calc(-1% * var(--paper-lift, 56)));
}
.rising-paper svg { display: block; width: 100%; height: 100%; }
.motion-enabled .rising-paper { transform: translateY(calc(-1% * var(--paper-lift, 0))); }
html:not(.motion-enabled) .envelope-flap { display: none; }

/* If the reader enlarges their default type, keep the whole family letter in
   the reading order, allowing its portrait leaf to grow with the text. */
html[data-large-type] .scene--courtyard {
  height: auto;
  min-height: 0;
  aspect-ratio: auto;
}
html[data-large-type] .scene--courtyard .scene-copy,
html[data-large-type] .scene--courtyard .family-plane {
  position: relative;
  inset: auto;
  container-type: normal;
}
html[data-large-type] .scene--courtyard .letter-layout {
  position: relative;
  inset: auto;
  width: 86%;
  margin: 3rem auto;
  padding: 1rem 0;
  background: #f7e7c9;
  transform: none;
}
html[data-large-type] .masthead {
  height: auto;
}
html[data-large-type] .masthead-inner {
  flex-wrap: wrap;
  justify-content: center;
}
