/* ============================================================
   mdm.tools — Field Notes (blog) stylesheet
   Same Trust / Tech brand tokens as the site.
   ============================================================ */

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

:root {
    --bg:#0B2038; --surface:#0E2742; --surface2:#14385C;
    --accent:#3DA9FC; --accent2:#1B4E7D; --text:#F5F8FC; --text-dim:#A9C0D6; --faint:#7C99B4;
    --yellow:#E7B152; --coral:#F2795F;
    --accent-soft:rgba(61,169,252,.14); --accent-line:rgba(61,169,252,.34);
    --mesh:rgba(61,169,252,.055); --shadow:0 18px 50px -22px rgba(0,0,0,.75);
    --radius:14px; --radius-sm:9px; --maxw:1080px;
    --mono:ui-monospace,"SF Mono","SFMono-Regular","Cascadia Code","Fira Code",Menlo,monospace;
    --sans:-apple-system,BlinkMacSystemFont,"SF Pro Display","SF Pro Text","Segoe UI",Roboto,sans-serif;
}
[data-theme="light"] {
    --bg:#EDF2F8; --surface:#FFFFFF; --surface2:#D6E2EE;
    --accent:#1E7FD0; --accent2:#1E7FD0; --text:#0E2742; --text-dim:#4A6885; --faint:#7C93AB;
    --yellow:#B77C1A; --coral:#D8543A;
    --accent-soft:rgba(30,127,208,.10); --accent-line:rgba(30,127,208,.28);
    --mesh:rgba(30,127,208,.06); --shadow:0 18px 44px -24px rgba(20,56,92,.32);
}
@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) {
        --bg:#EDF2F8; --surface:#FFFFFF; --surface2:#D6E2EE;
        --accent:#1E7FD0; --accent2:#1E7FD0; --text:#0E2742; --text-dim:#4A6885; --faint:#7C93AB;
        --yellow:#B77C1A; --coral:#D8543A;
        --accent-soft:rgba(30,127,208,.10); --accent-line:rgba(30,127,208,.28);
        --mesh:rgba(30,127,208,.06); --shadow:0 18px 44px -24px rgba(20,56,92,.32);
    }
}

