/* ==========================================================================
   Aman Kumar Singh: site styles
   One stylesheet for every page. No frameworks, no web fonts.
   Sections: Tokens · Base · Nav · Page header · Hero · Sections · Entries
             · News · Card · Pills · Chips · Notes grid · Gallery · Footer
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
    --bg: #ffffff;
    --bg-alt: #f5f5f7;
    --text: #1d1d1f;
    --muted: #6e6e73;
    --line: #d2d2d7;
    --link: #0066cc;
    --accent: #bf4800;           /* small highlights: Editor's Choice, "Now" */
    --nav-bg: rgba(255, 255, 255, 0.72);
    --radius: 18px;
    --width: 760px;
    --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #000000;
        --bg-alt: #161617;
        --text: #f5f5f7;
        --muted: #a1a1a6;
        --line: #424245;
        --link: #2997ff;
        --accent: #ff9f0a;
        --nav-bg: rgba(22, 22, 23, 0.72);
    }
}

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

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 17px;
    line-height: 1.53;
    letter-spacing: -0.011em;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

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

p { margin: 0 0 1em; }

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.022em; line-height: 1.15; }

em { font-style: italic; }

.wrap {
    max-width: var(--width);
    margin: 0 auto;
    padding: 0 22px;
}

.muted { color: var(--muted); }

.visually-hidden {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Nav ---------- */
.nav {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--nav-bg);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--line);
}

.nav .wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 52px;
}

.nav-name {
    color: var(--text);
    font-weight: 600;
    font-size: 15px;
    white-space: nowrap;
}

.nav-name:hover { text-decoration: none; }

.nav-links {
    display: flex;
    gap: 22px;
    font-size: 13px;
    overflow-x: auto;
    scrollbar-width: none;
}

.nav-links::-webkit-scrollbar { display: none; }

.nav-links a { color: var(--text); opacity: 0.8; white-space: nowrap; }
.nav-links a:hover { opacity: 1; text-decoration: none; }
.nav-links a[aria-current="page"] { opacity: 1; font-weight: 600; }

/* Phones without JS: name on top, links scroll sideways underneath */
@media (max-width: 640px) {
    .nav:not(.has-toggle) .wrap { flex-direction: column; align-items: flex-start; gap: 2px; padding-top: 10px; padding-bottom: 8px; }
    .nav:not(.has-toggle) .nav-links { width: 100%; gap: 18px; padding-bottom: 2px; }
}

/* Menu button: hidden on wider screens */
.nav-toggle { display: none; }

/* Phones with JS: three-line button opens a full-screen menu */
@media (max-width: 640px) {
    .nav.has-toggle .wrap { min-height: 48px; }

    .nav-toggle {
        display: block;
        position: relative;
        width: 44px;
        height: 44px;
        margin-right: -12px;
        padding: 0;
        border: 0;
        background: none;
        color: var(--text);
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }

    .nav-toggle span {
        position: absolute;
        left: 13px;
        width: 18px;
        height: 1.5px;
        border-radius: 1px;
        background: currentColor;
        transition: transform 0.3s ease, opacity 0.2s ease, top 0.3s ease;
    }
    .nav-toggle span:nth-child(1) { top: 16px; }
    .nav-toggle span:nth-child(2) { top: 21.25px; }
    .nav-toggle span:nth-child(3) { top: 26.5px; }

    .nav.is-open .nav-toggle span:nth-child(1) { top: 21.25px; transform: rotate(45deg); }
    .nav.is-open .nav-toggle span:nth-child(2) { opacity: 0; }
    .nav.is-open .nav-toggle span:nth-child(3) { top: 21.25px; transform: rotate(-45deg); }

    .nav.has-toggle .nav-links {
        position: fixed;
        top: 49px;
        left: 0;
        right: 0;
        height: calc(100vh - 49px);
        height: calc(100dvh - 49px);
        flex-direction: column;
        gap: 0;
        padding: 20px 22px 40px;
        overflow-y: auto;
        background: var(--bg);
        visibility: hidden;
        opacity: 0;
        transition: opacity 0.3s ease, visibility 0s linear 0.3s;
    }

    .nav.is-open .nav-links {
        visibility: visible;
        opacity: 1;
        transition: opacity 0.3s ease, visibility 0s;
    }

    .nav.has-toggle .nav-links a {
        padding: 8px 0;
        font-size: 28px;
        font-weight: 600;
        letter-spacing: -0.015em;
        line-height: 1.2;
        opacity: 0;
        transform: translateY(-8px);
        transition: opacity 0.25s ease, transform 0.25s ease;
    }

    .nav.is-open .nav-links a {
        opacity: 1;
        transform: none;
        transition-delay: calc(0.05s + var(--i, 0) * 0.03s);
    }

    .nav.is-open .nav-links a[aria-current="page"] { color: var(--muted); }

    .nav.has-toggle .nav-links { overscroll-behavior: contain; }

    /* Menu open: solid bar, no scrolling behind it.
       Lock only <html>: overflow on <body> too makes body the sticky bar's
       scroll box, so the bar (and menu) jump to the page top when scrolled down.
       Dropping the blur keeps the fixed menu tied to the screen, not the bar. */
    .nav.is-open {
        background: var(--bg);
        border-bottom-color: transparent;
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }
    html.nav-locked { overflow: hidden; }
}

