/* BreakLine Wiki theme. Dark by default, light via prefers-color-scheme or the toggle.
   Solid, high-contrast text only: no gradient or translucent text. */
:root {
  color-scheme: dark;
  --bg: #0d1117;
  --surface: #151b23;
  --surface-2: #1c2430;
  --border: #2d3846;
  --text: #e9edf2;
  --muted: #b4beca;
  --link: #3ee6e6;
  --link-hover: #8ff3f3;
  --accent: #ffc21a;
  --accent-text: #ffc21a;
  --on-accent: #16120a;
  --code-bg: #1a222d;
  --note: #3ee6e6;
  --tip: #5fd38d;
  --warning: #ffc21a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  --header-h: 64px;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #f6f7f9;
    --surface: #ffffff;
    --surface-2: #edf0f4;
    --border: #cfd6df;
    --text: #10151c;
    --muted: #46505d;
    --link: #006a74;
    --link-hover: #004a51;
    --accent: #ffc21a;
    --accent-text: #7a5600;
    --on-accent: #16120a;
    --code-bg: #eef1f5;
    --note: #00808c;
    --tip: #1f8a4c;
    --warning: #b07c00;
    --shadow: 0 1px 2px rgba(16, 21, 28, .12);
  }
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #edf0f4;
  --border: #cfd6df;
  --text: #10151c;
  --muted: #46505d;
  --link: #006a74;
  --link-hover: #004a51;
  --accent: #ffc21a;
  --accent-text: #7a5600;
  --on-accent: #16120a;
  --code-bg: #eef1f5;
  --note: #00808c;
  --tip: #1f8a4c;
  --warning: #b07c00;
  --shadow: 0 1px 2px rgba(16, 21, 28, .12);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 12px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  font-size: 1.0625rem;
  line-height: 1.65;
}
img { max-width: 100%; height: auto; }
a { color: var(--link); text-underline-offset: .18em; }
a:hover { color: var(--link-hover); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
.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;
}
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--accent); color: var(--on-accent); padding: 8px 14px; border-radius: 6px;
  font-weight: 700; text-decoration: none;
}
.skip-link:focus { top: 12px; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: var(--shadow);
}
.header-inner {
  max-width: 1440px; margin: 0 auto; min-height: var(--header-h);
  display: flex; align-items: center; gap: 12px; padding: 8px 16px; flex-wrap: wrap;
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.brand:hover { color: var(--text); }
.brand img { border-radius: 8px; display: block; }
.brand-name { font-size: 1.2rem; font-weight: 800; letter-spacing: .01em; white-space: nowrap; }
.badge {
  display: inline-block; background: var(--accent); color: var(--on-accent);
  font-size: .75rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em;
  padding: 3px 9px; border-radius: 999px; white-space: nowrap;
}
.search { position: relative; margin-left: auto; flex: 0 1 340px; }
.search input {
  width: 100%; font: inherit; font-size: .95rem; color: var(--text);
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px;
}
.search input::placeholder { color: var(--muted); opacity: 1; }
.search-results {
  position: absolute; right: 0; top: calc(100% + 6px); width: min(480px, calc(100vw - 32px));
  max-height: 70vh; overflow-y: auto; z-index: 60;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
  padding: 6px;
}
.search-hit { display: block; padding: 8px 10px; border-radius: 8px; text-decoration: none; color: var(--text); }
.search-hit:hover, .search-hit.active, .search-hit:focus { background: var(--surface-2); color: var(--text); }
.search-hit-title { display: block; font-weight: 700; color: var(--link); }
.search-hit-section { display: inline-block; font-size: .78rem; font-weight: 700; color: var(--accent-text); text-transform: uppercase; letter-spacing: .05em; }
.search-hit-excerpt { display: block; font-size: .9rem; color: var(--muted); line-height: 1.45; }
.search-empty { margin: 8px 10px; color: var(--muted); }
.theme-toggle, .menu-button {
  font: inherit; font-size: .9rem; font-weight: 600; color: var(--text); text-decoration: none;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 7px 12px; cursor: pointer;
  white-space: nowrap;
}
.theme-toggle:hover, .menu-button:hover { border-color: var(--link); color: var(--text); }
.menu-button { display: none; }

/* Layout */
.layout {
  max-width: 1440px; margin: 0 auto; padding: 0 16px;
  display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 40px;
}
.layout.has-toc { grid-template-columns: 250px minmax(0, 1fr) 220px; }
.sidebar {
  position: sticky; top: var(--header-h); align-self: start;
  max-height: calc(100vh - var(--header-h)); overflow-y: auto; padding: 24px 4px 32px 0;
}
.nav-home { margin: 0 0 12px; }
.nav-group { margin-bottom: 18px; }
.nav-heading {
  margin: 0 0 6px; font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--accent-text);
}
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar a, .nav-home a {
  display: block; padding: 5px 10px; border-radius: 6px; color: var(--text); text-decoration: none;
  font-size: .95rem; line-height: 1.4; border-left: 3px solid transparent;
}
.sidebar a:hover { background: var(--surface-2); color: var(--text); }
.sidebar a[aria-current="page"] {
  background: var(--surface-2); border-left-color: var(--accent); font-weight: 700;
}
.page { min-width: 0; padding: 20px 0 56px; outline: none; }
.page article { max-width: 760px; }
.page-home article { max-width: 980px; }
.toc-side { position: sticky; top: var(--header-h); align-self: start; padding: 28px 0; max-height: calc(100vh - var(--header-h)); overflow-y: auto; }
.toc-inline { display: none; }
.toc-title { font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--accent-text); margin: 0 0 8px; }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--border); }
.toc li a { display: block; padding: 3px 0 3px 12px; font-size: .9rem; line-height: 1.4; color: var(--muted); text-decoration: none; }
.toc li a:hover { color: var(--link); }
.toc li.toc-sub a { padding-left: 24px; font-size: .86rem; }

