/* elxmqtt.ru — styles for the ELX-MQTT Broker site.
   The palette is the broker dashboard's own, so the site and the product it
   describes look like one thing. Dark is the default; light is a full
   repaint, not a filter. */

/* ---------- tokens ---------- */

:root {
  --bg:            #0a0f1e;
  --bg-deep:       #060a15;
  --surface:       #0f1729;
  --surface-2:     #141d33;
  --surface-3:     #1c2942;
  --border:        #20304f;
  --border-strong: #2c436e;

  --text:   #e8effb;
  --text-2: #9fb2ce;
  --text-3: #61748f;

  --accent:      #22d3ee;
  --accent-2:    #3b82f6;
  --accent-ink:  #04121a;
  --accent-soft: rgba(34, 211, 238, 0.15);

  --good:   #22c55e;
  --warn:   #eab308;
  --danger: #f43f5e;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.45);
  --shadow-2: 0 8px 24px -8px rgba(0, 0, 0, 0.6);
  --shadow-3: 0 24px 60px -20px rgba(2, 6, 20, 0.8);

  --glow:      0 0 22px -4px rgba(34, 211, 238, 0.5);
  --glow-soft: 0 0 30px -10px rgba(34, 211, 238, 0.4);
  --glow-ring: 0 0 0 1px rgba(34, 211, 238, 0.28), 0 0 20px -4px rgba(34, 211, 238, 0.4);

  --radius:    14px;
  --radius-sm: 9px;
  --radius-lg: 20px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dur:  0.28s;

  --orb-1: rgba(34, 211, 238, 0.20);
  --orb-2: rgba(59, 130, 246, 0.18);

  --header-h: 68px;
  --wrap:     1180px;

  --grid-line: rgba(120, 170, 255, 0.07);
  --code-bg:   #070c18;

  color-scheme: dark;
}

[data-theme="light"] {
  --bg:            #eef2f8;
  --bg-deep:       #e4eaf3;
  --surface:       #ffffff;
  --surface-2:     #f7f9fc;
  --surface-3:     #eef2f7;
  --border:        #dde4ee;
  --border-strong: #c3cede;

  --text:   #0f172a;
  --text-2: #55617a;
  --text-3: #8794ad;

  --accent:      #0aa08a;
  --accent-2:    #2563eb;
  --accent-ink:  #ffffff;
  --accent-soft: rgba(10, 160, 138, 0.12);

  --good:   #15803d;
  --warn:   #a16207;
  --danger: #dc2626;

  --shadow-1: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-2: 0 10px 26px -12px rgba(15, 23, 42, 0.22);
  --shadow-3: 0 28px 60px -28px rgba(15, 23, 42, 0.3);

  --glow:      0 6px 20px -8px rgba(10, 160, 138, 0.45);
  --glow-soft: 0 10px 30px -14px rgba(10, 160, 138, 0.4);
  --glow-ring: 0 0 0 1px rgba(10, 160, 138, 0.3), 0 6px 18px -8px rgba(10, 160, 138, 0.35);

  --orb-1: rgba(10, 160, 138, 0.16);
  --orb-2: rgba(37, 99, 235, 0.12);

  --grid-line: rgba(30, 60, 120, 0.06);
  --code-bg:   #0f172a;

  color-scheme: light;
}

/* ---------- base ---------- */

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 17px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  overflow-x: hidden;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

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

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5em; font-weight: 700; letter-spacing: -0.02em; }
h1 { font-size: clamp(2rem, 5vw, 3.4rem); }
h2 { font-size: clamp(1.5rem, 3.2vw, 2.3rem); }
h3 { font-size: 1.15rem; }
p  { margin: 0 0 1em; }

code, pre, .mono {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
               "Liberation Mono", monospace;
}

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

.wrap { width: min(100% - 40px, var(--wrap)); margin-inline: auto; }
.center { text-align: center; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--accent); color: var(--accent-ink);
  padding: 10px 16px; border-radius: 0 0 var(--radius-sm) 0; font-weight: 600;
}
.skip-link:focus { left: 0; }

.lead { color: var(--text-2); font-size: 1.12rem; max-width: 62ch; }
.hint { color: var(--text-3); font-size: 0.95rem; }

/* ---------- header ---------- */

