@font-face {
    font-family: 'Geist';
    src: url('/static/Geist.ttf');
}

/* Universal box-sizing for consistent sizing */
*,
*::before,
*::after {
    box-sizing: border-box;
}

/* Prevent horizontal overflow on all elements */
html,
body {
    overflow-x: hidden;
    max-width: 100vw;
}

:root {
    --primary: oklch(0.75 0.15 60);
    --border: oklch(0.25 0.02 120);
    --background: oklch(0.0847 0 0);
    --text-primary: oklch(0.85 0.05 120);
    --text-secondary: oklch(0.65 0.12 280);
    --card-bg: #060606;
}

/* Terminal-specific styles */
.terminal-cursor::after {
    content: "█";
    animation: blink 1s infinite;
    color: var(--primary);
}

.terminal-prompt::before {
    content: "> ";
    color: var(--primary);
}

.terminal-back {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
    display: inline-block;
}

.terminal-back::before {
    content: "../";
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
    display: inline-block;
}

.terminal-window {
    border: 2px solid var(--border);
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.1);
}

@keyframes blink {

    0%,
    50% {
        opacity: 1;
    }

    51%,
    100% {
        opacity: 0;
    }
}

/* Base body styles with improved mobile defaults */
body {
    background-color: var(--background);
    font-family: Geist, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    width: 100%;
    margin: 0 auto;
    padding: 1rem;
    max-width: 64rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    line-height: 1.6;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
}

/* Blog header with improved mobile scaling */
.blog-header {
    color: var(--primary);
    font-size: clamp(1.75rem, 5vw, 2.25rem);
    font-weight: 700;
    word-break: break-word;
}

.articles-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Enhanced mobile-friendly tags */
.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.tag {
    color: var(--text-primary);
    border: 1px solid var(--text-primary);
    background-color: var(--background);
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
    line-height: 1;
}

.tag:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
}

/* Enhanced article info cards for mobile */
.article-info {
    border: 2px solid #3a3d32;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background-color: var(--card-bg);
    padding: 1.25rem;
    box-shadow: 5px 5px 3px rgba(0, 255, 0, 0.1);
    transition: all 0.2s ease;
}

.article-info:hover {
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.2);
    transform: translateY(-2px);
}

.article-info-title {
    margin: 0;
    line-height: 1.3;
}

.article-info-title a {
    text-decoration: none;
    color: var(--primary);
    font-size: clamp(1.25rem, 4vw, 1.5rem);
    word-break: break-word;
    display: inline-block;
    transition: color 0.2s ease;
}

.article-info-title a:hover {
    color: oklch(0.85 0.18 60);
}

.article-info-header {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.time-container {
    color: var(--text-secondary);
    font-size: 0.875rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.description-container {
    color: var(--text-primary);
    line-height: 1.6;
}

.description {
    margin: 0;
    word-break: break-word;
}

/* Loading indicator styles */
.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.loading.show {
    opacity: 1;
}

/* Article page styles with mobile improvements */
.article-page {
    width: 100%;
    max-width: 64rem;
    margin: 0 auto;
    padding: 1rem;
    box-sizing: border-box;
    overflow-x: hidden;
}

.article-header {
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--border);
    padding-bottom: 1.5rem;
}

.article-title {
    color: var(--primary);
    font-size: clamp(1.75rem, 6vw, 2.25rem);
    font-weight: 700;
    margin: 0 0 1rem 0;
    line-height: 1.2;
    word-break: break-word;
}

.article-description {
    color: var(--text-primary);
    font-size: clamp(1rem, 3vw, 1.125rem);
    margin: 0 0 1.5rem 0;
    line-height: 1.6;
    word-break: break-word;
}

.article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.meta-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.meta-label {
    font-weight: 500;
    color: var(--primary);
}

.time,
.time-updated {
    color: var(--text-secondary);
}

/* Enhanced article content styles for mobile reading */
.article-content {
    color: var(--text-primary);
    line-height: 1.7;
    font-size: clamp(0.95rem, 2.5vw, 1rem);
    word-break: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    box-sizing: border-box;
    width: 100%;
}

/* Typography for rendered markdown content */
.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4,
.article-content h5,
.article-content h6 {
    color: var(--primary);
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-weight: 600;
    line-height: 1.3;
    word-break: break-word;
}

.article-content h1 {
    font-size: clamp(1.5rem, 5vw, 2rem);
    border-bottom: 2px solid var(--border);
    padding-bottom: 0.5rem;
}

.article-content h2 {
    font-size: clamp(1.375rem, 4.5vw, 1.75rem);
}

.article-content h3 {
    font-size: clamp(1.25rem, 4vw, 1.5rem);
}

.article-content h4 {
    font-size: clamp(1.125rem, 3.5vw, 1.25rem);
}

.article-content p {
    margin-bottom: 1rem;
}

.article-content a {
    color: var(--primary);
    text-decoration: underline;
    text-decoration-color: transparent;
    transition: text-decoration-color 0.2s ease;
    word-break: break-word;
}

.article-content a:hover {
    text-decoration-color: var(--primary);
}

.article-content ul,
.article-content ol {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

.article-content li {
    margin-bottom: 0.5rem;
}

.article-content blockquote {
    border-left: 4px solid var(--primary);
    padding-left: 1rem;
    margin: 1.5rem 0;
    color: var(--text-secondary);
    font-style: italic;
    border-radius: 0 4px 4px 0;
    background-color: rgba(0, 0, 0, 0.3);
    padding: 1rem;
}

.article-content pre {
    background-color: var(--card-bg);
    border: 1px solid var(--border);
    padding: 1rem;
    overflow-x: auto;
    margin: 1rem 0;
    border-radius: 8px;
    font-size: 0.875rem;
    line-height: 1.5;
    max-width: 100%;
    box-sizing: border-box;
}

.article-content code {
    background-color: var(--card-bg);
    padding: 0.25rem 0.375rem;
    border-radius: 4px;
    font-size: 0.875rem;
    font-family: 'Courier New', monospace;
    border: 1px solid var(--border);
    word-break: break-all;
}

.article-content pre code {
    background-color: transparent;
    padding: 0;
    border: none;
    word-break: normal;
}

.article-content img {
    max-width: 100%;
    height: auto;
    margin: 1rem auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    display: block;
}

.article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    font-size: 0.875rem;
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    box-sizing: border-box;
}

.article-content th,
.article-content td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    word-break: break-word;
}

