/* ============================================
   SALZBURGO - EL FIN DEL VIEJO MUNDO
   CSS Principal
   José Manuel Sainz de Baranda - @jmsdbg
   ============================================ */

/* Importar fuentes de Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;0,600;0,700;1,300;1,400&family=Crimson+Text:ital,wght@0,400;0,600;0,700;1,400;1,600&family=Spectral:ital,wght@0,300;0,400;1,300;1,400&display=swap');

/* ============================================
   VARIABLES
   ============================================ */

:root {
    /* Colores */
    --bg-dark: #1a1612;
    --bg-light: #EAE4D8;
    --text-dark: #2B2416;
    --text-light: #F4ECD8;
    --text-meta: #8B7355;
    --accent-gold: #C9A961;
    --overlay-dark: rgba(0, 0, 0, 0.7);
    --overlay-medium: rgba(0, 0, 0, 0.5);
    --overlay-light: rgba(0, 0, 0, 0.3);
    
    /* Tipografía */
    --font-title: 'Cormorant Garamond', serif;
    --font-body: 'Crimson Text', serif;
    --font-meta: 'Spectral', serif;
    
    /* Espaciado */
    --container-max: 800px;
    --spacing-small: 1.5rem;
    --spacing-medium: 3rem;
    --spacing-large: 6rem;
}

/* ============================================
   RESET Y BASE
   ============================================ */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    font-size: 1.35rem;
    line-height: 1.8;
    color: var(--text-dark);
    background: var(--bg-light);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   SELECTOR DE IDIOMA
   ============================================ */

.lang-switcher {
    position: fixed;
    top: 30px;
    right: 40px;
    z-index: 1000;
    display: flex;
    gap: 1rem;
}

.lang-switcher a {
    font-family: var(--font-meta);
    font-size: 0.9rem;
    font-weight: 300;
    color: var(--text-light);
    text-decoration: none;
    letter-spacing: 0.1em;
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

.lang-switcher a:hover,
.lang-switcher a.active {
    opacity: 1;
}

/* ============================================
   PORTADA
   ============================================ */

.cover-page {
    position: relative;
    width: 100%;
    min-height: 100vh;
    background: var(--bg-dark);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
    overflow: hidden;
}

.cover-page::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-gold), transparent);
    opacity: 0.3;
}

.cover-page::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-gold), transparent);
    opacity: 0.3;
}

.cover-ornament {
    width: 100px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent-gold), transparent);
    margin-bottom: 3rem;
    opacity: 0.5;
}

.cover-title {
    font-family: var(--font-title);
    font-size: 4.5rem;
    font-weight: 300;
    color: var(--text-light);
    letter-spacing: 0.05em;
    margin-bottom: 2rem;
    line-height: 1.2;
}

.cover-subtitle {
    font-family: var(--font-meta);
    font-size: 1.8rem;
    font-style: italic;
    font-weight: 300;
    color: var(--accent-gold);
    letter-spacing: 0.1em;
    margin-bottom: 3rem;
}

.cover-separator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin: 3rem auto;
    max-width: 200px;
}

.cover-separator::before,
.cover-separator::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--accent-gold);
    opacity: 0.5;
}

.cover-separator-icon {
    color: var(--accent-gold);
    font-size: 0.8rem;
    opacity: 0.6;
}

.cover-tagline {
    font-family: var(--font-meta);
    font-size: 1rem;
    font-style: italic;
    font-weight: 300;
    color: var(--text-light);
    opacity: 0.7;
    max-width: 600px;
    line-height: 1.6;
    margin-bottom: 4rem;
}

.cover-author {
    font-family: var(--font-meta);
    font-size: 0.85rem;
    font-weight: 300;
    color: var(--accent-gold);
    letter-spacing: 0.3em;
    text-transform: uppercase;
    margin-top: 4rem;
    opacity: 0.6;
}

.cover-enter-btn {
    font-family: var(--font-meta);
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-light);
    background: transparent;
    border: 1px solid var(--accent-gold);
    padding: 1rem 3rem;
    text-decoration: none;
    letter-spacing: 0.2em;
    transition: all 0.4s ease;
    display: inline-block;
    margin-top: 2rem;
}

.cover-enter-btn:hover {
    border-color: var(--text-light);
    color: var(--text-light);
    box-shadow: 0 0 20px rgba(201, 169, 97, 0.15);
}

/* ============================================
   HERO IMAGE CON TEXTO OVERLAY
   ============================================ */

.hero-section {
    position: relative;
    width: 100%;
    height: 85vh;
    overflow: hidden;
}

.hero-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.5) 0%,
        rgba(0, 0, 0, 0.9) 50%,
        rgba(0, 0, 0, 0.5) 100%
    );
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-content {
    max-width: var(--container-max);
    padding: 3rem;
    text-align: center;
    background: rgba(26, 22, 18, 0.4);
    border: 1px solid rgba(201, 169, 97, 0.15);
    backdrop-filter: blur(5px);
}

