/* ============================================================
   CORPORATIVO MACEDO INTEGRAL — Próximamente
   Tema claro: papel crema #f5f3ef · tinta navy #162638 · oro #af915f
   Tipografía: Playfair Display (display) + Rubik (sans)
   ============================================================ */

:root {
  --paper: #f5f3ef;
  --paper-deep: #eceae3;
  --ink: #162638;
  --ink-soft: rgba(22, 38, 56, 0.62);
  --ink-faint: rgba(22, 38, 56, 0.42);
  --gold: #af915f;
  --hairline: rgba(175, 145, 95, 0.45);
  --serif: "Playfair Display", Georgia, serif;
  --sans: "Rubik", "Helvetica Neue", Arial, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 300;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

/* ---------- Fondo: aurora de gradientes + grano de película ---------- */

.aurora {
  position: fixed;
  inset: -12%;
  z-index: 0;
  overflow: hidden;
  will-change: transform;
}

.blob {
  position: absolute;
  border-radius: 50%;
  mix-blend-mode: multiply;
  will-change: transform;
}

.b1 { /* azul polvo — superior izquierda */
  width: 64vw; height: 64vw;
  left: -14vw; top: -20vw;
  background: radial-gradient(circle at 42% 42%, rgba(148, 176, 207, 0.8), rgba(148, 176, 207, 0) 68%);
  animation: deriva1 34s ease-in-out infinite alternate;
}

.b2 { /* dorado cálido — superior derecha */
  width: 56vw; height: 56vw;
  right: -16vw; top: -10vw;
  background: radial-gradient(circle at 55% 45%, rgba(233, 214, 178, 0.9), rgba(233, 214, 178, 0) 66%);
  animation: deriva2 41s ease-in-out infinite alternate;
}

.b3 { /* azul acero — inferior izquierda */
  width: 50vw; height: 50vw;
  left: 6vw; bottom: -24vw;
  background: radial-gradient(circle at 50% 50%, rgba(110, 143, 184, 0.55), rgba(110, 143, 184, 0) 68%);
  animation: deriva3 37s ease-in-out infinite alternate;
}

.b4 { /* gris azulado claro — inferior derecha */
  width: 44vw; height: 44vw;
  right: 2vw; bottom: -14vw;
  background: radial-gradient(circle at 50% 50%, rgba(214, 224, 235, 0.95), rgba(214, 224, 235, 0) 70%);
  animation: deriva4 29s ease-in-out infinite alternate;
}

@keyframes deriva1 {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  50%  { transform: translate3d(9vw, 6vh, 0) scale(1.12); }
  100% { transform: translate3d(-4vw, 12vh, 0) scale(0.94); }
}

@keyframes deriva2 {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  50%  { transform: translate3d(-10vw, 9vh, 0) scale(1.08); }
  100% { transform: translate3d(5vw, 14vh, 0) scale(1.16); }
}

@keyframes deriva3 {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  50%  { transform: translate3d(8vw, -10vh, 0) scale(1.1); }
  100% { transform: translate3d(14vw, -3vh, 0) scale(0.92); }
}

@keyframes deriva4 {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  50%  { transform: translate3d(-7vw, -8vh, 0) scale(1.14); }
  100% { transform: translate3d(-13vw, 4vh, 0) scale(1.02); }
}

/* Zona de calma: mantiene limpio el centro tras el logo */
.calma {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 62% 54% at 50% 44%, rgba(245, 243, 239, 0.72) 0%, rgba(245, 243, 239, 0.28) 55%, rgba(245, 243, 239, 0) 78%),
    radial-gradient(ellipse 110% 90% at 50% 50%, transparent 62%, rgba(198, 191, 176, 0.35) 100%);
}

/* Grano de película animado (unifica todo el conjunto) */
.grain {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
  animation: grano 0.9s steps(1, end) infinite;
}

@keyframes grano {
  0%   { background-position: 0 0; }
  20%  { background-position: -42px 28px; }
  40%  { background-position: 34px -48px; }
  60%  { background-position: -28px -36px; }
  80%  { background-position: 44px 22px; }
  100% { background-position: 0 0; }
}

/* ---------- Preloader: revelado palabra por palabra ---------- */

.preloader {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--paper-deep);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 34px;
  transition: opacity 1s ease, visibility 1s ease;
}

.preloader.is-done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.preloader-words {
  display: flex;
  gap: 0.6em;
  flex-wrap: wrap;
  justify-content: center;
  padding: 0 24px;
}

.preloader-words .w {
  display: inline-block;
  overflow: hidden;
}

.preloader-words .w span {
  display: inline-block;
  font-family: var(--sans);
  font-weight: 400;
  font-size: clamp(13px, 1.6vw, 17px);
  letter-spacing: 0.34em;
  color: var(--ink);
  transform: translateY(110%);
  animation: sube 0.9s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.preloader-words .w:nth-child(1) span { animation-delay: 0.25s; }
.preloader-words .w:nth-child(2) span { animation-delay: 0.5s; }
.preloader-words .w:nth-child(3) span { animation-delay: 0.75s; }

@keyframes sube {
  to { transform: translateY(0); }
}

.preloader-line {
  width: min(240px, 40vw);
  height: 1px;
  background: rgba(175, 145, 95, 0.3);
  overflow: hidden;
}

.preloader-line span {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--gold);
  transform: scaleX(0);
  transform-origin: left;
  animation: linea 1.6s cubic-bezier(0.65, 0, 0.35, 1) 0.9s forwards;
}

@keyframes linea {
  to { transform: scaleX(1); }
}

