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

:root {
    /* Paper/ink palette — mirrors bitroot-v3 (globals.css) so the blog
       reads as the same product as the homepage newslogger section. */
    --bitroot-primary-blue: #525ceb;
    --bitroot-dark-blue: #161d24;
    --bitroot-light-blue: #ebedfc;
    --bitroot-pink: #7782ee;
    --off-white: #f6f7fb;
    --white: #ffffff;
    --black: #3d3b40;
    --grey: #e8eaf3;
    --dark-grey: #5a585e;
    --light-grey: #f6f7fb;

    /* Fonts */
    --font-sans: 'Geist', system-ui, -apple-system, sans-serif;
    --font-mono: 'Geist Mono', ui-monospace, monospace;
    --font-display: 'Funnel Display', var(--font-sans);
    --font-serif: 'Instrument Serif', 'Times New Roman', serif;

    /* Theme Colors */
    --bg: var(--white);
    --bg-secondary: var(--white);
    --text-primary: var(--black);
    --text-secondary: var(--dark-grey);
    --text-muted: #807d86;
    --border: var(--grey);
    --accent: var(--bitroot-primary-blue);
    --tag-bg: var(--bitroot-light-blue);
    --tag-text: var(--bitroot-primary-blue);

    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;
    --spacing-3xl: 4rem;

    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 22px;

    --max-width: 1232px;

    /* Grid Pattern */
    --grid-color: rgba(82, 92, 235, 0.07);
    --grid-size: 40px;
}

/* Dark theme — toggled via data-theme or system preference */
[data-theme="dark"] {
    --bitroot-primary-blue: #7782ee;
    --bitroot-light-blue: rgba(82, 92, 235, 0.16);
    --bg: #121114;
    --bg-secondary: #1d1b22;
    --text-primary: #e9e3f0;
    --text-secondary: #a8a4b0;
    --text-muted: #6f6b78;
    --border: #2c2933;
    --accent: #7782ee;
    --tag-bg: rgba(82, 92, 235, 0.16);
    --tag-text: #9aa2f2;
    --grid-color: rgba(119, 130, 238, 0.05);
}

html {
    font-size: 16px;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Ambient aurora background — soft fixed gradient washes behind everything */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    background:
        radial-gradient(900px 600px at 12% -8%, rgba(82, 92, 235, 0.11), transparent 62%),
        radial-gradient(1100px 700px at 92% 4%, rgba(119, 130, 238, 0.10), transparent 60%),
        radial-gradient(800px 600px at 30% 108%, rgba(251, 207, 217, 0.22), transparent 60%),
        radial-gradient(700px 500px at 78% 92%, rgba(82, 92, 235, 0.07), transparent 55%);
}

[data-theme="dark"] body::before {
    background:
        radial-gradient(900px 600px at 12% -8%, rgba(82, 92, 235, 0.20), transparent 62%),
        radial-gradient(1100px 700px at 92% 4%, rgba(119, 130, 238, 0.13), transparent 60%),
        radial-gradient(800px 600px at 30% 108%, rgba(160, 90, 200, 0.10), transparent 60%),
        radial-gradient(700px 500px at 78% 92%, rgba(82, 92, 235, 0.10), transparent 55%);
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Header (post pages) — frosted glass bar */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: rgba(255, 255, 255, 0.55);
    -webkit-backdrop-filter: blur(22px) saturate(1.8);
    backdrop-filter: blur(22px) saturate(1.8);
    border-bottom: 1px solid rgba(61, 59, 64, 0.08);
}

[data-theme="dark"] .header {
    background-color: rgba(18, 17, 20, 0.55);
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

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

.logo {
    display: flex;
    align-items: center;
}

.logo-img {
    height: 28px;
    width: auto;
}


.logo:hover {
    opacity: 0.8;
}
.nav-links {
    display: flex;
    gap: var(--spacing-lg);
    align-items: center;
}

.nav-link {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    color: var(--text-secondary);
    transition: color 0.2s ease;
    font-weight: 500;
}

.nav-link:hover {
    color: var(--bitroot-primary-blue);
}

.nav-link.active {
    color: var(--bitroot-primary-blue);
}

/* Theme toggle */
.theme-toggle {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    padding: 5px 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: color 0.2s, border-color 0.2s;
    font-family: inherit;
    line-height: 1;
}

.theme-toggle:hover {
    color: var(--bitroot-primary-blue);
    border-color: var(--bitroot-primary-blue);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
    width: 16px;
    height: 16px;
}

/* Show moon in light mode, sun in dark mode */
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }

[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* Hero */
.hero {
    padding: var(--spacing-3xl) var(--spacing-xl) var(--spacing-2xl);
    max-width: var(--max-width);
    margin: 0 auto;
    width: 100%;
    position: relative;
}

.hero-eyebrow {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.02em;
    color: var(--accent);
}

.hero-content h1 {
    font-family: var(--font-display);
    font-size: clamp(44px, 6.5vw, 84px);
    font-weight: 700;
    letter-spacing: -0.045em;
    line-height: 0.95;
    margin-top: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
    color: var(--text-primary);
}

.hero-serif {
    font-family: var(--font-serif);
    font-style: italic;
    font-weight: 400;
    letter-spacing: -0.02em;
    color: var(--accent);
}

.hero-content p {
    font-size: 15px;
    color: var(--text-secondary);
    margin-top: var(--spacing-md);
    max-width: 560px;
}

/* Showcase Grid */
.showcase {
    flex: 1;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--spacing-xl) var(--spacing-3xl);
    width: 100%;
}

.showcase-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: var(--spacing-xl);
}

/* Featured Post */
.featured-post {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    cursor: pointer;
    position: relative;
}

/* Progress bar */
.featured-progress {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(0, 0, 0, 0.06);
    z-index: 10;
    overflow: hidden;
}

[data-theme="dark"] .featured-progress {
    background: rgba(255, 255, 255, 0.06);
}

.featured-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--bitroot-primary-blue), var(--bitroot-pink));
    border-radius: 0 2px 2px 0;
    animation: progressFill 6000ms linear forwards;
}

@keyframes progressFill {
    from { width: 0%; }
    to { width: 100%; }
}

.featured-post::before {
    content: '';
    position: absolute;
    top: 3px;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--bitroot-primary-blue), var(--bitroot-pink));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.featured-post {
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.2s ease, opacity 0.3s ease;
}

.featured-post.fade-out {
    opacity: 0;
}

.featured-post:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(82, 92, 235, 0.12);
    border-color: var(--bitroot-primary-blue);
}

.featured-post:hover::before {
    opacity: 1;
}

.featured-post .post-image {
    aspect-ratio: 16 / 9;
    overflow: hidden;
    position: relative;
}

/* Video container */
.featured-post .video-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
}

.featured-post .video-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Video play button */
.video-play-btn {
    position: absolute;
    bottom: var(--spacing-md);
    right: var(--spacing-md);
    width: 48px;
    height: 48px;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
    backdrop-filter: blur(4px);
}

.video-play-btn:hover {
    background: var(--bitroot-primary-blue);
    border-color: var(--bitroot-primary-blue);
    transform: scale(1.1);
}

.video-play-btn svg {
    margin-left: 3px;
}

/* Video mute button */
.video-mute-btn {
    position: absolute;
    bottom: var(--spacing-md);
    right: var(--spacing-md);
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
    backdrop-filter: blur(4px);
}

.video-mute-btn:hover {
    background: rgba(0, 0, 0, 0.9);
    border-color: white;
}

.featured-post .post-image::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100px;
    background: linear-gradient(transparent, rgba(0,0,0,0.1));
    pointer-events: none;
}

.featured-post .post-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.featured-post:hover .post-image img {
    transform: scale(1.05);
}

.featured-post .post-content {
    padding: var(--spacing-xl);
}

.post-meta {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.post-tag {
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--tag-bg);
    color: var(--tag-text);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: 999px;
}

.post-date {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.post-title {
    font-family: var(--font-display);
    font-size: 1.65rem;
    font-weight: 600;
    letter-spacing: -0.025em;
    line-height: 1.2;
    margin-bottom: var(--spacing-sm);
}

.post-excerpt {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: var(--spacing-lg);
}

.post-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--border);
}

