/* ============================================================
   Payline Kiosk — Tide design tokens (ported from shared.jsx)
   1080x1920 portrait. Vanilla CSS. Self-hosted fonts.
   ============================================================ */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('fonts/inter-latin-var.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter Tight';
  font-style: normal;
  font-display: swap;
  font-weight: 300 800;
  src: url('fonts/inter-tight-latin-var.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-display: swap;
  font-weight: 400 700;
  src: url('fonts/jetbrains-mono-latin-var.woff2') format('woff2');
}

:root {
  /* TOK from shared.jsx */
  --navy-900: #06132B;
  --navy-800: #0A1E3F;
  --navy-700: #0E2A55;
  --navy-600: #163A6E;
  --teal-700: #0E7C8B;
  --teal-500: #1FA3B8;
  --teal-300: #5BD0DE;
  --ivory:    #F6F2EA;
  --paper:    #FCFAF5;
  --ink:      #0A1322;
  --ink-soft: #3B4252;
  --ink-mute: #7A8294;
  --amber:    #FFB454;
  --ruby:     #E25A4F;
  --jade:     #27B27A;

  /* Canvas */
  --kiosk-w: 1080px;
  --kiosk-h: 1920px;

  /* a11y font-scale (kiosk-polish-p0): driven by the Aa+ chip. Default 1.0
     (100%); the engine sets this + a matching `zoom` on #stage to enlarge
     the whole fixed-pixel canvas proportionally (100→125→150%). */
  --font-scale: 1;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  overflow: hidden;
  background: var(--navy-900);
  color: #fff;
  font-family: 'Inter Tight', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
  letter-spacing: -0.01em;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

.mono { font-family: 'JetBrains Mono', monospace; }

/* Stage: 1080×1920 portrait canvas, fit-to-window scale.
   On 1080×1920 manufacturer hardware: scale = 1.
   On dev laptops: scaled with a CSS transform to fit viewport.   */
#stage {
  position: relative;
  width: 1080px;
  height: 1920px;
  background: var(--navy-800);
  overflow: hidden;
  transform-origin: top left;
}
/* Landscape hardware (GOLDFINGER fixed-landscape dual screens):
   wide 1920x1080 canvas. Screens branch on STATE.layout==='landscape'. */
body.landscape #stage {
  width: 1920px;
  height: 1080px;
}
.scaled #stage { /* applied by JS for dev viewport */ }

