/* ============================================================
   MODERN 2026 RESTYLE - layout, components, hamburger, dark-mode extras
   Layer for the Resizable theme family (StudentLife/TechCrates/Technik).
   Loaded AFTER style.css, colors/*.css and custom.css.
   Rollback: remove the two enqueues + restore header.php/footer.php
   from the backup (see ~/migration/theme-restyle-backup-2026-08-11/).
============================================================ */

:root {
    color-scheme: light;
    --icon-moon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M21.75 15.5A9.75 9.75 0 0 1 8.5 2.25a9.75 9.75 0 1 0 13.25 13.25z'/%3E%3C/svg%3E");
    --icon-sun: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 17a5 5 0 1 1 0-10 5 5 0 0 1 0 10zm0-13.5a1 1 0 0 1 1 1V6a1 1 0 0 1-2 0V4.5a1 1 0 0 1 1-1zm0 15a1 1 0 0 1 1 1V21a1 1 0 0 1-2 0v-1.5a1 1 0 0 1 1-1zM3.5 12a1 1 0 0 1 1-1H6a1 1 0 0 1 0 2H4.5a1 1 0 0 1-1-1zm14.5 0a1 1 0 0 1 1-1h1.5a1 1 0 0 1 0 2H19a1 1 0 0 1-1-1zM5.99 5.99a1 1 0 0 1 1.42 0l1.06 1.06a1 1 0 0 1-1.42 1.42L5.99 7.4a1 1 0 0 1 0-1.42zm9.54 9.54a1 1 0 0 1 1.42 0l1.06 1.06a1 1 0 0 1-1.42 1.42l-1.06-1.06a1 1 0 0 1 0-1.42zm2.48-9.54a1 1 0 0 1 0 1.42L16.95 8.47a1 1 0 1 1-1.42-1.42l1.06-1.06a1 1 0 0 1 1.42 0zM8.47 15.53a1 1 0 0 1 0 1.42L7.4 18.01a1 1 0 0 1-1.42-1.42l1.06-1.06a1 1 0 0 1 1.42 0z'/%3E%3C/svg%3E");
}
body.dark { color-scheme: dark; }

/* ---------- Theme-toggle icon ----------
   header.php marks the icon up with Font Awesome classes, but only TechCrates
   loads Font Awesome - on StudentLife and Technik the button rendered as an
   empty circle (icon measured 0x0). Paint the glyph from an inline SVG mask
   instead: no external dependency, identical on all three, and it inherits
   the button's colour. */
#theme-icon {
    display: block;
    width: 22px;
    height: 22px;
    background-color: currentColor;
    -webkit-mask: var(--icon-moon) center / 22px 22px no-repeat;
    mask: var(--icon-moon) center / 22px 22px no-repeat;
}
#theme-icon::before { content: none !important; }
body.dark #theme-icon {
    -webkit-mask-image: var(--icon-sun);
    mask-image: var(--icon-sun);
}
.theme-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

/* ---------- Fluid layout ---------- */
#wrapper,
.inner-wrap { width: min(1200px, 94%); max-width: 1200px; margin-inline: auto; }

#container {
    float: none;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 32px;
    padding: 26px 0 44px;
}

#content { float: none; width: 100%; min-width: 0; z-index: auto; }
#sidebar { float: none; width: 100%; z-index: auto; }
#content-loop { float: none; width: 100%; }
.one-col { width: 100% !important; }

/* ---------- Sticky header ---------- */
#header {
    height: auto;
    z-index: 999;
    background: var(--bg, #fff);
    box-shadow: 0 1px 0 rgba(0,0,0,0.06), 0 2px 10px rgba(0,0,0,0.04);
    padding: 12px 0 14px;
    backdrop-filter: blur(8px);
    box-sizing: border-box;
    width: 100vw;
    margin-left: calc(50% - 50vw);
    padding-left: max(calc(50vw - 564px), 5.82vw);
    padding-right: max(calc(50vw - 564px), 5.82vw);
}
body.dark #header { background: rgba(13,17,23,0.92); box-shadow: 0 1px 0 #21262d, 0 2px 12px rgba(0,0,0,0.45); }
#header h1 { line-height: 1; margin: 0; }
#header #logo { max-width: 100%; height: auto; display: block; }
#header .theme-toggle-container { top: 50% !important; right: 0 !important; transform: translateY(-50%); }

