/* M-Twin4US shared styles */
:root {
    --navy: #0b2545;
    --navy-2: #13315c;
    --eu-blue: #003399;
    --eu-gold: #ffcc00;
    --accent: #1d5fa8;
    --accent-dark: #164a84;
    --text: #1f2933;
    --muted: #5f6b7a;
    --line: #e3e8ef;
    --bg: #ffffff;
    --bg-soft: #f5f7fa;
    --radius: 10px;
    --max: 1040px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 17px;
    line-height: 1.65;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--accent); }
a:hover { color: var(--accent-dark); }
img { max-width: 100%; height: auto; }

.container { max-width: var(--max); margin: 0 auto; padding: 0 1.25rem; }

.skip-link {
    position: absolute; left: -999px; top: 0;
    background: var(--eu-gold); color: #000; padding: .5rem 1rem; z-index: 100;
}
.skip-link:focus { left: 1rem; }

/* ---------- Header / navigation ---------- */
.site-header {
    position: sticky; top: 0; z-index: 50;
    background: var(--navy);
    color: #fff;
    border-bottom: 3px solid var(--eu-gold);
}
.site-header .container {
    display: flex; align-items: center; justify-content: space-between;
    min-height: 64px; gap: 1rem;
}
.brand { color: #fff; text-decoration: none; display: flex; flex-direction: column; line-height: 1.2; }
.brand:hover { color: #fff; }
.brand strong { font-size: 1.25rem; letter-spacing: .02em; }
.brand span { font-size: .78rem; color: #b8c7da; }

.nav-toggle {
    display: none;
    background: none; border: 1px solid rgba(255,255,255,.35); border-radius: 6px;
    color: #fff; padding: .45rem .6rem; cursor: pointer; line-height: 0;
}
.nav-toggle svg { width: 22px; height: 22px; }

.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: .25rem; }
.site-nav a {
    display: block; padding: .5rem .85rem; border-radius: 6px;
    color: #dbe4ef; text-decoration: none; font-weight: 500; font-size: .97rem;
}
.site-nav a:hover { background: var(--navy-2); color: #fff; }
.site-nav a[aria-current="page"] { color: #fff; background: var(--navy-2); box-shadow: inset 0 -2px 0 var(--eu-gold); }

/* ---------- Page hero ---------- */
.hero {
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 60%, #1b4a7a 100%);
    color: #fff;
    padding: 3.5rem 0 3rem;
}
.hero h1 { font-size: 2.4rem; line-height: 1.2; margin: 0 0 .5rem; }
.hero .lead { font-size: 1.2rem; color: #d3deea; margin: 0 0 1.5rem; max-width: 720px; }
.hero .eyebrow {
    display: inline-block; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase;
    color: var(--eu-gold); font-weight: 600; margin-bottom: .75rem;
}
.page-hero { padding: 2.25rem 0 2rem; }
.page-hero h1 { font-size: 2rem; }
.page-hero .lead { margin-bottom: 0; font-size: 1.08rem; }

/* ---------- Content ---------- */
main { display: block; flex: 1 0 auto; }
.section { padding: 2.75rem 0; }
.section + .section { border-top: 1px solid var(--line); }
.section h2 { font-size: 1.55rem; margin: 0 0 1rem; color: var(--navy); }
.section h3 { font-size: 1.15rem; margin: 1.5rem 0 .5rem; color: var(--navy); }
.section p { margin: 0 0 1rem; }

.grid-2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 2.5rem; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }

.card {
    background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 1.4rem 1.5rem;
}
.card.soft { background: var(--bg-soft); }
.card h3 { margin-top: 0; }

.facts { margin: 0; }
.facts div { padding: .6rem 0; border-bottom: 1px solid var(--line); }
.facts div:last-child { border-bottom: 0; }
.facts dt { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.facts dd { margin: .1rem 0 0; font-weight: 500; }

.pillar .num {
    display: inline-flex; align-items: center; justify-content: center;
    width: 2rem; height: 2rem; border-radius: 50%;
    background: var(--navy); color: var(--eu-gold); font-weight: 700; font-size: .95rem;
    margin-bottom: .6rem;
}
.pillar p { color: var(--muted); font-size: .97rem; margin: 0; }

.btn {
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .65rem 1.2rem; border-radius: 8px;
    background: var(--accent); color: #fff; text-decoration: none; font-weight: 600;
    border: 1px solid var(--accent); font-size: .97rem;
}
.btn:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }
.btn.secondary { background: transparent; color: var(--accent); }
.btn.secondary:hover { background: var(--bg-soft); color: var(--accent-dark); }
.hero .btn.secondary { color: #fff; border-color: rgba(255,255,255,.55); }
.hero .btn.secondary:hover { background: rgba(255,255,255,.1); }
.btn-row { display: flex; flex-wrap: wrap; gap: .75rem; }

.todo {
    background: #fff7d6; border: 1px dashed #d4a500; color: #6b5200;
    padding: 0 .3em; border-radius: 4px; font-size: .92em;
}

/* ---------- Team ---------- */
.person {
    display: grid; grid-template-columns: 120px 1fr; gap: 1.5rem; align-items: center;
}
.avatar {
    width: 120px; height: 120px; border-radius: 50%;
    background: linear-gradient(135deg, var(--navy), var(--accent));
    color: #fff; font-size: 2.4rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}
.person h3 { margin: 0; font-size: 1.3rem; }
.person .role { color: var(--muted); margin: .15rem 0 .8rem; }

/* ---------- Publications ---------- */
.pub-year { font-size: 1.2rem; color: var(--navy); margin: 2rem 0 .75rem; padding-bottom: .35rem; border-bottom: 2px solid var(--line); }
.pub-year:first-of-type { margin-top: 0; }
.pub-list { list-style: none; margin: 0; padding: 0; }
.pub {
    padding: 1.1rem 1.25rem; margin-bottom: .9rem;
    border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--radius);
}
.pub-type {
    display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
    color: var(--accent); background: #eaf1fa; padding: .1rem .5rem; border-radius: 4px; margin-bottom: .4rem;
}
.pub-type.conf { color: #7a4d00; background: #fff2d1; }
.pub-title { font-weight: 600; font-size: 1.05rem; margin: 0 0 .3rem; line-height: 1.4; }
.pub-title a { color: var(--text); text-decoration: none; }
.pub-title a:hover { color: var(--accent); text-decoration: underline; }
.pub-authors { margin: 0 0 .2rem; font-size: .95rem; }
.pub-authors .me { font-weight: 700; text-decoration: underline; text-decoration-color: var(--eu-gold); text-decoration-thickness: 2px; }
.pub-venue { margin: 0; font-size: .95rem; color: var(--muted); font-style: italic; }
.section .pub > p { margin-bottom: .25rem; }
.section .pub > p:last-child { margin-bottom: 0; }
.pub-links { margin-top: .6rem; display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; font-size: .9rem; }
.pub-links a { text-decoration: none; font-weight: 600; }
.pub details { width: 100%; }
.pub summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.pub pre {
    background: var(--bg-soft); border: 1px solid var(--line); border-radius: 6px;
    padding: .75rem; font-size: .8rem; overflow-x: auto; margin: .5rem 0 0; white-space: pre;
}

/* ---------- Outputs / dashboard ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin: 1.25rem 0 1.75rem; }
.stat { background: var(--bg-soft); border-radius: var(--radius); padding: 1rem 1.2rem; }
.stat strong { display: block; font-size: 1.6rem; color: var(--navy); line-height: 1.2; }
.stat span { color: var(--muted); font-size: .9rem; }

.embed {
    position: relative; border: 1px solid var(--line); border-radius: var(--radius);
    overflow: hidden; background: var(--bg-soft);
}
.embed iframe {
    display: block; width: 100%; height: 900px; height: min(900px, 85vh); min-height: 560px; border: 0; background: #fff;
}
.embed-loader {
    position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: .9rem; padding: 1.5rem; text-align: center; background: var(--bg-soft); color: var(--muted);
    transition: opacity .4s ease;
}
.embed-loader.hidden { opacity: 0; pointer-events: none; }
.spinner {
    width: 42px; height: 42px; border-radius: 50%;
    border: 4px solid var(--line); border-top-color: var(--accent);
    animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.embed-note { font-size: .9rem; color: var(--muted); margin-top: .75rem; }
.mobile-only { display: none; }

/* ---------- Footer / EU funding ---------- */
.funding {
    background: var(--bg-soft); border-top: 1px solid var(--line);
    padding: 2rem 0;
}
.funding .container { display: flex; gap: 1.5rem; align-items: center; }
.eu-emblem { display: flex; align-items: center; gap: .9rem; flex-shrink: 0; }
.eu-emblem img { width: 96px; height: 64px; display: block; }
.eu-emblem span { font-weight: 700; color: var(--eu-blue); line-height: 1.2; font-size: 1rem; }
.funding p { margin: 0 0 .4rem; font-size: .88rem; color: var(--muted); }
.funding p:last-child { margin-bottom: 0; }
.funding strong { color: var(--text); }

.site-footer { background: var(--navy); color: #b8c7da; font-size: .88rem; padding: 1.25rem 0; }
.site-footer .container { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem 1.5rem; }
.site-footer a { color: #dbe4ef; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
    .grid-2 { grid-template-columns: 1fr; gap: 1.75rem; }
    .grid-3 { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
    body { font-size: 16px; }
    .nav-toggle { display: inline-flex; }
    .site-nav {
        position: absolute; top: 100%; left: 0; right: 0;
        background: var(--navy); border-bottom: 3px solid var(--eu-gold);
        display: none;
    }
    .site-nav.open { display: block; }
    .site-nav ul { flex-direction: column; padding: .5rem 1.25rem 1rem; gap: 0; }
    .site-nav a { padding: .8rem .5rem; border-radius: 0; border-bottom: 1px solid rgba(255,255,255,.08); }
    .site-nav a[aria-current="page"] { box-shadow: inset 3px 0 0 var(--eu-gold); }

    .hero { padding: 2.25rem 0 2rem; }
    .hero h1 { font-size: 1.85rem; }
    .hero .lead { font-size: 1.05rem; }
    .page-hero h1 { font-size: 1.6rem; }
    .section { padding: 2rem 0; }
    .section h2 { font-size: 1.35rem; }

    .person { grid-template-columns: 1fr; text-align: center; justify-items: center; }
    .person .btn-row { justify-content: center; }

    .stats { grid-template-columns: 1fr; gap: .6rem; }
    .stat { display: flex; align-items: baseline; gap: .6rem; }
    .stat strong { font-size: 1.3rem; }

    .embed iframe { height: 75vh; min-height: 480px; }
    .mobile-only { display: block; }

    .funding .container { flex-direction: column; align-items: flex-start; }
    .pub { padding: 1rem; }
}

/* ---------- Team: section headings and partners ---------- */
.team-heading { margin-top: 2.25rem !important; }
.team-heading:first-child { margin-top: 0 !important; }
.partners { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.25rem; }
.partner {
    display: flex; flex-direction: column; gap: .3rem;
    text-decoration: none; color: var(--text);
    border-left: 4px solid var(--eu-gold);
    transition: border-color .2s, box-shadow .2s;
}
.partner:hover { color: var(--text); border-color: var(--accent); box-shadow: 0 2px 10px rgba(11,37,69,.08); }
.partner strong { font-size: 1.05rem; color: var(--navy); }
.partner span { color: var(--muted); font-size: .92rem; }
@media (max-width: 720px) { .partners { grid-template-columns: 1fr; } }

/* ---------- Icon-only link buttons ---------- */
.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 42px; height: 42px; border-radius: 8px;
    border: 1px solid var(--line); color: var(--muted); background: var(--bg);
    transition: color .2s, border-color .2s, background .2s;
}
.icon-btn svg { width: 22px; height: 22px; display: block; }
.icon-btn:hover { color: var(--accent); border-color: var(--accent); background: var(--bg-soft); }

/* ---------- Project framework figure ---------- */
.project-figure { margin: 2rem 0 0; }
.project-figure img {
    width: 100%; height: auto; display: block;
    border: 1px solid var(--line); border-radius: var(--radius); background: #fff;
}
.project-figure figcaption {
    margin-top: .75rem; font-size: .9rem; color: var(--muted); line-height: 1.5;
}

/* ---------- News (image left, text right) ---------- */
.news-list { list-style: none; margin: 0; padding: 0; }
.news-item {
    display: grid; grid-template-columns: 240px 1fr; gap: 1.5rem; align-items: start;
    padding: 1.5rem 0; border-bottom: 1px solid var(--line);
}
.news-item:last-child { border-bottom: 0; }
.news-item:first-child { padding-top: 0; }
.news-media {
    aspect-ratio: 4 / 3; overflow: hidden;
    border: 1px solid var(--line); border-radius: 8px; background: var(--line);
    display: grid; grid-template-columns: 1fr; gap: 2px;
}
.news-media.imgs-2 { grid-template-columns: 1fr 1fr; }
.news-media.imgs-4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.news-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.news-body h3 { margin: .35rem 0 .4rem; font-size: 1.15rem; color: var(--navy); }
.news-body p { margin: 0; }
.news-meta { display: flex; align-items: center; gap: .6rem; color: var(--muted); font-weight: 600; font-size: .9rem; }
.news-tag {
    display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
    color: var(--accent); background: #eaf1fa; padding: .1rem .5rem; border-radius: 4px;
}
.news-tag.event, .news-tag.career { color: #146c43; background: #e3f3ea; }
.news-tag.award { color: #8a5a00; background: #fff2d1; }
.news-tag.outreach { color: #6b3fa0; background: #efe7fb; }
@media (max-width: 720px) {
    .news-item { grid-template-columns: 1fr; gap: .75rem; }
}