html { scroll-behavior: smooth; }
body {
    font-family: var(--sans); background: var(--bg); color: var(--text);
    line-height: 1.55; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
    overflow-x: hidden; min-height: 100vh;
}
body::before {
    content: ""; position: fixed; inset: 0; z-index: -2; pointer-events: none;
    background-image: linear-gradient(var(--mesh) 1px, transparent 1px), linear-gradient(90deg, var(--mesh) 1px, transparent 1px);
    background-size: 32px 32px;
    -webkit-mask-image: radial-gradient(120% 90% at 88% -6%, #000 0%, transparent 62%);
    mask-image: radial-gradient(120% 90% at 88% -6%, #000 0%, transparent 62%);
}
a { color: inherit; text-decoration: none; }
code { font-family: var(--mono); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.skip-link { position: absolute; left: 14px; top: -120px; background: var(--accent); color: #062033; padding: 8px 16px; border-radius: 8px; font-weight: 700; font-size: .8rem; z-index: 999; }
.skip-link:focus { top: 10px; }

/* nav — shared markup */
.site-nav { position: sticky; top: 0; z-index: 200; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(140%) blur(14px); border-bottom: 1px solid var(--surface2); }
.site-nav-inner { max-width: var(--maxw); margin: 0 auto; padding: 9px 24px; min-height: 60px; display: flex; align-items: center; gap: 16px; }
.nav-brand { display: inline-flex; align-items: center; gap: 9px; font-family: var(--mono); font-weight: 600; font-size: 1rem; color: var(--text); flex-shrink: 0; }
.nav-brand::before { content: ""; width: 11px; height: 11px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.dot-sep { color: var(--accent); }
.nav-links { display: flex; gap: 2px; row-gap: 3px; list-style: none; margin-left: 4px; flex: 1; flex-wrap: wrap; min-width: 0; }
.nav-links a { font-size: .78rem; font-weight: 600; color: var(--text-dim); padding: 6px 10px; border-radius: 8px; transition: color .15s, background .15s; }
.nav-links a:hover { color: var(--text); background: var(--accent-soft); }
.nav-links a.active { color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent-line); }
.theme-toggle { margin-left: auto; flex-shrink: 0; width: 38px; height: 38px; border-radius: 9px; background: var(--surface); border: 1px solid var(--surface2); color: var(--text-dim); font-size: 1rem; cursor: pointer; display: grid; place-items: center; line-height: 1; transition: color .15s, border-color .15s; }
.theme-toggle:hover { color: var(--accent); border-color: var(--accent-line); }
.nav-hamburger { display: none; width: 38px; height: 38px; border-radius: 9px; background: var(--surface); border: 1px solid var(--surface2); color: var(--text); font-size: 1.15rem; cursor: pointer; line-height: 1; }
@media (max-width: 860px) {
    .nav-hamburger { display: grid; place-items: center; }
    .nav-links { display: none; position: absolute; top: 60px; left: 0; right: 0; flex-direction: column; gap: 2px; padding: 10px 20px 14px; background: var(--surface); border-bottom: 1px solid var(--surface2); z-index: 199; }
    .nav-links.open { display: flex; }
    .nav-links a { display: block; padding: 9px 10px; font-size: .84rem; }
    .theme-toggle { margin-left: 0; }
    .site-nav-inner { gap: 12px; }
}

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.eyebrow { font-family: var(--mono); font-size: .72rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); display: inline-flex; align-items: center; gap: 9px; }
.eyebrow::before { content: ""; width: 22px; height: 1px; background: var(--accent); opacity: .7; }

/* receipt */
.receipt { background: var(--surface); border: 1px solid var(--surface2); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); position: relative; }
.receipt::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: linear-gradient(var(--accent), transparent 70%); }
.receipt-bar { display: flex; align-items: center; gap: 8px; padding: 11px 15px; border-bottom: 1px solid var(--surface2); background: color-mix(in srgb, var(--surface2) 40%, transparent); }
.dots { display: flex; gap: 6px; }
.dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--surface2); display: block; }
.dots i:first-child { background: var(--coral); }
.dots i:nth-child(2) { background: var(--yellow); }
.dots i:nth-child(3) { background: var(--accent); }
.receipt-title { font-family: var(--mono); font-size: .72rem; color: var(--faint); }
.receipt-body { padding: 18px 20px; font-family: var(--mono); font-size: .8rem; line-height: 1.85; overflow-x: auto; color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; }
.receipt-body .c { color: var(--faint); }
.receipt-body .k { color: var(--accent); }
.receipt-body .s { color: var(--yellow); }
.receipt-body .p { color: var(--text-dim); }

/* ---------- Blog index ---------- */
.blog-hero { padding: 56px 0 20px; }
.blog-hero h1 { font-size: clamp(2rem, 4vw, 3rem); font-weight: 700; letter-spacing: -.03em; text-wrap: balance; margin: 16px 0 14px; }
.blog-hero p { color: var(--text-dim); font-size: 1.08rem; max-width: 52ch; }

.feature { display: grid; grid-template-columns: 1.1fr .9fr; gap: 0; align-items: stretch; background: var(--surface); border: 1px solid var(--surface2); border-radius: var(--radius); overflow: hidden; margin: 34px 0 48px; }
.feature-txt { padding: 38px 34px; align-self: center; }
.feature-txt .cat { font-family: var(--mono); font-size: .72rem; color: var(--accent); letter-spacing: .1em; text-transform: uppercase; }
.feature-txt h2 { font-size: clamp(1.5rem, 2.6vw, 2rem); font-weight: 700; letter-spacing: -.02em; margin: 14px 0 12px; line-height: 1.15; text-wrap: balance; }
.feature-txt h2 a:hover { color: var(--accent); }
.feature-txt p { color: var(--text-dim); font-size: .94rem; margin-bottom: 20px; }
.byline { display: flex; align-items: center; gap: 10px; font-size: .8rem; color: var(--faint); font-family: var(--mono); }
.byline .av { width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); border: 1px solid var(--accent-line); display: grid; place-items: center; color: var(--accent); font-weight: 700; }
.feature-art { min-height: 280px; background: radial-gradient(60% 80% at 70% 20%, var(--accent-soft), transparent 60%), linear-gradient(37deg, var(--surface) 8%, var(--surface2) 118%); position: relative; border-left: 1px solid var(--surface2); display: grid; place-items: center; }
.feature-art .glyphs { font-family: var(--mono); font-size: .8rem; color: var(--accent); opacity: .85; line-height: 2; text-align: center; }

