/* ============================================================
   Cortronics — site styles
   Themes: dark (default), light, blueprint.
   ============================================================ */

:root {
  color-scheme: dark;
  --bg: #080b10;
  --bg-soft: #0b1016;
  --panel: #101720;
  --panel-2: #141e29;
  --panel-3: #18232f;
  --border: #22303f;
  --border-soft: #1a2634;
  --text: #e7eef5;
  --muted: #93a4b8;
  --dim: #65768b;
  --cyan: #38bdf8;
  --teal: #2dd4bf;
  --amber: #f5b942;
  --red: #fb7185;
  --green: #4ade80;
  --accent-ink: #05221d;
  --hover-border: #34465c;
  --article-text: #c7d3e0;
  --header-bg: rgba(8, 11, 16, 0.82);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --grid-line: rgba(90, 130, 170, 0.035);

  /* diagram palette (resolved by diagrams.js) */
  --d-bg: #0b1118;
  --d-grid: #1d2a39;
  --d-block: #14202c;
  --d-stroke: #344a61;
  --d-text: #e7eef5;
  --d-muted: #93a4b8;
  --d-power: #f5b942;
  --d-signal: #2dd4bf;
  --d-mains: #fb7185;
  --d-rf: #a78bfa;
  --d-measure: #38bdf8;
  --d-analog: #5eead4;
  --d-load: #4ade80;
  --d-board: #0d2622;
  --d-board-edge: #2dd4bf;

  --sans: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --display: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --radius: 14px;
  --radius-sm: 9px;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f7fa;
  --bg-soft: #eef2f6;
  --panel: #ffffff;
  --panel-2: #f6f9fb;
  --panel-3: #eaf0f5;
  --border: #d3dde7;
  --border-soft: #e5ebf1;
  --text: #14212e;
  --muted: #51657a;
  --dim: #7d90a3;
  --cyan: #0284c7;
  --teal: #0d9488;
  --amber: #b45309;
  --red: #dc2626;
  --green: #15803d;
  --accent-ink: #ffffff;
  --hover-border: #b6c6d5;
  --article-text: #33465a;
  --header-bg: rgba(245, 247, 250, 0.86);
  --shadow: 0 16px 40px rgba(30, 55, 80, 0.10);
  --grid-line: rgba(40, 80, 120, 0.05);

  --d-bg: #fbfdff;
  --d-grid: #dce6ef;
  --d-block: #ffffff;
  --d-stroke: #b8c9d8;
  --d-text: #14212e;
  --d-muted: #52677b;
  --d-power: #b45309;
  --d-signal: #0d9488;
  --d-mains: #dc2626;
  --d-rf: #7c3aed;
  --d-measure: #0284c7;
  --d-analog: #0f766e;
  --d-load: #15803d;
  --d-board: #eef7f3;
  --d-board-edge: #0d9488;
}

:root[data-theme="blueprint"] {
  color-scheme: dark;
  --bg: #06162e;
  --bg-soft: #082046;
  --panel: #0b2a53;
  --panel-2: #0f3565;
  --panel-3: #123e75;
  --border: #1d4e83;
  --border-soft: #17406d;
  --text: #e8f3ff;
  --muted: #a5c6e8;
  --dim: #7299c4;
  --cyan: #79c9ff;
  --teal: #4ee0f5;
  --amber: #ffc857;
  --red: #ff8fa8;
  --green: #7ee0a8;
  --accent-ink: #04203c;
  --hover-border: #2f6ba6;
  --article-text: #cfe3f8;
  --header-bg: rgba(6, 22, 46, 0.86);
  --shadow: 0 18px 50px rgba(0, 15, 40, 0.45);
  --grid-line: rgba(120, 190, 255, 0.07);

  --d-bg: #072044;
  --d-grid: #164478;
  --d-block: #103663;
  --d-stroke: #3d78ad;
  --d-text: #e8f3ff;
  --d-muted: #a5c6e8;
  --d-power: #ffc857;
  --d-signal: #4ee0f5;
  --d-mains: #ff8fa8;
  --d-rf: #b9a5ff;
  --d-measure: #79c9ff;
  --d-analog: #6ff0e0;
  --d-load: #7ee0a8;
  --d-board: #0a2b55;
  --d-board-edge: #4ee0f5;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15.5px;
  line-height: 1.72;
  -webkit-font-smoothing: antialiased;
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 20%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 20%, transparent 100%);
}

