/* ================================================
   ROOT TOKENS
   ================================================ */
:root {
    --fesb-blue: #0c7ab8;
    --fesb-blue-dark: #0a6599;
    --fesb-blue-soft: #e8f1f9;
    --fesb-orange: #e43e2b;
    --fesb-orange-dark: #c32f1e;

    --text-primary: #1a2330;
    --text-secondary: #5b6876;
    --text-muted: #8a96a3;

    --bg-main: #ffffff;
    --bg-alt: #f5f7fa;
    --bg-card: #ffffff;
    --bg-header: rgba(255, 255, 255, 0.92);
    --bg-footer: #1f1f1f;

    --border-color: #e4e8ee;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
    --shadow-md: 0 4px 12px rgba(16, 24, 40, 0.08);
    --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.10);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;

    --font-main: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    --transition-speed: 0.35s;
    --ease: cubic-bezier(0.4, 0, 0.2, 1);

    --container: 1200px;
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: 70px;
    background-color: var(--bg-main);
    transition: background-color var(--transition-speed) var(--ease);
}

@media (max-width: 900px) {
    html {
        scroll-padding-top: 60px;
    }
}

body {
    font-family: var(--font-main);
    font-size: 16px;
    line-height: 1.65;
    color: var(--text-primary);
    background-color: transparent;
    position: relative;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    transition: color var(--transition-speed) var(--ease);
}

main {
    position: relative;
    z-index: 2;
}

footer {
    position: relative;
    z-index: 2;
}

a {
    color: var(--fesb-blue);
}

/* ================================================
   AMBIENT BACKGROUND 3D VIEWER
   ================================================ */
.bg-viewer {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
    background-color: transparent !important;
    --progress-bar-color: transparent;
    --progress-mask: transparent;
    filter: drop-shadow(0 0 2px rgba(12, 122, 184, 0.7)) saturate(0.55);
    opacity: 0;
    transform: scale(1.05);
    /* hide blur edge artifacts */
}

[data-theme="dark"] .bg-viewer {
    filter:
        drop-shadow(0 0 1px rgba(93, 180, 255, 0.95)) drop-shadow(0 0 4px rgba(93, 180, 255, 0.55)) blur(4px) saturate(0.6) brightness(0.95);
    opacity: 0.33;
}

/* ================================================
   SHIP OVERLAY + WAVES
   ================================================ */
#ship-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 50;
}

.wave-sticky-anchor {
    position: sticky;
    bottom: 0;
    width: 100%;
    height: 0;
    z-index: -1;
}

.wave-bg {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 420px;
    pointer-events: none;
    z-index: 3;
    overflow: hidden;
}

.wave-bg svg {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 200%;
    height: 100%;
}

.wave-bg .wave1 {
    animation: waveMove1 18s ease-in-out infinite;
    opacity: 0.22;
}

.wave-bg .wave2 {
    animation: waveMove2 22s ease-in-out infinite;
    opacity: 0.16;
}

.wave-bg .wave3 {
    animation: waveMove3 26s ease-in-out infinite;
    opacity: 0.10;
}

@keyframes waveMove1 {

    0%,
    100% {
        transform: translateX(0);
    }

    50% {
        transform: translateX(-25%);
    }
}

@keyframes waveMove2 {

    0%,
    100% {
        transform: translateX(-10%);
    }

    50% {
        transform: translateX(-35%);
    }
}

@keyframes waveMove3 {

    0%,
    100% {
        transform: translateX(-5%);
    }

    50% {
        transform: translateX(-20%);
    }
}

/* ================================================
   HEADER & NAV
   ================================================ */
header {
    background-color: rgba(255, 255, 255, 0.7);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    transition: background-color 0.4s var(--ease),
        border-color 0.4s var(--ease);
}

[data-theme="dark"] header {
    background-color: rgba(8, 19, 31, 0.7);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.nav-container {
    max-width: var(--container);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.9rem 2rem;
    gap: 2rem;
}

.logo-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    flex-shrink: 0;
    transition: opacity 0.4s var(--ease), transform 0.4s var(--ease);
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
}

header.scrolled .logo-link {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.logo-link img.logo-na {
    height: 34px;
    filter: invert(37%) sepia(84%) saturate(1752%) hue-rotate(173deg) brightness(96%) contrast(89%);
}

.logo-text {
    font-weight: 700;
    font-size: 0.98rem;
    letter-spacing: -0.01em;
    line-height: 1.2;
    color: var(--text-primary);
}

nav#main-nav {
    display: flex;
    gap: 2rem;
    margin-left: auto;
}

