/* ============================================
   RELATO.CSS — Estilos para páginas de relato
   jmsdbg.com
   
   USO: <link rel="stylesheet" href="/relato.css">
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;0,600;1,300;1,400;1,500&family=Lora:ital,wght@0,400;0,500;1,400;1,500&display=swap');

:root {
    --bg: #f6f1eb;
    --text: #2c2420;
    --text-light: #4a3f38;
    --text-faint: #6e6256;
    --accent: #7a3d10;
    --accent-soft: #946840;
    --rule: #c4b5a5;
    --drop-cap: #6b3a1f;
}

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

html {
    font-size: 18px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Lora', Georgia, serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.85;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* --- PROGRESO --- */
.progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 2px;
    background: var(--accent-soft);
    z-index: 100;
    transition: width 0.1s linear;
    width: 0%;
}

/* --- CONTENEDOR --- */
.page {
    max-width: 640px;
    margin: 0 auto;
    padding: 6rem 2rem 8rem;
}

/* --- CABECERA --- */
.story-header {
    text-align: center;
    margin-bottom: 4rem;
    padding-bottom: 3rem;
    border-bottom: 1px solid var(--rule);
    animation: fadeUp 1s ease both;
}

.story-subtitle {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 0.8rem;
    font-weight: 400;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--text-faint);
    margin-bottom: 1.5rem;
}

.story-title {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 2.8rem;
    font-weight: 300;
    color: var(--text);
    line-height: 1.2;
    margin-bottom: 1rem;
    letter-spacing: 0.02em;
}

.story-author {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-light);
    font-style: italic;
    letter-spacing: 0.05em;
}

.story-epigraph {
    font-style: italic;
    color: var(--text-light);
    font-size: 0.95rem;
    max-width: 420px;
    margin: 2rem auto 0;
    text-align: center;
    line-height: 1.7;
}

.story-epigraph cite {
    display: block;
    font-style: normal;
    font-size: 0.8rem;
    color: var(--text-faint);
    margin-top: 0.5rem;
    letter-spacing: 0.05em;
}

/* --- ÍNDICE --- */
.story-toc {
    margin-bottom: 4rem;
    padding: 2rem 0;
    animation: fadeUp 1s ease 0.2s both;
}

.story-toc-title {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--text-faint);
    text-align: center;
    margin-bottom: 1.5rem;
}

.story-toc ol {
    list-style: none;
    max-width: 380px;
    margin: 0 auto;
}

.story-toc li {
    border-bottom: 1px solid rgba(196, 181, 165, 0.4);
}

.story-toc li:last-child {
    border-bottom: none;
}

.story-toc a {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.7rem 0;
    text-decoration: none;
    color: var(--text-light);
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.05rem;
    transition: color 0.3s ease;
}

.story-toc a:hover {
    color: var(--accent);
}

.toc-number {
    font-size: 0.8rem;
    color: var(--text-faint);
}

/* --- CAPÍTULOS / SECCIONES --- */
.chapter {
    margin-bottom: 4rem;
    animation: fadeUp 1s ease 0.4s both;
}

.chapter-header {
    text-align: center;
    margin-bottom: 2.5rem;
    padding-top: 2rem;
}

.chapter-number {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--text-faint);
    margin-bottom: 0.8rem;
}

/* Número de sección solo (sin título) */
.chapter-number--solo {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.6rem;
    font-weight: 300;
    color: var(--text-light);
    margin-bottom: 0;
    letter-spacing: 0.1em;
}

.chapter-title {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.8rem;
    font-weight: 300;
    color: var(--text);
    letter-spacing: 0.03em;
}

.chapter-sep {
    width: 30px;
    height: 1px;
    background: var(--rule);
    margin: 1.5rem auto 0;
}

.chapter-divider {
    text-align: center;
    padding: 2rem 0;
    margin: 2rem 0;
    border-top: 1px solid var(--rule);
}

.chapter-divider::after {
    content: '✦';
    display: block;
    color: var(--rule);
    font-size: 0.7rem;
    margin-top: -0.7rem;
    background: var(--bg);
    width: 2rem;
    margin-left: auto;
    margin-right: auto;
}

.chapter-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 0;
    margin-top: 1rem;
    border-top: 1px solid rgba(196, 181, 165, 0.4);
}

