/* ==========================================================================
   Bedroom Coders - Clean, Fast, Modern Markdown Blog Theme for Zola
   ========================================================================== */

:root {
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;

    /* Light Theme Palette */
    --bg-page: #f8f9fa;
    --bg-card: #ffffff;
    --bg-surface: #e9ecef;
    --bg-hover: #dee2e6;
    --border-color: #e2e8f0;
    --border-highlight: #cbd5e1;

    --text-main: #1e293b;
    --text-muted: #64748b;
    --text-subtle: #94a3b8;

    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-subtle: #dbeafe;
    --accent-tag: #e0e7ff;
    --accent-tag-text: #3730a3;

    --code-bg: #1e1e2e;
    --code-inline-bg: #e2e8f0;
    --code-inline-text: #b91c1c;

    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.05);

    --content-width: 760px;
}

[data-theme="dark"] {
    /* Dark Theme Palette (Catppuccin Mocha inspired) */
    --bg-page: #181825;
    --bg-card: #1e1e2e;
    --bg-surface: #313244;
    --bg-hover: #45475a;
    --border-color: #313244;
    --border-highlight: #585b70;

    --text-main: #cdd6f4;
    --text-muted: #a6adc8;
    --text-subtle: #6c7086;

    --accent: #89b4fa;
    --accent-hover: #b4befe;
    --accent-subtle: #1e2540;
    --accent-tag: #2a2b3d;
    --accent-tag-text: #89dceb;

    --code-bg: #11111b;
    --code-inline-bg: #313244;
    --code-inline-text: #f38ba8;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
    color-scheme: light dark;
}

body {
    background-color: var(--bg-page);
    color: var(--text-main);
    font-family: var(--font-sans);
    line-height: 1.7;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

.layout {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    width: 100%;
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 0 1.25rem;
}

/* Links */
a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.15s ease;
}

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

/* Header */
.site-header {
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(8px);
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 4rem;
}

.logo a {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--text-main);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.logo-prompt {
    color: var(--accent);
}

.logo-cursor {
    color: var(--accent);
    animation: blink 1s step-end infinite;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.nav-link {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
}

.nav-link:hover {
    color: var(--text-main);
    background-color: var(--bg-surface);
    text-decoration: none;
}

.theme-toggle {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    cursor: pointer;
    font-size: 1rem;
    padding: 0.35rem 0.5rem;
    border-radius: var(--radius-md);
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    background-color: var(--bg-surface);
    border-color: var(--border-highlight);
}

/* Main Content */
.site-main {
    flex: 1;
    padding-top: 3rem;
    padding-bottom: 4rem;
}

/* Hero Section */
.hero {
    margin-bottom: 3.5rem;
    padding-bottom: 2.5rem;
    border-bottom: 1px solid var(--border-color);
    text-align: center;
}

.hero-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.75rem;
}

.hero-logo-box {
    display: flex;
    justify-content: center;
    width: 100%;
}

.hero-logo {
    max-width: 520px;
    width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hero-logo:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
}

.hero-content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hero-title {
    font-family: var(--font-mono);
    font-size: 2.25rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    margin-bottom: 0.75rem;
    color: var(--text-main);
}

.hero-bio {
    font-size: 1.15rem;
    color: var(--text-muted);
    line-height: 1.6;
    max-width: 580px;
    margin: 0 auto;
}

/* Home Sections */
.home-section {
    margin-bottom: 4rem;
}

/* Section Header */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 1.75rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.01em;
}

.section-subtitle {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

.view-all {
    font-size: 0.88rem;
    font-family: var(--font-mono);
    white-space: nowrap;
}

/* Projects Grid */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
}

.project-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.project-card:hover {
    transform: translateY(-3px);
    border-color: var(--accent);
    box-shadow: var(--shadow-md);
}

.project-card-image-box {
    margin: -1.5rem -1.5rem 1.25rem -1.5rem;
    height: 230px;
    background: radial-gradient(circle at 50% 50%, #252836 0%, #11111b 100%);
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--border-color);
}

.project-card-image-box a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.project-card-img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: var(--radius-sm);
    transition: transform 0.25s ease, filter 0.25s ease;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4));
}

.project-card:hover .project-card-img {
    transform: scale(1.04);
    filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.6));
}

