:root {
  --ink: #3a2d4d;
  --ink-soft: #6b5b82;
  --cream: #fff8ec;
  --cream-deep: #ffefd2;
  --white: #ffffff;

  --coral: #ff6b6b;
  --coral-soft: #ffe0e0;
  --sky: #48cae4;
  --sky-soft: #dcf6ff;
  --mint: #2ec4b6;
  --mint-soft: #d7f7f0;
  --sun: #ffb703;
  --sun-soft: #ffedc2;
  --grass: #8ac926;
  --grass-soft: #e9f7cf;
  --grape: #9b5de5;
  --grape-soft: #ecdcff;
  --pink: #ff70a6;
  --pink-soft: #ffe0ec;

  --radius-lg: 26px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --shadow: 0 12px 30px rgba(58, 45, 77, 0.12);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--cream);
  background-image:
    radial-gradient(rgba(155, 93, 229, 0.08) 2.5px, transparent 2.5px),
    radial-gradient(rgba(255, 183, 3, 0.08) 2.5px, transparent 2.5px);
  background-size: 46px 46px, 46px 46px;
  background-position: 0 0, 23px 23px;
  color: var(--ink);
  font-family: "Nunito", -apple-system, sans-serif;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

header, main, footer { position: relative; z-index: 1; }

h1, h2, h3 {
  font-family: "Baloo 2", "Nunito", sans-serif;
  margin: 0;
  line-height: 1.15;
}

img, video { max-width: 100%; }

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--grape);
  color: #fff;
  padding: 0.6rem 1rem;
  border-radius: 0 0 10px 0;
  z-index: 100;
}
.skip-link:focus { left: 0; }

