/* =========================================================
   CSS VARIABLES
========================================================= */
:root {
    --olive:       #4a5240;
    --olive-light: #6b7260;
    --olive-pale:  #d4d9c8;
    --cream:       #f5f2eb;
    --cream-dark:  #ede9e0;
    --white:       #ffffff;
    --ink:         #1c1c1a;
    --ink-soft:    #4a4a46;
    --ink-muted:   #8a8a82;
    --accent:      #8b7355;
    --accent-light:#c4a882;

    --font-serif: 'Cormorant Garamond', Georgia, serif;
    --font-sans:  'DM Sans', system-ui, sans-serif;

    --nav-h: 68px;
    --section-pad: 100px;
    --inner-max: 1140px;

    --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* =========================================================
   RESET & BASE
========================================================= */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

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

body {
    font-family: var(--font-sans);
    background: var(--cream);
    color: var(--ink);
    padding-top: var(--nav-h);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* =========================================================
   NAVBAR
========================================================= */
.navbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--nav-h);
    background: rgba(245, 242, 235, 0.96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--olive-pale);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 48px;
    z-index: 1000;
    transition: box-shadow 0.3s var(--ease);
}

.navbar.scrolled {
    box-shadow: 0 4px 24px rgba(74, 82, 64, 0.08);
}

.nav-brand {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.nav-label {
    font-size: 0.65rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--olive-light);
}

.nav-title {
    font-family: var(--font-serif);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--olive);
    letter-spacing: 0.02em;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 36px;
}

.nav-links a {
    font-size: 0.82rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-soft);
    transition: color 0.2s;
    position: relative;
    padding-bottom: 2px;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -2px; left: 0;
    width: 0; height: 1px;
    background: var(--olive);
    transition: width 0.3s var(--ease);
}

.nav-links a:hover { color: var(--olive); }
.nav-links a:hover::after { width: 100%; }

/* LANG SWITCHER */
.lang-switcher {
    display: flex;
    gap: 4px;
}

.lang-btn {
    background: none;
    border: 1px solid transparent;
    padding: 4px 8px;
    font-family: var(--font-sans);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    color: var(--ink-muted);
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.2s;
}

.lang-btn:hover, .lang-btn.active {
    color: var(--olive);
    border-color: var(--olive-pale);
    background: var(--cream-dark);
}

/* HAMBURGER */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.hamburger span {
    display: block;
    width: 22px;
    height: 1.5px;
    background: var(--ink);
    transition: all 0.3s var(--ease);
}

/* MOBILE MENU */
.mobile-menu {
    display: none;
    position: fixed;
    top: var(--nav-h);
    left: 0; right: 0;
    background: var(--cream);
    border-bottom: 1px solid var(--olive-pale);
    padding: 24px 32px 32px;
    z-index: 999;
    transform: translateY(-10px);
    opacity: 0;
    transition: all 0.3s var(--ease);
}

.mobile-menu.open {
    transform: translateY(0);
    opacity: 1;
}

.mobile-menu ul { list-style: none; }

.mobile-menu ul li + li { margin-top: 4px; }

.mobile-menu ul a {
    display: block;
    font-size: 1.2rem;
    font-family: var(--font-serif);
    color: var(--ink);
    padding: 8px 0;
    border-bottom: 1px solid var(--olive-pale);
}

.mobile-lang { margin-top: 20px; }

/* =========================================================
   HERO
========================================================= */
.hero {
    position: relative;
    min-height: calc(100vh - var(--nav-h));
    display: flex;
    align-items: center;
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    inset: 0;
    background-image: url('img/portada.jpg');
    background-size: cover;
    background-position: center 30%;
    transform: scale(1.04);
    transition: transform 8s ease-out;
}

.hero-bg.loaded { transform: scale(1); }

.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        rgba(28, 28, 26, 0.68) 0%,
        rgba(74, 82, 64, 0.45) 60%,
        rgba(74, 82, 64, 0.25) 100%
    );
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: var(--inner-max);
    margin: 0 auto;
    padding: 80px 48px;
    animation: heroFadeIn 1.2s var(--ease) both;
}

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

