/* Villa Mar: misma base que Villa Montgó, con acento azul mar (la casa mira al Mediterráneo). *
   escenario oscuro fijo; el resto de la página es sobrio, de texto corto y aire. */
:root {
  --bg: #ecede8;          /* caliza clara */
  --surface: #e1e3dd;
  --ink: #1c201e;
  --muted: #59605c;
  --line: #c9ccc5;
  --accent: #2c5f78;      /* azul del Mediterráneo visto desde la casa */
  --stage: #0d100f;       /* escenario del recorrido, siempre oscuro */
  --stage-ink: #eceee9;
  --stage-muted: #a3aaa6;
  --font-display: "Marcellus", "Optima", "Candara", Georgia, serif;
  --font-body: "Hanken Grotesk", "Helvetica Neue", Arial, sans-serif;
  --font-data: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --gutter: clamp(16px, 4vw, 56px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121514; --surface: #1a1e1c; --ink: #e5e8e3; --muted: #9aa29d;
    --line: #2c322f; --accent: #86b6cc; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121514; --surface: #1a1e1c; --ink: #e5e8e3; --muted: #9aa29d;
  --line: #2c322f; --accent: #86b6cc; color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: auto; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1rem/1.6 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
img, video { max-width: 100%; display: block; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

.skip-to-content {
  position: absolute; left: var(--gutter); top: -100px; z-index: 50;
  background: var(--ink); color: var(--bg); padding: .5rem .9rem; text-decoration: none;
}
.skip-to-content:focus { top: calc(env(safe-area-inset-top, 0px) + 8px); }

/* Cabecera */
.site-header {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  padding: 1.1rem var(--gutter);
  border-bottom: 1px solid var(--line);
}
.brand { font: 400 1.05rem/1 var(--font-display); letter-spacing: .14em; text-transform: uppercase; text-decoration: none; }
.crumb { font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }

/* ---------- Recorrido ---------- */
.recorrido { position: relative; background: var(--stage); color: var(--stage-ink); }
.r-stage {
  position: sticky; top: 0;
  height: 100vh; height: 100svh;
  display: grid; grid-template-rows: 1fr auto;
  overflow: hidden;
}
.r-frame { position: relative; display: grid; place-items: center; min-height: 0; }
.r-media {
  position: relative; width: 100%; max-height: 100%;
  aspect-ratio: 16 / 9;
  max-width: calc((100svh - 5.5rem) * 16 / 9);
}
.r-media video, .r-media .r-poster {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: contain; background: var(--stage);
}
.r-poster { transition: opacity .35s ease; }
.recorrido[data-state="ready"] .r-poster { opacity: 0; pointer-events: none; }

.r-intro {
  position: absolute; inset: 0; z-index: 2;
  display: grid; align-content: end; gap: .35rem;
  padding: 0 var(--gutter) clamp(1.5rem, 7vh, 4.5rem);
  background: linear-gradient(to top, rgb(13 16 15 / .72), rgb(13 16 15 / 0) 55%);
  pointer-events: none;
  will-change: opacity, transform;
}
.r-intro h1 {
  margin: 0; font: 400 clamp(2.6rem, 8vw, 6.5rem)/.95 var(--font-display);
  letter-spacing: .04em; text-wrap: balance;
}
.r-intro .r-lead { margin: 0; font-size: clamp(1.05rem, 2.2vw, 1.4rem); letter-spacing: .02em; }
.r-intro .r-hint {
  margin: .9rem 0 0; display: flex; align-items: center; gap: .6rem;
  font-size: .78rem; letter-spacing: .16em; text-transform: uppercase; color: var(--stage-muted);
}
.r-hint::before { content: ""; width: 1px; height: 2.2rem; background: currentColor; opacity: .7; }

/* Barra inferior: progreso, tramo, tiempo y enlaces */
.r-controls {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: .6rem 1.5rem;
  padding: .85rem var(--gutter) calc(.95rem + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid rgb(236 238 233 / .12);
  font-size: .8rem;
}
.r-track { grid-column: 1 / -1; position: relative; height: 2px; background: rgb(236 238 233 / .18); }
.r-bar { position: absolute; inset: 0; background: var(--stage-ink); transform-origin: left; transform: scaleX(0); }
.r-ticks { position: absolute; inset: -3px 0; }
.r-tick { position: absolute; top: 0; width: 1px; height: 8px; background: rgb(236 238 233 / .55); }
.r-now { display: flex; gap: 1rem; align-items: baseline; min-width: 0; }
.r-chapter { letter-spacing: .12em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r-time { font: 400 .75rem/1 var(--font-data); color: var(--stage-muted); font-variant-numeric: tabular-nums; }
.r-actions { display: flex; gap: 1.25rem; align-items: center; }
.r-actions a, .r-actions button {
  font: inherit; color: var(--stage-ink); background: none; border: 0; padding: .25rem 0; cursor: pointer;
  letter-spacing: .1em; text-transform: uppercase; text-decoration: underline; text-underline-offset: .3em;
  text-decoration-color: rgb(236 238 233 / .4);
}
.r-actions a:hover, .r-actions button:hover { text-decoration-color: currentColor; }
.r-status { font-size: .78rem; color: var(--stage-muted); }
.r-status:empty { display: none; }
.r-slow { color: var(--stage-ink); }
.recorrido[data-state="error"] .r-status { color: var(--stage-ink); }

/* Reproducción convencional (movimiento reducido, error o elección del visitante) */
.r-fallback { background: var(--stage); color: var(--stage-ink); padding-block: clamp(2rem, 6vw, 4rem); padding-inline: var(--gutter); }
.r-fallback-inner { max-width: 1200px; margin: 0 auto; display: grid; gap: 1rem; }
.r-fallback h1 { margin: 0; font: 400 clamp(2.2rem, 6vw, 4.5rem)/1 var(--font-display); letter-spacing: .04em; }
.r-fallback p { margin: 0; color: var(--stage-muted); }
.r-fallback video { width: 100%; aspect-ratio: 16 / 9; background: #000; }

/* ---------- Secciones siguientes ---------- */
.section {
  padding-block: clamp(3.5rem, 9vw, 7rem); padding-inline: var(--gutter);
  border-bottom: 1px solid var(--line);
}
.section-inner { max-width: 1100px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 14rem) minmax(0, 1fr); gap: 1.5rem 3rem; }
.section-label { font-size: .78rem; letter-spacing: .16em; text-transform: uppercase; color: var(--accent); padding-top: .55rem; }
.section h2 { margin: 0 0 .75rem; font: 400 clamp(1.8rem, 4vw, 2.8rem)/1.1 var(--font-display); text-wrap: balance; }
.section p { margin: 0; max-width: 62ch; color: var(--muted); }
.pending {
  display: inline-block; margin-top: 1.25rem; padding: .3rem .6rem;
  font: 400 .72rem/1.4 var(--font-data); letter-spacing: .04em;
  border: 1px dashed var(--line); color: var(--muted);
}
.site-footer { padding-block: 2rem; padding-inline: var(--gutter); font-size: .8rem; color: var(--muted); }

@media (max-width: 700px) {
  .section-inner { grid-template-columns: 1fr; gap: .5rem; }
  .r-controls { grid-template-columns: 1fr; }
  .r-actions { justify-content: space-between; }
  .r-intro { align-content: center; background: none; padding-bottom: 0; }
  /* En móvil el vídeo 16:9 ocupa una franja: el texto se coloca encima, sin tapar la casa. */
  .r-frame { align-content: center; gap: 1.5rem; }
}
@media (max-width: 700px) and (orientation: portrait) {
  .r-frame { display: flex; flex-direction: column; justify-content: center; }
  .r-intro { position: static; order: -1; padding: 0 var(--gutter); }
}

@media (prefers-reduced-motion: reduce) {
  .r-poster, .r-intro { transition: none; }
}


/* Navegación entre proyectos */
.brand { text-decoration: none; }
.proj-nav { display: flex; gap: 1.1rem; flex-wrap: wrap; font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; }
.proj-nav a { color: var(--muted); text-decoration: none; padding-block: .2rem; border-bottom: 1px solid transparent; }
.proj-nav a:hover { color: var(--ink); }
.proj-nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }
.proj-nav .soon { color: var(--muted); opacity: .55; }
.site-header { flex-wrap: wrap; row-gap: .6rem; }