.posts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; padding-bottom: 20px; }
.post { background: var(--surface); border: 1px solid var(--surface2); border-radius: var(--radius); overflow: hidden; transition: .18s; display: flex; flex-direction: column; }
.post:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--accent-line); }
.post-soon { opacity: .72; cursor: default; }
.post-soon:hover { transform: none; box-shadow: none; border-color: var(--surface2); }
.post-top { height: 118px; background: linear-gradient(37deg, var(--surface), var(--surface2)); position: relative; display: grid; place-items: center; border-bottom: 1px solid var(--surface2); }
.post-top .g { font-family: var(--mono); color: var(--accent); opacity: .8; font-size: 1.5rem; }
.post-b { padding: 20px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.post-b .cat { font-family: var(--mono); font-size: .68rem; color: var(--accent); letter-spacing: .08em; text-transform: uppercase; }
.post-b h3 { font-size: 1.02rem; font-weight: 700; line-height: 1.25; letter-spacing: -.01em; }
.post-b p { font-size: .83rem; color: var(--text-dim); flex: 1; }
.post-b .meta { font-family: var(--mono); font-size: .72rem; color: var(--faint); border-top: 1px solid var(--surface2); padding-top: 10px; }

/* ---------- Article ---------- */
.article { max-width: 680px; margin: 0 auto; padding: 40px 0 20px; }
.backlink { font-family: var(--mono); font-size: .8rem; color: var(--accent); display: inline-flex; gap: 8px; align-items: center; margin: 10px 0 20px; }
.article .cat { display: block; font-family: var(--mono); font-size: .74rem; color: var(--accent); letter-spacing: .1em; text-transform: uppercase; }
.article h1 { font-size: clamp(1.9rem, 3.6vw, 2.7rem); font-weight: 700; letter-spacing: -.03em; line-height: 1.1; margin: 16px 0 18px; text-wrap: balance; }
.article .abyline { display: flex; align-items: center; gap: 11px; font-size: .82rem; color: var(--faint); font-family: var(--mono); padding-bottom: 24px; border-bottom: 1px solid var(--surface2); margin-bottom: 30px; }
.article .abyline .av { width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); border: 1px solid var(--accent-line); display: grid; place-items: center; color: var(--accent); font-weight: 700; }
.article p { font-size: 1.04rem; color: var(--text); margin: 0 0 20px; line-height: 1.72; }
.article p.dek { font-size: 1.2rem; color: var(--text-dim); line-height: 1.5; }
.article h2 { font-size: 1.4rem; font-weight: 700; letter-spacing: -.02em; margin: 36px 0 14px; }
.article ul { margin: 0 0 20px 4px; padding-left: 20px; color: var(--text); }
.article li { margin-bottom: 9px; line-height: 1.6; }
.article a[href] { color: var(--accent); }
.article .receipt { margin: 26px 0; }
.article blockquote { margin: 26px 0; padding: 4px 0 4px 22px; border-left: 3px solid var(--accent); font-size: 1.14rem; line-height: 1.55; color: var(--text); font-style: normal; }
.article blockquote cite { display: block; margin-top: 12px; font-family: var(--mono); font-size: .78rem; font-style: normal; color: var(--faint); letter-spacing: .02em; }

/* footer */
.site-footer { border-top: 1px solid var(--surface2); padding: 40px 0; margin-top: 30px; }
.foot-bot { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: .78rem; color: var(--faint); font-family: var(--mono); }

@media (max-width: 900px) {
    .feature { grid-template-columns: 1fr; }
    .feature-art { min-height: 170px; border-left: 0; border-top: 1px solid var(--surface2); order: -1; }
    .posts { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
    .wrap { padding: 0 18px; }
    .posts { grid-template-columns: 1fr; }
    .feature-txt { padding: 28px 22px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
