/* ==========================================================================
   Carlos Gallego Domínguez — Portfolio
   Estilo editorial, limpio, artesano y contemporáneo (Sin líneas divisorias)
   ========================================================================== */

:root {
  --bg-color: #faf9f6;          /* Blanco cálido papel / off-white */
  --text-main: #18181b;         /* Negro suave tipográfico */
  --text-muted: #71717a;        /* Gris medio */
  --sidebar-w: 320px;           /* Ancho barra lateral optimizado con más presencia */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  background-color: var(--bg-color);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-sans);
  line-height: 1.5;
  min-height: 100vh;
}

/* Tipografía editorial y prevención universal de palabras huérfanas */
p, .category-lead, .category-sublead, .project-entry-header p {
  text-wrap: pretty;
}

h1, h2, h3 {
  text-wrap: balance;
}

/* ==========================================================================
   Estructura Principal (Layout)
   ========================================================================== */

.layout {
  display: flex;
  min-height: 100vh;
}

/* Barra lateral izquierda fija en ordenador */
.sidebar {
  width: var(--sidebar-w);
  height: 100vh;
  position: sticky;
  top: 0;
  padding: 3.5rem 2.4rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background-color: var(--bg-color);
  z-index: 50;
  border-right: none;           /* Cero líneas */
  flex-shrink: 0;
}

/* Marca y Nombre en una sola línea */
.brand h1 {
  font-size: 1.22rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  white-space: nowrap;          /* Nombre en una sola línea */
  margin-bottom: 1.35rem;
}

.brand h1 a {
  color: inherit;
  text-decoration: none;
}

/* Contacto rápido debajo del nombre */
.quick-contact {
  display: flex;
  flex-direction: column;
  gap: 0.42rem;
  margin-bottom: 1.6rem;
  font-size: 0.98rem;
}

.quick-contact a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.quick-contact a:hover {
  color: var(--text-main);
}

.quick-contact .about-link {
  color: var(--text-muted);
  font-weight: 400;             /* Texto normal, sin negrita */
  margin-top: 0.25rem;
}

.quick-contact .about-link:hover {
  color: var(--text-main);
}

/* Ilustración decorativa en la barra lateral con modo multiplicar */
.sidebar-spot-illustration {
  margin: 0 0 1.8rem 0;
  display: block;
}

