/* Dark editorial theme with a light theme */
:root {
    --bg: #0c0e13;
    --bg-raised: #141821;
    --line: #232a36;
    --text: #e8eaef;
    --muted: #8b93a3;
    --accent: #c8f560;
    --accent-ink: #0c0e13;
    --accent-2: #7aa2ff;
    --radius: 14px;
    --mono: "JetBrains Mono", ui-monospace, monospace;
    --sans: "Inter", system-ui, sans-serif;
    --display: "Space Grotesk", var(--sans);
}

/* Light theme: the device setting, unless the visitor picked a theme with the nav button */
@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) {
        --bg: #f6f5f1;
        --bg-raised: #ffffff;
        --line: #e2e0d8;
        --text: #15171c;
        --muted: #5d6370;
        --accent: #3d5afe;
        --accent-ink: #ffffff;
        --accent-2: #3d5afe;
    }
}
:root[data-theme="light"] {
    --bg: #f6f5f1;
    --bg-raised: #ffffff;
    --line: #e2e0d8;
    --text: #15171c;
    --muted: #5d6370;
    --accent: #3d5afe;
    --accent-ink: #ffffff;
    --accent-2: #3d5afe;
}

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

html { scroll-behavior: smooth; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 24px; }

/* Navigation */
.nav {
    position: sticky; top: 0; z-index: 10;
    backdrop-filter: blur(12px);
    background: color-mix(in srgb, var(--bg) 80%, transparent);
    border-bottom: 1px solid var(--line);
}
.nav .wrap { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.nav-logo { font-family: var(--mono); font-size: 0.9rem; text-decoration: none; }
.nav-logo span { color: var(--accent); }
.nav-links { display: flex; align-items: center; gap: 22px; list-style: none; }
.nav-links a { text-decoration: none; color: var(--muted); font-size: 0.9rem; transition: color .2s; }
.nav-links a:hover { color: var(--text); }
.theme-toggle {
    display: grid; place-items: center; width: 32px; height: 32px; color: var(--muted);
    background: none; border: 1px solid var(--line); border-radius: 50%; cursor: pointer;
    transition: color .2s, border-color .2s;
}
.theme-toggle:hover { color: var(--text); border-color: var(--accent); }

/* Hero */
.hero { padding: 96px 0 72px; }
.hero .wrap { display: grid; grid-template-columns: 1.4fr 1fr; gap: 56px; align-items: center; }
.status {
    display: inline-flex; align-items: center; gap: 10px;
    font-family: var(--mono); font-size: 0.8rem; color: var(--muted);
    border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px;
}
.status::before {
    content: ""; width: 8px; height: 8px; border-radius: 50%;
    background: var(--accent); box-shadow: 0 0 12px var(--accent);
}
.status.badge { text-decoration: none; margin-left: 8px; transition: border-color .2s, color .2s; }
.status.badge::before { background: var(--accent-2); box-shadow: none; }
.status.badge:hover { border-color: var(--accent); color: var(--text); }
.hero h1 {
    font-family: var(--display); font-weight: 700;
    font-size: clamp(2.8rem, 7vw, 5.2rem); line-height: 1; letter-spacing: -0.03em;
    margin: 24px 0 20px;
}
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p.lede { font-size: 1.15rem; color: var(--muted); max-width: 34em; }
.hero p.lede strong { color: var(--text); font-weight: 500; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.btn {
    font-family: var(--mono); font-size: 0.85rem; text-decoration: none;
    padding: 12px 20px; border-radius: 10px; border: 1px solid var(--line);
    transition: transform .2s, border-color .2s;
}
.btn:hover { transform: translateY(-2px); border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.portrait { position: relative; justify-self: center; width: min(340px, 100%); }
.portrait img {
    width: 100%; aspect-ratio: 1; object-fit: cover; display: block;
    border-radius: 28px; position: relative; z-index: 1;
}
.portrait::after {
    content: ""; position: absolute; inset: 0; border-radius: 28px;
    border: 2px solid var(--accent); transform: translate(14px, 14px);
}

/* Sections */
section { padding: 72px 0; border-top: 1px solid var(--line); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 36px; }
.section-head h2 { font-family: var(--display); font-size: 2rem; letter-spacing: -0.02em; }
.section-head .idx { font-family: var(--mono); color: var(--accent); font-size: 0.85rem; margin-right: 12px; }
.section-head a { font-family: var(--mono); font-size: 0.85rem; color: var(--muted); }

/* Featured post */
.post-card {
    display: grid; grid-template-columns: 1.1fr 1fr; overflow: hidden;
    background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--radius);
    text-decoration: none; transition: border-color .2s, transform .2s;
}
.post-card:hover { border-color: var(--accent); transform: translateY(-3px); }
.post-card + .post-card { margin-top: 18px; }
.post-card img { width: 100%; height: 100%; min-height: 260px; object-fit: cover; display: block; }
.post-card .body { padding: 32px; display: flex; flex-direction: column; gap: 14px; }
.post-card h3 { font-family: var(--display); font-size: 1.6rem; line-height: 1.2; }
.post-card p { color: var(--muted); }
.meta { font-family: var(--mono); font-size: 0.78rem; color: var(--muted); }
.tag {
    display: inline-block; font-family: var(--mono); font-size: 0.72rem;
    padding: 3px 9px; border-radius: 6px; border: 1px solid var(--line); color: var(--accent-2);
}

/* Research cards */
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.card {
    background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 26px; display: flex; flex-direction: column; gap: 12px;
}
.card .glyph { font-family: var(--mono); color: var(--accent); font-size: 1.3rem; }
.card h3 { font-family: var(--display); font-size: 1.2rem; }
.card p { color: var(--muted); font-size: 0.95rem; flex: 1; }
.card a { font-family: var(--mono); font-size: 0.8rem; color: var(--accent-2); text-decoration: none; }

/* Tools & datasets */
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 440px), 1fr)); gap: 18px; }
.tool-sub { margin-top: 40px; }
.tool {
    background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 24px; display: flex; flex-direction: column; align-items: flex-start; gap: 12px;
}
.tool-fig { width: 100%; height: auto; display: block; border-radius: 10px; border: 1px solid var(--line); }
.tool h3 { font-family: var(--display); font-size: 1.25rem; }
/* Easter egg: nearly invisible until hovered */
.tool .egg { margin-left: 8px; text-decoration: none; opacity: 0.15; transition: opacity .2s, color .2s; display: inline-block; }
.tool .egg:hover, .tool .egg:focus { opacity: 1; color: var(--accent); animation: egg-bounce .5s ease infinite alternate; }
@keyframes egg-bounce { to { transform: translateY(-4px) rotate(12deg); } }
.tool p { color: var(--muted); font-size: 0.93rem; }
.tool p.use { flex: 1; }
.tool p.use strong { color: var(--text); font-weight: 500; }
.tool-links { display: flex; flex-wrap: wrap; gap: 14px; font-family: var(--mono); font-size: 0.8rem; }
.tool-links a { color: var(--accent-2); text-decoration: none; }
.flow {
    display: flex; align-items: stretch; gap: 8px; width: 100%;
    font-family: var(--mono); font-size: 0.74rem; line-height: 1.35; padding: 14px; border-radius: 10px;
    border: 1px dashed var(--line);
}
.flow span {
    flex: 1 1 0; display: grid; place-items: center; text-align: center;
    padding: 10px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg);
}
.flow span.core { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.flow i { font-style: normal; color: var(--muted); align-self: center; }
.stats { display: flex; flex-wrap: wrap; gap: 20px; }
.stats b { display: block; font-family: var(--display); font-size: 1.7rem; line-height: 1.1; color: var(--accent); }
.stats span { font-family: var(--mono); font-size: 0.7rem; color: var(--muted); }

/* Talks list */
.rows { list-style: none; }
.rows li {
    display: grid; grid-template-columns: 130px 1fr auto; gap: 20px; align-items: baseline;
    padding: 16px 0; border-bottom: 1px dashed var(--line);
}
.rows .when { font-family: var(--mono); font-size: 0.8rem; color: var(--muted); }
.rows .what strong { display: block; font-weight: 500; }
.rows .what span { color: var(--muted); font-size: 0.9rem; }
.rows .what span.thesis { color: var(--text); font-size: 0.95rem; }
.rows .what span { display: block; }
.rows .links { display: flex; gap: 12px; font-family: var(--mono); font-size: 0.8rem; }
.rows .links a { color: var(--accent-2); text-decoration: none; }
details.more summary {
    cursor: pointer; font-family: var(--mono); font-size: 0.85rem; color: var(--muted); padding: 18px 0;
}

/* Publications */
.pub { padding: 18px 0; border-bottom: 1px dashed var(--line); }
.pub h3 { font-size: 1.05rem; font-weight: 500; }
.pub .venue { font-family: var(--mono); font-size: 0.8rem; color: var(--accent); }
.pub .links { margin-top: 6px; display: flex; gap: 14px; font-family: var(--mono); font-size: 0.8rem; }
.pub .links a { color: var(--muted); }

/* About */
.about-lede { font-size: 1.1rem; color: var(--muted); max-width: 46em; margin-bottom: 40px; }
.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; }
.col-title { font-family: var(--mono); font-size: 0.85rem; font-weight: 500; color: var(--accent); margin-bottom: 16px; }
.path { list-style: none; border-left: 1px solid var(--line); padding-left: 20px; }
.path li { position: relative; padding-bottom: 20px; display: flex; flex-direction: column; }
.path li::before {
    content: ""; position: absolute; left: -25px; top: 7px;
    width: 9px; height: 9px; border-radius: 50%; background: var(--bg); border: 2px solid var(--accent);
}
.path .when { font-family: var(--mono); font-size: 0.75rem; color: var(--muted); }
.path strong { font-weight: 500; }
.path span:last-child { color: var(--muted); font-size: 0.9rem; }
.community {
    display: grid; grid-template-columns: 200px 1fr; gap: 28px; align-items: center; margin-top: 16px;
    background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px;
}
.community-logo { background: #fff; border-radius: 10px; padding: 10px; display: block; }
.community-logo img { width: 100%; height: auto; display: block; }
.community .col-title { display: block; margin-bottom: 6px; }
.community h3 { font-family: var(--display); font-size: 1.25rem; margin-bottom: 8px; }
.community p { color: var(--muted); font-size: 0.95rem; }
.community-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.community-links .btn { font-size: 0.8rem; padding: 9px 14px; }
.toolbelt { margin-top: 24px; display: flex; flex-wrap: wrap; gap: 8px; }

/* Friends */
.friend-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 14px; }
.friend {
    background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 20px; display: flex; flex-direction: column; gap: 8px; text-decoration: none;
    transition: border-color .2s, transform .2s;
}
.friend:hover { border-color: var(--accent); transform: translateY(-3px); }
.friend strong { font-family: var(--display); font-size: 1.1rem; }
.friend span { color: var(--muted); font-size: 0.9rem; flex: 1; }
.friend .friend-url { flex: none; font-family: var(--mono); font-size: 0.78rem; color: var(--accent-2); }

