:root {
    --bg-color: #f0f2f5;
    --text-color: #1a1a1a;
    --primary-color: #2563eb;
    --secondary-color: #4b5563;
    --accent-color: #f59e0b;
    --card-bg: #ffffff;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-layer: 8px 8px 0px 0px rgba(0, 0, 0, 0.1);
    /* Distinct "layered" shadow */
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    --spacing-container: 2rem;
    --max-width: 1200px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #111827;
        --text-color: #f3f4f6;
        --primary-color: #3b82f6;
        --secondary-color: #9ca3af;
        --card-bg: #1f2937;
        --border-color: #374151;
        --shadow-layer: 8px 8px 0px 0px rgba(0, 0, 0, 0.5);
    }
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-body);
    line-height: 1.6;
    overflow-x: hidden;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    line-height: 1.2;
    margin-bottom: 1rem;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--accent-color);
}

.container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 4rem;
    /* Increased from 2rem to 4rem for desktop */
}

/* Offset for sticky header navigation */
section[id] {
    scroll-margin-top: 100px;
}

/* Header */
header {
    background-color: var(--card-bg);
    border-bottom: 2px solid var(--border-color);
    padding: 1.5rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    font-family: var(--font-heading);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-icon {
    width: 24px;
    height: 24px;
    border: 2px solid currentColor;
    border-radius: 4px;
    position: relative;
}

.logo-icon::after {
    content: '';
    position: absolute;
    top: -4px;
    right: -4px;
    width: 100%;
    height: 100%;
    border: 2px solid var(--accent-color);
    border-radius: 4px;
    z-index: -1;
}

nav ul {
    display: flex;
    list-style: none;
    gap: 2rem;
}

nav a {
    font-weight: 500;
    color: var(--secondary-color);
}

nav a:hover {
    color: var(--primary-color);
}

/* Hero Section */
.hero {
    padding: 6rem 0;
    text-align: left;
    /* Changed from center */
}

.hero .container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

.hero-content {
    max-width: 600px;
}

.hero h1 {
    font-size: 3.5rem;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero p {
    font-size: 1.25rem;
    color: var(--secondary-color);
    margin-bottom: 3rem;
}

.hero-img {
    width: 100%;
    height: auto;
    max-width: 500px;
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.1));
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-20px);
    }

    100% {
        transform: translateY(0px);
    }
}

/* Concept Image */
.concept-visual {
    text-align: center;
    margin-bottom: 3rem;
}

.concept-img {
    max-width: 400px;
    width: 100%;
    height: auto;
}

/* Stack Image - Optional Helper */
.stack-illustration {
    display: block;
    margin: 0 auto 2rem;
    max-width: 300px;
    width: 100%;
}

/* Concept Section (Cards) */
.section-title {
    text-align: center;
    margin-bottom: 3rem;
    font-size: 2.5rem;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 4rem;
}

.card {
    background-color: var(--card-bg);
    border: 2px solid var(--border-color);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow-layer);
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translate(-4px, -4px);
    box-shadow: 12px 12px 0px 0px rgba(0, 0, 0, 0.1);
}

.card h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

/* Framework Tabs & Content */
.tabs {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 0.75rem 2rem;
    border: 2px solid var(--border-color);
    background: var(--card-bg);
    color: var(--secondary-color);
    font-weight: 600;
    cursor: pointer;
    border-radius: 6px;
    font-size: 1.1rem;
    transition: all 0.2s;
}

.tab-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.tab-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

