/* ═══════════════════════════════════════════
   gift-of-flowers — design tokens
   Palette:    cream-blush              (EXTENSION: not in _shared/tokens/palettes.json; ground: light)
   Typography: playfair-outfit-pinyon   (_shared/tokens/typography.json), display role not loaded,
               plus ONE added face: Caveat (the `hand` role, EXTENSION)
   Easings:    expo-out · breath · drift · stage · silk · snap   (_shared/tokens/easings.json)
               plus `fall` (EXTENSION: the bloom's gravity)

   Mirrors _shared/css/tokens-base.css. The 15 palette tokens below are the one
   documented palette extension; they follow the same vocabulary and clear the same
   audits as every shared palette (__tests__/lib/palette-contrast.test.ts), computed with
   src/lib/palette-contrast.ts: ground light; text-primary and text-secondary AA on
   bg-primary; accent-warm, accent-celestial and sage AA on bg-primary; spark lighter than
   bg-primary. Every ratio is in concept.md.

   Two grounds, one palette:
     bg-primary  = cream paper  (#F6F2EC)  the-gift, and the audited ground
     bg-elevated = blush        (#F3D6DE)  the DEEPEST pixel of the pink wash (everything after the bloom)
   The wash only ever gets lighter than bg-elevated (white mottling, a pale streak), so any
   text that clears AA on bg-elevated clears it on every pixel of the wash.

   Text rule that follows from the numbers: on the blush wash, text is `wine` or
   `text-primary` only. `text-secondary` (5.86 on the deepest blush, 4.38 under two
   overlapping bubbles) is for cream, the note card and the polaroid frame.
   ═══════════════════════════════════════════ */