.sidebar-spot-illustration img {
  width: 98px;
  height: auto;
  display: block;
  mix-blend-mode: multiply;
  opacity: 0.95;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

/* Navegación por Categorías */
.nav-section {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.nav-link {
  font-size: 1.05rem;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.2rem 0;
  transition: color 0.15s ease, transform 0.15s ease;
  display: inline-block;
  cursor: pointer;
  background: none;
  border: none;
  text-align: left;
  font-family: inherit;
}

.nav-link:hover,
.nav-link.active {
  color: var(--text-main);
  font-weight: 600;
  transform: translateX(4px);
}

/* Pie de la barra lateral */
.sidebar-footer {
  font-size: 0.84rem;
  color: #a1a1aa;
  line-height: 1.5;
}

/* Pantallas de escritorio grandes (iMac, monitores 2K / 4K / pantalla completa) */
@media (min-width: 1500px) {
  :root {
    --sidebar-w: 350px;
  }
  .sidebar {
    padding: 4rem 2.8rem;
  }
  .brand h1 {
    font-size: 1.3rem;
  }
  .quick-contact {
    font-size: 1.02rem;
    gap: 0.5rem;
  }
  .nav-link {
    font-size: 1.12rem;
    padding: 0.25rem 0;
  }
  .sidebar-spot-illustration img {
    width: 108px;
  }
  .sidebar-footer {
    font-size: 0.88rem;
  }
}

/* Botón Volver y Selector de Idioma */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  transition: color 0.15s ease, transform 0.15s ease;
}

.back-link:hover {
  color: var(--text-main);
  transform: translateX(-3px);
}

/* Botón Volver Fijo a la Derecha (Categorías y Proyectos) */
.back-link-fixed {
  position: fixed;
  top: 3.2rem;
  right: 2.5rem;
  z-index: 80;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  background-color: rgba(250, 249, 246, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 0.45rem 0.9rem;
  border-radius: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: color 0.15s ease, transform 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.back-link-fixed:hover {
  color: var(--text-main);
  transform: translateX(-3px);
  background-color: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

@media (max-width: 768px) {
  .back-link-fixed {
    top: 4.25rem;
    right: 1.25rem;
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
  }
}

.lang-btn {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.lang-btn:hover,
.lang-btn.active {
  color: var(--text-main);
  font-weight: 600;
}

/* ==========================================================================
   Contenido Principal / Galería (4 Columnas en Ordenador)
   ========================================================================== */

.main-content {
  flex: 1;
  padding: 3rem 2rem 5rem 1.5rem;
  max-width: 100%;
}

/* Cuadrícula de Portafolio: 4 columnas por defecto en portátiles y pantallas estándar */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.6rem 1.05rem;
  align-items: start;
}

/* Pantallas grandes / monitores de sobremesa a ancho completo: 5 columnas */
@media (min-width: 1850px) {
  .gallery-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 1.5rem 0.95rem;
  }
}

/* Tarjeta de Proyecto */
.project-card {
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: opacity 0.3s ease;
  min-width: 0;
  width: 100%;
}

.project-card > a {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  min-width: 0;
  width: 100%;
}

.project-card.hidden {
  display: none;
}

.image-wrapper {
  position: relative;
  width: 100%;
  min-width: 0;
  aspect-ratio: 4 / 5;          /* Formato idéntico y uniforme para todas las miniaturas en Home */
  background-color: transparent; /* Cero recuadros ocres */
  border-radius: 0;              /* Ángulos rectos */
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
}

.project-card:hover .image-wrapper {
  transform: translateY(-3px);
  box-shadow: 0 10px 20px -6px rgba(0, 0, 0, 0.1);
}

@keyframes fadeInImage {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.image-wrapper img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;            /* Todas encajan limpiamente sin deformarse */
  object-position: center;
  border-radius: 0;
  animation: fadeInImage 0.4s ease-out;
}

/* Zoom específico para la miniatura de Adega do Demo en la home para ocultar los bordes blancos de la foto */
.image-wrapper img.batela-zoom {
  transform: scale(1.15);
  transform-origin: center center;
}

/* Viñetas artísticas decorativas / Respiros en la cuadrícula de Home */
.spot-card {
  display: flex;
  flex-direction: column;
  cursor: zoom-in;
  min-width: 0;
  width: 100%;
}

.spot-card .image-wrapper {
  aspect-ratio: 4 / 5;
  background-color: transparent;
  border-radius: 0;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
  position: relative;
}

.spot-card:hover .image-wrapper {
  transform: translateY(-3px);
  box-shadow: 0 10px 20px -6px rgba(0, 0, 0, 0.1);
}

.spot-card .image-wrapper img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center center;
  border-radius: 0;
}

.spot-card .image-wrapper img.spot-lapices {
  object-position: center 15%;
}

/* Metadatos de la miniatura: 2 líneas uniformes y estructuradas */
.project-info {
  margin-top: 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  width: 100%;
  min-width: 0;
}

.project-title {
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text-main);
  letter-spacing: -0.01em;
  white-space: nowrap;          /* Título en una sola línea */
  overflow: hidden;
  text-overflow: ellipsis;      /* Corta suave si es muy largo */
  display: block;
  width: 100%;
  min-width: 0;
}

.project-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  width: 100%;
  min-width: 0;
}

/* Sin descripción */
.project-desc {
  display: none !important;
}

/* ==========================================================================
   Cabecera Móvil y Menú Desplegable
   ========================================================================== */

