/*
 * Koydo Flashcards — Atelier App Shell
 * Tokens: D:\koydo-design\tokens\ (category-11 light variant + shared)
 * Theme: warm pastel light (Fraunces display + Inter body)
 * Breakpoint: ≤720px → bottom nav, >720px → left rail
 */

/* ── 1. DESIGN TOKENS (CSS custom properties) ─────────────────────────────── */
:root {
  /* --- Colour: surface --- */
  --surface-canvas:   #FDFAF6;   /* warm off-white — atelier paper */
  --surface-elevated: #FFFFFF;
  --surface-subtle:   #F5F0EA;   /* warm tinted hover/bg */
  --surface-deep:     #EDE8E0;   /* section dividers */

  /* --- Colour: ink --- */
  --ink-primary:   #1C1410;   /* near-black warm */
  --ink-secondary: #5C4F44;   /* warm slate-600 analogue */
  --ink-tertiary:  #9C8F84;   /* placeholder / disabled */

  /* --- Colour: brand (warm pastel atelier) --- */
  --brand-primary:      #C084FC;   /* violet-400 — gradient anchor */
  --brand-primary-dark: #A855F7;   /* violet-500 — hover */
  --brand-primary-text: #FFFFFF;
  --brand-gradient:     linear-gradient(135deg, #C084FC 0%, #F9A8D4 55%, #FCD34D 100%);
  --brand-gradient-pill: linear-gradient(90deg, #C084FC, #F9A8D4);

  /* --- Colour: accent --- */
  --accent-amber:   #F59E0B;
  --accent-rose:    #F43F5E;
  --accent-emerald: #10B981;
  --accent-cyan:    #06B6D4;

  /* --- Colour: feedback --- */
  --feedback-success: #059669;
  --feedback-warn:    #D97706;
  --feedback-error:   #B45309;  /* warm amber per Koydo DNA, never red walls */

  /* --- Colour: border --- */
  --border-subtle:  rgba(28, 20, 16, 0.08);
  --border-default: rgba(28, 20, 16, 0.14);
  --border-strong:  rgba(28, 20, 16, 0.30);

  /* --- Colour: nav --- */
  --nav-bg:           #FFFEFB;
  --nav-border:       rgba(28, 20, 16, 0.07);
  --nav-item-active-bg:   rgba(192, 132, 252, 0.12);
  --nav-item-active-ink:  #7C3AED;
  --nav-item-hover-bg:    rgba(28, 20, 16, 0.04);
  --nav-item-ink:         #5C4F44;

  /* --- Colour: topbar --- */
  --topbar-bg:     rgba(253, 250, 246, 0.88);
  --topbar-border: rgba(28, 20, 16, 0.07);

  /* --- Focus ring --- */
  --focus-ring: 0 0 0 3px rgba(168, 85, 247, 0.40);

  /* --- Typography --- */
  --font-display: 'Fraunces', ui-serif, Georgia, serif;
  --font-body:    'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* --- Type scale (px, converted to rem where consumed) --- */
  --fs-display-xl: 3.5rem;    /* 56px */
  --fs-display-lg: 2.75rem;   /* 44px */
  --fs-display-md: 2.25rem;   /* 36px */
  --fs-display-sm: 1.75rem;   /* 28px */
  --fs-heading-lg: 1.5rem;    /* 24px */
  --fs-heading-md: 1.25rem;   /* 20px */
  --fs-heading-sm: 1.125rem;  /* 18px */
  --fs-body-lg:    1.0625rem; /* 17px */
  --fs-body-md:    0.9375rem; /* 15px */
  --fs-body-sm:    0.8125rem; /* 13px */
  --fs-label-lg:   0.9375rem;
  --fs-label-md:   0.8125rem;
  --fs-label-sm:   0.6875rem; /* 11px, uppercase tracked */

  /* --- Letter-spacing --- */
  --ls-display: -0.02em;
  --ls-heading: -0.01em;
  --ls-label-sm: 0.05em;

  /* --- Spacing scale (8pt base) --- */
  --sp-1:  4px;
  --sp-2:  8px;
  --sp-3:  12px;
  --sp-4:  16px;
  --sp-5:  20px;
  --sp-6:  24px;
  --sp-8:  32px;
  --sp-10: 40px;
  --sp-12: 48px;
  --sp-16: 64px;

  /* --- Radii --- */
  --r-sm:   4px;
  --r-md:   8px;
  --r-lg:   12px;
  --r-xl:   16px;
  --r-2xl:  24px;
  --r-3xl:  32px;
  --r-full: 9999px;

  /* --- Shadows --- */
  --shadow-sm:  0 1px 3px rgba(28, 20, 16, 0.08), 0 1px 2px rgba(28, 20, 16, 0.05);
  --shadow-md:  0 4px 12px rgba(28, 20, 16, 0.10), 0 2px 4px rgba(28, 20, 16, 0.06);
  --shadow-lg:  0 12px 32px rgba(28, 20, 16, 0.12), 0 4px 8px rgba(28, 20, 16, 0.06);
  --shadow-nav: 0 0 0 1px var(--nav-border), 0 4px 16px rgba(28, 20, 16, 0.06);

  /* --- Motion (canonical durations from motion.json) --- */
  --dur-instant:  0ms;
  --dur-fast:     120ms;
  --dur-medium:   240ms;
  --dur-slow:     400ms;
  --ease-standard: cubic-bezier(0.2, 0, 0, 1);
  --ease-out:      cubic-bezier(0, 0, 0.2, 1);
  --ease-in:       cubic-bezier(0.4, 0, 1, 1);

  /* --- Layout --- */
  --nav-rail-width:        220px;
  --nav-rail-width-sm:     72px;   /* icon-only collapsed state (future) */
  --topbar-height:         52px;
  --bottom-nav-height:     64px;
  --tap-target-min:        44px;
}

/* ── 2. RESET + BASE ───────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  height: 100%;
  max-height: 100%;
  overflow: hidden;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  height: 100%;
  max-height: 100%;
  overflow: hidden;
  font-family: var(--font-body);
  font-size: var(--fs-body-md);
  line-height: 1.5;
  color: var(--ink-primary);
  background-color: var(--surface-canvas);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Reduced-motion: collapse all transitions/animations */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: var(--dur-instant) !important;
    animation-duration:  var(--dur-instant) !important;
  }
}

