:root {
    /* Cyber Blue Palette */
    --color-accent: #00d8ff;
    --backgound-accent: rgba(0, 216, 255, 0.1);
    --color-highlight: #f8fafc; /* Crisp, stark white for high contrast */
    --color-slate-400: #a1a1aa; /* Neutral cool grey for body text */
    --color-slate-200: #e4e4e7;
}

/* spacing / measure variables inspired by generous vertical rhythm */
:root {
    --measure: 65ch; /* comfortable line length for body copy */
    --space-xs: 0.5rem;
    --space-sm: 1rem;
    --space-md: 2rem;
    --space-lg: 3.5rem;
    --space-xl: 6rem;
}

html {
    scroll-behavior: smooth;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
}

body {
    background: #0a0a0a; /* True Deep Black */
    color: var(--color-slate-400);
    padding: var(--space-xl) var(--space-md);
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: var(--space-xl);
    line-height: 1.75;
}

p {
    line-height: 1.5rem;
}

p::selection, h1::selection, h2::selection, h3::selection, h4::selection, h5::selection, h6::selection {
    background: var(--color-accent);
    color: #0a0a0a;
}

.underlay {
    position: fixed;
    /* Updated glow to a subtle electric blue */
    background: radial-gradient(600px at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(0, 216, 255, 0.08), transparent 80%);
    inset: 0;
    pointer-events: none;
    transition: opacity 500ms;
    z-index: 1;
}

header,
main,
footer {
    position: relative;
    z-index: 10;
}

header {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 300px;
}

header h1,
header h4,
.lightText {
    color: var(--color-highlight)
}

header a {
    text-decoration: none;
}

header h1 {
    font-weight: 600;
}

header h4 {
    font-weight: 400;
}

nav {
    display: none;
}

nav a {
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 0;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.1em;
    font-size: 0.75rem;
    color: var(--color-slate-400); /* Sets the default inactive text color */
    text-decoration: none;
    transition: color 200ms;
}

/* The inactive line next to the text */
nav a::before {
    content: '';
    display: block;
    width: 2rem;
    height: 1px;
    background: #52525b; 
    transition: all 200ms;
}

/* Extends and turns the line white on hover/active */
nav a:hover::before,
nav a.active::before {
    width: 4rem;
    background: var(--color-highlight);
}

/* Forces the text (and any inner spans/paragraphs) to turn white, overriding any blue */
nav a:hover,
nav a.active,
nav a:hover *,
nav a.active * {
    color: var(--color-highlight) !important;
}

.social-link-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.social-link {
    font-size: 1.2rem;
    color: inherit;
    text-decoration: none;
    transition: 200ms;
}

.social-link:hover {
    color: var(--color-highlight);
}

main {
    display: flex;
    flex-direction: column;
    gap: 6rem;
}

section {
    display: flex;
    flex-direction: column;
    gap:  2rem;
}

section h2 {
    text-transform: uppercase;
    font-size: 1rem;
    font-weight: 500;
}

.sticky-header {
    position: sticky;
    top: 0;
    padding: 1rem 0;
}

.sticky-header h2 {
    position: relative;
    z-index: 2;
}

.sticky-header::before {
    content: '';
    position: absolute;
    inset: 0;
    /* background: #0a0a0a99; */
    backdrop-filter: blur(5px);
}

