/* ============================================================
   BlueMist Theme — Zen Edition
   Calm · Spacious · Unhurried
   ============================================================ */

/* --- Reset & Base ----------------------------------------- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Skip-to-content link */
.skip-link {
    position: absolute;
    top: -999px;
    left: 0;
    z-index: 999;
    padding: 10px 20px;
    background: var(--zen-blue);
    color: var(--zen-surface);
    font-size: .9rem;
    font-weight: 500;
    border-radius: 0 0 var(--radius) 0;
    letter-spacing: .02em;
}
.skip-link:focus { top: 0; }

/* Focus ring */
:focus-visible {
    outline: 2px solid var(--zen-blue-l);
    outline-offset: 3px;
    border-radius: 2px;
}
:focus:not(:focus-visible) { outline: none; }

/* ── Design Tokens ───────────────────────────────────────── */
:root {
    /* NOTE: these values mirror the inlined critical CSS in functions.php
       (section 3). Any above-the-fold change must be made in both places. */

    /* Background & surface */
    --zen-bg:        #F6F9FC;   /* cool page base — matches critical body bg */
    --zen-surface:   #ffffff;   /* card / panel white */
    --zen-surface-2: #EDF2F7;   /* slightly tinted surface */

    /* Borders */
    --zen-border:    #DDE5EE;   /* main border — matches critical .post-card */
    --zen-border-2:  #EAF0F6;   /* even softer dividers */

    /* Text */
    --zen-text:      #1B2B3A;   /* deep navy slate — matches critical body color */
    --zen-text-2:    #55697D;   /* secondary muted blue-gray */
    --zen-text-3:    #8A9CAE;   /* captions, placeholders */

    /* Brand navy — ramp built around the #0F3B68 navigation colour */
    --zen-blue:      #154D84;   /* primary — matches critical link color */
    --zen-blue-h:    #0F3B68;   /* hover / active — the brand navy */
    --zen-blue-d:    #0C3055;   /* deep emphasis */
    --zen-blue-l:    #5A9EE2;   /* lighter accent */
    --zen-blue-pale: #96C2EE;   /* subtle tint */
    --zen-blue-wash: #EDF5FC;   /* barely-blue background */

    /* Header / Footer chrome */
    --zen-header:    #0F3B68;   /* nav bg — matches critical + theme-color meta */
    --zen-header-b:  #1D61A5;   /* header border/divider */
    --zen-nav:       #C9E0F7;   /* nav link text */
    --zen-nav-desc:  #96C2EE;   /* description text in header */
    --zen-footer:    #09243F;   /* footer background */
    --zen-footer-l:  #96C2EE;   /* footer link color */

    /* Semantics */
    --zen-success:   #16a34a;
    --zen-error:     #dc2626;

    /* Geometry */
    --radius:        5px;
    --radius-lg:     10px;
    --shadow:        0 1px 4px rgba(0,0,0,.05);   /* nearly invisible */
    --shadow-hover:  0 4px 16px rgba(15,59,104,.12);

    /* Typography */
    --font-sans: 'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-mono: 'Consolas', 'Courier New', monospace;

    /* Layout — container width = content + sidebar + gap(32) + padding(2x28) = 1268px
       Sidebar stacks below 1290px. Keep in sync with the critical CSS in
       functions.php (section 3) and the srcset `sizes` attr (section 9). */
    --max-width:     860px;
    --sidebar-width: 320px;
    --content-gap:   32px;
}

/* ── Dark theme ───────────────────────────────── */
[data-theme="dark"] {
    --zen-bg:        #0B1826;
    --zen-surface:   #132436;
    --zen-surface-2: #0F1D2C;
    --zen-border:    #24384F;
    --zen-border-2:  #1B2C3F;
    --zen-text:      #E2E9F0;
    --zen-text-2:    #94A8BC;
    --zen-text-3:    #647C93;
    --zen-blue:      #5A9EE2;
    --zen-blue-h:    #96C2EE;
    --zen-blue-d:    #2980D6;
    --zen-blue-l:    #C9E0F7;
    --zen-blue-pale: #163253;
    --zen-blue-wash: #10263F;
    --zen-header:    #0F3B68;   /* brand navy — identical in both themes */
    --zen-header-b:  #154D84;
    --zen-nav:       #C9E0F7;
    --zen-nav-desc:  #96C2EE;
    --zen-footer:    #071726;
    --zen-footer-l:  #5A9EE2;
    --zen-success:   #22c55e;
    --zen-error:     #f87171;
    --shadow:        0 1px 4px rgba(0,0,0,.3);
    --shadow-hover:  0 4px 16px rgba(0,0,0,.4);
}

html {
    /* Fluid root size: 17px on phones → 19px at 1440px+ (rem base keeps the
       user's own browser font-size preference intact). Everything else in this
       stylesheet is in rem, so it all scales from here. */
    font-size: clamp(1.0625rem, 1.02rem + 0.19vw, 1.1875rem);
    scroll-behavior: smooth;
    text-size-adjust: 100%;
    transition: background-color .25s, color .25s;
}

body {
    font-family: var(--font-sans);
    color: var(--zen-text);
    background: var(--zen-bg);
    line-height: 1.85;
    -webkit-font-smoothing: antialiased;
}

