/* ============================================================
   FFWD Institute — Stylesheet
   Fonts: IBM Plex Serif (headings/editorial) · IBM Plex Sans (body/UI)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Serif:ital,wght@0,400;0,600;1,400&family=IBM+Plex+Sans:wght@300;400;500&display=swap');

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --blue:        #1E3A5F;
    --blue-dark:   #152B47;
    --teal:        #2F7F7A;
    --bright-blue: #2D6CDF;
    --charcoal:    #1F1F1F;
    --body-text:   #2A2A2A;
    --muted:       #5A5A5A;
    --light-grey:  #E3E5E8;
    --off-white:   #F5F6F7;
    --card-bg:     #FFFFFF;
    --rule:        #E3E5E8;

    /* Layout widths */
    --width-reading: 680px;
    --width-layout:  980px;
}

html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

body {
    font-family: 'IBM Plex Sans', system-ui, sans-serif;
    font-size: 17px;
    line-height: 1.7;
    background-color: var(--off-white);
    color: var(--body-text);
    -webkit-font-smoothing: antialiased;
}

/* ── Typography ───────────────────────────────────────────── */
h1, h2, h3, h4 {
    font-family: 'IBM Plex Serif', Georgia, serif;
    font-weight: 600;
    line-height: 1.2;
    color: var(--charcoal);
}

h1 { font-size: clamp(2.2rem, 5vw, 3.25rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.1rem); margin-bottom: 0.9rem; }
h3 { font-size: 1.2rem; margin-bottom: 0.4rem; }

p { margin-bottom: 1.25rem; max-width: 68ch; }
p:last-child { margin-bottom: 0; }

/* Links — blue only, teal reserved for structural accents */
a { color: var(--bright-blue); text-decoration: underline; text-decoration-color: rgba(45,108,223,0.3); text-underline-offset: 3px; transition: text-decoration-color 0.15s; }
a:hover { text-decoration-color: var(--bright-blue); }
a:focus-visible { outline: 2px solid var(--bright-blue); outline-offset: 3px; border-radius: 2px; }

/* ── Layout ───────────────────────────────────────────────── */
.site-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Reading container — for text-heavy content */
.container {
    max-width: var(--width-reading);
    margin: 0 auto;
    padding: 0 2rem;
    width: 100%;
}

/* Layout container — for grids, cards, wider content */
.container-wide {
    max-width: var(--width-layout);
    margin: 0 auto;
    padding: 0 2rem;
    width: 100%;
}

main { flex: 1; }

/* ── Navbar ───────────────────────────────────────────────── */
.site-nav {
    background-color: var(--blue);
    border-bottom: 2px solid var(--teal);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: var(--width-layout);
    margin: 0 auto;
    padding: 0 2rem;
    height: 60px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: #FFFFFF;
    text-decoration: none;
    flex-shrink: 0;
}

.nav-brand:hover { text-decoration: none; color: white; }
.nav-brand:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; border-radius: 2px; }

.nav-mark {
    width: 18px;
    height: 14px;
    flex-shrink: 0;
    opacity: 0.9;
}

.nav-brand-text {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 500;
    font-size: 0.95rem;
    letter-spacing: 0.02em;
}

.nav-brand-text span {
    font-weight: 300;
    opacity: 0.65;
    letter-spacing: 0.01em;
}

.nav-links {
    display: flex;
    gap: 2rem;
    list-style: none;
}

.nav-links a {
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 0.78rem;
    font-weight: 400;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    padding-bottom: 3px;
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
    color: #FFFFFF;
    border-bottom-color: var(--teal);
}

.nav-links a:focus-visible {
    outline: 2px solid var(--teal);
    outline-offset: 4px;
    border-radius: 2px;
}

/* Mobile nav toggle */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0.25rem;
}

.nav-toggle:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; }

.nav-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: white;
    margin: 5px 0;
    transition: 0.3s;
}

@media (max-width: 640px) {
    .nav-toggle { display: block; }
    .nav-links {
        display: none;
        position: absolute;
        top: 60px;
        left: 0;
        right: 0;
        background: var(--blue-dark);
        flex-direction: column;
        gap: 0;
        padding: 0.5rem 2rem 1rem;
    }
    .nav-links.open { display: flex; }
    .nav-links a { padding: 0.75rem 0; border-bottom: 1px solid rgba(255,255,255,0.1); letter-spacing: 0.06em; }
    .nav-links a:last-child { border-bottom: none; }
}