.project-card-body {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.project-hero-image-box {
    margin: 1.5rem 0 2rem 0;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    background-color: #0b0d13;
    max-height: 420px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.project-hero-img {
    width: 100%;
    height: auto;
    max-height: 420px;
    object-fit: contain;
}

.project-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.project-badge {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 600;
    background-color: var(--accent-subtle);
    color: var(--accent);
    padding: 0.25rem 0.6rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.project-year {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-subtle);
}

.project-card-title {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 0.6rem;
    line-height: 1.3;
}

.project-card-title a {
    color: var(--text-main);
    text-decoration: none;
}

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

.project-card-description {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
    flex-grow: 1;
}

.project-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    font-family: var(--font-mono);
    font-size: 0.88rem;
}

.project-card-link {
    font-weight: 600;
    color: var(--accent);
    white-space: nowrap;
}

.project-card-download {
    margin-left: auto;
    font-weight: 600;
    color: #a6e3a1;
    background-color: rgba(166, 227, 161, 0.12);
    padding: 0.28rem 0.65rem;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(166, 227, 161, 0.25);
    text-decoration: none;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.project-card-download:hover {
    background-color: rgba(166, 227, 161, 0.22);
    color: #a6e3a1;
    text-decoration: none;
    transform: translateY(-1px);
}

.project-card-ext {
    color: var(--text-muted);
}

.project-card-ext:hover {
    color: var(--text-main);
}

/* Individual Project Detail Layout */
.project-header {
    margin-bottom: 2.5rem;
    padding-bottom: 1.75rem;
    border-bottom: 1px solid var(--border-color);
}

.project-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.75rem;
    margin-bottom: 0.5rem;
}

.project-status {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    background-color: var(--bg-surface);
    color: var(--text-muted);
    padding: 0.2rem 0.55rem;
    border-radius: var(--radius-sm);
}

.project-date {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-subtle);
}

.project-title {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-top: 0.5rem;
    margin-bottom: 0.75rem;
    color: var(--text-main);
}

.project-lead {
    font-size: 1.2rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.project-links {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.project-footer {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

/* Article Cards & List */
.article-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.article-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    box-shadow: var(--shadow-sm);
}

.article-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-highlight);
    box-shadow: var(--shadow-md);
}

.article-meta {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.dot {
    opacity: 0.6;
}

.article-title {
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.35;
    margin-bottom: 0.6rem;
}

.article-title a {
    color: var(--text-main);
    text-decoration: none;
}

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

.article-description {
    color: var(--text-muted);
    font-size: 0.98rem;
    line-height: 1.6;
    margin-bottom: 1rem;
}

/* Tags */
.tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    background-color: var(--accent-tag);
    color: var(--accent-tag-text);
    padding: 0.2rem 0.55rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: opacity 0.15s ease;
}

.tag:hover {
    opacity: 0.85;
    text-decoration: none;
}

/* Page Headers */
.page-header {
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.page-title {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.page-description {
    font-size: 1.05rem;
    color: var(--text-muted);
}

.breadcrumb {
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    font-family: var(--font-mono);
}

.tag-highlight {
    color: var(--accent);
}

/* Tags Cloud / Page */
.tags-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.tag-card {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 0.5rem 0.85rem;
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: all 0.15s ease;
}

.tag-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    text-decoration: none;
}

.tag-name {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--text-main);
}

.tag-count {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    background-color: var(--bg-surface);
    color: var(--text-muted);
    padding: 0.1rem 0.45rem;
    border-radius: var(--radius-sm);
}

/* Single Article Layout */
.article-header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.article-header .article-title {
    font-size: 2.4rem;
    font-weight: 800;
    line-height: 1.25;
    margin-top: 0.5rem;
    margin-bottom: 0.75rem;
    color: var(--text-main);
}

.article-subtitle {
    font-size: 1.15rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 1rem;
}

/* Table of Contents */
.toc-container {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    margin-bottom: 2.5rem;
}

.toc-summary {
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    color: var(--text-main);
}

.toc-list {
    margin-top: 0.75rem;
    padding-left: 1.25rem;
    font-size: 0.92rem;
}

.toc-list ul {
    padding-left: 1.25rem;
    margin-top: 0.25rem;
}

.toc-list li {
    margin-bottom: 0.35rem;
}

/* Article Markdown Typography */
.article-content {
    font-size: 1.08rem;
    line-height: 1.8;
    color: var(--text-main);
}

.article-content>*+* {
    margin-top: 1.5rem;
}

