:root,
[data-theme="light"] {
    --bg-primary: #f7f3e8;          /* warm paper cream */
    --bg-secondary: #fefbf2;        /* lighter paper sheet */
    --bg-tertiary: #ede5d0;         /* highlighter cream */
    --text-primary: #1f2331;        /* ink blue-black */
    --text-secondary: #545a72;      /* faded ink */
    --text-muted: #8e94a8;          /* light pencil */
    --accent: #e8602c;              /* marker orange */
    --accent-soft: rgba(232, 96, 44, 0.08);
    --accent-glow: rgba(232, 96, 44, 0.2);
    --border: rgba(31, 35, 49, 0.12);
    --grid-line: rgba(31, 35, 49, 0.06);
    --shadow: 0 10px 30px -15px rgba(31, 35, 49, 0.18);
    --shadow-lg: 0 20px 40px -15px rgba(31, 35, 49, 0.25);
    --navbar-bg: rgba(247, 243, 232, 0.88);
    --marker-yellow: rgba(255, 217, 61, 0.55);
    --marker-pink: rgba(255, 126, 182, 0.45);
    --marker-blue: rgba(86, 177, 255, 0.4);
    --marker-green: rgba(110, 197, 103, 0.45);
    --sticky-yellow: #fff8c4;
    --sticky-pink: #ffd6e7;
    --sticky-blue: #d4e8ff;
    --font-sans: 'Spectral', Georgia, serif;
    --font-display: 'Bricolage Grotesque', 'Inter', sans-serif;
    --font-serif: 'Bricolage Grotesque', 'Inter', sans-serif;
    --font-mono: 'IBM Plex Mono', 'SF Mono', monospace;
    --font-hand: 'Patrick Hand', cursive;
    --font-marker: 'Patrick Hand', cursive;
    --transition: cubic-bezier(0.645, 0.045, 0.355, 1);
    --container-max: 1200px;
}

[data-theme="dark"] {
    --bg-primary: #1a1d28;          /* chalkboard dark */
    --bg-secondary: #23273a;        /* slightly lighter board */
    --bg-tertiary: #2d324a;
    --text-primary: #e8e6dd;        /* chalk white */
    --text-secondary: #a0a4b8;      /* faded chalk */
    --text-muted: #5f6479;          /* dusty chalk */
    --accent: #ffd93d;              /* yellow chalk */
    --accent-soft: rgba(255, 217, 61, 0.1);
    --accent-glow: rgba(255, 217, 61, 0.25);
    --border: rgba(232, 230, 221, 0.12);
    --grid-line: rgba(232, 230, 221, 0.05);
    --shadow: 0 10px 30px -15px rgba(0, 0, 0, 0.7);
    --shadow-lg: 0 20px 40px -15px rgba(0, 0, 0, 0.9);
    --navbar-bg: rgba(26, 29, 40, 0.88);
    --marker-yellow: rgba(255, 217, 61, 0.25);
    --marker-pink: rgba(255, 126, 182, 0.25);
    --marker-blue: rgba(86, 177, 255, 0.25);
    --marker-green: rgba(110, 197, 103, 0.25);
    --sticky-yellow: #4d4a2a;
    --sticky-pink: #4d2d3d;
    --sticky-blue: #2d3d4d;
}

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

/* Honor HTML `hidden` attribute even when we override display in component CSS */
[hidden] { display: none !important; }

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-secondary);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        linear-gradient(var(--grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
    background-size: 28px 28px;
    background-position: center top;
    pointer-events: none;
    z-index: -1;
}

body::after {
    content: '';
    position: fixed;
    left: 96px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: rgba(232, 96, 44, 0.25);
    pointer-events: none;
    z-index: -1;
    box-shadow: 4px 0 0 rgba(232, 96, 44, 0.15);
}

@media (max-width: 900px) {
    body::after { display: none; }
}

.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 2rem;
}

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding: 1.25rem 0;
    background: var(--navbar-bg);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    z-index: 1000;
    transition: padding 0.3s var(--transition), border-color 0.3s var(--transition), background 0.4s ease;
    border-bottom: 1px solid transparent;
}

.navbar.scrolled {
    padding: 0.75rem 0;
    border-bottom-color: var(--border);
    box-shadow: 0 10px 30px -10px rgba(2, 12, 27, 0.7);
}

.nav-container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    font-family: var(--font-mono);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    letter-spacing: -0.02em;
}

.nav-logo .dot {
    color: var(--accent);
}

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

.nav-menu a {
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.2s ease;
    position: relative;
}

.nav-menu a::before {
    content: counter(nav) ".";
    counter-increment: nav;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--accent);
    margin-right: 0.4rem;
}

.nav-menu {
    counter-reset: nav;
}

.nav-menu a:hover {
    color: var(--accent);
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    width: 40px;
    height: 40px;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
}

.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--accent);
    transition: transform 0.3s var(--transition), opacity 0.2s ease;
    transform-origin: center;
}

/* Hero */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    position: relative;
    padding: 6rem 0 2rem;
}

.hero-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4rem;
    align-items: center;
}

.hero-content {
    max-width: 720px;
}

.hero-avatar {
    position: relative;
    animation: fadeUp 0.9s ease-out 0.25s backwards;
}

.avatar-frame {
    width: 320px;
    height: 320px;
    border-radius: 50%;
    padding: 4px;
    background: linear-gradient(135deg, var(--accent), rgba(100, 130, 255, 0.6));
    box-shadow:
        0 0 60px -10px var(--accent-glow),
        0 20px 60px -20px rgba(2, 12, 27, 0.9);
    position: relative;
    transition: transform 0.4s var(--transition), box-shadow 0.4s var(--transition);
}

.avatar-frame::before {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 1px dashed var(--border);
    opacity: 0.6;
    animation: spin 25s linear infinite;
}

.avatar-frame img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    background: var(--bg-secondary);
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    transform: translateZ(0);
    backface-visibility: hidden;
}

.avatar-frame:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow:
        0 0 80px -10px var(--accent-glow),
        0 30px 70px -20px rgba(2, 12, 27, 1);
}

.avatar-badge {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 100px;
    box-shadow: var(--shadow);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    white-space: nowrap;
}

.avatar-badge svg {
    color: var(--accent);
}

.avatar-badge a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.avatar-badge a:hover {
    color: var(--accent);
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.hero-greeting {
    font-family: var(--font-mono);
    color: var(--accent);
    font-size: 1rem;
    margin-bottom: 1.5rem;
    letter-spacing: 0.02em;
    animation: fadeUp 0.6s ease-out;
}

.hero-name {
    font-size: clamp(2.5rem, 8vw, 5rem);
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.05;
    letter-spacing: -0.03em;
    margin-bottom: 0.5rem;
    animation: fadeUp 0.8s ease-out 0.1s backwards;
}

.hero-tagline {
    font-size: clamp(1.75rem, 6vw, 4rem);
    font-weight: 700;
    color: var(--text-secondary);
    line-height: 1.1;
    letter-spacing: -0.03em;
    margin-bottom: 2rem;
    animation: fadeUp 0.8s ease-out 0.2s backwards;
}

.hero-description {
    font-size: 1.125rem;
    max-width: 600px;
    line-height: 1.7;
    margin-bottom: 3rem;
    animation: fadeUp 0.8s ease-out 0.3s backwards;
}

.hero-description .highlight {
    color: var(--accent);
    font-weight: 500;
}

.hero-cta {
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
    animation: fadeUp 0.8s ease-out 0.4s backwards;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.9rem 1.75rem;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.25s var(--transition);
    letter-spacing: 0.02em;
}

.btn-primary {
    background: var(--accent);
    color: var(--bg-primary);
    border-color: var(--accent);
}

.btn-primary:hover {
    background: transparent;
    color: var(--accent);
    transform: translateY(-3px);
    box-shadow: 0 10px 30px -10px var(--accent-glow);
}

.btn-secondary {
    background: transparent;
    color: var(--accent);
    border-color: var(--accent);
}

.btn-secondary:hover {
    background: var(--accent-soft);
    transform: translateY(-3px);
}

.btn-large {
    padding: 1.25rem 2.5rem;
    font-size: 1rem;
}

/* Hero socials */
.hero-socials {
    position: fixed;
    left: 2rem;
    bottom: 0;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: center;
    animation: fadeUp 1s ease-out 0.8s backwards;
    z-index: 10;
}

.hero-socials::after {
    content: '';
    width: 1px;
    height: 90px;
    background: var(--text-muted);
    margin-top: 1rem;
}

.hero-socials a {
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.hero-socials a:hover {
    color: var(--accent);
    transform: translateY(-3px);
}

.scroll-indicator {
    position: absolute;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    writing-mode: vertical-rl;
    animation: fadeUp 1s ease-out 1s backwards;
}

.scroll-line {
    width: 1px;
    height: 80px;
    background: linear-gradient(to bottom, var(--text-muted), transparent);
    writing-mode: horizontal-tb;
}

/* Sections */
.section {
    padding: 6rem 0;
    position: relative;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: clamp(1.75rem, 4vw, 2.25rem);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 3rem;
    letter-spacing: -0.02em;
}

.section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
    margin-left: 1rem;
    max-width: 300px;
}

.section-num {
    font-family: var(--font-mono);
    color: var(--accent);
    font-size: 1.25rem;
    font-weight: 400;
}

/* About */
.about-grid {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 4rem;
    align-items: start;
}

.about-text p {
    margin-bottom: 1.25rem;
    font-size: 1rem;
    line-height: 1.7;
}

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

.about-list {
    list-style: none;
    margin-top: 1.5rem;
}

.about-list li {
    position: relative;
    padding-left: 1.5rem;
    margin-bottom: 0.625rem;
    font-size: 0.95rem;
}

.about-list li::before {
    content: '▹';
    position: absolute;
    left: 0;
    color: var(--accent);
    font-size: 0.875rem;
}

.about-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.stat-card {
    padding: 1.75rem 1.25rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    text-align: center;
    transition: all 0.25s var(--transition);
}

.stat-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent);
    box-shadow: var(--shadow);
}

.stat-num {
    display: block;
    font-family: var(--font-mono);
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.825rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Experience */
.experience-container {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 2rem;
    min-height: 350px;
}

.tabs {
    display: flex;
    flex-direction: column;
    border-left: 2px solid var(--bg-tertiary);
}

.tab {
    background: none;
    border: none;
    color: var(--text-secondary);
    text-align: left;
    padding: 0.75rem 1.25rem;
    font-family: var(--font-mono);
    font-size: 0.825rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 2px solid transparent;
    margin-left: -2px;
}

.tab:hover {
    background: var(--accent-soft);
    color: var(--accent);
}

.tab.active {
    color: var(--accent);
    border-left-color: var(--accent);
    background: var(--accent-soft);
}

.tab-content-wrapper {
    padding: 0.5rem 0;
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease-out;
}

.tab-content.active {
    display: block;
}

.tab-content h3 {
    font-size: 1.375rem;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    font-weight: 600;
}

.tab-content .company {
    color: var(--accent);
}

.tab-content .duration {
    font-family: var(--font-mono);
    font-size: 0.825rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.tab-content ul {
    list-style: none;
}

.tab-content ul li {
    position: relative;
    padding-left: 1.5rem;
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
    line-height: 1.7;
}

.tab-content ul li::before {
    content: '▹';
    position: absolute;
    left: 0;
    color: var(--accent);
    top: 4px;
}

/* Projects */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
}

.project-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    padding: 2rem 1.75rem;
    border-radius: 8px;
    transition: all 0.25s var(--transition);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent), transparent);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.project-card:hover {
    transform: translateY(-7px);
    border-color: var(--accent);
    box-shadow: var(--shadow-lg);
}

