/* ==========================================================================
   Frugální inženýr - CSS Design System & Premium Stylesheet
   ========================================================================== */

/* Variables & Theme Tokens */
:root {
    --bg-primary: #080c14;
    --bg-secondary: #0f1626;
    --bg-surface: #17223b;
    --border-color: #263554;
    
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    
    --accent-emerald: #00ff66;
    --accent-cyan: #00f0ff;
    --accent-gradient: linear-gradient(135deg, #00ff66, #00f0ff);
    
    --error: #f43f5e;
    --success: #00ff66;
    
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
    
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 16px;
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 10px 35px rgba(0, 0, 0, 0.6);
    --transition: all 0.2s ease-out;
}

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

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
}

/* Ambient Glow Background */
body::before, body::after {
    content: "";
    position: fixed;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    pointer-events: none;
    z-index: -1;
    filter: blur(130px);
    opacity: 0.035;
    transition: opacity 0.5s ease;
}
body::before {
    top: -100px;
    left: -100px;
    background: var(--accent-cyan);
}
body::after {
    bottom: -100px;
    right: -100px;
    background: var(--accent-emerald);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: var(--radius-sm);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Container */
.header-container, .app-content, .footer-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* 1. Header Styling */
.main-header {
    background-color: rgba(8, 12, 20, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(38, 53, 84, 0.5);
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    transition: var(--transition);
}

.logo:hover {
    opacity: 0.95;
    transform: translateY(-1px);
}

.logo .highlight {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 1.75rem;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: var(--transition);
    cursor: pointer;
    position: relative;
    padding: 0.25rem 0;
}

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

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

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--accent-gradient);
    border-radius: 2px;
}

.btn-editor {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent-emerald) !important;
    padding: 0.5rem 1rem !important;
    border-radius: var(--radius-sm);
    border: 1px dashed rgba(16, 185, 129, 0.3);
}

.btn-editor:hover {
    background: rgba(16, 185, 129, 0.2);
    border-color: rgba(16, 185, 129, 0.5);
    transform: translateY(-1px);
}

.btn-editor i {
    width: 14px;
    height: 14px;
}

/* 2. Main Content Layout */
.app-content {
    padding-top: 3.5rem;
    padding-bottom: 5rem;
    min-height: calc(100vh - 144px);
}

.view-section {
    animation: fadeIn 0.35s ease-out;
}

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

/* 3. Hero Section (Home View) */
.hero {
    margin-bottom: 4rem;
}

.hero-tag {
    display: inline-block;
    background-color: var(--bg-surface);
    color: var(--accent-cyan);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    border: 1px solid var(--border-color);
    margin-bottom: 1.25rem;
}

.hero-title {
    font-size: 2.75rem;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -1px;
    margin-bottom: 1.25rem;
}

.gradient-text {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-lead {
    color: var(--text-secondary);
    font-size: 1.15rem;
    max-width: 720px;
    line-height: 1.5;
}

/* Section Title */
.section-title {
    margin-bottom: 2rem;
    position: relative;
}

.section-title h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.section-title .line {
    width: 40px;
    height: 3px;
    background: var(--accent-gradient);
    border-radius: 2px;
}

/* 4. Posts Grid & Cards */
.posts-grid {
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
}

.post-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.75rem;
    text-decoration: none;
    color: var(--text-primary);
    transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
    display: block;
}

.post-card:hover {
    transform: translateY(-4px);
    border-color: rgba(0, 240, 255, 0.5);
    box-shadow: 0 10px 30px rgba(0, 240, 255, 0.05), var(--shadow-sm);
}

.post-card-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.post-card-title {
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 0.75rem;
    transition: var(--transition);
}

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

.post-card-desc {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Pinned post styling */
.pinned-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--accent-cyan);
    font-weight: 600;
    font-family: var(--font-mono);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

.pinned-badge svg {
    width: 12px;
    height: 12px;
    transform: rotate(45deg);
}

.pinned-card {
    border-left: 3px solid var(--accent-cyan) !important;
    position: relative;
}

.pinned-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, rgba(0, 240, 255, 0.02) 0%, transparent 100%);
    pointer-events: none;
}

.loader {
    text-align: center;
    color: var(--text-muted);
    font-family: var(--font-mono);
    padding: 3rem 0;
}

/* 5. Article Reader View */
.post-header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1.5rem;
    margin-bottom: 2.5rem;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--accent-cyan);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: var(--transition);
}