.hero-meta {
    font-family: var(--font-meta);
    font-size: 0.85rem;
    font-weight: 300;
    color: var(--accent-gold);
    letter-spacing: 0.3em;
    text-transform: uppercase;
    margin-bottom: 2rem;
    opacity: 0.8;
}

.hero-title {
    font-family: var(--font-title);
    font-size: 3rem;
    font-weight: 400;
    color: var(--text-light);
    line-height: 1.3;
    margin-bottom: 3rem;
}

.hero-text {
    font-family: var(--font-body);
    font-size: 1.35rem;
    color: var(--text-light);
    line-height: 1.8;
    opacity: 0.9;
}

/* ============================================
   CONTENEDOR DE TEXTO (NOTA DEL EDITOR / CARTAS)
   ============================================ */

.text-section {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: var(--spacing-large) 2rem;
}

.section-meta {
    font-family: var(--font-meta);
    font-size: 1rem;
    font-weight: 300;
    color: var(--text-meta);
    letter-spacing: 0.3em;
    text-transform: uppercase;
    text-align: center;
    margin-bottom: 3rem;
}

.section-title {
    font-family: var(--font-title);
    font-size: 4rem;
    font-weight: 400;
    color: var(--text-dark);
    text-align: center;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.section-subtitle {
    text-align: center;
    margin-bottom: 3rem;
}

.section-separator {
    width: 60px;
    height: 1px;
    background: var(--accent-gold);
    margin: 3rem auto;
    opacity: 0.5;
}

.section-text {
    font-family: var(--font-body);
    font-size: 1.35rem;
    line-height: 1.9;
    color: var(--text-dark);
    margin-bottom: 1.5rem;
}

.section-text:first-of-type::first-letter {
    font-family: var(--font-title);
    font-size: 4.5rem;
    font-weight: 400;
    line-height: 1;
    float: left;
    margin: 0.1rem 0.2rem 0 0;
    color: var(--accent-gold);
}

.section-text em {
    font-style: italic;
}

.section-text strong {
    font-weight: 600;
}

/* ============================================
   IMÁGENES FULL-WIDTH
   ============================================ */

.full-image {
    position: relative;
    width: 100%;
    height: 70vh;
    overflow: hidden;
}

.full-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.1s ease-out;
}

/* Parallax suave */
.full-image.parallax img {
    transform: translateY(0);
}

/* ============================================
   IMAGEN CON TEXTO OVERLAY
   ============================================ */

.image-with-text {
    position: relative;
    width: 100%;
    min-height: 60vh;
    display: flex;
    align-items: flex-end;
    overflow: hidden;
}

.image-with-text img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    z-index: 1;
}

.image-with-text::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to top, var(--overlay-dark) 0%, transparent 100%);
    z-index: 2;
}

.image-text-content {
    position: relative;
    z-index: 3;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 3rem 2rem;
    color: var(--text-light);
}

.image-text-content p {
    font-family: var(--font-body);
    font-size: 1.35rem;
    line-height: 1.8;
    margin-bottom: 1rem;
}

.image-caption {
    font-family: var(--font-meta);
    font-size: 0.75rem;
    font-style: italic;
    color: var(--text-light);
    opacity: 0.6;
    text-align: right;
    margin-top: 2rem;
}

/* ============================================
   NAVEGACIÓN ENTRE CARTAS
   ============================================ */

.letter-navigation {
    max-width: var(--container-max);
    margin: var(--spacing-large) auto;
    padding: 0 2rem var(--spacing-large) 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
}

.nav-btn {
    font-family: var(--font-meta);
    font-size: 0.9rem;
    font-weight: 500;
    color: #1a1612;
    text-decoration: none;
    letter-spacing: 0.1em;
    padding: 1rem 2rem;
    border: 2px solid #1a1612;
    transition: all 0.3s ease;
    opacity: 1;
    background: rgba(26, 22, 18, 0.03);
}

.nav-btn:hover {
    opacity: 1;
    background: #1a1612;
    color: var(--bg-light);
    transform: translateY(-2px);
}

.nav-btn.disabled {
    opacity: 0.2;
    pointer-events: none;
}