nav#main-nav a {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.92rem;
    letter-spacing: 0.01em;
    position: relative;
    transition: color 0.25s var(--ease);
}

nav#main-nav a::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -6px;
    height: 2px;
    background: var(--fesb-orange);
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 0.25s var(--ease);
}

nav#main-nav a:hover {
    color: var(--text-primary);
}

nav#main-nav a:hover::after {
    transform: scaleX(1);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
}

.theme-toggle-btn,
.ship-toggle-btn {
    background: none;
    border: none;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s var(--ease), color 0.2s var(--ease);
    color: var(--text-secondary);
    padding: 0;
}

.theme-toggle-btn:hover,
.ship-toggle-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
}

[data-theme="dark"] .theme-toggle-btn:hover,
[data-theme="dark"] .ship-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.theme-toggle-btn svg,
.ship-toggle-btn svg {
    width: 20px;
    height: 20px;
    stroke-width: 2;
    stroke: currentColor;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform 0.5s var(--ease);
}

.ship-toggle-btn.disabled {
    opacity: 0.4;
}

.ship-toggle-btn.disabled svg {
    transform: scale(0.8) rotate(-15deg);
}

.theme-toggle-btn .sun-icon {
    display: none;
}

.theme-toggle-btn .moon-icon {
    display: block;
}

[data-theme="dark"] .theme-toggle-btn .sun-icon {
    display: block;
}

[data-theme="dark"] .theme-toggle-btn .moon-icon {
    display: none;
}

[data-theme="dark"] .theme-toggle-btn svg {
    transform: rotate(360deg);
}

.mobile-toggle {
    display: none;
}

/* ================================================
   HERO
   ================================================ */
#hero {
    background:
        linear-gradient(135deg, rgba(13, 40, 72, 0.72), rgba(12, 122, 184, 0.58)),
        url('images/ui/hero-bg.webp') center/cover no-repeat;
    min-height: 85vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #fff;
    text-align: center;
    padding: 4rem 2rem;
    position: relative;
}

.hero-title-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 1.25rem;
    max-width: 900px;
}

.hero-logo {
    height: clamp(80px, 12vw, 140px);
    width: auto;
    opacity: 0.95;
    flex-shrink: 0;
    transition: transform 0.3s var(--ease), filter 0.4s var(--ease);
    cursor: pointer;
}

.hero-logo stop {
    transition: stop-color 0.5s var(--ease);
}

/* Stagger each stop so the colour wipes bottom → top */
.hero-logo stop:nth-child(1) { transition-delay: 0s;    }
.hero-logo stop:nth-child(2) { transition-delay: 0.08s; }
.hero-logo stop:nth-child(3) { transition-delay: 0.16s; }
.hero-logo stop:nth-child(4) { transition-delay: 0.24s; }
.hero-logo stop:nth-child(5) { transition-delay: 0.32s; }

.hero-logo:hover {
    transform: translateY(-3px);
    filter: drop-shadow(0 0 8px rgba(12, 122, 184, 0.55)) drop-shadow(0 0 22px rgba(12, 122, 184, 0.3));
}

.hero-logo:hover stop {
    stop-color: #0c7ab8;
}

#hero h1 {
    font-size: clamp(2.5rem, 5.5vw, 4.25rem);
    font-weight: 800;
    letter-spacing: -0.025em;
    line-height: 1.05;
    margin-bottom: 0;
    text-align: left;
    text-shadow: 0 2px 20px rgba(0, 0, 0, 0.25);
}

.hero-title-subline {
    display: block;
    font-size: 0.55em;
    line-height: 1.15;
    margin-top: 0.2rem;
}

.hero-branding {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 2.5rem;
    margin-top: 2.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    animation: fadeInDown 1s var(--ease) 0.2s both;
}

.branding-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    max-width: 250px;
    text-decoration: none;
}

.branding-logo {
    height: 64px;
    width: auto;
    opacity: 0.95;
    transition: transform 0.3s var(--ease);
}

.logo-white {
    filter: brightness(0) invert(1);
}

.branding-item:hover .branding-logo {
    transform: translateY(-3px);
}

.branding-text {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.3;
}