/* Global focus ring — visible keyboard focus, invisible on pointer */
:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

:focus:not(:focus-visible) {
  outline: none;
}

/* Screen-reader only utility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: none;
  cursor: pointer;
}

ul, ol {
  list-style: none;
}

/* ── 3. APP SHELL LAYOUT ───────────────────────────────────────────────────── */

/* Full-bleed app root */
.app-shell {
  display: grid;
  grid-template-rows: var(--topbar-height) minmax(0, 1fr);
  grid-template-columns: 1fr;
  grid-template-areas:
    "topbar"
    "body";
  width: 100vw;
  height: 100dvh;
  max-height: 100vh; /* fallback for environments without dvh */
  min-height: 0;
  overflow: hidden;

  /* Warm ambient gradient canvas — subordinate, not distracting */
  background:
    radial-gradient(ellipse at 0% 0%,   rgba(192, 132, 252, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 100% 100%, rgba(249, 168, 212, 0.07) 0%, transparent 50%),
    radial-gradient(ellipse at 60%  0%,  rgba(252, 211, 77, 0.05)  0%, transparent 40%),
    var(--surface-canvas);
}

/* Desktop: body-row spans both columns internally via flex */
@media (min-width: 721px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: var(--topbar-height) 1fr;
    grid-template-areas:
      "topbar"
      "body";
  }
}

/* ── 4. TOP BAR ────────────────────────────────────────────────────────────── */

