/* =============================================================
   K210 Training Site - Main Stylesheet
   Author: freezy2000
   ============================================================= */

/* ---------- Design Tokens ---------- */
:root {
  /* Brand palette */
  --brand-50:  #eef2ff;
  --brand-100: #e0e7ff;
  --brand-200: #c7d2fe;
  --brand-300: #a5b4fc;
  --brand-400: #818cf8;
  --brand-500: #6366f1;
  --brand-600: #4f46e5;
  --brand-700: #4338ca;
  --brand-800: #3730a3;
  --brand-900: #312e81;

  --accent-400: #22d3ee;
  --accent-500: #06b6d4;
  --accent-600: #0891b2;

  --success-500: #10b981;
  --warning-500: #f59e0b;
  --danger-500:  #ef4444;

  /* Surface (light theme) */
  --bg:           #f7f8fc;
  --bg-elevated:  #ffffff;
  --bg-soft:      #f1f3f9;
  --bg-code:      #0f172a;
  --text:         #0f172a;
  --text-soft:    #475569;
  --text-muted:   #94a3b8;
  --border:       #e5e7eb;
  --border-soft:  #eef0f5;
  --shadow-sm:    0 1px 2px rgba(15, 23, 42, .04);
  --shadow:       0 8px 24px rgba(15, 23, 42, .06);
  --shadow-lg:    0 24px 60px rgba(15, 23, 42, .12);
  --gradient-hero: linear-gradient(135deg, #4f46e5 0%, #06b6d4 100%);
  --gradient-soft:  linear-gradient(135deg, #eef2ff 0%, #ecfeff 100%);

  /* Layout */
  --radius-sm: 6px;
  --radius:    12px;
  --radius-lg: 20px;
  --container: 1180px;
  --header-h:  64px;

  /* Type */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue",
               Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", "Source Code Pro", Consolas,
               "Courier New", monospace;
}

/* Dark theme tokens */
[data-theme="dark"] {
  --bg:           #0b1020;
  --bg-elevated:  #121833;
  --bg-soft:      #0f1530;
  --bg-code:      #050816;
  --text:         #e6e9f5;
  --text-soft:    #b5bcd6;
  --text-muted:   #6b7390;
  --border:       #1f2747;
  --border-soft:  #182040;
  --shadow-sm:    0 1px 2px rgba(0, 0, 0, .4);
  --shadow:       0 8px 24px rgba(0, 0, 0, .35);
  --shadow-lg:    0 24px 60px rgba(0, 0, 0, .55);
  --gradient-soft: linear-gradient(135deg, #1e1b4b 0%, #083344 100%);
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color .25s ease, color .25s ease;
}

h1, h2, h3, h4 {
  margin: 0 0 .5em;
  line-height: 1.25;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.01em;
}

h1 { font-size: clamp(2rem, 4vw + .5rem, 3.25rem); letter-spacing: -.02em; }
h2 { font-size: clamp(1.5rem, 2vw + .8rem, 2.1rem); }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.05rem; }

p { margin: 0 0 1em; color: var(--text-soft); }

a {
  color: var(--brand-600);
  text-decoration: none;
  transition: color .2s ease;
}
a:hover { color: var(--brand-700); }

img { max-width: 100%; display: block; }

code, pre {
  font-family: var(--font-mono);
  font-size: .92em;
}
code {
  background: var(--bg-soft);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--brand-700);
}
[data-theme="dark"] code { color: var(--brand-300); }

pre {
  background: var(--bg-code);
  color: #e2e8f0;
  padding: 18px 20px;
  border-radius: var(--radius);
  overflow-x: auto;
  line-height: 1.55;
}
pre code { background: transparent; color: inherit; padding: 0; }

/* ---------- Layout helpers ---------- */
.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

.section { padding: 80px 0; }
.section-sm { padding: 48px 0; }
.section-soft { background: var(--bg-soft); }
.section-gradient { background: var(--gradient-soft); }

.eyebrow {
  display: inline-block;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--brand-600);
  background: var(--brand-50);
  padding: 6px 12px;
  border-radius: 999px;
  margin-bottom: 16px;
}
[data-theme="dark"] .eyebrow {
  color: var(--brand-300);
  background: rgba(99, 102, 241, .12);
}

