/* ============================================
   GOSIGN — Blog Post Styles v3
   Terminal aesthetic, editorial reading comfort.
   Palette aligned with the main site (emerald on charcoal).
   ============================================ */

/* Claude-inspired pairing: Source Serif 4 ≈ Copernicus/Tiempos, Archivo ≈ Styrene */
@import url('https://fonts.googleapis.com/css2?family=Source+Serif+4:ital,opsz,wght@0,8..60,400;0,8..60,600;0,8..60,700;0,8..60,900;1,8..60,400&family=Archivo:wght@300;400;500;600;700;800&family=JetBrains+Mono:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&display=swap');

/* ============================================
   Design Tokens
   ============================================ */
:root {
    --color-bg: #0c110e;
    --color-bg-alt: #10160f;
    --color-surface: #121a15;
    --color-terminal: #0a100d;
    --color-terminal-header: #151f1a;

    --color-text: #00ff9d;
    --color-text-bright: #4dffbe;
    --color-text-dim: #00cc7d;
    --color-text-muted: #5d8a72;

    --color-white: #eef5f0;
    --color-white-dim: #b9c7be;

    --color-border: rgba(0, 255, 157, 0.16);
    --color-border-hover: rgba(0, 255, 157, 0.4);
    --color-accent: #00e5ff;
    --color-accent-dim: #00b8cc;

    --glow-sm: 0 0 8px rgba(0, 255, 157, 0.12);
    --glow-md: 0 0 20px rgba(0, 255, 157, 0.16);
    --glow-lg: 0 0 40px rgba(0, 255, 157, 0.12), 0 0 80px rgba(0, 255, 157, 0.04);
    --glow-text: 0 0 12px rgba(0, 255, 157, 0.35);

    --font-mono: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
    --font-sans: 'Archivo', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-display: 'Source Serif 4', 'Georgia', serif;
    --font-reading: 'Source Serif 4', 'Georgia', serif;

    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-pill: 100px;

    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
    width: 100%;
}