.hero-eyebrow {
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--accent-light);
    margin-bottom: 20px;
}

.hero-title {
    font-family: var(--font-serif);
    font-size: clamp(2.8rem, 6vw, 5.5rem);
    font-weight: 300;
    color: var(--white);
    line-height: 1.1;
    margin-bottom: 24px;
    letter-spacing: -0.01em;
}

.hero-title em {
    font-style: italic;
    color: var(--accent-light);
}

.hero-subtitle {
    font-size: clamp(0.95rem, 1.5vw, 1.1rem);
    color: rgba(255,255,255,0.8);
    max-width: 560px;
    line-height: 1.7;
    margin-bottom: 36px;
    font-weight: 300;
}

.hero-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.82rem;
    color: rgba(255,255,255,0.6);
    letter-spacing: 0.04em;
}

.hero-meta .dot { opacity: 0.4; }

.hero-scroll {
    position: absolute;
    bottom: 36px;
    right: 48px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: rgba(255,255,255,0.5);
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    z-index: 2;
}

.scroll-line {
    width: 40px;
    height: 1px;
    background: rgba(255,255,255,0.3);
    position: relative;
    overflow: hidden;
}

.scroll-line::after {
    content: '';
    position: absolute;
    left: -100%; top: 0;
    width: 100%; height: 100%;
    background: rgba(255,255,255,0.7);
    animation: scrollPulse 2s ease-in-out infinite;
}

@keyframes scrollPulse {
    0%   { left: -100%; }
    100% { left: 100%; }
}

/* =========================================================
   INTRO STRIP
========================================================= */
.intro-strip {
    background: var(--olive);
    padding: 40px 48px;
}

.intro-grid {
    max-width: var(--inner-max);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
}

.intro-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 60px;
}

.stat-number {
    font-family: var(--font-serif);
    font-size: 2.8rem;
    font-weight: 300;
    color: var(--white);
    line-height: 1;
    margin-bottom: 6px;
}

.stat-label {
    font-size: 0.72rem;
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--olive-pale);
    text-align: center;
}

.intro-divider {
    width: 1px;
    height: 48px;
    background: rgba(255,255,255,0.15);
    flex-shrink: 0;
}

/* =========================================================
   SECTIONS
========================================================= */
.section {
    padding: var(--section-pad) 48px;
}

.section--alt {
    background: var(--cream-dark);
}

.section-inner {
    max-width: var(--inner-max);
    margin: 0 auto;
}

.section-header {
    margin-bottom: 56px;
}

.section-eyebrow {
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--olive-light);
    margin-bottom: 12px;
}

.section-title {
    font-family: var(--font-serif);
    font-size: clamp(2rem, 3.5vw, 2.8rem);
    font-weight: 300;
    color: var(--ink);
    line-height: 1.2;
}

.section-desc {
    margin-top: 12px;
    color: var(--ink-soft);
    max-width: 560px;
    font-size: 0.95rem;
}

/* =========================================================
   NEWS GRID
========================================================= */
.news-grid {
    display: grid;
    grid-template-columns: 1.6fr 1fr 1fr;
    grid-template-rows: auto auto;
    gap: 24px;
}

.news-card {
    background: var(--white);
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
    border: 1px solid var(--olive-pale);
}

.news-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 40px rgba(74, 82, 64, 0.12);
}

.news-card--featured {
    grid-row: 1 / 3;
}

.news-card-img {
    width: 100%;
    background-size: cover;
    background-position: center;
    background-color: var(--olive-pale);
}

.news-card--featured .news-card-img { height: 280px; }
.news-card:not(.news-card--featured) .news-card-img { height: 140px; }

.news-card-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.news-tag {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent);
    border: 1px solid var(--accent-light);
    border-radius: 2px;
    padding: 3px 8px;
    margin-bottom: 8px;
    align-self: flex-start;
}

