/* Zimu & Loreta: the reveal page. Every color, font, space and timing comes from
   sugar-maple/tokens.css; component classes (sm-*) come from sugar-maple/bundle.css.
   The scene behind the page is cut paper: Naples Yellow sky, Yellow Ocher hills from the
   skyline in our photo, a Deep Slate Green sea and night. main.js sets --sun (the sun going
   down) and --night (the night sky coming down) from the scroll position. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--surface);
  overflow-x: hidden;
}
p { margin: 0; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ================================================================ the paper world */
.scene {
  --sun: 0;
  --night: 0;
  --p: 0;
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  height: 100vh;
  height: 100lvh;              /* covers the screen while the phone's toolbar slides away */
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background: var(--surface);
}

/* the sunset: stacked paper discs around her sun */
.halo {
  position: absolute;
  left: 70%;
  top: 44%;
  width: min(84vw, 56vh);
  aspect-ratio: 1;
  translate: -50% calc(-50% + var(--sun) * 30vh);
  scale: calc(1 + var(--sun) * 0.22);
  will-change: translate, scale;
}
.ring {
  position: absolute;
  inset: 0;
  margin: auto;
  border-radius: var(--radius-full);
  background: var(--yellow-ocher);
  box-shadow: 0 3px 12px -4px var(--shadow-paper);
}
.r3 { width: 100%; height: 100%; opacity: 0.16; }
.r2 { width: 76%; height: 76%; opacity: 0.26; }
.r1 { width: 54%; height: 54%; opacity: 0.42; }
.ring.glow {
  width: 76%; height: 76%;
  background: var(--eugenia-red);
  box-shadow: none;
  opacity: calc(var(--sun) * 0.3);
}
.sun {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 46%;
  aspect-ratio: 164 / 130;
  translate: -45.7% -51.5%;      /* the center of her egg-shaped sun on the halo */
}
.sun-disc {
  position: absolute;
  left: 24.5%; top: 30.5%;
  width: 43%; height: 42%;
  border-radius: 50%;
  background: var(--eugenia-red);
  rotate: -8deg;
}
.sun-ink { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0.88; }

/* sunset: a warm wash over the sky and a red paper band low behind the hills */
.dusk {
  position: absolute;
  inset: 0;
  background: var(--yellow-ocher);
  opacity: calc(var(--sun) * 0.34 * (1 - var(--night)));
}
.dusk-band {
  position: absolute;
  left: 0;
  width: 100%;
  bottom: 0;
  filter: drop-shadow(0 -3px 6px var(--shadow-paper));
}
.dusk-band.ocher { height: 50vh; fill: var(--yellow-ocher); opacity: calc(var(--sun) * 0.5 * (1 - var(--night))); }
.dusk-band.red { height: 36vh; fill: var(--eugenia-red); opacity: calc(var(--sun) * 0.42 * (1 - var(--night))); }

/* her clouds, drifting at low contrast; they go with the daylight */
.cloud {
  position: absolute;
  height: auto;
  opacity: calc(0.42 * (1 - var(--night)));
  translate: 0 calc(var(--p) * -16vh);
  animation: drift 46s var(--ease-float) infinite alternate;
  will-change: translate, transform;
}
.c1 { width: clamp(120px, 30vw, 230px); left: -6%; top: 4%; }
.c2 { width: clamp(120px, 30vw, 260px); right: -12%; top: 40%; animation-duration: 58s; animation-delay: -20s; }
.c3 { width: clamp(90px, 22vw, 170px); left: 4%; top: 52%; animation-duration: 40s; animation-delay: -9s; }
@keyframes drift { from { transform: translateX(-14px); } to { transform: translateX(16px); } }

/* night comes down like a paper curtain with her scalloped edge */
.night {
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 95vh;                /* its scalloped edge tucks in behind the sea */
  translate: 0 calc((var(--night) - 1) * 104%);
  filter: drop-shadow(0 8px 10px var(--shadow-paper));
  will-change: translate;
}
.night-sheet { display: block; width: 100%; height: 100%; fill: var(--deep-slate-green); }
.moon {
  position: absolute;
  left: 14%;
  top: 12%;
  width: clamp(44px, 9vh, 76px);
  aspect-ratio: 1;
  border-radius: var(--radius-full);
  background: var(--naples-yellow);
  overflow: hidden;
}
.moon::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--deep-slate-green);
  translate: 34% -18%;
}
.stars { position: absolute; left: 0; top: 0; width: 100%; height: 66%; }
.stars i {
  position: absolute;
  width: var(--s, 10px);
  aspect-ratio: 1;
  translate: -50% -50%;
  background: var(--naples-yellow);
  clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%);
  animation: twinkle 3.2s var(--ease-float) infinite alternate;
}

