/* =========================================================
   Pablo Morales · web de artista
   Crema y oro viejo. Se entra directamente a la obra.
   Referencia de estructura: ficha de artista de Alarcón Criado.
   ========================================================= */

/* ---------- 1. Tokens ---------- */
:root {
  --paper:    #F7F2E7;   /* fondo general, crema */
  --cream:    #EFE6D2;   /* banda de migas, bloques */
  --cream-2:  #E7DAC0;   /* paspartú del PDF */
  --gold:     #B8975A;   /* oro viejo: filetes y marcos (decorativo, no texto) */
  --gold-ink: #7D6228;   /* oro legible para texto pequeño (contraste AA sobre crema) */
  --wine:     #6E2B2B;   /* burdeos: marco de la serie Devoción carnal */
  --line:     #DCCFB4;   /* filetes neutros */
  --ink:      #2E2820;   /* texto */
  --ink-2:    #5C5245;   /* texto secundario */

  --serif: 'Cormorant Garamond', 'Iowan Old Style', Georgia, serif;
  --sans:  'Sora', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --container: 1180px;
  --gutter: clamp(20px, 5vw, 48px);
  --space: clamp(56px, 8vw, 104px);

  --t: 260ms ease;
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 300;
  font-size: 0.95rem;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}
main { flex: 1; }

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; margin: 0; padding: 0; }
h1, h2, h3, p, figure { margin: 0; }

:focus-visible { outline: 1px solid var(--gold-ink); outline-offset: 4px; }

.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link { position: absolute; left: -9999px; top: 0; }
.skip-link:focus { left: var(--gutter); top: 12px; z-index: 10; background: var(--paper); padding: 8px 12px; }

.eyebrow {
  font-size: 0.66rem; font-weight: 400; letter-spacing: 0.26em; text-transform: uppercase;
  color: var(--gold-ink);
}

/* Texto provisional: visible a propósito para no publicarlo por error */
.pending { color: var(--ink-2); border-bottom: 1px dashed var(--gold); }

/* Enlace de texto discreto */
.link { border-bottom: 1px solid var(--gold); transition: color var(--t), border-color var(--t); }
.link:hover { color: var(--gold-ink); border-color: var(--gold-ink); }

/* ---------- 3. Cabecera ---------- */
.site-header { border-bottom: 1px solid var(--gold); }
.header__inner {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
  gap: 10px 32px; padding-block: 26px;
}
.brand {
  font-size: 0.76rem; font-weight: 400; letter-spacing: 0.32em; text-transform: uppercase;
}
.nav ul { display: flex; flex-wrap: wrap; gap: 6px 28px; }
.nav a {
  font-size: 0.66rem; font-weight: 400; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--ink-2); padding-block: 4px; border-bottom: 1px solid transparent;
  transition: color var(--t), border-color var(--t);
}
.nav a:hover { color: var(--gold-ink); }
.nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--gold); }

/* Banda de migas, como la franja de título de la referencia */
.crumbs { background: var(--cream); border-bottom: 1px solid var(--line); }
.crumbs ol {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 10px;
  margin-block: 0; padding-block: 20px;
  font-size: 0.66rem; letter-spacing: 0.22em; text-transform: uppercase; color: var(--ink-2);
}
.crumbs li + li::before { content: "/"; margin-right: 10px; color: var(--gold); }
.crumbs a:hover { color: var(--gold-ink); }
.crumbs [aria-current] { color: var(--gold-ink); }

/* ---------- 4. Secciones ---------- */
.section { padding-block: var(--space); }

/* ---------- 5. Obra (portada): mosaico de cuadrados ---------- */
/* 6 columnas (2 en móvil). Obras únicas en 2 × 2; obras de serie en 1 × 1 con marco del color de su serie. */
.mosaic { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-flow: row dense; gap: 6px; }
@media (min-width: 640px)  { .mosaic { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; } }
@media (min-width: 1040px) { .mosaic { gap: 10px; } }

.tile { transition: opacity var(--t); }
.tile--lg { grid-column: span 2; grid-row: span 2; }

.tile__link { position: relative; display: block; aspect-ratio: 1; overflow: hidden; background: var(--cream); }
.tile--lg .tile__link { aspect-ratio: auto; height: 100%; }
.tile__link img { width: 100%; height: 100%; object-fit: cover; transition: transform 700ms ease; }
.tile__link:hover img { transform: scale(1.03); }

