/* ═══════════════════════════════════════════════════════════════════════════
   Site header and footer layout (Admin > Appearance > Header & Footer).
   Loaded after frontend.css / responsive.css. With nothing changed the header is the
   original one: logo left, menu right, container width.
   Structure: .hdr__inner > .hdr-row (1-2) > .hdr-zone (left / center / right) > items
   ═══════════════════════════════════════════════════════════════════════════ */
.hdr { background: var(--hdr-bg, #fff); }
.hdr--static { position: relative; }
.hdr .site-logo img { height: var(--hdr-logo-h, 44px); }
.hdr .site-logo { color: var(--hdr-fg, inherit); }
.hdr .nav-menu > li > a { color: var(--hdr-fg, #374151); }
.hdr .nav-toggle { color: var(--hdr-fg, #374151); }

/* width: site container (default) · own container width · full width with side padding */
.hdr-wrap { width: 100%; padding: 0 24px; box-sizing: border-box; }
.hdr-wrap--custom { max-width: var(--hdr-cw, 1140px); margin-left: auto; margin-right: auto; }
.hdr-wrap--full { max-width: none; padding: 0 var(--hdr-pad, 10px); }

/* rows and zones */
.hdr .hdr__inner { display: block; height: auto; }
.hdr-row { display: flex; align-items: stretch; justify-content: space-between; height: 72px; gap: 16px; }
.hdr-row--2 { height: 50px; border-top: 1px solid rgba(15,23,42,.07); }
.hdr-zone { display: flex; align-items: stretch; gap: 12px; min-width: 0; }
.hdr-zone--left { justify-content: flex-start; }
.hdr-zone--center { justify-content: center; flex: 1 1 auto; }
.hdr-zone--right { justify-content: flex-end; }
/* only one side + a centre item: both sides get equal room so the centre stays truly centred */
.hdr-row--balance > .hdr-zone--left, .hdr-row--balance > .hdr-zone--right { flex: 1 1 0; }
.hdr-row--balance > .hdr-zone--center { flex: 0 1 auto; }
.hdr-zone > .site-logo { padding-right: 0; }
.hdr-item { display: flex; align-items: stretch; gap: 10px; }
.hdr-item--search, .hdr-cta { align-self: center; }
.hdr-item--search { align-items: center; }
.hdr-item--menu { align-items: stretch; }

/* button */
.hdr-cta { display: inline-flex; align-items: center; padding: 9px 18px; border-radius: 8px; background: var(--primary, #4f46e5); color: #fff !important; font-weight: 600; font-size: 14px; text-decoration: none !important; white-space: nowrap; transition: filter .15s, transform .15s; }
.hdr-cta:hover { filter: brightness(1.08); transform: translateY(-1px); }

/* search */
.hdr-search-btn, .nav-toggle { width: 40px; height: 40px; border-radius: 10px; border: 1px solid #e5e7eb; background: transparent; color: var(--hdr-fg, #374151); font-size: 17px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: background .15s, border-color .15s; }
.hdr-search-btn:hover, .nav-toggle:hover { background: rgba(79,70,229,.08); border-color: var(--primary, #4f46e5); }
/* RESPONSIVE MENU BUTTON: the hamburger exists only where the menu collapses. On desktop the menu links are shown, so the
   button stays hidden. It is switched on by responsive.css (<= 1099px) and by the (<= 900px) block below, both with !important. */
.nav-toggle { display: none; }
.hdr-search { display: none; align-items: center; gap: 8px; height: 44px; box-sizing: border-box; background: #f3f4f6; border: 1px solid #e5e7eb; border-radius: 999px; padding: 0 5px 0 16px; transition: border-color .15s, box-shadow .15s, background .15s; }
.hdr-search:hover { border-color: #cbd5e1; }
.hdr-search:focus-within { border-color: var(--primary, #4f46e5); box-shadow: 0 0 0 3px rgba(79,70,229,.15); background: #fff; }
.hdr-search input { flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; outline: none; font: inherit; font-size: 14px; padding: 0; color: #111827; }
.hdr-search input::placeholder { color: #9ca3af; }
.hdr-search input::-webkit-search-cancel-button { display: none; }
.hdr-search__icon { font-size: 15px; opacity: .6; line-height: 1; }
.hdr-search__go { height: 34px; border: 0; background: var(--primary, #4f46e5); color: #fff; font-weight: 600; font-size: 13px; padding: 0 18px; border-radius: 999px; cursor: pointer; transition: filter .15s, transform .15s; }
.hdr-search__go:hover { filter: brightness(1.1); }
.hdr-search__go:active { transform: scale(.97); }
/* search placed in the centre zone: an inline bar (the button is not needed) */
.hdr-search--inline { display: flex; flex: 1 1 260px; max-width: 440px; margin: 0 8px; }
.hdr-item--search:has(.hdr-search--inline) { flex: 1 1 auto; justify-content: center; }
.hdr-item--search:has(.hdr-search--inline) .hdr-search-btn { display: none; }
/* search in a side zone: the button opens a bar under the header */
.hdr--search-open .hdr-search:not(.hdr-search--inline) { display: flex; position: absolute; left: 50%; transform: translateX(-50%); top: calc(100% + 8px); width: min(560px, calc(100vw - 32px)); height: 52px; background: #fff; border-color: #e2e8f0; box-shadow: 0 18px 40px rgba(15,23,42,.18); z-index: 998; padding: 0 8px 0 18px; }
.hdr--search-open .hdr-search:not(.hdr-search--inline) .hdr-search__go { height: 38px; }

/* top bar (strip above the header) */
.hdr-topbar { background: var(--hdr-fg, #111827); color: var(--hdr-bg, #fff); font-size: 13px; }
.hdr-topbar__inner { display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 38px; flex-wrap: wrap; }
.hdr-topbar a { color: inherit; text-decoration: none; opacity: .9; margin-left: 18px; }
.hdr-topbar a:hover { opacity: 1; text-decoration: underline; }
.hdr-topbar__links { display: flex; flex-wrap: wrap; }

/* header height (desktop; phones keep the compact bar) */
@media (min-width: 901px) { .hdr--h .hdr-row--1 { height: var(--hdr-h); } }

/* ═══ Responsive ═════════════════════════════════════════════════════════════ */
@media (max-width: 1100px) {
    .hdr .nav-menu > li > a { padding: 0 11px; }
    .hdr-search--inline { max-width: 300px; }
}
@media (max-width: 900px) {
    /* every row / zone melts into ONE compact bar: logo ... search, button, menu button */
    .hdr .hdr__inner { display: flex; align-items: center; height: 64px; flex-wrap: nowrap; position: static; padding: 0; }
    .hdr .hdr-row, .hdr .hdr-zone, .hdr .hdr-item--menu, .hdr .hdr-item--search { display: contents; }
    .hdr .hdr-row--2 { border: 0; }
    .hdr .hdr__logo { order: 1; flex: 0 1 auto; min-width: 0; padding-right: 12px; }
    .hdr .hdr-search-btn { order: 2; display: inline-flex !important; margin-left: auto; }
    .hdr .hdr-cta { order: 3; margin-left: 10px; padding: 8px 14px; font-size: 13px; }
    .hdr .nav-toggle { order: 4; display: flex !important; margin-left: auto; align-self: center; }
    .hdr--has-search .nav-toggle, .hdr--has-cta .nav-toggle { margin-left: 10px; }
    .hdr--has-cta:not(.hdr--has-search) .hdr-cta { margin-left: auto; }
    .hdr .site-nav { order: 9; }
    .hdr .hdr-search--inline { display: none; }
    /* the open menu hangs under the whole header */
    .hdr .site-nav { top: 100% !important; left: 0; right: 0; width: 100%; max-height: calc(100vh - 80px) !important; flex: none; margin: 0; min-height: 0; border-top: 0; }
    .hdr .site-nav:not(.site-nav--open) { display: none !important; }
    .hdr .nav-menu { justify-content: flex-start; }
    /* the search bar opens under the header on every layout */
    .hdr--search-open .hdr-search, .hdr--search-open .hdr-search--inline { display: flex; position: absolute; left: 50%; transform: translateX(-50%); top: calc(100% + 8px); width: min(560px, calc(100vw - 32px)); height: 52px; flex: none; max-width: none; margin: 0; background: #fff; border-color: #e2e8f0; box-shadow: 0 18px 40px rgba(15,23,42,.18); z-index: 998; padding: 0 8px 0 18px; }
    .hdr-wrap { padding: 0 16px; }
    .hdr-wrap--full { padding: 0 min(var(--hdr-pad, 10px), 16px); }
}
@media (max-width: 640px) {
    .hdr .hdr__inner { height: 58px; }
    .hdr .site-logo img { height: min(var(--hdr-logo-h, 44px), 38px); }
    .hdr .hdr-cta { display: none; }
    .hdr--has-cta:not(.hdr--has-search) .nav-toggle { margin-left: auto; }
    .hdr-topbar__inner { justify-content: center; text-align: center; padding-top: 6px; padding-bottom: 6px; }
    .hdr-topbar__text { display: none; }
    .hdr-topbar a { margin: 0 9px; }
    .hdr--search-open .hdr-search { width: calc(100vw - 24px); }
    .hdr-search__go { display: none; }
}
@media (max-width: 380px) {
    .hdr .site-logo { font-size: 18px; }
    .hdr-search-btn, .hdr .nav-toggle { width: 38px; height: 38px; padding: 0; }
}
@media print { .hdr, .hdr-topbar { display: none; } }

/* ═══ Footer layout (only when the owner changed something: .site-footer--custom) ═ */
.ft-wrap { width: 100%; padding: 0 24px; box-sizing: border-box; }
.ft-wrap--custom { max-width: var(--ft-cw, 1140px); margin-left: auto; margin-right: auto; }
.ft-wrap--full { max-width: none; padding: 0 var(--ft-pad, 10px); }
.site-footer--custom { background: var(--ft-bg, linear-gradient(180deg, #0a0f1e 0%, #111827 100%)); color: var(--ft-fg, #94a3b8); }
.site-footer--custom .site-footer__grid { padding-top: var(--ft-pt, 52px); padding-bottom: var(--ft-pb, 40px); }
.site-footer--custom .site-footer__copy, .site-footer--custom .site-footer__tagline { color: var(--ft-fg, #94a3b8); }
@media (min-width: 1025px) {
    .site-footer--custom .site-footer__grid { grid-template-columns: var(--ft-cols, 1.6fr 1fr 1fr 1fr); }
}
@media (min-width: 641px) and (max-width: 1024px) {
    .site-footer--custom .site-footer__grid { grid-template-columns: repeat(2, 1fr) !important; }
    .site-footer--custom .site-footer__brand { grid-column: 1 / -1 !important; }
}
/* bottom bar: three zones, positions chosen by drag and drop */
.ft-zone { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ft-zone--left { justify-content: flex-start; }
.ft-zone--center { justify-content: center; flex: 1 1 auto; }
.ft-zone--right { justify-content: flex-end; }
@media (max-width: 640px) {
    .ft-wrap { padding: 0 16px; }
    .ft-wrap--full { padding: 0 min(var(--ft-pad, 10px), 16px); }
    .site-footer__bottom .ft-zone { flex: 1 1 100%; justify-content: center; }
}

/* ═══ Footer text must always be readable on the dark background ═════════════ */
.site-footer .widget-recent-posts__title,
.site-footer .widget-recent-posts__title a,
.site-footer .widget-recent-posts__info a { color: var(--ft-fg, #cbd5e1); font-weight: 500; }
.site-footer .widget-recent-posts__title:hover,
.site-footer .widget-recent-posts__title a:hover { color: #a5b4fc; text-decoration: none; }
.site-footer .widget-recent-posts__date { color: var(--ft-fg, #94a3b8); opacity: .85; }
.site-footer__tagline { color: var(--ft-fg, #94a3b8); }
.site-footer__copy { color: var(--ft-fg, #94a3b8); }
.site-footer__copy strong { color: #e2e8f0; }
.site-footer .widget-text, .site-footer .widget-custom-html, .site-footer p { color: var(--ft-fg, #94a3b8); }
.site-footer__bottom .nav-menu a { color: var(--ft-fg, #94a3b8); }
.site-footer .footer-back-top { color: var(--ft-fg, #cbd5e1); }
.site-footer .footer-back-top:hover { color: #fff; }

/* ═══ Floating "back to top" with scroll progress ring ═══════════════════════ */
.site-footer .footer-back-top.fd-totop {
    position: fixed; right: 24px; bottom: 24px; z-index: 900;
    width: 54px; height: 54px; padding: 0; margin: 0; border: 0; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%); color: #fff;
    box-shadow: 0 10px 28px rgba(79,70,229,.45), 0 2px 6px rgba(15,23,42,.25);
    cursor: pointer; letter-spacing: 0;
    opacity: 0; visibility: hidden; transform: translateY(16px) scale(.85);
    transition: opacity .25s ease, transform .25s ease, visibility .25s, box-shadow .2s ease, filter .2s ease;
}
.site-footer .footer-back-top.fd-totop.is-visible { opacity: 1; visibility: visible; transform: none; }
.site-footer .footer-back-top.fd-totop:hover { transform: translateY(-3px); filter: brightness(1.08); box-shadow: 0 16px 34px rgba(79,70,229,.55), 0 3px 8px rgba(15,23,42,.3); color: #fff; background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%); border: 0; }
.site-footer .footer-back-top.fd-totop:active { transform: scale(.94); }
.site-footer .footer-back-top.fd-totop:focus-visible { outline: 3px solid #fff; outline-offset: 3px; box-shadow: 0 0 0 6px rgba(79,70,229,.6); }
.fd-totop__ring { position: absolute; inset: 3px; width: calc(100% - 6px); height: calc(100% - 6px); transform: rotate(-90deg); pointer-events: none; }
.fd-totop__track { fill: none; stroke: rgba(255,255,255,.28); stroke-width: 3; }
.fd-totop__bar { fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; stroke-dasharray: 132; stroke-dashoffset: 132; transition: stroke-dashoffset .12s linear; }
.fd-totop__arrow { position: relative; transition: opacity .15s, transform .2s; }
.fd-totop__pct { position: absolute; font-size: 12px; font-weight: 800; letter-spacing: -.02em; opacity: 0; transform: scale(.8); transition: opacity .15s, transform .2s; font-variant-numeric: tabular-nums; }
.fd-totop:hover .fd-totop__arrow { opacity: 0; transform: translateY(-4px); }
.fd-totop:hover .fd-totop__pct { opacity: 1; transform: none; }
@media (max-width: 640px) { .site-footer .footer-back-top.fd-totop { right: 14px; bottom: 14px; width: 46px; height: 46px; } .fd-totop__arrow { width: 16px; height: 16px; } }
@media (prefers-reduced-motion: reduce) { .site-footer .footer-back-top.fd-totop, .fd-totop__bar { transition: none; } }
/* credit line in the footer's bottom bar */
.site-footer__credit { font-size: 13px; color: var(--ft-fg, #94a3b8); white-space: nowrap; }
.site-footer__credit a, .site-footer__credit strong { color: #e2e8f0; font-weight: 700; text-decoration: none; border-bottom: 1px solid rgba(165,180,252,.45); padding-bottom: 1px; transition: color .15s, border-color .15s; }
.site-footer__credit a:hover { color: #a5b4fc; border-color: #a5b4fc; }
@media (max-width: 640px) { .site-footer__credit { white-space: normal; text-align: center; } }

/* ═══════════════════════════════════════════════════════════════════════════
   POST DETAIL FIX v2: blog details page + content/sidebar grid, fully responsive
   (kept in this file on purpose: it is always loaded last and its URL changes whenever the file changes)

   Root cause: the page grid was `1fr 300px`. A `1fr` column may grow to fit its widest child, so ONE wide element inside
   an article (table, embed, code block, fixed-width box, wide image, long line) stretched the article column and pushed
   the sidebar off the right edge of the screen. `minmax(0, 1fr)` lets the column shrink. The rules below use !important
   and a stronger selector so no older stylesheet can bring the problem back.
   Breakpoints match responsive.css: 1099px (tablet), 767px (mobile), 479px (small mobile).
   ═══════════════════════════════════════════════════════════════════════════ */

/* 1. Page grid: article + sidebar */
body .site-main { grid-template-columns: minmax(0, 1fr) clamp(260px, 24vw, 320px) !important; }
body .site-main.site-main--full { grid-template-columns: minmax(0, 1fr) !important; }
body #main-content, body .sidebar, body .entry { min-width: 0 !important; max-width: 100% !important; }
@media (max-width: 1099px) {
    body .site-main, body .site-main:not(.site-main--full) { grid-template-columns: minmax(0, 1fr) !important; }
    body .sidebar { position: static !important; width: 100%; }
}
/* nothing a post contains may ever create a sideways scrollbar for the whole page */
html { overflow-x: hidden; }

/* 2. Article header */
.entry-title { overflow-wrap: anywhere; hyphens: auto; }
.entry-meta { gap: 8px 16px; }
.entry-meta > * { min-width: 0; }
.entry-categories { display: flex; flex-wrap: wrap; gap: 6px; }
.entry-category { margin-right: 0; }
@media (max-width: 767px) {
    .entry-header { margin-bottom: 22px; }
    .entry-meta { font-size: 12.5px; gap: 6px 12px; margin-bottom: 18px; }
    .entry-featured-image { margin-bottom: 24px; border-radius: 10px; }
    .entry-featured-image img { max-height: 340px; }
    .entry-featured-image--default { padding: 22px 14px; }
    .entry-featured-image--default img { max-width: min(220px, 70%); }
}

/* 3. Article body */
.prose { min-width: 0; max-width: 100%; overflow-x: auto; overflow-wrap: break-word; word-wrap: break-word; hyphens: auto; }
.prose :where(div, section, article, figure, figcaption, p, ul, ol, dl, blockquote, form, fieldset, span, a,
              img, video, audio, iframe, embed, object, canvas, svg, picture) { max-width: 100%; }
.prose :where(img, video, canvas, picture) { height: auto; }
.prose img[width], .prose img[height] { height: auto; }
.prose :where(span, a, p, div, li, td, th)[style*="nowrap"] { white-space: normal !important; }
.prose table { display: block; width: 100%; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.prose th, .prose td { overflow-wrap: break-word; }
.prose pre { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: pre; tab-size: 4; }
.prose :not(pre) > code { overflow-wrap: anywhere; }
.prose iframe { width: 100%; border: 0; }
.prose iframe[src*="youtube"], .prose iframe[src*="youtu.be"], .prose iframe[src*="vimeo"] { aspect-ratio: 16 / 9; height: auto; }
.prose video { width: 100%; }

/* justified text: good on a wide column, big gaps on a narrow one */
.prose p, .prose li { text-align: left; }
@media (min-width: 768px) { .prose p, .prose li { text-align: justify; text-justify: inter-word; } }
@media (max-width: 767px) {
    .prose { font-size: 16px; line-height: 1.75; }
    .prose ul, .prose ol { margin-left: 1.25em; }
    .prose blockquote { margin-left: 0; margin-right: 0; padding: 12px 14px; }
    .prose .alignleft, .prose .alignright, .prose img[align="left"], .prose img[align="right"] { float: none !important; display: block; margin: 1em auto !important; }
    .prose th, .prose td { padding: 8px 10px; font-size: .92em; }
}

/* 4. Tags, share buttons, author box */
.entry-tags { gap: 8px; }
.share-buttons { flex-wrap: wrap; gap: 8px; }
.author-box, .author-box > div { min-width: 0; }
.author-box__bio, .author-box__name { overflow-wrap: anywhere; }
@media (max-width: 479px) {
    .share-buttons__label { flex: 0 0 100%; }
    .share-btn { flex: 1 1 calc(50% - 8px); justify-content: center; }
    .author-box { padding: 20px 16px; }
}

/* 5. Related posts */
.related-posts__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1099px) { .related-posts__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 767px)  { .related-posts__grid { grid-template-columns: minmax(0, 1fr) !important; } }
.post-card__title, .post-card__excerpt { overflow-wrap: anywhere; }

/* 6. Comments */
.comment, .comment-body { min-width: 0; }
.comment-content { overflow-wrap: anywhere; }
.comment-form input[type="text"], .comment-form input[type="email"], .comment-form input[type="url"], .comment-form textarea { max-width: 100%; box-sizing: border-box; }
.comment-form .form-row > * { min-width: 0; }
@media (max-width: 767px) {
    .comment-form .form-row { grid-template-columns: minmax(0, 1fr); }
    .comment-children { margin-left: 12px; padding-left: 10px; }
}

/* 7. Sidebar widgets */
.widget { min-width: 0; }
.widget-recent-posts__title, .widget-categories__item a, .widget-tag-cloud__tag { overflow-wrap: anywhere; }
.widget-search__wrap { min-width: 0; max-width: 100%; }
.widget-search__input { min-width: 0; width: 100%; }
.widget-search__btn { flex: 0 0 auto; }