/* CSS Variables for colors and settings */
:root {
    --bg-color: #f2eee0;
    --text-color: #000000;
    
    /* Especies Colors */
    --nativa: #a4b187;
    --cultivada: #b386a7;
    --introducida: #638cab;
    --invasiva: #8f004a;
    --desconocida: #b8b8b8;
}

/* Custom Fonts */
@font-face {
    font-family: 'Comico';
    src: url('tipografia/Comico-Regular.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Satoshi';
    src: url('tipografia/Satoshi-Regular.otf') format('opentype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Satoshi';
    src: url('tipografia/Satoshi-Medium.otf') format('opentype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Satoshi';
    src: url('tipografia/Satoshi-Bold.otf') format('opentype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Tabular';
    src: url('tipografia/Tabular-Regular.otf') format('opentype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Tabular';
    src: url('tipografia/Tabular-Semibold.otf') format('opentype');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

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

body {
    font-family: 'Satoshi', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.7;
    overflow-x: hidden;
    font-size: 1.15rem;
    background-image: url('../assets/fondo.png');
    background-repeat: repeat;
    background-size: auto;
    background-attachment: fixed;
}

h1 {
    font-family: 'Comico', cursive;
    color: var(--text-color);
    margin-bottom: 1rem;
    line-height: 1.2;
}

h2, h3, h4 {
    font-family: 'Tabular', sans-serif;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 1rem;
    line-height: 1.2;
}

.prose h3 {
    font-size: 1.5rem;
    margin-top: 2.5rem;
    position: relative;
    display: inline-block;
}

.prose h3::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 100%;
    height: 4px;
    background-color: var(--cultivada);
    opacity: 0.5;
    border-radius: 3px;
    z-index: -1;
}

/* Hero Section */
.hero-pudding {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
    position: relative;
    overflow: hidden;
}

.hero-portada {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    opacity: 0.28;
    pointer-events: none;
    user-select: none;
}

.hero-content {
    position: relative;
    z-index: 1;
}

/* Typewriter cursor */
@keyframes blink-cursor {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0; }
}

.tw-typing::after {
    content: '|';
    margin-left: 3px;
    animation: blink-cursor 0.65s step-end infinite;
}

.main-title.tw-typing::after {
    font-size: 0.85em;
    vertical-align: middle;
}

.main-title {
    font-size: clamp(4rem, 8vw, 7rem);
    margin-bottom: 1.5rem;
}

.subtitle-desc {
    font-size: 1.4rem;
    max-width: 600px;
    margin: 0 auto;
    font-family: 'Satoshi', sans-serif;
}

.author {
    margin-top: 1rem;
    font-style: italic;
    font-weight: 500;
}

/* Standard Prose Layout */
.prose {
    max-width: 740px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.prose h2 {
    font-size: 2.2rem;
    margin-top: 0.5rem;
    margin-bottom: 1rem;
    position: relative;
    display: inline-block;
}

.prose h2::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 6px;
    background-color: var(--nativa);
    opacity: 0.4;
    border-radius: 4px;
    z-index: -1;
}

.prose p {
    margin-bottom: 1.1rem;
}

.highlight-text {
    font-size: 1.4rem;
    font-weight: normal;
    font-family: 'Comico', cursive;
    text-align: center;
    margin: 1.8rem 0;
}

/* Full Bleed Visualizations */
.full-bleed {
    width: 100%;
    max-width: 1000px;
    margin: 4rem auto;
    padding: 0 2rem;
    display: flex;
    justify-content: center;
}

.viz-container {
    margin: 4rem 0;
}

.viz-placeholder {
    padding: 3rem;
    text-align: center;
    max-width: 900px;
    width: 100%;
    border: 2px solid var(--text-color);
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 4px 4px 0 rgba(0,0,0,0.1);
}

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

.inline-viz {
    margin: 3rem 0;
    padding: 2rem;
}

/* Scrolly Overlay (Map sticking to background) */
.scrolly-overlay {
    position: relative;
    width: 100%;
}

.sticky-background {
    position: sticky;
    top: 0;
    height: 100vh;
    width: 100%;
    z-index: 1;
}

.leaflet-map {
    width: 95%;
    max-width: 1100px;
    height: 94vh;
    margin: 3vh auto;
    background-color: #e5e3df; 
    border: 2px solid var(--text-color);
    border-radius: 8px;
    box-shadow: 4px 4px 0 rgba(0,0,0,0.1);
}

.scroll-steps-overlay {
    position: relative;
    z-index: 2;
    padding: 0 1rem;
    max-width: 600px;
    margin: 0 auto;
    padding-top: 50vh; 
    padding-bottom: 50vh;
}

.scroll-steps-overlay.right-align {
    margin-right: 5%;
    margin-left: auto;
}

.step-card {
    padding: 2rem;
    margin-bottom: 70vh; 
    border: 2px solid var(--text-color);
    border-radius: 8px;
    box-shadow: 4px 4px 0 rgba(0,0,0,0.1);
    background-color: rgba(255,255,255,0.95);
    backdrop-filter: blur(5px);
    transition: opacity 0.3s;
    opacity: 0.3;
}

.step-card.is-active {
    opacity: 1;
}

/* Scrolly Split Layout */
.scrolly-split {
    display: flex;
    max-width: 1200px;
    margin: 4rem auto;
    position: relative;
    padding: 0 2rem;
    gap: 4rem;
    align-items: flex-start;
}

.sticky-side {
    flex: 1;
    position: sticky;
    top: 10vh;
    height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scroll-side {
    flex: 1;
    padding-bottom: 50vh;
    padding-top: 5vh;
}

@media (max-width: 900px) {
    .scrolly-split {
        flex-direction: column;
    }
    .sticky-side {
        position: sticky;
        top: 0;
        height: 50vh;
        z-index: 0;
        width: 100%;
    }
    .scroll-side {
        padding-top: 10vh;
        z-index: 1;
        width: 100%;
    }
    .leaflet-map {
        width: 95%;
    }
}

/* Decorative margin elements */
.pudding-article {
    position: relative;
}

.deco-plant {
    position: absolute;
    pointer-events: none;
    user-select: none;
    z-index: 0;
    mix-blend-mode: multiply;
}

/* Content sections stack above decorative plants */
.prose,
.highlight-text,
.full-bleed,
.viz-container,
.scrolly-overlay,
.scrolly-split,
.methodology-section,
.site-footer {
    position: relative;
    z-index: 1;
}

.methodology-section {
    display: block;
    background-color: rgba(255,255,255,0.6);
    border-top: 2px solid var(--text-color);
    margin-top: 3rem;
    font-size: 0.95rem;
    padding: 2.5rem 2rem;
    max-width: 900px;
}

.methodology-content p {
    margin-bottom: 1rem;
}

.site-footer {
    text-align: center;
    padding: 4rem 2rem;
    font-family: 'Comico', cursive;
    color: var(--text-color);
    opacity: 0.5;
}

/* Sites Carousel */
.sites-carousel-wrap {
    max-width: 1000px;
    margin: 0 auto 2rem;
    padding: 0 2rem;
    position: relative;
    z-index: 1;
}

.carousel-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 0.4rem;
}

.carousel-btn {
    background: transparent;
    color: var(--cultivada);
    border: none;
    padding: 0.2rem 0.4rem;
    font-size: 1.8rem;
    cursor: pointer;
    line-height: 1;
    transition: opacity 0.2s;
}

.carousel-btn:hover {
    opacity: 0.55;
}

.carousel-name {
    font-family: 'Comico', cursive;
    font-weight: normal;
    font-size: 1.2rem;
    text-align: center;
    min-width: 240px;
}

.carousel-stage {
    width: 100%;
    overflow: hidden;
    background: transparent;
}

.carousel-img-tooltip {
    position: fixed;
    pointer-events: none;
    background: var(--bg-color);
    color: var(--cultivada);
    font-family: 'Tabular', sans-serif;
    font-weight: 600;
    font-size: 0.78rem;
    padding: 0.25rem 0.65rem;
    border: 1px solid var(--cultivada);
    border-radius: 4px;
    z-index: 9999;
    display: none;
    white-space: nowrap;
    letter-spacing: 0.03em;
}

.carousel-download {
    text-align: center;
    margin-top: 1.5rem;
    font-family: 'Tabular', sans-serif;
    font-weight: 600;
    font-size: 0.82rem;
}

.carousel-download a {
    color: var(--cultivada);
    text-decoration: none;
    border-bottom: 1px solid var(--cultivada);
    padding-bottom: 1px;
    transition: opacity 0.2s;
}

.carousel-download a:hover {
    opacity: 0.65;
}

.carousel-main-img {
    width: 100%;
    height: auto;
    display: none; /* mostrado/oculto por JS según vista */
}

.carousel-overview-grid {
    display: none; /* controlado por JS */
    flex-direction: column;
    gap: 5%;
    width: 100%;
}

.carousel-overview-item {
    width: 100%;
    height: auto;
    display: block;
}

.carousel-thumbs {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.carousel-thumb-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
}

.carousel-thumb {
    width: 160px;
    height: 80px;
    object-fit: cover;
    border: 1.5px solid var(--cultivada);
    border-radius: 4px;
    opacity: 0.65;
    transition: opacity 0.2s, transform 0.2s;
    display: block;
}

.carousel-thumb-wrap:hover .carousel-thumb,
.carousel-thumb-wrap.is-active .carousel-thumb {
    opacity: 1;
    transform: translateY(-2px);
}

.carousel-thumb-label {
    font-family: 'Tabular', sans-serif;
    font-weight: 600;
    font-size: 0.7rem;
    color: var(--cultivada);
    letter-spacing: 0.04em;
    opacity: 0.75;
    transition: opacity 0.2s;
}

.carousel-thumb-wrap:hover .carousel-thumb-label,
.carousel-thumb-wrap.is-active .carousel-thumb-label {
    opacity: 1;
}

/* ── Simbología panel (dentro del carrusel de sitios) ───────── */
.carousel-sim-panel {
    margin: 0.4rem 0 0.3rem;
    padding: 0.65rem 1rem 0.6rem;
    background: transparent;
    border: 1.5px solid var(--cultivada);
    border-radius: 8px;
}

.sim-header {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(0,0,0,.12);
}

.sim-title {
    font-family: 'Comico', cursive;
    font-weight: normal;
    font-size: 1rem;
    color: #000;
    letter-spacing: 0.01em;
}

.sim-section {
    font-family: 'Tabular', sans-serif;
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #666;
}

.sim-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.55rem 1rem;
}

.sim-item {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    cursor: default;
}

.sim-icon {
    flex-shrink: 0;
    width: 36px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sim-icon svg {
    max-width: 36px;
    max-height: 28px;
    width: auto;
    height: auto;
    display: block;
    color: #000;
}

.sim-name {
    font-family: 'Tabular', sans-serif;
    font-weight: 600;
    font-size: 0.68rem;
    color: #222;
    line-height: 1.3;
    letter-spacing: 0.01em;
}

@media (max-width: 600px) {
    .sim-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
    .sim-icon { width: 28px; height: 22px; }
    .sim-icon svg { max-width: 28px; max-height: 22px; }
    .sim-name { font-size: 0.62rem; }
}

/* Methodology Process Carousel */
.meto-carousel {
    margin-top: 2.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.meto-carousel-row {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    width: 100%;
    justify-content: center;
}

.meto-arrow {
    background: none;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: #000;
    flex-shrink: 0;
    padding: 0.25rem;
    line-height: 1;
    opacity: 0.55;
    transition: opacity 0.15s;
}

.meto-arrow:hover {
    opacity: 1;
}

.meto-img-wrap {
    flex: 1;
    max-width: 720px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 180px;
}

.meto-img {
    max-width: 100%;
    max-height: 460px;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

.meto-caption {
    font-family: 'Tabular', sans-serif;
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #555;
    text-align: center;
}

.meto-counter {
    font-family: 'Tabular', sans-serif;
    font-size: 0.65rem;
    color: #bbb;
    text-align: center;
}