.about-contents {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.about-contents p {
    font-size: 1rem;
    line-height: 1.8;
    max-width: var(--measure);
}

.anchor-text {
    color: var(--color-highlight);
    text-decoration: none;
    transition-duration: 200ms;
}

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

.experience-contents,
.project-contents {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.experience-card,
.project-card {
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    transition: all 200ms ease;
    cursor: pointer;
}

.experience-card {
    gap: 0.5rem 1rem;
}

.project-card {
    gap: 1rem 1rem;
}

.card-column {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.tenure {
    opacity: 0.7;
    text-transform: uppercase;
    font-size: 0.8rem;
}

.experience-card p{
    font-size: 0.9rem;
}

.card-header {
    font-weight: 500;
    font-size: 1rem;
    text-decoration: none;
    display: inline-flex;
    align-items: baseline;
}

.anchor-icon {
    padding-left: 0.5rem;
    transition: transform 200ms ease;
    display: inline-block;
}

.anchor-text:hover .anchor-icon {
    transform: translate(4px, -4px);
}

.tag-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    color: var(--color-accent);
}

.tag {
    border-radius: 0.5rem;
    padding: 0.25rem 0.5rem;
    background: var(--backgound-accent)
}

.tag p {
    font-size: 0.8rem;
}

.project-image-container {
    max-width: 220px;
    overflow: hidden;
    display: grid;
    place-items: center;
    aspect-ratio: 16/9;
    order: 2;
    border-radius: 0.25rem;
    border: 2px solid rgba(255, 255, 255, 0.05); /* Neutralized border */
    transition: border-color 200ms ease;
}

.project-card:hover .project-image-container {
    border-color: rgba(0, 216, 255, 0.4); /* Blue hover border */
}

.project-image-container img {
    object-fit: cover;
    width: 100%;
    height: 100%;
}

.project-stat-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
}

.project-archive-link {
    position: relative;
    color: var(--color-highlight);
    text-decoration: none;
    transition-duration: 200ms;
    margin-right: auto;
}

.project-archive-link span {
    transition-duration: 200ms;
}

.project-archive-link:hover span {
    padding-left: 0.5rem;
}

.project-archive-link::after {
    content: '';
    position: absolute;
    left: 0;
    width: 100%;
    height: 1.5px;
    bottom: 0;
    background: transparent;
    transition-duration: 200ms;
}

.project-archive-link:hover::after {
    background: var(--color-accent);
}

footer {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    justify-content: space-between;
    align-items: flex-start;
}

footer p {
    font-size: 0.9rem;
}

.scroll-to-top {
    text-decoration: none;
    color: var(--color-accent);
    background: var(--backgound-accent);
    padding: 0 0.75rem;
    aspect-ratio: 1/1;
    display: grid;
    place-items: center;
    border-radius: 100%;
    overflow: hidden;
    transition-duration: 200ms;
}

.scroll-to-top:hover {
    opacity: 0.6;
}

@media (min-width: 640px) {
    body {
        padding: calc(var(--space-xl) - 1rem) 3rem;
    }

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

    .card-column {
        grid-column: span 3 / span 3;
    }

    .project-image-container {
        order: 0;
    }

    header {
        max-width: unset;
    }

    header h1 {
        font-size: 3rem;
    }

    header h4 {
        font-size: 1.4rem;
    }

    header p {
        max-width: 300px;
    }

    .social-link-container {
        gap: 1.5rem;
    }

    .social-link-container i {
        font-size: 2rem;
    }
}

@media (min-width: 1024px) {
    body {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 2rem;
        padding: var(--space-xl);
        padding-top: 0;
    }

    header {
        position: sticky;
        top: 0;
        margin-left: auto;
        height: fit-content;
        padding-bottom: 6rem;
    }

    header h1 {
        font-size: 3rem;
    }

    header h4 {
        font-size: 1.4rem;
    }

    header p {
        max-width: 300px;
    }

    nav {
        padding: 2rem 0;
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        flex: 1;
    }

    .social-link-container {
        gap: 1.5rem;
    }

    .social-link-container i {
        font-size: 2rem;
    }

    header,
    main {
        padding-top: 6rem;
        max-width: min(var(--measure), 1100px);
        width: 100%;
    }

    main {
        margin-right: auto;
    }

    .sticky-header {
        display: none;
    }

    .project-card,
    .experience-card {
        padding: 1rem;
        border-radius: 0.5rem;
        border: 1px solid transparent;
        transition-duration: 200ms;
    }

    /* Updated desktop hover states for cards to fit the dark theme */
    .project-card:hover,
    .experience-card:hover {
        background: rgba(255, 255, 255, 0.03); 
        border: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    }

    .experience-card:hover .card-header,
    .project-card:hover .card-header {
        color: var(--color-accent);
    }

    .experience-card:hover .anchor-icon,
    .project-card:hover .anchor-icon {
        transform: translate(4px, -4px);
    }

    .project-archive-link {
        padding-left: 1rem;
    }

    footer {
        grid-column: span 2 / span 2;
        flex-direction: row;
        max-width: 1350px;
        margin: 0 auto;
        width: 100%;
    }
}