/* 
  3FACTOR DESIGN - Estilos Globales & Personalizados
  Paleta: Tonos tierra cálidos, arena, terracota y resplandor ámbar
*/

:root {
  --color-primary: #5C3D21;
  --color-primary-dark: #3E2714;
  --color-primary-light: #7A4E2B;
  --color-primary-surface: #F5EEE6;
  
  --color-bg: #FAF6F0;
  --color-surface: #FFFFFF;
  --color-surface-warm: #F4ECE1;
  --color-card-border: #E8DCCB;
  
  --color-glow-amber: #E68228;
  --color-glow-light: rgba(230, 130, 40, 0.2);
  
  --color-text-main: #241A14;
  --color-text-muted: #6E5F55;
  --color-text-subtle: #98887D;
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-full: 9999px;
  
  --shadow-warm-sm: 0 2px 8px rgba(92, 61, 33, 0.06);
  --shadow-warm-md: 0 8px 24px rgba(92, 61, 33, 0.09);
  --shadow-warm-lg: 0 16px 40px rgba(92, 61, 33, 0.13);
  --shadow-lamp-glow: 0 0 35px rgba(230, 130, 40, 0.28);
}

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

html {
  scroll-behavior: smooth;
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--color-text-main);
  background-color: var(--color-bg);
}

body {
  overflow-x: hidden;
  background-color: var(--color-bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 9px;
}
::-webkit-scrollbar-track {
  background: var(--color-surface-warm);
}
::-webkit-scrollbar-thumb {
  background: #C4B29E;
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--color-primary-light);
}

/* Lamp Ambient Glow Animations */
@keyframes ambientGlow {
  0%, 100% {
    box-shadow: 0 0 25px rgba(230, 130, 40, 0.22), 0 8px 30px rgba(92, 61, 33, 0.08);
  }
  50% {
    box-shadow: 0 0 45px rgba(230, 130, 40, 0.38), 0 12px 36px rgba(92, 61, 33, 0.12);
  }
}

.lamp-glow-effect {
  animation: ambientGlow 4s ease-in-out infinite;
}

/* Efecto de iluminacion nocturna cuando se prende la lampara en el Hero 3D */
#hero-card-container {
  transition: background 0.7s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.7s ease, box-shadow 0.7s ease;
}
/* Fondo nocturno calido: capa aparte para que la transicion sea suave */
#hero-card-container::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.9s ease;
  background:
    radial-gradient(ellipse 34% 42% at 50% 54%, rgba(255, 176, 92, 0.55) 0%, rgba(232, 128, 48, 0.22) 45%, rgba(232, 128, 48, 0) 100%),
    radial-gradient(ellipse 80% 75% at 50% 55%, #5A3A20 0%, #3A2414 55%, #24160C 100%);
}
#hero-card-container.lamp-on-dark-mode::before { opacity: 1; }
#hero-card-container.lamp-on-dark-mode {
  border-color: #6B4423;
  box-shadow: 0 0 90px rgba(255, 150, 60, 0.28), 0 25px 60px -10px rgba(0, 0, 0, 0.45);
}
#hero-card-container h1,
#hero-card-container p,
#hero-card-container .hero-cad-label {
  transition: color 0.8s ease, text-shadow 0.8s ease;
}
#hero-card-container.lamp-on-dark-mode h1 {
  color: #FFF4E2 !important;
  text-shadow: 0 2px 24px rgba(60, 30, 10, 0.75);
}
#hero-card-container.lamp-on-dark-mode p {
  color: #F1DFC6 !important;
}
#hero-card-container.lamp-on-dark-mode .hero-cad-label {
  color: #C9A57F !important;
}
#hero-card-container.lamp-on-dark-mode #hero-wireframe-toggle,
#hero-card-container.lamp-on-dark-mode label {
  background-color: rgba(36, 24, 14, 0.75) !important;
  color: #F5E6D0 !important;
  border-color: #6B4423 !important;
}