.topbar {
  grid-area: topbar;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 0 var(--sp-4);
  height: var(--topbar-height);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--topbar-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 40;
  /* Tight, not bulky — no extra height */
}

/* Hamburger — mobile only */
.topbar__menu-btn {
  display: none;
  flex-shrink: 0;
}

@media (max-width: 720px) {
  .topbar__menu-btn { display: flex; }
}

.topbar__title-group {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex-shrink: 0;
  /* Allow truncation on very narrow viewports */
  max-width: 40vw;
}

@media (min-width: 721px) {
  .topbar__title-group {
    max-width: none;
  }
}

.topbar__eyebrow {
  font-size: var(--fs-label-sm);
  font-weight: 600;
  letter-spacing: var(--ls-label-sm);
  text-transform: uppercase;
  color: var(--ink-tertiary);
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar__title {
  font-family: var(--font-display);
  font-size: var(--fs-heading-sm);
  font-weight: 600;
  letter-spacing: var(--ls-heading);
  color: var(--ink-primary);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Search grows to fill available space */
.topbar__search-wrap {
  flex: 1 1 0;
  min-width: 0;
  max-width: 360px;
  margin: 0 var(--sp-2);
}

/* Hide search label text on very small viewports */
@media (max-width: 480px) {
  .topbar__search-wrap {
    max-width: 120px;
  }
}

.search-field {
  position: relative;
  display: flex;
  align-items: center;
}

.search-field__icon {
  position: absolute;
  left: var(--sp-3);
  color: var(--ink-tertiary);
  pointer-events: none;
  flex-shrink: 0;
}

.search-field__input {
  width: 100%;
  height: 36px;
  padding: 0 var(--sp-3) 0 calc(var(--sp-3) + 16px + var(--sp-2));
  background: var(--surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-full);
  font-size: var(--fs-body-sm);
  color: var(--ink-primary);
  transition: border-color var(--dur-fast) var(--ease-standard),
              box-shadow   var(--dur-fast) var(--ease-standard);
}

.search-field__input::placeholder {
  color: var(--ink-tertiary);
}

.search-field__input:focus-visible {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: var(--focus-ring);
  background: var(--surface-elevated);
}

/* Clear button (browser native) */
.search-field__input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}

/* Chips cluster */
.topbar__chips {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-shrink: 0;
  margin-left: auto;
}

@media (max-width: 480px) {
  /* On tiny screens hide the text labels in chips but keep icons */
  .topbar__chips .chip__label {
    display: none;
  }
}

/* ── 5. CHIP COMPONENT ─────────────────────────────────────────────────────── */

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  height: 28px;
  padding: 0 var(--sp-3);
  border-radius: var(--r-full);
  font-size: var(--fs-label-md);
  font-weight: 500;
  white-space: nowrap;
  user-select: none;
  transition: transform var(--dur-fast) var(--ease-standard);
}

.chip--streak {
  background: linear-gradient(90deg, rgba(251,146,60,0.15), rgba(251,146,60,0.08));
  color: #C2410C;
  border: 1px solid rgba(251, 146, 60, 0.25);
}

.chip--progress {
  background: var(--brand-gradient-pill);
  color: var(--brand-primary-text);
  border: none;
  box-shadow: 0 2px 8px rgba(168, 85, 247, 0.25);
}

/* ── 6. ICON BUTTON ────────────────────────────────────────────────────────── */

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--tap-target-min);
  height: var(--tap-target-min);
  border-radius: var(--r-lg);
  color: var(--ink-secondary);
  transition: background var(--dur-fast) var(--ease-standard),
              color      var(--dur-fast) var(--ease-standard),
              transform  var(--dur-fast) var(--ease-standard);
}

.icon-btn:hover {
  background: var(--nav-item-hover-bg);
  color: var(--ink-primary);
}

.icon-btn:active {
  transform: scale(0.95);
}

.icon-btn:focus-visible {
  box-shadow: var(--focus-ring);
}

