/* ==========================================================================
   Design tokens — extracted verbatim from "Tsukimi Thanks & Wishes.dc.html"
   ========================================================================== */

/* ==========================================================================
   Anri Bakery — the shop's own face, and the only one the site sets type in.

   Built from the supplied OTFs with fonttools; see assets/font/README.md. The
   woff2 pair is 57 KB against 137 KB of OTF and is what ships.

   Two weights exist, and the ranges below say so out loud: the CSS asks for
   300, 400 and 500 in places, and declaring the ranges means the browser picks
   the real Regular for all three rather than smearing a synthetic weight over
   them. Nothing here is italic, so no italic face is shipped.

   The src paths are relative to THIS FILE. A url() in an ordinary declaration
   is resolved against the stylesheet it is written in — every engine agrees
   about that — so they hold wherever the site is mounted, at / here and under
   /tsukimi in production.
   ========================================================================== */
@font-face {
  font-family: "Anri Bakery";
  src: url("../font/gen/anri-bakery-400.woff2") format("woff2");
  font-weight: 300 500;
  font-style: normal;
  /* BLOCK, not swap. `swap` means: lay the page out in a fallback face now,
     and repaint in the real one when it arrives. That is two faces for one
     paragraph, and it is only safe if the engine RE-MEASURES on the swap.
     Where it repaints without re-measuring, a line keeps the width it was
     measured at and gets drawn at another — and a Thai line measured in a face
     with no Thai has a width of nearly nothing, so `text-align: center` starts
     it at the middle of its box and it runs off to the right. No amount of
     layout CSS can fix that, because centring text means measuring it.

     `block` removes the second face: the text is not drawn at all until the
     real font is here, then it is measured and drawn once. The cost is a brief
     blank, and it is a small cost here — the file is 28 KB, it is preloaded at
     the top of every page, and since it is served immutable for a week a
     returning visitor has it before the first byte of HTML. */
  font-display: block;
}
@font-face {
  font-family: "Anri Bakery";
  src: url("../font/gen/anri-bakery-700.woff2") format("woff2");
  font-weight: 600 800;
  font-style: normal;
  /* BLOCK, not swap. `swap` means: lay the page out in a fallback face now,
     and repaint in the real one when it arrives. That is two faces for one
     paragraph, and it is only safe if the engine RE-MEASURES on the swap.
     Where it repaints without re-measuring, a line keeps the width it was
     measured at and gets drawn at another — and a Thai line measured in a face
     with no Thai has a width of nearly nothing, so `text-align: center` starts
     it at the middle of its box and it runs off to the right. No amount of
     layout CSS can fix that, because centring text means measuring it.

     `block` removes the second face: the text is not drawn at all until the
     real font is here, then it is measured and drawn once. The cost is a brief
     blank, and it is a small cost here — the file is 28 KB, it is preloaded at
     the top of every page, and since it is served immutable for a week a
     returning visitor has it before the first byte of HTML. */
  font-display: block;
}

/* ==========================================================================
   Sriracha — the hand the moon is written in.

   ONE face, Regular, and it has one job: the visitor's own words, laid on the
   lit disc on the summary poster, in the peek on the wall of moons, and in the
   canvas export of both. Anri Bakery is the shop's voice and still sets every
   other line on the site; a wish reads as the person's own handwriting rather
   than as signage, which is the whole point of putting it on the moon instead
   of on a card.

   Sriracha is SIL OFL (assets/font/Sriracha/OFL.txt) and covers the Thai block
   plus Basic Latin, so it can carry a whole message on its own. Rebuilt from
   the TTF the same way the shop face is — see assets/font/README.md.

   IT SHIPS UPRIGHT AND HAS NO ITALIC, which is the one thing to know before
   touching this block. Sriracha is a single-style face; the lean the artwork
   wants comes entirely from --hand-lean below, applied as a transform on the
   rendered block. That is why the same file is declared twice, once for each
   style: three places still ask for `italic` (.poster__msg, the peek in
   decorate.css, and HAND_STYLE in poster.js) and a face that answers the
   request with its real glyphs is what STOPS THE BROWSER SYNTHESISING ONE.
   A synthesised italic shears every glyph on its own, which on Thai drags the
   vowel and tone marks off the letters they belong to. The transform skew does
   not: it leans the finished picture, marks and letters together.

   Do not "fix" this by deleting the italic declaration — that reintroduces the
   synthesis. If a real italic ever ships, give it its own file here.
   ========================================================================== */
