/* ================================================
   FlowerWolf Global Design System
   Unified: header, topbar, nav, footer, typography
   ================================================ */

/* ── Color Tokens ───────────────────────────────── */
:root {
  /* Brand */
  --fw-purple:   #667eea;
  --fw-purple-h: #7c8ff5;
  --fw-purple-d: #5a6fd6;
  --fw-bg:       #050508;
  --fw-surface:  #0c0c14;
  --fw-border:   #1a1a2e;
  --fw-border-h: #2a2a44;

  /* Text */
  --fw-text:     #e0e0e0;
  --fw-muted:    #666;
  --fw-dim:      #444;

  /* Accents */
  --fw-green:  #22c55e;
  --fw-red:    #f87171;
  --fw-yellow: #fbbf24;

  /* Typography scale (browser default 16px) */
  --text-xs:   0.72em;  /* 11.5px - labels, tags */
  --text-sm:   0.83em;  /* 13.3px - secondary text */
  --text-base: 0.93em;  /* 14.9px - body */
  --text-md:   1em;     /* 16px - primary body */
  --text-lg:   1.15em;  /* 18.4px - section headers */
  --text-xl:   1.35em;  /* 21.6px - page titles */
  --text-2xl:  1.7em;   /* 27px - hero */
  --text-3xl:  2.2em;   /* 35px - main headings */

  /* Spacing */
  --gap-xs:  8px;
  --gap-sm:  14px;
  --gap-md:  24px;
  --gap-lg:  40px;
  --gap-xl:  64px;

  /* Radii */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 999px;
}

/* ── Reset & Base ───────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--fw-bg);
  color: var(--fw-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Topbar (unified, replaces old .topbar) ─────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--gap-lg);
  height: 64px;
  border-bottom: 1px solid var(--fw-border);
  position: sticky;
  top: 0;
  background: rgba(5, 5, 8, 0.92);
  backdrop-filter: blur(16px);
  z-index: 100;
}

.topbar-logo {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--fw-purple);
  text-decoration: none;
  letter-spacing: -0.3px;
  white-space: nowrap;
  flex-shrink: 0;
}
.topbar-logo span { color: var(--fw-dim); font-weight: 400; }

.topbar-nav {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
  flex: 1;
  justify-content: center;
}

.topbar-nav a {
  color: var(--fw-muted);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
}
.topbar-nav a:hover {
  color: var(--fw-text);
  background: var(--fw-surface);
}
.topbar-nav a.active {
  color: var(--fw-purple);
  background: rgba(102, 126, 234, 0.1);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--gap-xs);
  flex-shrink: 0;
}

.lang-btn {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  background: var(--fw-surface);
  border: 1px solid var(--fw-border);
  border-radius: var(--radius-pill);
  color: var(--fw-purple);
  font-size: var(--text-xs);
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s;
  white-space: nowrap;
  cursor: pointer;
}
.lang-btn:hover {
  border-color: var(--fw-purple);
  background: rgba(102, 126, 234, 0.1);
}

/* ── Footer (unified) ────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--fw-border);
  padding: var(--gap-lg) var(--gap-xl);
  text-align: center;
}
.site-footer p {
  font-size: var(--text-xs);
  color: var(--fw-dim);
  line-height: 2;
}
.site-footer a {
  color: var(--fw-purple);
  text-decoration: none;
  transition: color 0.15s;
}
.site-footer a:hover { color: var(--fw-purple-h); }

/* ── Typography ─────────────────────────────────── */
.section-label {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 3px;
  color: var(--fw-purple);
  margin-bottom: var(--gap-xs);
}
.section-title {
  font-size: var(--text-xl);
  font-weight: 800;
  color: #fff;
  margin-bottom: var(--gap-sm);
  margin-top: var(--gap-lg);
}
.subsection-title {
  font-size: var(--text-md);
  font-weight: 700;
  color: #fff;
  margin-bottom: var(--gap-xs);
  margin-top: var(--gap-md);
}

/* ── Cards ──────────────────────────────────────── */
.card {
  background: var(--fw-surface);
  border: 1px solid var(--fw-border);
  border-radius: var(--radius-md);
  padding: var(--gap-md);
}
.card h3 {
  font-size: var(--text-md);
  font-weight: 700;
  color: #fff;
  margin-bottom: 6px;
}
.card p {
  font-size: var(--text-sm);
  color: var(--fw-muted);
  line-height: 1.7;
}
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--gap-sm);
  margin-bottom: var(--gap-lg);
}

/* ── Code Blocks ────────────────────────────────── */
.code-block {
  background: #0a0a0f;
  border: 1px solid var(--fw-border);
  border-radius: var(--radius-md);
  padding: var(--gap-md);
  margin: var(--gap-xs) 0;
  overflow-x: auto;
}
.code-block pre {
  font-size: var(--text-sm);
  font-family: 'Courier New', Courier, monospace;
  color: #c9d1d9;
  line-height: 1.75;
  white-space: pre;
}
code {
  background: #111;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
  font-family: 'Courier New', monospace;
  color: #79c99e;
}

/* ── Info / Notice / Tip Boxes ───────────────────── */
.notice-box {
  background: rgba(248, 113, 113, 0.07);
  border: 1px solid rgba(248, 113, 113, 0.25);
  border-radius: var(--radius-sm);
  padding: 14px var(--gap-sm);
  margin: var(--gap-xs) 0;
}
.notice-box p { font-size: var(--text-sm); color: var(--fw-red); line-height: 1.7; }

