/* ==========================================================================
   1. ROOT VARIABLES & THEME CONFIGURATION
   ========================================================================== */
:root {
  --color-accent: #f46653; /* Coral: sobre fondos oscuros o imágenes */
  --color-light: #dcdcdc;
  --color-dark: #191919;
  --font-main: 'Cascadia Code', monospace;

  /* Espaciado lateral/vertical de secciones (se reduce en responsive) */
  --pad-x: 3rem;
  --pad-y: 2.5rem;

  /* Altura de las imágenes de galería (se reduce en responsive) */
  --gallery-img-h: 340px;
}

/* ==========================================================================
   2. GLOBAL RESET & BASE STYLES
   ========================================================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-family: var(--font-main);
  -webkit-text-size-adjust: 100%;
          text-size-adjust: 100%;
}

/* Scroll suave solo si el usuario no pidió reducir movimiento */
@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  background-color: var(--color-light);
  color: var(--color-dark);
}

a {
  text-decoration: none;
  color: inherit;
  transition: color 0.25s ease, opacity 0.25s ease;
}

/* Foco visible para navegación con teclado */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}

.light-theme :focus-visible {
  outline-color: var(--color-dark);
}

/* Evita que las imágenes se arrastren o seleccionen */
img {
  -webkit-user-drag: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* ==========================================================================
   3. NAVIGATION SYSTEM & DROPDOWN MENU
   ========================================================================== */
.top-nav,
.sub-nav {
  position: relative;
  width: 100%;
  z-index: 10;
}

.top-nav > ul,
.sub-nav > ul {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 2.5rem;
  list-style: none;
}

.top-nav ul li a,
.sub-nav ul li a {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 1px;
  color: var(--color-dark);
  opacity: 0.75;
}

/* Nav sobre imágenes (heroes) */
.hero-section .top-nav ul li a,
.sub-hero-section .sub-nav ul li a {
  color: var(--color-light);
  opacity: 0.85;
}

/* Nav sobre fondo oscuro */
.dark-theme .sub-nav ul li a {
  color: var(--color-light);
  opacity: 0.7;
}

/* Hover / activo (por defecto coral claro, válido sobre oscuro e imágenes) */
.top-nav ul li a:hover,
.sub-nav ul li a:hover,
.sub-nav ul li a.active {
  color: var(--color-accent);
  opacity: 1;
}

/* Dropdown */
.has-dropdown {
  position: relative;
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  background-color: var(--color-dark);
  list-style: none;
  padding: 0.8rem 1.2rem;
  border-radius: 8px;
  min-width: 160px;
  box-shadow: 0 4px 15px rgba(25, 25, 25, 0.2);
  z-index: 100;
  flex-direction: column;
  gap: 0.6rem;
}

/* El menú siempre vive sobre fondo oscuro: coral claro en hover */
.dropdown-menu li a {
  color: var(--color-light) !important;
  font-size: 0.7rem !important;
  white-space: nowrap;
  display: block;
  opacity: 0.8 !important;
}

.dropdown-menu li a:hover,
.dropdown-menu li a:focus-visible {
  color: var(--color-accent) !important;
  opacity: 1 !important;
}

.has-dropdown:hover .dropdown-menu,
.has-dropdown:focus-within .dropdown-menu {
  display: flex;
}

/* Dispositivos táctiles: no hay hover, así que el submenú se muestra en línea */
@media (hover: none) {
  .has-dropdown {
    display: flex;
    align-items: center;
    gap: 1.2rem;
  }

  .dropdown-menu {
    display: flex;
    position: static;
    flex-direction: row;
    gap: 1.2rem;
    padding: 0;
    min-width: 0;
    background: transparent;
    box-shadow: none;
    border-radius: 0;
  }
}

/* ==========================================================================
   4. HERO SECTION STYLES
   ========================================================================== */
.hero-section {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: var(--pad-y) var(--pad-x);
  color: var(--color-light);
  overflow: hidden;
}

.hero-backgrounds {
  position: absolute;
  inset: 0;
  display: flex;
  z-index: 1;
}

.hero-bg-left {
  flex: 1;
  background: url('assets/images/hero-render.webp') center/cover no-repeat;
}

.hero-bg-right {
  flex: 1;
  background: url('assets/images/hero-ph-bn.webp') center/cover no-repeat;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: rgba(25, 25, 25, 0.35);
  pointer-events: none;
  z-index: 2;
}

.hero-links {
  position: absolute;
  inset: 0;
  display: flex;
  z-index: 5;
  pointer-events: none;
}

.hero-link-col {
  flex: 1;
  display: flex;
}

/* Todo el medio de la pantalla es clicable, no solo el texto */
.hero-btn {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 1.3rem;
  font-weight: 400;
  color: #ffffff;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.35);
}

.hero-btn:hover,
.hero-btn:focus-visible {
  color: var(--color-accent);
}

/* ==========================================================================
   4.1 SUB-HERO / LANDING INTERMEDIATE SECTIONS
   ========================================================================== */
.sub-hero-section {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: var(--pad-y) var(--pad-x);
  color: var(--color-light);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  overflow: hidden;
}

.sub-hero-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(25, 25, 25, 0.45);
  z-index: 1;
  pointer-events: none;
}

