/* KINSafe — Liquid Glass system.
   Values previously driven by the dev tweaks panel are baked in here
   as final design constants for production. */

:root {
  /* color */
  --ss-bg: #f4f6fa;
  --ss-bg-deep: #e8ecf4;
  --ss-fg: #0a1628;
  --ss-muted: #5a6577;
  --ss-navy: #0a1628;
  --ss-yellow: #fbcf2c;
  --ss-orange: #fb923c;
  --ss-glass: 220, 230, 245;

  /* glass */
  --ss-radius: 32px;
  --ss-blur: 17px;
  --ss-glass-op: 0.25;
  --ss-border-op: 0.68;
  --ss-shadow-strength: 2;

  /* motion */
  --ss-anim: 1450ms;
  --ss-float: 30px;
  --ss-pulse: 960ms;
  --ss-lift: 12px;

  /* typography */
  --ss-font: "Manrope", ui-sans-serif, system-ui, sans-serif;
  --ss-display-weight: 700;
  --ss-body-size: 16px;
  --ss-tracking: -0.01em;

  /* layout (airy density) */
  --ss-pad-x: 48px;
  --ss-pad-y: 140px;
  --ss-max-w: 1280px;
}

html { scroll-behavior: smooth; }
html, body { background: var(--ss-bg); }

body {
  font-family: var(--ss-font);
  font-size: var(--ss-body-size);
  background:
    radial-gradient(1200px 800px at 80% -10%, color-mix(in oklab, var(--ss-yellow) 10%, transparent), transparent 60%),
    radial-gradient(1000px 700px at -10% 30%, color-mix(in oklab, var(--ss-orange) 8%, transparent), transparent 60%),
    radial-gradient(900px 800px at 50% 110%, rgba(20, 35, 55, 0.06), transparent 60%),
    var(--ss-bg);
  background-attachment: fixed;
}

/* ============= GLASS ============= */
.glass {
  background: linear-gradient(135deg,
    rgba(var(--ss-glass), var(--ss-glass-op)),
    rgba(var(--ss-glass), calc(var(--ss-glass-op) * 0.45)));
  backdrop-filter: blur(var(--ss-blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--ss-blur)) saturate(180%);
  border: 1px solid rgba(255,255,255, var(--ss-border-op));
  box-shadow:
    inset 0 1px 0 rgba(255,255,255, calc(0.7 * var(--ss-border-op))),
    inset 0 -1px 0 rgba(255,255,255, calc(0.15 * var(--ss-border-op))),
    0 calc(30px * var(--ss-shadow-strength)) calc(80px * var(--ss-shadow-strength)) calc(-20px * var(--ss-shadow-strength)) rgba(10, 22, 40, calc(0.18 * var(--ss-shadow-strength))),
    0 calc(8px * var(--ss-shadow-strength)) calc(24px * var(--ss-shadow-strength)) calc(-8px * var(--ss-shadow-strength)) rgba(10, 22, 40, calc(0.12 * var(--ss-shadow-strength)));
  border-radius: var(--ss-radius);
}

.glass-dark {
  background: linear-gradient(135deg, rgba(20,35,55,0.78), rgba(10,22,40,0.62));
  backdrop-filter: blur(var(--ss-blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--ss-blur)) saturate(160%);
  border: 1px solid rgba(255,255,255, calc(0.10 * var(--ss-border-op) * 1.6));
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.08),
    0 calc(30px * var(--ss-shadow-strength)) calc(80px * var(--ss-shadow-strength)) calc(-20px * var(--ss-shadow-strength)) rgba(10, 22, 40, calc(0.30 * var(--ss-shadow-strength)));
  border-radius: var(--ss-radius);
  color: #f1f5fb;
}

.glass-thin {
  background: rgba(var(--ss-glass), calc(var(--ss-glass-op) * 0.55));
  backdrop-filter: blur(calc(var(--ss-blur) * 0.5)) saturate(160%);
  -webkit-backdrop-filter: blur(calc(var(--ss-blur) * 0.5)) saturate(160%);
  border: 1px solid rgba(255,255,255, var(--ss-border-op));
  border-radius: calc(var(--ss-radius) * 0.7);
}

