:root {
  --bg: #ffffff;
  --text: #141414;
  --muted: #8a8a8a;
  --line: #ececec;
  --card-shadow: 0 25px 50px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Manrope", sans-serif;
}

img {
  display: block;
  width: 100%;
  height: auto;
}

.portfolio {
  position: relative;
  max-width: 1500px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 30px 28px 80px;
  overflow: hidden;
}

/* LÍNEAS DE FONDO */
.portfolio::before,
.portfolio::after {
  content: "";
  position: absolute;
  top: 0;
  width: 1px;
  height: 100%;
  background: var(--line);
  pointer-events: none;
  z-index: 0;
}

.portfolio::before {
  left: 25%;
}

.portfolio::after {
  left: 75%;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  position: relative;
  z-index: 5;
}

.topbar__left {
  font-family: "Allura", cursive;
  font-size: 1.6rem;
  letter-spacing: 0.03em;
  text-transform: none;
  color: var(--text);
}

.topbar__right {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.35em;
  color: var(--muted);
}

.side-label {
  position: fixed;
  top: 50%;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.35em;
  color: var(--muted);
  z-index: 10;
  display: none;
}

.side-label--left {
  left: 12px;
  transform: rotate(-90deg);
  transform-origin: left top;
}

.side-label--right {
  right: 12px;
  transform: rotate(90deg);
  transform-origin: right top;
}

.hero {
  position: relative;
  z-index: 4;
  min-height: 0;
  padding: 0;
}

.hero__intro {
  position: absolute;
  left: 18px;
  top: 560px;
  transform: rotate(0deg);
  transform-origin: left top;
  margin: 0;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.35em;
  color: var(--muted);
  z-index: 8;
}

/* ZONA EDITORIAL */
.editorial-grid {
  position: relative;
  min-height: 1700px;
  margin-top: 0;
}

.floating-card {
  position: absolute;
  background: #f8f8f8;
  overflow: hidden;
  box-shadow: var(--card-shadow);
  cursor: pointer;
  z-index: 3;
  transition:
    transform 0.35s ease,
    box-shadow 0.35s ease,
    opacity 0.28s ease;
}

  transform:
    translateX(var(--start-x, 0))
    translateY(var(--start-y, 0))
    scale(var(--start-scale, 1))
    rotate(var(--start-r, 0deg));

  transition:
    top 3.2s cubic-bezier(0.22, 1, 0.36, 1),
    left 3.2s cubic-bezier(0.22, 1, 0.36, 1),
    right 3.2s cubic-bezier(0.22, 1, 0.36, 1),
    width 3.2s cubic-bezier(0.22, 1, 0.36, 1),
    height 3.2s cubic-bezier(0.22, 1, 0.36, 1),
    transform 3.2s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.35s ease,
    opacity 0.4s ease;
}

.floating-card:hover {
  transform:
    translateX(var(--start-x, 0))
    translateY(calc(var(--start-y, 0) - 6px))
    scale(var(--start-scale, 1))
    rotate(var(--start-r, 0deg));

  box-shadow: 0 28px 60px rgba(0, 0, 0, 0.12);
}

/* =========================================================
   GESTO INICIAL: fila superior + carga + reparto a su lugar
   ========================================================= */

/* estado inicial general */
body.is-loading .floating-card {
  top: 72px !important;
  right: auto !important;
  width: 75px !important;
  height: 90px !important;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.06);
  transform:
    translateX(0)
    translateY(0)
    scale(0.94)
    rotate(0deg);
}

/* posiciones en fila */
body.is-loading .floating-card--one { left: 8% !important; }
body.is-loading .floating-card--two { left: 21% !important; }
body.is-loading .floating-card--three { left: 34% !important; }
body.is-loading .floating-card--four { left: 47% !important; }
body.is-loading .floating-card--five { left: 60% !important; }
body.is-loading .floating-card--six { left: 73% !important; }

/* mientras cargan: todas translucidas */
body.is-loading .floating-card img {
  opacity: 0.6;
  transition: opacity 0.55s ease;
}

body.is-loading .floating-card.is-coloring img {
  opacity: 1;
}

body.is-loading .floating-card.is-dealt img {
  opacity: 1;
}

