/* ───────────────────────────────────────────────────────────
   lugowski.dev — Shared Theme
   ─────────────────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20,400,0,0&display=swap');

:root {
  /* ── Backgrounds (dark — lifted, grey-leaning) ── */
  --bg:           #191a23;
  --surface:      #21222e;
  --surface2:     #292a38;
  --surface3:     #31323f;
  --border:       #3a3b4a;
  --border2:      #484958;

  /* ── Accent ── */
  --accent:       #6c72ff;
  --accent-hover: #8387ff;
  --accent-glow:  rgba(108, 114, 255, 0.18);
  --accent-dim:   rgba(108, 114, 255, 0.08);
  --purple:       #a78bfa;
  --cyan:         #22d3ee;
  --cyan-dim:     rgba(34, 211, 238, 0.1);

  /* ── Status ── */
  --danger:       #ff5252;
  --success:      #2ecc71;
  --warning:      #f59e0b;

  /* ── Text ── */
  --text:         #e3e4f0;
  --text-muted:   #a0a1b6;
  --text-dim:     #6e6f86;

  /* ── Component tokens ── */
  --code-bg:      rgba(0, 0, 0, 0.28);
  --code-color:   #a8b5ff;
  --pre-color:    #c4cce6;
  --nav-bg:       rgba(25, 26, 35, 0.93);
  --modal-border: rgba(0, 0, 0, 0.46);

  /* ── Radii / shadows / type ── */
  --radius-sm:    6px;
  --radius:       10px;
  --radius-lg:    16px;
  --radius-xl:    24px;
  --shadow:       0 4px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg:    0 12px 48px rgba(0, 0, 0, 0.45);
  --font-sans:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:    'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  --max-w:        1100px;
  --nav-h:        64px;
}

/* ── Utilities ───────────────────────────────────────────── */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.zoomable { cursor: zoom-in; }

html.modal-open,
html.modal-open body { overflow: hidden; }

/* ── Shared image modal (guides + projects) ─────────────── */
.img-modal {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 2200;
}
.img-modal.open { display: block; }
.img-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.68);
  backdrop-filter: blur(6px);
  z-index: 0;
}
.img-modal-dialog {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
  width: min(1100px, calc(100vw - 28px));
  height: min(820px, calc(100vh - 28px));
  background: rgba(33,34,46,0.92);
  border: 1px solid var(--modal-border, var(--border));
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 24px 90px rgba(0,0,0,0.6);
  display: grid;
  place-items: center;
}
.img-modal-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.img-modal-close,
.img-modal-nav {
  position: absolute;
  z-index: 2;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(0,0,0,0.35);
  color: rgba(255,255,255,0.95);
  cursor: pointer;
  line-height: 1;
}
.img-modal-close {
  top: 10px;
  right: 10px;
  font-size: 22px;
}
.img-modal-nav {
  top: 50%;
  transform: translateY(-50%);
  font-size: 30px;
}
.img-modal-prev { left: 10px; }
.img-modal-next { right: 10px; }
.img-modal-close:hover,
.img-modal-nav:hover { border-color: rgba(108,114,255,0.5); }
.img-modal-caption {
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  z-index: 2;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.95);
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(255,255,255,0.16);
  max-width: calc(100% - 120px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Light mode ──────────────────────────────────────────── */
[data-theme="light"] {
  --bg:           #f3f4f8;
  --surface:      #ffffff;
  --surface2:     #f7f8fb;
  --surface3:     #edeef5;
  --border:       #dfe0ec;
  --border2:      #cacbd8;

  --accent:       #4f54f0;
  --accent-hover: #6468f8;
  --accent-glow:  rgba(79, 84, 240, 0.13);
  --accent-dim:   rgba(79, 84, 240, 0.07);
  --purple:       #7c5ccf;
  --cyan:         #0891b2;
  --cyan-dim:     rgba(8, 145, 178, 0.09);

  --danger:       #dc2f2f;
  --success:      #1a9e52;
  --warning:      #c07000;

  --text:         #14141f;
  --text-muted:   #5e5f74;
  --text-dim:     #9899ae;

  --code-bg:      rgba(79, 84, 240, 0.06);
  --code-color:   #4f54f0;
  --pre-color:    #2c2c3e;
  --nav-bg:       rgba(243, 244, 248, 0.96);
  --modal-border: rgba(0, 0, 0, 0.42);

  --shadow:       0 4px 24px rgba(0, 0, 0, 0.07);
  --shadow-lg:    0 12px 48px rgba(0, 0, 0, 0.11);
}

/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip; /* prevent horizontal scrollbar from oversized decorations */
}

