/* Better Social Docs - shared stylesheet. No external fonts, no scripts. */

:root {
  --bg: #ffffff;
  --bg-soft: #f6f7fb;
  --surface: #ffffff;
  --border: #e2e6ef;
  --text: #0f172a;
  --muted: #475569;
  --link: #8a5300;
  --link-hover: #5c3700;
  --focus: #b45309;
  --gold: #f2ab36;
  --gold-light: #fbd57a;
  --gold-dark: #dc8f1c;
  --navy: #0a1020;
  --navy-2: #14203a;
  --header-bg: #0a1020;
  --header-text: #ffffff;
  --header-muted: #c8d0e0;
  --code-bg: #f1f3f8;
  --code-text: #0f172a;
  --pre-bg: #0a1020;
  --pre-text: #e8ecf4;
  --nav-active-bg: #fff4dc;
  --nav-active-text: #5c3700;
  --info-bg: #eef3ff;
  --info-border: #3b5bdb;
  --info-title: #1e3a8a;
  --warn-bg: #fff7e6;
  --warn-border: #dc8f1c;
  --warn-title: #7a4a00;
  --ok-bg: #ecfdf3;
  --ok-border: #22a559;
  --ok-title: #14532d;
  --danger-bg: #fff4ec;
  --danger-border: #ea580c;
  --danger-title: #9a3412;
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a1020;
    --bg-soft: #0d1528;
    --surface: #14203a;
    --border: #24324f;
    --text: #e8ecf4;
    --muted: #a9b3c7;
    --link: #fbd57a;
    --link-hover: #ffe7a8;
    --focus: #fbd57a;
    --header-bg: #070c18;
    --code-bg: #14203a;
    --code-text: #e8ecf4;
    --pre-bg: #060b16;
    --nav-active-bg: #1d2a47;
    --nav-active-text: #fbd57a;
    --info-bg: #13233f;
    --info-border: #6b8cff;
    --info-title: #cfe0ff;
    --warn-bg: #2a2110;
    --warn-border: #f2ab36;
    --warn-title: #ffe2a8;
    --ok-bg: #0f2a1d;
    --ok-border: #3ccf7c;
    --ok-title: #bff0cf;
    --danger-bg: #2e1a12;
    --danger-border: #fb8a4c;
    --danger-title: #ffd2bf;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 80px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.7;
  overflow-wrap: break-word;
}

img, svg { max-width: 100%; height: auto; }

a { color: var(--link); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--link-hover); text-decoration-thickness: 2px; }

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

.skip-link {
  position: absolute; left: 8px; top: -60px; z-index: 100;
  background: var(--gold); color: var(--navy); padding: 10px 16px; border-radius: 8px;
  font-weight: 700; text-decoration: none;
}
.skip-link:focus { top: 8px; color: var(--navy); }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--header-bg); color: var(--header-text);
  border-bottom: 2px solid var(--gold);
}
.header-inner {
  max-width: 1440px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--header-text); text-decoration: none; font-weight: 700; font-size: 1.05rem; }