.hero-social {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
    margin-top: 0.5rem;
    margin-bottom: 2rem;
    animation: fadeInDown 1s var(--ease) 0.35s both;
}

.hero-social-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(255, 255, 255, 0.65);
    margin-right: 0.25rem;
}

.hero-social-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-decoration: none;
    transition: background 0.25s var(--ease), border-color 0.25s var(--ease), transform 0.25s var(--ease);
}

.hero-social-link:hover {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
}

.hero-social-icon {
    width: 18px;
    height: 18px;
    color: #fff;
    flex-shrink: 0;
}

.branding-sep {
    font-size: 1.75rem;
    font-weight: 400;
    color: #fff;
    margin-top: 0.75rem;
    font-family: inherit;
    opacity: 0.85;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center bottom, rgba(0, 0, 0, 0.35), transparent 60%);
    pointer-events: none;
}

#hero>* {
    position: relative;
    z-index: 1;
}

#hero p {
    font-size: clamp(1.05rem, 1.6vw, 1.35rem);
    max-width: 620px;
    margin-bottom: 2.5rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 400;
}

.btn-show-more {
    display: block;
    margin: 2.5rem auto 0;
}

.btn-primary,
.btn-show-more {
    background-color: var(--fesb-orange);
    color: #fff;
    padding: 1rem 2.25rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: 0.01em;
    border: none;
    cursor: pointer;
    font-family: inherit;
    box-shadow: 0 8px 24px rgba(228, 62, 43, 0.35);
    transition: background 0.25s var(--ease), transform 0.2s var(--ease), box-shadow 0.25s var(--ease);
}

.btn-primary:hover,
.btn-show-more:hover {
    background-color: var(--fesb-orange-dark);
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(228, 62, 43, 0.45);
}

/* ================================================
   SECTIONS (alternating rhythm)
   ================================================ */
main>section {
    padding: 6rem 2rem;
    position: relative;
}

main>section> :not(#hero *),
main>section>.study-grid,
main>section>.projects-grid,
main>section>.staff-grid,
main>section>.pub-container,
main>section>.contact-grid,
main>section>.contact-header,
main>section>h2,
main>section>.section-lede,
main>section>.erasmus-coordinator,
main>section>.btn-show-more {
    max-width: var(--container);
    margin-left: auto;
    margin-right: auto;
}

/* Hero ignores container padding rules */
#hero {
    padding: 10rem 2rem 6rem;
    max-width: none;
    margin: 0;
}

/* Translucent section tints — let the ambient background viewer breathe through */
#studies {
    background: rgba(255, 255, 255, 0.55);
}

#projects {
    background: rgba(245, 247, 250, 0.55);
}

#research {
    background: rgba(255, 255, 255, 0.55);
}

#staff {
    background: rgba(255, 255, 255, 0.55);
}

#publications {
    background: rgba(245, 247, 250, 0.55);
}

#contact {
    background: rgba(255, 255, 255, 0.60);
}

[data-theme="dark"] #studies,
[data-theme="dark"] #research,
[data-theme="dark"] #staff,
[data-theme="dark"] #contact {
    background: rgba(8, 19, 31, 0.55);
}

[data-theme="dark"] #projects,
[data-theme="dark"] #publications {
    background: rgba(13, 29, 46, 0.55);
}

h2 {
    font-size: clamp(1.9rem, 3vw, 2.4rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin-bottom: 1rem;
    text-align: center;
    line-height: 1.15;
}

/* Subtle orange hairline — once per section, minimal */
main > section > h2::after {
    content: '';
    display: block;
    width: 3em;
    height: 3px;
    background-color: var(--fesb-orange);
    border-radius: 3px;
    margin: 1rem auto 0;
}

.section-lede {
    text-align: center;
    max-width: 640px;
    margin: 0 auto 3.5rem;
    color: var(--text-secondary);
    font-size: 1.05rem;
}

.section-lede a {
    color: var(--fesb-blue);
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px solid currentColor;
}

/* ================================================
   UNIFIED CARD
   ================================================ */
.card {
    background: rgba(255, 255, 255, 0.45);
    backdrop-filter: blur(10px) saturate(140%);
    -webkit-backdrop-filter: blur(10px) saturate(140%);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: var(--radius-lg);
    box-shadow: 
        0 4px 6px -1px rgba(0, 0, 0, 0.05),
        0 10px 15px -3px rgba(0, 0, 0, 0.03);
    overflow: hidden;
    transition: transform 0.3s var(--ease),
        box-shadow 0.3s var(--ease),
        border-color 0.3s var(--ease);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 
        0 20px 25px -5px rgba(0, 0, 0, 0.08),
        0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border-color: rgba(12, 122, 184, 0.4);
}

/* ================================================
   STUDIES
   ================================================ */
.study-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 2rem;
}

