/* ===========================
   King Manager X — Core UI
   Smooth animations + theme
   =========================== */

:root {
  /* Light theme (default) */
  --bg: #f7f9fc;
  --surface: #ffffff;
  --elev: #eef2f9;
  --text: #0b1020;
  --muted: #4b5567;
  --border: #e6e9f2;
  --primary: #6366f1;              /* indigo-500 */
  --primary-contrast: #ffffff;
  --accent: #22d3ee;               /* cyan-400 */
  --link: #3758f9;
  --ring: rgba(99,102,241,.30);
  --card-shadow: 0 10px 24px rgba(2,6,23,.08);
  --elev-shadow: 0 18px 40px rgba(2,6,23,.10);
  --radius: 14px;
  --ease: cubic-bezier(.22,1,.36,1);
  --fast: .18s var(--ease);
  --slow: .6s var(--ease);
}

/* Respect system dark on first paint */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1020;
    --surface: #111528;
    --elev: #161b31;
    --text: #e9edff;
    --muted: #b4bce0;
    --border: #222a45;
    --primary: #6f77ff;
    --primary-contrast: #ffffff;
    --accent: #22d3ee;
    --link: #9ec1ff;
    --ring: rgba(111,119,255,.35);
    --card-shadow: 0 14px 28px rgba(0,0,0,.35);
    --elev-shadow: 0 22px 60px rgba(0,0,0,.45);
  }
}

/* Manual override via <html data-theme> */
html[data-theme="light"] {
  --bg: #f7f9fc; --surface: #ffffff; --elev: #eef2f9; --text: #0b1020; --muted: #4b5567; --border: #e6e9f2;
  --primary: #6366f1; --primary-contrast: #ffffff; --accent: #22d3ee; --link: #3758f9; --ring: rgba(99,102,241,.30);
  --card-shadow: 0 10px 24px rgba(2,6,23,.08); --elev-shadow: 0 18px 40px rgba(2,6,23,.10);
}
html[data-theme="dark"] {
  --bg: #0b1020; --surface: #111528; --elev: #161b31; --text: #e9edff; --muted: #b4bce0; --border: #222a45;
  --primary: #6f77ff; --primary-contrast: #ffffff; --accent: #22d3ee; --link: #9ec1ff; --ring: rgba(111,119,255,.35);
  --card-shadow: 0 14px 28px rgba(0,0,0,.35); --elev-shadow: 0 22px 60px rgba(0,0,0,.45);
}

/* Base */
* { box-sizing: border-box; }
html, body { height: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.65 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  transition: background var(--slow), color var(--slow);
}
img { display: block; max-width: 100%; }
a { color: var(--link); text-decoration: none; transition: color var(--fast); }
a:hover { text-decoration: underline; }
code {
  background: rgba(125, 138, 255, .08);
  border: 1px solid var(--border);
  padding: .1rem .35rem; border-radius: 8px;
}

/* Containers & Utilities */
.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.observe { opacity: 0; transform: translateY(16px); transition: opacity .5s var(--ease), transform .5s var(--ease); }
.observe.visible { opacity: 1; transform: translateY(0); }
.floaty { animation: floaty 6s ease-in-out infinite; }
@keyframes floaty {
  0%,100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

/* NAV */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in oklab, var(--bg) 85%, transparent);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  transition: box-shadow var(--fast), background var(--fast), border-color var(--fast);
}
.nav.scrolled { box-shadow: var(--card-shadow); background: color-mix(in oklab, var(--bg) 92%, transparent); }
.nav-row { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 12px; padding: 10px 0; }

.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; color: var(--text); }
.brand img { width: 34px; height: 34px; border-radius: 10px; box-shadow: var(--card-shadow); }

.links { display: flex; gap: 18px; }
.link { color: color-mix(in oklab, var(--text) 85%, var(--bg)); font-weight: 600; position: relative; }
.link::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -6px; height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: 1px;
  transform: scaleX(0); transform-origin: left; transition: transform var(--fast);
}
.link:hover { color: var(--text); text-decoration: none; }
.link:hover::after { transform: scaleX(1); }
.link.active { color: var(--text); }
.link.active::after { transform: scaleX(1); }

