@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@400;500;600;700&family=Inter:wght@300;400;500;600&display=swap');

:root {
  --bg: #090909;
  --bg-2: #120d0f;

  --text: #f2ede7;
  --muted: rgba(242, 237, 231, 0.58);

  --accent: #9f1d2c;
  --accent-soft: rgba(159, 29, 44, 0.18);

  --line: rgba(255,255,255,0.08);

  --mouse-x: 50%;
  --mouse-y: 50%;
}


/* ==========================================================
   BASE
   ========================================================== */

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;

  width: 100%;
  height: 100%;

  overflow: hidden;

  background: var(--bg);
  color: var(--text);
}

body.frase-body {
  position: relative;

  min-height: 100svh;

  font-family: 'Inter', sans-serif;
}


/* ==========================================================
   FONDO
   ========================================================== */

.frase-bg {
  position: fixed;
  inset: 0;

  overflow: hidden;

  pointer-events: none;
}

.frase-bg::before {
  content: "";

  position: absolute;
  inset: 0;

  background:
    radial-gradient(
      circle at 20% 25%,
      rgba(120, 15, 30, 0.25),
      transparent 30%
    ),
    radial-gradient(
      circle at 78% 32%,
      rgba(90, 10, 25, 0.18),
      transparent 25%
    ),
    radial-gradient(
      circle at 50% 80%,
      rgba(110, 20, 20, 0.10),
      transparent 35%
    ),
    linear-gradient(
      135deg,
      var(--bg) 0%,
      var(--bg-2) 60%,
      #070707 100%
    );

  transform: scale(1.05);
}


.bg-orb {
  position: absolute;

  border-radius: 999px;

  filter: blur(70px);

  opacity: 0.48;

  mix-blend-mode: screen;

  animation:
    drift 14s
    ease-in-out
    infinite alternate;
}


.orb-a {
  width: 28vw;
  height: 28vw;

  left: 10%;
  top: 12%;

  background:
    rgba(125, 23, 37, 0.16);
}


.orb-b {
  width: 24vw;
  height: 24vw;

  right: 8%;
  bottom: 10%;

  background:
    rgba(151, 27, 45, 0.13);

  animation-duration: 18s;
}


.orb-c {
  width: 18vw;
  height: 18vw;

  left: 45%;
  bottom: 18%;

  background:
    rgba(95, 13, 28, 0.12);

  animation-duration: 16s;
}


.bg-spotlight {
  position: absolute;
  inset: 0;

  background:
    radial-gradient(
      circle at var(--mouse-x) var(--mouse-y),
      rgba(255,255,255,0.045),
      transparent 22%
    );

  transition:
    background 120ms linear;
}


.bg-grid {
  position: absolute;
  inset: 0;

  background-image:
    linear-gradient(
      rgba(255,255,255,0.018) 1px,
      transparent 1px
    ),
    linear-gradient(
      90deg,
      rgba(255,255,255,0.018) 1px,
      transparent 1px
    );

  background-size:
    48px 48px;

  mask-image:
    radial-gradient(
      circle at center,
      black 30%,
      transparent 82%
    );

  opacity: 0.11;
}


.bg-vignette {
  position: absolute;
  inset: 0;

  background:
    radial-gradient(
      circle at center,
      transparent 40%,
      rgba(0,0,0,0.46) 100%
    );
}


.bg-noise {
  position: absolute;
  inset: 0;

  opacity: 0.045;

  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' viewBox='0 0 180 180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");

  mix-blend-mode: soft-light;
}


/* ==========================================================
   ESCENA
   ========================================================== */

.frase-page {
  position: relative;
  z-index: 2;

  width: 100%;
  height: 100svh;

  display: grid;
  place-items: center;

  padding:
    clamp(24px, 4vw, 64px);
}


.frase-shell {
  width: min(1200px, 100%);

  text-align: center;

  opacity: 0;

  transform:
    translateY(22px)
    scale(0.988);

  transition:
    opacity 1.15s ease,
    transform 1.15s
      cubic-bezier(.2,.8,.2,1);
}


.frase-shell.is-visible {
  opacity: 1;

  transform:
    translateY(0)
    scale(1);
}


/* ==========================================================
   PROCEDENCIA
   ========================================================== */

.frase-meta {
  display: inline-flex;

  align-items: center;

  gap: 12px;

  margin-bottom:
    clamp(24px, 3vh, 38px);

  padding:
    10px 16px;

  border:
    1px solid var(--line);

  border-radius: 999px;

  backdrop-filter: blur(10px);

  background:
    rgba(255,255,255,0.025);

  color:
    var(--muted);

  font-size: 12px;

  letter-spacing: 0.18em;

  text-transform: uppercase;
}


