/* ==========================================================================
   Kheema Bisht Inter College: Dusk, the light layer (theme-c-fx.css)
   Loaded after theme-c.css, the page-group sheet and fx/transitions.css.
   Works together with assets/js/dusk/core.js.

   THREE LIGHTS
     sky light     --eve (0 last gold light .. 1 night), written on <html> by
                   core.js as the page scrolls. Grounds, gold and stars read it.
     lamp light    brass. The visitor: pointer lamp, tap ring, focus ring, rim.
     window light  bus yellow. The school: lamps that switch on (--kb-light).

   THE FALLBACK RULE (every rule below follows it)
     The resting CSS of an effect is its FINISHED state. A hidden start state
     exists only (a) inside prefers-reduced-motion: no-preference and (b) on an
     element that core.js has armed with .kb-arm (time reveals) or .kb-sd
     (scroll-driven). core.js arms only what starts below the first screen.
     No script, old browser, reduced motion: nothing is hidden and nothing moves.
     (Without the script --eve stays 0: today's dark grounds, paper a shade warm.)

   CLASSES core.js SETS (page CSS may read them, never set them)
     html.kb-on    engine is running          html.kb-lite  light tier
     html.kb-touch no fine pointer            html.kb-boot  first 120 ms
     .kb-arm       waiting below the fold     .is-in        has come into view
     .kb-sd        scroll-driven effect on    .is-lit  .is-rolled  .is-on
     .kb-deco      every decorative layer this build adds (hidden in print)

   TOKENS FOR PAGE CSS
     --eve --lamp --sky-gold --stars     the evening
     --kb-light    colour of a window light (bus yellow; settles to brass-light
                   on [data-kb-switch~="settle"])
     --kb-halo     halo of a window light     --kb-glow  glow of a brass numeral
     --kb-rim-c    colour of the rim light (brass on paper, brass-light on dark)
     --i           index set by [data-kb-stagger]   --kb-step  its step (70ms)
     --kb-btn-glow glow of a primary button on a dark ground
     --ease-rise --ease-cut --ease-sheet --t-press --t-ui --t-reveal --t-arrive --t-cut

   ALSO IN THIS SHEET
     page cut      the ridge rises between pages (view transitions, type kb-page;
                   kb-back sinks). Mark data-fx-vt="header|title|hero" in the page.
     kb-lang       the dissolve of the language switch
     seam depth    the far ridge of every seam rises 8px as it crosses the screen
   THE FRAME (header, menu sheet, nav lamp, language thumb, progress lamp,
   back-to-top arch, dock, WhatsApp, footer bookend) lives in theme-c.css
   ("THE FRAME") and theme-c.js, so it also runs where this sheet is not loaded.
   ========================================================================== */

