/* ==========================================================================
   Grad invitation — rebuilt from the Canva mobile layout (375 px artboard).
   Every position/size is in artboard units: calc(N * var(--u)).
   ========================================================================== */

:root {
  --u: calc(min(100vw, 480px) / 375);
  --gold: #d1a940;
  --paper: #f6f3ed;
  --ink: #000;
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ease-out-cubic: cubic-bezier(.33, 1, .68, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; background: #fff; color: var(--ink); }
body { overflow-x: hidden; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
img { display: block; max-width: none; }
button { font: inherit; color: inherit; }

/* ---------- Fonts (free stand-ins; see docs/reverse-engineering-plan.md §2) ---------- */
.f-name  { font-family: "Michroma", "Arial", sans-serif; text-transform: uppercase; font-weight: 400;
           -webkit-text-stroke: calc(.7 * var(--u)) currentColor; /* Pattanakarn Expanded is heavier than Michroma */ }
.f-serif { font-family: "Ibarra Real Nova", "Times New Roman", serif; font-weight: 400; }
.f-script{ font-family: "Pinyon Script", "Snell Roundhand", cursive; font-weight: 400; }
.f-calli { font-family: "Corinthia", "Snell Roundhand", cursive; font-weight: 400; }
.f-deco  { font-family: "Marcellus", "Times New Roman", serif; font-weight: 400; }
.f-mono  { font-family: "Share Tech Mono", "Courier New", monospace; font-weight: 400; }
.up { text-transform: uppercase; }

/* ---------- Artboard + positioning helpers ---------- */
.page {
  position: relative;
  width: min(100%, 480px);
  aspect-ratio: 375 / 2875;
  margin: 0 auto;
  overflow: hidden;
  container-type: inline-size;
  --u: calc(100cqw / 375);   /* resolved by each child against .page's width */
}
.a {
  position: absolute;
  left: calc(var(--x, 0) * var(--u));
  top: calc(var(--y, 0) * var(--u));
  width: calc(var(--w, 375) * var(--u));
}
.a.h { height: calc(var(--h) * var(--u)); }
img.a { height: auto; }
.clip { overflow: hidden; }

.t {
  margin: 0;
  font-size: calc(var(--fs, 16) * var(--u));
  line-height: calc(var(--lh) * var(--u));
  letter-spacing: calc(var(--ls, 0) * var(--u));
  text-align: center;
  white-space: nowrap;
}
.t > [style*="--fs"] { font-size: calc(var(--fs) * var(--u)); }

.frame { border: calc(1.58 * var(--u)) solid var(--gold); pointer-events: none; }
.frame--thin { border-width: calc(1.1 * var(--u)); }
.paper { position: absolute; inset: 0; background: var(--paper); border-radius: calc(3 * var(--u)); }
.line { background: var(--ink); }

/* Hero "Class of 2026": script + serif share one baseline */
.class-of { display: flex; justify-content: center; align-items: baseline; gap: calc(14 * var(--u)); }

/* Details block: Canva draws a soft drop shadow under each value */
.details .t { text-shadow: 0 .122em .52em rgba(0, 0, 0, .325); }

/* Campus photo: top and bottom fade into the white page (Canva bakes this into the image) */
.campus { background: #fff; overflow: hidden; }
.campus img {
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, transparent 3%, #000 22%, #000 76%, transparent 97%);
          mask-image: linear-gradient(to bottom, transparent 0%, transparent 3%, #000 22%, #000 76%, transparent 97%);
}

/* Screen-reader copy of split text */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
.word { display: inline-block; white-space: nowrap; }

/* ==========================================================================
   Animations — measured from the Canva site (see plan §3).
   Initial hidden states only apply when JS runs (html.js).
   A [data-trigger] element gets .is-in once when scrolled into view;
   it and its descendants then animate.
   ========================================================================== */

@keyframes grow {
  0%   { opacity: 0; transform: scale(.9); animation-timing-function: ease-out; }
  12%  { opacity: 1; }
  60%  { transform: scale(1.025); animation-timing-function: ease-in-out; }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes rise  { from { opacity: 0; transform: translateY(calc(80 * var(--u))); } to { opacity: 1; transform: none; } }
@keyframes drift { from { transform: translateX(calc(-40 * var(--u))); } to { transform: none; } }
@keyframes fade  { from { opacity: 0; } to { opacity: 1; } }
@keyframes blurIn{ from { opacity: 0; filter: blur(.2em); } to { opacity: 1; filter: blur(0); } }
@keyframes wipe  { from { clip-path: inset(-1em 100% -1em -1em); } to { clip-path: inset(-1em -1em -1em -1em); } }
@keyframes draw  { from { opacity: 0; clip-path: inset(100% 0 0 0); } to { opacity: 1; clip-path: inset(0); } }
@keyframes appear{ from { opacity: 0; } to { opacity: 1; } }

.js .fx-grow, .js .fx-rise, .js .fx-draw, .js .ch, .js .tw { opacity: 0; }
.js .fx-wipe { clip-path: inset(-1em 100% -1em -1em); }

.is-in .fx-grow, .is-in.fx-grow { animation: grow 4s var(--d, 0ms) both; }
.is-in .fx-rise, .is-in.fx-rise { animation: rise .5s var(--ease-out-cubic) var(--d, 0ms) both; }
.is-in .fx-drift,.is-in.fx-drift{ animation: drift var(--dur, 2.5s) var(--ease-out) var(--d, 0ms) both; }
.is-in.fx-drift.fx-fade         { animation: drift var(--dur) var(--ease-out) var(--d) both, fade .4s ease-out var(--d) both; }
.is-in .ch                      { animation: blurIn var(--cd) ease-out var(--cdl) both; }
.is-in .fx-wipe                 { animation: wipe 1.45s var(--ease-out) var(--d, 0ms) both; }
.is-in .fx-draw                 { animation: draw .5s var(--ease-out-cubic) var(--d, 0ms) both; }
.is-in .tw, .is-in.tw           { animation: appear 1ms linear var(--cdl) both; }
.is-in .tw                      { animation: appear 1ms linear var(--cdl) both; }

/* ==========================================================================
   Opening screen
   ========================================================================== */
html.cover-open, html.cover-open body { overflow: hidden; height: 100%; }

.cover {
  position: fixed; inset: 0; z-index: 10;
  background: #fff;
  display: flex; justify-content: center;
  transition: opacity .7s ease, transform .7s ease;
}
html:not(.js) .cover { display: none; }
.cover.is-closing { opacity: 0; transform: scale(1.04); pointer-events: none; }

.cover-inner {
  position: relative;
  width: calc(375 * var(--u));
  height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: calc(44 * var(--u));
  padding-bottom: calc(24 * var(--u));
  opacity: 0;
  transition: opacity .6s ease;
}
.fonts-ready .cover-inner { opacity: 1; }

.cover-confetti { position: absolute; pointer-events: none; height: auto; }
.cover-confetti--tl { width: calc(196 * var(--u)); left: calc(-8 * var(--u)); top: calc(-22 * var(--u)); }
.cover-confetti--br { width: calc(170 * var(--u)); right: calc(-14 * var(--u)); bottom: calc(-10 * var(--u)); }

.cover-title {
  position: relative;
  margin: 0;
  font-family: "Pinyon Script", "Snell Roundhand", cursive;
  font-weight: 400;
  font-size: calc(58 * var(--u));
  line-height: 1.2;
  white-space: nowrap;
  transition: opacity .35s ease;
}
.is-opening .cover-title { opacity: 0; }

/* Envelope, built from the open-envelope image so its flap can actually open.
   Source image 1102 px: flap rows 33–452, body rows 452–1088, cols 41–1060. */
.env-btn {
  position: relative;
  padding: 0; border: 0; background: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  margin-top: calc(30 * var(--u));
}
.env-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: calc(10 * var(--u)); border-radius: 4px; }
.env {
  --s: calc(322 * var(--u) / 1020);
  position: relative; display: block;
  width: calc(1020 * var(--s));
  height: calc(636 * var(--s));
  filter: drop-shadow(0 calc(6 * var(--u)) calc(10 * var(--u)) rgba(0, 0, 0, .13));
}
.env-layer { position: absolute; display: block; }
.env-layer img { position: absolute; width: calc(1102 * var(--s)); left: calc(-41 * var(--s)); }
.env-back   { inset: 0; overflow: hidden; z-index: 1; }
.env-back img { top: calc(-452 * var(--s)); }
.env-paper  { left: 7%; right: 7%; top: 6%; height: 82%; background: var(--paper); border-radius: 2px; z-index: 2;
              box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.env-pocket { inset: 0; z-index: 3; }
.env-pocket img { top: calc(-425 * var(--s)); }
.env-flap {
  left: 0; width: 100%;
  top: calc(-419 * var(--s)); height: calc(419 * var(--s));
  overflow: hidden; z-index: 4;
  transform-origin: 50% 100%;
  transform: perspective(calc(1400 * var(--u))) rotateX(180deg);
  filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, .18)) brightness(1.03);
}
.env-flap img { top: calc(-33 * var(--s)); }

.env-seal {
  position: absolute; z-index: 5;
  left: 50%; top: calc(419 * var(--s));
  width: calc(78 * var(--u));
  transform: translate(-50%, -50%);
}
.env-seal img { width: 100%; height: auto; animation: seal-pulse 2.4s ease-in-out infinite; }
.env-arc {
  position: absolute; left: -50%; top: -50%; width: 200%; height: 200%;
  overflow: visible; pointer-events: none;
  font-family: "Ibarra Real Nova", "Times New Roman", serif;
  font-size: 13.5px; letter-spacing: .06em; fill: var(--ink);
}
@keyframes seal-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }

/* Opening sequence (classes added by main.js) */
.is-opening .env-seal { transition: transform .45s ease-in, opacity .45s ease-in; transform: translate(-50%, -50%) scale(1.35); opacity: 0; }
.is-opening .env-flap { transition: transform .9s cubic-bezier(.45, 0, .2, 1) .3s; transform: perspective(calc(1400 * var(--u))) rotateX(0deg); }
.is-flap-open .env-flap { z-index: 1; }
.is-flap-open .env-paper { transition: transform .75s var(--ease-out-cubic); transform: translateY(-48%); }

/* ==========================================================================
   Reduced motion: show everything, no movement.
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .js .fx-grow, .js .fx-rise, .js .fx-draw, .js .ch, .js .tw, .js .fx-wipe, .js .fx-drift {
    opacity: 1 !important; animation: none !important; clip-path: none !important; filter: none !important; transform: none !important;
  }
  .details .t { clip-path: none !important; }
  .env-seal img { animation: none; }
  .cover, .cover-inner, .is-opening .env-seal, .is-opening .env-flap, .is-flap-open .env-paper { transition: none !important; }
}