.section-head { text-align: center; max-width: 720px; margin: 0 auto 48px; }
.section-head p { font-size: 1.05rem; }

.grid { display: grid; gap: 24px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

/* ---------- Header / Nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, .85);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border-soft);
  transition: background-color .25s ease, border-color .25s ease;
}
[data-theme="dark"] .site-header {
  background: rgba(11, 16, 32, .78);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: var(--text);
  font-size: 1.05rem;
}
.brand .logo {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--gradient-hero);
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: .9rem;
  box-shadow: var(--shadow-sm);
}

.nav-list {
  display: flex; gap: 4px;
  list-style: none; margin: 0; padding: 0;
}
.nav-list a {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 8px;
  color: var(--text-soft);
  font-weight: 500;
  font-size: .95rem;
}
.nav-list a:hover { background: var(--bg-soft); color: var(--text); }
.nav-list a.active {
  color: var(--brand-600);
  background: var(--brand-50);
}
[data-theme="dark"] .nav-list a.active {
  color: var(--brand-300);
  background: rgba(99, 102, 241, .14);
}

.nav-tools { display: inline-flex; align-items: center; gap: 8px; }

.icon-btn {
  width: 38px; height: 38px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-soft);
  border-radius: 10px;
  cursor: pointer;
  transition: all .2s ease;
}
.icon-btn:hover { color: var(--brand-600); border-color: var(--brand-300); }

.menu-toggle { display: none; }

@media (max-width: 820px) {
  .menu-toggle { display: inline-flex; }
  .nav-list {
    position: absolute;
    top: var(--header-h); left: 0; right: 0;
    flex-direction: column;
    gap: 0;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-soft);
    padding: 8px 16px 16px;
    display: none;
    box-shadow: var(--shadow);
  }
  .nav-list.open { display: flex; }
  .nav-list a { width: 100%; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 20px;
  border-radius: 10px;
  font-weight: 600;
  font-size: .95rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all .2s ease;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary {
  background: var(--gradient-hero);
  color: #fff;
  box-shadow: 0 6px 18px rgba(79, 70, 229, .35);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(79, 70, 229, .45); color: #fff; }

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--bg-soft); border-color: var(--brand-300); color: var(--text); }

.btn-sm { padding: 8px 14px; font-size: .85rem; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding: 96px 0 88px;
  overflow: hidden;
  background: var(--gradient-soft);
}
.hero::before, .hero::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: .55;
  pointer-events: none;
}
.hero::before { width: 360px; height: 360px; background: #818cf8; top: -120px; left: -80px; }
.hero::after  { width: 320px; height: 320px; background: #22d3ee; bottom: -100px; right: -60px; }

.hero-inner {
  position: relative;
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 56px;
  align-items: center;
}
.hero h1 span {
  background: var(--gradient-hero);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p.lead { font-size: 1.1rem; max-width: 560px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

.hero-card {
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-soft);
}
.hero-card .row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px dashed var(--border);
  font-size: .9rem;
}
.hero-card .row:last-child { border-bottom: 0; }
.hero-card .row span { color: var(--text-muted); }
.hero-card .row b { color: var(--text); font-weight: 600; }

@media (max-width: 820px) {
  .hero { padding: 64px 0 56px; }
  .hero-inner { grid-template-columns: 1fr; gap: 32px; }
}

/* ---------- Cards ---------- */
.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: var(--brand-200);
}
.card .icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--brand-50);
  color: var(--brand-600);
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
}
[data-theme="dark"] .card .icon { background: rgba(99, 102, 241, .15); color: var(--brand-300); }
.card h3 { margin-bottom: 6px; }
.card p { font-size: .95rem; }

.feature-list { list-style: none; padding: 0; margin: 0; }
.feature-list li {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 8px 0;
  color: var(--text-soft);
  font-size: .95rem;
}
.feature-list li svg { flex: none; color: var(--success-500); margin-top: 4px; }