.project-card:hover::before {
    transform: scaleX(1);
}

.project-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.project-icon {
    color: var(--accent);
}

.project-links {
    display: flex;
    gap: 1rem;
}

.project-links a {
    color: var(--text-secondary);
    transition: color 0.2s ease;
    display: flex;
}

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

.project-title {
    font-size: 1.375rem;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    font-weight: 600;
}

.project-subtitle {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--accent);
    margin-bottom: 1rem;
}

.project-description {
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
    flex: 1;
}

.tech-list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
    margin-top: auto;
}

.tech-list li {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Education / Timeline */
.timeline {
    position: relative;
    padding-left: 2rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: var(--bg-tertiary);
}

.timeline-item {
    position: relative;
    padding-bottom: 2.5rem;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-marker {
    position: absolute;
    left: -2.5rem;
    top: 0.5rem;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--bg-primary);
    border: 2px solid var(--accent);
    box-shadow: 0 0 0 4px var(--bg-primary), 0 0 20px var(--accent-glow);
}

.timeline-date {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--accent);
    margin-bottom: 0.25rem;
}

.timeline-content h3 {
    font-size: 1.25rem;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    font-weight: 600;
}

.institution {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-style: italic;
    margin-bottom: 0.625rem;
}

.timeline-content p:not(.institution) {
    font-size: 0.95rem;
    line-height: 1.6;
}

/* Skills */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.skill-category {
    padding: 1.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: all 0.25s var(--transition);
}

.skill-category:hover {
    transform: translateY(-4px);
    border-color: var(--accent);
    box-shadow: var(--shadow);
}

.skill-category h3 {
    color: var(--accent);
    font-size: 1.05rem;
    margin-bottom: 1.25rem;
    font-family: var(--font-mono);
    letter-spacing: 0.02em;
}

.skill-category ul {
    list-style: none;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.625rem;
}

.skill-category ul li {
    font-size: 0.875rem;
    color: var(--text-secondary);
    position: relative;
    padding-left: 1rem;
}

.skill-category ul li::before {
    content: '▹';
    position: absolute;
    left: 0;
    color: var(--accent);
    font-size: 0.75rem;
}

.certificates h3 {
    color: var(--text-primary);
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
}

.certificates-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.cert-tag {
    padding: 0.5rem 1rem;
    background: var(--accent-soft);
    border: 1px solid var(--border);
    border-radius: 100px;
    font-size: 0.825rem;
    color: var(--text-primary);
    font-family: var(--font-mono);
    transition: all 0.2s ease;
}

.cert-tag:hover {
    background: var(--accent);
    color: var(--bg-primary);
    transform: translateY(-2px);
}

/* Contact */
.contact {
    text-align: center;
    padding: 8rem 0;
}

.contact-pretitle {
    font-family: var(--font-mono);
    color: var(--accent);
    font-size: 1rem;
    margin-bottom: 1.25rem;
}

.contact-title {
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    letter-spacing: -0.03em;
}

.contact-description {
    max-width: 600px;
    margin: 0 auto 3rem;
    font-size: 1.0625rem;
    line-height: 1.7;
}

/* Footer */
.footer {
    padding: 3rem 0 2rem;
    text-align: center;
    border-top: 1px solid var(--bg-tertiary);
}

.footer-socials {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.footer-socials a {
    color: var(--text-secondary);
    text-decoration: none;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    transition: color 0.2s ease;
}

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

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

/* Animations */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

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

/* Responsive */
/* ===== Tablet (≤900px) ===== */
@media (max-width: 900px) {
    .hero-layout {
        grid-template-columns: 1fr;
        gap: 2.5rem;
        text-align: center;
    }
    .hero-content {
        max-width: 100%;
        order: 2;
    }
    .hero-avatar {
        order: 1;
        margin: 0 auto;
    }
    .avatar-frame {
        width: 220px;
        height: 220px;
    }
    .hero-description {
        margin-left: auto;
        margin-right: auto;
    }
    .hero-cta {
        justify-content: center;
    }
    .about-grid {
        grid-template-columns: 1fr;
        gap: 2.5rem;
    }
    .experience-container {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .tabs {
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        border-left: none;
        border-bottom: 2px solid var(--bg-tertiary);
        padding-bottom: 0;
        scroll-snap-type: x proximity;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .tabs::-webkit-scrollbar { display: none; }
    .tab {
        border-left: none;
        border-bottom: 2px solid transparent;
        margin-left: 0;
        margin-bottom: -2px;
        white-space: nowrap;
        scroll-snap-align: start;
        padding: 0.85rem 1.1rem;
    }
    .tab.active {
        border-bottom-color: var(--accent);
        border-left: none;
    }
    .hero-socials {
        position: static;
        flex-direction: row;
        justify-content: center;
        margin-top: 2.5rem;
        gap: 1.75rem;
    }
    .hero-socials::after { display: none; }
    .scroll-indicator { display: none; }
}

/* ===== Mobile (≤700px) ===== */
@media (max-width: 700px) {
    :root {
        --container-pad: max(1.1rem, env(safe-area-inset-left));
    }
    .nav-toggle { display: flex; }
    .navbar { padding: 0.9rem 0; }
    .navbar.scrolled { padding: 0.6rem 0; }
    .nav-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 78%;
        max-width: 360px;
        height: 100vh;
        height: 100dvh;
        background: var(--bg-secondary);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 1.75rem;
        transition: right 0.35s var(--transition);
        box-shadow: -10px 0 40px rgba(0, 0, 0, 0.4);
        padding: 0 1.5rem;
    }
    .nav-menu.open { right: 0; }
    .nav-menu a { font-size: 1.0625rem; }
    .nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
    .nav-toggle.open span:nth-child(2) { opacity: 0; }
    .nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
    body.nav-open { overflow: hidden; }

    .container, .nav-container {
        padding-left: var(--container-pad);
        padding-right: var(--container-pad);
    }
    .section { padding: 3.5rem 0; }
    .section-title {
        margin-bottom: 2rem;
        gap: 0.5rem;
    }
    .section-title::after { display: none; }
    .section-num { font-size: 1rem; }

    .hero {
        min-height: auto;
        padding: 5rem 0 3rem;
    }
    .hero-greeting { margin-bottom: 1rem; font-size: 0.9rem; }
    .hero-tagline { margin-bottom: 1.25rem; }
    .hero-description {
        font-size: 1rem;
        margin-bottom: 2.25rem;
    }
    .hero-cta {
        flex-direction: column;
        align-items: stretch;
        gap: 0.875rem;
    }
    .btn {
        text-align: center;
        padding: 1rem 1.5rem;
        min-height: 48px;
    }
    .avatar-frame {
        width: 200px;
        height: 200px;
    }
    .avatar-badge {
        font-size: 0.75rem;
        padding: 0.4rem 0.85rem;
    }

    .about-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    .stat-card { padding: 1.35rem 0.75rem; }
    .stat-num { font-size: 1.85rem; }
    .stat-label { font-size: 0.7rem; }

    .tab-content h3 { font-size: 1.2rem; }
    .tab-content ul li { font-size: 0.925rem; }

    .projects-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }
    .project-card { padding: 1.5rem 1.35rem; }

    .timeline { padding-left: 1.5rem; }
    .timeline-marker { left: -2rem; }
    .timeline-content h3 { font-size: 1.1rem; }
    .timeline-item { padding-bottom: 2rem; }

    .skills-grid { gap: 1rem; }
    .skill-category { padding: 1.4rem 1.25rem; }
    .skill-category ul { grid-template-columns: 1fr 1fr; }
    .cert-tag {
        font-size: 0.75rem;
        padding: 0.45rem 0.85rem;
    }

    .contact { padding: 5rem 0; }
    .contact-description {
        font-size: 1rem;
        margin-bottom: 2.25rem;
    }
    .btn-large {
        padding: 1.1rem 2rem;
        font-size: 0.95rem;
    }

    .footer { padding: 2.5rem 0 calc(1.5rem + env(safe-area-inset-bottom)); }
    .footer-socials {
        gap: 1.25rem;
        font-size: 0.8rem;
    }
}

/* ===== Small phones (≤420px) ===== */
@media (max-width: 420px) {
    .avatar-frame {
        width: 170px;
        height: 170px;
    }
    .avatar-badge {
        bottom: 0;
        font-size: 0.7rem;
    }
    .hero-name { letter-spacing: -0.04em; }
    .skill-category ul { grid-template-columns: 1fr; }
    .stat-num { font-size: 1.6rem; }
    .nav-logo { font-size: 1.3rem; }
}

/* ===== Touch device polish ===== */
@media (hover: none) and (pointer: coarse) {
    .project-card:hover,
    .stat-card:hover,
    .skill-category:hover,
    .avatar-frame:hover {
        transform: none;
    }
    .btn:active {
        transform: scale(0.97);
    }
    .tab { -webkit-tap-highlight-color: transparent; }
    .avatar-frame::before { animation: none; }
}

/* ===== Reduced motion ===== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ===== Landscape phones ===== */
@media (max-height: 500px) and (orientation: landscape) {
    .hero {
        min-height: auto;
        padding: 5rem 0 2rem;
    }
    .hero-layout {
        grid-template-columns: auto 1fr;
        text-align: left;
        gap: 2rem;
    }
    .hero-content { order: 1; }
    .hero-avatar { order: 0; }
    .avatar-frame { width: 160px; height: 160px; }
    .hero-cta { justify-content: flex-start; }
    .hero-description { margin-left: 0; }
}

/* ============================================
   INTERACTIVE FEATURES
   ============================================ */

html {
    transition: background-color 0.4s ease, color 0.4s ease;
}

body {
    transition: background-color 0.4s ease, color 0.4s ease;
}

/* ===== Scroll progress bar ===== */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0;
    background: linear-gradient(90deg, var(--accent), rgba(100, 255, 218, 0.5));
    box-shadow: 0 0 12px var(--accent-glow);
    z-index: 1100;
    transition: width 0.08s linear;
    pointer-events: none;
}

/* ===== Custom cursor (desktop only) ===== */
.cursor-dot,
.cursor-ring,
.cursor-spotlight {
    pointer-events: none;
    position: fixed;
    z-index: 9999;
    will-change: transform;
}

.cursor-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    top: 0;
    left: 0;
    transform: translate3d(-50%, -50%, 0);
    transition: transform 0.08s linear, width 0.2s, height 0.2s, opacity 0.2s;
    opacity: 0;
}

.cursor-ring {
    width: 36px;
    height: 36px;
    border: 1.5px solid var(--accent);
    border-radius: 50%;
    top: 0;
    left: 0;
    transform: translate3d(-50%, -50%, 0);
    transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), width 0.2s, height 0.2s, opacity 0.2s, background 0.2s;
    opacity: 0;
}