.mobile-header {
  display: none;
  position: sticky;
  top: 0;
  background-color: rgba(250, 249, 246, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 1.1rem 1.25rem;
  border-bottom: none;
  justify-content: space-between;
  align-items: center;
  z-index: 100;
}

.mobile-header .brand-title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-main);
  white-space: nowrap;
}

.mobile-menu-btn {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--text-main);
  padding: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mobile-drawer {
  display: none;
  position: fixed;
  inset: 0;
  background-color: var(--bg-color);
  z-index: 99;
  padding: 5.5rem 1.5rem 2rem 1.5rem;
  flex-direction: column;
  justify-content: space-between;
  overflow-y: auto;
}

.mobile-drawer.open {
  display: flex;
}

.mobile-drawer .nav-link {
  font-size: 1.25rem;
  padding: 0.5rem 0;
}

.mobile-drawer .sidebar-spot-illustration {
  margin: 0.5rem 0 1.5rem 0;
}

.mobile-drawer .sidebar-spot-illustration img {
  width: 76px;
}

/* ==========================================================================
   Lightbox
   ========================================================================== */

.lightbox {
  position: fixed;
  inset: 0;
  background-color: rgba(18, 18, 20, 0.94);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 2rem;
  cursor: zoom-out;
}

.lightbox.open {
  display: flex;
}

.lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 0;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
  cursor: default;
  transition: opacity 0.15s ease-out;
}

.lightbox-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  background: none;
  border: none;
  color: white;
  font-size: 2rem;
  cursor: pointer;
  line-height: 1;
  padding: 0.5rem;
  opacity: 0.75;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 220;
}

.lightbox-close:hover {
  opacity: 1;
  transform: scale(1.1);
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #ffffff;
  font-size: 1.6rem;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 0;
  transition: background-color 0.2s ease, border-color 0.2s ease, opacity 0.2s ease, transform 0.15s ease;
  z-index: 215;
  user-select: none;
  opacity: 0.8;
}

.lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.45);
  opacity: 1;
}

.lightbox-nav:active {
  transform: translateY(-50%) scale(0.94);
}

.lightbox-prev {
  left: 1.5rem;
}

.lightbox-next {
  right: 1.5rem;
}

.lightbox-caption {
  display: none !important;
}

@media (max-width: 640px) {
  .lightbox-nav {
    width: 42px;
    height: 42px;
    font-size: 1.3rem;
    background: rgba(18, 18, 20, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.25);
  }
  .lightbox-prev {
    left: 0.5rem;
  }
  .lightbox-next {
    right: 0.5rem;
  }
}

/* ==========================================================================
   Responsive: Pantallas medianas (Tablet) y Móviles
   ========================================================================== */


/* Tablets o pantallas intermedias (hasta 960px):
   - Layout móvil con cabecera superior
   - 3 columnas en la galería
   ========================================================================== */
@media (max-width: 960px) {
  .layout {
    flex-direction: column;
  }

  .sidebar {
    display: none;
  }

  .mobile-header {
    display: flex;
  }

  .main-content {
    padding: 1.5rem 1.25rem 3rem 1.25rem;
  }

  .gallery-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.4rem 0.85rem;
  }

  .project-title {
    font-size: 0.9rem;
  }

  .project-meta {
    font-size: 0.8rem;
  }
}

/* Tablets compactas (hasta 768px): 2 columnas */
@media (max-width: 768px) {
  .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.3rem 0.8rem;
  }
}

/* Teléfonos móviles (hasta 550px): 1 columna */
@media (max-width: 550px) {
  .gallery-grid {
    grid-template-columns: 1fr;
    gap: 1.8rem;
  }

  .project-title {
    font-size: 0.95rem;
  }
}

/* ==========================================================================
   Páginas de Categoría: Cabecera e Introducción Editorial
   ========================================================================== */

