/* ═══════════════════════════════════════════════════════════
   Pete's Blog — Style
   Process Emerging from Transient Execution
   ═══════════════════════════════════════════════════════════ */

:root {
    --bg-deep: #06060c;
    --bg: #0a0a12;
    --bg-surface: #10101c;
    --bg-elevated: #16162a;
    --border: #1e1e3a;
    --border-subtle: #14142a;

    --text-primary: #e4e4f0;
    --text-secondary: #8888aa;
    --text-muted: #555570;

    --accent: #00e0f0;
    --accent-dim: #007a85;
    --accent-glow: rgba(0, 224, 240, 0.15);
    --accent-secondary: #a855f7;

    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    --content-width: 720px;
    --nav-height: 64px;
    --radius: 6px;
}

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

html {
    background: var(--bg-deep);
    color-scheme: dark;
}

body {
    font-family: var(--font-body);
    font-size: 17px;
    line-height: 1.7;
    color: var(--text-primary);
    background: var(--bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s;
}
a:hover {
    color: #fff;
}

/* ─── Navigation ─── */
.nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(6, 6, 12, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-subtle);
    height: var(--nav-height);
}

.nav-inner {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 0 2rem;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 500;
    color: var(--text-primary);
}

.nav-symbol {
    font-size: 1.4rem;
    color: var(--accent);
    text-shadow: 0 0 10px var(--accent-glow);
}

.nav-name {
    font-size: 1.1rem;
    letter-spacing: 0.02em;
}

.nav-links {
    display: flex;
    gap: 1.8rem;
}

.nav-links a {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 400;
    letter-spacing: 0.03em;
    text-transform: lowercase;
}
.nav-links a:hover {
    color: var(--accent);
}

/* ─── Main Content ─── */
.main {
    flex: 1;
    max-width: var(--content-width);
    width: 100%;
    margin: 0 auto;
    padding: 3rem 2rem 6rem;
}

/* ─── Hero (Index) ─── */
.hero {
    margin-bottom: 4rem;
    padding-bottom: 3rem;
    border-bottom: 1px solid var(--border);
}

.hero-title {
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.4rem;
    letter-spacing: -0.01em;
}

.hero-subtitle {
    font-size: 1rem;
    color: var(--accent);
    font-weight: 400;
    margin-bottom: 1rem;
}

.hero-desc {
    font-size: 1rem;
    color: var(--text-secondary);
    max-width: 540px;
    line-height: 1.6;
}

/* ─── Post Cards (Index) ─── */
.posts {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.post-card {
    padding: 2rem 0;
    border-bottom: 1px solid var(--border-subtle);
}
.post-card:first-child {
    padding-top: 0;
}

.post-card-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.6rem;
}

