/* ==========================================================================
   Base: reset, tipografía, layout, motion
   ========================================================================== */

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 5rem; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img, svg, video { display: block; max-width: 100%; height: auto; }
img { color: transparent; }

h1, h2, h3, h4, p, figure, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }

h1, h2, h3, .display {
  font-family: var(--font-display);
  font-weight: 400;
  color: var(--text-strong);
  line-height: var(--leading-tight);
  letter-spacing: -0.01em;
}
h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
.italic { font-style: italic; }

p { max-width: var(--measure); }
p + p { margin-top: 1em; }

a { color: inherit; text-decoration: none; }
a:hover { color: var(--text-strong); }

button, input, select, textarea { font: inherit; color: inherit; margin: 0; }
button { background: none; border: 0; padding: 0; cursor: pointer; }

/* El contorno del foco se adapta al fondo: sobre las superficies oscuras
   (el bloque final, la confirmación, el visor de fotos) un contorno color
   tinta es invisible y quien navega con teclado se pierde. */
:focus-visible { outline: 2px solid var(--focus-ring, var(--ink)); outline-offset: 3px; border-radius: var(--radius-xs); }
.cta, .done, .lightbox { --focus-ring: var(--ivory); }
:focus:not(:focus-visible) { outline: none; }
::selection { background: var(--accent-soft); color: var(--ink); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0; margin: -1px;
}

/* --- Layout --- */
.container {
  width: 100%;
  max-width: calc(var(--content) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.section { padding-block: var(--section-y); }
.muted { color: var(--text-muted); }
.small { font-size: var(--text-sm); }

/* --- Imagen con placeholder ---
   Mientras carga (o si falla) se ve una superficie cálida con un brillo lento;
   al cargar, la foto aparece con fundido y termina un leve acercamiento. */
.ph { position: relative; background: var(--sand); overflow: hidden; }
.ph::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(110deg, var(--sand) 25%, var(--porcelain) 50%, var(--sand) 75%);
  background-size: 250% 100%;
  animation: ph-shimmer 2.8s var(--ease-in-out) infinite;
}
@keyframes ph-shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.ph > img {
  position: relative;
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0; transform: scale(1.04);
  transition: opacity 900ms var(--ease-out), transform 1600ms var(--ease-out);
}
.ph > img.is-loaded { opacity: 1; transform: none; }
.ph > img.is-error { display: none; }
.ph.is-ready::before { animation: none; }
/* Hueco sin foto cargada todavía: superficie lisa, sin brillo ni destello,
   para que se lea como parte del diseño y no como algo roto. */
.ph--vacio::before { animation: none; background: var(--sand); }

/* --- Apariciones --- */
.reveal {
  opacity: 0; transform: translateY(18px);
  transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out);
  transition-delay: calc(var(--d, 0) * 90ms);
}
.reveal.is-visible { opacity: 1; transform: none; }

.reveal-img { clip-path: inset(100% 0 0 0); }
.reveal-img > img { transform: scale(1.08); transition: transform 1400ms var(--ease-out), opacity var(--dur-slow) var(--ease-out); }
.reveal-img.is-visible { clip-path: inset(0 0 0 0); transition: clip-path 1100ms var(--ease-in-out); }
.reveal-img.is-visible > img { transform: none; }

.reveal-line { position: relative; padding-bottom: var(--s-3); }
.reveal-line::after {
  content: ""; position: absolute; left: 0; bottom: 0;
  width: 3rem; height: 1px; background: var(--accent);
  transform: scaleX(0); transform-origin: left;
  transition: transform 900ms var(--ease-out) 200ms;
}
.reveal-line.is-visible::after { transform: scaleX(1); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal, .reveal-img { opacity: 1; transform: none; clip-path: none; }
  .reveal-line::after { transform: none; }
}
