/* ==========================================================================
   HAOS HUB · HOME ASSISTANT & PROXMOX LAB · ARTES DO SUL
   (CYBER-GROWTH & HOMELAB DESIGN SYSTEM)
   ========================================================================== */

:root {
  --bg-primary: #080d1a;
  --bg-surface: #0f172a;
  --bg-surface-elevated: #1e293b;
  --bg-card: rgba(15, 23, 42, 0.78);
  --bg-glass: rgba(11, 19, 36, 0.70);

  --ink-primary: #f8fafc;
  --ink-secondary: #94a3b8;
  --ink-muted: #64748b;
  --line: rgba(255, 255, 255, 0.09);
  --line-focus: rgba(3, 169, 244, 0.45);

  --accent-blue: #03a9f4;   /* Home Assistant Core & Web */
  --accent-blue-soft: rgba(3, 169, 244, 0.15);
  --accent-cyan: #00d9ff;   /* Logic & Zigbee 3.0 */
  --accent-cyan-soft: rgba(0, 217, 255, 0.12);
  --accent-orange: #ff6b35; /* Hardware BOM & Action */
  --accent-orange-soft: rgba(255, 107, 53, 0.15);
  --accent-green: #10b981;  /* Online & Verified */
  --accent-green-soft: rgba(16, 185, 129, 0.15);
  --accent-purple: #8b5cf6; /* Proxmox VE & Hypervisor */
  --accent-purple-soft: rgba(139, 92, 246, 0.15);
  --accent-gold: #f59e0b;   /* Telemetry & Nobreak */

  --font-display: "Bricolage Grotesque", -apple-system, sans-serif;
  --font-body: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", "IBM Plex Mono", Consolas, monospace;

  --glass-blur: blur(14px);
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-pill: 9999px;

  --shadow-card: 0 8px 32px 0 rgba(0, 0, 0, 0.55);
  --shadow-glow-blue: 0 0 25px rgba(3, 169, 244, 0.28);
  --shadow-glow-cyan: 0 0 25px rgba(0, 217, 255, 0.22);
}

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

html {
  scroll-behavior: smooth;
  color-scheme: dark;
}

body {
  background-color: var(--bg-primary);
  color: var(--ink-primary);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* Background Subtle Grid Effect */
body::before {
  content: "";
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image: 
    linear-gradient(to right, rgba(3, 169, 244, 0.03) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(3, 169, 244, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

a {
  color: var(--accent-blue);
  text-decoration: none;
  transition: color 0.2s ease, text-shadow 0.2s ease;
}

a:hover {
  color: #38bdf8;
  text-shadow: 0 0 8px rgba(3, 169, 244, 0.45);
}

code, pre {
  font-family: var(--font-mono);
}

.shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px 80px;
  position: relative;
  z-index: 1;
}

/* ==========================================================================
   TOPBAR & HEADER
   ========================================================================== */

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(8, 13, 26, 0.85);
  backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--line);
  margin: 0 -20px 24px;
  padding: 12px 24px;
  transition: all 0.3s ease;
}

.topbar.scrolled {
  background: rgba(8, 13, 26, 0.96);
  border-bottom-color: rgba(3, 169, 244, 0.3);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.7);
}

.topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--ink-primary);
}

.brand-logo {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--accent-blue), #0284c7);
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.2rem;
  color: #fff;
  box-shadow: var(--shadow-glow-blue);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: #fff;
}

.brand-sub {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent-cyan);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.tracker-mini {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ink-secondary);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background-color: var(--accent-green);
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 10px var(--accent-green);
  animation: pulse-ring 2s infinite ease-in-out;
}

@keyframes pulse-ring {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.6; }
}

.btn-topbar {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  color: var(--ink-primary);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn-topbar:hover {
  background: var(--line);
  border-color: var(--accent-blue);
  color: #fff;
  transform: translateY(-1px);
}

.btn-topbar.btn-accent {
  background: linear-gradient(135deg, rgba(3, 169, 244, 0.2), rgba(0, 217, 255, 0.2));
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

.btn-topbar.btn-accent:hover {
  background: var(--accent-blue);
  color: #050505;
  box-shadow: var(--shadow-glow-blue);
}

.is-hidden {
  display: none !important;
}

/* ==========================================================================
   HERO CINEMATIC SECTION
   ========================================================================== */

.hero-cinematic {
  position: relative;
  min-height: 440px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--line);
  margin-bottom: 32px;
  display: flex;
  align-items: flex-end;
  padding: 40px 32px;
  box-shadow: var(--shadow-card);
}

.hero-bg-wrapper {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 0;
}

.hero-bg-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  filter: brightness(0.65) saturate(1.15);
  transform: scale(1.02);
  transition: transform 10s ease;
}

.hero-cinematic:hover .hero-bg-img {
  transform: scale(1.05);
}

.hero-gradient-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(
    to top,
    rgba(8, 13, 26, 0.96) 0%,
    rgba(8, 13, 26, 0.70) 50%,
    rgba(8, 13, 26, 0.40) 100%
  );
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 900px;
}