.site-header {
  position: sticky; top: 0; z-index: 50;
  height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid transparent;
  transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
.site-header.scrolled {
  border-bottom-color: var(--border);
  box-shadow: var(--shadow-2);
}

.header-inner {
  height: 100%;
  display: flex; align-items: center; gap: 24px;
}

.brand {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--text); text-decoration: none; flex-shrink: 0;
}
.brand:hover { text-decoration: none; }
.logo { width: 34px; height: 34px; flex-shrink: 0; }
.logo-ring {
  fill: none; stroke: var(--border-strong); stroke-width: 1.5;
}
.logo-arc {
  fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round;
  opacity: 0.9;
  transform-origin: 20px 20px;
  animation: logo-pulse 3.4s var(--ease) infinite;
}
.logo-arc:nth-of-type(3) { animation-delay: 0.15s; }
.logo-arc:nth-of-type(4) { animation-delay: 0.3s; }
.logo-arc:nth-of-type(5) { animation-delay: 0.45s; }
@keyframes logo-pulse {
  0%, 70%, 100% { opacity: 0.35; }
  35%           { opacity: 1; }
}
.brand:hover .logo { filter: drop-shadow(var(--glow-soft)); }

.brand-text { font-size: 1.05rem; letter-spacing: -0.02em; line-height: 1.1; }
.brand-text b { font-weight: 800; }
.brand-dim { color: var(--text-2); font-weight: 600; }
.brand-text small { display: block; font-size: 0.68rem; color: var(--text-3); letter-spacing: 0.14em; text-transform: uppercase; }

.site-nav { margin-inline-start: auto; }
.site-nav ul { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.site-nav a {
  display: block; padding: 8px 13px; border-radius: var(--radius-sm);
  color: var(--text-2); font-size: 0.95rem; font-weight: 500;
  transition: color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
.site-nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.site-nav a.active { color: var(--accent); background: var(--accent-soft); }

.header-actions { display: flex; align-items: center; gap: 8px; }

.lang-switch, .theme-toggle {
  width: 38px; height: 38px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text-2); cursor: pointer;
  transition: all var(--dur) var(--ease);
}
.lang-switch:hover, .theme-toggle:hover {
  color: var(--accent); border-color: var(--accent); box-shadow: var(--glow-soft);
  text-decoration: none;
}
.lang-code { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.05em; }

.theme-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.theme-toggle .i-moon { display: none; }
[data-theme="light"] .theme-toggle .i-sun  { display: none; }
[data-theme="light"] .theme-toggle .i-moon { display: block; }
.theme-toggle .rays { transform-origin: center; transition: transform 0.5s var(--ease); }
.theme-toggle:hover .rays { transform: rotate(45deg); }

.burger {
  display: none;
  width: 38px; height: 38px; padding: 0;
  flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer;
}
.burger span {
  display: block; width: 17px; height: 2px; border-radius: 2px;
  background: var(--text-2); transition: transform var(--dur) var(--ease), opacity var(--dur) var(--ease);
}
.burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 11px 20px; border-radius: var(--radius-sm);
  font-size: 0.97rem; font-weight: 600; line-height: 1.2;
  border: 1px solid transparent; cursor: pointer;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
              background-color var(--dur) var(--ease), border-color var(--dur) var(--ease),
              color var(--dur) var(--ease);
}
.btn:hover { text-decoration: none; transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn-lg { padding: 14px 28px; font-size: 1.03rem; }
.btn-sm { padding: 8px 15px; font-size: 0.9rem; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-ink);
  box-shadow: var(--glow-soft);
}
.btn-primary:hover { box-shadow: var(--glow), var(--shadow-2); }
.header-cta.is-current { box-shadow: var(--glow-ring); }

.btn-ghost {
  background: var(--surface); color: var(--text); border-color: var(--border-strong);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); box-shadow: var(--glow-soft); }

.btn-icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.badge {
  display: inline-block; margin-bottom: 18px;
  padding: 6px 14px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  font-size: 0.85rem; font-weight: 600;
}

.chip {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-2); font-size: 0.78rem; font-weight: 600;
}
.chip-good { color: var(--good); border-color: color-mix(in srgb, var(--good) 40%, transparent); background: color-mix(in srgb, var(--good) 12%, transparent); }

