/* =========================================================
   Hemant Verma — Academic Website
   Modern, dynamic design system (light + dark themes)
   ========================================================= */

/* ---------- Design Tokens ---------- */
:root {
    /* Brand */
    --brand: #4f46e5;
    --brand-strong: #4338ca;
    --brand-2: #7c3aed;
    --brand-soft: rgba(79, 70, 229, 0.12);
    --gradient: linear-gradient(120deg, #4f46e5 0%, #7c3aed 50%, #2563eb 100%);

    /* Neutrals (light) */
    --bg: #f6f8fc;
    --bg-alt: #eef2f9;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --ink: #0f172a;
    --text: #334155;
    --muted: #64748b;
    --border: #e2e8f0;

    /* Effects */
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.08);
    --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 18px 40px -12px rgba(15, 23, 42, 0.22);
    --ring: 0 0 0 3px var(--brand-soft);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --radius: 16px;
    --radius-sm: 10px;
    --maxw: 1160px;
    --dot-color: rgba(15, 23, 42, 0.045);
}

[data-theme="dark"] {
    --brand: #818cf8;
    --brand-strong: #a5b4fc;
    --brand-2: #c4b5fd;
    --brand-soft: rgba(129, 140, 248, 0.16);
    --gradient: linear-gradient(120deg, #818cf8 0%, #c4b5fd 50%, #60a5fa 100%);

    --bg: #0b1120;
    --bg-alt: #0e1628;
    --surface: #111a2e;
    --surface-2: #0f1830;
    --ink: #f1f5f9;
    --text: #cbd5e1;
    --muted: #94a3b8;
    --border: #233148;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 22px 48px -14px rgba(0, 0, 0, 0.7);
    --dot-color: rgba(148, 163, 184, 0.05);
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: 90px;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    overflow-x: hidden;
    overflow-x: clip;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.65;
    color: var(--text);
    background-color: var(--bg);
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 0.4s ease, color 0.4s ease;
    overflow-x: hidden;
    overflow-x: clip;
    overflow-wrap: break-word;
    word-break: break-word;
}

h1, h2, h3, h4 {
    font-family: 'Sora', 'Inter', sans-serif;
    color: var(--ink);
    line-height: 1.2;
    letter-spacing: -0.02em;
    overflow-wrap: break-word;
}

a { color: var(--brand); text-decoration: none; }

::selection { background: var(--brand); color: #fff; }

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

/* Scrollbar */
::-webkit-scrollbar { width: 11px; }
::-webkit-scrollbar-track { background: var(--bg-alt); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; border: 3px solid var(--bg-alt); }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ---------- Scroll Progress Bar ---------- */
.scroll-progress {
    position: fixed;
    top: 0; left: 0;
    height: 3px;
    width: 0%;
    background: var(--gradient);
    z-index: 2000;
    transition: width 0.05s linear;
}

/* ---------- Layout helpers ---------- */
.section-head {
    max-width: 720px;
    margin: 0 auto 3.25rem;
    text-align: center;
}

.section-head .eyebrow {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--brand);
    margin-bottom: 0.75rem;
}

.section-head h2 {
    font-size: clamp(1.9rem, 4vw, 2.6rem);
    margin-bottom: 0.85rem;
}

.section-head p { color: var(--muted); font-size: 1.05rem; }

.section-head h2::after {
    content: '';
    display: block;
    width: 64px; height: 4px;
    margin: 1rem auto 0;
    border-radius: 4px;
    background: var(--gradient);
}

/* ---------- Reveal on scroll ---------- */
.reveal {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: opacity, transform;
}
.reveal.visible { opacity: 1; transform: none; }
.reveal[data-delay="1"] { transition-delay: 0.08s; }
.reveal[data-delay="2"] { transition-delay: 0.16s; }
.reveal[data-delay="3"] { transition-delay: 0.24s; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.8rem 1.5rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.97rem;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition);
    text-decoration: none;
}
.btn-primary { background: var(--gradient); color: #fff; box-shadow: var(--shadow-md); }
.btn-primary:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.btn-ghost { background: rgba(255,255,255,0.08); color: #fff; border-color: rgba(255,255,255,0.35); }
.btn-ghost:hover { background: rgba(255,255,255,0.18); transform: translateY(-3px); }

/* ---------- Header / Nav ---------- */
header {
    position: fixed;
    top: 0; left: 0;
    width: 100%;
    z-index: 1000;
    background: var(--surface); /* fallback */
    background: color-mix(in srgb, var(--surface) 80%, transparent);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid transparent;
    transition: var(--transition);
}
header.scrolled {
    border-bottom-color: var(--border);
    box-shadow: var(--shadow-sm);
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.9rem 5%;
    max-width: var(--maxw);
    margin: 0 auto;
}

.logo {
    font-family: 'Sora', 'Inter', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    letter-spacing: -0.02em;
}

.nav-right { display: flex; align-items: center; gap: 0.5rem; }

.nav-links { display: flex; list-style: none; gap: 0.35rem; align-items: center; }

.nav-links li a {
    color: var(--text);
    font-weight: 500;
    font-size: 0.95rem;
    padding: 0.5rem 0.85rem;
    border-radius: 999px;
    position: relative;
    transition: var(--transition);
}
.nav-links li a:hover { color: var(--brand); background: var(--brand-soft); }
.nav-links li a.active { color: var(--brand); background: var(--brand-soft); }

/* Theme toggle */
.theme-toggle {
    width: 42px; height: 42px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--ink);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    transition: var(--transition);
}
.theme-toggle:hover { color: var(--brand); border-color: var(--brand); transform: rotate(15deg); }

.menu-toggle {
    display: none;
    font-size: 1.6rem;
    cursor: pointer;
    color: var(--ink);
    background: none;
    border: none;
    line-height: 1;
}

/* ---------- Hero ---------- */
.hero {
    min-height: 100vh;
    min-height: 100svh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 7rem 1.5rem 4rem;
    position: relative;
    overflow: hidden;
    background: linear-gradient(rgba(7, 11, 24, 0.82), rgba(7, 11, 24, 0.88)), url('../assets/images/physics-bg.jpg');
    background-size: cover;
    background-position: center;
    color: #fff;
}
/* animated aurora glow */
.hero::before {
    content: '';
    position: absolute;
    inset: -30%;
    background:
        radial-gradient(40% 40% at 20% 30%, rgba(124, 58, 237, 0.35), transparent 60%),
        radial-gradient(35% 35% at 80% 70%, rgba(37, 99, 235, 0.35), transparent 60%);
    animation: drift 16s ease-in-out infinite alternate;
    pointer-events: none;
    z-index: 0;
}
@keyframes drift {
    from { transform: translate3d(-3%, -2%, 0) scale(1); }
    to   { transform: translate3d(3%, 2%, 0) scale(1.1); }
}

.hero-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; }