/* Boton prender / apagar de la portada */
.hero-light-btn {
  background: rgba(255, 255, 255, 0.9);
  color: #5C3D21;
  border-color: #E8DFC8;
}
.hero-light-btn .hero-light-icon { color: #A8A29E; transition: color 0.4s ease, filter 0.4s ease; }
.hero-light-btn:hover { background: #FFFBEB; }
.hero-light-btn.is-on {
  background: rgba(36, 22, 12, 0.88);
  color: #FCD34D;
  border-color: rgba(245, 158, 11, 0.7);
  box-shadow: 0 0 18px rgba(245, 158, 11, 0.35);
}
.hero-light-btn.is-on .hero-light-icon {
  color: #FBBF24;
  fill: #FBBF24;
  filter: drop-shadow(0 0 4px rgba(251, 191, 36, 0.9));
}

/* Atenuar el resto de la pagina mientras la lampara esta prendida */
#page-dimmer {
  position: fixed;
  inset: 0;
  z-index: 45;
  pointer-events: none;
  background: rgba(30, 18, 8, 0.5);
  opacity: 0;
  transition: opacity 0.9s ease;
}
body.lamp-mode #page-dimmer { opacity: 1; }
body.lamp-mode #hero-card-container { z-index: 46; }

.lamp-card-hover {
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.lamp-card-hover:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 40px rgba(92, 61, 33, 0.14), 0 0 30px rgba(230, 130, 40, 0.18);
  border-color: #D5BCA2;
}

/* Texture overlay for subtle 3D print layer line feel */
.bg-layer-pattern {
  background-image: radial-gradient(rgba(92, 61, 33, 0.04) 1px, transparent 1px);
  background-size: 20px 20px;
}

/* Navigation Blur */
.nav-glass {
  background: rgba(250, 246, 240, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

/* Category Filter Active Pill */
.filter-btn {
  transition: all 0.2s ease;
}

.filter-btn.active {
  background-color: var(--color-primary);
  color: #FFF8F0;
  border-color: var(--color-primary);
  box-shadow: 0 4px 14px rgba(92, 61, 33, 0.25);
}

/* Cart Drawer */
#cart-drawer {
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

#cart-drawer.open {
  transform: translateX(0);
}

#cart-backdrop {
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

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

/* Modal Transitions */
#product-modal-backdrop {
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

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

#product-modal-content {
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}

#product-modal-backdrop.open #product-modal-content {
  transform: translateY(0) scale(1);
  opacity: 1;
}

/* Toast Notification */
.toast-notice {
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  transform: translateY(100px);
  opacity: 0;
}

.toast-notice.show {
  transform: translateY(0);
  opacity: 1;
}

/* Color swatch preview */
.color-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid rgba(0,0,0,0.12);
  display: inline-block;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.color-dot:hover {
  transform: scale(1.2);
}

.color-dot.selected {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Floating WhatsApp Button Pulse */
@keyframes floatPulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 8px 25px rgba(37, 211, 102, 0.35);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 12px 32px rgba(37, 211, 102, 0.55);
  }
}

.whatsapp-float-btn {
  animation: floatPulse 3.5s infinite ease-in-out;
  bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
  right: calc(1.5rem + env(safe-area-inset-right, 0px));
}

/* Optimización táctil y visual para iOS (Safari) y Android */
html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

/* Responsive tweaks */
@media (max-width: 640px) {
  .hero-heading {
    font-size: 2.2rem;
    line-height: 1.15;
  }
}

/* =========================================================
   ANIMACIONES SUAVES AL HACER SCROLL (MODERN SCROLL REVEAL)
   ========================================================= */
.reveal-on-scroll {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity 0.85s cubic-bezier(0.16, 1, 0.3, 1), transform 0.85s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}

.reveal-on-scroll.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Delays escalonados para que los elementos aparezcan en secuencia */
.delay-100 { transition-delay: 100ms; }
.delay-200 { transition-delay: 200ms; }
.delay-300 { transition-delay: 300ms; }
.delay-400 { transition-delay: 400ms; }

/* Efecto sutil de zoom en imágenes al hover */
.img-zoom-container {
  overflow: hidden;
}
.img-zoom-container img {
  transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}
.img-zoom-container:hover img {
  transform: scale(1.06);
}

/* Tipografía editorial estilizada */
.tracking-editorial {
  letter-spacing: -0.03em;
}

/* ===== Botón prender/apagar en las tarjetas de lámparas ===== */
.lamp-photo-stack {
  position: relative;
  width: 100%;
  height: 100%;
}
.lamp-photo {
  transition: opacity 0.6s ease, transform 0.5s ease;
}
.lamp-photo-off {
  position: absolute;
  inset: 0;
}
.lamp-photo.is-hidden {
  opacity: 0;
}
.lamp-power-btn {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.8rem 0.35rem 0.6rem;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.01em;
  background: rgba(255, 255, 255, 0.9);
  color: #5C3D21;
  border: 1px solid #E8DFC8;
  backdrop-filter: blur(6px);
  box-shadow: 0 2px 8px rgba(43, 30, 23, 0.12);
  cursor: pointer;
  transition: background 0.35s ease, color 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease, transform 0.2s ease;
}
.lamp-power-btn:hover { transform: scale(1.05); }
.lamp-power-btn:active { transform: scale(0.96); }
.lamp-power-btn.is-on {
  background: rgba(36, 22, 12, 0.82);
  color: #FCD34D;
  border-color: rgba(245, 158, 11, 0.45);
  box-shadow: 0 2px 14px rgba(245, 158, 11, 0.28);
}
.lamp-power-dot {
  width: 8px;
  height: 8px;
  border-radius: 9999px;
  background: #A8A29E;
  transition: background 0.35s ease, box-shadow 0.35s ease;
}
.lamp-power-btn.is-on .lamp-power-dot {
  background: #F59E0B;
  box-shadow: 0 0 8px 2px rgba(245, 158, 11, 0.8);
}

