/* ALDABA — shared editorial layer over the WebGL night world */
:root {
  --ink: #0b0908;
  --bone: #ece7dd;
  --bronze: #c98d4e;
  --bronze-hi: #e8b06a;
  --bronze-deep: #7c5526;
  --mono: "Space Grotesk", ui-monospace, Menlo, monospace;
  --serif: "Cormorant Garamond", Georgia, serif;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scrollbar-width: thin; scrollbar-color: var(--bronze-deep) var(--ink); }
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--ink); }
::-webkit-scrollbar-thumb { background: var(--bronze-deep); border-radius: 5px; }
html, body { background: var(--ink); color: var(--bone); }
body { font-family: var(--serif); overflow-x: hidden; }
::selection { background: var(--bronze-deep); color: var(--bone); }

#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; z-index: 0; }
#track { position: relative; z-index: 1; pointer-events: none; }
#hud { display: none; position: fixed; bottom: 12px; left: 12px; z-index: 90;
  color: var(--bronze-hi); font: 11px var(--mono); white-space: pre; pointer-events: none; }
body.debug #hud { display: block; }

.mono { font-family: var(--mono); letter-spacing: 0.16em; font-size: 11px; font-weight: 400; }

/* ---------- preloader ---------- */
#pre { position: fixed; inset: 0; z-index: 200; background: var(--ink);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  transition: background-color 1.2s ease, opacity .9s ease; }
#pre.lift { background-color: transparent; }
#pre.gone { opacity: 0; pointer-events: none; }
#pre .pre-mark { font-family: var(--serif); font-size: 15px; letter-spacing: .58em;
  text-indent: .58em; color: var(--bone); opacity: .9; }
#pre .pre-count { font-family: var(--mono); font-size: clamp(64px, 11vw, 150px);
  font-weight: 300; letter-spacing: .04em; color: var(--bone); line-height: 1;
  margin-top: 3vh; font-variant-numeric: tabular-nums; }
#pre .pre-scramble { font-family: var(--mono); font-size: 10px; letter-spacing: .34em;
  text-indent: .34em; color: var(--bronze); margin-top: 3vh; min-height: 14px;
  text-transform: uppercase; opacity: .85; }
#pre.pulse .pre-count, #pre.pulse .pre-scramble { display: none; }
#pre.pulse .pre-mark { animation: premark 1s ease both; }
@keyframes premark { from { opacity: 0; letter-spacing: .9em; } to { opacity: .9; letter-spacing: .58em; } }

/* chrome waits behind the preloader */
.chrome, .alti, .fase, .sala, .overlays { transition: opacity 1s ease .15s; }
body.loading .chrome, body.loading .alti, body.loading .fase, body.loading .sala,
body.loading .overlays { opacity: 0; pointer-events: none; }

/* ---------- fixed chrome ---------- */
.chrome { position: fixed; left: 0; right: 0; z-index: 40; display: flex;
  align-items: center; justify-content: space-between; padding: 28px 40px; }
.chrome-top { top: 0; }
.chrome-bottom { bottom: 0; pointer-events: none; }
.wordmark { display: flex; align-items: center; gap: 11px; color: var(--bone); text-decoration: none; }
.wm-glyph { width: 21px; height: 21px; color: var(--bronze-hi); }
.wm-text { font-family: var(--serif); font-size: 20px; letter-spacing: 0.44em; }
.nav { display: flex; gap: 24px; }
.nav a { color: var(--bone); text-decoration: none; opacity: 0.72; transition: opacity .3s, color .3s; }
.nav a:hover, .nav a[aria-current] { opacity: 1; color: var(--bronze-hi); }

.skip { pointer-events: auto; background: none; border: 1px solid rgba(236,231,221,.22);
  color: var(--bone); padding: 10px 18px; cursor: pointer; letter-spacing: .18em;
  font-family: var(--mono); font-size: 11px;
  transition: border-color .3s, color .3s; border-radius: 2px; }
.skip:hover { border-color: var(--bronze-hi); color: var(--bronze-hi); }

/* ---------- altitude meter (progress UI, La Torre) ---------- */
.alti { position: fixed; right: 34px; top: 50%; transform: translateY(-50%);
  z-index: 40; display: flex; align-items: center; gap: 14px; pointer-events: none; }
.alti-scale { position: relative; width: 1px; height: 42vh; background: rgba(236,231,221,.16); }
.alti-scale i { position: absolute; left: -3px; width: 7px; height: 1px;
  background: rgba(236,231,221,.28); }
.alti-cursor { position: absolute; left: -5px; width: 11px; height: 1px;
  background: var(--bronze-hi); box-shadow: 0 0 8px rgba(232,176,106,.8); bottom: 0; }
.alti-read { font-family: var(--mono); font-size: 10px; letter-spacing: .22em;
  color: var(--bronze-hi); writing-mode: vertical-rl; white-space: nowrap; opacity: .92; }

