/* ==========================================================================
   آکادمی آبیاری — استایل اصلی
   ========================================================================== */

/* فونت وزیرمتن به‌صورت محلی (بدون وابستگی به سرویس خارجی)
   مجوز: SIL Open Font License 1.1 — assets/fonts/OFL.txt */
@font-face {
  font-family: "Vazirmatn";
  src: url("../assets/fonts/Vazirmatn-Variable.woff2") format("woff2-variations"),
       url("../assets/fonts/Vazirmatn-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --font: "Vazirmatn", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;

  --bg: #f4f7f3;
  --surface: #ffffff;
  --surface-2: #eef3ec;
  --surface-3: #e3ebe0;
  --text: #15241a;
  --text-2: #4a5a4f;
  --muted: #7c8a80;
  --border: #d9e2d7;
  --hairline: #e6ece4;

  --primary: #1b6e3a;
  --primary-2: #2d8a4e;
  --primary-soft: #dff1e4;
  --primary-ink: #ffffff;
  --accent: #1f6fcf;
  --accent-soft: #dcebfb;
  --warn: #b7791f;
  --warn-soft: #fdf1dc;
  --danger: #c0392b;
  --danger-soft: #fbe3e0;
  --good: #1f8f3d;
  --good-soft: #def5e3;

  /* پالت نمودار (اعتبارسنجی‌شده برای کوررنگی) */
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --series-5: #e87ba4;
  --series-6: #008300;
  --series-7: #4a3aa7;
  --series-8: #e34948;
  --chart-grid: #e1e0d9;
  --chart-axis: #c3c2b7;
  --chart-muted: #898781;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(20, 40, 25, .06), 0 8px 24px rgba(20, 40, 25, .06);
  --shadow-lg: 0 20px 60px rgba(10, 30, 15, .18);
  --max: 1180px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1612;
  --surface: #182019;
  --surface-2: #1f2a21;
  --surface-3: #27352a;
  --text: #eef3ee;
  --text-2: #c3cdc5;
  --muted: #8d9a90;
  --border: #2d3b30;
  --hairline: #26322a;
  --primary: #3fae68;
  --primary-2: #55c27c;
  --primary-soft: #1d3626;
  --primary-ink: #07140b;
  --accent: #5a9cf0;
  --accent-soft: #1b2d44;
  --warn: #e3a944;
  --warn-soft: #3a2d14;
  --danger: #ef6b5e;
  --danger-soft: #3f1f1b;
  --good: #4ec472;
  --good-soft: #1b3a24;
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #c98500;
  --series-5: #d55181;
  --series-6: #008300;
  --series-7: #9085e9;
  --series-8: #e66767;
  --chart-grid: #2c2c2a;
  --chart-axis: #383835;
  --chart-muted: #898781;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, .5);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0f1612;
    --surface: #182019;
    --surface-2: #1f2a21;
    --surface-3: #27352a;
    --text: #eef3ee;
    --text-2: #c3cdc5;
    --muted: #8d9a90;
    --border: #2d3b30;
    --hairline: #26322a;
    --primary: #3fae68;
    --primary-2: #55c27c;
    --primary-soft: #1d3626;
    --primary-ink: #07140b;
    --accent: #5a9cf0;
    --accent-soft: #1b2d44;
    --warn: #e3a944;
    --warn-soft: #3a2d14;
    --danger: #ef6b5e;
    --danger-soft: #3f1f1b;
    --good: #4ec472;
    --good-soft: #1b3a24;
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-4: #c98500;
    --series-5: #d55181;
    --series-6: #008300;
    --series-7: #9085e9;
    --series-8: #e66767;
    --chart-grid: #2c2c2a;
    --chart-axis: #383835;
    --chart-muted: #898781;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, .5);
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.85;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
img, svg { max-width: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.4; margin: 0 0 .5em; font-weight: 700; }
h1 { font-size: clamp(1.6rem, 3.5vw, 2.4rem); }
h2 { font-size: clamp(1.35rem, 2.6vw, 1.8rem); }
h3 { font-size: 1.15rem; }
h4 { font-size: 1.02rem; }
p { margin: 0 0 1em; }
ul, ol { padding-inline-start: 1.4em; margin: 0 0 1em; }
li { margin-bottom: .3em; }
small { font-size: .85em; }
code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .9em; background: var(--surface-2); padding: .1em .4em; border-radius: 5px; }
hr { border: 0; border-top: 1px solid var(--hairline); margin: 1.5rem 0; }
.num { font-variant-numeric: tabular-nums; }

.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 16px; }
main.container { flex: 1; padding-top: 24px; padding-bottom: 48px; }

