/* ============================================================
   XSCOPE card flip engine — one engine, two homes.
   Used by the recipient card page (full-screen) and the
   storefront product page (mini opener). Proof build 2026-11-18.
   ============================================================ */

@font-face {
  font-family: "Libre Bodoni";
  src: url("fonts/LibreBodoni.ttf") format("truetype");
  font-weight: 400 700;
}
@font-face {
  font-family: "Libre Bodoni";
  src: url("fonts/LibreBodoni-Italic.ttf") format("truetype");
  font-style: italic;
  font-weight: 400 700;
}
@font-face {
  font-family: "Source Sans 3";
  src: url("fonts/SourceSans3-Regular.ttf") format("truetype");
  font-weight: 400;
}
@font-face {
  font-family: "Source Sans 3";
  src: url("fonts/SourceSans3-Bold.ttf") format("truetype");
  font-weight: 700;
}

:root {
  --ink-green: #2e4634;
  --deep-green: #1e3a28;
  --gold: #b98a2f;
  --gold-soft: #d9b96a;
  --paper: #faf5ea;
  --paper-edge: #efe6d2;
}

/* ---------- the flip stage ---------- */
.flip-stage {
  position: relative;
  perspective: 1800px;
  perspective-origin: 50% 50%;
  /* width/height set by the host page; aspect handled by .flip-book */
}
.flip-book {
  position: absolute;
  inset: 0;
  margin: auto;
  transform-style: preserve-3d;
}
/* the page currently at rest underneath */
.flip-under {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45), 0 4px 14px rgba(0, 0, 0, 0.35);
  background: var(--paper);
}
/* shadow the turning leaf casts on the page beneath, near the fold */
.flip-fold-shadow {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  pointer-events: none;
  opacity: 0;
  z-index: 3;
}
.flip-stage[data-orient="portrait"] .flip-fold-shadow {
  background: linear-gradient(to right, rgba(30, 25, 10, 0.55) 0%, rgba(30, 25, 10, 0.18) 26%, rgba(30, 25, 10, 0) 55%);
}
.flip-stage[data-orient="landscape"] .flip-fold-shadow {
  background: linear-gradient(to bottom, rgba(30, 25, 10, 0.55) 0%, rgba(30, 25, 10, 0.18) 26%, rgba(30, 25, 10, 0) 55%);
}
/* the turning leaf */
.flip-leaf {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  z-index: 5;
  will-change: transform;
}
.flip-stage[data-orient="portrait"] .flip-leaf { transform-origin: left center; }
.flip-stage[data-orient="landscape"] .flip-leaf { transform-origin: center top; }
.flip-face {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  overflow: hidden;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  background: var(--paper);
}
.flip-face--back { }
.flip-stage[data-orient="portrait"] .flip-face--back { transform: rotateY(180deg); }
.flip-stage[data-orient="landscape"] .flip-face--back { transform: rotateX(180deg); }
/* shading that travels across the turning leaf — the paper catching light */
.flip-leaf-shade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  z-index: 4;
}
.flip-stage[data-orient="portrait"] .flip-leaf-shade {
  background: linear-gradient(to right, rgba(255,255,255,0.0) 55%, rgba(40,32,8,0.38) 100%);
}
.flip-stage[data-orient="landscape"] .flip-leaf-shade {
  background: linear-gradient(to bottom, rgba(255,255,255,0.0) 55%, rgba(40,32,8,0.38) 100%);
}
/* the back face is pre-rotated, so the same shade reads mirrored —
   physically right for light crossing the fold */