/* ── Page Hero ────────────────────────────────────────────── */
.page-hero {
    background-color: var(--blue);
    color: white;
    padding: 4.5rem 0 4rem;
    border-bottom: 2px solid var(--teal);
}

.page-hero .container,
.page-hero .container-wide { position: relative; }

.hero-label-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1.1rem;
}

.hero-mark {
    width: 20px;
    height: 16px;
    color: var(--teal);
    flex-shrink: 0;
}

.hero-label {
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--teal);
}

.page-hero h1 {
    color: white;
    margin-bottom: 1.4rem;
    max-width: 18ch;
}

.page-hero .lead {
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 1.05rem;
    font-weight: 300;
    line-height: 1.7;
    color: rgba(255,255,255,0.78);
    max-width: 52ch;
}

/* ── Sections ─────────────────────────────────────────────── */
.section {
    padding: 4rem 0;
    background: var(--card-bg);
}

.section-alt {
    background: var(--off-white);
}

.section + .section {
    border-top: 1px solid var(--rule);
}

/* Section label — one of two places uppercase is used (nav is the other) */
.section-label {
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 0.65rem;
    font-weight: 500;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--teal);
    margin-bottom: 0.6rem;
    display: block;
}

/* ── Focus Area Grid ──────────────────────────────────────── */
/* Uses wide container — three columns benefit from more room */
.focus-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1px;
    margin-top: 2.5rem;
    background: var(--rule);
    border: 1px solid var(--rule);
}

.focus-card {
    background: var(--card-bg);
    padding: 1.75rem;
    border-top: 3px solid var(--bright-blue);
    margin-top: -1px;
}

.focus-card h3 {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--charcoal);
    margin-bottom: 0.5rem;
    letter-spacing: 0.01em;
}

.focus-card p {
    font-size: 0.875rem;
    color: var(--muted);
    line-height: 1.65;
    margin-bottom: 0;
    max-width: none;
}

/* ── Publications / Research List ────────────────────────── */
/* Bibliographic styling — more document-like than card-like */
.research-item {
    padding: 1.75rem 0;
    border-bottom: 1px solid var(--rule);
}

.research-item:first-child { border-top: 1px solid var(--rule); }

.research-type {
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--teal);
    margin-bottom: 0.35rem;
}

.research-item h3 {
    font-size: 1.05rem;
    margin-bottom: 0.4rem;
    line-height: 1.35;
}

.research-meta {
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 0.83rem;
    color: var(--muted);
    margin-bottom: 0.85rem;
    font-style: italic;
}

.research-meta a { color: var(--muted); font-size: 0.83rem; font-style: normal; }

.btn-abstract {
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 0.8rem;
    font-weight: 400;
    background: none;
    border: 1px solid var(--rule);
    color: var(--bright-blue);
    padding: 0.35rem 0.9rem;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    text-decoration: none;
}

.btn-abstract:hover {
    border-color: var(--bright-blue);
    background: rgba(45,108,223,0.05);
}

.btn-abstract:focus-visible {
    outline: 2px solid var(--bright-blue);
    outline-offset: 2px;
}

/* ── Projects ─────────────────────────────────────────────── */
/* More substantial, report-like feel */
.project-card {
    background: var(--card-bg);
    border: 1px solid var(--rule);
    border-left: 4px solid var(--teal);
    padding: 2rem 2rem 2rem 1.75rem;
    margin-bottom: 1.5rem;
}

.project-card + .project-card { margin-top: 0; }

/* Status as a plain label, not a badge */
.project-status {
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--teal);
    margin-bottom: 0.6rem;
    display: block;
}

.project-card h3 {
    font-size: 1.3rem;
    margin-bottom: 0.6rem;
    line-height: 1.25;
}

.project-card p { font-size: 0.95rem; color: var(--muted); line-height: 1.7; }

.project-partners {
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 0.8rem;
    color: var(--muted);
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--rule);
    margin-bottom: 0;
}

/* ── People ───────────────────────────────────────────────── */
.person-card {
    display: flex;
    gap: 1.5rem;
    padding: 2rem 0;
    border-bottom: 1px solid var(--rule);
    align-items: flex-start;
}

