/* === Logo Theme Switching === */
.mxd-logo__image {
  width: 56px;
  height: auto;
  display: none;
  transition: opacity 0.3s ease;
}

/* Light mode (system or manual) */
@media (prefers-color-scheme: light) {
  .light-logo {
    display: inline-block;
  }
}

/* Dark mode (system or manual) */
@media (prefers-color-scheme: dark) {
  .dark-logo {
    display: inline-block;
  }
}

/* If theme uses data-color-scheme or class toggling */
[color-scheme="light"] .light-logo {
  display: inline-block;
}
[color-scheme="light"] .dark-logo {
  display: none;
}

[color-scheme="dark"] .light-logo {
  display: none;
}
[color-scheme="dark"] .dark-logo {
  display: inline-block;
}

/* === Footer: Midnight Circuit Glitch (B&W Version) === */
.footer-brand-text {
  font-family: var(--_font-accent, "Funnel Display"), sans-serif;
  font-size: clamp(4rem, 18vw, 16rem);
  font-weight: 900;
  text-transform: uppercase;
  text-align: center;
  line-height: 1;
  margin: 0;
  padding-bottom: 1%;
  color: #fff;
  position: relative;
  letter-spacing: -2px;
  text-shadow: 0 0 6px rgba(255, 255, 255, 0.3),
               0 0 12px rgba(255, 255, 255, 0.2);
  animation: flicker-bw 3s infinite, grainShift 5s infinite alternate ease-in-out;
  filter: contrast(120%) brightness(110%);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}


/* --- Glitch layers --- */
.footer-brand-text::before,
.footer-brand-text::after {
  content: "Midnight Circuit";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  overflow: hidden;
  opacity: 0.6;
  color: #fff;
  mix-blend-mode: difference; /* makes white flicker turn black in light mode */
}

.footer-brand-text::before {
  clip-path: inset(0 0 50% 0);
  animation: glitch-bw-1 2.5s infinite;
}

.footer-brand-text::after {
  clip-path: inset(50% 0 0 0);
  animation: glitch-bw-2 3s infinite;
}

/* --- Animations --- */
@keyframes flicker-bw {
  0%,
  19%,
  21%,
  23%,
  90%,
  91%,
  93%,
  100% {
    opacity: 1;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.25),
      0 0 18px rgba(255, 255, 255, 0.15);
  }
  20%,
  22%,
  92% {
    opacity: 0.5;
    text-shadow: none;
  }
}

@keyframes grainShift {
  0% { filter: contrast(120%) brightness(110%) blur(0px); }
  50% { filter: contrast(125%) brightness(120%) blur(0.5px); }
  100% { filter: contrast(120%) brightness(110%) blur(0px); }
}

@keyframes glitch-bw-1 {
  0% {
    transform: translate(0);
    opacity: 0.7;
  }
  15% {
    transform: translate(-2px, 1px);
    opacity: 0.3;
  }
  35% {
    transform: translate(3px, -2px);
    opacity: 0.6;
  }
  55% {
    transform: translate(-1px, 2px);
    opacity: 0.4;
  }
  75% {
    transform: translate(1px, -1px);
    opacity: 0.8;
  }
  100% {
    transform: translate(0);
    opacity: 0.7;
  }
}

@keyframes glitch-bw-2 {
  0% {
    transform: translate(0);
    opacity: 0.6;
  }
  25% {
    transform: translate(2px, -2px);
    opacity: 0.4;
  }
  45% {
    transform: translate(-3px, 3px);
    opacity: 0.6;
  }
  65% {
    transform: translate(1px, -1px);
    opacity: 0.8;
  }
  85% {
    transform: translate(-1px, 1px);
    opacity: 0.5;
  }
  100% {
    transform: translate(0);
    opacity: 0.6;
  }
}

