
/* ── TOKENS ─────────────────────────────── */
:root {
  --bg:        #f4f6fb;
  --surface:   #ffffff;
  --surface2:  #f0f3f9;
  --border:    #e3e8f0;
  --text:      #18202e;
  --muted:     #7a8799;
  --accent:    #0ea5e9;
  --accent-lt: #e0f4fe;
  --accent2:   #8b5cf6;
  --accent2-lt:#ede9fe;
  --accent3:   #10b981;
  --accent3-lt:#d1fae5;
  --danger:    #ef4444;
  --shadow:    0 2px 16px rgba(0,0,0,0.07);
  --font:      'Plus Jakarta Sans', sans-serif;
  --mono:      'Fira Code', monospace;
  --radius:    16px;
  --radius-sm: 10px;
}

[data-theme="night"] {
  --bg:        #0c0f18;
  --surface:   #131722;
  --surface2:  #1a1f2e;
  --border:    #252b3b;
  --text:      #e6eaf4;
  --muted:     #5a6478;
  --accent:    #38bdf8;
  --accent-lt: #0c2a3e;
  --accent2:   #a78bfa;
  --accent2-lt:#2a1f4a;
  --accent3:   #34d399;
  --accent3-lt:#0d2e22;
  --danger:    #f87171;
  --shadow:    0 2px 20px rgba(0,0,0,0.4);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: background 0.3s, color 0.3s;
  font-size: 15px;
  line-height: 1.6;
}

/* ── HEADER ─────────────────────────────── */
.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
  transition: background 0.3s, border-color 0.3s;
}
.header-inner {
  max-width: 1200px; margin: 0 auto;
  padding: 0 24px; height: 56px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.logo { text-decoration: none; font-weight: 800; font-size: 1rem; color: var(--text); letter-spacing: -0.3px; }
.logo span { color: var(--accent); }
.nav { display: flex; gap: 20px; }
.nav a { color: var(--muted); text-decoration: none; font-size: 0.875rem; transition: color 0.2s; font-weight: 500; }
.nav a:hover { color: var(--accent); }
.theme-toggle {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 999px; padding: 5px 14px;
  font-size: 0.8rem; font-family: var(--font); color: var(--text);
  cursor: pointer; transition: all 0.2s; font-weight: 500;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }

/* ── LAYOUT ──────────────────────────────── */
.section { padding: 40px 24px 80px; }
.container { max-width: 1200px; margin: 0 auto; }
.page-layout {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 32px; align-items: start;
}
@media (max-width: 820px) { .page-layout { grid-template-columns: 1fr; } }

.section-title { font-size: 1.7rem; font-weight: 800; margin-bottom: 6px; letter-spacing: -0.5px; }
.section-desc { color: var(--muted); font-size: 0.9rem; margin-bottom: 28px; }

/* ── CARD ────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: background 0.3s, border-color 0.3s;
}

/* ── MODE PICKER ─────────────────────────── */
.mode-row {
  display: flex; gap: 8px; flex-wrap: wrap;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}

.mode-btn {
  flex: 1; min-width: 80px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--muted);
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}
.mode-btn:hover { border-color: var(--accent); color: var(--accent); }
.mode-btn.active {
  background: var(--accent); border-color: var(--accent);
  color: #fff; box-shadow: 0 2px 10px rgba(14,165,233,0.3);
}

/* ── SHAPE GRID ──────────────────────────── */
.shape-section { padding: 20px; border-bottom: 1px solid var(--border); }
.shape-section-label {
  font-size: 0.7rem; font-family: var(--mono);
  color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.07em; margin-bottom: 10px;
}

.shape-grid {
  display: flex; flex-wrap: wrap; gap: 8px;
}

.shape-btn {
  display: flex; flex-direction: column;
  align-items: center; gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface2);
  color: var(--muted);
  font-family: var(--font);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s;
  min-width: 72px;
}
.shape-btn:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.shape-btn.active {
  background: var(--accent-lt);
  border-color: var(--accent);
  color: var(--accent);
}
.shape-btn .shape-icon { font-size: 1.4rem; }

/* ── INPUTS ──────────────────────────────── */
.inputs-section { padding: 20px; border-bottom: 1px solid var(--border); }

.input-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 500px) { .input-grid { grid-template-columns: 1fr; } }

.field { display: flex; flex-direction: column; gap: 5px; }
.field label {
  font-size: 0.72rem; font-family: var(--mono);
  color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em;
}
.field input, .field select {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-family: var(--mono); font-size: 0.875rem;
  padding: 9px 12px; outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  appearance: none;
}
.field input:focus, .field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(14,165,233,0.12);
}
.field input::placeholder { color: var(--muted); }

.unit-row {
  display: flex; align-items: center; gap: 10px;
  margin-top: 14px;
}
.unit-label {
  font-size: 0.72rem; font-family: var(--mono);
  color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em;
  flex-shrink: 0;
}
.unit-row select {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-family: var(--mono); font-size: 0.82rem;
  padding: 7px 10px; outline: none;
  transition: border-color 0.2s;
  appearance: none; cursor: pointer;
}
.unit-row select:focus { border-color: var(--accent); }