main, .site-header, .site-footer { position: relative; z-index: 1; }

.wrap { width: min(1180px, calc(100% - 48px)); margin-inline: auto; }

a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button { cursor: pointer; }

::selection { background: rgba(45, 212, 191, 0.28); color: #fff; }

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

/* ---------- header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--header-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-soft);
}

.header-inner {
  height: 66px;
  display: flex;
  align-items: center;
  gap: 32px;
}

.brand { display: inline-flex; align-items: center; gap: 10px; flex-shrink: 0; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-tagline { font-family: var(--sans); font-size: 8.5px; font-weight: 500; color: var(--dim); letter-spacing: 0.1px; margin-top: 2px; white-space: nowrap; }

.brand-mark {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border: 1px solid var(--teal);
  border-radius: 7px;
  color: var(--teal);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -1px;
  background: rgba(45, 212, 191, 0.08);
  position: relative;
}
.brand-dot { color: var(--amber); margin-left: -1px; }
.brand-name { font-family: var(--display); font-size: 16px; font-weight: 700; letter-spacing: -0.4px; }
.brand-slash { color: var(--dim); }

.site-nav { display: flex; gap: 26px; margin-left: auto; }
.site-nav a {
  color: var(--muted);
  font-size: 13px;
  transition: color 0.2s;
}
.site-nav a:hover { color: var(--text); }

.header-cta {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 13px;
  font-size: 12px;
  color: var(--text);
  background: var(--panel);
  transition: border-color 0.2s, background 0.2s;
  white-space: nowrap;
}
.header-cta:hover { border-color: var(--teal); background: rgba(45, 212, 191, 0.06); }
.header-cta span { color: var(--teal); margin-left: 4px; }

.theme-toggle {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  padding: 6px 10px;
  font-family: var(--mono);
  font-size: 11px;
  white-space: nowrap;
  transition: color 0.18s, border-color 0.18s, background 0.18s;
}
.theme-toggle:hover { color: var(--text); border-color: var(--hover-border); background: var(--panel); }
.theme-icon { font-size: 14px; color: var(--amber); line-height: 1; }
.theme-name { min-width: 52px; text-align: left; }

/* ---------- hero ---------- */
.hero {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 70px;
  align-items: center;
  padding-top: 96px;
  padding-bottom: 84px;
}

.eyebrow {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: 24px;
}
.pulse {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 4px rgba(45, 212, 191, 0.12);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(45, 212, 191, 0); } }

.hero h1 {
  margin: 0 0 22px;
  font-size: clamp(44px, 5.4vw, 70px);
  line-height: 1.06;
  letter-spacing: -1.5px;
  font-weight: 700;
}
.hero h1 em { color: var(--teal); font-style: normal; }

.hero-lede { color: var(--muted); font-size: 16px; max-width: 560px; margin: 0 0 32px; }

.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 11px 19px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: transform 0.18s, background 0.18s, border-color 0.18s;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--teal); color: var(--accent-ink); }
.btn-primary:hover { background: color-mix(in srgb, var(--teal) 78%, white); }
.btn-ghost { border-color: var(--border); color: var(--text); background: transparent; }
.btn-ghost:hover { border-color: var(--muted); background: var(--panel); }