/* the hills behind us, cut from the skyline in the photo */
.ridge {
  position: absolute;
  left: -2%;
  width: 104%;
  bottom: 0;
  filter: drop-shadow(0 -3px 6px var(--shadow-paper));
}
.ridge svg { display: block; width: 100%; height: 100%; }
.ridge-far { height: 52vh; }
.ridge-near { height: 40vh; }
.paper-day { fill: var(--yellow-ocher); }
/* the far hills: Yellow Ocher at half strength over a Naples Yellow backing, opaque so the sun sets behind them */
.paper-base { fill: var(--naples-yellow); }
.ridge-far .paper-day { opacity: 0.55; }
.paper-dusk { fill: var(--deep-slate-green); opacity: calc(var(--sun) * 0.12 + var(--night) * 0.72); }
.ridge-far .paper-dusk { opacity: calc(var(--sun) * 0.1 + var(--night) * 0.6); }

/* town lights come on after dark */
.lights { position: absolute; inset: 0; opacity: clamp(0, calc(var(--night) * 2.2 - 1.1), 1); }
.lights i {
  position: absolute;
  width: 4px; height: 4px;
  border-radius: var(--radius-full);
  background: var(--naples-yellow);
  animation: twinkle 3.6s var(--ease-float) infinite alternate;
}

/* the harbor: three paper waves and folded paper boats */
.sea {
  position: absolute;
  left: -4%;
  width: 108%;
  bottom: 0;
  filter: drop-shadow(0 -2px 5px var(--shadow-paper));
}
.sea svg { display: block; width: 100%; height: 100%; fill: var(--deep-slate-green); }
.sea-1 { height: 16vh; animation: swell 11s var(--ease-float) infinite alternate; }
.sea-2 { height: 10.5vh; animation: swell 8s var(--ease-float) infinite alternate-reverse; }
.sea-3 { height: 5vh; animation: swell 9.5s var(--ease-float) infinite alternate; }
.sea-1 svg path { fill-opacity: 0.5; }
.sea-2 svg path { fill-opacity: 0.78; }
@keyframes swell { from { transform: translateX(-1.2%); } to { transform: translateX(1.2%); } }

.boat {
  position: absolute;
  width: clamp(38px, 7vh, 64px);
  aspect-ratio: 80 / 52;
  bottom: 85%;
  filter: drop-shadow(0 4px 4px var(--shadow-paper));
  transform-origin: 50% 90%;
  animation: bob 4.6s var(--ease-float) infinite alternate;
}
.boat svg { display: block; width: 100%; height: 100%; overflow: visible; }
.boat .hull, .boat .sail { fill: var(--surface-card); }
.boat .sail-back { fill: var(--naples-yellow); }
.boat .fold { fill: none; stroke: var(--line); stroke-width: 1.2; stroke-linecap: round; }
.b1 { left: 14%; }
.b2 { left: 62%; width: clamp(30px, 5.5vh, 50px); bottom: 80%; animation-delay: -1.7s; }
.b3 { left: 82%; width: clamp(24px, 4.2vh, 40px); bottom: 80%; animation-delay: -3.1s; }
@keyframes bob {
  from { transform: translateY(0) rotate(-3deg); }
  to { transform: translateY(-5px) rotate(2.5deg); }
}
@keyframes twinkle { from { opacity: 0.35; } to { opacity: 1; } }

.grain {
  position: absolute;
  inset: 0;
  background: url("img/paper.png") repeat;
  background-size: 256px;
}

/* ================================================================ the page */
main, .foot { position: relative; z-index: 1; }
main {
  display: grid;
  gap: var(--space-16);
  padding: 0 var(--space-4) var(--space-16);
}

/* ---------- 1. Opening ---------- */
.opening {
  min-height: 74svh;
  display: grid;
  align-content: start;
  justify-items: center;
  gap: var(--space-2);
  padding-top: max(7vh, var(--space-8));
  text-align: center;
}
.monogram { width: 92px; height: 92px; display: block; overflow: visible; margin-bottom: var(--space-1); }
.opening .sm-names { font-size: 52px; }
.lede {
  margin-top: var(--space-2);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink);
}

/* ---------- 2. The sketch ---------- */
.sketch { display: grid; justify-items: center; gap: var(--space-6); }
.sketch-stage {
  position: relative;
  width: min(100%, 560px);
  display: grid;
  justify-items: center;
}
.paper {
  --border: var(--space-4);
  width: 100%;
  padding: var(--border);
}
.paper .sm-cardstock { inset: 0; box-shadow: 0 34px 60px -22px var(--shadow-paper), 0 6px 14px -6px var(--shadow-paper); }
.paper-card {
  position: relative;
  transform-style: preserve-3d;
  background: var(--surface-card);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 24px -12px var(--shadow-paper);
  padding: var(--space-3) var(--space-3) 0;
}
.photo-frame {
  position: relative;
  aspect-ratio: 1040 / 1087;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface-card);
}
.photo-frame > *, .photo-frame picture > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.photo { object-fit: cover; opacity: 0; }
.paint { touch-action: none; cursor: crosshair; }
/* the pencil sits on top and multiplies, so colored areas keep her graphite under the color */
.pencil {
  mix-blend-mode: multiply;
  pointer-events: none;
  transition: opacity 1100ms var(--ease-pen);
}
.photo-frame.is-revealed .photo { opacity: 1; }
.photo-frame.is-revealed .paint { visibility: hidden; }
.photo-frame.is-revealed .pencil { opacity: 0.18; }
.photo-frame.is-revealed .paint,
.photo-frame.is-idle .paint { touch-action: auto; cursor: default; }

.sparkle {
  inset: auto;
  left: calc(var(--ring-x, 53%) - 6%);
  top: calc(var(--ring-y, 76%) - 8%);
  width: 15%;
  height: auto;
  aspect-ratio: 1;
  translate: -50% -50%;
  pointer-events: none;
  overflow: visible;
  opacity: 0;
}
.sparkle path {
  stroke: var(--pen);
  stroke-width: 3.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}
.sparkle .star { fill: var(--yellow-ocher); }
.photo-frame.is-revealed .sparkle { opacity: 1; }

.caption { height: 56px; }
.note { position: absolute; inset: 0; pointer-events: none; }
.note-arrow { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.note-arrow path {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.note-text { position: absolute; right: var(--space-4); bottom: 14px; white-space: nowrap; }
.note > * { opacity: 0; }
.paper.is-said .note > * { opacity: 1; }

/* paper tags taped to the scene: the hint and the controls stay readable at any hour */
.tag {
  position: relative;
  background: var(--surface-card);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 16px -8px var(--shadow-paper);
}
.tape {
  position: absolute;
  left: 50%;
  top: -7px;
  width: 46px;
  height: 14px;
  translate: -50% 0;
  rotate: 4deg;
  background: var(--eugenia-red);
  opacity: 0.55;
  border-radius: 1px;
}
.hint {
  position: absolute;
  z-index: 2;
  right: 4px;
  top: -46px;
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: 6px var(--space-3);
  rotate: -3deg;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--dur-page) var(--ease-paper);
}
.hint.is-on { opacity: 1; }
.hint-arrow {
  width: 30px;
  height: 22px;
  translate: 0 14px;
  overflow: visible;
}
.hint-arrow path {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sketch-controls { min-height: 36px; display: flex; justify-content: center; }
.tag-button {
  background: var(--surface-card);
  border: 0;
  box-shadow: 0 8px 16px -8px var(--shadow-paper);
  padding: var(--space-2) var(--space-4);
  rotate: 1deg;
  transition: transform var(--dur-quick) var(--ease-paper);
}
.tag-button:hover { transform: translateY(-1px) rotate(-0.8deg); }
.tag-button[hidden] { display: none; }

/* Until main.js starts each moment, what is about to animate waits instead of flashing in.
   main.js adds .is-on in the same frame it starts the animation (which holds the first frame). */
.js .paper:not(.is-on) { opacity: 0; }
.js .opening:not(.is-on) .sm-names,
.js .opening:not(.is-on) .lede,
.js .opening:not(.is-on) .mono-ring,
.js .opening:not(.is-on) .mono-letters { opacity: 0; }
.js .opening:not(.is-on) .sm-rule { scale: 0 1; }

/* ---------- 3. Neon countdown, after dark ---------- */
.countdown-section {
  display: grid;
  justify-items: center;
  padding-top: 34vh;          /* room for the night to come down */
}
.neon-wrap {
  position: relative;
  width: min(100%, 640px);
  display: grid;
  justify-items: center;
  gap: var(--space-4);
}
.porky {
  justify-self: end;
  width: 112px;
  aspect-ratio: 716 / 1456;
  position: relative;
  margin-bottom: calc(-1 * var(--space-6));
  margin-right: var(--space-2);
  z-index: 1;
}
.porky > div { position: absolute; }
.porky .balloons { left: 0; top: 0; width: 88%; height: 64.08%; transform-origin: 55% 100%; }
.porky .pig { left: 9.5%; top: 57.9%; width: 90.5%; height: 42.1%; }

.neon-board {
  position: relative;
  width: 100%;
  background: var(--deep-slate-green);
  border-radius: var(--radius-md);
  box-shadow:
    0 0 0 4px var(--yellow-ocher),
    0 30px 50px -18px var(--shadow-paper);
  padding: var(--space-8) var(--space-4) var(--space-6);
  display: grid;
  justify-items: center;
  gap: var(--space-6);
  text-align: center;
}
/* four brass screws hold the sign to its board */
.neon-board::before {
  content: '';
  position: absolute;
  inset: 10px;
  pointer-events: none;
  background:
    radial-gradient(circle, var(--yellow-ocher) 0 2px, transparent 2.5px) left top / 12px 12px no-repeat,
    radial-gradient(circle, var(--yellow-ocher) 0 2px, transparent 2.5px) right top / 12px 12px no-repeat,
    radial-gradient(circle, var(--yellow-ocher) 0 2px, transparent 2.5px) left bottom / 12px 12px no-repeat,
    radial-gradient(circle, var(--yellow-ocher) 0 2px, transparent 2.5px) right bottom / 12px 12px no-repeat;
  opacity: 0.7;
}

.neon { display: inline-grid; position: relative; }
.neon > span { grid-area: 1 / 1; }
.neon .tube-off { color: var(--tube); opacity: 0.2; }
/* a lit tube: the token color with a hot white core and layered glow in the same color */
.neon .tube-on {
  color: var(--tube);
  text-shadow:
    0 0 1px var(--surface-card),
    0 0 3px var(--tube),
    0 0 9px var(--tube),
    0 0 20px var(--tube),
    0 0 42px var(--tube);
}
.neon-yellow { --tube: var(--naples-yellow); }
.neon-red { --tube: var(--eugenia-red); }
.js .neon .tube-on { opacity: 0; }
.js .neon-board.is-lit .neon .tube-on { opacity: 1; }

.neon-title {
  margin: 0;
  font-family: var(--font-script);
  font-weight: 400;
  font-size: 44px;
  line-height: 1.2;
  text-wrap: balance;
  font-feature-settings: "calt" 1;
}
.countdown {
  display: grid;
  grid-template-columns: repeat(4, auto);
  justify-content: center;
  gap: var(--space-3);
}
.unit { display: grid; justify-items: center; gap: var(--space-2); }
.digits { font-family: var(--font-hand-caps); font-size: 44px; line-height: 1; }
.digits .d { display: inline-block; width: 0.62em; text-align: center; }
.unit-label {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--on-action);
}
.countdown[hidden] { display: none; }

.when {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
  transition: color var(--dur-page) ease-out;
}
.is-night .when { color: var(--naples-yellow); }

.reveal {
  width: 100%;
  background: var(--surface-card);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 24px -12px var(--shadow-paper);
  padding: var(--space-6) var(--space-4);
  text-align: center;
  display: grid;
  gap: var(--space-2);
}
.reveal[hidden], .reveal-details[hidden], .reveal-wait[hidden] { display: none; }
.reveal-details { display: grid; gap: var(--space-2); }
.reveal-wait, .reveal-city {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink);
}