.news-card-body time {
    font-size: 0.75rem;
    color: var(--ink-muted);
    margin-bottom: 10px;
    display: block;
}

.news-card-body h3 {
    font-family: var(--font-serif);
    font-size: 1.15rem;
    font-weight: 400;
    line-height: 1.35;
    color: var(--ink);
    margin-bottom: 12px;
    flex: 1;
}

.news-card--featured .news-card-body h3 {
    font-size: 1.5rem;
}

.news-card-body p {
    font-size: 0.87rem;
    color: var(--ink-soft);
    line-height: 1.65;
    margin-bottom: 16px;
}

.card-link {
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    color: var(--olive);
    align-self: flex-start;
    margin-top: auto;
    transition: color 0.2s;
}

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

/* =========================================================
   PROJECT
========================================================= */
.project-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 80px;
    align-items: start;
}

.project-question {
    font-family: var(--font-serif);
    font-size: 1.3rem;
    font-weight: 400;
    font-style: italic;
    color: var(--olive);
    margin-bottom: 12px;
    margin-top: 36px;
}

.project-question:first-child { margin-top: 0; }

.project-text p {
    font-size: 0.97rem;
    color: var(--ink-soft);
    line-height: 1.8;
}

.project-info-card {
    background: var(--white);
    border: 1px solid var(--olive-pale);
    border-radius: 4px;
    padding: 28px;
}

.info-label {
    font-size: 0.65rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-muted);
    margin-top: 20px;
    margin-bottom: 4px;
}

.info-label:first-child { margin-top: 0; }

.info-value {
    font-size: 0.9rem;
    color: var(--ink);
    font-weight: 400;
    line-height: 1.4;
}

.eu-badge {
    margin-top: 16px;
    padding: 12px 16px;
    background: rgba(74, 82, 64, 0.06);
    border-radius: 4px;
    border-left: 3px solid var(--olive);
}

.eu-badge span {
    font-size: 0.78rem;
    color: var(--ink-soft);
    font-style: italic;
}

/* =========================================================
   BIBLIOGRAPHY
========================================================= */
.bib-filters {
    display: flex;
    gap: 8px;
    margin-bottom: 36px;
    flex-wrap: wrap;
}

.bib-filter {
    background: none;
    border: 1px solid var(--olive-pale);
    padding: 7px 16px;
    font-family: var(--font-sans);
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    color: var(--ink-soft);
    cursor: pointer;
    border-radius: 2px;
    transition: all 0.2s;
}

.bib-filter:hover, .bib-filter.active {
    background: var(--olive);
    border-color: var(--olive);
    color: var(--white);
}

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

.bib-entry {
    display: grid;
    grid-template-columns: 64px 1fr;
    gap: 24px;
    padding: 24px 0;
    border-bottom: 1px solid var(--olive-pale);
    transition: opacity 0.3s var(--ease);
}

.bib-entry.hidden {
    display: none;
}

.bib-year {
    font-family: var(--font-serif);
    font-size: 1.1rem;
    color: var(--ink-muted);
    font-weight: 300;
    padding-top: 2px;
}

.bib-authors {
    font-size: 0.87rem;
    color: var(--ink-soft);
    margin-bottom: 4px;
}

.bib-title {
    font-size: 0.95rem;
    color: var(--ink);
    margin-bottom: 4px;
    line-height: 1.45;
}

.bib-journal {
    font-size: 0.83rem;
    color: var(--ink-muted);
    margin-bottom: 8px;
}

.bib-link {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--olive);
    letter-spacing: 0.04em;
    transition: color 0.2s;
}

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

/* =========================================================
   DISCUSSION
========================================================= */
.threads {
    display: flex;
    flex-direction: column;
    gap: 24px;
    margin-bottom: 48px;
}

.thread {
    background: var(--white);
    border: 1px solid var(--olive-pale);
    border-radius: 4px;
    overflow: hidden;
}

.thread-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 28px;
    border-bottom: 1px solid var(--olive-pale);
    background: rgba(74, 82, 64, 0.03);
}