.back-link:hover {
    color: var(--text-primary);
    transform: translateX(-2px);
}

.back-link i {
    width: 16px;
    height: 16px;
}

.post-meta-top {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Markdown Rendering Engine Styling */
.markdown-body {
    color: var(--text-secondary);
    font-size: 1.08rem;
    line-height: 1.75;
    letter-spacing: -0.011em;
}

.markdown-body h1, .markdown-body h2, .markdown-body h3 {
    font-family: var(--font-mono);
    color: var(--text-primary);
    margin-top: 2.25rem;
    margin-bottom: 1.25rem;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.02em;
}

.markdown-body h1 { font-size: 2.1rem; }
.markdown-body h2 { font-size: 1.55rem; border-bottom: 1px solid var(--border-color); padding-bottom: 0.4rem; }
.markdown-body h3 { font-size: 1.22rem; }

.markdown-body p {
    margin-bottom: 1.35rem;
}

.markdown-body ul, .markdown-body ol {
    margin-bottom: 1.25rem;
    padding-left: 1.5rem;
}

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

.markdown-body strong {
    color: var(--text-primary);
    font-weight: 600;
}

.markdown-body blockquote {
    padding: 0 1rem;
    color: var(--text-secondary);
    border-left: 4px solid var(--accent-emerald);
    background-color: var(--bg-secondary);
    padding: 0.75rem 1.25rem;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin: 1.5rem 0;
    font-style: italic;
}

.markdown-body hr {
    height: 1px;
    background-color: var(--border-color);
    border: none;
    margin: 2.5rem 0;
}

.markdown-body pre {
    background-color: var(--bg-secondary);
    padding: 1rem;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    border: 1px solid var(--border-color);
    margin: 1.5rem 0;
}

.markdown-body code {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    background-color: var(--bg-secondary);
    padding: 0.15rem 0.35rem;
    border-radius: 3px;
    border: 1px solid var(--border-color);
    color: var(--accent-cyan);
}

.markdown-body pre code {
    background-color: transparent;
    padding: 0;
    border: none;
    color: var(--text-primary);
}



.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border-radius: var(--radius-sm);
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    border: none;
}

.btn i {
    width: 16px;
    height: 16px;
}

.btn-primary {
    background: var(--accent-gradient);
    color: var(--bg-primary);
    font-weight: 700;
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

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

.btn-secondary:hover {
    background-color: var(--border-color);
    transform: translateY(-1px);
}



/* 7. About View */
.about-container {
    max-width: 680px;
    margin: 0 auto;
}

.about-title {
    font-size: 2.25rem;
    font-weight: 800;
    margin-bottom: 2rem;
}

.about-content p {
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.about-content h3 {
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    font-size: 1.25rem;
    color: var(--text-primary);
}

.about-content ul {
    list-style-type: none;
    margin-bottom: 2rem;
}

.about-content li {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    font-size: 1rem;
}

.about-content li strong {
    color: var(--text-primary);
}

/* Globální styl pro tabulky v článcích a Frugální setup */
.setup-table,
.article-body table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 2rem 0;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--bg-secondary);
    overflow: hidden;
    font-size: 0.95rem;
}

.setup-table tr,
.article-body table tr {
    transition: background-color 0.2s ease;
}

.setup-table tr:hover,
.article-body table tbody tr:hover {
    background-color: rgba(0, 240, 255, 0.02);
}

.setup-table td,
.article-body table td,
.article-body table th {
    padding: 1.25rem 1.5rem;
    vertical-align: top;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.setup-table tr:last-child td,
.article-body table tbody tr:last-child td {
    border-bottom: none;
}

/* Specifické stylizace pro záhlaví markdown tabulek */
.article-body table th {
    background-color: rgba(38, 53, 84, 0.3);
    color: var(--accent-cyan);
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* První sloupec v těle tabulek článků se chová jako klíč */
.article-body table tbody td:first-child,
.article-body table tbody td:first-child strong {
    font-family: var(--font-mono) !important;
    color: var(--accent-cyan) !important;
    font-weight: 500 !important;
    font-size: 0.9rem !important;
}

.setup-key {
    width: 200px;
    vertical-align: top;
}

.setup-key-inner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-mono);
    color: var(--accent-cyan);
    font-weight: 500;
    font-size: 0.9rem;
    user-select: none;
}

.setup-key-inner svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    stroke-width: 2px;
}

.setup-value {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
}