.hero-badges {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.badge-glow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: rgba(3, 169, 244, 0.15);
  border: 1px solid rgba(3, 169, 244, 0.4);
  color: var(--accent-blue);
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: 0 0 15px rgba(3, 169, 244, 0.2);
}

.badge-pulse {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: var(--accent-green);
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
}

.hero-content h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.5vw, 3.2rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: #fff;
  margin-bottom: 12px;
}

.hero-content h1 span {
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-lead {
  font-size: 1.05rem;
  color: var(--ink-secondary);
  line-height: 1.6;
  margin-bottom: 24px;
  max-width: 780px;
}

/* Lab Tracker Card */
.lab-tracker-card {
  background: var(--bg-glass);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-top: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.tracker-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.tracker-title {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
}

.tracker-sync-status {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--ink-muted);
}

.tracker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
  align-items: center;
}

.tracker-stat {
  display: flex;
  flex-direction: column;
}

.stat-num {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
  line-height: 1;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--ink-secondary);
  margin-top: 2px;
}

.btn-tracker-filter {
  padding: 8px 16px;
  background: rgba(3, 169, 244, 0.15);
  border: 1px solid rgba(3, 169, 244, 0.4);
  color: var(--accent-blue);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
}

.btn-tracker-filter:hover {
  background: var(--accent-blue);
  color: #050505;
  box-shadow: var(--shadow-glow-blue);
}

/* ==========================================================================
   FILTER DASHBOARD & TOOLBAR
   ========================================================================== */

.filter-dashboard {
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.group-title {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-blue);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.group-hint {
  font-size: 0.72rem;
  color: var(--ink-muted);
}

.chips-track {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  color: var(--ink-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.chip:hover {
  border-color: rgba(3, 169, 244, 0.4);
  color: #fff;
  background: rgba(3, 169, 244, 0.08);
}

.chip[aria-pressed="true"] {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
  color: #050505;
  font-weight: 700;
  box-shadow: 0 0 15px rgba(3, 169, 244, 0.35);
}

.chip small {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  opacity: 0.8;
  background: rgba(0, 0, 0, 0.2);
  padding: 1px 6px;
  border-radius: 9999px;
}

.chip[aria-pressed="true"] small {
  background: rgba(0, 0, 0, 0.25);
  color: #fff;
}

.toolbar-search-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.search-box {
  flex-grow: 1;
  max-width: 600px;
  position: relative;
}

.search-input {
  width: 100%;
  padding: 10px 16px 10px 40px;
  background: var(--bg-primary);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-box::before {
  content: "🔍";
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.9rem;
  pointer-events: none;
  opacity: 0.6;
}

.search-input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(3, 169, 244, 0.2);
}

.results-meta {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ink-secondary);
}

/* ==========================================================================
   PROJECTS / MODULES GRID
   ========================================================================== */

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 24px;
  margin-bottom: 48px;
}

.project-card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  position: relative;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.project-card:hover {
  transform: translateY(-4px);
  border-color: rgba(3, 169, 244, 0.45);
  box-shadow: var(--shadow-card), 0 0 25px rgba(3, 169, 244, 0.18);
}

.project-card.featured {
  border-color: rgba(0, 217, 255, 0.35);
}

.card-top {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.card-category-badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--bg-surface-elevated);
  color: var(--accent-blue);
  border: 1px solid rgba(3, 169, 244, 0.25);
}

.card-hardware-tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-secondary);
}

.card-status-pill {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-weight: 700;
  text-transform: uppercase;
}

.card-status-pill.in_lab {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-green);
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.card-status-pill.expansion {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-gold);
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.card-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.25;
}

.card-summary {
  font-size: 0.88rem;
  color: var(--ink-secondary);
  line-height: 1.5;
}

.card-bom-preview {
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-top: 4px;
}

.bom-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  color: var(--accent-orange);
  margin-bottom: 4px;
  display: block;
}

.bom-list-mini {
  list-style: none;
  font-size: 0.78rem;
  color: var(--ink-primary);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.btn-card-action {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}

.btn-card-action.primary {
  background: var(--accent-blue);
  border: 1px solid var(--accent-blue);
  color: #050505;
}

.btn-card-action.primary:hover {
  background: #38bdf8;
  box-shadow: var(--shadow-glow-blue);
}

.btn-card-action.secondary {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--line);
  color: var(--ink-primary);
}

.btn-card-action.secondary:hover {
  background: var(--line);
  border-color: var(--accent-blue);
  color: #fff;
}

.btn-lab-toggle {
  background: transparent;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: transform 0.2s ease;
}

.btn-lab-toggle:hover {
  transform: scale(1.2);
}

/* ==========================================================================
   ARCHITECTURE & TOPOLOGY SECTION
   ========================================================================== */

.arch-section {
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 32px;
  margin-bottom: 48px;
  box-shadow: var(--shadow-card);
}

.section-head {
  text-align: center;
  max-width: 700px;
  margin: 0 auto 28px;
}