:root {
    color-scheme: light;

    /* ───── Palette: cream-blush (extension) ───── */
    --void: #fffdfa;                 /* paper white: the polaroid frame, the lightest highlight */
    --bg-primary: #f6f2ec;           /* cream paper: the gift's ground; the audited ground */
    --bg-elevated: #f3d6de;          /* blush: the wash's deepest stop (the worst-case ground for text) */

    --accent-warm: #c4304a;          /* pencil red: the gift box's strokes. A mark, never body copy */
    --accent-warm-bright: #d2384e;   /* the pencil's lighter pass (4.26 on cream: a stroke, never text) */
    --accent-warm-deep: #9e2238;     /* red in shadow: the box's cross-hatch, the heart's pressed fill */

    --accent-rose: #d77a92;          /* bubble rose (2.66 on cream: decorative, never text) */
    --accent-soft: #f7c9d4;          /* bubble light, the wash's pink breath (decorative) */
    --accent-celestial: #9c3556;     /* dusty plum-rose: the outlined heart, fine rules */

    --text-primary: #4f222c;         /* deep wine-brown: the letter's ink; any text on cream, note or blush */
    --text-secondary: #7a3f4c;       /* quiet wine: hints, "swipe up", on cream / note / polaroid only */

    --wine: #8e2a3b;                 /* wine-rose: the script headlines and the hand lines. Text on the blush wash */
    --sage: #437055;                 /* contract only: not rendered (a leaf-green kept AA on cream) */
    --ember: #b5452f;                /* contract only: not rendered (nothing here can fail or alert) */
    --spark: #fffdfb;                /* glints: lighter than the cream (lum 0.985 vs 0.892) */

    /* ───── Glow + glass (derived from this palette) ─────
       Light worlds do not glow: these are soft red-rose shadows and a cream glass. */
    --accent-warm-glow: rgba(196, 48, 74, 0.28);         /* accent-warm */
    --accent-warm-glow-soft: rgba(196, 48, 74, 0.10);
    --glass: rgba(246, 242, 236, 0.66);                  /* bg-primary */
    --glass-border: rgba(142, 42, 59, 0.14);             /* wine */
    --glass-border-hover: rgba(142, 42, 59, 0.34);

    /* ───── The paper (the-gift) ───── */
    --paper: var(--bg-primary);
    --paper-grain: rgba(142, 42, 59, 0.035);             /* a 2% tooth, rasterised once as a static tile */
    --pencil: var(--accent-warm);                        /* box outline and bow */
    --pencil-light: var(--accent-warm-bright);           /* the lighter second pass */
    --pencil-shade: var(--accent-warm-deep);             /* the shaded hatch on the box's right third */

    /* ───── The wash (everything after the bloom): blush watercolour with white mottling ─────
       Deepest pixel = --wash-a (= bg-elevated). Mottling only lightens. */
    --wash-a: #f3d6de;               /* deep blush: top-left and the bottom-right bloom */
    --wash-b: #f8e4ea;               /* mid blush */
    --wash-c: #fbeff2;               /* pale blush: the streak through the middle */
    --wash-ground: linear-gradient(168deg, var(--wash-a) 0%, var(--wash-b) 34%, var(--wash-c) 58%, var(--wash-b) 80%, var(--wash-a) 100%);
    --wash-mottle: radial-gradient(closest-side, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0));
    --wash-mottle-size: 96vmax;      /* three of these, drifting 6-9vw over 60-90 s, `drift` */

    /* ───── Bubbles: drifting pink discs (template-local CSS, ~26 spans) ─────
       Darkest stop #eba3b5 at <= 0.5 opacity: wine over it is 5.03:1, 4.55:1 under two overlapping bubbles. */
    --bubble-hi: #fbe3e9;
    --bubble-mid: #f2b0c2;
    --bubble-lo: #eba3b5;
    --bubble: radial-gradient(circle at 36% 30%, var(--bubble-hi) 0%, var(--bubble-mid) 42%, var(--bubble-lo) 100%);
    --bubble-opacity-max: 0.5;       /* never above this: the text-contrast floor depends on it */

    /* ───── Polaroids and the note card ───── */
    --polaroid-frame: #fffefb;
    --polaroid-shadow: 0 8px 18px rgba(142, 42, 59, 0.16), 0 1px 3px rgba(142, 42, 59, 0.22);
    --note-paper: #fbf7ec;           /* the letter's card: cream with a breath of warmth (ink 12.28:1) */
    --note-shadow: 0 14px 34px rgba(142, 42, 59, 0.18), 0 2px 4px rgba(142, 42, 59, 0.16);
    --ink: var(--text-primary);      /* letter body */
    --ink-script: var(--wine);       /* headlines, the hand lines */

    /* ───── Light events ───── */
    --bloom-flash: rgba(255, 255, 255, 0.72);            /* the swell's hit: a white lift over the flowers */
    --finale-lift: rgba(255, 255, 255, 0.6);             /* the white bloom behind "I will always love you" */

    /* ───── The bloom: geometry and clock (numbers explained in shots.md) ───── */
    --bloom-cx: 50%;                 /* the tunnel's centre = the gift box's centre */
    --bloom-cy: 46%;
    --bloom-u: max(72vw, 62vh);      /* U: centre to the farthest corner. Fallback first, exact below */
    --bloom-q: 1.36;                 /* ring-to-ring radius ratio (self-similar: every ring is a scaled copy) */
    --bloom-grow: 1.25s;             /* a ring's birth growth, `expo-out` */
    --bloom-g0: 0.14;                /* a ring's scale when born */
    --bloom-zoom-rate: 0.16;         /* z(c) = 0.62 * e^(0.16 c) on the bloom clock c (seconds from the-gift 1.0 s) */
    --bloom-spin: 11.4deg;           /* the whole tunnel, per second */
    --bloom-fall-tilt: 1;            /* 0 under reduced motion */

    /* ───── Typography ─────
       Pinyon Script + Outfit come from playfair-outfit-pinyon (Playfair Display is NOT loaded: no beat sets display type).
       Caveat is the one added face (SIL OFL, Google Fonts):
       https://fonts.googleapis.com/css2?family=Caveat:wght@400;500;600&display=swap */
    --font-display: 'Playfair Display', 'Georgia', serif;                  /* declared by the pairing, unused */
    --font-body: 'Outfit', 'Segoe UI', sans-serif;                         /* hints, buttons, "tap to open" */
    --font-script: 'Pinyon Script', 'Snell Roundhand', cursive;            /* the headlines */
    --font-hand: 'Caveat', 'Segoe Print', 'Bradley Hand', cursive;         /* the sub-lines, the letter, the sign-off */

    --type-script-headline: clamp(2.6rem, 13vw, 3.6rem);                   /* From me to you. */
    --type-script-closing: clamp(2.5rem, 12.5vw, 3.9rem);                  /* the closing line, fitted */
    --type-script-gift: clamp(1.7rem, 8vw, 2.1rem);                        /* For you, {toName}. */
    --type-hand-sub: clamp(1.35rem, 5.6vw, 1.6rem);                        /* This is how much I love you. */
    --type-hand-letter: clamp(1.45rem, 6.2vw, 1.8rem);                     /* the letter body; never below 1.45rem */
    --type-hand-signoff: clamp(1.5rem, 6.4vw, 1.8rem);
    --type-hint: 0.78rem;                                                  /* Outfit 400, tracked caps; never lower */
    --script-stroke: 0.35px;                                               /* -webkit-text-stroke on Pinyon: the reel's script is a touch heavier */

    /* ───── Easings ───── */
    --ease-silk: cubic-bezier(0.25, 0.1, 0.25, 1);
    --ease-expo-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-back-out: cubic-bezier(0.34, 1.56, 0.64, 1);    /* declared by the contract; NOT used in this film */
    --ease-breath: cubic-bezier(0.45, 0, 0.55, 1);
    --ease-snap: cubic-bezier(0.5, 0, 0.5, 1);
    --ease-drift: cubic-bezier(0.4, 0, 0.6, 1);
    --ease-stage: cubic-bezier(0.83, 0, 0.17, 1);
    --ease-fall: cubic-bezier(0.55, 0, 0.85, 0.35);        /* EXTENSION: gravity, an accelerating ease-in for the flowers' fall */
}

/* U exactly: the half-diagonal from the bloom's centre (50%, 46%) to the farthest corner. */
@supports (width: hypot(1px, 1px)) {
    :root { --bloom-u: hypot(50vw, 54vh); }
}
@supports (height: 1dvh) and (width: hypot(1px, 1px)) {
    :root { --bloom-u: hypot(50vw, 54dvh); }
}

@media (prefers-reduced-motion: reduce) {
    :root { --bloom-fall-tilt: 0; }
}