/* ── 7. BODY ROW ───────────────────────────────────────────────────────────── */

.body-row {
  grid-area: body;
  display: flex;
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
}

/* ── 8. LEFT NAV RAIL ──────────────────────────────────────────────────────── */

.nav-rail {
  display: none; /* hidden mobile-first */
  flex-direction: column;
  width: var(--nav-rail-width);
  flex-shrink: 0;
  background: var(--nav-bg);
  border-right: 1px solid var(--nav-border);
  padding: var(--sp-4) var(--sp-3);
  overflow-y: auto;
  overflow-x: hidden;
  /* Subtle left shadow separating rail from content */
  box-shadow: var(--shadow-nav);
  z-index: 30;
  transition: transform var(--dur-medium) var(--ease-out);
}

/* Desktop: show as persistent rail */
@media (min-width: 721px) {
  .nav-rail {
    display: flex;
    position: static;
    transform: none !important;
  }
}

/* Mobile: slide-in drawer */
@media (max-width: 720px) {
  .nav-rail {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 260px;
    z-index: 60;
    transform: translateX(-100%);
    padding-top: max(var(--sp-8), env(safe-area-inset-top));
  }

  .nav-rail.is-open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
}

.nav-rail__brand {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--sp-6);
  padding: 0 var(--sp-2);
}

.brand-mark {
  font-family: var(--font-display);
  font-size: var(--fs-display-sm);
  font-weight: 700;
  letter-spacing: var(--ls-display);
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1;
  user-select: none;
}

.nav-rail__list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.nav-rail__list--bottom {
  margin-top: auto;
  padding-top: var(--sp-4);
  border-top: 1px solid var(--border-subtle);
}

.nav-rail__spacer {
  flex: 1 1 0;
  min-height: var(--sp-4);
}

/* ── 9. NAV ITEM (rail + bottom) ───────────────────────────────────────────── */

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-height: var(--tap-target-min);
  padding: 0 var(--sp-3);
  border-radius: var(--r-xl);
  color: var(--nav-item-ink);
  font-size: var(--fs-label-lg);
  font-weight: 500;
  transition:
    background var(--dur-fast) var(--ease-standard),
    color      var(--dur-fast) var(--ease-standard),
    transform  var(--dur-fast) var(--ease-standard);
  cursor: pointer;
  user-select: none;
}

.nav-item:hover {
  background: var(--nav-item-hover-bg);
  color: var(--ink-primary);
}

.nav-item:active {
  transform: scale(0.97);
}

.nav-item:focus-visible {
  box-shadow: var(--focus-ring);
  outline: none;
}

/* Active state */
.nav-item[aria-current="page"],
.nav-item.is-active {
  background: var(--nav-item-active-bg);
  color: var(--nav-item-active-ink);
  font-weight: 600;
}

.nav-item[aria-current="page"] .nav-item__icon,
.nav-item.is-active .nav-item__icon {
  color: var(--nav-item-active-ink);
}

/* Active pill accent — left edge */
.nav-item[aria-current="page"]::before,
.nav-item.is-active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  border-radius: var(--r-full);
  background: var(--brand-gradient-pill);
}

/* Make nav-rail a stacking context so ::before works */
.nav-rail__list li {
  position: relative;
}

.nav-item__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  color: var(--ink-tertiary);
  transition: color var(--dur-fast) var(--ease-standard);
}

.nav-item:hover .nav-item__icon {
  color: var(--ink-secondary);
}

.nav-item__label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── 10. CONTENT AREA ──────────────────────────────────────────────────────── */

.content-area {
  flex: 1 1 0;
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--sp-6) var(--sp-6);
  /* Reserve bottom space for mobile bottom-nav */
  padding-bottom: calc(var(--sp-6) + env(safe-area-inset-bottom));
}

@media (max-width: 720px) {
  .content-area {
    padding: var(--sp-4) var(--sp-4);
    padding-bottom: calc(var(--bottom-nav-height) + var(--sp-6) + env(safe-area-inset-bottom));
  }
}