.section-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent-cyan);
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

.section-head h2 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 8px;
}

.section-head p {
  color: var(--ink-secondary);
  font-size: 0.95rem;
}

.arch-tabs {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.tab-btn {
  padding: 8px 18px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  color: var(--ink-secondary);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  border-color: rgba(3, 169, 244, 0.4);
  color: #fff;
}

.tab-btn.active {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
  color: #050505;
  box-weight: 700;
  box-shadow: var(--shadow-glow-blue);
}

.arch-display-board {
  background: var(--bg-primary);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 24px;
}

/* ==========================================================================
   24/7 POWER CALCULATOR & SIZING
   ========================================================================== */

.calc-card {
  background: linear-gradient(135deg, var(--bg-surface), #111d33);
  border: 1px solid rgba(3, 169, 244, 0.3);
  border-radius: var(--radius-md);
  padding: 32px;
  margin-bottom: 48px;
  box-shadow: var(--shadow-card), 0 0 30px rgba(3, 169, 244, 0.1);
}

.calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-top: 24px;
}

.calc-input-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.calc-input-box label {
  font-size: 0.82rem;
  color: var(--ink-secondary);
  display: flex;
  justify-content: space-between;
}

.calc-input-box label b {
  font-family: var(--font-mono);
  color: var(--accent-cyan);
}

.calc-input-box input[type="range"] {
  width: 100%;
  accent-color: var(--accent-blue);
}

.calc-result-box {
  background: var(--bg-surface-elevated);
  border: 1px solid rgba(3, 169, 244, 0.35);
  border-radius: var(--radius-sm);
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.calc-val {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--accent-green);
  line-height: 1.1;
}

.calc-desc {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ink-secondary);
  margin-top: 4px;
}

/* ==========================================================================
   MAKER ECOSYSTEM SECTION
   ========================================================================== */

.ecosystem-section {
  margin-bottom: 48px;
}

.eco-grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.eco-mini-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s ease;
}

.eco-mini-card:hover {
  border-color: rgba(3, 169, 244, 0.4);
  transform: translateY(-3px);
  background: var(--bg-surface-elevated);
}

.eco-mini-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.eco-mini-icon {
  font-size: 1.8rem;
}

.eco-mini-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
}

.eco-mini-desc {
  font-size: 0.82rem;
  color: var(--ink-secondary);
  line-height: 1.4;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */

.footer-branded {
  margin-top: 48px;
  padding: 32px 0 16px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 0.85rem;
  color: var(--ink-muted);
}

.footer-nav {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-nav a {
  color: var(--ink-secondary);
}

.footer-nav a:hover {
  color: var(--accent-blue);
}

/* ==========================================================================
   MODAL / DRAWER
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 8, 16, 0.85);
  backdrop-filter: blur(12px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.modal-window {
  background: #0b1324;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 860px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.9), 0 0 40px rgba(3, 169, 244, 0.2);
  transform: scale(0.95) translateY(10px);
  transition: transform 0.25s ease;
  padding: 32px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.modal-backdrop.open .modal-window {
  transform: scale(1) translateY(0);
}

.btn-close-modal {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--ink-secondary);
  font-size: 1.2rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-close-modal:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  transform: rotate(90deg);
}

.modal-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
}

.modal-section-title {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent-blue);
  letter-spacing: 0.05em;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 4px;
}

.wiring-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  margin-top: 8px;
}

.wiring-table th, .wiring-table td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.wiring-table th {
  background: var(--bg-surface-elevated);
  color: var(--ink-secondary);
  font-family: var(--font-mono);
}

.step-list {
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.step-item {
  color: var(--ink-primary);
  font-size: 0.9rem;
  line-height: 1.5;
}

.code-box {
  background: #040810;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.code-header {
  background: var(--bg-surface-elevated);
  padding: 6px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-muted);
}

.btn-copy-code {
  background: rgba(3, 169, 244, 0.15);
  border: 1px solid rgba(3, 169, 244, 0.35);
  color: var(--accent-blue);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
}

.btn-copy-code:hover {
  background: var(--accent-blue);
  color: #050505;
}

.code-box pre {
  padding: 14px;
  overflow-x: auto;
  font-size: 0.82rem;
  color: #38bdf8;
  line-height: 1.5;
}

/* Floating Go-To-Top Button */
.go-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 42px;
  height: 42px;
  background: var(--bg-surface-elevated);
  border: 1px solid rgba(3, 169, 244, 0.35);
  color: var(--accent-blue);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  cursor: pointer;
  z-index: 99;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s ease;
}

.go-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.go-to-top:hover {
  background: var(--accent-blue);
  color: #050505;
  box-shadow: var(--shadow-glow-blue);
  transform: translateY(-2px);
}

@media (max-width: 768px) {
  .hero-cinematic {
    padding: 24px 16px;
    min-height: 380px;
  }
  .projects-grid {
    grid-template-columns: 1fr;
  }
  .topbar-inner {
    flex-direction: column;
    align-items: flex-start;
  }
}
