/* ============================================================
   Zhaoqi Wang — personal homepage
   Visual language: light academic / blue accent / card grid.
   Code is original; layout and tokens follow the reference style.
   ============================================================ */

:root {
    --brand: #1e40af;
    --brand-2: #1d4ed8;
    --brand-hover: #1e3a8a;
    --brand-gradient: linear-gradient(135deg, #1e40af 0%, #1d4ed8 100%);

    --bg: #f8fafc;
    --surface: #ffffff;
    --border: #e2e8f0;
    --border-subtle: #f1f5f9;

    --text: #0f172a;
    --text-soft: #475569;
    --text-muted: #64748b;

    --maxw: 1152px;
    --radius: 20px;
    --radius-sm: 12px;
    --shadow-card: 0 16px 48px -12px rgba(30, 64, 175, 0.20);
    --shadow-soft: 0 8px 24px -12px rgba(15, 23, 42, 0.18);

    --font-sans: 'Inter', 'Lato', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-display: 'Instrument Serif', Georgia, 'Times New Roman', serif;
    --font-heading: 'Space Grotesk', 'Inter', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', ui-monospace, SFMono-Regular, Menlo, monospace;

    --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* ===== reset & base ===== */
*, *::before, *::after { box-sizing: border-box; }

html {
    color-scheme: light;
    background: var(--bg);
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: clip;
}

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

a {
    color: var(--brand);
    text-decoration: none;
    transition: color 0.15s ease;
}
a:hover { color: var(--brand-hover); }


p { margin: 0 0 1em; }
ul { margin: 0; padding: 0; }

::selection { background: rgba(30, 64, 175, 0.16); color: var(--text); }

:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 3px;
    border-radius: 4px;
}

.skip-link {
    position: fixed;
    top: 8px;
    left: 8px;
    z-index: 200;
    padding: 10px 14px;
    border-radius: 8px;
    background: var(--brand);
    color: #fff;
    font-size: 0.85rem;
    transform: translateY(-160%);
    transition: transform 0.2s var(--ease);
}
.skip-link:focus { transform: none; color: #fff; }
#main:focus { outline: none; }

/* Controls that require JavaScript */
.no-js .wechat-btn { display: none; }

/* ===== reading progress ===== */
.progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    height: 3px;
    width: 0;
    background-image: linear-gradient(90deg, #ff5b1f 0%, #ff5fa2 50%, #1547ff 100%);
    background-size: 100vw 100%;
    box-shadow: 0 0 14px rgba(21, 71, 255, 0.35);
}

/* ===== nav ===== */
.nav-bar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    border-bottom: 2px solid var(--border);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
}

.nav-inner {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 0 20px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 22px;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 22px;
    font-size: 14px;
    font-weight: 500;
}

.nav-links a {
    position: relative;
    color: var(--text-soft);
    padding: 4px 0;
}
.nav-links a::after {
    content: "";
    position: absolute;
    left: 0;
    right: 100%;
    bottom: 0;
    height: 2px;
    border-radius: 2px;
    background: var(--brand-gradient);
    transition: right 0.2s var(--ease), left 0.2s var(--ease);
}
.nav-links a:hover { color: var(--text); }
.nav-links a:hover::after { left: 0; right: 0; }

/* ===== layout ===== */
.page {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 0 20px;
}

/* ===== hero ===== */
.hero-section {
    position: relative;
    padding: 56px 0 48px;
}
.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 240px;
    gap: 48px;
    align-items: center;
}

.hero-name-text {
    display: inline-block;
    transform: scaleY(0.92);
    transform-origin: center center;
}

.hero-name {
    display: flex;
    align-items: center;
    margin: 0;
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 400;
    font-size: clamp(3rem, 6.8vw, 5.6rem);
    letter-spacing: -0.015em;
    line-height: 1.05;
    overflow-wrap: anywhere;
}

.hero-alias {
    display: inline-block;
    margin-left: 0.35em;
    font-family: var(--font-display);
    font-style: italic;
    font-size: 0.3em;
    font-weight: 400;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    white-space: nowrap;
    transform: translate(1em, 0.4em);
}

.hero-bio {
    max-width: 42rem;
    margin-top: 1.25rem;
    color: var(--text-soft);
}
.hero-bio p { line-height: 1.7; }
.hero-bio p:last-child { margin-bottom: 0; }
.hero-bio strong { color: var(--text); font-weight: 600; }

.social-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 1.5rem;
}

.icon-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--surface);
    color: var(--text-soft);
    font-family: inherit;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.icon-btn:hover {
    transform: translateY(-3px) rotate(-6deg);
    background: var(--text);
    color: var(--surface);
    border-color: var(--text);
}

.wechat-tip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    padding: 3px 8px;
    border-radius: 6px;
    background: var(--text);
    color: var(--surface);
    font-family: var(--font-mono);
    font-size: 10px;
    line-height: 1.5;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) translateY(4px);
    transition: opacity 0.15s ease, transform 0.15s ease;
}
.wechat-btn.copied .wechat-tip {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.hero-photo {
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.profile-placeholder {
    display: grid;
    place-items: center;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    box-shadow:
        0 0 0 4px rgba(30, 64, 175, 0.18),
        0 0 0 10px rgba(30, 64, 175, 0.09),
        0 0 0 20px rgba(30, 64, 175, 0.04),
        0 24px 70px -15px rgba(30, 64, 175, 0.50);
}

.profile-frame {
    width: 200px;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius);
    background: transparent;
    overflow: hidden;
    transform: translateX(-72px);
}

.profile-photo {
    display: block;
    width: 100%;
    height: auto;
}

.profile-placeholder {
    display: grid;
    place-content: center;
    gap: 6px;
    padding: 24px;
    border: 2px dashed #cbd5e1;
    background: var(--surface);
    text-align: center;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    overflow-wrap: anywhere;
}
.profile-hint { font-size: 9px; color: var(--text-muted); }

/* ===== sections ===== */
.section {
    padding: 48px 0;
    scroll-margin-top: 80px;
}

.section-title {
    margin: 0;
    font-family: var(--font-heading);
    font-size: 1.45rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text);
}