main {
  flex: 1 0 auto;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

/* ── Typography ──────────────────────────────────────────── */
h1, h2, h3, h4, h5 { line-height: 1.25; font-weight: 700; letter-spacing: -0.02em; }
h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.05rem; }

p { color: var(--text-muted); line-height: 1.75; }

code, kbd {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--code-bg);
  border: 1px solid var(--border2);
  padding: 2px 7px;
  border-radius: 4px;
  color: var(--code-color);
}

pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.7;
  color: var(--pre-color);
  position: relative;
}
pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
  color: inherit;
}
.pre-label {
  position: absolute;
  top: 10px;
  right: 14px;
  font-size: 0.72rem;
  font-family: var(--font-mono);
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ── Layout ──────────────────────────────────────────────── */
.container { max-width: var(--max-w); margin: 0 auto; padding: 0 20px; }

/* ── 404 page ────────────────────────────────────────────── */
.error-page {
  min-height: calc(100vh - var(--nav-h) - 180px);
  display: grid;
  align-content: center;
  justify-items: center;
  text-align: center;
  gap: 12px;
  padding-top: 40px;
  padding-bottom: 80px;
  position: relative;
  isolation: isolate;
  overflow: hidden;
}
.error-bg-code {
  position: absolute;
  z-index: -1;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -54%);
  font-size: clamp(8rem, 36vw, 28rem);
  line-height: 0.8;
  font-weight: 800;
  letter-spacing: -0.05em;
  color: color-mix(in srgb, var(--accent) 22%, transparent);
  user-select: none;
  pointer-events: none;
}
.error-kicker {
  font-size: 0.78rem;
  font-family: var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}
.error-page h1 {
  font-size: clamp(2.2rem, 6vw, 3.5rem);
  letter-spacing: -0.03em;
}
.error-text {
  max-width: 700px;
  color: var(--text-muted);
}
.error-actions {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}
.container-wide { max-width: 1280px; margin: 0 auto; padding: 0 24px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }

.flex   { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }

/* ── Navigation ──────────────────────────────────────────── */
.nav {
  position: sticky; top: 0; z-index: 100;
  height: var(--nav-h);
  background: var(--nav-bg);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 20px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.nav-logo {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  text-decoration: none;
}
.logo-bracket { color: var(--accent); }
.logo-name    { color: var(--text); }
.logo-tld     { color: var(--purple); }

.nav-links {
  display: flex;
  align-items: center;
  list-style: none;
  gap: 4px;
  flex: 1;
  justify-content: center;
}
.nav-links a {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.15s;
}
.nav-links a:hover,
.nav-links a.active { color: var(--text); background: var(--surface2); }
.nav-links a.active { color: var(--accent); }

.nav-menu-toggle {
  display: none;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border2);
  background: transparent;
  color: var(--text-muted);
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.nav-menu-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}
.nav-collapse {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
}
.nav-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; margin-left: auto; }
/* ── Material Symbols ────────────────────────────────────── */
.material-symbols-outlined {
  font-family: 'Material Symbols Outlined';
  font-weight: normal;
  font-style: normal;
  font-size: 20px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  direction: ltr;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  vertical-align: middle;
}
/* Smaller icon variant for compact buttons */
.material-symbols-outlined.icon-sm { font-size: 16px; }

