/* ========== HERO GENERAL (desktop, tablet, móvil) ========== */
.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: #000;
  width: 100vw;
  height: 100vh;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  touch-action: auto;  /* ✅ PERMITIR SCROLL POR DEFECTO */
}

.hero-canvas-bg {
  display: block;
  position: absolute;
  inset: 0;
  z-index: 0;
  background: #000;
  width: 100%;
  height: 100%;
}

/* Texto hero centrado sobre el canvas */
.hero-text {
  position: relative;
  z-index: 3;
  color: #fff;
  text-align: center;
  max-width: min(90vw, 800px);
  margin: 0 auto;
  padding: 20px;
}

/* === Títulos === */
.hero-title {
  color: #fff;
  font-size: clamp(2.5rem, 5vw, 4rem);
  line-height: 1.2;
  margin: 0 0 20px 0;
  letter-spacing: -0.02em;
}
.hero-subtitle {
  color: #ccc;
  font-size: clamp(1.1rem, 2.5vw, 1.5rem);
  margin: 0 0 15px 0;
}
.hero-tagline {
  color: #aaa;
  font-size: clamp(0.9rem, 2vw, 1.2rem);
  font-style: italic;
}

/* === Degradados arriba y abajo === */
.hero-fade {
  position: absolute;
  left: 0;
  width: 100%;
  height: 150px;
  pointer-events: none;
  z-index: 2;
}
.hero-fade--top {
  top: 0;
  height: 120px;
  background: linear-gradient(to bottom, #ffffff, rgba(255, 255, 255, 0));
}
.hero-fade--bottom {
  bottom: 0;
  height: 120px;
  background: linear-gradient(to top, #000000, rgba(0, 0, 0, 0));
}

/* === Oculta herramientas por defecto === */
.hero-tools {
  display: none;
}

/* ========== TABLET ========== */
@media (max-width: 1024px) and (min-width: 769px) {
  .hero {
    max-width: none;
  }
  .hero-canvas-bg {
    display: block;
  }
  .hero-text {
    z-index: 1;
    max-width: min(90vw, 700px);
  }
  .hero-title { font-size: clamp(2.5rem, 5vw, 3.5rem); }
  .hero-subtitle { color: #ccc; }
  .hero-tagline { color: #aaa; }

  /* Botonera flotante en tablet */
  .hero-tools {
    display: flex;
    flex-wrap: wrap;
    position: absolute;
    z-index: 2;
    right: 30px;
    bottom: 30px;
    gap: 10px;
    padding: 10px;
    border-radius: 999px;
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.2);
    box-shadow: 0 10px 24px rgba(0,0,0,.35);
    backdrop-filter: blur(6px);
  }

  .hero-tools button {
    appearance: none;
    border: 0;
    border-radius: 999px;
    padding: 12px 18px;
    font: inherit;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    color: #111;
    background: #FFD400;
    transition: all 0.2s ease;
  }

  .hero-tools button:hover {
    transform: scale(1.05);
  }

  .hero-tools button[aria-pressed="true"] {
    outline: 2px solid #fff;
    outline-offset: 2px;
    box-shadow: inset 0 0 0 2px rgba(0,0,0,.25);
  }
}

/* ========== MÓVIL: Nueva interfaz minimalista ========== */
@media (max-width: 768px) {
  .hero {
    max-width: none;
  }

  .hero-text {
    z-index: 1;
    max-width: 95vw;
    padding: 15px;
  }

  .hero-title {
    font-size: clamp(1.8rem, 6vw, 2.5rem);
  }
  .hero-subtitle {
    font-size: clamp(1rem, 4vw, 1.3rem);
  }
  .hero-tagline {
    font-size: clamp(0.9rem, 3.5vw, 1.1rem);
  }

  /* === CONTENEDOR PRINCIPAL MINIMALISTA === */
  .hero-tools-wrapper {
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(6px);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: 8px 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 999;
  }
  
  /* Contenedor de controles */
  .paint-controls {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
  }
  
  /* === BOTÓN PRINCIPAL DEL PINCEL - MINIMALISTA === */
  .brush-btn {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    padding: 6px 10px;
    font-weight: 500;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    cursor: pointer;
  }
  
  .brush-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.9);
  }
  
  .brush-status {
    font-size: 0.75rem;
    font-weight: 400;
    opacity: 0.9;
  }
  
  /* === DESPLEGABLE MINIMALISTA === */
  .brush-dropdown {
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(20, 20, 20, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 12px;
    min-width: 240px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    transition: all 0.2s ease;
  }
  
  .brush-dropdown.hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(8px) scale(0.95);
    pointer-events: none;
  }
  
  .brush-dropdown:not(.hidden) {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
  
  /* Grupos de controles */
  .control-group {
    margin-bottom: 12px;
  }
  
  .control-group:last-of-type {
    margin-bottom: 10px;
  }
  
  .control-label {
    display: block;
    font-weight: 500;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
  }
  
  /* === CONTROLES DE GROSOR SUTILES === */
  .thickness-options {
    display: flex;
    gap: 6px;
  }
  
  .thickness-btn {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    padding: 6px 10px;
    font-size: 0.7rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.2s ease;
  }
  
  .thickness-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
  }
  
  .thickness-btn.active {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.2);
  }
  
  /* === GRID DE COLORES MINIMALISTA === */
  .color-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
    justify-items: center;
  }
  
  .color-dot {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid rgba(255, 255, 255, 0.2);
    transition: all 0.2s ease;
    position: relative;
    opacity: 0.8;
  }
  
  .color-dot:hover {
    transform: scale(1.05);
    opacity: 1;
  }
  
  .color-dot.active {
    border-color: rgba(255, 255, 255, 0.6);
    transform: scale(1.1);
    opacity: 1;
  }
  
  /* Colores específicos */
  .color-dot[data-color="#FFD400"] { background: #FFD400; }
  .color-dot[data-color="#00F0F0"] { background: #00F0F0; }
  .color-dot[data-color="#FF4C4C"] { background: #FF4C4C; }
  .color-dot[data-color="#4CAF50"] { background: #4CAF50; }
  .color-dot[data-color="#246BFD"] { background: #246BFD; }
  .color-dot[data-color="#FFFFFF"] { 
    background: #FFFFFF; 
    border: 2px solid rgba(255, 255, 255, 0.4);
  }
  .color-dot[data-color="#FFFFFF"].active {
    border-color: rgba(255, 255, 255, 0.8);
  }
  
  /* === BOTÓN BORRAR DISCRETO === */
  .clear-btn {
    width: 100%;
    background: rgba(200, 60, 60, 0.15);
    color: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(200, 60, 60, 0.2);
    border-radius: 4px;
    padding: 8px;
    font-weight: 400;
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.2s ease;
  }
  
  .clear-btn:hover {
    background: rgba(200, 60, 60, 0.25);
    color: rgba(255, 255, 255, 0.9);
  }
  
  /* === TOGGLE SWITCH MÁS SUTIL === */
  .toggle-switch {
    display: flex;
    align-items: center;
    gap: 6px;
  }
  
  .toggle-checkbox {
    display: none;
  }
  
  .toggle-label {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
  }
  
  .toggle-slider {
    width: 40px;
    height: 20px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    position: relative;
    transition: all 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
  }
  
  .toggle-slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.8);
    top: 1px;
    left: 1px;
    transition: all 0.2s ease;
  }
  
  .toggle-checkbox:checked + .toggle-label .toggle-slider {
    background: rgba(100, 200, 100, 0.3);
    border-color: rgba(100, 200, 100, 0.4);
  }
  
  .toggle-checkbox:checked + .toggle-label .toggle-slider::before {
    transform: translateX(20px);
    background: rgba(255, 255, 255, 0.95);
  }
  
  .toggle-text {
    font-weight: 400;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.6);
    min-width: 20px;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.2px;
  }
  
  /* === OPTIMIZACIONES SAFARI === */
  .brush-btn,
  .thickness-btn,
  .clear-btn,
  .toggle-label,
  .color-dot {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
  }
  
  /* === ANIMACIÓN SUTIL === */
  .brush-dropdown:not(.hidden) {
    animation: subtleSlideIn 0.2s ease forwards;
  }
  
  @keyframes subtleSlideIn {
    0% {
      opacity: 0;
      transform: translateX(-50%) translateY(8px) scale(0.98);
    }
    100% {
      opacity: 1;
      transform: translateX(-50%) translateY(0) scale(1);
    }
  }
}

/* ========== ANIMACIÓN palabra glitch ========== */
.word {
  display: inline-block;
  position: relative;
}
.word--glitch {
  animation: glitch .7s steps(2, end) 1;
  text-shadow: 1px 0 #00ffe5, -1px 0 #ff0077;
}
@keyframes glitch {
  0% { transform: translate(0) }
  20% { transform: translate(-1px,0) }
  40% { transform: translate(1px,-0.5px) }
  60% { transform: translate(-0.5px,0.5px) }
  80% { transform: translate(0.5px,-1px) }
  100%{ transform: translate(0) }
}
@media (prefers-reduced-motion: reduce){
  .word--glitch { animation: fade .5s ease 1; }
  @keyframes fade {
    from{opacity:0}
    to{opacity:1}
  }
}