/* ===== Diseñá tu lámpara ===== */
.ld-viewer {
  aspect-ratio: 4 / 5;
  max-height: 78vh;
  width: 100%;
  background: radial-gradient(ellipse 70% 60% at 50% 45%, #FFFFFF 0%, #F7F1E8 55%, #EFE5D6 100%);
  touch-action: pan-y;
  cursor: grab;
}
@media (min-width: 1024px) {
  .ld-viewer { aspect-ratio: auto; height: 640px; max-height: none; }
}
.ld-viewer:active { cursor: grabbing; }
.ld-viewer::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.9s ease;
  background:
    radial-gradient(ellipse 36% 40% at 50% 46%, rgba(255, 176, 92, 0.5) 0%, rgba(232, 128, 48, 0.18) 50%, rgba(232, 128, 48, 0) 100%),
    radial-gradient(ellipse 85% 75% at 50% 50%, #5A3A20 0%, #3A2414 55%, #24160C 100%);
}
.ld-viewer.is-lit::before { opacity: 1; }
.ld-viewer canvas { z-index: 1; }
.ld-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid #E8DFC8;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #5C3D21;
  font-variant-numeric: tabular-nums;
  backdrop-filter: blur(6px);
  transition: background 0.6s ease, color 0.6s ease, border-color 0.6s ease;
}
.ld-viewer.is-lit .ld-chip { background: rgba(36, 22, 12, 0.8); color: #F5E6D0; border-color: #6B4423; }
.ld-hint {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.7rem;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 700;
  color: #8B7B6E;
  background: rgba(255, 255, 255, 0.7);
  transition: opacity 0.6s ease, color 0.6s ease, background 0.6s ease;
}
.ld-viewer.is-lit .ld-hint { color: #C9A57F; background: rgba(36, 22, 12, 0.55); }
.ld-viewer.was-dragged .ld-hint { opacity: 0; }

/* Cota de altura total, a la izquierda de la lampara */
.ld-cota {
  position: absolute;
  z-index: 5;
  width: 9px;
  margin-left: -4.5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
  color: #9C8B7D;
}
.ld-cota-tick { width: 9px; height: 1px; background: currentColor; flex: none; }
.ld-cota-line { width: 1px; flex: 1; background: currentColor; opacity: 0.7; }
.ld-cota-text {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: #7A6A5D;
}
.ld-cota.is-vertical .ld-cota-text {
  right: 6px;
  transform: translateY(-50%) rotate(180deg);
  writing-mode: vertical-rl;
}
.ld-viewer.is-lit .ld-cota { color: #A88466; }
.ld-viewer.is-lit .ld-cota-text { color: #D9BC9A; }

/* Botones para inclinar la vista (sirven tambien en el celular) */
.ld-tilt {
  position: absolute;
  right: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  border-radius: 9999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid #E8DFC8;
  box-shadow: 0 2px 8px rgba(43, 30, 23, 0.08);
}
.ld-tilt button {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  color: #7A4E2B;
  cursor: pointer;
  transition: background 0.2s ease;
}
.ld-tilt button + button { border-top: 1px solid #E8DFC8; }
.ld-tilt button:hover { background: #FBF4EA; }
.ld-tilt button:active { background: #F1E4D0; }
.ld-tilt button:focus-visible { outline: 2px solid #B07A45; outline-offset: -2px; }
.ld-tilt svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.ld-viewer.is-lit .ld-tilt { background: rgba(36, 22, 12, 0.7); border-color: #6B4423; }
.ld-viewer.is-lit .ld-tilt button { color: #F5E6D0; }
.ld-viewer.is-lit .ld-tilt button + button { border-top-color: #6B4423; }
.ld-viewer.is-lit .ld-tilt button:hover { background: rgba(120, 78, 43, 0.5); }

.ld-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 800;
  color: #241A14;
}
/* Nombre al lado del titulo (colores), no contra el borde derecho */
.ld-label.ld-label-junto { justify-content: flex-start; gap: 0.4rem; }
.ld-label output {
  font-size: 13px;
  font-weight: 800;
  color: #7A4E2B;
  font-variant-numeric: tabular-nums;
}
.ld-help { font-size: 11px; color: #8B7B6E; margin-top: 0.15rem; line-height: 1.4; }
.ld-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 28px;
  background: transparent;
  cursor: pointer;
  margin-top: 0.25rem;
}
.ld-range::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 9999px;
  background: linear-gradient(to right, #B07A45 0%, #B07A45 var(--fill, 50%), #E8DFC8 var(--fill, 50%), #E8DFC8 100%);
}
.ld-range::-moz-range-track { height: 6px; border-radius: 9999px; background: #E8DFC8; }
.ld-range::-moz-range-progress { height: 6px; border-radius: 9999px; background: #B07A45; }
.ld-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  margin-top: -8px;
  border-radius: 9999px;
  background: #FFFFFF;
  border: 2px solid #7A4E2B;
  box-shadow: 0 2px 6px rgba(43, 30, 23, 0.2);
  transition: transform 0.15s ease;
}
.ld-range::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 9999px;
  background: #FFFFFF;
  border: 2px solid #7A4E2B;
  box-shadow: 0 2px 6px rgba(43, 30, 23, 0.2);
}
.ld-range:active::-webkit-slider-thumb { transform: scale(1.15); }
.ld-range:focus-visible { outline: 2px solid #B07A45; outline-offset: 4px; border-radius: 6px; }
.ld-range.is-blocked::-webkit-slider-thumb { border-color: #D97706; box-shadow: 0 0 0 4px rgba(217, 119, 6, 0.2); }

.ld-limit {
  display: flex;
  gap: 0.5rem;
  padding: 0.65rem 0.8rem;
  border-radius: 0.9rem;
  background: #FFFBEB;
  border: 1px solid #FCD34D;
  color: #92400E;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
}

.ld-formas { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.5rem; }
.ld-formas.ld-formas-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ld-formas-2 .ld-forma { flex-direction: row; justify-content: center; gap: 0.4rem; padding: 0.45rem 0.3rem; }
.ld-formas-2 .ld-forma svg { width: 20px; height: 20px; }
.ld-forma {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: 0.55rem 0.2rem 0.45rem;
  border-radius: 0.9rem;
  background: #FFFFFF;
  border: 1px solid #E8DFC8;
  color: #8B7B6E;
  font-size: 10.5px;
  letter-spacing: -0.01em;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}
.ld-forma svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.ld-forma:hover { border-color: #B07A45; color: #5C3D21; }
.ld-forma:active { transform: scale(0.96); }
.ld-forma:focus-visible { outline: 2px solid #B07A45; outline-offset: 2px; }
.ld-forma.is-active { border-color: #7A4E2B; color: #5C3D21; box-shadow: 0 0 0 1px #7A4E2B; background: #FBF4EA; }
.ld-forma.is-active svg { fill: rgba(176, 122, 69, 0.18); }

.ld-segs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; margin-top: 0.35rem; }
.ld-seg {
  padding: 0.4rem 0.5rem;
  border-radius: 0.75rem;
  background: #FFFFFF;
  border: 1px solid #E8DFC8;
  color: #8B7B6E;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}
.ld-seg:hover { border-color: #B07A45; color: #5C3D21; }
.ld-seg:active { transform: scale(0.97); }
.ld-seg:focus-visible { outline: 2px solid #B07A45; outline-offset: 2px; }
.ld-seg.is-active { border-color: #7A4E2B; color: #5C3D21; box-shadow: 0 0 0 1px #7A4E2B; background: #FBF4EA; }

.ld-swatch {
  width: 30px;
  height: 30px;
  border-radius: 9999px;
  border: 2px solid #FFFFFF;
  box-shadow: 0 0 0 1px #D9CDB9;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}
.ld-swatch:hover { transform: scale(1.08); }
.ld-swatch.is-active { box-shadow: 0 0 0 2px #7A4E2B; }

.ld-stat {
  display: flex;
  flex-direction: column;
  padding: 0.6rem 0.4rem;
  border-radius: 1rem;
  background: #FFFFFF;
  border: 1px solid #E8DFC8;
}
.ld-stat-value { font-size: 18px; font-weight: 900; color: #241A14; font-variant-numeric: tabular-nums; line-height: 1.1; }
.ld-stat-label { font-size: 10px; font-weight: 700; color: #8B7B6E; margin-top: 0.15rem; }
.ld-limit.hidden { display: none; }

/* Barra de accesos rapidos (celular): entra todo y, si no, se desliza */
#mobile-quick-nav { overflow-x: auto; scrollbar-width: none; gap: 2px; }
#mobile-quick-nav::-webkit-scrollbar { display: none; }
#mobile-quick-nav a { flex-shrink: 0; white-space: nowrap; padding-left: 0.45rem; padding-right: 0.45rem; }