/* terminal-style panel */
.hero-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(160deg, var(--panel-2), var(--bg-soft));
  box-shadow: var(--shadow);
  overflow: hidden;
  transform: rotate(0.6deg);
}
.panel-head {
  display: flex; align-items: center; gap: 6px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.02);
}
.panel-dot { width: 8px; height: 8px; border-radius: 50%; background: #3a4655; }
.panel-dot:first-child { background: var(--red); }
.panel-dot:nth-child(2) { background: var(--amber); }
.panel-dot:nth-child(3) { background: var(--green); }
.panel-title { font-family: var(--mono); font-size: 11px; color: var(--dim); margin-left: 10px; }
.panel-body { padding: 20px 22px 22px; }
.panel-line {
  display: flex; justify-content: space-between;
  font-family: var(--mono); font-size: 12px;
  padding: 7px 0;
  border-bottom: 1px dashed var(--border-soft);
}
.panel-line .key { color: var(--dim); }
.panel-line .val { color: var(--text); }
.panel-line .val.ok { color: var(--green); }
.panel-chart {
  display: flex; align-items: flex-end; gap: 5px;
  height: 78px; margin-top: 22px;
  padding-bottom: 2px;
  border-bottom: 1px solid var(--border);
}
.panel-chart span {
  flex: 1;
  height: var(--h);
  background: linear-gradient(to top, rgba(45, 212, 191, 0.18), var(--teal));
  border-radius: 2px 2px 0 0;
  opacity: 0.75;
}
.panel-chart span:nth-child(3n) { background: linear-gradient(to top, rgba(56, 189, 248, 0.15), var(--cyan)); }

/* ---------- stats ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: hidden;
  margin-bottom: 104px;
}
.stat { padding: 24px 26px; border-right: 1px solid var(--border-soft); }
.stat:last-child { border-right: 0; }
.stat-value {
  display: block;
  font-family: var(--mono);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -1px;
  color: var(--text);
  line-height: 1.2;
}
.stat-label { display: block; color: var(--dim); font-size: 12px; margin-top: 5px; }

/* ---------- sections ---------- */
.section { margin-bottom: 110px; scroll-margin-top: 90px; }
.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 32px;
}
.section-kicker {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 10px;
}
.section-head h2 {
  margin: 0;
  font-size: clamp(28px, 3.2vw, 38px);
  letter-spacing: -0.7px;
  font-weight: 700;
}
.section-sub { color: var(--muted); margin: 9px 0 0; max-width: 620px; font-size: 14px; }
.text-link { color: var(--teal); font-size: 13px; white-space: nowrap; border-bottom: 1px solid rgba(45, 212, 191, 0.35); padding-bottom: 2px; }
.text-link:hover { color: #5eead4; border-color: #5eead4; }

/* ---------- toolbar ---------- */
.toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.search-wrap {
  position: relative;
  flex: 1;
  min-width: 240px;
}
.search-wrap svg {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; fill: none; stroke: var(--dim); stroke-width: 2;
  stroke-linecap: round;
}
.search-wrap input {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 11px 14px 11px 40px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}
.search-wrap input::placeholder { color: var(--dim); }
.search-wrap input:focus { border-color: var(--teal); }
.select-wrap select {
  appearance: none;
  background: var(--panel) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2393a4b8' stroke-width='2'><path d='m6 9 6 6 6-6'/></svg>") no-repeat right 13px center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 11px 36px 11px 14px;
  font-size: 13px;
  outline: none;
  min-width: 180px;
  cursor: pointer;
}
.select-wrap select:focus { border-color: var(--teal); }

/* ---------- catalogue layout + sidebar ---------- */
.catalogue-layout {
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
  gap: 26px;
  align-items: start;
}
.catalogue-main { min-width: 0; }

.sidebar {
  position: sticky;
  top: 86px;
  max-height: calc(100vh - 106px);
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 6px; }

.side-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--panel-2);
}
.side-title {
  font-family: var(--mono); font-size: 10px; letter-spacing: 1.4px;
  text-transform: uppercase; color: var(--teal);
}
.side-close { display: none; background: none; border: 0; color: var(--muted); font-size: 22px; line-height: 1; padding: 0 2px; }
.side-close:hover { color: var(--text); }

.side-block { padding: 16px 14px 14px; border-bottom: 1px solid var(--border-soft); }
.side-label {
  font-family: var(--mono); font-size: 9.5px; text-transform: uppercase;
  letter-spacing: 1.3px; color: var(--dim); font-weight: 500;
  margin: 0 0 10px 4px;
}
.side-list { display: flex; flex-direction: column; gap: 3px; }

.side-item {
  width: 100%;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--muted);
  transition: background 0.16s, border-color 0.16s, color 0.16s;
}
.side-item:hover { background: var(--panel-2); color: var(--text); }
.side-item.active {
  background: rgba(45, 212, 191, 0.09);
  border-color: rgba(45, 212, 191, 0.32);
  color: var(--text);
}
.side-item-copy { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.side-item-title { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; }
.side-item-note { font-size: 10px; color: var(--dim); padding-left: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-count {
  font-family: var(--mono); font-size: 10px; color: var(--dim);
  background: rgba(255, 255, 255, 0.035);
  border-radius: 5px; padding: 2px 6px;
}
.side-item.active .side-count { color: var(--teal); background: rgba(45, 212, 191, 0.12); }

.level-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--dim); flex-shrink: 0; }
.level-dot.all { background: var(--teal); }
.level-dot.easy { background: var(--green); }
.level-dot.medium { background: var(--cyan); }
.level-dot.hard { background: var(--amber); }
.level-dot.expert { background: var(--red); }
.level-dot.v1 { background: var(--cyan); }
.level-dot.v2 { background: var(--teal); }
.level-dot.v3 { background: var(--amber); }