@media (max-width: 600px) {
    .setup-table td,
    .article-body table td,
    .article-body table th {
        display: block;
        width: 100%;
    }
    .setup-table tr td:first-child {
        padding-bottom: 0.5rem;
        border-bottom: none;
    }
    .setup-table tr td:last-child {
        padding-top: 0.5rem;
    }
    .setup-key {
        width: 100%;
    }
}

/* 8. Footer */
.main-footer {
    border-top: 1px solid var(--border-color);
    padding: 2.5rem 0;
    text-align: center;
    background-color: var(--bg-primary);
}

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

/* Responsive Scaling */
@media (max-width: 768px) {
    .header-container, .app-content, .footer-container {
        padding: 0 1rem;
    }
    
    .terminal-body {
        padding: 1.25rem 1rem;
    }
    
    .post-card {
        padding: 1.25rem;
    }
    
    .markdown-body blockquote {
        padding: 1rem 1.25rem;
        margin: 1.5rem 0;
    }

    .logo-text {
        font-size: 1.1rem;
    }
    
    .main-nav {
        gap: 1rem;
    }
    
    .btn-editor {
        padding: 0.4rem 0.75rem !important;
        font-size: 0.85rem;
    }
    
    .hero-title {
        font-size: 2rem;
    }
}

/* ==========================================================================
   Terminal Elements & IT Styling
   ========================================================================== */
.terminal-window {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    margin-bottom: 2.5rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.terminal-window:hover {
    border-color: rgba(0, 255, 102, 0.25);
    box-shadow: 0 12px 40px rgba(0, 255, 102, 0.02), var(--shadow-md);
}

.terminal-bar {
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    padding: 0.65rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.dot-red { background-color: #ff5f56; }
.dot-yellow { background-color: #ffbd2e; }
.dot-green { background-color: #27c93f; }

.terminal-title {
    margin-left: 0.75rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.terminal-body {
    padding: 1.75rem 2rem;
    background-color: var(--bg-primary);
}

.command-line {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    display: flex;
    gap: 0.5rem;
}

.prompt {
    color: var(--accent-emerald);
    font-weight: 700;
}

/* Custom TL;DR Alert / Box inside markdown body */
.markdown-body blockquote {
    border-left: 4px solid var(--accent-cyan);
    background-color: rgba(6, 182, 212, 0.05);
    border: 1px dashed var(--border-color);
    border-left: 4px solid var(--accent-cyan);
    padding: 1.25rem 1.5rem;
    border-radius: var(--radius-sm);
    margin: 2rem 0;
    font-style: normal;
}

.markdown-body blockquote strong {
    color: var(--accent-cyan);
}

.markdown-body blockquote ul {
    margin-top: 0.75rem;
    margin-bottom: 0;
    padding-left: 1.25rem;
}

.markdown-body blockquote li {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.markdown-body blockquote li strong {
    color: var(--text-primary);
}

/* Language Switcher Display Rules */
body.lang-cz .lang-en { display: none !important; }
body.lang-en .lang-cz { display: none !important; }

/* Language Switcher Button Styling */
.btn-lang {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.35rem 0.65rem !important;
    font-size: 0.8rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--accent-cyan) !important;
    transition: var(--transition);
}

.btn-lang:hover {
    background-color: var(--border-color);
    color: var(--text-primary) !important;
}

/* ==========================================================================
   New Dynamic UX Components (Reading Progress & Scroll Top & Blink Cursor)
   ========================================================================== */

/* Reading Progress Bar */
.reading-progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0%;
    height: 2px;
    background: var(--accent-gradient);
    transition: width 0.1s ease-out;
    z-index: 101;
}

/* Scroll to Top Button */
.scroll-top-btn {
    position: fixed;
    bottom: 2.5rem;
    right: 2.5rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: rgba(15, 22, 38, 0.8);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 90;
    backdrop-filter: blur(8px);
    box-shadow: var(--shadow-sm);
}

.scroll-top-btn.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.scroll-top-btn:hover {
    background-color: var(--bg-surface);
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.2);
    transform: translateY(-2px);
}

.scroll-top-btn i {
    width: 18px;
    height: 18px;
}

/* Blinking terminal cursor */
.command-line::after {
    content: "▊";
    color: var(--accent-emerald);
    animation: blinkCursor 1s infinite alternate;
    margin-left: 2px;
}

@keyframes blinkCursor {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

html {
    scroll-behavior: smooth;
}
