:root {
  --bg: #eef1f4;
  --panel: #ffffff;
  --ink: #1c2430;
  --slate: #2f3b4d;
  --amber: #d97706;
  --amber-soft: #fff7eb;
  --line: #d5dbe3;
  --muted: #5b6778;
  --ok: #0f766e;
  --display: "DM Serif Display", Georgia, serif;
  --body: "IBM Plex Sans", "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--body);
  color: var(--ink);
  background:
    linear-gradient(180deg, #e7ecf2 0%, var(--bg) 220px),
    repeating-linear-gradient(90deg, transparent, transparent 79px, rgba(47,59,77,.03) 80px);
  line-height: 1.6;
  font-size: 1rem;
}
img { max-width: 100%; display: block; }
a { color: var(--slate); }
a:hover { color: var(--amber); }

.shell {
  width: min(1200px, 94%);
  margin: 1.25rem auto 3rem;
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 1.25rem;
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: static !important; }
}

.rail {
  position: sticky;
  top: 1rem;
  align-self: start;
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 1.25rem 1rem;
}
.mark {
  font-family: var(--display);
  font-size: 1.7rem;
  color: var(--slate);
  text-decoration: none;
  display: block;
  margin-bottom: 0.25rem;
}
.mark small {
  display: block;
  font-family: var(--body);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 0.35rem;
}
.rail-note {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0.75rem 0 1.1rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--line);
}
.rail nav a {
  display: block;
  text-decoration: none;
  padding: 0.45rem 0.55rem;
  margin-bottom: 0.2rem;
  border-radius: 6px;
  font-weight: 500;
  font-size: 0.92rem;
  color: var(--ink);
}
.rail nav a:hover, .rail nav a.active { background: var(--amber-soft); color: var(--ink); }
.lang { display: flex; gap: 0.35rem; margin-top: 1rem; }
.lang a {
  text-decoration: none;
  border: 1px solid var(--line);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
}
.lang a.active { background: var(--slate); color: #fff; border-color: var(--slate); }

.stage { min-width: 0; }
.hero-panel {
  background: var(--slate);
  color: #fff;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  overflow: hidden;
  border: 1px solid #243041;
}
@media (max-width: 800px) { .hero-panel { grid-template-columns: 1fr; } }
.hero-copy { padding: clamp(1.4rem, 3vw, 2.4rem); }
.hero-copy .eyebrow {
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #fbbf24;
  margin-bottom: 0.75rem;
  font-weight: 600;
}
.hero-copy h1 {
  font-family: var(--display);
  font-size: clamp(1.9rem, 4vw, 2.8rem);
  line-height: 1.15;
  font-weight: 400;
  margin-bottom: 0.85rem;
}
.hero-copy p { opacity: 0.9; max-width: 38ch; margin-bottom: 1.2rem; }
.hero-panel img { width: 100%; height: 100%; object-fit: cover; min-height: 280px; opacity: 0.9; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--amber);
  color: #1c1408;
  text-decoration: none;
  font-weight: 700;
  padding: 0.75rem 1.1rem;
  border-radius: 6px;
  border: 0;
  cursor: pointer;
}
.btn-secondary {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255,255,255,.35);
  margin-left: 0.5rem;
}

.warn {
  margin-top: 1rem;
  background: var(--amber-soft);
  border: 1px solid #f3d5a4;
  padding: 0.85rem 1rem;
  font-size: 0.88rem;
  color: #6b4a12;
}

.grid-topics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.9rem;
  margin-top: 1rem;
}
@media (max-width: 800px) { .grid-topics { grid-template-columns: 1fr; } }
.topic {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 1.1rem;
  text-decoration: none;
  color: inherit;
  transition: border-color .2s, transform .2s;
}
.topic:hover { border-color: var(--amber); transform: translateY(-3px); }
.topic .code {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--amber);
  margin-bottom: 0.45rem;
}
.topic h3 { font-size: 1.05rem; margin-bottom: 0.35rem; }
.topic p { font-size: 0.9rem; color: var(--muted); }

.panel {
  margin-top: 1rem;
  background: var(--panel);
  border: 1px solid var(--line);
  padding: clamp(1.1rem, 2.5vw, 1.75rem);
}
.panel h2 {
  font-family: var(--display);
  font-size: 1.7rem;
  font-weight: 400;
  margin-bottom: 0.75rem;
}
.panel p { margin-bottom: 0.85rem; color: var(--ink); }
.panel ul { margin: 0 0 1rem 1.2rem; }

.calc {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 640px) { .calc { grid-template-columns: 1fr; } }
.calc label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.35rem; }
.calc input {
  width: 100%;
  padding: 0.7rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  margin-bottom: 0.75rem;
}
.calc-result {
  background: #f4f7fb;
  border-radius: 8px;
  padding: 1rem;
  font-family: var(--mono);
}
.calc-result strong { display: block; font-size: 1.4rem; color: var(--ok); margin-top: 0.25rem; }

.prose { max-width: 720px; }
.prose h1 { font-family: var(--display); font-size: 2rem; font-weight: 400; margin: 0.5rem 0 1rem; }
.prose h2 { font-family: var(--display); font-size: 1.4rem; font-weight: 400; margin: 1.5rem 0 0.6rem; }
.prose p, .prose li { margin-bottom: 0.7rem; }
.prose ul { margin-left: 1.2rem; }

.footer {
  margin-top: 1.25rem;
  padding: 1.25rem;
  background: var(--slate);
  color: rgba(255,255,255,.8);
  font-size: 0.85rem;
}
.footer a { color: #fbbf24; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 1rem; }
@media (max-width: 700px) { .footer-grid { grid-template-columns: 1fr; } }

.form { display: grid; gap: 0.7rem; max-width: 480px; }
.form input, .form textarea { padding: 0.7rem; border: 1px solid var(--line); border-radius: 6px; font: inherit; }
.form button { justify-self: start; }

.fade { opacity: 0; transform: translateY(10px); transition: .6s ease; }
.fade.show { opacity: 1; transform: none; }
