/* ==========================================================================
   Wuanlan — "Signal" design system (Hebrew / RTL)
   Deep slate-teal ground, lime signal accents, sky counterpoint, 1px grid
   and hairline panels. RTL-first, no external fonts, no libraries.
   ========================================================================== */

:root {
  /* surfaces */
  --bg: #0c1417;
  --bg-alt: #0f1a1e;
  --bg-card: #121f24;
  --bg-card-hi: #16262c;
  --bg-deep: #060d0f;
  --panel: #101c20;

  /* lines */
  --border: #22363c;
  --border-soft: #1a2b30;
  --border-hi: #33505a;

  /* type */
  --text: #c9dbdd;
  --muted: #8ba3a7;
  --heading: #f1fbf6;

  /* accents */
  --lime: #bef264;
  --lime-deep: #a3e635;
  --sky: #38bdf8;
  --rose: #fb7185;
  --warn: #fda4af;

  --accent: var(--lime);
  --accent-soft: rgba(190, 242, 100, 0.09);
  --accent-line: rgba(190, 242, 100, 0.34);
  --sky-soft: rgba(56, 189, 248, 0.09);
  --warn-soft: rgba(251, 113, 133, 0.08);

  /* geometry */
  --radius: 5px;
  --radius-sm: 3px;
  --max: 1130px;
  --measure: 700px;
  --header-h: 68px;

  --font: "Heebo", "Assistant", "Segoe UI", "Arial Hebrew", Arial, sans-serif;
  --mono: "Cascadia Mono", "Consolas", "Courier New", monospace;

  --ease: cubic-bezier(0.2, 0.62, 0.3, 1);
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  color-scheme: dark;
}

body {
  font-family: var(--font);
  background-color: var(--bg);
  color: var(--text);
  font-size: 17px;
  line-height: 1.85;
  overflow-x: hidden;
  position: relative;
  isolation: isolate;
  -webkit-font-smoothing: antialiased;
}

/* hairline measurement grid + two cold glows */
body::before,
body::after {
  content: "";
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
}
body::before {
  background:
    radial-gradient(760px 420px at 88% -10%, rgba(190, 242, 100, 0.10), transparent 70%),
    radial-gradient(700px 400px at 4% 6%, rgba(56, 189, 248, 0.08), transparent 72%),
    radial-gradient(620px 380px at 60% 106%, rgba(163, 230, 53, 0.05), transparent 70%);
}
body::after {
  background-image:
    linear-gradient(to right, rgba(139, 163, 167, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(139, 163, 167, 0.035) 1px, transparent 1px);
  background-size: 84px 84px, 84px 84px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 10%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 10%, transparent 80%);
}

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

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

a {
  color: var(--sky);
  text-decoration: none;
  text-underline-offset: 3px;
  transition: color 0.16s var(--ease);
}
a:hover { color: var(--lime); }

a:focus-visible,
button:focus-visible,
summary:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 3px;
  border-radius: 2px;
}

h1, h2, h3, h4 {
  color: var(--heading);
  line-height: 1.3;
  font-weight: 800;
  letter-spacing: 0;
  text-wrap: balance;
}
h1 { font-size: clamp(1.9rem, 1.4rem + 1.8vw, 2.85rem); line-height: 1.2; }
h2 { font-size: clamp(1.35rem, 1.15rem + 0.8vw, 1.72rem); }
h3 { font-size: 1.13rem; }
h4 { font-size: 1rem; }

p { margin-bottom: 1rem; }
strong, b { color: var(--heading); font-weight: 700; }
small { font-size: 0.86rem; }

ul, ol { padding-inline-start: 1.3rem; margin-bottom: 1rem; }
li { margin-bottom: 0.4rem; }
li::marker { color: var(--lime-deep); }
li > ul, li > ol { margin-top: 0.4rem; margin-bottom: 0.4rem; }

hr {
  border: none; height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-hi), transparent);
  margin: 2.2rem 0;
}

::selection { background: rgba(190, 242, 100, 0.28); color: #fff; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); border: 0;
}

