/* ============================================================
   Mis Historias — lenguaje visual
   El mar visto desde la profundidad.
   Blanco-niebla · azules fríos · gris · azul abismo
   Cormorant Garamond (display) + EB Garamond (cuerpo)
   ============================================================ */

:root {
  /* superficies — la luz que baja desde la superficie del agua */
  --sea:        #e7eef3;   /* fondo app (niebla marina) */
  --surface:    #ffffff;
  --surface-2:  #f3f8fb;
  --surface-deep:#d8e4ec;

  /* tinta — azul pizarra profundo */
  --ink:       #16242f;
  --ink-soft:  #3f5b6b;
  --ink-faint: #7f97a3;

  /* trim — espuma / acero marino (reemplaza al dorado) */
  --trim:      #5d89a3;
  --trim-soft: #a6c4d6;
  --trim-pale: #dceaf1;

  /* acento — azul abismo (temable) */
  --accent:      #0f3f5c;
  --accent-soft: #2f6e92;
  --accent-pale: #e2edf3;

  --line:      rgba(22, 36, 47, 0.13);
  --line-soft: rgba(22, 36, 47, 0.07);

  --font-display: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --font-body:    'EB Garamond', Georgia, 'Times New Roman', serif;

  --read-w: 660px;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);

  --paper-texture: 1;
}

/* ---- variantes de paleta (tweaks) — todas marinas ---- */
:root[data-accent="profundo"] {            /* azul abismo (default) */
  --accent:      #0f3f5c;
  --accent-soft: #2f6e92;
  --accent-pale: #e2edf3;
  --trim:        #5d89a3;
  --trim-soft:   #a6c4d6;
  --trim-pale:   #dceaf1;
}
:root[data-accent="marea"] {               /* turquesa / agua media */
  --accent:      #115e63;
  --accent-soft: #2f8c8f;
  --accent-pale: #e0f0ef;
  --trim:        #4fa0a3;
  --trim-soft:   #a6d3d3;
  --trim-pale:   #dcefee;
}
:root[data-accent="niebla"] {              /* azul-gris bruma */
  --accent:      #3a5566;
  --accent-soft: #5f7f92;
  --accent-pale: #e7edf1;
  --trim:        #7e9aab;
  --trim-soft:   #bcccd6;
  --trim-pale:   #e4ecf0;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--sea);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 19px;
  line-height: 1.72;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "liga" 1, "kern" 1;
}

/* textura sutil: luz filtrándose en el agua */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: calc(var(--paper-texture) * 0.6);
  background-image:
    radial-gradient(ellipse at 20% 0%, rgba(120,170,200,0.16), transparent 55%),
    radial-gradient(ellipse at 85% 12%, rgba(60,110,150,0.10), transparent 50%),
    radial-gradient(circle at 50% 120%, rgba(15,63,92,0.10), transparent 60%),
    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.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
}

#root { position: relative; z-index: 1; }

/* ============================================================
   Ornamentos / utilidades
   ============================================================ */
.ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--trim);
}
.ornament .line {
  height: 1px;
  width: 54px;
  background: linear-gradient(to var(--dir, right), transparent, var(--trim-soft));
}
.ornament .line.left  { --dir: left; }
.ornament .wave {
  flex: none;
  display: block;
  color: var(--trim);
  opacity: 0.95;
}

.eyebrow {
  font-family: var(--font-body);
  font-size: 12px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--trim);
  font-weight: 500;
}

/* botones */
.btn {
  font-family: var(--font-body);
  font-size: 13px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--accent);
  background: transparent;
  border: 1px solid var(--accent-soft);
  padding: 15px 34px;
  cursor: pointer;
  transition: all 0.3s var(--ease);
  border-radius: 1px;
}
.btn:hover {
  background: var(--accent);
  color: var(--surface);
  border-color: var(--accent);
}
.btn-ghost {
  border: none;
  padding: 0;
  background: none;
  color: var(--ink-soft);
  letter-spacing: 0.16em;
  font-size: 12px;
}
.btn-ghost:hover { color: var(--accent); background: none; }

.link-quiet {
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  transition: color 0.25s var(--ease), border-color 0.25s var(--ease);
  cursor: pointer;
}
.link-quiet:hover { color: var(--accent); border-color: var(--accent-soft); }