.foot { display: grid; justify-items: center; padding: var(--space-8) var(--space-4) var(--space-16); }
.foot .monogram { width: 60px; height: 60px; }

/* ================================================================ larger screens */
@media (min-width: 640px) {
  .opening { padding-top: max(9vh, var(--space-16)); min-height: 64svh; }
  .opening .sm-names { font-size: 72px; }
  .opening .monogram { width: 112px; height: 112px; }
  .paper { --border: var(--space-6); }
  .paper-card { padding: var(--space-4) var(--space-4) 0; }
  .caption { height: 64px; }
  .neon-board { padding: var(--space-8); }
  .neon-title { font-size: 60px; }
  .digits { font-size: 56px; }
  .countdown { gap: var(--space-6); }
  .halo { left: 76%; width: min(60vw, 64vh); }
}
@media (min-width: 960px) {
  .sketch-stage { width: 560px; }
  .hint {
    top: 36%;
    right: auto;
    left: calc(100% + var(--space-6));
    flex-direction: row-reverse;
    rotate: -4deg;
    white-space: nowrap;
  }
  .hint-arrow { translate: 0 10px; scale: -1 1; }
  .porky {
    position: absolute;
    right: -170px;
    top: -120px;
    width: 140px;
    margin: 0;
  }
  .c3 { top: 52%; }
}

/* ================================================================ reduced motion */
@media (prefers-reduced-motion: reduce) {
  .js .paper:not(.is-on), .js .opening:not(.is-on) .sm-names, .js .opening:not(.is-on) .lede,
  .js .opening:not(.is-on) .mono-ring, .js .opening:not(.is-on) .mono-letters { opacity: 1; }
  .js .opening:not(.is-on) .sm-rule { scale: 1 1; }
  .js .neon .tube-on { opacity: 1; }
  .paper, .paper [data-depth] { transform: none !important; }
  .cloud, .sea, .boat, .lights i, .stars i { animation: none !important; }
  .cloud { translate: none; }
  .pencil, .when { transition: none; }
}
