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

:root {
    --primary: #8B1A1A;        /* Deep burgundy red - dark winter */
    --secondary: #A52A2A;      /* Rich brown-red */
    --accent: #6B1F1F;         /* Dark wine */
    --accent-warm: #B8534E;    /* Muted terracotta */
    --dark: #1D1D1F;           /* Apple-style dark */
    --light: #FBFBFD;          /* Apple-style light */
    --text: #1D1D1F;           /* Dark text */
    --text-light: #86868B;     /* Apple gray */
    --border: #D2D2D7;         /* Subtle border */
    --cream: #FFFFFF;          /* Pure white */
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text);
    background: var(--cream);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Hero Section */
.hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: white;
    text-align: center;
    padding: 280px 20px 100px;
    position: relative;
}

/* Hero Logo (stays within hero section) */
.hero-logo {
    position: absolute;
    top: 15vh;
    left: 50%;
    transform: translateX(-50%);
    width: 180px;
    height: 180px;
    z-index: 10;
}

.hero-logo img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.95);
    box-shadow: 0 8px 32px rgba(139, 26, 26, 0.4);
    object-fit: cover;
}

.hero-content {
    max-width: 900px;
    opacity: 0;
    transform: translateY(30px);
    margin-top: 40px;
}

.hero-title {
    font-size: 5rem;
    font-weight: 700;
    margin-bottom: 20px;
    letter-spacing: -3px;
}

.hero-subtitle {
    font-size: 1.75rem;
    font-weight: 400;
    margin-bottom: 20px;
    opacity: 0.95;
}

.hero-description {
    font-size: 1.3rem;
    margin-bottom: 50px;
    opacity: 0.9;
    font-weight: 300;
}

.hero-links {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-primary, .btn-secondary {
    padding: 16px 48px;
    border-radius: 980px;
    text-decoration: none;
    font-weight: 500;
    font-size: 1.1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-block;
}

.btn-primary {
    background: white;
    color: var(--primary);
}

.btn-primary:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 1.5px solid rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: white;
}

/* Scroll Indicator */
.scroll-indicator {
    position: absolute;
    bottom: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    opacity: 0.6;
    animation: bounce 2s infinite;
}

.scroll-indicator span {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 500;
}

.scroll-arrow {
    width: 24px;
    height: 24px;
    border-left: 2px solid white;
    border-bottom: 2px solid white;
    transform: rotate(-45deg);
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* Projects Section */
.projects {
    background: var(--cream);
    padding: 100px 0;
}

.section-title {
    text-align: center;
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--dark);
    letter-spacing: -2px;
}

.section-tagline {
    text-align: center;
    font-size: 1.1rem;
    font-style: italic;
    color: var(--primary);
    margin: 0 auto 30px;
    padding: 0 20px;
}

.section-blurb {
    text-align: center;
    font-size: 1.2rem;
    line-height: 1.8;
    color: var(--text-light);
    max-width: 700px;
    margin: 0 auto 60px;
    padding: 0 20px;
}

/* TOC Wrapper - contains title and grid for sticky scope */
.toc-wrapper {
    position: relative;
}

/* Table of Contents Grid */
.toc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    max-width: 1200px;
    margin: 0 auto 100px;
    padding: 0 40px;
}

.toc-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.toc-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 20px rgba(139, 26, 26, 0.15);
    transform: translateY(-2px);
}

.toc-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.toc-icon svg {
    width: 100%;
    height: 100%;
    opacity: 1 !important;
    transform: none !important;
}

.toc-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    width: 0;
    flex: 1;
    overflow: hidden;
}

