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

/* Design tokens */
:root {
    --color-bg:      #0a0a0a;
    --color-text:    #f0f0f0;
    --color-muted:   #888;
    --color-divider: #555;
    --color-border:  #222;

    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

    --nav-height: 52px;
}

/* Scroll */
html {
    scroll-behavior: smooth;
    scroll-padding-top: var(--nav-height);
}

/* Body */
body {
    min-height: 100vh;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-sans);
    line-height: 1.6;
}

/* Nav */
nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-divider);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    z-index: 100;
}

.nav-name {
    font-size: 0.875rem;
    font-weight: 400;
    letter-spacing: 0.05em;
    color: var(--color-text);
    text-decoration: none;
}

/* Mobile hamburger button */
.nav-toggle {
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
}

.nav-toggle span {
    display: block;
    width: 20px;
    height: 1px;
    background: var(--color-text);
    transition: transform 0.2s ease, opacity 0.2s ease;
}

/* Animate hamburger → X when open */
.nav-toggle[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
}

.nav-toggle[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

/* Nav links — hidden on mobile by default, shown as dropdown when .is-open */
.nav-links {
    display: none;
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-divider);
    flex-direction: column;
    list-style: none;
    padding: 0.25rem 0;
    gap: 0;
}

.nav-links.is-open {
    display: flex;
}

.nav-links a {
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    min-height: 44px;
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--color-muted);
    text-decoration: none;
    transition: color 0.2s ease;
}

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

/* Desktop nav: show links inline, hide hamburger */
@media (min-width: 640px) {
    .nav-toggle {
        display: none;
    }

    .nav-links {
        display: flex;
        position: static;
        background: transparent;
        border: none;
        flex-direction: row;
        padding: 0;
        gap: 1.5rem;
    }

    .nav-links a {
        padding: 0;
    }
}

/* Divider line */
.divider {
    width: 40px;
    height: 1px;
    background: var(--color-divider);
    margin: 1.5rem 0;
}

/* Splash / hero */
.splash {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: calc(var(--nav-height) + 2rem) 1.5rem 2rem;
    text-align: center;
}

.splash-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.splash h1 {
    font-size: clamp(2.5rem, 8vw, 5rem);
    font-weight: 300;
    letter-spacing: 0.05em;
}

.splash .divider {
    margin: 1.5rem auto;
}

/* Typewriter text */
.splash-tagline {
    font-size: clamp(0.75rem, 2.5vw, 0.875rem);
    color: var(--color-muted);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    min-height: 1.5em;
}

/* Blinking cursor */
.cursor {
    animation: blink 1s step-end infinite;
    color: var(--color-muted);
    margin-left: 1px;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* SVG icon helpers — replaces presentation attributes flagged by HTML validator */
.icon-stroke {
    fill: none;
}

.icon-fill {
    fill: currentColor;
}

/* Scroll-down arrow */
.scroll-hint {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    color: var(--color-muted);
    text-decoration: none;
    transition: color 0.2s ease, transform 0.2s ease;
}

.scroll-hint:hover {
    color: var(--color-text);
    transform: translateX(-50%) translateY(3px);
}

/* Page sections */
.page-section {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: calc(var(--nav-height) + 3rem) 1.5rem 4rem;
    max-width: 860px;
    margin: 0 auto;
    width: 100%;
}

.page-section h2 {
    font-size: clamp(1.75rem, 5vw, 2.5rem);
    font-weight: 300;
    letter-spacing: 0.05em;
}

/* Scroll-reveal: sections start hidden and fade in when visible */
.reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

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

/* About layout */
.about-grid {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

.about-bio p {
    color: var(--color-muted);
    font-size: 1rem;
    letter-spacing: 0.02em;
    margin-bottom: 1rem;
}

.about-bio p:last-child {
    margin-bottom: 0;
}

.about-skills h3 {
    font-size: 0.7rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--color-muted);
    margin-bottom: 1rem;
    font-weight: 400;
}

/* Two-column about on wider screens */
@media (min-width: 640px) {
    .about-grid {
        flex-direction: row;
        gap: 4rem;
        align-items: flex-start;
    }

    .about-bio {
        flex: 1;
    }

    .about-skills {
        flex-shrink: 0;
        width: 180px;
    }
}

/* Skill tags */
.skill-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    list-style: none;
}

.skill-list li {
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    color: var(--color-muted);
    border: 1px solid var(--color-border);
    padding: 0.35rem 0.75rem;
    border-radius: 2px;
}

/* Projects grid */
.projects-grid {
    display: flex;
    flex-direction: column;
    gap: 1px;
    border: 1px solid var(--color-border);
}

/* Project card */
.project-card {
    padding: 1.75rem;
    border-top: 1px solid var(--color-border);
    transition: background 0.2s ease;
}

.project-card:first-child {
    border-top: none;
}

.project-card:hover {
    background: #111;
}

.project-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.project-card h3 {
    font-size: 1rem;
    font-weight: 400;
    letter-spacing: 0.03em;
}

.project-links {
    display: flex;
    gap: 0.75rem;
    flex-shrink: 0;
}

.project-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    color: var(--color-muted);
    text-decoration: none;
    transition: color 0.2s ease;
    margin: -0.65rem -0.65rem -0.65rem 0;
}

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

.project-card > p {
    font-size: 0.875rem;
    color: var(--color-muted);
    letter-spacing: 0.02em;
    margin-bottom: 1.25rem;
    line-height: 1.6;
}

/* Tech tags on project cards */
.tech-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    list-style: none;
}

.tech-tags li {
    font-size: 0.65rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-muted);
    border: 1px solid var(--color-border);
    padding: 0.2rem 0.6rem;
    border-radius: 2px;
}

/* Two-column project grid on wider screens */
@media (min-width: 640px) {
    .projects-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0;
    }

    .project-card {
        border-left: 1px solid var(--color-border);
    }

    .project-card:first-child {
        border-top: none;
        border-left: none;
    }

    .project-card:nth-child(2) {
        border-top: none;
    }

    .project-card:nth-child(3) {
        border-left: none;
    }
}

/* Contact */
.contact-intro {
    font-size: 1rem;
    color: var(--color-muted);
    letter-spacing: 0.02em;
    margin-bottom: 2rem;
}

.contact-email {
    display: inline-block;
    font-size: clamp(1rem, 3vw, 1.25rem);
    font-weight: 300;
    letter-spacing: 0.05em;
    color: var(--color-text);
    text-decoration: none;
    border-bottom: 1px solid var(--color-divider);
    padding-bottom: 2px;
    transition: border-color 0.2s ease, color 0.2s ease;
    margin-bottom: 2rem;
}

.contact-email:hover {
    border-color: var(--color-text);
}

.contact-links {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.contact-links a {
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--color-muted);
    text-decoration: none;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    transition: color 0.2s ease;
}

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

.contact-sep {
    color: var(--color-divider);
    font-size: 0.75rem;
}

/* Footer */
footer {
    border-top: 1px solid var(--color-border);
    padding: 2rem 1.5rem;
    text-align: center;
    max-width: 860px;
    margin: 0 auto;
    width: 100%;
}

footer p {
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    color: var(--color-muted);
}

/* Reduced motion: disable all animations and transitions */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .cursor {
        animation: none;
    }

    .nav-toggle span {
        transition: none;
    }

    .scroll-hint {
        transition: none;
    }
}