/* ============================================================
   Header (oculto en inicio)
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(20px, 5vw, 56px);
  height: 64px;
  background: color-mix(in srgb, var(--sea) 86%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line-soft);
}
.site-mark {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--ink);
  cursor: pointer;
  background: none; border: none; padding: 0;
}
.site-mark .amp { color: var(--trim); }
.site-nav { display: flex; gap: clamp(16px, 3vw, 36px); }
.nav-link {
  font-family: var(--font-body);
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  background: none; border: none; padding: 6px 0; cursor: pointer;
  position: relative;
  transition: color 0.25s var(--ease);
}
.nav-link:hover { color: var(--ink); }
.nav-link.active { color: var(--accent); }
.nav-link.active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 1px;
  background: var(--trim);
}

/* ============================================================
   Transición de vistas
   ============================================================ */
.view {
  animation: rise 0.55s var(--ease) both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   INICIO — descenso a la profundidad
   ============================================================ */
.home {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 80px clamp(24px, 6vw, 60px) 56px;
  overflow: hidden;
}
/* degradado: superficie luminosa arriba → abismo abajo */
.home::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--accent) 6%, var(--surface)) 0%,
    var(--sea) 42%,
    color-mix(in srgb, var(--accent) 14%, var(--sea)) 100%);
}
.home-inner { max-width: 720px; position: relative; }
.home-title {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(52px, 11vw, 104px);
  line-height: 1.0;
  letter-spacing: 0.005em;
  margin: 26px 0 0;
  color: var(--ink);
}
.home-sub {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(21px, 3.4vw, 30px);
  color: var(--accent-soft);
  margin: 18px 0 0;
  letter-spacing: 0.01em;
}
.home-intro {
  font-size: clamp(17px, 2.2vw, 20px);
  color: var(--ink-soft);
  max-width: 480px;
  margin: 30px auto 0;
  line-height: 1.85;
}
.home-cta { margin-top: 44px; }
.home-foot {
  margin-top: 64px;
  font-size: 14px;
  color: var(--ink-faint);
  letter-spacing: 0.04em;
}
/* olas al pie de la portada */
.home-waves {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  width: 100%;
  height: clamp(70px, 12vw, 130px);
  z-index: -1;
  color: var(--accent);
  pointer-events: none;
}

/* ============================================================
   Página genérica con columna de lectura
   ============================================================ */
.page {
  max-width: var(--max, 1080px);
  margin: 0 auto;
  padding: clamp(44px, 7vw, 88px) clamp(22px, 5vw, 56px) 120px;
}
.page-head { text-align: center; margin-bottom: clamp(44px, 6vw, 72px); }
.page-title {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(40px, 7vw, 68px);
  line-height: 1.05;
  margin: 18px 0 0;
  color: var(--ink);
}
.page-lede {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(18px, 2.4vw, 23px);
  color: var(--ink-soft);
  margin: 16px auto 0;
  max-width: 540px;
}

/* ============================================================
   BIBLIOTECA — colecciones + tarjetas
   ============================================================ */