.cursor-spotlight {
    width: 600px;
    height: 600px;
    top: 0;
    left: 0;
    transform: translate3d(-50%, -50%, 0);
    background: radial-gradient(circle, var(--accent-soft) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 1;
    mix-blend-mode: screen;
}

body.cursor-active .cursor-dot,
body.cursor-active .cursor-ring {
    opacity: 1;
}

body.cursor-active .cursor-spotlight {
    opacity: 0.45;
}

body.cursor-hover .cursor-ring {
    width: 56px;
    height: 56px;
    background: var(--accent-soft);
}

body.cursor-hover .cursor-dot {
    opacity: 0;
}

@media (hover: none) and (pointer: coarse) {
    .cursor-dot, .cursor-ring, .cursor-spotlight { display: none !important; }
}

/* ===== Nav controls ===== */
.nav-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ctrl-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-primary);
    width: 38px;
    height: 38px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 600;
}

.ctrl-btn:hover {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent);
}

.lang-toggle {
    min-width: 44px;
}

.theme-toggle .icon-sun { display: none; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }
[data-theme="light"] .theme-toggle .icon-sun { display: block; }

/* ===== Typewriter ===== */
.type-target {
    color: var(--accent);
    font-weight: 700;
}

.type-cursor {
    display: inline-block;
    width: 3px;
    height: 0.95em;
    background: var(--accent);
    margin-left: 2px;
    vertical-align: -0.12em;
    animation: blink 1s steps(2, start) infinite;
}

@keyframes blink {
    50% { opacity: 0; }
}

/* ===== Working-on widget ===== */
.working-on {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 1rem;
    border: 1px solid var(--border);
    border-radius: 100px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 2.5rem;
    background: var(--accent-soft);
    animation: fadeUp 0.8s ease-out 0.45s backwards;
}

.working-on .working-value {
    color: var(--text-primary);
    font-weight: 500;
}

.working-on .working-sep { color: var(--text-muted); }

.working-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4ade80;
    box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.7);
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(74, 222, 128, 0); }
    100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); }
}

/* ===== Magnetic buttons ===== */
.magnetic {
    transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1),
                background 0.25s, color 0.25s, box-shadow 0.25s, border-color 0.25s;
    will-change: transform;
}

/* ===== 3D tilt ===== */
[data-tilt] {
    transform-style: preserve-3d;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform;
}

.projects-grid {
    perspective: 1000px;
}

.hero-avatar {
    perspective: 800px;
}

/* ===== Project filters ===== */
.project-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-bottom: 2rem;
}

.filter-pill {
    padding: 0.55rem 1.1rem;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    border-radius: 100px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.25s ease;
}

.filter-pill:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.filter-pill.active {
    background: var(--accent);
    color: var(--bg-primary);
    border-color: var(--accent);
}

.project-card.is-hidden {
    opacity: 0;
    transform: scale(0.92);
    pointer-events: none;
    position: absolute;
    visibility: hidden;
}

.project-card {
    transition: opacity 0.4s ease, transform 0.4s ease, border-color 0.25s, box-shadow 0.25s;
}

/* ===== ML Playground ===== */
.playground-desc {
    max-width: 720px;
    font-size: 1rem;
    line-height: 1.7;
    margin-bottom: 2.5rem;
}

.ml-demo {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
    position: relative;
    overflow: hidden;
}

.ml-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0;
}

.ml-bar .btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.model-status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: background 0.3s;
}

.model-status.loading .status-dot {
    background: #facc15;
    animation: pulse-dot 1.5s infinite;
}

.model-status.ready .status-dot {
    background: #4ade80;
    box-shadow: 0 0 8px rgba(74, 222, 128, 0.6);
}

.model-status.error .status-dot {
    background: #f87171;
}

.ml-workspace {
    margin-top: 2rem;
    display: grid;
    gap: 1.5rem;
}

.upload-area {
    border: 2px dashed var(--border);
    border-radius: 10px;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s ease;
    color: var(--text-secondary);
}

.upload-area svg { color: var(--accent); margin-bottom: 1rem; }

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--text-primary);
}

.upload-title {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.upload-hint {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.ml-examples .examples-label {
    font-family: var(--font-mono);
    font-size: 0.825rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.example-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 0.6rem;
}

.example-btn {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.85rem 0.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    font-family: var(--font-mono);
    font-size: 0.825rem;
}

.example-emoji { font-size: 1.5rem; }

.example-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-2px);
}

.ml-result {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-top: 1rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    animation: fadeIn 0.4s ease-out;
}

.result-image {
    background: var(--bg-primary);
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    display: flex;
    align-items: center;
    justify-content: center;
}

.result-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

.predictions h4 {
    color: var(--text-primary);
    font-size: 0.95rem;
    margin-bottom: 1rem;
    font-family: var(--font-mono);
}

.prediction-list {
    list-style: none;
    padding: 0;
    display: grid;
    gap: 0.65rem;
}

.prediction-item {
    display: grid;
    gap: 0.3rem;
}

.prediction-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 0.875rem;
}

.prediction-name {
    color: var(--text-primary);
    text-transform: capitalize;
}

.prediction-pct {
    color: var(--accent);
    font-family: var(--font-mono);
    font-weight: 500;
}

.prediction-bar {
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 100px;
    overflow: hidden;
}

.prediction-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), rgba(100, 255, 218, 0.5));
    border-radius: 100px;
    width: 0;
    transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.prediction-meta {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 1rem;
}

/* ===== Timeline progress line ===== */
.timeline {
    position: relative;
}

.timeline-progress {
    position: absolute;
    left: 0;
    top: 8px;
    width: 2px;
    height: 0;
    background: linear-gradient(to bottom, var(--accent), rgba(100, 255, 218, 0.4));
    z-index: 1;
    transition: height 0.1s linear;
    box-shadow: 0 0 8px var(--accent-glow);
}

.timeline-marker {
    transition: transform 0.4s var(--transition), background 0.4s, box-shadow 0.4s;
    z-index: 2;
}

.timeline-item.reached .timeline-marker {
    background: var(--accent);
    transform: scale(1.15);
}

/* ===== Stat counter ===== */
.stat-num {
    font-variant-numeric: tabular-nums;
}