body {
    font-family: var(--font-mono);
    background:
        radial-gradient(110% 70% at 50% 0%, #121a14 0%, var(--color-bg) 60%, #080d0a 100%) fixed;
    color: var(--color-text);
    line-height: 1.7;
    overflow-x: hidden;
    width: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::selection {
    background: var(--color-text);
    color: var(--color-bg);
}

/* Subtle scanline overlay */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    background: repeating-linear-gradient(0deg,
            transparent,
            transparent 2px,
            rgba(0, 0, 0, 0.025) 2px,
            rgba(0, 0, 0, 0.025) 4px);
    pointer-events: none;
    z-index: 9999;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* ============================================
   Reading Progress Bar (injected by blog.js)
   ============================================ */
.read-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 2px;
    width: 100%;
    transform-origin: 0 50%;
    transform: scaleX(0);
    background: linear-gradient(90deg, var(--color-text), var(--color-accent));
    box-shadow: 0 0 12px rgba(0, 255, 157, 0.5);
    z-index: 1001;
    pointer-events: none;
}

/* ============================================
   Terminal Header
   ============================================ */
.terminal-header {
    background: rgba(18, 26, 21, 0.82);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 0.6rem 1rem;
    display: flex;
    align-items: center;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    border-bottom: 1px solid var(--color-border);
    transition: border-color var(--transition-fast);
}

.terminal-header:hover {
    border-bottom-color: var(--color-border-hover);
}

.terminal-controls {
    display: flex;
    gap: 0.5rem;
    margin-right: 1rem;
}

.control {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    transition: transform var(--transition-fast);
}

.control:hover {
    transform: scale(1.3);
}

.close {
    background: #ff5f56;
    box-shadow: 0 0 6px rgba(255, 95, 86, 0.4);
}

.minimize {
    background: #ffbd2e;
    box-shadow: 0 0 6px rgba(255, 189, 46, 0.4);
}

.maximize {
    background: #27c93f;
    box-shadow: 0 0 6px rgba(39, 201, 63, 0.4);
}

.terminal-title {
    color: var(--color-text-muted);
    font-size: 0.85rem;
    font-family: var(--font-mono);
    letter-spacing: 0.5px;
}

/* Hint that the header is a way home */
.terminal-title::after {
    content: '  — cd ~/home';
    opacity: 0;
    color: var(--color-text-dim);
    transition: opacity var(--transition-fast);
}

.terminal-header:hover .terminal-title::after {
    opacity: 1;
}

/* ============================================
   Hero / Blog Post Section
   ============================================ */
.hero {
    height: auto;
    min-height: 100vh;
    padding: 5rem 0 3rem;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.matrix-bg {
    position: fixed;
    inset: 0;
    z-index: -1;
    opacity: 0.45;
    pointer-events: none;
}

.matrix-bg canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.terminal-window {
    background: rgba(10, 16, 13, 0.88);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 3rem;
    width: 95%;
    max-width: 880px;
    position: relative;
    z-index: 2;
    box-shadow: var(--glow-lg), 0 25px 60px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    margin: 0 auto;
}

/* Faux window bar on top of the article window */
.terminal-window::before {
    content: '● ● ●';
    display: block;
    font-size: 0.6rem;
    letter-spacing: 0.45em;
    color: var(--color-text-muted);
    opacity: 0.55;
    margin-bottom: 1.6rem;
}

.terminal-output {
    font-size: 1.1rem;
    line-height: 1.8;
    padding: 0.4rem;
}

.prompt {
    color: var(--color-accent);
    margin-right: 0.5rem;
    font-weight: 600;
}

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

/* ============================================
   Blog Post Content
   ============================================ */
.blog-title {
    font-size: clamp(1.8rem, 4.5vw, 2.6rem);
    color: var(--color-white);
    margin-bottom: 0.8rem;
    text-align: center;
    font-family: var(--font-display);
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.2;
    text-shadow: var(--glow-text);
}

.blog-subtitle {
    font-size: 1rem;
    color: var(--color-text-dim);
    margin-bottom: 0.8rem;
    text-align: center;
    font-family: var(--font-sans);
    font-weight: 300;
}

.blog-meta {
    font-size: 0.82rem;
    color: var(--color-text-muted);
    text-align: center;
    margin-bottom: 1.6rem;
    font-family: var(--font-mono);
    letter-spacing: 0.5px;
}

/* Divider under the meta line */
.blog-meta::after {
    content: '';
    display: block;
    width: 60px;
    height: 1px;
    margin: 1.4rem auto 0;
    background: linear-gradient(90deg, transparent, var(--color-text), transparent);
    opacity: 0.5;
}

.blog-content {
    max-width: 720px;
    margin: 0 auto;
    word-wrap: break-word;
    text-align: left;
    font-size: 1.1rem;
    line-height: 1.85;
    color: var(--color-white-dim);
    font-family: var(--font-reading);
    font-weight: 400;
}

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

.blog-content h2,
.blog-content h3 {
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--color-white);
    letter-spacing: -0.01em;
    line-height: 1.3;
    margin: 2.4rem 0 1rem;
}

.blog-content h2 {
    font-size: 1.45rem;
    padding-left: 1rem;
    border-left: 3px solid var(--color-text);
}

.blog-content h3 {
    font-size: 1.15rem;
}

.blog-content big {
    font-size: 1.18em;
}

.sub-heading {
    font-family: var(--font-display);
    color: var(--color-white);
}

.subheading {
    font-size: large;
    color: var(--color-text);
    font-family: var(--font-mono);
}

/* ============================================
   Highlight Utilities
   ============================================ */
.highlight_glow {
    color: var(--color-text);
    text-shadow: var(--glow-text);
    font-weight: 600;
}

.highlight_underline {
    font-weight: 600;
    color: var(--color-white);
    text-decoration: underline;
    text-decoration-color: var(--color-text);
    text-decoration-thickness: 2px;
    text-underline-offset: 4px;
}

.highlight_allout {
    background: linear-gradient(135deg, var(--color-text), var(--color-accent));
    color: #06100b;
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-sm);
    font-weight: 700;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

/* ============================================
   Links
   ============================================ */
a {
    color: var(--color-text);
    text-decoration: none;
    transition: all var(--transition-fast);
}

a:hover {
    color: var(--color-text-bright);
}

.blog-content a {
    text-decoration: underline;
    text-underline-offset: 4px;
    text-decoration-color: rgba(0, 255, 157, 0.4);
}

.blog-content a:hover {
    text-decoration-color: var(--color-text-bright);
}

/* ============================================
   Back to Home (inline styles stripped by blog.js)
   ============================================ */
.back-home {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text) !important;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-pill);
    padding: 0.65rem 1.5rem;
    margin: 0.4rem 0 1.2rem;
    letter-spacing: 0.04em;
    transition: all var(--transition-fast);
    text-decoration: none !important;
}

.back-home::before {
    content: '←';
    transition: transform var(--transition-fast);
}

.back-home:hover {
    border-color: var(--color-border-hover);
    background: rgba(0, 255, 157, 0.06);
    box-shadow: var(--glow-sm);
}

.back-home:hover::before {
    transform: translateX(-3px);
}

/* ============================================
   Blog Images
   ============================================ */
.blog-image {
    margin: 2rem 0;
    text-align: center;
}

.featured-image {
    width: 100%;
    max-width: 800px;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    box-shadow: var(--glow-sm), 0 16px 40px rgba(0, 0, 0, 0.4);
    transition: all var(--transition-smooth);
}

