/* ===== Design tokens ===== */
:root {
  --bg: #ffffff;
  --bg-soft: #f5f7fa;
  --ink: #16212e;
  --ink-soft: #4a5766;
  --line: #e2e8f0;
  --brand: #0f2438;
  --accent: #1f6feb;
  --accent-soft: #eaf1fe;
  --warn-bg: #fff8ec;
  --warn-line: #f0d9a8;
  --radius: 12px;
  --maxw: 820px;
  --wrapw: 1120px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
}

.wrap { width: 100%; max-width: var(--wrapw); margin-inline: auto; padding-inline: 1.1rem; }

img { max-width: 100%; height: auto; display: block; }

a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
a:hover { text-decoration: none; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 1000;
  background: var(--brand); color: #fff; padding: .7rem 1rem; border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus { left: 0; }

/* ===== Header ===== */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.92);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 62px; }

.logo { display: inline-flex; align-items: center; gap: .55rem; text-decoration: none; color: var(--brand); }
.logo-mark {
  display: grid; place-items: center; width: 34px; height: 34px;
  background: var(--brand); color: #fff; border-radius: 8px; font-weight: 800; font-size: .95rem; letter-spacing: .5px;
}
.logo-text { font-size: 1rem; font-weight: 600; color: var(--ink); }
.logo-text strong { color: var(--brand); }

.primary-nav ul { list-style: none; display: flex; gap: 1.35rem; margin: 0; padding: 0; }
.primary-nav a { color: var(--ink-soft); text-decoration: none; font-size: .95rem; font-weight: 500; }
.primary-nav a:hover { color: var(--accent); }

.nav-toggle {
  display: none; flex-direction: column; gap: 5px; justify-content: center;
  width: 44px; height: 44px; background: none; border: 1px solid var(--line); border-radius: 8px; cursor: pointer;
}
.nav-toggle span { display: block; height: 2px; width: 22px; margin-inline: auto; background: var(--brand); transition: transform .2s, opacity .2s; }

/* ===== Layout ===== */
main.wrap { max-width: var(--maxw); padding-top: 1.5rem; padding-bottom: 3rem; }

.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 1rem; padding: 0; font-size: .85rem; color: var(--ink-soft); }
.breadcrumbs li + li::before { content: "›"; margin-right: .4rem; color: var(--ink-soft); }
.breadcrumbs a { color: var(--ink-soft); }

/* ===== Typography ===== */
h1 { font-size: clamp(1.75rem, 5vw, 2.5rem); line-height: 1.18; letter-spacing: -.02em; margin: .2rem 0 .8rem; }
h2 { font-size: clamp(1.4rem, 3.6vw, 1.85rem); line-height: 1.25; letter-spacing: -.01em; margin: 0 0 .7rem; }
h3 { font-size: 1.2rem; line-height: 1.3; margin: 1.6rem 0 .5rem; }
p { margin: 0 0 1rem; }
.lead { font-size: 1.18rem; color: var(--ink-soft); }

.content-section { padding-top: 2.4rem; margin-top: 2.4rem; border-top: 1px solid var(--line); scroll-margin-top: 80px; }
.intro-section { scroll-margin-top: 80px; }

.direct-answer {
  font-weight: 500; color: var(--ink);
  background: var(--accent-soft); border-left: 4px solid var(--accent);
  padding: .85rem 1rem; border-radius: 0 var(--radius) var(--radius) 0; margin-bottom: 1.2rem;
}

ul, ol { margin: 0 0 1.1rem; padding-left: 1.3rem; }
li { margin-bottom: .45rem; }

/* ===== Images ===== */
.content-image { margin: 1.4rem 0; }
.content-image img { width: 100%; border-radius: var(--radius); border: 1px solid var(--line); background: var(--bg-soft); aspect-ratio: 16 / 9; object-fit: cover; }
figcaption { font-size: .85rem; color: var(--ink-soft); margin-top: .5rem; text-align: center; }