.study-card-content {
    padding: 2.25rem 2.25rem 2rem;
}

.study-card h3 {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.015em;
    color: var(--text-primary);
    margin-bottom: 0.35rem;
}

.study-meta {
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--fesb-blue);
    background: var(--fesb-blue-soft);
    padding: 0.3rem 0.7rem;
    border-radius: 50px;
    margin-bottom: 1rem;
}

.study-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
}

.course-list {
    list-style: none;
    margin-top: 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.course-item {
    display: block;
    padding: 0;
    background: var(--bg-alt);
    border-radius: var(--radius-sm);
    font-size: 0.92rem;
    color: var(--text-primary);
    border-left: 3px solid transparent;
    transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
    overflow: hidden;
}

.course-item:hover {
    border-left-color: var(--fesb-orange);
}

.course-toggle {
    width: 100%;
    padding: 1rem;
    background: none;
    border: none;
    text-align: left;
    display: block;
    cursor: pointer;
    font-family: inherit;
    color: inherit;
    transition: background 0.2s var(--ease);
}

.course-toggle:hover {
    background: var(--fesb-blue-soft);
}

.course-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    font-weight: 600;
}

.course-title-wrap {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.course-icon {
    font-size: 0.8rem;
    transition: transform 0.3s var(--ease);
    color: var(--fesb-orange);
    display: inline-block;
}

.course-item.active .course-icon {
    transform: rotate(90deg);
}

.course-description {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s var(--ease);
    background: rgba(0, 0, 0, 0.02);
}

[data-theme="dark"] .course-description {
    background: rgba(255, 255, 255, 0.03);
}

.course-item.active .course-description {
    max-height: 960px;
}

.course-facts,
.course-summary {
    margin: 0;
    padding: 0 1rem;
}

.course-facts {
    padding-top: 1rem;
    color: var(--fesb-blue);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.course-summary {
    padding-top: 0.45rem;
    padding-bottom: 1.15rem;
    color: var(--text-secondary);
    font-size: 0.88rem;
    line-height: 1.55;
}

.ects {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.03em;
    white-space: nowrap;
}

/* Erasmus coordinator — uses brand blue */
.erasmus-coordinator {
    max-width: 760px;
    margin: 3rem auto 0;
    background: rgba(232, 241, 249, 0.45);
    backdrop-filter: blur(8px) saturate(140%);
    -webkit-backdrop-filter: blur(8px) saturate(140%);
    border: 1px solid rgba(12, 122, 184, 0.2);
    border-left: 4px solid var(--fesb-blue);
    border-radius: var(--radius-md);
    padding: 1.5rem 2rem;
    transition: background-color var(--transition-speed) var(--ease);
}

.erasmus-coordinator-content {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.erasmus-coordinator-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.erasmus-coordinator-icon img {
    width: 44px;
    height: 44px;
    display: block;
}

.erasmus-coordinator-text h3 {
    color: var(--fesb-blue);
    margin-bottom: 0.25rem;
    font-size: 1.05rem;
    font-weight: 700;
}

.erasmus-coordinator-text p {
    margin: 0.15rem 0;
    color: var(--text-primary);
}

.erasmus-note {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.35rem !important;
}

/* ================================================
   PROJECTS
   ================================================ */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 2rem;
}

.project-carousel,
.course-carousel {
    position: relative;
    width: 100%;
    overflow: hidden;
    background: var(--bg-alt);
}

.project-carousel {
    height: 230px;
}

.course-carousel {
    height: 190px;
    margin: 0.4rem 1rem 1rem;
    border-radius: calc(var(--radius-sm) - 2px);
    background: var(--bg-alt);
}

.project-img,
.course-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.5s var(--ease);
}

.project-img {
    object-fit: cover;
}

.course-img {
    object-fit: contain;
    padding: 0.35rem;
}

.project-img.active,
.course-img.active {
    opacity: 1;
    z-index: 1;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(13, 27, 42, 0.55);
    backdrop-filter: blur(6px);
    color: #fff;
    border: none;
    font-size: 1.1rem;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.25s var(--ease), background 0.25s var(--ease);
}

.carousel-btn:hover {
    background: rgba(13, 27, 42, 0.85);
}

.project-carousel:hover .carousel-btn,
.course-carousel:hover .carousel-btn {
    opacity: 1;
}

.carousel-btn.prev {
    left: 10px;
}

.carousel-btn.next {
    right: 10px;
}

/* Carousel dot indicators */
.carousel-dots {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    z-index: 2;
}

.carousel-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    border: none;
    padding: 0;
    transition: background 0.2s var(--ease), transform 0.2s var(--ease);
}