/* Post list */
.post-list { list-style: none; }
.post-list li { border-bottom: 1px dashed var(--line); }
.post-list a { display: grid; grid-template-columns: 130px 1fr; gap: 20px; padding: 18px 0; text-decoration: none; }
.post-list a:hover strong { color: var(--accent); }
.post-list strong { font-weight: 500; display: block; transition: color .2s; }
.post-list span.sum { color: var(--muted); font-size: 0.92rem; }

/* Footer */
footer { border-top: 1px solid var(--line); padding: 48px 0 64px; }
footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 24px; }
footer h2 { font-family: var(--display); font-size: 1.8rem; }
footer .socials { display: flex; gap: 18px; align-items: center; font-size: 1.3rem; }
footer .socials a { color: var(--muted); transition: color .2s; }
footer .socials a:hover { color: var(--accent); }
footer .socials a.text-link { font-family: var(--mono); font-size: 0.85rem; text-decoration: none; border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; }

/* Post page */
.article { max-width: 720px; margin: 0 auto; padding: 72px 24px 96px; }
.article h1 { font-family: var(--display); font-size: clamp(2rem, 5vw, 3rem); line-height: 1.1; letter-spacing: -0.02em; margin: 16px 0; }
.article figure { margin: 32px 0; }
.article figure img { width: 100%; height: auto; border-radius: var(--radius); display: block; }
.article figcaption { font-family: var(--mono); font-size: 0.78rem; color: var(--muted); margin-top: 8px; }
.article h2 { font-family: var(--display); font-size: 1.5rem; margin: 40px 0 12px; }
.article p, .article li { font-size: 1.08rem; margin-bottom: 18px; }
.article ul { padding-left: 1.2em; }
.article code { font-family: var(--mono); font-size: 0.9em; background: var(--bg-raised); border: 1px solid var(--line); padding: 1px 6px; border-radius: 5px; }
.article h3 { font-family: var(--display); font-size: 1.15rem; margin: 28px 0 10px; color: var(--accent); }
.article ol { padding-left: 1.3em; }
.article .flow { margin: 0 0 18px; }
.article .flow span { font-size: 0.74rem; margin: 0; }

