/* Year Selector (Legacy - now used in Hub?) */
/* Replacing with Hub Styles */

/* Override global take-me-back link size */
.enlace-regreso {
    font-size: 0.6rem !important;
}

.hub-year-list {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3rem;
    min-height: 60vh;
    /* Establish vertical space */
}

/* Hub Timeline Styles */
.timeline-wrapper {
    position: relative;
    width: 100%;
    max-width: 800px;
    margin: 15vh auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-bottom: 0;
}

.timeline-line {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background-color: var(--primary-color);
    z-index: 0;
}

.timeline-years {
    display: flex;
    justify-content: space-around;
    width: 100%;
    position: relative;
    z-index: 1;
    align-items: flex-end;
}

.timeline-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    padding-bottom: 0;
}

.timeline-vertical-line {
    width: 1px;
    height: 40px;
    background-color: var(--primary-color);
    margin-top: 1rem;
    position: relative;
}

/* Optional: Small dot at intersection with main line */
.timeline-vertical-line::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--primary-color);
}

.timeline-link {
    font-family: var(--font-serif);
    font-size: 3rem;
    text-decoration: none;
    color: var(--primary-color);
    text-transform: uppercase;
    transition: transform 0.3s ease;
    padding: 0 1rem;
}

.timeline-link:hover {
    transform: translateY(-10px);
}

.year-view-title {
    width: 100%;
    text-align: center;
    font-family: var(--font-menu);
    font-size: 2rem;
    margin-top: 2rem;
    margin-bottom: 2rem;
    color: var(--primary-color);
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    max-width: 200px;
    margin-left: auto;
    margin-right: auto;
}

/* Year Selector */
.year-selector {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2rem;
    font-family: var(--font-menu);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.year-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 1.2rem;
    color: var(--primary-color);
    opacity: 0.5;
    transition: opacity 0.3s;
    text-transform: inherit;
    letter-spacing: inherit;
    padding: 0.5rem 1rem;
}

.year-btn:hover,
.year-btn.active {
    opacity: 1;
    border-bottom: 1px solid var(--primary-color);
}

/* Intro Text (Virginia Woolf style) */
.diary-intro-text {
    max-width: 100%;
    /* Full width allowed */
    margin: 0 auto 4rem auto;
    /* Top 0 */
    font-family: var(--font-menu);
    font-size: 0.75rem;
    line-height: 2.2;
    text-align: justify;
    text-align-last: justify;
    /* Force last line to spread too if desired, or just justify main block */
    color: var(--primary-color);
    letter-spacing: 0.05em;
    padding: 0 0.5rem;
    /* Minimal side padding ("apuralo al maximo") */
    word-spacing: 0.5rem;
    /* Separate words more */
}

/* Organic Grid Styles */
.diary-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    /* Let margins dictate position */
    align-items: flex-start;
    gap: 0;
    /* JS handles gaps */
    padding: 2rem 0;
    /* Minimized side padding to allow edge sticking */
    max-width: 98%;
    /* Almost full width with slight safety */
    margin: 0 auto;
}

.diary-item {
    /* No fixed width - allowed to vary by JS or content */
    width: auto;
    cursor: default;
    /* Remove pointer cursor too if truly no interaction desired? User only said hover effects. Keeping pointer for click. */
    cursor: pointer;
    transition: none;
    /* Remove transition */
    opacity: 1;
    /* Full opacity always */
    position: relative;
    /* margin-bottom controlled by JS now, but keep a safety floor? No, JS sets top margin. */
    margin-bottom: 0;
}

/* Static Link (Home button) */
.static-link:hover {
    opacity: 1 !important;
    color: inherit !important;
}

/* Hover effects removed as requested */
/* .diary-item:hover {
    transform: scale(1.03);
    opacity: 1;
    z-index: 10;
} */

.diary-item img,
.diary-item video {
    width: 100%;
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 2px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    pointer-events: none;
    /* Prevent browser overlays/interactions on the media itself */
}

.diary-item p {
    text-align: left;
    /* Left aligned */
    margin-top: 0.8rem;
    font-family: var(--font-body);
    font-size: 0.4rem;
    /* Smaller */
    text-transform: uppercase;

    color: var(--primary-color);
    padding-left: 2px;
    /* Align strictly with image edge */
}

/* Modal Split Layout */
.modal {
    /* Overlay */
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 254, 239, 0.98);
    /* Less transparent for focus */
    z-index: 2000;
    justify-content: center;
    align-items: center;
    padding: 0;
    overflow: hidden;
    /* Prevent body scroll if possible, inner scroll handled below */
}