.theme-toggle {
  background: transparent;
  border: 1px solid var(--border2);
  color: var(--text-muted);
  cursor: pointer;
  width: 34px; height: 34px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}
.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

/* Nav action buttons match toggle height */
.nav-actions .btn { height: 34px; }
.nav-cart-btn { position: relative; }
.nav-cart-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: 2px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  font-family: var(--font-mono);
  border: 2px solid var(--bg);
  line-height: 1;
}
.nav-badge {
  background: var(--accent-glow);
  border: 1px solid rgba(108,114,255,0.3);
  color: var(--accent);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}
.btn-primary {
  background: linear-gradient(135deg, #6c72ff, #9b59ff);
  color: #fff;
  box-shadow: 0 4px 20px rgba(108,114,255,0.3);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 28px rgba(108,114,255,0.45); }
.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border2);
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
}
.btn-ghost:hover { color: var(--text); background: var(--surface2); }
.btn-danger {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
  padding: 6px 10px;
  font-size: 0.82rem;
}
.btn-danger:hover { color: var(--danger); background: rgba(255,82,82,0.08); }
.btn-sm { padding: 6px 14px; font-size: 0.82rem; border-radius: var(--radius-sm); }
.btn-lg { padding: 14px 32px; font-size: 1rem; border-radius: var(--radius-lg); }

.btn-shop {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: #fff;
  box-shadow: 0 4px 20px rgba(245,158,11,0.25);
}
.btn-shop:hover { transform: translateY(-1px); box-shadow: 0 6px 28px rgba(245,158,11,0.35); }

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s;
}
.card:hover { border-color: var(--border2); }
.card-link:hover { transform: translateY(-2px); border-color: rgba(108,114,255,0.35); }

.card-img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  background: var(--surface2);
}
.card-img-placeholder {
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
}

.card-body { padding: 20px 22px; }
.card-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ── Tags / Badges ───────────────────────────────────────── */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}
.tag-esp32   { background: rgba(34,211,238,0.1);  color: var(--cyan);     border: 1px solid rgba(34,211,238,0.2); }
.tag-ha      { background: rgba(108,114,255,0.1); color: var(--accent);   border: 1px solid rgba(108,114,255,0.2); }
.tag-3d      { background: rgba(245,158,11,0.1);  color: var(--warning);  border: 1px solid rgba(245,158,11,0.2); }
.tag-pcb     { background: rgba(46,204,113,0.1);  color: var(--success);  border: 1px solid rgba(46,204,113,0.2); }
.tag-assembly{ background: rgba(245,158,11,0.1);  color: var(--warning);  border: 1px solid rgba(245,158,11,0.2); }
.tag-diy     { background: rgba(99,102,241,0.1);  color: var(--accent);   border: 1px solid rgba(99,102,241,0.22); }
.tag-moto    { background: rgba(255,82,82,0.1);   color: var(--danger);   border: 1px solid rgba(255,82,82,0.2); }
.tag-default { background: var(--surface2);        color: var(--text-muted); border: 1px solid var(--border2); }
.tag-esphome    { background: rgba(16,185,129,0.1);  color: var(--success);  border: 1px solid rgba(16,185,129,0.22); }
.tag-automation { background: rgba(14,165,233,0.12); color: var(--cyan);      border: 1px solid rgba(14,165,233,0.28); }

/* ── Guides list (/guides/) ──────────────────────────────── */
.guides-list-wrap { padding: 32px 20px 56px; }
.guides-featured { margin-bottom: 20px; }
.guides-tiles { gap: 20px; }
.post-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: auto;
}
.post-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--border) 65%, var(--accent));
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.10);
}
.post-card-thumb {
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: none;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  color: var(--text-dim);
}
.post-card-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.post-card-thumb .material-symbols-outlined {
  font-size: 44px;
  opacity: 0.65;
}
.post-card-body {
  padding: 16px 18px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.post-card-tags { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 10px; }
.post-card-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 6px;
  line-height: 1.35;
}
.post-card-excerpt {
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.65;
  flex: 1;
  margin: 0;
}
.post-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-dim);
}
.post-card-footer .meta-left { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.post-card-difficulty {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface2);
  border: 1px solid var(--border2);
  color: var(--text-muted);
  font-weight: 700;
}