.hero-content { max-width: 820px; margin: 0 auto; position: relative; z-index: 2; }

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 1rem;
    border-radius: 999px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
    backdrop-filter: blur(6px);
}
.hero-badge .dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: #34d399;
    box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.7);
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(52,211,153,0.7); }
    70% { box-shadow: 0 0 0 10px rgba(52,211,153,0); }
    100% { box-shadow: 0 0 0 0 rgba(52,211,153,0); }
}

/* Atom avatar: portrait as nucleus, electrons in orbit */
.hero-avatar {
    position: relative;
    width: 150px; height: 150px;
    margin: 0 auto 1.75rem;
    cursor: pointer;
    animation: fadeIn 0.9s ease-out;
}
.hero-avatar img {
    width: 100%; height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 0 4px rgba(129, 140, 248, 0.25), 0 0 45px rgba(124, 58, 237, 0.45);
    transition: box-shadow 0.4s ease, transform 0.4s ease;
    position: relative;
    z-index: 1;
}
.hero-avatar:hover img { transform: scale(1.04); }
.orbit {
    position: absolute;
    border: 1px dashed rgba(199, 210, 254, 0.35);
    border-radius: 50%;
    animation: orbit-spin linear infinite;
    pointer-events: none;
}
.orbit-1 { inset: -16px; animation-duration: 9s; }
.orbit-2 { inset: -32px; animation-duration: 16s; animation-direction: reverse; }
.electron {
    position: absolute;
    top: -5px; left: 50%;
    margin-left: -4.5px;
    width: 9px; height: 9px;
    border-radius: 50%;
    background: #a5b4fc;
    box-shadow: 0 0 12px 2px rgba(165, 180, 252, 0.9);
}
@keyframes orbit-spin { to { transform: rotate(360deg); } }
/* Photoexcitation easter egg (click the avatar) */
.hero-avatar.excited img {
    box-shadow: 0 0 0 6px rgba(165, 180, 252, 0.5), 0 0 70px rgba(196, 181, 253, 0.9);
}
.hero-avatar.excited .orbit { border-color: rgba(196, 181, 253, 0.85); }
.hero-avatar.excited .electron { background: #fff; box-shadow: 0 0 18px 5px rgba(196, 181, 253, 1); }

.hero-content h1 {
    font-size: clamp(2.8rem, 8vw, 4.6rem);
    margin-bottom: 1rem;
    color: #fff;
    background: linear-gradient(120deg, #fff 30%, #c7d2fe 70%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-role {
    font-family: 'Sora', 'Inter', sans-serif;
    font-size: clamp(1.15rem, 3.2vw, 1.7rem);
    font-weight: 600;
    margin-bottom: 1rem;
    min-height: 1.4em;
    color: #e0e7ff;
}
.hero-role .type-cursor {
    display: inline-block;
    width: 2px;
    margin-left: 2px;
    background: #c7d2fe;
    animation: blink 1s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.hero-affil { font-size: 1rem; color: rgba(255,255,255,0.75); margin-bottom: 1.25rem; letter-spacing: 0.01em; }

.hero-tagline {
    font-size: 1.1rem;
    max-width: 640px;
    margin: 0 auto 2rem;
    color: rgba(255,255,255,0.82);
}

.hero-cta { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; margin-bottom: 2.25rem; }

.social-links { display: flex; justify-content: center; gap: 0.9rem; flex-wrap: wrap; }

.social-icon {
    width: 44px; height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    transition: var(--transition);
    color: #fff;
    font-size: 1.15rem;
}
.social-icon:hover { background: #fff; color: var(--brand); transform: translateY(-4px); }

.scroll-hint {
    position: absolute;
    bottom: 1.6rem; left: 50%;
    transform: translateX(-50%);
    color: rgba(255,255,255,0.7);
    font-size: 1.3rem;
    animation: bounce 2s infinite;
    z-index: 1;
}
@keyframes bounce { 0%,100%{transform:translate(-50%,0);} 50%{transform:translate(-50%,8px);} }

/* ---------- Generic section ---------- */
section.block { padding: 6rem 1.5rem; }
.block-inner { max-width: var(--maxw); margin: 0 auto; }
.bg-alt {
    background-color: var(--bg-alt);
    background-image: radial-gradient(var(--dot-color) 1px, transparent 1px);
    background-size: 22px 22px;
}

/* ---------- Stats strip ---------- */
.stats {
    max-width: var(--maxw);
    margin: -4rem auto 0;
    position: relative;
    z-index: 5;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    padding: 0 1.5rem;
}
.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.6rem 1rem;
    text-align: center;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}
.stat:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }
.stat .num {
    font-family: 'Sora', 'Inter', sans-serif;
    font-size: 2.4rem;
    font-weight: 700;
    background: var(--gradient);
    -webkit-background-clip: text; background-clip: text; color: transparent;
    line-height: 1;
}
.stat .label { color: var(--muted); font-size: 0.9rem; margin-top: 0.5rem; }

/* ---------- News ---------- */
.news-list { max-width: 820px; margin: 0 auto; display: flex; flex-direction: column; gap: 1rem; }
.news-item {
    display: flex;
    gap: 1.25rem;
    align-items: flex-start;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--brand);
    border-radius: var(--radius-sm);
    padding: 1.1rem 1.3rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}
.news-item:hover { transform: translateX(6px); box-shadow: var(--shadow-md); }
.news-date {
    flex-shrink: 0;
    min-width: 92px;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--brand);
    background: var(--brand-soft);
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    white-space: nowrap;
}
.news-item p { color: var(--text); font-size: 0.97rem; }