.category-header {
  margin-top: 0;              /* Subido arriba al mover el botón volver fijo a la derecha */
  margin-bottom: 66px;        /* Espacio equilibrado con respecto al primer proyecto */
  max-width: 980px;           /* Amplitud suficiente para mantener frases editoriales en una sola línea en escritorio */
}

.category-title {
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-main);
  margin-bottom: 0.85rem;
  line-height: 1.15;
  text-wrap: balance;
}

.category-title em {
  font-weight: 300;
  font-style: italic;
  color: #71717a;
}

.category-lead {
  font-size: 1.1rem;
  font-weight: 400;
  line-height: 1.6;
  color: #52525b;
  letter-spacing: -0.01em;
  margin-bottom: 0.35rem;
  text-wrap: pretty;
}

.category-sublead {
  font-size: 0.92rem;
  line-height: 1.55;
  color: #71717a;
  font-style: italic;
  text-wrap: pretty;
}

@media (max-width: 768px) {
  .category-header {
    margin-bottom: 40px;
  }
  .category-title {
    font-size: 1.75rem;
  }
  .category-lead {
    font-size: 1rem;
    line-height: 1.5;
  }
  .category-sublead {
    font-size: 0.86rem;
  }
}

/* ==========================================================================
   Páginas de Proyecto / Deep Dives: Estructura y Metadatos
   ========================================================================== */

.project-deep-dive {
  margin-bottom: 7rem;
  scroll-margin-top: 3.5rem;
}

@media (max-width: 960px) {
  .project-deep-dive {
    scroll-margin-top: 6.5rem !important;  /* Margen amplio y generoso para que la cabecera móvil fija jamás tape el título */
  }
}

.project-entry-header {
  margin-bottom: 2.4rem;
}

.project-entry-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
  margin-bottom: 0.65rem;
}

.project-entry-header p {
  font-size: 0.95rem;
  color: #3f3f46;
  max-width: 980px;
  line-height: 1.6;
  margin-bottom: 0.85rem;
  text-wrap: pretty;
}

.project-entry-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  font-family: var(--font-mono);
  margin-top: 0.65rem;
  line-height: 1.5;
}

.project-entry-meta span {
  display: block;
}

/* Páginas de Categoría: Galería de ilustraciones completas */
.project-images-grid .image-wrapper {
  aspect-ratio: auto;
  background-color: transparent !important;
  box-shadow: none !important;
}

.project-images-grid .image-wrapper img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
}

/* Cuadrícula de 3 Columnas para Libros de Texto (Si entras no sales - 3 columnas) */
.textbooks-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2.2rem 1.8rem;
  align-items: start;
}

.textbooks-grid-3 .image-wrapper {
  aspect-ratio: auto;
  background-color: transparent !important;
  box-shadow: none !important;
  border-radius: 0 !important;
}

.textbooks-grid-3 .image-wrapper img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
  border-radius: 0 !important;
}

/* Cuadrícula de 4 Columnas para Libros de Texto en Pantalla Completa */
.textbooks-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 2.2rem 1.8rem;
  align-items: start;
}

.textbooks-grid-4 .image-wrapper {
  aspect-ratio: auto;
  background-color: transparent !important;
  box-shadow: none !important;
  border-radius: 0 !important;
}

.textbooks-grid-4 .image-wrapper img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
  border-radius: 0 !important;
}

.textbooks-grid-4 .span-2 {
  grid-column: span 2;
}

/* Galería de Figuritas en pequeño (serie de 12 agrupadas) */
.figurines-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1.25rem 1rem;
  align-items: end;
}

.figurines-grid .image-wrapper {
  aspect-ratio: auto;
  background-color: transparent !important;
  box-shadow: none !important;
  border-radius: 0 !important;
}

.figurines-grid .image-wrapper img {
  width: 100%;
  max-width: 140px;
  height: auto;
  display: block;
  margin: 0 auto;
  object-fit: contain;
  border-radius: 0 !important;
}

@media (max-width: 1100px) {
  .textbooks-grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .textbooks-grid-4 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .figurines-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 768px) {
  .textbooks-grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .textbooks-grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .textbooks-grid-4 .span-2 {
    grid-column: span 2;
  }
  .figurines-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 500px) {
  .textbooks-grid-3 {
    grid-template-columns: 1fr;
  }
  .textbooks-grid-4 {
    grid-template-columns: 1fr;
  }
  .textbooks-grid-4 .span-2 {
    grid-column: span 1;
  }
  .figurines-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
  }
}

/* ==========================================================================
   2º de Bachillerato: Maquetación editorial (2/3 libros en 2x2, 1/3 ilustraciones)
   ========================================================================== */
.bachillerato-layout {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  align-items: stretch;
}

.bachillerato-books-grid {
  grid-column: span 2;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.bachillerato-books-grid .image-wrapper {
  aspect-ratio: auto;
  background-color: transparent !important;
  box-shadow: none !important;
}

.bachillerato-books-grid .image-wrapper img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
}

.bachillerato-artworks-col {
  grid-column: span 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1.25rem;
}

.bachillerato-artworks-col .image-wrapper {
  aspect-ratio: auto;
  background-color: transparent !important;
  box-shadow: none !important;
}

.bachillerato-artworks-col .image-wrapper img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
}

.bachillerato-artworks-col .artwork-middle img {
  max-width: 82%;
  margin: 0 auto;
}

@media (max-width: 960px) {
  .bachillerato-layout {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .bachillerato-books-grid {
    grid-column: span 1;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }

  .bachillerato-artworks-col {
    grid-column: span 1;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
    align-items: end;
  }

  .bachillerato-artworks-col .artwork-middle img {
    max-width: 100%;
  }
}

@media (max-width: 640px) {
  .bachillerato-books-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .bachillerato-artworks-col {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

/* ==========================================================================
   3º ESO: Maquetación editorial idéntica al portfolio original
   ========================================================================== */
.eso-layout {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3rem 2rem;
  align-items: center;
}

.eso-item {
  aspect-ratio: auto;
  background-color: transparent !important;
  box-shadow: none !important;
}

.eso-item img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
}

/* Fila 1: Libros y hojas al viento alineados al tope */
.eso-book-left,
.eso-book-right,
.eso-leaves {
  align-self: start;
}

.eso-leaves img {
  max-width: 80%;
  margin: 0 auto;
}

/* Fila 2: Fuente, Árbol y Tapiz */
.eso-fountain img {
  max-width: 85%;
  margin: 0 auto;
}

.eso-tree img {
  max-width: 75%;
  margin: 0 auto;
}

.eso-tapestry img {
  max-width: 95%;
  margin: 0 auto;
}

/* Fila 3: Manteliño y Grupo de las Rosas alineados a la base */
.eso-placemat {
  align-self: end;
}

/* Grupo exclusivo de las 3 rosas (siempre juntas como un grupo) */
.roses-group {
  grid-column: span 2;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  align-items: end;
  align-self: end;
}

.roses-group .image-wrapper {
  aspect-ratio: auto;
  background-color: transparent !important;
  box-shadow: none !important;
}

.roses-group .image-wrapper img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
}

.roses-group .rose-stem img {
  max-width: 90%;
  margin: 0 auto;
}

.roses-group .rose-tree img {
  max-width: 92%;
  margin: 0 auto;
}

.roses-group .rose-cut img {
  max-width: 85%;
  margin: 0 auto;
}

@media (max-width: 960px) {
  .eso-layout {
    grid-template-columns: repeat(2, 1fr);
    gap: 2.2rem 1.5rem;
  }

  .eso-book-left { order: 1; }
  .eso-book-right { order: 2; }
  .eso-leaves { order: 3; }
  .eso-fountain { order: 4; }
  .eso-tree { order: 5; }
  .eso-tapestry { order: 6; }
  .eso-placemat { order: 7; grid-column: span 2; }
  .roses-group {
    order: 8;
    grid-column: span 2;
    gap: 1.25rem;
  }

  .eso-leaves img,
  .eso-fountain img,
  .eso-tree img,
  .eso-tapestry img {
    max-width: 100%;
  }
}

@media (max-width: 640px) {
  .eso-layout {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .eso-placemat {
    grid-column: span 1;
  }

  /* Las tres rosas se mantienen SIEMPRE en su grupo de 3 columnas juntas */
  .roses-group {
    grid-column: span 1;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
  }
}

/* ==========================================================================
   5º y 6º de Primaria: Maquetación editorial idéntica al portfolio original
   ========================================================================== */
.primaria-layout {
  display: flex;
  flex-direction: column;
  gap: 3.5rem;
}

/* Parte superior: 6 imágenes en cuadrícula editorial 3 columnas */
.primaria-top-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2.5rem 2rem;
  align-items: center;
}

.primaria-top-grid .image-wrapper {
  aspect-ratio: auto;
  background-color: transparent !important;
  box-shadow: none !important;
}

.primaria-top-grid .image-wrapper img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
}