/* featured (latest) guide: full width */
.post-card-featured {
  grid-column: 1 / -1;
  flex-direction: row;
  height: auto;
  min-height: 240px;
}
.post-card-featured .post-card-thumb {
  width: 340px;
  flex-shrink: 0;
  aspect-ratio: unset;
  border-bottom: none;
  border-right: 1px solid var(--border);
  align-self: stretch;
}
.post-card-featured .post-card-title { font-size: 1.05rem; }

@media (max-width: 860px) {
  .post-card { flex-direction: column; }
  .post-card-thumb {
    width: 100%;
    aspect-ratio: 16/9;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .post-card-featured { flex-direction: column; height: auto; }
  .post-card-featured .post-card-thumb {
    width: 100%;
    aspect-ratio: 16/9;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
}

/* ── Projects list (/projects/) ──────────────────────────── */
.projects-list-wrap { padding: 32px 20px 48px; }
.projects-list {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.projects-list-item {
  width: 100%;
}
.project-list-row {
  display: flex;
  gap: 20px;
  align-items: stretch;
  width: 100%;
  box-sizing: border-box;
  padding: 18px 20px;
  text-decoration: none;
  color: inherit;
  border-radius: 12px;
  border: 1px solid var(--border2);
  background: color-mix(in srgb, var(--surface2) 55%, var(--surface));
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
  transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.project-list-row:hover {
  background: color-mix(in srgb, var(--surface2) 92%, var(--accent));
  border-color: color-mix(in srgb, var(--border2) 70%, var(--accent));
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}
.project-list-thumb {
  flex-shrink: 0;
  align-self: flex-start;
  width: 160px;
  height: 100px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border2);
  display: flex;
  align-items: center;
  justify-content: center;
}
.project-list-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.project-list-thumb-placeholder {
  width: 36px;
  height: 36px;
  color: var(--text-dim);
  opacity: 0.45;
}
.project-list-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100px;
}
.project-list-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: auto;
  padding-top: 12px;
}
.project-list-tags .tag {
  font-size: 0.65rem;
  padding: 2px 7px;
  font-weight: 600;
  border-radius: 999px;
}
.project-list-title {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 6px;
}
.project-list-summary {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}
@media (max-width: 560px) {
  .project-list-row { flex-direction: column; align-items: stretch; gap: 14px; }
  .project-list-thumb { width: 100%; height: 140px; align-self: stretch; }
  .project-list-body { min-height: 0; }
}

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--accent);
  color: #fff;
}
.badge-warning { background: var(--warning); }
.badge-success { background: var(--success); }
.badge-danger  { background: var(--danger); }

/* ── Difficulty dots ─────────────────────────────────────── */
.difficulty {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.dots { display: flex; gap: 3px; }
.dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--border2);
}
.dot.filled { background: var(--accent); }
.dot.filled.warn { background: var(--warning); }
.dot.filled.hard { background: var(--danger); }

/* ── Section headers ─────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
}
.section-label {
  font-size: 0.72rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 6px;
}
.section-title { font-size: 1.6rem; }

/* ── Info / callout boxes ────────────────────────────────── */
.callout {
  --callout-accent: var(--accent);
  padding: 14px 18px;
  margin-bottom: 22px;
  border-radius: var(--radius);
  font-size: 0.88rem;
  line-height: 1.6;
  display: flex;
  gap: 12px;
}
.callout-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
  margin-top: 1px;
  color: var(--callout-accent);
}
.callout-icon.material-symbols-outlined { font-size: 20px; }
.callout-content { flex: 1; }
.callout-content strong { display: block; margin-bottom: 3px; color: var(--text); font-size: 0.9rem; }
.callout-info    { --callout-accent: var(--accent);  background: var(--accent-dim);      border: 1px solid rgba(108,114,255,0.2); color: var(--text-muted); }
.callout-warning { --callout-accent: var(--warning); background: rgba(245,158,11,0.07); border: 1px solid rgba(245,158,11,0.2);  color: var(--text-muted); }
.callout-tip     { --callout-accent: var(--success); background: rgba(46,204,113,0.07); border: 1px solid rgba(46,204,113,0.2);  color: var(--text-muted); }
.callout-danger  { --callout-accent: var(--danger);  background: rgba(255,82,82,0.08);  border: 1px solid rgba(255,82,82,0.2);   color: var(--text-muted); }

