/* ==========================================================================
   1. DESIGN SYSTEM VARIABLES (Theme & Logic)
   ========================================================================== */

:root,
[data-theme="light"] {
    /* Core Brand Palette */
    --brand-cream: #f6f3f0;
    --brand-ink: #111111;
    --brand-charcoal: #202020;
    --brand-yellow: #f4ca66;
    --brand-purple: #8978e5;
    --brand-orange: #e88149;
    --brand-green: #9ad88b;

    /* Semantic Variables (Light Mode) */
    --bg: var(--brand-cream);
    --fg: var(--brand-charcoal);
    --accent: var(--brand-purple);
    --border-color: var(--brand-ink);
    --shadow-color: var(--brand-ink);
    --card-bg: #ffffff; /* Pure white makes cards pop off the off-white bg */

    /* Typography */
    --mono: 'Consolas', 'Monaco', 'Courier New', monospace;
    --sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --heading: var(--sans);

    /* Global UI */
    --border-width: 3px;
    --border: var(--border-width) solid var(--border-color);
}


[data-theme="dark"] {
    /* Semantic Variables (Dark Mode) */
    --bg: var(--brand-ink);
    --fg: var(--brand-cream);
    --accent: var(--brand-yellow); /* Yellow pops best on black */
    --border-color: var(--brand-cream);
    --shadow-color: var(--brand-purple); /* Purple shadows in dark mode! */
    --card-bg: var(--brand-charcoal);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: var(--brand-ink);
        --fg: var(--brand-cream);
        --accent: var(--brand-yellow);
        --border-color: var(--brand-cream);
        --shadow-color: var(--brand-purple);
        --card-bg: var(--brand-charcoal);
    }
}

/* ==========================================================================
   2. RESETS & BASE
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background: var(--bg);
    color: var(--fg);
    font-family: var(--sans);
    line-height: 1.6;
    overflow-x: hidden;
    transition: background 0.3s, color 0.3s;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

h1, h2, h3 {
    font-family: var(--heading);
    font-weight: 800; /* Chunky headings */
    letter-spacing: -1px;
    color: var(--fg);
}

a {
    color: var(--accent);
    text-decoration: underline;
    font-weight: 600;
}

/* ==========================================================================
   3. UTILITIES & DESIGN SYSTEM (Maintainable Classes)
   ========================================================================== */

/* 1. The Standard "Retro Card" Style goes FIRST */
.retro-card {
    border: var(--border);
    border-radius: 8px;
    background: var(--card-bg); /* Baseline background */
    box-shadow: 8px 8px 0px var(--shadow-color);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.retro-card:hover {
    transform: translate(-2px, -2px);
    box-shadow: 10px 10px 0px var(--shadow-color);
}

/* 2. Color Overrides go SECOND so they win the specificity battle */
.bg-yellow {
    background-color: var(--brand-yellow) !important;
    color: var(--brand-ink);
}

.bg-yellow h1, .bg-yellow h2, .bg-yellow h3, .bg-yellow p {
    color: var(--brand-ink);
}

.bg-dark {
    background-color: var(--brand-ink) !important;
    color: var(--brand-cream);
}

.bg-dark h1, .bg-dark h2, .bg-dark h3, .bg-dark p {
    color: var(--brand-cream);
}

/* ==========================================================================
   4. NAVIGATION & HEADER
   ========================================================================== */
header {
    border-bottom: var(--border);
    padding: 1.5rem 0;
    background: var(--bg);
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: var(--mono);
    font-weight: bold;
    font-size: 1.2rem;
    text-decoration: none;
    text-transform: uppercase;
}

.nav-links {
    display: flex;
    gap: 20px;
    align-items: center;
}

.nav-links a {
    text-decoration: none;
    font-size: 0.95rem;
}

.nav-links a:hover {
    text-decoration: underline;
}

.theme-toggle-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0 5px;
    opacity: 0.8;
    transition: transform 0.2s;
}

.theme-toggle-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* ==========================================================================
   5. BUTTONS
   ========================================================================== */
.cta-group {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    align-items: center;
}