/* ===== paper / project cards ===== */
.card-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 24px;
}

.pcard {
    display: flex;
    gap: 24px;
    padding: 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid transparent;
    border-radius: var(--radius);
    transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), border-color 0.2s var(--ease);
}
.pcard:hover,
.pcard:focus-within {
    transform: translateY(-3px);
    border-left-color: var(--brand);
    box-shadow: var(--shadow-card);
}

.thumb {
    position: relative;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 160px;
    height: 160px;
    padding: 10px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: #cbd5e1;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    text-align: center;
    overflow: hidden;
    overflow-wrap: anywhere;
}
.thumb::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(148, 163, 184, 0.18) 1px, transparent 1px);
    background-size: 16px 16px;
}
.thumb span { position: relative; }
.thumb-media {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: calc(var(--radius-sm) - 4px);
}

.pcard-body { min-width: 0; }

.pcard-title {
    margin: 0 0 6px;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.4;
    letter-spacing: -0.01em;
    overflow-wrap: anywhere;
}

.pauthors,
.pdesc {
    margin: 0 0 4px;
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--text-soft);
    overflow-wrap: anywhere;
}

.pvenue {
    margin: 0;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--brand);
}

.pcard-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
}

.link-pill {
    display: inline-flex;
    align-items: center;
    padding: 3px 11px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--border-subtle);
    color: var(--text-soft);
    font-size: 11.5px;
    font-weight: 600;
    transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.link-pill:hover {
    color: #fff;
    background: var(--brand-gradient);
    border-color: transparent;
}

/* ===== experience (kept layout: logo / info / date) ===== */
.exp-list {
    display: grid;
    grid-auto-rows: 1fr;
    margin-top: 24px;
}

.exp-row {
    display: grid;
    grid-template-columns: 160px minmax(0, 1fr) auto;
    gap: 28px;
    align-items: center;
    padding: 20px 10px;
    transition: background 0.2s ease, padding 0.2s ease, box-shadow 0.2s ease, border-radius 0.2s ease;
}
.exp-row + .exp-row {
    border-top: 1px solid var(--border);
}
.exp-row:hover {
    padding-left: 16px;
    background: var(--surface);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-soft);
}

.exp-logo {
    display: grid;
    place-items: center start;
    width: 160px;
    height: 56px;
    overflow: hidden;
}

.exp-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: left center;
}

.exp-logo img.logo-ahu {
    width: 92%;
    height: 92%;
}

.exp-info {
    min-width: 0;
    color: var(--text);
}
.exp-info b {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
}
.exp-info .role {
    margin: 4px 0;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--text);
}
.exp-info p {
    margin: 2px 0;
    font-size: 0.9rem;
    color: var(--text);
    overflow-wrap: anywhere;
}

.exp-date {
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* ===== footer ===== */
.site-footer {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 40px 20px 32px;
}
.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    font-family: var(--font-mono);
    font-size: 11.5px;
    color: var(--text-muted);
}
.footer-meta { min-width: 0; overflow-wrap: anywhere; }
.footer-meta a { color: var(--text-muted); text-decoration: underline; text-underline-offset: 3px; }
.footer-meta a:hover { color: var(--brand); }

/* ===== back to top ===== */
.back-to-top {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--surface);
    color: var(--brand);
    box-shadow: var(--shadow-soft);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease, background 0.2s ease;
}
.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: none;
}
.back-to-top:hover { background: var(--brand); color: #fff; }

/* ===== reveal ===== */
html.js .reveal {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.5s var(--ease), transform 0.5s var(--ease);
}
html.js .reveal.visible {
    opacity: 1;
    transform: none;
}

/* ===== responsive ===== */
@media (max-width: 900px) {
    .hero-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 36px;
    }
    .hero-photo { justify-content: flex-start; }
    .profile-frame { transform: none; }
    .hero-section { padding-top: 44px; }
}

@media (max-width: 640px) {
    .nav-links { display: none; }

    .pcard { flex-direction: column; }
    .thumb { width: 100%; height: 200px; }

    .exp-row {
        grid-template-columns: 120px minmax(0, 1fr);
        gap: 20px;
    }
    .exp-logo { width: 120px; height: 48px; }
    .exp-date { grid-column: 2; padding-top: 0; }

}

@media (max-width: 480px) {
    .nav-inner,
    .page { padding-left: 16px; padding-right: 16px; }
    .site-footer { padding-left: 16px; padding-right: 16px; }
    .profile-placeholder { width: 180px; height: 180px; }
    .profile-frame { width: 160px; }
    .icon-btn { width: 40px; height: 40px; }
    .footer-inner { flex-direction: column; align-items: flex-start; }
    .back-to-top { right: 16px; bottom: 16px; }
}

/* ===== reduced motion ===== */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
    html.js .reveal { opacity: 1; transform: none; }
}