/* ---------- Research ---------- */
.research-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
}
.research-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem 1.75rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}
.research-item::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: var(--gradient);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s ease;
}
.research-item:hover { transform: translateY(-8px); box-shadow: var(--shadow-lg); border-color: transparent; }
.research-item:hover::before { transform: scaleX(1); }
.research-icon {
    width: 52px; height: 52px;
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    background: var(--brand-soft);
    color: var(--brand);
    font-size: 1.4rem;
    margin-bottom: 1.1rem;
}
.research-item h3 { font-size: 1.2rem; margin-bottom: 0.7rem; }
.research-item p { color: var(--muted); margin-bottom: 0.8rem; font-size: 0.96rem; }
.research-item .highlight {
    color: var(--text);
    font-size: 0.88rem;
    font-weight: 500;
    border-top: 1px dashed var(--border);
    padding-top: 0.8rem;
    margin-bottom: 0;
}

/* ---------- Publications ---------- */
.pub-filter { display: flex; justify-content: center; flex-wrap: wrap; gap: 0.6rem; margin-bottom: 2.5rem; }
.filter-btn {
    padding: 0.5rem 1.2rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
}
.filter-btn:hover { border-color: var(--brand); color: var(--brand); }
.filter-btn.active { background: var(--gradient); color: #fff; border-color: transparent; box-shadow: var(--shadow-sm); }

.pub-year-group { max-width: 820px; margin: 0 auto 2.5rem; }
.year-heading {
    font-size: 1.4rem;
    margin-bottom: 1.25rem;
    color: var(--ink);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.year-heading::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.publications-grid { display: grid; grid-template-columns: 1fr; gap: 1.25rem; }

.publication-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.6rem 1.6rem 1.6rem 3.4rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    position: relative;
}
.publication-item:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--brand); border-color: color-mix(in srgb, var(--brand) 35%, var(--border)); }
.pub-number {
    position: absolute;
    top: 1.6rem; left: 1.3rem;
    font-family: 'Sora', 'Inter', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: var(--brand);
}
.pub-title { font-size: 1.08rem; font-weight: 600; color: var(--ink); margin-bottom: 0.5rem; line-height: 1.4; }
.publication-item .authors { margin-bottom: 0.4rem; font-size: 0.94rem; color: var(--text); }
.publication-item .authors strong { color: var(--brand); }
.publication-item .journal { color: var(--muted); font-size: 0.9rem; }
.publication-item .journal a {
    color: var(--brand);
    font-weight: 600;
    margin-left: 0.4rem;
    white-space: nowrap;
}
.publication-item .journal a:hover { text-decoration: underline; }
.publication-item.pub-status { padding-left: 1.6rem; }

