/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
}

body {
    font-family: 'Nunito', sans-serif;
    line-height: 1.6;
    color: #2d3748;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-attachment: fixed;
    overflow-x: hidden;
    max-width: 100vw;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Navigation */
.navbar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    border-bottom: 3px solid #ff6b6b;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
    position: relative;
}

.nav-logo h1 {
    font-family: 'Fredoka', cursive;
    color: #4c51bf;
    font-size: 2rem;
    font-weight: 600;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 30px;
}

.nav-menu a {
    text-decoration: none;
    color: #4a5568;
    font-weight: 600;
    font-size: 1.1rem;
    padding: 8px 16px;
    border-radius: 25px;
    transition: all 0.3s ease;
    position: relative;
}

.nav-menu a:hover {
    color: #fff;
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
}

.language-switcher {
    display: flex;
    gap: 5px;
    margin-left: 20px;
}

.lang-btn {
    padding: 8px 15px;
    border: 2px solid #ff6b6b;
    background: transparent;
    color: #ff6b6b;
    cursor: pointer;
    border-radius: 20px;
    font-weight: 600;
    font-family: 'Fredoka', cursive;
    transition: all 0.3s ease;
}

.lang-btn.active,
.lang-btn:hover {
    background: linear-gradient(45deg, #ff6b6b, #ff8e8e);
    color: white;
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

/* Hamburger menu */
.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
    width: 30px;
    height: 30px;
    justify-content: space-around;
    z-index: 1001;
}

.hamburger span {
    width: 100%;
    height: 3px;
    background: #2c3e50;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(7px, 7px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* Main content */
main {
    margin-top: 70px;
}

/* Hero section */
.hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #a8edea 100%);
    color: white;
    padding: 60px 0;
    min-height: 700px;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '🏎️';
    position: absolute;
    font-size: 60px;
    opacity: 0.15;
    top: 20%;
    right: 10%;
    animation: raceAround 15s linear infinite;
}

.hero::after {
    content: '🏁';
    position: absolute;
    font-size: 80px;
    opacity: 0.1;
    bottom: 20%;
    left: 10%;
    animation: wave 4s ease-in-out infinite;
}

@keyframes raceAround {
    0% {
        transform: translateX(0px) translateY(0px);
    }
    25% {
        transform: translateX(100px) translateY(-50px);
    }
    50% {
        transform: translateX(200px) translateY(0px);
    }
    75% {
        transform: translateX(100px) translateY(50px);
    }
    100% {
        transform: translateX(0px) translateY(0px);
    }
}

@keyframes wave {
    0%, 100% {
        transform: rotate(-5deg);
    }
    50% {
        transform: rotate(5deg);
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    50% {
        transform: translateY(-20px) rotate(180deg);
    }
}

.hero-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
}

.hero-image {
    display: flex;
    justify-content: center;
}

.hero-image img {
    width: 100%;
    max-width: 400px;
    height: 400px;
    object-fit: cover;
    border-radius: 30px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    border: 5px solid rgba(255, 255, 255, 0.3);
    transition: transform 0.3s ease;
    position: relative;
    z-index: 2;
}

.hero-image img:hover {
    transform: scale(1.05) rotate(2deg);
}

.hero-content {
    text-align: left;
}

.hero-title {
    font-family: 'Fredoka', cursive;
    font-size: 3.5rem;
    font-weight: 600;
    margin-bottom: 25px;
    line-height: 1.2;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.2);
    background: linear-gradient(45deg, #fff, #f0f0f0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
    z-index: 2;
}

.hero-description {
    font-size: 1.3rem;
    line-height: 1.7;
    opacity: 0.95;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1);
    font-weight: 500;
    position: relative;
    z-index: 2;
}

