/* ============================================================
   blog.css — bogdantruta.com/blog/

   Deliberately standalone: the blog shares the portfolio's palette and
   typography but none of its machinery. styles.css sets `overflow: hidden`
   on the body for the 3D canvas, which is exactly wrong for long-form
   reading, so the tokens below are restated rather than imported.

   Theme is driven by `html.light-mode`, set before first paint from the
   same localStorage['siteTheme'] key the 3D site uses.
   ============================================================ */

:root {
    --glow-color: #00ffff;
    --genesis-color: #00ff88;
    --background-start: #0a0a1a;
    --background-end: #1a1a3a;

    --text: #e5e5e5;
    --text-strong: #ffffff;
    --text-muted: #9ca3af;
    --text-faint: #6b7280;

    --surface: rgba(255, 255, 255, 0.03);
    --surface-hover: rgba(0, 255, 255, 0.05);
    --border: rgba(255, 255, 255, 0.1);
    --border-strong: rgba(0, 255, 255, 0.3);
    --header-bg: rgba(10, 10, 26, 0.82);

    --accent: var(--a-dark, #00ffff);
    --accent-soft: rgba(0, 255, 255, 0.12);

    --art-grid: rgba(255, 255, 255, 0.05);
    --art-glow: 0.55;

    --measure: 68ch;
    --radius: 0.75rem;
}

html.light-mode {
    --glow-color: #0f766e;
    --genesis-color: #115e59;
    --background-start: #f3efe6;
    --background-end: #e3dccb;

    --text: #44403c;
    --text-strong: #1c1917;
    --text-muted: #57534e;
    --text-faint: #78716c;

    --surface: rgba(250, 247, 240, 0.8);
    --surface-hover: rgba(15, 118, 110, 0.07);
    --border: rgba(28, 25, 23, 0.14);
    --border-strong: rgba(15, 118, 110, 0.35);
    --header-bg: rgba(243, 239, 230, 0.85);

    --accent: var(--a-light, #0f766e);
    --accent-soft: rgba(15, 118, 110, 0.1);

    --art-grid: rgba(28, 25, 23, 0.06);
    --art-glow: 0;
}

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

html {
    scroll-behavior: smooth;
    /* Anchored headings clear the sticky header. */
    scroll-padding-top: 6rem;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: linear-gradient(135deg, var(--background-start), var(--background-end));
    background-attachment: fixed;
    color: var(--text);
    min-height: 100vh;
    line-height: 1.7;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

::selection {
    background: var(--glow-color);
    color: var(--background-start);
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--background-end); }
::-webkit-scrollbar-thumb { background: var(--glow-color); border-radius: 4px; }

a { color: var(--glow-color); }

:focus-visible {
    outline: 2px solid var(--glow-color);
    outline-offset: 3px;
    border-radius: 3px;
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 100;
    padding: 0.75rem 1.25rem;
    background: var(--glow-color);
    color: var(--background-start);
    font-weight: 700;
    text-decoration: none;
    border-radius: 0 0 var(--radius) 0;
}

.skip-link:focus {
    left: 0;
}

/* ---------------------------------------------------------- site header --- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
    padding: 0.9rem clamp(1.1rem, 4vw, 2.5rem);
    background: var(--header-bg);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
}

.brand {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: 0.01em;
    color: var(--text-strong);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    transition: color 0.25s ease;
}

.brand:hover { color: var(--glow-color); }

.brand-sha {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    color: var(--glow-color);
    border: 1px solid var(--border-strong);
    border-radius: 0.4rem;
    padding: 0.15rem 0.4rem;
    line-height: 1;
}

/* Mirrors the pill nav on the 3D pages so the two halves of the site match. */
.page-nav {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: rgba(0, 0, 0, 0.3);
    padding: 0.25rem;
    border-radius: 1rem;
    border: 1px solid var(--border);
}

html.light-mode .page-nav {
    background: rgba(250, 246, 236, 0.7);
}

.page-nav a {
    color: var(--text-muted);
    text-decoration: none;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 0.35rem 0.95rem;
    border-radius: 0.75rem;
    border: 1px solid transparent;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.page-nav a:hover {
    color: var(--text-strong);
    background: var(--surface-hover);
}

.page-nav a.active {
    color: #0a0a1a;
    background: var(--glow-color);
    border-color: var(--glow-color);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.4);
    font-weight: 700;
}

html.light-mode .page-nav a.active {
    color: #ffffff;
    box-shadow: none;
}

.view-toggle {
    background: none;
    border: none;
    border-left: 1px solid var(--border);
    color: var(--text-faint);
    font-family: 'Roboto Mono', monospace;
    font-size: 0.75rem;
    padding: 0.35rem 0.75rem 0.35rem 0.85rem;
    margin-left: 0.15rem;
    cursor: pointer;
    transition: color 0.25s ease;
}

.view-toggle:hover { color: var(--text-strong); }

/* ----------------------------------------------------------------- main --- */

main {
    flex: 1;
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
    padding: clamp(2.5rem, 6vw, 4.5rem) clamp(1.1rem, 4vw, 2rem) 4rem;
}

/* ------------------------------------------------------------ blog index -- */

.blog-intro {
    max-width: var(--measure);
    margin-bottom: clamp(2.5rem, 5vw, 3.5rem);
}

.blog-intro h1 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(2.2rem, 6vw, 3.1rem);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: var(--text-strong);
    margin-bottom: 0.9rem;
}

.blog-intro h1::after {
    content: '';
    display: block;
    width: 3.5rem;
    height: 3px;
    margin-top: 1rem;
    border-radius: 2px;
    background: var(--glow-color);
    box-shadow: 0 0 14px rgba(0, 255, 255, calc(var(--art-glow) * 0.9));
}

.entries {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.entry {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 1.75rem;
    align-items: center;
    padding: 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

.entry:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 10px 34px rgba(0, 0, 0, 0.28);
}

html.light-mode .entry:hover {
    box-shadow: 0 10px 30px rgba(28, 25, 23, 0.1);
}

.entry-art {
    display: block;
    border-radius: 0.5rem;
    overflow: hidden;
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.22);
    aspect-ratio: 440 / 260;
}

html.light-mode .entry-art {
    background: rgba(255, 255, 255, 0.5);
}

.cover { display: block; width: 100%; height: 100%; }
.cover .grid { stroke: var(--art-grid); stroke-width: 1; }
.cover .rail {
    fill: none;
    stroke: var(--accent);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0.55;
}
.cover .node { fill: var(--accent); opacity: 0.8; }
.cover .head {
    fill: var(--accent);
    opacity: 1;
    filter: drop-shadow(0 0 6px var(--accent));
}
.cover .tick { fill: var(--accent); opacity: 0.22; }

.post-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.55rem;
    font-family: 'Roboto Mono', monospace;
    font-size: 0.74rem;
    letter-spacing: 0.05em;
    color: var(--text-faint);
    margin-bottom: 0.6rem;
}