.modal-split-wrapper {
    display: flex;
    width: 100%;
    height: 100%;
    max-width: 1600px;
    /* Limit huge screens */
}

/* Left Column: Media (Scattered Zig-Zag, Small) */
.modal-left {
    flex: 1.5;
    height: 100%;
    overflow: hidden;
    /* Ensure everything stays inside */
    padding: 2rem 4rem;
    display: flex;
    flex-direction: column;
    /* Vertical flow */
    flex-wrap: nowrap;
    justify-content: center;
    /* Center the group vertically */
    gap: 2rem;
    /* Initial gap */
}

.media-item-container {
    flex: 0 1 auto;
    /* Make them bigger as requested, but still shrinkable */
    width: auto;
    max-width: 85%;
    /* Substantially wider */
    max-height: 45vh;
    /* Taller (was 25vh) */
    min-height: 0;

    object-fit: contain;
    margin: 0 !important;
    transform: none !important;

    display: flex;
}

/* ZIG-ZAG ALIGNMENT */
/* 1st: Left */
.media-item-container:nth-child(3n+1) {
    align-self: flex-start;
}

/* 2nd: Right */
.media-item-container:nth-child(3n+2) {
    align-self: flex-end;
}

/* 3rd: Center (or slight offset) */
.media-item-container:nth-child(3n+3) {
    align-self: center;
}

.modal-media {
    width: auto;
    height: auto;
    max-height: 100%;
    /* Bind to container height */
    max-width: 100%;
    /* Bind to container width */
    object-fit: contain;
    /* Preserve aspect ratio */
    display: block;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

/* Right Column: Text */
.modal-right {
    flex: 1;
    height: 100%;
    padding: 6rem 4rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.modal-text-content {
    font-family: 'Public Sans', sans-serif;
    font-size: 0.85rem;
    /* Smaller */
    line-height: 1.9;
    letter-spacing: 0.12em;
    /* Wider spacing */
    color: var(--primary-color);
    white-space: pre-wrap;
    max-width: 500px;
}


/* Zig-Zag Horizontal Layout */
.horizontal-timeline {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    height: 100vh;
    width: 100vw;
    align-items: center;
    /* Center everything vertically initially */
    padding: 0 50vw;
    /* Padding to center the first/last items if needed, or just let them scroll */
    gap: 15vw;
    /* Space between years */
    background-color: var(--background-color);
    position: relative;

    /* Hide scrollbar */
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.horizontal-timeline::-webkit-scrollbar {
    display: none;
}

/* Fixed Center Text */
.fixed-center-text {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    pointer-events: none;
    /* Let clicks pass through */
    text-align: center;
    width: 100%;
}

.fixed-center-text h2 {
    font-family: var(--font-serif);
    /* EB Garamond */
    font-size: 4rem;
    /* Big */
    font-weight: 300;
    font-style: italic;
    color: var(--primary-color);
    margin: 0;
    text-shadow: 0 0 20px rgba(255, 254, 239, 0.8);
    /* Glow effect to separate from video if overlaps */
}

/* Timeline Items */
.timeline-item {
    position: relative;
    width: 40vw;
    /* Wide format */
    height: 50vh;
    /* Half screen height roughly */
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: transform 0.3s ease;
}

/* Zig-Zag Positioning */
.timeline-top {
    align-self: flex-start;
    /* Top */
    margin-bottom: 5vh;
    /* Push slightly down from very top if needed, or stick to top */
}

.timeline-bottom {
    align-self: flex-end;
    /* Bottom */
    margin-top: 5vh;
}

/* Connectors (Vertical lines to center?) - Optional, for now just space */
.timeline-connector {
    height: 100px;
    width: 1px;
    background-color: var(--primary-color);
    opacity: 0.3;
    display: none;
    /* Removing connectors for cleaner look first */
}

/* Media Wrapper */
.media-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 2px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.timeline-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    filter: brightness(0.9);
}

/* Year Label */
.timeline-year {
    position: absolute;
    bottom: 1rem;
    right: 1.5rem;
    font-family: var(--font-menu);
    /* Arial */
    font-size: 4rem;
    /* Big year number */
    color: rgba(255, 255, 255, 0.9);
    z-index: 5;
    mix-blend-mode: overlay;
    /* Cool effect over video */
    font-weight: bold;
}

/* Hover Effects */
.timeline-item:hover {
    transform: scale(1.02);
    z-index: 5;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .fixed-center-text h2 {
        font-size: 2rem;
        padding: 0 1rem;
    }

    .timeline-item {
        width: 80vw;
        height: 40vh;
    }

    .horizontal-timeline {
        gap: 10vw;
        padding: 0 10vw;
    }
}