.glass::before, .glass-dark::before {
  content: "";
  position: absolute; inset: 0; border-radius: inherit;
  background:
    radial-gradient(120% 80% at 0% 0%, rgba(255,255,255, calc(0.6 * var(--ss-border-op))), transparent 40%),
    radial-gradient(120% 80% at 100% 100%, color-mix(in oklab, var(--ss-yellow) 12%, transparent), transparent 50%);
  pointer-events: none; mix-blend-mode: screen; opacity: 0.7;
}
.glass-dark::before {
  background:
    radial-gradient(120% 80% at 0% 0%, rgba(255,255,255,0.18), transparent 40%),
    radial-gradient(120% 80% at 100% 100%, color-mix(in oklab, var(--ss-yellow) 18%, transparent), transparent 55%);
}

/* ============= BUTTONS ============= */
.btn {
  display: inline-flex; align-items: center; white-space: nowrap; gap: 0.5rem;
  padding: 0.85rem 1.4rem; border-radius: 999px;
  font-weight: 600; font-size: 0.95rem; letter-spacing: -0.01em;
  transition: transform 200ms ease, box-shadow 300ms ease, background 200ms ease;
  cursor: default; position: relative; isolation: isolate;
  max-width: 100%;
}
@media (max-width: 480px) {
  .btn {
    padding: 0.75rem 1.1rem;
    font-size: 0.85rem;
    gap: 0.4rem;
  }
}
.btn-primary {
  background: var(--ss-navy); color: #fff;
  box-shadow: 0 10px 30px -10px rgba(10, 22, 40, 0.5);
}
.btn-primary:hover {
  transform: translateY(calc(var(--ss-lift) * -0.5));
  box-shadow: 0 18px 40px -10px rgba(10, 22, 40, 0.55), 0 0 0 6px rgba(10, 22, 40, 0.06);
}
.btn-glass {
  background: rgba(255,255,255,0.6);
  border: 1px solid rgba(255,255,255,0.8);
  color: var(--ss-navy);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
}
.btn-glass:hover {
  transform: translateY(calc(var(--ss-lift) * -0.5));
  background: rgba(255,255,255,0.85);
}
.btn-yellow {
  background: var(--ss-yellow); color: var(--ss-navy);
  box-shadow: 0 12px 30px -8px color-mix(in oklab, var(--ss-yellow) 60%, transparent);
}
.btn-yellow:hover {
  transform: translateY(calc(var(--ss-lift) * -0.5));
  box-shadow: 0 18px 40px -8px color-mix(in oklab, var(--ss-yellow) 70%, transparent);
}

/* ============= UTIL ============= */
.section-pad { padding: var(--ss-pad-y) var(--ss-pad-x); }
@media (max-width: 640px) {
  /* Tighter horizontal padding on phones — 48px each side eats too much
     of the viewport, causing dashboard cards and pills to overflow or
     look cramped. 16px keeps content readable to the edges. */
  .section-pad { padding-left: 16px; padding-right: 16px; }
}

/* Footer: defeat .section-pad's 140px vertical padding entirely.
   On phones the giant top/bottom whitespace was leaving a half-screen
   blank below the © line on iPhone 17 Pro Max etc. We use !important
   here because the Tailwind `!py-6` utility from the JSX wasn't
   reliably winning over the .section-pad shorthand. Also pad with
   safe-area-inset on the bottom so the footer sits flush above the
   home indicator without hiding behind it. */
footer.section-pad {
  padding-top: 16px !important;
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 12px) !important;
}
@media (min-width: 640px) {
  footer.section-pad {
    padding-top: 40px !important;
    padding-bottom: max(env(safe-area-inset-bottom, 0px), 28px) !important;
  }
}

/* Make the body fill at least the viewport so we don't get phantom blank
   space below short content on iOS Safari (rubber-band scroll exposes
   the page-bg, which can read as "empty space below footer"). Long pages
   are unaffected — flex-1 main only pushes footer down when content is
   shorter than the viewport. */
html, body { min-height: 100%; }
body { display: flex; flex-direction: column; min-height: 100dvh; }
#root { display: flex; flex-direction: column; flex: 1 0 auto; }
#root > main { flex: 1 0 auto; }
#root > footer { flex-shrink: 0; }

.eyebrow {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--ss-muted);
}

h1, h2, h3 { letter-spacing: var(--ss-tracking); }