/* Story section */
.story {
    padding: 60px 0;
    background: linear-gradient(180deg, #fff 0%, #f8f9ff 100%);
    position: relative;
    --left-rail: 220px;
}

.story::before {
    content: '🏎️';
    position: absolute;
    font-size: 40px;
    opacity: 0.1;
    top: 15%;
    right: 5%;
    animation: fastRace 8s linear infinite;
}

.story::after {
    content: '🏆';
    position: absolute;
    font-size: 50px;
    opacity: 0.08;
    bottom: 15%;
    left: 5%;
    animation: trophy 6s ease-in-out infinite;
}

@keyframes fastRace {
    0% {
        transform: translateX(-100px) rotate(0deg);
    }
    50% {
        transform: translateX(200px) rotate(10deg);
    }
    100% {
        transform: translateX(-100px) rotate(0deg);
    }
}

@keyframes trophy {
    0%, 100% {
        transform: scale(1) rotate(-2deg);
    }
    50% {
        transform: scale(1.1) rotate(2deg);
    }
}

.story h2 {
    text-align: center;
    font-family: 'Fredoka', cursive;
    font-size: 3rem;
    color: #4c51bf;
    margin-bottom: 60px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 2;
}

.story-content {
    max-width: none;
    margin: 0;
    padding-left: var(--left-rail);
}

.story-text {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #555;
}

/* Timeline styles */
.timeline {
    position: relative;
    overflow: visible; /* permitir que labels sobresalgan hacia la izquierda */
}

.timeline h3 {
    font-family: 'Fredoka', cursive;
    font-size: 2.2rem;
    color: #4c51bf;
    margin: 0 auto 40px auto;

    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1);

    width: 100%
}

.timeline-item {
    position: relative;
    padding: 30px 0;
    margin-left: 40px; /* +aire para separar del eje */
    border-left: 4px solid;
    border-image: linear-gradient(45deg, #ff6b6b, #4ecdc4) 1;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 0 20px 20px 0;
    margin-bottom: 30px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease;
    max-width: calc(100vw - 40px);
    overflow: visible; /* antes: hidden; recortaba el label */
}

.timeline-item:hover {
    transform: translateX(10px);
}

.timeline-item::before {
    content: '🌟';
    position: absolute;
    left: -10px; /* antes: -15px; reduce solape con el label */
    top: 40px; /* alineación más natural con el label */
    width: 30px;
    height: 30px;
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    border: 4px solid white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    z-index: 1; /* por debajo del label si se cruzan */
}

.timeline-date {
    position: absolute;
     left: calc(-1 * var(--left-rail) + 20px); /* ajusta el carril un poco más a la izquierda */
    top: 28px; /* alinea con el contenido */
    width: 180px;
    text-align: right;
    z-index: 2; /* por encima del ::before */
}

.timeline-date span {
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
    color: white;
    padding: 8px 12px;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: 'Fredoka', cursive;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
    white-space: nowrap;
    display: inline-block;
}

.timeline-content {
    padding-left: 28px; /* sutil ajuste para no pegarse al borde */
    padding-top: 15px;
}

.timeline-content p {
    margin: 0 0 20px 0;
    color: #555;
    line-height: 1.6;
}

.timeline-photos {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 300px));
    gap: 15px;
    margin-top: 20px;
    justify-content: start;
}

.timeline-photo {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 15px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    cursor: pointer;
    border: 3px solid rgba(255, 255, 255, 0.8);
}

.timeline-photo:hover {
    transform: scale(1.08) rotate(2deg);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.25);
    border-color: #ff6b6b;
}

.story-photos {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.photo-placeholder {
    width: 100%;
    height: 200px;
    background: #e0e0e0;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    border: 2px dashed #ccc;
}

.story-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
}

/* Audiobook section */
.audiobook {
    padding: 60px 0;
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    position: relative;
}

.audiobook::before {
    content: '🏎️';
    position: absolute;
    font-size: 70px;
    opacity: 0.12;
    top: 10%;
    right: 10%;
    animation: speedBoost 5s ease-in-out infinite;
}

.audiobook::after {
    content: '🎵';
    position: absolute;
    font-size: 60px;
    opacity: 0.1;
    bottom: 20%;
    left: 15%;
    animation: bounce 3s ease-in-out infinite;
}

