
:root {
  --bg: #f7f7f5;
  --card: #ffffff;
  --text: #1a1a1a;
  --muted: #5c5c5c;
  --border: #e5e5e0;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --accent-soft: #dbeafe;
  --success: #059669;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 4px 12px rgba(0,0,0,.04);
  --font: "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--font); background: var(--bg); color: var(--text);
  line-height: 1.55; -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.container { width: min(1120px, 92vw); margin: 0 auto; }

/* Header */
.site-header {
  background: var(--card); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.85rem 0; gap: 1rem;
}
.logo {
  font-weight: 800; font-size: 1.15rem; color: var(--text); text-decoration: none;
  letter-spacing: -0.02em;
}
.logo span { color: var(--accent); font-weight: 600; }
.nav { display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap; }
.nav a { color: var(--muted); font-weight: 500; font-size: 0.92rem; text-decoration: none; }
.nav a:hover, .nav a.active { color: var(--text); }
.lang-switcher { display: flex; gap: 0.35rem; }
.lang-switcher a {
  font-size: 0.75rem; padding: 0.2rem 0.4rem; border-radius: 4px;
  color: var(--muted); border: 1px solid transparent;
}
.lang-switcher a.active, .lang-switcher a:hover {
  background: var(--accent-soft); color: var(--accent-dark); border-color: #bfdbfe;
}

/* Hero */
.hero {
  padding: 2.75rem 0 1.5rem; text-align: center;
}
.hero h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem); font-weight: 800;
  letter-spacing: -0.03em; margin: 0 0 0.5rem;
}
.hero p { color: var(--muted); font-size: 1.1rem; max-width: 560px; margin: 0 auto 1.5rem; }
.hero-actions {
  display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; margin-bottom: 1rem;
}
.hero-actions a, .chip {
  display: inline-block; padding: 0.5rem 1rem; border-radius: 999px;
  background: var(--card); border: 1px solid var(--border); color: var(--text);
  font-weight: 600; font-size: 0.9rem; text-decoration: none;
  box-shadow: var(--shadow);
}
.hero-actions a:hover, .chip:hover { border-color: var(--accent); color: var(--accent); }

/* Cards grid */
.tool-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem; margin: 1.5rem 0 2.5rem;
}
.tool-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.15rem 1.25rem; box-shadow: var(--shadow); transition: 0.15s;
  display: flex; flex-direction: column; gap: 0.35rem;
}
.tool-card:hover { border-color: #93c5fd; transform: translateY(-2px); }
.tool-card h3 { margin: 0; font-size: 1rem; }
.tool-card h3 a { color: var(--text); text-decoration: none; }
.tool-card h3 a:hover { color: var(--accent); }
.tool-card p { margin: 0; font-size: 0.88rem; color: var(--muted); flex: 1; }
.tool-card .tag {
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--accent); margin-top: 0.35rem;
}

/* Calculator page */
.calc-page { padding: 1.5rem 0 3rem; }
.calc-page h1 { font-size: 1.75rem; margin: 0 0 0.35rem; letter-spacing: -0.02em; }
.calc-lead { color: var(--muted); margin: 0 0 1.5rem; max-width: 640px; }
.calc-layout {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; align-items: start;
}
@media (max-width: 800px) { .calc-layout { grid-template-columns: 1fr; } }

.calc-panel, .result-panel {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.35rem 1.5rem; box-shadow: var(--shadow);
}
.calc-panel h2, .result-panel h2 {
  font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); margin: 0 0 1rem; font-weight: 700;
}
.field { margin-bottom: 0.9rem; }
.field label {
  display: block; font-size: 0.82rem; font-weight: 600; margin-bottom: 0.3rem; color: var(--text);
}
.field input, .field select {
  width: 100%; padding: 0.55rem 0.7rem; border: 1px solid var(--border);
  border-radius: 8px; font-size: 1rem; background: #fff;
}
.field input:focus, .field select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.btn-primary {
  width: 100%; margin-top: 0.5rem; padding: 0.75rem 1rem;
  background: var(--accent); color: #fff; border: none; border-radius: 8px;
  font-weight: 700; font-size: 1rem; cursor: pointer;
}
.btn-primary:hover { background: var(--accent-dark); }

