/* ─────────────────────────────────────────────────────────────
   MiloKit — shared design system
   Based on milo-explained.html palette by ירין
   ───────────────────────────────────────────────────────────── */

:root {
  --bg: #f5f3ee;
  --bg-top: #e8f4ee;
  --card: #ffffff;
  --text: #14181c;
  --text-soft: #4a5560;
  --text-muted: #7a8590;
  --text-faint: #a8b0b8;
  --divider: #eef0ea;
  --border: rgba(0,0,0,0.06);
  --mint: #7dd3b3;
  --mint-dark: #0e6b4e;
  --lavender: #b8a4d4;
  --amber: #f0b86e;
  --rose: #f87171;
  --blue: #60a5fa;
  --count-bg: #f0ece6;
  --code-bg: #1a2128;
  --code-text: #e8e8e8;
  --shadow-sm: 0 1px 2px rgba(20,30,40,0.04);
  --shadow-md: 0 4px 16px rgba(20,30,40,0.08);
  --shadow-lg: 0 10px 32px rgba(20,30,40,0.10);
}

[data-theme="dark"] {
  --bg: #0c1116;
  --bg-top: #122028;
  --card: #181f27;
  --text: #ecedef;
  --text-soft: #b2bac3;
  --text-muted: #7e8892;
  --text-faint: #5a6470;
  --divider: #232c36;
  --border: rgba(255,255,255,0.07);
  --count-bg: #2a3340;
  --code-bg: #0a0f14;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg: 0 10px 32px rgba(0,0,0,0.5);
}