.post-meta .sha {
    color: var(--genesis-color);
    border: 1px solid var(--border);
    border-radius: 0.35rem;
    padding: 0.1rem 0.4rem;
}

.post-meta .dot { opacity: 0.5; }

.entry-body h2 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(1.25rem, 2.4vw, 1.5rem);
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.01em;
    margin-bottom: 0.5rem;
}

.entry-body h2 a {
    color: var(--text-strong);
    text-decoration: none;
    transition: color 0.25s ease;
}

.entry:hover h2 a { color: var(--accent); }

.entry-dek {
    color: var(--text-muted);
    font-size: 0.96rem;
    line-height: 1.6;
}

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

.tech-tag {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.68rem;
    letter-spacing: 0.04em;
    color: var(--text-faint);
    background: var(--accent-soft);
    border: 1px solid var(--border);
    border-radius: 0.35rem;
    padding: 0.18rem 0.5rem;
}

.empty {
    color: var(--text-faint);
    font-family: 'Roboto Mono', monospace;
}

/* ------------------------------------------------------------ back links -- */

/* The measure sits on the wrapper, not the link: `ch` resolves against the
   element's own font, and the link is small monospace while the article is not.
   Putting max-width on the link itself would misalign it with the post column. */
.back-wrap {
    max-width: var(--measure);
    margin: 0 auto 2rem;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-family: 'Roboto Mono', monospace;
    font-size: 0.78rem;
    letter-spacing: 0.05em;
    color: var(--text-faint);
    text-decoration: none;
    transition: color 0.25s ease, gap 0.25s ease;
}

.back-link:hover {
    color: var(--glow-color);
    gap: 0.7rem;
}

.post-foot-back {
    max-width: var(--measure);
    margin: 1.5rem auto 0;
    text-align: center;
    font-family: 'Roboto Mono', monospace;
    font-size: 0.8rem;
}

.post-foot-back a {
    color: var(--text-muted);
    text-decoration: none;
    border-bottom: 1px dashed var(--border-strong);
    padding-bottom: 2px;
    transition: color 0.25s ease;
}

.post-foot-back a:hover { color: var(--glow-color); }

/* ------------------------------------------------------------- post page -- */

.post {
    max-width: var(--measure);
    margin: 0 auto;
}

.post-head {
    margin-bottom: 2.75rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border);
}

.post-head h1 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(2rem, 5.2vw, 2.9rem);
    font-weight: 800;
    line-height: 1.12;
    letter-spacing: -0.025em;
    color: var(--text-strong);
    margin-bottom: 1rem;
    text-wrap: balance;
}

.post-head .dek {
    font-size: 1.15rem;
    line-height: 1.6;
    color: var(--text-muted);
}

.post-body {
    font-size: 1.0625rem;
    line-height: 1.78;
}

.post-body > * + * { margin-top: 1.35rem; }

.post-body h2 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(1.4rem, 3vw, 1.75rem);
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.015em;
    color: var(--text-strong);
    margin-top: 3rem;
    padding-top: 0.6rem;
    border-top: 1px solid var(--border);
}