@property --kb-light { syntax: "<color>"; inherits: true; initial-value: #ffc72c; }
@property --kb-y { syntax: "<length>"; inherits: false; initial-value: 0px; }

:root {
  --eve: 0;
  --sky-gold: calc(0.16 - 0.12 * var(--eve));
  --lamp: calc(0.55 + 0.45 * var(--eve));
  --stars: clamp(0, calc((var(--eve) - 0.12) * 1.5), 1);

  --ease-rise: cubic-bezier(0.2, 1, 0.2, 1);
  --ease-cut: cubic-bezier(0.7, 0, 0.2, 1);
  --ease-sheet: cubic-bezier(0.32, 0.72, 0, 1);
  --t-press: 160ms;
  --t-ui: 220ms;
  --t-reveal: 800ms;
  --t-arrive: 1100ms;
  --t-cut: 460ms;
  --kb-step: 70ms;

  --kb-halo: 0 0 22px 6px rgba(255, 199, 44, calc(0.42 * var(--lamp)));
  --kb-glow: 0 0 0 transparent;
  --kb-focus-halo: 0 0 0 0 transparent;
  --kb-rim-c: var(--brass);

  /* 128px tile: sparse mist-white specks on a thin dark wash, so a ground keeps its average
     brightness and meets its ridge without a seam (indexed PNG, under 3 KB) */
  --grain: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACAAgMAAAC+UIlYAAAADFBMVEUAAADt7/Xt7/Xt7/WWy2cdAAAABHRSTlPZTZn/HQxQxAAACxJJREFUeNo9V11sZVUV/vZP293OaWe3vQNlrLh7W6FISU5nSmykyL63RQqUUGASSNRw+YmZmHmo6MPE8LDbXrCRKlUTwwMPRXnwsRhj8MG4e63QiY2pyosJDwV8wLdGR8Obfuvckdv03nvOPXuvtb71rW+tDYWH0gSeACwQIpLtQ4Pf/E/G7kMwPgDts3189zgA9n2jDsT+kcYWgOJSE/OyMP6nDjcMec3BhBiPLj8Lp1J8wE7ynjW+91R7uOQ8rPbtJT+MCP0aEi+rZRYDiQ5E/pl9RB2WsY5W9ROWgMVi0gXoI/QgZQ0NAz+EHOHAC2SMFh+erf82Y7m7pAa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ZVB98w7I7Rx/nRLTOBs5Lla0TnphvzL3bKtXzCXRmF7c7texglT/fGPlV9P4LuCLMcVgjRyNZuuB5F5yZzslsVG0P3hJ6KostYTCmJcLgq4iQVK+bisrCRfSbHwqCtX+BanvZ5EnGvoxdG0WB/gVntQ3aLOp6Z5kFxu0j/A2VcUBfkYJjPAAAAAElFTkSuQmCC");
}
@media (max-width: 719px) { :root { --t-cut: 300ms; } }

/* ---------- Sky light: the grounds follow --eve ----------
   Dark grounds start at today's colours and only deepen, toward navy
   (#1b1f40 to #10172f, #262b52 to #192144, #2c3260 to #1f2850).
   Paper starts a shade warm, as if lamp-lit (#faf8f3, #f1eee7), and ends at
   today's cool paper. Written as rgb() sums, so every computed colour is a
   plain rgb value (colour tools read it) and no @supports gate is needed. */
:root {
  --night: rgb(calc(27 - 11 * var(--eve)) calc(31 - 8 * var(--eve)) calc(64 - 17 * var(--eve)));
  --dusk: rgb(calc(38 - 13 * var(--eve)) calc(43 - 10 * var(--eve)) calc(82 - 14 * var(--eve)));
  --dusk-2: rgb(calc(44 - 13 * var(--eve)) calc(50 - 10 * var(--eve)) calc(96 - 16 * var(--eve)));
  --paper: rgb(calc(250 - 2 * var(--eve)) calc(248 + var(--eve)) calc(243 + 9 * var(--eve)));
  --mist: rgb(calc(241 - 4 * var(--eve)) calc(238 + var(--eve)) calc(231 + 14 * var(--eve)));
}
/* the rubber-band at the top and bottom of a phone screen shows the sky */
html { background: var(--night); }

/* horizon gold fades as night comes: .section-night and .fame in theme-c.css read
   --sky-gold as the alpha of their top glow (0.12 when this sheet is not loaded) */

/* tokens that differ on dark grounds (same list as theme-c.css) */
:is(.top-utility-bar, .site-header, .announcement-bar, .hero, .dusk-band, .why-panorama,
.fame, .helpdesk, .helpdesk-band, .voices, .site-footer, .sticky-admission, .whatsapp-float,
.back-to-top, .pwa-install-banner, .whatsapp-popup-header,
.on-dusk, .breadcrumbs, .page-title, .page-band, .section-dusk, .section-night, .cta-band,
.photo-band, .lightbox, .callout--dusk, .card--dusk) {
  --focus: var(--brass-light);
  --kb-rim-c: var(--brass-light);
  --kb-focus-halo: 0 0 0 7px rgba(235, 203, 138, 0.18);
  --kb-glow: 0 0 calc(18px * var(--lamp)) rgba(235, 203, 138, 0.35);
  --kb-btn-glow: 0 6px 24px -8px rgba(210, 162, 76, calc(0.5 * var(--lamp)));
}
.helpdesk-band { --focus: var(--brass-light); }
.on-paper, .whatsapp-popup-body {
  --focus: var(--ink);
  --kb-rim-c: var(--brass);
  --kb-focus-halo: 0 0 0 0 transparent;
  --kb-glow: 0 0 0 transparent;
  --kb-btn-glow: 0 0 0 0 transparent;
}
/* brass numerals on dark: add .kb-glow */
.kb-glow { text-shadow: var(--kb-glow); }

/* ---------- Grounds that carry grain, stars or the pointer lamp ----------
   core.js adds .kb-ground (own stacking context, so layers at z-index -1 sit
   above the ground's background and under everything else). */
.kb-ground { isolation: isolate; }
.kb-pos { position: relative; }

.kb-grain {
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0.055;
  pointer-events: none;
  background: var(--grain) 0 0 / 160px;
}

/* stars: the canvas of starfield.js; shows at its own base strength or the
   strength of the evening, whichever is higher */
.kb-star { opacity: 0; transition: opacity 1.8s ease; }
/* coming on is an animation, played once: the strength follows the evening number, and a
   transition on it would start again at every step of the scroll */
.kb-star.is-on { opacity: max(var(--star-base, 0.35), var(--stars)); transition: none; animation: kb-star-in 1.8s ease backwards; }
.kb-star.kb-now { transition: none; animation: none; }
@keyframes kb-star-in { from { opacity: 0; } }
/* fx/ridge.js draws its layers wider than the host, so they can drift: the theme's max-width on svg must not clip them */
.kbfx-ridge svg { max-width: none; }

/* ---------- Lamp light: focus ---------- */
:focus:not(:focus-visible) { outline: none; }
:where(.top-utility-bar, .site-header, .announcement-bar, .hero, .dusk-band, .why-panorama,
.fame, .helpdesk, .helpdesk-band, .voices, .site-footer, .on-dusk, .breadcrumbs, .page-title,
.page-band, .section-dusk, .section-night, .cta-band, .photo-band, .lightbox, .callout--dusk,
.card--dusk) :focus-visible { box-shadow: var(--kb-focus-halo); }

/* ---------- Lamp light: tap ring (touch, dark grounds, never on a control) ---------- */
.kb-tap {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 70;
  width: 64px;
  height: 64px;
  margin: -32px 0 0 -32px;
  border: 1.5px solid var(--brass-light);
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
}
.kb-tap.is-on { animation: kb-tap 480ms ease-out both; }
@keyframes kb-tap { from { opacity: 0.5; scale: 0.12; } to { opacity: 0; scale: 1; } }

/* ---------- Lamp light: rim ([data-kb-rim=".card"] on a grid) ----------
   core.js picks a free pseudo-element on each card (.kb-rim-b = ::before,
   .kb-rim-a = ::after) or, when both are taken, adds <i class="kb-rim-i">. */
.kb-rim-b::before, .kb-rim-a::after, .kb-rim-i {
  content: "";
  position: absolute;
  inset: var(--rim-o, -1px);
  z-index: 1;
  padding: 1px;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(240px circle at var(--x, 0px) var(--y, 0px), var(--kb-rim-c), transparent 70%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  opacity: var(--lit, 0);
  transition: opacity 600ms var(--ease);
}
.kb-rim.is-near::before, .kb-rim.is-near::after, .kb-rim.is-near > .kb-rim-i { transition-duration: 200ms; }
.kb-rim:focus-within { --lit: 1; }

/* ---------- Window light: one switch-on for every lamp ----------
   [data-kb-switch] on a lamp. Colour the lamp with var(--kb-light) and give it
   box-shadow: var(--kb-halo). "settle": a lamp in a row flickers on in bus
   yellow and rests in brass-light. */
[data-kb-switch] { --kb-light: var(--bus); }
[data-kb-switch~="settle"] { --kb-light: var(--brass-light); }
@keyframes kb-switch-on { 0% { opacity: 0; } 22% { opacity: 0.6; } 34% { opacity: 0.25; } }
@keyframes kb-settle { 0%, 55% { --kb-light: #ffc72c; } }

/* ---------- Register marks ([data-kb-marks] on a frame) ---------- */
.kb-marks {
  --m: var(--brass);
  position: absolute;
  inset: -5px;
  z-index: 1;
  opacity: 0.35;
  pointer-events: none;
  background:
    linear-gradient(var(--m) 0 0) left 0 top 4.5px / 10px 1px,
    linear-gradient(var(--m) 0 0) left 4.5px top 0 / 1px 10px,
    linear-gradient(var(--m) 0 0) right 0 top 4.5px / 10px 1px,
    linear-gradient(var(--m) 0 0) right 4.5px top 0 / 1px 10px,
    linear-gradient(var(--m) 0 0) left 0 bottom 4.5px / 10px 1px,
    linear-gradient(var(--m) 0 0) left 4.5px bottom 0 / 1px 10px,
    linear-gradient(var(--m) 0 0) right 0 bottom 4.5px / 10px 1px,
    linear-gradient(var(--m) 0 0) right 4.5px bottom 0 / 1px 10px;
  background-repeat: no-repeat;
}
/* a frame that clips its content keeps the marks just inside its corners */
.kb-marks.is-inside { inset: 6px; }

/* ---------- Tabs ([data-kb-tabs] on a tab row): one bar glides to the active tab ---------- */
.kb-tab-lamp {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--w, 0px);
  height: 2px;
  background: var(--spark, var(--brass));
  translate: var(--x, 0px) var(--y, 0px);
  opacity: 0;
  pointer-events: none;
}
.kb-tab-lamp.is-set { opacity: 1; transition: translate 260ms var(--ease), width 260ms var(--ease); }
.kb-tabs-on:has(> .kb-tab-lamp.is-set) :is(.tab, .gallery-tab, .gallery-mode-tab)::after { opacity: 0; }

/* ---------- Lit ([data-kb-lit] on a card or arch) ----------
   Resting = lit. A page may set its own look on .is-lit / :hover / :focus-within;
   this is the default brass rim. */
[data-kb-lit] {
  box-shadow: 0 0 0 1px var(--brass), 0 0 32px -6px rgba(235, 203, 138, calc(0.45 * var(--lamp)));
  transition: box-shadow 250ms var(--ease);
}

/* ---------- Numbers ([data-kb-odo]): glow once the roll has ended ---------- */
[data-kb-odo] { text-shadow: var(--kb-glow); }
/* the glow of a rolled number comes up once, as an animation (it follows --lamp, so a
   transition would start again at every step of the evening number) */
@media (prefers-reduced-motion: no-preference) { [data-kb-odo].is-rolled { animation: kb-glow-in 400ms ease backwards; } }
@keyframes kb-glow-in { from { text-shadow: 0 0 0 transparent; } }

/* ==========================================================================
   Motion. Everything from here to the next banner is inside no-preference.
   ========================================================================== */
@media (prefers-reduced-motion: no-preference) {

  /* arrival: the title band of an inner page comes up from dark, once, from the first
     paint (plain CSS, nothing is hidden: the words are at full strength throughout) */
  .page-title, .page-band:not(.has-photo) { animation: kb-arrive 700ms ease-out backwards; }
  .page-band-media { animation: kb-arrive-photo 700ms ease-out backwards; }

  /* [data-reveal] (theme-c.css hides it from the first paint; here it is hidden
     only once the engine runs, and never on the first screen) */
  html.c-js:not(.kb-on) [data-reveal]:not(.page-title, .page-band, .is-visible) { opacity: 1; transform: none; }
  html.kb-boot [data-reveal] { transition: none !important; }
  /* (doubled selectors: this must win over the nth-child delays of the theme sheets) */
  html.kb-on.kb-on [data-kb-stagger][data-kb-stagger] > [data-reveal][data-reveal] { transition-delay: calc(var(--i, 0) * var(--kb-step)); }

  /* A waiting element is hidden with opacity, never with a full clip or a zero
     scale: the browser's in-view check does not see an element that is clipped
     away, so it would wait for ever. The clip lives in the keyframes only. */

  /* photo shutter: the frame opens bottom to top, the photo settles */
  .kb-arm[data-kb-shutter]:not(.is-in) { opacity: 0; }
  .kb-arm[data-kb-shutter].is-in {
    animation: kb-shutter var(--t-reveal) var(--ease-rise) calc(var(--i, 0) * var(--kb-step)) backwards;
  }
  .kb-arm[data-kb-shutter].is-in :is(img, video) {
    animation: kb-settle-in var(--t-reveal) var(--ease-rise) calc(var(--i, 0) * var(--kb-step)) backwards;
  }

  /* arch: opens from a slit */
  .kb-arm[data-kb-arch]:not(.is-in) { opacity: 0; }
  .kb-arm[data-kb-arch].is-in {
    animation: kb-arch 900ms var(--ease-rise) calc(var(--i, 0) * var(--kb-step)) backwards;
  }

  /* heading rise: every h2 in <main> below the first screen (.kb-h, set by core.js) */
  .kb-arm.kb-h:not(.is-in) { opacity: 0; }
  .kb-arm.kb-h.is-in { animation: kb-rise 700ms var(--ease-rise) 120ms backwards; }
  .kb-arm.kb-h.kb-w.is-in { animation: kb-rise 700ms var(--ease-rise) 120ms backwards, kb-rise-w 700ms var(--ease-rise) 120ms backwards; }
  .kb-arm.kb-k:not(.is-in) { opacity: 0; }
  .kb-arm.kb-k.is-in { animation: kb-fade 500ms ease-out backwards; }

  /* lit */
  .kb-arm[data-kb-lit]:not(.is-lit, :hover, :focus-within) {
    box-shadow: 0 0 0 1px rgba(210, 162, 76, 0), 0 0 32px -6px rgba(235, 203, 138, 0);
  }

  /* seal: a rank chip lands */
  .kb-arm[data-kb-seal]:not(.is-in) { opacity: 0; }
  .kb-arm[data-kb-seal].is-in { animation: kb-seal 300ms var(--ease-rise) calc(var(--i, 0) * var(--kb-step)) backwards; }

  /* numbers */
  html.kb-on [data-kb-odo]:not(.is-rolled) { text-shadow: none; }

  /* --- decoration: runs once from the first paint as plain CSS; below the
     first screen core.js holds it (.kb-arm) until it is in view --- */

  /* lamp */
  [data-kb-switch] { animation: kb-switch-on 900ms ease-out calc(var(--i, 0) * var(--kb-step)) backwards; }
  [data-kb-switch~="settle"] {
    animation: kb-switch-on 900ms ease-out calc(var(--i, 0) * var(--kb-step)) backwards,
      kb-settle 1200ms ease-out calc(var(--i, 0) * var(--kb-step)) backwards;
  }
  .kb-arm[data-kb-switch]:not(.is-in) { animation: none; opacity: 0; }

  /* ink: strokes of an inline SVG draw in (shapes carry pathLength="1";
     core.js adds it below the first screen, put it in the markup above it) */
  [data-kb-ink] [pathLength="1"] {
    stroke-dasharray: 1;
    animation: kb-ink 600ms var(--ease) calc(var(--i, 0) * var(--kb-step)) backwards;
  }
  .kb-arm[data-kb-ink]:not(.is-in) [pathLength="1"] { animation: none; stroke-dashoffset: 1; }

  /* rule: a brass rule draws from its start edge.
     data-kb-rule            the element's ::before, left to right
     data-kb-rule="after"    its ::after      "self"  the element itself
     add "y" for top to bottom, "center" to draw outward from the middle */
  [data-kb-rule] { --kb-rule-from: 0 1; --kb-rule-o: 0 50%; }
  [data-kb-rule~="y"] { --kb-rule-from: 1 0; --kb-rule-o: 50% 0; }
  [data-kb-rule~="center"] { --kb-rule-o: 50% 50%; }
  [data-kb-rule]:not([data-kb-rule~="after"], [data-kb-rule~="self"])::before,
  [data-kb-rule~="before"]::before,
  [data-kb-rule~="after"]::after,
  [data-kb-rule~="self"] {
    animation: kb-rule 500ms var(--ease-rise) calc(var(--i, 0) * var(--kb-step)) backwards;
  }
  .kb-arm[data-kb-rule]:not(.is-in):not([data-kb-rule~="after"], [data-kb-rule~="self"])::before,
  .kb-arm[data-kb-rule~="before"]:not(.is-in)::before,
  .kb-arm[data-kb-rule~="after"]:not(.is-in)::after,
  .kb-arm[data-kb-rule~="self"]:not(.is-in) {
    animation: none;
    scale: var(--kb-rule-from);
    transform-origin: var(--kb-rule-o);
  }

  /* --- scroll-driven: only where the browser has view() timelines --- */
  @supports (animation-timeline: view()) {
    /* reading light: [data-kb-read] on a text block, the paragraphs fill with
       their own colour from the first line down. The lamp line sits 15% above the
       foot of the screen (the inset of the timeline): a line of text is at full
       strength the moment it has crossed it, so nothing in the reading area is
       ever pale; below the line the text waits at 55% */
    .kb-sd.kb-read {
      -webkit-text-fill-color: transparent;
      -webkit-background-clip: text;
      background-clip: text;
      background-image:
        linear-gradient(currentColor 0 0),
        linear-gradient(color-mix(in srgb, currentColor 55%, transparent) 0 0);
      background-size: 100% 0%, 100% 100%;
      background-repeat: no-repeat;
      animation: kb-read linear both;
      animation-timeline: view(block 0% 15%);
      animation-range: entry 0% entry 100%;
    }
    /* seam depth: the far ridge of every seam sits 8px low and rises as the seam crosses the screen */
    .ridge-out::before, .page-title::before, .page-band::before, .ridge-edge .edge-back {
      animation: kb-seam linear both;
      animation-timeline: view();
      animation-range: entry 0% cover 50%;
    }
    /* lens: [data-kb-lens] on one statement heading per page. It comes into focus
       while it enters: the moment its whole box is on screen it is sharp.
       (view(block 0px): measured against the real screen edges; a bare view() would
       take the page's scroll-padding as insets and keep the heading soft for longer) */
    .kb-sd[data-kb-lens] {
      animation: kb-lens linear both;
      animation-timeline: view(block 0px);
      animation-range: entry 0% entry 100%;
    }
  }
}

@keyframes kb-arrive { from { box-shadow: inset 0 0 0 100vmax rgba(16, 23, 47, 0.5); } to { box-shadow: inset 0 0 0 100vmax rgba(16, 23, 47, 0); } }
@keyframes kb-arrive-photo { from { opacity: 0.5; } }
@keyframes kb-shutter { from { clip-path: inset(100% 0 0 0); } to { clip-path: inset(0); } }
@keyframes kb-settle-in { from { scale: 1.06; } }
@keyframes kb-arch {
  from { clip-path: inset(38% 34% 0 34% round 999px 999px 0 0); opacity: 0; }
  30% { opacity: 1; }
  to { clip-path: inset(0 round 999px 999px 4px 4px / 46% 46% 4px 4px); }
}
@keyframes kb-rise {
  from { clip-path: inset(-0.2em 0 100% 0); translate: 0 0.35em; }
  to { clip-path: inset(-0.2em 0); translate: 0 0; }
}
@keyframes kb-rise-w { from { font-weight: 440; } }
@keyframes kb-fade { from { opacity: 0; } }
@keyframes kb-seal {
  from { scale: 1.2; opacity: 0; box-shadow: 0 0 0 0 rgba(235, 203, 138, 0.7); }
  60% { opacity: 1; }
  to { box-shadow: 0 0 0 10px rgba(235, 203, 138, 0); }
}
@keyframes kb-ink { from { stroke-dashoffset: 1; } }
@keyframes kb-rule { from { scale: var(--kb-rule-from); transform-origin: var(--kb-rule-o); } to { transform-origin: var(--kb-rule-o); } }
@keyframes kb-seam { from { translate: 0 8px; } to { translate: 0 0; } }
@keyframes kb-read { to { background-size: 100% 100%, 100% 100%; } }
@keyframes kb-lens { from { filter: blur(4px); opacity: 0.7; } to { filter: none; opacity: 1; } }

/* ==========================================================================
   Page cut: the ridge rises. One move for the whole site (overrides the default
   slide of fx/transitions.css). The header stays still; the old page dims toward
   night and lifts; the new page is uncovered from the bottom upward behind a
   ridge-shaped edge; the title and the hero photo glide. On Back the ridge sinks.
   Phones get a plain dip to night. Light tier: core.js skips the cut.
   No support, or reduced motion: a normal page load.
   ========================================================================== */
@media (prefers-reduced-motion: no-preference) {
  html:active-view-transition-type(kb-page)::view-transition { background: #10172f; }
  html:active-view-transition-type(kb-page)::view-transition-old(root),
  html:active-view-transition-type(kb-page)::view-transition-new(root) { mix-blend-mode: normal; }

  html:active-view-transition-type(kb-page)::view-transition-old(root) {
    animation: kb-cut-dim var(--t-cut) var(--ease-cut) both;
  }
  html:active-view-transition-type(kb-page)::view-transition-new(root) {
    animation: kb-cut-rise var(--t-cut) var(--ease-cut) both;
    -webkit-mask-image: var(--ridge-front), linear-gradient(#000 0 0);
    mask-image: var(--ridge-front), linear-gradient(#000 0 0);
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-size: 100% 58px, 100% 100%;
    mask-size: 100% 58px, 100% 100%;
    -webkit-mask-position: 0 var(--kb-y), 0 calc(var(--kb-y) + 57px);
    mask-position: 0 var(--kb-y), 0 calc(var(--kb-y) + 57px);
  }
  /* Back: the page being left is on top and is covered from the top down */
  html:active-view-transition-type(kb-back)::view-transition-old(root) {
    z-index: 1;
    animation: kb-cut-sink var(--t-cut) var(--ease-cut) both;
    -webkit-mask-image: var(--ridge-front), linear-gradient(#000 0 0);
    mask-image: var(--ridge-front), linear-gradient(#000 0 0);
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-size: 100% 58px, 100% 100%;
    mask-size: 100% 58px, 100% 100%;
    -webkit-mask-position: 0 var(--kb-y), 0 calc(var(--kb-y) + 57px);
    mask-position: 0 var(--kb-y), 0 calc(var(--kb-y) + 57px);
  }
  html:active-view-transition-type(kb-back)::view-transition-new(root) {
    animation: kb-cut-lit var(--t-cut) var(--ease-cut) both;
    -webkit-mask-image: none;
    mask-image: none;
  }
  /* the hero photo travels above the page, so its lower edge is cut to the ridge
     that the page draws over it: the seam is there all the way through */
  html:active-view-transition-type(kb-page)::view-transition-old(kb-hero),
  html:active-view-transition-type(kb-page)::view-transition-new(kb-hero) {
    -webkit-mask: linear-gradient(#000 0 0), var(--ridge-front) 50% calc(100% + 1px) / 100% var(--ridge-h) no-repeat;
    -webkit-mask-composite: xor;
    mask: linear-gradient(#000 0 0) exclude, var(--ridge-front) 50% calc(100% + 1px) / 100% var(--ridge-h) no-repeat;
  }
  /* the words set over a title-band photo travel as their own layer, above the photo
     (left in the page they would sit under the moving photo until the cut ends) */
  .page-band.has-photo > .container, .hero > .hero-grid { view-transition-name: kb-band; }
  html[data-fx-vt-busy] :is(.page-band.has-photo > .container, .hero > .hero-grid),
  html:active-view-transition-type(kb-lang) :is(.page-band.has-photo > .container, .hero > .hero-grid) { view-transition-name: none; }
  html.kb-xfade :is(.page-band.has-photo > .container, .hero > .hero-grid) { view-transition-name: none; }
  html:active-view-transition-type(kb-page)::view-transition-group(kb-band) { animation-duration: var(--t-cut); animation-timing-function: var(--ease-cut); }
  html:active-view-transition-type(kb-page)::view-transition-old(kb-band),
  html:active-view-transition-type(kb-page)::view-transition-new(kb-band) {
    width: 100%;
    height: 100%;
    object-fit: none;
    object-position: left top;
    animation-duration: var(--t-cut);
  }
  /* the title glides on the same beat */
  html:active-view-transition-type(kb-page)::view-transition-group(kb-title) {
    animation-duration: var(--t-cut);
    animation-timing-function: var(--ease-cut);
  }

  @media (max-width: 719px) {
    html:active-view-transition-type(kb-page)::view-transition-old(root),
    html:active-view-transition-type(kb-back)::view-transition-old(root) {
      z-index: auto;
      animation: kb-dip-out 140ms ease-out both;
      -webkit-mask-image: none;
      mask-image: none;
    }
    html:active-view-transition-type(kb-page)::view-transition-new(root),
    html:active-view-transition-type(kb-back)::view-transition-new(root) {
      animation: kb-dip-in 160ms ease-out 140ms both;
      -webkit-mask-image: none;
      mask-image: none;
    }
  }

  /* Language switch (theme-c.js replays the click inside a view transition of
     type kb-lang): the old text blurs out as the new fades in, nothing else moves */
  html:active-view-transition-type(kb-lang) [data-fx-vt] { view-transition-name: none; }
  html:active-view-transition-type(kb-lang)::view-transition { pointer-events: none; }
  html:active-view-transition-type(kb-lang)::view-transition-old(root) { animation: kb-lang-out 240ms linear both; }
  html:active-view-transition-type(kb-lang)::view-transition-new(root) { animation: kb-lang-in 240ms linear both; }
}
@keyframes kb-cut-rise { from { --kb-y: 100vh; } to { --kb-y: -58px; } }
@keyframes kb-cut-sink { from { --kb-y: -58px; } to { --kb-y: 100vh; } }
@keyframes kb-cut-dim { to { opacity: 0.35; translate: 0 -10px; } }
@keyframes kb-cut-lit { from { opacity: 0.35; translate: 0 -10px; } }
@keyframes kb-dip-out { to { opacity: 0; } }
@keyframes kb-dip-in { from { opacity: 0; } }
@keyframes kb-lang-out { to { opacity: 0; filter: blur(2px); } }
@keyframes kb-lang-in { from { opacity: 0; } }

/* ==========================================================================
   Press and small finish (caused by the visitor, so they stay under reduced motion)
   ========================================================================== */
.btn, .tab, .gallery-tab, .gallery-mode-tab, .nursery-arrow, .testimonial-carousel-btn, summary,
.lang-toggle button, .back-to-top, .whatsapp-float, .lightbox-close, .lightbox-prev, .lightbox-next {
  -webkit-tap-highlight-color: transparent;
}
.btn:active, .tab:active, .gallery-tab:active, .gallery-mode-tab:active, .nursery-arrow:active,
.testimonial-carousel-btn:active, .lang-toggle button:active, .back-to-top:active, .whatsapp-float:active,
.lightbox-close:active, .lightbox-prev:active, .lightbox-next:active {
  scale: 0.97;
  transition-property: scale;
  transition-duration: var(--t-press);
  transition-timing-function: ease-out;
}

::selection { background: var(--brass-light); color: #1b1f40; }
@media (hover: hover) and (pointer: fine) { html { scrollbar-color: var(--brass) var(--night); } }
input, textarea { caret-color: var(--brass-deep); accent-color: var(--brass-deep); }
.pill, .label-badge, .rs-pill, .transport-chip { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14); }

/* ==========================================================================
   Print: no decoration, every reveal in its finished state
   ========================================================================== */
@media print {
  canvas, .kb-deco, .kbfx-layer { display: none !important; }
  [data-kb-shutter], [data-kb-arch], [data-kb-seal], [data-kb-switch], [data-kb-lens], .kb-h, .kb-k, .kb-read, [data-reveal] {
    clip-path: none !important;
    opacity: 1 !important;
    translate: none !important;
    scale: none !important;
    filter: none !important;
    animation: none !important;
  }
  .kb-read { -webkit-text-fill-color: currentColor !important; background: none !important; }
  [data-kb-ink] [pathLength="1"] { stroke-dasharray: none !important; stroke-dashoffset: 0 !important; animation: none !important; }
  [data-kb-rule], [data-kb-rule]::before, [data-kb-rule]::after { scale: none !important; animation: none !important; }
  html { background: #fff; }
  [data-kb-lit], [data-kb-odo], .kb-glow { box-shadow: none !important; text-shadow: none !important; }
  /* rolled numbers print as their final value: the real number shows, its rolling copy does not */
  .kbfx-sr.kbfx-sr {
    position: static !important;
    width: auto !important;
    height: auto !important;
    margin: 0 !important;
    overflow: visible !important;
    clip: auto !important;
    clip-path: none !important;
  }
  .kbfx-sr + [aria-hidden="true"] { display: none !important; }
  @page { margin: 14mm; }
  thead { display: table-header-group; }
  tr, .card, figure { break-inside: avoid; }
}

/* Owner request (1 Dec): the star sky (stars, constellations, shooting stars) in the dark
   bands of every page. Decorative layers sit behind the content and never take clicks. */
.kb-sky-host { position: relative; isolation: isolate; }
.kb-sky-layer { position: absolute; inset: 0; z-index: 0; pointer-events: none; display: block; }
.kb-sky-host > .container { position: relative; z-index: 1; }

/* Owner request (1 Dec): Apple "liquid glass" look on top of the star sky, stronger version.
   Very see-through frosted panels, a bright light-catching rim, inner glow and a top shine. */
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .dusk-band .quick-info,
  .dusk-band .stat-card,
  .helpdesk-band .spotlight-card,
  .kb-sky-host .fact, .kb-sky-host .stat, .kb-sky-host .stat-card,
  .hero .badge {
    position: relative;
    isolation: isolate;
    background:
      radial-gradient(140% 90% at 0% 0%, rgba(255, 255, 255, 0.10), rgba(255, 255, 255, 0) 55%),
      linear-gradient(160deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.008) 60%, rgba(255, 255, 255, 0.03)) !important;
    -webkit-backdrop-filter: blur(7px) saturate(140%) brightness(1.04);
    backdrop-filter: blur(7px) saturate(140%) brightness(1.04);
    border: 1px solid rgba(255, 255, 255, 0.10) !important;
    box-shadow:
      inset 0 1.5px 0 rgba(255, 255, 255, 0.55),
      inset 1.5px 0 0 rgba(255, 255, 255, 0.18),
      inset 0 -1px 0 rgba(255, 255, 255, 0.10),
      inset 0 -18px 30px -18px rgba(255, 255, 255, 0.10),
      inset 0 18px 40px -22px rgba(255, 255, 255, 0.14),
      0 18px 50px rgba(4, 7, 22, 0.42),
      0 2px 6px rgba(4, 7, 22, 0.25);
  }
  .dusk-band .quick-info, .helpdesk-band .spotlight-card { border-radius: 30px; padding: clamp(22px, 2.6vw, 34px) !important; }
  .dusk-band .stat-card { border-radius: 26px; padding: 18px 24px !important; margin-bottom: 14px; }
  .kb-sky-host .fact, .kb-sky-host .stat { border-radius: 20px; padding: 14px 18px !important; }
  /* light-catching rim: brighter at the top left and bottom right, like the edge of real glass */
  .dusk-band .quick-info::before, .dusk-band .stat-card::before, .helpdesk-band .spotlight-card::before,
  .kb-sky-host .fact::before, .kb-sky-host .stat::before {
    content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1.4px; pointer-events: none; z-index: 2;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0.12) 30%, rgba(255, 255, 255, 0.04) 55%, rgba(255, 255, 255, 0.18) 80%, rgba(255, 255, 255, 0.6));
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor; mask-composite: exclude;
  }
  /* soft top shine and a faint lower glow inside the glass */
  .dusk-band .quick-info::after, .dusk-band .stat-card::after, .helpdesk-band .spotlight-card::after {
    content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 1;
    background:
      radial-gradient(90% 45% at 30% -8%, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0) 60%),
      radial-gradient(70% 40% at 85% 115%, rgba(160, 190, 255, 0.16), rgba(160, 190, 255, 0) 60%);
    mix-blend-mode: screen;
  }
}

/* Fix (3 Dec): phone glass number cards. Three cards in a row were too tight, so "1,800+"
   spilled out. Phones: smaller padding and number, a gap between cards. */
@media (max-width: 720px) {
  .dusk-band .stats-grid { gap: 10px !important; }
  .dusk-band .stat-card { padding: 14px 10px !important; border-radius: 20px; margin-bottom: 0; min-width: 0; }
  .dusk-band .stat-value { font-size: clamp(1.7rem, 8.4vw, 2.3rem) !important; white-space: nowrap; }
}
@media (max-width: 380px) {
  .dusk-band .stat-value { font-size: clamp(1.5rem, 7.8vw, 2rem) !important; }
}
