/* ==========================================================
   AMAN AGRAWAL — RESEARCH SCIENTIST PORTFOLIO
   Minimal, Nous Research-inspired aesthetic
   ========================================================== */

/* ---------- Design Tokens ---------- */
:root {
    --bg:            #fafafa;
    --bg-raised:     #ffffff;
    --bg-hover:      #f0f0f0;
    --bg-code:       #f5f5f5;

    --border:        #d8d8d8;
    --border-hover:  #bbb;

    --text-primary:  #171717;
    --text-secondary:#525252;
    --text-muted:    #a3a3a3;

    --accent:        #0171A9;
    --accent-hover:  #015d8a;
    --accent-dim:    rgba(1, 113, 169, 0.06);
    --accent-border: #d95d22;

    --green:         #16a34a;

    --heading-font: 'Geist Mono', 'JetBrains Mono', ui-monospace, monospace;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --mono: 'JetBrains Mono', 'Fira Code', ui-monospace, monospace;

    --nav-h: 56px;
    --max-w: 720px;
    --radius: 8px;
    --radius-sm: 6px;
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- Reset ---------- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html {
    scroll-behavior: smooth;
    scroll-padding-top: var(--nav-h);
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text-primary);
    font-size: 0.9375rem;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(37, 99, 235, 0.12); }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #d0d0d0; border-radius: 3px; }

/* ---------- Layout ---------- */
.container {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 24px;
}

.section {
    padding: 80px 0;
}

.section-heading {
    font-family: var(--heading-font);
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: -0.05em;
    text-transform: uppercase;
    margin-bottom: 32px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.section-subtitle {
    color: var(--text-muted);
    font-size: 0.8125rem;
    margin-top: -20px;
    margin-bottom: 32px;
}

/* Hide decorative elements */
.mesh-bg, .grain-overlay, .scroll-indicator, .heading-number { display: none; }

/* ==========================================================
   NAVIGATION
   ========================================================== */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-h);
    z-index: 100;
    background: rgba(250, 250, 250, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.nav.scrolled {
    background: rgba(250, 250, 250, 0.92);
}

.nav-inner {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 24px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-logo {
    font-family: var(--heading-font);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: -0.05em;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 4px;
}

.nav-links a {
    font-size: 0.8125rem;
    font-weight: 450;
    color: var(--text-muted);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    transition: color 150ms var(--ease);
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--text-primary);
}

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.nav-toggle span {
    display: block;
    width: 18px;
    height: 1.5px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all 200ms var(--ease);
}

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

/* ==========================================================
   HERO
   ========================================================== */
.hero {
    position: relative;
    z-index: 1;
    padding: 160px 0 80px;
}

.hero-content {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 24px;
}

.hero-badge {
    font-family: var(--mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--green);
}

.hero-name {
    font-family: var(--heading-font);
    font-size: clamp(2rem, 5vw, 2.75rem);
    font-weight: 700;
    letter-spacing: -0.05em;
    line-height: 1.1;
    color: var(--text-primary);
    margin-bottom: 12px;
}

/* Hero tags row */
.hero-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.hero-tag {
    font-family: var(--mono);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-code);
    border: 1px solid var(--border);
    padding: 4px 12px;
    border-radius: var(--radius-sm);
}

.hero-description {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    line-height: 1.7;
    max-width: 480px;
    margin-bottom: 12px;
}

.hero-philosophy {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-bottom: 24px;
}

.hero-research-hook { display: none; }

.hero-links {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
}

.hero-link {
    color: var(--text-muted);
    font-size: 1rem;
    transition: color 150ms var(--ease);
}

.hero-link:hover {
    color: var(--text-primary);
}

.hero-cta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--mono);
    font-size: 0.75rem;
    font-weight: 500;
    padding: 8px 20px;
    border-radius: 9999px;
    transition: all 150ms var(--ease);
    cursor: pointer;
    border: none;
}

.btn-primary {
    background: #32373C;
    color: #fff;
}

.btn-primary:hover {
    background: #1a1e22;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-ghost:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.btn-lg {
    padding: 12px 28px;
    font-size: 0.875rem;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.75rem;
}

/* ==========================================================
   ABOUT
   ========================================================== */
.about-grid {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 32px;
    align-items: start;
}

.about-image-wrapper {
    width: 140px;
    height: 180px;
    border-radius: var(--radius);
    overflow: hidden;
    border: 2px solid #171717;
    background: #fff;
}

.about-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.about-text p {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    margin-bottom: 16px;
    line-height: 1.7;
}

.about-text strong {
    color: var(--text-primary);
    font-weight: 600;
}

.about-education {
    margin: 20px 0;
    padding: 12px 16px;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
}

.edu-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.edu-icon {
    color: var(--text-muted);
    font-size: 1rem;
    flex-shrink: 0;
}

.edu-item h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.edu-item p {
    font-size: 0.75rem !important;
    color: var(--text-muted) !important;
    margin-bottom: 0 !important;
}

.focus-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 16px;
}