/* ── Parts list table ────────────────────────────────────── */
.parts-wrapper {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin: 20px 0;
}
.parts-wrapper-header {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.parts-wrapper-header .btn { white-space: nowrap; }
.parts-wrapper-body { padding: 0; }
.parts-wrapper-body table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.parts-wrapper-body thead th {
  text-align: left;
  padding: 10px 16px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.parts-wrapper-body tbody td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
}
.parts-wrapper-body tbody tr:last-child td { border-bottom: none; }
.parts-wrapper-body tbody tr:hover td { background: var(--surface2); }
.parts-wrapper-body tbody td:first-child { color: var(--text); font-weight: 600; }
.parts-wrapper-body tbody td:nth-child(3) { font-family: var(--font-mono); color: var(--accent); font-weight: 700; }

/* Markdown table — all columns same style (no 3rd-column accent) */
.md-table-standard {
  margin: 20px 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.md-table-standard-caption {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.md-table-standard-inner { overflow-x: auto; }
.md-table-standard-inner table {
  width: 100%;
  min-width: min(100%, 520px);
  border-collapse: collapse;
  font-size: 0.88rem;
}
.md-table-standard-inner th,
.md-table-standard-inner td {
  padding: 10px 14px;
  text-align: left;
  vertical-align: top;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-weight: 400;
}

/* Avoid "double borders" against the wrapper + caption */
.md-table-standard-inner tr > *:first-child { border-left: 0; }
.md-table-standard-inner tr > *:last-child { border-right: 0; }
.md-table-standard-inner thead tr:first-child > * { border-top: 0; }
.md-table-standard-inner tbody tr:last-child > * { border-bottom: 0; }
/* Caption already draws the divider line */
.md-table-standard-caption + .md-table-standard-inner thead tr:first-child > * { border-top: 0; }
.md-table-standard-inner thead th {
  background: var(--surface2);
  color: var(--text);
  font-weight: 600;
  font-size: 0.82rem;
}
.md-table-standard--no-header .md-table-standard-inner thead th {
  background: transparent;
  color: var(--text-muted);
  font-weight: 400;
  font-size: 0.88rem;
}
.md-table-standard-inner tbody tr:hover td { background: var(--surface2); }
.md-table-standard-inner td img {
  max-width: 100%;
  width: auto;
  height: auto;
  max-height: min(240px, 28vw);
  object-fit: contain;
  display: block;
  margin: 6px auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.md-table-standard-inner td:has(img) {
  text-align: center;
  vertical-align: middle;
  min-width: 140px;
}

.parts-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.parts-table th {
  text-align: left;
  padding: 10px 16px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.parts-table td {
  padding: 11px 16px;
  border-bottom: 1px solid rgba(42,47,74,0.5);
  color: var(--text-muted);
}
.parts-table tr:last-child td { border-bottom: none; }
.parts-table tr:hover td { background: var(--surface2); }
.parts-table td:first-child { color: var(--text); font-weight: 500; }
.parts-table .qty { font-family: var(--font-mono); color: var(--accent); font-weight: 600; }

/* ── Steps ───────────────────────────────────────────────── */
.step {
  display: flex;
  gap: 20px;
}
.step-num {
  flex-shrink: 0;
  width: 36px; height: 36px;
  background: var(--accent-glow);
  border: 1px solid rgba(108,114,255,0.35);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  margin-top: 2px;
}
.step-body { flex: 1; }
.step-body h4 { margin-bottom: 8px; color: var(--text); }

/* ── Footer ──────────────────────────────────────────────── */
.footer {
  margin-top: 80px;
  padding: 48px 20px 32px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.footer-compact {
  margin-top: 40px;
  padding: 16px 20px 20px;
  border-top: none;
}
.footer-compact .footer-bottom {
  border-top: none;
  padding-top: 10px;
}
.footer-grid {
  max-width: var(--max-w);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 48px;
  margin-bottom: 40px;
}
.footer-brand { max-width: 280px; }
.footer-logo {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 2px;
}
.footer-brand p { font-size: 0.87rem; line-height: 1.65; }
.footer-col h5 {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 14px;
}
.footer-col ul { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.footer-col ul a {
  font-size: 0.875rem;
  color: var(--text-muted);
  transition: color 0.15s;
}
.footer-col ul a:hover { color: var(--text); }
.footer-bottom {
  max-width: var(--max-w);
  margin: 0 auto;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 0.82rem;
  color: var(--text-dim);
}
.social-links { display: flex; gap: 8px; }
.social-link {
  width: 34px; height: 34px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem;
  color: var(--text-muted);
  transition: all 0.15s;
}
.social-link:hover { color: var(--text); border-color: var(--accent); background: var(--accent-dim); }

/* ── Circuit grid background ─────────────────────────────── */
.bg-grid {
  background-image:
    linear-gradient(rgba(108,114,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(108,114,255,0.04) 1px, transparent 1px);
  background-size: 40px 40px;
}

.bg-dots {
  background-image: radial-gradient(circle, rgba(108,114,255,0.12) 1px, transparent 1px);
  background-size: 28px 28px;
}

/* ── Glow effects ────────────────────────────────────────── */
.glow-accent {
  box-shadow: 0 0 0 1px rgba(108,114,255,0.3), 0 0 40px rgba(108,114,255,0.1);
}

/* ── Divider ─────────────────────────────────────────────── */
hr.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 32px 0;
}

/* ── Pagination ──────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 48px;
}
.page-btn {
  min-width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font-sans);
}
.page-btn:hover  { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
.page-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── Toast ───────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--success); color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius); font-weight: 600; font-size: 0.88rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  transform: translateY(80px); opacity: 0;
  transition: all 0.3s; z-index: 1000;
}
.toast.show { transform: translateY(0); opacity: 1; }

/* ── Breadcrumb ──────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-bottom: 24px;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb-sep { color: var(--text-dim); }
.breadcrumb-current { color: var(--text-muted); }

/* ── Page header ─────────────────────────────────────────── */
.page-hero {
  padding: 32px 20px 40px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.page-hero-inner { max-width: var(--max-w); margin: 0 auto; }
.page-hero h1 {
  font-size: 2rem;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.page-hero-icon {
  font-size: 44px;
  color: var(--text-muted);
}
.page-hero p { color: var(--text-muted); }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 960px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 32px; }
}
@media (max-width: 640px) {
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
  .footer-bottom { flex-direction: column; text-align: center; }
  .nav {
    height: var(--nav-h);
    overflow: visible;
  }
  .nav-inner {
    height: 100%;
    flex-wrap: nowrap;
    gap: 10px;
    position: relative;
  }
  .nav-menu-toggle { display: inline-flex; margin-left: auto; }
  .nav-collapse {
    width: auto;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    padding: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    z-index: 120;
  }
  .nav.nav-open .nav-collapse { display: flex; }
  .nav-links {
    display: flex;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }
  .nav-links a {
    display: block;
    width: 100%;
    padding: 9px 12px;
  }
  .nav-actions {
    width: 100%;
    margin-left: 0;
    justify-content: space-between;
    border-top: 1px solid var(--border);
    padding-top: 8px;
    gap: 8px;
  }
  .section-header { flex-direction: column; align-items: flex-start; }
}