.carousel-dot.active {
    background: #fff;
    transform: scale(1.25);
}

.project-info {
    padding: 1.5rem 1.75rem 1.75rem;
}

.project-info h3 {
    color: var(--text-primary);
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin-bottom: 0.5rem;
}

.project-info p {
    color: var(--text-secondary);
    font-size: 0.92rem;
    line-height: 1.6;
}

/* PDF chip row for research papers */
.pdf-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1.1rem;
}

/* Let tooltips escape the card; keep rounded corners on the cover image */
.card.project-card:has(.pdf-chips) {
    overflow: visible;
}
.card.project-card:has(.pdf-chips) .project-carousel {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.pdf-chip {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.4rem 0.8rem;
    border: 1px solid var(--fesb-blue);
    border-radius: 999px;
    background: color-mix(in srgb, var(--fesb-blue) 6%, transparent);
    color: var(--fesb-blue);
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.2s var(--ease), color 0.2s var(--ease), transform 0.2s var(--ease);
}

.pdf-chip:hover,
.pdf-chip:focus-visible {
    background: var(--fesb-blue);
    color: #fff;
    transform: translateY(-1px);
    outline: none;
}

.pdf-chip-icon {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
    stroke-width: 1.75;
}

.pdf-chip-label {
    line-height: 1;
}

/* Hover tooltip revealing the full paper title */
.pdf-chip::after {
    content: attr(data-full);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    transform: translateX(-50%) translateY(4px);
    background: #0d1b2a;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.4rem 0.65rem;
    border-radius: 6px;
    width: max-content;
    max-width: 220px;
    text-align: center;
    line-height: 1.35;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.18s var(--ease), transform 0.18s var(--ease);
    z-index: 3;
    box-shadow: 0 6px 20px rgba(13, 27, 42, 0.3);
}

.pdf-chip::before {
    content: "";
    position: absolute;
    left: 50%;
    bottom: calc(100% + 2px);
    transform: translateX(-50%) translateY(4px);
    border: 5px solid transparent;
    border-top-color: #0d1b2a;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.18s var(--ease), transform 0.18s var(--ease);
    z-index: 3;
}

.pdf-chip:hover::after,
.pdf-chip:focus-visible::after,
.pdf-chip:hover::before,
.pdf-chip:focus-visible::before {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ================================================
   RESEARCH PROJECTS
   ================================================ */
.research-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 0.5rem;
}

/* ================================================
   STAFF
   ================================================ */
.staff-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 1.75rem;
    justify-items: stretch;
}

.staff-member {
    grid-column: span 2;
}

/* Center the orphan row of 2 under 6-col layout (works when there are exactly 5 members) */
.staff-member:nth-child(4):nth-last-child(2) {
    grid-column: 2 / span 2;
}

.staff-member:nth-child(5):nth-last-child(1) {
    grid-column: 4 / span 2;
}

.staff-member {
    text-align: center;
    padding: 2rem 1.5rem;
}

.staff-member h3 {
    color: var(--text-primary);
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin: 0.75rem 0 0.25rem;
}

.staff-member p {
    color: var(--text-secondary);
    font-size: 0.88rem;
    margin: 0.1rem 0;
}

.staff-photo {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--bg-card);
    box-shadow: 0 6px 20px rgba(12, 122, 184, 0.18);
    transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.staff-photo:hover {
    transform: scale(1.06);
    box-shadow: 0 8px 28px rgba(12, 122, 184, 0.32);
}

/* ================================================
   PUBLICATIONS
   ================================================ */
.pub-container {
    max-width: 860px;
    margin: 0 auto;
    text-align: left;
}

.pub-year {
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    display: inline-block;
    margin: 2.5rem 0 1rem;
    padding-bottom: 0.35rem;
    border-bottom: 2px solid var(--fesb-orange);
}