.post-body h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.18rem;
    font-weight: 700;
    color: var(--text-strong);
    margin-top: 2.2rem;
}

.post-body h4 {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-faint);
    margin-top: 2rem;
}

.post-body a {
    color: var(--glow-color);
    text-decoration: none;
    border-bottom: 1px solid var(--border-strong);
    transition: border-color 0.2s ease, background 0.2s ease;
}

.post-body a:hover {
    border-bottom-color: var(--glow-color);
    background: var(--accent-soft);
}

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

.post-body ul,
.post-body ol {
    padding-left: 1.4rem;
}

.post-body li + li { margin-top: 0.5rem; }
.post-body li::marker { color: var(--glow-color); }

.post-body code {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.87em;
    background: var(--accent-soft);
    border: 1px solid var(--border);
    border-radius: 0.3rem;
    padding: 0.1em 0.35em;
    word-break: break-word;
}

.post-body pre {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--border);
    border-left: 3px solid var(--glow-color);
    border-radius: 0.5rem;
    padding: 1.1rem 1.25rem;
    overflow-x: auto;
}

html.light-mode .post-body pre {
    background: rgba(28, 25, 23, 0.04);
}

.post-body pre code {
    background: none;
    border: none;
    padding: 0;
    font-size: 0.85rem;
    line-height: 1.65;
    color: var(--text);
    word-break: normal;
}

.post-body blockquote {
    border-left: 3px solid var(--glow-color);
    padding: 0.15rem 0 0.15rem 1.25rem;
    color: var(--text-muted);
    font-style: italic;
}

.post-body blockquote p { margin: 0; }

.note {
    background: var(--accent-soft);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    padding: 1.1rem 1.35rem;
    font-size: 0.98rem;
}

.note > * + * { margin-top: 0.75rem; }

.note-title {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--glow-color);
}

.post-body hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 2.5rem 0;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.post-body table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

.post-body th,
.post-body td {
    text-align: left;
    padding: 0.7rem 1rem;
    border-bottom: 1px solid var(--border);
}

.post-body th {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-faint);
    background: var(--surface);
}

.post-body tbody tr:last-child td { border-bottom: none; }

/* --------------------------------------------------- post nav + author ---- */

.post-nav {
    max-width: var(--measure);
    margin: 3.5rem auto 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
}

.pn {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 1.1rem 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    transition: border-color 0.3s ease, transform 0.3s ease;
}

.pn:hover { border-color: var(--glow-color); transform: translateY(-2px); }
.pn-next { text-align: right; }

.pn-label {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    color: var(--text-faint);
}

.pn-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    font-size: 0.98rem;
    line-height: 1.35;
    color: var(--text-strong);
}

.author-card {
    max-width: var(--measure);
    margin: 1rem auto 0;
    padding: 1.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--genesis-color);
    border-radius: var(--radius);
}

.author-name {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    color: var(--text-strong);
    margin-bottom: 0.4rem;
}

.author-bio {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.65;
}

.author-links {
    margin-top: 0.85rem;
    font-family: 'Roboto Mono', monospace;
    font-size: 0.8rem;
}

.author-links a {
    color: var(--glow-color);
    text-decoration: none;
    border-bottom: 1px dashed var(--border-strong);
}

/* --------------------------------------------------------------- footer --- */

.site-footer {
    border-top: 1px solid var(--border);
    padding: 2.5rem clamp(1.1rem, 4vw, 2.5rem) 3rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.foot-line {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.8rem;
    color: var(--text-faint);
}

.foot-line .prompt { color: var(--genesis-color); }

.foot-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.4rem 1.4rem;
}

.foot-links a {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.25s ease;
}

.foot-links a:hover { color: var(--glow-color); }

.foot-copy {
    font-size: 0.78rem;
    color: var(--text-faint);
}

/* ------------------------------------------------------------ responsive -- */

@media (max-width: 720px) {
    .site-header {
        justify-content: center;
        gap: 0.75rem;
        padding-bottom: 0.75rem;
    }

    .entry {
        grid-template-columns: 1fr;
        gap: 1.1rem;
    }

    .entry-art { max-height: 150px; }

    .post-body { font-size: 1.02rem; }

    .pn-next { text-align: left; }
}

@media (max-width: 400px) {
    .page-nav a { padding: 0.35rem 0.7rem; font-size: 0.8rem; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }

    .back-link:hover { gap: 0.45rem; }

    .entry,
    .pn,
    .brand,
    .page-nav a,
    .post-body a,
    .foot-links a {
        transition: none;
    }

    .entry:hover,
    .pn:hover { transform: none; }
}

/* ----------------------------------------------------------------- print -- */

@media print {
    .site-header, .site-footer, .post-nav, .author-card, .skip-link { display: none; }
    body { background: #fff; color: #000; }
    .post { max-width: none; }
    .post-body a { border: none; color: #000; }
    .post-body a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.8em; }
}