/* Links */
a {
    color: var(--zen-blue);
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-color: var(--zen-blue-pale);
    transition: color .2s, text-decoration-color .2s;
}
a:hover {
    color: var(--zen-blue-h);
    text-decoration-color: var(--zen-blue-l);
}

/* Selective no-underline */
.site-title a,
.main-navigation a,
.entry-title a,
.read-more,
.post-tag,
.entry-category,
.page-numbers,
.footer-navigation a,
.footer-credit a,
.comment-reply-link,
.btn,
.breadcrumb-item a {
    text-decoration: none;
}

img { max-width: 100%; height: auto; display: block; border-radius: var(--radius); }

/* ── Layout ─────────────────────────────────────────────── */
.site-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    width: 100%;
    max-width: calc(var(--max-width) + var(--sidebar-width) + var(--content-gap) + 56px);
    margin: 0 auto;
    padding: 0 28px;
}

.site-main {
    flex: 1;
    padding: 56px 0 72px;
}

.content-area {
    display: flex;
    gap: var(--content-gap);
    align-items: flex-start;
}

.primary-content { flex: 1; min-width: 0; }

/* ── Header ─────────────────────────────────────────────── */
.site-header {
    background: var(--zen-header);
    color: #fff;
    /* single thin bottom line — no thick accent bar */
    border-bottom: 1px solid var(--zen-header-b);
    position: sticky;
    top: 0;
    z-index: 100;
    /* no heavy shadow — calm */
    box-shadow: 0 1px 12px rgba(0,0,0,.12);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 62px;
    gap: 24px;
}

.site-branding { display: flex; align-items: center; gap: 12px; line-height: 1.25; }
.site-branding-text { display: flex; flex-direction: column; min-width: 0; }

@media (max-width: 480px) {
    /* The wordmark is the logo, so it is what has to shrink on narrow screens. */
    .site-title { font-size: 1.28rem; }
    .site-branding { gap: 10px; }

    /* Author box stacks — a 72px avatar plus text is too tight beside it here */
    .author-box { flex-direction: column; gap: 14px; }
    .author-box .author-avatar { width: 60px; height: 60px; }
}

/* The site title IS the logo — there is no logo image — so it is set as a
   wordmark: heavier, tighter, and a step larger than a plain title would be. */
.site-title {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -.03em;
    color: #fff;                   /* header bg is always dark blue — keep title light in both themes */
}
.site-title a { color: inherit; }
.site-title a:hover { opacity: .8; }

/* Trailing TLD (".com") — deliberately de-emphasised, not accented: "Mkyong" is
   the ownable half of the name and should hold the eye. Deliberately NOT red —
   this site reserves red for semantics (--zen-error, .copy-code-btn.is-failed),
   so a red wordmark would overload a hue that already means "failed".
   Literal rather than a token because the header navy is fixed in both themes. */
.site-title-tld { color: #96C2EE; }

.site-description {
    font-size: .75rem;
    color: var(--zen-nav-desc);
    margin-top: 2px;
    font-weight: 400;
    letter-spacing: .02em;
}

/* Nav */
.main-navigation ul {
    list-style: none;
    display: flex;
    gap: 2px;
}

.main-navigation a {
    display: block;
    padding: 6px 13px;
    color: var(--zen-nav);
    font-size: .88rem;
    font-weight: 400;
    letter-spacing: .02em;
    border-radius: var(--radius);
    transition: color .2s, background .2s;
}
/* Hover is gated — on a touch device :hover sticks to the last-tapped item
   until you tap elsewhere, which reads as a wrong "selected" row. */
@media (hover: hover) {
    .main-navigation a:hover {
        color: #fff;
        background: rgba(255,255,255,.07);
    }
}
/* Press feedback, the part touch actually gets */
.main-navigation a:active {
    color: #fff;
    background: rgba(255,255,255,.18);
}
.main-navigation .current-menu-item > a,
.main-navigation .current_page_item > a {
    color: #fff;
    background: rgba(255,255,255,.1);
}

/* Dropdown for menu items with children (desktop) */
.main-navigation .menu-item-has-children { position: relative; }
.main-navigation .sub-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 180px;
    flex-direction: column;
    gap: 0;
    padding: 6px;
    background: var(--zen-header);
    border: 1px solid var(--zen-header-b);
    border-radius: var(--radius);
    box-shadow: var(--shadow-hover);
    z-index: 110;
}
.main-navigation .menu-item-has-children:hover > .sub-menu,
.main-navigation .menu-item-has-children:focus-within > .sub-menu {
    display: flex;
}
.main-navigation .sub-menu a { white-space: nowrap; }

/* Hamburger toggle — three bars that cross into an X while the menu is open */
.menu-toggle {
    display: none;
    background: none;
    border: 1px solid rgba(255,255,255,.2);
    color: var(--zen-nav);
    padding: 0;
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    cursor: pointer;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    transition: border-color .2s, background .2s;
}
.menu-toggle:hover {
    border-color: rgba(255,255,255,.4);
    background: rgba(255,255,255,.08);
}

.menu-toggle-icon {
    display: block;
    position: relative;
    width: 18px;
    height: 14px;
}
.menu-toggle-icon span {
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
    transition: transform .25s, opacity .2s;
}
.menu-toggle-icon span:nth-child(1) { top: 0; }
.menu-toggle-icon span:nth-child(2) { top: 6px; }
.menu-toggle-icon span:nth-child(3) { top: 12px; }

