/* MQTT One — main stylesheet */

/* ---------- Fonts ---------- */
@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-latin-var.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrains-mono-latin-var.woff2") format("woff2");
  font-weight: 100 800;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans Arabic";
  src: url("../fonts/plex-arabic-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans Arabic";
  src: url("../fonts/plex-arabic-500.woff2") format("woff2");
  font-weight: 500 600;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans Arabic";
  src: url("../fonts/plex-arabic-700.woff2") format("woff2");
  font-weight: 700 900;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  --cyan: #00b0f0;
  --cyan-600: #0090c8;
  --magenta: #d357fc;
  --magenta-600: #b23ddb;
  --gray: #9f9f9f;

  --ink: #0b1020;
  --ink-2: #121a33;
  --ink-3: #1b2547;
  --text: #1c2333;
  --muted: #5b6478;
  --muted-dark: #a7b0c8;
  --bg: #ffffff;
  --soft: #f4f6fb;
  --border: #e3e7f0;
  --border-dark: rgba(255, 255, 255, .1);

  --gradient: linear-gradient(120deg, var(--cyan) 0%, var(--magenta) 100%);
  --gradient-soft: linear-gradient(120deg, rgba(0, 176, 240, .12), rgba(211, 87, 252, .12));

  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-ar: "IBM Plex Sans Arabic", "Inter", system-ui, "Segoe UI", Tahoma, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;

  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 22px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .06);
  --shadow-lg: 0 24px 60px rgba(11, 16, 32, .18);
  --header-h: 72px;
  --container: 1180px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
html[lang="ar"] body { font-family: var(--font-ar); line-height: 1.8; }
img, svg { max-width: 100%; display: block; }
a { color: var(--cyan-600); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.2; color: var(--ink); margin: 0 0 .6em; font-weight: 700; letter-spacing: -.015em; }
html[lang="ar"] h1, html[lang="ar"] h2, html[lang="ar"] h3, html[lang="ar"] h4 { letter-spacing: 0; line-height: 1.4; }
h1 { font-size: clamp(2.1rem, 4.6vw, 3.6rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }
code, pre, kbd { font-family: var(--mono); }
:not(pre) > code {
  font-size: .88em;
  padding: .12em .4em;
  border-radius: 6px;
  background: var(--soft);
  border: 1px solid var(--border);
  color: var(--magenta-600);
  direction: ltr;
  unicode-bidi: isolate;
}
:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; border-radius: 4px; }
::selection { background: rgba(0, 176, 240, .25); }