/* ---------- Marco: esquinas fijas ---------- */

.chrome {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 28px 36px;
  pointer-events: none;
}

.chrome-top { top: 0; }
.chrome-bottom { bottom: 0; }

.chrome-item {
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.chrome-top .chrome-left {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.42em;
  color: var(--ink);
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  z-index: 5;
  height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 90px 24px;
}

.lockup {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  will-change: transform;
}

.logo {
  width: min(400px, 60vw);
  height: auto;
  filter: drop-shadow(0 16px 34px rgba(60, 50, 30, 0.18));
}

.divider {
  width: min(320px, 46vw);
  height: 1px;
  margin: 34px 0 30px;
  background: rgba(175, 145, 95, 0.25);
  overflow: hidden;
}

.divider span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  transform: scaleX(0);
}

.titulo {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(26px, 5.2vw, 62px);
  letter-spacing: 0.22em;
  text-indent: 0.22em; /* compensa el tracking en el centrado */
  color: var(--ink);
  white-space: nowrap;
}

.titulo .letra {
  display: inline-block;
  opacity: 0;
  transform: translateY(0.55em);
}

.subtitulo {
  margin-top: 22px;
  font-size: clamp(13px, 1.5vw, 16px);
  font-weight: 300;
  letter-spacing: 0.18em;
  color: var(--ink-soft);
}

.contacto {
  margin-top: 30px;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.24em;
  text-transform: lowercase;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--hairline);
  padding-bottom: 6px;
  transition: color 0.25s ease, border-color 0.25s ease, border-width 0.2s ease;
}

.contacto:hover {
  color: var(--gold);
  border-color: var(--gold);
  border-bottom-width: 2px;
}

/* ---------- Sello giratorio ---------- */

.sello {
  position: fixed;
  right: 40px;
  bottom: 84px;
  z-index: 10;
  width: 140px;
  height: 140px;
  opacity: 0.9;
}

.sello svg {
  display: block;
  overflow: visible;
  animation: girar 14s linear infinite;
}

@keyframes girar {
  to { transform: rotate(360deg); }
}

.sello-texto {
  font-family: var(--sans);
  font-weight: 400;
  font-size: 9.5px;
  letter-spacing: 0.12em;
  fill: var(--ink);
}

.sello-punto {
  fill: var(--gold);
}

/* ---------- Coreografía de entrada (tras el preloader) ---------- */

.reveal,
.titulo .letra,
.divider span {
  opacity: 0;
}

body.is-ready .logo {
  animation: logoIn 1.4s cubic-bezier(0.22, 1, 0.36, 1) 0.1s forwards;
}

@keyframes logoIn {
  from { opacity: 0; transform: scale(0.94) translateY(14px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

body.is-ready .divider span {
  opacity: 1;
  animation: dividerIn 1.1s cubic-bezier(0.65, 0, 0.35, 1) 0.7s forwards;
}

@keyframes dividerIn {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

body.is-ready .titulo .letra {
  animation: letraIn 0.8s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

body.is-ready .titulo .letra:nth-child(1)  { animation-delay: 0.95s; }
body.is-ready .titulo .letra:nth-child(2)  { animation-delay: 1.0s; }
body.is-ready .titulo .letra:nth-child(3)  { animation-delay: 1.05s; }
body.is-ready .titulo .letra:nth-child(4)  { animation-delay: 1.1s; }
body.is-ready .titulo .letra:nth-child(5)  { animation-delay: 1.15s; }
body.is-ready .titulo .letra:nth-child(6)  { animation-delay: 1.2s; }
body.is-ready .titulo .letra:nth-child(7)  { animation-delay: 1.25s; }
body.is-ready .titulo .letra:nth-child(8)  { animation-delay: 1.3s; }
body.is-ready .titulo .letra:nth-child(9)  { animation-delay: 1.35s; }
body.is-ready .titulo .letra:nth-child(10) { animation-delay: 1.4s; }
body.is-ready .titulo .letra:nth-child(11) { animation-delay: 1.45s; }
body.is-ready .titulo .letra:nth-child(12) { animation-delay: 1.5s; }

@keyframes letraIn {
  from { opacity: 0; transform: translateY(0.55em); }
  to   { opacity: 1; transform: translateY(0); }
}

body.is-ready .subtitulo { animation: fundido 1s ease 1.75s forwards; }
body.is-ready .contacto  { animation: fundido 1s ease 2.0s forwards; }
body.is-ready .chrome-item { animation: fundido 1s ease 2.2s forwards; }
body.is-ready .sello     { animation: fundidoSello 1.2s ease 2.35s forwards; }

@keyframes fundido {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fundidoSello {
  from { opacity: 0; }
  to   { opacity: 0.9; }
}

/* ---------- Responsive ---------- */

@media (max-width: 720px) {
  .chrome { padding: 20px 22px; }
  .chrome-top .chrome-right { display: none; }
  .chrome-bottom { justify-content: center; }
  .chrome-bottom .chrome-right { display: none; }
  .sello { right: 22px; bottom: 70px; width: 104px; height: 104px; }
  .titulo { letter-spacing: 0.16em; text-indent: 0.16em; white-space: normal; }
}

/* ---------- Movimiento reducido ---------- */

@media (prefers-reduced-motion: reduce) {
  .preloader { display: none; }
  .reveal, .titulo .letra, .divider span { opacity: 1 !important; transform: none !important; animation: none !important; }
  .divider span { transform: scaleX(1) !important; }
  .sello svg { animation: none; }
  .blob, .grain { animation: none; }
}