/* paper reverse of a turning leaf */
.paper-back {
  background:
    radial-gradient(120% 90% at 50% 0%, #fdfaf2 0%, var(--paper) 55%, var(--paper-edge) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}
.paper-back::after {
  content: "✦";
  color: rgba(185, 138, 47, 0.35);
  font-size: 28px;
}

/* ---------- faces ---------- */
/* Card back revised 2026-11-18 on Raj's direction: the branding block is
   small print anchored at the bottom of the back (Hallmark sample), not a
   centered billboard. Applies to both pages via this shared sheet. */
.face-fill { position: absolute; inset: 0; }
.face-front img.art,
.face-fill img.art {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.face-inside {
  background:
    radial-gradient(120% 90% at 50% 0%, #fdfaf2 0%, var(--paper) 55%, var(--paper-edge) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 9% 10%;
  box-sizing: border-box;
}
.face-inside .ornament {
  color: var(--gold);
  font-size: clamp(15px, 2.6vmin, 24px);
  letter-spacing: 0.6em;
  text-indent: 0.6em;
  margin-bottom: 5%;
}
.face-inside .message {
  font-family: "Libre Bodoni", Georgia, serif;
  font-style: italic;
  font-weight: 500;
  color: var(--ink-green);
  font-size: clamp(24px, 6.4vmin, 54px);
  line-height: 1.32;
}
.face-inside .sender {
  margin-top: 7%;
  font-family: "Source Sans 3", sans-serif;
  font-size: clamp(13px, 2.4vmin, 20px);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #7a6a45;
}
.face-inside .rule {
  width: 54px;
  height: 2px;
  background: var(--gold-soft);
  margin-top: 6%;
  border-radius: 2px;
}
.face-back {
  background:
    radial-gradient(130% 100% at 50% 0%, #2a4d33 0%, var(--deep-green) 58%, #142a1b 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  text-align: center;
  padding: 10% 10% 9%;
  box-sizing: border-box;
  color: #f3ead2;
}
.face-back .seal {
  width: clamp(26px, 5vmin, 32px);
  height: clamp(26px, 5vmin, 32px);
  border: 1.5px solid var(--gold-soft);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold-soft);
  font-size: clamp(12px, 2.4vmin, 14px);
  margin-bottom: 8px;
}
.face-back .wordmark {
  font-family: "Libre Bodoni", Georgia, serif;
  font-weight: 700;
  font-size: clamp(13px, 2.9vmin, 17px);
  letter-spacing: 0.14em;
  text-indent: 0.14em;
  color: #f6efdb;
}
.face-back .tagline {
  margin-top: 5px;
  font-family: "Libre Bodoni", Georgia, serif;
  font-style: italic;
  font-size: clamp(10px, 2.2vmin, 13px);
  color: #d8c892;
}
.face-back .rule {
  width: 34px;
  height: 2px;
  background: var(--gold-soft);
  margin: 9px 0 7px;
  border-radius: 2px;
}
.face-back .store {
  font-family: "Source Sans 3", sans-serif;
  font-weight: 700;
  font-size: clamp(10px, 2.3vmin, 13px);
  letter-spacing: 0.12em;
  color: var(--gold-soft);
}
.face-back .small {
  margin-top: 4px;
  font-family: "Source Sans 3", sans-serif;
  font-size: clamp(8px, 1.7vmin, 10px);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(243, 234, 210, 0.62);
}

/* ---------- Paper & Thread cards (Raj, 2026-11-24) ----------
   The city Christmas sets are cut paper and silk thread on a cream
   ground, in three portrait ratios (2:3, 3:4, 1:2). Their fronts are
   fitted whole onto the paper, never cover-cropped, and their backs
   carry the branding as a sewn-on label on cream paper with a
   stitched frame. (The label began small and bottom-anchored;
   Raj's elegance pass later the same day made it minuscule and
   centred: see the Phase 2 block below.) */
.face-front.face-fit { background: #f6efdd; }
.face-front.face-fit img.art { object-fit: contain; }
/* Elegance pass (Raj, 2026-11-24, "Our branding is too loud... it
   needs to be minuscule, tasteful, centred"): the PT back is ONE
   small sewn label at the centre of quiet paper: the wordmark in
   small letter-spaced type, the care line beneath in smaller
   italic, nothing else. The stitched frame stays, softened. */
.face-back--pt {
  background:
    radial-gradient(130% 100% at 50% 0%, #fdfaf2 0%, var(--paper) 58%, var(--paper-edge) 100%);
  color: var(--ink-green);
  justify-content: center;
  container-type: inline-size;
}
.face-back--pt::before {
  content: "";
  position: absolute;
  inset: 11px;
  border: 1.5px dashed rgba(178, 58, 44, 0.3);
  border-radius: 8px;
  pointer-events: none;
}
.face-back--pt::after {
  content: "";
  position: absolute;
  inset: 17px;
  border: 1px dashed rgba(185, 138, 47, 0.28);
  border-radius: 6px;
  pointer-events: none;
}
.face-back--pt .pt-label {
  background: #fffdf4;
  border: 1.5px dashed rgba(178, 58, 44, 0.55);
  border-radius: 6px;
  padding: 2.2cqw 3.6cqw 1.9cqw;
  transform: rotate(-1.3deg);
  box-shadow: 0 3px 8px rgba(74, 64, 42, 0.14);
  display: flex;
  flex-direction: column;
  align-items: center;
}
.face-back--pt .wordmark {
  color: var(--ink-green);
  font-size: 3.1cqw;
  font-weight: 500;
  letter-spacing: 0.34em;
  text-indent: 0.34em;
}
.face-back--pt .tagline {
  color: #8a6d2f;
  font-size: 2.3cqw;
  margin-top: 1.1cqw;
}

/* mini (storefront) size adjustments */
.flip-stage--mini .face-inside .message { font-size: clamp(11px, 3vmin, 16px); }
.flip-stage--mini .face-back .wordmark { font-size: clamp(11px, 2.5vmin, 14px); }
.flip-stage--mini .face-back .seal { width: 24px; height: 24px; font-size: 11px; }
.flip-stage--mini .paper-back::after { font-size: 18px; }
.flip-stage--mini .face-back--pt .wordmark { font-size: 12px; }
.flip-stage--mini .face-back--pt .tagline { font-size: 9.5px; margin-top: 4px; }
.flip-stage--mini .face-back--pt .pt-label { padding: 8px 12px 7px; }

/* ---------- photo card fronts (photo-card proof, 2026-11-18) ---------- */
/* The customer's photo fills the face; pan/zoom are baked into the img's
   percentage geometry by the page, so editor and card always agree.
   Frame overlays are inline SVG (assets/frames.js), edges/corners only. */
.photo-front { background: #e8e2d2; }
.photo-front img.ph { position: absolute; display: block; }
.frame-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.frame-overlay svg { width: 100%; height: 100%; display: block; }

/* Inside-face type sized to the CARD (container units), not the viewport —
   so a buyer's message, the ornament and the sender line fit the face at
   any card size, mini stage or full screen. The page steps long messages
   down further with inline cqw sizes. */
.face-inside { container-type: inline-size; }
/* Elegance pass (Raj, 2026-11-24, "the wording inside is very
   large and very magnified... not luxurious"): the inside type is
   now roughly half the former scale, on a narrower measure with
   more line spacing, sitting quietly centred with air around it.
   The sender line and the personal note are smaller still. */
.face-inside .ornament { font-size: 3.2cqw; margin-bottom: 3.2%; }
.face-inside .message { font-size: 6.6cqw; line-height: 1.62; max-width: 72%; text-wrap: balance; }
.face-inside .sender { font-size: 2.7cqw; margin-top: 4.5%; }
/* The personal note beneath the printed hero (designed cards'
   saying + note pattern; the photo card's printed greeting +
   note since Raj's ruling, 2026-11-24). Mirrors the recipient
   page's own values in workers/delivery.template.js. */
.face-inside .note { display: block; margin-top: 4.5%; font-size: 3.3cqw; line-height: 1.6; font-style: italic; color: #5a5f52; max-width: 74%; margin-left: auto; margin-right: auto; }
.face-inside .note-label { display: block; font-size: 2.5cqw; letter-spacing: .24em; text-transform: uppercase; color: #b08a3e; margin-bottom: 2%; font-style: normal; }

/* Landscape insides (photo cards, 2026-11-24): type is sized to
   the card's WIDTH, but a 7:5 face has barely half a portrait
   face's height, so the portrait scale overflows it once the
   printed greeting and a note share the face. The landscape
   scale tightens every block until greeting, note, rule and
   sender fit the wide face at any stage size. The recipient
   page carries the same rules in its inline styles. */
.face-inside--land { padding: 4% 8%; }
.face-inside--land .ornament { font-size: 2.4cqw; margin-bottom: 1.6%; }
.face-inside--land .message { font-size: 4.9cqw; }
.face-inside--land .note { margin-top: 2.2%; font-size: 2.5cqw; }
.face-inside--land .note-label { font-size: 1.9cqw; margin-bottom: 1%; }
.face-inside--land .rule { margin-top: 2.2%; }
.face-inside--land .sender { font-size: 2.1cqw; margin-top: 2.2%; }