/* ── FORMULA PREVIEW ─────────────────────── */
.formula-box {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-top: 14px;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--accent2);
  display: flex; align-items: center; gap: 8px;
}
.formula-box .f-label { color: var(--muted); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em; }

/* ── CALCULATE BTN ───────────────────────── */
.calc-action { padding: 16px 20px; border-bottom: 1px solid var(--border); }
.btn-calc {
  width: 100%; padding: 13px;
  background: var(--accent); border: none;
  border-radius: var(--radius-sm); color: #fff;
  font-family: var(--font); font-size: 0.95rem; font-weight: 700;
  cursor: pointer; transition: all 0.2s; letter-spacing: 0.02em;
}
.btn-calc:hover { filter: brightness(1.1); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(14,165,233,0.35); }
.btn-calc:active { transform: scale(0.98); }

/* ── RESULTS ─────────────────────────────── */
.results-section { padding: 20px; }

.result-empty {
  text-align: center; color: var(--muted);
  font-size: 0.875rem; padding: 20px 0;
}
.result-empty .icon { font-size: 2rem; margin-bottom: 8px; opacity: 0.4; }

.result-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }

.result-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  transition: border-color 0.2s;
}
.result-card.primary { background: var(--accent-lt); border-color: var(--accent); }
.result-card.secondary { background: var(--accent2-lt); border-color: var(--accent2); }
.result-card.tertiary { background: var(--accent3-lt); border-color: var(--accent3); }

.rc-label {
  font-size: 0.68rem; font-family: var(--mono);
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); margin-bottom: 6px;
}
.result-card.primary   .rc-label { color: var(--accent); }
.result-card.secondary .rc-label { color: var(--accent2); }
.result-card.tertiary  .rc-label { color: var(--accent3); }

.rc-value {
  font-family: var(--mono); font-size: 1.3rem;
  font-weight: 600; color: var(--text);
  line-height: 1.2;
}
.rc-unit { font-size: 0.75rem; color: var(--muted); margin-top: 2px; font-family: var(--mono); }

.result-formula {
  margin-top: 14px; padding: 10px 14px;
  background: var(--surface2); border-radius: var(--radius-sm);
  font-family: var(--mono); font-size: 0.78rem;
  color: var(--muted); line-height: 1.6;
  border: 1px solid var(--border);
}

/* ── SVG SHAPE PREVIEW ───────────────────── */
.shape-preview {
  display: flex; justify-content: center;
  margin-top: 14px;
}
.shape-preview svg { max-width: 160px; height: auto; }

/* ── SEO CONTENT ─────────────────────────── */
.seo-content { margin-top: 40px; max-width: 680px; }
.seo-content h2 { font-size: 1.2rem; font-weight: 800; margin-bottom: 10px; }
.seo-content h3 { font-size: 0.95rem; font-weight: 700; margin: 22px 0 8px; }
.seo-content p, .seo-content li { font-size: 0.875rem; color: var(--muted); line-height: 1.8; }
.seo-content ul { padding-left: 18px; }
.seo-content li { margin-bottom: 4px; }

.formula-table {
  width: 100%; border-collapse: collapse;
  margin: 16px 0; font-size: 0.82rem;
}
.formula-table th, .formula-table td {
  padding: 9px 12px; text-align: left;
  border-bottom: 1px solid var(--border);
}
.formula-table th { color: var(--text); font-weight: 700; font-size: 0.78rem; background: var(--surface2); }
.formula-table td { color: var(--muted); }
.formula-table td:nth-child(3) { font-family: var(--mono); color: var(--accent2); font-size: 0.78rem; }

.faq-item { border-bottom: 1px solid var(--border); }
.faq-q {
  font-size: 0.875rem; font-weight: 700; color: var(--text);
  cursor: pointer; padding: 13px 0;
  display: flex; justify-content: space-between; align-items: center;
}
.faq-q::after { content: '+'; color: var(--accent); font-size: 1.1rem; }
.faq-item.open .faq-q::after { content: '−'; }
.faq-a { font-size: 0.875rem; color: var(--muted); padding: 2px 0 12px; display: none; line-height: 1.7; }
.faq-item.open .faq-a { display: block; }

/* ── SIDEBAR ─────────────────────────────── */
.right-column h2 { font-size: 0.95rem; font-weight: 800; margin-bottom: 12px; }
.quick-links { display: flex; flex-direction: column; gap: 8px; }
.quick-links a {
  display: block; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 14px; font-size: 0.85rem;
  color: var(--text); text-decoration: none;
  transition: all 0.2s; font-weight: 500;
}
.quick-links a:hover { border-color: var(--accent); color: var(--accent); }

/* ── FOOTER ──────────────────────────────── */
.footer {
  background: var(--surface); border-top: 1px solid var(--border);
  text-align: center; padding: 20px;
  font-size: 0.8rem; color: var(--muted);
}