.read-time {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.read-more {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--bitroot-primary-blue);
    transition: opacity 0.2s ease;
}

.read-more:hover {
    opacity: 0.7;
}

/* Post List */
.post-list {
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
}

.list-header {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--bitroot-primary-blue);
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--spacing-md);
}

.list-item {
    display: grid;
    grid-template-columns: 50px 1fr;
    gap: var(--spacing-md);
    padding: var(--spacing-md) 0;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: var(--radius-sm);
    margin: 0 calc(-1 * var(--spacing-sm));
    padding-left: var(--spacing-sm);
    padding-right: var(--spacing-sm);
}

.list-item:hover {
    background: var(--tag-bg);
}

.list-item:last-child {
    border-bottom: none;
}

.list-item.active {
    background: var(--tag-bg);
}

.list-date {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    padding-top: 2px;
    font-weight: 500;
}

.list-content {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.list-tag {
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--bitroot-primary-blue);
}

.list-title {
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: -0.01em;
}

.list-read-time {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Pagination */
.pagination-container {
    margin-top: var(--spacing-2xl);
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--spacing-lg);
    padding: var(--spacing-lg) 0;
}

.pagination-btn {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-sm) var(--spacing-lg);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-primary);
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--bitroot-light-blue);
    border-color: var(--bitroot-primary-blue);
    color: var(--bitroot-primary-blue);
}