.focus-tag {
    font-family: var(--mono);
    font-size: 0.6875rem;
    color: var(--text-secondary);
    background: var(--bg-code);
    border: 1px solid var(--border);
    padding: 3px 10px;
    border-radius: var(--radius-sm);
}

/* ==========================================================
   EXPERIENCE
   ========================================================== */
.exp-list {
    display: flex;
    flex-direction: column;
}

.exp-card {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 24px;
    padding: 24px 0;
    border-bottom: 1px solid var(--border);
    background: transparent;
    border-radius: 0;
}

.exp-card:last-child {
    border-bottom: none;
}

.exp-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.exp-date {
    font-family: var(--mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.6;
}

.exp-type {
    font-family: var(--mono);
    font-size: 0.625rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.exp-role {
    font-family: var(--heading-font);
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.03em;
    margin-bottom: 2px;
}

.exp-company {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.exp-location {
    color: var(--text-muted);
    font-weight: 400;
}

.exp-bullets {
    list-style: none;
    margin-bottom: 12px;
}

.exp-bullets li {
    position: relative;
    padding-left: 14px;
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 6px;
}

.exp-bullets li::before {
    content: '–';
    position: absolute;
    left: 0;
    color: var(--text-muted);
}

.exp-bullets strong {
    color: var(--text-primary);
    font-weight: 600;
}

.exp-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.exp-tags span {
    font-family: var(--mono);
    font-size: 0.6875rem;
    color: var(--text-muted);
    background: var(--bg-code);
    padding: 2px 8px;
    border-radius: 4px;
}

/* ==========================================================
   RESEARCH
   ========================================================== */
.research-item {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 16px;
    transition: border-color 150ms var(--ease);
}

.research-item:hover {
    border-color: var(--accent-border);
}

.research-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.research-item-title {
    font-family: var(--heading-font);
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.03em;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.research-item-title i {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.research-item-desc {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 12px;
    max-width: 600px;
}

.research-item-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.research-item-tags span {
    font-family: var(--mono);
    font-size: 0.6875rem;
    color: var(--text-muted);
    background: var(--bg-code);
    padding: 2px 8px;
    border-radius: 4px;
}

.research-item-links { flex-shrink: 0; }

/* PDF Viewer */
.pdf-viewer {
    margin-top: 4px;
    background: #111;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border);
}

#pdf-canvas {
    display: block;
    width: 100%;
    height: auto;
}

.pdf-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: #1a1a1a;
    border-top: 1px solid #2a2a2a;
}

.pdf-page-info {
    font-family: var(--mono);
    font-size: 0.75rem;
    color: #888;
}

.pdf-btns { display: flex; gap: 6px; }

.pdf-btn {
    font-family: var(--mono);
    font-size: 0.75rem;
    padding: 5px 12px;
    border: 1px solid #333;
    background: transparent;
    color: #aaa;
    border-radius: 4px;
    cursor: pointer;
    transition: all 150ms var(--ease);
}

.pdf-btn:hover {
    border-color: #555;
    color: #fff;
}

.pdf-btn-accent {
    border-color: #444;
    color: #ddd;
}

.pdf-all-pages { display: flex; flex-direction: column; gap: 2px; }
.pdf-page-canvas { display: block; width: 100%; height: auto; }

/* Repo Tree */
.repo-tree {
    margin-top: 4px;
    background: #111;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.repo-tree-title {
    font-family: var(--mono);
    font-size: 0.6875rem;
    color: #888;
    padding: 8px 14px;
    background: #1a1a1a;
    border-bottom: 1px solid #2a2a2a;
    display: flex;
    align-items: center;
    gap: 8px;
}

.repo-tree-title i { color: #888; }

.repo-tree-content {
    font-family: var(--mono);
    font-size: 0.6875rem;
    line-height: 1.8;
    color: #aaa;
    padding: 14px 18px;
    margin: 0;
    overflow-x: auto;
}

/* ==========================================================
   PROJECTS
   ========================================================== */
.project-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.project-card {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 24px;
    transition: border-color 150ms var(--ease);
}

.project-card:hover {
    border-color: var(--accent-border);
}

.project-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.project-icon { font-size: 1.1rem; color: var(--text-muted); }

.project-links a {
    color: var(--text-muted);
    font-size: 1rem;
    transition: color 150ms var(--ease);
}

.project-links a:hover { color: var(--text-primary); }

.project-title {
    font-family: var(--heading-font);
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.03em;
    margin-bottom: 2px;
}

.project-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 10px;
    font-family: var(--mono);
}

.project-desc {
    color: var(--text-secondary);
    font-size: 0.8125rem;
    line-height: 1.7;
    margin-bottom: 12px;
}

.demo-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--mono);
    font-size: 0.75rem;
    color: var(--accent);
    margin-bottom: 12px;
    transition: color 150ms var(--ease);
}

.demo-btn:hover { color: var(--accent-hover); }
.demo-btn i { font-size: 0.85rem; }

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.project-tags span {
    font-family: var(--mono);
    font-size: 0.6875rem;
    color: var(--text-muted);
    background: var(--bg-code);
    padding: 2px 8px;
    border-radius: 4px;
}

/* ==========================================================
   TECH STACK
   ========================================================== */
.stack-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 24px;
}