.frase-dot {
  width: 4px;
  height: 4px;

  border-radius: 999px;

  background:
    rgba(255,255,255,0.35);
}


/* ==========================================================
   LINK A LA OBRA
   ========================================================== */

.frase-origen {
  position: relative;

  color: inherit;

  text-decoration: none;

  transition:
    color 250ms ease,
    opacity 250ms ease;
}


.frase-origen::after {
  content: "";

  position: absolute;

  left: 0;
  right: 100%;

  bottom: -5px;

  height: 1px;

  background:
    var(--accent);

  transition:
    right 350ms
      cubic-bezier(.2,.8,.2,1);
}


.frase-origen:hover {
  color:
    var(--text);
}


.frase-origen:hover::after {
  right: 0;
}


/* ==========================================================
   FRASE
   ========================================================== */

.frase-texto {
  margin: 0 auto;

  max-width: none;

  font-family:
    'Cormorant Garamond',
    serif;

  font-weight: 600;

  font-size:
    clamp(
      2.35rem,
      4.35vw,
      5rem
    );

  line-height: 0.99;

  letter-spacing: -0.022em;

  text-align: center;

  text-shadow:
    0 2px 18px
    rgba(0,0,0,0.35);

  transition:
    transform 220ms ease-out;
}


.segunda-parte {
  display: inline-block;

  margin-top: 0.24em;
}


/* ==========================================================
   ÉNFASIS
   ========================================================== */

.frase-texto .accent {
  position: relative;

  display: inline-block;

  color: #fff5f2;

  z-index: 1;
}


.frase-texto .accent::after {
  content: "";

  position: absolute;

  z-index: -1;

  left: -0.04em;
  right: -0.04em;

  bottom: 0.07em;

  height: 0.11em;

  border-radius: 999px;

  background:
    linear-gradient(
      90deg,
      rgba(159,29,44,0),
      rgba(159,29,44,0.58),
      rgba(159,29,44,0)
    );

  filter: blur(5px);

  opacity: 0.48;

  animation:
    pulseLine
    4.5s
    ease-in-out
    infinite;
}


/* ==========================================================
   FIRMA DEL SITIO
   ========================================================== */

.frase-corner {
  position: fixed;

  z-index: 3;

  left: 22px;
  bottom: 18px;

  font-size: 11px;

  letter-spacing: 0.16em;

  text-transform: uppercase;

  color:
    rgba(242, 237, 231, 0.30);
}


.frase-corner span {
  color:
    rgba(242, 237, 231, 0.50);
}


/* ==========================================================
   ANIMACIONES
   ========================================================== */

@keyframes drift {

  from {
    transform:
      translate3d(0,0,0)
      scale(1);
  }

  to {
    transform:
      translate3d(20px,-18px,0)
      scale(1.08);
  }

}


@keyframes pulseLine {

  0%,
  100% {
    opacity: 0.30;

    transform:
      scaleX(0.94);
  }

  50% {
    opacity: 0.62;

    transform:
      scaleX(1.03);
  }

}


/* ==========================================================
   RESPONSIVE
   ========================================================== */

@media (max-width: 900px) {

  .frase-texto {
    font-size:
      clamp(
        2.2rem,
        7vw,
        4.2rem
      );

    line-height: 1;
  }

  .frase-meta {
    font-size: 10px;

    gap: 8px;

    letter-spacing: 0.12em;
  }

}


@media (max-width: 560px) {

  .frase-page {
    padding:
      24px 18px;
  }

  .frase-meta {
    margin-bottom: 22px;

    padding:
      8px 12px;

    font-size: 9px;
  }

  .frase-texto {
    font-size:
      clamp(
        2rem,
        9vw,
        3.35rem
      );

    line-height: 1.02;
  }

  .frase-corner {
    left: 16px;
    bottom: 14px;

    font-size: 9px;
  }

}

/* ===== INDEX FRASES ===== */

/*
  El índice sí puede crecer verticalmente.
  La clase en <html> sobreescribe el overflow:hidden global
  que usan las páginas individuales de frases.
*/
html.frases-index-html {
  height: auto;
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: rgba(159,29,44,.34) transparent;
}

html.frases-index-html::-webkit-scrollbar {
  width: 7px;
}