/* ---------- decorative background ---------- */

.hero-bg { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }

#hero-canvas { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0.55; }

.orb {
  position: absolute; border-radius: 50%; filter: blur(90px);
  animation: float 18s ease-in-out infinite;
}
.orb-1 { width: 520px; height: 520px; background: var(--orb-1); top: -180px; right: -120px; }
.orb-2 { width: 420px; height: 420px; background: var(--orb-2); bottom: -200px; left: -140px; animation-delay: -7s; }
@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(-40px, 40px) scale(1.12); }
}

.grid-fade {
  position: absolute; inset: 0;
  background-image: linear-gradient(var(--grid-line) 1px, transparent 1px),
                    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 30%, transparent 75%);
}

/* ---------- hero ---------- */

.hero { position: relative; padding: clamp(48px, 8vw, 96px) 0 0; }
.hero-inner {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 48px; align-items: center;
}
/* A grid item defaults to a min-width of its min-content, and the terminal's
   <pre> holds an unbreakable systemd path. Without this the column — and with
   it the whole hero — grows past a phone's viewport. */
.hero-inner > * { min-width: 0; }
.hero h1 {
  margin-bottom: 20px;
  background: linear-gradient(180deg, var(--text) 55%, var(--text-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
/* On light backgrounds the fade to grey reads as washed out rather than
   deliberate, so the light theme keeps solid ink. */
[data-theme="light"] .hero h1 { background: none; color: var(--text); }
.hero .lead { font-size: 1.18rem; margin-bottom: 30px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.hero-note { margin-top: 20px; color: var(--text-3); font-size: 0.92rem; }

/* terminal */
.term {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--code-bg); box-shadow: var(--shadow-3);
  overflow: hidden;
}
.term-bar {
  display: flex; align-items: center; gap: 7px;
  padding: 11px 14px; border-bottom: 1px solid rgba(255,255,255,0.07);
  background: rgba(255,255,255,0.03);
}
.term-bar .dot { width: 10px; height: 10px; border-radius: 50%; background: #2b3a55; }
.term-bar .dot:nth-child(1) { background: #f4635a; }
.term-bar .dot:nth-child(2) { background: #f5bd4f; }
.term-bar .dot:nth-child(3) { background: #4fc776; }
.term-title { margin-left: 8px; font-size: 0.8rem; color: #7d8ca6; }

.term-body {
  margin: 0; padding: 18px 20px;
  font-size: 0.86rem; line-height: 1.75; color: #b8c7de;
  white-space: pre-wrap; overflow-wrap: anywhere;
  min-height: 190px;
}
.term-line { display: block; opacity: 0; animation: term-in 0.4s var(--ease) forwards; }
.term-line:nth-child(1) { animation-delay: 0.3s; color: var(--accent); }
.term-line:nth-child(2) { animation-delay: 0.9s; }
.term-line:nth-child(3) { animation-delay: 1.2s; }
.term-line:nth-child(4) { animation-delay: 1.4s; }
.term-line:nth-child(5) { animation-delay: 1.6s; color: #dbe6f5; }
.term-line:nth-child(6) { animation-delay: 1.9s; color: #6ee7b7; }
@keyframes term-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* stats */
.stats-row {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px;
  margin-top: clamp(48px, 7vw, 80px);
  padding: 26px 0;
  border-top: 1px solid var(--border);
}
.stat { text-align: center; }
.stat-value {
  display: block; font-size: clamp(1.9rem, 3.6vw, 2.7rem); font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.stat-label { color: var(--text-3); font-size: 0.88rem; }

/* ---------- sections ---------- */

.section { padding: clamp(56px, 9vw, 110px) 0; position: relative; }
.section-alt { background: var(--bg-deep); border-block: 1px solid var(--border); }

.section-head { max-width: 780px; margin: 0 auto clamp(32px, 5vw, 56px); text-align: center; }
.section-head .lead { margin-inline: auto; }

/* cards */
.cards {
  display: grid; gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}
.card {
  padding: 26px 24px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease);
  position: relative; overflow: hidden;
}
.card::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(400px circle at var(--mx, 50%) var(--my, 0%), var(--accent-soft), transparent 60%);
  opacity: 0; transition: opacity var(--dur) var(--ease); pointer-events: none;
}
.card:hover { transform: translateY(-4px); border-color: var(--border-strong); box-shadow: var(--shadow-2); }
.card:hover::after { opacity: 1; }
.card h3 { margin-bottom: 8px; }
.card p { margin: 0; color: var(--text-2); font-size: 0.97rem; }

.feature-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; margin-bottom: 16px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
}
.feature-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.card:hover .feature-icon { box-shadow: var(--glow-ring); }

/* tabs */
.tabs { max-width: 900px; margin-inline: auto; }
.tab-buttons { display: flex; gap: 8px; margin-bottom: 22px; flex-wrap: wrap; justify-content: center; }
.tab-buttons button {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-2); font-size: 0.95rem; font-weight: 600; cursor: pointer;
  transition: all var(--dur) var(--ease);
}
.tab-buttons button:hover { color: var(--text); border-color: var(--border-strong); }
.tab-buttons button.active { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.tab-buttons .feature-icon { width: 22px; height: 22px; margin: 0; background: none; border-radius: 0; }
.tab-buttons .feature-icon svg { width: 17px; height: 17px; }

.tab-panel { display: none; animation: fade-up 0.4s var(--ease); }
.tab-panel.active { display: block; }
@keyframes fade-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* steps */
.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.steps > li { margin-bottom: 22px; }
.steps > li > p { margin-bottom: 10px; color: var(--text-2); }

.steps-numbered > li { display: flex; gap: 16px; align-items: flex-start; }
.step-n {
  flex-shrink: 0;
  width: 34px; height: 34px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  font-weight: 700; font-size: 0.95rem;
}
.step-body { flex: 1; min-width: 0; }
.step-body h3 { margin-bottom: 4px; font-size: 1.05rem; }
.step-body p { color: var(--text-2); font-size: 0.96rem; margin-bottom: 10px; }

.after-install {
  max-width: 760px; margin: 30px auto 20px; text-align: center;
  color: var(--text-2); font-size: 0.97rem;
}
.after-install code {
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 1px 6px; border-radius: 5px; font-size: 0.9em; color: var(--accent);
}

/* code block */
.code { position: relative; margin: 0 0 14px; }
.code pre {
  margin: 0; padding: 16px 18px; padding-right: 96px;
  background: var(--code-bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow-x: auto; font-size: 0.86rem; line-height: 1.7; color: #cfe0f5;
}
.code code { white-space: pre; }
.code-copy {
  position: absolute; top: 9px; right: 9px; z-index: 1;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 11px; border-radius: 7px;
  background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.12);
  color: #b8c7de; font-size: 0.78rem; font-weight: 600; cursor: pointer;
  opacity: 0; transition: all var(--dur) var(--ease);
}
.code:hover .code-copy, .code-copy:focus-visible { opacity: 1; }
.code-copy:hover { background: rgba(255,255,255,0.13); color: #fff; }
.code-copy svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.code-copy.done { color: var(--good); border-color: color-mix(in srgb, var(--good) 45%, transparent); opacity: 1; }
@media (hover: none) { .code-copy { opacity: 1; } }

/* spec columns */
.spec-columns { display: grid; gap: 24px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.spec-col {
  padding: 26px 24px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.spec-col h3 { color: var(--accent); margin-bottom: 14px; }
.tick-list { list-style: none; margin: 0; padding: 0; }
.tick-list li {
  position: relative; padding-left: 26px; margin-bottom: 9px;
  color: var(--text-2); font-size: 0.95rem;
}
.tick-list li::before {
  content: ""; position: absolute; left: 4px; top: 0.55em;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); box-shadow: var(--glow-soft);
}

/* showcase */
.shot-showcase {
  border-radius: var(--radius-lg); overflow: hidden;
  border: 1px solid var(--border); box-shadow: var(--shadow-3);
  max-width: 1000px; margin: 0 auto 34px;
  transition: transform 0.5s var(--ease);
}
.shot-showcase:hover { transform: translateY(-6px); }

/* cta band */
.cta-band {
  padding: clamp(56px, 8vw, 92px) 0;
  text-align: center;
  background:
    radial-gradient(700px circle at 50% 0%, var(--accent-soft), transparent 70%),
    var(--bg-deep);
  border-top: 1px solid var(--border);
}
.cta-band p { color: var(--text-2); max-width: 56ch; margin-inline: auto; margin-bottom: 26px; }
.cta-band .hero-actions { justify-content: center; }

/* ---------- page head ---------- */

.page-head {
  position: relative;
  padding: clamp(44px, 7vw, 78px) 0 clamp(28px, 4vw, 44px);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}
.page-head .wrap { position: relative; z-index: 1; }
.page-head h1 { margin-bottom: 14px; }
.not-found { text-align: center; min-height: 56vh; display: flex; align-items: center; }
.not-found .lead { margin-inline: auto; margin-bottom: 26px; }

/* ---------- aside layout (docs, features, help) ---------- */

.layout-with-aside {
  display: grid; grid-template-columns: 240px minmax(0, 1fr);
  gap: 48px; align-items: start;
  padding: clamp(32px, 5vw, 56px) 0 clamp(48px, 7vw, 88px);
}

.toc {
  position: sticky; top: calc(var(--header-h) + 20px);
  padding: 20px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface);
}
.toc h2 {
  font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--text-3); margin-bottom: 12px;
}
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc li { margin-bottom: 2px; }
.toc a {
  display: block; padding: 6px 10px; border-radius: 7px;
  color: var(--text-2); font-size: 0.92rem;
  border-left: 2px solid transparent;
  transition: all var(--dur) var(--ease);
}
.toc a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.toc a.active { color: var(--accent); border-left-color: var(--accent); background: var(--accent-soft); }

/* ---------- doc body ---------- */

.doc-body { min-width: 0; }
.doc-section, .feature-group, .faq-group { margin-bottom: clamp(40px, 6vw, 64px); scroll-margin-top: calc(var(--header-h) + 20px); }
.doc-section h2, .feature-group h2, .faq-group h2 {
  padding-bottom: 12px; margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.anchor {
  float: left; margin-left: -0.8em; padding-right: 0.3em;
  color: var(--text-3); opacity: 0; text-decoration: none; font-weight: 400;
  transition: opacity var(--dur) var(--ease);
}
h2:hover .anchor { opacity: 1; }

.doc-body p { color: var(--text-2); }
.doc-body code {
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 1px 6px; border-radius: 5px; font-size: 0.88em;
  color: var(--accent); white-space: nowrap;
}
.doc-body .code code { background: none; border: 0; padding: 0; color: inherit; white-space: pre; }

.doc-list { margin: 0 0 1.2em; padding-left: 22px; }
.doc-list li { margin-bottom: 8px; color: var(--text-2); }

.callout {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 16px 18px; margin: 0 0 1.2em;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  border-left: 3px solid var(--accent);
}
.callout div { flex: 1; min-width: 0; }
.callout p:last-child { margin-bottom: 0; }
.callout-mark {
  flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 800;
  background: var(--accent-soft); color: var(--accent);
}
.callout-warn { border-left-color: var(--warn); }
.callout-warn .callout-mark { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }

.table-scroll { overflow-x: auto; margin: 0 0 1.3em; border-radius: var(--radius-sm); border: 1px solid var(--border); }
table { border-collapse: collapse; width: 100%; font-size: 0.94rem; }
thead th {
  text-align: left; padding: 12px 16px; white-space: nowrap;
  background: var(--surface-2); color: var(--text);
  font-weight: 600; border-bottom: 1px solid var(--border);
}
tbody td { padding: 11px 16px; border-bottom: 1px solid var(--border); color: var(--text-2); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--surface-2); }

/* features page */
.feature-list { display: grid; gap: 18px; }
.feature-row {
  padding: 22px 24px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.feature-row:hover { border-color: var(--border-strong); transform: translateX(4px); }
.feature-row h3 { margin-bottom: 6px; }
.feature-row p { margin: 0; color: var(--text-2); font-size: 0.97rem; }

/* ---------- article ---------- */

.crumbs {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  margin-bottom: 18px; font-size: 0.87rem; color: var(--text-3);
}
.crumbs a { color: var(--text-2); }
.crumbs a:hover { color: var(--accent); text-decoration: none; }

.article-head h1 { max-width: 20ch; }
.article-meta {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  margin: 18px 0 0; color: var(--text-3); font-size: 0.9rem;
}

/* An article is read, not scanned: a narrower measure and more air between
   paragraphs than the reference pages need. */
.article-body { max-width: 74ch; }
.article-body p { margin-bottom: 1.15em; }
.article-body h3 {
  margin-top: 1.8em; margin-bottom: 0.5em;
  font-size: 1.12rem; color: var(--text);
}
.article-body .block-lead {
  font-size: 1.12rem; color: var(--text);
  padding-left: 18px; border-left: 3px solid var(--accent);
}

.article-cta {
  margin: 48px 0 0; padding: 28px 30px;
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background:
    radial-gradient(600px circle at 20% 0%, var(--accent-soft), transparent 70%),
    var(--surface);
}
.article-cta h2 { font-size: 1.35rem; border: 0; padding: 0; margin-bottom: 8px; }
.article-cta p { color: var(--text-2); margin-bottom: 18px; }

.read-next { margin-top: 44px; }
.read-next h2 { font-size: 1.2rem; padding-bottom: 12px; }
.read-next ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.read-next a {
  display: block; padding: 16px 20px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  transition: all var(--dur) var(--ease);
}
.read-next a:hover { border-color: var(--accent); transform: translateX(4px); text-decoration: none; }
.read-next b { display: block; margin-bottom: 2px; }
.read-next span { color: var(--text-3); font-size: 0.9rem; }

/* ---------- download page ---------- */

.dl-wrap { padding: clamp(36px, 5vw, 60px) 0 clamp(48px, 7vw, 88px); display: grid; gap: 26px; }
.dl-card {
  padding: clamp(24px, 3vw, 34px);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-1);
}
.dl-card.small { box-shadow: none; }
.dl-card h2 { font-size: 1.5rem; }
.dl-head { display: flex; gap: 18px; align-items: flex-start; margin-bottom: 26px; }
.dl-head h2 { margin-bottom: 4px; }
.dl-head p { margin: 0; color: var(--text-2); font-size: 0.97rem; }

.os-mark {
  flex-shrink: 0; width: 52px; height: 52px; border-radius: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent);
}
.os-mark svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.os-mark .feature-icon { margin: 0; background: none; width: auto; height: auto; }

.dl-button-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 26px; }
.dl-size { color: var(--text-3); font-size: 0.88rem; }

.dl-after { margin-top: 26px; padding-top: 24px; border-top: 1px solid var(--border); }
.dl-after h3, .dl-split h3 { margin-bottom: 10px; }
.dl-after p, .dl-split p { color: var(--text-2); font-size: 0.96rem; }

.dl-note { margin-top: 12px; color: var(--text-3); font-size: 0.9rem; }

.dl-split { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; margin-top: 26px; padding-top: 24px; border-top: 1px solid var(--border); }
.dl-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; }

.kv { margin: 0; display: grid; gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.kv > div { display: grid; grid-template-columns: minmax(140px, 34%) 1fr; gap: 14px; padding: 11px 16px; background: var(--surface); }
.kv dt { color: var(--text-3); font-size: 0.9rem; }
.kv dd { margin: 0; color: var(--text); font-size: 0.93rem; word-break: break-word; }

.arch-list { list-style: none; margin: 0 0 24px; padding: 0; display: grid; gap: 10px; }
.arch-dl {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 18px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); transition: all var(--dur) var(--ease);
}
.arch-dl:hover { border-color: var(--accent); box-shadow: var(--glow-soft); text-decoration: none; transform: translateX(4px); }
.arch-dl code { color: var(--accent); font-size: 0.9rem; font-weight: 600; flex-shrink: 0; }
.arch-dl span { color: var(--text-2); font-size: 0.92rem; flex: 1; }
.arch-dl .btn-icon { flex-shrink: 0; color: var(--text-3); }
.arch-dl:hover .btn-icon { color: var(--accent); }

/* ---------- gallery ---------- */

.gallery {
  display: grid; gap: 22px;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  padding: clamp(32px, 5vw, 52px) 0 clamp(48px, 7vw, 80px);
}
.shot { margin: 0; }
.shot a {
  display: block; position: relative; overflow: hidden;
  border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--surface-2);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.shot a:hover { transform: translateY(-5px); box-shadow: var(--shadow-3); border-color: var(--accent); }
.shot img { width: 100%; aspect-ratio: 78 / 50; object-fit: cover; object-position: top center; }
.shot-zoom {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--bg-deep) 55%, transparent);
  opacity: 0; transition: opacity var(--dur) var(--ease);
}
.shot a:hover .shot-zoom { opacity: 1; }
.shot-zoom svg { width: 40px; height: 40px; fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; }
.shot figcaption { padding: 12px 4px 0; }
.shot figcaption b { display: block; font-size: 0.97rem; }
.shot figcaption span { color: var(--text-3); font-size: 0.87rem; }

/* lightbox */
.lightbox {
  position: fixed; inset: 0; z-index: 90;
  display: flex; align-items: center; justify-content: center;
  padding: 4vh 6vw;
  background: rgba(3, 7, 18, 0.93);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  animation: fade-in 0.2s var(--ease);
}
.lightbox[hidden] { display: none; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.lb-figure { margin: 0; max-width: 100%; max-height: 92vh; display: flex; flex-direction: column; gap: 12px; }
.lb-figure img {
  max-width: 100%; max-height: 82vh; object-fit: contain;
  border-radius: var(--radius); border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 30px 80px -20px rgba(0,0,0,0.9);
}
.lb-figure figcaption { text-align: center; color: #cbd7e8; font-size: 0.94rem; }
.lb-close, .lb-nav {
  position: absolute; z-index: 1;
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.16);
  color: #e8effb; cursor: pointer; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.lb-close:hover, .lb-nav:hover { background: rgba(255,255,255,0.18); transform: scale(1.08); }
.lb-close { top: 18px; right: 18px; width: 42px; height: 42px; font-size: 1.6rem; line-height: 1; }
.lb-nav { top: 50%; margin-top: -26px; width: 52px; height: 52px; font-size: 2rem; line-height: 1; }
.lb-prev { left: 14px; }
.lb-next { right: 14px; }

/* ---------- help / faq ---------- */

.faq-search {
  position: relative; max-width: 460px; margin-top: 24px;
}
.faq-search svg {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; fill: none; stroke: var(--text-3);
  stroke-width: 1.8; stroke-linecap: round; pointer-events: none;
}
.faq-search input {
  width: 100%; padding: 12px 16px 12px 42px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-size: 0.97rem; font-family: inherit;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.faq-search input::placeholder { color: var(--text-3); }
.faq-search input:focus { outline: none; border-color: var(--accent); box-shadow: var(--glow-ring); }

.faq-item {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); margin-bottom: 10px;
  transition: border-color var(--dur) var(--ease);
}
.faq-item:hover { border-color: var(--border-strong); }
.faq-item[open] { border-color: var(--accent); box-shadow: var(--glow-soft); }
.faq-item summary {
  display: flex; align-items: center; gap: 14px; justify-content: space-between;
  padding: 16px 20px; cursor: pointer; list-style: none;
  font-weight: 600; font-size: 1rem;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-mark {
  flex-shrink: 0; position: relative; width: 16px; height: 16px;
}
.faq-mark::before, .faq-mark::after {
  content: ""; position: absolute; left: 50%; top: 50%;
  background: var(--accent); border-radius: 2px;
  transform: translate(-50%, -50%);
  transition: transform var(--dur) var(--ease), opacity var(--dur) var(--ease);
}
.faq-mark::before { width: 14px; height: 2px; }
.faq-mark::after  { width: 2px; height: 14px; }
.faq-item[open] .faq-mark::after { transform: translate(-50%, -50%) rotate(90deg); opacity: 0; }
.faq-a { padding: 0 20px 18px; }
.faq-a p { margin: 0; color: var(--text-2); font-size: 0.97rem; }

.faq-empty { padding: 30px 0; color: var(--text-3); text-align: center; }

.help-contact {
  padding: 30px; border-radius: var(--radius-lg);
  background: var(--surface); border: 1px solid var(--border);
  text-align: center;
}
.help-contact .hero-actions { justify-content: center; }

/* ---------- footer ---------- */

.site-footer {
  background: var(--bg-deep);
  border-top: 1px solid var(--border);
  padding: clamp(44px, 6vw, 68px) 0 24px;
}
.footer-grid {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 40px;
  padding-bottom: 36px;
}
.footer-brand .brand { margin-bottom: 14px; }
.footer-about { color: var(--text-3); font-size: 0.92rem; max-width: 40ch; }
.footer-badges { display: flex; gap: 8px; flex-wrap: wrap; margin: 0; }

.footer-col h3 {
  font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--text-3); margin-bottom: 14px;
}
.footer-col ul { list-style: none; margin: 0; padding: 0; }
.footer-col li { margin-bottom: 9px; }
.footer-col a { color: var(--text-2); font-size: 0.93rem; }
.footer-col a:hover { color: var(--accent); text-decoration: none; }

.footer-bottom {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding-top: 22px; border-top: 1px solid var(--border);
  color: var(--text-3); font-size: 0.87rem; flex-wrap: wrap;
}
.to-top { color: var(--text-3); }
.to-top:hover { color: var(--accent); text-decoration: none; }

/* ---------- reveal on scroll ---------- */

.js .reveal { opacity: 0; transform: translateY(18px); }
.reveal.in {
  opacity: 1; transform: none;
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}
.cards .reveal.in,
.feature-list .reveal.in,
.gallery .reveal.in { transition-delay: calc(var(--i, 0) * 45ms); }

/* ---------- responsive ---------- */

@media (max-width: 1080px) {
  .hero-inner { grid-template-columns: 1fr; gap: 36px; }
  .hero-terminal { max-width: 640px; }
  .layout-with-aside { grid-template-columns: 200px minmax(0, 1fr); gap: 32px; }
  .footer-grid { grid-template-columns: 1fr 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
}

@media (max-width: 900px) {
  .site-nav {
    position: fixed; inset: var(--header-h) 0 auto;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-3);
    padding: 12px 20px 20px;
    transform: translateY(-8px);
    opacity: 0; visibility: hidden; pointer-events: none;
    transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease), visibility var(--dur);
    max-height: calc(100vh - var(--header-h)); overflow-y: auto;
  }
  .site-nav.open { opacity: 1; visibility: visible; transform: none; pointer-events: auto; }
  .site-nav ul { flex-direction: column; gap: 2px; }
  .site-nav a { padding: 12px 14px; font-size: 1rem; }
  .burger { display: inline-flex; }
  .header-cta { display: none; }
  .header-inner { gap: 12px; }

  .layout-with-aside { grid-template-columns: 1fr; gap: 0; }
  .toc {
    position: static; margin-bottom: 28px;
    display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  }
  .toc h2 { width: 100%; margin-bottom: 6px; }
  .toc ul { display: flex; flex-wrap: wrap; gap: 6px; }
  .toc a { border-left: 0; border: 1px solid var(--border); padding: 6px 12px; font-size: 0.88rem; }
  .toc a.active { border-color: var(--accent); }

  .dl-split, .dl-columns { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: repeat(2, 1fr); gap: 24px 16px; }
}

@media (max-width: 620px) {
  body { font-size: 16px; }
  .wrap { width: min(100% - 32px, var(--wrap)); }
  .brand-text small { display: none; }
  .hero { padding-top: 34px; }
  .hero .lead { font-size: 1.05rem; }
  .hero-actions .btn { width: 100%; }
  .gallery { grid-template-columns: 1fr; }
  .kv > div { grid-template-columns: 1fr; gap: 2px; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 28px; }
  .footer-bottom { justify-content: center; text-align: center; }
  .steps-numbered > li { gap: 12px; }
  .code pre { padding-right: 18px; padding-top: 42px; font-size: 0.8rem; }
  .code-copy { opacity: 1; top: 8px; right: 8px; }
  .lb-nav { width: 42px; height: 42px; font-size: 1.6rem; }
  .lb-prev { left: 6px; } .lb-next { right: 6px; }
  .lightbox { padding: 3vh 3vw; }
}

/* ---------- motion preferences ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; }
  .term-line { opacity: 1; }
  #hero-canvas { display: none; }
}

/* ---------- print ---------- */

@media print {
  .site-header, .site-footer, .toc, .hero-bg, .cta-band, .code-copy { display: none !important; }
  body { background: #fff; color: #000; }
  .reveal { opacity: 1; transform: none; }
}