/* ---------- Navigation bar ---------- */
#primary-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    background: var(--surface-2, #f6f8fa);
    border: 1px solid var(--border, #d8dee4);
    border-radius: 12px;
    padding: 0 10px 0 0;
    margin-top: 10px;
}
#primary-nav .nav {
    float: none;
    overflow: visible;
    flex: 1 1 auto;
}
#primary-nav .nav li { position: relative; }
#primary-nav .nav li a {
    color: var(--text, #24292f);
    font-size: 14px;
    font-weight: 500;
    padding: 13px 16px;
    border-right: 1px solid var(--border, #d8dee4);
    transition: background .18s ease, color .18s ease;
}
#primary-nav .nav li a:hover,
#primary-nav .nav .current-menu-item > a,
#primary-nav .nav .current_page_item > a,
#primary-nav .nav .current-cat > a,
#primary-nav .nav li.first > a:hover {
    background: var(--surface-3, #eef1f4);
    color: var(--accent-strong, #026aa7);
}
/* clean dropdowns */
#primary-nav .nav ul {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: 230px;
    background: var(--surface, #fff);
    border: 1px solid var(--border, #d8dee4);
    border-radius: 0 0 10px 10px;
    box-shadow: var(--shadow, 0 6px 18px rgba(0,0,0,0.12));
    z-index: 100000;
    padding: 6px 0;
}
#primary-nav .nav ul ul { top: -7px; left: 100%; margin: 0; border-radius: 10px; }
#primary-nav .nav li:hover > ul,
#primary-nav .nav li:focus-within > ul,
#primary-nav .nav li.sfHover > ul,
#primary-nav .nav li.sfHover > ul ul { display: block; }
#primary-nav .nav li li a {
    border-right: none;
    border-bottom: 1px solid var(--border, #d8dee4);
    display: block;
    padding: 10px 16px;
}
#primary-nav .nav li li:last-child > a { border-bottom: none; }

/* float containment (ul has floated li children; overflow stays visible for dropdowns) */
#primary-nav .nav::after,
#secondary-nav .nav::after {
    content: '';
    display: block;
    clear: both;
}

/* search pill */
#search { float: none; margin-left: auto; padding: 8px 0 8px 10px; }
#search form { margin: 0; }
#search .field {
    border: 1px solid var(--border, #d8dee4);
    border-radius: 999px;
    background: var(--surface, #fff);
    color: var(--text, #24292f);
    font-size: 13px;
    padding: 8px 16px;
    width: 160px;
    transition: width .2s ease, box-shadow .2s ease;
}
#search .field:focus {
    width: 220px;
    outline: none;
    box-shadow: 0 0 0 3px rgba(2,116,190,0.25);
}
#search .submit { display: none; }

/* secondary nav row */
#secondary-nav {
    background: var(--accent, #0274be);
    border: none;
    border-radius: 10px;
    margin-top: 8px;
    overflow: visible;
}
#secondary-nav .nav {
    background: none;
    border-bottom: none;
    overflow: visible;
}
#secondary-nav .nav li a {
    font-size: 12.5px;
    padding: 7px 12px;
    color: #ffffff !important;
}
#secondary-nav .nav li a:hover {
    background: rgba(0, 0, 0, 0.18) !important;
    color: #ffffff !important;
}
#secondary-nav .nav li.sfHover > a {
    background: rgba(0, 0, 0, 0.18) !important;
    color: #ffffff !important;
}
#secondary-nav .nav li ul {
    width: 200px;
    background: #ffffff;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.14);
    z-index: 100000;
}
#secondary-nav .nav li ul li a {
    background: #ffffff !important;
    color: #24292f !important;
    border-bottom: 1px solid var(--border, #d8dee4);
    font-weight: normal;
}
#secondary-nav .nav li ul li a:hover {
    background: #eef1f4 !important;
    color: #026aa7 !important;
}

/* ---------- Hamburger (mobile) ---------- */
#nav-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 5px;
    flex-direction: column;
    width: 44px;
    height: 44px;
    margin: 6px 0 6px auto;
    background: transparent;
    border: 1px solid var(--border, #d8dee4);
    border-radius: 10px;
    cursor: pointer;
    padding: 10px;
}
#nav-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    border-radius: 2px;
    background: var(--text, #24292f);
    transition: transform .2s ease, opacity .2s ease;
}
body.nav-open #nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
body.nav-open #nav-toggle span:nth-child(2) { opacity: 0; }
body.nav-open #nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Box sizing ---------- */
#content-loop .post,
.post,
.hentry,
.entry-content,
#sidebar .widget,
.widget,
.sidebar-ad,
#primary-nav,
#secondary-nav,
#search .field,
#nav-toggle { box-sizing: border-box; }

