/* =========================================================================
   Molecular Programming Group — design system
   Type: Familjen Grotesk (headings) + Spectral (body) + JetBrains Mono (code)
   ========================================================================= */

:root {
    /* palette: white canvas, off-white surfaces, near-black ink, sky/baby-blue
       primary, amber emphasis. Body/link text verified >= 4.5:1 on white. */
    --bg:            #ffffff;
    --surface:       #f5f7fa;
    --surface-2:     #eaeef3;
    --ink:           oklch(0.24 0.021 264);
    --ink-soft:      oklch(0.42 0.018 264);
    --muted:         oklch(0.53 0.014 264);
    --line:          #e2e7ee;
    --line-strong:   #cfd6e0;

    --primary:       #1a72c2;   /* sky blue, passes 4.5:1 on white for links */
    --primary-strong:#12558f;   /* hover / darker */
    --primary-bright:#3f9be0;   /* baby-blue, large text only (hero accent) */
    --primary-tint:  #e4f0fb;   /* light baby-blue fill for tags / hovers */

    --accent:        oklch(0.56 0.16 40);
    --accent-strong: oklch(0.47 0.15 38);
    --accent-tint:   oklch(0.955 0.028 55);

    --radius:   10px;
    --radius-sm: 6px;
    --maxw:     1280px;
    --gutter:   clamp(1rem, 3vw, 2.5rem);

    --step--1: clamp(0.82rem, 0.79rem + 0.15vw, 0.9rem);
    --step-0:  clamp(1rem, 0.96rem + 0.2vw, 1.12rem);
    --step-1:  clamp(1.2rem, 1.12rem + 0.4vw, 1.45rem);
    --step-2:  clamp(1.5rem, 1.36rem + 0.7vw, 2rem);
    --step-3:  clamp(1.9rem, 1.66rem + 1.2vw, 2.85rem);
    --step-4:  clamp(2.4rem, 2rem + 2vw, 3.8rem);

    /* z-index scale */
    --z-dropdown: 100;
    --z-sticky:   200;

    --font-head: "Familjen Grotesk", system-ui, sans-serif;
    --font-body: "Spectral", Georgia, serif;
    --font-mono: "JetBrains Mono", ui-monospace, monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: var(--step-0);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

img { max-width: 100%; height: auto; display: block; }

h1, h2, h3, h4, h5 {
    font-family: var(--font-head);
    font-weight: 600;
    line-height: 1.1;
    color: var(--ink);
    margin: 0 0 0.5em;
    letter-spacing: -0.02em;
    text-wrap: balance;
}
h1 { font-size: var(--step-4); }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-2); }
h4 { font-size: var(--step-1); font-weight: 600; }
p  { margin: 0 0 1rem; text-wrap: pretty; }

a { color: var(--primary); text-decoration: none; text-underline-offset: 2px; }
a:hover { color: var(--primary-strong); text-decoration: underline; }

/* legacy inline tags carried in extracted content */
inv { font-family: var(--font-head); font-weight: 600; font-size: 0.95em; color: var(--primary); }
a inv { color: inherit; }
a:hover inv { text-decoration: underline; }
u { text-decoration: none; }
u a { text-decoration: underline; text-underline-offset: 2px; }

hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }

code, .mono { font-family: var(--font-mono); font-size: 0.9em; }

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

/* ------------------------------------------------------------------ header */
.masthead {
    position: sticky; top: 0; z-index: var(--z-sticky);
    background: color-mix(in oklab, var(--surface) 88%, transparent);
    backdrop-filter: saturate(1.4) blur(10px);
    border-bottom: 1px solid var(--line);
}
.masthead__bar {
    display: flex; align-items: center; gap: 1.25rem;
    max-width: var(--maxw); margin: 0 auto;
    padding: 0.7rem var(--gutter);
}
.brand { display: flex; align-items: center; gap: 0.6rem; flex-shrink: 0; }
.brand__mark { width: 34px; height: 34px; border-radius: 8px; background: var(--primary-tint);
    display: grid; place-items: center; overflow: hidden; }
