:root {
    --bg-color: #0e0e10;
    --text-color: #d4d4d8;
    --accent-color: hsl(187 93% 67%);
    --card-bg: #161618;
    --card-border: rgba(255, 255, 255, 0.07);
    --font-heading: 'DM Serif Display', serif;
    --font-body: 'Inter', sans-serif;
    --transition-speed: 0.6s;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-body);
    line-height: 1.7;
    letter-spacing: -0.01em;
    overflow-x: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

/* Grain Texture Overlay */
.grain-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.04;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%2%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

.container {
    max-width: 800px;
    width: 90%;
    padding: 4rem 0;
    z-index: 1;
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 8rem);
}

/* Hero Section */
.hero {
    text-align: center;
    margin-bottom: 4rem;
}

h1 {
    font-family: var(--font-heading);
    font-size: clamp(3rem, 8vw, 5rem);
    line-height: 1.1;
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

.subtitle {
    font-size: 1.2rem;
    font-weight: 400;
    opacity: 0.75;
    letter-spacing: 0.05em;
}

.accent {
    color: var(--accent-color);
    font-weight: 400;
}

/* Grid Layout (Lydia Hallie inspired centered square cards) */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 4rem;
}

.card {
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    aspect-ratio: 1 / 1; /* Makes cards square */
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 2rem;
    transition: transform var(--transition-speed) cubic-bezier(0.23, 1, 0.32, 1), border-color 0.3s ease;
    position: relative;
    overflow: hidden;
}

.card:hover {
    transform: scale(1.02);
    border-color: rgba(255, 255, 255, 0.2);
}

.card h3 {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    margin-bottom: 1rem;
    letter-spacing: -0.01em;
}

.card p {
    font-size: 0.95rem;
    opacity: 0.7;
    font-weight: 400;
}

/* Footer */
.footer {
    text-align: center;
    margin-top: auto;
    padding-top: 3rem;
}

nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    font-size: 0.9rem;
    opacity: 0.6;
}

.footer-link {
    color: inherit;
    text-decoration: none;
    font-size: 0.8rem;
    opacity: 0.45;
    transition: opacity 0.3s ease, color 0.3s ease;
}

.footer-link:hover {
    opacity: 1;
    color: var(--accent-color);
}

.separator {
    opacity: 0.3;
}

/* Reveal Animations */
.reveal {
    opacity: 0;
    transform: translateY(20px);
    animation: revealAnimation var(--transition-speed) cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

@keyframes revealAnimation {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .grid {
        grid-template-columns: 1fr;
    }

    .card {
        aspect-ratio: auto; /* Allow vertical flow on small mobile */
        min-height: 250px;
    }
}

/* ── Blog Card Grid (index.php) — Lydia Hallie style ───────────── */

.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
    margin-bottom: 4rem;
}

.blog-card {
    display: block;
    text-decoration: none;
    color: inherit;
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(14, 239, 216, 0.25),
                0 1px 6px rgba(0, 0, 0, 0.5);
    transition: transform var(--transition-speed) cubic-bezier(0.23, 1, 0.32, 1),
                box-shadow var(--transition-speed) ease;
}

.blog-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 32px rgba(14, 239, 216, 0.45),
                0 2px 10px rgba(0, 0, 0, 0.6);
}

.card-image-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-bottom: 1px solid var(--card-border);
}

.card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

.blog-card:hover .card-image {
    transform: scale(1.04);
}

.card-content {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 1.2rem 1.4rem;
}

.card-topic {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    opacity: 0.5;
    font-weight: 500;
}

.card-content h3 {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    line-height: 1.3;
    letter-spacing: -0.01em;
    margin: 0;
}

.card-date {
    font-size: 0.85rem;
    opacity: 0.4;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.card-type-badge {
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
}

.card-type-duo {
    color: #c084fc;
    background-color: rgba(192, 132, 252, 0.1);
}

.card-type-presentation {
    color: #fb923c;
    background-color: rgba(251, 146, 60, 0.1);
}

.no-posts {
    text-align: center;
    opacity: 0.5;
    font-size: 1.1rem;
}

/* ── Post Page (post.php) ─────────────────────────────────────── */

body.post-page {
    display: block; /* Override centered flex for post pages */
}

/* Top bar */
.post-header {
    text-align: center;
    padding: 3rem 1.5rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
}

.back-link {
    display: inline-block;
    position: absolute;
    left: 1.5rem;
    top: 3rem;
    color: var(--text-color);
    text-decoration: none;
    opacity: 0.6;
    font-size: 0.9rem;
    transition: opacity 0.3s ease, color 0.3s ease;
}

.back-link:hover {
    opacity: 1;
    color: var(--accent-color);
}

.post-header h1 {
    font-size: clamp(2rem, 5vw, 3rem);
    margin-bottom: 1.5rem;
}

.post-date {
    display: block;
    opacity: 0.5;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.post-prompt {
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
    font-size: 0.8rem;
    opacity: 0.5;
    font-style: italic;
    margin-top: 1rem;
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

.post-prompt .prompt-label {
    font-weight: 400;
    opacity: 0.7;
}

.share-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-color);
    opacity: 0.6;
    padding: 0.5rem;
    transition: opacity 0.3s ease, color 0.3s ease;
}

.share-btn:hover {
    opacity: 1;
    color: var(--accent-color);
}

/* Split container */
.split-container {
    display: flex;
    max-width: 1400px;
    margin: 0 auto;
    min-height: calc(100vh - 200px);
    position: relative;
}

/* Panels */
.panel {
    flex: 1;
    padding: 2rem 3rem;
    overflow-y: auto;
    max-height: calc(100vh - 200px);
}

/* Independent scroll — custom scrollbar */
.panel::-webkit-scrollbar {
    width: 6px;
}

.panel::-webkit-scrollbar-track {
    background: transparent;
}

.panel::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

/* Panel divider */
.split-container::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 1px;
    background-color: var(--card-border);
}