.footnote { font-size: 0.85rem; color: var(--muted); text-align: center; font-style: italic; margin-top: 0.5rem; }

/* ---------- CV ---------- */
.cv-content { max-width: 820px; margin: 0 auto; }

.cv-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
}
.cv-photo {
    width: 130px; height: 130px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--brand);
    box-shadow: var(--shadow-md);
    flex-shrink: 0;
}
.cv-photo img { width: 100%; height: 100%; object-fit: cover; }
.cv-info { text-align: left; }
.cv-info p { margin-bottom: 0.35rem; font-size: 1rem; color: var(--text); }
.cv-info p:first-child { font-size: 1.3rem; color: var(--ink); font-family: 'Sora','Inter',sans-serif; }
.cv-download { margin-top: 0.9rem; }
.download-btn {
    display: inline-flex; align-items: center;
    padding: 0.65rem 1.3rem;
    background: var(--gradient);
    color: #fff;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.92rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}
.download-btn:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

.cv-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.75rem 2rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
}
.cv-section h3 {
    font-size: 1.3rem;
    margin-bottom: 1.25rem;
    padding-bottom: 0.6rem;
    border-bottom: 2px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
.cv-section h3 i { color: var(--brand); font-size: 1.05rem; }

.cv-item {
    position: relative;
    padding-left: 1.4rem;
    margin-bottom: 1.5rem;
    border-left: 2px solid var(--border);
}
.cv-item:last-child { margin-bottom: 0; }
.cv-item::before {
    content: '';
    position: absolute;
    left: -7px; top: 4px;
    width: 12px; height: 12px;
    border-radius: 50%;
    background: var(--brand);
    border: 3px solid var(--surface);
}
.cv-section > .cv-item:only-child,
.cv-item.no-marker { border-left: none; padding-left: 0; }
.cv-item.no-marker::before { display: none; }

.cv-title { font-weight: 600; font-size: 1.05rem; color: var(--ink); margin-bottom: 0.25rem; }
.cv-place { color: var(--text); margin-bottom: 0.25rem; font-size: 0.96rem; }
.cv-subtitle { font-style: italic; color: var(--muted); font-size: 0.9rem; margin-bottom: 0.4rem; }
.cv-date {
    display: inline-block;
    color: var(--brand);
    font-weight: 600;
    font-size: 0.82rem;
    background: var(--brand-soft);
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
}
.cv-details { margin-top: 0.7rem; padding-left: 1.2rem; }
.cv-details li { margin-bottom: 0.45rem; line-height: 1.55; color: var(--text); font-size: 0.95rem; }
.cv-item p:not(.cv-title):not(.cv-place):not(.cv-subtitle):not(.cv-date) { color: var(--text); font-size: 0.95rem; }
.cv-link a { font-weight: 500; }
.cv-link a:hover { text-decoration: underline; }

/* ---------- Tutorials ---------- */
.tutorials-grid { max-width: var(--maxw); margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 2rem; }
.tutorial-category {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}
.tutorial-category:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }
.tutorial-category h3 { font-size: 1.4rem; margin-bottom: 1.5rem; }
.tutorial-cards { display: grid; gap: 1.5rem; }
.tutorial-card { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; transition: var(--transition); }
.tutorial-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.card-content { padding: 1.5rem; }
.card-content h4 { font-size: 1.15rem; margin-bottom: 0.75rem; }
.card-content p { color: var(--muted); margin-bottom: 1.25rem; font-size: 0.95rem; }
.tutorial-tags { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.25rem; }
.tag { background: var(--brand-soft); color: var(--brand); padding: 0.3rem 0.8rem; border-radius: 999px; font-size: 0.82rem; font-weight: 500; }
.tutorial-link {
    display: inline-flex; align-items: center; gap: 0.4rem;
    background: var(--gradient);
    color: #fff;
    padding: 0.55rem 1.3rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: var(--transition);
}
.tutorial-link:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.tutorial-note { font-style: italic; color: var(--muted); margin-top: 0.75rem; font-size: 0.85rem; }