.info-box {
  background: rgba(102, 126, 234, 0.07);
  border: 1px solid rgba(102, 126, 234, 0.25);
  border-radius: var(--radius-sm);
  padding: 14px var(--gap-sm);
  margin: var(--gap-xs) 0;
}
.info-box p { font-size: var(--text-sm); color: var(--fw-purple); line-height: 1.7; }

.tip-box {
  background: rgba(34, 197, 94, 0.07);
  border: 1px solid rgba(34, 197, 94, 0.25);
  border-radius: var(--radius-sm);
  padding: 14px var(--gap-sm);
  margin: var(--gap-xs) 0;
}
.tip-box p { font-size: var(--text-sm); color: var(--fw-green); line-height: 1.7; }

/* ── Dividers ────────────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--fw-border); margin: var(--gap-lg) 0; }

/* ── Tags ────────────────────────────────────────── */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: var(--text-xs);
  font-weight: 600;
  margin-top: 6px;
}
.tag-cmd    { background: rgba(102,126,234,0.15); color: var(--fw-purple); }
.tag-trouble{ background: rgba(248,113,113,0.15); color: var(--fw-red); }
.tag-tip    { background: rgba(34,197,94,0.15);  color: var(--fw-green); }
.tag-new    { background: rgba(251,191,36,0.15); color: var(--fw-yellow); }

/* ── Steps ───────────────────────────────────────── */
.step-list { list-style: none; counter-reset: steps; }
.step-item { display: flex; gap: var(--gap-sm); margin-bottom: var(--gap-md); align-items: flex-start; }
.step-num {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  background: rgba(102,126,234,0.12);
  border: 1px solid rgba(102,126,234,0.3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--fw-purple);
  counter-increment: steps;
}
.step-item::before { content: counter(steps); display: none; }
.step-num::before { display: none; }
.step-content { flex: 1; }
.step-content h3 { font-size: var(--text-md); font-weight: 700; color: #fff; margin-bottom: 6px; }
.step-content p { font-size: var(--text-sm); color: var(--fw-muted); line-height: 1.7; }

/* ── Tables ──────────────────────────────────────── */
.config-table {
  background: var(--fw-surface);
  border: 1px solid var(--fw-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: var(--gap-md);
}
.config-table table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.config-table th {
  padding: 10px 16px;
  text-align: left;
  background: rgba(102,126,234,0.05);
  color: var(--fw-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--fw-border);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.config-table td {
  padding: 9px 16px;
  color: #aaa;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.config-table tr:last-child td { border-bottom: none; }
.config-table td:first-child { color: #79c99e; font-family: 'Courier New', monospace; font-size: var(--text-xs); }
.config-table td:nth-child(2) { color: var(--fw-purple); font-weight: 600; }
.config-table td:last-child { color: var(--fw-muted); }

/* ── Problem / Tip Grids ─────────────────────────── */
.problem-grid, .tips-grid {
  display: grid;
  gap: var(--gap-xs);
  margin-bottom: var(--gap-md);
}
.problem-item {
  background: var(--fw-surface);
  border: 1px solid var(--fw-border);
  border-radius: var(--radius-md);
  padding: var(--gap-sm);
}
.problem-item h4 { font-size: var(--text-sm); font-weight: 700; color: var(--fw-red); margin-bottom: 6px; }
.problem-item h4::before { content: "❌ "; }
.problem-item p { font-size: var(--text-sm); color: var(--fw-muted); line-height: 1.7; }
.problem-item p code, .problem-item code { background: #111; padding: 2px 6px; border-radius: 4px; font-family: 'Courier New', monospace; color: #79c99e; font-size: 0.88em; }

.tip-item {
  background: var(--fw-surface);
  border: 1px solid rgba(34,197,94,0.2);
  border-radius: var(--radius-md);
  padding: var(--gap-sm);
}
.tip-item h4 { font-size: var(--text-sm); font-weight: 700; color: var(--fw-green); margin-bottom: 6px; }
.tip-item h4::before { content: "💡 "; }
.tip-item p { font-size: var(--text-sm); color: var(--fw-muted); line-height: 1.7; }
.tip-item p code, .tip-item code { background: rgba(34,197,94,0.05); padding: 2px 6px; border-radius: 4px; font-family: 'Courier New', monospace; color: #79c99e; font-size: 0.88em; }

/* ── Main Content Area ───────────────────────────── */
.main { max-width: 1100px; margin: 0 auto; padding: var(--gap-xl) var(--gap-lg); }
.page-header { margin-bottom: var(--gap-xl); }
.page-header h1 { font-size: var(--text-3xl); font-weight: 800; color: #fff; letter-spacing: -0.5px; margin-bottom: 8px; }
.page-header p { font-size: var(--text-md); color: var(--fw-muted); margin-top: 8px; }

/* ── Responsive ─────────────────────────────────── */
@media (max-width: 768px) {
  .topbar { padding: 0 var(--gap-sm); }
  .topbar-nav { gap: 4px; }
  .topbar-nav a { padding: 5px 8px; font-size: var(--text-xs); }
  .cards-grid { grid-template-columns: 1fr; }
}