.skip-link { position: absolute; top: -50px; right: 10px; background: var(--primary); color: var(--primary-ink); padding: 8px 14px; border-radius: 8px; z-index: 1000; }
.skip-link:focus { top: 10px; }

/* --------------------------------------------------------------------------
   Topbar
   -------------------------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--hairline);
}
.topbar-inner { display: flex; align-items: center; gap: 16px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--primary); color: #bfe8ff; }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 1.05rem; }
.brand-text small { color: var(--muted); font-size: .72rem; }
.main-nav { display: flex; gap: 2px; margin-inline-start: auto; flex-wrap: wrap; }
.main-nav a { padding: 8px 11px; border-radius: 9px; color: var(--text-2); font-weight: 500; font-size: .93rem; white-space: nowrap; }
.main-nav a:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.main-nav a.active { background: var(--primary-soft); color: var(--primary); }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-sun { display: none; }
:root[data-theme="dark"] .icon-sun { display: block; }
:root[data-theme="dark"] .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: block; }
  :root:not([data-theme="light"]) .icon-moon { display: none; }
}
.nav-toggle { display: none; width: 42px; height: 42px; border: 1px solid var(--border); background: var(--surface); border-radius: 10px; cursor: pointer; flex-direction: column; justify-content: center; align-items: center; gap: 5px; margin-inline-start: auto; }
.nav-toggle span { display: block; width: 20px; height: 2px; background: var(--text); border-radius: 2px; transition: .2s; }

@media (max-width: 980px) {
  .nav-toggle { display: flex; }
  .main-nav { display: none; position: absolute; inset-inline: 0; top: 100%; flex-direction: column; background: var(--surface); border-bottom: 1px solid var(--border); padding: 10px 16px 14px; box-shadow: var(--shadow); margin: 0; }
  .main-nav.open { display: flex; }
  .main-nav a { padding: 11px 12px; font-size: 1rem; }
  .brand-text small { display: none; }
}

/* --------------------------------------------------------------------------
   Generic building blocks
   -------------------------------------------------------------------------- */