.toc-name {
    display: block;
    font-weight: 600;
    font-size: 1rem;
    color: var(--dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.toc-tagline {
    display: block;
    font-size: 0.8rem;
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* Sticky Header Navigation */
.floating-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    z-index: 1000;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.08);
}

.floating-nav.visible {
    transform: translateY(0);
}

.floating-nav-header {
    display: none;
}

.floating-nav-items {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 12px 20px;
    max-width: 1400px;
    margin: 0 auto;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.floating-nav-items::-webkit-scrollbar {
    display: none;
}

.floating-nav-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    text-decoration: none;
    border-radius: 20px;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.floating-nav-item:hover {
    background: rgba(139, 26, 26, 0.08);
}

.floating-nav-item.active {
    background: var(--primary);
}

.floating-nav-item.active .nav-label {
    color: white;
}

.floating-nav-item.active .nav-dot {
    background: white;
}

.nav-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--text-light);
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.nav-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--dark);
    transition: color 0.2s ease;
}

/* Responsive header nav */
@media (max-width: 768px) {
    .floating-nav-items {
        justify-content: flex-start;
        padding: 10px 16px;
        gap: 2px;
    }

    .floating-nav-item {
        padding: 6px 10px;
    }

    .nav-label {
        font-size: 0.8rem;
    }

    .nav-dot {
        width: 4px;
        height: 4px;
    }
}

@media (max-width: 768px) {
    /* Sticky section title for Featured Projects - scoped to toc-wrapper */
    .projects {
        padding: 0;
    }

    .toc-wrapper {
        position: relative;
        max-width: 100%;
        overflow: hidden;
    }

    /* Title inside toc-wrapper is sticky within wrapper bounds */
    .toc-wrapper .section-title {
        position: sticky;
        top: 0;
        background: var(--cream);
        padding: 16px 20px 12px;
        margin-bottom: 0;
        font-size: 1.5rem;
        z-index: 40;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
        white-space: nowrap;
        text-align: center;
    }

    /* Original title hidden on mobile (cloned into wrapper) */
    .projects > .section-title {
        display: none;
    }

    .section-tagline {
        display: none;
    }

    .section-blurb {
        display: none;
    }

    .toc-grid {
        grid-template-columns: 1fr;
        padding: 0;
        gap: 0;
        margin-bottom: 0;
        max-width: 100%;
        width: 100%;
    }

    .toc-card {
        padding: 16px 20px;
        border-radius: 0;
        border: none;
        border-bottom: 1px solid var(--border);
        margin: 0;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .toc-card:first-child {
        border-top: 1px solid var(--border);
    }

    .toc-card:hover {
        border-radius: 0;
        transform: none;
    }

    .toc-icon {
        width: 36px;
        height: 36px;
        flex-shrink: 0;
    }

    .toc-info {
        width: 100%;
        overflow: hidden;
        min-width: 0;
    }

    .toc-name {
        font-size: 1rem;
    }

    .toc-tagline {
        font-size: 0.8rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

/* Project Showcase - Apple Style */
.project-showcase {
    min-height: 400vh;
    position: relative;
    margin-bottom: 0;
}

.project-showcase:last-of-type {
    min-height: 300vh;
}

/* Sticky Icon Container */
.sticky-icon-container {
    position: sticky;
    top: 50%;
    transform: translateY(-50%);
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 5;
}

.project-icon {
    width: 200px;
    height: 200px;
    opacity: 0;
    transform: scale(0.5);
}

/* Scrolling Content */
.project-content-scroll {
    position: relative;
    z-index: 10;
    pointer-events: auto;
    background: var(--cream);
}

.content-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px 40px;
}

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

.content-section h3 {
    font-size: 4rem;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--dark);
    letter-spacing: -2.5px;
}

.project-tagline {
    font-size: 1.75rem;
    color: var(--text-light);
    font-weight: 400;
    margin-bottom: 50px;
}

.project-description {
    font-size: 1.3rem;
    line-height: 1.9;
    color: var(--text-light);
    margin-bottom: 40px;
}

.project-description p {
    margin-bottom: 28px;
}

/* Tech Stack */
.tech-stack {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 40px;
}

.tech-tag {
    background: var(--dark);
    color: white;
    padding: 10px 24px;
    border-radius: 980px;
    font-size: 0.95rem;
    font-weight: 500;
}

/* Project Links */
.project-links {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.btn-project, .btn-project-secondary {
    padding: 14px 36px;
    border-radius: 980px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-block;
}

.btn-project {
    background: var(--primary);
    color: white;
}

.btn-project:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 24px rgba(139, 26, 26, 0.3);
}

.btn-project-secondary {
    background: transparent;
    color: var(--primary);
    border: 1.5px solid var(--primary);
}

.btn-project-secondary:hover {
    background: var(--primary);
    color: white;
}

/* Footer */
.footer {
    background: var(--dark);
    color: white;
    padding: 80px 20px;
    text-align: center;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
}

.footer-content p {
    margin-bottom: 24px;
    opacity: 0.7;
    font-size: 1rem;
}

.footer-links {
    display: flex;
    gap: 32px;
    justify-content: center;
    flex-wrap: wrap;
}

.footer-links a {
    color: white;
    text-decoration: none;
    opacity: 0.7;
    transition: opacity 0.3s ease;
    font-size: 1rem;
}

.footer-links a:hover {
    opacity: 1;
}

.version {
    margin-top: 20px;
    font-size: 0.85rem;
    opacity: 0.5;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
}

/* Responsive */
@media (max-width: 768px) {
    /* Compact Hero for mobile - ensure all elements above the fold */
    .hero {
        padding: 120px 20px 40px;
        min-height: 100vh;
        min-height: 100dvh; /* Dynamic viewport height for modern browsers */
        justify-content: flex-start;
    }

    .hero-logo {
        position: relative;
        top: auto;
        left: auto;
        transform: none;
        width: 120px;
        height: 120px;
        margin-bottom: 20px;
    }

    .hero-content {
        margin-top: 0;
    }

    .hero-title {
        font-size: 2.5rem;
        letter-spacing: -1.5px;
        margin-bottom: 12px;
    }

    .hero-subtitle {
        font-size: 1.1rem;
        margin-bottom: 12px;
    }

    .hero-description {
        font-size: 1rem;
        margin-bottom: 24px;
    }

    .hero-links {
        gap: 12px;
        margin-bottom: 20px;
    }

    .btn-primary, .btn-secondary {
        padding: 12px 32px;
        font-size: 1rem;
    }

    .scroll-indicator {
        position: relative;
        bottom: auto;
        margin-top: auto;
        padding-bottom: 20px;
    }

    .scroll-indicator span {
        font-size: 0.75rem;
    }

    .scroll-arrow {
        width: 20px;
        height: 20px;
    }

    .floating-logo {
        width: 70px;
        height: 70px;
        top: 20px;
    }

    .project-icon {
        width: 150px;
        height: 150px;
    }

    .content-section h3 {
        font-size: 2.5rem;
    }

    .section-title {
        font-size: 2.5rem;
    }

    .content-section {
        padding: 60px 20px;
    }

    .project-showcase {
        min-height: 350vh;
    }
}

/* Desktop Two-Column Layout */
.desktop-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 300vh;
    position: relative;
    width: 100%;
}

