/* ============================================================
   QSolid — High-Tech Industrial Design System
   Geometric Kernel SDK · CAD/CAM/CAE
   ============================================================ */

:root {
  /* surfaces */
  --bg-0: #e7edf4;
  --bg-1: #eef3f9;
  --bg-2: #ffffff;
  --panel: #ffffff;
  --panel-2: #eaf1f8;
  --line: rgba(37, 71, 110, 0.16);
  --line-strong: rgba(37, 71, 110, 0.30);

  /* text */
  --text: #1c2836;
  --text-dim: #46586e;
  --text-mute: #6d7f95;

  /* accents */
  --cyan: #0b8aa8;
  --cyan-bright: #0a6f88;
  --blue: #2563eb;
  --amber: #c76a12;
  --amber-bright: #a85608;

  /* type */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", ui-monospace, Consolas,
    "Cascadia Code", "Courier New", monospace;

  /* metrics */
  --maxw: 1200px;
  --radius: 4px;
  --gutter: clamp(20px, 5vw, 56px);
  --header-h: 68px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--text);
  background-color: var(--bg-0);
  background-image:
    radial-gradient(1100px 620px at 82% -8%, rgba(11, 138, 168, 0.10), transparent 60%),
    radial-gradient(900px 560px at 8% 4%, rgba(37, 99, 235, 0.08), transparent 58%),
    linear-gradient(rgba(37, 71, 110, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(37, 71, 110, 0.05) 1px, transparent 1px),
    linear-gradient(180deg, #eef3f9, #f4f8fc 40%, #e7edf4);
  background-size: auto, auto, 46px 46px, 46px 46px, auto;
  background-attachment: fixed;
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--cyan); text-decoration: none; transition: color .2s ease; }
a:hover { color: var(--cyan-bright); }

img { max-width: 100%; display: block; }

h1, h2, h3, h4 { line-height: 1.2; margin: 0; font-weight: 700; letter-spacing: -0.01em; }
p { margin: 0 0 1rem; }

::selection { background: rgba(11, 138, 168, 0.22); color: #06283a; }

/* ---------- layout helpers ---------- */
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }
.section { padding: clamp(56px, 9vw, 110px) 0; }
.section--tight { padding: clamp(40px, 6vw, 72px) 0; }
.mono { font-family: var(--font-mono); }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 18px;
}
.eyebrow::before {
  content: "";
  width: 26px; height: 1px;
  background: linear-gradient(90deg, var(--cyan), transparent);
}
.eyebrow--amber { color: var(--amber); }
.eyebrow--amber::before { background: linear-gradient(90deg, var(--amber), transparent); }

.section-title { font-size: clamp(26px, 3.6vw, 40px); margin-bottom: 14px; }
.section-title .accent { color: var(--cyan); }
.section-lead { color: var(--text-dim); font-size: clamp(15px, 1.6vw, 18px); max-width: 62ch; }