.view { animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.section { margin-bottom: 40px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.section-head p { color: var(--text-2); margin: 0; max-width: 70ch; }
.eyebrow { display: inline-block; font-size: .78rem; font-weight: 600; letter-spacing: .02em; color: var(--primary); background: var(--primary-soft); padding: 3px 10px; border-radius: 999px; margin-bottom: 8px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card.soft { background: var(--surface-2); box-shadow: none; }
.card h3 { margin-top: 0; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; transition: .15s; line-height: 1.4; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.primary:hover { background: var(--primary-2); }
.btn.ghost { background: transparent; }
.btn.small { padding: 6px 12px; font-size: .88rem; border-radius: 8px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); white-space: nowrap; }
.badge.surface { background: #f3e8d3; color: #7a5410; border-color: #e8d4ad; }
.badge.sprinkler { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.badge.micro { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.badge.other { background: #ece6f7; color: #5a3fa3; border-color: #dcd1f1; }
:root[data-theme="dark"] .badge.surface { background: #3a2f16; color: #e7c47c; border-color: #4a3d1e; }
:root[data-theme="dark"] .badge.other { background: #2b2440; color: #c4b5f5; border-color: #3b3159; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .badge.surface { background: #3a2f16; color: #e7c47c; border-color: #4a3d1e; }
  :root:not([data-theme="light"]) .badge.other { background: #2b2440; color: #c4b5f5; border-color: #3b3159; }
}

.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font: inherit; font-size: .9rem; color: var(--text-2); }
.chip:hover { background: var(--surface-2); }
.chip.active { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }

.callout { border-inline-start: 4px solid var(--accent); background: var(--accent-soft); padding: 12px 16px; border-radius: 10px; margin: 14px 0; }
.callout.warn { border-color: var(--warn); background: var(--warn-soft); }
.callout.good { border-color: var(--good); background: var(--good-soft); }
.callout.danger { border-color: var(--danger); background: var(--danger-soft); }
.callout p:last-child { margin-bottom: 0; }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; }
.stat .label { color: var(--muted); font-size: .8rem; display: block; }
.stat .value { font-size: 1.35rem; font-weight: 700; display: block; }
.stat .sub { color: var(--text-2); font-size: .8rem; }

table.data { width: 100%; border-collapse: collapse; font-size: .93rem; background: var(--surface); border-radius: var(--radius-sm); overflow: hidden; }
table.data th, table.data td { padding: 10px 12px; border-bottom: 1px solid var(--hairline); text-align: right; vertical-align: top; }
table.data th { background: var(--surface-2); font-weight: 700; color: var(--text-2); font-size: .86rem; }
table.data tr:last-child td { border-bottom: 0; }
table.data td.num, table.data th.num { font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.table-wrap table.data { border-radius: 0; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: .88rem; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: .78rem; color: var(--muted); }
input[type="text"], input[type="number"], input[type="search"], select, textarea {
  font: inherit; padding: 9px 12px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); color: var(--text); width: 100%;
}
input:focus, select:focus, textarea:focus, .btn:focus-visible, .chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
input[type="range"] { width: 100%; accent-color: var(--primary); }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { accent-color: var(--primary); width: 18px; height: 18px; }

.search-bar { position: relative; }
.search-bar input { padding-inline-start: 38px; }
.search-bar svg { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; scrollbar-width: thin; }
.tabs button { background: none; border: 0; border-bottom: 3px solid transparent; padding: 10px 14px; font: inherit; font-weight: 600; color: var(--text-2); cursor: pointer; white-space: nowrap; margin-bottom: -1px; }
.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fade .2s; }

.meter { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 999px; background: var(--primary); }
.meter.blue > span { background: var(--series-1); }
.meter.orange > span { background: var(--series-2); }

.rating { display: inline-flex; gap: 3px; }
.rating i { width: 10px; height: 10px; border-radius: 3px; background: var(--surface-3); display: inline-block; }
.rating i.on { background: var(--primary); }

.pill-steps { counter-reset: step; list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.pill-steps li { position: relative; padding: 12px 52px 12px 14px; background: var(--surface-2); border-radius: var(--radius-sm); counter-increment: step; }
.pill-steps li::before { content: counter(step); position: absolute; right: 12px; top: 10px; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: var(--primary); color: var(--primary-ink); font-weight: 700; font-size: .9rem; }

.pros-cons { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.pros-cons ul { list-style: none; padding: 0; margin: 0; }
.pros-cons li { padding: 8px 32px 8px 10px; position: relative; border-bottom: 1px solid var(--hairline); }
.pros-cons li:last-child { border-bottom: 0; }
.pros-cons li::before { position: absolute; right: 8px; top: 9px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: .7rem; font-weight: 800; }
.pros li::before { content: "✓"; background: var(--good-soft); color: var(--good); }
.cons li::before { content: "✕"; background: var(--danger-soft); color: var(--danger); }

/* Hero */
.hero { position: relative; overflow: hidden; border-radius: 22px; padding: clamp(28px, 5vw, 56px); background: linear-gradient(135deg, #0f4d28 0%, #1b6e3a 55%, #1f6fcf 140%); color: #fff; margin-bottom: 28px; box-shadow: var(--shadow-lg); }
.hero::after { content: ""; position: absolute; inset: 0; background: radial-gradient(600px 300px at 10% 110%, rgba(159, 216, 255, .35), transparent 60%), radial-gradient(400px 200px at 95% -10%, rgba(255, 255, 255, .18), transparent 60%); pointer-events: none; }
.hero > * { position: relative; z-index: 1; }
.hero h1 { color: #fff; font-size: clamp(1.7rem, 4vw, 2.6rem); max-width: 22ch; }
.hero p { color: rgba(255, 255, 255, .88); font-size: 1.08rem; max-width: 62ch; }
.hero .btn.primary { background: #fff; color: #0f4d28; border-color: #fff; }
.hero .btn.ghost { color: #fff; border-color: rgba(255, 255, 255, .5); }
.hero .btn.ghost:hover { background: rgba(255, 255, 255, .12); }
.hero-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-top: 24px; }
.hero-stats div { background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .2); border-radius: 12px; padding: 10px 12px; }
.hero-stats strong { display: block; font-size: 1.4rem; }
.hero-stats span { font-size: .8rem; opacity: .85; }

.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.feature { display: flex; flex-direction: column; gap: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; color: var(--text); transition: .15s; }
.feature:hover { transform: translateY(-2px); box-shadow: var(--shadow); text-decoration: none; border-color: var(--primary); }
.feature .ico { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; background: var(--primary-soft); color: var(--primary); font-size: 1.4rem; }
.feature strong { font-size: 1.05rem; }
.feature span { color: var(--text-2); font-size: .9rem; }

/* Method cards */
.method-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.method-card { display: flex; flex-direction: column; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; cursor: pointer; transition: .15s; color: var(--text); text-align: right; font: inherit; }
.method-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--primary); text-decoration: none; }
.method-card .m-head { display: flex; align-items: center; gap: 12px; }
.method-card .m-icon { width: 54px; height: 54px; flex: 0 0 54px; display: grid; place-items: center; border-radius: 14px; background: var(--surface-2); }
.method-card .m-icon svg { width: 38px; height: 38px; }
.method-card h3 { margin: 0; font-size: 1.08rem; }
.method-card .en { color: var(--muted); font-size: .78rem; display: block; direction: ltr; text-align: right; }
.method-card p { color: var(--text-2); font-size: .92rem; margin: 0; }
.method-card .m-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; font-size: .82rem; color: var(--text-2); margin-top: auto; }
.method-card .m-meta b { color: var(--text); }

/* Method detail */
.detail-head { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.detail-head .m-icon { width: 76px; height: 76px; display: grid; place-items: center; border-radius: 18px; background: var(--surface); border: 1px solid var(--border); }
.detail-head .m-icon svg { width: 54px; height: 54px; }
.detail-head h1 { margin-bottom: 2px; }
.detail-head .en { direction: ltr; display: inline-block; color: var(--muted); }
.detail-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin: 18px 0; }
.crop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.crop-item { background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 12px; font-size: .92rem; }
.crop-item b { display: block; }
.crop-item span { color: var(--text-2); font-size: .82rem; }
.score-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px 20px; }
.score-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; font-size: .9rem; }
.score-row .meter { grid-column: 1 / -1; }
.comp-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.comp-link { display: flex; gap: 10px; align-items: center; padding: 10px 12px; background: var(--surface-2); border-radius: var(--radius-sm); color: var(--text); cursor: pointer; border: 1px solid transparent; font: inherit; text-align: right; }
.comp-link:hover { border-color: var(--primary); text-decoration: none; }
.comp-link .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--primary); flex: 0 0 10px; }
.comp-link small { color: var(--muted); display: block; }
.problem-table td:first-child { font-weight: 600; }

/* Compare */
.compare-picker { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.compare-table th:first-child, .compare-table td:first-child { position: sticky; right: 0; background: var(--surface-2); min-width: 150px; z-index: 1; }
.compare-table td { min-width: 180px; }
.compare-table .best { background: var(--good-soft); font-weight: 700; }

/* Components */
.comp-groups { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.comp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.comp-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; cursor: pointer; transition: .15s; color: var(--text); font: inherit; text-align: right; }
.comp-card:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.comp-card h3 { font-size: 1.02rem; margin-bottom: 2px; }
.comp-card .en { color: var(--muted); font-size: .78rem; direction: ltr; display: block; text-align: right; }
.comp-card p { color: var(--text-2); font-size: .9rem; margin: 8px 0 0; }
.schematic-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; overflow-x: auto; }
.schematic-wrap svg { width: 100%; min-width: 760px; height: auto; display: block; }
.schematic-wrap .part { cursor: pointer; }
.schematic-wrap .part:hover .shape, .schematic-wrap .part.active .shape { stroke: var(--accent); stroke-width: 3; filter: drop-shadow(0 0 4px rgba(31, 111, 207, .5)); }
.schematic-wrap .shape { fill: var(--surface-2); stroke: var(--text-2); stroke-width: 1.6; transition: .15s; }
.schematic-wrap .pipe { stroke: var(--series-1); stroke-width: 6; fill: none; stroke-linecap: round; }
.schematic-wrap .pipe.thin { stroke-width: 3; }
.schematic-wrap .water { fill: none; stroke: var(--series-1); stroke-width: 2; stroke-dasharray: 6 8; animation: flow 1.2s linear infinite; }
@keyframes flow { to { stroke-dashoffset: -14; } }
.schematic-wrap text { font-family: var(--font); font-size: 12px; fill: var(--text); }
.schematic-wrap .lbl { font-size: 11.5px; fill: var(--text-2); }
.schematic-info { margin-top: 14px; }

/* Cost */
.cost-result { display: grid; grid-template-columns: 1.1fr .9fr; gap: 16px; }
@media (max-width: 860px) { .cost-result { grid-template-columns: 1fr; } }
.cost-total { background: linear-gradient(135deg, var(--primary) 0%, #155a2f 100%); color: #fff; border-radius: var(--radius); padding: 20px; }
:root[data-theme="dark"] .cost-total { color: #07140b; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .cost-total { color: #07140b; } }
.cost-total .big { font-size: clamp(1.6rem, 3.6vw, 2.3rem); font-weight: 800; }
.cost-total small { opacity: .85; }
.cost-items input { max-width: 120px; padding: 5px 8px; font-size: .88rem; text-align: left; direction: ltr; }
.cost-items td { vertical-align: middle; }

/* Advisor */
.wizard-q { margin-bottom: 20px; }
.wizard-q h3 { margin-bottom: 8px; }
.option-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; }
.option { padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; font: inherit; color: var(--text); text-align: right; }
.option:hover { border-color: var(--primary); }
.option.active { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); font-weight: 700; }
.result-card { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 10px; }
.result-card .rank { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--surface-2); }
.result-card.top .rank { background: var(--primary); color: var(--primary-ink); }
.result-card .why { color: var(--text-2); font-size: .88rem; }
.result-card .score { font-weight: 700; font-size: 1.2rem; }
@media (max-width: 600px) { .result-card { grid-template-columns: auto 1fr; } .result-card .score { grid-column: 2; } }

/* Quiz */
.quiz-q { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; }
.quiz-q .q-head { display: flex; gap: 10px; align-items: flex-start; }
.quiz-q .q-num { flex: 0 0 30px; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); font-weight: 700; font-size: .9rem; }
.quiz-opts { display: grid; gap: 8px; margin-top: 10px; }
.quiz-opt { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; background: var(--surface); font: inherit; color: var(--text); text-align: right; }
.quiz-opt:hover { border-color: var(--primary); }
.quiz-opt.selected { border-color: var(--accent); background: var(--accent-soft); }
.quiz-opt.correct { border-color: var(--good); background: var(--good-soft); }
.quiz-opt.wrong { border-color: var(--danger); background: var(--danger-soft); }
.quiz-exp { margin-top: 10px; font-size: .9rem; color: var(--text-2); display: none; }
.quiz-q.revealed .quiz-exp { display: block; }
.quiz-score { text-align: center; padding: 24px; }
.quiz-score .big { font-size: 2.6rem; font-weight: 800; color: var(--primary); }

/* Glossary */
.glossary-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.term { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; }
.term b { display: block; }
.term .en { color: var(--muted); font-size: .78rem; direction: ltr; display: inline-block; }
.term p { margin: 4px 0 0; color: var(--text-2); font-size: .9rem; }
.alpha-nav { display: flex; flex-wrap: wrap; gap: 4px; margin: 10px 0 16px; }
.alpha-nav button { border: 1px solid var(--border); background: var(--surface); border-radius: 7px; width: 34px; height: 34px; cursor: pointer; font: inherit; }
.alpha-nav button.active { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }

/* Charts */
.chart { width: 100%; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { font-family: var(--font); font-size: 12px; fill: var(--text-2); }
.chart .grid-line { stroke: var(--chart-grid); stroke-width: 1; }
.chart .axis-line { stroke: var(--chart-axis); stroke-width: 1; }
.chart .bar { transition: opacity .15s; }
.chart .bar:hover { opacity: .8; }
.chart .val { fill: var(--text); font-weight: 600; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 6px 0; font-size: .85rem; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.chart-tip { position: fixed; z-index: 500; pointer-events: none; background: var(--text); color: var(--bg); padding: 6px 10px; border-radius: 8px; font-size: .82rem; box-shadow: var(--shadow); opacity: 0; transition: opacity .1s; white-space: nowrap; }
.chart-tip.show { opacity: 1; }
.radar-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; align-items: start; }

/* Topics / articles */
.topic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.topic-card { display: flex; gap: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; color: var(--text); transition: .15s; }
.topic-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--primary); text-decoration: none; }
.topic-card .t-icon { font-size: 2rem; line-height: 1; flex: 0 0 auto; width: 54px; height: 54px; display: grid; place-items: center; border-radius: 14px; background: var(--surface-2); }
.topic-card h3 { font-size: 1.05rem; margin: 6px 0 4px; }
.topic-card p { color: var(--text-2); font-size: .9rem; margin: 0 0 6px; }
.topic-card small { color: var(--muted); }
.article-layout { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 24px; align-items: start; }
.article-layout > * { min-width: 0; }
@media (max-width: 960px) { .article-layout { grid-template-columns: 1fr; } .article-aside { order: -1; } .article-toc { position: static; } }
.article-toc { position: sticky; top: 80px; }
.article-toc ol { padding-inline-start: 1.2em; margin: 0; font-size: .9rem; }
.article-toc li { margin-bottom: 4px; }
.article-toc button { background: none; border: 0; padding: 2px 0; font: inherit; color: var(--accent); cursor: pointer; text-align: right; }
.article-toc button:hover { text-decoration: underline; }
.article section { margin-bottom: 8px; }
.article h2 { font-size: 1.35rem; margin: 26px 0 12px; padding-top: 18px; border-top: 1px solid var(--hairline); }
.article section:first-child h2 { border-top: 0; padding-top: 0; margin-top: 0; }
.article p { max-width: 80ch; }
.article .table-wrap { margin: 10px 0 14px; }
.article table.kv th { width: 32%; font-weight: 700; color: var(--text-2); background: var(--surface-2); }
.article .caption { font-size: .82rem; color: var(--muted); margin-top: -8px; }
.article .mini-cards .card { padding: 14px 16px; }
.article .mini-cards h4 { margin-bottom: 4px; color: var(--primary); }
.article .mini-cards p { margin: 0; font-size: .9rem; color: var(--text-2); }
.article .pros-cons { margin: 10px 0 14px; }
details.faq { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 8px; }
details.faq summary { cursor: pointer; font-weight: 600; }
details.faq p { margin: 8px 0 0; color: var(--text-2); }
.main-nav a { font-size: .9rem; padding: 8px 9px; }

/* Tools v3: shared */
.caption { font-size: .82rem; color: var(--muted); }
table.data tr.best td { background: var(--good-soft); font-weight: 600; }
.badge.p3 { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge.p2 { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.p1 { background: var(--surface-2); color: var(--text-2); }

/* Troubleshooter */
.trouble-layout { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 16px; align-items: start; }
.trouble-layout > * { min-width: 0; }
.trouble-list { display: grid; gap: 6px; max-height: 75vh; overflow: auto; padding: 2px; }
.trouble-item { display: flex; gap: 10px; align-items: center; text-align: right; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; font: inherit; color: var(--text); }
.trouble-item:hover { border-color: var(--primary); }
.trouble-item.active { border-color: var(--primary); background: var(--primary-soft); }
.trouble-item small { display: block; color: var(--muted); font-size: .8rem; }
.cause-list { padding-inline-start: 1.3em; margin: 12px 0; }
.cause-list li { margin-bottom: 10px; padding: 10px 12px; background: var(--surface-2); border-radius: var(--radius-sm); }
.cause-head { display: flex; justify-content: space-between; gap: 10px; align-items: center; flex-wrap: wrap; }
.cause-body p { margin: 6px 0 0; font-size: .92rem; color: var(--text-2); }
@media (max-width: 900px) { .trouble-layout { grid-template-columns: 1fr; } .trouble-list { max-height: none; } }

/* Timeline / calendar */
.calendar { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; }
.cal-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; }
.cal-item b { display: block; color: var(--primary); }
.cal-item ul { margin: 6px 0 0; padding-inline-start: 1.1em; font-size: .9rem; color: var(--text-2); }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(5, 15, 8, .55); display: grid; place-items: center; z-index: 300; padding: 16px; animation: fade .15s; }
.modal { background: var(--surface); border-radius: 18px; max-width: 760px; width: 100%; max-height: 90vh; overflow: auto; padding: 24px; box-shadow: var(--shadow-lg); position: relative; }
.modal .close { position: absolute; left: 14px; top: 14px; }
.modal h2 { padding-inline-end: 40px; }
.modal dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; }
.modal dt { font-weight: 700; color: var(--text-2); }
.modal dd { margin: 0; }
@media (max-width: 560px) { .modal dl { grid-template-columns: 1fr; } .modal dt { margin-top: 6px; } }

.toast-root { position: fixed; bottom: 18px; inset-inline-start: 18px; z-index: 400; display: grid; gap: 8px; }
.toast { background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow); animation: fade .2s; }