/* Smooth screen swap animation */
.content-area > .screen {
  animation: screenEnter var(--dur-medium) var(--ease-out) both;
}

@keyframes screenEnter {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── 11. SCREEN STUB (placeholder layout) ──────────────────────────────────── */

.screen {
  width: 100%;
  max-width: 900px; /* reading-content cap */
}

.screen__header {
  margin-bottom: var(--sp-8);
}

.screen__eyebrow {
  display: block;
  font-size: var(--fs-label-sm);
  font-weight: 600;
  letter-spacing: var(--ls-label-sm);
  text-transform: uppercase;
  color: var(--ink-tertiary);
  margin-bottom: var(--sp-2);
}

.screen__title {
  font-family: var(--font-display);
  font-size: var(--fs-display-sm);
  font-weight: 600;
  letter-spacing: var(--ls-display);
  color: var(--ink-primary);
  line-height: 1.15;
}

/* Gradient accent on display title */
.screen__title em {
  font-style: normal;
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.screen__desc {
  margin-top: var(--sp-3);
  font-size: var(--fs-body-lg);
  color: var(--ink-secondary);
  max-width: 520px;
  line-height: 1.6;
}

/* Stub mount point — Phase 2 drops components here */
.screen__mount {
  background: var(--surface-elevated);
  border: 1.5px dashed var(--border-default);
  border-radius: var(--r-2xl);
  min-height: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-3);
  padding: var(--sp-10);
  color: var(--ink-tertiary);
  font-size: var(--fs-body-sm);
  text-align: center;
  transition: border-color var(--dur-fast) var(--ease-standard),
              background   var(--dur-fast) var(--ease-standard);
}

.screen__mount:hover {
  border-color: var(--brand-primary);
  background: rgba(192, 132, 252, 0.03);
}

.screen__mount-icon {
  width: 48px;
  height: 48px;
  background: var(--brand-gradient);
  border-radius: var(--r-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: var(--shadow-md);
  margin-bottom: var(--sp-2);
}

.screen__mount-label {
  font-weight: 600;
  color: var(--ink-secondary);
  font-size: var(--fs-body-md);
}

.screen__mount-sub {
  font-size: var(--fs-body-sm);
  color: var(--ink-tertiary);
  max-width: 260px;
}

/* ── 12. BOTTOM NAV (mobile ≤720px) ────────────────────────────────────────── */

.bottom-nav {
  display: none; /* hidden on desktop */
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  background: rgba(253, 250, 246, 0.92);
  border-top: 1px solid var(--topbar-border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -4px 20px rgba(28, 20, 16, 0.06);
}

@media (max-width: 720px) {
  .bottom-nav {
    display: flex;
    justify-content: space-around;
    align-items: stretch;
  }
}

.bottom-nav__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-1);
  flex: 1 1 0;
  min-width: 0;
  min-height: var(--bottom-nav-height);
  padding: var(--sp-2) var(--sp-1) var(--sp-3);
  color: var(--nav-item-ink);
  font-size: var(--fs-label-sm);
  font-weight: 500;
  letter-spacing: 0.01em;
  transition:
    color     var(--dur-fast) var(--ease-standard),
    transform var(--dur-fast) var(--ease-standard);
  user-select: none;
}

.bottom-nav__item:active {
  transform: scale(0.92);
}

.bottom-nav__item:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--r-lg);
}

.bottom-nav__item[aria-current="page"],
.bottom-nav__item.is-active {
  color: var(--nav-item-active-ink);
}

.bottom-nav__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

/* Active state: pill indicator above icon */
.bottom-nav__item[aria-current="page"] .bottom-nav__icon::before,
.bottom-nav__item.is-active .bottom-nav__icon::before {
  content: '';
  position: absolute;
  top: 6px;
  width: 24px;
  height: 3px;
  border-radius: var(--r-full);
  background: var(--brand-gradient-pill);
}