@media (max-width: 640px) and (prefers-reduced-motion: reduce) {
    .nav-toggle span,
    .nav.has-toggle .nav-links,
    .nav.has-toggle .nav-links a { transition: none !important; }
}

/* ---------- Page header (sub-pages) ---------- */
.page-head { padding: 72px 0 8px; }

.page-head h1 { font-size: 48px; letter-spacing: -0.03em; }

.page-head p { margin: 12px 0 0; font-size: 21px; line-height: 1.38; color: var(--muted); }

@media (max-width: 640px) {
    .page-head { padding-top: 44px; }
    .page-head h1 { font-size: 36px; }
    .page-head p { font-size: 19px; }
}

/* ---------- Hero (home) ---------- */
.hero {
    display: flex;
    align-items: center;
    gap: 32px;
    padding: 72px 0 16px;
}

.hero img {
    width: 136px;
    height: 136px;
    border-radius: 50%;
    object-fit: cover;
    flex: none;
}

.hero h1 { font-size: 48px; letter-spacing: -0.03em; }

.hero .tagline { margin: 8px 0 0; font-size: 21px; line-height: 1.38; }

.hero .affil { margin: 6px 0 0; font-size: 15px; color: var(--muted); }

.status {
    display: inline-block;
    margin-top: 14px;
    padding: 5px 12px;
    border-radius: 980px;
    background: var(--bg-alt);
    font-size: 13px;
    font-weight: 500;
}

.status::before { content: "●"; color: #30d158; margin-right: 6px; font-size: 10px; vertical-align: 1px; }

.contact {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 20px;
    margin: 28px 0 0;
    padding: 0;
    list-style: none;
    font-size: 15px;
}

.contact .email { color: var(--muted); }

@media (max-width: 640px) {
    .hero { flex-direction: column; align-items: flex-start; gap: 20px; padding-top: 40px; }
    .hero img { width: 104px; height: 104px; }
    .hero h1 { font-size: 36px; }
    .hero .tagline { font-size: 19px; }
}

/* ---------- Sections ---------- */
main { padding-bottom: 40px; }

.section { padding-top: 56px; }

.section > h2 {
    font-size: 28px;
    padding-bottom: 12px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--line);
}

.section > h3,
.group {
    margin: 32px 0 4px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
}

.section > h2 + h3,
.section > h2 + .group { margin-top: 0; }

.prose p { font-size: 17px; }
.prose p:last-child { margin-bottom: 0; }

.more { display: inline-block; margin-top: 16px; font-size: 15px; }
.more::after { content: " ›"; }

/* ---------- Entries: publications, projects, roles, courses ---------- */
.entries { list-style: none; margin: 0; padding: 0; }

.entry { padding: 18px 0; border-bottom: 1px solid var(--line); }
.entry:last-child { border-bottom: 0; }

.entry-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
}

.entry-title { font-weight: 600; font-size: 17px; line-height: 1.35; }
.entry-title a { color: inherit; }

.entry-date { flex: none; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }

.entry-meta { margin-top: 3px; font-size: 15px; color: var(--muted); }

.entry-desc { margin-top: 6px; font-size: 15px; line-height: 1.5; }

.entry-desc .team { display: block; color: var(--muted); font-size: 14px; margin-bottom: 2px; }

.me { font-weight: 600; color: var(--text); }

@media (max-width: 640px) {
    .entry-head { flex-direction: column; gap: 2px; }
}