/* ===== Konami overlay ===== */
.konami-overlay {
    position: fixed;
    inset: 0;
    background: rgba(2, 12, 27, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.konami-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.konami-card {
    background: var(--bg-secondary);
    border: 1px solid var(--accent);
    border-radius: 16px;
    padding: 3rem 2.5rem;
    text-align: center;
    max-width: 420px;
    box-shadow: 0 30px 70px -20px rgba(0, 0, 0, 0.6);
    transform: scale(0.85);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.konami-overlay.active .konami-card {
    transform: scale(1);
}

.konami-emoji {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: konami-bounce 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.konami-card h3 {
    color: var(--text-primary);
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
}

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

@keyframes konami-bounce {
    0% { transform: scale(0) rotate(-45deg); }
    60% { transform: scale(1.3) rotate(10deg); }
    100% { transform: scale(1) rotate(0); }
}

.confetti-piece {
    position: fixed;
    width: 10px;
    height: 14px;
    z-index: 2100;
    pointer-events: none;
    will-change: transform;
}

/* ===== Light theme polish ===== */
[data-theme="light"] body::before {
    background:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(0, 169, 136, 0.06), transparent),
        radial-gradient(ellipse 60% 40% at 80% 80%, rgba(74, 222, 128, 0.04), transparent);
}

[data-theme="light"] .hero-greeting,
[data-theme="light"] .contact-pretitle,
[data-theme="light"] .section-num,
[data-theme="light"] .timeline-date,
[data-theme="light"] .project-subtitle {
    color: var(--accent);
}

[data-theme="light"] .btn-primary:hover {
    color: var(--accent);
}

[data-theme="light"] .cursor-spotlight {
    mix-blend-mode: multiply;
    background: radial-gradient(circle, rgba(0, 169, 136, 0.12) 0%, transparent 60%);
}

/* ===== Mobile adjustments for new features ===== */
@media (max-width: 900px) {
    .ml-result {
        grid-template-columns: 1fr;
    }
    .working-on {
        align-self: center;
    }
}

@media (max-width: 700px) {
    .nav-controls { gap: 0.4rem; }
    .ctrl-btn {
        width: 36px;
        height: 36px;
    }
    .lang-toggle { min-width: 42px; }
    .scroll-progress { height: 2px; }
    .ml-demo { padding: 1.25rem; }
    .upload-area { padding: 2rem 1rem; }
    .example-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .working-on {
        font-size: 0.72rem;
        padding: 0.45rem 0.85rem;
        flex-wrap: wrap;
        justify-content: center;
    }
    .working-on .working-sep { display: none; }
    .konami-card { padding: 2.25rem 1.5rem; margin: 1rem; }
    .konami-emoji { font-size: 3rem; }
    .timeline-progress { left: 0; }
}

/* ============================================
   ML PLAYGROUND v2 — 4 tabs
   ============================================ */

.ml-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.5rem;
    margin-bottom: 1.25rem;
}

.ml-tab {
    flex: 1 1 calc(25% - 0.5rem);
    min-width: 140px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    padding: 0.75rem 0.85rem;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.ml-tab:hover {
    color: var(--accent);
    border-color: var(--border);
}

.ml-tab.active {
    background: var(--accent-soft);
    color: var(--accent);
    border-color: var(--accent);
}

.ml-tab-icon {
    font-size: 1.1rem;
    line-height: 1;
}

.ml-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
    animation: fadeIn 0.3s ease-out;
}

.ml-panel[hidden] { display: none; }

.ml-panel-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.5rem;
    flex-wrap: wrap;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

.ml-panel-meta {
    flex: 1;
    min-width: 240px;
}

.ml-panel-meta h3 {
    color: var(--text-primary);
    font-size: 1.05rem;
    font-family: var(--font-mono);
    margin-bottom: 0.4rem;
}

.ml-panel-meta p {
    font-size: 0.9rem;
    line-height: 1.55;
    color: var(--text-secondary);
}

.ml-panel-controls {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.6rem;
}

.ml-load-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.825rem;
    padding: 0.7rem 1.1rem;
}

/* Detector canvas */
.detector-canvas-wrap {
    background: var(--bg-primary);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 4 / 3;
}

.detector-canvas-wrap canvas {
    max-width: 100%;
    max-height: 100%;
    display: block;
}

/* Toxicity panel */
.text-input-wrap {
    display: grid;
    gap: 1rem;
}

textarea[data-input="toxicity"] {
    width: 100%;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    line-height: 1.5;
    resize: vertical;
    min-height: 90px;
    transition: border-color 0.2s ease;
}

textarea[data-input="toxicity"]:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.text-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.text-examples {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.text-example {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 0.45rem 0.85rem;
    border-radius: 100px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.text-example:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.toxicity-result {
    display: block;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.toxicity-result h4 {
    color: var(--text-primary);
    font-size: 0.95rem;
    margin-bottom: 1rem;
    font-family: var(--font-mono);
}

/* Webcam panel */
.webcam-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.webcam-hint {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0;
}

.webcam-video-wrap {
    background: var(--bg-primary);
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    display: flex;
    align-items: center;
    justify-content: center;
}

.webcam-video-wrap video {
    max-width: 100%;
    max-height: 100%;
    display: block;
    transform: scaleX(-1);
}

/* Per-dimension color hints in toxicity bars */
.prediction-item.high .prediction-fill { background: linear-gradient(90deg, #f87171, #fb923c); }
.prediction-item.medium .prediction-fill { background: linear-gradient(90deg, #facc15, #fb923c); }
.prediction-item.low .prediction-fill { background: linear-gradient(90deg, var(--accent), rgba(100, 255, 218, 0.5)); }

/* Responsive */
@media (max-width: 900px) {
    .ml-panel-head {
        flex-direction: column;
        align-items: stretch;
    }
    .ml-panel-controls {
        align-items: stretch;
    }
    .ml-load-btn { justify-content: center; }
    .ml-panel-controls .model-status {
        justify-content: center;
    }
}

@media (max-width: 700px) {
    .ml-panel { padding: 1.25rem; }
    .ml-tabs { padding: 0.4rem; gap: 0.3rem; }
    .ml-tab {
        flex: 1 1 calc(50% - 0.3rem);
        font-size: 0.72rem;
        padding: 0.6rem 0.5rem;
    }
    .ml-tab-label { font-size: 0.72rem; }
    .ml-tab-icon { font-size: 1rem; }
    .text-controls {
        flex-direction: column;
        align-items: stretch;
    }
    .text-examples { justify-content: center; }
}

/* ============================================
   FIXES: page jump + broken preview state
   ============================================ */

/* Reserve tagline height so typewriter doesn't shift layout */
.hero-tagline {
    min-height: 2.4em;
}

/* Reserve ML panel height so tab switching doesn't shift Education below */
.ml-panel {
    min-height: 540px;
}

/* Fix stat counter width — digit count varies (0 → 28) */
.stat-num {
    display: inline-block;
    text-align: center;
    min-width: 3ch;
}

/* Upload area loading state */
.upload-area.analyzing {
    border-color: var(--accent);
    background: var(--accent-soft);
    cursor: progress;
    position: relative;
}

.upload-area.analyzing .upload-title,
.upload-area.analyzing .upload-hint,
.upload-area.analyzing svg {
    opacity: 0.25;
}

.upload-area.analyzing::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 36px;
    height: 36px;
    margin: -18px 0 0 -18px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spinSpinner 0.8s linear infinite;
}

@keyframes spinSpinner {
    to { transform: rotate(360deg); }
}

/* Inline analyzing pill (for non-image demos) */
.analyzing-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.85rem;
    background: var(--accent-soft);
    border: 1px solid var(--accent);
    border-radius: 100px;
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

.analyzing-pill::before {
    content: '';
    width: 12px;
    height: 12px;
    border: 2px solid var(--accent);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spinSpinner 0.7s linear infinite;
}

/* Toast (error messages) */
.toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    background: var(--bg-secondary);
    border: 1px solid #f87171;
    border-radius: 8px;
    padding: 0.9rem 1.2rem;
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: var(--font-mono);
    box-shadow: var(--shadow-lg);
    z-index: 2100;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    transform: translateY(20px);
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.25s ease;
    max-width: calc(100vw - 3rem);
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast::before {
    content: '⚠';
    font-size: 1.1rem;
}

/* Better preview image background so even loading frame looks clean */
.result-image {
    background: var(--bg-tertiary);
}

.result-image img:not([src]),
.result-image img[src=""] {
    display: none;
}

@media (max-width: 700px) {
    .ml-panel { min-height: 480px; }
    .toast { left: 1rem; right: 1rem; bottom: 1rem; }
}

/* ============================================
   LAB NOTEBOOK THEME
   ============================================ */

/* Headings use serif feel */
.section-title {
    font-family: var(--font-serif);
    font-weight: 600;
    letter-spacing: -0.01em;
}

/* Section title becomes a Jupyter-style code cell header */
.section-title {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: 6px;
    padding: 0.85rem 1.25rem 0.85rem 3rem;
    position: relative;
    gap: 0.6rem;
    box-shadow: 0 1px 0 var(--border);
    font-size: clamp(1.5rem, 3vw, 1.85rem);
}

.section-title::before {
    content: 'In [' counter(sect-counter) ']:';
    counter-increment: sect-counter;
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--accent);
    letter-spacing: 0;
    font-style: normal;
}

body { counter-reset: sect-counter; }

/* Hide the original "01." numbering since we render "In [n]:" instead */
.section-title .section-num,
.contact-pretitle .section-num {
    display: none;
}

.section-title::after {
    display: none;
}

/* Contact pretitle becomes "In [N]:" style too */
.contact-pretitle {
    font-family: var(--font-mono);
    color: var(--accent);
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.contact-pretitle::before {
    content: 'In [' counter(sect-counter) ']:';
    counter-increment: sect-counter;
    font-family: var(--font-mono);
    color: var(--accent);
    margin-right: 0.4rem;
}

/* Hero name + tagline get serif accent */
.hero-name {
    font-family: var(--font-serif);
    font-weight: 700;
    letter-spacing: -0.02em;
}

.hero-tagline {
    font-family: var(--font-serif);
    font-weight: 500;
    color: var(--text-primary);
}

.hero-tagline .type-target {
    font-family: var(--font-serif);
    font-style: italic;
    font-weight: 600;
    color: var(--accent);
    text-decoration: underline;
    text-decoration-color: var(--marker-yellow);
    text-decoration-thickness: 0.4em;
    text-decoration-skip-ink: none;
    text-underline-offset: -0.15em;
}

.hero-greeting {
    font-family: var(--font-hand);
    font-weight: 500;
    color: var(--accent);
    font-size: 1.6rem;
    margin-bottom: 0.5rem;
    letter-spacing: 0;
    transform: rotate(-1deg);
    display: inline-block;
}

.hero-greeting::before {
    content: '//';
    margin-right: 0.4rem;
    opacity: 0.5;
}

/* Working-on widget becomes a hand-drawn sticker */
.working-on {
    font-family: var(--font-hand);
    font-size: 1.05rem;
    border: 2px dashed var(--accent);
    background: var(--marker-yellow);
    border-radius: 12px;
    color: var(--text-primary);
    transform: rotate(-1.5deg);
    box-shadow: 3px 3px 0 rgba(31, 35, 49, 0.1);
    padding: 0.65rem 1.1rem;
}

.working-on .working-value {
    font-family: var(--font-hand);
    font-weight: 600;
}

/* Avatar frame more "polaroid" */
.avatar-frame {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 12px 12px 60px;
    border: 1px solid var(--border);
    box-shadow:
        0 1px 0 rgba(31, 35, 49, 0.04),
        0 8px 24px -8px rgba(31, 35, 49, 0.2),
        var(--shadow);
    transform: rotate(2deg);
    transition: transform 0.4s var(--transition);
}

.avatar-frame::before {
    display: none;
}

.avatar-frame img {
    border-radius: 4px;
    aspect-ratio: 1 / 1;
}

.avatar-frame:hover {
    transform: rotate(0deg) translateY(-4px);
}

.avatar-badge {
    font-family: var(--font-hand);
    font-size: 1.05rem;
    bottom: 18px;
    transform: translateX(-50%) rotate(-3deg);
    border: 1px solid var(--border);
    background: var(--sticky-yellow);
    color: var(--text-primary);
}

.avatar-badge a { font-family: var(--font-hand); }

/* Project cards become "experiment result" papers with washi tape */
.project-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    box-shadow: 0 1px 0 var(--border), 0 8px 18px -10px rgba(31, 35, 49, 0.15);
    border-radius: 6px;
    position: relative;
}

.project-card::after {
    content: '';
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%) rotate(-1deg);
    width: 56px;
    height: 14px;
    background: var(--marker-yellow);
    border: 1px solid rgba(31, 35, 49, 0.06);
    border-radius: 1px;
    box-shadow: 0 1px 2px rgba(31, 35, 49, 0.1);
}

.project-card:nth-child(2)::after { background: var(--marker-pink); transform: translateX(-50%) rotate(2deg); }
.project-card:nth-child(3)::after { background: var(--marker-blue); transform: translateX(-50%) rotate(-2deg); left: 30%; }
.project-card:nth-child(4)::after { background: var(--marker-green); transform: translateX(-50%) rotate(1deg); left: 65%; }
.project-card:nth-child(5)::after { background: var(--marker-yellow); transform: translateX(-50%) rotate(-3deg); }
.project-card:nth-child(6)::after { background: var(--marker-pink); transform: translateX(-50%) rotate(2deg); left: 40%; }

.project-title {
    font-family: var(--font-serif);
    font-weight: 600;
}

.project-subtitle {
    font-family: var(--font-hand);
    font-size: 1rem;
}

/* Marker highlight utility */
.highlight {
    background: linear-gradient(transparent 55%, var(--marker-yellow) 55% 90%, transparent 90%);
    padding: 0 0.15em;
    color: var(--text-primary);
}

.hero-description .highlight:nth-of-type(1) { background: linear-gradient(transparent 55%, var(--marker-yellow) 55% 90%, transparent 90%); }
.hero-description .highlight:nth-of-type(2) { background: linear-gradient(transparent 55%, var(--marker-pink) 55% 90%, transparent 90%); }
.hero-description .highlight:nth-of-type(3) { background: linear-gradient(transparent 55%, var(--marker-blue) 55% 90%, transparent 90%); }

/* Stat cards become index cards */
.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    box-shadow: 0 1px 0 var(--border), 2px 3px 0 rgba(31, 35, 49, 0.04);
    border-radius: 4px;
    transform: rotate(-0.5deg);
}

.stat-card:nth-child(2) { transform: rotate(0.8deg); }
.stat-card:nth-child(3) { transform: rotate(-0.8deg); }
.stat-card:nth-child(4) { transform: rotate(0.5deg); }

.stat-card:hover { transform: rotate(0) translateY(-4px); border-color: var(--accent); }

.stat-num {
    font-family: var(--font-serif);
    font-weight: 700;
    color: var(--accent);
}

.stat-label {
    font-family: var(--font-hand);
    font-size: 1rem;
    text-transform: none;
    letter-spacing: 0;
}

/* Filter pills become marker buttons */
.filter-pill, .ml-tab, .tab {
    font-family: var(--font-mono);
}

.filter-pill.active {
    background: var(--accent);
    color: var(--bg-secondary);
}

/* Skill categories — index cards */
.skill-category {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    box-shadow: 0 1px 0 var(--border), 3px 4px 0 rgba(31, 35, 49, 0.04);
}

.skill-category h3 {
    font-family: var(--font-mono);
    color: var(--accent);
}

.skill-category ul li::before {
    content: '✓';
    color: var(--accent);
    font-family: var(--font-mono);
}

.cert-tag {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    font-family: var(--font-mono);
}

.cert-tag:nth-child(odd):hover {
    background: var(--marker-yellow);
    color: var(--text-primary);
    border-color: rgba(31, 35, 49, 0.1);
    transform: rotate(-1deg) translateY(-2px);
}

.cert-tag:nth-child(even):hover {
    background: var(--marker-pink);
    color: var(--text-primary);
    border-color: rgba(31, 35, 49, 0.1);
    transform: rotate(1deg) translateY(-2px);
}

/* Timeline — looser, hand-drawn marker line */
.timeline::before {
    background: rgba(232, 96, 44, 0.18);
    width: 2px;
}

.timeline-progress {
    background: var(--accent);
    width: 2px;
    box-shadow: 1px 0 0 var(--marker-yellow);
}

.timeline-marker {
    background: var(--bg-primary);
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--bg-primary), 0 0 0 6px rgba(232, 96, 44, 0.15);
}

.timeline-date {
    font-family: var(--font-hand);
    font-size: 1.05rem;
    color: var(--accent);
}

.timeline-content h3 {
    font-family: var(--font-serif);
    font-weight: 600;
}

.timeline-content .institution {
    font-family: var(--font-hand);
    font-size: 1rem;
    font-style: normal;
    color: var(--text-secondary);
}

/* Experience tabs — marker tabs */
.tabs { border-color: var(--border); }
.tab.active { background: var(--marker-yellow); color: var(--text-primary); }

.tab-content h3 { font-family: var(--font-serif); font-weight: 600; }
.tab-content .company { color: var(--accent); font-family: var(--font-mono); font-size: 0.95rem; }
.tab-content .duration { font-family: var(--font-hand); font-size: 1.05rem; color: var(--text-secondary); }

/* Contact title */
.contact-title { font-family: var(--font-serif); font-weight: 700; }
.contact-pretitle { font-family: var(--font-mono); }

/* Buttons */
.btn {
    font-family: var(--font-mono);
    border-radius: 4px;
}

.btn-primary {
    box-shadow: 2px 3px 0 rgba(31, 35, 49, 0.15);
}

.btn-primary:hover {
    box-shadow: 4px 5px 0 rgba(232, 96, 44, 0.3);
    transform: translateY(-3px);
}

/* Sticky notes — placed inline via HTML */
.sticky-note {
    display: inline-block;
    background: var(--sticky-yellow);
    border: 1px solid rgba(31, 35, 49, 0.1);
    box-shadow: 2px 3px 0 rgba(31, 35, 49, 0.08);
    padding: 0.6rem 0.9rem;
    border-radius: 2px;
    font-family: var(--font-hand);
    font-size: 1.05rem;
    color: var(--text-primary);
    transform: rotate(-2deg);
    position: relative;
    line-height: 1.3;
    margin: 1rem 0;
}

.sticky-note::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%) rotate(-3deg);
    width: 40px;
    height: 10px;
    background: rgba(232, 96, 44, 0.3);
    border-radius: 1px;
}

.sticky-note.pink { background: var(--sticky-pink); transform: rotate(1.5deg); }
.sticky-note.blue { background: var(--sticky-blue); transform: rotate(-1deg); }

.sticky-note .arrow {
    font-family: var(--font-hand);
    margin: 0 0.3rem;
}

/* Hand-drawn arrow utility */
.arrow-down {
    display: inline-block;
    font-family: var(--font-hand);
    font-size: 2rem;
    color: var(--accent);
    transform: rotate(-12deg);
}

/* Code-cell wrapper around ML panels */
.ml-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    box-shadow: 0 2px 0 var(--border), 0 16px 28px -16px rgba(31, 35, 49, 0.15);
}

