/* SMGS Hub docs. The colour language is the app's own: one tint per mode, warm orange only for power. */

:root {
  --bg: #f3f5f8;
  --bg-raised: #ffffff;
  --bg-sunk: #e9edf2;
  --ink: #12161c;
  --ink-2: #4a5462;
  --ink-3: #7b8594;
  --rule: #d9dfe7;
  --cool: #4cc3ff;
  --cool-deep: #2a7bff;
  --dry: #38d3c0;
  --dry-deep: #1c9c9e;
  --fan: #9dc8b0;
  --fan-deep: #5e9c7a;
  --auto: #8fa4ff;
  --auto-deep: #5b6cff;
  --heat: #ffb36b;
  --heat-deep: #ff7a2f;
  --off: #7e8b9b;
  --off-deep: #5a6677;
  --power: #ff8a3d;
  --online: #2fbf6e;
  --warn: #e07a12;
  --accent: var(--cool-deep);
  --glow: rgba(76, 195, 255, 0.16);
  --shadow: 0 1px 2px rgba(18, 22, 28, 0.06), 0 12px 40px -12px rgba(18, 22, 28, 0.22);
  --shadow-lg: 0 2px 6px rgba(18, 22, 28, 0.06), 0 40px 80px -24px rgba(18, 40, 80, 0.32);
  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --sans: "Schibsted Grotesk", "Avenir Next", "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --radius: 14px;
  --measure: 68ch;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c0f14;
    --bg-raised: #151a22;
    --bg-sunk: #10141b;
    --ink: #e9edf3;
    --ink-2: #aab3c0;
    --ink-3: #788292;
    --rule: #242b36;
    --accent: var(--cool);
    --online: #3ddc84;
    --warn: #ff9f43;
    --glow: rgba(76, 195, 255, 0.12);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 40px -12px rgba(0, 0, 0, 0.7);
    --shadow-lg: 0 2px 6px rgba(0, 0, 0, 0.4), 0 40px 80px -24px rgba(0, 0, 0, 0.8);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0c0f14;
  --bg-raised: #151a22;
  --bg-sunk: #10141b;
  --ink: #e9edf3;
  --ink-2: #aab3c0;
  --ink-3: #788292;
  --rule: #242b36;
  --accent: var(--cool);
  --online: #3ddc84;
  --warn: #ff9f43;
  --glow: rgba(76, 195, 255, 0.12);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 40px -12px rgba(0, 0, 0, 0.7);
  --shadow-lg: 0 2px 6px rgba(0, 0, 0, 0.4), 0 40px 80px -24px rgba(0, 0, 0, 0.8);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 84px; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.62 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: -20vmax -20vmax auto auto;
  width: 70vmax;
  height: 70vmax;
  background: radial-gradient(closest-side, var(--glow), transparent);
  pointer-events: none;
  z-index: 0;
}

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

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

code, kbd { font-family: var(--mono); font-size: 0.86em; }
code { background: var(--bg-sunk); border: 1px solid var(--rule); padding: 0.08em 0.38em; border-radius: 6px; }
kbd {
  display: inline-block;
  min-width: 1.7em;
  padding: 0.1em 0.45em;
  border-radius: 6px;
  border: 1px solid var(--rule);
  border-bottom-width: 2px;
  background: var(--bg-raised);
  text-align: center;
  line-height: 1.5;
}

pre {
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.6;
  background: var(--bg-sunk);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 16px 18px;
  overflow-x: auto;
}
pre code { background: none; border: 0; padding: 0; }

/* ---------- Top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px clamp(16px, 4vw, 40px);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: saturate(1.4) blur(16px);
  -webkit-backdrop-filter: saturate(1.4) blur(16px);
  border-bottom: 1px solid var(--rule);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 600; letter-spacing: -0.01em; }
.brand svg { width: 28px; height: 28px; }
.brand small { color: var(--ink-3); font-weight: 400; }
.topbar nav { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.topbar nav a { color: var(--ink-2); text-decoration: none; font-size: 15px; padding: 6px 10px; border-radius: 8px; }
.topbar nav a:hover, .topbar nav a[aria-current="page"] { color: var(--ink); background: var(--bg-sunk); }

.theme-toggle {
  display: inline-flex;
  padding: 3px;
  border-radius: 10px;
  background: var(--bg-sunk);
  border: 1px solid var(--rule);
}
.theme-toggle button {
  border: 0;
  background: none;
  color: var(--ink-3);
  font: 500 13px var(--sans);
  padding: 4px 9px;
  border-radius: 7px;
  cursor: pointer;
}
.theme-toggle button[aria-pressed="true"] { background: var(--bg-raised); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }

/* ---------- Layout ---------- */