html.frases-index-html::-webkit-scrollbar-track {
  background: transparent;
}

html.frases-index-html::-webkit-scrollbar-thumb {
  background: rgba(159,29,44,.30);
  border-radius: 999px;
}

html.frases-index-html::-webkit-scrollbar-thumb:hover {
  background: rgba(159,29,44,.48);
}

.frases-index-body {
  margin: 0;
  width: 100%;
  height: auto;
  min-height: 100svh;
  overflow-x: hidden;
  overflow-y: visible;
  background: var(--bg);
  color: var(--text);
}

.frases-index-page {
  position: relative;
  z-index: 2;

  width: 100%;
  min-height: 100svh;

  display: flex;
  align-items: flex-start;
  justify-content: center;

  padding:
    clamp(92px, 10vh, 132px)
    clamp(24px, 5vw, 72px)
    clamp(110px, 12vh, 160px);
}

.frases-index {
  width: min(960px, 100%);

  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));

  gap:
    clamp(18px, 2.2vw, 26px)
    clamp(18px, 2.5vw, 30px);

  animation:
    frasesIndexEnter
    1.05s
    cubic-bezier(.2,.8,.2,1)
    both;
}

.frases-index-item {
  position: relative;
  isolation: isolate;

  width: 100%;
  aspect-ratio: 1 / 1.08;

  display: grid;
  place-items: center;

  color: rgba(242,237,231,.62);
  text-decoration: none;

  border: 1px solid rgba(255,255,255,.035);
  border-radius: 1px;

  background:
    linear-gradient(
      145deg,
      rgba(255,255,255,.010),
      rgba(255,255,255,.002)
    );

  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,.006);

  overflow: hidden;

  transition:
    color 420ms ease,
    border-color 420ms ease,
    background 420ms ease,
    box-shadow 420ms ease,
    transform 420ms cubic-bezier(.2,.8,.2,1);
}

.frases-index-item::before {
  content: "";

  position: absolute;
  z-index: -1;

  width: 82%;
  aspect-ratio: 1;

  border-radius: 50%;

  background:
    radial-gradient(
      circle,
      rgba(150,20,40,.16),
      rgba(150,20,40,.055) 34%,
      transparent 70%
    );

  filter: blur(24px);

  opacity: .18;
  transform: scale(.72);

  transition:
    opacity 560ms ease,
    transform 620ms cubic-bezier(.2,.8,.2,1);
}

.frases-index-item::after {
  content: "";
  position: absolute;
  left: 22%;
  right: 22%;
  bottom: 14%;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(159,29,44,.16),
    transparent
  );
  opacity: 0;
  transform: scaleX(.45);
  transition:
    opacity 420ms ease,
    transform 520ms cubic-bezier(.2,.8,.2,1);
}

.frases-index-item span {
  position: relative;
  z-index: 2;

  font-family:
    'Cormorant Garamond',
    serif;

  font-size:
    clamp(3.5rem, 4.65vw, 5rem);

  font-weight: 500;

  line-height: .88;
  letter-spacing: -.06em;

  transform: translateY(-.02em);

  transition:
    transform 500ms cubic-bezier(.2,.8,.2,1),
    text-shadow 500ms ease;
}

.frases-index-item:hover,
.frases-index-item:focus-visible {
  color: rgba(255,246,242,.96);

  border-color:
    rgba(159,29,44,.18);

  background:
    linear-gradient(
      145deg,
      rgba(130,20,34,.032),
      rgba(255,255,255,.004)
    );

  box-shadow:
    inset 0 0 0 1px rgba(159,29,44,.025),
    0 16px 46px rgba(0,0,0,.15);

  transform:
    translateY(-3px);

  outline: none;
}

.frases-index-item:hover::before,
.frases-index-item:focus-visible::before {
  opacity: .82;
  transform: scale(1);
}

.frases-index-item:hover::after,
.frases-index-item:focus-visible::after {
  opacity: 1;
  transform: scaleX(1);
}

.frases-index-item:hover span,
.frases-index-item:focus-visible span {
  transform:
    translateY(-.03em)
    scale(1.025);

  text-shadow:
    0 0 34px
    rgba(159,29,44,.16);
}

.frases-home {
  position: fixed;

  z-index: 5;

  left: 22px;
  bottom: 18px;

  color:
    rgba(242,237,231,.34);

  text-decoration: none;

  text-transform: uppercase;

  font-family:
    'Inter',
    sans-serif;

  font-size: 10px;

  letter-spacing: .17em;

  transition:
    color 300ms ease;
}