.skill-nav { display: flex; flex-wrap: wrap; gap: 6px; }
.skill-item {
  display: inline-flex; align-items: center; gap: 7px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  padding: 5px 8px;
  font-size: 11px;
  transition: all 0.16s;
}
.skill-item:hover { border-color: var(--muted); color: var(--text); }
.skill-item.active { border-color: var(--cyan); color: var(--cyan); background: rgba(56, 189, 248, 0.08); }
.skill-item .side-count { padding: 1px 4px; font-size: 9px; }

.side-reset {
  margin: 12px 14px 14px;
  width: calc(100% - 28px);
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: 7px;
  color: var(--muted);
  font-size: 11px;
  padding: 8px;
}
.side-reset:hover { color: var(--red); border-color: rgba(251, 113, 133, 0.4); }

.filter-toggle {
  display: none;
  align-items: center; gap: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--muted);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
}
.filter-toggle[aria-expanded="true"] { color: var(--teal); border-color: var(--teal); }

.active-filters { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-bottom: 12px; }
.active-filters[hidden] { display: none; }
.active-label { font-family: var(--mono); font-size: 10px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.8px; }
.filter-chip {
  border: 1px solid rgba(56, 189, 248, 0.3);
  background: rgba(56, 189, 248, 0.07);
  color: var(--cyan);
  border-radius: 100px;
  padding: 4px 10px;
  font-size: 11px;
  display: inline-flex; align-items: center; gap: 6px;
}
.filter-chip:hover { background: rgba(56, 189, 248, 0.15); }
.filter-chip span { font-size: 13px; line-height: 1; }

.results-bar {
  display: flex; align-items: center; justify-content: space-between;
  font-family: var(--mono); font-size: 11px; color: var(--dim);
  padding: 8px 2px 16px;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 20px;
}
.mini-btn {
  background: none; border: none; color: var(--muted);
  font-family: var(--mono); font-size: 11px; padding: 2px 0;
}
.mini-btn:hover { color: var(--teal); }

/* ---------- project cards ---------- */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
  align-items: start;
}

.card {
  position: relative;
  scroll-margin-top: 90px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.card::before {
  content: "";
  position: absolute; top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--accent, var(--teal));
  opacity: 0.8;
}
.card[data-volume="v1"] { --accent: var(--cyan); }
.card[data-volume="v2"] { --accent: var(--teal); }
.card[data-volume="v3"] { --accent: var(--amber); }
.card:hover { border-color: var(--hover-border); transform: translateY(-3px); box-shadow: var(--shadow); }
.card.expanded {
  grid-column: 1 / -1;
  border-color: var(--accent);
  transform: none;
}

.card-main { padding: 22px 22px 18px; }
.card-top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 15px;
}
.vol-badge {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
  padding: 4px 8px;
  border-radius: 5px;
  white-space: nowrap;
}
.level-badge {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: 5px;
  white-space: nowrap;
  border: 1px solid var(--border);
  color: var(--muted);
}
.level-badge.easy { color: var(--green); border-color: rgba(74, 222, 128, 0.35); background: rgba(74, 222, 128, 0.08); }
.level-badge.medium { color: var(--cyan); border-color: rgba(56, 189, 248, 0.35); background: rgba(56, 189, 248, 0.08); }
.level-badge.hard { color: var(--amber); border-color: rgba(245, 185, 66, 0.35); background: rgba(245, 185, 66, 0.08); }
.level-badge.expert { color: var(--red); border-color: rgba(251, 113, 133, 0.35); background: rgba(251, 113, 133, 0.08); }

.card-section { font-family: var(--mono); font-size: 11px; color: var(--dim); margin-bottom: 6px; }
.card h3 {
  margin: 0 0 10px;
  font-size: 19px;
  line-height: 1.3;
  letter-spacing: -0.5px;
  font-weight: 650;
}
.card-desc { color: var(--muted); font-size: 13px; margin: 0 0 18px; line-height: 1.62; }
.card-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.tag {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  border: 1px solid var(--border-soft);
  border-radius: 4px;
  padding: 3px 7px;
  background: rgba(255, 255, 255, 0.015);
}
.tag.cat { color: var(--amber); border-color: rgba(245, 185, 66, 0.25); }
.tag.skill { color: var(--cyan); border-color: rgba(56, 189, 248, 0.18); }