.collection { margin-bottom: clamp(48px, 7vw, 80px); }
.collection:last-child { margin-bottom: 0; }
.collection-head {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 28px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line-soft);
}
.collection-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(27px, 4vw, 38px);
  line-height: 1.1;
  color: var(--ink);
  margin: 0;
  white-space: nowrap;
}
.collection-desc {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(16px, 2vw, 19px);
  color: var(--ink-faint);
  margin: 0;
}
.collection-count {
  margin-left: auto;
  font-family: var(--font-body);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--trim);
  white-space: nowrap;
  flex: none;
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: clamp(20px, 2.6vw, 32px);
}
.story-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: 2px;
  padding: 32px 30px 30px;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease), border-color 0.35s var(--ease);
  display: flex;
  flex-direction: column;
  min-height: 280px;
}
.story-card::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--trim-soft);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 0.4s var(--ease);
}
.story-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 24px 46px -28px rgba(15,63,92,0.42);
  border-color: var(--trim-pale);
}
.story-card:hover::before { transform: scaleY(1); }

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.theme-tag {
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--trim);
  font-weight: 500;
}
.status {
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 4px 11px;
  border-radius: 999px;
  font-weight: 500;
  white-space: nowrap;
}
.status.pub {
  color: var(--accent);
  background: var(--accent-pale);
}
.status.proc {
  color: var(--ink-faint);
  background: transparent;
  border: 1px dashed var(--line);
}
.card-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 30px;
  line-height: 1.12;
  color: var(--ink);
  margin: 0 0 14px;
}
.card-desc {
  font-size: 16.5px;
  line-height: 1.66;
  color: var(--ink-soft);
  margin: 0 0 22px;
  flex: 1;
}
.card-read {
  font-family: var(--font-body);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.card-read .arrow { transition: transform 0.3s var(--ease); }
.story-card:hover .card-read .arrow { transform: translateX(5px); }

/* ============================================================
   PÁGINA DE CUENTO
   ============================================================ */
.story { max-width: var(--read-w); margin: 0 auto; }
.story-back {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 40px;
  font-family: var(--font-body);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
  background: none; border: none; cursor: pointer;
  transition: color 0.25s var(--ease);
}
.story-back:hover { color: var(--accent); }

.story-meta {
  text-align: center;
  margin-bottom: 6px;
}
.story-collection {
  font-family: var(--font-body);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 8px;
}
.story-title {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(38px, 6.5vw, 62px);
  line-height: 1.06;
  text-align: center;
  color: var(--ink);
  margin: 14px 0 0;
}
.epigraph {
  margin: 38px auto 8px;
  max-width: 460px;
  text-align: center;
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(19px, 2.6vw, 23px);
  line-height: 1.5;
  color: var(--accent-soft);
}
.epigraph cite {
  display: block;
  margin-top: 14px;
  font-family: var(--font-body);
  font-style: normal;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.story-body {
  margin-top: 48px;
  font-size: 19.5px;
  line-height: 1.92;
  color: var(--ink);
}
.story-body p { margin: 0 0 1.5em; text-wrap: pretty; }
.story-body p:first-of-type::first-letter {
  font-family: var(--font-display);
  font-weight: 400;
  float: left;
  font-size: 4.4em;
  line-height: 0.74;
  padding: 8px 14px 0 0;
  color: var(--accent-soft);
}

.reflection {
  margin-top: 56px;
  padding: 40px clamp(26px, 5vw, 48px);
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-top: 2px solid var(--trim-soft);
  border-radius: 2px;
}
.reflection-label {
  text-align: center;
  margin-bottom: 22px;
}
.reflection p {
  font-family: var(--font-display);
  font-size: clamp(20px, 2.8vw, 25px);
  font-style: italic;
  line-height: 1.62;
  color: var(--ink-soft);
  margin: 0 0 0.7em;
  text-align: center;
  text-wrap: pretty;
}
.reflection p:last-child { margin-bottom: 0; }

/* compartir cuento */
.story-share {
  margin-top: 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}
.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-body);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--accent);
  background: var(--surface);
  border: 1px solid var(--trim-soft);
  padding: 12px 24px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.3s var(--ease);
}
.share-btn:hover {
  background: var(--accent-pale);
  border-color: var(--accent-soft);
}
.share-btn.copied {
  color: var(--surface);
  background: var(--accent);
  border-color: var(--accent);
}
.share-btn svg { flex: none; }
.share-hint {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 15px;
  color: var(--ink-faint);
}

.story-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 64px;
  padding-top: 36px;
  border-top: 1px solid var(--line-soft);
}
.story-nav .next-wrap { text-align: right; }
.story-nav .nav-cap {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 6px;
}
.story-nav .nav-name {
  font-family: var(--font-display);
  font-size: 21px;
  color: var(--accent);
  cursor: pointer;
  background: none; border: none; padding: 0;
}
.story-nav .nav-name:hover { color: var(--ink); }

/* ============================================================
   SOBRE EL PROYECTO
   ============================================================ */
.about { max-width: var(--read-w); margin: 0 auto; }
.about-body {
  font-size: 19.5px;
  line-height: 1.9;
  color: var(--ink);
}
.about-body p { margin: 0 0 1.5em; text-wrap: pretty; }
.about-body .lead {
  font-family: var(--font-display);
  font-size: clamp(22px, 3vw, 28px);
  font-style: italic;
  line-height: 1.5;
  color: var(--accent-soft);
  margin-bottom: 1.4em;
}
.signature {
  margin-top: 44px;
  text-align: center;
}
.signature .name {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 30px;
  color: var(--ink);
}
.signature .role {
  margin-top: 6px;
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--trim);
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 720px) {
  body { font-size: 18px; }
  .site-header { height: 58px; }
  .site-nav { gap: 16px; }
  .nav-link { font-size: 11px; letter-spacing: 0.08em; }
  .story-body p:first-of-type::first-letter { font-size: 3.6em; }
  .story-nav { flex-direction: column; align-items: stretch; gap: 22px; text-align: center; }
  .story-nav .next-wrap { text-align: center; }
  .collection-head { flex-wrap: wrap; gap: 6px 14px; }
  .collection-count { margin-left: 0; width: 100%; }
}
@media (max-width: 460px) {
  .site-mark { font-size: 18px; }
  .nav-link { letter-spacing: 0.04em; }
}