.menu-toggle[aria-expanded="true"] { color: #fff; }
.menu-toggle[aria-expanded="true"] .menu-toggle-icon span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}
.menu-toggle[aria-expanded="true"] .menu-toggle-icon span:nth-child(2) { opacity: 0; }
.menu-toggle[aria-expanded="true"] .menu-toggle-icon span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

/* Theme toggle button */
.theme-toggle {
    background: none;
    border: 1px solid var(--zen-header-b);
    border-radius: 50%;
    color: var(--zen-nav);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    padding: 0;
    transition: color .2s, border-color .2s, background .2s;
}
.theme-toggle:hover {
    color: #fff;
    border-color: var(--zen-nav);
    background: rgba(255,255,255,.08);
}
.theme-toggle svg { display: block; }
/* Show correct icon per theme */
.theme-toggle .icon-sun  { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun  { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
/* Mobile placement is handled in the responsive block — the theme toggle
   stays on the header row next to the hamburger. */

/* ── Breadcrumb Bar ─────────────────────────────────────── */
.breadcrumb-bar {
    background: var(--zen-surface-2);
    border-bottom: 1px solid var(--zen-border-2);
    padding: 9px 0;
    font-size: .78rem;
}

.breadcrumb-list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}

.breadcrumb-item { display: flex; align-items: center; gap: 4px; }

.breadcrumb-item a {
    color: var(--zen-blue);
    font-weight: 500;
}
.breadcrumb-item a:hover { text-decoration: underline; }

.breadcrumb-current { color: var(--zen-text-3); }
.breadcrumb-sep { color: var(--zen-border); user-select: none; }

/* ── Page Header (archives, search) ─────────────────────── */
.page-header {
    background: var(--zen-header);       /* flat, no gradient */
    color: #fff;
    padding: 36px 0;
    margin-bottom: 44px;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 600;
    letter-spacing: -.01em;
    line-height: 1.25;
}
.page-subtitle {
    margin-top: 8px;
    color: var(--zen-nav);
    font-size: .93rem;
    font-weight: 400;
}

/* ── Post Cards ─────────────────────────────────────────── */
.post-card {
    background: var(--zen-surface);
    border: 1px solid var(--zen-border);
    border-radius: var(--radius-lg);
    padding: 32px;
    margin-bottom: 24px;
    /* no shadow by default — appears on hover */
    transition: border-color .25s, box-shadow .25s;
}
.post-card:hover {
    border-color: var(--zen-blue-pale);
    box-shadow: var(--shadow-hover);
}

/* post-card spacing handled by margin-bottom on each card */

.entry-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: .78rem;
    color: var(--zen-text-3);
    margin-bottom: 12px;
    align-items: center;
    letter-spacing: .02em;
}
.entry-meta a { color: var(--zen-text-3); text-decoration: none; }
.entry-meta a:hover { color: var(--zen-blue); }