/* ---------- Featured hero ----------
   Fills the content column instead of stopping at the old 650px fixed width.
   flex-grow 430 : 200 reproduces the native crop proportions
   (featured-thumb-large 430x410, featured-thumb-small 200x130), so the big
   image and the stack of 3 end level; space-between absorbs the remainder. */
#featured-content {
    display: flex;
    align-items: stretch;
    gap: 20px;
    width: 100%;
    margin: 0 0 26px;
}
#featured-content .featured-main,
#featured-content .featured-aside {
    float: none;
    width: auto;
    min-width: 0;
    margin: 0;
}
#featured-content .featured-main { flex: 430 1 0; }
#featured-content .featured-aside { flex: 200 1 0; }

/* The theme emits <div class="clear"> float-clearers. Inside a flex container
   they become stray flex items that swallow an extra gap plus a few px, so the
   row never reaches the full column width. Nothing to clear in flex layout. */
#featured-content > .clear,
#primary-nav > .clear { display: none; }

#featured-content .featured-main ul,
#featured-content .featured-aside ul {
    width: 100%;
    margin: 0;
    padding: 0;
    list-style: none;
}
#featured-content .featured-aside ul {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 10px;
    height: 100%;
}
#featured-content .featured-main ul li,
#featured-content .featured-aside ul li {
    float: none;
    width: 100%;
    height: auto;
    margin: 0;
    border-radius: 10px;
    overflow: hidden;
}
#featured-content a img,
#featured-content .entry-thumb {
    display: block;
    width: 100%;
    height: auto;
}
#featured-content .featured-main .entry-title,
#featured-content .featured-aside .entry-title {
    box-sizing: border-box;
    width: 100%;
    left: 0;
    right: 0;
}