.featured-image:hover {
    box-shadow: var(--glow-md), 0 20px 50px rgba(0, 0, 0, 0.45);
    border-color: var(--color-border-hover);
    transform: translateY(-3px);
}

.content-image {
    width: 100%;
    max-width: 600px;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    box-shadow: var(--glow-sm);
}

.image-caption {
    font-style: italic;
    color: var(--color-text-muted);
    margin-top: 10px;
    font-size: 0.85rem;
    font-family: var(--font-sans);
}

.featured-image,
.content-image {
    max-width: 100%;
    height: auto;
}

/* ============================================
   Footer
   ============================================ */
footer {
    padding: 2.5rem 0;
    text-align: center;
    border-top: 1px solid var(--color-border);
    color: var(--color-text-muted);
    font-size: 0.85rem;
    background: rgba(8, 13, 10, 0.6);
}

/* ============================================
   Legacy card styles (kept for compatibility)
   ============================================ */
.section-header {
    font-size: 1.3rem;
    margin-bottom: 2rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text-dim);
}

.social-links {
    display: flex;
    gap: 16px;
    margin: 1.2rem 0;
    flex-wrap: wrap;
}

.social-links a {
    color: var(--color-text-dim);
    padding: 8px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.social-links a:hover {
    transform: translateY(-3px) scale(1.1);
    color: var(--color-text-bright);
    text-shadow: var(--glow-text);
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.8rem;
}

.tags span {
    background: rgba(0, 229, 255, 0.06);
    padding: 0.2rem 0.65rem;
    border-radius: var(--radius-pill);
    font-size: 0.78rem;
    font-family: var(--font-mono);
    border: 1px solid rgba(0, 229, 255, 0.15);
    color: var(--color-accent-dim);
    transition: all var(--transition-fast);
}

.tags span:hover {
    background: rgba(0, 229, 255, 0.15);
    border-color: rgba(0, 229, 255, 0.3);
    transform: translateY(-2px);
}

/* ============================================
   Animations
   ============================================ */
@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .terminal-window { opacity: 1 !important; transform: none !important; }
}

/* ============================================
   Scrollbar
   ============================================ */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--color-bg);
}

::-webkit-scrollbar-thumb {
    background: #2a3a31;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-dim);
}

/* ============================================
   Responsive: Tablet
   ============================================ */
@media (max-width: 768px) {
    .terminal-window {
        width: 95%;
        padding: 2rem;
        margin: 1rem auto;
    }

    .terminal-output {
        font-size: 0.95rem;
    }

    .blog-title {
        font-size: 1.5rem;
        margin-top: 1rem;
    }

    .blog-content {
        font-size: 0.98rem;
        line-height: 1.8;
        padding: 0 4px;
    }

    .terminal-header {
        padding: 0.4rem 0.8rem;
    }

    .terminal-title {
        font-size: 0.75rem;
    }

    .hero {
        min-height: auto;
        padding: 4rem 0 2rem;
    }
}

/* ============================================
   Responsive: Small Mobile
   ============================================ */
@media (max-width: 480px) {
    .terminal-window {
        padding: 1.5rem;
        margin: 0.5rem auto;
    }

    .blog-title {
        font-size: 1.35rem;
        margin-top: 1rem;
    }

    .blog-subtitle {
        font-size: 0.85rem;
    }

    .blog-meta {
        font-size: 0.78rem;
        margin-bottom: 1.2rem;
    }

    .blog-content {
        font-size: 0.93rem;
        line-height: 1.75;
    }

    .blog-content h2 {
        font-size: 1.2rem;
    }

    .terminal-controls {
        gap: 0.3rem;
    }

    .control {
        width: 10px;
        height: 10px;
    }

    footer {
        padding: 1.5rem 0;
        font-size: 0.8rem;
    }

    .hero {
        padding-top: 3.2rem;
        padding-bottom: 1.5rem;
    }
}

/* ============================================
   Responsive: Very Small
   ============================================ */
@media (max-width: 600px) {
    .blog-content p {
        margin-bottom: 1rem;
    }

    .terminal-window {
        box-shadow: var(--glow-sm);
    }

    .blog-image {
        margin: 15px 0;
    }

    .terminal-title {
        font-size: 0.72rem;
        max-width: 80%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .terminal-title::after {
        content: '';
    }
}

/* Medium screens */
@media (min-width: 769px) and (max-width: 1024px) {
    .terminal-window {
        max-width: 90%;
        padding: 2.5rem;
    }
}

/* Large screens */
@media (min-width: 1600px) {
    .blog-content {
        max-width: 780px;
        font-size: 1.12rem;
    }
}

/* Landscape mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .hero {
        min-height: auto;
        padding: 3.5rem 0 2rem;
    }
}
