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

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.return-button {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 100;
    display: grid;
    width: 58px;
    height: 58px;
    place-items: center;
    border: 1px solid rgba(181, 160, 255, 0.42);
    border-radius: 50%;
    background: rgba(26, 28, 32, 0.88);
    box-shadow:
        0 8px 24px rgba(0, 0, 0, 0.28),
        inset 0 0 0 1px rgba(255, 255, 255, 0.04);
    color: #b5a0ff;
    font: inherit;
    line-height: 1;
    backdrop-filter: blur(8px);
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transform: translateY(8px);
    transition:
        opacity 180ms ease,
        transform 180ms ease,
        visibility 180ms ease,
        border-color 180ms ease,
        background-color 180ms ease;
}

.return-button.is-visible {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
    transform: translateY(0);
}

.return-button:hover {
    border-color: #b5a0ff;
    background: rgba(36, 33, 47, 0.94);
    box-shadow:
        0 10px 28px rgba(0, 0, 0, 0.34),
        0 0 0 4px rgba(181, 160, 255, 0.1);
}

.return-button svg {
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
    transition: transform 180ms ease;
}

.return-button:hover svg {
    transform: translateY(-2px);
}

.return-button:focus-visible {
    outline: 2px solid #b5a0ff;
    outline-offset: 4px;
}

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 28px;
}

.filter-btn {
    padding: 8px 16px;
    border: 1px solid #34363b;
    border-radius: 999px;
    background: #1a1c20;
    color: #b6b8c0;
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition:
        border-color 180ms ease,
        color 180ms ease,
        background-color 180ms ease;
}

.filter-btn:hover,
.filter-btn[aria-pressed="true"] {
    border-color: #b5a0ff;
    color: #f4f4f5;
}

.filter-btn[aria-pressed="true"] {
    background: rgba(181, 160, 255, 0.14);
    box-shadow: inset 0 0 0 1px #b5a0ff;
}

.filter-btn:focus-visible {
    outline: 2px solid #b5a0ff;
    outline-offset: 4px;
}

.experience,
.skills-section,
.thinking-section {
    max-width: 1120px;
    margin: 0 auto;
    padding: 80px 48px;
    border-top: 1px solid #34363b;
}

.experience-content-note,
.content-note,
.no-script-note {
    max-width: 65ch;
    margin-top: 16px;
    color: #b6b8c0;
    line-height: 1.7;
}

.affiliation-card,
.exploring-card,
.skill-group,
.principle-card {
    padding: 24px;
    background: #1a1c20;
    border: 1px solid #34363b;
    border-radius: 8px;
}

.affiliation-card {
    max-width: 720px;
    margin-top: 40px;
}

.affiliation-card h3,
.exploring-card h3,
.skill-group h3,
.principle-card h3 {
    margin-top: 12px;
    font-size: 1.25rem;
}

.affiliation-organization {
    margin-top: 6px;
    color: #b5a0ff;
    font-weight: 600;
}

.timeline {
    position: relative;
    max-width: 720px;
    margin-top: 40px;
    margin-left: 8px; /* Aligns the dot visually with the card edge above */
    padding-left: 28px;
    border-left: 2px solid #34363b;
}

.timeline-item {
    position: relative;
    padding: 0 0 36px 0;
}

.timeline-item:last-child {
    padding-bottom: 4px; /* Stops the vertical line from dangling past the last item */
}

.timeline-item::before {
    position: absolute;
    top: 3px;
    left: -36px; /* Exact center: -28px padding - 1px half-border - 7px half-dot */
    width: 14px;
    height: 14px;
    box-sizing: border-box;
    border: 3px solid #101113;
    border-radius: 50%;
    background: #b5a0ff;
    content: "";
}

.timeline-meta,
.item-meta,
.skill-status {
    color: #b5a0ff;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.timeline-category {
    margin-left: 12px;
    color: #b6b8c0;
}

.timeline-item h3 {
    margin-top: 10px;
}

.timeline-item > p:not(.timeline-meta),
.exploring-item p:last-child,
.principle-card p,
.timeline-empty {
    max-width: 65ch;
    margin-top: 10px;
    color: #b6b8c0;
    line-height: 1.7;
}

.timeline-empty {
    margin: 0;
}

.exploring-card {
    max-width: 720px;
    margin-top: 40px; /* Matches the 40px rhythm between affiliation and timeline */
}

.exploring-item {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #34363b;
}

.skills-grid,
.principles-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 40px;
}

.skill-list {
    display: grid;
    gap: 18px;
    margin-top: 20px;
    padding: 0;
    list-style: none;
}

.skill-heading {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px;
}

.skill-status {
    color: #b6b8c0;
    font-size: 0.7rem;
}

.evidence-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.evidence-link {
    color: #b5a0ff;
    font-size: 0.8rem;
    text-decoration: none;
}

.evidence-link::after {
    content: " ↗";
}

.evidence-link:hover {
    color: #d0c3ff;
}

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