.sub-hero-section > * {
  position: relative;
  z-index: 5;
}

.bg-3d {
  background-image: url('assets/images/hero-render-b.webp');
}

.bg-photo {
  background-image: url('assets/images/hero-ph-bn-b.webp');
}

.sub-hero-content {
  text-align: center;
  margin: auto 0;
}

.sub-hero-title {
  font-size: 3.8rem;
  font-weight: 500;
  color: var(--color-accent);
  margin-bottom: 3.5rem;
  letter-spacing: 1px;
}

.sub-hero-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8rem;
}

.sub-hero-btn {
  font-size: 1.3rem;
  font-weight: 400;
  color: #ffffff;
  letter-spacing: 0.5px;
  opacity: 0.85;
  padding: 0.5rem 0.25rem;
  transition: opacity 0.3s ease, color 0.3s ease;
}

.sub-hero-btn:hover,
.sub-hero-btn:focus-visible {
  opacity: 1;
  color: var(--color-accent);
}

/* ==========================================================================
   5. CONTENT SECTIONS LAYOUT
   ========================================================================== */
.content-section {
  min-height: 100vh;
  min-height: 100svh;
  padding: var(--pad-y) var(--pad-x);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.light-theme {
  background-color: var(--color-light);
  color: var(--color-dark);
}

.dark-theme {
  background-color: var(--color-dark);
  color: var(--color-light);
}

.section-header {
  margin-top: 1rem;
}

.section-header h2 {
  font-size: 1.8rem;
  font-weight: 500;
}

.filter-menu {
  list-style: none;
  margin-top: 0.4rem;
}

.filter-btn {
  font-size: 0.85rem;
  opacity: 0.7;
  display: inline-block;
  padding: 0.25rem 0;
  cursor: pointer;
}

.filter-btn:hover {
  opacity: 1;
}

.filter-btn.active {
  color: var(--color-accent);
  opacity: 1;
}

/* ==========================================================================
   6. DYNAMIC HORIZONTAL GALLERY
   (Sin filtro de escala de grises: las imágenes se ven tal como son)
   ========================================================================== */
.dynamic-horizontal-gallery {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  gap: 1.5rem;
  padding: 1.5rem 0;
  width: 100%;
  min-width: 0;
  min-height: 0;
  flex: 1;
  align-items: center;
  margin: 1.5rem 0;
  scrollbar-width: thin;
  scrollbar-color: var(--color-dark) rgba(25, 25, 25, 0.05);
}

.dynamic-horizontal-gallery::-webkit-scrollbar {
  height: 6px;
}

.dynamic-horizontal-gallery::-webkit-scrollbar-track {
  background: rgba(25, 25, 25, 0.05);
  border-radius: 3px;
}

.dynamic-horizontal-gallery::-webkit-scrollbar-thumb {
  background: var(--color-dark);
  border-radius: 3px;
}

.gallery-item {
  flex: 0 0 auto;
}

/* Por si más adelante envuelves cada imagen en un <button> */
.gallery-item button {
  display: block;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.gallery-item img {
  height: var(--gallery-img-h);
  width: auto;
  display: block;
  object-fit: cover;
  background-color: rgba(25, 25, 25, 0.08); /* placeholder mientras carga */
  box-shadow: 0 4px 15px rgba(25, 25, 25, 0.12);
  transition: transform 0.4s ease, box-shadow 0.4s ease;
  cursor: pointer;
}

/* Zoom y sombra solo donde existe hover real (mouse); en móvil no se queda "pegado" */
@media (hover: hover) {
  .gallery-item img:hover {
    transform: scale(1.03);
    box-shadow: 0 8px 25px rgba(25, 25, 25, 0.25);
  }
}

/* ==========================================================================
   7. LIGHTBOX MODAL STYLES
   ========================================================================== */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background-color: rgba(25, 25, 25, 0.95);
  align-items: center;
  justify-content: center;
  overscroll-behavior: contain;
}

.lightbox.active {
  display: flex;
}

/* Opcional: añade/quita esta clase en <body> desde JS para bloquear el scroll de fondo */
body.lightbox-open {
  overflow: hidden;
}

.lightbox-img {
  max-width: 85%;
  max-height: 85vh;
  max-height: 85dvh;
  object-fit: contain;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* Funciona igual si es <span> o <button>. Área táctil mínima de 44px */
.lightbox-close {
  position: absolute;
  top: 1.2rem;
  right: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: none;
  border: 0;
  color: var(--color-light);
  font-size: 2.5rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.25s ease;
}

.lightbox-close:hover,
.lightbox-close:focus-visible {
  color: var(--color-accent);
}

.lightbox-prev,
.lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  min-width: 44px;
  min-height: 44px;
  background: transparent;
  border: none;
  color: var(--color-light);
  font-size: 2.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 1rem;
  transition: color 0.25s ease;
}

.lightbox-prev:hover,
.lightbox-next:hover,
.lightbox-prev:focus-visible,
.lightbox-next:focus-visible {
  color: var(--color-accent);
}

.lightbox-prev {
  left: 2rem;
}

.lightbox-next {
  right: 2rem;
}

/* ==========================================================================
   8. ABOUT SECTION & PROTECTED PORTRAIT
   ========================================================================== */
.about-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5rem;
  max-width: 1100px;
  margin: auto;
}