.person-card:first-child { border-top: 1px solid var(--rule); }

.person-initials {
    width: 48px;
    height: 48px;
    background: var(--blue);
    color: white;
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 400;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.person-info h3 {
    font-size: 1.05rem;
    margin-bottom: 0.15rem;
}

/* Person role — descriptive, not badged or uppercased */
.person-role {
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 0.83rem;
    color: var(--teal);
    font-weight: 400;
    margin-bottom: 0.35rem;
}

.person-affiliation {
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 0.83rem;
    color: var(--muted);
    margin-bottom: 0.5rem;
    font-style: italic;
}

.person-info p {
    font-size: 0.9rem;
    color: var(--muted);
    line-height: 1.65;
    margin-bottom: 0;
}

/* ── Network Model Box ────────────────────────────────────── */
.network-model {
    background: var(--blue);
    color: white;
    padding: 2.75rem;
    margin-top: 3rem;
    border-left: 4px solid var(--teal);
}

.network-model h3 {
    font-family: 'IBM Plex Serif', serif;
    color: white;
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

.network-model p {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 300;
    color: rgba(255,255,255,0.8);
    font-size: 0.95rem;
    line-height: 1.7;
    margin-bottom: 1rem;
    max-width: 58ch;
}

.network-model a { color: rgba(255,255,255,0.85); text-decoration: underline; text-decoration-color: rgba(255,255,255,0.35); text-underline-offset: 3px; }
.network-model a:hover { text-decoration-color: white; color: white; }
.network-model a:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; border-radius: 2px; }

/* ── Contact ──────────────────────────────────────────────── */
.contact-block {
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 0.95rem;
    line-height: 2;
    color: var(--body-text);
}

.contact-block a { font-size: 0.95rem; }



/* ── Empty State ──────────────────────────────────────────── */
.empty-state {
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 0.9rem;
    color: var(--muted);
    font-style: italic;
    padding: 2rem 0;
}

/* ── Footer ───────────────────────────────────────────────── */
.site-footer {
    background-color: var(--blue-dark);
    color: rgba(255,255,255,0.35);
    text-align: center;
    padding: 2rem 0;
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    margin-top: auto;
}

.footer-mark {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
    color: rgba(255,255,255,0.5);
}

.footer-mark svg {
    width: 14px;
    height: 11px;
    flex-shrink: 0;
}

.footer-mark-text {
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.footer-mark-text span { font-weight: 300; opacity: 0.7; }

.site-footer a { color: rgba(255,255,255,0.35); }
.site-footer a:hover { color: white; }

/* ── Modal — custom, no Bootstrap dependency ─────────────── */
#abstractModal {
    position: fixed;
    inset: 0;
    z-index: 200;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(20, 43, 71, 0.65);
}

.modal-dialog {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: calc(100% - 2rem);
    max-width: 640px;
    max-height: 85vh;
    background: var(--card-bg);
    display: flex;
    flex-direction: column;
    border-top: 3px solid var(--teal);
    box-shadow: 0 8px 40px rgba(0,0,0,0.25);
}

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.25rem;
    padding: 1.5rem 1.75rem 1.25rem;
    border-bottom: 1px solid var(--rule);
    flex-shrink: 0;
}

.modal-title {
    font-family: 'IBM Plex Serif', serif;
    font-size: 1rem;
    font-weight: 600;
    color: var(--charcoal);
    line-height: 1.35;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--muted);
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    transition: color 0.15s;
}

.modal-close:hover { color: var(--charcoal); }
.modal-close:focus-visible { outline: 2px solid var(--bright-blue); outline-offset: 2px; border-radius: 2px; }

.modal-body {
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 0.9rem;
    line-height: 1.8;
    color: var(--body-text);
    padding: 1.5rem 1.75rem;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 1rem 1.75rem;
    border-top: 1px solid var(--rule);
    display: flex;
    justify-content: flex-end;
    flex-shrink: 0;
}

/* On mobile, sheet slides up from bottom instead of centering */
@media (max-width: 680px) {
    .modal-dialog {
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        transform: none;
        width: 100%;
        max-width: 100%;
        max-height: 80vh;
    }
}