/* ============ Colores por acento ============ */
[data-accent="coral"] { --accent: var(--coral); --accent-soft: var(--coral-soft); }
[data-accent="sky"]   { --accent: var(--sky);   --accent-soft: var(--sky-soft); }
[data-accent="mint"]  { --accent: var(--mint);  --accent-soft: var(--mint-soft); }
[data-accent="sun"]   { --accent: #e09a00;     --accent-soft: var(--sun-soft); }
[data-accent="grass"] { --accent: #6f9e1f;     --accent-soft: var(--grass-soft); }
[data-accent="grape"] { --accent: var(--grape); --accent-soft: var(--grape-soft); }
[data-accent="pink"]  { --accent: var(--pink);  --accent-soft: var(--pink-soft); }

/* ============ Portada ============ */
.cover {
  position: relative;
  background: linear-gradient(160deg, #9b5de5 0%, #7b5df0 40%, #4a6cf0 100%);
  color: #fff;
  padding: 4.5rem 1.5rem 5rem;
  text-align: center;
  overflow: hidden;
}

.cover-sun {
  position: absolute;
  top: -70px;
  right: -70px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, #ffd166 0%, rgba(255, 209, 102, 0) 70%);
  opacity: 0.9;
}

.cover-cloud {
  position: absolute;
  height: 26px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.25);
}
.cover-cloud::before,
.cover-cloud::after {
  content: "";
  position: absolute;
  background: inherit;
  border-radius: 50%;
}
.cover-cloud::before { width: 34px; height: 34px; top: -16px; left: 14px; }
.cover-cloud::after  { width: 24px; height: 24px; top: -10px; left: 46px; }
.cloud-a { width: 110px; top: 18%; left: 8%; }
.cloud-b { width: 90px; top: 30%; right: 10%; }

.cover-inner {
  position: relative;
  max-width: 40rem;
  margin: 0 auto;
}

.cover-tag {
  display: inline-block;
  background: rgba(255, 255, 255, 0.18);
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  padding: 0.35rem 1rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.cover-title {
  font-size: clamp(2.8rem, 9vw, 5.2rem);
  font-weight: 800;
  line-height: 1.02;
  margin: 1.4rem 0 0.8rem;
  text-shadow: 0 4px 0 rgba(0, 0, 0, 0.12);
}

.cover-subtitle {
  margin: 0 auto;
  max-width: 30ch;
  font-size: 1.2rem;
  font-weight: 600;
  color: #ffe8f6;
}

.cover-quote {
  margin: 2.2rem auto 0;
  max-width: 34ch;
  background: rgba(255, 255, 255, 0.14);
  border: 1.5px dashed rgba(255, 255, 255, 0.45);
  border-radius: var(--radius-md);
  padding: 1.3rem 1.6rem;
}
.cover-quote p {
  margin: 0;
  font-size: 1.12rem;
  font-style: italic;
  font-weight: 600;
  line-height: 1.6;
}

.cover-creators {
  margin: 2.6rem auto 0;
  max-width: 30rem;
}
.creators-title {
  margin: 0 0 0.9rem;
  font-family: "Baloo 2", sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #ffe8a6;
}
.creator {
  margin: 0.4rem 0;
  font-weight: 700;
  font-size: 1.05rem;
}
.creator span {
  display: block;
  font-weight: 600;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.75);
}

.cover-meta {
  margin-top: 2.4rem;
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.95rem;
}
.cover-meta p { margin: 0.2rem 0; }
.cover-place {
  font-family: "Baloo 2", sans-serif;
  font-weight: 800;
  letter-spacing: 0.2em;
  font-size: 1.05rem;
  margin-top: 0.9rem !important;
}

/* ============ Índice ============ */
.toc {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
  padding: 1.4rem 1rem;
  background: var(--cream-deep);
  border-bottom: 3px dashed rgba(155, 93, 229, 0.25);
  position: sticky;
  top: 0;
  z-index: 20;
}
.toc a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.88rem;
  padding: 0.5rem 0.95rem;
  border-radius: 999px;
  box-shadow: 0 4px 10px rgba(58, 45, 77, 0.08);
  border: 2px solid transparent;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.toc a:hover { transform: translateY(-2px); }
.toc a:focus-visible { outline: 3px solid var(--grape); outline-offset: 2px; }
.toc-dot { width: 12px; height: 12px; border-radius: 50%; }
.dot-a { background: var(--grape); }
.dot-b { background: var(--coral); }
.dot-c { background: var(--mint); }
.dot-d { background: var(--sun); }

/* ============ Secciones ============ */
.section {
  max-width: 72rem;
  margin: 0 auto;
  padding: 3.5rem 1.5rem 1rem;
}

.section-header {
  text-align: center;
  margin: 0 0 3.5rem;
}
.section-kicker {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 800;
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.35rem 1rem;
  border-radius: 999px;
}
.section-header h2 {
  font-size: clamp(2rem, 5.5vw, 3rem);
  font-weight: 800;
  color: var(--accent);
  margin: 1rem 0 0.9rem;
}
.section-intro {
  max-width: 46ch;
  margin: 0 auto;
  font-size: 1.1rem;
  color: var(--ink-soft);
}

/* ============ Historia / artículo ============ */
.story {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.6rem;
  align-items: center;
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 2.6rem;
  margin-bottom: 3rem;
  box-shadow: var(--shadow);
  border: 3px solid var(--accent-soft);
  position: relative;
}

.story:nth-of-type(odd) .story-media { order: -1; }
.story:nth-of-type(even) .story-media { order: 1; }

.story-number {
  position: absolute;
  top: -1.6rem;
  left: 1.4rem;
  width: 3.4rem;
  height: 3.4rem;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
  font-family: "Baloo 2", sans-serif;
  font-weight: 800;
  font-size: 1.3rem;
  border-radius: 50%;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.18);
}

.story-media {
  margin: 0;
  background: var(--accent-soft);
  border-radius: var(--radius-md);
  overflow: hidden;
  align-self: start;
}
.story-media img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 58vh;
  object-fit: contain;
}
.story-media video {
  display: block;
  width: 100%;
  height: auto;
  max-height: 58vh;
  object-fit: contain;
  background: #000;
}
.media-tag {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  padding: 0.6rem 0.9rem;
}