.entry-category {
    background: var(--zen-blue-wash);
    color: var(--zen-blue-d);
    border: 1px solid var(--zen-blue-pale);
    padding: 2px 10px;
    border-radius: 100px;
    font-size: .7rem;
    font-weight: 500;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.entry-title {
    font-size: 1.3rem;
    font-weight: 600;               /* 600 vs 700 — less assertive */
    letter-spacing: -.01em;
    line-height: 1.35;
    margin-bottom: 10px;
}
.entry-title a { color: var(--zen-text); }
.entry-title a:hover { color: var(--zen-blue); }

.entry-excerpt {
    color: var(--zen-text-2);
    font-size: .93rem;
    line-height: 1.75;
    margin-bottom: 18px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.read-more {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: .82rem;
    font-weight: 500;
    color: var(--zen-blue);
    letter-spacing: .03em;
    border-bottom: 1px solid transparent;
    transition: border-color .2s;
}
.read-more:hover {
    border-bottom-color: var(--zen-blue-l);
}
/* no arrow animation — zen = stillness */

/* ── Single Post ────────────────────────────────────────── */
.single-post-card {
    background: var(--zen-surface);
    border: 1px solid var(--zen-border);
    border-radius: var(--radius-lg);
    padding: 48px;
    /* no shadow — the border is enough */
}


/* --- Global Text Safety --- */
.entry-content {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Specifically for mobile headers */
@media (max-width: 680px) {
    .entry-content h1, 
    .entry-content h2, 
    .entry-content h3 {
        hyphens: auto;
        overflow-wrap: break-word;
    }
}

.entry-content {
    font-size: 1.02rem;
    line-height: 1.9;
    color: var(--zen-text);
}

.entry-content h1,
.entry-content h2,
.entry-content h3,
.entry-content h4,
.entry-content h5,
.entry-content h6 {
    color: var(--zen-text);
    font-weight: 600;
    letter-spacing: -.01em;
    margin: 2em 0 .7em;
    line-height: 1.3;
}
.entry-content h1 { font-size: 1.75rem; }
.entry-content h2 {
    font-size: 1.35rem;
    padding-bottom: .4em;
    /* thin bottom line — restrained */
    border-bottom: 1px solid var(--zen-border);
}
.entry-content h3 { font-size: 1.15rem; }
.entry-content h4 { font-size: 1rem; color: var(--zen-text-2); }

.entry-content p { margin-bottom: 1.2em; }
.entry-content ul,
.entry-content ol { margin: 0 0 1.2em 1.5em; }
.entry-content li { margin-bottom: .4em; }

.entry-content blockquote {
    /* subtle left bar — thin, calm */
    border-left: 3px solid var(--zen-blue-pale);
    background: var(--zen-blue-wash);
    padding: 16px 22px;
    margin: 1.8em 0;
    border-radius: 0 var(--radius) var(--radius) 0;
    color: var(--zen-text-2);
    font-style: italic;
    font-size: .97rem;
    line-height: 1.8;
}

/* Inline code — wraps rather than forcing the column wider.
   `overflow-wrap` breaks only when a token genuinely cannot fit;
   `word-break: break-word` broke mid-identifier even when there was room. */
.entry-content code {
    font-family: var(--font-mono);
    font-size: .9em;
    background: var(--zen-surface-2);
    border: 1px solid var(--zen-border);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--zen-blue-d);
    white-space: pre-wrap;
    overflow-wrap: break-word;
}

/* Wrapper built by main.js around [.filename +] pre, so the copy button can be
   anchored to the block without living inside the horizontally scrolling <pre>. */
.code-block {
    position: relative;
}

/* No filename tab means the button would sit over the first line — reserve room */
.code-block:not(.code-block--titled) pre {
    padding-top: 42px;
}

.copy-code-btn {
    position: absolute;
    top: 8px;
    right: 10px;
    z-index: 2;
    padding: 5px 10px;
    font-family: var(--font-sans);
    font-size: .72rem;
    font-weight: 500;
    line-height: 1;
    letter-spacing: .02em;
    color: #9DB2C6;
    background: #16324B;
    border: 1px solid #24547E;
    border-radius: var(--radius);
    cursor: pointer;
    transition: opacity .18s, color .18s, background .18s, border-color .18s;
}

/* On pointer devices the button stays out of the way until the block is hovered.
   Touch devices get no hover, so it is always visible there. */
@media (hover: hover) {
    .copy-code-btn { opacity: 0; }
    .code-block:hover .copy-code-btn,
    .copy-code-btn:focus-visible,
    .copy-code-btn.is-copied,
    .copy-code-btn.is-failed { opacity: 1; }

    .copy-code-btn:hover {
        color: #fff;
        background: #1B3E5C;
        border-color: #3A7FBF;
    }
}

.copy-code-btn.is-copied {
    color: #86D9A6;
    background: #123326;
    border-color: #2E6B4A;
}
.copy-code-btn.is-failed {
    color: #F0A9A9;
    background: #351D1D;
    border-color: #7A3B3B;
}

/* Filename tab that sits directly above a code block:
     <div class="filename">Foo.java</div><pre><code class="language-java">…</code></pre>
   Colours are hardcoded like `.entry-content pre` — the block is the same navy
   in light and dark mode, so the tab has to be too. */
.entry-content .filename {
    display: block;
    background: #16324B;            /* one step lighter than the block below */
    color: #9DB2C6;
    font-family: var(--font-mono);
    font-size: .82em;
    line-height: 1.4;
    letter-spacing: .02em;
    padding: 9px 24px;
    margin: 1.8em 0 0;              /* inherits the code block's top margin */
    border: 1px solid #1C3A57;
    border-bottom: none;
    border-radius: var(--radius) var(--radius) 0 0;
    overflow-wrap: break-word;      /* long paths must not widen the column */
}

/* Fuse the block to the tab: kill the seam between them */
.entry-content .filename + pre {
    margin-top: 0;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

/* --- Code blocks --- */
.entry-content pre {
    background: #0E2438;
    color: #C6D8EA;
    padding: 20px 24px;
    border-radius: var(--radius);
    margin: 1.8em 0;
    font-family: var(--font-mono);
    font-size: .95em;
    line-height: 1.75;
    tab-size: 4;                /* 8 is the default and wastes a lot of width */
    border: 1px solid #1C3A57;

    /* Desktop: keep real formatting, scroll long lines */
    overflow-x: auto;
    overscroll-behavior-x: contain;  /* don't chain the swipe to the page */
    white-space: pre;
    word-spacing: normal;
    word-break: normal;
    word-wrap: normal;
}

/* Prism puts the highlighted source in the inner <code>, so without these
   resets it inherits the inline-code rules above — that is what was breaking
   lines mid-identifier and boxing each block in its own background. */
.entry-content pre code {
    background: none;
    border: none;
    padding: 0;
    color: inherit;
    font-size: inherit;
    white-space: inherit;
    overflow-wrap: normal;
    word-break: normal;
}
/* WP/Markdown can auto-link URLs inside comments — strip link styling in code blocks */
.entry-content pre a {
    color: inherit;
    text-decoration: none;
    font-weight: inherit;
}

/* Responsive Table wrapper */

/* 1. The Container */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    display: block;
    -webkit-overflow-scrolling: touch;
    margin: 1.8em 0;
    /* Hide the scrollbar until needed, but ensure it works */
}

/* 2. The Table */
.entry-content .table-responsive table {
    width: 100%;
    border-collapse: collapse;
    /* 'fixed' prevents the table from growing wider than its container 
       UNLESS the cells themselves have a forced width */
    table-layout: fixed; 
}

/* 3. The Cells */
.entry-content .table-responsive th,
.entry-content .table-responsive td {
    border: 1px solid var(--zen-border);
    padding: 12px 16px;
    
    /* THE CRITICAL PIECE: This forces long text to break instead of 
       pushing the table width out. */
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-all; /* Use break-all for extreme cases like long URLs */
    
    vertical-align: top;
}

/* 4. Column Width Control (Optional) */
/* If you want columns to have a minimum readable size on mobile */
@media (max-width: 680px) {
    .entry-content .table-responsive td {
        min-width: 150px; 
    }
}


.entry-content th,
.entry-content td {
    border: 1px solid var(--zen-border);
    padding: 10px 16px;
    text-align: left;
}
.entry-content th {
    background: var(--zen-blue-wash);
    color: var(--zen-blue-d);
    font-weight: 600;
    font-size: .82rem;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.entry-content tr:nth-child(even) td { background: var(--zen-surface-2); }

.entry-content hr {
    border: none;
    /* single hair line — zen divider */
    border-top: 1px solid var(--zen-border);
    margin: 2.5em 0;
}

.entry-content a { font-weight: 500; }

.entry-footer {
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px solid var(--zen-border-2);
    font-size: .8rem;
    color: var(--zen-text-3);
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
}

.post-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.post-tag {
    background: transparent;
    color: var(--zen-text-2);
    border: 1px solid var(--zen-border);
    padding: 2px 10px;
    border-radius: 100px;
    font-size: .72rem;
    font-weight: 500;
    letter-spacing: .03em;
    transition: border-color .2s, color .2s;
}
.post-tag:hover {
    border-color: var(--zen-blue-pale);
    color: var(--zen-blue);
}

/* ── Sticky Bottom Ad ───────────────────────────────────── */
/* --sticky-ad-h is emitted in <head> by bluemist_sticky_ad_style(), and only
   when ad code is actually saved — so with no ad these rules never apply. */
body.has-sticky-ad {
    /* Keeps the bar from permanently covering the end of the footer */
    padding-bottom: calc(var(--sticky-ad-h, 90px) + env(safe-area-inset-bottom, 0px));
}

.sticky-ad {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 90;                   /* under the sticky header (100) */
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: var(--sticky-ad-h, 90px);
    padding: 4px 12px calc(4px + env(safe-area-inset-bottom, 0px));
    background: var(--zen-surface);
    border-top: 1px solid var(--zen-border);
    box-shadow: 0 -2px 12px rgba(0,0,0,.10);
    /* Second guard: a creative wider than the screen gets clipped here rather
       than making the whole document scroll sideways. */
    overflow: hidden;
}
.sticky-ad.is-dismissed { display: none; }

.sticky-ad-slot {
    max-width: 100%;
    /* Required, and not redundant with max-width: as a flex item this defaults
       to min-width:auto, which resolves to the creative's own width (e.g. a
       fixed 728px leaderboard) and beats max-width — forcing the bar wider than
       the viewport and giving the whole page a horizontal scrollbar. */
    min-width: 0;
    overflow: hidden;
    line-height: 0;                /* kills the inline-image descender gap */
}

.sticky-ad-close {
    position: absolute;
    top: -13px;
    right: 10px;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    line-height: 1;
    color: var(--zen-text-2);
    background: var(--zen-surface);
    border: 1px solid var(--zen-border);
    border-radius: 50%;
    box-shadow: var(--shadow);
    cursor: pointer;
}
.sticky-ad-close:hover {
    color: var(--zen-text);
    border-color: var(--zen-text-3);
}

/* Landscape phones: a fixed bar plus the header leaves almost no content left */
@media (max-height: 420px) {
    .sticky-ad { display: none; }
    body.has-sticky-ad { padding-bottom: 0; }
}

/* ── Author Box ─────────────────────────────────────────── */
.author-box {
    display: flex;
    gap: 18px;
    align-items: flex-start;
    margin-top: 34px;
    padding-top: 26px;
    border-top: 1px solid var(--zen-border);
}

.author-box-avatar { flex-shrink: 0; line-height: 0; }
.author-box .author-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 1px solid var(--zen-border);
}

.author-box-body { min-width: 0; }

.author-box-label {
    display: block;
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: var(--zen-text-3);
    margin-bottom: 3px;
}

.author-box-name {
    font-size: 1.02rem;
    font-weight: 600;
    color: var(--zen-text);
    text-decoration: none;
}
.author-box-name:hover { color: var(--zen-blue); }

.author-box-bio {
    margin-top: 8px;
    font-size: .9rem;
    line-height: 1.75;
    color: var(--zen-text-2);
}
.author-box-bio p { margin: 0 0 .6em; }
.author-box-bio p:last-child { margin-bottom: 0; }

.author-box-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    margin-top: 10px;
    font-size: .82rem;
}
.author-box-links a { color: var(--zen-blue); }

/* Post navigation */
.post-navigation {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 36px;
}
.nav-previous, .nav-next {
    background: var(--zen-surface);
    border: 1px solid var(--zen-border);
    border-radius: var(--radius);
    padding: 18px 20px;
    transition: border-color .2s;
}
.nav-previous:hover, .nav-next:hover {
    border-color: var(--zen-blue-pale);
}
.nav-next { text-align: right; }
.nav-label {
    display: block;
    font-size: .7rem;
    font-weight: 500;
    color: var(--zen-text-3);
    text-transform: uppercase;
    letter-spacing: .08em;
    margin-bottom: 5px;
}
.nav-title { font-size: .88rem; color: var(--zen-text); font-weight: 500; line-height: 1.4; }
.nav-previous a:hover .nav-title,
.nav-next a:hover .nav-title { color: var(--zen-blue); }

/* ── Comments ───────────────────────────────────────────── */
.comments-section {
    background: var(--zen-surface);
    border: 1px solid var(--zen-border);
    border-radius: var(--radius-lg);
    padding: 40px;
    margin-top: 32px;
}

.comments-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--zen-text);
    margin-bottom: 28px;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: .01em;
}
.comments-title::before {
    content: '';
    display: block;
    width: 3px;
    height: 18px;
    background: var(--zen-blue-l);  /* muted bar, not vivid */
    border-radius: 2px;
}

