@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg: #f7f8fb;
  --surface: #ffffff;
  --line: #e2e7f0;
  --line-soft: #eef1f7;
  --ink: #0c1119;
  --ink-2: #3f4854;
  --ink-3: #5d6c8a;
  --brand: #284dcc;
  --brand-dark: #1f3ea8;
  --brand-soft: #eef2fe;
  --lime: #d8f35b;
  --nav-bg: rgba(12, 17, 25, 0.88);
  --nav-h: 64px;
  --tab-h: 62px;
  --radius: 10px;
  --font-heading: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink-2);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.7;
  padding-top: var(--nav-h);
  padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 28px);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  color: var(--ink);
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0 0 12px;
}

a { color: var(--brand); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--brand-dark); }

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

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 200;
  background: #fff;
  color: var(--ink);
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  transition: top .18s ease;
}
.skip-link:focus { top: 10px; }

/* ---------------- top navigation ---------------- */
.site-nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 90;
  height: var(--nav-h);
  background: #0c1119;
  background: var(--nav-bg);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  backdrop-filter: blur(16px) saturate(140%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 6px 24px rgba(8, 12, 20, 0.28);
  color: #f5f6f8;
}

.nav-inner {
  max-width: 1180px;
  margin: 0 auto;
  height: 100%;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -0.03em;
  color: #fff;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.brand:hover { color: #fff; }
.brand i { color: var(--lime); font-size: 18px; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.nav-link,
.nav-drop-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: rgba(245, 246, 248, 0.82);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background .16s ease, color .16s ease;
}
.nav-link:hover,
.nav-drop-btn:hover,
.nav-link:focus-visible,
.nav-drop-btn:focus-visible {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}
.nav-drop-btn[aria-expanded="true"] { background: rgba(255, 255, 255, 0.16); color: #fff; }

.nav-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  border: 1px solid rgba(255,255,255,.16);
}
.nav-cta:hover { background: var(--brand-dark); color: #fff; }

.nav-drop { position: relative; }

.nav-panel {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  width: 440px;
  max-height: min(70vh, 560px);
  overflow: auto;
  padding: 12px;
  border-radius: 12px;
  background: rgba(12, 17, 25, 0.97);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 18px 50px rgba(6, 10, 18, 0.45);
  display: none;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}
.nav-panel[data-open="true"] { display: grid; }
.nav-panel a {
  display: block;
  padding: 9px 10px;
  border-radius: 8px;
  color: rgba(245, 246, 248, 0.86);
  font-size: 13.5px;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-panel a:hover,
.nav-panel a:focus-visible { background: rgba(255, 255, 255, 0.14); color: #fff; }

.nav-toggle {
  display: none;
  margin-left: auto;
  width: 42px;
  height: 42px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
}

/* ---------------- layout ---------------- */
.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px 20px 8px;
}

.crumbs {
  font-size: 13px;
  color: var(--ink-3);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
}
.crumbs a { color: var(--ink-3); text-decoration: none; }
.crumbs a:hover { color: var(--brand); text-decoration: underline; }
.crumbs span[aria-hidden="true"] { opacity: .55; }

.article-head {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px 28px;
  margin-bottom: 20px;
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--brand);
  background: var(--brand-soft);
  border: 1px solid #d7e0fb;
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 14px;
}
.article-head h1 {
  font-size: clamp(26px, 3.1vw, 40px);
  margin-bottom: 12px;
}
.lede {
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink-2);
  margin: 0;
  max-width: 68ch;
}
.head-meta {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  font-size: 12.5px;
  color: var(--ink-3);
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 760px) 300px;
  gap: 28px;
  align-items: start;
}

.article-body {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 30px 32px 34px;
  font-size: 16.5px;
  line-height: 1.78;
  color: #333a46;
}
.article-body h2 {
  font-size: 23px;
  margin: 34px 0 12px;
  padding-top: 6px;
}
.article-body h2:first-of-type { margin-top: 8px; }
.article-body h3 { font-size: 17.5px; margin: 22px 0 8px; }
.article-body p { margin: 0 0 14px; }
.article-body ul, .article-body ol { margin: 0 0 16px; padding-left: 20px; }
.article-body li { margin-bottom: 8px; }
.article-body strong { color: var(--ink); }
.article-body a { color: var(--brand); }