.media-audio {
  padding: 0.9rem 1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.audio-label {
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--accent);
}
.media-audio audio { width: 100%; }

/* Galería */
.gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
  padding: 0.6rem;
  align-items: start;
}
.gallery img {
  width: 100%;
  height: auto;
  max-height: 46vh;
  object-fit: contain;
  background: #fff;
  border-radius: 12px;
  cursor: zoom-in;
}
.gallery img:first-child { grid-column: 1 / -1; }

/* Texto */
.story-text h3 {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 1rem;
}
.story-text p { font-size: 1.02rem; color: var(--ink); }
.story-text p.italic { font-style: italic; color: var(--ink-soft); }
.story-text .note { font-size: 0.92rem; color: var(--ink-soft); }

blockquote.voice {
  margin: 1.2rem 0;
  padding: 1rem 1.2rem;
  background: var(--accent-soft);
  border-left: 6px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic;
}
blockquote.voice cite {
  display: block;
  margin-top: 0.4rem;
  font-style: normal;
  font-weight: 800;
  color: var(--accent);
  font-size: 0.9rem;
}

.big-quote {
  font-family: "Baloo 2", sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
  margin: 1.2rem 0;
  padding-left: 1rem;
  border-left: 6px solid var(--accent);
}

/* Reflexión final */
.story-reflection { grid-template-columns: 1fr 1.2fr; }
.closing-quote {
  margin: 1.4rem 0;
  padding: 1.4rem;
  background: var(--grape-soft);
  border-radius: var(--radius-md);
  font-family: "Baloo 2", sans-serif;
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--grape);
}
.attribution { font-size: 0.9rem; color: var(--ink-soft); font-style: italic; }
.thanks {
  margin-top: 1.2rem;
  padding: 1.2rem;
  background: var(--cream-deep);
  border-radius: var(--radius-md);
  font-style: italic;
}
.signature {
  font-family: "Baloo 2", sans-serif;
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--grape);
}

/* ============ Referencias ============ */
.references {
  max-width: 72rem;
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
}
.refs-list {
  max-width: 60ch;
  margin: 0 auto;
  padding: 1.8rem 2.2rem 1.8rem 2.8rem;
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 3px solid var(--sun-soft);
  counter-reset: ref;
}
.refs-list li {
  counter-increment: ref;
  position: relative;
  margin-bottom: 1.2rem;
  padding-left: 0.4rem;
  font-size: 0.98rem;
  list-style: none;
}
.refs-list li::before {
  content: counter(ref);
  position: absolute;
  left: -2rem;
  top: 0.15rem;
  width: 1.6rem;
  height: 1.6rem;
  display: grid;
  place-items: center;
  background: var(--sun);
  color: #fff;
  font-family: "Baloo 2", sans-serif;
  font-weight: 800;
  font-size: 0.8rem;
  border-radius: 50%;
}

/* ============ Colofón ============ */
.colophon {
  text-align: center;
  padding: 2.5rem 1rem 3rem;
  background: var(--grape);
  color: #fff;
  font-weight: 700;
}
.colophon p { margin: 0; }

/* ============ Lightbox ============ */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(30, 20, 45, 0.92);
  display: grid;
  place-items: center;
  padding: 2rem;
  z-index: 60;
}
.lightbox[hidden] { display: none; }
.lightbox-img {
  max-width: 92vw;
  max-height: 88vh;
  border-radius: var(--radius-md);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1.4rem;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background: #fff;
  color: var(--ink);
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
}