@font-face {
  font-family: "Sriracha";
  src: url("../font/gen/sriracha-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  /* BLOCK: a Thai line measured in a face that has no Thai measures as nearly
     nothing, and this text is centred on a moon. Better a blank moment than a
     line that starts in the middle of the disc and runs off the side of it. */
  font-display: block;
}
@font-face {
  font-family: "Sriracha";
  /* THE SAME FILE. See the note above — this entry exists so that `italic`
     resolves to real glyphs instead of a sheared upright. */
  src: url("../font/gen/sriracha-400.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: block;
}

:root {
  /* ---- night sky ------------------------------------------------------- */
  --sky-void:        #070c1c;  /* body */
  --sky-canvas:      #05091a;  /* page shell */
  --sky-panel:       #0d1738;  /* write panel base */
  --sky-panel-top:   #132250;
  --sky-panel-bot:   #0b1330;
  --sky-wall-1:      #0c1638;  /* results wall gradient stops */
  --sky-wall-2:      #101c44;
  --sky-wall-3:      #16234d;
  --sky-wall-4:      #0e1734;

  /* ---- hills ----------------------------------------------------------- */
  --hill-near-top:   #182a5c;
  --hill-near-bot:   #0c1430;
  --hill-far-top:    #162654;
  --hill-far-bot:    #0a1029;

  /* ---- gold ------------------------------------------------------------ */
  --gold:            #e8c877;
  --gold-bright:     #f6e3ad;
  --gold-pale:       #f2e2b6;
  --gold-lantern-1:  #f4d98d;
  --gold-lantern-2:  #e0b355;
  --gold-focus:      #c8a75f;

  /* ---- moon ------------------------------------------------------------ */
  --moon-1:          #fdf6cf;
  --moon-2:          #f6dd93;
  --moon-3:          #e9c469;
  --moon-4:          #dcae4f;
  --moon-sm-1:       #fdf3c4;
  --moon-sm-2:       #f2d379;
  --moon-sm-3:       #e0b95a;

  /* ---- paper (form sheet) ---------------------------------------------- */
  --paper:           #f7f2e8;
  --paper-field:     #fffdf8;
  --paper-border:    #ded5c3;

  /* ---- ink ------------------------------------------------------------- */
  --ink:             #1a2647;  /* form headings + field text */
  --ink-note:        #26314f;  /* text on pastel notes */
  --ink-pill:        #16213f;  /* text on an active gold pill */
  --ink-moon:        #3a2b12;  /* text sitting on the moon (mobile) */
  /* The visitor's own hand on the lit disc, and DELIBERATELY LIGHTER than
     --ink-moon. Near-black on gold reads as a caption stamped onto the artwork;
     this is the brown of ink that was written there, which is what the picture
     is meant to look like. It buys that with contrast — about 3.7:1 on the
     moon's own yellow, against 8:1 for --ink-moon — so it is paired everywhere
     with the cream halo below, which is what keeps a thin stroke legible where
     it crosses a crater. Both move together or neither does. */
  --ink-hand:        #8a5a2e;
  /* THE WHOLE LEAN, and THE ONE PLACE THE ANGLE LIVES.

     It used to be only half of it. Mali shipped a real italic worth about 10
     degrees and this added the rest; Sriracha is a single upright face, so
     every degree of the lean is now this number — which is why it moved from
     -18 to -28. Same picture on screen, different arithmetic behind it. If a
     leaning face is ever swapped back in, take its own angle off this value or
     the writing will fall over.

     A SKEW, NOT A ROTATION, and the two are different pictures. A rotation
     turns the whole block — the lines stay parallel to each other and the
     sentence runs diagonally across the moon. A skew leans the letters while
     the lines stay level, which is what handwriting does and what the artwork
     shows. Rotation is also why "upright" is 0 here and not 90: this is the
     angle AWAY from straight, not a bearing.

     A SKEW IS ALSO WHY THE THAI SURVIVES IT. This leans the rendered block,
     so a vowel or tone mark travels with the letter it sits on. A synthesised
     italic shears each glyph on its own and slides the marks off — see the
     @font-face note above, which is what the second Sriracha declaration is
     there to prevent.

     poster.js reads this very value for the canvas copy, so the page and the
     saved file cannot lean differently. Change it here only. */
  --hand-lean:       -28deg;
  /* AND THE TURN, which is the other half of what the artwork does and the half
     that was missing. The lean tilts the LETTERS; this tilts the LINES, so the
     writing rises to the right the way a hand does when it is not following a
     ruler. Measured off the reference art: its two lines climb about six
     degrees across their own width.

     Kept apart from --hand-lean because they are different moves and want
     different amounts — the letters lean much further than the lines climb, and
     dialling one should not drag the other with it. Applied in that order, the
     lean inside the turn, in both the page and the canvas. */
  --hand-turn:       -9deg;
  /* The galaxy pattern is not a purple moon — it is a PASTEL one, pink and
     lavender and cream, and the brightest of the three. White on it measures
     about 1.2:1 and disappears. So its hand is plum: dark and saturated, the
     same relationship to its own ground that the brown has to the yellow, at
     about 6:1. Which pattern takes which is in stickers.js, beside the art. */
  --ink-hand-plum:   #5c3b6e;
  /* Light behind the letters, sized in em so the page and the 1080px export
     blur by the same fraction of the type rather than the same pixels. */
  --halo-hand:       0 .04em .45em rgba(255, 247, 226, .92);
  --halo-hand-plum:  0 .04em .45em rgba(255, 252, 248, .92);
  --ink-muted:       #8b8272;  /* form hint */
  --ink-faint:       #b3a993;  /* counters */
  --ink-placeholder: #b6ac9c;

  /* ---- cream text on navy ---------------------------------------------- */
  --cream:           #f6efdf;
  --cream-logo:      #f4ead6;
  --cream-70:        rgba(238, 235, 226, .72);
  --cream-60:        rgba(238, 235, 226, .72);  /* mock had .6 — raised for contrast */
  --cream-80:        rgba(238, 235, 226, .8);

  /* ---- gold alphas ----------------------------------------------------- */
  --gold-a12:        rgba(232, 200, 119, .12);
  --gold-a14:        rgba(232, 200, 119, .14);
  --gold-a16:        rgba(232, 200, 119, .16);
  --gold-a18:        rgba(232, 200, 119, .18);
  --gold-a28:        rgba(232, 200, 119, .28);
  --gold-a35:        rgba(232, 200, 119, .35);
  --gold-a45:        rgba(232, 200, 119, .45);
  --gold-a50:        rgba(232, 200, 119, .5);
  --gold-a55:        rgba(232, 200, 119, .55);
  --gold-a60:        rgba(232, 200, 119, .6);
  --gold-a90:        rgba(232, 200, 119, .92);

  /* ---- CTA ------------------------------------------------------------- */
  --cta-1:           #1b2c5e;
  --cta-2:           #111d43;
  --cta-1-hover:     #24386f;
  --cta-2-hover:     #16244f;

  /* ---- badges ---------------------------------------------------------- */
  --badge-thanks-bg: #eec3cc;
  --badge-thanks-fg: #7d3a4a;
  --badge-wish-bg:   #f2d98f;
  --badge-wish-fg:   #7a5b1c;

  /* ---- note palette (mock PALETTE, index 0..6) ------------------------- */
  --note-0: #eec3cc;
  --note-1: #f2d98f;
  --note-2: #e7dfc9;
  --note-3: #d9cde9;
  --note-4: #f3ded0;
  --note-5: #e9d7b0;
  --note-6: #f0c9d4;

  /* ---- state ----------------------------------------------------------- */
  --danger:          #e5849a;
  --danger-ink:      #8d2f45;
  --success:         #9fd3ae;

  /* ---- type ------------------------------------------------------------ */
  /* One face for all the words. Anri Bakery covers Basic Latin and the whole
     Thai block (88 codepoints in U+0E00-0E7F, checked against the font's own
     cmap), so the three text tokens all point at it and the poster's four lines
     stop looking like four different fonts.

     `--font-en` was Cormorant Garamond, a serif, which is why HAPPY TSUKIMI sat
     oddly beside the Thai above it. It also sets TSUKIMI on the landing page,
     so that wordmark changes with it. */
  --font-thai:  "Anri Bakery", "Noto Sans Thai", system-ui, sans-serif;
  --font-sans:  "Anri Bakery", "Noto Sans Thai", system-ui, sans-serif;
  --font-en:    "Anri Bakery", system-ui, sans-serif;
  /* NOT Anri Bakery: it has no kana and no CJK, so 月見 and つきみ would fall
     back to whatever the device happens to have. */
  --font-jp:    "Zen Kaku Gothic New", "Hiragino Sans", system-ui, sans-serif;
  /* The visitor's own words, and only those — see the @font-face above. Anri
     Bakery is the fallback rather than a system face so a failed load still
     lands on something with real Thai in it. */
  --font-hand:  "Sriracha", "Anri Bakery", "Noto Sans Thai", system-ui, sans-serif;
  /* NOT Anri Bakery either: this is the 0/100 counter, and proportional digits
     make the number jump sideways as you type. */
  --font-mono:  ui-monospace, Menlo, Consolas, monospace;

  /* ---- radii ----------------------------------------------------------- */
  --r-panel:  22px;
  --r-card:   16px;
  --r-field:  10px;
  --r-pill:   999px;
  --r-phone:  34px;

  /* ---- elevation ------------------------------------------------------- */
  --sh-panel: 0 24px 60px rgba(0, 0, 0, .55);
  --sh-cta:   0 10px 24px rgba(17, 29, 67, .32);
  --sh-note:  0 8px 22px rgba(6, 10, 26, .28);
  --sh-note-sm: 0 6px 16px rgba(60, 42, 12, .22);

  /* ---- layout ---------------------------------------------------------- */
  --shell-max:  1480px;
  --write-w:    452px;
  --moon-size:  min(640px, 46vw);
  --moon-glow:  min(820px, 60vw);

  /* ---- imported artwork (see assets/img/README.md) --------------------- */
  --img-moon-bg: none;
  --img-rabbits: none;

  /* ---- artwork paths are NOT tokens, and that is deliberate -------------
     There used to be a --img-* custom property per picture here, and the
     sheets below pulled them in with var(). They are gone: the url() now sits
     in the rule that paints it (assets/css/*.css, relative to the sheet) or,
     where a script picks the picture, in card.js's TEMPLATES.

     A url() inside a CUSTOM PROPERTY has no agreed base. Chromium resolves it
     against the stylesheet that CONSUMES the token, WebKit against the
     DOCUMENT — verified on iOS 15.2, where "../img/..." came out as
     url("http://host/img/gen/shape-thank.webp") and every image that reached
     an element through a token silently painted nothing on Safari: the card
     faces on the confirm page and the poster, both seals on the form, the
     form's header artwork, and the moon on the decorating stage.

     Root-absolute paths ("/assets/img/...") papered over that, because an
     absolute path has no base to disagree about. Then production moved under
     https://anribakery.com/tsukimi, the proxy strips that prefix before Node
     sees it, and "/assets/..." pointed clean out of the app: 404 for every
     picture, on every browser.

     A url() in an ORDINARY declaration is resolved against its own stylesheet
     in every engine, and that answer carries whatever prefix the sheet was
     fetched under. So the pictures live in the rules. Nothing on this site may
     put a url() in a custom property again. */

  /* Filter equivalents of --sh-note. A masked element clips its own filter
     (filters run before masking), so these go on an ancestor, never on the
     masked face itself. */
  --sh-note-drop:    drop-shadow(0 6px 11px rgba(6, 10, 26, .34));
  --sh-note-drop-sm: drop-shadow(0 4px 8px rgba(60, 42, 12, .3));
  --glow-mine:    drop-shadow(0 0 6px rgba(240, 208, 122, .95))
                  drop-shadow(0 0 18px rgba(240, 208, 122, .5));
  --glow-mine-strong: drop-shadow(0 0 9px rgba(255, 240, 190, 1))
                      drop-shadow(0 0 30px rgba(240, 208, 122, .68));

  /* ---- summary poster geometry ------------------------------------------
     Both the page backdrop and card use the 1086x1448 supplied artwork. */
  --poster-aspect: 1080 / 1920;   /* summary.js rewrites this from LAYOUT */
  --poster-disc-cx: 49.95%;
  --poster-disc-cy: 48.30%;
}