.ml-panel-meta h3 {
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--text-primary);
}

.ml-panel-meta p {
    font-family: var(--font-serif);
    font-size: 0.95rem;
}

.ml-tab.active {
    background: var(--marker-yellow);
    border-color: var(--accent);
    color: var(--text-primary);
}

/* Hero CTA buttons — paper button */
.btn-secondary {
    background: var(--bg-secondary);
    border-color: var(--accent);
}

/* Nav becomes lighter / more notebook-like */
.nav-logo {
    font-family: var(--font-serif);
    font-weight: 700;
    font-style: italic;
}

.nav-menu a {
    font-family: var(--font-mono);
}

.nav-menu a::before {
    color: var(--accent);
}

/* Footer */
.footer-credit {
    font-family: var(--font-hand);
    font-size: 1rem;
}

/* Konami coffee → notebook eraser-pencil */
.konami-emoji { font-size: 4rem; }

/* Decorative formula in margins (deep, decorative) */
.margin-formula {
    position: absolute;
    font-family: var(--font-serif);
    font-style: italic;
    color: var(--text-muted);
    opacity: 0.45;
    pointer-events: none;
    font-size: 1rem;
    user-select: none;
    z-index: 0;
}

.margin-formula.top-right {
    top: 1.5rem;
    right: 1.5rem;
    transform: rotate(8deg);
}

.margin-formula.bottom-left {
    bottom: 1.5rem;
    left: 1.5rem;
    transform: rotate(-6deg);
}

.section { position: relative; }
.section > .container { position: relative; z-index: 1; }

/* Hand-drawn doodle borders */
.doodle-border {
    border: 2px solid var(--text-primary);
    border-radius: 8px;
    box-shadow: 4px 4px 0 var(--accent);
}

/* Scroll progress — marker stroke */
.scroll-progress {
    background: var(--accent);
    box-shadow: 0 0 0 var(--accent-glow);
    height: 4px;
}

/* Avatar bg gradient swap */
.avatar-frame {
    background-image: none;
    background-color: var(--bg-secondary);
}

/* Light theme polish — paper specific tweaks */
[data-theme="light"] .ml-tab.active { color: var(--text-primary); }
[data-theme="light"] .filter-pill.active { color: var(--bg-secondary); }
[data-theme="light"] .working-on { color: var(--text-primary); }
[data-theme="light"] .stat-num { color: var(--accent); }
[data-theme="light"] .navbar { border-bottom: 1px solid var(--border); }
[data-theme="light"] body { color: var(--text-secondary); }
[data-theme="light"] .hero-greeting { color: #c84614; }

/* Override cursor spotlight blend */
[data-theme="light"] .cursor-spotlight {
    mix-blend-mode: multiply;
    background: radial-gradient(circle, rgba(232, 96, 44, 0.08) 0%, transparent 60%);
}

[data-theme="light"] .cursor-dot,
[data-theme="light"] .cursor-ring { mix-blend-mode: multiply; }

/* Dark theme polish — chalkboard */
[data-theme="dark"] body::before {
    background-image:
        linear-gradient(rgba(232, 230, 221, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(232, 230, 221, 0.05) 1px, transparent 1px);
}

[data-theme="dark"] body::after {
    background: rgba(255, 217, 61, 0.3);
    box-shadow: 4px 0 0 rgba(255, 217, 61, 0.15);
}

[data-theme="dark"] .working-on,
[data-theme="dark"] .ml-tab.active,
[data-theme="dark"] .tab.active {
    color: var(--bg-primary);
}

[data-theme="dark"] .btn-primary {
    color: var(--bg-primary);
}

[data-theme="dark"] .btn-primary:hover {
    color: var(--accent);
    background: transparent;
}

/* ============================================
   PLAYGROUND PUSH — go more whimsical
   ============================================ */

/* DROP the code-cell look on section titles, replace with banner + emoji */
.section-title {
    background: transparent;
    border: none;
    border-left: none;
    padding: 0;
    box-shadow: none;
    font-family: var(--font-serif);
    font-weight: 700;
    font-size: clamp(2rem, 4.5vw, 3rem);
    color: var(--text-primary);
    line-height: 1.1;
    margin-bottom: 2.5rem;
    position: relative;
    display: inline-flex;
    align-items: baseline;
    gap: 0.6rem;
    transform: rotate(-0.5deg);
}

.section-title::before {
    content: 'In [' counter(sect-counter) ']:';
    counter-increment: sect-counter;
    position: static;
    transform: none;
    font-family: var(--font-hand);
    font-size: 0.55em;
    font-weight: 600;
    color: var(--accent);
    background: var(--marker-yellow);
    padding: 0.2em 0.5em;
    border-radius: 4px;
    transform: rotate(-3deg);
    display: inline-block;
}

/* Hand-drawn squiggle underline under section title */
.section-title::after {
    content: '';
    position: absolute;
    left: 0;
    right: -1rem;
    bottom: -0.35em;
    height: 12px;
    display: block !important;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 12' preserveAspectRatio='none'><path d='M0,6 Q20,0 40,6 T80,6 T120,6 T160,6 T200,6 T240,6 T280,6 T320,6 T360,6 T400,6' fill='none' stroke='%23e8602c' stroke-width='3' stroke-linecap='round'/></svg>");
    background-repeat: no-repeat;
    background-size: 100% 100%;
    z-index: -1;
    opacity: 0.65;
    max-width: none;
    margin: 0;
}

/* Random emojis at section title start — via data attribute would be ideal but here as decoration */
#about .section-title::after { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 12' preserveAspectRatio='none'><path d='M0,6 Q20,0 40,6 T80,6 T120,6 T160,6 T200,6 T240,6 T280,6 T320,6 T360,6 T400,6' fill='none' stroke='%23ff7eb6' stroke-width='3' stroke-linecap='round'/></svg>"); }
#experience .section-title::after { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 12' preserveAspectRatio='none'><path d='M0,6 Q20,0 40,6 T80,6 T120,6 T160,6 T200,6 T240,6 T280,6 T320,6 T360,6 T400,6' fill='none' stroke='%2356b1ff' stroke-width='3' stroke-linecap='round'/></svg>"); }
#projects .section-title::after { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 12' preserveAspectRatio='none'><path d='M0,6 Q20,0 40,6 T80,6 T120,6 T160,6 T200,6 T240,6 T280,6 T320,6 T360,6 T400,6' fill='none' stroke='%236ec567' stroke-width='3' stroke-linecap='round'/></svg>"); }
#playground .section-title::after { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 12' preserveAspectRatio='none'><path d='M0,6 Q20,0 40,6 T80,6 T120,6 T160,6 T200,6 T240,6 T280,6 T320,6 T360,6 T400,6' fill='none' stroke='%23e8602c' stroke-width='3' stroke-linecap='round'/></svg>"); }
#education .section-title::after { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 12' preserveAspectRatio='none'><path d='M0,6 Q20,0 40,6 T80,6 T120,6 T160,6 T200,6 T240,6 T280,6 T320,6 T360,6 T400,6' fill='none' stroke='%23ffd93d' stroke-width='3' stroke-linecap='round'/></svg>"); }
#skills .section-title::after { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 12' preserveAspectRatio='none'><path d='M0,6 Q20,0 40,6 T80,6 T120,6 T160,6 T200,6 T240,6 T280,6 T320,6 T360,6 T400,6' fill='none' stroke='%23ff7eb6' stroke-width='3' stroke-linecap='round'/></svg>"); }

/* Star burst doodles in section corners */
.section::before {
    content: '';
    position: absolute;
    width: 70px;
    height: 70px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e8602c' stroke-width='1.5' stroke-linecap='round'><path d='M12 2 L13 9 L20 10 L13 11 L12 18 L11 11 L4 10 L11 9 Z'/></svg>");
    background-repeat: no-repeat;
    background-size: contain;
    top: 3rem;
    right: 4rem;
    opacity: 0.18;
    pointer-events: none;
    transform: rotate(15deg);
    z-index: 0;
}

.section.about::before { transform: rotate(15deg); top: 4rem; right: 5%; }
.section.experience::before {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2356b1ff' stroke-width='1.5'><path d='M2,12 Q6,4 12,12 T22,12' stroke-linecap='round'/></svg>");
    top: 3rem; right: 3%; width: 100px; height: 50px;
    transform: rotate(-10deg); opacity: 0.25;
}
.section.projects::before {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236ec567' stroke-width='1.5' stroke-linecap='round'><circle cx='12' cy='12' r='3'/><path d='M12 2 L12 6 M12 18 L12 22 M2 12 L6 12 M18 12 L22 12 M4.93 4.93 L7.76 7.76 M16.24 16.24 L19.07 19.07 M4.93 19.07 L7.76 16.24 M16.24 7.76 L19.07 4.93'/></svg>");
    top: 5rem; right: 4%;
}
.section.playground::before {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e8602c' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'><path d='M4 4 Q12 -2 20 4 Q26 12 20 20 Q12 26 4 20 Q-2 12 4 4 Z'/><circle cx='10' cy='10' r='1'/><circle cx='15' cy='12' r='1'/><circle cx='12' cy='15' r='1'/></svg>");
    top: 4rem; right: 6%;
}

/* Sticky note (interactive scattered around) */
.scattered-note {
    position: absolute;
    background: var(--sticky-yellow);
    border: 1px solid rgba(31, 35, 49, 0.1);
    box-shadow: 3px 4px 0 rgba(31, 35, 49, 0.08);
    padding: 0.7rem 1rem;
    border-radius: 2px;
    font-family: var(--font-hand);
    font-size: 1.1rem;
    color: var(--text-primary);
    transform: rotate(-3deg);
    line-height: 1.3;
    z-index: 2;
    max-width: 180px;
}

.scattered-note.pink { background: var(--sticky-pink); transform: rotate(3deg); }
.scattered-note.blue { background: var(--sticky-blue); transform: rotate(-2deg); }

.scattered-note::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%) rotate(-2deg);
    width: 36px;
    height: 8px;
    background: rgba(232, 96, 44, 0.35);
    border-radius: 1px;
}