/* Breadcrumb and page header */
.breadcrumb ol { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; font-size: .9rem; color: var(--muted); }
.breadcrumb li + li::before { content: "/"; margin-right: 4px; color: var(--muted); }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--link); }
.breadcrumb [aria-current] { color: var(--text); }
.page-header { margin-bottom: 20px; }
.page-header h1 { font-size: clamp(1.9rem, 4vw, 2.5rem); line-height: 1.2; margin: 0 0 8px; font-weight: 800; }
.lead { font-size: 1.2rem; color: var(--text); margin: 0 0 8px; }
.updated { margin: 0; font-size: .88rem; color: var(--muted); }
.hero-logo { display: block; margin-bottom: 12px; border-radius: 16px; }
.page-home .page-header { padding: 12px 0 8px; }

/* Content */
.content > :first-child { margin-top: 0; }
.content h2, .content h3, .content h4 { line-height: 1.3; font-weight: 750; position: relative; }
.content h2 { font-size: 1.55rem; margin: 2.2em 0 .6em; padding-bottom: .3em; border-bottom: 1px solid var(--border); }
.content h3 { font-size: 1.25rem; margin: 1.8em 0 .5em; }
.content h4 { font-size: 1.05rem; margin: 1.5em 0 .4em; }
.anchor { margin-left: .4em; color: var(--muted); text-decoration: none; font-weight: 400; opacity: 0; }
h2:hover .anchor, h3:hover .anchor, h4:hover .anchor, .anchor:focus { opacity: 1; }
.content p, .content ul, .content ol, .content blockquote, .content figure, .content pre, .table-wrap, .callout { margin: 0 0 1.1em; }
.content ul, .content ol { padding-left: 1.5em; }
.content li { margin: .25em 0; }
.content li > ul, .content li > ol { margin: .25em 0; }
.content strong { font-weight: 750; }
code {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace; font-size: .9em;
  background: var(--code-bg); border: 1px solid var(--border); border-radius: 5px; padding: .08em .35em;
  overflow-wrap: anywhere;
}
pre {
  background: var(--code-bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 14px 16px; overflow-x: auto; line-height: 1.5;
}
pre code { background: none; border: 0; padding: 0; font-size: .9rem; overflow-wrap: normal; }
blockquote { border-left: 4px solid var(--border); margin-left: 0; padding: 2px 0 2px 16px; color: var(--text); }
blockquote > :last-child, .callout > :last-child { margin-bottom: 0; }
.callout {
  background: var(--surface); border: 1px solid var(--border); border-left: 5px solid var(--note);
  border-radius: 8px; padding: 12px 16px;
}
.callout-title { margin: 0 0 4px !important; font-weight: 800; font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text); }
.callout-tip { border-left-color: var(--tip); }
.callout-warning { border-left-color: var(--warning); }
.callout-note .callout-title::before, .callout-tip .callout-title::before, .callout-warning .callout-title::before {
  display: inline-block; width: 1.2em; font-weight: 800;
}
.callout-note .callout-title::before { content: "i"; color: var(--note); }
.callout-tip .callout-title::before { content: "+"; color: var(--tip); }
.callout-warning .callout-title::before { content: "!"; color: var(--warning); }
hr { border: 0; border-top: 1px solid var(--border); margin: 2em 0; }
figure { margin-left: 0; margin-right: 0; }
figure img { display: block; border-radius: 8px; border: 1px solid var(--border); }
figcaption { font-size: .9rem; color: var(--muted); margin-top: 6px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { padding: 8px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { background: var(--surface-2); font-weight: 750; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }

/* Cards */
.cards-section { margin: 28px 0 32px; }
.cards-heading { font-size: 1.3rem; margin: 0 0 12px; }
.cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.page-home .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 560px) { .page-home .cards { grid-template-columns: minmax(0, 1fr); } }
.card a {
  display: flex; flex-direction: column; gap: 6px; height: 100%;
  background: var(--surface); border: 1px solid var(--border); border-top: 4px solid var(--accent);
  border-radius: 10px; padding: 16px 18px; text-decoration: none; color: var(--text); box-shadow: var(--shadow);
}
.page-home .card a { padding: 22px 20px; }
.card a:hover { border-color: var(--link); border-top-color: var(--accent); color: var(--text); }
.card-title { font-weight: 800; font-size: 1.1rem; color: var(--link); }
.page-home .card-title { font-size: 1.3rem; }
.card-desc { color: var(--muted); font-size: .95rem; line-height: 1.5; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); margin-top: 24px; }
.footer-inner { max-width: 1440px; margin: 0 auto; padding: 20px 16px 28px; font-size: .92rem; color: var(--muted); }
.footer-inner p { margin: 4px 0; }
.footer-meta { font-size: .85rem; }