.bottom-nav__item {
  position: relative;
}

.bottom-nav__label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── 13. MOBILE NAV BACKDROP ───────────────────────────────────────────────── */

.nav-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(28, 20, 16, 0.35);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity var(--dur-medium) var(--ease-standard);
  pointer-events: none;
}

@media (max-width: 720px) {
  .nav-backdrop {
    display: block;
  }

  .nav-backdrop.is-visible {
    opacity: 1;
    pointer-events: auto;
  }
}

/* ── 14. CARD SHELL INTEGRATION (Phase 2 hooks) ────────────────────────────── */

/*
 * Phase 2: koydo-cards.css will define:
 *   .kc-card              — base card wrapper
 *   .kc-card--[skin]      — skin variant (classic, gradient, glass, etc.)
 *   .kc-card__front       — front face
 *   .kc-card__back        — back face
 *   .kc-card.is-flipped   — 3D Y-rotation state
 *   .kc-grade-bar         — Again / Almost / Got-it action row
 *
 * The .screen__mount inside #screen-study is the injection target.
 * Router exposes window.KoydoRouter.currentScreen() for the cards layer.
 */

/* Anticipatory placeholder — no-op if koydo-cards.css absent */
.kc-card-host {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-6);
}

/* ── 15. UTILITY CLASSES ───────────────────────────────────────────────────── */

/* Gradient text utility */
.text-gradient {
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Gradient pill button */
.btn-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  height: var(--tap-target-min);
  padding: 0 var(--sp-5);
  background: var(--brand-gradient-pill);
  color: var(--brand-primary-text);
  border-radius: var(--r-full);
  font-size: var(--fs-label-lg);
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(168, 85, 247, 0.30);
  transition:
    box-shadow var(--dur-fast) var(--ease-standard),
    transform  var(--dur-fast) var(--ease-standard),
    filter     var(--dur-fast) var(--ease-standard);
  border: none;
  cursor: pointer;
  user-select: none;
}

.btn-pill:hover {
  filter: brightness(1.06);
  box-shadow: 0 6px 20px rgba(168, 85, 247, 0.40);
}

.btn-pill:active {
  transform: scale(0.97);
}

.btn-pill:focus-visible {
  box-shadow: var(--focus-ring), 0 4px 14px rgba(168, 85, 247, 0.30);
}

/* Ghost secondary button */
.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  height: var(--tap-target-min);
  padding: 0 var(--sp-4);
  background: transparent;
  border: 1.5px solid var(--border-default);
  border-radius: var(--r-full);
  font-size: var(--fs-label-lg);
  font-weight: 500;
  color: var(--ink-secondary);
  transition:
    border-color var(--dur-fast) var(--ease-standard),
    background   var(--dur-fast) var(--ease-standard),
    color        var(--dur-fast) var(--ease-standard);
  cursor: pointer;
  user-select: none;
}

.btn-ghost:hover {
  border-color: var(--brand-primary);
  color: var(--nav-item-active-ink);
  background: var(--nav-item-active-bg);
}

.btn-ghost:focus-visible {
  box-shadow: var(--focus-ring);
  outline: none;
}

/* Stat card (used on Progress screen) */
.stat-card {
  background: var(--surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-xl);
  padding: var(--sp-5);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.stat-card__label {
  font-size: var(--fs-label-sm);
  font-weight: 600;
  letter-spacing: var(--ls-label-sm);
  text-transform: uppercase;
  color: var(--ink-tertiary);
}

.stat-card__value {
  font-family: var(--font-display);
  font-size: var(--fs-display-sm);
  font-weight: 700;
  color: var(--ink-primary);
  letter-spacing: var(--ls-display);
}

.stat-card__sub {
  font-size: var(--fs-body-sm);
  color: var(--ink-secondary);
}

/* Grid helpers */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-4);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-4);
}

@media (max-width: 480px) {
  .grid-2, .grid-3 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}