.brand:hover { color: var(--gold-light); text-decoration: none; }
.brand img { width: 34px; height: 34px; }
.brand .brand-docs { color: var(--gold-light); font-weight: 600; }
.header-links { margin-left: auto; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.header-links a { color: var(--header-muted); text-decoration: none; padding: 6px 10px; border-radius: 6px; font-size: 0.95rem; }
.header-links a:hover { color: #ffffff; background: rgba(255,255,255,0.08); }
.header-links a.btn-gold { background: var(--gold); color: var(--navy); font-weight: 700; }
.header-links a.btn-gold:hover { background: var(--gold-light); color: var(--navy); }
.header-links a:focus-visible, .brand:focus-visible { outline-color: var(--gold-light); }

/* Language switcher (plain links, no JS) */
.lang-switcher ul { list-style: none; margin: 0; padding: 2px; display: flex; gap: 2px; border: 1px solid rgba(255,255,255,0.22); border-radius: 8px; }
.lang-switcher a {
  display: block; min-width: 2.4em; padding: 4px 8px; border-radius: 6px; text-align: center;
  color: var(--header-muted); text-decoration: none; font-size: 0.85rem; font-weight: 700; letter-spacing: 0.04em;
}
.lang-switcher a:hover { color: #ffffff; background: rgba(255,255,255,0.10); }
.lang-switcher a[aria-current="true"] { background: var(--gold-light); color: var(--navy); }
.lang-switcher a:focus-visible { outline-color: var(--gold-light); }
@media (max-width: 599px) {
  .header-links { margin-left: 0; order: 3; width: 100%; }
  .lang-switcher { margin-left: auto; }
}
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Layout ---------- */
.layout {
  max-width: 1440px; margin: 0 auto; padding: 0 16px;
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 0;
}
.sidebar { display: none; }
.toc { display: none; }
.content { min-width: 0; padding: 20px 0 48px; }
.article { max-width: 760px; margin: 0 auto; }

/* Mobile menu (details/summary, no JS) */
.mobile-nav { margin: 14px 0 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-soft); }
.mobile-nav > summary {
  cursor: pointer; list-style: none; padding: 12px 16px; font-weight: 700;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.mobile-nav > summary::-webkit-details-marker { display: none; }
.mobile-nav > summary::after { content: "+"; font-size: 1.3rem; line-height: 1; color: var(--muted); }
.mobile-nav[open] > summary::after { content: "\2212"; }
.mobile-nav .nav-tree { padding: 0 16px 14px; }

@media (min-width: 900px) {
  .layout { grid-template-columns: 250px minmax(0, 1fr); gap: 40px; padding: 0 24px; }
  .mobile-nav { display: none; }
  .sidebar {
    display: block; position: sticky; top: 64px; align-self: start;
    max-height: calc(100vh - 64px); overflow-y: auto; padding: 24px 4px 32px 0;
    border-right: 1px solid var(--border);
  }
  .content { padding-top: 24px; }
}
@media (min-width: 1240px) {
  .layout { grid-template-columns: 250px minmax(0, 1fr) 220px; }
  .toc {
    display: block; position: sticky; top: 64px; align-self: start;
    max-height: calc(100vh - 64px); overflow-y: auto; padding: 28px 0 32px;
    font-size: 0.875rem;
  }
}

/* ---------- Navigation tree ---------- */
.nav-tree h2 {
  font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); margin: 18px 0 6px; font-weight: 700;
}
.nav-tree h2:first-child { margin-top: 4px; }
.nav-tree ul { list-style: none; margin: 0; padding: 0; }
.nav-tree a {
  display: block; padding: 5px 10px; margin: 1px 0; border-radius: 6px;
  color: var(--text); text-decoration: none; font-size: 0.95rem; line-height: 1.45;
}
.nav-tree a:hover { background: var(--bg-soft); color: var(--link-hover); }
.nav-tree a[aria-current="page"] { background: var(--nav-active-bg); color: var(--nav-active-text); font-weight: 700; box-shadow: inset 3px 0 0 var(--gold-dark); }

/* ---------- TOC ---------- */
.toc .toc-title { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 700; margin: 0 0 8px; }
.toc ul { list-style: none; margin: 0; padding: 0 0 0 12px; border-left: 1px solid var(--border); }
.toc li { margin: 4px 0; }
.toc a { color: var(--muted); text-decoration: none; display: block; line-height: 1.4; padding: 2px 0; }
.toc a:hover { color: var(--link-hover); text-decoration: underline; }

/* ---------- Breadcrumb ---------- */
.breadcrumb ol { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; font-size: 0.875rem; color: var(--muted); }
.breadcrumb li + li::before { content: "/"; margin: 0 6px 0 2px; color: var(--muted); }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--link-hover); }

/* ---------- Typography ---------- */
.article h1 { font-size: clamp(1.8rem, 1.4rem + 1.6vw, 2.4rem); line-height: 1.2; margin: 0 0 10px; letter-spacing: -0.01em; }
.article h2 { font-size: 1.45rem; line-height: 1.3; margin: 44px 0 12px; padding-top: 8px; border-top: 1px solid var(--border); }
.article h3 { font-size: 1.13rem; line-height: 1.4; margin: 28px 0 8px; }
.article p, .article ul, .article ol, .article dl { margin: 0 0 16px; }
.article ul, .article ol { padding-left: 1.4rem; }
.article li { margin: 4px 0; }
.article li > ul, .article li > ol { margin: 4px 0; }
.lead { font-size: 1.15rem; color: var(--muted); margin: 0 0 12px; }
.updated { font-size: 0.875rem; color: var(--muted); margin: 0 0 8px; }
.updated strong { color: var(--text); }
.anchor { color: inherit; text-decoration: none; }
.anchor:hover { color: var(--link-hover); text-decoration: underline; }
hr { border: 0; border-top: 1px solid var(--border); margin: 32px 0; }
strong { font-weight: 700; }

code, kbd, samp {
  font-family: var(--mono); font-size: 0.9em;
  background: var(--code-bg); color: var(--code-text);
  padding: 0.1em 0.35em; border-radius: 5px; border: 1px solid var(--border);
  overflow-wrap: anywhere;
}
pre {
  margin: 0 0 18px; padding: 14px 16px; overflow-x: auto;
  background: var(--pre-bg); color: var(--pre-text);
  border-radius: var(--radius); border: 1px solid var(--border);
  font-size: 0.875rem; line-height: 1.55; max-width: 100%;
}
pre code { background: none; border: 0; padding: 0; color: inherit; font-size: inherit; overflow-wrap: normal; white-space: pre; }
.code-label { font-size: 0.8rem; font-weight: 700; color: var(--muted); margin: 0 0 6px; text-transform: uppercase; letter-spacing: 0.05em; }