/* barra de carga base */
body.is-loading .floating-card::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 8px;
  height: 2px;
  background: rgba(255, 255, 255, 0.28);
  opacity: 0.85;
}

/* barra activa */
body.is-loading .floating-card::before {
  content: "";
  position: absolute;
  left: 10px;
  bottom: 8px;
  width: 0;
  height: 2px;
  background: white;
  opacity: 0;
}

body.is-loading .floating-card.is-coloring::before {
  opacity: 1;
  animation: loadingBar 0.38s linear forwards;
}

/* desactiva hover mientras ocurre el gesto */
body.is-loading .floating-card:hover {
  transform: inherit;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.06);
}

/* cuando empieza el reparto */
body.is-loading .floating-card.is-dealt {
  box-shadow: var(--card-shadow);
}

body.is-loading .floating-card--one.is-dealt {
  top: 120px !important;
  left: 8% !important;
  width: 230px !important;
  height: 310px !important;
  transform: rotate(0deg) scale(1);
}

body.is-loading .floating-card--two.is-dealt {
  top: 60px !important;
  left: 38% !important;
  width: 190px !important;
  height: 255px !important;
  transform: rotate(0deg) scale(1);
}

body.is-loading .floating-card--three.is-dealt {
  top: 420px !important;
  left: 28% !important;
  width: 260px !important;
  height: 340px !important;
  transform: rotate(0deg) scale(1);
}

body.is-loading .floating-card--four.is-dealt {
  top: 500px !important;
  right: 10% !important;
  left: auto !important;
  width: 250px !important;
  height: 220px !important;
  transform: rotate(0deg) scale(1);
}

body.is-loading .floating-card--five.is-dealt {
  top: 820px !important;
  left: 12% !important;
  width: 200px !important;
  height: 275px !important;
  transform: rotate(0deg) scale(1);
}

body.is-loading .floating-card--six.is-dealt {
  top: 175px !important;
  right: 22% !important;
  left: auto !important;
  width: 210px !important;
  height: 280px !important;
  transform: rotate(0deg) scale(1);
}

/* al terminar la animación, limpieza visual */
body.is-ready .floating-card img {
  opacity: 1;
}

body.is-ready .floating-card::before,
body.is-ready .floating-card::after {
  opacity: 0;
}

/* animación de barra */
@keyframes loadingBar {
  from {
    width: 0;
  }
  to {
    width: calc(100% - 20px);
  }
}

/* ESTADO FINAL: vuelven a su tamaño y rotación natural */
body.is-ready .floating-card--one {
  --start-x: 0px;
  --start-y: 0px;
  --start-scale: 1;
  --start-r: -4deg;
}

body.is-ready .floating-card--two {
  --start-x: 0px;
  --start-y: 0px;
  --start-scale: 1;
  --start-r: 3deg;
}

body.is-ready .floating-card--three {
  --start-x: 0px;
  --start-y: 0px;
  --start-scale: 1;
  --start-r: -2deg;
}

body.is-ready .floating-card--four {
  --start-x: 0px;
  --start-y: 0px;
  --start-scale: 1;
  --start-r: 4deg;
}

body.is-ready .floating-card--five {
  --start-x: 0px;
  --start-y: 0px;
  --start-scale: 1;
  --start-r: -3deg;
}

body.is-ready .floating-card--six {
  --start-x: 0px;
  --start-y: 0px;
  --start-scale: 1;
  --start-r: 2deg;
}

.floating-card img {
  height: 100%;
  object-fit: cover;
}

.floating-card__info {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 16px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.42), rgba(0, 0, 0, 0.04) 45%, rgba(0, 0, 0, 0));
  color: white;
  opacity: 0;
  transition: opacity 0.28s ease;
  pointer-events: none;
}

.floating-card:hover .floating-card__info {
  opacity: 1;
}

body.is-ready .editorial-grid:has(.floating-card:hover) .floating-card {
  opacity: 0.5;
}

body.is-ready .editorial-grid:has(.floating-card:hover) .floating-card:hover {
  opacity: 1;
}

body.is-ready .floating-card:hover .floating-card__info {
  opacity: 1;
}