/* ---------- Content cards ---------- */
#content-loop .post,
.post,
.entry-content {
    background: var(--surface, #fff);
    border: 1px solid var(--border, #d8dee4);
    border-radius: 12px;
    padding: 1.6rem 1.8rem;
    margin-bottom: 26px;
    box-shadow: var(--shadow, 0 1px 2px rgba(0,0,0,0.05), 0 6px 18px rgba(0,0,0,0.05));
}
#content-loop .post img,
.post img {
    border-radius: 8px;
    height: auto;
}
.entry-title {
    font-size: clamp(22px, 2.6vw, 30px);
    line-height: 1.22;
    margin: 0 0 8px;
}
.entry-title a, .entry-title a:visited { color: var(--text, #24292f); }
.entry-title a:hover { color: var(--accent, #0274be); }
.entry-meta, .entry-meta a {
    color: var(--muted, #57606a);
    font-size: 13px;
    letter-spacing: .2px;
}
.entry-meta a:hover { color: var(--accent-strong, #026aa7); }

/* prose: no card chrome here - the wrapping .post is the card */
.entry-content {
    font-size: 17px;
    line-height: 1.7;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
}
.entry-content h1, .entry-content h2, .entry-content h3, .entry-content h4 {
    margin: 1.4em 0 .5em;
    line-height: 1.3;
    color: var(--text, #24292f);
}
.entry-content h2 { font-size: 26px; padding-bottom: 6px; border-bottom: 1px solid var(--border, #d8dee4); }
.entry-content h3 { font-size: 21px; }
.entry-content blockquote {
    margin: 1.4em 0;
    padding: 6px 0 6px 18px;
    border-left: 4px solid var(--accent, #0274be);
    color: var(--muted, #57606a);
    background: var(--surface-2, #f6f8fa);
    border-radius: 0 8px 8px 0;
}
/* custom.css designs pre as a dark block (#e6e6e6 text); this light background
   must bring its own text colour or code becomes light-grey-on-white. */
.entry-content pre {
    background: var(--surface-2, #f6f8fa);
    color: var(--text, #24292f);
    border: 1px solid var(--border, #d8dee4);
    border-radius: 10px;
    padding: 16px;
    overflow-x: auto;
}
.entry-content code {
    background: var(--surface-2, #f6f8fa);
    color: #b62324; /* custom.css #d63344 is 4.47:1 on this background, under WCAG AA */
    border: 1px solid var(--border, #d8dee4);
    border-radius: 5px;
    padding: 2px 6px;
    font-size: .9em;
}
/* Inline code stays inline. style.css gives every .entry-content code (and tt)
   display:block, margin:1.5em 0 and white-space:pre, a rule meant for pre only:
   an inline snippet became a full-width box that split its sentence, worst in
   list items, and the code inside every pre got a 1.5em margin, so a one-line
   block stood 95px tall instead of 54px. */
.entry-content code,
.entry-content tt {
    display: inline;
    margin: 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    overflow-x: visible;
}
.entry-content pre code,
.entry-content pre tt {
    display: block;
    margin: 0;
    padding: 0;
    background: none;
    border: 0;
    white-space: pre;
    overflow-wrap: normal;
}
.entry-content li > pre { margin: .9em 0; }
/* custom.css styles body.dark .entry-content code with !important, which also
   put an inline-code chip (background, border, padding) inside every pre. */
body.dark .entry-content pre code,
body.dark .entry-content pre tt {
    background: none !important;
    border: 0 !important;
    padding: 0 !important;
    color: inherit !important;
}
/* ---------- Old post markup on narrow screens (layout scan of all posts, 2026-10-05) ----------
   The theme clips sideways overflow (body { overflow-x: clip }), so anything wider than the
   column was cut off on a phone instead of scrolling: half a photo and its caption, the right
   edge of a video. max-width wins over an inline width without !important. */
.entry-content { overflow-wrap: break-word; }   /* registry keys and paths with no break point */
.entry-content .wp-caption,
.entry-content dl.wp-caption { max-width: 100%; box-sizing: border-box; }   /* style="width: 660px" */
.entry-content .wp-caption img { max-width: 100%; height: auto; }
.entry-content iframe,
.entry-content embed,
.entry-content object,
.entry-content video { max-width: 100%; }   /* width="630" embeds */
.entry-content iframe[src*="youtube"],
.entry-content iframe[src*="youtu.be"],
.entry-content iframe[src*="vimeo"] { height: auto; aspect-ratio: 16 / 9; }   /* no letterbox once narrowed */
/* Tables wrapped by the ck-content-tidy mu-plugin scroll instead of losing their last columns. */
.entry-content .ck-table-scroll { max-width: 100%; overflow-x: auto; margin: 1.5em 0; }
.entry-content .ck-table-scroll > table { margin: 0; }
/* Contact Form 7 inputs come with size="40": 404px on a 375px screen, right edge cut off. */
.wpcf7 input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="hidden"]),
.wpcf7 textarea,
.wpcf7 select { max-width: 100%; box-sizing: border-box; }
/* The logo carries an inline max-width: 100%, and the 44px dark-mode toggle (absolute, right: 0)
   sat on its last 40px on every phone-width page. */
#header #logo { max-width: calc(100% - 52px) !important; }
@media (max-width: 600px) {
    /* A floated 140-270px image left about 100px for the text beside it. */
    .entry-content .alignleft,
    .entry-content .alignright { float: none; display: block; margin: 0 auto 1em; }
}
.entry-content table { width: 100%; border-collapse: collapse; }
.entry-content th, .entry-content td { border: 1px solid var(--border, #d8dee4); padding: 8px 12px; }
.entry-content th { background: var(--surface-2, #f6f8fa); }

/* ---------- Pagination ----------
   wp-pagenavi prints its links with no whitespace between them, so the inline
   run has no break opportunity and pushes past the viewport on narrow screens
   (horizontal page scroll at <=480px). Flex supplies real wrap points. */
.wp-pagenavi,
.pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin: 0 0 26px;
}
.wp-pagenavi a,
.wp-pagenavi span { margin: 0; }
.wp-pagenavi a,
.wp-pagenavi span.current {
    border-radius: 8px;
    border: 1px solid var(--border, #d8dee4);
}
.wp-pagenavi span.pages { color: var(--muted, #57606a); }
body.dark .wp-pagenavi a,
body.dark .wp-pagenavi span.current { border-color: #30363d; }

/* ---------- Sidebar widgets ---------- */
#sidebar .widget,
.widget {
    background: var(--surface, #fff);
    border: 1px solid var(--border, #d8dee4);
    border-radius: 12px;
    padding: 16px 18px;
    margin-bottom: 22px;
    box-shadow: var(--shadow, 0 1px 2px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.04));
}
#sidebar .widget-title {
    background: none;
    color: var(--text, #24292f);
    font-size: 14px;
    letter-spacing: .6px;
    text-transform: uppercase;
    border-bottom: 2px solid var(--accent, #0274be);
    padding-bottom: 8px;
    margin-bottom: 12px;
}
.widget ul { list-style: none; margin: 0; padding: 0; }
.widget ul li {
    padding: 7px 0;
    border-bottom: 1px dashed var(--border, #d8dee4);
    font-size: 14px;
    line-height: 1.5;
}
.widget ul li:last-child { border-bottom: none; }
.widget a { color: var(--accent, #0274be); }
.widget a:hover { color: var(--accent-strong, #026aa7); }

/* sticky ad unit */
.sidebar-ad {
    position: static;
    background: var(--surface, #fff);
    border: 1px solid var(--border, #d8dee4);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 22px;
}

/* ---------- Legacy shortcode widgets (jQuery UI 1.13) ---------- */
.ui-tabs { border: none; padding: 0; background: transparent; }
.ui-tabs .ui-tabs-nav {
    border: none;
    background: transparent;
    border-radius: 10px;
    overflow: hidden;
    padding: 0;
    border: 1px solid var(--border, #d8dee4);
    background: var(--surface-2, #f6f8fa);
    display: flex;
    flex-wrap: wrap;
}
.ui-tabs .ui-tabs-nav li { border: none; background: transparent; margin: 0; }
.ui-tabs .ui-tabs-nav li a {
    color: var(--muted, #57606a);
    padding: 10px 18px;
    font-weight: 500;
    border-right: 1px solid var(--border, #d8dee4);
}
.ui-tabs .ui-tabs-nav li.ui-tabs-active a,
.ui-tabs .ui-tabs-nav li.ui-tabs-active a:hover {
    background: var(--accent, #0274be);
    color: #fff;
}
.ui-tabs .ui-tabs-panel { padding: 16px 4px 4px; }
.ui-accordion { margin-bottom: 1.2em; }
.ui-accordion .ui-accordion-header {
    background: var(--surface-2, #f6f8fa);
    border: 1px solid var(--border, #d8dee4);
    border-radius: 8px;
    color: var(--text, #24292f);
    font-size: 15px;
    font-weight: 600;
    margin: 6px 0 0;
    padding: 11px 16px;
}
.ui-accordion .ui-accordion-header.ui-state-active {
    background: var(--accent, #0274be);
    color: #fff;
}
.ui-accordion .ui-accordion-content {
    border: 1px solid var(--border, #d8dee4);
    border-top: none;
    border-radius: 0 0 8px 8px;
    background: var(--surface, #fff);
    padding: 14px 16px;
}

/* ---------- Footer ---------- */
#footer {
    background: var(--surface-2, #f6f8fa);
    border-top: 1px solid var(--border, #d8dee4);
    padding: 30px 0;
    color: var(--muted, #57606a);
}
#footer a { color: var(--accent, #0274be); }
#footer .widget { background: transparent; border: none; box-shadow: none; padding: 0; }
#footer .widget-title {
    background: none;
    border-bottom: 2px solid var(--accent, #0274be);
    color: var(--text, #24292f);
}
.copyright { font-size: 13px; color: var(--muted, #57606a); padding: 14px 0 20px; }

/* ---------- Dark mode: components not covered by custom.css ---------- */
body.dark .entry-title a,
body.dark .entry-title a:visited { color: #e6edf3; }
body.dark .entry-title a:hover { color: #79c0ff; }
body.dark .entry-meta, body.dark .entry-meta a { color: #8b949e; }
body.dark .widget a { color: #58a6ff; }
body.dark .widget ul li { border-color: #30363d; }
body.dark #search .field {
    background: #161b22;
    border-color: #30363d;
    color: #c9d1d9;
}
body.dark #search .field:focus { box-shadow: 0 0 0 3px rgba(88,166,255,0.3); }
body.dark .sidebar-ad { background: #161b22; border-color: #30363d; }
body.dark #nav-toggle { border-color: #30363d; }
body.dark #nav-toggle span { background: #c9d1d9; }
body.dark .ui-tabs .ui-tabs-nav li a { color: #8b949e; border-color: #30363d; }
body.dark .entry-content {
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
}
body.dark #primary-nav .nav ul {
    background: #161b22;
    border-color: #30363d;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
}
body.dark #primary-nav .nav li li a {
    color: #c9d1d9 !important;
    border-color: #30363d;
}
body.dark #primary-nav .nav li li a:hover {
    background: #21262d !important;
    color: #79c0ff !important;
}
body.dark #secondary-nav .nav li ul {
    background: #161b22;
}
body.dark #secondary-nav .nav li ul li a {
    background: #161b22 !important;
    color: #c9d1d9 !important;
    border-color: #30363d;
}
body.dark #secondary-nav .nav li ul li a:hover {
    background: #21262d !important;
    color: #79c0ff !important;
}
body.dark .ui-accordion .ui-accordion-header { color: #c9d1d9; }
body.dark .ui-accordion .ui-accordion-content { background: #161b22; }
body.dark .MathJax { color: #c9d1d9; }
/* Old posts hardcode dark inline text colours (pasted from Word/editors) that
   vanish on the dark background; let them follow the theme text colour. */
body.dark .entry-content [style*="color: #000"],
body.dark .entry-content [style*="color: black"],
body.dark .entry-content [style*="color: #19232d"],
body.dark .entry-content [style*="color: #333"],
body.dark .entry-content [style*="color: #444"],
body.dark .entry-content [style*="color: #606569"] { color: inherit !important; }
body.dark .entry-content [style*="color: #0000ff"],
body.dark .entry-content [style*="color: #3366ff"] { color: #79c0ff !important; }
body.dark .entry-content [style*="background: white"] { background: transparent !important; }
/* techcrates "CSS ghost button" post demo: keep white-on-dark-backdrop, not link blue */
body.dark .entry-content a.ghost-button { color: #fff !important; text-decoration: none !important; }
body.dark .entry-content a.ghost-button:hover { color: #000 !important; }
body.dark .wp-caption {
    background: #161b22;
    border-color: #30363d;
}
body.dark .wpck-sidebar-follow .wpck-follow-btn,
body.dark .wpck-sidebar-cta {
    background: #161b22;
    border-color: #30363d;
}
body.dark .wpck-follow-label,
body.dark .wpck-sidebar-cta p { color: #c9d1d9; }

/* ---------- Accessibility & polish ---------- */
:focus-visible {
    outline: 3px solid var(--accent, #0274be);
    outline-offset: 2px;
}
#primary-nav .nav li a:focus-visible { outline-offset: -2px; }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition: none !important;
        animation: none !important;
    }
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
    #container { grid-template-columns: minmax(0, 1fr) 280px; gap: 22px; }
}
@media (max-width: 900px) {
    #featured-content { flex-direction: column; }
    #featured-content .featured-main,
    #featured-content .featured-aside { flex: 0 0 auto; width: 100%; }
    #featured-content .featured-aside ul { height: auto; }
    #featured-content .featured-main ul li,
    #featured-content .featured-aside ul li { width: 100%; height: auto; }
    .featured-main img, .featured-aside img { max-width: 100%; height: auto; }
    #featured-content .featured-main .entry-title,
    #featured-content .featured-aside .entry-title { width: 100%; }

    #container { grid-template-columns: minmax(0, 1fr); }
    #primary-nav { flex-wrap: wrap; border-radius: 12px; padding: 0; }
    #nav-toggle { display: flex; }
    #primary-nav .nav,
    #primary-nav #search { display: none; width: 100%; }
    body.nav-open #primary-nav .nav,
    body.nav-open #primary-nav #search { display: block; }
    #primary-nav .nav { float: none; margin: 0; }
    #primary-nav .nav > li { float: none; width: 100%; }
    #primary-nav .nav li a {
        border-right: none;
        border-bottom: 1px solid var(--border, #d8dee4);
        display: block;
        padding: 12px 16px;
    }
    /* submenus become static, always visible inside the panel */
    #primary-nav .nav ul,
    #primary-nav .nav ul ul {
        display: block;
        position: static;
        width: 100%;
        margin: 0;
        padding: 0;
        border: none;
        border-radius: 0;
        box-shadow: none;
        background: var(--surface-3, #eef1f4);
    }
    #primary-nav .nav li li a { padding-left: 28px; }
    #search { margin-left: 0; padding: 8px 12px; }
    #search .field { width: 100%; }
    #search .field:focus { width: 100%; }
    #header h1 { line-height: 1; margin: 0; }
#header #logo { max-width: 100%; height: auto; display: block; }
}
@media (max-width: 480px) {
    #header { padding-left: 1%; padding-right: 1%; }
    #wrapper, .inner-wrap { width: 96%; }
    #content-loop .post, .post, .entry-content { padding: 1.1rem 1.1rem; }
    #sidebar { width: 100%; }
    .theme-toggle-container { top: 8px !important; right: 0 !important; }
}

/* ---------- Stacked category bar, 480–970px (v1.0.7) ----------
   Between 480 and 970px the base theme unfloats #secondary-nav's items into a vertical
   list AND paints the <ul> itself white:
       #secondary-nav #secondary-navigation { background-color: #ffffff; }   (style.css:2293)
   That selector carries TWO ids, so it outranks the `#secondary-nav .nav { background:none }`
   reset above. The labels in this bar are `#ffffff !important` (they sit on the blue bar at
   desktop widths), so the whole stacked list rendered white-on-white — invisible until
   hovered, because only the hover rule repaints the row. Identical in dark mode, where the
   white <ul> covers the #161b22 bar.

   Fix: let the bar's own background show through the list, so the white labels keep their
   intended ground in both themes. Also neutralises the base theme's pale-yellow
   `.current-cat` highlight, which is likewise unreadable behind white text. */
@media only screen and (min-width: 480px) and (max-width: 970px) {
    #secondary-nav #secondary-navigation,
    #secondary-nav .nav,
    #secondary-nav .nav > li {
        background: transparent !important;
    }
    #secondary-nav .nav > li {
        border-top: 1px solid rgba(255, 255, 255, 0.20);
        border-bottom: none;
    }
    #secondary-nav .nav > li:first-child { border-top: none; }
    #secondary-nav .nav > li > a { display: block; }

    /* current category: base theme uses #fffbcc, unreadable behind white labels */
    #secondary-nav .current-cat > a,
    #secondary-nav .current-cat > a:hover,
    #secondary-nav .nav .current-menu-item > a {
        background: rgba(0, 0, 0, 0.18) !important;
        color: #ffffff !important;
        text-decoration: none !important;
    }
}

/* ---------- Dark-mode completions (v1.0.8) ----------
   Elements the base theme still paints light in dark mode (audited 2026-08-13 in headless
   Chrome across home/post/category/search/404 on all three sites):
     - .copyright footer bar (white)                      - .wp-pagenavi pills (white/#efefef/#f9f9f9)
     - #breadcrumbs bar (light grey)                      - .authorbox (light grey + white avatar pad)
     - .entry-bottom (related posts + comments, white)    - .entry-tags (#222 text, invisible on #161b22)
     - #comment-form fields (inconsistent greys)          - CookieFirst consent dialog (TC)
   Plus low-contrast text: sidebar widget meta (#777), CTA button label (#58a6ff on blue —
   the plugin's own white !important loses to body.dark a), related-post dates, breadcrumb links. */
body.dark #breadcrumbs {
    background: #161b22;
    border-color: #30363d;
    color: #8b949e;
}
body.dark #breadcrumbs a {
    color: #58a6ff;
    background-image: none;
}
body.dark .wp-pagenavi .extend,
body.dark .wp-pagenavi span.pages {
    background: transparent;
    background-image: none;
    color: #8b949e;
}
body.dark .wp-pagenavi a:link,
body.dark .wp-pagenavi a:visited {
    background: #161b22;
    background-image: none;
    border-color: #30363d;
    color: #c9d1d9;
}
body.dark .wp-pagenavi .on,
body.dark .wp-pagenavi .current,
body.dark .wp-pagenavi a:hover {
    background: #30363d !important;
    background-image: none !important;
    border-color: #58a6ff !important;
    color: #e6edf3 !important;
}
body.dark .authorbox {
    background: #161b22;
    border-color: #30363d;
    color: #c9d1d9;
}
body.dark .authorbox img {
    background: #0d1117;
    border-color: #30363d;
}
body.dark .entry-bottom {
    background: #161b22;
    border-color: #30363d;
}
body.dark .entry-bottom h3,
body.dark .related-posts h3 {
    color: #e6edf3;
}
body.dark .related-posts li {
    border-top-color: #30363d;
}
body.dark .related-posts li span,
body.dark .entry-bottom-ad .ad-title {
    color: #8b949e;
}
body.dark .entry-tags {
    color: #8b949e;
}
body.dark .entry-tags a {
    color: #58a6ff;
}
body.dark .copyright {
    background: #0d1117;
    border-top-color: #30363d;
    color: #8b949e !important;
}
body.dark .copyright a,
body.dark .copyright a:visited {
    color: #8b949e;
    border-bottom-color: #30363d;
}
body.dark #comment-form textarea,
body.dark #comment-form .form-left input {
    background: #0d1117;
    border: 1px solid #30363d;
    color: #c9d1d9;
}
body.dark #comment-form textarea::placeholder,
body.dark #comment-form .form-left input::placeholder {
    color: #8b949e;
}
body.dark #comment-form input.sb {
    background: #1f6feb;
    border: none;
    border-radius: 4px;
    color: #ffffff;
    font-weight: 600;
    padding: 8px 18px;
    cursor: pointer;
}
body.dark #comment-form input.sb:hover {
    background: #388bfd;
}
/* sidebar widget meta + CTA/follow button labels: beat body.dark a (equal specificity,
   later in cascade — modern.css loads after custom.css) */
body.dark .wpck-meta,
body.dark .wpck-comment-meta {
    color: #8b949e;
}
body.dark .wpck-cta-btn,
body.dark .wpck-sidebar-follow .wpck-follow-btn {
    color: #ffffff !important;
}
body.dark .wpck-cta-title {
    color: #e6edf3;
}
/* CookieFirst consent dialog (TechCrates): white dialog + near-invisible button labels */
body.dark .fc-consent-root .fc-dialog {
    background: #161b22 !important;
    color: #c9d1d9 !important;
}
body.dark .fc-consent-root .fc-dialog * {
    border-color: #30363d !important;
}
/* CookieFirst injects its own <style> with !important at up to (0,4,0) specificity —
   beat it at ID-free maximum specificity */
body.dark .fc-consent-root .fc-dialog .fc-dialog-content .fc-dialog-scrollable-content .fc-header h1,
body.dark .fc-consent-root .fc-dialog .fc-dialog-content .fc-dialog-scrollable-content .fc-header h2,
body.dark .fc-consent-root .fc-dialog .fc-dialog-content .fc-dialog-scrollable-content .fc-header .fc-header-text {
    color: #e6edf3 !important;
}
body.dark .fc-consent-root .fc-dialog .fc-dialog-content .fc-dialog-scrollable-content .fc-footer p,
body.dark .fc-consent-root .fc-dialog .fc-dialog-content .fc-dialog-scrollable-content .fc-footer li {
    color: #8b949e !important;
}
body.dark .fc-consent-root .fc-dialog .fc-dialog-content .fc-dialog-scrollable-content .fc-footer a.fc-vendors-list-dialog,
body.dark .fc-consent-root .fc-dialog .fc-dialog-content .fc-dialog-scrollable-content .fc-footer a,
body.dark .fc-consent-root .fc-dialog .fc-dialog-content .fc-dialog-scrollable-content .fc-footer .fc-footer-link-v2 {
    color: #58a6ff !important;
}
body.dark .fc-consent-root .fc-dialog .fc-dialog-content .fc-dialog-scrollable-content .fc-stacks .fc-stack-name,
body.dark .fc-consent-root .fc-dialog .fc-dialog-content .fc-dialog-scrollable-content .fc-faq-header .fc-faq-label {
    color: #c9d1d9 !important;
}
body.dark .fc-consent-root .fc-faq-icon {
    background: #30363d !important;
}
body.dark .fc-consent-root .fc-dialog .fc-button:not(.fc-cta-consent) {
    background: #21262d !important;
    color: #c9d1d9 !important;
}
body.dark .fc-consent-root .fc-cta-consent {
    background: #1f6feb !important;
    color: #ffffff !important;
}
body.dark .fc-consent-root .fc-cta-consent .fc-button-label {
    color: #ffffff !important;
}
body.dark .fc-consent-root .fc-reopen-button {
    background: #161b22 !important;
    color: #c9d1d9 !important;
}

/* ---------- Phones < 480px (2026-10-05) ----------
   The legacy includes/js/custom.js used to hide the primary + secondary menus, sidebar, featured
   block etc. with jQuery AFTER the first paint and replace the menus by a <select> — a layout shift
   of up to ~0.9 CLS on phones and no hamburger menu below 480px. The hiding now happens here, from
   the first paint, and the category bar lives inside the hamburger menu (shown with body.nav-open). */
@media only screen and (max-width: 479px) {
    #sidebar, #left-sidebar, .footer-categories, .entry-bottom-ad, #featured-content,
    #news-ticker, .header-ad, select.select-nav { display: none !important; }
    #secondary-nav { display: none !important; }
    body.nav-open #secondary-nav { display: block !important; }
    #secondary-nav #secondary-navigation,
    #secondary-nav .nav,
    #secondary-nav .nav > li {
        background: transparent !important;
        float: none !important;
        width: 100% !important;
    }
    #secondary-nav .nav > li { border-top: 1px solid rgba(255, 255, 255, 0.20); border-bottom: none; }
    #secondary-nav .nav > li:first-child { border-top: none; }
    #secondary-nav .nav > li > a { display: block; }
    #secondary-nav .nav li ul,
    #secondary-nav .sf-sub-indicator { display: none !important; }
    /* base style.css positions #search absolutely (bottom: 80px; right: 2%) on small screens — it overlapped the open menu */
    body.nav-open #primary-nav #search {
        position: static !important;
        top: auto !important; left: auto !important; right: auto !important; bottom: auto !important;
        width: 100% !important;
        box-sizing: border-box;
        padding: 10px 16px !important;
        margin: 0 !important;
    }
    body.nav-open #primary-nav #search .field { width: 100% !important; box-sizing: border-box; }
    #secondary-nav .current-cat > a,
    #secondary-nav .current-cat > a:hover,
    #secondary-nav .nav .current-menu-item > a {
        background: rgba(0, 0, 0, 0.18) !important;
        color: #ffffff !important;
        text-decoration: none !important;
    }
}