.toc {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin: 0 0 24px;
}
.toc h2 {
  font-size: 13px !important;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-3) !important;
  margin: 0 0 10px !important;
  font-family: var(--font-body);
  padding: 0 !important;
}
.toc ol { margin: 0; padding-left: 18px; font-size: 14.5px; }
.toc li { margin-bottom: 6px; }
.toc a { text-decoration: none; color: var(--ink-2); }
.toc a:hover { color: var(--brand); text-decoration: underline; }

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 8px 0 18px;
  -webkit-overflow-scrolling: touch;
}
table {
  border-collapse: collapse;
  width: 100%;
  min-width: 520px;
  font-size: 14px;
  background: #fff;
}
caption {
  caption-side: bottom;
  padding: 8px 10px 0;
  font-size: 12.5px;
  color: var(--ink-3);
  text-align: left;
}
th, td {
  border-bottom: 1px solid var(--line-soft);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
  line-height: 1.55;
}
th {
  background: #f2f5fb;
  color: var(--ink);
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
}
tbody tr:last-child td { border-bottom: 0; }

.checklist {
  list-style: none;
  padding: 0;
  margin: 0 0 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.checklist li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 14px;
  margin: 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 15px;
  background: #fff;
}
.checklist li:last-child { border-bottom: 0; }
.checklist li::before {
  content: "\ea6e";
  font-family: "remixicon";
  color: var(--brand);
  font-size: 16px;
  line-height: 1.5;
  flex: none;
}