/* ---------- phase meter (progress UI, La Obra) ---------- */
.fase { position: fixed; right: 40px; bottom: 86px;
  z-index: 40; display: flex; flex-direction: column; align-items: flex-end; gap: 10px;
  pointer-events: none; text-align: right; }
.fase-pct { font-family: var(--mono); font-weight: 300; font-size: 34px;
  letter-spacing: .06em; color: var(--bronze-hi); font-variant-numeric: tabular-nums; }
.fase-name { font-family: var(--mono); font-size: 10px; letter-spacing: .3em;
  color: var(--bone); opacity: .85; }
.fase-bars { display: flex; gap: 6px; }
.fase-bars i { width: 22px; height: 2px; background: rgba(236,231,221,.18); transition: background .5s; }
.fase-bars i.on { background: var(--bronze-hi); box-shadow: 0 0 6px rgba(232,176,106,.7); }

/* ---------- room meter (progress UI, Interiores) ---------- */
.sala { position: fixed; right: 40px; bottom: 34px; z-index: 40; text-align: right;
  pointer-events: none; }
.sala-idx { font-family: var(--mono); font-weight: 300; font-size: 26px;
  letter-spacing: .12em; color: var(--bronze-hi); font-variant-numeric: tabular-nums; }
.sala-name { font-family: var(--mono); font-size: 10px; letter-spacing: .3em;
  color: var(--bone); opacity: .8; margin-top: 6px; }

/* ---------- editorial overlays ---------- */
.overlays { position: fixed; inset: 0; z-index: 20; pointer-events: none; }
.ov { position: absolute; inset: 0; display: flex; flex-direction: column;
  justify-content: center; padding: 0 9vw 0 11vw; opacity: 0; visibility: hidden; }
.ov > * { transform: translateY(24px); transition: transform 1s cubic-bezier(.16,1,.3,1); }
.ov.on > * { transform: none; }
.ov.on { visibility: visible; }
.ov-right { align-items: flex-end; text-align: right; padding-right: 11vw; }
.ov-low { justify-content: flex-end; padding-bottom: 12vh; }
.ov-center { align-items: center; text-align: center; padding: 0 6vw; }

.kicker { color: var(--bronze-hi); margin-bottom: 26px; opacity: .92; }
.chapnum { color: var(--bronze-hi); margin-bottom: 20px; }
.display { font-size: clamp(52px, 8.2vw, 126px); line-height: 1.0; font-weight: 400;
  text-shadow: 0 2px 44px rgba(5,3,2,.85); }
.display em, .display-sm em { font-style: italic; color: var(--bronze-hi); }
.display-sm { font-size: clamp(32px, 4.4vw, 64px); line-height: 1.06; font-weight: 400;
  text-shadow: 0 2px 30px rgba(5,3,2,.8); }
.sub { margin-top: 32px; opacity: .65; }
.body-line { margin-top: 20px; opacity: .68; }
.lede { font-family: var(--serif); font-size: clamp(16px, 1.5vw, 21px); line-height: 1.55;
  max-width: 44ch; margin-top: 26px; opacity: .88; text-shadow: 0 1px 20px rgba(5,3,2,.9); }
.ov-right .lede { margin-left: auto; }

.scroll-hint { position: absolute; bottom: 12vh; left: 50%; width: 1px; height: 56px;
  background: rgba(236,231,221,.2); overflow: hidden; }
.scroll-hint span { position: absolute; left: 0; top: -40%; width: 100%; height: 40%;
  background: var(--bronze-hi); animation: hint 2.2s cubic-bezier(.65,0,.35,1) infinite; }
@keyframes hint { to { top: 110%; } }

/* bridge cards to LA OBRA / INTERIORES */
.puertas { display: flex; gap: 28px; margin-top: 34px; }
.puerta-card { pointer-events: auto; display: block; text-decoration: none;
  color: var(--bone); border: 1px solid rgba(201,141,78,.35); padding: 26px 30px;
  min-width: 250px; background: rgba(11,9,8,.55); backdrop-filter: blur(4px);
  transition: border-color .35s, background .35s, transform .35s; border-radius: 2px; }
.puerta-card:hover { border-color: var(--bronze-hi); background: rgba(24,17,10,.72);
  transform: translateY(-4px); }
.puerta-card .pc-num { font-family: var(--mono); font-size: 10px; letter-spacing: .3em;
  color: var(--bronze-hi); }
.puerta-card .pc-title { font-family: var(--serif); font-size: 30px; margin-top: 12px; }
.puerta-card .pc-line { font-family: var(--mono); font-size: 10px; letter-spacing: .18em;
  opacity: .6; margin-top: 12px; }
.puerta-card .pc-go { font-family: var(--mono); font-size: 11px; letter-spacing: .22em;
  color: var(--bronze-hi); margin-top: 20px; }

.cta { pointer-events: auto; margin-top: 36px; display: inline-block;
  font-family: var(--mono); font-size: 12px; letter-spacing: .22em;
  color: var(--ink); background: var(--bronze-hi); padding: 17px 36px;
  text-decoration: none; border-radius: 2px; transition: background .3s, transform .3s;
  text-transform: uppercase; }