.nav-indicator {
    font-family: var(--font-meta);
    font-size: 0.75rem;
    font-weight: 300;
    color: var(--text-meta);
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

/* Indicador clickeable */
.nav-indicator-link {
    text-decoration: none;
    transition: opacity 0.3s ease;
}

.nav-indicator-link:hover .nav-indicator {
    opacity: 1;
    text-decoration: underline;
    text-decoration-color: var(--text-meta);
}

/* ============================================
   PÁGINA ÍNDICE
   ============================================ */

.index-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.index-item {
    display: flex;
    flex-direction: column;
    padding: 1.5rem 2rem;
    text-decoration: none;
    border-bottom: 1px solid rgba(43, 36, 22, 0.1);
    transition: all 0.3s ease;
}

.index-item:first-child {
    border-top: 1px solid rgba(43, 36, 22, 0.1);
}

.index-item:hover {
    background: rgba(201, 169, 97, 0.05);
    padding-left: 2.5rem;
}

.index-number {
    font-family: var(--font-meta);
    font-size: 0.75rem;
    font-weight: 300;
    color: var(--text-meta);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.index-title {
    font-family: var(--font-body);
    font-size: 1.3rem;
    font-style: italic;
    color: var(--text-dark);
}

.index-label {
    font-family: var(--font-body);
    font-size: 1.1rem;
    color: var(--text-dark);
}

/* ============================================
   INDICADOR DE SCROLL
   ============================================ */

.scroll-indicator {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    color: var(--accent-gold);
    font-size: 2rem;
    opacity: 0.6;
    animation: bounce 2s infinite;
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.scroll-indicator:hover {
    opacity: 1;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateX(-50%) translateY(0);
    }
    40% {
        transform: translateX(-50%) translateY(-10px);
    }
    60% {
        transform: translateX(-50%) translateY(-5px);
    }
}

/* Ocultar indicador cuando se hace scroll */
.scroll-indicator.hidden {
    opacity: 0;
    pointer-events: none;
}

/* ============================================
   PIE DE PÁGINA
   ============================================ */

.footer-credits {
    text-align: center;
    padding: 3rem 2rem;
    background: var(--bg-dark);
    color: var(--text-light);
}

.footer-credits p {
    font-family: var(--font-meta);
    font-size: 0.75rem;
    font-weight: 300;
    opacity: 0.6;
    line-height: 1.6;
}

.footer-credits a {
    color: var(--accent-gold);
    text-decoration: none;
}

.footer-credits a:hover {
    opacity: 0.8;
}

/* ============================================
   ANIMACIONES
   ============================================ */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 1.2s ease-out forwards;
}

@keyframes fadeInSlow {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.fade-in-slow {
    animation: fadeInSlow 2s ease-out forwards;
}

/* Animaciones secuenciales portada */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cover-ornament {
    animation: fadeInUp 0.8s ease-out 0s forwards;
    opacity: 0;
}

.cover-title {
    animation: fadeInUp 0.8s ease-out 0.3s forwards;
    opacity: 0;
}

.cover-subtitle {
    animation: fadeInUp 0.8s ease-out 0.6s forwards;
    opacity: 0;
}

.cover-separator {
    animation: fadeInUp 0.8s ease-out 0.9s forwards;
    opacity: 0;
}

.cover-tagline {
    animation: fadeInUp 0.8s ease-out 1.2s forwards;
    opacity: 0;
}

.cover-enter-btn {
    animation: fadeInUp 0.8s ease-out 1.5s forwards;
    opacity: 0;
}

/* ============================================
   RESPONSIVE
   ============================================ */

/* Tablets */
@media (max-width: 1024px) {
    body {
        font-size: 1.25rem;
    }
    
    .cover-title {
        font-size: 3.5rem;
    }
    
    .cover-subtitle {
        font-size: 1.5rem;
    }
    
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-text {
        font-size: 1.25rem;
    }
    
    .section-title {
        font-size: 3.5rem;
    }
    
    .section-text {
        font-size: 1.25rem;
    }
}

/* Móviles */
@media (max-width: 768px) {
    :root {
        --spacing-small: 1rem;
        --spacing-medium: 2rem;
        --spacing-large: 4rem;
    }
    
    body {
        font-size: 1.2rem;
    }
    
    .lang-switcher {
        top: 20px;
        right: 20px;
    }
    
    .cover-title {
        font-size: 2.5rem;
    }
    
    .cover-subtitle {
        font-size: 1.2rem;
    }
    
    .cover-tagline {
        font-size: 0.9rem;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-text {
        font-size: 1.2rem;
    }
    
    .section-title {
        font-size: 2.5rem;
    }
    
    .section-text {
        font-size: 1.2rem;
        line-height: 1.8;
    }
    
    .section-text:first-of-type::first-letter {
        font-size: 3.5rem;
    }
    
    .full-image {
        height: 50vh;
    }
    
    .letter-navigation {
        flex-direction: column;
        gap: 1.5rem;
    }
    
    .nav-btn {
        width: 100%;
        text-align: center;
    }
    
    /* Hero section mobile - foto arriba, texto abajo */
    .hero-section {
        height: auto;
        min-height: auto;
        display: flex;
        flex-direction: column;
    }
    
    .hero-image {
        position: relative !important;
        width: 100%;
        height: 50vh;
        object-fit: cover;
        order: 1;
    }
    
    .hero-overlay {
        position: relative !important;
        order: 2;
        background: var(--bg-light) !important;
        flex-direction: column;
        align-items: stretch;
        padding: 0;
    }
    
    .hero-content {
        position: relative;
        background: var(--bg-light);
        border: none;
        backdrop-filter: none;
        padding: 2rem 1.5rem;
        max-width: 100%;
        width: 100%;
    }
    
    .hero-meta {
        color: var(--text-meta);
    }
    
    .hero-title {
        color: var(--text-dark);
    }
    
    .hero-text,
    .hero-text p {
        color: var(--text-dark);
        opacity: 1;
    }
    
    .scroll-indicator {
        display: none;
    }
}

/* Móviles pequeños */
@media (max-width: 480px) {
    .cover-title {
        font-size: 2rem;
    }
    
    .cover-subtitle {
        font-size: 1rem;
    }
    
    .hero-title {
        font-size: 1.75rem;
    }
    
    .section-title {
        font-size: 1.75rem;
    }
}

/* Móviles y tablets por ancho - ampliado a 1280px para S24+/Ultra */
@media (max-width: 1280px) {
    :root {
        --spacing-large: 4rem;
        --spacing-medium: 2rem;
    }

    /* Navegación */
    .letter-navigation {
        flex-direction: column;
        gap: 1.5rem;
    }

    .nav-btn {
        width: 100%;
        text-align: center;
    }

    /* Imágenes */
    .full-image {
        height: 55vh;
    }

    /* Texto - fuentes más grandes para pantalla grande */
    .text-section {
        padding: var(--spacing-large) 1.5rem;
    }

    body {
        font-size: 2.5rem;
    }

    .section-text {
        font-size: 2.5rem;
        line-height: 1.9;
    }

    .section-title {
        font-size: 4.5rem;
    }

    .section-text:first-of-type::first-letter {
        font-size: 8rem;
    }

    .hero-title {
        font-size: 4rem;
    }

    .hero-text,
    .hero-text p {
        font-size: 2.5rem;
    }

    .hero-meta {
        font-size: 1.5rem;
    }

    .cover-title {
        font-size: 5.5rem;
    }

    .cover-subtitle {
        font-size: 2.5rem;
    }

    .nav-btn {
        font-size: 1.6rem;
        padding: 1.2rem 2rem;
    }

    .nav-indicator {
        font-size: 1.3rem;
    }

    /* Nota del editor - tagline */
    .cover-tagline {
        font-size: 2rem;
    }

    /* Botón entrar portada */
    .cover-enter-btn {
        font-size: 1.5rem;
        padding: 1.2rem 3.5rem;
    }

    /* Textos superpuestos a fotos */
    .image-text-content p {
        font-size: 2.5rem;
        line-height: 1.8;
    }

    /* Índice */
    .index-hero-title {
        font-size: 4.2rem;
    }

    .index-hero-sub {
        font-size: 1.8rem;
    }

    .index-label {
        font-size: 2.1rem !important;
    }

    .index-number {
        font-size: 1.8rem !important;
    }

    .index-title {
        font-size: 2.8rem !important;
    }

    .index-item {
        padding: 2rem 2rem;
    }

    /* Créditos */
    .section-meta {
        font-size: 1.7rem;
    }

    /* section-text en créditos tiene font-size inline - necesita !important */
    .section-text {
        font-size: 2.5rem !important;
    }

    .credits-intro {
        font-size: 2rem !important;
    }

    .credits-legal {
        font-size: 1.8rem !important;
    }

    .credits-contact {
        font-size: 2.1rem !important;
    }

    /* Navegación */
    .nav-btn {
        font-size: 2.1rem;
        padding: 1.2rem 2rem;
    }

    .nav-indicator {
        font-size: 2.1rem !important;
    }

    /* Hero section - foto arriba, texto abajo */
    .hero-section {
        height: auto;
        min-height: auto;
        display: flex;
        flex-direction: column;
    }

    .hero-image {
        position: relative !important;
        width: 100%;
        height: 50vh;
        object-fit: cover;
        order: 1;
    }

    .hero-overlay {
        position: relative !important;
        order: 2;
        background: var(--bg-light) !important;
        flex-direction: column;
        align-items: stretch;
        padding: 0;
    }

    .hero-content {
        position: relative;
        background: var(--bg-light);
        border: none;
        backdrop-filter: none;
        padding: 2rem 1.5rem;
        max-width: 100%;
        width: 100%;
    }

    .hero-meta {
        color: var(--text-meta);
    }

    .hero-title {
        color: var(--text-dark);
    }

    .hero-text,
    .hero-text p {
        color: var(--text-dark);
        opacity: 1;
    }
}
