/* ============================================================
   SINGLE PROJECT — carloscastroarias.com style
   /wp-content/themes/astra-child/single-project.css
   ============================================================ */

:root {
  --sp-sidebar-width: 280px;
  --sp-font: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --sp-text: #000000;
  --sp-muted: #999999;
  --sp-border: #e8e8e8;
  --sp-topbar-h: 50px;
  --sp-transition: 0.2s ease;
}

body.single-project-page {
  margin: 0;
  padding: 0;
  background: #ffffff;
  -webkit-font-smoothing: antialiased;
}

body.single-project-page #masthead,
body.single-project-page #colophon,
body.single-project-page .ast-above-header-wrap,
body.single-project-page .ast-below-header-wrap {
  display: none !important;
}

body.single-project-page #page {
  padding: 0 !important;
  margin: 0 !important;
}

/* ── Wrapper ────────────────────────────────────────────────── */
.sp-wrapper {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* ── SIDEBAR ────────────────────────────────────────────────── */
.sp-sidebar {
  width: var(--sp-sidebar-width);
  min-width: var(--sp-sidebar-width);
  background: #ffffff;
  border-right: 1px solid var(--sp-border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  z-index: 100;
  transition: transform var(--sp-transition);
}

.sp-sidebar::-webkit-scrollbar { display: none; }

/* ── Navegación global ──────────────────────────────────────── */
.sp-nav {
  padding: 36px 28px 0;
}

.sp-nav__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sp-nav__list li { margin: 0; }

.sp-nav__list a {
  display: block;
  padding: 5px 0;
  font-family: var(--sp-font);
  font-size: 11px;
  font-weight: 400;
  color: #000000;
  text-decoration: none;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: color var(--sp-transition);
  line-height: 1.4;
}

.sp-nav__list a:hover { color: #888888; }

.sp-nav__list .current-menu-item > a,
.sp-nav__list .current_page_item > a {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

/* ── Separador ──────────────────────────────────────────────── */
.sp-sidebar__divider {
  margin: 24px 28px;
  border: none;
  border-top: 1px solid var(--sp-border);
}

/* ── Información del proyecto ───────────────────────────────── */
.sp-project-info {
  padding: 0 28px;
  flex: 1;
}

/* Volver a proyectos */
.sp-back-link {
  display: inline-block;
  font-family: var(--sp-font);
  font-size: 10px;
  font-weight: 400;
  color: var(--sp-muted);
  text-decoration: none;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 20px;
  transition: color var(--sp-transition);
}

.sp-back-link:hover { color: #000000; }

/* Título del proyecto */
.sp-project-title {
  font-family: var(--sp-font);
  font-size: 13px;
  font-weight: 400;
  color: #000000;
  line-height: 1.4;
  margin: 0 0 16px;
  letter-spacing: 0.01em;
}

/* Descripción larga */
.sp-project-description {
  font-family: var(--sp-font);
  font-size: 12px;
  font-weight: 400;
  color: #333333;
  line-height: 1.75;
  margin-bottom: 20px;
}

.sp-project-description p {
  margin: 0 0 10px;
}

.sp-project-description p:last-child { margin-bottom: 0; }

/* Metadatos: definición list */
.sp-project-meta {
  margin: 0;
  padding: 0;
  font-family: var(--sp-font);
  font-size: 11px;
  line-height: 1.6;
  letter-spacing: 0.02em;
  border-top: 1px solid var(--sp-border);
  padding-top: 16px;
  margin-top: 16px;
}

.sp-project-meta dt {
  font-weight: 400;
  color: var(--sp-muted);
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.08em;
  margin-top: 10px;
}

.sp-project-meta dt:first-child { margin-top: 0; }

.sp-project-meta dd {
  margin: 2px 0 0 0;
  color: #000000;
  font-size: 11px;
}

/* ── Selector de idioma ─────────────────────────────────────── */
.sp-lang {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 20px 28px 28px;
  font-family: var(--sp-font);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #cccccc;
  margin-top: auto;
}

.sp-lang a {
  color: #cccccc;
  text-decoration: none;
  transition: color var(--sp-transition);
}

.sp-lang a:hover,
.sp-lang a.active { color: #000000; }

/* Botón cerrar mobile */
.sp-sidebar__close {
  display: none;
  position: absolute;
  top: 14px;
  right: 14px;
  background: none;
  border: none;
  cursor: pointer;
  color: #000000;
  padding: 4px;
  opacity: 0.4;
  transition: opacity var(--sp-transition);
}

.sp-sidebar__close:hover { opacity: 1; }

/* ── Overlay mobile ─────────────────────────────────────────── */
.sp-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.85);
  z-index: 99;
  opacity: 0;
  transition: opacity var(--sp-transition);
  pointer-events: none;
}

.sp-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}

/* ── CONTENIDO — galería ────────────────────────────────────── */
.sp-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: #ffffff;
}

/* Topbar mobile */
.sp-topbar {
  display: none;
  align-items: center;
  gap: 12px;
  height: var(--sp-topbar-h);
  padding: 0 20px;
  border-bottom: 1px solid var(--sp-border);
  position: sticky;
  top: 0;
  z-index: 50;
  background: #ffffff;
}

.sp-topbar__toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: #000000;
  padding: 4px;
  display: flex;
  align-items: center;
  opacity: 0.6;
  transition: opacity var(--sp-transition);
}

.sp-topbar__toggle:hover { opacity: 1; }

.sp-topbar__title {
  font-family: var(--sp-font);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #000000;
}

/* ── Galería de imágenes ────────────────────────────────────── */
.sp-gallery {
  padding: 0;
}

.sp-gallery--empty {
  padding: 60px 40px;
  font-family: var(--sp-font);
  font-size: 12px;
  color: var(--sp-muted);
}

.sp-gallery__item {
  margin: 0;
  padding: 0;
  display: block;
  /* Igual que el sitio original: imágenes apiladas una sobre otra */
  border-bottom: 1px solid var(--sp-border);
}

.sp-gallery__item:last-child {
  border-bottom: none;
}

.sp-gallery__item a {
  display: block;
  line-height: 0; /* evitar espacio bajo la imagen */
  cursor: zoom-in;
}

.sp-gallery__item img {
  width: 100%;
  height: auto;
  display: block;
  transition: opacity 0.3s ease;
}

.sp-gallery__item a:hover img {
  opacity: 0.92;
}

/* Caption bajo cada imagen — estilo del sitio original */
.sp-gallery__caption {
  font-family: var(--sp-font);
  font-size: 10px;
  font-weight: 400;
  color: var(--sp-muted);
  letter-spacing: 0.04em;
  padding: 10px 20px 14px;
  line-height: 1.5;
  margin: 0;
}

/* ── Imagen destacada sola (modo B y C) ─────────────────────── */
.sp-featured-image {
  line-height: 0;
  border-bottom: 1px solid var(--sp-border);
}

.sp-featured-image a { display: block; cursor: zoom-in; }

.sp-featured-image img {
  width: 100%;
  height: auto;
  display: block;
  transition: opacity 0.3s ease;
}

.sp-featured-image a:hover img { opacity: 0.92; }

/* ── Modo B: contenido del editor de WordPress ───────────────── */
/* Permite que las imágenes que insertas en Gutenberg/Classic
   tengan el mismo estilo apilado que la galería ACF */
.sp-wp-content {
  /* reset estilos de WordPress que no queremos */
}

.sp-wp-content p { margin: 0; }

/* Imágenes sueltas insertadas en el editor */
.sp-wp-content figure.wp-block-image,
.sp-wp-content .wp-block-image {
  margin: 0;
  padding: 0;
  border-bottom: 1px solid var(--sp-border);
  line-height: 0;
}

.sp-wp-content figure.wp-block-image img,
.sp-wp-content .wp-block-image img {
  width: 100%;
  height: auto;
  display: block;
  transition: opacity 0.3s ease;
}

.sp-wp-content figure.wp-block-image img:hover,
.sp-wp-content .wp-block-image img:hover { opacity: 0.92; }

/* Caption en bloques de imagen del editor */
.sp-wp-content figure.wp-block-image figcaption,
.sp-wp-content .wp-block-image figcaption {
  font-family: var(--sp-font);
  font-size: 10px;
  color: var(--sp-muted);
  letter-spacing: 0.04em;
  padding: 10px 20px 14px;
  line-height: 1.5;
  text-align: left;
}

/* Galería nativa de WordPress (bloque Gallery) */
.sp-wp-content .wp-block-gallery {
  margin: 0;
  padding: 0;
  gap: 1px !important;
}

.sp-wp-content .wp-block-gallery figure {
  margin: 0;
}

.sp-wp-content .wp-block-gallery img {
  transition: opacity 0.3s ease;
}

.sp-wp-content .wp-block-gallery img:hover { opacity: 0.92; }

/* Texto en el editor (si lo hay) — padding para que respire */
.sp-wp-content > p,
.sp-wp-content > h2,
.sp-wp-content > h3,
.sp-wp-content > ul,
.sp-wp-content > ol {
  padding: 20px 28px;
  font-family: var(--sp-font);
  font-size: 12px;
  line-height: 1.75;
  color: #333333;
  margin: 0;
}

/* ── GLightbox overrides para match con el sitio ────────────── */
.glightbox-clean .gclose {
  background: none !important;
}

.glightbox-clean .gdesc-inner {
  font-family: var(--sp-font) !important;
  font-size: 11px !important;
  letter-spacing: 0.04em !important;
}

/* ── Tablet ─────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  :root { --sp-sidebar-width: 240px; }

  .sp-nav { padding: 28px 20px 0; }
  .sp-project-info { padding: 0 20px; }
  .sp-sidebar__divider { margin: 20px; }
  .sp-lang { padding: 16px 20px 24px; }
}

/* ── Mobile ─────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sp-topbar { display: flex; }

  .sp-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    width: 280px;
    min-width: 280px;
    transform: translateX(-100%);
    z-index: 200;
  }

  .sp-sidebar.is-open {
    transform: translateX(0);
    box-shadow: 2px 0 16px rgba(0,0,0,0.06);
  }

  .sp-sidebar__close { display: flex; }
  .sp-overlay { display: block; }
}