.inline-links {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 14px;
}

.hidden,
[hidden] {
    display: none !important;
}

@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}

body {
    background-color: #101113;
    color: #f4f4f5;
    font-family:
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Oxygen,
        Ubuntu,
        Cantarell,
        sans-serif;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 48px;
    border-bottom: 1px solid #34363b;
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: #101113;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 24px;
}

nav a {
    color: #b6b8c0;
    text-decoration: none;
    transition: color 180ms ease;
}

nav a:hover {
    color: #f4f4f5;
}

.header-glow {
    height: 420px;
    margin-bottom: -420px;
    background:
        radial-gradient(
            ellipse 80% 100% at 16% 0%,
            rgba(112, 84, 180, 0.24),
            transparent 72%
        ),
        radial-gradient(
            ellipse 72% 92% at 86% 0%,
            rgba(181, 160, 255, 0.17),
            transparent 74%
        );
    opacity: var(--header-glow-opacity, 1);
    pointer-events: none;
    transition: opacity 120ms linear;
}

.brand-name {
    font-size: 1rem;
    font-weight: 600;
    color: #b5a0ff;
}

.brand-role {
    margin-top: 4px;
    color: #b6b8c0;
    font-size: 0.8rem;
}

.resume-link {
    color: #b5a0ff;
    font-weight: 600;
}

.hero {
    max-width: 900px;
    margin: 120px auto;
    padding: 0 24px;
}

.hero-label {
    color: #b5a0ff;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.08rem;
    text-transform: uppercase;
}

.hero h1 {
    max-width: 800px;
    margin-top: 24px;
    font-size: clamp(2.5rem, 6vw, 5rem);
    line-height: 1.1;
    letter-spacing: -0.04em;
}

.hero h1 span {
    color: #b5a0ff;
}

.hero-description {
    max-width: 620px;
    margin-top: 24px;
    color: #b6b8c0;
    font-size: 1.1rem;
    line-height: 1.8;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 32px;
}

.button {
    display: inline-block;
    padding: 14px 20px;
    border: 1px solid #34363b;
    border-radius: 6px;
    font-size: 0.9rem;
    text-decoration: none;
    transition:
        background-color 180ms ease,
        color 180ms ease,
        border-color 180ms ease;
}

.button-primary {
    background-color: #b5a0ff;
    border-color: #b5a0ff;
    color: #101113;
}

.button-primary:hover {
    background-color: #c5b5ff;
    border-color: #c5b5ff;
}

.button-secondary {
    color: #f4f4f5;
}

.button-secondary:hover {
    border-color: #b6b8c0;
}

.projects {
    max-width: 1120px;
    margin: 0 auto;
    padding: 80px 48px;
}

.section-label {
    color: #b5a0ff;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.08em;
}

.section-heading h2 {
    margin-top: 16px;
    font-size: 2.5rem;
    letter-spacing: -0.04em;
}

.section-description {
    margin-top: 12px;
    color: #b6b8c0;
    line-height: 1.7;
}

.project-grid {
    display: flex;
    flex-direction: column;
    gap: 24px;
    width: 100%;
    max-width: 1040px;
    margin-top: 40px;
}

.project-card {
    width: 100%;
    padding: 28px;
    background-color: #1a1c20;
    border: 1px solid #34363b;
    border-radius: 8px;
    scroll-margin-top: 100px;
    transition:
        border-color 180ms ease,
        transform 180ms ease;
}

.project-category {
    color: #b5a0ff;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.project-card h3 {
    margin-top: 24px;
    font-size: 1.5rem;
}

.project-description {
    margin-top: 12px;
    color: #b6b8c0;
    line-height: 1.7;
    overflow-wrap: anywhere;
}

.project-link {
    display: block;
    width: fit-content;
    margin-top: 20px;
    color: #b5a0ff;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    transition: color 180ms ease;
}

.project-link:hover {
    color: #d0c3ff;
}

.project-details-toggle {
    width: 100%;
}

.project-details-toggle summary {
    list-style: none;
    cursor: pointer;
}

.project-details-toggle summary:hover {
    color: #f4f4f5;
}

.project-details-toggle summary::-webkit-details-marker {
    display: none;
}

.project-details-toggle summary:focus-visible {
    outline: 2px solid #b5a0ff;
    outline-offset: 6px;
    border-radius: 2px;
}

.project-expand-label {
    display: inline-block;
    margin-top: 24px;
    color: #b5a0ff;
    font-size: 0.9rem;
    font-weight: 600;
    transition: color 180ms ease;
}

.project-expand-label::after {
    content: "+";
    display: inline-block;
    margin-left: 4px;
    font-size: 1.1em;
    transition: transform 180ms ease;
}

.project-details-toggle[open] .project-expand-label::after {
    content: "−";
    transform: rotate(180deg);
}

.project-expanded {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid #34363b;
}

.project-expanded h4 {
    margin-top: 20px;
    font-size: 1rem;
}