.cta:hover { background: var(--bone); transform: translateY(-2px); }
.cta-quiet { pointer-events: auto; display: inline-block; margin-top: 22px;
  font-family: var(--mono); font-size: 10px; letter-spacing: .24em; color: var(--bone);
  opacity: .55; text-decoration: none; border-bottom: 1px solid rgba(236,231,221,.25);
  padding-bottom: 3px; transition: opacity .3s, color .3s; }
.cta-quiet:hover { opacity: 1; color: var(--bronze-hi); }
.foot { margin-top: 34px; text-align: center; opacity: .45; letter-spacing: .2em; }

/* ---------- contacto overlay (pure :target) ---------- */
.contacto { display: none; position: fixed; inset: 0; z-index: 120;
  background: rgba(8,6,4,.93); backdrop-filter: blur(7px);
  align-items: center; justify-content: center; text-align: center; }
.contacto:target { display: flex; }
.contacto-card { padding: 48px 7vw; max-width: 640px; width: 100%; }
.contacto-line { margin-top: 20px; opacity: .65; }
.cform { margin-top: 36px; display: flex; flex-direction: column; gap: 14px; text-align: left; }
.cform label { font-family: var(--mono); font-size: 9px; letter-spacing: .28em;
  color: var(--bronze-hi); text-transform: uppercase; }
.cform input, .cform textarea { background: rgba(236,231,221,.05);
  border: 1px solid rgba(236,231,221,.18); color: var(--bone); padding: 13px 14px;
  font-family: var(--mono); font-size: 13px; letter-spacing: .06em; border-radius: 2px;
  outline: none; transition: border-color .3s; width: 100%; resize: none; }
.cform input:focus, .cform textarea:focus { border-color: var(--bronze); }
.cform button { margin-top: 10px; align-self: flex-start; cursor: pointer; border: 0; }
.cform .sent { display: none; font-family: var(--mono); font-size: 11px;
  letter-spacing: .2em; color: var(--bronze-hi); margin-top: 10px; }
.cform.is-sent .sent { display: block; }
.cform.is-sent button, .cform.is-sent input, .cform.is-sent textarea, .cform.is-sent label { display: none; }
.contacto-close { display: block; margin-top: 38px; color: var(--bone);
  text-decoration: none; opacity: .6; transition: opacity .3s, color .3s; }
.contacto-close:hover { opacity: 1; color: var(--bronze-hi); }

/* ---------- custom cursor: small bronze ring ---------- */
@media (pointer: fine) {
  body.ring-cursor, body.ring-cursor a, body.ring-cursor button { cursor: none; }
  #cursor { position: fixed; z-index: 300; width: 26px; height: 26px; border-radius: 50%;
    border: 1.5px solid var(--bronze-hi); pointer-events: none; left: 0; top: 0;
    transform: translate(-200px, -200px); box-shadow: 0 0 10px rgba(232,176,106,.35),
    inset 0 0 6px rgba(232,176,106,.18); transition: width .25s, height .25s, border-color .25s; }
  #cursor::after { content: ""; position: absolute; left: 50%; top: 50%; width: 3px; height: 3px;
    border-radius: 50%; background: var(--bronze-hi); transform: translate(-50%, -50%); }
  #cursor.grab { width: 44px; height: 44px; border-color: var(--bone); }
}
@media (pointer: coarse) { #cursor { display: none; } }

/* ---------- reduced motion: native scroll + poster world ---------- */
@media (prefers-reduced-motion: reduce) {
  .scroll-hint span { animation: none; }
  .ov > * { transition: none; transform: none; }
  #pre .pre-mark { animation: none; }
}
body.reduced .overlays { position: static; pointer-events: auto; }
body.reduced .ov { position: relative; inset: auto; min-height: 100vh;
  opacity: 1 !important; visibility: visible; }
body.reduced #track, body.reduced .skip, body.reduced .alti, body.reduced .fase { display: none; }
body.reduced #cursor { display: none; }

@media (max-width: 768px) {
  .chrome { padding: 16px 14px; gap: 8px; }
  .nav { gap: 10px; flex: none; }
  .nav a { font-size: 9px; letter-spacing: .07em; white-space: nowrap; }
  .wm-glyph { width: 16px; height: 16px; }
  .wm-text { font-size: 13px; letter-spacing: .3em; }
  .alti { right: 12px; }
  .fase { right: 16px; }
  .fase-pct { font-size: 24px; }
  .ov { padding: 0 8vw; }
  .ov-right { padding-right: 8vw; }
  .puertas { flex-direction: column; gap: 14px; }
  .puerta-card { min-width: 0; padding: 18px 20px; }
  .puerta-card .pc-title { font-size: 22px; }
  .skip { padding: 8px 12px; font-size: 10px; }
  .sala { right: 16px; bottom: 20px; }
}