.thread-title {
    font-family: var(--font-serif);
    font-size: 1.1rem;
    font-weight: 400;
    color: var(--ink);
}

.thread-count {
    font-size: 0.75rem;
    color: var(--ink-muted);
    letter-spacing: 0.04em;
}

.thread-messages {
    padding: 24px 28px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.message {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--olive);
    color: var(--white);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.message-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.message-meta strong {
    font-size: 0.87rem;
    font-weight: 500;
    color: var(--ink);
}

.message-meta time {
    font-size: 0.75rem;
    color: var(--ink-muted);
}

.message-body p {
    font-size: 0.9rem;
    color: var(--ink-soft);
    line-height: 1.65;
}

.disc-contact {
    text-align: center;
    padding: 40px;
    background: var(--white);
    border: 1px solid var(--olive-pale);
    border-radius: 4px;
}

.disc-contact p {
    font-size: 0.95rem;
    color: var(--ink-soft);
    margin-bottom: 20px;
    max-width: 420px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
}

.btn-primary {
    display: inline-block;
    padding: 12px 28px;
    background: var(--olive);
    color: var(--white);
    font-size: 0.82rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border-radius: 2px;
    transition: background 0.2s var(--ease), transform 0.2s;
}

.btn-primary:hover {
    background: var(--olive-light);
    transform: translateY(-1px);
}

/* =========================================================
   FOOTER
========================================================= */
.footer {
    background: var(--ink);
    color: var(--white);
}

.footer-inner {
    max-width: var(--inner-max);
    margin: 0 auto;
    padding: 60px 48px 48px;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 48px;
}

.footer-project {
    font-family: var(--font-serif);
    font-size: 1.3rem;
    font-weight: 300;
    margin-bottom: 4px;
}

.footer-name {
    font-size: 0.9rem;
    color: rgba(255,255,255,0.7);
    margin-bottom: 4px;
}

.footer-inst {
    font-size: 0.82rem;
    color: rgba(255,255,255,0.45);
}

.footer-links {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.footer-links a {
    font-size: 0.87rem;
    color: rgba(255,255,255,0.65);
    transition: color 0.2s;
}

.footer-links a:hover { color: var(--white); }

.footer-eu p {
    font-size: 0.78rem;
    color: rgba(255,255,255,0.4);
    line-height: 1.7;
    font-style: italic;
}

.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.08);
    padding: 20px 48px;
    text-align: center;
    font-size: 0.75rem;
    color: rgba(255,255,255,0.3);
    letter-spacing: 0.04em;
}

/* =========================================================
   RESPONSIVE
========================================================= */
@media (max-width: 1024px) {
    .news-grid {
        grid-template-columns: 1fr 1fr;
    }
    .news-card--featured {
        grid-column: 1 / -1;
        grid-row: auto;
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
    .news-card--featured .news-card-img { height: 100%; min-height: 220px; }

    .project-layout {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .footer-inner {
        grid-template-columns: 1fr 1fr;
    }

    .footer-eu { grid-column: 1 / -1; }
}

@media (max-width: 768px) {
    :root { --section-pad: 64px; }

    .navbar { padding: 0 24px; }
    .nav-links, .lang-switcher:not(.mobile-lang) { display: none; }
    .hamburger { display: flex; }
    .mobile-menu { display: block; }

    .hero-content { padding: 48px 24px; }
    .hero-scroll { display: none; }

    .intro-strip { padding: 32px 24px; }
    .intro-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 24px;
    }
    .intro-divider { display: none; }
    .intro-stat { padding: 0; }

    .section { padding: var(--section-pad) 24px; }

    .news-grid {
        grid-template-columns: 1fr;
    }
    .news-card--featured {
        display: flex;
        flex-direction: column;
    }
    .news-card--featured .news-card-img { height: 200px; }

    .footer-inner {
        grid-template-columns: 1fr;
        gap: 32px;
        padding: 40px 24px 32px;
    }
    .footer-eu { grid-column: auto; }
    .footer-bottom { padding: 16px 24px; }
}
