/* Shared surfaces in the header, article tools and discussion area. */
body .header .main-menu .sub-menu,
body .mobile-sidebar .mobile-sidebar-menu,
body .mobile-sidebar .mobile-sidebar-author-action,
body .mobile-sidebar .mobile-sidebar-author-meta,
body .comments .card,
body .widget.card,
body .nice-dropdown {
    background: var(--panel);
    color: var(--ink);
    border: 1px solid var(--rule);
}
body .header .main-menu .sub-menu,
body .comments .card,
body .widget.card,
body .nice-dropdown { border-radius: 8px; }
body .nice-dropdown:after { border-top-color: var(--panel); }
body .header .main-menu .sub-menu li a,
body .mobile-sidebar .mobile-sidebar-menu li a { color: var(--ink); }
body .header .main-menu .sub-menu li a:hover,
body .mobile-sidebar .mobile-sidebar-menu li a:hover { color: var(--accent); background: var(--paper); }

body .header .navbar-search { background: var(--panel); border-bottom: 1px solid var(--rule); }
body .navbar-search .searchform { box-shadow: none !important; padding: 1rem .5rem; }
body .navbar-search .input-group {
    padding: .65rem 1rem;
    border: 1px solid var(--rule);
    border-radius: 6px;
    background: var(--paper);
}
body .navbar-search .input-group:focus-within { border-color: var(--accent); }
body .navbar-search .searchform input,
body .navbar-search .searchform input:focus,
body .navbar-search .searchform .input-group-append > .btn { color: var(--ink); }
body .navbar-search .searchform input::placeholder { color: var(--muted); }
body .navbar-search .searchform .input-group > .form-control:focus + .input-group-append .btn { color: var(--accent); }

body .comments .form-control,
body .widget_search .search-form .search-field {
    color: var(--ink);
    background: var(--paper);
    border: 1px solid var(--rule);
    border-radius: 6px;
}
body .comments .form-control::placeholder { color: var(--muted); }
body .comments .form-control:focus,
body .widget_search .search-form .search-field:focus { border-color: var(--accent); box-shadow: none; }
body .widget_search .search-form .search-submit,
body .comments .form-submit .btn-dark,
body .list-ajax-nav ul li .btn.current {
    background: var(--gold);
    border-color: var(--gold);
    color: #151d29;
}
body .list-ajax-nav ul li .btn.current:after { content: none; }
body .comments .logged-in-as.bg-light { background: var(--paper) !important; }
body .widget-header > i.bg-primary { background: var(--gold) !important; }
body .list-ajax-load .btn-light,
body .comment-ajax-load .btn-light,
body .pagination .btn-light {
    background: var(--panel);
    border: 1px solid var(--rule);
    color: var(--ink);
}
body .list-ajax-load .btn-light:hover,
body .comment-ajax-load .btn-light:hover,
body .pagination .btn-light:hover { border-color: var(--accent); color: var(--accent); }
body .pagination :is(.page-numbers,.post-page-numbers).current,
body .pagination a.post-page-numbers:not(.btn):hover { color: var(--accent); }
body .pagination :is(.page-numbers,.post-page-numbers).current:after { background: var(--gold); }
body .pagination a:focus-visible { outline: 2px solid var(--accent); }
body .post .post-header.border-light { border-color: var(--rule) !important; }
body .post .post-content blockquote {
    background: var(--paper);
    color: var(--ink);
    border-left: 3px solid var(--gold);
}

