/* XAI Baba - Custom Styles */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Playfair+Display:ital,wght@0,400;0,700;1,400&display=swap');

:root {
    --bg-charcoal: #121212;
    --primary-saffron: #D97706;
    --accent-cyan: #22D3EE;
    --text-glass: rgba(255, 255, 255, 0.95); /* was 0.85 — brighter on all screens */
    --text-body: rgba(255, 255, 255, 0.82);  /* for prose paragraphs */
    --text-muted: rgba(255, 255, 255, 0.55); /* for secondary/meta text */
}

body {
    background-color: var(--bg-charcoal);
    color: var(--text-glass);
    font-family: 'Inter', sans-serif;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ─── Global text brightness overrides ─────────────────────────────────────── */

/* Tailwind's text-gray-300 and text-gray-400 are too dim on mobile OLED screens.
   Override them globally so all prose reads clearly. */
.text-gray-300,
.custom-prose .text-gray-300 {
    color: rgba(255, 255, 255, 0.82) !important;
}

.text-gray-400,
.custom-prose .text-gray-400 {
    color: rgba(255, 255, 255, 0.68) !important;
}

.text-gray-500 {
    color: rgba(255, 255, 255, 0.48) !important;
}

/* ─── Color Utilities ───────────────────────────────────────────────────────── */
.text-saffron { color: var(--primary-saffron); }
.text-cyan    { color: var(--accent-cyan); }
.bg-saffron   { background-color: var(--primary-saffron); }
.bg-charcoal  { background-color: var(--bg-charcoal); }
.border-saffron { border-color: var(--primary-saffron); }
.border-cyan    { border-color: var(--accent-cyan); }

/* ─── Typography ────────────────────────────────────────────────────────────── */
h1, h2, h3, h4, .font-serif {
    font-family: 'Playfair Display', serif;
}

/* Fluid heading scale — prevents the 5xl→7xl cliff on small screens */
@media (max-width: 640px) {
    .text-5xl  { font-size: 2.25rem !important; line-height: 1.15 !important; }
    .text-6xl  { font-size: 2.75rem !important; line-height: 1.1  !important; }
    .text-7xl  { font-size: 3rem    !important; line-height: 1.1  !important; }

    /* Article headlines get slightly more room to breathe */
    article h1 {
        font-size: 2.25rem !important;
        line-height: 1.2 !important;
        margin-bottom: 1.75rem !important;
    }

    /* Body prose — readable without being oversized */
    .custom-prose,
    .custom-prose p {
        font-size: 1rem !important;
        line-height: 1.75 !important;
    }

    /* Tighten horizontal padding so text isn't squeezed to 90% width */
    main.pt-32 { padding-left: 1.25rem !important; padding-right: 1.25rem !important; }
}

/* ─── Glows ─────────────────────────────────────────────────────────────────── */
.glow-saffron { box-shadow: 0 0 15px rgba(217, 119, 6, 0.4); }
.glow-cyan    { box-shadow: 0 0 15px rgba(34, 211, 238, 0.4); }

/* ─── Glass Card ─────────────────────────────────────────────────────────────── */
.glass-card {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.07);
    transition: all 0.3s ease;
}

.glass-card:hover {
    border-color: var(--accent-cyan);
    transform: translateY(-4px);
}

/* ─── Mobile Navigation ──────────────────────────────────────────────────────── */
/* Hamburger button — injected by main.js, hidden on md+ */
#mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: border-color 0.2s;
}

#mobile-menu-btn:hover { border-color: var(--primary-saffron); }
#mobile-menu-btn svg   { width: 1.25rem; height: 1.25rem; color: white; }

@media (min-width: 768px) {
    #mobile-menu-btn { display: none !important; }
}

/* Mobile drawer */
#mobile-nav {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 40;
}

#mobile-nav.open { display: block; }

#mobile-nav-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
}

#mobile-nav-drawer {
    position: absolute;
    top: 0;
    right: 0;
    width: min(80vw, 300px);
    height: 100%;
    background: #1a1a1a;
    border-left: 1px solid rgba(255,255,255,0.08);
    padding: 5rem 2rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#mobile-nav.open #mobile-nav-drawer {
    transform: translateX(0);
}

#mobile-nav-drawer a {
    font-size: 1.125rem;
    font-weight: 600;
    color: rgba(255,255,255,0.85);
    padding: 0.875rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    transition: color 0.2s;
    text-decoration: none;
    letter-spacing: 0.01em;
}

#mobile-nav-drawer a:hover,
#mobile-nav-drawer a.active { color: var(--primary-saffron); }

#mobile-nav-drawer .nav-subscribe {
    margin-top: 1.5rem;
    background: var(--primary-saffron);
    color: black;
    text-align: center;
    border-radius: 9999px;
    padding: 0.875rem 1.5rem;
    font-weight: 700;
    font-size: 0.9rem;
    border-bottom: none;
}

#mobile-nav-close {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.6);
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
    padding: 0.25rem;
}

/* ─── Blog Grid ──────────────────────────────────────────────────────────────── */
#blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
    gap: 2rem;
}

/* ─── Substack override ──────────────────────────────────────────────────────── */
#substack-feed-container { width: 100% !important; }

/* ─── Misc Utilities ─────────────────────────────────────────────────────────── */
.zen-gradient { background: linear-gradient(135deg, #121212 0%, #1a1a1a 100%); }

.hero-for {
    font-size: 0.6em;
    vertical-align: middle;
}

.footer-icon { transition: transform 0.2s ease, color 0.2s ease; }
.footer-icon:hover {
    color: var(--primary-saffron);
    transform: scale(1.2);
}

/* ─── Webcomic Carousel ──────────────────────────────────────────────────────── */
.carousel-container {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
    overflow: hidden;
    border-radius: 1rem;
}

.carousel-slide { display: none; animation: fadeIn 0.5s ease-in-out; }
.carousel-slide.active { display: block; }

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    padding: 0.75rem;
    cursor: pointer;
    z-index: 10;
    border-radius: 50%;
    transition: background 0.3s;
}

@media (max-width: 640px) {
    .carousel-btn { padding: 0.5rem; font-size: 0.85rem; }
    .carousel-prev { left: 0.5rem; }
    .carousel-next { right: 0.5rem; }
}

.carousel-btn:hover { background: var(--primary-saffron); }
.carousel-prev { left: 1rem; }
.carousel-next { right: 1rem; }

/* ─── Article page spacing on mobile ────────────────────────────────────────── */
@media (max-width: 640px) {
    /* Back link + tag row wraps gracefully */
    article .flex.items-center.gap-4.mb-6 {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    /* Quote blocks don't overflow */
    .border-l-4 { padding-left: 1rem !important; }

    /* Image aspect ratio stays sane */
    .aspect-\[21\/9\] { aspect-ratio: 16 / 9 !important; }
}