.actions { display: flex; align-items: center; gap: 10px; }
.icon-btn { width: 42px; height: 42px; padding: 0; display: grid; place-items: center; }

/* Mobile menu */
.hamburger { display: none; width: 42px; height: 42px; border: 1px solid var(--border); background: var(--surface); border-radius: 12px; padding: 10px; cursor: pointer; transition: border var(--fast), background var(--fast); }
.hamburger span { display: block; height: 2px; background: var(--text); margin: 5px 0; border-radius: 2px; transition: transform var(--fast); }
@media (max-width: 900px) {
  .links { position: absolute; top: 64px; right: 16px; left: 16px; padding: 12px; border: 1px solid var(--border); border-radius: 14px;
           background: var(--surface); display: none; flex-direction: column; box-shadow: var(--elev-shadow); }
  .links.open { display: flex; animation: menuIn .18s var(--ease); }
  @keyframes menuIn { from { opacity: 0; transform: translateY(-6px);} to { opacity: 1; transform: translateY(0);} }
  .hamburger { display: inline-block; }
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: .5rem; padding: .68rem 1.1rem; border-radius: var(--radius); border: 1px solid transparent;
  font-weight: 800; letter-spacing: .2px; cursor: pointer; transition: transform var(--fast), box-shadow var(--fast), background var(--fast), color var(--fast), border var(--fast);
  will-change: transform;
}
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn:focus { outline: 2px solid transparent; box-shadow: 0 0 0 6px var(--ring); }

.btn.primary { background: linear-gradient(180deg, color-mix(in oklab, var(--primary) 94%, black), var(--primary)); color: var(--primary-contrast); box-shadow: var(--card-shadow); }
.btn.primary:hover { background: linear-gradient(180deg, var(--primary), color-mix(in oklab, var(--primary) 88%, white)); }
.btn.ghost   { background: color-mix(in oklab, var(--surface) 92%, transparent); border-color: var(--border); color: var(--text); }
.btn.ghost:hover { background: color-mix(in oklab, var(--surface) 98%, transparent); }
.btn.outline { background: transparent; border-color: var(--border); color: var(--text); }
.btn.outline:hover { background: color-mix(in oklab, var(--surface) 96%, transparent); }

.btn.lg { padding: .9rem 1.25rem; border-radius: calc(var(--radius) + 2px); }
.btn.sm { padding: .48rem .8rem; border-radius: 10px; font-size: 14px; }

/* Ripple (JS adds .ripple) */
.ripple { position: relative; overflow: hidden; }
.ripple::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(120px 120px at var(--rx,50%) var(--ry,50%), rgba(255,255,255,.25), transparent 40%);
  opacity: 0; transform: scale(.9); transition: opacity .35s var(--ease), transform .35s var(--ease);
}
.ripple:active::after { opacity: 1; transform: scale(1); }

/* HERO */
.hero {
  position: relative; padding: 68px 0 54px;
  background:
    radial-gradient(1200px 600px at 10% -20%, color-mix(in oklab, var(--primary) 26%, transparent), transparent 60%),
    radial-gradient(900px 480px at 100% 0%, color-mix(in oklab, var(--accent) 20%, transparent), transparent 60%);
}
.hero-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 28px; align-items: start; }
@media (max-width: 1000px) { .hero-grid { grid-template-columns: 1fr; } }