.h-display {
  font-size: clamp(2.5rem, 6.5vw, 5.5rem);
  line-height: 1.02; font-weight: var(--ss-display-weight);
  letter-spacing: calc(var(--ss-tracking) * 1.15);
}
.h-section {
  font-size: clamp(2rem, 4.5vw, 3.6rem);
  line-height: 1.05; font-weight: var(--ss-display-weight);
  letter-spacing: var(--ss-tracking);
}

/* max-w override using var */
.max-w-7xl { max-width: var(--ss-max-w) !important; }

/* ============= ANIMS ============= */
@keyframes ss-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(calc(var(--ss-float) * -1)); }
}
.anim-float { animation: ss-float 6s ease-in-out infinite; }

@keyframes ss-pulse-ring {
  0% { transform: scale(1); opacity: 0.7; }
  100% { transform: scale(2.2); opacity: 0; }
}
.pulse-ring { animation: ss-pulse-ring var(--ss-pulse) ease-out infinite; }

@keyframes ss-shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.shimmer {
  background: linear-gradient(110deg,
    transparent 30%, rgba(255,255,255,0.5) 50%, transparent 70%);
  background-size: 200% 100%;
  animation: ss-shimmer 2.5s ease-in-out infinite;
}

@keyframes ss-rise {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}
.reveal { opacity: 0; }
.reveal.in {
  animation: ss-rise var(--ss-anim) cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

/* ============= HAZARD MARKER (red — final design) ============= */
.hazard-dot {
  position: absolute;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 0 4px rgba(239,68,68,0.25), 0 0 20px rgba(239,68,68,0.6);
  cursor: default;
  transition: transform 250ms ease, box-shadow 250ms ease;
  z-index: 5;
}
.hazard-dot::after {
  content: ""; position: absolute; inset: -2px;
  border-radius: 50%;
  border: 2px solid rgba(239,68,68,0.6);
  animation: ss-pulse-ring var(--ss-pulse) ease-out infinite;
}
.hazard-dot:hover, .hazard-dot.active {
  transform: scale(1.25);
  box-shadow: 0 0 0 6px rgba(239,68,68,0.35), 0 0 30px rgba(239,68,68,0.8);
}

/* AR scene — dusk tone (final design) */
.ss-scene-sky    { background: linear-gradient(180deg, #f6a67a, #6b4a8b) !important; }
.ss-scene-ground { background: linear-gradient(180deg, #4a3a5a, #1f1830) !important; }

/* hover lift */
.ss-hover-lift:hover { transform: translateY(calc(var(--ss-lift) * -1)); }

/* mobile tap targets */
@media (max-width: 640px) {
  .hazard-dot { width: 28px; height: 28px; }
}

/* Hero phone hazard tooltip — tighter padding/radius on mobile so the
   card doesn't dominate the AR scene preview. */
.hero-hazard-card {
  padding: 8px 10px;
  border-radius: 12px;
}
@media (min-width: 640px) {
  .hero-hazard-card { padding: 10px 12px; border-radius: 14px; }
}

/* Even smaller hazard dots on tight phones (iPhone 14 Pro and below)
   so they don't dominate the AR scene. */
@media (max-width: 480px) {
  .hazard-dot { width: 22px; height: 22px; }
}

/* ============= FOCUS RING (a11y) =============
   Make keyboard navigation visible without affecting mouse users. */
:where(a, button, [role="button"], [tabindex]):focus-visible {
  outline: 2px solid var(--ss-navy);
  outline-offset: 3px;
  border-radius: inherit;
}
.btn-yellow:focus-visible,
.btn-primary:focus-visible {
  outline-color: var(--ss-yellow);
}

/* ───────────────────────────────────────────────────────────────
   Scroll Showcase — sticky frame
   The outer <section id="scroll"> provides the scroll-track height
   (e.g. 320vh). This inner frame sticks to the viewport for the
   duration of that track so the right-hand preview stays in place
   while the left-hand step list advances 1→5.
   ─────────────────────────────────────────────────────────────── */
.scroll-frame {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  align-items: center;
  overflow: hidden;
}
@media (max-width: 768px) {
  /* On mobile, sticky scroll feels cramped — let it breathe at viewport height
     but with a touch of vertical padding so content isn't flush against the nav. */
  .scroll-frame { padding-top: 12px; padding-bottom: 12px; }
}