/* Tide noise + ambient overlays */
.ks-noise {
  background-image:
    radial-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    radial-gradient(rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 32px 32px, 17px 17px;
  background-position: 0 0, 9px 11px;
  position: absolute; inset: 0; pointer-events: none;
}

/* Animations from shared.jsx */
@keyframes ks-pulse-ring {
  0%   { transform: scale(.85); opacity: .9; }
  80%  { transform: scale(1.35); opacity: 0; }
  100% { transform: scale(1.35); opacity: 0; }
}
@keyframes ks-shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
@keyframes ks-tide {
  0%,100% { transform: translateX(0) translateY(0); }
  50%     { transform: translateX(-40px) translateY(-12px); }
}
@keyframes ks-tide-2 {
  0%,100% { transform: translateX(0) translateY(0); }
  50%     { transform: translateX(40px) translateY(-20px); }
}
@keyframes ks-tide-3 {
  0%,100% { transform: translateX(0) translateY(0); }
  50%     { transform: translateX(-20px) translateY(8px); }
}
@keyframes ks-fade-up {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes ks-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes ks-rotate-slow { to { transform: rotate(360deg); } }
/* gentle card hover/drift (Tide.Loaded card) — keeps the perspective tilt */
@keyframes ks-drift {
  0%, 100% { transform: perspective(1600px) rotateX(8deg) rotateY(-5deg) translateY(0); }
  50%      { transform: perspective(1600px) rotateX(6deg) rotateY(-3deg) translateY(-14px); }
}
/* living-logo breathing glow (attract/resting screen) */
@keyframes ks-breathe {
  0%, 100% { filter: drop-shadow(0 0 16px rgba(91,208,222,.40)); }
  50%      { filter: drop-shadow(0 0 42px rgba(91,208,222,.85)); }
}
/* top-display "look below" arrow for stacked dual-monitor cabinets */
@keyframes ks-bounce-down {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(10px); }
}
.ad-interstitial { opacity: 0; pointer-events: none; transition: opacity .8s ease; }
.ad-interstitial.show { opacity: 1; }
@keyframes ks-bill-drop {
  0%   { transform: translateY(-300px); opacity: 0; }
  30%  { opacity: 1; }
  100% { transform: translateY(0); opacity: 1; }
}
@keyframes ks-print-roll {
  0%   { transform: translateY(-100%); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}
@keyframes ks-counter-tick {
  0%   { transform: translateY(0.5em); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

/* ============================================================
   Screen transitions — directional, flow-depth aware (P1)
   ------------------------------------------------------------
   engine.js sets data-dir="fwd|back|none" on the incoming
   screen based on flow depth. Forward = slide in from the
   right (and the outgoing screen drifts left); back = the
   mirror. data-dir="none" (or reduced-motion) = plain fade.
   Curve is a soft ease-out for a "settled" kiosk feel.
   ------------------------------------------------------------ */
.scr {
  position: absolute; inset: 0;
  opacity: 0;
  pointer-events: none;
}
.scr.active {
  opacity: 1;
  pointer-events: auto;
}

/* Directional entrances. Distance is deliberately modest (kiosk =
   large viewport; a full-width slide reads as sluggish). */
@keyframes ks-slide-in-fwd  { from { opacity: 0; transform: translateX(8%);  } to { opacity: 1; transform: translateX(0); } }
@keyframes ks-slide-in-back { from { opacity: 0; transform: translateX(-8%); } to { opacity: 1; transform: translateX(0); } }
@keyframes ks-slide-out-fwd  { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(-6%); } }
@keyframes ks-slide-out-back { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(6%);  } }

.scr.active[data-dir="fwd"]  { animation: ks-slide-in-fwd  .42s cubic-bezier(.22,.61,.36,1) both; }
.scr.active[data-dir="back"] { animation: ks-slide-in-back .42s cubic-bezier(.22,.61,.36,1) both; }
.scr.active[data-dir="none"] { animation: ks-fade-in .4s ease-out both; }
/* The outgoing screen (kept briefly in the stack) slides the opposite way. */
.scr.leaving[data-dir="fwd"]  { animation: ks-slide-out-fwd  .34s ease-in both; }
.scr.leaving[data-dir="back"] { animation: ks-slide-out-back .34s ease-in both; }
.scr.leaving { z-index: 0; }
.scr.active  { z-index: 1; }

/* Common scaffolding */
.scr-light { background: var(--paper); color: var(--ink); }
.scr-dark  { background: var(--navy-800); color: #fff; }
.scr-deep  { background: var(--navy-900); color: #fff; }

.gutter { padding: 60px; }

.status-bar {
  position: absolute; top: 0; left: 0; right: 0; height: 84px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 48px; z-index: 5;
  font-size: 22px; font-weight: 500;
}
.status-bar.dark { color: #fff; }
.status-bar.dark .mute { color: rgba(255,255,255,.55); }
.status-bar.light { color: var(--ink); }
.status-bar.light .mute { color: var(--ink-mute); }

.poweredby {
  display: inline-flex; align-items: center; gap: 16px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 17px; letter-spacing: .22em; text-transform: uppercase;
  font-weight: 500;
  color: rgba(255,255,255,.55);
}
.poweredby.light { color: rgba(10,30,63,.5); }
.poweredby img.axes { height: 30px; width: auto; }
.poweredby img.gbank { height: 30px; width: 30px; border-radius: 6px; }
.poweredby .sep { width: 1px; height: 28px; background: rgba(255,255,255,.18); }
.poweredby.light .sep { background: rgba(10,30,63,.18); }

/* Big touch buttons: minimum 88px tall — kiosk hard rule */
.btn { min-height: 88px; border-radius: 24px; padding: 28px 40px;
       font-size: 30px; font-weight: 600; display: inline-flex;
       align-items: center; justify-content: center; gap: 16px;
       transition: transform .12s ease, opacity .12s ease; }
.btn:active { transform: scale(.98); opacity: .9; }
.btn-primary { background: #fff; color: var(--navy-800); box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.btn-secondary { background: rgba(255,255,255,.08); color: #fff; backdrop-filter: blur(20px); border: 1px solid rgba(255,255,255,.18); }
.btn-light-primary { background: var(--ink); color: #fff; }
.btn-light-secondary { background: rgba(10,30,63,.06); color: var(--ink); }
.btn-amber { background: var(--amber); color: var(--navy-800); font-weight: 700; }

/* Headlines */
h1.tide {
  font-family: 'Inter Tight', sans-serif;
  font-weight: 300;
  font-size: 96px;
  letter-spacing: -0.04em;
  line-height: 1.02;
  margin: 0;
}
h1.tide strong { font-weight: 600; }

.eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 22px;
  letter-spacing: .18em;
  text-transform: uppercase;
}

/* NFC pulse target */
.nfc-target {
  position: relative;
  width: 540px; height: 540px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto;
}
.nfc-ring {
  position: absolute; border-radius: 50%;
  border: 2px solid var(--teal-300);
  animation: ks-pulse-ring 2.6s ease-out infinite;
}
.nfc-core {
  width: 260px; height: 260px; border-radius: 50%;
  background: radial-gradient(circle, var(--teal-500), var(--teal-700));
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 80px rgba(31,163,184,.4),
              inset 0 0 40px rgba(255,255,255,.15);
}

/* Toast */
.toast {
  position: fixed; bottom: 60px; left: 50%; transform: translateX(-50%);
  background: rgba(10,19,34,.95); color: #fff;
  padding: 24px 36px; border-radius: 20px;
  font-size: 24px; z-index: 1000;
  border: 1px solid rgba(255,255,255,.1);
  box-shadow: 0 20px 50px rgba(0,0,0,.4);
  animation: ks-fade-up .3s ease-out;
  max-width: 80vw;
}
.toast.error { background: rgba(226,90,79,.95); }
.toast.success { background: rgba(39,178,122,.95); }

/* ============================================================
   Keypad press feedback (P1) — contact-entry keypad (.kk)
   Visual key-down (scale + brighten) plus a press-ripple that
   radiates from the touch point. Touch-friendly: feedback fires
   on :active and on a JS-injected .ks-ripple span. ----------- */
.kk { position: relative; overflow: hidden;
      transition: transform .08s ease, background-color .12s ease, box-shadow .12s ease; }
.kk:active {
  transform: scale(.94);
  background: rgba(255,255,255,.20) !important;
  box-shadow: inset 0 0 0 2px rgba(124,227,240,.5);
}
.kk.kk-down { transform: scale(.94); }
.ks-ripple {
  position: absolute; border-radius: 50%; pointer-events: none;
  background: rgba(255,255,255,.45); transform: scale(0);
  animation: ks-ripple .42s ease-out forwards;
}
@keyframes ks-ripple { to { transform: scale(2.4); opacity: 0; } }

/* ============================================================
   Skeleton / shimmer placeholders (P1)
   Shown while a quote is in flight (chooser) instead of a blank
   frame. The sweeping highlight is decorative — reduced-motion
   keeps a calm static block. -------------------------------- */
.ks-skel, .ks-skel-card {
  background: linear-gradient(100deg,
    rgba(255,255,255,.05) 30%,
    rgba(255,255,255,.13) 50%,
    rgba(255,255,255,.05) 70%);
  background-size: 200% 100%;
  animation: ks-shimmer 1.4s ease-in-out infinite;
}
.ks-skel-card { border: 1px solid rgba(255,255,255,.08); }

/* ============================================================
   :focus-visible — switch / keypad / external-keyboard nav
   (kiosk-polish-p0)
   Touch taps never show a ring (:focus-visible only fires for
   keyboard/AT focus), so this is free for touch customers but
   gives switch-access + keypad navigation a clear target. High
   contrast on both dark and light screens. Two-color outline so
   it reads on any background. ----------------------------------- */
:focus-visible {
  outline: 4px solid var(--teal-300);
  outline-offset: 3px;
  border-radius: 8px;
  box-shadow: 0 0 0 8px rgba(6, 19, 43, .55);
}
.scr-light :focus-visible {
  outline-color: var(--teal-700);
  box-shadow: 0 0 0 8px rgba(255, 255, 255, .75);
}
/* Buttons already carry their own radius — match the ring to it. */
.btn:focus-visible { border-radius: 24px; }
/* Never show the legacy non-:focus-visible outline on mouse/touch. */
:focus:not(:focus-visible) { outline: none; }

/* ============================================================
   prefers-reduced-motion (kiosk-polish-p0)
   Respect the OS / kiosk accessibility setting. We KILL the
   perpetual decorative loops (pulse rings, breathing logo, tide
   waves, drifting card, slow spinners, shimmer, look-below
   bounce, SVG animateMotion) and SHORTEN the one-shot entrance/
   feedback animations to a fast settle — we never remove the
   essential transaction feedback (progress bar fill, bill drop,
   receipt roll, counter tick, screen fade), we just make it
   near-instant instead of motion-heavy. ---------------------- */
@media (prefers-reduced-motion: reduce) {
  /* Kill the perpetual decorative loops outright. */
  .nfc-ring,
  [style*="ks-pulse-ring"],
  [style*="ks-tide"],
  [style*="ks-tide-2"],
  [style*="ks-tide-3"],
  [style*="ks-drift"],
  [style*="ks-breathe"],
  [style*="ks-bounce-down"],
  [style*="ks-rotate-slow"],
  [style*="ks-shimmer"],
  .ks-skel,
  .ks-skel-card {
    animation: none !important;
  }
  /* Static, readable skeleton fill under reduced-motion. */
  .ks-skel, .ks-skel-card { background: rgba(255,255,255,.08) !important; }
  /* Keypad: keep the instant key-down (it's functional feedback, not
     decorative), but drop the radiating ripple animation. */
  .ks-ripple { animation: none !important; display: none !important; }
  .kk { transition-duration: .01ms !important; }
  /* Freeze the breathing-logo at its calm baseline glow. */
  [style*="ks-breathe"] { filter: drop-shadow(0 0 16px rgba(91, 208, 222, .40)) !important; }
  /* Hold the drifting card flat (keep its perspective, drop the float). */
  [style*="ks-drift"] { transform: perspective(1600px) rotateX(8deg) rotateY(-5deg) !important; }
  /* SVG path motion (animateMotion / animateTransform) — pause at start. */
  animateMotion, animateTransform, animate { animation: none !important; }

  /* Curb — don't delete — the one-shot entrance + feedback animations:
     drop them to a fast settle so the UI still confirms state changes
     without sweeping motion. */
  .scr.active,
  .scr.active[data-dir="fwd"],
  .scr.active[data-dir="back"],
  .scr.active[data-dir="none"],
  .scr.leaving[data-dir="fwd"],
  .scr.leaving[data-dir="back"],
  [style*="ks-fade-in"],
  [style*="ks-fade-up"],
  [style*="ks-counter-tick"],
  [style*="ks-bill-drop"],
  [style*="ks-print-roll"] {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  /* No horizontal sliding under reduced-motion — settle in place. */
  .scr.active[data-dir="fwd"],
  .scr.active[data-dir="back"],
  .scr.leaving[data-dir="fwd"],
  .scr.leaving[data-dir="back"] {
    animation-name: ks-fade-in !important;
    transform: none !important;
  }
  /* Universal backstop for any inline transition we didn't enumerate. */
  *, *::before, *::after {
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}