.chapter-nav a {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 0.85rem;
    color: var(--text-faint);
    text-decoration: none;
    letter-spacing: 0.08em;
    transition: color 0.3s ease;
}

.chapter-nav a:hover {
    color: var(--accent);
}

.chapter-nav .to-top {
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

/* --- CUERPO TEXTO --- */
.story-body p,
.chapter-body p {
    margin-bottom: 1.5rem;
    text-align: justify;
    hyphens: auto;
    -webkit-hyphens: auto;
}

.drop-cap::first-letter {
    font-family: 'Cormorant Garamond', Georgia, serif;
    float: left;
    font-size: 4.2rem;
    line-height: 0.75;
    font-weight: 600;
    color: var(--drop-cap);
    padding-right: 0.12em;
    padding-top: 0.08em;
}

.scene-break {
    text-align: center;
    margin: 3rem 0;
    color: var(--text-faint);
    font-size: 1.2rem;
    letter-spacing: 0.8em;
    user-select: none;
}

/* --- SWITCHER DE IDIOMA --- */
.lang-switcher {
    display: flex;
    justify-content: center;
    gap: 0.8rem;
    margin-bottom: 1.5rem;
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 0.8rem;
    letter-spacing: 0.15em;
}

.lang-current {
    color: var(--text);
    font-weight: 500;
    border-bottom: 1px solid var(--text-faint);
    padding-bottom: 2px;
}

.lang-link {
    color: var(--text-faint);
    text-decoration: none;
    transition: color 0.3s ease;
    padding-bottom: 2px;
}

.lang-link:hover {
    color: var(--accent);
}

/* --- PIE --- */
.story-footer {
    margin-top: 5rem;
    padding-top: 3rem;
    border-top: 1px solid var(--rule);
    text-align: center;
}

.story-end-mark {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.4rem;
    color: var(--text-faint);
    margin-bottom: 2rem;
    letter-spacing: 0.3em;
}

.story-footer-info {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 0.85rem;
    color: var(--text-faint);
    letter-spacing: 0.1em;
    line-height: 2;
}

.story-footer-info a {
    color: var(--accent-soft);
    text-decoration: none;
    transition: color 0.3s ease;
}

.story-footer-info a:hover {
    color: var(--accent);
}

/* --- LECTURA EN VOZ ALTA --- */
.reading-active {
    background: rgba(148, 104, 64, 0.1);
    border-radius: 4px;
    padding: 0.2rem 0.4rem;
    margin-left: -0.4rem;
    margin-right: -0.4rem;
    transition: background 0.4s ease;
}

/* --- RESPONSIVE --- */
@media (max-width: 768px) {
    html { font-size: 17px; }
    .page { padding: 4rem 1.5rem 6rem; }
    .story-title { font-size: 2.2rem; }
    .chapter-title { font-size: 1.5rem; }
    .drop-cap::first-letter { font-size: 3.5rem; }
}

@media (max-width: 480px) {
    html { font-size: 16px; }
    .page { padding: 3rem 1.2rem 5rem; }
    .story-title { font-size: 1.9rem; }
    .story-body p, .chapter-body p { text-align: left; hyphens: none; }
    .chapter-nav { flex-direction: column; gap: 0.8rem; align-items: center; }
}

/* S24+ */
@media (min-width: 900px) and (max-width: 1280px) {
    html { font-size: 22px; }
    .story-title { font-size: 3.5rem; }
    .story-subtitle { font-size: 1.2rem; }
    .story-author { font-size: 1.4rem; }
    .story-epigraph { font-size: 1.3rem; }
    .story-epigraph cite { font-size: 1.1rem; }
    .chapter-number { font-size: 1.1rem; }
    .chapter-number--solo { font-size: 2.2rem; }
    .chapter-title { font-size: 2.2rem; }
    .story-toc-title { font-size: 1.1rem; }
    .story-toc a { font-size: 1.4rem; }
    .toc-number { font-size: 1.1rem; }
    .chapter-nav a { font-size: 1.2rem; }
    .story-end-mark { font-size: 1.8rem; }
    .story-footer-info { font-size: 1.2rem; }
    .lang-switcher { font-size: 1.1rem; }
}

/* --- ANIMACIONES --- */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

::selection { background: var(--accent-soft); color: #fff; }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }
