/* ============================================
   Nodess.cl - Custom Styles (Dark Tech Premium)
   ============================================ */

/* ---------- CSS Variables (Dark by default) ---------- */
:root {
  --bg-primary: #0a0a0f;
  --bg-card: rgba(255, 255, 255, 0.02);
  --bg-card-hover: rgba(255, 255, 255, 0.04);
  --border-subtle: rgba(255, 255, 255, 0.05);
  --border-card: rgba(255, 255, 255, 0.05);
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --input-bg: rgba(255, 255, 255, 0.03);
  --input-border: rgba(255, 255, 255, 0.1);
  --navbar-bg: rgba(10, 10, 15, 0.9);
  --footer-border: rgba(255, 255, 255, 0.05);
}

/* ---------- Light Mode ---------- */
body.light-mode {
  --bg-primary: #f8fafc;
  --bg-card: rgba(255, 255, 255, 0.8);
  --bg-card-hover: rgba(255, 255, 255, 0.95);
  --border-subtle: rgba(0, 0, 0, 0.06);
  --border-card: rgba(0, 0, 0, 0.08);
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-muted: #6b7280;
  --input-bg: #ffffff;
  --input-border: rgba(0, 0, 0, 0.12);
  --navbar-bg: rgba(248, 250, 252, 0.9);
  --footer-border: rgba(0, 0, 0, 0.08);
}

/* ---------- Base ---------- */
html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
  overflow-x: hidden !important;
}

body {
  overflow-x: hidden !important;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  max-width: 100vw;
  position: relative;
}

/* Prevent any child from causing horizontal overflow */
#navbar, section, footer {
  max-width: 100vw;
  overflow-x: hidden;
}

img, svg, video, canvas, iframe {
  max-width: 100%;
  height: auto;
}

::selection {
  background: rgba(6, 182, 212, 0.3);
  color: #fff;
}

/* ---------- Light mode overrides ---------- */
body.light-mode,
body.light-mode .bg-\[\#0a0a0f\] {
  background-color: #f8fafc !important;
}

body.light-mode .glass-card {
  background: rgba(255, 255, 255, 0.85) !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

body.light-mode .glass-card:hover {
  background: rgba(255, 255, 255, 0.95) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* Text overrides */
body.light-mode h1,
body.light-mode h2,
body.light-mode h3,
body.light-mode h4,
body.light-mode p {
  color: #111827 !important;
}
body.light-mode .text-gray-100,
body.light-mode .text-white {
  color: #111827 !important;
}
body.light-mode .text-gray-300 {
  color: #1f2937 !important;
}
body.light-mode .text-gray-400 {
  color: #374151 !important;
}
body.light-mode .text-gray-500 {
  color: #4b5563 !important;
}
body.light-mode .text-gray-600 {
  color: #6b7280 !important;
}
body.light-mode .text-gray-700 {
  color: #9ca3af !important;
}

body.light-mode .text-cyan-400 {
  color: #0891b2 !important;
}
body.light-mode .text-cyan-300 {
  color: #06b6d4 !important;
}

/* Navbar */
body.light-mode #navbar[style] {
  background-color: rgba(248, 250, 252, 0.92) !important;
}
body.light-mode #navbar {
  background-color: transparent;
}
body.light-mode #mobile-menu {
  background-color: rgba(248, 250, 252, 0.98) !important;
}

/* Borders */
body.light-mode .border-white\/5,
body.light-mode [class*="border-white/5"] {
  border-color: rgba(0, 0, 0, 0.06) !important;
}
body.light-mode .border-white\/10,
body.light-mode [class*="border-white/10"] {
  border-color: rgba(0, 0, 0, 0.1) !important;
}
body.light-mode .border-white\/\[0\.03\] {
  border-color: rgba(0, 0, 0, 0.04) !important;
}

/* Backgrounds */
body.light-mode .bg-white\/\[0\.03\] {
  background-color: rgba(0, 0, 0, 0.02) !important;
}
body.light-mode .bg-cyan-500\/10 {
  background-color: rgba(6, 182, 212, 0.08) !important;
}
body.light-mode .bg-cyan-500\/\[0\.02\] {
  background-color: rgba(6, 182, 212, 0.03) !important;
}
body.light-mode .bg-cyan-500\/\[0\.03\] {
  background-color: rgba(6, 182, 212, 0.05) !important;
}
body.light-mode .bg-cyan-500\/\[0\.08\] {
  background-color: rgba(6, 182, 212, 0.1) !important;
}

/* Inputs and form */
body.light-mode input,
body.light-mode textarea {
  background-color: #ffffff !important;
  border-color: rgba(0, 0, 0, 0.12) !important;
  color: #111827 !important;
}
body.light-mode input::placeholder,
body.light-mode textarea::placeholder {
  color: #9ca3af !important;
}
body.light-mode input:-webkit-autofill,
body.light-mode textarea:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 50px #ffffff inset !important;
  -webkit-text-fill-color: #111827 !important;
}

/* Footer */
body.light-mode footer {
  border-color: rgba(0, 0, 0, 0.08) !important;
  background-color: #f8fafc !important;
}
body.light-mode footer .text-gray-600 {
  color: #4b5563 !important;
}

/* Gradient backgrounds - reduce intensity */
body.light-mode .bg-gradient-to-b,
body.light-mode [class*="bg-gradient"] {
  opacity: 0.4;
}

/* Hero glow orbs */
body.light-mode .bg-cyan-500\/10 {
  background-color: rgba(6, 182, 212, 0.05) !important;
}
body.light-mode .bg-cyan-400\/10 {
  background-color: rgba(34, 211, 238, 0.05) !important;
}

/* Grid background in hero */
body.light-mode [style*="linear-gradient"] {
  opacity: 0.3;
}

/* Details/summary open state border */
body.light-mode details[open] {
  border-color: rgba(6, 182, 212, 0.25) !important;
}

/* Gradient text keep legible */
body.light-mode .bg-clip-text {
  filter: brightness(0.6);
  -webkit-text-fill-color: #0891b2 !important;
}

/* Force gradient spans to be visible */
body.light-mode span.bg-clip-text {
  color: #0891b2 !important;
  -webkit-text-fill-color: #0891b2 !important;
  background-image: none !important;
}

/* Badge pills */
body.light-mode .bg-white\/\[0\.03\].rounded-full {
  background-color: rgba(0, 0, 0, 0.04) !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: rgba(6, 182, 212, 0.3);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(6, 182, 212, 0.5);
}

/* ---------- Glass Card ---------- */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-color: var(--border-card);
}

.glass-card:hover {
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

/* ---------- Theme Toggle Button ---------- */
#theme-toggle i {
  transition: color 0.2s ease;
}
#theme-toggle:hover i {
  color: #22d3ee;
}
#theme-toggle .fa-sun { display: none; color: #fbbf24; }
#theme-toggle .fa-moon { display: inline-block; color: #9ca3af; }
body.light-mode #theme-toggle .fa-sun { display: inline-block; color: #f59e0b; }
body.light-mode #theme-toggle .fa-moon { display: none; }

/* Mobile menu button */
#mobile-menu-btn i {
  color: #9ca3af;
}
#mobile-menu-btn:hover i {
  color: #22d3ee;
}
body.light-mode #mobile-menu-btn i {
  color: #374151;
}

/* ---------- Social Buttons ---------- */
.social-btn:hover {
  transform: translateY(-4px);
  transition: transform 0.3s ease;
}

.social-btn .fab {
  filter: drop-shadow(0 0 0 transparent);
  transition: filter 0.5s ease;
}

.social-btn:hover .fab {
  filter: drop-shadow(0 0 12px currentColor);
}

/* ---------- Input Autofill ---------- */
input:-webkit-autofill,
textarea:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 50px var(--bg-primary) inset;
  -webkit-text-fill-color: var(--text-primary);
  caret-color: var(--text-primary);
}

/* ---------- Navbar transitions ---------- */
#navbar {
  transition: background-color 0.3s ease, backdrop-filter 0.3s ease, border-color 0.3s ease;
}

/* ---------- AOS overrides ---------- */
[data-aos] {
  pointer-events: none;
}

[data-aos].aos-animate {
  pointer-events: auto;
}

/* ---------- Responsive tweaks ---------- */
@media (max-width: 640px) {
  html {
    scroll-padding-top: 60px;
  }
}

/* ---------- Focus visible ---------- */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid rgba(6, 182, 212, 0.5);
  outline-offset: 2px;
  border-radius: 8px;
}

/* ---------- Glow pulse for CTA buttons ---------- */
@keyframes glowPulse {
  0%, 100% {
    box-shadow: 0 0 20px rgba(6, 182, 212, 0.15);
  }
  50% {
    box-shadow: 0 0 40px rgba(6, 182, 212, 0.3);
  }
}

a[href="#piramide"] {
  animation: glowPulse 3s ease-in-out infinite;
}

/* ---------- Copy Link Button ---------- */
.copy-link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin-left: 6px;
  border-radius: 6px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: #6b7280;
  font-size: 13px;
  transition: all 0.2s ease;
  vertical-align: middle;
  opacity: 0;
}

.copy-link-btn:hover {
  background: rgba(6, 182, 212, 0.15);
  color: #22d3ee;
}

h2:hover .copy-link-btn,
h3:hover .copy-link-btn,
h4:hover .copy-link-btn,
.glass-card:hover .copy-link-btn,
.group:hover .copy-link-btn,
[data-copy-url]:hover .copy-link-btn {
  opacity: 1;
}

.copy-link-btn.copied {
  color: #22d3ee;
  background: rgba(6, 182, 212, 0.2);
}