.card-foot {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 14px;
  padding-top: 16px;
  border-top: 1px solid var(--border-soft);
}
.cost-block { min-width: 0; }
.cost-label { display: block; font-family: var(--mono); font-size: 10px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.8px; }
.cost-value { display: block; font-family: var(--mono); font-size: 22px; font-weight: 700; color: var(--text); letter-spacing: -0.6px; line-height: 1.3; }
.cost-value .approx { font-size: 13px; color: var(--dim); font-weight: 400; margin-right: 2px; }
.cost-foot { display: block; font-family: var(--mono); font-size: 10px; color: var(--dim); }

.card-toggle {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  border-radius: 7px;
  font-size: 11px;
  padding: 8px 11px;
  white-space: nowrap;
  transition: all 0.18s;
}
.card-toggle:hover { color: var(--text); border-color: var(--accent); }
.card.expanded .card-toggle { color: var(--accent); border-color: var(--accent); }
.card-toggle .chev { display: inline-block; transition: transform 0.2s; margin-left: 5px; }
.card.expanded .card-toggle .chev { transform: rotate(180deg); }

/* expanded detail */
.card-detail {
  border-top: 1px solid var(--border-soft);
  background: var(--bg-soft);
  padding: 24px 22px 26px;
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(0, 1.6fr);
  gap: 30px;
}
.detail-title {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--dim);
  margin: 0 0 12px;
}
.highlights { list-style: none; padding: 0; margin: 0 0 22px; }
.highlights li {
  position: relative;
  padding-left: 16px;
  margin-bottom: 10px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}
.highlights li::before {
  content: "›"; position: absolute; left: 0; top: -1px;
  color: var(--accent); font-family: var(--mono); font-size: 15px;
}
.basis-note {
  font-size: 11px;
  color: var(--dim);
  border-left: 2px solid var(--border);
  padding-left: 12px;
  line-height: 1.6;
}

.bom-mini { width: 100%; border-collapse: collapse; font-size: 12px; }
.bom-mini th {
  text-align: left;
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--dim);
  font-weight: 500;
  padding: 0 10px 10px 0;
  border-bottom: 1px solid var(--border);
}
.bom-mini td {
  padding: 9px 10px 9px 0;
  border-bottom: 1px solid var(--border-soft);
  color: var(--muted);
  vertical-align: top;
}
.bom-mini td:first-child { color: var(--text); }
.bom-mini td.qty, .bom-mini td.num { font-family: var(--mono); white-space: nowrap; font-size: 11px; }
.bom-mini td.num { text-align: right; }
.bom-mini td .comp-note { display: block; font-size: 10px; color: var(--dim); margin-top: 2px; }
.bom-mini tr:last-child td { border-bottom: 0; }
.bom-mini tfoot td {
  border-top: 1px solid var(--border);
  border-bottom: 0;
  color: var(--text);
  font-weight: 700;
  padding-top: 12px;
}

.basis-pill {
  display: inline-block;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.4px;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  border: 1px solid var(--border);
  color: var(--dim);
  white-space: nowrap;
}
.basis-pill.listed { color: var(--teal); border-color: rgba(45, 212, 191, 0.35); background: rgba(45, 212, 191, 0.08); }
.basis-pill.kit { color: var(--cyan); border-color: rgba(56, 189, 248, 0.3); background: rgba(56, 189, 248, 0.06); }
.basis-pill.estimate { color: var(--dim); }

.detail-actions { margin-top: 16px; display: flex; gap: 8px; }
.copy-btn {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 7px;
  font-size: 11px;
  padding: 7px 11px;
}
.copy-btn:hover { color: var(--teal); border-color: var(--teal); }