/* TITULO */
.floating-card__info span {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  opacity: 0.85;
  margin-bottom: 8px;
}

/* SUBTITULO */
.floating-card__info h2 {
  margin: 0;
  font-family: "Cormorant Garamond", serif;
  font-weight: 400;
  font-size: 1.rem;
}

/* POSICIONES ESCRITORIO */
.floating-card--one {
  --r: -4deg;
  top: 120px;
  left: 8%;
  width: 230px;
  height: 310px;
}

.floating-card--two {
  --r: 3deg;
  top: 60px;
  left: 38%;
  width: 190px;
  height: 255px;
}

.floating-card--three {
  --r: -2deg;
  top: 420px;
  left: 28%;
  width: 260px;
  height: 340px;
}

.floating-card--four {
  --r: 4deg;
  top: 500px;
  right: 10%;
  width: 250px;
  height: 220px;
}

.floating-card--five {
  --r: -3deg;
  top: 820px;
  left: 12%;
  width: 200px;
  height: 275px;
}

.floating-card--five .floating-card__info h2 {
  font-size: 1.40rem;
  line-height: 1.05;
}

.floating-card--six {
  --r: 2deg;
  top: 175px;
  right: 22%;
  width: 210px;
  height: 280px;
}

.closing {
  max-width: 360px;
  margin: 60px 0 0 auto;
  text-align: right;
}

.closing__tag {
  margin: 0 0 12px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.35em;
  color: var(--muted);
}

.closing__text {
  margin: 0;
  font-size: 15px;
  line-height: 1.9;
  color: #5c5c5c;
}