.about-text {
  flex: 1.2;
  font-size: 0.95rem;
  line-height: 1.7;
  letter-spacing: 0.2px;
}

.about-image {
  flex: 0.8;
  max-width: 380px;
  width: 100%;
}

/* El retrato se mantiene en B&N a propósito (decisión de diseño) */
.about-portrait-bg {
  width: 100%;
  height: 380px;
  background-image: url('assets/images/about-portrait.webp');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  filter: grayscale(100%);
  pointer-events: none;
  user-select: none;
}

/* ==========================================================================
   9. CONTACT SECTION
   ========================================================================== */
.contact-container {
  text-align: center;
  margin: auto 0;
}

.contact-container h1 {
  font-size: 4rem;
  font-weight: 400;
  margin-bottom: 2.5rem;
  letter-spacing: 1px;
}

.social-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
}

/* Área táctil de al menos 44px por icono */
.social-links a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
}

/* Icono en gris claro (#dcdcdc) */
.social-icon {
  width: 32px;
  height: 32px;
  filter: brightness(0) saturate(100%) invert(91%) sepia(0%) saturate(22%) hue-rotate(187deg) brightness(96%) contrast(89%);
  transition: filter 0.25s ease, transform 0.25s ease;
}

/* Coral (#f46653) en hover / foco */
.social-links a:hover .social-icon,
.social-links a:focus-visible .social-icon {
  filter: brightness(0) saturate(100%) invert(52%) sepia(58%) saturate(1469%) hue-rotate(323deg) brightness(101%) contrast(92%);
  transform: translateY(-3px);
}

/* ==========================================================================
   10. BRAND FOOTER
   ========================================================================== */
.brand-footer {
  position: relative;
  width: 100%;
  text-align: center;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
  opacity: 0.85;
  z-index: 10;
  padding: 1rem 0;
}

/* ==========================================================================
   11. DISABLED STATE FOR FUTURE FEATURES
   ========================================================================== */
.sub-hero-btn.disabled,
.filter-btn.disabled,
[aria-disabled="true"] {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

/* ==========================================================================
   12. RESPONSIVE DESIGN
   ========================================================================== */

/* Tablets */
@media (max-width: 992px) {
  :root {
    --pad-x: 2rem;
    --pad-y: 2rem;
  }

  .sub-hero-title {
    font-size: 2.8rem;
    margin-bottom: 2rem;
  }

  .contact-container h1 {
    font-size: 3rem;
  }

  .sub-hero-links {
    gap: 4rem;
  }

  .about-container {
    gap: 3rem;
  }
}

/* Móviles grandes y tablets pequeñas */
@media (max-width: 768px) {
  :root {
    --gallery-img-h: 240px;
  }

  /* Navegación centrada y en varias líneas si hace falta */
  .top-nav > ul,
  .sub-nav > ul {
    gap: 0.6rem 1.2rem;
    flex-wrap: wrap;
    justify-content: center;
  }

  .top-nav ul li a,
  .sub-nav ul li a {
    font-size: 0.7rem;
    display: inline-block;
    padding: 0.4rem 0;
  }

  /* Hero principal: mitades apiladas, cada una completamente clicable */
  .hero-backgrounds,
  .hero-links {
    flex-direction: column;
  }

  .sub-hero-links {
    flex-direction: column;
    gap: 1.5rem;
  }

  .sub-hero-title {
    font-size: 2.2rem;
  }

  .about-container {
    flex-direction: column;
    gap: 2rem;
    text-align: center;
  }

  .about-text {
    font-size: 0.85rem;
    line-height: 1.6;
  }

  .about-image {
    max-width: 260px;
    margin: 0 auto;
  }

  .about-portrait-bg {
    height: 260px;
  }

  .contact-container h1 {
    font-size: 2.3rem;
  }

  /* Lightbox: más imagen, controles más pequeños y con fondo para verse sobre la foto */
  .lightbox-img {
    max-width: 94%;
  }

  .lightbox-close {
    top: 0.6rem;
    right: 0.6rem;
  }

  .lightbox-prev,
  .lightbox-next {
    font-size: 1.8rem;
    padding: 0.6rem;
    background: rgba(25, 25, 25, 0.45);
    border-radius: 50%;
  }

  .lightbox-prev {
    left: 0.4rem;
  }

  .lightbox-next {
    right: 0.4rem;
  }
}

/* Móviles */
@media (max-width: 480px) {
  :root {
    --pad-x: 1.2rem;
    --pad-y: 1.2rem;
    --gallery-img-h: 200px;
  }

  .sub-hero-title {
    font-size: 1.8rem;
  }

  .section-header h2 {
    font-size: 1.5rem;
  }

  .contact-container h1 {
    font-size: 2rem;
  }

  .dynamic-horizontal-gallery {
    gap: 1rem;
  }
}

/* ==========================================================================
   13. REDUCED MOTION
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}