/* --- Theme contrast --- */
[color-scheme="light"] .footer-brand-text {
  color: #000;
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.3), 0 0 12px rgba(0, 0, 0, 0.15);
}
[color-scheme="dark"] .footer-brand-text {
  color: #fff;
}

/* === Logo Theme Switching === */
.mxd-logo__image {
  width: 56px;
  height: auto;
  display: none;
  transition: opacity 0.3s ease;
}

/* Light mode (system or manual) */
@media (prefers-color-scheme: light) {
  .light-logo {
    display: inline-block;
  }
}

/* Dark mode (system or manual) */
@media (prefers-color-scheme: dark) {
  .dark-logo {
    display: inline-block;
  }
}

/* If theme uses data-color-scheme or class toggling */
[color-scheme="light"] .light-logo {
  display: inline-block;
}
[color-scheme="light"] .dark-logo {
  display: none;
}

[color-scheme="dark"] .light-logo {
  display: none;
}
[color-scheme="dark"] .dark-logo {
  display: inline-block;
}

.footer-brand-text::after {
  background-image: repeating-linear-gradient(
    rgba(255,255,255,0.02) 0px,
    rgba(255,255,255,0.02) 1px,
    transparent 2px,
    transparent 3px
  );
}

/* === Modal Styles === */
.mxd-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  overflow-y: auto;
}

.mxd-modal.is-open {
  display: block;
}

.mxd-modal__overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2rem;
  animation: modalFadeIn 0.3s ease-out;
}

.mxd-modal__container {
  background: var(--base);
  border-radius: 12px;
  max-width: 800px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: modalSlideIn 0.3s ease-out;
  border: 1px solid var(--border);
}

.mxd-modal__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2rem 2rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--base);
  position: sticky;
  top: 0;
  z-index: 10;
}

.mxd-modal__title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.mxd-modal__close {
  background: none;
  border: none;
  padding: 0.5rem;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.3s ease;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mxd-modal__close:hover {
  color: var(--text);
  background: var(--border);
  transform: rotate(90deg);
}

.mxd-modal__content {
  padding: 2rem;
  overflow-y: auto;
  max-height: calc(90vh - 120px);
}

.modal-content h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin: 1.5rem 0 0.5rem;
}

.modal-content h3:first-child {
  margin-top: 0;
}

.modal-content p {
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 1rem;
}

.modal-update {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* Modal Animations */
@keyframes modalFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .mxd-modal__overlay {
    padding: 1rem;
  }
  
  .mxd-modal__container {
    max-height: 95vh;
  }
  
  .mxd-modal__header {
    padding: 1.5rem 1.5rem 1rem;
  }
  
  .mxd-modal__content {
    padding: 1.5rem;
  }
  
  .mxd-modal__title {
    font-size: 1.25rem;
  }
}

/* Theme Compatibility */
[color-scheme="light"] .mxd-modal__container {
  --base: #FAF7F6;
  --border: rgba(0, 0, 0, 0.1);
  --text: #161616;
  --text-muted: rgba(22, 22, 22, 0.7);
}

[color-scheme="dark"] .mxd-modal__container {
  --base: #161616;
  --border: rgba(255, 255, 255, 0.1);
  --text: #FAF7F6;
  --text-muted: rgba(250, 247, 246, 0.7);
}



/* === Force Active Style for Main Menu === */
.main-menu__item.active > .main-menu__link .btn-caption {
  color: color-mix(in srgb, var(--additional), var(--nl-black) 15%);
  font-weight: 600;
}

/* === Circuit Background Canvas === */
#bg-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0; /* Behind content but accessible */
  pointer-events: none; /* Let clicks pass through, but we track mouse via window event */
}

/* Ensure hero content sits above canvas */
.mxd-hero-section {
  position: relative;
  background: transparent !important;
  z-index: 1;
}

.mxd-hero-05 {
  position: relative;
  z-index: 2;
}

/* Hide the old video if we are replacing it, or just keep it as fallback? 
   We will comment out the video in HTML, so no CSS needed to hide it. 
*/