.wrap { position: relative; z-index: 1; max-width: 1240px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 40px); }

.hero { padding: clamp(48px, 9vw, 112px) 0 clamp(32px, 5vw, 56px); position: relative; }
.eyebrow { font: 500 13px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); margin: 0 0 18px; }
.hero h1 {
  font: 400 clamp(46px, 8.4vw, 104px)/0.98 var(--serif);
  letter-spacing: -0.02em;
  margin: 0 0 24px;
  max-width: 14ch;
}
.hero h1 em { font-style: italic; background: linear-gradient(100deg, var(--cool-deep), var(--cool)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lede { font-size: clamp(18px, 2vw, 21px); color: var(--ink-2); max-width: 58ch; margin: 0; }

.hero-shot {
  margin-top: clamp(36px, 6vw, 64px);
  position: relative;
}
.hero-shot img { border-radius: 12px; box-shadow: var(--shadow-lg); }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1px; background: var(--rule); border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; margin-top: 40px; }
.facts div { background: var(--bg-raised); padding: 18px 20px; }
.facts b { display: block; font: 400 30px/1.1 var(--serif); margin-bottom: 4px; }
.facts span { color: var(--ink-2); font-size: 15px; }

.doc { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: clamp(24px, 5vw, 72px); padding-bottom: 120px; }
@media (max-width: 960px) { .doc { grid-template-columns: minmax(0, 1fr); } .toc { display: none; } }

.toc { position: sticky; top: 84px; align-self: start; max-height: calc(100vh - 100px); overflow: auto; padding: 8px 0; }
.toc p { font: 500 12px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 10px; }
.toc ol { list-style: none; margin: 0; padding: 0; counter-reset: toc; }
.toc li { counter-increment: toc; }
.toc a {
  display: flex;
  gap: 10px;
  padding: 5px 10px;
  margin-left: -10px;
  border-radius: 8px;
  color: var(--ink-2);
  text-decoration: none;
  font-size: 14.5px;
  line-height: 1.35;
}
.toc a::before { content: counter(toc, decimal-leading-zero); font: 12px/1.6 var(--mono); color: var(--ink-3); }
.toc a:hover { color: var(--ink); background: var(--bg-sunk); }
.toc a.active { color: var(--ink); background: var(--bg-sunk); }
.toc a.active::before { color: var(--accent); }

/* ---------- Sections ---------- */

section.step { padding: 56px 0 8px; border-top: 1px solid var(--rule); }
section.step:first-child { border-top: 0; padding-top: 8px; }
.step-num { font: 500 13px var(--mono); color: var(--accent); letter-spacing: 0.06em; }
section.step h2 { font: 400 clamp(34px, 4.6vw, 52px)/1.04 var(--serif); letter-spacing: -0.015em; margin: 6px 0 18px; }
section.step h3 { font: 600 19px/1.3 var(--sans); letter-spacing: -0.01em; margin: 36px 0 10px; }
section.step p, section.step li { max-width: var(--measure); }
section.step p { color: var(--ink-2); }
section.step p strong, section.step li strong { color: var(--ink); }
section.step ul, section.step ol { color: var(--ink-2); padding-left: 1.2em; }
section.step li { margin: 6px 0; }
section.step li::marker { color: var(--ink-3); }

figure { margin: 28px 0; }
figure.shot img { border-radius: 10px; box-shadow: var(--shadow); }
figure.shot.window img { border-radius: 12px; box-shadow: var(--shadow-lg); }
figure.shot.flat img { box-shadow: none; border: 1px solid var(--rule); background: var(--bg-raised); }
figcaption { margin-top: 12px; font-size: 14px; color: var(--ink-3); max-width: var(--measure); }
figcaption b { color: var(--ink-2); font-weight: 600; }

.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; align-items: start; }
.pair.wide-left { grid-template-columns: 1.4fr 1fr; }
.pair.wide-right { grid-template-columns: 1fr 1.25fr; }
@media (max-width: 760px) { .pair, .pair.wide-left, .pair.wide-right { grid-template-columns: minmax(0, 1fr); } }

.gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin: 28px 0; }
@media (max-width: 640px) { .gallery { grid-template-columns: minmax(0, 1fr); } }
.gallery figure { margin: 0; background: var(--bg-raised); border: 1px solid var(--rule); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; }
.gallery figure img { margin: auto; max-height: 280px; width: auto; }
.gallery figcaption { margin-top: 8px; }