@keyframes speedBoost {
    0%, 100% {
        transform: translateX(0px) scale(1);
    }
    50% {
        transform: translateX(50px) scale(1.1);
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

.audiobook h2 {
    text-align: center;
    font-family: 'Fredoka', cursive;
    font-size: 3rem;
    color: #4c51bf;
    margin-bottom: 60px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.audio-player-container {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    padding: 50px;
    border-radius: 25px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    border: 3px solid rgba(255, 255, 255, 0.5);
    position: relative;
    z-index: 2;
}

.audio-player {
    width: 100%;
    margin-bottom: 30px;
    height: 400px;
    border-radius: 20px;
    border: 4px solid rgba(255, 107, 107, 0.3);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.audio-info h3 {
    font-family: 'Fredoka', cursive;
    font-size: 1.8rem;
    color: #4c51bf;
    margin-bottom: 20px;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1);
}

.audio-info p {
    font-size: 1.2rem;
    color: #4a5568;
    line-height: 1.7;
    font-weight: 500;
}

/* Purchase section */
.purchase {
    padding: 60px 0;
    background: linear-gradient(135deg, #ffeaa7 0%, #fab1a0 100%);
    position: relative;
}

.purchase::before {
    content: '🏁';
    position: absolute;
    font-size: 80px;
    opacity: 0.12;
    top: 15%;
    right: 10%;
    animation: flagWave 4s ease-in-out infinite;
}

.purchase::after {
    content: '📚';
    position: absolute;
    font-size: 90px;
    opacity: 0.08;
    bottom: 20%;
    left: 8%;
    animation: float 10s ease-in-out infinite;
}

@keyframes flagWave {
    0%, 100% {
        transform: rotate(-3deg) scale(1);
    }
    50% {
        transform: rotate(3deg) scale(1.05);
    }
}

.purchase h2 {
    text-align: center;
    font-family: 'Fredoka', cursive;
    font-size: 3rem;
    color: #4c51bf;
    margin-bottom: 60px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.purchase-content {
    max-width: 600px;
    margin: 0 auto;
}

.book-info {
    display: flex;
    gap: 40px;
    align-items: center;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    padding: 50px;
    border-radius: 25px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    border: 3px solid rgba(255, 255, 255, 0.5);
    position: relative;
    z-index: 2;
}

.book-cover {
    width: 180px;
    height: 240px;
    object-fit: cover;
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.25);
    background: #e0e0e0;
    border: 4px solid rgba(255, 255, 255, 0.8);
    transition: transform 0.3s ease;
}

.book-cover:hover {
    transform: scale(1.05) rotate(-2deg);
}

.book-details {
    flex: 1;
}

.book-details h3 {
    font-family: 'Fredoka', cursive;
    font-size: 2rem;
    color: #4c51bf;
    margin-bottom: 20px;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1);
}

.book-details p {
    font-size: 1.2rem;
    color: #4a5568;
    margin-bottom: 30px;
    line-height: 1.7;
    font-weight: 500;
}

.buy-button {
    display: inline-block;
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
    color: white;
    padding: 18px 40px;
    text-decoration: none;
    border-radius: 30px;
    font-weight: 600;
    font-size: 1.3rem;
    font-family: 'Fredoka', cursive;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.4);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.buy-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.buy-button:hover::before {
    left: 100%;
}

.buy-button:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 12px 35px rgba(255, 107, 107, 0.5);
}

/* Lightbox styles */
.lightbox {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
    overflow: hidden;
}

.lightbox-content {
    position: relative;
    margin: auto;
    padding: 20px;
    width: 100vw;
    max-width: 800px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10000;
    transition: opacity 0.3s ease;
}

.lightbox-close:hover {
    opacity: 0.7;
}

#lightbox-image {
    max-width: 90vw;
    max-height: 75vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    background: rgba(255, 255, 255, 0.1);
}

.lightbox-caption {
    color: white;
    text-align: center;
    margin-top: 20px;
    font-size: 1.1rem;
    max-width: 600px;
    line-height: 1.5;
}

/* Footer */
footer {
    background: #2c3e50;
    color: white;
    text-align: center;
    padding: 30px 0;
}

/* --- Ajustes específicos para DESKTOP --- */
@media (min-width: 769px) {
    /* Reservar un carril estable para los labels de la izquierda */
    .story-content {
        padding-left: 220px; /* antes 200px */
    }
}

/* Responsive design */
@media (max-width: 768px) {
    .story {
        --left-rail: 0;
    }

    /* Ajuste para que el label no se monte con el ::before */
    .timeline-date {
        position: static; /* ya lo tienes así en móvil */
        transform: none; /* resetea para móvil */
        margin-left: 20px; /* separa el texto del icono */
        padding-left: 20px; /* más aire a la derecha del icono */
        margin-bottom: 10px;
    }

    .timeline-item::before {
        left: 0; /* alinear el ícono con el margen izquierdo */
    }

    .container {
        padding: 0 15px;
    }

    .hamburger {
        display: flex;
    }

    .nav-menu {
        position: absolute;
        top: 70px;
        left: 0;
        width: 100%;
        background: white;
        flex-direction: column;
        gap: 0;
        padding: 20px;
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 999;
    }

    .nav-menu.active {
        transform: translateX(0);
    }

    .nav-menu a {
        padding: 15px 0;
        border-bottom: 1px solid #eee;
        text-align: center;
    }

    .language-switcher {
        margin: 20px 0 0 0;
        justify-content: center;
    }

    .nav-container {
        height: 70px;
        padding: 0 20px;
        flex-direction: row;
    }

    main {
        margin-top: 70px;
    }

    .hero-container {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 40px;
    }

    .hero-title {
        font-size: 2.5rem;
    }

    .story-content {
        grid-template-columns: 1fr;
        margin: 0;
        padding-left: 0;
    }

    /* Timeline responsive */
    .timeline {
        margin-left: 0;
    }

    .timeline-item {
        margin-left: 50px;
        margin-right: 15px;
        max-width: calc(100vw - 70px);
        border-left: 3px solid #ff6b6b;
        border-image: none;
        overflow: visible; /* mantener visible el punto/label si se desbordan */
        --marker-y: 32px; /* ajusta fino 48–56px según prefieras */
    }

    .timeline-item::before {
        left: -10px;
        top: var(--marker-y);
        transform: translateY(-50%);
        font-size: 12px;
        width: 24px;
        height: 24px;
        z-index: 1;
    }

    .timeline-date {
        position: static;
        text-align: right;
        margin-bottom: 15px;
        width: 180px;
        margin-left: 0;
        left: -200px;
        top: var(--marker-y);
        transform: translateY(-50%);
        z-index: 2;
    }

    .timeline-date span {
        font-size: 0.85rem;
        padding: 6px 12px;
    }

    .timeline-content {
        padding-left: 28px;
        padding-right: 15px;
        padding-top: 5px;
    }

    .timeline-photos {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .timeline-photo {
        height: 120px;
    }

    .story-photos {
        flex-direction: row;
        justify-content: center;
        gap: 15px;
    }

    .timeline h3 {
        margin-left: 0;
        width: 100%;
    }

    .photo-placeholder {
        width: 150px;
        height: 150px;
    }

    .book-info {
        flex-direction: column;
        text-align: center;
    }

    .book-cover {
        width: 120px;
        height: 160px;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 2rem;
    }

    .story h2,
    .audiobook h2,
    .purchase h2 {
        font-size: 2rem;
    }

    .audio-player-container,
    .book-info {
        padding: 25px;
    }

    .audio-player {
        height: 200px;
    }

    .audio-player-container {
        margin: 0 10px;
    }

    .story-photos {
        flex-direction: column;
    }
}

/* Extra small screens */
@media (max-width: 380px) {
    .audio-player {
        height: 180px;
    }

    .audio-player-container {
        padding: 15px;
        margin: 0 5px;
    }

    .audio-info h3 {
        font-size: 1.2rem;
    }

    .audio-info p {
        font-size: 1rem;
    }

    .timeline-photos {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .timeline-photo {
        height: 200px;
    }

    /* Lightbox responsive */
    #lightbox-image {
        max-width: 85vw;
        max-height: 60vh;
        width: auto;
        height: auto;
    }

    .lightbox-content {
        padding: 15px;
        width: 100vw;
    }

    .lightbox-close {
        font-size: 30px;
        top: 10px;
        right: 15px;
    }
}