.tab-content {
    display: none;
    animation: fadeIn 0.4s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.content-block {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 3rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 2rem;
}

.content-block h3 {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.content-block ul {
    list-style-position: inside;
    margin-bottom: 1.5rem;
}

.content-block li {
    margin-bottom: 0.5rem;
}

/* Interactive Stack Visualizer */
.stack-visualizer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    margin: 2rem auto;
    max-width: 600px;
    perspective: 1000px;
}

.stack-layer {
    width: 100%;
    background: var(--card-bg);
    border: 3px solid var(--secondary-color);
    padding: 1rem;
    text-align: center;
    font-weight: 700;
    border-radius: 8px;
    cursor: default;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    user-select: none;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.stack-layer:hover {
    transform: scale(1.05) translateZ(20px);
    border-color: var(--primary-color);
    color: var(--primary-color);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15);
    z-index: 10;
}

/* Specific Widths for Stack Visual */
.stack-layer[data-layer="device"] {
    width: 90%;
    background: #f8fafc;
}

.stack-layer[data-layer="os"] {
    width: 85%;
    background: #eff6ff;
}

.stack-layer[data-layer="app"] {
    width: 80%;
    background: #e0f2fe;
}

.stack-layer[data-layer="platform"] {
    width: 75%;
    background: #bae6fd;
}

.stack-layer[data-layer="account"] {
    width: 70%;
    background: #7dd3fc;
}

.stack-layer[data-layer="workspace"] {
    width: 65%;
    background: #38bdf8;
    color: white;
}

.stack-layer[data-layer="doc"] {
    width: 60%;
    background: #0ea5e9;
    color: white;
}

.stack-layer[data-layer="data"] {
    width: 55%;
    background: #0284c7;
    color: white;
}

/* Dark mode adjustments for stack */
@media (prefers-color-scheme: dark) {
    .stack-layer {
        background: #1f2937;
        border-color: #4b5563;
        color: #e5e7eb;
    }

    .stack-layer:hover {
        color: white;
        border-color: #60a5fa;
    }

    .stack-layer[data-layer="device"] {
        background: #111827;
    }

    .stack-layer[data-layer="os"] {
        background: #1f2937;
    }

    .stack-layer[data-layer="app"] {
        background: #374151;
    }

    .stack-layer[data-layer="platform"] {
        background: #4b5563;
    }

    .stack-layer[data-layer="account"] {
        background: #6b7280;
    }

    .stack-layer[data-layer="workspace"] {
        background: #9ca3af;
        color: #111827;
    }

    .stack-layer[data-layer="doc"] {
        background: #d1d5db;
        color: #111827;
    }

    .stack-layer[data-layer="data"] {
        background: #f3f4f6;
        color: #111827;
    }
}

/* Slides Section */
.slides-container {
    background-color: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    /* overflow: hidden; Removed to allow content to grow */
    position: relative;
    max-width: 900px;
    margin: 0 auto;
    box-shadow: var(--shadow-lg);
    min-height: 500px;
    /* Use min-height instead of fixed aspect ratio */
    display: flex;
    flex-direction: column;
}

/* Analogies Section */
.analogy-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.analogy-card {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 2rem;
    transition: transform 0.2s;
}

.analogy-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent-color);
}

.analogy-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    display: block;
}

/* Database Comparison Table */
.db-compare-container {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    margin: 2rem auto;
    max-width: 800px;
}

.db-table {
    width: 100%;
    border-collapse: collapse;
}