/* Annotated screenshot */
.annotated { position: relative; }
.pin {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font: 600 13px var(--mono);
  color: #fff;
  background: var(--power);
  border: 2px solid #fff;
  box-shadow: 0 4px 14px rgba(255, 138, 61, 0.55);
  cursor: default;
  z-index: 2;
}
.pin::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid var(--power);
  opacity: 0;
  animation: ping 2.6s ease-out infinite;
}
@keyframes ping { 0% { transform: scale(.7); opacity: .7; } 70%, 100% { transform: scale(1.6); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .pin::after { animation: none; } }
@media (max-width: 640px) { .pin { width: 22px; height: 22px; font-size: 11px; } }

.legend { list-style: none; padding: 0 !important; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px 28px; margin: 22px 0 0; }
.legend li { display: flex; gap: 12px; margin: 0 !important; font-size: 15.5px; }
.legend li > span:first-child {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font: 600 12px var(--mono);
  color: #fff;
  background: var(--power);
  margin-top: 1px;
}

/* Tables */
.table-wrap { overflow-x: auto; margin: 22px 0; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--bg-raised); }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { text-align: left; padding: 11px 16px; border-bottom: 1px solid var(--rule); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
th { font: 500 12px var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); background: var(--bg-sunk); }
td { color: var(--ink-2); }
td:first-child { color: var(--ink); font-weight: 500; white-space: nowrap; }

/* Callouts */
.note {
  display: flex;
  gap: 14px;
  padding: 16px 18px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--cool) 10%, var(--bg-raised));
  border: 1px solid color-mix(in srgb, var(--cool) 30%, var(--rule));
  color: var(--ink-2);
  margin: 24px 0;
  max-width: calc(var(--measure) + 60px);
  font-size: 15.5px;
}
.note.warn { background: color-mix(in srgb, var(--warn) 10%, var(--bg-raised)); border-color: color-mix(in srgb, var(--warn) 35%, var(--rule)); }
.note svg { flex: none; width: 20px; height: 20px; margin-top: 2px; color: var(--accent); }
.note.warn svg { color: var(--warn); }
.note p { margin: 0; }

/* Mode swatches */
.swatches { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin: 24px 0; }
.swatch { border-radius: var(--radius); border: 1px solid var(--rule); background: var(--bg-raised); overflow: hidden; }
.swatch i { display: block; height: 64px; }
.swatch div { padding: 10px 12px; font-size: 14px; }
.swatch b { display: block; color: var(--ink); }
.swatch span { color: var(--ink-3); font: 12px var(--mono); }

/* Status item glyphs */
.status-strip { display: flex; flex-wrap: wrap; gap: 12px; margin: 20px 0; }
.status-strip div { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border: 1px solid var(--rule); border-radius: 12px; background: var(--bg-raised); font-size: 14.5px; color: var(--ink-2); }
.menubar-chip { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 8px; border-radius: 6px; background: var(--bg-sunk); color: var(--ink); font: 500 13.5px var(--sans); }
.menubar-chip svg { width: 16px; height: 16px; }

/* Home cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; padding-bottom: 120px; }
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 24px;
  border-radius: 18px;
  background: var(--bg-raised);
  border: 1px solid var(--rule);
  color: var(--ink);
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform .25s ease, box-shadow .25s ease;
  overflow: hidden;
}
a.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.card .tag { font: 500 12px var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); }
.card h3 { font: 400 32px/1.05 var(--serif); margin: 4px 0 0; }
.card p { margin: 0; color: var(--ink-2); font-size: 15.5px; }
.card .thumb { margin: 10px -24px -24px; border-top: 1px solid var(--rule); background: var(--bg-sunk); }
.card .thumb img { width: 100%; }
.card.muted { opacity: 0.75; box-shadow: none; }
.card.muted .tag { color: var(--ink-3); }

footer.site { border-top: 1px solid var(--rule); padding: 28px 0 48px; color: var(--ink-3); font-size: 14px; position: relative; z-index: 1; }

/* Load-in */
@media (prefers-reduced-motion: no-preference) {
  .rise { opacity: 0; transform: translateY(14px); animation: rise .8s cubic-bezier(.2,.7,.2,1) forwards; }
  .rise.d1 { animation-delay: .08s; } .rise.d2 { animation-delay: .18s; } .rise.d3 { animation-delay: .3s; }
  @keyframes rise { to { opacity: 1; transform: none; } }
}

/* Phones: keep the top bar to one line and nothing wider than the screen. */
main { min-width: 0; }
@media (max-width: 640px) {
  .topbar { gap: 10px; }
  .topbar nav, .brand small { display: none; }
  .theme-toggle { margin-left: auto; }
  .theme-toggle button { padding: 4px 7px; }
  .facts { grid-template-columns: minmax(0, 1fr); }
  pre { font-size: 12.5px; }
}