.comment-list { list-style: none; }
.comment-list .children {
    list-style: none;
    margin-left: 32px;
    border-left: 1px solid var(--zen-border-2);
    padding-left: 24px;
}

.comment {
    padding: 22px 0;
    border-bottom: 1px solid var(--zen-border-2);
}
.comment:last-child { border-bottom: none; }

.comment-author {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}
.comment-author img {
    border-radius: 50%;
    width: 36px;
    height: 36px;
    border: 1px solid var(--zen-border);
    opacity: .9;
}
.comment-author .fn {
    font-weight: 600;
    color: var(--zen-text);
    font-size: .9rem;
    font-style: normal;
}
.comment-metadata {
    font-size: .75rem;
    color: var(--zen-text-3);
}
.comment-metadata a { color: inherit; }

.comment-content { font-size: .92rem; color: var(--zen-text-2); line-height: 1.75; }
.comment-content p { margin-bottom: .7em; }

.reply { margin-top: 10px; }
.comment-reply-link {
    font-size: .75rem;
    font-weight: 500;
    color: var(--zen-blue);
    background: var(--zen-blue-wash);
    border: 1px solid var(--zen-blue-pale);
    padding: 3px 11px;
    border-radius: 100px;
    letter-spacing: .02em;
    transition: background .2s, border-color .2s;
}
.comment-reply-link:hover {
    background: #C9E0F7;
    border-color: var(--zen-blue-l);
}