.frases-home:hover {
  color:
    rgba(242,237,231,.76);
}

@keyframes frasesIndexEnter {

  from {
    opacity: 0;

    transform:
      translateY(14px)
      scale(.992);
  }

  to {
    opacity: 1;

    transform:
      translateY(0)
      scale(1);
  }

}

@media (max-width: 1050px) {

  .frases-index {
    width: min(780px, 100%);
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .frases-index-item span {
    font-size:
      clamp(3.35rem, 7vw, 4.7rem);
  }

}

@media (max-width: 720px) {

  .frases-index-page {
    padding:
      82px 18px
      100px;
  }

  .frases-index {
    width: min(520px, 100%);

    grid-template-columns:
      repeat(3, minmax(0, 1fr));

    gap: 14px;
  }

  .frases-index-item {
    aspect-ratio: 1 / 1.06;
  }

  .frases-index-item span {
    font-size:
      clamp(2.7rem, 11vw, 4.1rem);
  }

}

@media (max-width: 480px) {

  .frases-index {
    width: min(330px, 100%);

    grid-template-columns:
      repeat(2, minmax(0, 1fr));

    gap: 13px;
  }

  .frases-index-item span {
    font-size:
      clamp(3rem, 18vw, 4.25rem);
  }

  .frases-home {
    left: 16px;
    bottom: 14px;
  }

}

@media (prefers-reduced-motion: reduce) {

  .frases-index,
  .frases-index-item,
  .frases-index-item::before,
  .frases-index-item::after,
  .frases-index-item span {
    animation: none;
    transition: none;
  }

}

/* ===== FIN INDEX FRASES ===== */

/* ===== SOPORTE LOTE FRASES ===== */

.frase-bloque {
  display: block;
}

.frase-bloque + .frase-bloque {
  margin-top: 0.24em;
}

.frase-escena {
  position: relative;
}

.frase-escena--con-imagen {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 340px);
  gap: clamp(20px, 4vw, 56px);
  align-items: center;
}

.frase-ilustracion {
  margin: 0;
  opacity: 0.24;
  filter:
    saturate(.92)
    contrast(1.03)
    drop-shadow(0 8px 40px rgba(0,0,0,.35));
  animation:
    fraseFloat 9s ease-in-out infinite alternate;
}

.frase-ilustracion img {
  display: block;
  width: 100%;
  max-height: 68svh;
  object-fit: contain;
}

@keyframes fraseFloat {
  from {
    transform: translateY(0px);
  }
  to {
    transform: translateY(-10px);
  }
}

@media (max-width: 820px) {
  .frase-escena--con-imagen {
    grid-template-columns: 1fr;
  }

  .frase-ilustracion {
    max-width: 260px;
    margin: 0 auto 10px;
    opacity: 0.18;
  }
}

/* ===== FIN SOPORTE LOTE FRASES ===== */

/* ===== VISOR / GALERÍA FRASES ===== */

/* El documento sigue siendo una escena fija. Sólo el contenido de una
   cita extraordinariamente larga obtiene scroll propio. */
.frase-page {
  overflow: hidden;
}

.frase-shell {
  max-height: calc(100svh - 110px);
}

.frase-escena {
  max-height: calc(100svh - 175px);
}