/* === Small Text for Long Emails === */
.btn-caption-small {
  font-size: 3.5rem !important; /* Larger than before but small enough to fit */
  text-transform: none !important;
  letter-spacing: -1px !important;
}

@media (max-width: 768px) {
  .btn-caption-small {
    font-size: 1.3rem !important;
    word-break: break-all;
  }
}

/* === Hero Text Animation === */
.text-pulse-fade {
  animation: pulseFade 4s ease-in-out infinite;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
}

/* === Hero Text Animation === */
.text-pulse-fade {
  animation: pulseFade 4s ease-in-out infinite;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
}

.text-neon-flicker {
  background: linear-gradient(
    to right,
    #fff 20%,
    #00ffaa 40%,
    #00aaff 60%,
    #fff 80%
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  background-size: 200% auto;
  animation: shineFlow 5s linear infinite;
  font-weight: 700;
  letter-spacing: -1px;
}

@keyframes shineFlow {
  to {
    background-position: 200% center;
  }
}

/* === Custom Cursor === */
.cursor-dot,
.cursor-outline {
  position: fixed;
  top: 0;
  left: 0;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  z-index: 9999;
  pointer-events: none;
}

.cursor-dot {
  width: 5px;
  height: 5px;
  background-color: #fff;
}

.cursor-outline {
  width: 30px;
  height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  transition: width 0.2s, height 0.2s, background-color 0.2s;
}

/* Hide default cursor on desktop */
@media (min-width: 1025px) {
  body {
    cursor: none;
  }
}

/* Hide custom cursor on mobile */
@media (max-width: 1024px) {
  .cursor-dot,
  .cursor-outline {
    display: none;
  }
}

/* Hover effect */
body:has(a:hover, button:hover, .cursor-hover:hover) .cursor-outline {
  width: 50px;
  height: 50px;
  background-color: rgba(0, 255, 170, 0.1);
  border-color: #00ffaa;
}

@keyframes pulseFade {
  0%, 100% {
    opacity: 0.8;
    transform: scale(1);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
  }
  50% {
    opacity: 1;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.4), 0 0 10px rgba(255, 255, 255, 0.2);
  }
}

/* === Responsive Hero Text === */
#hero-typewriter {
  font-size: 2rem; /* Mobile default */
  line-height: 1.3;
}

@media (min-width: 768px) {
  #hero-typewriter {
    font-size: 3.5rem;
  }
}

@media (min-width: 1200px) {
  #hero-typewriter {
    font-size: 5.5rem; /* Original desktop size */
  }
}

/* === Email Handlers === */
.email-break-mobile {
  word-break: break-all;
}

@media (min-width: 576px) {
  .email-break-mobile {
    word-break: normal;
  }
}

/* === Hero Background Video === */
.video-background-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  overflow: hidden;
}

.bg-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
}

.video-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.2); /* Reduced opacity from 0.4 to 0.2 */
  z-index: 1;
}

/* Ensure text is above the video */
/* Ensure text is above the video */
.mxd-hero-05-videoblock__descr {
  position: relative;
  z-index: 2;
  /* High Visibility Glass */
  background: rgba(255, 255, 255, 0.02); /* Almost transparent backdrop */
  padding: 3rem;
  border-radius: 24px;
  backdrop-filter: blur(16px); /* Strong blur to flatten video details for text */
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.15); /* Distinct border */
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2); /* Deep shadow */
  transition: all 0.3s ease;
}

.mxd-hero-05-videoblock__descr:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(20px); /* Even clearer text on hover */
}

/* Mobile Responsiveness for Video Section */
@media (max-width: 768px) {
  .mxd-hero-05__videoblock {
    min-height: 500px !important; /* Adjust height for mobile */
  }
  
  #hero-typewriter {
    min-height: auto !important; /* Allow efficient height on mobile */
  }
}