/* Marco de serie: dorado para Vía Dolorosa, burdeos para Devoción carnal */
.tile[data-series="vd"], .index li[data-series="vd"] { --series: var(--gold); }
.tile[data-series="dc"], .index li[data-series="dc"] { --series: var(--wine); }
.tile[data-series] .tile__link { padding: 5px; background: var(--series); }
.tile[data-series] .tile__link img { display: block; }

/* Al pasar por una obra (o por su línea del índice) se atenúa lo que no es de su serie */
.obra:has(.tile[data-series="vd"] .tile__link:hover, .index li[data-series="vd"]:hover) .tile:not([data-series="vd"]),
.obra:has(.tile[data-series="dc"] .tile__link:hover, .index li[data-series="dc"]:hover) .tile:not([data-series="dc"]) { opacity: 0.3; }

/* Velo crema con filete dorado y el nombre de la obra */
.tile__text {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  padding: 16px; text-align: center;
  background: rgb(247 242 231 / 0.9);
  box-shadow: inset 0 0 0 8px rgb(247 242 231 / 0.9), inset 0 0 0 9px var(--gold);
  opacity: 0; transition: opacity var(--t);
}
.tile[data-series] .tile__text { inset: 5px; }
.tile__link:hover .tile__text, .tile__link:focus-visible .tile__text { opacity: 1; }
.tile__title { font-family: var(--serif); font-style: italic; font-size: clamp(1.05rem, 1.6vw, 1.35rem); line-height: 1.2; }
.tile--lg .tile__title { font-size: clamp(1.3rem, 2.4vw, 1.9rem); }
.tile__project { font-size: 0.58rem; letter-spacing: 0.22em; text-transform: uppercase; color: var(--gold-ink); }

/* Índice de proyectos + leyenda de colores de serie */
.index { margin-top: clamp(56px, 8vw, 96px); max-width: 720px; }
.index__list { margin-top: 12px; border-top: 1px solid var(--gold); }
.index__list li {
  display: grid; grid-template-columns: 22px 1fr auto; align-items: baseline; gap: 12px;
  padding-block: 12px; border-bottom: 1px solid var(--line);
}
.swatch { width: 14px; height: 14px; align-self: center; }
.index li[data-series] .swatch { border: 4px solid var(--series); }
.index__list a { font-family: var(--serif); font-style: italic; font-size: 1.3rem; transition: color var(--t); }
.index__list a:hover { color: var(--gold-ink); }
.index__list li > span:last-child { font-size: 0.74rem; color: var(--gold-ink); text-align: right; }

/* ---------- 6. Biografía ---------- */
.bio { display: grid; gap: 40px; align-items: start; }
@media (min-width: 760px) { .bio { grid-template-columns: 4fr 7fr; gap: clamp(40px, 7vw, 96px); } }
.bio__photo {
  padding: 10px; background: var(--cream); border: 1px solid var(--gold);
}
.bio__photo img {
  width: 100%; aspect-ratio: 4 / 5; object-fit: cover; object-position: center 18%;
  filter: grayscale(1) sepia(0.18);
}
.bio__text {
  font-family: var(--serif); font-size: clamp(1.3rem, 2.4vw, 1.6rem); line-height: 1.5;
  max-width: 46ch; margin-top: 14px;
}
.cv { margin-top: 48px; }
.cv h2 { margin: 36px 0 10px; }
.cv ul { border-top: 1px solid var(--gold); }
.cv li {
  display: grid; grid-template-columns: 5rem 1fr; gap: 16px;
  padding-block: 12px; border-bottom: 1px solid var(--line); font-size: 0.88rem;
}
.cv time { color: var(--gold-ink); }
.cv em { font-family: var(--serif); font-size: 1.1rem; font-style: italic; }

.contact { display: grid; justify-items: start; gap: 6px; margin-top: 10px; font-size: 0.9rem; }

/* ---------- 7. Pie ---------- */
.site-footer { border-top: 1px solid var(--gold); background: var(--cream); }
.footer__inner {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px;
  padding-block: 26px;
  font-size: 0.66rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-2);
}

/* ---------- 8. Página de proyecto ---------- */
.project-head { display: grid; gap: 24px; margin-bottom: clamp(48px, 7vw, 88px); }
@media (min-width: 860px) { .project-head { grid-template-columns: 5fr 6fr; gap: clamp(40px, 7vw, 96px); align-items: end; } }
.project-head__title {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(2.4rem, 5.5vw, 4rem); line-height: 1.02;
}
.project-head__meta { margin-top: 16px; }
.project-head__text { max-width: 48ch; }
.project-head__text p + p { margin-top: 12px; }
.project-head__note { font-size: 0.8rem; color: var(--ink-2); }