.brand__mark img { width: 26px; height: 26px; }
.brand__name {
    font-family: var(--font-head); font-weight: 700; font-size: 1.02rem;
    letter-spacing: -0.02em; color: var(--ink); line-height: 1.1;
}
.brand__name span { display: block; font-weight: 500; font-size: 0.72rem; color: var(--muted);
    letter-spacing: 0.01em; }

/* nav */
.nav { margin-left: auto; }
.nav__list { list-style: none; display: flex; align-items: center; gap: 0.15rem; margin: 0; padding: 0; }
.nav__item { position: relative; }
.nav__link {
    display: inline-block; padding: 0.45rem 0.7rem; border-radius: var(--radius-sm);
    font-family: var(--font-head); font-weight: 500; font-size: 0.95rem;
    color: var(--ink-soft); white-space: nowrap;
}
.nav__link:hover, .nav__item:hover > .nav__link { color: var(--ink); background: var(--surface-2); text-decoration: none; }
.nav__link.is-active { color: var(--primary); }
.nav__link.is-active::after {
    content: ""; display: block; height: 2px; border-radius: 2px;
    background: var(--primary); margin-top: 3px;
}

.nav__dd {
    position: absolute; top: calc(100% + 6px); left: 0; min-width: 288px;
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: 0 14px 40px -12px oklch(0.3 0.05 264 / 0.35);
    padding: 0.4rem; opacity: 0; visibility: hidden; transform: translateY(-4px);
    transition: opacity .16s ease, transform .16s ease, visibility .16s;
    z-index: var(--z-dropdown);
}
.nav__item:hover > .nav__dd, .nav__item:focus-within > .nav__dd {
    opacity: 1; visibility: visible; transform: translateY(0);
}
.nav__dd a {
    display: block; padding: 0.5rem 0.7rem; border-radius: var(--radius-sm);
    font-family: var(--font-head); font-size: 0.9rem; color: var(--ink-soft); line-height: 1.35;
}
.nav__dd a:hover { background: var(--primary-tint); color: var(--primary-strong); text-decoration: none; }

.lang { display: inline-flex; gap: 0.35rem; margin-left: 0.5rem; padding-left: 0.75rem;
    border-left: 1px solid var(--line); font-family: var(--font-head); font-size: 0.85rem; }
.lang a { color: var(--muted); padding: 0.2rem 0.35rem; border-radius: 4px; }
.lang a.is-active { color: var(--ink); background: var(--surface-2); }

/* mobile nav toggle */
.nav__toggle { display: none; margin-left: auto; background: none; border: 1px solid var(--line);
    border-radius: var(--radius-sm); padding: 0.5rem 0.65rem; cursor: pointer; color: var(--ink); }

/* --------------------------------------------------------------- page head */
.pagehead { padding: clamp(2rem, 5vw, 4rem) 0 clamp(1.2rem, 3vw, 2rem); }
.pagehead__eyebrow { font-family: var(--font-head); font-weight: 600; color: var(--primary);
    font-size: 0.9rem; letter-spacing: 0.02em; margin-bottom: 0.4rem; }
.pagehead h1 { margin: 0; }
.pagehead__lead { color: var(--ink-soft); font-size: var(--step-1); max-width: 65ch; margin-top: 0.6rem; }

/* home hero */
.hero { padding: clamp(2.5rem, 6vw, 5rem) 0 clamp(1.5rem, 4vw, 3rem); }
.hero__title { font-size: var(--step-4); max-width: 20ch; }
.hero__title em { color: var(--primary-bright); font-style: normal; }
.hero__lead { font-size: var(--step-1); color: var(--ink-soft); max-width: 62ch; margin-top: 1rem; }

/* ------------------------------------------------------------------ layout */
main { display: block; }
section { scroll-margin-top: 84px; }

.split {
    display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    gap: clamp(1.5rem, 4vw, 3.5rem); align-items: start;
    padding-bottom: 4rem;
}
.split--news { grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); }
@media (max-width: 900px) { .split, .split--news { grid-template-columns: 1fr; } }

.panel-title {
    font-family: var(--font-head); font-size: 0.82rem; font-weight: 600; letter-spacing: 0.09em;
    text-transform: uppercase; color: var(--muted); margin-bottom: 1rem;
    padding-bottom: 0.5rem; border-bottom: 1px solid var(--line);
}