/* ---------- Contact ---------- */
.contact-info {
    max-width: 820px; margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
}
.contact-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.4rem 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}
.contact-item:hover { transform: translateY(-5px); box-shadow: var(--shadow-md); }
.contact-item i {
    font-size: 1.1rem;
    color: var(--brand);
    background: var(--brand-soft);
    width: 44px; height: 44px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.contact-item p { color: var(--text); font-size: 0.95rem; }
.contact-item p[title] { cursor: pointer; }

/* ---------- Footer ---------- */
footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 3rem 1.5rem 1.5rem;
    margin-top: 0;
    position: relative;
}
.footer-content {
    max-width: var(--maxw);
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
}
.footer-social { display: flex; gap: 0.75rem; }
.footer-social .social-icon {
    width: 40px; height: 40px;
    background: var(--brand-soft);
    border: 1px solid var(--border);
    color: var(--brand);
    font-size: 1rem;
}
.footer-social .social-icon:hover { background: var(--gradient); color: #fff; }
.footer-links { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; justify-content: center; }
.footer-links a { color: var(--muted); font-size: 0.92rem; transition: var(--transition); }
.footer-links a:hover { color: var(--brand); }
.footer-info { width: 100%; text-align: center; padding-top: 1.25rem; border-top: 1px solid var(--border); }
.footer-info p { color: var(--muted); font-size: 0.85rem; margin-bottom: 0.25rem; }

.back-to-top {
    position: fixed;
    bottom: 1.75rem; right: 1.75rem;
    z-index: 900;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: var(--transition);
}
.back-to-top.show { opacity: 1; visibility: visible; transform: none; }
.back-to-top a {
    display: flex; align-items: center; justify-content: center;
    width: 48px; height: 48px;
    background: var(--gradient);
    color: #fff;
    border-radius: 50%;
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
}
.back-to-top a:hover { transform: translateY(-4px); }

/* ============ Tutorial article pages ============ */
.tutorial-page { padding: 7rem 1.5rem 4rem; max-width: var(--maxw); margin: 0 auto; }
.tutorial-header { text-align: center; margin-bottom: 3rem; }
.tutorial-header h1 { font-size: clamp(2rem, 5vw, 2.8rem); margin-bottom: 1rem; }
.tutorial-meta { color: var(--muted); font-size: 0.95rem; }
.tutorial-meta span { margin: 0 0.5rem; }
.tutorial-content { display: grid; grid-template-columns: 240px 1fr; gap: 2.5rem; align-items: start; }
.tutorial-nav { position: sticky; top: 100px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow-sm); }
.tutorial-nav h3 { font-size: 1.1rem; margin-bottom: 1rem; }
.tutorial-nav ul { list-style: none; }
.tutorial-nav li { margin-bottom: 0.35rem; }
.tutorial-nav a { display: block; padding: 0.5rem 0.9rem; border-radius: var(--radius-sm); color: var(--text); font-size: 0.92rem; transition: var(--transition); }
.tutorial-nav a:hover, .tutorial-nav a.active { background: var(--brand-soft); color: var(--brand); }
.tutorial-article { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 2.5rem; box-shadow: var(--shadow-sm); }
.tutorial-article h2 { font-size: 1.7rem; margin: 2rem 0 1rem; padding-bottom: 0.5rem; border-bottom: 2px solid var(--border); }
.tutorial-article h2:first-child { margin-top: 0; }
.tutorial-article h3 { font-size: 1.3rem; margin: 1.5rem 0 0.75rem; }
.tutorial-article p { margin-bottom: 1.25rem; }
.tutorial-article ul, .tutorial-article ol { margin-bottom: 1.25rem; padding-left: 1.75rem; }
.tutorial-article li { margin-bottom: 0.5rem; }
.tutorial-article pre { background: var(--surface-2); border: 1px solid var(--border); padding: 1.1rem; border-radius: var(--radius-sm); overflow-x: auto; margin-bottom: 1.25rem; }
.tutorial-article code { font-family: 'SFMono-Regular', Consolas, 'Courier New', monospace; font-size: 0.9rem; }
.tutorial-note { background: var(--brand-soft); border-left: 4px solid var(--brand); padding: 1rem 1.25rem; margin: 1.25rem 0; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.tutorial-note p { margin: 0; }
.tutorial-continue { margin-top: 2.5rem; padding-top: 2rem; border-top: 1px solid var(--border); }

/* ---------- Publication cite (BibTeX) ---------- */
.pub-actions { margin-top: 0.9rem; }
.cite-btn {
    display: inline-flex; align-items: center; gap: 0.4rem;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--muted);
    font-family: inherit; font-size: 0.82rem; font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}