/* Hand-drawn arrow doodle */
.doodle-arrow {
    position: absolute;
    pointer-events: none;
    color: var(--accent);
    font-family: var(--font-hand);
    font-size: 1.1rem;
    line-height: 1.2;
    z-index: 1;
}

.doodle-arrow svg {
    width: 60px;
    height: 50px;
}

/* Make project cards feel more like polaroid w/ caption strip */
.project-card {
    padding-bottom: 2.5rem;
}

.project-card::before {
    transform-origin: top left;
    transform: scaleX(0);
}

/* Random rotation on project cards (no rotation but slight tilt) */
.projects-grid > .project-card:nth-child(odd) { transform: rotate(-0.6deg); }
.projects-grid > .project-card:nth-child(even) { transform: rotate(0.6deg); }
.projects-grid > .project-card:hover { transform: rotate(0) translateY(-5px); z-index: 5; }

/* Tab content gets handwritten margin notes */
.tab-content::before {
    content: '✏️';
    position: absolute;
    top: 0;
    left: -2.5rem;
    font-size: 1.5rem;
    opacity: 0.7;
    transform: rotate(-15deg);
}

.tab-content { position: relative; }

/* Hero adds floating doodles around avatar */
.hero-avatar {
    position: relative;
}

.hero-avatar::after {
    content: '✨';
    position: absolute;
    font-size: 2rem;
    top: -10px;
    right: -10px;
    z-index: 3;
    animation: bobble 3s ease-in-out infinite;
}

@keyframes bobble {
    0%, 100% { transform: translateY(0) rotate(0); }
    50% { transform: translateY(-8px) rotate(15deg); }
}

/* Hero greeting bigger */
.hero-greeting {
    font-size: 2rem;
}

/* CTA buttons softer */
.btn-primary {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    border-radius: 100px;
    font-weight: 600;
}

.btn-secondary {
    border-radius: 100px;
    border-width: 2px;
    font-weight: 600;
}

/* Filter pills + ml tabs rounder, more sticker-like */
.filter-pill, .ml-tab {
    border-radius: 100px;
    border-width: 1.5px;
}

.filter-pill.active {
    box-shadow: 2px 3px 0 rgba(31, 35, 49, 0.2);
    transform: rotate(-1.5deg);
}

/* Avatar bigger handwriting badge */
.avatar-badge { font-size: 1.1rem; }

/* Tagline more obvious marker highlight */
.hero-tagline .type-target {
    background: var(--marker-yellow);
    text-decoration: none;
    padding: 0 0.15em;
    border-radius: 4px;
    box-shadow: 2px 3px 0 rgba(31, 35, 49, 0.08);
    color: var(--text-primary);
    font-style: italic;
}

/* Stat numbers bigger, more "score" feel */
.stat-num { font-size: 2.8rem; }

