:root {
  --bg: #020617;
  --surface: rgba(15, 23, 42, 0.86);
  --surface-strong: #0b1222;
  --border: rgba(148, 163, 184, 0.34);
  --text: #e5e7eb;
  --soft: #a8b3c5;
  --accent: #38bdf8;
  --accent-strong: #0ea5e9;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 0%, rgba(14, 165, 233, 0.2), transparent 32rem),
    radial-gradient(circle at 90% 20%, rgba(99, 102, 241, 0.14), transparent 30rem),
    var(--bg);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Inter", sans-serif;
  line-height: 1.72;
}

a {
  color: #bae6fd;
  text-underline-offset: 0.18em;
}

a:hover {
  color: #e0f2fe;
}

.site-header,
.page-shell,
.site-footer {
  width: min(1120px, calc(100% - 32px));
  margin-inline: auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 0 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 20%, #e0f2fe, #0369a1 48%, #020617);
  box-shadow: 0 0 0 1px rgba(226, 232, 240, 0.18);
}

.brand strong {
  display: block;
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand span span {
  display: block;
  color: var(--soft);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.header-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  font-size: 13px;
}

.breadcrumbs {
  padding-top: 30px;
  color: var(--soft);
  font-size: 12px;
}

.breadcrumbs a {
  color: #dbeafe;
}

.hero {
  padding: 28px 0 20px;
}

.eyebrow {
  margin: 0 0 10px;
  color: #7dd3fc;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1 {
  max-width: 900px;
  margin: 0;
  font-size: clamp(38px, 7vw, 68px);
  line-height: 1.02;
  letter-spacing: -0.05em;
}

.hero-copy {
  max-width: 800px;
  margin: 18px 0 0;
  color: var(--soft);
  font-size: 18px;
}

.dates {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 18px;
  color: #94a3b8;
  font-size: 12px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 24px;
  align-items: start;
  padding-bottom: 40px;
}

.article-card,
.toc,
.quick-check {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 22px;
  background:
    linear-gradient(145deg, rgba(56, 189, 248, 0.06), transparent 42%),
    var(--surface);
}

.article-card {
  padding: clamp(20px, 4vw, 38px);
}

.toc {
  position: sticky;
  top: 18px;
  padding: 18px;
  font-size: 13px;
}

.toc strong {
  display: block;
  margin-bottom: 10px;
  color: #f8fafc;
}

.toc ol {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 20px;
  color: var(--soft);
}

.toc a {
  color: #cbd5e1;
  text-decoration: none;
}

.toc a:hover {
  color: #7dd3fc;
  text-decoration: underline;
}

.quick-check {
  margin-bottom: 24px;
  padding: 20px;
}

.quick-check h2 {
  margin-top: 0;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  min-width: 0;
}

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

label {
  color: #dbeafe;
  font-size: 13px;
  font-weight: 700;
}

input[type="text"] {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #020617;
  color: var(--text);
  padding: 12px 14px;
  font: 600 15px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
}

input[type="text"]:focus,
button:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(56, 189, 248, 0.42);
  outline-offset: 3px;
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.primary-button,
.example-button {
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #e0f2fe, #0ea5e9);
  color: #082f49;
  padding: 10px 15px;
  font: 750 13px/1.2 system-ui, sans-serif;
  cursor: pointer;
}

.example-button {
  margin-top: 10px;
  border: 1px solid rgba(56, 189, 248, 0.42);
  background: rgba(14, 165, 233, 0.1);
  color: #bae6fd;
}

.example-button:hover {
  background: rgba(14, 165, 233, 0.2);
}

.quick-result {
  margin-top: 14px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.answer-line {
  margin: 4px 0;
  color: #f8fafc;
  font: 700 16px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace;
  overflow-wrap: anywhere;
}

.quick-steps {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding-left: 22px;
  color: #cbd5e1;
  font-size: 13px;
}

.quick-error {
  min-height: 22px;
  margin: 10px 0 0;
  color: #fda4af;
  font-size: 13px;
}

.article-card h2 {
  margin: 38px 0 14px;
  font-size: clamp(26px, 4vw, 36px);
  line-height: 1.18;
  letter-spacing: -0.03em;
  scroll-margin-top: 22px;
}

.article-card h2:first-child {
  margin-top: 0;
}

.article-card h3 {
  margin: 28px 0 10px;
  color: #e0f2fe;
  font-size: 19px;
  line-height: 1.3;
  scroll-margin-top: 22px;
}

.article-card p,
.article-card li {
  color: #cbd5e1;
}

.article-card code {
  color: #f0f9ff;
  background: rgba(14, 165, 233, 0.1);
  border-radius: 5px;
  padding: 1px 4px;
}

.equation {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  margin: 14px 0;
  border-left: 3px solid var(--accent);
  border-radius: 0 12px 12px 0;
  background: rgba(2, 6, 23, 0.76);
  padding: 12px 15px;
  color: #f8fafc;
  font: 650 15px/1.9 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: nowrap;
}

.step-list {
  display: grid;
  gap: 10px;
  padding-left: 24px;
}

.flow {
  display: grid;
  grid-template-columns: repeat(5, minmax(110px, 1fr));
  gap: 8px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  margin: 18px 0;
  padding-bottom: 4px;
}

.flow div {
  min-width: 110px;
  border: 1px dashed rgba(56, 189, 248, 0.48);
  border-radius: 14px;
  background: rgba(14, 165, 233, 0.06);
  padding: 12px;
  text-align: center;
  font-size: 12px;
}

.flow strong {
  display: block;
  margin-bottom: 8px;
  color: #7dd3fc;
}

.flow span {
  display: block;
  min-height: 24px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.4);
}

.callout {
  margin: 18px 0;
  border: 1px solid rgba(56, 189, 248, 0.31);
  border-radius: 16px;
  background: rgba(14, 165, 233, 0.08);
  padding: 15px 17px;
  color: #dbeafe;
}

.example-block {
  margin: 24px 0;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(2, 6, 23, 0.38);
  padding: 18px;
}

.example-block h3 {
  margin-top: 0;
}

.conclusion {
  margin-top: 16px;
  color: #dcfce7;
  font-weight: 650;
}

.practice-list {
  display: grid;
  gap: 10px;
  padding-left: 24px;
}

details {
  margin-top: 6px;
}

summary {
  color: #7dd3fc;
  cursor: pointer;
  font-weight: 700;
}

details p {
  margin: 8px 0 0;
}

.faq-item {
  padding: 17px 0;
  border-top: 1px solid var(--border);
}

.faq-item:first-of-type {
  border-top: 0;
}

.faq-item h3 {
  margin-top: 0;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 0 36px;
  color: var(--soft);
  font-size: 12px;
}

@media (max-width: 860px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
    min-width: 0;
  }

  .toc {
    position: static;
    grid-row: 1;
  }

  .article-card {
    width: 100%;
    max-width: 100%;
  }
}

@media (max-width: 620px) {
  .site-header,
  .page-shell,
  .site-footer {
    width: min(100% - 20px, 1120px);
  }

  .site-header,
  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .form-row {
    grid-template-columns: minmax(0, 1fr);
    min-width: 0;
  }

  input[type="text"] {
    min-width: 0;
  }
}

@media print {
  body {
    color: #111827;
    background: white;
  }

  .site-header,
  .breadcrumbs,
  .hero-copy,
  .dates,
  .toc,
  .quick-check,
  .example-button,
  .site-footer {
    display: none;
  }

  .layout {
    display: block;
  }

  .article-card {
    border: 0;
    background: white;
    padding: 0;
  }

  .article-card p,
  .article-card li,
  .article-card h2,
  .article-card h3,
  .equation {
    color: #111827;
  }
}