/* Parte inferior: 4 columnas de personajes alineados */
.primaria-chars-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2rem 1.5rem;
  align-items: center;
}

.primaria-chars-grid .image-wrapper {
  aspect-ratio: auto;
  background-color: transparent !important;
  box-shadow: none !important;
}

.primaria-chars-grid .image-wrapper img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
}

.primaria-chars-grid .wall-item img {
  max-width: 75%;
  margin: 0 auto;
}

.primaria-chars-grid .orchestra-item img {
  max-width: 80%;
  margin: 0 auto;
}

/* 2 pancartas horizontales */
.primaria-banners-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2rem 2.5rem;
  align-items: center;
}

.primaria-banners-grid .image-wrapper {
  aspect-ratio: auto;
  background-color: transparent !important;
  box-shadow: none !important;
}

.primaria-banners-grid .image-wrapper img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
}

/* Cuervo centrado */
.primaria-crow {
  display: flex;
  justify-content: center;
  margin-top: 1rem;
}

.primaria-crow .image-wrapper {
  max-width: 340px;
  width: 100%;
  aspect-ratio: auto;
  background-color: transparent !important;
  box-shadow: none !important;
}

.primaria-crow .image-wrapper img {
  width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
  object-fit: contain;
}

/* Responsiveness */
@media (max-width: 960px) {
  .primaria-top-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem 1.5rem;
  }

  .primaria-chars-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem 1.5rem;
  }

  .primaria-banners-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}

@media (max-width: 640px) {
  .primaria-top-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .primaria-chars-grid {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }

  .primaria-banners-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .primaria-crow .image-wrapper {
    max-width: 260px;
  }
}

/* ==========================================================================
   Página Libros / Books: Distribución editorial idéntica al portfolio Cargo
   ========================================================================== */
.libros-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2.5rem 2rem;
  align-items: center;
}

.libros-grid-3 .image-wrapper {
  aspect-ratio: auto;
  background-color: transparent !important;
  box-shadow: none !important;
}

.libros-grid-3 .image-wrapper img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
}

@media (max-width: 960px) {
  .libros-grid-3 {
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem 1.5rem;
  }
}

@media (max-width: 640px) {
  .libros-grid-3 {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}

/* Proyecto Guerra Civil: filas estructuradas según Cargo (4, 3, 1 centrada, 2) */
.guerra-civil-layout {
  display: flex;
  flex-direction: column;
  gap: 3rem;
}

.guerra-row-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2rem 1.5rem;
  align-items: center;
}

.guerra-row-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2.5rem 2rem;
  align-items: center;
}

.guerra-row-center {
  display: flex;
  justify-content: center;
}

.guerra-row-center .image-wrapper {
  max-width: 540px;
  width: 100%;
  aspect-ratio: auto;
  background-color: transparent !important;
  box-shadow: none !important;
}