/* ---------- Course list ---------- */
.course {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 18px;
  align-items: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 20px 24px;
  transition: all .2s ease;
}
.course:hover { border-color: var(--brand-200); box-shadow: var(--shadow); }
.course .num {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--gradient-hero);
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700;
}
.course h3 { margin: 0 0 4px; font-size: 1.05rem; }
.course p { margin: 0; font-size: .9rem; color: var(--text-soft); }
.course .tag {
  font-size: .75rem; padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg-soft); color: var(--text-soft);
  font-weight: 600;
  white-space: nowrap;
}

/* ---------- Steps ---------- */
.steps { counter-reset: step; }
.step {
  position: relative;
  padding: 20px 20px 20px 72px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  margin-bottom: 16px;
}
.step::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 20px; top: 20px;
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--gradient-hero);
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700;
}
.step h3 { margin-bottom: 6px; font-size: 1.05rem; }
.step p { margin-bottom: 0; font-size: .92rem; }

/* ---------- Examples gallery ---------- */
.example {
  display: block;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all .2s ease;
  color: inherit;
}
.example:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--brand-200); color: inherit; }
.example .thumb {
  aspect-ratio: 16 / 9;
  background: var(--gradient-hero);
  display: flex; align-items: center; justify-content: center;
  color: rgba(255, 255, 255, .92);
  position: relative;
  overflow: hidden;
}
.example .thumb svg { width: 64px; height: 64px; opacity: .9; }
.example .body { padding: 18px 20px; }
.example h3 { margin: 0 0 4px; font-size: 1.02rem; }
.example p { margin: 0; font-size: .9rem; }

/* ---------- FAQ ---------- */
.faq details {
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-bottom: 12px;
  transition: border-color .2s ease;
}
.faq details[open] { border-color: var(--brand-200); }
.faq summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
  list-style: none;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  font-size: 1.4rem; line-height: 1;
  color: var(--text-muted);
  transition: transform .2s ease;
}
.faq details[open] summary::after { content: "−"; color: var(--brand-600); }
.faq .answer { margin-top: 10px; color: var(--text-soft); font-size: .95rem; }

/* ---------- Resource table ---------- */
.resource {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-bottom: 12px;
}
.resource h3 { margin: 0 0 2px; font-size: 1.02rem; }
.resource p { margin: 0; font-size: .9rem; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--bg-elevated);
  border-top: 1px solid var(--border-soft);
  padding: 40px 0 24px;
  margin-top: 40px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 32px;
  margin-bottom: 28px;
}
.footer-grid h4 { font-size: .95rem; margin-bottom: 12px; }
.footer-grid ul { list-style: none; padding: 0; margin: 0; }
.footer-grid li { margin-bottom: 8px; }
.footer-grid a { color: var(--text-soft); font-size: .9rem; }
.footer-grid a:hover { color: var(--brand-600); }
.footer-grid p { font-size: .9rem; color: var(--text-soft); }
.copyright {
  text-align: center;
  font-size: .85rem;
  color: var(--text-muted);
  padding-top: 20px;
  border-top: 1px solid var(--border-soft);
}
@media (max-width: 720px) {
  .footer-grid { grid-template-columns: 1fr; gap: 20px; }
}

/* ---------- Utilities ---------- */
.text-center { text-align: center; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; } .mt-4 { margin-top: 32px; }
.mb-0 { margin-bottom: 0; }
.flex { display: flex; }
.gap-2 { gap: 8px; } .gap-3 { gap: 16px; }
.badge {
  display: inline-block;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--brand-50);
  color: var(--brand-700);
}
[data-theme="dark"] .badge { background: rgba(99, 102, 241, .15); color: var(--brand-300); }

/* ---------- Page header ---------- */
.page-header {
  padding: 64px 0 32px;
  background: var(--gradient-soft);
  text-align: center;
}
.page-header p { max-width: 640px; margin: 0 auto; font-size: 1.05rem; }
.page-header .eyebrow { margin-bottom: 12px; }

/* ---------- Breadcrumb ---------- */
.breadcrumb {
  font-size: .85rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.breadcrumb a { color: var(--text-soft); }
.breadcrumb a:hover { color: var(--brand-600); }