.skip-link {
  position: fixed; inset-inline-start: 1rem; top: -60px; z-index: 300;
  background: var(--lime); color: #08120a;
  font-weight: 700; padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  transition: top 0.2s var(--ease);
}
.skip-link:focus { top: 1rem; }

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

.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(12, 20, 23, 0.93);
  border-bottom: 1px solid var(--border);
  transition: background 0.22s var(--ease), box-shadow 0.22s var(--ease);
}
.site-header.is-stuck {
  background: rgba(9, 16, 18, 0.98);
  box-shadow: 0 12px 30px -24px #000;
}
.site-header::after {
  content: "";
  position: absolute; inset-inline: 0; bottom: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--lime), transparent);
  opacity: 0.35;
}
.site-header.is-stuck::after { opacity: 0.7; }

.header-inner {
  max-width: var(--max); margin-inline: auto; padding-inline: 1.5rem;
  height: var(--header-h); display: flex; align-items: center; gap: 1.6rem;
}

.logo {
  display: inline-flex; align-items: center; gap: 0.55rem;
  color: var(--heading); font-weight: 800; font-size: 1.08rem;
  text-decoration: none; flex: none;
}
.logo-mark { display: inline-flex; flex: none; }
.logo svg { width: 34px; height: 34px; display: block; border-radius: 8px; }
.logo-text {
  font-family: var(--mono);
  letter-spacing: 0.02em;
  unicode-bidi: isolate;
}

.nav { margin-inline-start: auto; }
.nav-links {
  display: flex; align-items: center; gap: 0.1rem;
  list-style: none; padding: 0; margin: 0;
}
.nav-links a {
  position: relative; display: inline-block;
  color: var(--text); font-size: 0.95rem; font-weight: 600;
  padding: 0.4rem 0.66rem;
  border-radius: var(--radius-sm);
  transition: color 0.16s var(--ease), background 0.16s var(--ease);
}
.nav-links a::after {
  content: ""; position: absolute;
  inset-inline: 0.66rem; bottom: 0.12rem; height: 2px;
  background: var(--lime);
  transform: scaleX(0);
  transition: transform 0.22s var(--ease);
}
.nav-links a:hover { color: var(--heading); background: rgba(255, 255, 255, 0.03); }
.nav-links a:hover::after { transform: scaleX(1); }
.nav-links a[aria-current="page"] { color: var(--lime); background: var(--accent-soft); }
.nav-links a[aria-current="page"]::after { transform: scaleX(1); }

.menu-toggle {
  display: none; margin-inline-start: auto;
  background: var(--bg-card); border: 1px solid var(--border-hi);
  color: var(--heading); width: 42px; height: 42px;
  border-radius: var(--radius-sm); font-size: 1.05rem;
  cursor: pointer; line-height: 1;
}

/* ---------- buttons & tags ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.72rem 1.35rem;
  border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 0.95rem; font-weight: 700;
  border: 1px solid transparent; cursor: pointer;
  text-decoration: none; white-space: nowrap;
  transition: background 0.18s var(--ease), color 0.18s var(--ease),
    border-color 0.18s var(--ease), transform 0.18s var(--ease);
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }

.btn-primary {
  background: var(--lime);
  color: #08120a;
  border-color: var(--lime);
}
.btn-primary:hover { background: #d9f99d; border-color: #d9f99d; color: #08120a; }

.btn-ghost {
  background: transparent;
  color: var(--heading);
  border-color: var(--border-hi);
}
.btn-ghost:hover {
  color: var(--lime);
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

.tag {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-family: var(--mono);
  font-size: 0.72rem; font-weight: 700;
  color: #dbf9ab;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  padding: 0.16rem 0.55rem;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}
.tag::before {
  content: ""; width: 5px; height: 5px; flex: none;
  background: var(--lime);
}
.tag--cyan {
  color: #bfe9ff;
  background: var(--sky-soft);
  border-color: rgba(56, 189, 248, 0.32);
}
.tag--cyan::before { background: var(--sky); }

/* ---------- layout ---------- */

.wrap { max-width: var(--max); margin-inline: auto; padding-inline: 1.5rem; }
.wrap--narrow { max-width: 810px; }
.wrap--prose { max-width: 780px; }
.wrap--prose.prose { max-width: 780px; }