.cite-btn:hover { color: var(--brand); border-color: var(--brand); background: var(--brand-soft); }
.cite-btn.copied { color: #fff; background: var(--brand); border-color: transparent; }
.bibtex { display: none; }

/* ---------- Software & Tools ---------- */
.software-grid { max-width: 820px; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.5rem; }
.software-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 2rem; box-shadow: var(--shadow-sm); transition: var(--transition);
}
.software-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }
.software-head { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.software-icon {
    width: 54px; height: 54px; flex-shrink: 0;
    border-radius: 14px; display: flex; align-items: center; justify-content: center;
    background: var(--gradient); color: #fff; font-size: 1.4rem;
}
.software-head h3 { font-size: 1.3rem; }
.software-sub { color: var(--muted); font-size: 0.9rem; }
.software-card > p { color: var(--text); margin-bottom: 1.1rem; font-size: 0.96rem; }
.software-links { margin-top: 1.25rem; }
.software-links .btn { font-size: 0.9rem; padding: 0.65rem 1.3rem; }

/* ---------- Teaching: animated QM atom card ---------- */
.qm-card .software-icon { position: relative; overflow: visible; }
.qm-card .qm-atom { display: inline-block; animation: qm-orbit 6s linear infinite; transform-origin: 50% 50%; }
.qm-card .software-icon::after {
    content: ""; position: absolute; inset: -4px; border-radius: 16px; pointer-events: none;
    box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.45); animation: qm-pulse 2.8s ease-out infinite;
}
.qm-card:hover .qm-atom { animation-duration: 2.4s; }
@keyframes qm-orbit { to { transform: rotate(360deg); } }
@keyframes qm-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.45); }
    70%  { box-shadow: 0 0 0 12px rgba(79, 70, 229, 0); }
    100% { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0); }
}
@media (prefers-reduced-motion: reduce) {
    .qm-card .qm-atom { animation: none; }
    .qm-card .software-icon::after { animation: none; }
}