/* ---------- top bar / navigation ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  background: rgba(248, 251, 254, 0.82);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--line);
}
.site-header::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(11,138,168,.5), rgba(199,106,18,.35), transparent);
  opacity: .6;
}
.nav {
  width: 100%; max-width: var(--maxw); margin: 0 auto;
  padding: 0 var(--gutter);
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
}
.brand { display: inline-flex; align-items: center; gap: 12px; color: #10202f; }
.brand:hover { color: #10202f; }
.brand__mark { width: 34px; height: 34px; flex: none; filter: drop-shadow(0 0 8px rgba(11,138,168,.3)); }
.brand__name { font-size: 20px; font-weight: 800; letter-spacing: 0.02em; }
.brand__name b { color: var(--cyan); font-weight: 800; }
.brand__sub {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--text-mute); display: block; margin-top: 1px;
}

.nav__links { display: flex; align-items: center; gap: 6px; list-style: none; margin: 0; padding: 0; }
.nav__links a {
  position: relative;
  display: block;
  padding: 9px 15px;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-dim);
  border-radius: var(--radius);
  letter-spacing: 0.01em;
  transition: color .2s, background .2s;
}
.nav__links a:hover { color: #10202f; background: rgba(37,71,110,.07); }
.nav__links a.current { color: #10202f; }
.nav__links a.current::after {
  content: ""; position: absolute; left: 15px; right: 15px; bottom: 3px; height: 2px;
  background: var(--cyan); box-shadow: 0 0 10px var(--cyan); border-radius: 2px;
}

.nav__toggle {
  display: none; width: 42px; height: 42px; border: 1px solid var(--line-strong);
  background: rgba(120,160,210,.06); border-radius: var(--radius); cursor: pointer;
  align-items: center; justify-content: center; flex-direction: column; gap: 5px;
}
.nav__toggle span { width: 18px; height: 2px; background: var(--text); border-radius: 2px; transition: .25s; }

/* ---------- hero ---------- */
.hero { position: relative; padding: clamp(64px, 10vw, 130px) 0 clamp(48px, 7vw, 90px); overflow: hidden; }
.hero__grid { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: clamp(32px, 5vw, 64px); align-items: center; }
.hero h1 {
  font-size: clamp(34px, 5.4vw, 62px);
  line-height: 1.05;
  margin-bottom: 22px;
  letter-spacing: -0.02em;
}
.hero h1 .grad {
  background: linear-gradient(100deg, var(--cyan-bright), var(--blue) 55%, var(--amber));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero__lead { font-size: clamp(16px, 1.9vw, 20px); color: var(--text-dim); max-width: 56ch; margin-bottom: 30px; }
.hero__tags { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 32px; }
.hero__tags span {
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.08em;
  color: var(--text-dim); border: 1px solid var(--line-strong);
  padding: 6px 12px; border-radius: 999px; background: rgba(120,160,210,.05);
}
.btn-row { display: flex; flex-wrap: wrap; gap: 14px; }
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 26px; border-radius: var(--radius);
  font-weight: 700; font-size: 15px; letter-spacing: 0.01em;
  border: 1px solid transparent; cursor: pointer; transition: transform .18s, box-shadow .18s, background .2s, border-color .2s;
}
.btn svg { width: 16px; height: 16px; }
.btn--primary { background: linear-gradient(120deg, var(--cyan), var(--blue)); color: #ffffff; box-shadow: 0 8px 26px -10px rgba(11,138,168,.5); }
.btn--primary:hover { transform: translateY(-2px); color: #ffffff; box-shadow: 0 14px 34px -10px rgba(11,138,168,.6); }
.btn--ghost { background: rgba(37,71,110,.04); border-color: var(--line-strong); color: var(--text); }
.btn--ghost:hover { border-color: var(--cyan); color: #10202f; transform: translateY(-2px); }
.btn--amber { background: linear-gradient(120deg, #e8821e, #cf5a12); color: #ffffff; box-shadow: 0 8px 26px -10px rgba(199,106,18,.5); }
.btn--amber:hover { transform: translateY(-2px); color: #ffffff; }

/* hero visual panel */
.hero__visual {
  position: relative;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background:
    linear-gradient(rgba(120,160,210,.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120,160,210,.06) 1px, transparent 1px),
    linear-gradient(160deg, var(--panel-2), var(--bg-1));
  background-size: 26px 26px, 26px 26px, auto;
  padding: 22px;
  box-shadow: 0 24px 60px -40px rgba(30,60,100,.35), inset 0 0 60px rgba(11,138,168,.05);
}
.hero__visual .corner { position: absolute; width: 16px; height: 16px; border: 2px solid var(--cyan); opacity: .7; }
.hero__visual .corner.tl { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.hero__visual .corner.tr { top: -1px; right: -1px; border-left: 0; border-bottom: 0; }
.hero__visual .corner.bl { bottom: -1px; left: -1px; border-right: 0; border-top: 0; }
.hero__visual .corner.br { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }
.hero__visual .cap {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-mute); display: flex; justify-content: space-between; margin-bottom: 14px;
}
.hero__curve { width: 100%; height: auto; }

/* ---------- stat strip ---------- */
.stats { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: rgba(255,255,255,.55); }
.stats__row { display: grid; grid-template-columns: repeat(4, 1fr); }
.stat { padding: 26px 20px; text-align: center; border-right: 1px solid var(--line); }
.stat:last-child { border-right: 0; }
.stat__num { font-family: var(--font-mono); font-size: clamp(26px, 3vw, 38px); font-weight: 700; color: var(--cyan); line-height: 1; }
.stat__num .u { color: var(--amber); }
.stat__label { font-size: 13px; color: var(--text-mute); margin-top: 8px; letter-spacing: 0.04em; }

/* ---------- feature cards ---------- */
.grid { display: grid; gap: 20px; }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }

.card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: linear-gradient(180deg, var(--panel), var(--bg-1));
  padding: 26px 24px;
  overflow: hidden;
  transition: transform .2s, border-color .2s, box-shadow .2s;
}
.card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--cyan), transparent);
  opacity: 0; transition: opacity .25s;
}
.card:hover { transform: translateY(-4px); border-color: var(--line-strong); box-shadow: 0 18px 40px -28px rgba(30,60,100,.45); }
.card:hover::before { opacity: 1; }
.card__idx {
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.1em;
  color: var(--amber); margin-bottom: 14px; display: block;
}
.card__icon {
  width: 46px; height: 46px; border-radius: 8px; margin-bottom: 18px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(11,138,168,.10); border: 1px solid rgba(11,138,168,.26); color: var(--cyan);
}
.card__icon svg { width: 24px; height: 24px; }
.card h3 { font-size: 19px; margin-bottom: 10px; color: #10202f; }
.card p { color: var(--text-dim); font-size: 15px; margin: 0; }

/* ---------- prose / content panel ---------- */
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--panel), var(--bg-1));
  padding: clamp(26px, 4vw, 46px);
}
.prose { color: var(--text-dim); font-size: 16px; max-width: 78ch; }
.prose h2 { color: #10202f; font-size: 22px; margin: 34px 0 14px; }
.prose h3 { color: #10202f; font-size: 18px; margin: 26px 0 10px; }
.prose strong { color: var(--text); }
.prose .hl { color: var(--cyan); font-weight: 600; }
.prose ol, .prose ul { padding-left: 1.2rem; }
.prose li { margin-bottom: 10px; }
.prose .en { color: var(--text-mute); font-size: 15px; }

/* ---------- resource link cards (navigation) ---------- */
.res-group { margin-bottom: 34px; }
.res-group__title {
  display: flex; align-items: center; gap: 12px;
  font-family: var(--font-mono); font-size: 14px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--cyan); padding-bottom: 12px; margin-bottom: 16px; border-bottom: 1px solid var(--line);
}
.res-group__title .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 10px var(--amber); }
.link-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.link-list a {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 14px 18px; border: 1px solid var(--line); border-radius: var(--radius);
  background: rgba(120,160,210,.03); color: var(--text); font-weight: 500;
  transition: border-color .2s, background .2s, transform .2s;
}
.link-list a:hover { border-color: var(--cyan); background: rgba(11,138,168,.07); transform: translateX(4px); color: #10202f; }
.link-list a .arrow { color: var(--text-mute); font-family: var(--font-mono); flex: none; }
.link-list a:hover .arrow { color: var(--cyan); }

/* ---------- code / example tree ---------- */
.tree { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line-strong); }
.tree > li { position: relative; padding: 4px 0 4px 22px; }
.tree > li::before { content: ""; position: absolute; left: 0; top: 16px; width: 14px; height: 1px; background: var(--line-strong); }
.tree__head { font-family: var(--font-mono); color: var(--amber); font-size: 14px; letter-spacing: 0.04em; margin: 8px 0; }
.tree a { display: block; padding: 8px 14px; border-radius: var(--radius); color: var(--text-dim); border: 1px solid transparent; }
.tree a:hover { color: #10202f; background: rgba(11,138,168,.08); border-color: var(--line); }

/* ---------- demo gallery ---------- */
.demo-block { margin-bottom: 56px; }
.demo-block__title { font-size: clamp(20px, 2.4vw, 26px); color: #10202f; margin-bottom: 8px; }
.demo-block__title .num { font-family: var(--font-mono); color: var(--cyan); margin-right: 12px; }
.demo-block__desc { color: var(--text-dim); max-width: 70ch; margin-bottom: 24px; }
.specimen-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.specimen {
  border: 1px solid var(--line); border-radius: 6px; overflow: hidden;
  background: linear-gradient(180deg, var(--panel), var(--bg-1));
  transition: transform .2s, border-color .2s, box-shadow .2s;
}
.specimen:hover { transform: translateY(-4px); border-color: var(--line-strong); box-shadow: 0 18px 40px -28px rgba(30,60,100,.45); }
.specimen__img { background: #eef3f8; padding: 14px; display: flex; align-items: center; justify-content: center; }
.specimen__img img { max-height: 320px; width: auto; }
.specimen__cap {
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.08em; color: var(--text-mute);
  padding: 12px 16px; border-top: 1px solid var(--line); display: flex; justify-content: space-between;
}
.specimen__cap b { color: var(--cyan); font-weight: 600; }

/* ---------- contact ---------- */
.contact-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-bottom: 40px; }
.contact-card {
  border: 1px solid var(--line); border-radius: 6px; padding: 26px;
  background: linear-gradient(180deg, var(--panel), var(--bg-1)); text-align: center;
  transition: transform .2s, border-color .2s;
}
.contact-card:hover { transform: translateY(-4px); border-color: var(--cyan); }
.contact-card .ic { width: 48px; height: 48px; margin: 0 auto 14px; color: var(--cyan); }
.contact-card .label { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-mute); }
.contact-card .value { font-size: 18px; color: #10202f; font-weight: 700; margin-top: 6px; word-break: break-all; }

/* ---------- footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, var(--bg-1), var(--bg-0));
  margin-top: 40px;
}
.footer__inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px; padding: 34px 0; }
.footer__menu { list-style: none; display: flex; flex-wrap: wrap; gap: 22px; margin: 0; padding: 0; }
.footer__menu a { color: var(--text-dim); font-size: 14px; }
.footer__menu a:hover { color: var(--cyan); }
.footer__meta { color: var(--text-mute); font-size: 13px; font-family: var(--font-mono); }
.footer__brand { display: flex; align-items: center; gap: 10px; color: var(--text-dim); font-size: 14px; }
.footer__brand svg { width: 26px; height: 26px; }

/* ---------- page banner (sub-pages) ---------- */
.page-head { padding: clamp(48px, 7vw, 84px) 0 clamp(28px, 4vw, 44px); border-bottom: 1px solid var(--line); }
.page-head h1 { font-size: clamp(30px, 4.4vw, 48px); margin-bottom: 12px; }
.page-head p { color: var(--text-dim); font-size: clamp(15px, 1.7vw, 18px); max-width: 64ch; margin: 0; }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .hero__grid { grid-template-columns: 1fr; }
  .hero__visual { order: -1; }
  .grid--3, .grid--4 { grid-template-columns: repeat(2, 1fr); }
  .stats__row { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(2) { border-right: 0; }
  .stat:nth-child(1), .stat:nth-child(2) { border-bottom: 1px solid var(--line); }
}

@media (max-width: 820px) {
  .nav__toggle { display: flex; }
  .nav__links {
    position: fixed; inset: var(--header-h) 0 auto 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: rgba(248,251,254,.98); backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line-strong);
    padding: 10px var(--gutter) 20px;
    transform: translateY(-130%); transition: transform .3s ease; max-height: calc(100vh - var(--header-h)); overflow:auto;
  }
  .nav__links.open { transform: translateY(0); }
  .nav__links a { padding: 14px 8px; border-bottom: 1px solid var(--line); }
  .nav__links a.current::after { display: none; }
}

@media (max-width: 640px) {
  .grid--2, .grid--3, .grid--4, .specimen-grid, .contact-grid { grid-template-columns: 1fr; }
  .stats__row { grid-template-columns: 1fr 1fr; }
  .footer__inner { flex-direction: column; align-items: flex-start; }
  .brand__sub { display: none; }
}

/* ---------- example pages: code windows, tabs, badges ---------- */
.example-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  margin-bottom: 26px;
}
.crumb { font-family: var(--font-mono); font-size: 12.5px; letter-spacing: 0.08em; color: var(--text-mute); }
.crumb a { color: var(--cyan); }
.crumb .sep { color: var(--line-strong); margin: 0 8px; }

