/* ── Hallmark curtain (user, 6-Oct-2026) — see curtain.js ────────────────────
   The SAME file lives in hrdk-dashboard/public and hrdk-orders/client/public;
   keep the two copies identical. Linked in <head> so it is in force for the
   first paint (in dev the apps' own CSS only arrives later, via JS).

   The curtain is two halves (top / bottom), each holding the whole seal and
   clipped to its half, so together they show one seal across the seam. Up:
   guilloché rings turn slowly behind the seal, the gold ring draws, then one
   glint passes over it. Down ("jewel-box opening"): a gold seam is drawn
   across the middle and the halves part up and down. Every animation's clock
   started at the click — a negative delay of the time already spent
   (--curtain-elapsed, set by curtain.js) carries it across the page load. */

.hrdk-curtain {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: none;
}
html.hrdk-curtain-on .hrdk-curtain { display: block; }
/* The page scrollbar sits OUTSIDE anything position:fixed, so it showed down
   the right edge beside the curtain and popped in and out while the page
   loaded under it (user, 6-Oct; painting it ivory did not take in Chrome).
   So while the curtain is fully up the page does not scroll at all, and the
   canvas behind the curtain is the curtain's ivory. curtain.js sets the class:
   from the first paint when arriving, from the click when leaving, and
   drops it as the curtain starts to open. */
/* No scrollbar-gutter here (10-Oct-2026): a reserved gutter is painted as an
   empty scrollbar track — a pale strip down the right edge beside the
   curtain (user: "its still there") — and neither recolouring it nor
   stretching the curtain into it took. Instead the page jump it prevented
   (6-Oct, "not smooth": the bar coming back at the very end) is hidden:
   curtain.js drops this class as the curtain STARTS to open, while both
   halves still cover the page, so the reflow happens out of sight. */
html.hrdk-curtain-full {
  overflow: hidden;
  background-color: #F4EFE4;
}
html.hrdk-curtain-entering .hrdk-curtain { animation: hc-in 220ms cubic-bezier(0.2, 0, 0, 1) both; }
html.hrdk-curtain-out .hrdk-curtain { pointer-events: none; }

.hrdk-curtain-half {
  position: absolute;
  left: 0;
  right: 0;
  overflow: hidden;
  background: #F4EFE4;
}
.hrdk-curtain-top { top: 0; height: 50%; }
/* half a pixel of overlap so no hairline of the page shows at the seam */
.hrdk-curtain-bot { top: calc(50% - 0.5px); bottom: 0; }
/* Centred on the WINDOW (100vw / 100vh), not on the area beside the page
   scrollbar: the page being left has a scrollbar and the page arriving has
   none, so centring on the curtain's own box moved the seal sideways by half
   a scrollbar at the switch (user, 6-Oct: "the logo is a little bit moving").
   The halves clip whatever reaches under the scrollbar. */