.btn {
    display: inline-block;
    background: var(--brand-yellow);
    color: var(--brand-ink) !important;
    padding: 1rem 2.5rem;
    font-family: var(--heading);
    font-weight: 800;
    font-size: 1.1rem;
    text-decoration: none;
    border: var(--border);
    border-radius: 6px;
    box-shadow: 6px 6px 0px var(--shadow-color);
    transition: all 0.1s ease-in-out;
    text-align: center;
}

.btn:hover {
    transform: translate(2px, 2px);
    box-shadow: 4px 4px 0px var(--shadow-color);
}

.btn:active {
    transform: translate(6px, 6px);
    box-shadow: 0px 0px 0px var(--shadow-color);
}

.btn-outline {
    background: var(--card-bg);
    color: var(--fg) !important;
}

/* ==========================================================================
   6. PAGE SECTIONS (Hero, Grid, Split)
   ========================================================================== */
.hero {
    padding: 6rem 0 5rem;
    text-align: center;
    border-bottom: var(--border);
}

.hero h1 {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    line-height: 1.1;
}

.hero p {
    font-size: 1.25rem;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto 2rem;
}

/* Legacy mappings applied to the new retro-card utility */
.hero-shot-container, .showcase-img, .orch-img, .code-editor {
    border: var(--border);
    border-radius: 8px;
    background: var(--card-bg);
    box-shadow: 8px 8px 0px var(--shadow-color);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hero-shot-container:hover, .showcase-img:hover, .orch-img:hover, .code-editor:hover {
    transform: translate(-2px, -2px);
    box-shadow: 10px 10px 0px var(--shadow-color);
}

.hero-shot {
    width: 100%;
    display: block;
    border-radius: 4px;
}

/* Section Borders */
.grid-section, .showcase-section, .orchestration-section, .tech-stack-section {
    border-bottom: var(--border);
}

/* Grids */
.grid-section {
    padding: 5rem 0;
}

.grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3rem;
    margin-top: 3rem;
}

.grid-2-col {
    grid-template-columns: repeat(2, 1fr);
    max-width: 850px;
    margin-left: auto;
    margin-right: auto;
}

.feature-card h3 {
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

/* Splits (Updated for massive, stacked images!) */
.showcase-section {
    padding: 6rem 0;
}

.showcase-section h3 {
    font-size: 2.2rem;
    margin-bottom: 1rem;
}

/* Made headings slightly bigger to match scale */
.showcase-wrap {
    display: flex;
    flex-direction: column; /* This stacks the text on top of the image */
    gap: 3rem;
    width: 100%;
}

.showcase-text {
    width: 100%;
    max-width: 800px; /* Keeps reading line-length comfortable */
}

.showcase-img {
    width: 100%;
    max-width: 100%;
    height: auto;
    object-fit: contain;
}


/* Orchestration (Fixed CSS Grid Overflow) */
.orchestration-section {
    padding: 6rem 0;
}

.section-header {
    text-align: center;
    margin-bottom: 4rem;
    max-width: 700px;
    margin: 0 auto 4rem;
}

.dual-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
}

.orch-card {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    min-width: 0; /* ✨ THE MAGIC FIX: Prevents images from blowing out the grid */
}

.orch-card p {
    margin-bottom: 2rem;
    flex-grow: 1;
}

.orch-img {
    width: 100%;
    max-width: 100%; /* Ensures the image respects the card boundary */
    height: auto;
    border: var(--border);
    border-radius: 4px;
}

/* Tech Stack Code Editor */
.tech-stack-section {
    padding: 6rem 0;
}

.tech-grid {
    display: flex;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    gap: 4rem;
}

.tech-text {
    flex: 1;
    min-width: 300px;
}

.code-editor {
    flex: 1;
    background: #1e1e1e;
    font-family: var(--mono);
    font-size: 0.9rem;
    color: #d4d4d4;
}

.editor-header {
    background: #252526;
    padding: 8px 15px;
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #999;
}

.editor-body {
    padding: 20px;
    line-height: 1.6;
    overflow: auto;
}

.c-key {
    color: #9cdcfe;
}

.c-str {
    color: #ce9178;
}

.c-num {
    color: #b5cea8;
}