/* Skill list items playful */
.skill-category ul li::before { content: '★'; color: var(--marker-yellow); }
.skill-category:nth-child(1) ul li::before { color: var(--accent); content: '✓'; }
.skill-category:nth-child(2) ul li::before { color: #56b1ff; content: '◆'; }
.skill-category:nth-child(3) ul li::before { color: #6ec567; content: '⬡'; }
.skill-category:nth-child(4) ul li::before { color: #ff7eb6; content: '♥'; }

/* Section title — explicit emoji per section title (added via JS data) */
.section-title .emoji {
    font-size: 1.2em;
    margin-right: 0.2em;
    display: inline-block;
    transform: translateY(-0.05em);
}

/* Avatar wrapper slight tilt */
.hero-avatar { transform: rotate(-2deg); transition: transform 0.4s ease; }
.hero-avatar:hover { transform: rotate(0); }

/* Confetti-like background dots (very subtle) */
.hero {
    background-image:
        radial-gradient(circle at 10% 20%, rgba(255, 217, 61, 0.15) 0, transparent 2px),
        radial-gradient(circle at 80% 70%, rgba(255, 126, 182, 0.2) 0, transparent 3px),
        radial-gradient(circle at 30% 80%, rgba(86, 177, 255, 0.18) 0, transparent 2px),
        radial-gradient(circle at 90% 30%, rgba(110, 197, 103, 0.18) 0, transparent 3px),
        radial-gradient(circle at 50% 50%, rgba(232, 96, 44, 0.1) 0, transparent 2px);
}

/* Cursor: keep but reduce dot/ring sizing to feel more "pencil" */
[data-theme="light"] .cursor-dot { background: var(--accent); }
[data-theme="light"] .cursor-ring { border-color: var(--accent); }


/* ============================================
   FONT REFRESH + RICHER BACKGROUND
   ============================================ */

/* Apply new fonts globally */
body { font-family: var(--font-sans); }

.hero-name {
    font-family: var(--font-marker);
    font-weight: 400;
    font-size: clamp(3rem, 9vw, 6rem);
    line-height: 0.95;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

.hero-tagline {
    font-family: var(--font-display);
    font-weight: 500;
    color: var(--text-primary);
}

.hero-tagline .type-target {
    font-family: var(--font-marker);
    font-style: normal;
    font-weight: 400;
    background: var(--marker-yellow);
    color: var(--text-primary);
}

.section-title {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: -0.02em;
}

.project-title, .timeline-content h3, .tab-content h3, .contact-title {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: -0.01em;
}

.stat-num {
    font-family: var(--font-display);
    font-weight: 800;
}

.hero-greeting {
    font-family: var(--font-marker);
    font-size: 1.7rem;
    color: #ff7eb6;
    transform: rotate(-2deg);
    letter-spacing: 0.5px;
}

.hero-greeting::before { display: none; }

.avatar-badge, .avatar-badge a,
.working-on, .working-on .working-value {
    font-family: var(--font-hand);
    font-size: 1.4rem;
    letter-spacing: 0.5px;
}

.footer-credit {
    font-family: var(--font-hand);
    font-size: 1.25rem;
}

.timeline-date, .project-subtitle,
.stat-label, .institution {
    font-family: var(--font-hand);
    font-size: 1.3rem;
    font-style: normal;
    letter-spacing: 0.5px;
}

.tab-content .duration { font-family: var(--font-hand); font-size: 1.25rem; }

.scattered-note, .sticky-note { font-family: var(--font-hand); font-size: 1.35rem; }

/* Section-title sticker uses marker font for stand-out */
.section-title::before {
    font-family: var(--font-marker);
    font-size: 0.5em;
    background: var(--marker-yellow);
    color: var(--accent);
    padding: 0.25em 0.7em;
    border-radius: 6px;
    transform: rotate(-4deg);
}

/* Nav logo BEKA. — bold marker */
.nav-logo {
    font-family: var(--font-marker);
    font-size: 1.8rem;
    font-style: normal;
    letter-spacing: 1px;
    color: var(--text-primary);
    transform: rotate(-2deg);
    display: inline-block;
}

.nav-logo .dot { color: var(--accent); }
.nav-logo:hover { transform: rotate(2deg); }

/* Nav links smaller, friendlier */
.nav-menu a { font-family: var(--font-sans); font-size: 0.95rem; font-weight: 500; }
.nav-menu a::before { font-family: var(--font-mono); }

/* === BACKGROUND TEXTURE === */
body::before {
    background-image:
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.122 0 0 0 0 0.137 0 0 0 0 0.192 0 0 0 0.07 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>"),
        linear-gradient(var(--grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
    background-size: 220px 220px, 28px 28px, 28px 28px;
    background-position: 0 0, center top, center top;
}

[data-theme="dark"] body::before {
    background-image:
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.91 0 0 0 0 0.9 0 0 0 0 0.86 0 0 0 0.04 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>"),
        linear-gradient(rgba(232, 230, 221, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(232, 230, 221, 0.05) 1px, transparent 1px);
}

/* === SCATTERED FLOATING DOODLES === */
.section .container::before,
.section .container::after {
    content: '';
    position: absolute;
    pointer-events: none;
    background-repeat: no-repeat;
    background-size: contain;
    z-index: 0;
}

.section.about .container::before {
    width: 90px; height: 90px;
    top: 8rem; left: -3rem;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' fill='none' stroke='%23ff7eb6' stroke-width='2.5' stroke-linecap='round'><path d='M20,50 Q30,20 50,50 Q70,80 80,50' /><circle cx='50' cy='50' r='6' fill='%23ff7eb6'/></svg>");
    transform: rotate(15deg); opacity: 0.5;
}

.section.about .container::after {
    width: 60px; height: 60px;
    bottom: 4rem; right: -2rem;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' fill='none' stroke='%23e8602c' stroke-width='3' stroke-linecap='round'><path d='M20,50 L80,50 M50,20 L50,80 M30,30 L70,70 M70,30 L30,70'/></svg>");
    transform: rotate(-10deg); opacity: 0.4;
}

.section.experience .container::before {
    width: 80px; height: 80px;
    top: 6rem; right: -1rem;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' fill='%2356b1ff'><circle cx='30' cy='30' r='4'/><circle cx='60' cy='25' r='3'/><circle cx='75' cy='55' r='5'/><circle cx='45' cy='60' r='3'/><circle cx='25' cy='70' r='4'/></svg>");
    opacity: 0.45;
}

.section.projects .container::before {
    width: 100px; height: 100px;
    top: 10rem; left: -4rem;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' fill='none' stroke='%236ec567' stroke-width='2' stroke-linecap='round'><path d='M50,15 L55,40 L80,40 L60,55 L70,80 L50,65 L30,80 L40,55 L20,40 L45,40 Z'/></svg>");
    opacity: 0.35; transform: rotate(-12deg);
}

.section.projects .container::after {
    width: 70px; height: 70px;
    bottom: 8rem; right: -2rem;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' fill='none' stroke='%23ffd93d' stroke-width='3' stroke-linecap='round'><path d='M20,80 L40,40 L60,60 L80,20' /></svg>");
    opacity: 0.5; transform: rotate(5deg);
}

.section.playground .container::before {
    width: 90px; height: 90px;
    top: 7rem; right: -1rem;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' fill='none' stroke='%23e8602c' stroke-width='2.5' stroke-linecap='round'><circle cx='30' cy='30' r='8'/><circle cx='70' cy='30' r='8'/><circle cx='30' cy='70' r='8'/><circle cx='70' cy='70' r='8'/><path d='M30,30 L70,70 M70,30 L30,70'/></svg>");
    opacity: 0.3; transform: rotate(15deg);
}

.section.education .container::before {
    width: 80px; height: 80px;
    top: 6rem; right: -2rem;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' fill='%23ff7eb6'><path d='M50,15 L60,40 L85,42 L65,58 L72,82 L50,70 L28,82 L35,58 L15,42 L40,40 Z'/></svg>");
    opacity: 0.35; transform: rotate(-8deg);
}

.section.skills .container::before {
    width: 100px; height: 60px;
    bottom: 4rem; left: -3rem;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 60' fill='none' stroke='%2356b1ff' stroke-width='2.5' stroke-linecap='round'><path d='M10,30 Q20,10 30,30 T50,30 T70,30 T90,30'/></svg>");
    opacity: 0.4; transform: rotate(-6deg);
}

.section.contact .container::before {
    width: 100px; height: 100px;
    top: 4rem; left: 5%;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' fill='%23e8602c'><path d='M20,30 L80,30 L80,70 L50,55 L20,70 Z' opacity='0.7'/><path d='M20,30 L50,55 L80,30' fill='none' stroke='%23ffd93d' stroke-width='2'/></svg>");
    opacity: 0.3; transform: rotate(8deg);
}

/* Floating dots/stars in hero */
.hero {
    background-image:
        radial-gradient(circle at 10% 20%, rgba(255, 217, 61, 0.4) 0, transparent 4px),
        radial-gradient(circle at 80% 70%, rgba(255, 126, 182, 0.45) 0, transparent 5px),
        radial-gradient(circle at 30% 80%, rgba(86, 177, 255, 0.4) 0, transparent 4px),
        radial-gradient(circle at 90% 30%, rgba(110, 197, 103, 0.4) 0, transparent 5px),
        radial-gradient(circle at 50% 50%, rgba(232, 96, 44, 0.25) 0, transparent 3px),
        radial-gradient(circle at 15% 60%, rgba(255, 126, 182, 0.3) 0, transparent 3px),
        radial-gradient(circle at 75% 15%, rgba(110, 197, 103, 0.35) 0, transparent 4px),
        radial-gradient(circle at 60% 40%, rgba(86, 177, 255, 0.3) 0, transparent 3px);
    background-size: 100% 100%;
    background-repeat: no-repeat;
}

/* Make sure decorative pseudos sit behind */
.section .container { position: relative; }
.section .container > * { position: relative; z-index: 1; }

/* Re-style buttons with new font */
.btn { font-family: var(--font-mono); font-weight: 500; letter-spacing: 0.5px; }
.filter-pill, .ml-tab, .tab { font-family: var(--font-mono); }

/* Description / body text uses new sans */
.hero-description, .about-text p, .tab-content ul li,
.playground-desc, .ml-panel-meta p,
.contact-description { font-family: var(--font-sans); }

/* Margin formula uses display serif */
.margin-formula { font-family: var(--font-display); font-style: italic; }


/* ============================================
   COMBO C: Editorial Magazine override
   ============================================ */

/* Hero name in italic Fraunces — signature editorial look */
.hero-name {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 700;
    font-size: clamp(3rem, 8.5vw, 5.5rem);
    line-height: 1;
    letter-spacing: -0.025em;
    color: var(--text-primary);
}

.hero-tagline {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: clamp(1.75rem, 5.5vw, 3.5rem);
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.hero-tagline .type-target {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 600;
    background: var(--marker-yellow);
    color: var(--text-primary);
    padding: 0 0.15em;
    border-radius: 4px;
    box-shadow: 2px 3px 0 rgba(31, 35, 49, 0.06);
}

.section-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-style: normal;
    font-size: clamp(1.85rem, 4vw, 2.75rem);
    letter-spacing: -0.025em;
    transform: none;
}

.section-title::before {
    font-family: var(--font-mono);
    font-size: 0.42em;
    font-weight: 500;
    background: var(--marker-yellow);
    color: var(--accent);
    padding: 0.25em 0.55em;
    border-radius: 3px;
    transform: rotate(-2deg);
}

.project-title, .timeline-content h3, .tab-content h3, .contact-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-style: normal;
    letter-spacing: -0.015em;
}

.contact-title { font-style: italic; font-weight: 700; }

.stat-num {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 700;
}

/* Hero greeting subtle Patrick Hand */
.hero-greeting {
    font-family: var(--font-hand);
    font-size: 1.4rem;
    color: var(--accent);
    transform: rotate(-1deg);
    letter-spacing: 0.3px;
}

.hero-greeting::before { display: none; }

/* Logo BEKA. — italic editorial */
.nav-logo {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 700;
    font-size: 1.5rem;
    letter-spacing: -0.5px;
    color: var(--text-primary);
    transform: none;
}

.nav-logo .dot { color: var(--accent); }
.nav-logo:hover { transform: none; color: var(--accent); }

/* Nav links */
.nav-menu a { font-family: var(--font-sans); font-size: 0.9rem; font-weight: 500; }
.nav-menu a::before { font-family: var(--font-mono); }

/* Avatar badge */
.avatar-badge, .avatar-badge a { font-family: var(--font-hand); font-size: 1.1rem; }

/* Working-on widget */
.working-on, .working-on .working-value {
    font-family: var(--font-hand);
    font-size: 1.15rem;
    letter-spacing: 0.2px;
}

.footer-credit { font-family: var(--font-hand); font-size: 1.1rem; }

/* Hand-written meta */
.timeline-date, .project-subtitle,
.stat-label, .institution,
.tab-content .duration {
    font-family: var(--font-hand);
    font-size: 1.05rem;
    letter-spacing: 0.2px;
}

.scattered-note, .sticky-note { font-family: var(--font-hand); font-size: 1.1rem; }

/* Description / body text */
.hero-description, .about-text p, .tab-content ul li,
.playground-desc, .ml-panel-meta p,
.contact-description, .timeline-content p:not(.institution) {
    font-family: var(--font-sans);
    font-weight: 400;
}

.about-list li { font-family: var(--font-sans); }

/* Tab content company stays mono */
.tab-content .company { font-family: var(--font-mono); }

/* Buttons */
.btn { font-family: var(--font-mono); font-weight: 500; letter-spacing: 0.3px; }
.filter-pill, .ml-tab, .tab { font-family: var(--font-mono); }

/* Tone DOWN decorations to half intensity */
.section.about .container::before,
.section.about .container::after,
.section.experience .container::before,
.section.projects .container::before,
.section.projects .container::after,
.section.playground .container::before,
.section.education .container::before,
.section.skills .container::before,
.section.contact .container::before {
    opacity: 0.18 !important;
}

.section.about::before,
.section.experience::before,
.section.projects::before,
.section.playground::before,
.section::before {
    opacity: 0.12 !important;
}

/* Tone down paper grain too */
body::before {
    background-image:
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.122 0 0 0 0 0.137 0 0 0 0 0.192 0 0 0 0.035 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>"),
        linear-gradient(var(--grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
}

/* Section title underline keeps the squiggle but softer */
.section-title::after {
    opacity: 0.45;
    height: 9px;
    bottom: -0.25em;
}

/* Hero confetti dots — very subtle */
.hero {
    background-image:
        radial-gradient(circle at 12% 18%, rgba(255, 217, 61, 0.2) 0, transparent 3px),
        radial-gradient(circle at 82% 68%, rgba(255, 126, 182, 0.22) 0, transparent 3px),
        radial-gradient(circle at 28% 78%, rgba(86, 177, 255, 0.18) 0, transparent 3px),
        radial-gradient(circle at 88% 28%, rgba(110, 197, 103, 0.18) 0, transparent 3px),
        radial-gradient(circle at 50% 50%, rgba(232, 96, 44, 0.12) 0, transparent 2px);
}

/* Hero avatar — remove bobbing sparkle (too much) */
.hero-avatar::after { display: none; }

/* Pencil emoji in tab-content — softer */
.tab-content::before { opacity: 0.4; }

/* Stat cards — less tilt */
.stat-card { transform: rotate(-0.3deg); }
.stat-card:nth-child(2) { transform: rotate(0.4deg); }
.stat-card:nth-child(3) { transform: rotate(-0.4deg); }
.stat-card:nth-child(4) { transform: rotate(0.2deg); }

/* Project cards — less tilt */
.projects-grid > .project-card:nth-child(odd) { transform: rotate(-0.3deg); }
.projects-grid > .project-card:nth-child(even) { transform: rotate(0.3deg); }

/* Avatar frame — less tilt */
.avatar-frame { transform: rotate(1deg); }

/* Working-on — less tilt */
.working-on { transform: rotate(-1deg); }

/* Skill list symbols — keep playful but smaller */
.skill-category ul li::before { font-size: 0.85em; }


/* ============================================
   COMBO A: Instrument Serif tweaks
   (Instrument Serif only has 400 weight)
   ============================================ */

.hero-name {
    font-weight: 400;
    font-style: italic;
    font-size: clamp(3.5rem, 9.5vw, 6.5rem);
    line-height: 0.95;
    letter-spacing: -0.02em;
}

.hero-tagline {
    font-weight: 400;
    font-size: clamp(2rem, 5.5vw, 3.5rem);
    line-height: 1.1;
}

.section-title {
    font-weight: 400;
    font-style: italic;
    font-size: clamp(2.1rem, 4.5vw, 3rem);
    letter-spacing: -0.02em;
}

.project-title, .timeline-content h3, .tab-content h3 {
    font-weight: 400;
    font-style: normal;
    font-size: 1.4rem;
}

.contact-title {
    font-weight: 400;
    font-style: italic;
    font-size: clamp(2.8rem, 6vw, 4.5rem);
}

.stat-num {
    font-weight: 400;
    font-style: italic;
}

.nav-logo {
    font-weight: 400;
    font-style: italic;
    font-size: 1.7rem;
}

/* ============================================
   FINAL: Spectral body + Bricolage display
   Remove italic from titles, keep readable
   ============================================ */

/* Titles use Bricolage Grotesque BOLD (no italic) */
.hero-name {
    font-family: var(--font-display);
    font-weight: 800;
    font-style: normal;
    font-size: clamp(2.75rem, 7.5vw, 5rem);
    line-height: 1;
    letter-spacing: -0.035em;
    color: var(--text-primary);
}

.hero-tagline {
    font-family: var(--font-display);
    font-weight: 600;
    font-style: normal;
    font-size: clamp(1.75rem, 5vw, 3.25rem);
    line-height: 1.15;
    letter-spacing: -0.025em;
    color: var(--text-primary);
}

.hero-tagline .type-target {
    font-family: var(--font-display);
    font-weight: 700;
    font-style: normal;
    background: var(--marker-yellow);
    color: var(--text-primary);
    padding: 0 0.2em;
    border-radius: 4px;
    box-shadow: 2px 3px 0 rgba(31, 35, 49, 0.06);
}

.section-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-style: normal;
    font-size: clamp(1.85rem, 4vw, 2.6rem);
    letter-spacing: -0.025em;
}

.section-title::before {
    font-family: var(--font-mono);
    font-size: 0.4em;
    font-weight: 500;
    font-style: normal;
}

.project-title, .timeline-content h3, .tab-content h3 {
    font-family: var(--font-display);
    font-weight: 700;
    font-style: normal;
    font-size: 1.3rem;
    letter-spacing: -0.015em;
}

.contact-title {
    font-family: var(--font-display);
    font-weight: 800;
    font-style: normal;
    font-size: clamp(2.5rem, 5.5vw, 4rem);
    letter-spacing: -0.035em;
}

.stat-num {
    font-family: var(--font-display);
    font-weight: 800;
    font-style: normal;
}

.nav-logo {
    font-family: var(--font-display);
    font-weight: 800;
    font-style: normal;
    font-size: 1.4rem;
    letter-spacing: -0.04em;
}

.nav-logo:hover { color: var(--accent); transform: none; }

/* Spectral body - serif body is distinctive */
body, .hero-description, .about-text p, .tab-content ul li,
.playground-desc, .ml-panel-meta p,
.contact-description, .timeline-content p:not(.institution),
.about-list li {
    font-family: var(--font-sans);
    font-weight: 400;
}

.hero-description {
    font-size: 1.1rem;
    line-height: 1.65;
}

.about-text p { font-size: 1.05rem; line-height: 1.65; }

.tab-content ul li { font-size: 0.98rem; line-height: 1.6; }

/* Skill category headers — mono with character */
.skill-category h3 {
    font-family: var(--font-mono);
    font-weight: 600;
    letter-spacing: 0;
}

/* ML panel header — mono */
.ml-panel-meta h3 {
    font-family: var(--font-mono);
    font-weight: 600;
}

/* Reduce italic uses elsewhere */
.contact-pretitle { font-style: normal; }

/* Hero greeting subtle handwriting */
.hero-greeting {
    font-family: var(--font-hand);
    font-size: 1.35rem;
    font-style: normal;
    color: var(--accent);
}

/* Avatar polaroid badge */
.avatar-badge, .avatar-badge a {
    font-family: var(--font-hand);
    font-size: 1.1rem;
    font-style: normal;
}

.working-on, .working-on .working-value {
    font-family: var(--font-hand);
    font-size: 1.15rem;
    font-style: normal;
    letter-spacing: 0.2px;
}

.footer-credit { font-family: var(--font-hand); font-size: 1.1rem; font-style: normal; }

.timeline-date, .project-subtitle,
.stat-label, .institution,
.tab-content .duration {
    font-family: var(--font-hand);
    font-size: 1.05rem;
    font-style: normal;
}


/* ============================================
   ML BUSY OVERLAY (locks scroll during inference)
   ============================================ */

.ml-busy-overlay {
    position: fixed;
    inset: 0;
    background: rgba(31, 35, 49, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1500;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

[data-theme="dark"] .ml-busy-overlay {
    background: rgba(0, 0, 0, 0.65);
}

.ml-busy-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.ml-busy-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 2.25rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    max-width: 360px;
    box-shadow: 0 20px 60px -20px rgba(0, 0, 0, 0.35);
    transform: scale(0.92);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.ml-busy-overlay.show .ml-busy-card {
    transform: scale(1);
}

.ml-busy-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--bg-tertiary);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spinSpinner 0.8s linear infinite;
}

.ml-busy-label {
    font-family: var(--font-mono);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
}

.ml-busy-hint {
    font-family: var(--font-sans);
    font-size: 0.825rem;
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.5;
}

/* Lock body scroll while busy */
body.ml-busy-lock {
    overflow: hidden;
    touch-action: none;
}


/* ============================================
   MOBILE NAV REWORK + OVERFLOW FIXES
   ============================================ */

/* Desktop: hide SVG icons, keep numbered "1." prefix */
.nav-icon {
    display: none;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.nav-footer { display: none; }

/* Working-on widget — prevent overflow on mobile */
.working-on {
    max-width: 100%;
    flex-wrap: wrap;
    justify-content: center;
    text-align: center;
}

/* ===== MOBILE (<= 700px) ===== */
@media (max-width: 700px) {
    /* Sidebar restructure: top-aligned with icons + bottom socials */
    .nav-menu {
        justify-content: flex-start;
        align-items: stretch;
        padding: 5rem 1.5rem 2rem;
        gap: 0.4rem;
        list-style: none;
    }

    .nav-menu li {
        list-style: none;
    }

    .nav-menu a {
        display: flex;
        align-items: center;
        gap: 0.9rem;
        padding: 0.85rem 1rem;
        border-radius: 10px;
        font-family: var(--font-display);
        font-size: 1.05rem;
        font-weight: 600;
        letter-spacing: -0.01em;
        color: var(--text-primary);
        transition: background 0.18s ease, color 0.18s ease;
    }

    .nav-menu a:hover,
    .nav-menu a:focus,
    .nav-menu a.active {
        background: var(--accent-soft);
        color: var(--accent);
    }

    /* Hide the "1." "2." counter prefix on mobile */
    .nav-menu a::before {
        display: none;
    }

    /* Show SVG icons on mobile */
    .nav-icon {
        display: block;
        color: var(--accent);
        opacity: 0.85;
    }

    /* Nav footer with socials pushed to bottom */
    .nav-footer {
        display: flex !important;
        margin-top: auto;
        justify-content: center;
        gap: 1.5rem;
        padding-top: 1.5rem;
        border-top: 1px solid var(--border);
    }

    .nav-footer a {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 42px;
        height: 42px;
        padding: 0;
        background: transparent;
        color: var(--text-secondary);
        border-radius: 50%;
        transition: color 0.2s, background 0.2s;
    }

    .nav-footer a:hover { color: var(--accent); background: var(--accent-soft); }
    .nav-footer a svg { width: 22px; height: 22px; }
    .nav-footer a::before { display: none !important; }

    /* === Working-on widget overflow fix === */
    .working-on {
        flex-direction: column;
        gap: 0.3rem;
        font-size: 0.95rem;
        padding: 0.55rem 0.9rem;
        max-width: 100%;
        line-height: 1.3;
    }
    .working-on .working-sep { display: none; }
    .working-on .working-value {
        font-size: 0.85rem;
    }

    /* === Hero tightening === */
    .hero { padding: 4.5rem 0 2.5rem; }
    .hero-name {
        font-size: clamp(2.1rem, 9vw, 3rem);
        line-height: 1.05;
        letter-spacing: -0.03em;
    }
    .hero-tagline {
        font-size: clamp(1.5rem, 6.5vw, 2.3rem);
        line-height: 1.15;
        margin-bottom: 1.5rem;
    }
    .hero-greeting {
        font-size: 1.15rem;
    }
    .hero-description {
        font-size: 0.95rem;
        line-height: 1.55;
        margin-bottom: 2rem;
    }
    .hero-avatar { transform: rotate(0.5deg); }
    .avatar-frame {
        width: 180px;
        height: 180px;
        padding: 10px 10px 50px;
    }

    /* === Tighter section padding === */
    .section { padding: 2.75rem 0; }
    .section-title {
        margin-bottom: 1.75rem;
        font-size: clamp(1.6rem, 6vw, 2rem);
    }

    /* === Tighter body text === */
    .about-text p { font-size: 0.95rem; line-height: 1.55; }
    .about-list li { font-size: 0.92rem; }
    .timeline-content p:not(.institution) { font-size: 0.92rem; line-height: 1.55; }
    .tab-content ul li { font-size: 0.9rem; line-height: 1.5; }
    .playground-desc { font-size: 0.95rem; line-height: 1.55; }
    .contact-description { font-size: 0.95rem; line-height: 1.55; }
    .ml-panel-meta p { font-size: 0.88rem; }

    /* === Stat cards tighter === */
    .about-stats { gap: 0.55rem; }
    .stat-card { padding: 1.15rem 0.6rem; }
    .stat-num { font-size: 1.55rem; }
    .stat-label { font-size: 0.9rem; }
}

/* ===== SMALL PHONES (<= 420px) ===== */
@media (max-width: 420px) {
    .hero-name { font-size: clamp(1.85rem, 9vw, 2.5rem); }
    .hero-tagline { font-size: clamp(1.35rem, 6.5vw, 2rem); }
    .avatar-frame { width: 160px; height: 160px; padding: 8px 8px 44px; }
    .working-on { font-size: 0.88rem; }
    .working-on .working-value { font-size: 0.78rem; }
    .skill-category ul { grid-template-columns: 1fr; }
    .stat-card { padding: 1rem 0.5rem; }
    .stat-num { font-size: 1.4rem; }
}


/* ============================================
   MOBILE AUDIT FIXES (6 issues)
   ============================================ */

/* 1. Skills 2-column always on mobile (was 1-col causing empty right) */
@media (max-width: 420px) {
    .skill-category ul { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 320px) {
    .skill-category ul { grid-template-columns: 1fr; }
}

/* 2. Hero CTA buttons — not full-width pill */
@media (max-width: 700px) {
    .hero-cta {
        flex-direction: column;
        align-items: center;
        gap: 0.7rem;
    }
    .hero-cta .btn {
        width: 100%;
        max-width: 260px;
        text-align: center;
        border-radius: 14px;
        padding: 0.95rem 1.5rem;
    }
}

/* 3. Sidebar full coverage (width 100% on mobile) */
@media (max-width: 700px) {
    .nav-menu {
        width: 100%;
        max-width: none;
        right: -100%;
        box-shadow: none;
    }
    .nav-menu.open {
        right: 0;
    }
}

/* 4. Section title sticker nowrap + smaller mobile */
@media (max-width: 700px) {
    .section-title::before {
        white-space: nowrap;
        font-size: 0.38em;
        padding: 0.2em 0.5em;
        flex-shrink: 0;
    }
    .section-title {
        gap: 0.5rem;
        align-items: center;
        flex-wrap: wrap;
    }
}

/* 5. Hide tab pencil emoji on mobile (was off-screen left) */
@media (max-width: 900px) {
    .tab-content::before { display: none; }
}

/* 6. Reduce scattered doodles opacity below 500px */
@media (max-width: 500px) {
    .section::before,
    .section .container::before,
    .section .container::after {
        opacity: 0.08 !important;
    }
}

/* 7. Bonus: body text micro-tune for tiny viewports */
@media (max-width: 360px) {
    .hero-description { font-size: 0.92rem; line-height: 1.5; }
    .about-text p { font-size: 0.92rem; line-height: 1.5; }
    .playground-desc { font-size: 0.92rem; }
    .contact-description { font-size: 0.92rem; }
}


/* ============================================
   HORIZONTAL OVERFLOW FIX (causes phone auto-zoom-out)
   ============================================ */

/* Defensive: clip horizontal overflow on root + body + every section */
html {
    overflow-x: hidden;
    max-width: 100%;
}

body {
    overflow-x: hidden;
    max-width: 100%;
    position: relative;
}

/* Sections clip their decorative pseudo-elements that extend past edges */
.section {
    overflow: hidden;
}

/* On mobile, kill all decorative doodles that use negative offsets — they
   were the source of horizontal overflow. */
@media (max-width: 700px) {
    .section::before,
    .section .container::before,
    .section .container::after {
        display: none !important;
    }

    /* Hero confetti dots — keep but lighter */
    .hero {
        background-image: none;
    }

    /* Pull avatar polaroid frame inside viewport (transform/rotate creates overflow) */
    .avatar-frame {
        transform: rotate(0deg);
    }

    /* Disable card tilts on mobile (rotation = horizontal expansion) */
    .stat-card,
    .stat-card:nth-child(2),
    .stat-card:nth-child(3),
    .stat-card:nth-child(4),
    .projects-grid > .project-card:nth-child(odd),
    .projects-grid > .project-card:nth-child(even) {
        transform: none !important;
    }

    /* Section title sticker rotate kills overflow */
    .section-title::before {
        transform: none !important;
    }

    /* Hero avatar rotate too */
    .hero-avatar {
        transform: none !important;
    }
}