/* Rejilla de estaciones: 2 → 3 → 4 columnas */
.works { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 40px 16px; }
@media (min-width: 720px)  { .works { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 48px 24px; } }
@media (min-width: 1040px) { .works { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 56px 28px; } }

.work__link { display: block; background: var(--cream); }
.work__link img {
  width: 100%; aspect-ratio: 3 / 4; object-fit: cover;
  transition: opacity var(--t);
}
.work__link:hover img { opacity: 0.88; }
.work__cap {
  display: flex; align-items: baseline; gap: 10px;
  margin-top: 12px; font-size: 0.78rem; line-height: 1.4; color: var(--ink-2);
}
.work__num {
  flex: none; min-width: 1.9em;
  font-family: var(--serif); font-style: italic; font-size: 1.2rem; color: var(--gold-ink);
}

/* Hueco del PDF: bloque crema con doble filete dorado, como un paspartú */
.work--doc .work__link {
  display: flex; flex-direction: column; justify-content: center; gap: 10px;
  aspect-ratio: 3 / 4; padding: clamp(18px, 2.6vw, 30px); text-align: center;
  background: var(--cream-2);
  box-shadow: inset 0 0 0 8px var(--cream-2), inset 0 0 0 9px var(--gold);
  transition: background var(--t), box-shadow var(--t);
}
.work--doc .work__link:hover {
  background: var(--cream);
  box-shadow: inset 0 0 0 8px var(--cream), inset 0 0 0 9px var(--gold-ink);
}
.doc__kicker { font-size: 0.62rem; letter-spacing: 0.26em; text-transform: uppercase; color: var(--gold-ink); }
.doc__title { font-family: var(--serif); font-style: italic; font-size: clamp(1.2rem, 2.1vw, 1.6rem); line-height: 1.2; }
.doc__meta { font-size: 0.7rem; color: var(--ink-2); }

.back { margin-top: clamp(56px, 8vw, 96px); font-size: 0.8rem; }

/* ---------- 8b. Obras con texto (Devoción carnal, Colombinas) ---------- */
.dc { display: grid; gap: 28px; align-items: start; scroll-margin-top: 24px; }
.dc + .dc { margin-top: clamp(64px, 10vw, 120px); padding-top: clamp(64px, 10vw, 120px); border-top: 1px solid var(--gold); }
@media (min-width: 900px) { .dc { grid-template-columns: 7fr 5fr; gap: clamp(40px, 6vw, 80px); } }

.dc__media { display: block; }
.dc__gallery { display: grid; gap: 16px; }
.dc__media img { width: auto; max-width: 100%; max-height: 88vh; margin-inline: auto; transition: opacity var(--t); }
.dc__media:hover img { opacity: 0.92; }

@media (min-width: 900px) { .dc__text { position: sticky; top: 32px; } }
.dc__title { font-family: var(--serif); font-weight: 400; font-size: clamp(2.2rem, 4.5vw, 3.2rem); line-height: 1; }
.dc__sub { margin-top: 10px; font-size: 0.8rem; color: var(--ink-2); }

.dc__quote {
  margin: 28px 0 0; padding-left: 18px; border-left: 1px solid var(--gold);
  font-family: var(--serif); font-style: italic; font-size: 1.15rem; line-height: 1.55;
}
.dc__quote + .dc__quote { margin-top: 20px; }
.dc__quote p + p { margin-top: 12px; }
.dc__quote sup { margin-right: 4px; font-family: var(--sans); font-style: normal; font-size: 0.6rem; color: var(--gold-ink); }
.dc__quote cite { display: block; margin-top: 10px; font-family: var(--sans); font-style: normal; font-size: 0.74rem; line-height: 1.5; color: var(--ink-2); }

.dc__body { margin-top: 24px; }
.dc__body p + p { margin-top: 12px; }
.dc__note { margin-top: 24px; font-size: 0.9rem; }
.dc__ficha {
  margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--line);
  font-size: 0.8rem; line-height: 1.7; color: var(--ink-2);
}

/* ---------- 9. Visor ---------- */
.viewer {
  width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0;
  background: rgb(247 242 231 / 0.985); color: var(--ink);
}
.viewer::backdrop { background: rgb(247 242 231 / 0.985); }
.viewer[open] { display: grid; grid-template-rows: auto 1fr auto; }

.viewer__bar {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: calc(16px + env(safe-area-inset-top, 0px)) var(--gutter) 16px;
}
.viewer__count { font-size: 0.66rem; letter-spacing: 0.22em; color: var(--gold-ink); }

.viewer__stage {
  position: relative; min-height: 0;
  display: flex; align-items: center; justify-content: center;
  padding-inline: clamp(8px, 7vw, 96px);
}
.viewer__img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; }