.pagination-btn:disabled,
.pagination-btn[aria-disabled="true"] {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.pagination-back {
    margin-top: var(--spacing-lg);
    text-align: center;
    font-size: 0.9375rem;
}

.pagination-back a {
    color: var(--text-secondary);
}

.pagination-back a:hover {
    color: var(--bitroot-primary-blue);
}

.pagination-btn svg {
    flex-shrink: 0;
}

.pagination-info {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.pagination-info strong {
    color: var(--bitroot-primary-blue);
    font-weight: 600;
}

@media (max-width: 600px) {
    .pagination {
        gap: var(--spacing-sm);
    }

    .pagination-btn {
        padding: var(--spacing-sm) var(--spacing-md);
        font-size: 0.875rem;
    }

    .pagination-btn span {
        display: none;
    }

    .pagination-info {
        font-size: 0.875rem;
    }
}

/* Footer */
.footer {
    border-top: 1px solid var(--border);
    margin-top: auto;
    background: var(--bg-secondary);
}

.footer-content {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: var(--spacing-xl) var(--spacing-xl);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.footer-links {
    display: flex;
    gap: var(--spacing-lg);
}

.footer-link {
    font-size: 0.875rem;
    color: var(--text-secondary);
    transition: color 0.2s ease;
    font-weight: 500;
}

.footer-link:hover {
    color: var(--bitroot-primary-blue);
}

/* Empty State */
.empty-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-3xl) var(--spacing-xl);
    text-align: center;
}

.terminal {
    background: #1a1a2e;
    border-radius: var(--radius-lg);
    overflow: hidden;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    font-family: 'Geist Mono', 'SF Mono', 'Monaco', monospace;
}

.terminal-header {
    background: #16213e;
    padding: var(--spacing-sm) var(--spacing-md);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.terminal-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.terminal-dot.red { background: #ff5f56; }
.terminal-dot.yellow { background: #ffbd2e; }
.terminal-dot.green { background: #27ca40; }

.terminal-title {
    margin-left: var(--spacing-md);
    color: #8892b0;
    font-size: 0.75rem;
}

.terminal-body {
    padding: var(--spacing-lg);
    color: #a0f0a0;
    font-size: 0.875rem;
    line-height: 1.6;
    min-height: 280px;
}

.ascii-art {
    color: var(--bitroot-primary-blue);
    font-size: 0.65rem;
    line-height: 1.2;
    margin-bottom: var(--spacing-lg);
    opacity: 0;
    animation: fadeIn 0.5s ease forwards;
}

.terminal-line {
    margin: var(--spacing-xs) 0;
    opacity: 0;
    animation: fadeIn 0.3s ease forwards;
}

.terminal-line:nth-child(2) { animation-delay: 0.5s; }
.terminal-line:nth-child(3) { animation-delay: 1.2s; }
.terminal-line:nth-child(4) { animation-delay: 1.8s; }
.terminal-line:nth-child(5) { animation-delay: 2.5s; }
.terminal-line:nth-child(6) { animation-delay: 3s; }

.prompt {
    color: #50fa7b;
    margin-right: var(--spacing-sm);
}

.command {
    color: #f8f8f2;
}

.output {
    color: #8892b0;
    padding-left: 1.2rem;
}

.error {
    color: #ff5f56;
}

.cursor {
    color: #50fa7b;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.empty-message {
    margin-top: var(--spacing-xl);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.empty-submessage {
    margin-top: var(--spacing-sm);
    font-size: 1rem;
    color: var(--text-muted);
}

/* ============================================
   Sunrise Intro Overlay
   ============================================ */

/* Overlay: fullscreen, centered */
.sunrise-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    opacity: 1;
    transition: opacity 0.7s ease;
}

/* Hidden by default; shown only when intro-active */
html:not(.intro-active) .sunrise-overlay {
    display: none;
}

/* Fade out when done */
.sunrise-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
}

/* Scene layout */
.sunrise-scene {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

/* Radial glow behind sun */
.sunrise-glow {
    position: absolute;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(82, 92, 235, 0.18) 0%, rgba(82, 92, 235, 0.05) 45%, transparent 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    animation: glowExpand 1.8s ease-out 0.1s forwards;
    pointer-events: none;
}

@keyframes glowExpand {
    0%   { transform: translate(-50%, -50%) scale(0.1); opacity: 0; }
    50%  { opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

/* Sun + rays container */
.sunrise-sun-wrapper {
    position: relative;
    width: min(300px, 65vw);
    height: min(300px, 65vw);
    z-index: 1;
    opacity: 0;
    transform: translateY(50px) scale(0.92);
    animation: sunRise 1.2s cubic-bezier(0.22, 1, 0.36, 1) 0.1s forwards;
}

@keyframes sunRise {
    0%   { opacity: 0; transform: translateY(50px) scale(0.92); }
    30%  { opacity: 1; }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* Both SVGs fill the wrapper */
.sunrise-sun-svg,
.sunrise-rays-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

/* Sun circle */
.sunrise-sun-svg {
    z-index: 2;
}

/* Rays: burst outward from center */
.sunrise-rays-svg {
    z-index: 1;
    fill: #525ceb;
    opacity: 0;
    transform: scale(0.45);
    transform-origin: center center;
    animation: raysBurst 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.5s forwards;
}

@keyframes raysBurst {
    0%   { opacity: 0; transform: scale(0.45); }
    40%  { opacity: 0.7; }
    100% { opacity: 0.55; transform: scale(1); }
}

/* Gentle pulse on the whole sun after rise */
.sunrise-sun-svg {
    animation: sunGlow 1.6s ease-in-out infinite alternate 1.3s;
}

@keyframes sunGlow {
    0%   { filter: drop-shadow(0 0 0px rgba(82, 92, 235, 0)); }
    100% { filter: drop-shadow(0 0 24px rgba(82, 92, 235, 0.35)); }
}

/* Sun spins away when overlay fades */
.sunrise-sun-wrapper.spin-away {
    animation: spinAway 0.7s cubic-bezier(0.55, 0, 1, 0.45) forwards !important;
}

.sunrise-sun-wrapper.spin-away .sunrise-rays-svg {
    animation: raysDissolve 0.5s ease-out forwards !important;
}

@keyframes spinAway {
    0%   { transform: rotate(0deg) scale(1); opacity: 1; }
    100% { transform: rotate(200deg) scale(0.2); opacity: 0; }
}

@keyframes raysDissolve {
    0%   { opacity: 0.55; transform: scale(1); }
    100% { opacity: 0; transform: scale(1.5); }
}

/* Greeting text */
.sunrise-greeting {
    text-align: center;
    opacity: 0;
    transform: translateY(10px);
    animation: greetReveal 0.6s ease forwards 1s;
    z-index: 2;
    margin-top: 24px;
}

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

.sunrise-greeting-text {
    font-family: 'Geist Mono', monospace;
    font-size: clamp(1rem, 2.5vw, 1.25rem);
    font-weight: 500;
    color: var(--text-primary);
    display: block;
}

.sunrise-greeting-sub {
    display: block;
    font-family: 'Geist Mono', monospace;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 8px;
    letter-spacing: 0.08em;
}

/* ============================================
   Content Reveal (after intro)
   ============================================ */

/* While intro is active, page content is invisible */
html.intro-active .header,
html.intro-active .glass-nav,
html.intro-active .blog-shell,
html.intro-active .showcase,
html.intro-active .footer {
    opacity: 0;
}

/* Staggered slide-in after overlay fades */
html.intro-reveal .header,
html.intro-reveal .glass-nav {
    animation: revealUp 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

html.intro-reveal .blog-shell {
    animation: revealUp 0.6s cubic-bezier(0.22, 1, 0.36, 1) 0.06s forwards;
}

html.intro-reveal .showcase {
    opacity: 1 !important;
}

html.intro-reveal .showcase .cards-grid {
    opacity: 0;
    animation: cardSlideIn 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.12s forwards;
}

html.intro-reveal .showcase .pagination-container {
    opacity: 0;
    animation: revealUp 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.32s forwards;
}

html.intro-reveal .footer {
    animation: revealUp 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.35s forwards;
}

@keyframes revealUp {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes cardSlideIn {
    from { opacity: 0; transform: translateY(32px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Accessibility: skip animations */
@media (prefers-reduced-motion: reduce) {
    .sunrise-overlay { display: none !important; }
    html.intro-active .header,
    html.intro-active .glass-nav,
    html.intro-active .blog-shell,
    html.intro-active .showcase,
    html.intro-active .footer { opacity: 1; }
}

/* Dark-mode glow tweak */
[data-theme="dark"] .sunrise-glow {
    background: radial-gradient(circle, rgba(74, 154, 255, 0.12) 0%, rgba(74, 154, 255, 0.03) 45%, transparent 70%);
}

/* Responsive */
@media (max-width: 1000px) {
    .showcase-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-xl);
    }

    .post-list {
        order: 1;
    }
}

@media (max-width: 600px) {
    html {
        font-size: 15px;
    }

    .nav {
        padding: var(--spacing-md);
    }

    .hero {
        padding: var(--spacing-2xl) var(--spacing-md) var(--spacing-xl);
    }

    .hero-content h1 {
        font-size: 2rem;
    }

    .showcase {
        padding: 0 var(--spacing-md) var(--spacing-2xl);
    }

    .featured-post .post-content {
        padding: var(--spacing-lg);
    }

    .post-list {
        padding: var(--spacing-md);
    }

    .list-item {
        grid-template-columns: 45px 1fr;
    }

    .footer-content {
        padding: var(--spacing-lg) var(--spacing-md);
        flex-direction: column;
        gap: var(--spacing-md);
        text-align: center;
    }
}

/* ---------------------------------------------------------------------------
   SEO/CWV refresh additions
   - list items are real anchors now (crawlable + proper tap targets)
   - externalized cloud SVG strips render via <img>
   - stable featured-card height to avoid rotation layout shift
   --------------------------------------------------------------------------- */

a.list-item {
    text-decoration: none;
    color: inherit;
}

.theme-toggle {
    min-width: 44px;
    min-height: 44px;
}

.list-read-time {
    font-size: 0.75rem;
}

/* Clamp featured card text so the 18s auto-rotation never changes the card
   height (timer-driven height changes count as CLS). */
.featured-post .post-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.6em;
}

.featured-post .post-excerpt {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 5.1em;
}

/* Crawlable archive of every post — collapsed disclosure so the links
   exist for crawlers/no-JS without a wall of text for everyone else. */
.post-archive {
    max-width: var(--max-width);
    width: calc(100% - 32px);
    margin: var(--spacing-2xl) auto 0;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--bg-secondary);
    overflow: hidden;
}

.archive-title {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 18px 24px;
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: color 0.15s ease;
}

.archive-title::-webkit-details-marker {
    display: none;
}

.archive-title::after {
    content: "+";
    font-size: 1rem;
    color: var(--text-muted);
}

.post-archive[open] .archive-title::after {
    content: "−";
}

.archive-title:hover {
    color: var(--accent);
}

.post-archive[open] .archive-title {
    border-bottom: 1px solid var(--border);
}

.post-archive .archive-list {
    padding: var(--spacing-md) 24px var(--spacing-lg);
}

.archive-list {
    list-style: none;
    padding: 0;
    margin: 0;
    columns: 2;
    column-gap: var(--spacing-xl);
}

.archive-list li {
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    break-inside: avoid;
    font-size: 0.875rem;
    line-height: 1.5;
}

.archive-list a {
    color: var(--text-primary);
    text-decoration: none;
}

.archive-list a:hover {
    color: var(--accent);
}

.archive-date {
    font-family: var(--font-mono);
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-left: var(--spacing-sm);
    white-space: nowrap;
}

@media (max-width: 700px) {
    .archive-list {
        columns: 1;
    }
}

/* ═══ Mythia-style blog shell + card grid ═══ */

/* Dark header capsule */
.blog-shell {
    max-width: var(--max-width);
    width: calc(100% - 32px);
    margin: 18px auto 24px;
    background:
        radial-gradient(620px 300px at 88% -30%, rgba(82, 92, 235, 0.30), transparent 62%),
        radial-gradient(500px 260px at 4% 120%, rgba(119, 130, 238, 0.16), transparent 60%),
        #17161a;
    border-radius: 24px;
    padding: 22px 32px 24px;
    color: #fff;
    position: relative;
    z-index: 1;
}

/* Floating glass navbar */
.glass-nav {
    position: sticky;
    top: 12px;
    z-index: 100;
    max-width: var(--max-width);
    width: calc(100% - 32px);
    margin: 12px auto 0;
}

.glass-nav-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 22px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.55);
    -webkit-backdrop-filter: blur(22px) saturate(1.8);
    backdrop-filter: blur(22px) saturate(1.8);
    border: 1px solid rgba(255, 255, 255, 0.55);
    box-shadow:
        0 8px 30px -14px rgba(61, 59, 64, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

[data-theme="dark"] .glass-nav-inner {
    background: rgba(24, 23, 28, 0.55);
    border-color: rgba(255, 255, 255, 0.10);
    box-shadow:
        0 8px 30px -14px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.shell-logo .logo-img {
    height: 28px;
    width: auto;
}

.shell-links {
    display: flex;
    gap: 22px;
    align-items: center;
}

.shell-link {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: color 0.2s ease;
}

.shell-link:hover,
.shell-link.active {
    color: var(--accent);
}

[data-theme="dark"] .theme-toggle {
    border-color: rgba(255, 255, 255, 0.18);
    color: #a19dab;
}

[data-theme="dark"] .theme-toggle:hover {
    color: #fff;
    border-color: #fff;
}

.glass-nav .theme-toggle {
    border-radius: 999px;
}

.shell-body {
    display: flex;
    align-items: center;
    gap: 28px;
    flex-wrap: wrap;
}

.shell-title {
    font-family: var(--font-display);
    font-size: clamp(28px, 2.8vw, 40px);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: -0.02em;
    line-height: 1;
    margin: 0;
    flex-shrink: 0;
}

.shell-controls {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 40px;
    flex-wrap: wrap;
}

.shell-label {
    display: block;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #8b8794;
    margin-bottom: 10px;
}

.filter-pills {
    flex: 1 1 0;
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    min-width: 0;
}

.filter-pills::-webkit-scrollbar {
    display: none;
}

.filter-pill {
    white-space: nowrap;
    flex-shrink: 0;
}

.filter-pill {
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 600;
    background: #26242c;
    color: #e9e3f0;
    border: none;
    border-radius: 999px;
    padding: 9px 16px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.filter-pill:hover {
    background: #322f3a;
}

.filter-pill:focus-visible {
    outline: 2px solid #7782ee;
    outline-offset: 2px;
}

.filter-pill.active {
    background: #fff;
    color: #17161a;
}

.pill-count {
    font-family: var(--font-mono);
    font-size: 11px;
    opacity: 0.55;
    margin-left: 2px;
}

.shell-search {
    flex: 0 1 320px;
    min-width: 260px;
}

.shell-body .search-box {
    flex: 0 0 260px;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #26242c;
    border-radius: 12px;
    padding: 11px 16px;
}

.search-box:focus-within {
    outline: 2px solid #7782ee;
    outline-offset: 1px;
}

.search-box svg {
    width: 16px;
    height: 16px;
    color: #8b8794;
    flex-shrink: 0;
}

.search-box input {
    background: none;
    border: none;
    outline: none;
    color: #fff;
    font-family: var(--font-sans);
    font-size: 14px;
    width: 100%;
}

.search-box input::placeholder {
    color: #8b8794;
}

/* Card grid */
.showcase {
    padding-top: 0;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
}

.card {
    position: relative;
    display: block;
    border-radius: 26px;
    overflow: hidden;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    min-height: 420px;
}

.card-featured {
    grid-column: span 2;
    min-height: 560px;
}

.card-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.card:hover .card-bg {
    transform: scale(1.03);
}

@media (prefers-reduced-motion: reduce) {
    .card-bg,
    .card:hover .card-bg {
        transition: none;
        transform: none;
    }
}

/* White content plate cut into the card, with concave corner fillets */
.card-plate {
    position: absolute;
    bottom: 0;
    left: 0;
    width: calc(100% - 48px);
    background: var(--bg-secondary);
    border-top-right-radius: 26px;
    padding: 22px 26px 20px 24px;
}

.card-plate::before,
.card-plate::after {
    content: "";
    position: absolute;
    width: 26px;
    height: 26px;
    background: radial-gradient(circle at 100% 0, transparent 26px, var(--bg-secondary) 26.5px);
}

.card-plate::before {
    top: -26px;
    left: 0;
}

.card-plate::after {
    right: -26px;
    bottom: 0;
}

.card-badge {
    position: absolute;
    top: 0;
    left: 0;
    transform: translateY(-58%);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: #17161a;
    color: #fff;
    padding: 9px 18px;
    border-radius: 999px;
    border: 6px solid var(--bg-secondary);
}

.card-title {
    font-family: var(--font-display);
    font-size: 19px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: -0.01em;
    line-height: 1.2;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.2s ease;
}

.card:hover .card-title {
    color: var(--accent);
}

.card-featured .card-title {
    font-size: clamp(24px, 2.4vw, 33px);
}

.card-excerpt {
    font-size: 13.5px;
    line-height: 1.55;
    color: var(--text-secondary);
    margin-top: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 14px;
}

.card-tag {
    font-size: 12.5px;
    font-weight: 600;
    background: var(--bg);
    color: var(--text-primary);
    border: 1px solid var(--border);
    padding: 6px 14px;
    border-radius: 999px;
    white-space: nowrap;
}

.card-info {
    font-family: var(--font-mono);
    font-size: 11.5px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.grid-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px 20px;
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--text-muted);
}

/* Dark page theme: capsule stays dark, plates follow surfaces */
[data-theme="dark"] .blog-shell {
    border: 1px solid var(--border);
}

/* Responsive */
@media (max-width: 1000px) {
    .cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .card-featured {
        grid-column: span 2;
    }
}

@media (max-width: 640px) {
    .blog-shell {
        padding: 12px 20px 22px;
        border-radius: 20px;
    }

    .shell-body {
        gap: 14px;
    }

    .shell-title {
        width: 100%;
    }

    .filter-pills {
        flex: 1 1 100%;
    }

    .shell-body .search-box {
        flex: 1 1 100%;
    }

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

    .card,
    .card-featured {
        grid-column: span 1;
        min-height: 400px;
    }

    .card-featured {
        min-height: 460px;
    }

    .card-plate {
        width: calc(100% - 36px);
        padding: 18px 18px 16px 18px;
    }
}