/* ===== TOC ===== */
.toc { background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem 1.3rem; margin: 1.8rem 0 .5rem; }
.toc h2 { font-size: 1.1rem; margin-bottom: .6rem; }
.toc ol { margin: 0; padding-left: 1.2rem; columns: 2; column-gap: 2rem; }
.toc li { margin-bottom: .35rem; break-inside: avoid; }
.toc a { color: var(--ink-soft); text-decoration: none; font-size: .93rem; }
.toc a:hover { color: var(--accent); text-decoration: underline; }

/* ===== Tables ===== */
.table-scroll { overflow-x: auto; margin: 1.2rem 0; -webkit-overflow-scrolling: touch; }
.comparison-table { width: 100%; border-collapse: collapse; font-size: .95rem; min-width: 480px; }
.comparison-table th, .comparison-table td { padding: .7rem .85rem; text-align: left; border-bottom: 1px solid var(--line); }
.comparison-table thead th { background: var(--brand); color: #fff; font-weight: 600; }
.comparison-table tbody tr:nth-child(even) { background: var(--bg-soft); }

/* ===== CTA / notice box ===== */
.cta-box { background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: var(--radius); padding: 1.1rem 1.25rem; margin: 1.6rem 0; }
.cta-box h3 { margin-top: 0; }
.cta-box p { margin-bottom: 0; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: .6rem 1.15rem; border-radius: 10px;
  font-weight: 600; font-size: .95rem; text-decoration: none; line-height: 1.2;
  border: 1px solid transparent; transition: background .15s, color .15s, border-color .15s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #1559c4; }
.btn-secondary { background: #fff; color: var(--brand); border-color: var(--line); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.4); }
.btn-ghost:hover { border-color: #fff; }

.cta-actions .cta-buttons { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: .3rem; }

/* ===== Sticky action bar ===== */
.sticky-bar {
  position: sticky; bottom: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  background: var(--brand); color: #fff;
  padding: .7rem 1.1rem; border-top: 1px solid rgba(255,255,255,.15);
  box-shadow: 0 -4px 16px rgba(15,36,56,.18);
}
.sticky-text { margin: 0; font-size: .95rem; color: #eef3f8; }
.sticky-actions { display: flex; gap: .6rem; flex-wrap: wrap; }

@media (max-width: 560px) {
  .sticky-bar { justify-content: center; text-align: center; padding: .6rem .9rem; }
  .sticky-text { flex-basis: 100%; }
  .sticky-actions { width: 100%; }
  .sticky-actions .btn { flex: 1; }
}

/* ===== FAQ ===== */
.faq h3 { font-size: 1.12rem; margin-top: 1.5rem; }

/* ===== Footer ===== */
.site-footer { background: var(--brand); color: #cdd8e4; padding: 2rem 0 2.4rem; margin-top: 3rem; font-size: .92rem; }
.site-footer a { color: #fff; }
.footer-warning { color: #fff; }
.footer-nav { list-style: none; display: flex; flex-wrap: wrap; gap: 1rem 1.5rem; padding: 0; margin: 1rem 0; }
.footer-nav a { text-decoration: none; color: #cdd8e4; }
.footer-nav a:hover { color: #fff; text-decoration: underline; }
.footer-note, .footer-copy { color: #91a2b5; font-size: .85rem; }

/* ===== Mobile nav ===== */
@media (max-width: 780px) {
  .nav-toggle { display: flex; }
  .primary-nav {
    position: absolute; left: 0; right: 0; top: 100%;
    background: #fff; border-bottom: 1px solid var(--line);
    display: none; padding: .6rem 1.1rem 1rem;
  }
  .primary-nav.open { display: block; }
  .primary-nav ul { flex-direction: column; gap: 0; }
  .primary-nav li { border-bottom: 1px solid var(--line); }
  .primary-nav a { display: block; padding: .8rem .2rem; }
  .nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
  .toc ol { columns: 1; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