.pub-item {
    background: rgba(255, 255, 255, 0.45);
    backdrop-filter: blur(8px) saturate(140%);
    -webkit-backdrop-filter: blur(8px) saturate(140%);
    padding: 1.4rem 1.6rem;
    border-radius: var(--radius-md);
    margin-bottom: 0.85rem;
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: var(--shadow-sm);
    transition: border-color 0.25s var(--ease),
        box-shadow 0.25s var(--ease),
        transform 0.25s var(--ease);
}

.pub-item:hover {
    border-color: var(--fesb-blue);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.pub-authors {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.93rem;
}

.pub-title {
    color: var(--fesb-blue);
    display: block;
    margin: 0.25rem 0;
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: -0.005em;
}

a.pub-title {
    text-decoration: none;
}

a.pub-title:hover {
    text-decoration: underline;
}

.pub-journal {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
}

.publications-more {
    display: none;
}

.publications-more.show {
    display: block;
}

.is-hidden {
    display: none !important;
}

/* ================================================
   CONTACT
   ================================================ */
.contact-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.contact-title {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.contact-header p {
    color: var(--text-secondary);
    margin: 0.15rem 0;
}

.contact-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    max-width: 800px;
    margin: 3rem auto 0;
    text-align: left;
    align-items: stretch;
}

.contact-info-col {
    position: relative;
    padding: 1.75rem;
    background: rgba(255, 255, 255, 0.45);
    backdrop-filter: blur(10px) saturate(140%);
    -webkit-backdrop-filter: blur(10px) saturate(140%);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: var(--radius-lg);
    box-shadow:
        0 4px 6px -1px rgba(0, 0, 0, 0.05),
        0 10px 15px -3px rgba(0, 0, 0, 0.03);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), border-color 0.3s var(--ease);
}

.contact-info-col::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 3px;
    background: var(--fesb-blue);
}

.contact-info-col:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(12, 122, 184, 0.18);
}

.contact-icon {
    width: 22px;
    height: 22px;
    color: var(--fesb-blue);
    margin-bottom: 0.75rem;
    display: block;
}

.contact-head {
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--fesb-blue);
    margin: 0 0 0.5rem !important;
}

.contact-name {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
    margin: 0 0 1rem !important;
}

.contact-email {
    margin: auto 0 0 !important;
    padding-top: 0.5rem;
}

@media (max-width: 768px) {
    .contact-info-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        margin-top: 2rem;
    }

    .ship-toggle-btn {
        display: none;
    }
}

.email-link {
    color: var(--fesb-blue);
    text-decoration: none;
    font-weight: 600;
    border-bottom: 1px dashed currentColor;
    transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
    overflow-wrap: anywhere;
}

.email-link:hover {
    color: var(--fesb-orange);
    border-bottom-style: solid;
}

.erasmus-coordinator-text .email-link {
    font-weight: 600;
    font-size: 0.95rem;
}

.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    max-width: 960px;
    margin: 0 auto;
}

.contact-media-border {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: border-color 0.3s var(--ease), box-shadow 0.3s var(--ease), transform 0.3s var(--ease);
    aspect-ratio: 4 / 3;
}

.contact-media-border:hover {
    border-color: var(--fesb-blue);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.contact-media-border img,
.contact-media-border iframe {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border: none;
}

/* ================================================
   FOOTER
   ================================================ */
footer {
    background: var(--bg-footer);
    color: rgba(255, 255, 255, 0.75);
    padding: 9rem 2rem 2rem;
    /* Was 5rem padding + 4rem margin */
    margin-top: 0;
    position: relative;
    z-index: 1;
}

.footer-inner {
    max-width: var(--container);
    margin: 0 auto;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
    gap: 3rem;
    padding-bottom: 3rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-col h4 {
    color: #fff;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 1rem;
}

.footer-col p,
.footer-col li {
    font-size: 0.9rem;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.65);
}

.footer-col ul {
    list-style: none;
}

.footer-col a {
    color: rgba(255, 255, 255, 0.65);
    text-decoration: none;
    transition: color 0.2s var(--ease);
}

.footer-col a:hover {
    color: var(--fesb-orange);
}

.footer-brand .footer-logo {
    height: 48px;
    margin-bottom: 1rem;
    filter: brightness(0) invert(1);
    opacity: 0.95;
}

.footer-tagline {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.75);
    line-height: 1.6;
}

