@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@300;400;500&family=Inter+Tight:wght@400;500;600&display=swap');

:root {
    --ink-0: #f0f0ec;
    --ink-1: #d9d9d3;
    --ink-2: #afafa8;
    --ink-3: #85857f;
    --ink-4: #666660;
    --ink-5: #41413d;
    --ink-6: #232321;
    --ink-7: #0c0d0c;
    --signal: rgb(142, 84, 222);
    --signal-soft: rgba(142, 84, 222, 0.16);
    --surface: rgba(15, 16, 15, 0.72);
    --surface-hover: rgba(142, 84, 222, 0.045);
    --line: rgba(223, 223, 214, 0.14);
    --line-strong: rgba(223, 223, 214, 0.24);
    --font-display: 'Inter Tight', Arial, sans-serif;
    --font-mono: 'IBM Plex Mono', 'SFMono-Regular', Consolas, monospace;
    --transition: 180ms ease;
}

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

html { scroll-behavior: smooth; }

body {
    min-height: 100vh;
    overflow-x: hidden;
    background: var(--ink-7);
    color: var(--ink-1);
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 1.65;
}

body::before {
    content: '';
    position: fixed;
    inset: 1px;
    z-index: 2000;
    border: 1px solid var(--line-strong);
    pointer-events: none;
}

::selection {
    color: var(--ink-7);
    background: var(--signal);
}

#boids-canvas {
    position: fixed;
    inset: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
    opacity: 0.16;
    pointer-events: none;
}

.container {
    position: relative;
    z-index: 1;
    margin-left: 98px;
    padding: 0 clamp(32px, 4vw, 70px);
}

section {
    display: flex;
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    padding: 110px 0;
}

.content-wrapper {
    width: 100%;
    max-width: 1500px;
}

/* Navigation rail */
.sidebar {
    position: fixed;
    inset: 1px auto 1px 1px;
    z-index: 1000;
    width: 97px;
    padding: 48px 0;
    border-right: 1px solid var(--line);
    background: rgba(11, 12, 11, 0.86);
    backdrop-filter: blur(14px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 13px;
}

.sidebar::after {
    content: 'v1.0';
    position: absolute;
    bottom: 50px;
    color: var(--ink-4);
    font-size: 9px;
    letter-spacing: 0.08em;
}

.sidebar a,
#theme-toggle {
    position: relative;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 0;
    color: var(--ink-4);
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--transition), background var(--transition);
}

.sidebar a { text-decoration: none; }
.sidebar a svg,
#theme-toggle svg { width: 18px; height: 18px; stroke-width: 1.5; }

.sidebar a:hover,
.sidebar a.active,
#theme-toggle:hover {
    color: var(--signal);
    background: var(--signal-soft);
}

.sidebar a.active::before {
    content: '';
    position: absolute;
    left: -29px;
    width: 20px;
    height: 2px;
    background: var(--signal);
}

.sidebar a[title]::after,
#theme-toggle[title]::after {
    content: attr(title);
    position: absolute;
    left: calc(100% + 16px);
    top: 50%;
    padding: 5px 9px;
    transform: translateY(-50%);
    border: 1px solid var(--line);
    color: var(--ink-2);
    background: var(--ink-7);
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--transition);
}

.sidebar a:hover::after,
#theme-toggle:hover::after { opacity: 1; }

.sidebar-divider {
    width: 24px;
    height: 1px;
    margin: 4px 0;
    background: var(--line);
}

#theme-toggle { cursor: pointer; }

/* Hero document */
.hero {
    position: relative;
    min-height: 100vh;
    padding: 0;
    align-items: stretch;
    justify-content: flex-start;
    flex-direction: column;
}

.module-label {
    color: var(--ink-3);
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0.075em;
    text-transform: uppercase;
}

.module-label span {
    margin-right: 12px;
    color: var(--signal);
}