.lang-badge {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--font-mono); font-size: 11.5px; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase;
  padding: 5px 11px; border-radius: 999px; line-height: 1;
  border: 1px solid var(--line-strong); background: rgba(120,160,210,.06); color: var(--text-dim);
}
.lang-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.lang-badge--cpp { color: #0b6fa8; border-color: rgba(11,111,168,.35); background: rgba(11,111,168,.08); }
.lang-badge--cs  { color: #2f8f4e; border-color: rgba(47,143,78,.35); background: rgba(47,143,78,.08); }
.lang-badge--both { color: var(--amber); border-color: rgba(199,106,18,.35); background: rgba(199,106,18,.08); }

.code-window {
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #0d1620;
  overflow: hidden;
  box-shadow: 0 30px 70px -46px rgba(6,26,42,.6), inset 0 0 0 1px rgba(255,255,255,.02);
  margin: 0 0 30px;
}
.code-window__bar {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 11px 16px;
  background: linear-gradient(180deg, #12202e, #0d1620);
  border-bottom: 1px solid rgba(120,160,210,.16);
}
.code-window__file {
  font-family: var(--font-mono); font-size: 12.5px; letter-spacing: 0.06em;
  color: #9dc0d6; display: flex; align-items: center; gap: 10px; min-width: 0;
}
.code-window__file .dots { display: inline-flex; gap: 6px; flex: none; }
.code-window__file .dots i { width: 11px; height: 11px; border-radius: 50%; display: block; }
.code-window__file .dots i:nth-child(1) { background: #ff5f56; }
.code-window__file .dots i:nth-child(2) { background: #ffbd2e; }
.code-window__file .dots i:nth-child(3) { background: #27c93f; }
.code-window__file .fname { color: #cfe6f5; }
.code-window__file .tag { color: #ff9d2e; font-weight: 700; }

.code-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.code-copy {
  font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase;
  color: #9dc0d6; background: rgba(120,160,210,.10);
  border: 1px solid rgba(120,160,210,.24); border-radius: 5px;
  padding: 6px 12px; cursor: pointer; transition: background .2s, color .2s, border-color .2s;
}
.code-copy:hover { background: rgba(11,138,168,.28); color: #eaf6ff; border-color: rgba(11,138,168,.5); }
.code-copy.done { background: rgba(39,201,63,.22); color: #d6ffe0; border-color: rgba(39,201,63,.5); }

.code-scroll { overflow: auto; max-height: 620px; }
.code-scroll::-webkit-scrollbar { width: 10px; height: 10px; }
.code-scroll::-webkit-scrollbar-thumb { background: rgba(120,160,210,.28); border-radius: 8px; }
pre.code {
  margin: 0; padding: 18px 22px;
  font-family: var(--font-mono); font-size: 13px; line-height: 1.68;
  color: #d7e7f2; white-space: pre; tab-size: 4; -moz-tab-size: 4;
}
pre.code .t-com { color: #5f7f97; font-style: italic; }
pre.code .t-str { color: #7fd39a; }
pre.code .t-key { color: #4fb0e6; font-weight: 600; }
pre.code .t-typ { color: #ffb877; }
pre.code .t-num { color: #e6d177; }
pre.code .t-pre { color: #d183e6; }
pre.code .t-fn  { color: #6fe0d0; }

/* language tabs (index showcase) */
.lang-tabs { display: inline-flex; gap: 4px; padding: 4px; background: rgba(120,160,210,.10); border: 1px solid var(--line); border-radius: 8px; }
.lang-tab {
  font-family: var(--font-mono); font-size: 12.5px; font-weight: 700; letter-spacing: 0.08em;
  color: var(--text-dim); background: transparent; border: 0; border-radius: 6px;
  padding: 7px 16px; cursor: pointer; transition: background .2s, color .2s;
}
.lang-tab:hover { color: #10202f; }
.lang-tab.active { background: var(--cyan); color: #fff; box-shadow: 0 4px 14px -6px rgba(11,138,168,.6); }

/* category showcase cards on the examples index */
.ex-cat { border: 1px solid var(--line); border-radius: 8px; background: linear-gradient(180deg, var(--panel), var(--bg-1)); padding: 24px 22px; }
.ex-cat__title { display: flex; align-items: center; gap: 10px; font-size: 18px; color: #10202f; margin-bottom: 6px; }
.ex-cat__title .ic { width: 22px; height: 22px; color: var(--cyan); flex: none; }
.ex-cat__desc { color: var(--text-dim); font-size: 14px; margin-bottom: 16px; }
.ex-cat ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ex-cat li a { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px; border: 1px solid transparent; border-radius: var(--radius); color: var(--text); font-size: 14.5px; }
.ex-cat li a:hover { border-color: var(--line-strong); background: rgba(11,138,168,.06); color: #10202f; }
.ex-cat li a .arrow { color: var(--text-mute); font-family: var(--font-mono); }
.ex-cat li a:hover .arrow { color: var(--cyan); }
.ex-cat--cover li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 12px; border: 1px solid transparent; border-radius: var(--radius); font-size: 14.5px; color: var(--text); transition: border-color .2s, background .2s; }
.ex-cat--cover li:hover { border-color: var(--line-strong); background: rgba(11,138,168,.05); }
.ex-cat--cover li > span:first-child { color: var(--text); font-weight: 500; }

/* ---------- example image gallery + lightbox ---------- */
.ex-gallery { margin: 0 0 30px; }
.ex-gallery__title {
  display: flex; align-items: center; gap: 12px;
  font-family: var(--font-mono); font-size: 14px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--cyan); padding-bottom: 12px; margin-bottom: 18px; border-bottom: 1px solid var(--line);
}
.ex-gallery__title .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 10px var(--amber); }
.ex-gallery__title .cnt { margin-left: auto; color: var(--text-mute); letter-spacing: 0.06em; }
.ex-gallery__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.ex-shot {
  display: block; border: 1px solid var(--line-strong); border-radius: 6px; overflow: hidden;
  background: #ffffff; cursor: zoom-in; text-decoration: none;
  transition: transform .18s, box-shadow .18s, border-color .18s;
}
.ex-shot:hover { transform: translateY(-3px); border-color: var(--cyan); box-shadow: 0 16px 34px -22px rgba(11,138,168,.6); }
.ex-shot__media { aspect-ratio: 4 / 3; display: flex; align-items: center; justify-content: center; background: #eef3f8; overflow: hidden; }
.ex-shot__media img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.ex-shot figcaption {
  font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.04em; color: var(--text-dim);
  padding: 9px 12px; border-top: 1px solid var(--line); background: var(--panel); text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.qs-lightbox {
  position: fixed; inset: 0; z-index: 200; display: none;
  align-items: center; justify-content: center; padding: 5vh 5vw;
  background: rgba(6,14,22,.86); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.qs-lightbox.open { display: flex; }
.qs-lightbox__img { max-width: 92vw; max-height: 84vh; background: #fff; border-radius: 6px; box-shadow: 0 30px 80px -30px rgba(0,0,0,.7); padding: 8px; }
.qs-lightbox__cap { position: absolute; left: 0; right: 0; bottom: 20px; text-align: center; color: #cfe6f5; font-family: var(--font-mono); font-size: 13px; letter-spacing: 0.06em; }
.qs-lightbox__close { position: absolute; top: 18px; right: 22px; width: 42px; height: 42px; border-radius: 50%; border: 1px solid rgba(120,160,210,.4); background: rgba(120,160,210,.12); color: #eaf6ff; font-size: 22px; line-height: 1; cursor: pointer; }
.qs-lightbox__close:hover { background: rgba(11,138,168,.4); }

/* ---------- language switcher (injected by js/i18n.js) ---------- */
.qs-lang { display: flex; align-items: center; }

.qs-lang__sel {
  font-family: var(--font-mono); font-size: 12.5px; font-weight: 600; letter-spacing: 0.06em;
  color: var(--text-dim); background-color: rgba(120,160,210,.08);
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  padding: 8px 26px 8px 10px; cursor: pointer;
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='rgb(70,88,110)' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; background-size: 10px 6px;
  transition: color .2s, border-color .2s, background-color .2s;
}
.qs-lang__sel:hover { color: #10202f; border-color: var(--cyan); background-color: rgba(11,138,168,.10); }
.qs-lang__sel:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.qs-lang__sel option { color: var(--text); background: var(--panel); font-family: var(--font-sans); letter-spacing: normal; }

@media (max-width: 820px) {
  .qs-lang { padding-top: 14px; }
  .qs-lang__sel { width: 100%; padding: 12px 26px 12px 10px; font-size: 14px; }
}

/* ---------- right-to-left languages ---------- */
/* Arabic script must stay joined, so the technical tracking is dropped. */
html[dir="rtl"] {
  --font-sans: "Segoe UI", Tahoma, "Noto Sans Arabic", "Noto Naskh Arabic", "Geeza Pro",
    "Microsoft YaHei", Roboto, Arial, sans-serif;
}
html[dir="rtl"] h1, html[dir="rtl"] h2, html[dir="rtl"] h3, html[dir="rtl"] h4,
html[dir="rtl"] p, html[dir="rtl"] a, html[dir="rtl"] li, html[dir="rtl"] figcaption,
html[dir="rtl"] button, html[dir="rtl"] td, html[dir="rtl"] .eyebrow { letter-spacing: normal; }

/* Code, identifiers and file names never mirror: keep them left-to-right. */
html[dir="rtl"] pre.code, html[dir="rtl"] .code-window, html[dir="rtl"] code,
html[dir="rtl"] .mono, html[dir="rtl"] .crumb, html[dir="rtl"] .lang-badge,
html[dir="rtl"] .stat__num, html[dir="rtl"] .card__idx, html[dir="rtl"] .qs-lang__sel,
html[dir="rtl"] .link-list a .arrow, html[dir="rtl"] .ex-cat li a .arrow {
  direction: ltr; unicode-bidi: isolate; text-align: left;
}
html[dir="rtl"] .prose p, html[dir="rtl"] .section-title { unicode-bidi: plaintext; }

html[dir="rtl"] .prose ol, html[dir="rtl"] .prose ul { padding-left: 0; padding-right: 1.2rem; }
html[dir="rtl"] .link-list a:hover { transform: translateX(-4px); }
html[dir="rtl"] .stat { border-right: 0; border-left: 1px solid var(--line); }
html[dir="rtl"] .stat:last-child { border-left: 0; }
html[dir="rtl"] .tree { border-left: 0; border-right: 1px solid var(--line-strong); }
html[dir="rtl"] .tree > li { padding: 4px 22px 4px 0; }
html[dir="rtl"] .tree > li::before { left: auto; right: 0; }
html[dir="rtl"] .ex-gallery__title .cnt { margin-left: 0; margin-right: auto; }
html[dir="rtl"] .qs-lightbox__close { right: auto; left: 22px; }

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto; transition: none !important; } }