.hrdk-curtain-inner {
  position: absolute;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hrdk-curtain-top .hrdk-curtain-inner { top: 0; }
.hrdk-curtain-bot .hrdk-curtain-inner { bottom: 0; }

.hrdk-curtain-seam {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(50% - 0.5px);
  height: 1px;
  background: #B8924A;
  transform: scaleX(0);
  opacity: 0;
}

/* Going down: seam drawn from the centre outwards (~215 ms), then the halves
   part (540 ms from 220 ms) as the seam goes out. 760 ms in all = OUT_MS in
   curtain.js. */
html.hrdk-curtain-out .hrdk-curtain-seam { animation: hc-seam 760ms cubic-bezier(0.4, 0, 0.2, 1) both; }
html.hrdk-curtain-out .hrdk-curtain-top { animation: hc-part-up 540ms cubic-bezier(0.6, 0, 0.2, 1) 220ms both; }
html.hrdk-curtain-out .hrdk-curtain-bot { animation: hc-part-down 540ms cubic-bezier(0.6, 0, 0.2, 1) 220ms both; }

/* Sized to the screen (user, 6-Oct: 96 px "small in reference to screen"):
   about a fifth of the shorter side — 190 px on a 1920×1080 monitor, never
   under 130 px on a phone or over 240 px on a big screen. Strokes are in the
   SVG's own units, so they grow with it. */
.hrdk-curtain-seal {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(18px, 2.6vmin, 30px);
}
/* Smoothness (user, 6-Oct: "stutter / freeze" on live): every moving part is
   a WHOLE element animated by transform/opacity only — the browser runs those
   off the main thread, so they keep going while the next app's JavaScript
   loads and starts under the curtain. Animating SVG shapes inside one <svg>
   (stroke draw, rotating a <g>) runs on the main thread and stalled exactly
   then. Hence four stacked layers in the disc instead of one SVG. */
.hrdk-curtain-disc {
  position: relative;
  width: clamp(130px, 19vmin, 240px);
  height: clamp(130px, 19vmin, 240px);
}
.hrdk-curtain-disc > svg { position: absolute; inset: 0; display: block; width: 100%; height: 100%; overflow: visible; }

/* Guilloché: three fine dashed rings, turning slowly the whole time. */
.hrdk-curtain-guilloche {
  fill: none;
  stroke: #C9AB6C;
  stroke-width: 0.5;
  opacity: 0.9;
  animation: hc-turn 24s linear infinite;
  animation-delay: calc(-1 * var(--curtain-elapsed, 0ms));
}
.hrdk-curtain-guilloche circle:nth-child(1) { stroke-dasharray: 2 3; }
.hrdk-curtain-guilloche circle:nth-child(2) { stroke-dasharray: 3 4; }
.hrdk-curtain-guilloche circle:nth-child(3) { stroke-dasharray: 1 2.5; }

/* The ring settles in over 450 ms (was a stroke draw — main-thread only, so
   it froze mid-way during the load). Short on purpose: it finishes on the
   page being left, before the browser swaps pages — during the swap the
   screen is a frozen picture of the old page, and anything moving then
   stops and jumps. */
.hrdk-curtain-ring {
  fill: none;
  stroke: #B8924A;
  stroke-width: 1.2;
  animation: hc-ring 450ms cubic-bezier(0.3, 0, 0.2, 1) both;
  animation-delay: calc(-1 * var(--curtain-elapsed, 0ms));
}
/* The glint: a slanted bar slid across the ring's face, clipped to the
   ring's inner circle (r 34 of 96 → inset 14.583%). */
.hrdk-curtain-glint {
  position: absolute;
  inset: 14.583%;
  border-radius: 50%;
  overflow: hidden;
}
.hrdk-curtain-glint i {
  position: absolute;
  top: -10%;
  left: -65%;
  width: 20%;
  height: 120%;
  background: #FFF6DC;
  opacity: 0;
}
/* The glint runs on the ARRIVING page only, timed from its first paint (not
   from the click), so it never lands in the frozen page-swap moment. */
html.hrdk-curtain-arrived .hrdk-curtain-glint i {
  animation: hc-glint 420ms cubic-bezier(0.45, 0, 0.2, 1) 120ms both;
}
/* The seal's own faces: the SAME font files the apps' Google Fonts sheets use
   (so already in the browser cache from the page being left), declared here
   with font-display: block and preloaded in index.html. The words used to be
   hidden by curtain.js until the page's own fonts had loaded and then faded
   back in — on arrival they vanished and came back (user, 6-Oct: "words
   blink"). Now the browser draws them as soon as the cached file is read, and
   never in a fallback face first.
   ponytail: hard-coded gstatic URLs (v24 / v23); if Google retires them the
   words fall back to Georgia / system sans — refresh from the css2 URL. */
@font-face {
  font-family: 'HRDK Curtain Serif';
  font-weight: 500 700;
  font-display: block;
  src: url(https://fonts.gstatic.com/s/cormorant/v24/H4clBXOCl9bbnla_nHIq75u9.woff2) format('woff2');
}
@font-face {
  font-family: 'HRDK Curtain Sans';
  font-weight: 400 700;
  font-display: block;
  src: url(https://fonts.gstatic.com/s/ibmplexsans/v23/zYXzKVElMYYaJe8bpLHnCwDKr932-G7dytD-Dmu1syxeKYY.woff2) format('woff2');
}
/* Type matches the dashboard's top-bar wordmark (user, 6-Oct): "HRDK" as
   .topnav-brand-main (Cormorant 700, near-plain tracking), the label as
   .topnav-brand-sub "JEWEL CRAFT" (IBM Plex Sans 600, capitals, .12em). */
.hrdk-curtain-mark text {
  fill: #8A6A2C;
  font-family: 'HRDK Curtain Serif', 'Cormorant', Georgia, serif;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.01em;
}
/* A fixed one-line box: the label's height must not depend on the font, or
   the seal (centred with it) shifts up or down if a fallback face is used. */
.hrdk-curtain-label { height: clamp(13px, 1.7vmin, 20px); }
.hrdk-curtain-label::after {
  content: var(--curtain-label, '');
  display: block;
  line-height: 1;
  white-space: nowrap;
  font-family: 'HRDK Curtain Sans', 'IBM Plex Sans', -apple-system, sans-serif;
  font-size: clamp(13px, 1.7vmin, 20px);
  font-weight: 600;
  letter-spacing: 0.12em;
  padding-left: 0.12em;
  text-transform: uppercase;
  color: #8A6A2C;
}

@keyframes hc-in { from { opacity: 0; } }
@keyframes hc-ring { from { opacity: 0; transform: scale(0.94) rotate(-25deg); } }
@keyframes hc-turn { to { transform: rotate(360deg); } }
@keyframes hc-glint {
  from { opacity: 0.9; transform: skewX(-7deg) translateX(0); }
  to { opacity: 0.9; transform: skewX(-7deg) translateX(1100%); }
}
/* The seam is the join of the two halves: drawn over 28% (~215 ms), then
   gone by 42% (~320 ms) — a beat after the halves start to part at 220 ms.
   It used to hold till 60% and fade till the end, so a gold line hung over
   the arriving page for half a second after the halves had gone (user,
   8-Oct-2026). */
@keyframes hc-seam {
  0% { opacity: 1; transform: scaleX(0); }
  28% { opacity: 1; transform: scaleX(1); }
  42% { opacity: 0; transform: scaleX(1); }
  100% { opacity: 0; transform: scaleX(1); }
}
@keyframes hc-part-up { to { transform: translateY(-100%); } }
@keyframes hc-part-down { to { transform: translateY(100%); } }

@media (prefers-reduced-motion: reduce) {
  html.hrdk-curtain-entering .hrdk-curtain,
  .hrdk-curtain-guilloche,
  html.hrdk-curtain-arrived .hrdk-curtain-glint i,
  .hrdk-curtain-ring,
  html.hrdk-curtain-out .hrdk-curtain-seam,
  html.hrdk-curtain-out .hrdk-curtain-top,
  html.hrdk-curtain-out .hrdk-curtain-bot { animation: none; }
}