.hero-layout {
    width: 100%;
    flex: 1;
    display: grid;
    grid-template-columns: minmax(520px, 1.55fr) minmax(370px, 0.95fr);
    gap: clamp(44px, 6vw, 96px);
    align-items: center;
    padding: 70px 0 38px;
}

.hero-main { min-width: 0; }
.hero-content { max-width: 760px; }

h1 {
    display: flex;
    flex-direction: column;
    margin-bottom: 22px;
    color: var(--ink-0);
    font-family: var(--font-display);
    font-size: clamp(4.4rem, 6.6vw, 7.2rem);
    font-weight: 600;
    letter-spacing: -0.065em;
    line-height: 0.84;
}

.signal-rule {
    display: block;
    width: 34px;
    height: 2px;
    margin: 28px 0 20px;
    background: var(--signal);
}

.tagline {
    margin-bottom: 46px;
    color: var(--ink-2);
    font-size: 13px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.tagline a {
    color: var(--signal);
    text-decoration-color: var(--signal);
    text-underline-offset: 6px;
}

.creator-credit {
    width: fit-content;
    margin: -24px 0 38px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    color: var(--ink-3);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 9px;
    letter-spacing: 0.08em;
    text-decoration: none;
    text-transform: uppercase;
    transition: color var(--transition), border-color var(--transition), background var(--transition);
}

.creator-credit strong {
    color: var(--ink-1);
    font-weight: 500;
}

.creator-credit span:last-child { color: var(--signal); }

.creator-credit:hover {
    border-color: var(--signal);
    color: var(--ink-1);
    background: var(--signal-soft);
}

.profile-block { max-width: 700px; }
.profile-block .module-label,
.hero-contact .module-label {
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}

.bio {
    max-width: 680px;
    color: var(--ink-2);
    font-size: 12px;
    font-weight: 300;
    line-height: 2;
}

.profile-block .bio { padding-top: 17px; }

.hero-contact {
    max-width: 880px;
    margin-top: 42px;
    text-align: left;
}

.contact-content { text-align: left; }

.contact-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0;
    padding-top: 14px;
}

.contact-link {
    min-height: 30px;
    padding: 4px 18px;
    border: 0;
    border-right: 1px solid var(--line);
    color: var(--ink-3);
    background: transparent;
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 10px;
    letter-spacing: 0.09em;
    text-decoration: none;
    text-transform: uppercase;
    transition: color var(--transition), background var(--transition);
}

.contact-link:first-child { padding-left: 0; }
.contact-link:last-child { border-right: 0; }
.contact-link svg { width: 16px; height: 16px; opacity: 0.65; stroke-width: 1.5; }
.contact-link:hover { color: var(--signal); background: transparent; }

.systems-panel {
    min-width: 0;
    padding-left: 28px;
    border-left: 1px solid var(--line);
}

.panel-module {
    padding: 22px 0 20px;
    border-bottom: 1px solid var(--line);
}

.panel-module:first-child { padding-top: 0; }
.panel-module:last-child { border-bottom: 0; }

.swarm-module canvas {
    display: block;
    width: 100%;
    height: 290px;
    margin: 16px 0 0;
}

.coordinate-row {
    padding-top: 12px;
    border-top: 1px solid var(--line);
    color: var(--ink-3);
    display: flex;
    justify-content: space-between;
    gap: 20px;
    font-size: 10px;
    letter-spacing: 0.065em;
    text-transform: uppercase;
}

.coordinate-row span:last-child { color: var(--ink-2); }
.domains-module > p:last-child {
    margin-top: 20px;
    color: var(--ink-2);
    font-size: 11px;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.hero-doc-footer {
    min-height: 52px;
    color: var(--ink-4);
    display: flex;
    align-items: flex-start;
    gap: 18px;
    font-size: 9px;
    letter-spacing: 0.08em;
}

.footer-rule {
    width: 26px;
    height: 1px;
    margin-top: 8px;
    background: var(--signal);
}

/* Indexed content sections */
.section-title {
    position: relative;
    margin-bottom: 46px;
    padding: 0 0 16px 48px;
    border-bottom: 1px solid var(--line);
    color: var(--ink-0);
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 3vw, 2.5rem);
    font-weight: 500;
    letter-spacing: -0.035em;
    line-height: 1.1;
    text-align: left;
}