/* ---------- project diagrams ---------- */
.diagram-section { margin-top: 4px; border-top: 1px solid var(--border-soft); padding: 22px 22px 24px; }
.diagram-tabs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.diagram-tab {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  border-radius: 7px;
  padding: 6px 11px;
  font-family: var(--mono);
  font-size: 11px;
}
.diagram-tab:hover { color: var(--text); border-color: var(--hover-border); }
.diagram-tab.active { color: var(--accent-ink); background: var(--teal); border-color: var(--teal); font-weight: 600; }
.diagram-actions { margin-left: auto; display: flex; gap: 6px; }
.diagram-download {
  border: 1px dashed var(--border);
  background: transparent;
  color: var(--muted);
  border-radius: 7px;
  padding: 6px 10px;
  font-family: var(--mono);
  font-size: 10px;
}
.diagram-download:hover { color: var(--cyan); border-color: var(--cyan); }
.diagram-frame {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--d-bg);
  line-height: 0;
}
.diagram-frame svg { display: block; width: 100%; height: auto; }
.diagram-caption { margin: 12px 0 0; font-size: 11.5px; color: var(--muted); line-height: 1.7; }
.diagram-caption strong { color: var(--text); font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.8px; }
.diagram-zones { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.diagram-zone {
  font-family: var(--mono); font-size: 9.5px; color: var(--cyan);
  border: 1px solid rgba(56, 189, 248, 0.25); background: rgba(56, 189, 248, 0.06);
  border-radius: 4px; padding: 3px 7px;
}

.empty-state {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 60px 20px;
  text-align: center;
  color: var(--muted);
}
.empty-icon { font-family: var(--mono); font-size: 34px; color: var(--dim); }
.empty-state h3 { margin: 10px 0 4px; color: var(--text); }
.empty-state p { font-size: 13px; margin: 0 0 18px; }

/* ---------- shopping list table ---------- */
.table-shell {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  background: var(--panel);
}
.bom-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 680px; }
.bom-table thead th {
  text-align: left;
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--dim);
  font-weight: 500;
  padding: 15px 20px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.bom-table td { padding: 15px 20px; border-bottom: 1px solid var(--border-soft); color: var(--muted); }
.bom-table td:first-child { color: var(--text); max-width: 420px; }
.bom-table td:nth-child(2), .bom-table td:nth-child(3) { font-family: var(--mono); font-size: 12px; white-space: nowrap; }
.bom-table td:nth-child(3) { color: var(--teal); font-weight: 600; }
.bom-table td:last-child { font-size: 12px; }
.bom-table tbody tr:hover { background: rgba(255, 255, 255, 0.018); }
.bom-table tfoot td {
  border-bottom: 0;
  border-top: 1px solid var(--border);
  background: var(--panel-2);
  font-family: var(--mono);
  font-weight: 700;
  color: var(--text);
}
.bom-table tfoot td:nth-child(3) { color: var(--amber); font-size: 14px; }
.fine-print { font-size: 11px; color: var(--dim); margin-top: 14px; max-width: 800px; line-height: 1.7; }
.fine-print strong { color: var(--muted); font-family: var(--mono); }

/* ---------- core kit ---------- */
.kit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }
.kit-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 20px 22px;
  transition: border-color 0.2s;
}
.kit-card:hover { border-color: var(--hover-border); }
.kit-num { font-family: var(--mono); font-size: 10px; color: var(--cyan); letter-spacing: 1px; }
.kit-card h3 { margin: 7px 0 9px; font-size: 15px; font-weight: 650; }
.kit-card p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.75; font-family: var(--mono); }

/* ---------- prerequisite tools ---------- */
.tool-callout {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  border: 1px solid rgba(56, 189, 248, 0.3);
  background: rgba(56, 189, 248, 0.05);
  border-radius: var(--radius);
  padding: 16px 22px;
  margin-bottom: 18px;
}
.callout-tag {
  font-family: var(--mono); font-size: 10px; letter-spacing: 1.2px;
  color: var(--cyan); white-space: nowrap;
}
.tool-callout p { margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.7; }
.tool-callout strong { color: var(--text); font-family: var(--mono); }

.tools-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.tool-group {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: hidden;
}
.tool-group-head { padding: 18px 22px 14px; border-bottom: 1px solid var(--border-soft); background: var(--panel-2); }
.tool-group-num { font-family: var(--mono); font-size: 10px; color: var(--amber); letter-spacing: 1px; }
.tool-group h3 { margin: 5px 0 5px; font-size: 16px; }
.tool-group-head p { margin: 0; color: var(--dim); font-size: 11.5px; line-height: 1.6; }
.tool-list { list-style: none; margin: 0; padding: 6px 22px 12px; }
.tool-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 14px;
  align-items: start;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-soft);
}
.tool-row:last-child { border-bottom: 0; }
.tool-name { font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.4; }
.tool-purpose { grid-column: 1 / -1; font-size: 11.5px; color: var(--muted); line-height: 1.6; }
.tool-meta { display: flex; align-items: center; gap: 8px; justify-self: end; white-space: nowrap; }
.tool-cost { font-family: var(--mono); font-size: 11px; color: var(--teal); }
.level-pill {
  font-family: var(--mono); font-size: 9px; text-transform: uppercase; letter-spacing: 0.5px;
  padding: 2px 6px; border-radius: 4px; border: 1px solid var(--border); color: var(--dim);
}
.level-pill.required { color: var(--amber); border-color: rgba(245, 185, 66, 0.35); background: rgba(245, 185, 66, 0.07); }
.level-pill.recommended { color: var(--cyan); border-color: rgba(56, 189, 248, 0.3); background: rgba(56, 189, 248, 0.06); }
.level-pill.optional { color: var(--dim); }