/* ---------- Embedded live course-hub preview ---------- */
.course-embed { max-width: 820px; margin: 1.75rem auto 0; }
.browser-frame {
    border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
    box-shadow: var(--shadow-sm); background: var(--surface);
}
.browser-bar {
    display: flex; align-items: center; gap: 0.6rem;
    padding: 0.55rem 0.8rem; border-bottom: 1px solid var(--border); background: var(--bg-alt);
}
.browser-dots { display: inline-flex; gap: 0.35rem; flex-shrink: 0; }
.browser-dots i { width: 11px; height: 11px; border-radius: 50%; background: var(--border); }
.browser-url {
    flex: 1; min-width: 0; font-size: 0.82rem; color: var(--muted);
    background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
    padding: 0.3rem 0.85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.browser-open { color: var(--muted); flex-shrink: 0; display: inline-flex; }
.browser-open:hover { color: var(--brand); }
.course-iframe { display: block; width: 100%; height: 560px; border: 0; background: #fff; }
.embed-caption { text-align: center; color: var(--muted); font-size: 0.88rem; margin-top: 0.75rem; }
@media (max-width: 600px) { .course-iframe { height: 460px; } }

/* ---------- Contact form ---------- */
.contact-form {
    max-width: 820px; margin: 2.5rem auto 0;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 2rem; box-shadow: var(--shadow-sm);
    text-align: left;
}
.form-title {
    font-size: 1.15rem;
    margin-bottom: 1.25rem;
    display: flex; align-items: center; gap: 0.6rem;
}
.form-title i { color: var(--brand); font-size: 0.95rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.form-field { display: flex; flex-direction: column; margin-bottom: 1.25rem; }
.form-field label { font-size: 0.85rem; font-weight: 600; color: var(--ink); margin-bottom: 0.4rem; }
.form-field input, .form-field textarea {
    font-family: inherit; font-size: 16px; /* >=16px avoids iOS focus-zoom */
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--surface-2); color: var(--text);
    transition: var(--transition); resize: vertical;
}
.form-field input::placeholder, .form-field textarea::placeholder { color: var(--muted); }
.form-field input:focus, .form-field textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
.form-status { margin-top: 1rem; font-size: 0.9rem; font-weight: 500; min-height: 1.2em; }
.form-status.ok { color: #059669; }
.form-status.err { color: #ef4444; }

/* ---------- Accessibility: keyboard focus ---------- */
a:focus-visible, button:focus-visible, .btn:focus-visible,
input:focus-visible, textarea:focus-visible, .social-icon:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ---------- Tech marquee ---------- */
.marquee {
    overflow: hidden;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    padding: 0.9rem 0;
    margin-top: 3rem;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.marquee-track { display: flex; width: max-content; animation: marquee 34s linear infinite; }
.marquee:hover .marquee-track { animation-play-state: paused; }
.marquee-group { display: flex; align-items: center; }
.marquee span {
    display: inline-flex; align-items: center;
    font-family: 'Sora', 'Inter', sans-serif;
    font-weight: 600; font-size: 0.92rem; color: var(--muted);
    white-space: nowrap;
}
.marquee span::after { content: '◆'; margin: 0 1.6rem; color: var(--brand); font-size: 0.6em; }
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ---------- Card tilt + cursor glow ---------- */
.research-grid, .software-grid { perspective: 1000px; }
.research-item, .software-card {
    position: relative;
    transition: transform 0.15s ease, box-shadow 0.35s ease, border-color 0.35s ease;
    transform-style: preserve-3d;
}
.software-card { overflow: hidden; }
.research-item::after, .software-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%), rgba(129, 140, 248, 0.16), transparent 50%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}
.research-item:hover::after, .software-card:hover::after { opacity: 1; }

/* ---------- Animations ---------- */
@keyframes fadeIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* ---------- Responsive ---------- */
@media (max-width: 992px) {
    .stats { grid-template-columns: repeat(2, 1fr); }
    .tutorial-content { grid-template-columns: 1fr; }
    .tutorial-nav { position: static; }
    .tutorial-nav ul { display: flex; flex-wrap: wrap; gap: 0.5rem; }
}

@media (max-width: 1024px) {
    .menu-toggle { display: block; }
    .nav-links {
        position: absolute;
        top: 100%; left: 0;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 0.25rem;
        background: var(--surface);
        border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow-md);
        padding: 0.75rem 5%;
        clip-path: inset(0 0 100% 0);
        opacity: 0;
        pointer-events: none;
        transition: clip-path 0.35s ease, opacity 0.25s ease;
    }
    .nav-links.active { clip-path: inset(0 0 0 0); opacity: 1; pointer-events: auto; }
    .nav-links li a { display: block; padding: 0.7rem 0.85rem; }
}

@media (max-width: 768px) {
    section.block { padding: 4.5rem 1.25rem; }
    .hero-role { min-height: 2.9em; } /* reserve 2 lines so the typing effect never shifts layout */
    .stat .num { font-size: 2rem; }
    .news-item { flex-direction: column; gap: 0.6rem; }
    .cv-section { padding: 1.5rem 1.25rem; }
    .cv-info { text-align: center; }
    .cv-header { text-align: center; }
    .publication-item { padding: 1.4rem 1.3rem 1.4rem 1.3rem; }
    .pub-number { position: static; display: block; margin-bottom: 0.3rem; }
    .form-row { grid-template-columns: 1fr; }
    .contact-form { padding: 1.5rem; }
    .tutorial-page { padding: 6rem 1rem 3rem; }
    .tutorial-article { padding: 1.5rem; }
    .tutorial-nav { padding: 1.25rem; }
    .cv-photo { width: 110px; height: 110px; }
    .research-item, .software-card { padding: 1.75rem 1.4rem; }
}

@media (max-width: 480px) {
    .hero-avatar { width: 118px; height: 118px; margin-bottom: 1.4rem; }
    .orbit-1 { inset: -12px; }
    .orbit-2 { inset: -24px; }
    .stats { grid-template-columns: 1fr 1fr; gap: 0.85rem; }
    .hero-cta { flex-direction: column; align-items: center; }
    .btn { width: 100%; max-width: 280px; justify-content: center; }
    .year-heading { font-size: 1.2rem; }
    .software-head { flex-direction: column; align-items: flex-start; text-align: left; }
}

/* Small phones */
@media (max-width: 380px) {
    nav { padding: 0.8rem 4%; }
    .logo { font-size: 1.25rem; }
    .theme-toggle { width: 38px; height: 38px; }
    .hero { padding: 5.5rem 1rem 3rem; }
    .hero-badge { font-size: 0.75rem; padding: 0.35rem 0.8rem; }
    .section-head h2 { font-size: 1.6rem; }
    .stats { grid-template-columns: 1fr; }
    .stat { padding: 1.2rem 0.8rem; }
    .social-icon { width: 40px; height: 40px; font-size: 1.05rem; }
}

/* Short / landscape viewports (e.g. phones turned sideways) */
@media (max-height: 600px) and (orientation: landscape) {
    .hero { min-height: auto; padding-top: 6rem; padding-bottom: 3rem; }
    .stats { margin-top: 1.5rem; }
}

/* Large desktops / ultra-wide */
@media (min-width: 1440px) {
    :root { --maxw: 1280px; }
    body { font-size: 1.03rem; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
    .reveal { opacity: 1; transform: none; }
    .marquee-track { flex-wrap: wrap; justify-content: center; width: auto; row-gap: 0.5rem; }
    .marquee-group { flex-wrap: wrap; justify-content: center; }
    .marquee-group:nth-child(2) { display: none; }
}

/* ---------- Print ---------- */
@media print {
    header, footer, .hero-cta, .social-links, .scroll-progress, .back-to-top, .pub-filter, .theme-toggle, .scroll-hint, .hero::before { display: none !important; }
    body { background: #fff; color: #000; }
    .reveal { opacity: 1 !important; transform: none !important; }
    section.block { padding: 1rem 0; }
}