/* Footer */
.site-footer { border-top: 1px solid var(--hairline); background: var(--surface); padding: 28px 0; margin-top: auto; }
.footer-inner { display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: start; }
.footer-inner p { color: var(--text-2); font-size: .9rem; margin: 6px 0 0; max-width: 70ch; }
.footer-links { display: flex; gap: 14px; flex-wrap: wrap; }
.footer-links a { color: var(--text-2); }
@media (max-width: 700px) { .footer-inner { grid-template-columns: 1fr; } }

/* Print */
@media print {
  .topbar, .site-footer, .btn, .tabs, .nav-toggle, .toast-root { display: none !important; }
  .tab-panel { display: block !important; }
  body { background: #fff; color: #000; }
  .card, .method-card, .comp-card { box-shadow: none; break-inside: avoid; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
table.data.bom td.num { white-space: nowrap; }

/* v3: global helpers */
[hidden] { display: none !important; }

/* Search */
.search-modal input { font-size: 1.05rem; padding: 12px 14px 12px 14px; padding-inline-start: 38px; }
.search-results { margin-top: 12px; display: grid; gap: 2px; max-height: 60vh; overflow: auto; }
.search-group { font-size: .78rem; color: var(--muted); margin: 10px 4px 2px; font-weight: 700; }
.search-item { display: flex; gap: 10px; align-items: flex-start; text-align: right; padding: 9px 10px; border-radius: 9px; border: 1px solid transparent; background: none; font: inherit; color: var(--text); cursor: pointer; width: 100%; }
.search-item:hover, .search-item.active { background: var(--surface-2); border-color: var(--border); }
.search-item .si-icon { flex: 0 0 26px; font-size: 1.1rem; line-height: 1.7; }
.search-item b { display: block; }
.search-item small { display: block; color: var(--muted); font-size: .78rem; }
.search-item .snip { display: block; color: var(--text-2); font-size: .86rem; margin-top: 2px; }

/* Floating consult button */
.fab { position: fixed; bottom: 18px; inset-inline-end: 18px; z-index: 250; display: inline-flex; align-items: center; gap: 8px; padding: 12px 18px; border-radius: 999px; background: var(--primary); color: var(--primary-ink); font-weight: 700; box-shadow: var(--shadow-lg); }
.fab:hover { text-decoration: none; background: var(--primary-2); }

/* Contact */
.contact-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.contact-card { display: flex; gap: 12px; align-items: center; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); }
a.contact-card:hover { border-color: var(--primary); text-decoration: none; }
.contact-card .ci { font-size: 1.5rem; }
.contact-card small { display: block; color: var(--muted); font-size: .8rem; }
textarea { min-height: 110px; resize: vertical; }
.footer-contact { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; font-size: .9rem; }
.footer-contact a { color: var(--text-2); }

/* Checklist */
.checklist { list-style: none; padding: 0; margin: 6px 0 0; }
.checklist li { margin-bottom: 6px; }
.checklist .check { align-items: flex-start; font-size: .9rem; color: var(--text-2); }
.checklist .check input { margin-top: 4px; flex: 0 0 18px; }
.checklist input:checked + span { text-decoration: line-through; color: var(--muted); }

@media print { .fab, #searchBtn, #installBtn { display: none !important; } }