/* prose blocks carried from extracted content */
.prose { color: var(--ink); }
.prose :where(p, ul, ol) { max-width: 72ch; }
.prose img { border-radius: var(--radius-sm); margin: 1rem 0; }
.prose h3 { margin-top: 2rem; }
.prose h4 { margin-top: 1.5rem; color: var(--ink); }
.prose ul, .prose ol { padding-left: 1.3rem; }
.prose li { margin-bottom: 0.4rem; }
.prose hr { margin: 2.5rem 0; }

/* ------------------------------------------------------------------- news */
.newsfeed { max-height: none; }
.news-item { padding: 1.5rem 0; border-bottom: 1px solid var(--line); }
.news-item:first-child { padding-top: 0; }
.news-item__date { font-family: var(--font-head); font-size: 0.8rem; font-weight: 600;
    letter-spacing: 0.04em; text-transform: uppercase; color: var(--accent-strong); }
.news-item__title { font-size: var(--step-1); margin: 0.3rem 0 0.75rem; }
.news-item img { border-radius: var(--radius-sm); margin: 0.75rem 0; width: 100%; }
.news-item p { color: var(--ink-soft); }
.news-item a { font-family: var(--font-head); font-weight: 500; }

/* about column cards */
.info-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: clamp(1.2rem, 3vw, 2rem); }
.info-card + .info-card { margin-top: 1.25rem; }

/* --------------------------------------------------------------- people */
.people-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: clamp(1rem, 2.5vw, 1.6rem);
}
.person {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 1.1rem; transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}
.person:hover { border-color: var(--line-strong); box-shadow: 0 10px 30px -18px oklch(0.3 0.05 264 / 0.5);
    transform: translateY(-2px); }
@media (prefers-reduced-motion: reduce) { .person:hover { transform: none; } }
.person img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 50%; margin-bottom: 0.9rem; }
.person__name { font-family: var(--font-head); font-weight: 700; font-size: 1.02rem; }
.person__role { font-family: var(--font-head); font-size: 0.85rem; color: var(--primary); margin: 0.15rem 0 0.6rem; }
.person__details { font-size: 0.85rem; color: var(--ink-soft); line-height: 1.5; }
.person__details a { word-break: break-word; }

.group-photo { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.group-photo figcaption { font-size: 0.85rem; color: var(--muted); text-align: center; padding: 0.6rem 0.8rem; font-style: italic; }

.alumni-list { list-style: none; padding: 0; margin: 0; columns: 2; column-gap: 2rem; }
@media (max-width: 640px) { .alumni-list { columns: 1; } }
.alumni-list li { break-inside: avoid; margin-bottom: 0.7rem; font-size: 0.9rem; color: var(--ink-soft); }
.alumni-list b { color: var(--ink); font-family: var(--font-head); font-weight: 600; }

/* gallery */
.gallery { position: relative; border-radius: var(--radius); overflow: hidden;
    background: var(--surface-2); border: 1px solid var(--line); }
.gallery__slide { display: none; }
.gallery__slide.is-active { display: block; }
.gallery__slide img { width: 100%; aspect-ratio: 4/3; object-fit: cover; }
.gallery__cap { padding: 0.85rem 1rem; font-size: 0.88rem; color: var(--ink-soft); min-height: 3.2em; }
.gallery__btn { position: absolute; top: 40%; transform: translateY(-50%);
    background: color-mix(in oklab, var(--ink) 55%, transparent); color: white; border: 0;
    width: 40px; height: 40px; border-radius: 50%; cursor: pointer; font-size: 1.1rem; display: grid; place-items: center; }
.gallery__btn:hover { background: var(--ink); }
.gallery__btn--prev { left: 0.6rem; } .gallery__btn--next { right: 0.6rem; }

/* ------------------------------------------------------------ theme cards */
.theme-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.1rem; margin: 1.5rem 0 3rem; }
.theme-card {
    display: flex; flex-direction: column; background: var(--surface);
    border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem;
    color: var(--ink); transition: border-color .2s, box-shadow .2s, transform .2s;
}
.theme-card:hover { border-color: var(--primary); text-decoration: none; transform: translateY(-3px);
    box-shadow: 0 14px 34px -20px oklch(0.4 0.12 274 / 0.6); }