.no-comments {
    color: var(--zen-text-3);
    font-size: .92rem;
    text-align: center;
    padding: 32px 0;
    letter-spacing: .02em;
}

/* Comment Form */
.comment-respond {
    margin-top: 36px;
    padding-top: 32px;
    border-top: 1px solid var(--zen-border-2);
}

.comment-reply-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--zen-text);
    margin-bottom: 22px;
    letter-spacing: .01em;
}

.comment-form label {
    display: block;
    font-size: .8rem;
    font-weight: 500;
    color: var(--zen-text-2);
    margin-bottom: 6px;
    letter-spacing: .03em;
    text-transform: uppercase;
}
.comment-form label span { color: var(--zen-blue-l); }

.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--zen-border);
    border-radius: var(--radius);
    font-size: .93rem;
    font-family: var(--font-sans);
    color: var(--zen-text);
    background: var(--zen-surface-2);
    transition: border-color .2s, background .2s;
}
.comment-form input:focus,
.comment-form textarea:focus {
    outline: none;
    border-color: var(--zen-blue-l);
    background: var(--zen-surface);
    box-shadow: 0 0 0 3px rgba(15,59,104,.15);
}

.comment-form textarea { resize: vertical; min-height: 130px; }

.comment-form-fields-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.comment-form p { margin-bottom: 18px; }
.comment-form .form-submit { margin-top: 6px; }

.submit {
    background: var(--zen-blue);
    color: var(--zen-surface);
    border: none;
    padding: 11px 28px;
    border-radius: var(--radius);
    font-size: .9rem;
    font-weight: 500;
    cursor: pointer;
    letter-spacing: .03em;
    transition: background .2s;
    font-family: var(--font-sans);
}
.submit:hover { background: var(--zen-blue-h); }
.submit:active { opacity: .9; }

.comment-form-cookies-consent { display: flex; align-items: center; gap: 8px; }
.comment-form-cookies-consent input { width: auto; }
.comment-form-cookies-consent label { margin-bottom: 0; font-weight: 400; text-transform: none; letter-spacing: 0; }

/* ── Sidebar ────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
}

.widget {
    background: var(--zen-surface);
    border: 1px solid var(--zen-border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
    /* no shadow */
}

.widget-title {
    font-size: .72rem;
    font-weight: 600;
    color: var(--zen-text-3);
    text-transform: uppercase;
    letter-spacing: .1em;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--zen-border-2);
}

.widget ul { list-style: none; }
.widget ul li {
    padding: 6px 0;
    border-bottom: 1px solid var(--zen-border-2);
    font-size: .88rem;
    color: var(--zen-text-2);
}
.widget ul li:last-child { border-bottom: none; }
.widget ul li a { color: var(--zen-text-2); text-decoration: none; }
.widget ul li a:hover { color: var(--zen-blue); }

