/* docs.icemax.net. Colours follow portal.icemax.net. */
:root {
  --bg: #ffffff;
  --bg-soft: #f6f7f9;
  --card: #ffffff;
  --border: #e2e5ea;
  --text: #1b1f24;
  --muted: #5d6878;
  --accent: #2764ff;
  --accent-soft: #e8efff;
  --top-bg: #0b1c2c;
  --top-text: #d5e0ea;
  --top-field: #16324b;
  --internal: #b45309;
  --internal-bg: #fff4e0;
  --add: #0f7a45;   --add-bg: #e4f6ec;
  --del: #b42336;   --del-bg: #fdeaec;
  --radius: 8px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1720; --bg-soft: #131d29; --card: #16212e; --border: #263648; --text: #e6edf3; --muted: #94a5b8;
    --accent: #7ea4ff; --accent-soft: #1b2c4d; --internal: #f5b14c; --internal-bg: #3a2a12;
    --add: #4cd08a; --add-bg: #123424; --del: #ff7a86; --del-bg: #3a1a20;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1720; --bg-soft: #131d29; --card: #16212e; --border: #263648; --text: #e6edf3; --muted: #94a5b8;
  --accent: #7ea4ff; --accent-soft: #1b2c4d; --internal: #f5b14c; --internal-bg: #3a2a12;
  --add: #4cd08a; --add-bg: #123424; --del: #ff7a86; --del-bg: #3a1a20;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.6 var(--sans); }
a { color: var(--accent); text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.muted { color: var(--muted); }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 8px; z-index: 50; background: var(--bg); padding: 8px 12px; }
[hidden] { display: none !important; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 16px;
  height: 60px; padding: 0 20px;
  background: var(--top-bg); color: var(--top-text);
}
html[data-zone="private"] .topbar { box-shadow: inset 0 -3px 0 #f59e0b; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; flex: none; }
.brand img { display: block; height: 26px; width: auto; }
.brand-name { font-weight: 600; font-size: 17px; padding-left: 10px; border-left: 1px solid #2b4a66; }
.zone-badge {
  font-size: 12px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase;
  color: #1b1200; background: #f59e0b; border-radius: 999px; padding: 2px 10px; flex: none;
}
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; flex: none;
  border: 0; border-radius: 8px; background: transparent; color: inherit; cursor: pointer;
}
.icon-btn:hover { background: var(--top-field); }
.menu-btn { display: none; }
.theme-btn .i-sun { display: none; }
:root[data-theme="dark"] .theme-btn .i-sun { display: block; }
:root[data-theme="dark"] .theme-btn .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-btn .i-sun { display: block; }
  :root:not([data-theme="light"]) .theme-btn .i-moon { display: none; }
}
.top-links { margin-left: auto; display: flex; align-items: center; gap: 8px; flex: none; }
.top-links a { color: var(--top-text); text-decoration: none; font-size: 14px; padding: 6px 10px; border-radius: 6px; }
.top-links a:hover { background: var(--top-field); color: #fff; }

/* ---------- search ---------- */
.search { position: relative; flex: 1 1 auto; max-width: 440px; margin-left: 12px; }
.search input {
  width: 100%; height: 38px; padding: 0 36px 0 36px; border-radius: 8px;
  border: 1px solid #23435f; background: var(--top-field); color: #fff; font: inherit; font-size: 15px;
}
.search input::placeholder { color: #8ea6bd; }
.search input:focus { outline: none; border-color: #6f9bff; }
.search-icon { position: absolute; left: 11px; top: 11px; color: #8ea6bd; pointer-events: none; }
.search-key {
  position: absolute; right: 9px; top: 9px; font: 12px var(--mono); color: #8ea6bd;
  border: 1px solid #2b4a66; border-radius: 4px; padding: 0 6px; line-height: 18px;
}
.search-results {
  position: absolute; top: 44px; left: 0; right: 0; margin: 0; padding: 6px; list-style: none;
  background: var(--card); color: var(--text); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .18); max-height: min(70vh, 520px); overflow: auto;
}
.search-results a { display: block; padding: 8px 10px; border-radius: 6px; color: inherit; text-decoration: none; }
.search-results a:hover, .search-results [aria-selected="true"] a { background: var(--accent-soft); }
.sr-title { display: block; font-weight: 600; }
.sr-meta { display: block; font-size: 13px; color: var(--muted); }
.sr-tag { font-size: 11px; font-weight: 600; text-transform: uppercase; color: var(--internal); margin-left: 6px; }
.sr-empty { padding: 10px; color: var(--muted); font-size: 14px; }
mark { background: #ffe58f; color: inherit; border-radius: 2px; }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: 272px minmax(0, 1fr); min-height: calc(100vh - 60px); }
.sidebar {
  position: sticky; top: 60px; height: calc(100vh - 60px); overflow-y: auto;
  padding: 20px 14px 40px; background: var(--bg-soft); border-right: 1px solid var(--border);
}
.nav-home { display: block; padding: 6px 10px; margin-bottom: 8px; border-radius: 6px; color: var(--text); font-weight: 600; text-decoration: none; }
.nav-home.is-active, .nav-home:hover { background: var(--accent-soft); }
.nav-group { margin-top: 14px; }
.nav-heading { margin: 0 0 4px; padding: 0 10px; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar li a { display: block; padding: 5px 10px; border-radius: 6px; color: var(--text); text-decoration: none; font-size: 15px; line-height: 1.4; }
.sidebar li a:hover { background: var(--accent-soft); }
.sidebar li a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-public { margin-top: 22px; border-top: 1px solid var(--border); padding-top: 12px; }
.nav-public summary { cursor: pointer; padding: 4px 10px; font-size: 14px; color: var(--muted); font-weight: 600; }
.scrim { position: fixed; inset: 60px 0 0; background: rgba(0, 0, 0, .4); z-index: 19; }

.main { min-width: 0; padding: 36px 48px 80px; }
.doc-wrap { display: grid; grid-template-columns: minmax(0, 760px) 220px; gap: 48px; }
.doc { max-width: 760px; }
.toc { position: sticky; top: 96px; align-self: start; font-size: 14px; max-height: calc(100vh - 120px); overflow-y: auto; }
.toc-title { margin: 0 0 6px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc ul ul { padding-left: 12px; }
.toc a { display: block; padding: 3px 0 3px 10px; color: var(--muted); text-decoration: none; border-left: 2px solid var(--border); }
.toc a:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- document ---------- */
.doc-head { margin-bottom: 28px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.eyebrow { margin: 0 0 6px; font-size: 13px; font-weight: 600; color: var(--accent); text-transform: uppercase; letter-spacing: .04em; }
.doc h1 { margin: 0; font-size: 34px; line-height: 1.2; letter-spacing: -.01em; }
.lede { margin: 10px 0 0; font-size: 18px; color: var(--muted); }
.meta { display: flex; flex-wrap: wrap; gap: 6px 28px; margin: 16px 0 0; font-size: 14px; }
.meta div { display: flex; gap: 6px; }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; font-weight: 500; }

.prose { font-size: 16px; }
.prose h2 { margin: 2em 0 .6em; font-size: 24px; line-height: 1.3; scroll-margin-top: 80px; }
.prose h3 { margin: 1.6em 0 .5em; font-size: 19px; scroll-margin-top: 80px; }
.prose p, .prose ul, .prose ol, .prose table, .prose pre, .prose blockquote { margin: 0 0 1.1em; }
.prose li + li { margin-top: .3em; }
.prose img { max-width: 100%; height: auto; border-radius: 6px; border: 1px solid var(--border); }
.prose code { font: .9em var(--mono); background: var(--bg-soft); border: 1px solid var(--border); border-radius: 4px; padding: .1em .35em; }
.prose pre { padding: 14px 16px; border-radius: var(--radius); overflow-x: auto; border: 1px solid var(--border); font-size: 14px; line-height: 1.5; }
.prose pre code { background: none; border: 0; padding: 0; font-size: inherit; }
.prose blockquote { padding: 10px 16px; border-left: 4px solid var(--accent); background: var(--accent-soft); border-radius: 0 6px 6px 0; }
.prose blockquote p:last-child { margin-bottom: 0; }
.prose table { display: block; overflow-x: auto; border-collapse: collapse; font-size: 15px; }
.prose th, .prose td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; vertical-align: top; }
.prose th { background: var(--bg-soft); }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 2em 0; }

.doc-foot { margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.doc-foot p { margin: 0; font-size: 14px; }

/* ---------- cards (home pages) ---------- */
.doc-group { margin-top: 36px; }
.doc-group h2 { font-size: 15px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0 0 12px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.card {
  display: flex; flex-direction: column; gap: 4px; padding: 16px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--card); color: var(--text); text-decoration: none; transition: border-color .15s, transform .15s;
}
.card:hover { border-color: var(--accent); transform: translateY(-1px); }
.card-title { font-weight: 600; }
.card-desc { font-size: 14px; color: var(--muted); line-height: 1.45; }

/* ---------- buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--card); color: var(--text); font: inherit; font-size: 15px; font-weight: 500;
  text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { color: #fff; filter: brightness(1.08); }
.btn-ghost { background: transparent; }
.btn[disabled] { opacity: .6; cursor: progress; }

.suggest { max-width: 900px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; font-weight: 500; }
.field small { font-weight: 400; }
.field input, .field textarea {
  width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--card); color: var(--text); font: inherit; font-weight: 400;
}
.field textarea#sg-body { font: 14px/1.55 var(--mono); min-height: 360px; resize: vertical; tab-size: 2; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.turnstile { margin: 4px 0 18px; min-height: 65px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.notice { padding: 12px 16px; border-radius: 8px; background: var(--del-bg); color: var(--del); border: 1px solid currentColor; }
.done { padding: 24px; border: 1px solid var(--add); background: var(--add-bg); border-radius: 10px; }
.done h2 { margin-top: 0; color: var(--add); }

.diff-wrap { margin-top: 28px; }
.diff-wrap h2 { font-size: 18px; margin: 0 0 4px; }
.diff { margin: 8px 0 0; padding: 8px 0; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-soft); font: 13px/1.5 var(--mono); overflow-x: auto; max-height: 480px; }
.diff span { display: block; padding: 0 12px; white-space: pre-wrap; word-break: break-word; }
.diff .add { background: var(--add-bg); color: var(--add); }
.diff .del { background: var(--del-bg); color: var(--del); text-decoration: line-through; text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); }
.diff .gap { color: var(--muted); }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .doc-wrap { grid-template-columns: minmax(0, 1fr); }
  .toc { display: none; }
}
@media (max-width: 900px) {
  .menu-btn { display: inline-grid; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; top: 60px; left: 0; bottom: 0; height: auto; width: min(300px, 86vw); z-index: 20;
    transform: translateX(-100%); transition: transform .2s ease; visibility: hidden;
  }
  body.nav-open .sidebar { transform: none; visibility: visible; }
  .main { padding: 24px 16px 64px; }
  .doc h1 { font-size: 28px; }
  .top-links a { display: none; }
  .field-row { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .topbar { gap: 8px; padding: 0 10px; }
  .brand img { height: 18px; }
  .brand-name { display: none; }
  .search { margin-left: 0; min-width: 0; }
  .search input { padding-right: 10px; }
  .search-key { display: none; }
  .search-results { position: fixed; top: 60px; left: 8px; right: 8px; }
  .top-links { gap: 0; }
  /* The amber line under the bar still marks internal pages. */
  .zone-badge { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