.frase-texto {
  max-height: calc(100svh - 190px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(159,29,44,.48) transparent;
  padding: 0.08em 0.18em 0.18em;
}

.frase-texto::-webkit-scrollbar {
  width: 5px;
}

.frase-texto::-webkit-scrollbar-track {
  background: transparent;
}

.frase-texto::-webkit-scrollbar-thumb {
  background: rgba(159,29,44,.42);
  border-radius: 999px;
}

/* Escalado editorial: no encoge todas las frases, sólo las que lo necesitan. */
.frase--media .frase-texto {
  font-size: clamp(2.05rem, 3.65vw, 4.25rem);
  line-height: 1.01;
}

.frase--larga .frase-texto {
  font-size: clamp(1.65rem, 2.75vw, 3.15rem);
  line-height: 1.04;
}

.frase--extra .frase-texto {
  font-size: clamp(1.28rem, 2.05vw, 2.35rem);
  line-height: 1.08;
}

/* Sólo mostramos una pista visual de scroll cuando JS detecta desborde real. */
.frase-texto.is-scrollable {
  mask-image: linear-gradient(
    to bottom,
    transparent 0,
    black 18px,
    black calc(100% - 28px),
    transparent 100%
  );
  padding-top: 18px;
  padding-bottom: 28px;
}

.frase-nav {
  position: fixed;
  z-index: 8;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: clamp(14px, 2vw, 26px);
  font-family: 'Inter', sans-serif;
}

.frase-nav a {
  color: rgba(242,237,231,.38);
  text-decoration: none;
  transition:
    color 250ms ease,
    transform 250ms ease,
    border-color 250ms ease,
    background 250ms ease;
}

.frase-nav-btn {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 999px;
  background: rgba(255,255,255,.018);
  font-size: 18px;
}

.frase-nav-index {
  padding: 10px 4px;
  font-size: 10px;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.frase-nav a:hover,
.frase-nav a:focus-visible {
  color: rgba(242,237,231,.92);
}

.frase-nav-btn:hover,
.frase-nav-btn:focus-visible {
  border-color: rgba(159,29,44,.34);
  background: rgba(159,29,44,.07);
  transform: scale(1.06);
}

@media (max-width: 900px) {
  .frase--media .frase-texto {
    font-size: clamp(1.85rem, 5.6vw, 3.25rem);
  }

  .frase--larga .frase-texto {
    font-size: clamp(1.48rem, 4.5vw, 2.55rem);
  }

  .frase--extra .frase-texto {
    font-size: clamp(1.18rem, 3.7vw, 2rem);
  }
}

@media (max-width: 560px) {
  .frase-shell {
    max-height: calc(100svh - 92px);
  }

  .frase-escena {
    max-height: calc(100svh - 145px);
  }

  .frase-texto {
    max-height: calc(100svh - 160px);
  }

  .frase--media .frase-texto {
    font-size: clamp(1.72rem, 7vw, 2.55rem);
  }

  .frase--larga .frase-texto {
    font-size: clamp(1.38rem, 5.5vw, 2rem);
  }

  .frase--extra .frase-texto {
    font-size: clamp(1.08rem, 4.35vw, 1.6rem);
  }

  .frase-corner {
    max-width: 34vw;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .frase-nav {
    bottom: 10px;
  }

  .frase-nav-btn {
    width: 34px;
    height: 34px;
  }
}

/* ===== FIN VISOR / GALERÍA FRASES ===== */

/* ===== COMILLAS EDITORIALES ===== */

.frase-texto {
  position: relative;
}

.frase-texto::before {
  content: "“";

  position: absolute;
  z-index: -1;

  left: -0.05em;
  top: -0.24em;

  font-family: 'Cormorant Garamond', serif;
  font-size: 2.35em;
  font-weight: 600;
  line-height: 1;

  color: rgba(159, 29, 44, 0.30);

  pointer-events: none;
}

.frase-texto::after {
  content: "”";

  display: inline;

  margin-left: 0.08em;

  font-family: 'Cormorant Garamond', serif;
  font-size: 1.12em;
  font-weight: 600;

  color: rgba(159, 29, 44, 0.62);
}

/* ===== FIN COMILLAS EDITORIALES ===== */

/* ===== REGRESO FRASES ===== */

.frase-back {
  position: fixed;
  z-index: 9;

  top: 22px;
  left: 22px;

  color: rgba(242,237,231,.38);
  text-decoration: none;

  font-family: 'Inter', sans-serif;
  font-size: 10px;
  font-weight: 400;

  letter-spacing: .17em;
  text-transform: uppercase;

  transition:
    color 250ms ease,
    transform 250ms ease;
}

.frase-back:hover,
.frase-back:focus-visible {
  color: rgba(242,237,231,.90);
  transform: translateX(-3px);
}

.frase-corner {
  text-decoration: none;
  transition: color 250ms ease;
}

.frase-corner:hover {
  color: rgba(242,237,231,.72);
}

@media (max-width: 560px) {
  .frase-back {
    top: 16px;
    left: 16px;
    font-size: 9px;
  }
}

/* ===== FIN REGRESO FRASES ===== */

/* Controles legibles y separados del texto en ventanas pequeñas. */
.frase-nav {
  bottom: max(12px, env(safe-area-inset-bottom));
  padding: 6px 12px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 999px;
  background: rgba(9,9,9,.96);
  white-space: nowrap;
}

.frase-nav a,
.frase-back {
  color: rgba(242,237,231,.85);
}

.frase-back {
  padding: 9px 12px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 999px;
  background: rgba(9,9,9,.96);
}

@media (max-width: 560px) {
  .frase-corner { display: none; }
}