.guerra-row-center .image-wrapper img {
  width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
  object-fit: contain;
}

.guerra-row-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2.5rem 2rem;
  align-items: center;
}

.guerra-civil-layout .image-wrapper {
  aspect-ratio: auto;
  background-color: transparent !important;
  box-shadow: none !important;
}

.guerra-civil-layout .image-wrapper img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
}

@media (max-width: 960px) {
  .guerra-row-4 {
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem 1.5rem;
  }

  .guerra-row-3 {
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem 1.5rem;
  }
}

@media (max-width: 640px) {
  .guerra-row-4,
  .guerra-row-3,
  .guerra-row-2 {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}

/* ==========================================================================
   Páginas Sobre Mí: Formato editorial a 2 columnas (sin scroll en desktop)
   ========================================================================== */

.about-page-container {
  max-width: 980px;
}

.about-header-bar {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  margin-top: 0;
  margin-bottom: 2rem;
}

.about-grid {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 3.5rem;
  align-items: start;
}

.about-photo-col {
  display: flex;
  flex-direction: column;
  width: 240px;
}

.about-photo-wrapper {
  width: 100%;
  max-width: 240px;
  background-color: transparent; /* Cero recuadros ocres */
  border-radius: 0;              /* Ángulos rectos */
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.05);
}

.about-photo-wrapper img {
  width: 100%;
  height: auto;
  display: block;
}

.about-photo-credit {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-top: 0.5rem;
  text-align: right;
  width: 100%;
}

.about-photo-credit a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.about-text-col {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  font-size: 0.92rem;
  line-height: 1.62;
  color: #27272a;
}

.about-text-col p strong {
  font-weight: 600;
  color: var(--text-main);
}

.about-text-col a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 500;
}

/* ==========================================================================
   Responsive para Sobre Mí (Tablets y Móviles)
   ========================================================================== */
@media (max-width: 960px) and (min-width: 769px) {
  .about-grid {
    grid-template-columns: 210px 1fr;
    gap: 2.2rem;
  }

  .about-photo-wrapper {
    max-width: 210px;
  }
}

/* En teléfonos móviles y pantallas compactas (hasta 768px):
   - FOTO ARRIBA CENTRADA
   - TEXTO 100% DEBAJO EN UNA SOLA COLUMNA A ANCHO COMPLETO
   ========================================================================== */
@media (max-width: 768px) {
  .about-header-bar {
    margin-bottom: 1.5rem;
  }

  .about-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 1.8rem !important;
    width: 100% !important;
  }

  .about-photo-col {
    order: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-end !important;
    width: min(290px, 82vw) !important;
    margin: 0 auto !important;
  }

  .about-photo-wrapper {
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08) !important;
  }

  .about-photo-credit {
    text-align: right !important;
    margin-top: 0.55rem !important;
    font-size: 0.74rem !important;
    width: 100% !important;
  }

  .about-text-col {
    order: 2 !important;
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    max-width: 100% !important;
    font-size: 0.96rem !important;
    line-height: 1.68 !important;
    margin-top: 0.2rem !important;
  }
}

/* ==========================================================================
   Página Otros / Others — Cuadrículas y ritmos de composición
   ========================================================================== */

/* Layout específico para Morecambe Bay */
.morecambe-bay-layout {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.morecambe-row-asymm {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 2rem;
  align-items: center;
}

.morecambe-row-centered {
  display: flex;
  justify-content: center;
}

.morecambe-row-centered .image-wrapper {
  width: 52%;
  max-width: 720px;
}

.morecambe-row-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  align-items: center;
}

.morecambe-row-full {
  width: 100%;
}

.morecambe-row-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2rem;
  align-items: center;
}

.morecambe-bay-layout .image-wrapper,
.morecambe-making-layout .image-wrapper,
.otros-grid-4 .image-wrapper,
.intervenciones-layout .image-wrapper {
  aspect-ratio: auto;
  background-color: transparent !important;
  box-shadow: none !important;
}

