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

:root {
    --bg: #0c0c0e;
    --bg-subtle: #111114;
    --surface: #18181c;
    --text: #e8e6e1;
    --text-secondary: #d4d4d4;
    --accent: #c4915e;
    --accent-dim: rgba(196, 145, 94, 0.12);
    --accent-hover: #d4a46e;
    --border: rgba(255, 255, 255, 0.06);
    --font-display: 'Instrument Serif', serif;
    --font-body: 'DM Sans', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

::selection {
    background: var(--accent);
    color: var(--bg);
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text);
    background-color: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* Subtle noise texture overlay */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    opacity: 0.025;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    pointer-events: none;
    z-index: 9999;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.12);
}

.page {
    max-width: 640px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Nav */
nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 0;
}

.nav-home {
    font-family: var(--font-display);
    font-size: 1.125rem;
    color: var(--text);
    text-decoration: none;
    transition: color 0.2s ease;
}

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

.nav-links {
    display: flex;
    gap: 1.5rem;
}

.nav-links a {
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--text-secondary);
    text-decoration: none;
    letter-spacing: 0.02em;
    transition: color 0.2s ease;
}

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

/* Header */
header {
    padding: 3rem 0 2rem;
}

header h1 {
    font-family: var(--font-display);
    font-size: clamp(3rem, 10vw, 5rem);
    font-weight: 400;
    line-height: 1;
    letter-spacing: -0.02em;
    color: var(--text);
}

.title-line {
    margin-top: 0.5rem;
}

header .title {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
}

/* Sections */
.section {
    padding: 2rem 0;
}

.divider {
    width: 100%;
    height: 1px;
    background: var(--border);
}

/* About */
.about p {
    color: var(--text-secondary);
    font-size: 1.0625rem;
    line-height: 1.6;
    max-width: 60ch;
    margin-bottom: 1rem;
}

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

/* Page intro */
.page-intro {
    color: var(--text-secondary);
    font-size: 1.0625rem;
    line-height: 1.6;
    max-width: 60ch;
}

/* Tags */
.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    padding: 0.375rem 0.625rem;
    border: 1px solid var(--border);
    border-radius: 2px;
    color: var(--text-secondary);
    background: transparent;
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
    cursor: default;
    user-select: none;
}

.tag:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-dim);
}

/* Links */
.links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem 1.5rem;
    padding-top: 2rem;
}

.links a {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9375rem;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.375rem 0;
    transition: color 0.2s ease;
}

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

.links a svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    fill: currentColor;
}

.link-text {
    position: relative;
}

.link-text::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--accent);
    transition: width 0.2s ease;
}

.links a:hover .link-text::after {
    width: 100%;
}

.links .email-link {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
}

/* Projects */
.project {
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--border);
}

.project:first-child {
    padding-top: 0;
}

.project:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.project-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.project-name {
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 400;
    color: var(--text);
    text-decoration: none;
    transition: color 0.2s ease;
}

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

.project-arrow {
    width: 16px;
    height: 16px;
    color: var(--text-secondary);
    flex-shrink: 0;
    transition: color 0.2s ease, transform 0.2s ease;
}

.project-name:hover + .project-arrow,
.project-header:hover .project-arrow {
    color: var(--accent);
    transform: translate(2px, -2px);
}

.project-description {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    line-height: 1.6;
    margin-top: 0.375rem;
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-top: 0.75rem;
}

.project-tags .tag {
    font-size: 0.6875rem;
    padding: 0.25rem 0.5rem;
}

/* Bottom space */
.end {
    padding-bottom: 4rem;
}

/* Animations */
.reveal {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.5s var(--ease), transform 0.5s var(--ease);
}

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

.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }

/* Responsive */
@media (max-width: 480px) {
    header {
        padding: 2rem 0 1.5rem;
    }

    header .title {
        font-size: 0.6875rem;
    }

    .section {
        padding: 1.5rem 0;
    }

    .about p {
        font-size: 1rem;
    }

    .tag {
        font-size: 0.6875rem;
        padding: 0.3rem 0.5rem;
    }

    .links {
        flex-direction: column;
        gap: 0.25rem;
        padding-top: 1.5rem;
    }

    .page {
        padding: 0 1.25rem;
    }
}