/* Article lists: inset covers, editorial titles and a quieter byline. */
body .list-grid .list-item.block {
    border-radius: 12px;
    background: var(--panel);
}
body .list-grid.list-grid-padding .list-item.block {
    padding: clamp(.85rem, 1.6vw, 1.35rem);
    margin-bottom: 1rem;
}
body .list-grid .card-plain > .media {
    flex: 0 0 34%;
    max-width: 34%;
    align-self: stretch;
    overflow: hidden;
    border-radius: 7px;
}
body .list-grid .card-plain > .media::after { padding-top: 66.667%; }
body .list-grid .card-plain > .list-content {
    min-width: 0;
    padding: .12rem 0 .12rem clamp(1rem, 2.2vw, 1.75rem);
}
body .list-grid .list-body > .list-title {
    color: var(--ink);
    font-size: clamp(1.08rem, 1.45vw, 1.42rem);
    font-weight: 650;
    line-height: 1.46;
    max-height: 2.92em;
    overflow-wrap: anywhere;
}
body .list-grid .list-body > .list-title:is(:hover,:focus-visible) { color: var(--accent); }
body .list-grid .list-desc {
    line-height: 1.75;
    letter-spacing: .012em;
}
body .list-grid .list-desc > .h-2x { max-height: 3.5em; line-height: inherit; }
body .list-grid .card-plain .list-footer {
    border-top: 1px solid var(--rule);
    padding-top: .65rem;
    margin-top: .65rem;
}
body .list-grid .kx-byline { min-width: 0; font-variant-numeric: tabular-nums; }
body .list-grid .kx-byline a:not(.flex-avatar) { color: var(--muted); }
body .list-grid .kx-byline a:hover { color: var(--accent); }
body .list-grid .kx-byline .kx-category {
    color: var(--accent);
    font-size: .72rem;
    border: 1px solid var(--rule);
    border-radius: 4px;
    padding: .12em .45em;
}
@media (max-width: 767.98px) {
    body .list-grid.list-grid-padding .list-item.block { padding: .7rem; margin-bottom: .75rem; }
    body .list-grid .card-plain > .media { flex-basis: 29%; max-width: 29%; }
    body .list-grid .card-plain > .media::after { padding-top: 92%; }
    body .list-grid .card-plain > .list-content { padding: 0 0 0 .8rem; }
    body .list-grid .list-body > .list-title { font-size: 1rem; }
    body .list-grid .card-plain .list-footer { border: 0; margin-top: .4rem; padding: 0; }
    body .list-grid .kx-byline { flex-wrap: wrap; row-gap: .25rem; }
}

