/* ==========================================================================
   Engineering Kit — web portal
   Light theme design tokens + the handful of styles Tailwind utilities
   cannot express inline (keyframes, scroll-snap deck, reduced motion).
   ========================================================================== */

:root {
  --ek-canvas: #f8fafc;
  --ek-card: #ffffff;
  --ek-line: #e2e8f0;
  --ek-ink: #0f172a;
  --ek-ink-soft: #475569;
  --ek-ink-muted: #64748b;
  --ek-blue: #2563eb;
  --ek-blue-dark: #1d4ed8;
  --ek-blue-wash: #eff6ff;
  /* Material Blue 50/100 — the panel fill and edge the Android apps use. */
  --ek-blue-50: #e3f2fd;
  --ek-blue-100: #bbdefb;
  --ek-orange: #ea580c;
  --ek-orange-wash: #fff7ed;
  --ek-radius: 12px;
  --ek-nav-h: 64px;
}

/* Critical base: keeps the first paint on-theme before Tailwind resolves. */
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--ek-nav-h) + 16px);
}

body {
  margin: 0;
  background-color: var(--ek-canvas);
  color: var(--ek-ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

svg {
  display: block;
}

/* --------------------------------------------------------------------------
   Icons
   -------------------------------------------------------------------------- */

.ek-icon {
  width: 1.25rem;
  height: 1.25rem;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ek-icon--solid {
  fill: currentColor;
  stroke: none;
}

img.ek-logo {
  display: block;
  width: auto;
  height: 1.5rem;
  max-height: 1.5rem;
  flex: none;
}

/* --------------------------------------------------------------------------
   Swipeable app deck
   Horizontal scroll-snap so touch swiping feels native on mobile while
   desktop keeps arrow-button paging.
   -------------------------------------------------------------------------- */

.ek-deck {
  display: flex;
  gap: 1.25rem;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: 1rem;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.5rem;
}

.ek-deck > * {
  scroll-snap-align: center;
  flex: 0 0 min(88vw, 34rem);
}

@media (min-width: 1024px) {
  .ek-deck > * {
    flex-basis: 32rem;
  }
}

.ek-deck::-webkit-scrollbar {
  height: 8px;
}

.ek-deck::-webkit-scrollbar-track {
  background: transparent;
}

.ek-deck::-webkit-scrollbar-thumb {
  background: var(--ek-line);
  border-radius: 999px;
}

.ek-deck.is-dragging {
  cursor: grabbing;
  scroll-snap-type: none;
}

.ek-deck.is-dragging * {
  pointer-events: none;
}

/* Dot pagination */
.ek-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #cbd5e1;
  transition: width 0.2s ease, background-color 0.2s ease;
}

.ek-dot[aria-current="true"] {
  width: 28px;
  background: var(--ek-orange);
}

/* --------------------------------------------------------------------------
   Blueprint media frame — every showcase / preview slot is 16:9
   -------------------------------------------------------------------------- */

.ek-media {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--ek-radius);
  overflow: hidden;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid var(--ek-line);
}

.ek-media > svg,
.ek-media > canvas {
  width: 100%;
  height: 100%;
}

/* --------------------------------------------------------------------------
   Range inputs — 48px touch targets, brand-coloured thumbs
   -------------------------------------------------------------------------- */

.ek-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 48px;
  background: transparent;
  cursor: pointer;
}

.ek-range:focus-visible {
  outline: none;
}

.ek-range::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: var(--ek-line);
}

.ek-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 26px;
  height: 26px;
  margin-top: -10px;
  border-radius: 999px;
  background: var(--ek-blue);
  border: 3px solid #ffffff;
  box-shadow: 0 1px 4px rgb(15 23 42 / 0.28);
}

.ek-range:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 4px rgb(37 99 235 / 0.25);
}

.ek-range::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: var(--ek-line);
}

.ek-range::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: var(--ek-blue);
  border: 3px solid #ffffff;
  box-shadow: 0 1px 4px rgb(15 23 42 / 0.28);
}

.ek-range:focus-visible::-moz-range-thumb {
  box-shadow: 0 0 0 4px rgb(37 99 235 / 0.25);
}

/* Segmented toggles / selects inside demos */
.ek-seg {
  min-height: 48px;
}

.ek-seg[aria-pressed="true"],
.ek-seg[aria-checked="true"] {
  background: var(--ek-orange-wash);
  border-color: var(--ek-orange);
  color: #9a3412;
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   Demo lock banner — high contrast overlay, never shows a computed number
   -------------------------------------------------------------------------- */

.ek-lock {
  background: var(--ek-blue-50);
  color: var(--ek-ink);
  border: 1px solid var(--ek-blue-100);
  border-radius: var(--ek-radius);
  box-shadow: 0 1px 3px rgb(15 23 42 / 0.08);
  transition: box-shadow 0.25s ease;
}

/* Fires on every input change so each edit gets an "input accepted" cue. */
.ek-lock--flash {
  box-shadow: 0 0 0 3px var(--ek-orange);
}

.ek-lock__pulse {
  animation: ek-pulse 2.4s ease-in-out infinite;
}

@keyframes ek-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

/* --------------------------------------------------------------------------
   Misc
   -------------------------------------------------------------------------- */

:where(a, button, input, select):focus-visible {
  outline: 2px solid var(--ek-blue);
  outline-offset: 2px;
  border-radius: 6px;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .ek-lock__pulse {
    animation: none;
  }
}