.viewer__caption {
  max-width: 62ch; margin-inline: auto; text-align: center;
  padding: 18px var(--gutter) calc(22px + env(safe-area-inset-bottom, 0px));
  font-size: 0.8rem; line-height: 1.6; color: var(--ink-2);
}
.viewer__caption .work__num { display: block; margin-bottom: 2px; font-size: 1.6rem; }
.viewer__caption .work__episode { font-family: var(--serif); font-style: italic; font-size: 1.1rem; color: var(--ink); margin-bottom: 6px; }

.viewer__btn {
  background: none; border: 0; padding: 10px 4px; cursor: pointer; color: var(--ink);
  font-family: var(--sans); font-size: 0.66rem; font-weight: 400; letter-spacing: 0.22em; text-transform: uppercase;
}
.viewer__btn:hover { color: var(--gold-ink); }
.viewer__nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 48px; height: 72px; font-family: var(--serif); font-size: 2.4rem; letter-spacing: 0; color: var(--gold-ink);
}
.viewer__nav--prev { left: max(4px, calc(var(--gutter) - 20px)); }
.viewer__nav--next { right: max(4px, calc(var(--gutter) - 20px)); }
@media (max-width: 640px) { .viewer__nav { background: rgb(247 242 231 / 0.75); width: 40px; } }

/* ---------- 10. Aparición suave ---------- */
.reveal { opacity: 0; transform: translateY(10px); transition: opacity 700ms ease, transform 700ms ease; }
.reveal.is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  * { transition-duration: 1ms !important; }
}

/* Correo e Instagram en el pie: sin mayúsculas forzadas */
.footer__inner a { text-transform: none; letter-spacing: 0.04em; }

/* Enlace a un documento (currículum, memorias) */
.bio__cv { margin-top: 24px; }
.doc-link {
  display: inline-flex; align-items: baseline; gap: 10px;
  padding: 10px 18px; border: 1px solid var(--gold);
  font-size: 0.66rem; letter-spacing: 0.22em; text-transform: uppercase;
  transition: background var(--t), color var(--t), border-color var(--t);
}
.doc-link:hover { background: var(--cream); color: var(--gold-ink); border-color: var(--gold-ink); }
.doc-link small { font-size: 0.58rem; letter-spacing: 0.14em; color: var(--ink-2); }


/* ---------- 11. Obras sueltas: colgadas como en una pared ----------
   Lo contrario del mosaico: tamaños distintos, alturas desiguales y una
   inclinación mínima, para que se lean como piezas que no forman serie. */
.loose { margin-top: clamp(72px, 10vw, 128px); }
.loose__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 18px; margin-bottom: clamp(28px, 4vw, 48px); }
.loose__note { font-size: 0.8rem; color: var(--ink-2); }

.wall { display: grid; grid-template-columns: repeat(12, 1fr); gap: clamp(18px, 3vw, 40px); align-items: center; }
.wall__link { display: block; transition: transform var(--t), opacity var(--t); }
.wall__link img { width: 100%; box-shadow: 0 10px 26px rgb(46 40 32 / 0.10); }
.wall__link:hover { opacity: 0.94; }

.wall__item:nth-child(1) { grid-column: span 3; align-self: end; }
.wall__item:nth-child(2) { grid-column: span 4; align-self: start; }
.wall__item:nth-child(3) { grid-column: span 5; align-self: center; }
.wall__item:nth-child(4) { grid-column: span 4; align-self: end; }
.wall__item:nth-child(5) { grid-column: span 3; align-self: start; }
.wall__item:nth-child(6) { grid-column: span 5; align-self: center; }

.wall__item:nth-child(1) .wall__link { transform: rotate(-1.1deg); }
.wall__item:nth-child(2) .wall__link { transform: rotate(0.8deg); }
.wall__item:nth-child(3) .wall__link { transform: rotate(-0.5deg); }
.wall__item:nth-child(4) .wall__link { transform: rotate(1deg); }
.wall__item:nth-child(5) .wall__link { transform: rotate(-0.8deg); }
.wall__item:nth-child(6) .wall__link { transform: rotate(0.6deg); }
.wall__link:hover { transform: rotate(0deg) translateY(-4px); }

@media (max-width: 720px) {
  .wall { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
  .wall__item:nth-child(n) { grid-column: span 1; align-self: start; }
  .wall__item:nth-child(3), .wall__item:nth-child(6) { grid-column: span 2; }
}
@media (prefers-reduced-motion: reduce) { .wall__link, .wall__link:hover { transform: none; } }