@media (prefers-reduced-motion: reduce) { .theme-card:hover { transform: none; } }
.theme-card h3 { font-size: var(--step-1); margin-bottom: 0.5rem; }
.theme-card p { color: var(--ink-soft); font-size: 0.95rem; margin-bottom: 1rem; }
.tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: auto; }
.tag { font-family: var(--font-head); font-size: 0.72rem; font-weight: 500; padding: 0.2rem 0.55rem;
    border-radius: 999px; background: var(--primary-tint); color: var(--primary-strong); }

/* research / collaboration sections */
.article-section { padding: 2.5rem 0; border-top: 1px solid var(--line); }
.article-section > h2 { font-size: var(--step-2); margin-bottom: 1.2rem; }
.flex-container { display: flex; flex-wrap: wrap; gap: 1.5rem; align-items: flex-start; margin: 1.5rem 0; }
.flex-container > div { flex: 1 1 320px; max-width: 100%; }
.flex-container iframe { width: 100%; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.collaboration-block { display: grid; grid-template-columns: 1fr 1.4fr; gap: 2rem; align-items: start; }
@media (max-width: 800px) { .collaboration-block { grid-template-columns: 1fr; } }
.collaboration-images img { margin-bottom: 1rem; border-radius: var(--radius-sm); }
.collaboration-links { margin: 1rem 0 0 1.2rem; }

/* --------------------------------------------------------- publications */
.pub { padding: 2rem 0; border-bottom: 1px solid var(--line); }
.pub::after { content: ""; display: block; clear: both; }
.pub__heading { font-family: var(--font-head); font-weight: 700; font-size: 1.05rem;
    letter-spacing: 0.01em; margin-bottom: 0.8rem; color: var(--ink); }
.pub img { border-radius: var(--radius-sm); margin: 0.3rem 1.4rem 0.8rem 0; max-width: min(46%, 420px);
    float: left; }
.pub img + img { margin-right: 0; }
.pub p, .pub { color: var(--ink-soft); }
@media (max-width: 640px) { .pub img { float: none; max-width: 100%; margin: 0 0 1rem; } }

/* ------------------------------------------------------------- positions */
.recruiting { color: var(--accent-strong); font-family: var(--font-head); font-weight: 600; }
.badge { display: inline-block; font-family: var(--font-head); font-size: 0.75rem; font-weight: 600;
    background: var(--accent-tint); color: var(--accent-strong); padding: 0.25rem 0.6rem; border-radius: 999px; }

/* ---------------------------------------------------------------- software */
.software details { background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 1rem 1.2rem; margin-bottom: 0.9rem; }
.software details[open] { border-color: var(--line-strong); }
.software summary { cursor: pointer; list-style: none; }
.software summary::-webkit-details-marker { display: none; }
.software summary h3 { display: inline; font-size: 1.05rem; }
.software summary::before { content: "＋"; color: var(--primary); font-family: var(--font-mono); margin-right: 0.5rem; }
.software details[open] summary::before { content: "－"; }
.copy-container { display: flex; align-items: center; gap: 0.6rem; margin: 0.8rem 0; }
.copy-container p { margin: 0; }
.copy-container code { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
    padding: 0.3rem 0.6rem; color: var(--ink); }
.copy-button { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
    cursor: pointer; font-size: 0.95rem; padding: 0.25rem 0.55rem; color: var(--ink); }
.copy-button:hover { background: var(--primary-tint); }
.software img { display: inline-block; vertical-align: middle; }

/* ---------------------------------------------------------------- contact */
.contact-grid { display: grid; grid-template-columns: 1fr 1.4fr; gap: 2rem; align-items: start; padding-bottom: 4rem; }
@media (max-width: 800px) { .contact-grid { grid-template-columns: 1fr; } }
.contact-grid iframe { width: 100%; height: 460px; border: 1px solid var(--line); border-radius: var(--radius); }

/* ------------------------------------------------------------------ footer */
.site-footer { border-top: 1px solid var(--line); margin-top: 3rem; padding: 2rem 0 3rem;
    color: var(--muted); font-family: var(--font-head); font-size: 0.9rem; }
.site-footer__bar { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; align-items: center; justify-content: space-between; }
.site-footer a { color: var(--ink-soft); }

/* ------------------------------------------------------------- responsive */
@media (max-width: 920px) {
    .nav { position: fixed; inset: 62px 0 auto 0; background: var(--surface);
        border-bottom: 1px solid var(--line); box-shadow: 0 20px 40px -24px oklch(0.3 0.05 264 / 0.5);
        max-height: calc(100dvh - 62px); overflow-y: auto; padding: 0.5rem var(--gutter) 1.25rem;
        display: none; }
    .nav.is-open { display: block; }
    .nav__list { flex-direction: column; align-items: stretch; gap: 0.1rem; }
    .nav__link { padding: 0.7rem 0.4rem; font-size: 1rem; }
    .nav__dd { position: static; opacity: 1; visibility: visible; transform: none; box-shadow: none;
        border: 0; border-left: 2px solid var(--line); border-radius: 0; margin: 0 0 0.4rem 0.8rem; padding-left: 0.4rem; }
    .nav__link.is-active::after { display: none; }
    .lang { border-left: 0; padding-left: 0.4rem; margin: 0.5rem 0 0; }
    .nav__toggle { display: inline-block; }
}

/* --------------------------- legacy content classes (carried from old HTML) */
hlink { font-family: var(--font-head); font-weight: 600; color: var(--primary); }
.prose .row { display: flex; flex-direction: column; gap: 1.25rem; margin-top: 2rem; }
.prose .column { background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); padding: clamp(1.25rem, 2.5vw, 1.75rem); }
.prose .column h3 { font-size: var(--step-1); }
.prose .column br { display: none; }
/* funder / institution logos: larger, tidy, wrap onto a row */
.prose .column img { max-height: 88px; width: auto; display: inline-block;
    vertical-align: middle; margin: 0.6rem 1.1rem 0.6rem 0; }