.footer-base {
    max-width: var(--container);
    margin: 0 auto;
    padding-top: 2rem;
    text-align: center;
}

.footer-base p {
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 0.02em;
}

/* ================================================
   DARK THEME
   ================================================ */
[data-theme="dark"] {
    /* Deep Ocean palette — navy-black with vibrant brand accents */
    --fesb-blue: #5db4ff;
    --fesb-blue-dark: #3f95df;
    --fesb-blue-soft: rgba(93, 180, 255, 0.09);
    --fesb-orange: #ff8354;
    /* warm coral, reads well on navy */
    --fesb-orange-dark: #e86a3d;

    --text-primary: #e4eef8;
    /* cool white */
    --text-secondary: #8ca3bb;
    --text-muted: #56697e;

    --bg-main: #08131f;
    /* deep navy-black */
    --bg-alt: #0d1d2e;
    /* elevated surface */
    --bg-card: #112338;
    /* card surface */
    --bg-header: rgba(8, 19, 31, 0.88);
    --bg-footer: #0a0a0a;
    /* neutral abyss */

    --border-color: #1b3049;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 14px 36px rgba(0, 0, 0, 0.6);
}

[data-theme="dark"] header {
    background-color: rgba(8, 19, 31, 0.7);
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .card {
    background: rgba(17, 35, 56, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .contact-info-col {
    background: rgba(17, 35, 56, 0.6);
    border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .contact-info-col:hover {
    box-shadow: 0 10px 30px rgba(93, 180, 255, 0.22);
}

[data-theme="dark"] .erasmus-coordinator {
    background: rgba(93, 180, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .pub-item {
    background: rgba(17, 35, 56, 0.6);
    border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .logo-link img.logo-na {
    filter: invert(68%) sepia(55%) saturate(2800%) hue-rotate(188deg) brightness(102%) contrast(100%);
}

[data-theme="dark"] .logo-text {
    color: var(--text-primary);
}

[data-theme="dark"] .wave-bg svg path {
    fill: #112a44;
}

[data-theme="dark"] #hero {
    background:
        linear-gradient(135deg, rgba(4, 9, 15, 0.82), rgba(8, 19, 31, 0.68)),
        url('images/ui/hero-bg.webp') center/cover no-repeat;
}

[data-theme="dark"] .hero-social-link {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.35);
}

[data-theme="dark"] .hero-social-link:hover {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.55);
}

[data-theme="dark"] .staff-photo {
    border-color: var(--bg-card);
    box-shadow: 0 6px 20px rgba(93, 180, 255, 0.18);
}

[data-theme="dark"] .btn-primary,
[data-theme="dark"] .btn-show-more {
    box-shadow: 0 8px 24px rgba(255, 131, 84, 0.28);
}

/* ================================================
   MOBILE RESPONSIVENESS
   ================================================ */
@media (max-width: 960px) {
    .staff-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .staff-member,
    .staff-member:nth-child(4):nth-last-child(2),
    .staff-member:nth-child(5):nth-last-child(1) {
        grid-column: auto;
    }

    .footer-inner {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 2rem;
    }
}

@media (max-width: 900px), (max-height: 500px) {
    main>section {
        padding: 4rem 1.25rem;
    }

    .nav-container {
        padding: 0.75rem 1.25rem;
        gap: 0.75rem;
    }

    /* Hide desktop nav */
    nav#main-nav {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: var(--bg-header);
        backdrop-filter: saturate(180%) blur(12px);
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
        z-index: 1001;
        border-top: 1px solid var(--border-color);
        padding: 0.5rem 0;
        gap: 0;
    }

    nav#main-nav.show {
        display: flex;
    }

    nav#main-nav a {
        padding: 1rem 1.5rem;
        border-bottom: 1px solid var(--border-color);
        width: 100%;
    }

    nav#main-nav a.nav-cta {
        background: none;
        color: var(--fesb-blue);
        border-radius: 0;
    }

    nav#main-nav a.nav-cta:hover {
        background: var(--bg-alt);
        transform: none;
    }

    nav#main-nav a::after {
        display: none;
    }

    .mobile-toggle {
        display: flex;
        flex-direction: column;
        justify-content: space-around;
        width: 28px;
        height: 22px;
        background: transparent;
        border: none;
        cursor: pointer;
        padding: 0;
    }

    .mobile-toggle span {
        width: 28px;
        height: 2.5px;
        background: var(--text-primary);
        border-radius: 10px;
        transition: all 0.3s var(--ease);
    }

    /* Disable heavy animations on mobile */
    #ship-overlay,
    .bg-viewer {
        display: none !important;
    }

    /* Disable expensive backdrop filters on mobile for smooth scrolling */
    .card,
    .course-description,
    .pub-item,
    .contact-info-col,
    .erasmus-coordinator,
    header {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }

    /* Mobile Wave Styles: Static and in the background */
    .wave-sticky-anchor {
        position: sticky !important;
        bottom: 0 !important;
        width: 100% !important;
        height: 0 !important;
        z-index: -1 !important;
        display: block !important;
        pointer-events: none;
    }

    .wave-bg {
        position: absolute !important;
        bottom: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 250px !important; /* Smaller on mobile */
        display: block !important;
    }

    .wave-bg .wave1,
    .wave-bg .wave2,
    .wave-bg .wave3 {
        animation: none !important;
        display: block !important;
        transform: none !important;
        width: 100% !important;
    }

    .wave-bg .wave1 { opacity: 0.22 !important; }
    .wave-bg .wave2 { opacity: 0.16 !important; }
    .wave-bg .wave3 { opacity: 0.10 !important; }

    .card,
    .pub-item,
    .contact-info-col {
        background: rgba(255, 255, 255, 0.9) !important;
    }

    #hero {
        min-height: 70vh;
        padding: 6rem 1.25rem 4rem;
    }

    .hero-title-container {
        flex-direction: column;
        gap: 1.5rem;
        margin-bottom: 2rem;
    }

    .hero-logo {
        height: 80px;
    }

    #hero h1 {
        text-align: center;
    }

    .hero-branding {
        gap: 1.25rem;
        margin-bottom: 2.5rem;
    }

    .branding-logo {
        height: 36px;
    }

    .branding-sep {
        margin-top: -1rem;
        font-size: 0.65rem;
    }

    .branding-text {
        font-size: 0.6rem;
    }

    .hero-social {
        gap: 0.5rem;
        margin-bottom: 2rem;
    }

    .hero-social-label {
        flex-basis: 100%;
        text-align: center;
        font-size: 0.65rem;
        margin-right: 0;
        margin-bottom: 0.25rem;
    }

    .hero-social-link {
        font-size: 0.75rem;
        padding: 0.4rem 0.75rem;
    }

    .contact-grid {
        grid-template-columns: 1fr;
    }

    .staff-grid {
        grid-template-columns: 1fr;
        max-width: 380px;
        margin-left: auto;
        margin-right: auto;
    }

    .footer-inner {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: left;
    }
}