/* Panel labels */
.panel-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 2rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--card-border);
    opacity: 0.6;
}

.panel-label.human {
    color: var(--text-color);
}

.panel-label.agent {
    color: var(--accent-color);
}

/* Agent panel accent right edge */
.panel-agent::before {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: var(--accent-color);
    opacity: 0.3;
}

/* Markdown body styling */
.panel-body {
    font-weight: 400;
}

.panel-body h1, .panel-body h2, .panel-body h3,
.panel-body h4, .panel-body h5, .panel-body h6 {
    font-family: var(--font-heading);
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.panel-body p {
    margin-bottom: 1rem;
    opacity: 0.9;
}

.panel-body a {
    color: var(--accent-color);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.3s ease;
}

.panel-body a:hover {
    border-bottom-color: var(--accent-color);
}

.panel-body blockquote {
    border-left: 2px solid var(--accent-color);
    padding-left: 1rem;
    margin: 1rem 0;
    opacity: 0.8;
    font-style: italic;
}

.panel-body code {
    background-color: rgba(255, 255, 255, 0.06);
    padding: 0.15em 0.4em;
    border-radius: 3px;
    font-size: 0.9em;
}

.panel-body pre {
    background-color: rgba(255, 255, 255, 0.04);
    padding: 1rem;
    border-radius: 6px;
    overflow-x: auto;
    margin: 1rem 0;
}

.panel-body pre code {
    background: none;
    padding: 0;
}

.panel-body ul, .panel-body ol {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

.panel-body li {
    margin-bottom: 0.4rem;
}

.panel-body hr {
    border: none;
    border-top: 1px solid var(--card-border);
    margin: 2rem 0;
}

.panel-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.9em;
}

.panel-body th, .panel-body td {
    padding: 0.6rem 0.8rem;
    text-align: left;
    border-bottom: 1px solid var(--card-border);
}

.panel-body th {
    font-weight: 500;
    opacity: 0.9;
}

.panel-body tr:hover td {
    background-color: rgba(255, 255, 255, 0.03);
}

.empty-panel {
    opacity: 0.4;
    font-style: italic;
}

/* ── Mobile Toggle Badge (post.php) ───────────────────────────── */

.mobile-toggle {
    display: none; /* Hidden on desktop, shown on mobile via media query */
    position: fixed;
    top: 1rem;
    z-index: 100;
    background-color: var(--card-bg);
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    font-family: var(--font-body);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.4em 1em;
    border-radius: 20px;
    cursor: pointer;
    transition: transform 0.3s ease, background-color 0.3s ease;
}

/* ── Mobile Toggle Tabs (post.php — duo template) ─────────────── */

.mobile-tabs {
    display: none; /* Hidden on desktop, shown on mobile via media query */
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1.2rem;
}

.mobile-tab {
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    color: var(--text-color);
    font-family: var(--font-body);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.5em 1.4em;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.45em;
}

.mobile-tab:hover {
    border-color: rgba(255, 255, 255, 0.2);
}

.mobile-tab.active {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.mobile-tab svg {
    transition: transform 0.3s ease;
}

.mobile-tab.active svg {
    transform: rotate(180deg);
}

/* ── Mobile Responsive (post.php) ─────────────────────────────── */

@media (max-width: 768px) {
    .split-container {
        flex-direction: column;
    }

    /* On mobile, only one panel is visible at a time via JS toggle */
    .panel {
        display: none;
        max-height: calc(100vh - 200px);
        padding: 1rem 1.5rem;
    }

    .panel.active {
        display: block;
    }

    .split-container::after {
        display: none; /* No divider on mobile */
    }

    /* Show new tabs, hide old fixed badge */
    .mobile-tabs {
        display: flex;
    }

    .post-header h1 {
        font-size: clamp(1.5rem, 6vw, 2rem);
    }

    .back-link {
        top: 0.75rem;
    }
}

/* ── Links ───────────────────────────────────────────── */

a {
    color: inherit;
    text-decoration: underline;
    text-decoration-color: rgba(255, 255, 255, 0.3);
    transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

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

/* Remove underline from structural links that have their own styles */
.blog-card,
.back-link,
.footer-link {
    text-decoration: none !important;
}

/* ── Presentation Mode ─────────────────────────────────────────── */

.presentation-viewport {
    position: fixed;
    inset: 0;
    overflow: hidden;
    background-color: var(--bg-primary);
}

.presentation-slide {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 300ms ease;
    padding: 2rem;
    z-index: 2;
}

.presentation-slide.active {
    opacity: 1;
    pointer-events: auto;
}

.slide-content {
    max-width: 1150px;
    width: 100%;
    margin: 0 auto;
}

.slide-content > * + * {
    margin-top: 1.2em;
}

/* Layout variants */
.slide-layout-center {
    text-align: center;
}

.slide-layout-left {
    text-align: left;
    max-width: 950px;
    margin-left: 10%;
}

.slide-layout-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: center;
}

/* Slide typography */
.presentation-slide h1,
.presentation-slide h2 {
    font-family: var(--font-heading);
    margin-bottom: 1.5em;
}

.presentation-slide h1 {
    font-size: clamp(2rem, 6vw, 3.5rem);
}

.presentation-slide h2 {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
}

.presentation-slide p {
    font-size: clamp(1rem, 3vw, 1.125rem); /* ~18px */
    line-height: 1.7;
    opacity: 0.85;
}

/* Navigation Dots */
.presentation-nav {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background-color: rgba(0, 0, 0, 0.4);
    padding: 0.6rem 1.2rem;
    border-radius: 2rem;
    backdrop-filter: blur(8px);
    z-index: 10;
}

.nav-counter {
    font-size: 0.85rem;
    color: var(--text-color);
    opacity: 0.6;
    min-width: 3ch;
    text-align: center;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-dots {
    display: flex;
    gap: 0.5rem;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: none;
    background-color: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.dot.active {
    background-color: var(--accent-color);
    transform: scale(1.3);
}

.dot:hover {
    background-color: rgba(255, 255, 255, 0.6);
}

/* Lantern Effect */
.lantern-glow {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    background: radial-gradient(circle 200px at var(--mx, 50%) var(--my, 50%), rgba(255, 255, 255, 0.03), transparent);
}

/* Presentation tables (inherited from markdown) */
.presentation-slide table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.presentation-slide th,
.presentation-slide td {
    padding: 0.6rem 0.8rem;
    text-align: left;
    border-bottom: 1px solid var(--card-border);
}

.presentation-slide th {
    font-weight: 500;
    opacity: 0.9;
}

/* Presentation code blocks */
.presentation-slide pre {
    background-color: rgba(255, 255, 255, 0.04);
    padding: 1rem;
    border-radius: 6px;
    overflow-x: auto;
}

.presentation-slide blockquote {
    border-left: 2px solid var(--accent-color);
    padding-left: 1rem;
    margin-top: 4em;
    margin-bottom: 0;
    color: var(--accent-color);
    font-style: italic;
}

.presentation-slide blockquote strong {
    font-weight: 600;
    opacity: 1;
}

/* ── Presentation Mode Mobile Responsive ─────────────────────── */

/* Nav counter flex layout (desktop + mobile) */
.nav-counter {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
}

/* Last-slide buttons (Home / Start) — desktop + mobile */
.pres-nav-btn {
    display: inline-block;
    background-color: var(--card-bg);
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    font-family: var(--font-body);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.35em 1em;
    border-radius: 20px;
    cursor: pointer;
    text-decoration: none !important;
    transition: all 0.3s ease;
}

.pres-nav-btn:hover {
    background-color: var(--accent-color);
    color: var(--bg-color);
}

@media (max-width: 768px) {
    .presentation-viewport {
        overflow-y: auto; /* Allow scrolling on mobile when content overflows */
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: y mandatory; /* Snap to each slide on vertical swipe */
    }

    .presentation-slide {
        position: relative; /* No longer absolute — let it flow and scroll */
        min-height: 100vh;
        padding: 5rem 1.2rem 6rem;
        scroll-snap-align: start; /* Each slide snaps into view */
    }

    .presentation-slide:not(.active) {
        display: none !important; /* Hide inactive slides completely (no invisible stacking) */
    }

    .slide-content {
        width: 100%;
    }

    /* Fix split layout stacking on mobile */
    .slide-layout-split {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .slide-layout-left {
        margin-left: 0;
        max-width: 100%;
    }

    /* Fix list bullets overlapping text */
    .presentation-slide ul,
    .presentation-slide ol {
        padding-left: 2rem;
        margin-left: 0;
    }

    .presentation-slide li {
        padding-left: 0.25em;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    /* Smaller typography on mobile */
    .presentation-slide h1 {
        font-size: clamp(1.6rem, 7vw, 2.5rem);
    }

    .presentation-slide h2 {
        font-size: clamp(1.3rem, 5vw, 2rem);
    }

    .presentation-slide p {
        font-size: clamp(0.95rem, 4vw, 1rem);
    }

    /* Nav dots stay fixed at bottom — stack counter above dots */
    .presentation-nav {
        position: fixed;
        bottom: 1rem;
        padding: 0.5rem 1rem;
        flex-direction: column; /* Counter on top, dots below */
        gap: 0.6rem;
    }

    .nav-counter {
        white-space: nowrap; /* Prevent "1/x" wrapping to two lines */
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 0.5rem;
    }
}