.c-bool {
    color: #569cd6;
}

/* ==========================================================================
   7. FOOTER, CTA, PRIVACY BANNER
   ========================================================================== */
.cta-section {
    padding: 100px 20px;
    text-align: center;
    border-top: var(--border);
}

.cta-heading {
    font-family: var(--mono);
    font-size: 2rem;
    margin-bottom: 10px;
}

.cta-subtext {
    font-size: 1.1rem;
    opacity: 0.8;
    margin-bottom: 30px;
}

.tally-container {
    max-width: 500px;
    margin: 0 auto;
    position: relative;
}

.branding-mask {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 100px;
    height: 65px;
    background: var(--bg);
    z-index: 10;
    pointer-events: none;
}

.site-footer {
    padding: 40px 20px;
    border-top: var(--border);
    text-align: center;
    font-size: 0.85rem;
}

.footer-links a {
    margin: 0 10px;
    text-decoration: none;
    font-weight: 500;
}

.copyright {
    margin-top: 20px;
    font-family: var(--mono);
    opacity: 0.7;
}

#privacy-banner {
    display: none;
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 650px;
    background: var(--card-bg);
    border: var(--border);
    padding: 24px;
    z-index: 10000;
    box-shadow: 8px 8px 0px var(--shadow-color);
}

#privacy-banner p {
    margin: 0 0 20px 0;
    font-size: 15px;
}

.banner-buttons {
    display: flex;
    gap: 16px;
}

.banner-btn {
    padding: 10px 20px;
    font-family: var(--heading);
    font-weight: bold;
    cursor: pointer;
    border: var(--border);
    border-radius: 4px;
    box-shadow: 4px 4px 0px var(--shadow-color);
    transition: transform 0.1s ease;
}

.banner-btn:active {
    transform: translate(4px, 4px);
    box-shadow: 0px 0px 0px var(--shadow-color);
}

#btn-accept {
    background: var(--brand-yellow);
    color: var(--brand-ink);
}

#btn-reject {
    background: transparent;
    color: var(--fg);
}

/* ==========================================================================
   8. LIGHTBOX & MOBILE
   ========================================================================== */
dialog.lightbox {
    background: transparent;
    border: none;
    padding: 0;
    max-width: 90vw;
    max-height: 90vh;
    margin: auto;
    overflow: hidden;
    z-index: 10000;
}

dialog.lightbox::backdrop {
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(2px);
    z-index: 9999;
}

dialog.lightbox img {
    display: block;
    max-width: 100%;
    max-height: 90vh;
    border: var(--border);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    cursor: zoom-out;
}

.zoomable {
    cursor: zoom-in;
}

.zoomable:hover {
    transform: scale(1.01);
}

@media (max-width: 768px) {
    header {
        padding: 1rem 0;
    }

    nav {
        flex-direction: column;
        gap: 1rem;
        align-items: center;
    }

    /* Let the links wrap gracefully into multiple centered rows */
    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 1rem 1.5rem; /* 1rem vertical gap, 1.5rem horizontal gap */
    }

    /* Prevent words like "The Stack" from breaking onto two lines */
    .nav-links a {
        white-space: nowrap;
    }

    .hero {
        padding: 3rem 0;
    }

    .hero h1 {
        font-size: 2.5rem;
    }

    .cta-group {
        flex-direction: column;
        width: 100%;
    }

    .btn {
        width: 100%;
    }

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

    .showcase-wrap {
        flex-direction: column !important;
    }

    .showcase-img {
        width: 100%;
    }

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

    .tech-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 2rem !important;
    }

    .footer-links {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        gap: 1rem 1.5rem; /* Controls spacing between links */
    }

    .footer-links a {
        margin: 0 !important; /* This strips out the desktop margins AND the inline margin-left */
        white-space: nowrap; /* Keeps the link text from breaking in half */
    }

    .footer-links .btn {
        width: 100%; /* Makes the button span the width of the container */
        max-width: 280px; /* Keeps it from getting comically wide on tablets */
        margin-top: 1rem !important; /* Gives it breathing room from the text links */
        padding: 0.8rem 1rem !important; /* Makes it a taller, easier tap target on phones */
    }
}