.kx-about { max-width: 56rem; margin: auto; border: 1px solid var(--rule); border-radius: 12px; overflow: hidden; background: var(--panel); }
.kx-about-heading { position: relative; isolation: isolate; overflow: hidden; display: flex; align-items: flex-end; min-height: clamp(13rem, 26vw, 21rem); padding: clamp(1.5rem, 5vw, 4rem); background: radial-gradient(ellipse at 80% 40%, #1b3556, #080e1b 70%); }
.kx-about-heading h1 { margin: 0; color: #f5f8ff; font-size: clamp(2.3rem, 5vw, 4rem); line-height: 1.2; text-shadow: 0 2px 12px #080e1b; }
.kx-about-heading img { position: absolute; z-index: -2; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: brightness(.6); }
.kx-about-copy { padding: clamp(1.5rem, 5vw, 4rem); overflow-wrap: anywhere; }
.kx-about-copy h2 { font-size: clamp(1.4rem, 3vw, 2rem); margin: 0 0 1rem; }

/* Keep the reading surface continuous from the post header to the share bar. */
body.single .post.card,
body.single .post.card > .card-body,
body.single .post.card > .card-footer,
body.single .post.card .post-content {
    background-color: var(--panel);
    color: var(--ink);
}
body.single .post-content :is(p, div, span, section).has-white-background-color,
body.single .post-content :is(p, div, span, section).bg-white {
    background-color: var(--panel) !important;
}
body.single .post-content :is(pre, blockquote):not(.has-background) {
    background-color: var(--paper);
    color: var(--ink);
}

/* Sidebar search: keep the input and submit action readable in both palettes. */
.sidebar .widget_search .search-form,
.sidebar .wp-block-search .wp-block-search__inside-wrapper {
    display: flex;
    align-items: stretch;
    gap: 0;
}
.sidebar .widget_search .search-form label {
    flex: 1 1 auto;
    min-width: 0;
}
.sidebar .widget_search .search-form .search-field,
.sidebar .wp-block-search .wp-block-search__input {
    min-width: 0;
    min-height: 42px;
    padding: .55rem .8rem;
    color: var(--ink);
    background: var(--paper);
    border: 1px solid var(--rule);
    border-radius: 6px;
}
.sidebar .widget_search .search-form .search-field,
.sidebar .wp-block-search:has(.wp-block-search__button) .wp-block-search__input {
    border-radius: 6px 0 0 6px;
}
.sidebar .widget_search .search-form .search-field::placeholder,
.sidebar .wp-block-search .wp-block-search__input::placeholder { color: var(--muted); opacity: 1; }
.sidebar .widget_search .search-form .search-submit,
.sidebar .wp-block-search .wp-block-search__button {
    position: static;
    flex: none;
    margin: 0;
    padding: .55rem .95rem;
    background: var(--gold);
    color: #151d29;
    border: 1px solid var(--gold);
    border-radius: 0 6px 6px 0;
    font-weight: 600;
    cursor: pointer;
}
.sidebar .widget_search .search-form .search-submit:hover,
.sidebar .wp-block-search .wp-block-search__button:hover { background: #e7d4ae; }
.sidebar .widget_search .search-form input:focus-visible,
.sidebar .wp-block-search :is(input, button):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Article footer panels sit outside the main .post card. */
body.single .post-tags.block,
body.single .list-related .content-related.card {
    background-color: var(--panel);
    border: 1px solid var(--rule);
    border-radius: 8px;
    color: var(--ink);
}
body.single .post-tags > .flex-fill {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    align-items: center;
}
body.single .post-tags .flex-fill > span {
    margin: 0 !important;
    border: 1px solid var(--rule);
    border-radius: 4px;
    padding: .15rem .55rem;
    color: var(--accent) !important;
}
body.single .post-tags a,
body.single .list-related .list-title { color: var(--ink); }
body.single .post-tags a:hover,
body.single .list-related .list-title:hover,
body.single :is(.post-tags, .list-related, .comments) .iconfont.text-primary { color: var(--accent) !important; }
body.single .list-related .list-dots .list-title:before { background-color: var(--gold); }
body.single .list-related .list-title { font-weight: 550; line-height: 1.5; }
body.single .list-related .list-item + .list-item { border-top: 1px solid var(--rule); }
body.single .comments > .mx-1 .text-muted,
body.single .comments .comment-avatar-author a.text-muted { color: var(--muted) !important; }

/* Dark reading surfaces and article metadata. */
body.nice-dark-mode .header nav.navbar { background-color: var(--panel); }
body.nice-dark-mode .post-content h2 { border-left-color: var(--gold); }
body.nice-dark-mode .post-content h3::before { background-color: var(--gold); }
body.nice-dark-mode .kx-byline time { color: var(--muted); }

/* The drawer and its controls follow the active site palette. */
body .header .mobile-sidebar { background: var(--paper); color: var(--ink); }
body .header .mobile-sidebar-menu { background: var(--panel); border-color: var(--rule); box-shadow: none; }
body .header .mobile-sidebar-menu li a { color: var(--ink); opacity: 1; }
body .header .mobile-sidebar-menu .sub-menu { border-left: 1px solid var(--rule); padding-left: .85rem; }
body .header .mobile-sidebar-menu .sub-menu li a { color: var(--muted); }
body .header .mobile-sidebar-menu li:is(.current-menu-item,.current_page_item,.current-menu-ancestor) > a,
body .header .mobile-sidebar-menu li a:is(:hover,:focus-visible,:active),
body .header .mobile-sidebar-menu a[aria-current="page"] { color: var(--accent); background: var(--paper); }
body .header .mobile-sidebar-menu .dropdown-sub-menu { color: var(--accent); }
body .header .mobile-sidebar .btn-icon { background-color: var(--panel); color: var(--ink); border: 1px solid var(--rule); }
body .header .mobile-sidebar .btn-icon:focus-visible,
body .header .mobile-sidebar .btn-icon:hover,
body .header .navbar-toggler { color: var(--accent); }
body .header .mobile-sidebar .text-warning { color: var(--accent) !important; }
body .mobile-overlay { background: rgba(5, 8, 16, .66); }

body.page .kx-page-sheet,
body.page .list-links-item .block,
body.page .list-grouped .list-item.block {
    background: var(--panel);
    color: var(--ink);
    border: 1px solid var(--rule);
    border-radius: 10px;
}
.kx-page-sheet .card-body { padding: clamp(1.15rem, 3.2vw, 3rem); min-width: 0; }
.kx-page-heading { display: flex; flex-wrap: wrap; gap: .75rem; align-items: baseline; border-bottom: 1px solid var(--rule); padding-bottom: 1rem; }
.kx-page-heading h1 { margin: 0; font-size: clamp(1.6rem, 3.4vw, 2.65rem); line-height: 1.25; overflow-wrap: anywhere; }
.kx-page-heading .post-edit-link { font-size: .8rem; color: var(--accent); }
.kx-page-copy { margin-top: 1.4rem; overflow-wrap: anywhere; }
.kx-page-copy:empty { display: none; }
.kx-page-copy > :last-child { margin-bottom: 0; }
.kx-page-copy :is(iframe,video) { max-width: 100%; }
.kx-page-copy pre, .kx-page-copy .wp-block-table { max-width: 100%; overflow-x: auto; }
.kx-page-wide { max-width: 100rem; padding-inline: clamp(.75rem, 3vw, 3rem); }
.kx-page-wide .kx-page-copy > :is(p,h2,h3,h4,ul,ol) { max-width: 76ch; margin-inline: auto; }
body.page .list-grouped .list-item.block { overflow: hidden; }
.kx-profile { max-width: 68rem; }
.kx-profile-head { display:flex; align-items:center; justify-content:space-between; gap:1rem; padding:clamp(1.5rem,5vw,4rem); background:radial-gradient(ellipse at top right,#213955,#080e1b 70%); color:#f5f8ff; border-radius:12px 12px 0 0; }
.kx-profile-head p { color:#ccb585 !important; letter-spacing:.1em; }
.kx-profile-head h1 { font-size:clamp(2.4rem,5vw,4.5rem); line-height:1.1; margin:0; }
.kx-profile-mark { font:bold clamp(2.3rem,7vw,6rem)/1 Georgia,serif; letter-spacing:-.07em; color:#b9c7d7; }
.kx-profile-mark span { color:#ccb585; }
.kx-profile-image { width:clamp(5rem,15vw,10rem); aspect-ratio:1; height:auto; object-fit:cover; border-radius:8px; }
.kx-profile-grid { display:grid; grid-template-columns:minmax(0,1.7fr) minmax(0,1fr); background:var(--panel); border:1px solid var(--rule); border-radius:0 0 12px 12px; }
.kx-profile-story,.kx-profile-index { padding:clamp(1.3rem,3vw,2.6rem); overflow-wrap:anywhere; }
.kx-profile-index { border-left:1px solid var(--rule); }
.kx-profile-index h2 { font-size:1.1rem; margin-bottom:1rem; }
.kx-profile-topics { display:flex; flex-wrap:wrap; gap:.45rem; margin-bottom:2rem; }
.kx-profile-topics a { border:1px solid var(--rule); border-radius:4px; padding:.25rem .6rem; }
.kx-profile-entry { display:block; padding:.7rem 0; border-top:1px solid var(--rule); }
.kx-profile-entry time { display:block; font-size:.75rem; color:var(--muted); }
@media(max-width:700px){.kx-profile-grid{grid-template-columns:1fr}.kx-profile-index{border-left:0;border-top:1px solid var(--rule)}}

.kx-guestbook { max-width: 48rem; margin: auto; }
.kx-guestbook .comment-list, .kx-guestbook .comment-list .children { list-style: none; padding-left: 0; }
.kx-guestbook .comment-list .children { margin-left: clamp(.65rem, 3vw, 2.25rem); }
.kx-guestbook .comment-body { border: 0; margin: 1rem 0; align-items: flex-start; }
.kx-guestbook .comment-body > .comment-text { flex: 0 1 auto !important; min-width: 0; max-width: 85%; }
.kx-guestbook .comment-content { align-self: flex-start; padding: .65rem 1rem; background: var(--paper); border: 1px solid var(--rule); border-radius: 3px 17px 17px; color: var(--ink); overflow-wrap: anywhere; }
.kx-guestbook .comment-content p:last-child { margin-bottom: 0; }
.kx-guestbook .bypostauthor > .comment-body { flex-direction: row-reverse; }
.kx-guestbook .bypostauthor > .comment-body > .vcard { margin: 0 0 0 .65rem !important; }
.kx-guestbook .bypostauthor > .comment-body .comment-info { justify-content: flex-end; }
.kx-guestbook .bypostauthor > .comment-body .comment-content { align-self: flex-end; border-color: var(--gold); border-radius: 17px 3px 17px 17px; }
.kx-guestbook .comment-text .comment-date { color: var(--muted); }

/* Author page: masthead, reading column, and dated article index. */
.kx-profile .kx-profile-head {
    position: relative; isolation: isolate; overflow: hidden;
    min-height: clamp(190px, 23vw, 290px);
    padding-inline: clamp(1.4rem, 5vw, 4rem);
    border: 1px solid #293a51; border-radius: 14px;
    background: radial-gradient(ellipse at 78% 30%, #233d59, transparent 53%), #0a1220;
}
.kx-profile-head::after {
    content: ""; position: absolute; z-index: -1; pointer-events: none;
    width: 54%; height: 140%; right: -3%; top: -26%;
    border: 1px solid #ccb58550; border-radius: 50%; transform: rotate(-28deg) scaleY(.58);
    box-shadow: 0 0 0 15px #a3bbd00a, 0 0 0 46px #a3bbd009;
}
.kx-profile-head h1 { color: #f5f8ff; letter-spacing: -.045em; overflow-wrap: anywhere; }
.kx-profile-head p { display: flex; align-items: center; gap: .7rem; font-size: .85rem; }
.kx-profile-head p::before { content: ""; flex: 0 0 1.8rem; height: 1px; background: #ccb585; }
.kx-profile-head .kx-profile-image { border: 3px solid #ccb585; border-radius: 50%; flex-shrink: 0; }
.kx-profile .kx-profile-grid { gap: clamp(1rem, 2vw, 1.7rem); margin-top: 1.3rem; align-items: start; background: transparent; border: 0; }
.kx-profile-story, .kx-profile-index { min-width: 0; background: var(--panel); border: 1px solid var(--rule); border-radius: 12px; }
.kx-profile-story:only-child { grid-column: 1/-1; }
.kx-profile-story > :last-child { margin-bottom: 0; }
body .kx-profile-story > h2 { padding-left: 0; border: 0; font-size: clamp(1.4rem, 2.5vw, 2rem); }
.kx-profile-index h2 { font-size: 1rem; font-weight: 650; }
.kx-profile-topics a { border-radius: 2rem; font-size: .82rem; padding: .3rem .75rem; }
.kx-profile-index .kx-profile-entry { display: grid; grid-template-columns: 4.8rem 1fr; gap: .5rem; padding: .85rem 0; line-height: 1.55; }
.kx-profile-entry time { padding-top: .16em; font-variant-numeric: tabular-nums; }
body .kx-profile-index a:hover { color: var(--accent); }
@media (max-width: 700px) {
    .kx-profile .kx-profile-head { min-height: 170px; }
    .kx-profile-head .kx-profile-mark { font-size: clamp(2rem, 10vw, 4rem); }
    .kx-profile .kx-profile-grid { margin-top: .8rem; }
}

/* Blend the full portrait into the masthead, preserving its original framing. */
.kx-profile-head:has(.kx-profile-portrait) { min-height: clamp(250px, 30vw, 370px); }
.kx-profile-head:has(.kx-profile-portrait) > div { max-width: 48%; z-index: 1; }
.kx-profile-head:has(.kx-profile-portrait)::after { display: none; }
.kx-profile-head .kx-profile-portrait {
    position: absolute; inset: auto 8% 0 auto;
    height: 100%; width: auto; max-width: 49%; max-height: 100%;
    object-fit: cover; object-position: center 35%;
    border: 0; border-radius: 0;
    mask-image: linear-gradient(to right, transparent, #000 29%, #000 74%, transparent),
                linear-gradient(to bottom, transparent, #000 12%, #000 77%, transparent);
    mask-composite: intersect;
}
@media (max-width: 700px) {
    .kx-profile .kx-profile-head:has(.kx-profile-portrait) { min-height: clamp(200px, 52vw, 270px); }
}

.kx-profile-side-photo { display: block; width: 100%; height: auto; border-radius: 7px; }
.kx-profile-side-photo + h2 { margin-top: 1.6rem; }

.kx-profile-heading { padding: clamp(.7rem, 2vw, 1.5rem) 0 clamp(1rem, 2.5vw, 1.8rem); border-bottom: 1px solid var(--rule); }
.kx-profile-heading p { display: flex; align-items: center; gap: .75rem; margin: 0 0 .6rem; font-size: .8rem; letter-spacing: .08em; color: var(--accent) !important; }
.kx-profile-heading p::before { content: ''; width: 2rem; height: 2px; background: var(--gold); }
.kx-profile-heading h1 { margin: 0; color: var(--ink); font-size: clamp(2rem, 3.8vw, 3.3rem); line-height: 1.16; letter-spacing: -.035em; }
