/* MOTHERBOARD LAYOUT & STYLING */
:root {
  --mb-primary: #06b6d4;
  --mb-orange: #f97316;
  --mb-purple: #8b5cf6;
  --mb-void: #05050a;
}

.motherboard-section {
  padding: 60px 20px;
  background: var(--mb-void);
  position: relative;
  overflow: hidden;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.motherboard-header {
  width: 100%;
  max-width: 100%;
  margin: 0 auto 40px auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 20px;
  padding: 0 40px;
}

.system-status {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-family-mono);
  font-size: 0.75rem;
  color: var(--mb-primary);
  background: rgba(6, 182, 212, 0.1);
  padding: 8px 16px;
  border: 1px solid rgba(6, 182, 212, 0.3);
  border-radius: 4px;
}

.status-indicator {
  width: 8px;
  height: 8px;
  background-color: #22c55e;
  border-radius: 50%;
  box-shadow: 0 0 8px #22c55e;
}

.status-indicator.pulse {
  animation: pulse-green 2s infinite;
}

/* CONTAINER */
.motherboard-container {
  width: 100%;
  max-width: 100% !important;
  margin: 0 auto;
  position: relative;
  background: rgba(10, 10, 15, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 60px;
  box-shadow: inset 0 0 100px rgba(0, 0, 0, 0.8);
  flex-grow: 1;
}

.circuit-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.5;
}

/* GRID SETUP */
.motherboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  grid-auto-rows: 160px; /* Fixed square height */
  gap: 20px;
  list-style: none !important;
  padding: 0 !important;
  margin: 0 !important;
  position: relative;
  z-index: 1;
}

/* MODULE (CARD) STYLES */
.circuit-module {
  position: relative;
  display: flex;
  flex-direction: column;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.circuit-module.is-dimmed {
  opacity: 0.1;
  filter: grayscale(1);
  pointer-events: none;
}

/* Base style for the interactive element inside the list item */
.module-btn {
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  text-decoration: none;
  color: var(--color-text-secondary);
}

/* Hover States */
.module-btn:hover,
.module-btn:focus-visible {
  background: rgba(255, 255, 255, 0.06);
  border-color: #fff;
  transform: translateY(-4px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4);
  outline: none;
}

.module-btn:focus-visible {
  box-shadow:
    0 0 0 2px var(--mb-primary),
    0 10px 20px rgba(0, 0, 0, 0.4);
}

/* LIVE MODULE (The "Hero" Chip) */
.circuit-module.is-live {
  grid-column: span 2;
  grid-row: span 2;
}

.circuit-module.is-live .module-btn {
  background: linear-gradient(
    135deg,
    rgba(6, 182, 212, 0.1),
    rgba(6, 182, 212, 0.02)
  );
  border: 2px solid var(--mb-primary);
  box-shadow:
    0 0 30px rgba(6, 182, 212, 0.15),
    inset 0 0 15px rgba(6, 182, 212, 0.1);
}

.circuit-module.is-live .module-btn::before {
  content: "";
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(
    45deg,
    var(--mb-primary),
    transparent,
    var(--mb-primary)
  );
  z-index: -1;
  border-radius: 8px;
  opacity: 0.3;
}

.circuit-module.is-live .module-btn:hover,
.circuit-module.is-live .module-btn:focus-visible {
  background: rgba(6, 182, 212, 0.15);
  box-shadow:
    0 0 50px rgba(6, 182, 212, 0.4),
    inset 0 0 20px rgba(6, 182, 212, 0.2);
  outline: none;
}

/* LOCKED MODULE */
.circuit-module.is-locked .module-btn {
  opacity: 0.6;
  background-image: radial-gradient(
    circle at 50% 50%,
    rgba(255, 255, 255, 0.03) 1px,
    transparent 1px
  );
  background-size: 10px 10px;
  border-color: rgba(255, 255, 255, 0.05);
  filter: grayscale(0.5);
}

.circuit-module.is-locked .module-btn:hover {
  opacity: 1;
  border-color: var(--mb-orange);
  background-image: radial-gradient(
    circle at 50% 50%,
    rgba(249, 115, 22, 0.1) 1px,
    transparent 1px
  );
}

/* CONTENT TYPOGRAPHY */
.module-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-bottom: 8px;
}

.module-id {
  font-family: var(--font-family-mono);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.3);
}

.circuit-module.is-live .module-id {
  color: var(--mb-primary);
  font-weight: 700;
}

.icon-lock {
  width: 12px;
  height: 12px;
  stroke: rgba(249, 115, 22, 0.4);
}

.module-title {
  font-family: var(--font-family-base);
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.3;
  color: #fff;
  margin: 0;
}

.circuit-module.is-live .module-title {
  font-size: 2rem;
  margin-top: auto;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: -0.02em;
}

.module-meta {
  font-family: var(--font-family-mono);
  font-size: 0.65rem;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: auto;
  transition: opacity 0.3s ease;
}