.widget_search .search-form { display: flex; gap: 8px; }
.widget_search .search-field {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--zen-border);
    border-radius: var(--radius);
    font-size: .88rem;
    font-family: var(--font-sans);
    background: var(--zen-surface-2);
    color: var(--zen-text);
}
.widget_search .search-field:focus {
    outline: none;
    border-color: var(--zen-blue-l);
    background: var(--zen-surface);
}
.widget_search .search-submit {
    background: var(--zen-blue);
    color: var(--zen-surface);
    border: none;
    padding: 8px 14px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: .85rem;
    font-family: var(--font-sans);
    transition: background .2s;
}
.widget_search .search-submit:hover { background: var(--zen-blue-h); }

/* ── Pagination ─────────────────────────────────────────── */
.posts-pagination, .pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 48px;
    flex-wrap: wrap;
}

.page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    border: 1px solid var(--zen-border);
    border-radius: var(--radius);
    font-size: .85rem;
    font-weight: 400;
    color: var(--zen-text-2);
    background: var(--zen-surface);
    transition: border-color .2s, color .2s;
}
.page-numbers:hover {
    border-color: var(--zen-blue-pale);
    color: var(--zen-blue);
    text-decoration: none;
}
.page-numbers.current {
    background: var(--zen-blue);
    border-color: var(--zen-blue);
    color: var(--zen-surface);
    font-weight: 500;
}

/* ── Footer ─────────────────────────────────────────────── */
.site-footer {
    background: var(--zen-footer);
    color: var(--zen-footer-l);
    padding: 48px 0 28px;
}

.footer-widgets {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 36px;
    margin-bottom: 36px;
}

.footer-widget-title {
    font-size: .7rem;
    font-weight: 600;
    color: rgba(255,255,255,.5);
    text-transform: uppercase;
    letter-spacing: .1em;
    margin-bottom: 16px;
}

.footer-widget ul { list-style: none; }
.footer-widget ul li { padding: 4px 0; font-size: .86rem; }
.footer-widget ul li a { color: var(--zen-footer-l); text-decoration: none; }
.footer-widget ul li a:hover { color: rgba(255,255,255,.8); }

.footer-bottom {
    border-top: 1px solid rgba(255,255,255,.07);
    padding-top: 22px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    font-size: .8rem;
    color: rgba(255,255,255,.3);
}

.footer-credit a { color: var(--zen-footer-l); text-decoration: none; }
.footer-credit a:hover { color: rgba(255,255,255,.8); }

/* ── 404 ────────────────────────────────────────────────── */
.error-page {
    text-align: center;
    padding: 80px 24px;
}
.error-code {
    font-size: 5.5rem;
    font-weight: 300;           /* ultra-light — zen feel */
    color: var(--zen-blue-pale);
    line-height: 1;
    margin-bottom: 16px;
    letter-spacing: -.05em;
}
.error-title {
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--zen-text);
    margin-bottom: 12px;
    letter-spacing: -.01em;
}
.error-description {
    color: var(--zen-text-2);
    margin-bottom: 28px;
    max-width: 380px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.7;
}
.btn {
    display: inline-block;
    padding: 10px 26px;
    background: var(--zen-blue);
    color: var(--zen-surface);
    border-radius: var(--radius);
    font-weight: 500;
    font-size: .9rem;
    letter-spacing: .02em;
    transition: background .2s;
}
.btn:hover { background: var(--zen-blue-h); color: var(--zen-surface); }

/* ── Search Header Bar ──────────────────────────────────── */
.search-header-bar {
    background: var(--zen-blue-wash);
    border: 1px solid var(--zen-border-2);
    border-radius: var(--radius);
    padding: 13px 18px;
    margin-bottom: 28px;
    font-size: .88rem;
    color: var(--zen-text-2);
}
.search-term { font-weight: 600; color: var(--zen-text); }

/* ── Featured Image ─────────────────────────────────────── */
.post-thumbnail {
    margin-bottom: 28px;
    border-radius: var(--radius);
    overflow: hidden;
}
.post-thumbnail img {
    width: 100%;
    height: auto;
    border-radius: var(--radius);
    /* slight desaturation for zen mood */
    filter: saturate(.92);
    transition: filter .3s;
}
.post-card:hover .post-thumbnail img,
.single-post-card .post-thumbnail img {
    filter: saturate(1);
}

/* ── Skip link (colour uses token) ─────────────────────── */
.skip-link { background: var(--zen-blue); }