.container { width: min(100% - 2.5rem, var(--container)); margin-inline: auto; }
.container--narrow { width: min(100% - 2.5rem, 820px); margin-inline: auto; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; inset-inline-start: 1rem; top: -100px; z-index: 100; background: var(--ink); color: #fff; padding: .6rem 1rem; border-radius: var(--radius-sm); }
.skip-link:focus { top: 1rem; }

.icon { width: 1.25em; height: 1.25em; flex: none; }
html[dir="rtl"] .icon--flip { transform: scaleX(-1); }
.text-gradient { background: var(--gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .8rem 1.35rem;
  border-radius: 999px;
  font-weight: 600; font-size: .98rem; line-height: 1.2;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .2s ease, background-color .2s ease, color .2s ease;
  text-decoration: none !important;
  white-space: nowrap;
  font-family: inherit;
}
.btn:hover { transform: translateY(-1px); }
.btn--sm { padding: .55rem 1rem; font-size: .9rem; }
.btn--lg { padding: 1rem 1.7rem; font-size: 1.05rem; }
.btn--primary { background: var(--gradient); color: #fff; box-shadow: 0 8px 22px rgba(0, 176, 240, .28); }
.btn--primary:hover { box-shadow: 0 12px 28px rgba(211, 87, 252, .35); }
.btn--ghost { color: #fff; border-color: rgba(255, 255, 255, .22); background: transparent; }
.btn--ghost:hover { background: rgba(255, 255, 255, .08); }
.btn--outline { color: var(--ink); border-color: var(--border); background: #fff; }
.btn--outline:hover { border-color: var(--cyan); color: var(--cyan-600); }
.btn--light { background: #fff; color: var(--ink); }
.btn--outline-light { color: #fff; border-color: rgba(255, 255, 255, .45); }
.btn--outline-light:hover { background: rgba(255, 255, 255, .1); }
.btn-row { display: flex; flex-wrap: wrap; gap: .8rem; }
.btn-row--center { justify-content: center; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  height: var(--header-h);
  background: rgba(11, 16, 32, .97);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--border-dark);
}
.site-header__inner { height: 100%; display: flex; align-items: center; gap: 1.5rem; }
.brand { display: inline-flex; align-items: center; gap: .55rem; color: #fff; text-decoration: none !important; flex: none; direction: ltr; }
.brand img { width: 58px; height: auto; }
.brand__name { font-weight: 800; font-size: 1.15rem; letter-spacing: .02em; font-family: var(--font); }
.brand__name span { color: var(--magenta); }
.site-nav { display: flex; align-items: center; gap: 1.5rem; flex: 1; }
.site-nav__list { display: flex; gap: .25rem; list-style: none; margin: 0; padding: 0; margin-inline-start: auto; }
.site-nav__list a {
  display: block; padding: .5rem .8rem; border-radius: 8px;
  color: var(--muted-dark); font-weight: 500; font-size: .95rem;
  text-decoration: none;
}
.site-nav__list a:hover, .site-nav__list a[aria-current="page"] { color: #fff; background: rgba(255, 255, 255, .07); }
.site-nav__list a[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--cyan); border-radius: 8px 8px 2px 2px; }
.site-nav__actions { display: flex; align-items: center; gap: .6rem; }
.lang-switch { display: inline-flex; align-items: center; gap: .35rem; color: var(--muted-dark); font-weight: 500; font-size: .92rem; padding: .45rem .6rem; border-radius: 8px; }
.lang-switch:hover { color: #fff; text-decoration: none; background: rgba(255, 255, 255, .07); }
.lang-switch[lang="ar"] { font-family: var(--font-ar); }
.lang-switch[lang="en"] { font-family: var(--font); }
.nav-toggle { display: none; margin-inline-start: auto; background: transparent; border: 1px solid var(--border-dark); color: #fff; border-radius: 10px; padding: .45rem; cursor: pointer; }
.nav-toggle__close { display: none; }

@media (max-width: 1120px) {
  .nav-toggle { display: inline-flex; }
  .site-nav {
    position: fixed; inset: var(--header-h) 0 auto 0;
    flex-direction: column; align-items: stretch; gap: 1rem;
    padding: 1rem 1.25rem 1.5rem;
    background: var(--ink);
    border-bottom: 1px solid var(--border-dark);
    max-height: calc(100vh - var(--header-h)); overflow-y: auto;
    transform: translateY(-8px); opacity: 0; visibility: hidden;
    transition: opacity .2s ease, transform .2s ease, visibility .2s;
  }
  .site-nav.is-open { transform: none; opacity: 1; visibility: visible; }
  .site-nav__list { flex-direction: column; margin: 0; }
  .site-nav__list a { padding: .75rem .8rem; font-size: 1rem; }
  .site-nav__list a[aria-current="page"] { box-shadow: inset 3px 0 0 var(--cyan); border-radius: 8px; }
  html[dir="rtl"] .site-nav__list a[aria-current="page"] { box-shadow: inset -3px 0 0 var(--cyan); }
  .site-nav__actions { flex-wrap: wrap; border-top: 1px solid var(--border-dark); padding-top: 1rem; }
  .site-nav__actions .btn { flex: 1; }
  .nav-toggle[aria-expanded="true"] .nav-toggle__open { display: none; }
  .nav-toggle[aria-expanded="true"] .nav-toggle__close { display: block; }
}

/* ---------- Sections ---------- */
.section { padding-block: clamp(4rem, 8vw, 6.5rem); }
.section--soft { background: var(--soft); }
.section--dark { background: var(--ink); color: var(--muted-dark); }
.section--dark h2, .section--dark h3 { color: #fff; }
.section--tight { padding-block: clamp(2.5rem, 5vw, 4rem); }
.section-head { max-width: 760px; margin-bottom: clamp(2rem, 4vw, 3.2rem); }
.section-head--center { text-align: center; margin-inline: auto; }
.section-head .lead { margin: 0; }
.eyebrow {
  display: inline-flex; align-items: center; gap: .4rem;
  font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .12em;
  color: var(--cyan-600); margin-bottom: .9rem;
}
html[lang="ar"] .eyebrow { letter-spacing: 0; font-size: .9rem; }
.section--dark .eyebrow, .hero .eyebrow, .page-hero .eyebrow { color: var(--cyan); }
.lead { font-size: clamp(1.05rem, 1.6vw, 1.2rem); color: var(--muted); }
.section--dark .lead { color: var(--muted-dark); }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  background: var(--ink);
  color: var(--muted-dark);
  padding-block: clamp(3.5rem, 8vw, 6.5rem) clamp(4rem, 9vw, 7rem);
  isolation: isolate;
}
.hero::before, .page-hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(600px 380px at 85% 10%, rgba(211, 87, 252, .28), transparent 70%),
    radial-gradient(640px 420px at 5% 90%, rgba(0, 176, 240, .25), transparent 70%);
}
.hero::after, .page-hero::after {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: .35;
  background-image:
    linear-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .05) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
}
.hero__grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: clamp(2rem, 5vw, 4rem); align-items: center; }
.hero h1 { color: #fff; margin-bottom: 1.2rem; }
.hero .lead { color: var(--muted-dark); max-width: 560px; margin-bottom: 2rem; }
.hero__badge {
  display: inline-flex; align-items: center; gap: .55rem;
  padding: .4rem .9rem .4rem .45rem; margin-bottom: 1.4rem;
  border: 1px solid var(--border-dark); border-radius: 999px;
  background: rgba(255, 255, 255, .04);
  color: #fff; font-size: .88rem; font-weight: 500;
  text-decoration: none !important;
}
html[dir="rtl"] .hero__badge { padding: .4rem .45rem .4rem .9rem; }
.hero__badge b { background: var(--gradient); padding: .15rem .6rem; border-radius: 999px; font-size: .75rem; letter-spacing: .04em; }
.hero__badge:hover { border-color: rgba(255, 255, 255, .3); }
.hero__meta { display: flex; flex-wrap: wrap; gap: .5rem 1.4rem; margin-top: 2rem; padding: 0; list-style: none; font-size: .92rem; }
.hero__meta li { display: inline-flex; align-items: center; gap: .45rem; }
.hero__meta .icon { color: var(--cyan); width: 1.1em; height: 1.1em; }
@media (max-width: 900px) {
  .hero__grid { grid-template-columns: 1fr; }
}

/* ---------- Terminal ---------- */
.terminal {
  background: #070b17;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(0, 176, 240, .06), 0 0 80px rgba(211, 87, 252, .12);
  overflow: hidden;
  font-family: var(--mono);
  font-size: .86rem;
  color: #cbd5f0;
  direction: ltr;
  text-align: left;
}
.terminal__bar { display: flex; align-items: center; gap: .45rem; padding: .8rem 1rem; border-bottom: 1px solid rgba(255, 255, 255, .08); background: rgba(255, 255, 255, .02); }
.terminal__bar i { width: 11px; height: 11px; border-radius: 50%; background: #3a4260; }
.terminal__bar i:nth-child(1) { background: #ff5f57; }
.terminal__bar i:nth-child(2) { background: #febc2e; }
.terminal__bar i:nth-child(3) { background: #28c840; }
.terminal__bar span { margin-inline-start: .6rem; color: #6c7593; font-size: .78rem; }
.terminal__body { padding: 1.1rem 1.2rem 1.3rem; min-height: 290px; }
.terminal__line { white-space: pre-wrap; word-break: break-all; margin: 0 0 .35rem; }
.terminal__line .p { color: var(--magenta); }
.terminal__line .c { color: #6c7593; }
.terminal__line .k { color: var(--cyan); }
.terminal__line .s { color: #8ee59b; }
.terminal__line .t { color: #ffd479; }
.terminal__log .terminal__line { animation: fadeUp .35s ease both; }
.terminal__cursor { display: inline-block; width: .55em; height: 1.05em; background: var(--cyan); vertical-align: -.15em; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------- Ports strip ---------- */
.ports { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.port {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.2rem 1.3rem; box-shadow: var(--shadow);
}
.port__num { font-family: var(--mono); font-size: 1.6rem; font-weight: 700; color: var(--ink); direction: ltr; display: block; }
.port__name { font-weight: 600; color: var(--ink); display: block; margin-top: .15rem; }
.port__desc { color: var(--muted); font-size: .9rem; display: block; }
.ports-strip { margin-top: calc(-1 * clamp(2.5rem, 5vw, 3.5rem)); position: relative; z-index: 2; }
@media (max-width: 860px) { .ports { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 460px) { .ports { grid-template-columns: 1fr; } }

/* ---------- Cards / grids ---------- */
.grid { display: grid; gap: 1.25rem; }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 980px) { .grid--3, .grid--4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; } }

.card {
  position: relative;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.6rem;
  box-shadow: var(--shadow);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 14px 36px rgba(16, 24, 40, .1); border-color: rgba(0, 176, 240, .35); }
.card h3 { margin-bottom: .45rem; }
.card p { color: var(--muted); margin: 0; }
.card--dark { background: var(--ink-2); border-color: var(--border-dark); box-shadow: none; }
.card--dark p { color: var(--muted-dark); }
.card--dark:hover { border-color: rgba(211, 87, 252, .4); box-shadow: none; }
.card__link { display: inline-flex; align-items: center; gap: .35rem; margin-top: 1rem; font-weight: 600; }
.card__link .icon { width: 1em; height: 1em; }

.icon-tile {
  width: 48px; height: 48px; border-radius: 12px;
  display: grid; place-items: center;
  background: var(--gradient-soft);
  color: var(--cyan-600);
  margin-bottom: 1.1rem;
}
.icon-tile .icon { width: 24px; height: 24px; }
.icon-tile--magenta { color: var(--magenta-600); }
.card--dark .icon-tile { background: rgba(255, 255, 255, .06); color: var(--cyan); }

/* ---------- Steps ---------- */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; counter-reset: step; list-style: none; padding: 0; margin: 0; }
.step { position: relative; padding: 1.8rem 1.6rem 1.6rem; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); }
.step::before {
  counter-increment: step; content: counter(step, decimal-leading-zero);
  font-family: var(--mono); font-weight: 700; font-size: .9rem;
  display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 50%;
  background: var(--gradient); color: #fff; margin-bottom: 1rem;
}
.step h3 { margin-bottom: .4rem; }
.step p { color: var(--muted); margin: 0; }
@media (max-width: 860px) { .steps { grid-template-columns: 1fr; } }

/* ---------- Split / media ---------- */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(2rem, 5vw, 4rem); align-items: center; }
.split--top { align-items: start; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }
.check-list { list-style: none; padding: 0; margin: 1.5rem 0; display: grid; gap: .75rem; }
.check-list li { display: flex; gap: .65rem; align-items: flex-start; }
.check-list .icon { color: #fff; background: var(--gradient); border-radius: 50%; padding: 3px; width: 22px; height: 22px; margin-top: .2em; }
.section--dark .check-list li { color: #dfe5f5; }

/* ---------- Integration visual ---------- */
.merge-visual { position: relative; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1rem; padding: 2rem; border-radius: var(--radius-lg); background: var(--ink-2); border: 1px solid var(--border-dark); direction: ltr; }
.merge-visual__link { align-self: center; }
.merge-visual__node { align-self: stretch; display: flex; flex-direction: column; align-items: center; justify-content: center; background: rgba(255, 255, 255, .04); border: 1px solid var(--border-dark); border-radius: var(--radius); padding: 1.3rem 1rem; text-align: center; color: #fff; font-weight: 700; }
.merge-visual__node img { margin: 0 auto .5rem; width: 84px; }
.merge-visual__node small { display: block; color: var(--muted-dark); font-weight: 500; font-size: .8rem; margin-top: .25rem; }
.logo-plate { display: inline-flex; align-items: center; justify-content: center; background: #fff; border-radius: 10px; padding: .55rem .8rem; margin-bottom: .55rem; box-shadow: 0 6px 18px rgba(0, 0, 0, .25); }
.logo-plate img { width: 132px; height: auto; margin: 0 !important; }
.merge-visual__link { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 50%; background: var(--gradient); color: #fff; box-shadow: 0 0 0 8px rgba(0, 176, 240, .1), 0 0 40px rgba(211, 87, 252, .45); }
.merge-visual__link .icon { width: 24px; height: 24px; }
.merge-visual__foot { grid-column: 1 / -1; text-align: center; color: var(--muted-dark); font-size: .9rem; padding-top: .5rem; border-top: 1px dashed var(--border-dark); margin-top: .5rem; }
html[dir="rtl"] .merge-visual__foot { direction: rtl; }

/* ---------- Page hero (inner pages) ---------- */
.page-hero {
  position: relative; overflow: hidden; isolation: isolate;
  background: var(--ink); color: var(--muted-dark);
  padding-block: clamp(3.2rem, 7vw, 5rem);
}
.page-hero h1 { color: #fff; font-size: clamp(2rem, 4vw, 3rem); margin-bottom: .8rem; }
.page-hero .lead { color: var(--muted-dark); max-width: 720px; margin: 0; }
.breadcrumbs { display: flex; gap: .4rem; flex-wrap: wrap; list-style: none; padding: 0; margin: 0 0 1rem; font-size: .88rem; }
.breadcrumbs a { color: var(--muted-dark); }
.breadcrumbs li + li::before { content: "/"; margin-inline-end: .4rem; color: #4a5373; }

/* ---------- Prose (long content) ---------- */
.prose { font-size: 1.04rem; }
.prose h2 { font-size: clamp(1.4rem, 2.4vw, 1.85rem); margin-top: 2.4em; padding-top: .2em; }
.prose > h2:first-child, .prose section > h2:first-child { margin-top: 0; }
.prose > section + section { margin-top: 3.2rem; }
.prose h3 { margin-top: 1.8em; }
.prose p, .prose li { color: #3a4356; }
.prose ul, .prose ol { padding-inline-start: 1.3rem; margin: 0 0 1.2em; }
.prose li { margin-bottom: .45em; }
.prose li::marker { color: var(--cyan-600); }
.prose table { width: 100%; border-collapse: collapse; margin: 1.2em 0 1.6em; font-size: .95rem; }
.prose th, .prose td { text-align: start; padding: .75rem .9rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.prose th { background: var(--soft); color: var(--ink); font-weight: 600; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); margin: 1.2em 0 1.6em; }
.table-wrap table { margin: 0; }
.table-wrap tr:last-child td { border-bottom: 0; }

.callout {
  display: flex; gap: .9rem; align-items: flex-start;
  padding: 1.1rem 1.25rem; border-radius: var(--radius);
  background: var(--gradient-soft); border: 1px solid rgba(0, 176, 240, .25);
  margin: 1.4em 0;
}
.callout > .icon { color: var(--cyan-600); margin-top: .2em; }
.callout p { margin: 0; color: var(--text); }
.callout--magenta { border-color: rgba(211, 87, 252, .3); }
.callout--magenta > .icon { color: var(--magenta-600); }

/* Docs layout with sticky table of contents */
.doc-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: clamp(2rem, 4vw, 3.5rem); align-items: start; }
.toc { position: sticky; top: calc(var(--header-h) + 1.5rem); font-size: .92rem; }
.toc h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: .8rem; }
html[lang="ar"] .toc h2 { letter-spacing: 0; font-size: .9rem; }
.toc ol { list-style: none; padding: 0; margin: 0; border-inline-start: 2px solid var(--border); }
.toc a { display: block; padding: .35rem .9rem; color: var(--muted); margin-inline-start: -2px; border-inline-start: 2px solid transparent; }
.toc a:hover { color: var(--ink); text-decoration: none; }
.toc a.is-active { color: var(--cyan-600); border-inline-start-color: var(--cyan); font-weight: 600; }
@media (max-width: 960px) {
  .doc-layout { grid-template-columns: 1fr; }
  .toc { position: static; background: var(--soft); border-radius: var(--radius); padding: 1.1rem 1.2rem; }
}

/* ---------- Code blocks & tabs ---------- */
.code {
  background: #0a0f1f; border: 1px solid #1d2747; border-radius: var(--radius);
  overflow: hidden; margin: 1rem 0 1.5rem; text-align: left;
}
.code__bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .5rem .6rem .5rem 1rem; background: #0f1630; border-bottom: 1px solid #1d2747; }
.code__label { font-family: var(--mono); font-size: .78rem; color: #7d88ab; }
.code__copy {
  margin-inline-start: auto;
  display: inline-flex; align-items: center; gap: .35rem;
  background: transparent; border: 1px solid #27325a; color: #aeb8d6;
  border-radius: 8px; padding: .3rem .65rem; font-size: .78rem; cursor: pointer; font-family: var(--font);
}
.code__copy .icon { width: 14px; height: 14px; }
.code__copy:hover { color: #fff; border-color: var(--cyan); }
.code__copy.is-copied { color: #8ee59b; border-color: #2f6b44; }
.code pre { margin: 0; padding: 1.1rem 1.2rem; overflow-x: auto; font-size: .86rem; line-height: 1.7; color: #d6def5; tab-size: 4; }

.tabs { margin: 1rem 0 1.5rem; }
.tabs__list { display: flex; flex-wrap: wrap; gap: .4rem; padding: 0; margin: 0 0 -.4rem; list-style: none; }
.tabs__tab {
  font: inherit; font-size: .9rem; font-weight: 600;
  padding: .55rem 1rem; border-radius: 10px 10px 0 0;
  border: 1px solid var(--border); border-bottom: 0;
  background: var(--soft); color: var(--muted); cursor: pointer;
}
.tabs__tab[aria-selected="true"] { background: #0f1630; color: #fff; border-color: #1d2747; }
.tabs__panel[hidden] { display: none; }
.tabs__panel .code { margin-top: .4rem; border-start-start-radius: 0; }
html[dir="rtl"] .tabs__panel .code { border-start-start-radius: var(--radius); border-start-end-radius: 0; }
.tabs__note { color: var(--muted); font-size: .92rem; }

/* ---------- Diagram ---------- */
.diagram { background: var(--ink); border-radius: var(--radius-lg); padding: clamp(1rem, 3vw, 2rem); margin: 1.5em 0 2em; border: 1px solid #1d2747; }
.diagram svg { width: 100%; height: auto; }
.diagram__caption { color: var(--muted-dark); font-size: .9rem; text-align: center; margin: .8rem 0 0; }

/* ---------- FAQ ---------- */
.faq { display: grid; gap: .75rem; }
.faq details { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); transition: border-color .2s ease, box-shadow .2s ease; }
.faq details[open] { border-color: rgba(0, 176, 240, .4); box-shadow: var(--shadow); }
.faq summary {
  cursor: pointer; list-style: none;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1.1rem 1.3rem; font-weight: 600; color: var(--ink);
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: ""; flex: none; width: 10px; height: 10px;
  border-inline-end: 2px solid var(--cyan-600); border-bottom: 2px solid var(--cyan-600);
  transform: rotate(45deg); transition: transform .2s ease; margin-top: -4px;
}
.faq details[open] summary::after { transform: rotate(-135deg); margin-top: 4px; }
.faq__body { padding: 0 1.3rem 1.2rem; color: var(--muted); }
.faq__body p:last-child { margin: 0; }
.faq-group + .faq-group { margin-top: 3rem; }
.faq-group h2 { font-size: 1.35rem; margin-bottom: 1rem; }

/* ---------- Tools ---------- */
.tool { display: flex; flex-direction: column; }
.tool__logo { width: 128px; height: auto; margin-bottom: .9rem; }
.tool-group + .tool-group { margin-top: 3.5rem; }
.tool-group__title { font-size: 1.35rem; margin-bottom: 1.2rem; }
.tool__tags { display: flex; flex-wrap: wrap; gap: .35rem; margin: .9rem 0 0; padding: 0; list-style: none; }
.tag { font-size: .75rem; font-weight: 600; padding: .2rem .55rem; border-radius: 999px; background: var(--soft); color: var(--muted); border: 1px solid var(--border); }
.tag--brand { background: var(--gradient-soft); color: var(--magenta-600); border-color: rgba(211, 87, 252, .25); }
.tool .card__link { margin-top: auto; padding-top: 1rem; }

/* ---------- Contact ---------- */
.contact-card { text-align: center; }
.contact-card .icon-tile { margin-inline: auto; }
.contact-card a { font-weight: 600; font-size: 1.05rem; }

/* ---------- Join page ---------- */
.join { min-height: calc(100vh - var(--header-h)); display: grid; place-items: center; padding-block: clamp(3rem, 7vw, 5rem); position: relative; overflow: hidden; isolation: isolate; background: var(--ink); }
.join::before { content: ""; position: absolute; inset: 0; z-index: -1; background: radial-gradient(520px 360px at 20% 20%, rgba(0, 176, 240, .25), transparent 70%), radial-gradient(560px 380px at 80% 80%, rgba(211, 87, 252, .25), transparent 70%); }
.join__card { width: min(100% - 2.5rem, 720px); background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: clamp(1.8rem, 5vw, 3rem); text-align: center; }
.join__logos { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-bottom: 1.6rem; direction: ltr; }
.join__logos img { width: 88px; }
.join__logos .merge-visual__link { width: 46px; height: 46px; }
.join__logos img.join__iotbind { width: 150px; height: auto; }
.join h1 { font-size: clamp(1.6rem, 3.4vw, 2.2rem); }
.join__text { color: var(--muted); font-size: 1.05rem; max-width: 560px; margin-inline: auto; }
.join__benefits { list-style: none; padding: 0; margin: 1.6rem auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; text-align: start; }
.join__benefits li { display: flex; gap: .55rem; align-items: flex-start; background: var(--soft); border-radius: var(--radius-sm); padding: .8rem .9rem; font-size: .92rem; color: var(--text); }
.join__benefits .icon { color: var(--cyan-600); margin-top: .15em; width: 1.1em; height: 1.1em; }
@media (max-width: 640px) { .join__benefits { grid-template-columns: 1fr; } }
.join__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .75rem; margin-top: 1.6rem; }
.join__actions .btn { min-width: 220px; }
.countdown { display: flex; align-items: center; justify-content: center; gap: .9rem; margin-top: 1.8rem; padding-top: 1.4rem; border-top: 1px solid var(--border); color: var(--muted); font-size: .95rem; flex-wrap: wrap; }
.countdown__ring { position: relative; width: 48px; height: 48px; flex: none; }
.countdown__ring svg { width: 48px; height: 48px; transform: rotate(-90deg); }
.countdown__ring circle { fill: none; stroke-width: 4; }
.countdown__track { stroke: var(--border); }
.countdown__bar { stroke: url(#cd-gradient); stroke-linecap: round; transition: stroke-dashoffset 1s linear; }
.countdown__num { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 700; color: var(--ink); font-family: var(--mono); }
.countdown__cancel { background: none; border: 0; color: var(--cyan-600); font: inherit; font-weight: 600; cursor: pointer; padding: .2rem .3rem; text-decoration: underline; }
.countdown.is-stopped .countdown__ring { opacity: .35; }
.page-join .cta-band { display: none; }

/* ---------- CTA band ---------- */
.cta-band { background: var(--gradient); color: #fff; padding-block: clamp(2.8rem, 6vw, 4rem); }
.cta-band__inner { display: flex; align-items: center; justify-content: space-between; gap: 2rem; flex-wrap: wrap; }
.cta-band h2 { color: #fff; margin-bottom: .35rem; font-size: clamp(1.5rem, 3vw, 2.1rem); }
.cta-band p { margin: 0; opacity: .92; max-width: 620px; }
.cta-band__actions { display: flex; flex-wrap: wrap; gap: .75rem; }

/* ---------- Footer ---------- */
.site-footer { background: var(--ink); color: var(--muted-dark); padding-top: clamp(3rem, 6vw, 4.5rem); font-size: .95rem; }
.site-footer__grid { display: grid; grid-template-columns: 1.6fr repeat(4, 1fr); gap: 2rem; padding-bottom: 2.5rem; }
.site-footer__brand img { width: 140px; margin-bottom: 1rem; }
.site-footer__brand p { max-width: 320px; }
.site-footer__partner { display: flex; align-items: center; gap: .5rem; font-size: .9rem; }
.site-footer__partner .icon { color: var(--cyan); width: 1.05em; }
.site-footer h3 { color: #fff; font-size: .95rem; margin-bottom: 1rem; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .55rem; }
.site-footer a { color: var(--muted-dark); }
.site-footer a:hover { color: #fff; }
.site-footer__bottom { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; border-top: 1px solid var(--border-dark); padding-block: 1.4rem; font-size: .88rem; }
.site-footer__bottom p { margin: 0; }
@media (max-width: 980px) {
  .site-footer__grid { grid-template-columns: repeat(2, 1fr); }
  .site-footer__brand { grid-column: 1 / -1; }
}

/* ---------- 404 ---------- */
.not-found { text-align: center; padding-block: clamp(4rem, 10vw, 8rem); }
.not-found__code { font-family: var(--mono); font-size: clamp(4rem, 12vw, 7rem); font-weight: 800; line-height: 1; margin-bottom: 1rem; }
.not-found .btn-row { justify-content: center; margin-top: 2rem; }

/* ---------- Misc ---------- */
.hero__grid > *, .split > *, .doc-layout > *, .grid > * { min-width: 0; }
@media (min-width: 641px) { .prose td:first-child { white-space: nowrap; } }
.ports--2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 460px) { .ports--2 { grid-template-columns: 1fr; } }
.card__topic { margin-top: 1rem !important; }
.section--dark :not(pre) > code { background: rgba(255, 255, 255, .06); border-color: var(--border-dark); color: var(--magenta); }
.prose .card h3 { margin-top: 0; }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem; list-style: none; padding: 0; margin: 0; }
.chips li { padding: .55rem 1.1rem; border-radius: 999px; background: #fff; border: 1px solid var(--border); font-weight: 600; color: var(--ink); box-shadow: var(--shadow); font-family: var(--font); }
.center { text-align: center; }
.link-icon { display: inline-flex; align-items: center; gap: .35rem; }
.link-icon .icon { width: 1em; height: 1em; }
.mt-2 { margin-top: 2rem; }
.mt-1 { margin-top: 1rem; }

/* ---------- Reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s ease; }
.reveal.is-visible { opacity: 1; transform: none; }
.no-js .reveal { opacity: 1; transform: none; }
