/* =========================================================================
   LIFE IN 24-70 — sistema visual
   Editorial claro: papel crema, tipografía enorme, la foto manda.
   ========================================================================= */

:root {
  /* Color */
  --paper:      #F2EFEA;
  --paper-2:    #EAE6DF;
  --card:       #FFFFFF;
  --ink:        #14120F;
  --ink-soft:   #4A443C;
  --muted:      #8C8477;
  --line:       rgba(20, 18, 15, .13);
  --line-soft:  rgba(20, 18, 15, .07);
  --accent:     #C2472A;
  --accent-ink: #FFFFFF;
  --ok:         #2F7D5B;

  /* Radios: generosos, es lo que pide una UI moderna */
  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 24px;
  --r-xl: 32px;
  --r-pill: 999px;

  /* Ritmo */
  --gap:      clamp(10px, 1.4vw, 22px);
  --pad-x:    clamp(18px, 4vw, 64px);
  --nav-h:    68px;

  /* Sombras muy suaves: papel, no plástico */
  --sh-1: 0 1px 2px rgba(20,18,15,.05), 0 8px 24px rgba(20,18,15,.06);
  --sh-2: 0 2px 6px rgba(20,18,15,.07), 0 24px 60px rgba(20,18,15,.12);

  --ease: cubic-bezier(.22, 1, .36, 1);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  padding-bottom: env(safe-area-inset-bottom);
}

img { display: block; max-width: 100%; }
a   { color: inherit; text-decoration: none; }

::selection { background: var(--ink); color: var(--paper); }

/* --- Tipografía ---------------------------------------------------------- */

.display {
  font-family: 'Archivo', 'Inter', sans-serif;
  font-weight: 800;
  font-stretch: 112%;
  text-transform: uppercase;
  letter-spacing: -.02em;
  line-height: .88;
  margin: 0;
}

h1.display { font-size: clamp(2.6rem, 11vw, 9rem); }
h2.display { font-size: clamp(2rem, 6vw, 4.6rem); }
h3.display { font-size: clamp(1.3rem, 2.6vw, 2.1rem); }

.eyebrow {
  font-family: 'Archivo', sans-serif;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
}

.lede {
  font-size: clamp(1rem, 1.5vw, 1.2rem);
  color: var(--ink-soft);
  max-width: 62ch;
}

.mono {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: .78rem;
  letter-spacing: .02em;
  color: var(--muted);
}

/* --- Navegación ---------------------------------------------------------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: clamp(14px, 3vw, 40px);
  height: var(--nav-h);
  padding: 0 var(--pad-x);
  padding-top: env(safe-area-inset-top);
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(18px);
  -webkit-backdrop-filter: saturate(1.6) blur(18px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s var(--ease);
}
.nav.is-stuck { border-bottom-color: var(--line-soft); }

.nav__brand {
  font-family: 'Archivo', sans-serif;
  font-weight: 800;
  font-stretch: 112%;
  text-transform: uppercase;
  letter-spacing: -.01em;
  font-size: 1.02rem;
  white-space: nowrap;
}

.nav__links {
  display: flex;
  align-items: center;
  gap: clamp(12px, 2vw, 28px);
  margin-left: auto;
}

.nav__link {
  font-family: 'Archivo', sans-serif;
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 6px 0;
  position: relative;
  transition: color .25s var(--ease);
}
.nav__link:hover,
.nav__link.is-active { color: var(--ink); }
.nav__link.is-active::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: var(--ink);
}

/* En el móvil la navegación baja al pulgar, como en una app */
@media (max-width: 700px) {
  .nav {
    height: 56px;
    justify-content: center;
    /* Sin backdrop-filter: si no, la barra inferior se anclaría al header */
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: color-mix(in srgb, var(--paper) 94%, transparent);
  }
  .nav__brand { font-size: .95rem; }

  .nav__links {
    position: fixed;
    left: 50%;
    bottom: max(12px, env(safe-area-inset-bottom));
    transform: translateX(-50%);
    z-index: 90;
    margin: 0;
    display: flex;
    gap: 4px;
    padding: 5px;
    border: 1px solid var(--line);
    border-radius: var(--r-pill);
    background: color-mix(in srgb, var(--card) 88%, transparent);
    backdrop-filter: saturate(1.8) blur(20px);
    -webkit-backdrop-filter: saturate(1.8) blur(20px);
    box-shadow: var(--sh-2);
    max-width: calc(100vw - 24px);
    overflow-x: auto;
    scrollbar-width: none;
  }
  .nav__links::-webkit-scrollbar { display: none; }
  .nav__link {
    padding: 9px 15px;
    border-radius: var(--r-pill);
    font-size: .74rem;
    white-space: nowrap;
  }
  .nav__link.is-active { background: var(--ink); color: var(--paper); }
  .nav__link.is-active::after { display: none; }

  /* Con el enlace de admin son cuatro: se aprietan para que quepan */
  .nav__links:has(> :nth-child(4)) .nav__link { padding: 9px 11px; font-size: .68rem; }

  /* Sitio para la barra: que no tape el final de la página */
  body { padding-bottom: calc(74px + env(safe-area-inset-bottom)); }
}