/* ---------- notes ---------- */
.notes-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.note-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 22px 24px;
  position: relative;
}
.note-card.warn { border-color: rgba(251, 113, 133, 0.3); background: rgba(251, 113, 133, 0.035); }
.note-card.warn .note-num { color: var(--red); }
.note-num { font-family: var(--mono); font-size: 11px; color: var(--teal); margin-bottom: 10px; }
.note-card h3 { margin: 0 0 8px; font-size: 15px; }
.note-card p { margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.75; }

.source-bar {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  margin-top: 22px; padding: 18px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-soft);
}
.source-label { font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--dim); }
.source-links { display: flex; gap: 10px; flex-wrap: wrap; }
.source-link {
  font-family: var(--mono); font-size: 11px; color: var(--muted);
  border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px;
  transition: all 0.18s;
}
.source-link:hover { color: var(--teal); border-color: var(--teal); }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--border-soft); background: var(--bg-soft); }
.footer-inner {
  min-height: 90px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px; flex-wrap: wrap;
  font-size: 11px; color: var(--dim);
}
.footer-brand { display: flex; flex-direction: column; font-family: var(--display); font-size: 15px; color: var(--text); font-weight: 700; line-height: 1.2; }
.footer-tagline { font-family: var(--sans); font-size: 10px; font-weight: 400; color: var(--dim); margin-top: 2px; }
.site-footer a:hover { color: var(--teal); }

.footer-bottom {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px 24px; flex-wrap: wrap;
  padding: 16px 0 24px;
  border-top: 1px solid var(--border-soft);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--dim);
}
.footer-contact, .footer-legal { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.footer-email { color: var(--muted); }
.footer-email:hover { color: var(--teal); }
.footer-email span, .footer-location span { color: var(--teal); margin-right: 3px; }
.footer-sep { color: var(--border); }
.footer-legal { gap: 18px; }
.footer-love { color: var(--muted); }
.heart { color: var(--red); display: inline-block; animation: heart-beat 2s ease-in-out infinite; }
@keyframes heart-beat { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.2); } 30% { transform: scale(1); } 45% { transform: scale(1.15); } 60% { transform: scale(1); } }

/* ---------- blog ---------- */
.site-nav a.current { color: var(--teal); }

.blog-hero { max-width: 830px; padding-top: 96px; padding-bottom: 34px; }
.blog-hero h1 {
  margin: 0 0 20px;
  font-size: clamp(42px, 5vw, 64px);
  line-height: 1.08;
  letter-spacing: -1.2px;
}
.blog-hero h1 em { color: var(--teal); font-style: normal; }
.blog-hero-meta {
  display: flex; gap: 22px; flex-wrap: wrap;
  margin-top: 28px;
  font-family: var(--mono); font-size: 11px; color: var(--dim);
}
.blog-hero-meta strong { color: var(--text); font-size: 14px; margin-right: 4px; }

.topic-filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.topic-chip {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  border-radius: 100px;
  padding: 6px 13px;
  font-size: 12px;
  transition: all 0.18s;
}
.topic-chip:hover { border-color: var(--muted); color: var(--text); }
.topic-chip.active { background: var(--teal); border-color: var(--teal); color: var(--accent-ink); font-weight: 600; }

.post-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.post-card {
  display: flex; flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 22px;
  min-height: 230px;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.post-card:hover { transform: translateY(-3px); border-color: var(--hover-border); box-shadow: var(--shadow); }
.post-card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.post-cat {
  font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--amber); border: 1px solid rgba(245, 185, 66, 0.3);
  background: rgba(245, 185, 66, 0.07); border-radius: 4px; padding: 3px 7px;
}
.post-read { font-family: var(--mono); font-size: 10px; color: var(--dim); white-space: nowrap; }
.post-card h3 { margin: 0 0 10px; font-size: 18px; line-height: 1.35; letter-spacing: -0.4px; }
.post-card p { margin: 0 0 22px; color: var(--muted); font-size: 13px; line-height: 1.65; flex: 1; }
.post-card-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border-top: 1px solid var(--border-soft); padding-top: 14px;
  font-family: var(--mono); font-size: 10px; color: var(--dim);
}
.post-cta { color: var(--teal); white-space: nowrap; }