.section-title::before {
    content: attr(data-index);
    position: absolute;
    left: 0;
    bottom: 19px;
    color: var(--signal);
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.05em;
}

.research-grid,
.project-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-top: 1px solid var(--line);
    border-left: 1px solid var(--line);
}

.project-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.card {
    min-width: 0;
    padding: 30px;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background: var(--surface);
    backdrop-filter: blur(9px);
    transition: background var(--transition), border-color var(--transition);
}

.card:hover {
    border-color: var(--line-strong);
    background: var(--surface-hover);
}

.card h3 {
    margin-bottom: 14px;
    color: var(--ink-0);
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: -0.015em;
    line-height: 1.38;
}

.card p {
    color: var(--ink-3);
    font-size: 11px;
    font-weight: 300;
    line-height: 1.9;
}

.card p + p { margin-top: 12px; }

.card .meta {
    margin-top: 20px;
    color: var(--ink-4);
    font-size: 9px;
    letter-spacing: 0.07em;
    line-height: 1.7;
    text-transform: uppercase;
}

.card .meta a,
.timeline-item a {
    color: var(--ink-2) !important;
    text-decoration-color: var(--signal) !important;
    text-underline-offset: 4px !important;
}

.card .meta a:hover,
.timeline-item a:hover { color: var(--signal) !important; }

.internal-project {
    position: relative;
    box-shadow: inset 3px 0 0 var(--signal);
    background: var(--surface);
}

.project-classification {
    width: fit-content;
    margin-bottom: 16px;
    padding: 4px 8px;
    border: 1px solid var(--signal);
    color: var(--signal);
    font-size: 8px;
    letter-spacing: 0.12em;
    line-height: 1.4;
    text-transform: uppercase;
}

/* Skills */
.skills-filters {
    margin-bottom: 24px;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 0;
}

.filter-btn {
    padding: 8px 18px;
    border: 1px solid var(--line);
    border-right: 0;
    border-radius: 0;
    color: var(--ink-4);
    background: transparent;
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    cursor: pointer;
    transition: color var(--transition), background var(--transition), border-color var(--transition);
}

.filter-btn:last-child { border-right: 1px solid var(--line); }
.filter-btn:hover { color: var(--ink-1); }
.filter-btn.active,
.filter-btn.active[data-category] {
    border-color: var(--signal);
    color: var(--ink-0);
    background: var(--signal-soft);
    box-shadow: none;
}

.skills-cloud {
    position: relative;
    width: 100%;
    height: 560px;
    overflow: hidden;
    border: 1px solid var(--line);
    background: rgba(9, 10, 9, 0.62);
}

.skills-cloud canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.skill-node,
.skills-list-item {
    padding: 7px 14px;
    border: 1px solid var(--line);
    border-radius: 0;
    color: var(--ink-3);
    background: rgba(13, 14, 13, 0.82);
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 0.055em;
    text-transform: uppercase;
}

.skill-node {
    position: absolute;
    white-space: nowrap;
    user-select: none;
    cursor: pointer;
    transition: color var(--transition), border-color var(--transition), background var(--transition);
}

.skill-node.research,
.skill-node.development,
.skill-node.infrastructure,
.skills-list-item.research,
.skills-list-item.development,
.skills-list-item.infrastructure {
    border-color: var(--line);
    color: var(--ink-3);
    background: rgba(13, 14, 13, 0.82);
}

.skill-node:hover,
.skill-node.research:hover,
.skill-node.development:hover,
.skill-node.infrastructure:hover {
    z-index: 10;
    border-color: var(--signal);
    color: var(--ink-0);
    background: var(--signal-soft);
}