/* --- Botones ------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 20px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: .9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .2s var(--ease), color .2s var(--ease),
              border-color .2s var(--ease), transform .18s var(--ease);
}
.btn:hover     { border-color: var(--ink); }
.btn:active    { transform: scale(.975); }
.btn--solid    { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn--solid:hover { background: #000; }
.btn--accent   { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn--ghost    { border-color: transparent; color: var(--muted); }
.btn--ghost:hover { color: var(--ink); background: var(--line-soft); border-color: transparent; }
.btn--sm       { min-height: 36px; padding: 0 14px; font-size: .82rem; }
.btn--danger   { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.btn--danger:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn[disabled] { opacity: .45; pointer-events: none; }

/* --- Campos -------------------------------------------------------------- */

.field { display: block; margin-bottom: 18px; }
.field__label {
  display: block;
  margin-bottom: 7px;
  font-family: 'Archivo', sans-serif;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}
.input, .textarea, .select {
  width: 100%;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--ink) 8%, transparent);
}
.textarea { min-height: 110px; resize: vertical; line-height: 1.6; }
.hint { margin: 6px 0 0; font-size: .82rem; color: var(--muted); }

/* --- Masonry ------------------------------------------------------------- */
/* El JS posiciona en absoluto respetando el orden; sin JS, cae a columnas. */

.masonry { position: relative; width: 100%; }

.masonry:not(.is-ready) {
  columns: 3 280px;
  column-gap: var(--gap);
}
.masonry:not(.is-ready) .tile {
  break-inside: avoid;
  margin-bottom: var(--gap);
}

.masonry.is-ready .tile {
  position: absolute;
  top: 0; left: 0;
  margin: 0;
  will-change: transform;
  transition: transform .5s var(--ease);
}
.masonry.is-ready.no-anim .tile { transition: none; }

.tile {
  position: relative;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--paper-2);
  cursor: zoom-in;
}

.tile__img {
  width: 100%;
  height: auto;
  display: block;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity .6s var(--ease);
}
.tile__img.is-loaded { opacity: 1; }

.tile__shade {
  position: absolute;
  inset: auto 0 0 0;
  padding: 40px 16px 14px;
  background: linear-gradient(transparent, rgba(0,0,0,.55));
  color: #fff;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .3s var(--ease), transform .3s var(--ease);
  pointer-events: none;
}
.tile:hover .tile__shade { opacity: 1; transform: none; }
.tile__title { font-size: .92rem; font-weight: 500; }
.tile__meta  { font-size: .74rem; opacity: .8; }

@media (hover: none) {
  .tile__shade { display: none; }
}

/* --- Lightbox ------------------------------------------------------------ */

.lb {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  place-items: center;
  background: color-mix(in srgb, var(--paper) 96%, #000);
  padding: clamp(12px, 3vw, 48px);
  padding-top: max(env(safe-area-inset-top), 12px);
  /* Hueco abajo para la ficha técnica: la foto nunca se le echa encima */
  padding-bottom: clamp(48px, 7vh, 72px);
}
.lb.is-open { display: grid; grid-template-rows: minmax(0, 1fr); animation: fade .28s var(--ease); }
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }

.lb__stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  /* Sin esto el contenido estira la celda y la foto se sale por abajo */
  min-height: 0;
  min-width: 0;
}
.lb__img {
  max-width: 100%;
  max-height: 100%;
  width: auto; height: auto;
  object-fit: contain;
  border-radius: var(--r-sm);
  box-shadow: var(--sh-2);
  animation: pop .4s var(--ease);
}
@keyframes pop { from { opacity: 0; transform: scale(.985) } to { opacity: 1; transform: none } }

.lb__bar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: flex-end;
  gap: 16px;
  padding: 14px 4px 0;
  pointer-events: none;
}
.lb__info { pointer-events: auto; }
.lb__caption { font-size: .95rem; margin: 0 0 2px; }

.lb__close, .lb__nav {
  position: absolute;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 52px; height: 52px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--paper) 80%, transparent);
  backdrop-filter: blur(10px);
  color: var(--ink);
  cursor: pointer;
  transition: background .2s var(--ease), transform .2s var(--ease);
}
.lb__close:hover, .lb__nav:hover { background: var(--ink); color: var(--paper); }
.lb__close { top: max(env(safe-area-inset-top), 10px); right: 0; }
.lb__nav--prev { left: 0;  top: 50%; transform: translateY(-50%); }
.lb__nav--next { right: 0; top: 50%; transform: translateY(-50%); }
.lb__nav--prev:hover { transform: translateY(-50%) scale(1.06); }
.lb__nav--next:hover { transform: translateY(-50%) scale(1.06); }
.lb__count {
  position: absolute;
  top: max(env(safe-area-inset-top), 24px); left: 4px;
  font-family: ui-monospace, monospace;
  font-size: .8rem;
  color: var(--muted);
}

@media (max-width: 700px) {
  .lb__nav { display: none; }         /* en móvil se navega deslizando */
}

/* --- Layout genérico ----------------------------------------------------- */

.wrap    { padding: 0 var(--pad-x); }
.section { padding-block: clamp(48px, 8vw, 120px); }
.stack   { display: grid; gap: 14px; }
.row     { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.spacer  { flex: 1; }

.divider { height: 1px; background: var(--line-soft); border: 0; margin: 0; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  font-size: .8rem;
  color: var(--ink-soft);
  background: transparent;
  cursor: pointer;
  transition: all .2s var(--ease);
}
.chip:hover, .chip.is-on { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.empty {
  padding: clamp(40px, 8vw, 90px) 24px;
  border: 1.5px dashed var(--line);
  border-radius: var(--r-xl);
  text-align: center;
  color: var(--muted);
}

/* --- Utilidades ---------------------------------------------------------- */

.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;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