main { counter-reset: sec; }

.section { padding-block: 3.4rem; }
.section--tight { padding-block: 2rem; }

.section--alt {
  background:
    linear-gradient(180deg, rgba(190, 242, 100, 0.025), transparent 45%),
    var(--bg-alt);
  border-block: 1px solid var(--border-soft);
}

.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem; margin-bottom: 1.7rem; flex-wrap: wrap;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--border);
}
.section-head h2 { margin: 0; display: flex; align-items: baseline; gap: 0.6rem; }
.section-head h2::before {
  counter-increment: sec;
  content: "//" counter(sec, decimal-leading-zero);
  font-family: var(--mono);
  font-size: 0.78rem; font-weight: 700;
  color: var(--lime-deep);
  direction: ltr;
}
.section-head .more {
  font-size: 0.9rem; font-weight: 700; color: var(--muted);
  padding: 0.2rem 0.55rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  transition: color 0.16s var(--ease), border-color 0.16s var(--ease);
}
.section-head .more:hover {
  color: var(--lime); border-color: var(--accent-line);
  text-decoration: none;
}

.eyebrow {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.76rem; font-weight: 700;
  color: var(--lime);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-inline-start: 3px solid var(--lime);
  padding: 0.28rem 0.65rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
}

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

.hero {
  position: relative;
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(700px 340px at 84% 0%, rgba(190, 242, 100, 0.11), transparent 68%),
    linear-gradient(180deg, #0d171a, var(--bg));
}
.hero::after {
  content: "";
  position: absolute; inset-inline: 0; bottom: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--lime), var(--sky), transparent);
  opacity: 0.4;
}
.hero-inner {
  position: relative; z-index: 1;
  max-width: var(--max); margin-inline: auto;
  padding: 4.2rem 1.5rem 4.4rem;
}
.hero h1 { max-width: 23ch; margin-bottom: 1.1rem; }
.hero .lede {
  max-width: 62ch; font-size: 1.06rem; color: #a9c2c4;
  margin-bottom: 1.9rem;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.7rem; margin-bottom: 1.9rem; }

.entity-line {
  font-size: 0.83rem; color: var(--muted);
  border-top: 1px dashed var(--border);
  padding-top: 0.85rem; max-width: 72ch;
}
.entity-line a { color: var(--text); border-bottom: 1px solid var(--accent-line); }
.entity-line a:hover { color: var(--lime); }

.hero-media {
  max-width: var(--max);
  margin: -2.4rem auto 3.2rem;
  padding-inline: 1.5rem;
  position: relative; z-index: 2;
}
.hero-media img,
.hero-media svg {
  width: 100%;
  border: 1px solid var(--border-hi);
  border-radius: var(--radius);
  box-shadow: 0 26px 60px -36px #000;
}

/* ---------- stats ---------- */

.stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 1px;
  background: var(--border-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-block: 2.2rem;
}
.stat { background: var(--panel); padding: 1.1rem 1.2rem; }
.stat b {
  display: block;
  font-family: var(--mono);
  font-size: 1.7rem; font-weight: 700;
  color: var(--lime);
  line-height: 1.3;
  direction: ltr;
}
.stat span { font-size: 0.84rem; color: var(--muted); }

/* ---------- grids & cards ---------- */

.grid { display: grid; gap: 1.15rem; }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(255px, 1fr)); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(295px, 1fr)); }

.card {
  position: relative;
  background: linear-gradient(180deg, var(--bg-card-hi), var(--bg-card));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem;
  transition: border-color 0.18s var(--ease), transform 0.18s var(--ease),
    box-shadow 0.18s var(--ease);
}
.card::after {
  content: "";
  position: absolute; inset-inline-start: 0.85rem; top: 0.85rem;
  width: 14px; height: 14px;
  border-top: 2px solid var(--lime);
  border-inline-start: 2px solid var(--lime);
  opacity: 0.45;
  transition: opacity 0.18s var(--ease), transform 0.18s var(--ease);
}
.card:hover {
  border-color: var(--border-hi);
  transform: translateY(-2px);
  box-shadow: 0 18px 40px -30px #000;
}
.card:hover::after { opacity: 1; transform: scale(1.15); }
.card > h2 { font-size: 1.2rem; margin-bottom: 0.55rem; }
.card > h3 { margin-bottom: 0.5rem; }
.card > p:last-child { margin-bottom: 0; }
.card .tag { margin-bottom: 0.7rem; }