[hidden] { display: none !important; }

.article-view { max-width: 820px; margin-inline: auto; }
.back-link {
  background: transparent; border: 1px solid var(--border); border-radius: 7px;
  color: var(--muted); font-size: 12px; padding: 8px 12px; margin-bottom: 34px;
}
.back-link:hover { color: var(--teal); border-color: var(--teal); }
.article-head h1 { margin: 0 0 16px; font-size: clamp(32px, 4vw, 46px); line-height: 1.14; letter-spacing: -0.9px; }
.article-excerpt { font-size: 17px; color: var(--muted); line-height: 1.7; margin: 0 0 20px; }
.article-meta { display: flex; gap: 8px; font-family: var(--mono); font-size: 11px; color: var(--dim); }
.meta-sep { color: var(--border); }
.post-tags { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 18px; }
.post-tag {
  font-family: var(--mono); font-size: 10px; color: var(--cyan);
  border: 1px solid rgba(56, 189, 248, 0.25); background: rgba(56, 189, 248, 0.06);
  border-radius: 4px; padding: 3px 8px;
}
.article-body { margin-top: 38px; color: var(--article-text); font-size: 15.5px; line-height: 1.85; }
.article-body p { margin: 0 0 20px; }
.article-body h2 {
  margin: 42px 0 16px; font-size: 23px; letter-spacing: -0.6px; color: var(--text);
  padding-left: 14px; border-left: 2px solid var(--teal);
}
.article-body ul { margin: 0 0 22px; padding-left: 20px; }
.article-body li { margin-bottom: 9px; }
.article-body li::marker { color: var(--teal); }
.article-callout {
  border: 1px solid rgba(56, 189, 248, 0.3);
  background: rgba(56, 189, 248, 0.05);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin: 28px 0;
}
.callout-label { font-family: var(--mono); font-size: 10px; letter-spacing: 1.3px; color: var(--cyan); }
.article-callout p { margin: 8px 0 0; font-size: 13.5px; line-height: 1.75; color: var(--muted); }
.article-bottom { margin-top: 56px; padding-top: 26px; border-top: 1px solid var(--border); }
.next-post-label { font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: 1.3px; color: var(--dim); margin-bottom: 12px; }

/* Display typography */
.hero h1, .section-head h2, .blog-hero h1, .article-head h1,
.card h3, .post-card h3, .tool-group h3, .kit-card h3,
.note-card h3, .empty-state h3, .tool-callout strong { font-family: var(--display); }

/* ---------- responsive ---------- */
@media (max-width: 940px) {
  .hero { grid-template-columns: 1fr; gap: 46px; padding-top: 70px; padding-bottom: 60px; }
  .hero-panel { max-width: 520px; transform: none; }
  .site-nav { display: none; }
  .header-cta { margin-left: auto; }
  .stats { margin-bottom: 80px; }
  .card-detail { grid-template-columns: 1fr; gap: 24px; }
  .catalogue-layout { grid-template-columns: 1fr; gap: 16px; }
  .sidebar { display: none; position: static; max-height: none; overflow: visible; }
  .sidebar.open { display: block; }
  .side-close { display: block; }
  .filter-toggle { display: inline-flex; }
}

@media (max-width: 700px) {
  .wrap { width: min(100% - 32px, 1180px); }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(2) { border-right: 0; }
  .stat:nth-child(-n+2) { border-bottom: 1px solid var(--border-soft); }
  .section { margin-bottom: 76px; }
  .section-head { flex-direction: column; align-items: flex-start; gap: 12px; }
  .toolbar { flex-direction: column; }
  .select-wrap select { width: 100%; }
  .notes-grid, .tools-grid, .post-grid { grid-template-columns: 1fr; }
  .project-grid { grid-template-columns: 1fr; }
  .blog-hero { padding-top: 62px; }
  .hero h1 { letter-spacing: -0.8px; }
  .footer-inner { flex-direction: column; align-items: flex-start; padding: 26px 0; }
  .footer-bottom { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