/* Responsive */
@media (max-width: 1200px) {
  .layout.has-toc { grid-template-columns: 230px minmax(0, 1fr); }
  .toc-side { display: none; }
  .toc-inline { display: block; margin: 0 0 24px; padding: 12px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
}
@media (max-width: 900px) {
  :root { --header-h: 112px; }
  .header-inner {
    display: grid; gap: 8px; align-items: center;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "menu brand badge" "search search toggle";
  }
  .menu-button { display: inline-block; grid-area: menu; }
  .brand { grid-area: brand; min-width: 0; }
  .brand-name { font-size: 1rem; overflow: hidden; text-overflow: ellipsis; }
  .brand img { width: 34px; height: 34px; flex: none; }
  .badge { grid-area: badge; }
  .search { grid-area: search; margin-left: 0; }
  .theme-toggle { grid-area: toggle; }
  .js .search[hidden] + .theme-toggle, .search[hidden] + .theme-toggle { grid-column: 1 / -1; justify-self: end; }
  .layout, .layout.has-toc { grid-template-columns: minmax(0, 1fr); gap: 0; }
  /* Without JavaScript the navigation sits below the page; the Menu link jumps to it. */
  .sidebar { position: static; max-height: none; order: 2; border-top: 1px solid var(--border); padding: 20px 0; }
  .js .sidebar { display: none; }
  .js .sidebar.open {
    display: block; position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; top: var(--header-h); align-self: stretch;
    background: var(--bg); padding: 16px; overflow-y: auto; border-top: 0;
  }
  .page { order: 1; padding-top: 16px; }
  body { font-size: 1rem; }
}
@media (max-width: 480px) {
  .header-inner { padding: 8px 12px; gap: 6px 8px; }
  .badge { font-size: .64rem; padding: 2px 6px; letter-spacing: .04em; }
  .brand { gap: 6px; }
  .brand img { width: 30px; height: 30px; }
  .brand-name { font-size: .95rem; }
  .menu-button { padding: 6px 9px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
@media print {
  .site-header, .sidebar, .toc-side, .toc-inline, .site-footer { display: none !important; }
  .layout { display: block; }
}