/* Left Side: Fixed Visual Stack (Title, Animation, Links) */
.visual-container {
    position: sticky;
    top: 60px; /* Account for sticky header nav */
    height: calc(100vh - 60px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, rgba(139, 26, 26, 0.05), rgba(184, 83, 78, 0.05));
    padding: 30px;
    opacity: 0;
    transform: scale(0.8);
    text-align: center;
}

/* Project Header with Icon */
.project-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.project-icon-wrapper {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.project-icon-wrapper svg {
    width: 100%;
    height: 100%;
    opacity: 1 !important;
    transform: none !important;
}

.project-header h3,
.visual-container h3 {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0;
    color: var(--dark);
    letter-spacing: -1px;
}

.visual-container .project-tagline {
    font-size: 1rem;
    color: var(--text-light);
    font-weight: 400;
    margin-bottom: 15px;
}

.project-visual {
    width: 100%;
    max-width: 380px;
    flex-shrink: 0;
}

/* Links and tech in visual container */
.visual-container .project-links {
    margin-top: 15px;
    margin-bottom: 10px;
    justify-content: center;
}

.visual-container .tech-stack {
    margin-bottom: 0;
    justify-content: center;
    max-width: 100%;
    flex-wrap: nowrap;
}

.visual-container .tech-tag {
    padding: 6px 12px;
    font-size: 0.75rem;
    white-space: nowrap;
}

.visual-container .btn-project,
.visual-container .btn-project-secondary {
    padding: 10px 24px;
    font-size: 0.9rem;
}

/* Right Side: Scrolling Text */
.text-content {
    background: var(--cream);
    z-index: 10;
    padding: 120px 80px;
}

.text-inner {
    min-height: 200vh;
}

/* Titles now on left side, removed from right */

.project-tldr {
    font-size: 1.5rem;
    line-height: 1.6;
    font-weight: 500;
    color: var(--dark);
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 2px solid var(--border);
}

.text-inner .project-description {
    font-size: 1.15rem;
    line-height: 1.8;
    color: var(--text-light);
    margin-bottom: 40px;
}

.text-inner .project-description p {
    margin-bottom: 24px;
}

/* Section headers from markdown ## */
.text-inner .section-header {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--dark);
    margin-top: 40px;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary);
    display: inline-block;
}