.skill-node.dimmed { opacity: 0.12; }
.skills-list { display: none; min-height: 120px; flex-wrap: wrap; gap: 6px; }
.skills-list-item { animation: fadeInUp 0.22s ease; }

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Timeline */
.timeline {
    position: relative;
    max-width: 960px;
    margin: 0 auto;
    padding-left: 42px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 4px;
    bottom: 4px;
    width: 1px;
    background: var(--line);
}

.timeline-item {
    position: relative;
    margin-bottom: 0;
    padding: 0 0 30px 28px;
    border-bottom: 1px solid var(--line);
}

.timeline-item + .timeline-item { padding-top: 30px; }
.timeline-item::before {
    content: '';
    position: absolute;
    left: -41px;
    top: 8px;
    width: 9px;
    height: 9px;
    border: 1px solid var(--ink-4);
    background: var(--ink-7);
}

.timeline-item + .timeline-item::before { top: 38px; }
.timeline-item:first-child::before { border-color: var(--signal); background: var(--signal); }

.timeline-item h3 {
    margin-bottom: 5px;
    color: var(--ink-1);
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 500;
}

.timeline-item .date {
    margin-bottom: 8px;
    color: var(--signal);
    font-size: 9px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.timeline-item p,
.timeline-item ul {
    color: var(--ink-3) !important;
    font-size: 11px;
    line-height: 1.85 !important;
}

.google-certificates-grid {
    position: relative;
    display: grid;
    overflow: hidden;
    margin-top: 18px;
    border-top: 1px solid var(--line);
    border-left: 1px solid var(--line);
    grid-template-columns: repeat(3, minmax(0, 1fr));
    isolation: isolate;
}

.google-certificates-logo {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 0;
    width: min(48%, 410px);
    height: auto;
    opacity: 0.055;
    filter: saturate(0.72);
    pointer-events: none;
    transform: translate(-50%, -50%);
}

.google-certificate-card {
    position: relative;
    z-index: 1;
    min-width: 0;
    min-height: 355px;
    padding: 24px 21px 22px;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background: rgba(12, 13, 12, 0.58);
    display: flex;
    flex-direction: column;
    transition: background var(--transition), border-color var(--transition);
}

.google-certificate-card:hover {
    border-color: var(--line-strong);
    background: rgba(17, 18, 17, 0.7);
}

.google-certificate-card h4 {
    min-height: 2.8em;
    color: var(--ink-1);
    font-family: var(--font-display);
    font-size: 0.96rem;
    font-weight: 500;
    line-height: 1.4;
}

.google-certificate-card .certificate-meta {
    margin-top: 7px;
    color: var(--signal);
    font-size: 8px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.google-certificate-card ul {
    margin: 18px 0 22px;
    padding-left: 16px;
    font-size: 9.5px;
    line-height: 1.65 !important;
}

.google-certificate-card li + li { margin-top: 5px; }

.google-certificate-card .certificate-link {
    width: fit-content;
    margin-top: auto;
    color: var(--ink-2) !important;
    font-size: 9px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* Themes */
[data-theme='light'] {
    --ink-0: #161713;
    --ink-1: #2e3029;
    --ink-2: #4c4e45;
    --ink-3: #6e7067;
    --ink-4: #92948b;
    --ink-5: #b6b8af;
    --ink-6: #dcddd6;
    --ink-7: #f0f0eb;
    --signal: rgb(142, 84, 222);
    --signal-soft: rgba(142, 84, 222, 0.1);
    --surface: rgba(240, 240, 235, 0.76);
    --surface-hover: rgba(142, 84, 222, 0.045);
    --line: rgba(24, 26, 22, 0.14);
    --line-strong: rgba(24, 26, 22, 0.25);
}

[data-theme='light'] .sidebar { background: rgba(239, 239, 234, 0.88); }
[data-theme='light'] .skills-cloud { background: rgba(235, 235, 230, 0.72); }
[data-theme='light'] .skill-node,
[data-theme='light'] .skill-node.research,
[data-theme='light'] .skill-node.development,
[data-theme='light'] .skill-node.infrastructure,
[data-theme='light'] .skills-list-item { background: rgba(239, 239, 234, 0.86); }
[data-theme='light'] #boids-canvas { opacity: 0.2; }
[data-theme='light'] .sidebar a[title]::after,
[data-theme='light'] #theme-toggle[title]::after { background: var(--ink-7); }
[data-theme='light'] .google-certificate-card { background: rgba(240, 240, 235, 0.62); }
[data-theme='light'] .google-certificate-card:hover { background: rgba(246, 246, 241, 0.78); }
[data-theme='light'] .google-certificates-logo { opacity: 0.045; }

/* Responsive */
@media (max-width: 1100px) {
    .container { padding: 0 34px; }
    .hero-layout {
        grid-template-columns: minmax(430px, 1.35fr) minmax(300px, 0.8fr);
        gap: 42px;
    }
    .project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .contact-link { padding-inline: 12px; }
}

@media (max-width: 850px) {
    .sidebar { width: 70px; }
    .container { margin-left: 71px; padding: 0 26px; }
    .hero-layout {
        grid-template-columns: minmax(0, 1fr) minmax(235px, 0.55fr);
        gap: 26px;
        align-items: start;
    }
    h1 { font-size: clamp(3rem, 8vw, 4.7rem); }
    .hero-contact { margin-top: 30px; }
    .contact-link { width: 50%; border-bottom: 1px solid var(--line); }
    .contact-link:nth-child(2n) { border-right: 0; }
    .contact-link:nth-last-child(-n + 2) { border-bottom: 0; }
    .contact-link:first-child { padding-left: 12px; }
    .systems-panel { padding-left: 20px; }
    .swarm-module canvas { height: 230px; }
    .research-grid { grid-template-columns: 1fr; }
    .google-certificates-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .google-certificate-card:last-child { grid-column: 1 / -1; min-height: 290px; }
    .skills-cloud { display: none; }
    .skills-list { display: flex; }
}

@media (max-width: 640px) {
    body::before { display: none; }
    .sidebar {
        inset: auto 0 0 0;
        width: 100%;
        height: 62px;
        padding: 0 12px;
        border-top: 1px solid var(--line);
        border-right: 0;
        flex-direction: row;
        background: rgba(11, 12, 11, 0.94);
    }
    .sidebar::after,
    .sidebar-divider { display: none; }
    .sidebar a.active::before {
        left: auto;
        bottom: -11px;
        width: 18px;
        height: 2px;
    }
    .sidebar a[title]::after,
    #theme-toggle[title]::after { display: none; }
    .container { margin-left: 0; padding: 0 20px 80px; }
    section { min-height: auto; padding: 90px 0; }
    .hero { min-height: 100vh; padding-bottom: 70px; }
    .hero-layout { grid-template-columns: 1fr; gap: 52px; padding-top: 54px; }
    h1 { font-size: clamp(3.2rem, 17vw, 5.2rem); }
    .systems-panel { padding-left: 0; border-left: 0; }
    .swarm-module canvas { height: 220px; }
    .project-grid { grid-template-columns: 1fr; }
    .card { padding: 24px 20px; }
    .section-title { padding-left: 38px; }
    .timeline { padding-left: 25px; }
    .timeline-item { padding-left: 20px; }
    .timeline-item::before { left: -25px; }
    .google-certificates-grid { grid-template-columns: 1fr; }
    .google-certificate-card,
    .google-certificate-card:last-child { min-height: 0; grid-column: auto; }
    .google-certificate-card h4 { min-height: 0; }
    .google-certificates-logo { width: min(78%, 330px); }
    .hero-doc-footer { display: none; }
}

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

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--ink-7); }
::-webkit-scrollbar-thumb { background: var(--signal); }