.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4,
.article-content h5,
.article-content h6 {
    color: var(--text-main);
    line-height: 1.35;
    font-weight: 700;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
}

.article-content h1 {
    font-size: 1.85rem;
}

.article-content h2 {
    font-size: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.4rem;
}

.article-content h3 {
    font-size: 1.25rem;
}

.article-content h4 {
    font-size: 1.1rem;
}

.article-content p {
    margin-bottom: 1.25rem;
}

.article-content ul,
.article-content ol {
    padding-left: 1.75rem;
    margin-bottom: 1.25rem;
}

.article-content li {
    margin-bottom: 0.4rem;
}

.article-content blockquote {
    border-left: 4px solid var(--accent);
    padding: 0.6rem 1.25rem;
    background-color: var(--bg-surface);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    color: var(--text-muted);
    font-style: italic;
    margin: 1.5rem 0;
}

.article-content blockquote p {
    margin-bottom: 0;
}

.article-content hr {
    border: 0;
    height: 1px;
    background: var(--border-color);
    margin: 3rem 0;
}

.article-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    margin: 1.5rem 0;
    display: block;
}

.article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.95rem;
}

.article-content th,
.article-content td {
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--border-color);
    text-align: left;
}

.article-content th {
    background-color: var(--bg-surface);
    font-weight: 600;
}

/* Code & Syntax Highlighting */
:not(pre)>code {
    font-family: var(--font-mono);
    font-size: 0.88em;
    background-color: var(--code-inline-bg);
    color: var(--code-inline-text);
    padding: 0.15em 0.35em;
    border-radius: var(--radius-sm);
}

pre {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    line-height: 1.6;
    padding: 1.25rem;
    border-radius: var(--radius-md);
    overflow-x: auto;
    margin: 1.5rem 0;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

/* Article Navigation */
.article-footer {
    margin-top: 3.5rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.article-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.nav-prev,
.nav-next {
    display: flex;
    flex-direction: column;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: all 0.15s ease;
}

.nav-prev:hover,
.nav-next:hover {
    border-color: var(--accent);
    background-color: var(--bg-card);
    text-decoration: none;
}

.nav-next {
    text-align: right;
    align-items: flex-end;
}

.nav-direction {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-subtle);
    margin-bottom: 0.35rem;
}

.nav-title {
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.95rem;
}

.back-link-wrapper {
    text-align: center;
}

.back-link {
    font-family: var(--font-mono);
    font-size: 0.9rem;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    font-family: var(--font-mono);
    font-size: 0.9rem;
}

.pagination-btn {
    padding: 0.4rem 0.85rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--bg-card);
    color: var(--text-main);
    text-decoration: none;
}

.pagination-btn:hover:not(.disabled) {
    border-color: var(--accent);
    text-decoration: none;
}

.pagination-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination-info {
    color: var(--text-muted);
}

/* 404 Error Page */
.error-page {
    text-align: center;
    padding: 4rem 1rem;
}

.error-badge {
    font-family: var(--font-mono);
    font-size: 5rem;
    font-weight: 800;
    color: var(--accent);
    line-height: 1;
    margin-bottom: 1rem;
}

.error-title {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 1rem;
}

.error-text {
    color: var(--text-muted);
    font-size: 1.1rem;
    max-width: 500px;
    margin: 0 auto 2rem auto;
}

.error-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.btn-primary,
.btn-secondary {
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    text-decoration: none;
    transition: all 0.15s ease;
}

.btn-primary {
    background-color: var(--accent);
    color: #ffffff;
}

.btn-primary:hover {
    background-color: var(--accent-hover);
    text-decoration: none;
}

.btn-secondary {
    background-color: var(--bg-surface);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--bg-hover);
    text-decoration: none;
}

.empty-state {
    color: var(--text-muted);
    font-style: italic;
    padding: 2rem 0;
}

/* Footer */
.site-footer {
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-card);
    padding: 2rem 0;
    font-size: 0.88rem;
    color: var(--text-muted);
}

.footer-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.back-to-top {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Responsive */
@media (max-width: 640px) {
    .hero-title {
        font-size: 1.85rem;
    }

    .article-header .article-title {
        font-size: 1.85rem;
    }

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

    .nav-next {
        text-align: left;
        align-items: flex-start;
    }

    .pagination {
        flex-direction: column;
        gap: 1rem;
    }
}