/* ============ Decoración flotante ============ */
.sky-decor {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.float-cloud {
  position: absolute;
  width: 120px;
  height: 30px;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 999px;
}
.float-cloud::before,
.float-cloud::after {
  content: "";
  position: absolute;
  background: inherit;
  border-radius: 50%;
}
.float-cloud::before { width: 42px; height: 42px; top: -22px; left: 18px; }
.float-cloud::after  { width: 30px; height: 30px; top: -14px; left: 62px; }

.float-star {
  position: absolute;
  width: 18px;
  height: 18px;
  background: var(--sun);
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}

.float-ball {
  position: absolute;
  border-radius: 50%;
}

.float-ring {
  position: absolute;
  border-radius: 50%;
  border: 5px solid rgba(255, 107, 107, 0.35);
  background: transparent;
}

.fc1 { top: 12%; left: 4%;  opacity: 0.8;  animation: drift 36s ease-in-out infinite; }
.fc2 { top: 34%; right: 5%; opacity: 0.65; animation: drift 44s ease-in-out infinite reverse; transform: scale(0.7); }
.fc3 { top: 58%; left: 8%;  opacity: 0.55; animation: drift 40s ease-in-out infinite; transform: scale(0.85); }
.fc4 { top: 78%; right: 8%; opacity: 0.7;  animation: drift 50s ease-in-out infinite; }

.fs1 { top: 18%; right: 12%;  animation: twinkle 5s ease-in-out infinite; }
.fs2 { top: 46%; left: 3%;   animation: twinkle 6.5s ease-in-out infinite 1s; background: var(--pink); }
.fs3 { top: 70%; right: 4%;  animation: twinkle 5.5s ease-in-out infinite 2s; }
.fs4 { top: 88%; left: 12%;  animation: twinkle 7s ease-in-out infinite 0.5s; background: var(--mint); }

.fb1 { top: 24%; left: 18%;  width: 26px; height: 26px; background: var(--mint);  opacity: 0.35; animation: drift 30s ease-in-out infinite; }
.fb2 { top: 62%; right: 16%; width: 20px; height: 20px; background: var(--pink);   opacity: 0.4;  animation: drift 38s ease-in-out infinite reverse; }
.fb3 { top: 82%; left: 30%;  width: 14px; height: 14px; background: var(--sky);    opacity: 0.45; animation: drift 28s ease-in-out infinite 1.5s; }
.fb4 { top: 8%;  right: 30%; width: 16px; height: 16px; background: var(--sun);    opacity: 0.4;  animation: drift 34s ease-in-out infinite 2s; }

.fr1 { top: 40%; left: 6%;   width: 40px; height: 40px; animation: drift 42s ease-in-out infinite; }
.fr2 { top: 66%; right: 10%; width: 52px; height: 52px; border-color: rgba(72, 202, 228, 0.35); animation: drift 48s ease-in-out infinite reverse; }
.fr3 { top: 14%; left: 40%;  width: 30px; height: 30px; border-color: rgba(138, 201, 38, 0.35); animation: drift 32s ease-in-out infinite 1s; }

@keyframes drift {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  25%      { transform: translate(14px, -18px) rotate(3deg); }
  50%      { transform: translate(-10px, 10px) rotate(-3deg); }
  75%      { transform: translate(12px, 16px) rotate(2deg); }
}

@keyframes twinkle {
  0%, 100% { transform: scale(1) rotate(0deg); opacity: 1; }
  50%      { transform: scale(1.35) rotate(20deg); opacity: 0.55; }
}

/* Estrellas de la portada */
.cover-star {
  position: absolute;
  width: 20px;
  height: 20px;
  background: #ffd166;
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
  animation: twinkle 4s ease-in-out infinite;
}
.star-a { top: 14%; left: 22%; }
.star-b { top: 26%; right: 20%; animation-delay: 1.2s; }
.star-c { bottom: 20%; left: 14%; animation-delay: 2s; width: 14px; height: 14px; }

/* ============ Responsivo ============ */
@media (max-width: 860px) {
  .story, .story-reflection {
    grid-template-columns: 1fr;
    gap: 1.6rem;
    padding: 2.2rem 1.4rem 1.8rem;
  }
  .story:nth-of-type(even) .story-media,
  .story:nth-of-type(odd) .story-media { order: 0; }
  .story-number { top: -1.4rem; }
  .gallery { grid-template-columns: repeat(2, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