/* REVEAL */
.reveal {
  opacity: 0;
  transform: translateY(45px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* TABLET */
@media (min-width: 768px) {
  .side-label {
    display: block;
  }
}

/* MÓVIL */
@media (max-width: 767px) {
  .portfolio {
    padding: 22px 18px 60px;
  }

  .topbar {
    flex-direction: column;
    gap: 12px;
  }

  .hero {
    padding-top: 45px;
    min-height: auto;
  }

  .hero__intro {
    left: 10px;
    top: 420px;
    font-size: 9px;
    letter-spacing: 0.28em;
  }

  .topbar__left {
    font-size: 1.35rem;
  }

  .topbar__right {
    font-size: 10px;
  }

  .editorial-grid {
    position: relative;
    min-height: 1200px;
    display: block;
    margin-top: 10px;
  }

  .floating-card {
    position: absolute;
    transform: none !important;
  }

  .floating-card:hover {
    transform: none !important;
  }

  .floating-card__info {
    padding: 10px;
  }

  .floating-card__info span {
    font-size: 6px;
    letter-spacing: 0.16em;
    margin-bottom: 5px;
  }

  .floating-card__info h2 {
    font-size: 0.95rem;
    line-height: 1;
  }

  .floating-card--one {
    top: 70px;
    left: 4%;
    width: 110px;
    height: 150px;
  }

  .floating-card--two {
    top: 35px;
    right: 7%;
    left: auto;
    width: 95px;
    height: 130px;
  }

  .floating-card--three {
    top: 255px;
    left: 24%;
    width: 128px;
    height: 170px;
  }

  .floating-card--four {
    top: 430px;
    right: 5%;
    left: auto;
    width: 120px;
    height: 105px;
  }

  .floating-card--six {
    top: 215px;
    right: 20%;
    left: auto;
    width: 108px;
    height: 145px;
  }

  .floating-card--five {
    top: 655px;
    left: 8%;
    width: 105px;
    height: 145px;
  }

  .closing {
  margin: 40px auto 0;
  max-width: 100%;
  text-align: center;
}

.closing__text {
  justify-content: center;
  text-align: center;
  gap: 8px;
}

  body.is-loading .floating-card,
  body.is-ready .floating-card {
    filter: none;
  }

  /* MÓVIL: las tarjetas cargan desde su lugar, no se mueven */
body.is-loading .floating-card {
  position: absolute;
  transform: none !important;
  box-shadow: var(--card-shadow);
}

body.is-loading .floating-card img {
  opacity: 0.5;
  transition: opacity 0.55s ease;
}

body.is-loading .floating-card.is-coloring img {
  opacity: 1;
}

body.is-loading .floating-card::before,
body.is-loading .floating-card::after {
  display: none;
}

body.is-loading .floating-card:hover {
  transform: none !important;
  box-shadow: var(--card-shadow);
}

body.is-ready .floating-card img {
  opacity: 1;
}

/* MÓVIL: anula la fila superior y el reparto del escritorio */
body.is-loading .floating-card--one,
body.is-loading .floating-card--two,
body.is-loading .floating-card--three,
body.is-loading .floating-card--four,
body.is-loading .floating-card--five,
body.is-loading .floating-card--six {
  top: auto !important;
  left: auto !important;
  right: auto !important;
  width: auto !important;
  height: auto !important;
}

body.is-loading .floating-card--one,
body.is-ready .floating-card--one {
  top: 50px !important;
  left: 4% !important;
  right: auto !important;
  width: 90px !important;
  height: 100px !important;
}

body.is-loading .floating-card--two,
body.is-ready .floating-card--two {
  top: -20px !important;
  right: 7% !important;
  left: auto !important;
  width: 90px !important;
  height: 125px !important;
}

body.is-loading .floating-card--three,
body.is-ready .floating-card--three {
  top: 280px !important;
  left: 14% !important;
  right: auto !important;
  width: 110px !important;
  height: 150px !important;
}

body.is-loading .floating-card--four,
body.is-ready .floating-card--four {
  top: 430px !important;
  right: 5% !important;
  left: auto !important;
  width: 100px !important;
  height: 105px !important;
}

body.is-loading .floating-card--six,
body.is-ready .floating-card--six {
  top: 155px !important;
  right: 17% !important;
  left: auto !important;
  width: 98px !important;
  height: 125px !important;
}

body.is-loading .floating-card--five,
body.is-ready .floating-card--five {
  top: 500px !important;
  left: 8% !important;
  right: auto !important;
  width: 105px !important;
  height: 145px !important;
}
}


.closing__text a,
.closing__text a:visited,
.closing__text a:active {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.35em;
  color: #141414 !important;
  text-decoration: none;
  font-family: "Manrope", sans-serif;
}

.closing__text a:hover {
  color: #141414 !important;
  opacity: 0.7;
}

.closing__text {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.96);
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.menu-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.menu-overlay__inner {
  width: 100%;
  max-width: 900px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: flex-start;
}

.menu-overlay__link {
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(2.2rem, 5vw, 4.8rem);
  line-height: 1;
  letter-spacing: 0.05em;
  color: #141414;
  text-decoration: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.menu-overlay__link:hover {
  opacity: 0.55;
  transform: translateX(8px);
}

.side-label--right {
  cursor: pointer;
}

.mobile-menu-button {
  display: none;
}

@media (max-width: 767px) {
  .topbar {
    position: relative;
    align-items: flex-start;
  }

  .topbar__right {
    position: absolute;
    left: 8px;
    top: 550px;
    transform: rotate(-90deg);
    transform-origin: left top;
    margin: 0;
    font-size: 8px;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    color: var(--muted);
    z-index: 8;
    white-space: nowrap;
  }

  .hero__intro {
    position: absolute;
    left: 140px;
    top: 180px;
    transform: rotate(0deg);
    transform-origin: left top;
    margin: 0;
    font-size: 8px;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    color: var(--muted);
    z-index: 8;
    white-space: nowrap;
  }

  .mobile-menu-button {
    display: block;
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.35em;
    color: var(--muted);
    font-family: "Manrope", sans-serif;
    cursor: pointer;
    position: absolute;
    right: 0;
    top: 0;
    z-index: 20;
  }

  .side-label--right {
    display: none;
  }

  .closing {
  margin: 40px auto 0;
  max-width: 100%;
  text-align: center;
}

.closing__tag {
  font-size: 9px;
  letter-spacing: 0.25em;
  text-align: center;
}

.closing__text {
  justify-content: center;
  text-align: center;
  gap: 8px;
}

.closing__text a,
.closing__text a:visited,
.closing__text a:active {
  font-size: 9px;
  letter-spacing: 0.22em;
}
}