/* ── Admin Bar Offset ───────────────────────────────────── */
.admin-bar .site-header { top: 32px; }
@media (max-width: 782px) { .admin-bar .site-header { top: 46px; } }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 1290px) {
    .content-area { flex-direction: column; }

    /* Both children need an explicit width. `.content-area` keeps
       `align-items: flex-start`, so once it turns into a column the cross axis
       is horizontal and children are sized to fit-content — meaning one wide
       descendant (code block, table, wide image) stretches the whole column
       past the viewport and the entire page scrolls sideways. A definite width
       pins them to the container and keeps overflow inside the child. */
    .primary-content { width: 100%; }
    .sidebar { width: 100%; }

    .footer-widgets { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 680px) {
    :root { --max-width: 100%; }

    /* Row 1: branding | hamburger + theme toggle.  Row 2: the nav panel.
       DOM order is branding → menu-toggle → nav → theme-toggle, so the nav is
       ordered last to keep both buttons on the first row; without this its
       width:100% wraps and pushes the theme toggle down with it. */
    .header-inner { height: auto; flex-wrap: wrap; padding: 14px 0; gap: 10px; }
    .site-branding { margin-right: auto; }

    .menu-toggle { display: flex; order: 2; }
    .theme-toggle { order: 3; }
    .main-navigation { width: 100%; order: 4; }
    .main-navigation ul {
        flex-direction: column;
        gap: 3px;
        padding: 6px 0 10px;
        display: none;
    }
    .main-navigation.is-open ul { display: flex; }

    /* No separator rules — spacing plus the press wash below does the work.
       Hairline borders read as stray white lines against the navy header. */
    .main-navigation a {
        padding: 12px 12px;
        border-radius: var(--radius);
        border-left: 3px solid transparent;
    }
    /* Pressed row: bright wash + accent bar, so the target is unmistakable */
    .main-navigation a:active,
    .main-navigation a:focus-visible {
        background: rgba(255,255,255,.18);
        border-left-color: var(--zen-blue-l);
        color: #fff;
    }
    /* Current page keeps a permanent accent bar */
    .main-navigation .current-menu-item > a,
    .main-navigation .current_page_item > a {
        background: rgba(255,255,255,.1);
        border-left-color: var(--zen-blue-l);
        color: #fff;
    }

    /* Sub-menus unfold inline rather than floating — no hover on touch */
    .main-navigation .sub-menu {
        position: static;
        min-width: 0;
        padding: 0 0 0 14px;
        background: none;
        border: none;
        border-left: 1px solid var(--zen-header-b);
        border-radius: 0;
        box-shadow: none;
    }

    .page-title { font-size: 1.35rem; }

    .single-post-card { padding: 24px; }
    .comments-section { padding: 24px; }

    /* Code blocks go full-bleed to the card edges — reclaims the 24px of card
       padding on each side, which is a meaningful share of a phone's width.
       The filename tab has to travel with the block or the two misalign. */
    .single-post-card .entry-content pre,
    .single-post-card .entry-content .filename,
    .single-post-card .entry-content .code-block {
        margin-left: -24px;
        margin-right: -24px;
        border-left: none;
        border-right: none;
        border-radius: 0;
    }
    /* Once JS has wrapped the block, the wrapper carries the bleed — otherwise
       the copy button would anchor 24px inside the block's visible edge. */
    .single-post-card .entry-content .code-block pre,
    .single-post-card .entry-content .code-block .filename {
        margin-left: 0;
        margin-right: 0;
    }
    .entry-content .filename { padding: 8px 16px; }
    .entry-content pre {
        padding: 16px 16px;
        font-size: .9em;
        line-height: 1.7;
        /* Wrap instead of scrolling sideways: a horizontal scroll container on a
           phone swallows swipes and hides the tail of every long line.
           `anywhere`, not `break-word`: both break identically when laying out
           lines, but only `anywhere` also shrinks the element's min-content
           width. With `break-word` a long code line still reports its full
           width intrinsically, which is what was widening the column above. */
        white-space: pre-wrap;
        overflow-wrap: anywhere;
    }
    .entry-content pre code { overflow-wrap: anywhere; }
    .comment-form-fields-row { grid-template-columns: 1fr; }

    .post-navigation { grid-template-columns: 1fr; }
    .nav-next { text-align: left; }

    .footer-widgets { grid-template-columns: 1fr; }
    .footer-bottom { flex-direction: column; text-align: center; }

    .error-code { font-size: 3.5rem; }
}

/* ── WordPress Core Classes ─────────────────────────────── */
.alignleft  { float: left;  margin-right: 22px; margin-bottom: 10px; }
.alignright { float: right; margin-left:  22px; margin-bottom: 10px; }
.aligncenter { display: block; margin: 0 auto 10px; }
.alignwide { margin-left: -40px; margin-right: -40px; max-width: calc(100% + 80px); }
.wp-caption { max-width: 100%; }
.wp-caption-text { font-size: .78rem; color: var(--zen-text-3); text-align: center; margin-top: 6px; font-style: italic; }

.screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ── Reduced Motion ─────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    html { transition: none; }
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ── Print ──────────────────────────────────────────────── */
@media print {
    .sticky-ad,
    .copy-code-btn,
    .site-header,
    .site-footer,
    .sidebar,
    .main-navigation,
    .breadcrumb-bar,
    .post-navigation,
    .posts-pagination,
    .comments-section,
    .menu-toggle,
    .read-more,
    .edit-link { display: none !important; }

    body { font-size: 12pt; color: #000; background: #fff; }
    a { color: #000; text-decoration: underline; }
    a[href]::after { content: ' (' attr(href) ')'; font-size: .8em; color: #555; }
    a[href^="#"]::after,
    a[href^="javascript:"]::after { content: ''; }

    .container { max-width: 100%; padding: 0; }
    .content-area { display: block; }
    .single-post-card, .post-card { box-shadow: none; border: none; padding: 0; }
    .entry-content { font-size: 11pt; }
    .entry-title { font-size: 18pt; }
    img { max-width: 500pt; page-break-inside: avoid; }
    h2, h3, h4 { page-break-after: avoid; }
    p, blockquote { page-break-inside: avoid; }
}