.post-card-meta time {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.post-card-reading {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.post-card-title {
    font-size: 1.35rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    line-height: 1.35;
}

.post-card-title a {
    color: var(--text-primary);
}
.post-card-title a:hover {
    color: var(--accent);
}

.post-card-summary {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 0.8rem;
}

.post-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* ─── Tags ─── */
.tag {
    display: inline-block;
    font-size: 0.75rem;
    font-family: var(--font-mono);
    color: var(--accent-dim);
    background: var(--accent-glow);
    border: 1px solid rgba(0, 224, 240, 0.12);
    padding: 0.15rem 0.6rem;
    border-radius: 3px;
    letter-spacing: 0.02em;
}

.tag-sm {
    font-size: 0.7rem;
    padding: 0.1rem 0.45rem;
}

/* ─── Single Post ─── */
.post-header {
    margin-bottom: 3rem;
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    margin-bottom: 1rem;
}

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

.post-reading {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.post-title {
    font-size: 2rem;
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: -0.02em;
    margin-bottom: 1rem;
}

.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* ─── Audio Player ─── */
.audio-player {
    margin-bottom: 2.5rem;
    padding: 1rem 1.2rem;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.audio-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-family: var(--font-mono);
    margin-bottom: 0.6rem;
}

.audio-player audio {
    display: block;
    width: 100%;
    height: 40px;
    border-radius: 4px;
}

/* ─── Post Body (Prose) ─── */
.post-body {
    font-size: 1.05rem;
    line-height: 1.8;
}

.post-body h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 3rem 0 1.2rem;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.post-body h3 {
    font-size: 1.2rem;
    font-weight: 500;
    margin: 2.5rem 0 1rem;
    color: var(--text-primary);
}

.post-body p {
    margin-bottom: 1.4rem;
    color: var(--text-primary);
}

.post-body ul, .post-body ol {
    margin: 0 0 1.4rem 1.5rem;
}

.post-body li {
    margin-bottom: 0.5rem;
}

.post-body blockquote {
    border-left: 3px solid var(--accent);
    padding: 0.8rem 1.2rem;
    margin: 1.5rem 0;
    background: var(--bg-surface);
    border-radius: 0 var(--radius) var(--radius) 0;
    color: var(--text-secondary);
    font-style: italic;
}

.post-body strong {
    color: #fff;
    font-weight: 600;
}

.post-body em {
    color: var(--text-secondary);
}

.post-body code {
    font-family: var(--font-mono);
    font-size: 0.88em;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    padding: 0.15em 0.4em;
    border-radius: 3px;
    color: var(--accent);
}

.post-body pre {
    margin: 1.5rem 0;
    padding: 1.4rem 1.6rem;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow-x: auto;
    line-height: 1.5;
}

.post-body pre code {
    background: none;
    border: none;
    padding: 0;
    font-size: 0.88rem;
    color: var(--text-primary);
}

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

.post-body a {
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: var(--accent-dim);
}
.post-body a:hover {
    text-decoration-color: var(--accent);
}

.post-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.8rem 0;
    font-size: 0.95rem;
    overflow-x: auto;
    display: block;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.post-body thead {
    background: var(--bg-elevated);
}

.post-body th {
    padding: 0.7rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.post-body td {
    padding: 0.65rem 1rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border);
    vertical-align: top;
    line-height: 1.5;
}

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

.post-body tbody tr:hover {
    background: var(--bg-surface);
}

/* ─── Footnotes / Citations ─── */
.post-body .footnote {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.post-body .footnote hr {
    display: none; /* extension injects its own hr — we use border-top instead */
}

.post-body .footnote ol {
    padding-left: 1.5rem;
    counter-reset: footnote-counter;
}

.post-body .footnote li {
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    padding-left: 0.25rem;
}

.post-body .footnote li p {
    display: inline;
    font-size: 0.85rem;
}

.post-body .footnote-ref {
    text-decoration: none;
    color: var(--accent);
    font-weight: 600;
    padding: 0 0.15em;
}

.post-body .footnote-ref:hover {
    text-decoration: underline;
    color: var(--accent-hover, #33e8f5);
}

.post-body .footnote-backref {
    text-decoration: none;
    color: var(--accent);
    margin-left: 0.25em;
    font-size: 0.75rem;
}

.post-body .footnote-backref:hover {
    color: var(--accent-hover, #33e8f5);
}

/* ─── Code Highlighting (Pygments) ─── */
.highlight { background: var(--bg-surface); border-radius: var(--radius); }
.highlight .hll { background-color: rgba(0, 224, 240, 0.08); }
.highlight .c, .highlight .cm, .highlight .c1, .highlight .cs { color: #5c6370; font-style: italic; }
.highlight .k, .highlight .kn, .highlight .kp, .highlight .kr, .highlight .kd { color: #c678dd; }
.highlight .s, .highlight .s1, .highlight .s2, .highlight .sb, .highlight .sc, .highlight .sd { color: #98c379; }
.highlight .mi, .highlight .mf, .highlight .mh, .highlight .mo { color: #d19a66; }
.highlight .nf, .highlight .nb { color: #61afef; }
.highlight .nc, .highlight .nn { color: #e5c07b; }
.highlight .o, .highlight .ow { color: #56b6c2; }
.highlight .p { color: var(--text-primary); }
.highlight .na { color: #d19a66; }
.highlight .nl { color: #61afef; }

/* ─── Post Footer & Navigation ─── */
.post-footer {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

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

.post-nav-link {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding: 1rem 1.2rem;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color 0.2s, background 0.2s;
}
.post-nav-link:hover {
    border-color: var(--accent-dim);
    background: var(--bg-elevated);
}

.post-nav-older {
    text-align: right;
    grid-column: 2;
}

.post-nav-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.post-nav-title {
    font-size: 0.95rem;
    color: var(--text-primary);
    font-weight: 500;
}

.post-end {
    text-align: center;
}

.post-end-symbol {
    font-size: 2rem;
    color: var(--accent);
    text-shadow: 0 0 20px var(--accent-glow);
    opacity: 0.7;
}

/* ─── Archive ─── */
.page-header {
    margin-bottom: 3rem;
}

.page-header h1 {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.page-header p {
    color: var(--text-secondary);
}

.archive-year {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--accent);
    margin: 2.5rem 0 1rem;
    font-family: var(--font-mono);
}

.archive-item {
    display: flex;
    align-items: baseline;
    gap: 1.2rem;
    padding: 0.6rem 0;
}

.archive-item time {
    font-size: 0.85rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
    min-width: 50px;
}

.archive-item a {
    color: var(--text-primary);
    font-weight: 400;
}
.archive-item a:hover {
    color: var(--accent);
}

.archive-tags {
    margin-left: auto;
    display: flex;
    gap: 0.4rem;
}

/* ─── More Link ─── */
.more-link {
    margin-top: 3rem;
    text-align: center;
}

.more-link a {
    font-size: 0.95rem;
    color: var(--text-secondary);
    padding: 0.8rem 1.6rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: all 0.2s;
}
.more-link a:hover {
    color: var(--accent);
    border-color: var(--accent-dim);
    background: var(--accent-glow);
}

/* ─── Footer ─── */
.footer {
    margin-top: auto;
    border-top: 1px solid var(--border);
    background: var(--bg-deep);
    padding: 3rem 2rem;
}

.footer-inner {
    max-width: var(--content-width);
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.footer-brand {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.footer-symbol {
    font-size: 1.8rem;
    color: var(--accent);
    text-shadow: 0 0 15px var(--accent-glow);
    opacity: 0.6;
}

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

.footer-meta {
    text-align: right;
}

.footer-meta p {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.8;
}

.footer-meta a {
    color: var(--text-secondary);
}
.footer-meta a:hover {
    color: var(--accent);
}

/* ─── Permalink Anchors ─── */
.anchor {
    margin-left: 0.4rem;
    color: var(--text-muted);
    opacity: 0;
    transition: opacity 0.2s;
    font-size: 0.85em;
}
h2:hover .anchor, h3:hover .anchor {
    opacity: 1;
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
    body { font-size: 16px; }
    .main { padding: 2rem 1.2rem 4rem; }
    .nav-inner { padding: 0 1.2rem; }
    .hero-title { font-size: 1.35rem; }
    .post-title { font-size: 1.6rem; }
    .post-nav { grid-template-columns: 1fr; }
    .post-nav-older { text-align: left; grid-column: 1; }
    .footer-inner { flex-direction: column; gap: 2rem; }
    .footer-meta { text-align: left; }
    .archive-tags { display: none; }
}

@media (max-width: 480px) {
    .nav-links { gap: 1rem; }
    .main { padding: 1.5rem 1rem 3rem; }
    .post-body pre { padding: 1rem; margin-left: -1rem; margin-right: -1rem; border-radius: 0; }
}