/* Compact rows: coursework */
.entry.compact { padding: 12px 0; }

.code {
    display: inline-block;
    min-width: 72px;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

/* ---------- News ---------- */
.news { list-style: none; margin: 0; padding: 0; }

.news li {
    display: grid;
    grid-template-columns: 96px 1fr;
    gap: 16px;
    padding: 9px 0;
    font-size: 16px;
}

.news time { color: var(--muted); font-size: 14px; padding-top: 1px; font-variant-numeric: tabular-nums; }

@media (max-width: 480px) {
    .news li { grid-template-columns: 1fr; gap: 0; }
}

/* ---------- Card: featured work ---------- */
.card {
    background: var(--bg-alt);
    border-radius: var(--radius);
    padding: 32px;
}

.card .eyebrow { margin: 0 0 8px; font-size: 13px; font-weight: 600; color: var(--accent); }

.card h3 { font-size: 24px; line-height: 1.2; letter-spacing: -0.02em; }

.card .entry-meta { margin-top: 8px; }

@media (max-width: 640px) {
    .card { padding: 24px; }
    .card h3 { font-size: 21px; }
}

.badge { color: var(--accent); font-weight: 600; font-size: 14px; }

/* ---------- Pills: small link buttons ---------- */
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.pill {
    display: inline-block;
    padding: 4px 12px;
    border: 1px solid var(--line);
    border-radius: 980px;
    background: transparent;
    color: var(--link);
    font: inherit;
    font-size: 13px;
    line-height: 1.5;
    cursor: pointer;
}

.pill:hover { border-color: var(--link); text-decoration: none; }

.pill.primary { background: var(--link); border-color: var(--link); color: #fff; }

/* BibTeX and other expandable blocks */
.bib {
    position: relative;
    margin: 12px 0 0;
    padding: 16px 18px;
    background: var(--bg-alt);
    border-radius: 12px;
    font-family: var(--mono);
    font-size: 12.5px;
    line-height: 1.55;
    overflow-x: auto;
    white-space: pre;
}

.bib-copy { position: absolute; top: 10px; right: 10px; font-family: var(--font); }

details.more-list { margin-top: 10px; font-size: 15px; }
details.more-list summary { cursor: pointer; color: var(--link); }
details.more-list ol { margin: 8px 0 0; padding-left: 22px; columns: 2; column-gap: 28px; }
details.more-list li { padding: 2px 0; break-inside: avoid; }

@media (max-width: 640px) {
    details.more-list ol { columns: 1; }
}

/* ---------- Chips: skills ---------- */
.skill-row {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid var(--line);
}

.skill-row:last-child { border-bottom: 0; }

.skill-row h3 { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; padding-top: 4px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
    padding: 4px 12px;
    border-radius: 980px;
    background: var(--bg-alt);
    font-size: 14px;
}

@media (max-width: 640px) {
    .skill-row { grid-template-columns: 1fr; gap: 8px; }
}

/* ---------- Notes grid ---------- */
.notes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 28px 20px;
    margin-top: 16px;
}

.note a { color: inherit; }
.note a:hover { text-decoration: none; }

.note img {
    width: 100%;
    aspect-ratio: 1.41;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid var(--line);
    transition: transform 0.25s ease;
}

.note a:hover img { transform: scale(1.02); }

.note-title { margin-top: 10px; font-size: 15px; font-weight: 600; line-height: 1.3; }
.note-title .code { min-width: 0; margin-right: 4px; }
.note-prof { margin-top: 2px; font-size: 13px; color: var(--muted); }

/* ---------- Gallery: award photos ---------- */
.gallery {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 24px;
}

.gallery figure { margin: 0; }

.gallery img {
    width: 100%;
    aspect-ratio: 3 / 2;
    object-fit: cover;
    border-radius: 12px;
}

.gallery figcaption { margin-top: 8px; font-size: 13px; color: var(--muted); }

@media (max-width: 640px) {
    .gallery { grid-template-columns: 1fr; }
}

/* ---------- Footer ---------- */
.footer {
    margin-top: 64px;
    padding: 24px 0 40px;
    background: var(--bg-alt);
    font-size: 12px;
    color: var(--muted);
}

.footer p { margin: 0 0 6px; }
.footer a { color: var(--text); }
.footer .sep { margin: 0 8px; opacity: 0.5; }
