/* ===================================
   CSS Reset & Variables
   =================================== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Color Palette - Warm, darker tones - easy on eyes */
    --bg-primary: #F0EBE3;
    --bg-secondary: #E4DED4;
    --bg-tertiary: #D5CFC3;
    --bg-card: #F5F1EA;
    --bg-terminal: #1A1A1A;

    --text-primary: #2A2520;
    --text-secondary: #4A453E;
    --text-muted: #6A645A;
    --text-light: #8A847A;

    --accent-olive: #7A8B6E;
    --accent-olive-light: #B8C4AC;
    --accent-sand: #C9BDA8;
    --accent-stone: #A69B8A;

    --border-color: #C9C3B8;
    --border-dark: #B0A898;

    /* Terminal colors */
    --terminal-green: #7EE787;
    --terminal-text: #C9D1D9;

    /* Typography */
    --font-primary: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    /* Spacing */
    --space-xs: 0.5rem;
    --space-sm: 1rem;
    --space-md: 1.5rem;
    --space-lg: 2.5rem;
    --space-xl: 4rem;

    /* Max width */
    --max-width: 900px;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(42, 37, 32, 0.06);
    --shadow-md: 0 4px 20px rgba(42, 37, 32, 0.08);
    --shadow-lg: 0 8px 40px rgba(42, 37, 32, 0.1);

    /* Dynamic Layout Defaults */
    --header-height: 80px;
    /* Fallback */
}

/* ===================================
   Base Styles
   =================================== */
html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-primary);
    font-size: 16px;
    line-height: 1.7;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::selection {
    background-color: var(--accent-olive-light);
    color: var(--text-primary);
}

/* ===================================
   Typography
   =================================== */
h1,
h2,
h3,
h4 {
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

h1 {
    font-size: 3.5rem;
    font-weight: 700;
}

h2 {
    font-size: 1.75rem;
    margin-bottom: var(--space-md);
}

h3 {
    font-size: 1.25rem;
}

h4 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: var(--space-xs);
}

p {
    color: var(--text-secondary);
}

.lead {
    font-size: 1.125rem;
    line-height: 1.7;
}

a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

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

/* ===================================
   Header
   =================================== */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding: var(--space-sm) var(--space-lg);
    background: rgba(240, 235, 227, 0.96);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    z-index: 100;
}

nav {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

nav ul {
    display: flex;
    list-style: none;
    gap: var(--space-lg);
}

nav ul a {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: color 0.2s ease;
}

nav ul a:hover {
    color: var(--text-primary);
}

.nav-social {
    display: flex;
    gap: var(--space-sm);
}

.nav-social a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.nav-social a:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* ===================================
   Main Layout
   =================================== */
main {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

section {
    padding: var(--space-xl) 0;
}

.section-label {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--accent-olive);
    display: block;
    margin-bottom: var(--space-xs);
}

.section-intro {
    color: var(--text-muted);
    margin-bottom: var(--space-lg);
}

/* ===================================
   Hero Section
   =================================== */
#hero {
    min-height: auto;
    padding-top: calc(var(--header-height) + var(--space-xl));
    padding-bottom: var(--space-md);
}

#about {
    padding-top: var(--space-lg);
}

.hero-badge {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    padding: 0.5rem 1rem;
    background: var(--accent-olive-light);
    color: var(--accent-olive);
    border-radius: 4px;
    margin-bottom: var(--space-sm);
    font-weight: 500;
}

#hero h1 {
    margin-bottom: var(--space-xs);
}

.hero-intro {
    font-size: 1.125rem;
    max-width: 550px;
    color: var(--text-secondary);
}

/* Terminal */
.hero-terminal {
    margin-top: 4.5rem;
    max-width: 450px;
    background: var(--bg-terminal);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.terminal-header {
    display: flex;
    gap: 6px;
    padding: 12px 16px;
    background: #252525;
}

.terminal-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent-stone);
}

.terminal-body {
    padding: 16px 20px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.8;
    color: var(--terminal-text);
}

.terminal-body .prompt {
    color: var(--terminal-green);
    margin-right: 8px;
}

.terminal-body .output {
    color: #8B949E;
    padding-left: 16px;
}

/* ===================================
   About Section
   =================================== */
.about-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: var(--space-lg);
    align-items: start;
}

.about-text p {
    margin-bottom: var(--space-md);
}