@media (max-width: 600px) {
    .logo-text {
        display: none;
    }

    .study-card-content {
        padding: 1.75rem 1.5rem 1.5rem;
    }

    .course-item {
        font-size: 0.88rem;
        padding: 0.7rem 0.85rem;
    }
}

/* ================================================
   FOCUS VISIBLE
   ================================================ */
:focus-visible {
    outline: 2px solid var(--fesb-blue);
    outline-offset: 3px;
    border-radius: 2px;
}

.btn-primary:focus-visible,
nav#main-nav a.nav-cta:focus-visible,
.btn-show-more:focus-visible {
    outline-offset: 4px;
}

.carousel-btn:focus-visible {
    opacity: 1;
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.carousel-dot:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 3px;
}

/* ================================================
   TOUCH DEVICES — neutralize sticky hover states
   ================================================ */
@media (hover: none) {
    /* Reveal carousel arrows on touch (no hover to trigger them) */
    .carousel-btn {
        opacity: 1;
    }

    /* Kill translateY hover lifts so taps don't leave elements floating */
    .card:hover,
    .btn-primary:hover,
    .btn-show-more:hover,
    .pub-item:hover,
    .contact-media-border:hover,
    .staff-photo:hover,
    nav#main-nav a.nav-cta:hover {
        transform: none;
    }
}

/* ================================================
   REDUCED MOTION
   ================================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }

    html {
        scroll-behavior: auto;
    }

    .bg-viewer,
    #ship-overlay {
        display: none !important;
    }

    .wave-bg .wave1,
    .wave-bg .wave2,
    .wave-bg .wave3 {
        animation: none !important;
    }
}