.prose .column img[alt="dm_scheme"] { max-height: 120px; }

/* the "molecular programming" wide scheme image sits full width */
.prose > img, .prose article > img { width: 100%; border-radius: var(--radius-sm); margin: 1.25rem 0; }

/* embedded videos / maps in prose (teaching, contact) */
.prose iframe { max-width: 100%; border: 1px solid var(--line); border-radius: var(--radius-sm); margin: 1rem 0; }
.teaching iframe[src*="youtube"] { width: 100%; aspect-ratio: 16 / 9; height: auto; }
.teaching section { padding: 2rem 0; border-top: 1px solid var(--line); }
.teaching section:first-child { border-top: 0; }
.teaching li { list-style: none; font-family: var(--font-head); font-size: 0.95rem; margin: 0.4rem 0; }
.teaching li a::before { content: "→ "; color: var(--primary); }

/* small floated icon used in a couple of intro paragraphs */
.prose img[alt="DNA Chip"], .prose img[alt="Computer Animation"] {
    float: left; width: 56px; height: auto; margin: 0.2rem 1rem 0.4rem 0; border-radius: var(--radius-sm); }

/* inline email "@" icon and other tiny inline glyph-images in person cards */
.person__details img { width: 14px; height: 14px; display: inline; vertical-align: -2px; margin: 0 1px; border-radius: 0; }

/* --------------------------------------------- home pixel-art hero banner */
.hero-banner {
    position: relative;
    height: clamp(190px, 30vw, 380px);
    margin-top: 1.25rem;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    overflow: hidden;
    background-image: url(/static/images/pixelbanner_scroll.png);
    background-repeat: no-repeat;
    background-size: 100% auto;         /* full width; taller than frame -> pans */
    background-position: center 0%;
    box-shadow: 0 18px 40px -24px oklch(0.3 0.05 264 / 0.45);
    will-change: background-position;
}
/* soft inner edge so the framed art sits into the page rather than floating */
.hero-banner::after {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    box-shadow: inset 0 0 0 1px oklch(1 0 0 / 0.25);
    border-radius: inherit;
}
@media (prefers-reduced-motion: reduce) {
    .hero-banner { background-position: center 40%; }
}