.circuit-module.is-live .module-meta {
  color: var(--mb-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.circuit-module.is-live.is-focused > .module-btn .module-meta {
  opacity: 0;
}

/* SPOKES POPUP (Focus Mode) */
.spokes-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -1;
  opacity: 0;
  transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
}

.circuit-module.is-focused .spokes-overlay {
  opacity: 1;
  pointer-events: all;
  z-index: 10;
}

.spoke-box {
  position: absolute;
  background: rgba(6, 182, 212, 0.05);
  background-image: radial-gradient(
    circle at 50% 50%,
    rgba(6, 182, 212, 0.1) 1px,
    transparent 1px
  );
  background-size: 10px 10px;
  border: 2px solid var(--mb-primary);
  width: 160px;
  height: 160px;
  border-radius: 6px;
  color: #fff;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: left;
  text-decoration: none;
  transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 0 20px rgba(6, 182, 212, 0.15);
  opacity: 0;
  transform: scale(0);
  backdrop-filter: blur(8px);
  z-index: 5;
}

.spoke-box .module-title {
  font-size: 1rem !important;
  font-weight: 700;
  margin: 0;
  line-height: 1.3;
  text-transform: none;
}

.spoke-box .module-meta {
  color: var(--mb-primary);
  margin-top: auto;
}

.circuit-module.is-focused .spoke-box {
  opacity: 1;
  transform: scale(1);
}

.spoke-box:hover,
.spoke-box:focus-visible {
  background: rgba(6, 182, 212, 0.2);
  border-color: #fff;
  box-shadow: 0 0 40px rgba(6, 182, 212, 0.4);
  z-index: 10;
  outline: none;
}

.spoke-box:focus-visible {
  box-shadow:
    0 0 0 2px #fff,
    0 0 40px rgba(6, 182, 212, 0.4);
}

/* Internal Hub Actions */
.internal-actions {
  position: absolute;
  bottom: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  gap: 10px;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.4s ease;
}

.circuit-module.is-focused .internal-actions {
  opacity: 1;
  transform: translateY(0);
}

.internal-btn {
  flex: 1;
  padding: 8px;
  border-radius: 4px;
  font-family: var(--font-family-mono);
  font-size: 0.65rem;
  font-weight: 700;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.internal-btn.reset-btn-in {
  background: rgba(5, 5, 10, 0.6);
  border-color: var(--mb-purple);
  color: var(--mb-purple);
  backdrop-filter: blur(4px);
}

.internal-btn.reset-btn-in:hover,
.internal-btn.reset-btn-in:focus-visible {
  background: var(--mb-purple);
  color: #fff;
  outline: none;
}

.internal-btn.hub-link-in {
  background: rgba(5, 5, 10, 0.6);
  border-color: #22c55e;
  color: #22c55e;
  backdrop-filter: blur(4px);
}

.internal-btn.hub-link-in:hover,
.internal-btn.hub-link-in:focus-visible {
  background: #22c55e;
  color: #000;
  outline: none;
}

/* ANIMATIONS */
.scan-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    to bottom,
    transparent,
    rgba(6, 182, 212, 0.2),
    transparent
  );
  transform: translateY(-100%);
  animation: scanline-pass 4s ease-in-out infinite;
  pointer-events: none;
}

@keyframes scanline-pass {
  0% {
    transform: translateY(-120%);
  }
  20% {
    transform: translateY(120%);
  }
  100% {
    transform: translateY(120%);
  }
}

@keyframes pulse-green {
  0% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(34, 197, 94, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
  }
}

/* SYSTEM CONSOLE */
.system-console {
  position: fixed;
  bottom: 40px;
  left: 40px;
  width: 320px;
  background: rgba(5, 5, 10, 0.8);
  border: 1px solid rgba(6, 182, 212, 0.2);
  font-family: var(--font-family-mono);
  font-size: 0.7rem;
  color: rgba(6, 182, 212, 0.8);
  padding: 12px;
  border-radius: 4px;
  z-index: 100;
  pointer-events: none;
  backdrop-filter: blur(4px);
  transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

.system-console.is-hidden {
  transform: translateY(150px);
}

.console-body {
  max-height: 4.5rem; /* ~4 lines */
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.console-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 8px;
  padding-bottom: 4px;
  color: var(--mb-primary);
  font-weight: 700;
}

/* RESET BUTTON */
.reset-btn {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%) translateY(150px);
  background: var(--mb-purple);
  color: #fff;
  border: none;
  padding: 12px 24px;
  border-radius: 50px;
  font-family: var(--font-family-mono);
  font-size: 0.8rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: 0 10px 20px rgba(139, 92, 246, 0.3);
  z-index: 1000;
  transition: all 0.4s cubic-bezier(0.18, 0.89, 0.32, 1.28);
  opacity: 0;
}

.reset-btn.active {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* SVG TRACE STYLES */
.circuit-trace {
  fill: none;
  stroke: rgba(6, 182, 212, 0.15);
  stroke-width: 1.5;
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  animation: draw-trace 3s ease-out forwards;
}

@keyframes draw-trace {
  to {
    stroke-dashoffset: 0;
  }
}

.trace-pulse {
  fill: var(--mb-primary);
  filter: url(#glow);
}

/* System Toast - Site Design Match */
.system-toast {
  position: fixed;
  top: 100px;
  right: 40px;
  background: rgba(5, 5, 10, 0.95);
  border-left: 4px solid var(--mb-orange);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--color-text-secondary);
  padding: 20px;
  border-radius: 0 4px 4px 0;
  z-index: 2000;
  transform: translateX(120%);
  transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
  backdrop-filter: blur(12px);
  max-width: 380px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.system-toast.active {
  transform: translateX(0);
}

.system-toast .toast-header {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--mb-orange);
  font-family: var(--font-family-mono);
  font-weight: 700;
  margin-bottom: 8px;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
}

.system-toast .toast-body {
  font-size: 0.85rem;
  line-height: 1.5;
  margin-bottom: 15px;
}

.toast-footer {
  display: flex;
  justify-content: flex-end;
}

.btn-subscribe {
  background: transparent;
  color: var(--mb-orange);
  border: 1px solid var(--mb-orange);
  padding: 8px 16px;
  border-radius: 4px;
  font-family: var(--font-family-mono);
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
}

.btn-subscribe:hover {
  background: var(--mb-orange);
  color: #000;
  transform: translateY(-2px);
}

/* MOBILE RESPONSIVENESS */
@media (max-width: 768px) {
  .motherboard-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: 140px;
  }
  .circuit-module.is-live .module-title {
    font-size: 1.2rem;
  }
}