/* Tables */
.table-wrap { overflow-x: auto; margin: 0 0 20px; border: 1px solid var(--border); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
th, td { text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 1px solid var(--border); }
th { background: var(--bg-soft); font-weight: 700; }
tr:last-child td { border-bottom: 0; }

/* Steps */
ol.steps { counter-reset: step; list-style: none; padding-left: 0; }
ol.steps > li { counter-increment: step; position: relative; padding-left: 44px; margin: 0 0 14px; }
ol.steps > li::before {
  content: counter(step); position: absolute; left: 0; top: 0;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--gold); color: var(--navy); font-weight: 800;
  display: flex; align-items: center; justify-content: center; font-size: 0.9rem;
}

/* Callouts */
.callout {
  border: 1px solid var(--border); border-left: 4px solid var(--info-border);
  background: var(--info-bg); border-radius: var(--radius);
  padding: 14px 16px; margin: 0 0 20px;
}
.callout > :last-child { margin-bottom: 0; }
.callout-title { font-weight: 800; margin: 0 0 4px; color: var(--info-title); }
.callout.warning { background: var(--warn-bg); border-left-color: var(--warn-border); }
.callout.warning .callout-title { color: var(--warn-title); }
.callout.success { background: var(--ok-bg); border-left-color: var(--ok-border); }
.callout.success .callout-title { color: var(--ok-title); }
.callout.danger { background: var(--danger-bg); border-left-color: var(--danger-border); }
.callout.danger .callout-title { color: var(--danger-title); }

/* Key facts */
.facts { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; margin: 20px 0 24px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--bg-soft); }
.facts h2 { margin: 0; padding: 12px 16px; border: 0; font-size: 1rem; background: var(--navy); color: #ffffff; }
.facts dl { margin: 0; display: grid; grid-template-columns: minmax(0, 1fr); }
.facts dl > div { padding: 12px 16px; border-top: 1px solid var(--border); }
.facts dt { font-weight: 800; }
.facts dd { margin: 2px 0 0; color: var(--muted); }
@media (min-width: 640px) {
  .facts dl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .facts dl > div:nth-child(odd) { border-right: 1px solid var(--border); }
}

/* Cards */
.cards { list-style: none; padding: 0 !important; margin: 0 0 20px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
@media (min-width: 640px) { .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.cards li { margin: 0; }
.cards a {
  display: block; height: 100%; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text); text-decoration: none;
}
.cards a:hover { border-color: var(--gold-dark); box-shadow: 0 2px 10px rgba(10, 16, 32, 0.08); }
.cards .card-title { display: block; font-weight: 800; color: var(--link); }
.cards .card-text { display: block; font-size: 0.93rem; color: var(--muted); margin-top: 2px; }

/* FAQ */
.faq-item { border: 1px solid var(--border); border-radius: var(--radius); margin: 0 0 12px; background: var(--surface); }
.faq-item h3 { margin: 0; font-size: 1.05rem; padding: 14px 16px 0; }
.faq-item .faq-answer { padding: 6px 16px 14px; }
.faq-item .faq-answer > :last-child { margin-bottom: 0; }

/* Prev / next */
.pager { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; margin: 48px 0 0; padding-top: 24px; border-top: 1px solid var(--border); }
@media (min-width: 640px) { .pager { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.pager a { display: block; padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; color: var(--text); }
.pager a:hover { border-color: var(--gold-dark); }
.pager .pager-label { display: block; font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.pager .pager-title { display: block; font-weight: 800; color: var(--link); }
.pager .next { text-align: right; }
@media (min-width: 640px) { .pager .next:only-child { grid-column: 2; } }

/* ---------- Footer ---------- */
.site-footer { background: var(--navy); color: #c8d0e0; margin-top: 24px; border-top: 2px solid var(--gold); }
.footer-inner { max-width: 1440px; margin: 0 auto; padding: 28px 16px; font-size: 0.93rem; }
.footer-inner nav ul { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.site-footer a { color: #fbd57a; }
.site-footer a:hover { color: #ffffff; }
.site-footer a:focus-visible { outline-color: #fbd57a; }
.site-footer p { margin: 0 0 8px; }
.footer-small { font-size: 0.85rem; color: #a9b3c7; }

/* 404 */
.notfound { text-align: left; padding-top: 24px; }
.notfound .code404 { font-size: 3.5rem; font-weight: 800; color: var(--gold-dark); line-height: 1; margin: 0 0 8px; }

@media print {
  .site-header, .sidebar, .toc, .mobile-nav, .pager, .skip-link { display: none !important; }
  .layout { display: block; }
  a { color: inherit; }
}