.skills-box {
    padding: var(--space-md);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.skill-group {
    margin-bottom: var(--space-md);
}

.skill-group:last-child {
    margin-bottom: 0;
}

.skill-group span {
    display: inline-block;
    font-size: 0.8rem;
    padding: 0.35rem 0.75rem;
    margin: 0.25rem 0.25rem 0.25rem 0;
    background: var(--bg-secondary);
    color: var(--text-muted);
    border-radius: 4px;
}

/* ===================================
   Work Section
   =================================== */
.project {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: var(--space-md);
    transition: all 0.25s ease;
}

.project:hover {
    border-color: var(--accent-olive);
    box-shadow: var(--shadow-md);
}

.project.featured {
    position: relative;
    border-color: var(--accent-olive);
}

.project-badge {
    position: absolute;
    top: var(--space-md);
    left: var(--space-md);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    padding: 0.25rem 0.75rem;
    background: var(--accent-olive);
    color: white;
    border-radius: 4px;
    font-weight: 500;
    z-index: 10;
}

.project.featured .project-media {
    height: 280px;
}

.project-media {
    height: 180px;
    background: var(--bg-tertiary);
}

.project-media video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.project-info {
    padding: var(--space-md);
}

.project-info h3 {
    margin-bottom: var(--space-xs);
}

.project-info p {
    font-size: 0.9rem;
    margin-bottom: var(--space-sm);
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
}

.project-tags span {
    font-size: 0.75rem;
    padding: 0.25rem 0.6rem;
    background: var(--bg-secondary);
    color: var(--text-muted);
    border-radius: 4px;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
}

.projects-grid .project-media {
    height: 150px;
}

/* ===================================
   Blog Section
   =================================== */
.blog-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.blog-post {
    display: flex;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.blog-post:hover {
    border-color: var(--accent-olive);
    transform: translateX(4px);
}

.blog-date {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-light);
    min-width: 90px;
}

.blog-content h3 {
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.blog-content p {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.no-posts,
.loading-posts {
    text-align: center;
    padding: var(--space-lg);
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.9rem;
}

.show-more-container {
    display: flex;
    justify-content: center;
    margin-top: var(--space-sm);
}

.show-more-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.show-more-btn:hover {
    border-color: var(--accent-olive);
    color: var(--text-primary);
    background: var(--bg-card);
}

/* ===================================
   Contact Section
   =================================== */
#contact .lead {
    margin-bottom: var(--space-lg);
}

.contact-links {
    display: flex;
    gap: var(--space-md);
}

.contact-btn {
    display: flex;
    flex-direction: column;
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.contact-btn:hover {
    border-color: var(--accent-olive);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.contact-btn span {
    font-weight: 600;
    color: var(--text-primary);
}

.contact-btn small {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* ===================================
   Footer
   =================================== */
footer {
    padding: var(--space-xl) 0;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

footer p {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* ===================================
   Responsive Design
   =================================== */
@media (max-width: 768px) {
    :root {
        --space-xl: 2rem;
        --space-lg: 1.5rem;
        --space-md: 1rem;
    }

    h1 {
        font-size: 1.5rem;
    }

    nav ul {
        gap: var(--space-sm);
    }

    .nav-social {
        display: none;
    }

    #hero {
        min-height: 80vh;
    }

    .about-grid {
        grid-template-columns: 1fr;
    }

    .projects-grid {
        grid-template-columns: 1fr;
    }

    .contact-links {
        flex-direction: column;
    }

    .blog-post {
        flex-direction: column;
        gap: var(--space-xs);
    }

    .blog-date {
        min-width: auto;
    }

    /* FORCED LAYOUT FIXES (The "Nuclear" Option) */
    #hero {
        padding-top: 180px !important;
    }

    section {
        padding: 2rem 0 !important;
    }

    .about-grid {
        gap: 2rem !important;
    }
}

/* Recon Terminal Styles */
.recon-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
    font-size: 0.8rem;
    font-family: 'JetBrains Mono', monospace;
}

.recon-label {
    color: #8B949E;
}

.recon-val {
    color: #e6edf3;
    font-weight: 500;
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    nav ul {
        font-size: 0.8rem;
        gap: 0.75rem;
    }

    header {
        padding: var(--space-sm);
    }

    main {
        padding: 0 var(--space-sm);
    }
}

/* Custom Cursor */
.custom-cursor {
    position: fixed;
    top: 0;
    left: 0;
    width: 8px;
    height: 8px;
    background-color: var(--color-text);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    transform: translate3d(-100px, -100px, 0);
    /* Start off-screen */
    mix-blend-mode: difference;
    transition: width 0.3s ease, height 0.3s ease, background-color 0.3s ease;
}

.custom-cursor-follower {
    position: fixed;
    top: 0;
    left: 0;
    width: 40px;
    height: 40px;
    background-color: rgba(186, 78, 58, 0.1);
    /* transparent accent */
    border: 1px solid var(--color-accent);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9998;
    transform: translate3d(-100px, -100px, 0);
    transition: width 0.3s ease, height 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
}

/* Hide default cursor only on devices that support hover */
@media (hover: hover) and (pointer: fine) {
    body {
        cursor: none;
    }

    a,
    button,
    input,
    textarea {
        cursor: none;
    }
}

/* Hover States */
.custom-cursor.hover {
    width: 0;
    height: 0;
    opacity: 0;
}

.custom-cursor-follower.hover {
    width: 60px;
    height: 60px;
    background-color: rgba(186, 78, 58, 0.2);
    border-color: transparent;
    mix-blend-mode: difference;
}

.custom-cursor-follower.clicking {
    width: 30px;
    height: 30px;
    border-color: var(--color-accent);
    background-color: rgba(186, 78, 58, 0.4);
    transition: width 0.1s ease, height 0.1s ease, background-color 0.1s ease;
}