.stack-group {
    padding: 0;
    background: transparent;
}

.stack-label {
    font-family: var(--heading-font);
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: -0.03em;
    margin-bottom: 8px;
}

.stack-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.stack-tags span {
    font-family: var(--mono);
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: var(--bg-code);
    border: 1px solid var(--border);
    padding: 3px 10px;
    border-radius: var(--radius-sm);
}

/* ==========================================================
   WRITING
   ========================================================== */
.writing-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    max-width: 960px;
    margin: 0 auto;
}

.writing-card {
    display: flex;
    align-items: stretch;
    gap: 0;
    padding: 0;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    color: inherit;
    overflow: hidden;
    transition: border-color 150ms var(--ease);
}

.writing-card:hover {
    border-color: var(--accent-border);
}

.writing-card:hover .writing-card-body h3 {
    color: var(--accent);
}

.writing-card-thumb {
    width: 80px;
    min-height: 80px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: var(--bg-code);
}

.writing-card-thumb i {
    font-size: 1.1rem;
    color: var(--text-muted);
    opacity: 0.5;
}

.writing-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.writing-card-body {
    flex: 1;
    min-width: 0;
    padding: 12px 16px;
}

.writing-card-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 4px;
}

.writing-pill {
    font-family: var(--mono);
    font-size: 0.5625rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.writing-pill-tds {
    color: var(--accent);
    font-weight: 700;
}

.writing-pill-blog {
    color: var(--green);
    font-weight: 600;
}

.writing-pill-medium {
    color: var(--text-muted);
    font-weight: 600;
}

.writing-card-body h3 {
    font-family: var(--heading-font);
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.03em;
    line-height: 1.4;
    margin-bottom: 2px;
    transition: color 150ms var(--ease);
}

.writing-card-body p {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.writing-card-foot {
    font-family: var(--mono);
    font-size: 0.625rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 5px;
}

.pub-more {
    margin-top: 24px;
}

/* ==========================================================
   ACHIEVEMENTS
   ========================================================== */
.achievements-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.achievement-card {
    display: flex;
    gap: 12px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}

.achievement-card:last-child { border-bottom: none; }

.achievement-icon {
    color: var(--text-muted);
    font-size: 1rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.achievement-card h3 {
    font-family: var(--heading-font);
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.03em;
    margin-bottom: 4px;
}

.achievement-card p {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ==========================================================
   CONTACT
   ========================================================== */
.contact-content {
    max-width: var(--max-w);
}

.contact-text {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    line-height: 1.7;
    margin-bottom: 24px;
}

.contact-socials {
    display: flex;
    gap: 16px;
    margin-top: 24px;
}

.contact-socials a {
    font-size: 1rem;
    color: var(--text-muted);
    transition: color 150ms var(--ease);
}

.contact-socials a:hover { color: var(--text-primary); }

/* ==========================================================
   FOOTER
   ========================================================== */
.footer {
    position: relative;
    z-index: 1;
    padding: 32px 0;
    border-top: 1px solid var(--border);
}

.footer p {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.footer strong { color: var(--text-secondary); }
.footer-sub { margin-top: 4px; }

.footer-sub a {
    color: var(--text-muted);
    font-size: 0.75rem;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: color 150ms var(--ease);
}

.footer-sub a:hover { color: var(--accent); }

/* ==========================================================
   ANIMATIONS — minimal
   ========================================================== */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.reveal {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ==========================================================
   RESPONSIVE
   ========================================================== */
@media (max-width: 768px) {
    :root { --nav-h: 50px; }
    .section { padding: 56px 0; }

    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 70%;
        max-width: 260px;
        height: 100vh;
        background: rgba(250, 250, 250, 0.97);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 16px;
        transition: right 200ms var(--ease);
        border-left: 1px solid var(--border);
    }

    .nav-links.open { right: 0; }
    .nav-toggle { display: flex; }

    .about-grid {
        grid-template-columns: 1fr;
    }

    .about-image-wrapper {
        width: 100px;
        height: 100px;
        border-radius: 50%;
    }

    .exp-card {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .exp-meta {
        flex-direction: row;
        align-items: center;
        gap: 12px;
    }

    .hero { padding: 120px 0 60px; }
    .hero-name { font-size: 2rem; }
    .hero-tags { gap: 6px; }
    .hero-tag { font-size: 0.6875rem; padding: 3px 10px; }

    .stack-grid { grid-template-columns: 1fr 1fr; }
    .writing-grid { grid-template-columns: 1fr; }
    .writing-card-body p { display: none; }

    .hero-cta {
        flex-direction: column;
    }

    .btn { width: 100%; max-width: 200px; justify-content: center; }
}

@media (max-width: 480px) {
    .container { padding: 0 16px; }
    .hero-content { padding: 0 16px; }
    .stack-grid { grid-template-columns: 1fr; }
}

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

@media print {
    .nav { display: none; }
    body { background: #fff; color: #000; }
    .section { padding: 24px 0; }
}