.post-card { display: flex; flex-direction: column; gap: 0.5rem; }
.post-card .meta {
  display: flex; flex-direction: column; align-items: flex-start;
  gap: 0.4rem; color: var(--muted);
}
.post-card .meta .when {
  display: flex; gap: 0.4rem; font-size: 0.78rem;
  color: #7d979b; white-space: nowrap;
}
.post-card .meta .when > * + *::before {
  content: "·"; margin-inline-end: 0.4rem; color: var(--border-hi);
}
.post-card h3 { font-size: 1.05rem; margin: 0.3rem 0 0.35rem; line-height: 1.45; }
.post-card h3 a { color: var(--heading); }
.post-card h3 a:hover { color: var(--lime); }
.post-card p { font-size: 0.92rem; color: var(--muted); margin: 0; }

.feature-card {
  display: grid; grid-template-columns: 1.1fr 1fr; gap: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.feature-card .body {
  padding: 2rem; display: flex; flex-direction: column;
  justify-content: center; gap: 0.6rem;
}
.feature-card .media { position: relative; min-height: 260px; }
.feature-card .media img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- breadcrumbs ---------- */

.breadcrumbs { font-size: 0.81rem; color: var(--muted); margin-bottom: 1.2rem; }
.breadcrumbs ol {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center;
}
.breadcrumbs li { margin: 0; }
.breadcrumbs li + li::before {
  content: "‹"; margin-inline-end: 0.4rem; color: var(--border-hi);
}
.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--lime); }
.breadcrumbs [aria-current="page"] { color: #b9d0d2; }

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

.article-hero {
  position: relative;
  padding-block: 2.6rem 1.4rem;
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(620px 260px at 86% 0%, rgba(190, 242, 100, 0.09), transparent 70%),
    var(--bg);
}
.article-hero h1 { margin: 0.6rem 0 0.8rem; max-width: 27ch; }
.article-hero .lede {
  font-size: 1.04rem; color: #a5bec0; max-width: 68ch; margin-bottom: 1.2rem;
}
.article-meta {
  display: flex; flex-wrap: wrap; gap: 0.4rem 0.7rem;
  font-size: 0.85rem; color: var(--muted); align-items: center;
}
.article-meta > * + *::before {
  content: "·"; margin-inline-end: 0.7rem; color: var(--border-hi);
}

.article-layout {
  max-width: var(--max); margin-inline: auto;
  padding: 2.6rem 1.5rem 3.6rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 248px;
  gap: 3rem; align-items: start;
}
.article-main { min-width: 0; }
.article-aside { position: sticky; top: calc(var(--header-h) + 1.4rem); }

.toc {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.05rem 1.15rem;
}
.toc h2 {
  font-family: var(--mono);
  font-size: 0.76rem; color: var(--muted);
  margin-bottom: 0.7rem; font-weight: 700;
}
.toc ul { list-style: none; padding: 0; margin: 0; }
.toc li { margin: 0; }
.toc a {
  display: block; font-size: 0.86rem; color: #96b0b4;
  padding: 0.3rem 0;
  border-inline-start: 2px solid var(--border-soft);
  padding-inline-start: 0.7rem;
  transition: color 0.16s var(--ease), border-color 0.16s var(--ease);
}
.toc a:hover { color: var(--heading); text-decoration: none; }
.toc a.is-active { color: var(--lime); border-color: var(--lime); }
.toc .toc-sub a { padding-inline-start: 1.5rem; font-size: 0.82rem; }

.takeaway {
  border: 1px solid var(--accent-line);
  border-inline-start: 3px solid var(--lime);
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  padding: 1.15rem 1.3rem; margin: 1.7rem 0;
}
.takeaway h2, .takeaway h3 {
  font-size: 0.96rem; margin-bottom: 0.6rem; color: #dbf9ab;
}
.takeaway ul { margin: 0; padding-inline-start: 1.2rem; }
.takeaway li { font-size: 0.95rem; }
.takeaway li::marker { color: var(--lime); }

.author-card {
  display: flex; gap: 1.05rem; align-items: flex-start;
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.3rem; margin-top: 2.4rem;
}
.author-card .avatar {
  width: 52px; height: 52px; flex: none;
  background: var(--lime);
  color: #08120a;
  display: grid; place-items: center;
  font-family: var(--mono); font-weight: 700; font-size: 1rem;
  border-radius: var(--radius-sm);
  direction: ltr;
}
.author-card h2 { font-size: 1rem; margin-bottom: 0.25rem; }
.author-card p { font-size: 0.9rem; color: var(--muted); margin-bottom: 0.4rem; }
.author-card .links { font-size: 0.85rem; }

/* ---------- prose ---------- */

.prose { max-width: var(--measure); }
.prose > :first-child { margin-top: 0; }

.prose h2 {
  margin-top: 2.6rem; margin-bottom: 0.8rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--border-soft);
  scroll-margin-top: calc(var(--header-h) + 1rem);
  font-size: clamp(1.23rem, 1.08rem + 0.5vw, 1.48rem);
  position: relative;
}
.prose h2::before {
  content: "";
  position: absolute; top: -1px; inset-inline-start: 0;
  width: 3.2rem; height: 2px;
  background: var(--lime);
}
.prose h3 {
  margin-top: 1.85rem; margin-bottom: 0.5rem;
  scroll-margin-top: calc(var(--header-h) + 1rem);
  color: #e8f6ef;
}
.prose h4 { margin-top: 1.4rem; margin-bottom: 0.4rem; }
.prose p, .prose li { font-size: 1.015rem; }
.prose > p:first-of-type { font-size: 1.07rem; color: #dcecea; }
.prose a {
  color: var(--sky);
  text-decoration: underline;
  text-decoration-color: rgba(56, 189, 248, 0.4);
}
.prose a:hover { text-decoration-color: var(--lime); color: var(--lime); }

.prose blockquote {
  position: relative;
  background: rgba(56, 189, 248, 0.055);
  border: 1px solid rgba(56, 189, 248, 0.18);
  border-inline-start: 3px solid var(--sky);
  border-radius: var(--radius-sm);
  padding: 0.95rem 1.15rem;
  margin: 1.6rem 0;
  color: #cfe4e6;
}
.prose blockquote p:last-child { margin-bottom: 0; }

.prose code {
  font-family: var(--mono);
  direction: ltr;
  unicode-bidi: embed;
}
.prose :not(pre) > code {
  background: rgba(190, 242, 100, 0.08);
  border: 1px solid var(--accent-line);
  border-radius: 2px;
  padding: 0.08rem 0.36rem;
  font-size: 0.86em;
  color: #e2f8bf;
}
.prose pre {
  direction: ltr; text-align: left;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-top: 2px solid var(--lime-deep);
  border-radius: var(--radius-sm);
  padding: 1.05rem 1.15rem;
  overflow-x: auto;
  margin: 1.5rem 0;
  position: relative;
  font-size: 0.855rem; line-height: 1.65;
}
.prose pre code {
  background: none; border: 0; padding: 0;
  color: #d7e9e4;
  font-family: var(--mono);
}

.copy-code {
  position: absolute; top: 0.5rem; inset-inline-end: 0.5rem; z-index: 2;
  font-family: var(--font); font-size: 0.72rem; font-weight: 700;
  background: #16241f; color: var(--muted);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius-sm);
  padding: 0.22rem 0.55rem;
  cursor: pointer;
}
.copy-code:hover { color: #08120a; background: var(--lime); border-color: var(--lime); }

.table-wrap {
  overflow-x: auto; margin: 1.6rem 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel);
}
.prose table { width: 100%; border-collapse: collapse; font-size: 0.92rem; margin: 0; }
.prose th, .prose td {
  padding: 0.62rem 0.85rem;
  border-bottom: 1px solid var(--border-soft);
  text-align: start; vertical-align: top;
}
.prose thead th {
  background: var(--bg-card-hi);
  color: var(--heading); font-weight: 700;
  border-bottom: 1px solid var(--border-hi);
  white-space: nowrap;
}
.prose tbody tr:last-child td { border-bottom: 0; }
.prose tbody tr:hover { background: rgba(190, 242, 100, 0.04); }

.prose figure { margin: 1.8rem 0; }
.prose figure img, .prose figure svg {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.prose figcaption {
  font-size: 0.82rem; color: var(--muted);
  margin-top: 0.5rem; text-align: center;
}
.diagram { background: var(--bg-alt); }

.article-figure { margin: 1.6rem 0 0; }
.article-figure img {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.related { margin-top: 2.6rem; }
.related h2 { font-size: 1.08rem; margin-bottom: 0.9rem; }
.related-list {
  list-style: none; padding: 0; margin: 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.65rem;
}
.related-list li { margin: 0; }
.related-list a {
  display: block; padding: 0.8rem 0.95rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  font-size: 0.93rem; color: var(--text);
  transition: border-color 0.16s var(--ease), color 0.16s var(--ease);
}
.related-list a:hover { border-color: var(--lime); color: var(--lime); text-decoration: none; }

/* ---------- callouts ---------- */

.callout {
  border: 1px solid var(--border);
  border-inline-start: 3px solid var(--lime);
  background: var(--bg-alt);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1.1rem;
  margin: 1.5rem 0;
  font-size: 0.96rem;
}
.callout > :last-child { margin-bottom: 0; }
.callout .callout-title {
  display: block; font-weight: 700; color: #dcf7b8;
  margin-bottom: 0.3rem;
}
.callout--warn {
  border-inline-start-color: var(--rose);
  background: var(--warn-soft);
  border-color: rgba(251, 113, 133, 0.24);
}
.callout--warn .callout-title { color: var(--warn); }
.callout--info {
  border-inline-start-color: var(--sky);
  background: var(--sky-soft);
  border-color: rgba(56, 189, 248, 0.22);
}
.callout--info .callout-title { color: #8fd8fb; }

/* ---------- glossary ---------- */

.glossary-nav { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 2rem; }
.glossary-nav a {
  font-size: 0.82rem; font-weight: 600; color: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.18rem 0.6rem;
  background: var(--panel);
}
.glossary-nav a:hover { color: var(--lime); border-color: var(--accent-line); text-decoration: none; }
.terms { display: grid; gap: 1rem; }
.term {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  padding: 1.05rem 1.2rem;
  scroll-margin-top: calc(var(--header-h) + 1rem);
}
.term dt {
  font-weight: 700; color: var(--heading); font-size: 1.02rem;
  margin-bottom: 0.35rem;
}
.term dd { margin: 0; font-size: 0.95rem; }
.term .en {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.73rem; color: #89a3a7;
  margin-inline-start: 0.45rem;
  padding: 0.02rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: 2px;
  direction: ltr;
}

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

.faq details {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  padding: 0.85rem 1.1rem;
  margin-bottom: 0.6rem;
  transition: border-color 0.16s var(--ease), background 0.16s var(--ease);
}
.faq details:hover { border-color: var(--border-hi); }
.faq details[open] { border-color: var(--accent-line); background: rgba(190, 242, 100, 0.04); }
.faq summary {
  cursor: pointer; font-weight: 700; color: var(--heading);
  list-style: none; display: flex; justify-content: space-between;
  gap: 1rem; align-items: baseline;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+"; flex: none;
  font-family: var(--mono); font-weight: 700;
  color: var(--lime); font-size: 1.1rem; line-height: 1;
}
.faq details[open] summary::after { content: "−"; color: var(--sky); }
.faq details p { margin: 0.75rem 0 0; font-size: 0.95rem; color: #c2d6d8; }

/* ---------- contact ---------- */

.contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 3rem; align-items: start;
}
.field { margin-bottom: 1.1rem; }
.field label {
  display: block; font-size: 0.88rem; font-weight: 700;
  color: #dcecea; margin-bottom: 0.35rem;
}
.field input, .field textarea, .field select {
  width: 100%;
  font-family: var(--font); font-size: 0.95rem;
  color: var(--text);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.66rem 0.8rem;
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none;
  border-color: var(--lime);
  box-shadow: 0 0 0 3px rgba(190, 242, 100, 0.12);
}
.field textarea { min-height: 150px; resize: vertical; }

.hint { font-size: 0.82rem; color: var(--muted); }
.detail-list { list-style: none; padding: 0; margin: 0; }
.detail-list li {
  display: grid; grid-template-columns: 7.5rem minmax(0, 1fr);
  gap: 0.7rem; align-items: start;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border-soft);
  font-size: 0.94rem;
}
.detail-list li:last-child { border-bottom: 0; }
.detail-list .k { color: var(--muted); font-size: 0.85rem; }
.detail-list .v { color: #dcecea; text-align: right; }

/* ---------- legal ---------- */

.legal { max-width: 800px; margin-inline: auto; padding: 3rem 1.5rem 4rem; }
.legal h1 { margin-bottom: 0.4rem; }
.legal .updated {
  color: var(--muted); font-size: 0.85rem; margin-bottom: 2rem;
  display: inline-block;
  padding: 0.12rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel);
}
.legal h2 {
  margin-top: 2.2rem; margin-bottom: 0.6rem; font-size: 1.15rem;
  padding-top: 1.1rem; border-top: 1px solid var(--border-soft);
}
.legal p, .legal li { font-size: 0.98rem; }
.legal ul, .legal ol { padding-inline-start: 1.25rem; }

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

.site-footer {
  position: relative;
  background: #081012;
  border-top: 1px solid var(--border);
  padding-block: 2.7rem 1.4rem;
  margin-top: 3.2rem;
}
.site-footer::before {
  content: "";
  position: absolute; inset-inline: 0; top: -1px; height: 2px;
  background: linear-gradient(90deg, transparent, var(--lime), transparent);
  opacity: 0.5;
}
.footer-inner {
  max-width: var(--max); margin-inline: auto;
  padding-inline: 1.5rem;
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1.3fr;
  gap: 2rem;
}
.footer-brand p {
  font-size: 0.88rem; color: var(--muted);
  max-width: 36ch; margin-top: 0.75rem;
}
.footer-brand .footer-operator {
  font-size: 0.8rem;
  color: #7d969a;
  border-top: 1px dashed var(--border);
  padding-top: 0.6rem;
  margin-top: 0.9rem;
  max-width: 40ch;
}
.footer-col h2 {
  font-family: var(--mono);
  font-size: 0.76rem; color: #7d969a;
  margin-bottom: 0.8rem; font-weight: 700;
}
.footer-col ul { list-style: none; padding: 0; margin: 0; }
.footer-col li { margin-bottom: 0.45rem; font-size: 0.9rem; color: var(--muted); }
.footer-col a { font-size: 0.9rem; color: var(--text); }
.footer-col a:hover { color: var(--lime); }
.footer-bottom {
  max-width: var(--max); margin: 2rem auto 0;
  padding: 1rem 1.5rem 0;
  border-top: 1px solid var(--border-soft);
  display: flex; flex-wrap: wrap;
  justify-content: space-between; gap: 0.6rem;
  font-size: 0.82rem; color: var(--muted);
}

/* ---------- 404 ---------- */

.error-page {
  max-width: 650px; margin-inline: auto;
  padding: 5rem 1.5rem; text-align: center;
}
.error-page .code {
  font-family: var(--mono);
  font-size: clamp(4rem, 3rem + 5vw, 6rem);
  font-weight: 700; line-height: 1;
  color: transparent;
  -webkit-text-stroke: 2px var(--lime);
  letter-spacing: 0.02em;
  direction: ltr;
}
.error-page h1 { margin: 0.7rem 0 0.8rem; }
.error-page p { color: var(--muted); }
.error-page .links {
  display: flex; gap: 0.8rem; justify-content: center;
  flex-wrap: wrap; margin-top: 1.6rem;
}
.error-page .error-more { margin-top: 2.5rem; }
.error-page .error-links {
  list-style: none; padding: 0; text-align: start;
  max-width: 32rem; margin: 1rem auto 0;
}
.error-page .error-links li { margin-bottom: 0.45rem; }
.error-page .error-links li::marker { color: transparent; }

/* ---------- reading progress ---------- */

.read-progress {
  position: fixed; inset-inline: 0; top: 0; height: 2px;
  background: transparent; z-index: 150; pointer-events: none;
}
.read-progress span {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--lime), var(--sky));
}

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

.reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.55s var(--ease), transform 0.55s var(--ease);
}
.reveal.is-in { opacity: 1; transform: none; }

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