.hero-copy h1 { margin: 10px 0 10px; font-size: clamp(32px, 6vw, 56px); line-height: 1.05; font-weight: 900; letter-spacing: -0.3px; }
.grad { background: linear-gradient(90deg, var(--primary), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { font-size: 18px; color: color-mix(in oklab, var(--text) 86%, var(--bg)); transition: color var(--slow); }
.chip { display: inline-block; padding: .44rem .8rem; border-radius: 999px; background: color-mix(in oklab, var(--surface) 92%, transparent);
        border: 1px solid var(--border); font-weight: 800; letter-spacing: .2px; }
.cta { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0 8px; }
.badges { display: flex; gap: 8px; flex-wrap: wrap; }
.badge { font-size: 13px; padding: .38rem .6rem; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); transition: background var(--fast), border var(--fast); }

.hero-card {
  background: linear-gradient(180deg, color-mix(in oklab, var(--surface) 94%, transparent), color-mix(in oklab, var(--surface) 88%, transparent));
  border: 1px solid var(--border); box-shadow: var(--elev-shadow); border-radius: 18px; padding: 20px;
}

/* Sections */
.section { padding: 58px 0; transition: background var(--slow); }
.section.alt { background: var(--elev); }
.section-head { text-align: center; margin-bottom: 22px; }
.section-head h2 { margin: 0 0 6px; font-size: clamp(24px, 4.2vw, 34px); }
.muted { color: color-mix(in oklab, var(--text) 62%, var(--bg)); transition: color var(--slow); }

/* Cards & grids */
.grid { display: grid; gap: 16px; }
.cards-4 { grid-template-columns: repeat(4, 1fr); }
.cards-3 { grid-template-columns: repeat(3, 1fr); }
.cards-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 1000px) { .cards-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 680px)  { .cards-3, .cards-2, .cards-4 { grid-template-columns: 1fr; } }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--card-shadow); color: var(--text);
  transition: transform var(--fast), box-shadow var(--fast), border var(--fast), background var(--slow);
}
.hover-up:hover { transform: translateY(-4px); box-shadow: var(--elev-shadow); }

.icon { font-size: 22px; }

/* Downloads */
.downloads-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 22px; align-items: start; }
@media (max-width: 1000px) { .downloads-grid { grid-template-columns: 1fr; } }
.stack { display: grid; gap: 12px; }
.note { margin-top: 10px; font-size: 13px; color: color-mix(in oklab, var(--text) 60%, var(--bg)); }
.glass {
  background: linear-gradient(180deg, color-mix(in oklab, var(--surface) 94%, transparent), color-mix(in oklab, var(--surface) 88%, transparent));
  border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--elev-shadow);
}
.steps { margin: 0; padding-left: 18px; }
.steps li { margin: 8px 0; }

/* Products */
.product img {
  width: 100%; height: 220px; object-fit: contain;
  background: color-mix(in oklab, var(--surface) 94%, var(--bg));
  border-bottom: 1px solid var(--border);
  border-radius: 12px;
  transition: filter var(--fast), transform var(--fast);
}
.product:hover img { transform: scale(1.02); }
.product-body { display: grid; gap: 10px; padding-top: 10px; }
.product .row { display: flex; align-items: center; justify-content: space-between; }
.price { color: var(--accent); font-weight: 900; letter-spacing: .2px; }

/* CTA bar */
.cta-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 20px; border-radius: 18px;
}
.cta-bar .row.gap { display: flex; gap: 10px; flex-wrap: wrap; }
@media (max-width: 800px) { .cta-bar { flex-direction: column; align-items: start; } }

/* Footer */
.footer { border-top: 1px solid var(--border); padding: 18px 0; }
.foot-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.logo-sm { width: 26px; height: 26px; border-radius: 8px; box-shadow: var(--card-shadow); }

/* WhatsApp FAB */
.wa-fab {
  position: fixed; right: 24px; bottom: 24px; z-index: 20;
  padding: .7rem 1rem; border-radius: 999px; background: #25d366; color: #062012;
  font-weight: 900; border: 1px solid #1fb157;
  box-shadow: 0 10px 22px rgba(0,0,0,.25);
  transition: transform var(--fast), box-shadow var(--fast), filter var(--fast);
}
.wa-fab:hover { transform: translateY(-2px); box-shadow: 0 16px 30px rgba(0,0,0,.3); }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