/* ─── RESET ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: "Rubik", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: linear-gradient(180deg, var(--bg-top) 0%, var(--bg) 400px, var(--bg) 100%);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: var(--mint-dark); text-decoration: none; }
[data-theme="dark"] a { color: var(--mint); }
a:hover { opacity: 0.8; }

.container { max-width: 1100px; margin: 0 auto; padding: 32px 28px 80px; }

/* ─── HEADER + NAV ─── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 32px;
  flex-wrap: wrap; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 16px; color: var(--text); }
.brand-logo {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, #a7e3c8 0%, #6ec9a9 100%);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  border: 2px solid var(--mint);
  box-shadow: 0 2px 8px rgba(125,211,179,0.3);
}
.brand-logo img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.nav-links { display: flex; gap: 18px; font-size: 14px; align-items: center; }
.nav-links a { color: var(--text-soft); font-weight: 500; }
.nav-links a:hover { color: var(--mint-dark); }
[data-theme="dark"] .nav-links a:hover { color: var(--mint); }
.theme-toggle {
  background: var(--card); border: 1px solid var(--border); cursor: pointer;
  width: 38px; height: 38px; border-radius: 50%;
  font-size: 16px; display: flex; align-items: center; justify-content: center;
  transition: transform 0.2s; color: var(--text);
}
.theme-toggle:hover { transform: rotate(20deg); }

/* ─── HERO ─── */
.hero {
  background: linear-gradient(135deg, #a7e3c8 0%, #6ec9a9 100%);
  border-radius: 28px;
  padding: 48px 44px;
  margin-bottom: 36px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 12px 36px rgba(125, 211, 179, 0.28);
}
.hero::before {
  content: ""; position: absolute; top: -80px; left: -80px;
  width: 300px; height: 300px; border-radius: 50%;
  background: rgba(255,255,255,0.08);
}
.hero-grid { display: grid; grid-template-columns: 1fr 200px; gap: 32px; align-items: center; position: relative; z-index: 1; }
@media (max-width: 700px) { .hero-grid { grid-template-columns: 1fr; } .hero { padding: 32px 24px; } }
.hero-title { font-size: clamp(32px, 5vw, 46px); font-weight: 800; color: #0e3225; letter-spacing: -0.025em; margin-bottom: 12px; line-height: 1.1; }
.hero-sub { font-size: 17px; color: #1a4a37; font-weight: 500; max-width: 600px; line-height: 1.55; margin-bottom: 24px; }
.hero-cta {
  display: inline-block;
  background: #0e3225;
  color: #ffffff;
  font-weight: 700;
  font-size: 15px;
  padding: 12px 28px;
  border-radius: 12px;
  transition: transform 0.15s, box-shadow 0.15s;
}
.hero-cta:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(14,50,37,0.3); opacity: 1; color: #fff; }
.hero-img-circle {
  width: 200px; height: 200px; border-radius: 50%;
  background: rgba(255,255,255,0.85);
  border: 6px solid rgba(255,255,255,0.6);
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  justify-self: center;
  display: flex; align-items: center; justify-content: center;
  font-size: 88px;
  overflow: hidden;
}
.hero-img-circle img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ─── KEY STATS ─── */
.key-stats {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px;
  margin: -20px auto 36px;
  position: relative; z-index: 2;
}
@media (max-width: 800px) { .key-stats { grid-template-columns: repeat(2, 1fr); } }
.key-stat {
  background: var(--card); border-radius: 16px; padding: 18px 16px;
  border: 1px solid var(--border); box-shadow: var(--shadow-md);
  text-align: center;
}
.key-stat-num { font-size: 30px; font-weight: 800; color: var(--mint-dark); letter-spacing: -0.03em; line-height: 1; }
[data-theme="dark"] .key-stat-num { color: var(--mint); }
.key-stat-label { font-size: 11.5px; color: var(--text-muted); font-weight: 600; margin-top: 6px; }

/* ─── TOC ─── */
.toc {
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  padding: 20px 24px; margin-bottom: 36px;
  box-shadow: var(--shadow-sm);
}
.toc-title { font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 12px; }
.toc-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 16px; font-size: 13.5px; }
@media (max-width: 700px) { .toc-list { grid-template-columns: 1fr 1fr; } }
.toc-list a { color: var(--text-soft); padding: 4px 0; transition: color 0.15s; }

/* ─── SECTIONS ─── */
section { margin-bottom: 56px; scroll-margin-top: 24px; }
h1 { font-size: clamp(28px, 4vw, 38px); font-weight: 800; letter-spacing: -0.025em; margin-bottom: 16px; color: var(--text); }
h2 {
  font-size: 28px; font-weight: 800; margin-bottom: 12px;
  letter-spacing: -0.02em; display: flex; align-items: center; gap: 12px;
  color: var(--text);
}
h2 .num {
  font-size: 18px; color: var(--text-faint); font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.section-lead { font-size: 15px; color: var(--text-soft); margin-bottom: 24px; max-width: 720px; line-height: 1.7; }
h3 { font-size: 18px; font-weight: 700; margin-bottom: 8px; margin-top: 24px; color: var(--text); }
p { margin-bottom: 12px; color: var(--text-soft); }
.card {
  background: var(--card); border-radius: 16px; padding: 24px 28px;
  border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}

ul, ol { padding-inline-start: 24px; color: var(--text-soft); margin-bottom: 16px; }
ul li, ol li { margin-bottom: 6px; }
ul li::marker { color: var(--mint-dark); }
[data-theme="dark"] ul li::marker { color: var(--mint); }

strong { color: var(--text); font-weight: 700; }

/* ─── CODE ─── */
code {
  background: var(--count-bg); padding: 1px 7px; border-radius: 5px;
  font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 0.88em;
  color: var(--text);
}
pre {
  background: var(--code-bg); color: var(--code-text);
  padding: 16px 20px; border-radius: 12px;
  overflow-x: auto; font-size: 12.5px; line-height: 1.6;
  margin: 16px 0;
  direction: ltr; text-align: left;
  position: relative;
}
pre code { background: transparent; padding: 0; color: var(--code-text); font-size: inherit; }
.code-wrap { position: relative; }
.code-copy {
  position: absolute; top: 8px; left: 8px;
  background: rgba(255,255,255,0.1); color: var(--code-text);
  border: 1px solid rgba(255,255,255,0.15);
  padding: 4px 10px; border-radius: 6px;
  font-size: 11px; font-family: inherit; cursor: pointer;
  transition: background 0.15s; z-index: 10;
}
.code-copy:hover { background: rgba(255,255,255,0.2); }
.code-copy.copied { background: var(--mint); color: #0e3225; border-color: transparent; }

/* ─── CALLOUTS ─── */
.callout {
  padding: 16px 20px; border-radius: 12px;
  background: rgba(125, 211, 179, 0.10);
  border-right: 4px solid var(--mint);
  font-size: 14px; color: var(--text-soft);
  margin: 16px 0;
}
.callout strong { color: var(--text); }
.callout.warn { background: rgba(240, 184, 110, 0.12); border-right-color: var(--amber); }
.callout.danger { background: rgba(248, 113, 113, 0.10); border-right-color: var(--rose); }
.callout.info { background: rgba(96, 165, 250, 0.10); border-right-color: var(--blue); }

/* ─── BUG STORY ─── */
.bug-story {
  background: rgba(248, 113, 113, 0.05);
  border: 1px solid rgba(248, 113, 113, 0.2);
  border-radius: 16px;
  padding: 24px 28px;
  margin: 24px 0;
}
.bug-story-tag {
  display: inline-block;
  background: var(--rose);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 6px;
  margin-bottom: 12px;
}
.bug-story h4 { font-size: 17px; font-weight: 700; margin-bottom: 12px; color: var(--text); }

/* ─── TRY IT YOURSELF ─── */
.try-it {
  background: rgba(184, 164, 212, 0.08);
  border: 1px solid rgba(184, 164, 212, 0.25);
  border-radius: 16px;
  padding: 24px 28px;
  margin: 24px 0;
}
.try-it-tag {
  display: inline-block;
  background: var(--lavender);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 6px;
  margin-bottom: 12px;
}

/* ─── WHATSAPP MOCKUP ─── */
.wa-mockup {
  background: #e5ddd5;
  border-radius: 18px;
  padding: 16px;
  max-width: 420px;
  margin: 20px auto;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
}
[data-theme="dark"] .wa-mockup { background: #1a2f2a; }
.wa-msg {
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 14px;
  margin-bottom: 6px;
  max-width: 85%;
  line-height: 1.45;
  position: relative;
  color: #1a1a1a;
  word-wrap: break-word;
}
[data-theme="dark"] .wa-msg { color: #e5e5e5; }
.wa-msg.from-user {
  background: #dcf8c6;
  margin-right: auto; margin-left: 0;
  border-bottom-right-radius: 2px;
}
[data-theme="dark"] .wa-msg.from-user { background: #056162; }
.wa-msg.from-bot {
  background: #ffffff;
  margin-left: auto; margin-right: 0;
  border-bottom-left-radius: 2px;
}
[data-theme="dark"] .wa-msg.from-bot { background: #262d31; }
.wa-msg-time { font-size: 10px; color: var(--text-muted); margin-top: 2px; text-align: left; }
.wa-msg-meta {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
  margin: 8px 0;
}

/* ─── SCREENSHOT PLACEHOLDER ─── */
.screenshot-placeholder {
  background: linear-gradient(135deg, rgba(125,211,179,0.05) 0%, rgba(184,164,212,0.05) 100%);
  border: 2px dashed rgba(125,211,179,0.4);
  border-radius: 12px;
  padding: 32px 24px;
  text-align: center;
  margin: 20px 0;
}
.screenshot-placeholder-icon { font-size: 36px; margin-bottom: 8px; opacity: 0.6; }
.screenshot-placeholder-title { font-size: 14px; font-weight: 700; color: var(--text-soft); margin-bottom: 4px; }
.screenshot-placeholder-desc { font-size: 12px; color: var(--text-muted); }
.screenshot-placeholder-todo { font-size: 11px; color: var(--text-faint); margin-top: 8px; font-style: italic; }

/* ─── TABLES ─── */
.compare, .data-table {
  display: grid; gap: 1px;
  background: var(--border); border-radius: 14px; overflow: hidden;
  border: 1px solid var(--border);
  margin: 20px 0;
}
.compare { grid-template-columns: 200px 1fr 1fr; }
@media (max-width: 700px) { .compare { grid-template-columns: 1fr; } .compare > div:nth-child(3n+1) { background: var(--count-bg); font-weight: 700; } }
.compare > div, .data-table > div { background: var(--card); padding: 14px 18px; font-size: 13.5px; color: var(--text-soft); }
.compare .ch, .data-table .ch { font-weight: 700; background: var(--count-bg); color: var(--text); }
.compare .lbl { font-weight: 600; color: var(--text-soft); background: var(--count-bg); }
.compare .y::before { content: "✓ "; color: var(--mint-dark); font-weight: 800; }
.compare .n::before { content: "× "; color: var(--rose); font-weight: 800; }
[data-theme="dark"] .compare .y::before { color: var(--mint); }

/* ─── BUTTONS ─── */
.btn {
  display: inline-block;
  padding: 10px 22px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: transform 0.15s, box-shadow 0.15s;
  text-align: center;
}
.btn-primary { background: var(--mint-dark); color: #fff; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(14,107,78,0.3); opacity: 1; color: #fff; }
[data-theme="dark"] .btn-primary { background: var(--mint); color: #0e3225; }
.btn-secondary { background: var(--card); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--count-bg); }
.btn-lg { padding: 14px 32px; font-size: 16px; }
.btn-sm { padding: 6px 14px; font-size: 13px; }

/* ─── CHAPTER NAV (prev/next) ─── */
.chapter-nav {
  display: flex; justify-content: space-between; gap: 16px;
  margin-top: 64px; padding-top: 32px; border-top: 1px solid var(--divider);
}
.chapter-nav-link {
  flex: 1;
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 16px 20px;
  text-decoration: none;
  transition: all 0.15s;
  max-width: 48%;
}
.chapter-nav-link:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); opacity: 1; }
.chapter-nav-direction { font-size: 11px; color: var(--text-muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 4px; }
.chapter-nav-title { font-size: 14px; color: var(--text); font-weight: 600; }
.chapter-nav-link.next { text-align: left; }
.chapter-nav-link.prev { text-align: right; }
.chapter-nav-link.disabled { opacity: 0.4; pointer-events: none; }

/* ─── PROGRESS BAR (top of guide pages) ─── */
.progress {
  position: sticky; top: 0;
  background: var(--bg); border-bottom: 1px solid var(--divider);
  z-index: 50; padding: 8px 0;
}
.progress-bar {
  height: 4px; background: var(--divider); border-radius: 2px; overflow: hidden;
}
.progress-fill {
  height: 100%; background: var(--mint); border-radius: 2px;
  transition: width 0.2s;
}
.progress-info {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; color: var(--text-muted); margin-bottom: 6px;
}

/* ─── FOOTER ─── */
footer {
  text-align: center; color: var(--text-faint); font-size: 12px;
  margin-top: 64px; padding-top: 24px; border-top: 1px solid var(--divider);
}

/* ─── DIAGRAMS ─── */
.diagram-wrap {
  background: var(--card); border: 1px solid var(--border); border-radius: 20px;
  padding: 24px 20px; box-shadow: var(--shadow-md);
  margin: 20px 0;
}
.diagram-svg { width: 100%; height: auto; display: block; }

.flow {
  position: relative;
  padding-right: 36px;
  margin: 24px 0;
}
.flow::before {
  content: ""; position: absolute; right: 14px; top: 12px; bottom: 12px;
  width: 2px; background: var(--divider);
}
.flow-step {
  position: relative;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px 18px; margin-bottom: 12px; box-shadow: var(--shadow-sm);
}
.flow-step::before {
  content: attr(data-num);
  position: absolute; right: -36px; top: 10px;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--mint); color: #0e3225;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px;
  border: 3px solid var(--bg);
}
.flow-title { font-weight: 700; font-size: 14px; margin-bottom: 4px; color: var(--text); }
.flow-detail { font-size: 13px; color: var(--text-soft); }