.db-table th,
.db-table td {
    padding: 1.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.db-table th {
    background: rgba(0, 0, 0, 0.02);
    font-size: 1.1rem;
    color: var(--primary-color);
}

.db-table tr:last-child td {
    border-bottom: none;
}

.db-table td:nth-child(2) {
    font-weight: 600;
    color: var(--secondary-color);
}

/* Cheat Sheet */
.cheat-sheet {
    background: #fdf2f8;
    /* Light pinkish bg to stand out */
    border: 2px dashed #db2777;
    padding: 3rem;
    border-radius: 12px;
    margin-top: 4rem;
}

@media (prefers-color-scheme: dark) {
    .cheat-sheet {
        background: #3f1d2e;
        border-color: #f472b6;
    }
}


.slide-content {
    flex: 1;
    padding: 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    transition: opacity 0.3s ease-in-out;
}

.slide-content h2 {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
}

.slide-content ul {
    text-align: left;
    list-style-position: inside;
    font-size: 1.25rem;
}

.slide-content blockquote {
    font-size: 1.5rem;
    font-style: italic;
    color: var(--secondary-color);
    border-left: 4px solid var(--accent-color);
    padding-left: 1rem;
    margin-top: 2rem;
}

.slide-controls {
    display: flex;
    justify-content: space-between;
    padding: 1rem 2rem;
    background-color: rgba(0, 0, 0, 0.02);
    border-top: 1px solid var(--border-color);
}

.btn {
    padding: 0.75rem 1.5rem;
    border: 2px solid var(--border-color);
    background-color: var(--card-bg);
    color: var(--text-color);
    font-weight: 600;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}

.btn:hover {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Footer */
footer {
    text-align: center;
    padding: 3rem 0;
    color: var(--secondary-color);
    margin-top: 4rem;
    border-top: 1px solid var(--border-color);
}

/* Utilities */
.text-center {
    text-align: center;
}

.mb-2 {
    margin-bottom: 2rem;
}

/* Slide Content Specifics */
.slide-list {
    text-align: left;
    margin: 1.5rem auto;
    font-size: 1.3rem;
    max-width: 500px;
    list-style-type: none;
}

.slide-list li {
    margin-bottom: 0.8rem;
    padding-left: 1.5rem;
    position: relative;
}

.slide-list li::before {
    content: "•";
    color: var(--primary-color);
    position: absolute;
    left: 0;
    font-weight: bold;
}

.slide-list.ordered {
    list-style-type: decimal;
    padding-left: 1.5rem;
}

.slide-list.ordered li::before {
    content: none;
}

.stack-list li {
    background: #f0f9ff;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    border-left: 4px solid var(--primary-color);
    margin-bottom: 0.5rem;
    color: #1e3a8a;
    /* Force dark blue text for contrast on light bg */
}

.large-quote {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--primary-color);
    border-left: none;
    margin: 2rem 0;
}

.help-script {
    background: #f0fdf4;
    border: 2px dashed #16a34a;
    padding: 1.5rem;
    border-radius: 8px;
    font-size: 1.25rem;
    color: #166534;
    margin: 2rem auto;
    max-width: 700px;
}

.slide-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
    margin: 2rem auto;
    max-width: 600px;
}

.slide-grid div {
    background: #eff6ff;
    padding: 1rem;
    border-radius: 6px;
    font-weight: bold;
    border: 1px solid #bfdbfe;
    color: #1e3a8a;
    /* Force dark text */
}

.text-large {
    font-size: 1.4rem;
    color: var(--secondary-color);
}

.text-primary {
    color: var(--primary-color) !important;
}

.highlight {
    color: var(--accent-color);
    font-weight: bold;
}

.takeaway-large {
    font-size: 2.5rem;
    background: linear-gradient(135deg, var(--primary-color), #8b5cf6);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
    padding: 0.5rem 0;
}

/* Skip Link (Accessibility) */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary-color);
    color: white;
    padding: 0.5rem 1rem;
    z-index: 1000;
    transition: top 0.2s;
}

.skip-link:focus {
    top: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 0 2rem;
        /* Ensure generous padding on mobile */
    }

    /* Header adjustments */
    header .container {
        flex-direction: column;
        gap: 1rem;
    }

    nav ul {
        flex-wrap: wrap;
        justify-content: center;
        gap: 1rem;
        font-size: 0.9rem;
    }

    .content-block,
    .cheat-sheet {
        padding: 1.5rem;
        /* Reduce padding on mobile */
    }

    .hero h1 {
        font-size: 2.5rem;
    }

    .hero .container {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .hero-content {
        margin: 0 auto;
    }

    .hero-img {
        order: -1;
        /* Image first on mobile */
        margin-bottom: 2rem;
        max-width: 300px;
        margin-left: auto;
        margin-right: auto;
    }

    .card-grid,
    .analogy-grid {
        grid-template-columns: 1fr;
    }

    /* Table scrolling */
    .db-compare-container {
        overflow-x: auto;
    }

    .db-table {
        min-width: 600px;
        /* Force scroll if too narrow */
    }

    .slide-content h2 {
        font-size: 1.8rem;
    }

    .slide-content ul {
        font-size: 1.1rem;
    }

    .slide-grid {
        grid-template-columns: 1fr;
    }
}