@media (max-width: 1024px) {
  .article-layout { grid-template-columns: minmax(0, 1fr); gap: 1.7rem; padding-top: 1.7rem; }
  .article-aside { position: static; order: -1; }
  .toc ul { max-height: 16rem; overflow: auto; }
  .contact-grid { grid-template-columns: minmax(0, 1fr); gap: 2.1rem; }
  .footer-inner { grid-template-columns: 1fr 1fr; }
  .feature-card { grid-template-columns: 1fr; }
  .feature-card .media { order: -1; max-height: 250px; }
  .hero-inner { padding-block: 3.4rem 3.8rem; }
  .hero-media { margin-top: -1.8rem; }
}

@media (max-width: 860px) {
  .nav-links { gap: 0; }
  .nav-links a { padding: 0.4rem 0.5rem; font-size: 0.9rem; }
}

@media (max-width: 768px) {
  body { font-size: 16.5px; }
  .menu-toggle { display: block; }
  .nav { position: static; }
  .nav-links {
    display: none; position: absolute; inset-inline: 0; top: 100%;
    flex-direction: column; align-items: stretch; gap: 0;
    background: #0b1518;
    border-bottom: 1px solid var(--border);
    padding: 0.5rem 1.2rem 0.9rem;
  }
  .nav-links.open { display: flex; }
  .nav-links a {
    display: block; padding: 0.7rem 0.4rem;
    border-bottom: 1px solid var(--border-soft);
  }
  .nav-links a::after { display: none; }
  .hero-inner { padding: 2.8rem 1.2rem 3.2rem; }
  .hero h1 { max-width: none; }
  .hero-media { margin-top: -1.4rem; margin-bottom: 2.4rem; }
  .section { padding-block: 2.3rem; }
  .wrap, .header-inner, .article-layout, .legal, .footer-inner, .footer-bottom {
    padding-inline: 1.2rem;
  }
  .article-hero { padding-block: 1.9rem 1rem; }
  .author-card { flex-direction: column; }
  .stats { grid-template-columns: 1fr 1fr; }
  .article-hero h1 { max-width: none; }
  .error-page { padding: 3.6rem 1.2rem; }
}