/* Mobile: Stack vertically with sticky headers */
@media (max-width: 1024px) {
    .desktop-layout {
        display: block;
        min-height: auto;
        position: relative;
        overflow: visible;
    }

    .visual-container {
        position: sticky;
        top: 55px; /* Below the floating nav */
        width: 100%;
        height: auto;
        min-height: auto;
        padding: 15px 20px;
        margin-bottom: 0;
        opacity: 1 !important;
        transform: none !important;
        background: rgba(255, 255, 255, 0.97);
        backdrop-filter: blur(10px);
        z-index: 50;
        border-bottom: 1px solid rgba(139, 26, 26, 0.15);
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    }

    /* Hide the animation visual on mobile, keep header info */
    .visual-container .project-visual {
        display: none;
    }

    .visual-container .project-links {
        margin-top: 10px;
        margin-bottom: 8px;
    }

    .visual-container .tech-stack {
        margin-bottom: 0;
    }

    .text-content {
        width: 100%;
        margin-left: 0;
        padding: 30px 20px;
        background: var(--cream);
        position: relative;
        z-index: 1;
    }

    .text-inner {
        padding: 0;
        min-height: auto;
    }

    .text-inner h3 {
        font-size: 3rem;
    }

    .text-inner .project-tagline {
        font-size: 1.4rem;
    }

    .text-inner .project-description {
        font-size: 1.1rem;
    }

    .project-showcase {
        min-height: auto !important;
        position: relative;
    }

    .project-showcase:last-of-type {
        min-height: auto !important;
    }
}

@media (max-width: 768px) {
    .text-inner {
        padding: 0;
    }

    .text-inner h3 {
        font-size: 2.5rem;
    }

    .visual-container {
        padding: 15px 20px;
        top: 55px; /* Slightly less space on small screens */
    }

    .text-content {
        padding: 25px 20px;
    }

    .project-icon-wrapper {
        width: 36px;
        height: 36px;
        margin-bottom: 0;
    }

    .project-header {
        gap: 10px;
    }

    .project-header h3,
    .visual-container h3 {
        font-size: 1.5rem;
    }

    .visual-container .project-tagline {
        font-size: 0.85rem;
        margin-bottom: 10px;
    }

    .visual-container .btn-project,
    .visual-container .btn-project-secondary {
        padding: 8px 16px;
        font-size: 0.8rem;
    }

    .visual-container .tech-tag {
        padding: 4px 10px;
        font-size: 0.7rem;
    }

    .project-tldr {
        font-size: 1.2rem;
    }
}

/* Remove old styles that conflict */
.sticky-icon-container,
.project-content-scroll,
.content-section,
.content-wrapper {
    display: none;
}