.project-expanded h4:first-child {
    margin-top: 0;
}

.project-expanded p {
    max-width: 65ch;
    margin-top: 10px;
    color: #b6b8c0;
    line-height: 1.7;
}

.tech-stack-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}

.tech-stack {
    display: inline-block;
    padding: 6px 12px;
    border: 1px solid #34363b;
    border-radius: 999px;
    background-color: #1a1c20;
    color: #b6b8c0;
    font-size: 0.8rem;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.about {
    max-width: 1120px;
    margin: 0 auto;
    padding: 80px 48px;
    border-top: 1px solid #34363b;
}

.about-heading {
    max-width: 700px;
}

.about-heading h2 {
    margin-top: 16px;
    font-size: clamp(2rem, 4vw, 3rem);
    line-height: 1.2;
    letter-spacing: -0.04em;
}

.about-content {
    max-width: 720px;
    margin-top: 28px;
}

.about-content p {
    color: #b6b8c0;
    line-height: 1.9;
}

.about-content p + p {
    margin-top: 16px;
}

.contact {
    max-width: 1120px;
    margin: 0 auto;
    padding: 80px 48px;
    border-top: 1px solid #34363b;
}

.contact h2 {
    margin-top: 16px;
    font-size: clamp(2rem, 4vw, 3rem);
    letter-spacing: -0.04em;
}

.contact-description {
    max-width: 600px;
    margin-top: 16px;
    color: #b6b8c0;
    line-height: 1.8;
}

.contact-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 32px;
}

.github-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #b6b8c0;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    transition: color 180ms ease;
}

.github-link:hover {
    color: #b5a0ff;
}

/* Fix nav header blocking elements */
#projects,
#experience,
#skills,
#thinking,
#about,
#contact {
    scroll-margin-top: 50px;
}

@media (hover: hover) and (pointer: fine) {
    /* To increase the specificity */

    html.js .project-card.reveal.is-visible:hover,
    html.js .affiliation-card.reveal.is-visible:hover,
    html.js .exploring-card.reveal.is-visible:hover,
    html.js .skill-group.reveal.is-visible:hover,
    html.js .principle-card.reveal.is-visible:hover {
        border-color: #71648f;
        transform: translateY(-3px);
    }
}

/* For smaller screens */

@media (max-width: 700px) {
    nav {
        flex-direction: column;
        padding: 20px 24px;
        align-items: flex-start;
        gap: 20px;
    }

    .hero {
        margin: 80px auto;
    }

    .header-glow {
        height: 180px;
        margin-bottom: -180px;
        background:
            radial-gradient(
                ellipse 90% 100% at 18% 0%,
                rgba(112, 84, 180, 0.3),
                transparent 72%
            ),
            radial-gradient(
                ellipse 85% 100% at 84% 0%,
                rgba(181, 160, 255, 0.18),
                transparent 74%
            );
        pointer-events: none;
    }

    .nav-links {
        align-self: stretch;
        flex-wrap: wrap;
        gap: 14px;
    }

    .projects {
        padding: 64px 24px;
    }

    .project-card {
        padding: 24px;
        scroll-margin-top: 165px;
    }

    .section-heading h2 {
        font-size: 2rem;
    }

    .about {
        padding: 64px 24px;
    }

    .contact {
        padding: 64px 24px;
    }

    #projects,
    #experience,
    #skills,
    #thinking,
    #about,
    #contact {
        scroll-margin-top: 135px;
    }

    .experience,
    .skills-section,
    .thinking-section {
        padding: 64px 24px;
    }

    .skills-grid,
    .principles-grid {
        grid-template-columns: 1fr;
    }
}

/* Navigating with keyboard */
a:focus-visible {
    outline: 2px solid #b5a0ff;
    outline-offset: 4px;
    border-radius: 3px;
}

/* Scroll reveal animation */

.reveal {
    transition:
        opacity 600ms ease,
        transform 600ms ease;
}

.hero-label.reveal {
    transition-delay: 200ms;
}

header h1.reveal {
    transition-delay: 400ms;
}

header p.reveal {
    transition-delay: 600ms;
}

.hero-actions.reveal {
    transition-delay: 800ms;
}

html.js .project-card.reveal:not(.is-visible):nth-child(2) {
    transition-delay: 100ms;
}

html.js .project-card.reveal:not(.is-visible):nth-child(3) {
    transition-delay: 200ms;
}

html.js .project-card.reveal:not(.is-visible):nth-child(4) {
    transition-delay: 300ms;
}

html.js .reveal:not(.is-visible) {
    opacity: 0;
    transform: translateY(20px);
}

html.js .reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Respect reduced-motion preferences */

@media (prefers-reduced-motion: reduce) {
    html.js .reveal,
    html.js .reveal:not(.is-visible) {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .project-card,
    .project-expand-label,
    .project-expand-label::after,
    .filter-btn,
    .return-button,
    .return-button svg {
        transition: none;
    }
}