@media (max-width: 480px) {
  .footer-inner { grid-template-columns: 1fr; gap: 1.7rem; }
  .hero-actions .btn { width: 100%; }
  .detail-list li { grid-template-columns: 1fr; gap: 0.1rem; }
  .read-progress { display: none; }
  .card { padding: 1.2rem; }
  .stats { grid-template-columns: 1fr; }
  .section-head h2::before { font-size: 0.72rem; }
}

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

@media print {
  .site-header, .site-footer, .article-aside, .author-card, .related,
  .read-progress, .skip-link, .copy-code, .hero-media, .glossary-nav,
  .menu-toggle { display: none !important; }
  body { background: #fff; color: #000; }
  body::before, body::after { display: none !important; }
  a { color: #000; text-decoration: underline; }
  h1, h2, h3, h4, .prose h2, .prose h3 { color: #000; border-color: #999; }
  .article-layout { display: block; padding: 0; }
  .prose { max-width: 100%; }
  .card, .callout, .takeaway, .term, .faq details, .prose pre {
    background: #fff !important; border-color: #ccc !important;
    box-shadow: none !important;
  }
  .prose pre, .prose pre code { background: #f4f4f4 !important; color: #111 !important; }
}

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

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .reveal { opacity: 1 !important; transform: none !important; }
}

@media (prefers-contrast: more) {
  :root {
    --text: #e2efee;
    --muted: #b3c7c9;
    --border: #40606a;
    --border-soft: #33505a;
    --border-hi: #5a7f89;
  }
  body::after { opacity: 0.4; }
}