.result-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem;
}
.result-item {
  background: #f8fafc; border-radius: 8px; padding: 0.85rem 1rem;
  border: 1px solid var(--border);
}
.result-item .label { font-size: 0.75rem; color: var(--muted); font-weight: 600; }
.result-item .value {
  font-size: 1.35rem; font-weight: 800; font-family: var(--mono);
  letter-spacing: -0.02em; margin-top: 0.15rem;
}
.result-item.wide { grid-column: 1 / -1; }

/* DOF diagram */
.dof-diagram {
  margin-top: 1.25rem; padding: 1rem; background: #0f172a; border-radius: 10px;
  color: #e2e8f0; font-size: 0.8rem; overflow: hidden;
}
.dof-track {
  position: relative; height: 48px; margin: 1.5rem 0 0.5rem;
  background: linear-gradient(90deg, #1e293b, #334155 40%, #1e293b);
  border-radius: 6px;
}
.dof-zone {
  position: absolute; top: 8px; bottom: 8px; background: rgba(37, 99, 235, 0.45);
  border: 1px solid #60a5fa; border-radius: 4px;
}
.dof-marker {
  position: absolute; top: 0; bottom: 0; width: 2px; background: #fbbf24;
}
.dof-marker.subject { background: #34d399; width: 3px; }
.dof-labels {
  display: flex; justify-content: space-between; color: #94a3b8; font-family: var(--mono);
}

/* Content sections */
.content-block {
  margin-top: 2.5rem; max-width: 720px;
}
.content-block h2 { font-size: 1.25rem; margin: 1.5rem 0 0.5rem; }
.content-block h3 { font-size: 1.05rem; margin: 1.25rem 0 0.4rem; }
.content-block p, .content-block li { color: #333; }
.formula {
  background: #0f172a; color: #e2e8f0; padding: 1rem 1.25rem; border-radius: 8px;
  font-family: var(--mono); font-size: 0.95rem; overflow-x: auto; margin: 0.75rem 0;
}
.table-wrap { overflow-x: auto; margin: 1rem 0; }
table.data {
  width: 100%; border-collapse: collapse; font-size: 0.9rem;
}
table.data th, table.data td {
  border: 1px solid var(--border); padding: 0.5rem 0.75rem; text-align: left;
}
table.data th { background: #f1f5f9; font-weight: 600; }
.related {
  display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1rem 0;
}
.related a {
  padding: 0.4rem 0.75rem; background: var(--card); border: 1px solid var(--border);
  border-radius: 8px; font-size: 0.88rem; color: var(--text); text-decoration: none;
}
.related a:hover { border-color: var(--accent); color: var(--accent); }

.section-title {
  font-size: 1.15rem; font-weight: 800; margin: 2rem 0 0.75rem;
  letter-spacing: -0.02em;
}
.muted { color: var(--muted); }

/* Footer */
.site-footer {
  background: #0f172a; color: #94a3b8; margin-top: 3rem; padding: 2.5rem 0 1.5rem;
}
.footer-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1.5rem; margin-bottom: 1.5rem;
}
.site-footer h4 { color: #f1f5f9; margin: 0 0 0.5rem; font-size: 0.9rem; }
.site-footer a { color: #94a3b8; display: block; font-size: 0.88rem; margin: 0.25rem 0; text-decoration: none; }
.site-footer a:hover { color: #fff; }
.footer-bottom {
  border-top: 1px solid #1e293b; padding-top: 1rem; font-size: 0.85rem; text-align: center;
}

.breadcrumb { font-size: 0.85rem; color: var(--muted); margin-bottom: 1rem; }
.breadcrumb a { color: var(--muted); }
.note { font-size: 0.88rem; color: var(--muted); }