.morecambe-bay-layout .image-wrapper img,
.morecambe-making-layout .image-wrapper img,
.otros-grid-4 .image-wrapper img,
.intervenciones-layout .image-wrapper img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
}

/* Layout para Morecambe Bay Making Of */
.morecambe-making-layout {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.morecambe-making-row-2 {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: 2rem;
  align-items: center;
}

/* Cuadrícula a 4 columnas (Sea People & Brujas Botánicas) */
.otros-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2rem;
}

/* Layout para Intervenciones artísticas */
.intervenciones-layout {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.intervenciones-row-top {
  display: flex;
  justify-content: center;
}

.intervenciones-row-top .image-wrapper {
  width: 80%;
  max-width: 900px;
}

.intervenciones-row-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  align-items: center;
}

/* Reglas responsivas para Otros */
@media (max-width: 960px) {
  .otros-grid-4 {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
  }
  .morecambe-row-centered .image-wrapper {
    width: 75%;
  }
  .intervenciones-row-top .image-wrapper {
    width: 100%;
  }
  .intervenciones-row-3 {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }
}

@media (max-width: 640px) {
  .morecambe-row-asymm,
  .morecambe-row-3,
  .morecambe-row-2,
  .morecambe-making-row-2,
  .intervenciones-row-3 {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .morecambe-row-centered .image-wrapper {
    width: 100%;
  }

  .otros-grid-4 {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
}

/* ==========================================================================
   Publicidad / Advertising Layouts
   ========================================================================== */

/* Lienzo blanco editorial para acoger imágenes de producto e ilustración */
.white-canvas {
  background-color: #ffffff;
  padding: 2.5rem 2rem;
  border-radius: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

/* Adega do Demo: 4 imágenes sobre fondo blanco continuo que las acoge a todas */
.adega-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr 1.25fr 1fr;
  gap: 2rem 1.8rem;
  align-items: center;
  background-color: #ffffff;
  padding: 2.5rem 2rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.adega-grid .image-wrapper {
  aspect-ratio: auto;
  background-color: transparent !important;
  box-shadow: none !important;
  border-radius: 0 !important;
}

.adega-grid .image-wrapper img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
  border-radius: 0 !important;
}

/* Horno Sanbrandan: 3 imágenes (ilustración, mesa y detalle) con altura exactamente igualada */
.sanbrandan-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.7727fr) minmax(0, 1.2427fr) minmax(0, 1.5274fr);
  gap: 2.2rem 1.8rem;
  align-items: stretch;
}

.sanbrandan-grid .image-wrapper {
  background-color: transparent !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  width: 100%;
}

.sanbrandan-grid .image-wrapper:nth-child(1) {
  aspect-ratio: 989 / 1280;
}

.sanbrandan-grid .image-wrapper:nth-child(2) {
  aspect-ratio: 1280 / 1030;
}

.sanbrandan-grid .image-wrapper:nth-child(3) {
  aspect-ratio: 1280 / 838;
}

.sanbrandan-grid .image-wrapper img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  border-radius: 0 !important;
}

@media (max-width: 960px) {
  .white-canvas {
    padding: 2rem 1.5rem;
  }
  .adega-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2rem 1.6rem;
    padding: 2rem 1.5rem;
  }
  .sanbrandan-grid {
    grid-template-columns: 1fr;
    gap: 2.2rem;
  }
  .sanbrandan-grid .image-wrapper {
    aspect-ratio: auto !important;
  }
  .sanbrandan-grid .image-wrapper img {
    height: auto !important;
    object-fit: contain !important;
  }
}

@media (max-width: 550px) {
  .white-canvas {
    padding: 1.5rem 1rem;
  }
  .adega-grid,
  .sanbrandan-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  .adega-grid {
    padding: 1.5rem 1rem;
  }
}