.callout {
  border-left: 3px solid var(--brand);
  background: var(--brand-soft);
  border-radius: 0 8px 8px 0;
  padding: 14px 16px;
  margin: 0 0 18px;
  font-size: 14.5px;
  line-height: 1.65;
  color: #253252;
}
.callout strong { color: #16224a; }
.callout.is-warn {
  border-left-color: var(--lime);
  background: #f8fce6;
  color: #33381f;
}

.steps { counter-reset: s; list-style: none; padding: 0; margin: 0 0 18px; }
.steps li {
  position: relative;
  padding-left: 40px;
  margin-bottom: 14px;
}
.steps li::before {
  counter-increment: s;
  content: counter(s);
  position: absolute;
  left: 0;
  top: 1px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------------- sidebar ---------------- */
.side {
  position: sticky;
  top: calc(var(--nav-h) + 20px);
  display: grid;
  gap: 14px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
.card h2 {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--ink-3);
  margin: 0 0 10px;
  font-family: var(--font-body);
  font-weight: 600;
}
.card p { margin: 0 0 12px; font-size: 14px; line-height: 1.6; }
.card--dark {
  background: var(--ink);
  border-color: var(--ink);
  color: rgba(245, 246, 248, 0.78);
}
.card--dark h2 { color: rgba(245, 246, 248, 0.6); }
.card--dark p { color: rgba(245, 246, 248, 0.8); }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  white-space: nowrap;
  width: 100%;
}
.btn:hover { background: var(--brand-dark); color: #fff; }
.btn--lime {
  background: var(--lime);
  color: #16240a;
}
.btn--lime:hover { background: #c6e33c; color: #16240a; }
.card--dark .btn--lime { margin-bottom: 8px; }

.side-list { display: grid; gap: 6px; }
.side-list a {
  display: block;
  font-size: 14px;
  color: var(--ink-2);
  text-decoration: none;
  padding: 7px 9px;
  border-radius: 6px;
  border: 1px solid transparent;
  line-height: 1.45;
}
.side-list a:hover { background: var(--brand-soft); border-color: #d7e0fb; color: var(--brand); }

/* ---------------- related / footer ---------------- */
.related {
  margin-top: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 26px;
}
.related h2 { font-size: 19px; margin-bottom: 4px; }
.related p.sub { margin: 0 0 16px; font-size: 14px; color: var(--ink-3); }
.related-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.related-card {
  display: block;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-decoration: none;
  background: var(--bg);
  transition: border-color .16s ease, background .16s ease;
}
.related-card:hover { border-color: var(--brand); background: var(--brand-soft); }
.related-card span {
  display: block;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-3);
  margin-bottom: 6px;
}
.related-card strong {
  font-family: var(--font-heading);
  font-size: 15px;
  color: var(--ink);
  line-height: 1.35;
  display: block;
}

.backhome {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-radius: var(--radius);
  background: var(--brand-soft);
  border: 1px solid #d7e0fb;
  font-size: 14.5px;
}
.backhome a {
  font-weight: 600;
  text-decoration: none;
  color: var(--brand);
}
.backhome a:hover { text-decoration: underline; }

.site-footer {
  background: #eef1f7;
  border-top: 1px solid var(--line);
  margin-top: 34px;
  padding: 30px 20px 26px;
}
.footer-inner {
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 24px;
}
.site-footer h2 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink-3);
  font-family: var(--font-body);
  margin: 0 0 10px;
}
.site-footer p { margin: 0 0 10px; font-size: 13.5px; line-height: 1.65; color: var(--ink-2); }
.footer-links { display: grid; gap: 7px; }
.footer-links a { font-size: 13.5px; color: var(--ink-2); text-decoration: none; }
.footer-links a:hover { color: var(--brand); text-decoration: underline; }
.footer-bottom {
  max-width: 1180px;
  margin: 22px auto 0;
  padding-top: 14px;
  border-top: 1px solid #dfe5ef;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--ink-3);
}

/* ---------------- mobile tabbar + sheet ---------------- */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 95;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: #0c1119;
  background: rgba(12, 17, 25, 0.94);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  padding-bottom: env(safe-area-inset-bottom);
  height: calc(var(--tab-h) + env(safe-area-inset-bottom));
}
.tabbar-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 44px;
  background: transparent;
  border: 0;
  color: rgba(245, 246, 248, 0.74);
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}
.tabbar-btn i { font-size: 19px; line-height: 1; }
.tabbar-btn:hover, .tabbar-btn:focus-visible { color: #fff; background: rgba(255,255,255,.08); }

.scrim {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(9, 13, 20, 0.55);
  opacity: 0;
  transition: opacity .2s ease;
}
.scrim[data-open="true"] { opacity: 1; }
.scrim[hidden] { display: none; }

.sheet {
  position: fixed;
  z-index: 130;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 85dvh;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border-radius: 18px 18px 0 0;
  border-top: 1px solid var(--line);
  box-shadow: 0 -18px 48px rgba(9, 13, 20, 0.3);
  transform: translateY(101%);
  transition: transform .24s ease;
  padding-bottom: env(safe-area-inset-bottom);
}
.sheet[data-open="true"] { transform: translateY(0); }
.sheet[hidden] { display: none; }
.sheet-grab {
  width: 44px;
  height: 4px;
  border-radius: 999px;
  background: #cfd6e3;
  margin: 10px auto 0;
  flex: none;
}
.sheet-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px 12px;
  border-bottom: 1px solid var(--line-soft);
  flex: none;
}
.sheet-head h2 { font-size: 17px; margin: 0; }
.sheet-close {
  margin-left: auto;
  flex: none;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  font-size: 20px;
  cursor: pointer;
}
.sheet-close:hover { background: var(--brand-soft); border-color: #d7e0fb; color: var(--brand); }
.sheet-body {
  overflow-y: auto;
  padding: 12px 18px 22px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.sheet-section + .sheet-section { margin-top: 14px; }
.sheet-section h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink-3);
  font-family: var(--font-body);
  margin: 10px 0 8px;
}
.sheet-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.sheet-grid a {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--line-soft);
  background: var(--bg);
  color: var(--ink-2);
  font-size: 13.5px;
  text-decoration: none;
  line-height: 1.3;
}
.sheet-grid a:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.sheet-grid a i { color: var(--brand); flex: none; font-size: 16px; }
.sheet-list { display: grid; gap: 2px; }
.sheet-list a {
  display: block;
  padding: 11px 10px;
  border-radius: 8px;
  color: var(--ink-2);
  font-size: 14px;
  text-decoration: none;
  border-bottom: 1px solid var(--line-soft);
  line-height: 1.4;
}
.sheet-list a:hover { color: var(--brand); background: var(--brand-soft); }
.sheet-note { font-size: 12.5px; color: var(--ink-3); margin: 12px 0 0; }

body.is-locked { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .sheet, .scrim, .skip-link { transition: none; }
}

/* ---------------- responsive ---------------- */
@media (min-width: 861px) {
  .tabbar { display: none; }
  body { padding-bottom: 0; }
}

@media (max-width: 1020px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; grid-template-columns: 1fr 1fr; }
}

@media (max-width: 860px) {
  .nav-links { display: none; }
  .nav-toggle { display: inline-flex; }
  .nav-inner { padding: 0 16px; gap: 10px; }
  .page { padding: 16px 16px 8px; }
  .article-head { padding: 20px 18px; }
  .article-body { padding: 22px 18px 26px; font-size: 16px; }
  .layout { gap: 18px; }
  .side { grid-template-columns: 1fr; }
  .related { padding: 18px; }
  .related-grid { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr; gap: 20px; }
  .sheet-grid { grid-template-columns: 1fr; }
  .article-body h2 { font-size: 20px; }
}