.article-content th {
    background-color: var(--card-bg);
    font-weight: 600;
    color: var(--primary);
}

.article-content hr {
    border: none;
    border-top: 2px solid var(--border);
    margin: 2rem 0;
}

/* Enhanced navigation */
.site-nav {
    border-bottom: 2px solid var(--border);
    background-color: var(--background);
    padding: 1rem 0;
    margin-bottom: 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.nav-container {
    max-width: 64rem;
    margin: 0 auto;
    padding: 0 1rem;
}

.nav-home {
    color: var(--primary);
    text-decoration: none;
    font-size: clamp(1.25rem, 4vw, 1.5rem);
    font-weight: 600;
    transition: color 0.2s ease;
    display: inline-block;
}

.nav-home:hover {
    color: oklch(0.85 0.18 60);
    transform: translateX(5px);
}

.main-content {
    min-height: calc(100vh - 200px);
}

/* Enhanced footer */
.site-footer {
    border-top: 2px solid var(--border);
    background-color: var(--card-bg);
    padding: 2rem 0;
    margin-top: 4rem;
}

.footer-container {
    max-width: 64rem;
    margin: 0 auto;
    padding: 0 1rem;
    text-align: center;
}

.footer-text {
    color: var(--text-primary);
    font-size: 1rem;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Comprehensive mobile responsive design */
@media (max-width: 768px) {
    body {
        padding: 0.75rem;
        gap: 1.5rem;
        overflow-x: hidden;
    }

    .article-info {
        padding: 1rem;
        gap: 0.75rem;
    }

    .article-page {
        padding: 0.5rem;
        max-width: calc(100vw - 1rem);
        box-sizing: border-box;
    }

    .article-header {
        margin-bottom: 1.5rem;
        padding-bottom: 1rem;
    }

    .article-meta {
        flex-direction: column;
        gap: 0.75rem;
    }

    .meta-item {
        flex-direction: row;
        gap: 0.5rem;
        align-items: center;
    }

    .tags {
        margin-top: 0.75rem;
    }

    .tag {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }

    .time-container {
        gap: 0.5rem;
    }

    .site-nav {
        padding: 0.75rem 0;
        margin-bottom: 1.5rem;
    }

    .nav-container {
        padding: 0 0.75rem;
    }

    .footer-container {
        padding: 0 0.75rem;
    }

    .footer-text {
        font-size: 0.875rem;
    }

    .article-content {
        overflow-wrap: break-word;
        word-wrap: break-word;
        width: 100%;
        max-width: 100%;
    }

    .article-content pre {
        margin: 1rem -0.5rem;
        border-radius: 0;
        padding: 0.75rem;
        font-size: 0.75rem;
    }

    .article-content table {
        margin: 1rem -0.5rem;
        border-radius: 0;
        width: calc(100% + 1rem);
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    body {
        padding: 0.5rem;
        gap: 1rem;
        overflow-x: hidden;
    }

    .article-info {
        padding: 0.75rem;
        gap: 0.5rem;
    }

    .article-page {
        padding: 0.25rem;
        max-width: calc(100vw - 0.5rem);
        margin: 0;
    }

    .blog-header {
        text-align: center;
        margin-bottom: 1rem;
    }

    .article-content {
        max-width: 100%;
        overflow-x: hidden;
    }

    .article-content table {
        font-size: 0.75rem;
        margin: 1rem -0.25rem;
        width: calc(100% + 0.5rem);
        display: block;
        overflow-x: auto;
    }

    .article-content th,
    .article-content td {
        padding: 0.5rem 0.25rem;
        white-space: nowrap;
    }

    .article-content pre {
        padding: 0.75rem;
        font-size: 0.75rem;
        margin: 1rem -0.25rem;
        border-radius: 0;
    }

    .tags {
        justify-content: start;
    }

    .site-nav {
        text-align: center;
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    .terminal-cursor::after {
        animation: none;
    }

    .article-info,
    .tag,
    .nav-home {
        transition: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --primary: oklch(0.9 0.2 60);
        --text-primary: oklch(0.95 0.05 120);
        --border: oklch(0.4 0.02 120);
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {

    .article-info:hover,
    .tag:hover,
    .nav-home:hover {
        transform: none;
    }

    .tag {
        padding: 0.5rem 0.75rem;
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .nav-home {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
}