/* Post: at-a-glance cards and "take part" grid */
.glance, .take-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 14px; margin: 24px 0; }
.glance a, .take {
    background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 20px; display: flex; flex-direction: column; align-items: flex-start; gap: 12px; text-decoration: none;
}
.glance a { transition: border-color .2s, transform .2s; }
.glance a:hover { border-color: var(--accent); transform: translateY(-2px); }
.glance strong { font-family: var(--display); font-size: 1.1rem; line-height: 1.25; }
.glance .stats > span { display: block; }
.glance .stats span span { display: block; }
.take p { font-size: 0.95rem; color: var(--muted); margin: 0; }
.article .jump { font-size: 0.98rem; padding: 14px 18px; border: 1px dashed var(--accent); border-radius: 10px; }
.article ol.actions li { margin-bottom: 22px; padding-left: 4px; }
.article ol.actions li::marker { font-family: var(--display); font-weight: 700; color: var(--accent); }
.article ol.actions strong { display: block; }
.action-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.action-links .btn { font-size: 0.8rem; padding: 9px 14px; }

.draft-note {
    font-family: var(--mono); font-size: 0.8rem; border: 1px dashed var(--accent);
    padding: 12px 16px; border-radius: 10px; color: var(--muted); margin-bottom: 24px;
}

/* Responsive */
@media (max-width: 860px) {
    .hero .wrap, .post-card { grid-template-columns: 1fr; }
    .portrait { order: -1; width: 220px; justify-self: start; }
    .grid-3, .about-grid { grid-template-columns: 1fr; }
    .community { grid-template-columns: 1fr; }
    .community-logo { max-width: 200px; }
    .status.badge { margin-left: 0; margin-top: 8px; }
    .flow { flex-direction: column; }
    .flow i { transform: rotate(90deg); }
    .post-list a { grid-template-columns: 1fr; gap: 4px; }
    .nav .wrap { flex-direction: column; align-items: flex-start; justify-content: center; gap: 6px; height: auto; padding-top: 10px; padding-bottom: 10px; }
    .nav-links { gap: 16px; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
    .nav-links a { white-space: nowrap; }
    .rows li { grid-template-columns: 1fr; gap: 4px; }
}
