/*
Theme Name: Gwern TWA
Theme URI: https://techwavearena.com
Author: TechWaveArena
Description: Typography-first theme. Smart dark mode. Built-in SEO, AdSense, floating TOC.
Version: 8.1.2
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 8.0
License: MIT
Text Domain: gwern-twa
*/

:root{
  --font-brand:"Space Grotesk",system-ui,sans-serif;
  --font-body:"Source Serif 4",Georgia,"Times New Roman",serif;
  --font-ui:"Inter",-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  --font-mono:"JetBrains Mono",Consolas,monospace;
  --fs-xs:.72rem;--fs-sm:.84rem;--fs-base:1.05rem;--fs-md:1.2rem;--fs-lg:1.44rem;--fs-xl:1.72rem;--fs-2xl:2.1rem;
  --lh:1.78;--lh-tight:1.22;
  --brand:#0891b2;--brand-pale:rgba(8,145,178,.06);--brand-border:rgba(8,145,178,.2);
  --bg:#fcfcfc;--bg-alt:#f4f4f4;--bg-code:#f0f0f0;--bg-input:#fff;
  --text:#1a1a1a;--text-sec:#444;--text-muted:#777;
  --border:#ccc;--border-lt:#e4e4e4;
  --link:#1a1a1a;--link-hover:#0891b2;
  --shadow:rgba(0,0,0,.06);--shadow-md:rgba(0,0,0,.12);
  --bottom-toc-h:42px;
  --hdr-bg:#fff;--hdr-text:#1a1a1a;--hdr-border:#e4e4e4;
  --max-w:820px;--sidebar-w:240px;--pad:1.5rem;--gap:2rem;
}

/* ═══ DARK MODE — base variables only, JS handles content colors ═══ */
[data-theme="dark"]{
  color-scheme:dark;
  --brand:#22d3ee;--brand-pale:rgba(34,211,238,.08);--brand-border:rgba(34,211,238,.18);
  --bg:#0e0e0e;--bg-alt:#161616;--bg-code:#1a1a1a;--bg-input:#1c1c1c;
  --text:#f1f1f1;--text-sec:#d0d0d0;--text-muted:#999;
  --border:#444;--border-lt:#2a2a2a;
  --link:#f1f1f1;--link-hover:#22d3ee;
  --shadow:rgba(0,0,0,.5);--shadow-md:rgba(0,0,0,.7);
  --hdr-bg:#fff;--hdr-text:#1a1a1a;--hdr-border:#e4e4e4;
}

/* Dark mode: elements that use CSS variables update automatically */
/* Forms need explicit dark styling since browsers default white */
[data-theme="dark"] input,[data-theme="dark"] textarea,[data-theme="dark"] select{
  background:var(--bg-input);color:var(--text);border-color:var(--border);
}
[data-theme="dark"] .site-footer{background:var(--bg-alt);border-color:var(--border-lt)}
[data-theme="dark"] .home-cat-card{background:var(--bg-alt);border-color:var(--border-lt)}
[data-theme="dark"] .floating-toc-panel{background:var(--bg-alt);border-color:var(--border);box-shadow:0 12px 40px rgba(0,0,0,.7)}
[data-theme="dark"] body{background:var(--bg);color:var(--text)}
[data-theme="dark"] .site-content,[data-theme="dark"] .site-sidebar,[data-theme="dark"] .main-wrap,[data-theme="dark"] .featured-card,[data-theme="dark"] .home-section,[data-theme="dark"] .home-cat-card,[data-theme="dark"] .widget,[data-theme="dark"] .breadcrumbs,[data-theme="dark"] .pagination a,[data-theme="dark"] .pagination span,[data-theme="dark"] .comment,[data-theme="dark"] .toc,[data-theme="dark"] .floating-toc-panel,[data-theme="dark"] .post-intro-ad,[data-theme="dark"] .ad-slot--in-article{background:var(--bg-alt);color:var(--text)}
[data-theme="dark"] .featured-card,[data-theme="dark"] .home-cat-card,[data-theme="dark"] .widget,[data-theme="dark"] .comment,[data-theme="dark"] .toc,[data-theme="dark"] .pagination a,[data-theme="dark"] .pagination span{border-color:var(--border-lt)}
[data-theme="dark"] .post-list li,[data-theme="dark"] .comment,[data-theme="dark"] .widget li,[data-theme="dark"] .breadcrumbs,[data-theme="dark"] .tag-list li,[data-theme="dark"] .entry-content p,[data-theme="dark"] .entry-content li,[data-theme="dark"] .entry-content blockquote,[data-theme="dark"] .entry-content table{color:var(--text)}
[data-theme="dark"] .entry-content a,[data-theme="dark"] .site-content a,[data-theme="dark"] .site-sidebar a{color:var(--brand)}
[data-theme="dark"] .entry-content pre,[data-theme="dark"] .entry-content code,[data-theme="dark"] .entry-content kbd,[data-theme="dark"] .entry-content samp{background:#161616;color:var(--text);border-color:var(--border)}
[data-theme="dark"] .entry-content blockquote{background:#131313;border-left-color:var(--brand-border)}
[data-theme="dark"] .entry-content table,[data-theme="dark"] .entry-content th,[data-theme="dark"] .entry-content td{background:#151515;border-color:var(--border)}
[data-theme="dark"] .post-item__title a,[data-theme="dark"] .home-cat-card__title a,[data-theme="dark"] .widget li a{color:var(--text)}
[data-theme="dark"] .post-item__title a:hover,[data-theme="dark"] .home-cat-card__title a:hover,[data-theme="dark"] .widget li a:hover{color:var(--brand)}
.post-intro-ad{margin:1rem 0 1.4rem}

/* ═══ RESET ═══ */
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
::selection{background:var(--brand-pale);color:var(--text)}
html{font-size:100%;scroll-behavior:smooth}
body{font-family:var(--font-ui);font-size:var(--fs-base);line-height:var(--lh);color:var(--text);background:var(--bg);-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility}

/* ═══ HEADER ═══ */
.site-header{position:sticky;top:0;z-index:200;background:var(--hdr-bg);border-bottom:1px solid var(--hdr-border)}
.header-top{max-width:1100px;margin:0 auto;padding:.55rem var(--pad);display:flex;align-items:center;justify-content:space-between;gap:.8rem}.header-left{display:flex;align-items:center;gap:.5rem;min-width:0}
.site-brand{display:flex;align-items:center;gap:.5rem;text-decoration:none;color:var(--hdr-text)}
.site-brand img{max-height:38px;width:auto}
.site-brand__text{font-family:var(--font-brand);font-size:var(--fs-md);font-weight:700;letter-spacing:-.02em;color:var(--hdr-text)}
.header-controls{display:flex;align-items:center;gap:.5rem}
.theme-toggle{background:none;border:1px solid var(--hdr-border);border-radius:6px;padding:.25rem .48rem;cursor:pointer;font-size:var(--fs-sm);color:var(--hdr-text);line-height:1}
.theme-toggle:hover{background:#f0f0f0}

/* ── Search toggle — visible on ALL screens, elastic sizing ── */
.header-search-toggle{display:inline-flex;align-items:center;justify-content:center;background:none;border:1px solid var(--hdr-border);border-radius:6px;padding:clamp(.25rem,.4vw,.45rem) clamp(.3rem,.5vw,.55rem);cursor:pointer;color:var(--hdr-text);line-height:1;flex:0 0 auto;width:clamp(34px,4vw,40px);height:clamp(34px,4vw,40px);transition:all .15s ease}
.header-search-toggle:hover{background:var(--brand-pale);border-color:var(--brand)}
.header-search-toggle:focus-visible{outline:2px solid var(--brand);outline-offset:2px}
.header-search-toggle svg{display:block;width:clamp(16px,2vw,20px);height:clamp(16px,2vw,20px)}

/* ── Search panel — elastic across all screen sizes ── */
.header-search-panel{display:none;z-index:250;background:var(--hdr-bg);border-bottom:1px solid var(--hdr-border);box-shadow:0 4px 16px rgba(0,0,0,.08)}
.header-search-panel.is-open{display:block;padding:clamp(.6rem,1.2vw,.85rem) var(--pad) clamp(.7rem,1.2vw,1rem)}
.header-search-panel .search-form{margin:0;max-width:680px;margin-left:auto;margin-right:auto}
.header-search-panel .search-form input[type="search"]{height:clamp(38px,5vw,44px);font-size:clamp(.85rem,1.2vw,1rem);padding:0 clamp(.6rem,1vw,.75rem)}
.header-search-panel .search-form button,
.header-search-panel .search-form button[type="submit"]{height:clamp(38px,5vw,44px);font-size:clamp(.7rem,1vw,.84rem);min-width:clamp(60px,8vw,90px);padding:0 clamp(.6rem,1vw,1rem)}
/* ── Inline header search — hidden globally (replaced by toggle + panel) ── */
.header-search{display:none!important}

/* ── Dark mode: search panel ── */
[data-theme="dark"] .header-search-panel{background:var(--bg);border-color:var(--border-lt)}
[data-theme="dark"] .header-search-panel .search-form input[type="search"]{background:var(--bg-input);color:var(--text);border-color:var(--border)}

.nav-toggle{display:none;background:none;border:none;cursor:pointer;padding:.2rem;color:var(--hdr-text)}
.tagline-bar{background:var(--hdr-bg);border-bottom:1px solid var(--hdr-border);padding:.18rem var(--pad);text-align:center}
.tagline-bar__inner{max-width:1100px;margin:0 auto;font-size:var(--fs-xs);color:#888;font-style:italic}

/* ═══ NAV ═══ */
.site-nav{background:var(--hdr-bg);border-bottom:1px solid var(--hdr-border)}
.site-nav__inner{max-width:1100px;margin:0 auto;padding:0 var(--pad)}
.primary-menu,.menu{list-style:none;display:flex;flex-wrap:wrap;gap:0;margin:0;padding:0}
.primary-menu>li,.menu>li{position:relative}
.primary-menu>li>a,.menu>li>a{display:block;padding:.48rem .75rem;font-size:var(--fs-sm);font-weight:500;text-decoration:none;color:var(--hdr-text);white-space:nowrap;font-family:var(--font-ui)}
.primary-menu>li>a:hover,.primary-menu>li.current-menu-item>a{background:var(--brand-pale);color:var(--brand)}
.primary-menu>li.menu-item-has-children>a::after{content:"";display:inline-block;width:0;height:0;border-left:3px solid transparent;border-right:3px solid transparent;border-top:3px solid currentColor;margin-left:5px;vertical-align:middle;opacity:.4}
.primary-menu .sub-menu,.menu .sub-menu{list-style:none;position:absolute;top:100%;left:0;z-index:300;min-width:200px;background:#fff;border:1px solid #ddd;border-radius:0 0 8px 8px;box-shadow:0 6px 20px rgba(0,0,0,.1);padding:.2rem 0;opacity:0;visibility:hidden;transform:translateY(-4px);transition:all .12s;pointer-events:none}
.primary-menu>li:hover>.sub-menu,.primary-menu>li:focus-within>.sub-menu,.menu>li:hover>.sub-menu{opacity:1;visibility:visible;transform:translateY(0);pointer-events:auto}
.sub-menu li{list-style:none}
.sub-menu li a{display:block;padding:.35rem .8rem;font-size:var(--fs-sm);color:#333;text-decoration:none}
.sub-menu li a:hover{background:var(--brand-pale);color:var(--brand)}

/* ═══ LAYOUT ═══ */
.site-wrapper{display:flex;flex-direction:column;min-height:100vh}
.main-wrap{max-width:1100px;margin:0 auto;padding:var(--gap) var(--pad);display:grid;grid-template-columns:1fr var(--sidebar-w);gap:var(--gap);align-items:start}
.main-wrap--full{grid-template-columns:1fr;max-width:var(--max-w)}
.site-content{max-width:var(--max-w);width:100%;min-width:0}
.site-sidebar{position:sticky;top:90px;font-size:var(--fs-sm);font-family:var(--font-ui);color:var(--text-sec)}

/* ═══ TYPOGRAPHY ═══ */
h1,h2,h3,h4,h5,h6{font-family:var(--font-brand);font-weight:700;line-height:var(--lh-tight);color:var(--text);margin-top:2rem;margin-bottom:.4rem}
h1{font-size:var(--fs-2xl);letter-spacing:-.03em;margin-top:0}
h2{font-size:var(--fs-xl);letter-spacing:-.015em;padding-bottom:.25rem;border-bottom:1px solid var(--border-lt)}
h3{font-size:var(--fs-lg)}h4{font-size:var(--fs-md)}
.heading-anchor{text-decoration:none;color:var(--brand);opacity:0;margin-left:.2em;font-weight:400}
h2:hover .heading-anchor,h3:hover .heading-anchor{opacity:.5}
p{margin-bottom:1.05rem}
.entry-content{font-family:var(--font-body);font-size:var(--fs-base);line-height:var(--lh);color:var(--text)}
a{color:var(--link);text-decoration-color:var(--border);text-underline-offset:.15em}
a:hover{color:var(--link-hover)}
.entry-content>p:first-of-type::first-letter{float:left;font-family:var(--font-brand);font-size:3.3em;line-height:.78;padding-right:.06em;padding-top:.03em;font-weight:700;color:var(--brand)}
blockquote{margin:1.2rem 0;padding:.45rem 1rem;border-left:3px solid var(--brand);color:var(--text-sec);background:var(--brand-pale);border-radius:0 6px 6px 0;font-style:italic}
blockquote p:last-child{margin-bottom:0}
ul,ol{margin-bottom:1rem;padding-left:1.3rem}li{margin-bottom:.15rem}
code,kbd{font-family:var(--font-mono);font-size:.84em;background:var(--bg-code);color:var(--text);padding:.08em .25em;border-radius:3px}
pre{margin:1.2rem 0;padding:.8rem 1rem;background:var(--bg-code);color:var(--text);border:1px solid var(--border-lt);border-radius:6px;overflow-x:auto;font-size:var(--fs-sm);line-height:1.55}
pre code{background:none;padding:0}
table{width:100%;border-collapse:collapse;margin:1.2rem 0;font-size:var(--fs-sm)}
thead th{font-family:var(--font-ui);font-weight:700;text-align:left;border-bottom:2px solid var(--brand-border);padding:.4rem .5rem;font-size:var(--fs-xs);text-transform:uppercase;letter-spacing:.04em;color:var(--text-muted)}
td{padding:.4rem .5rem;border-bottom:1px solid var(--border-lt)}
tbody tr:hover{background:var(--brand-pale)}
hr{border:none;border-top:1px solid var(--border-lt);margin:2rem 0}
img{max-width:100%;height:auto;display:block}
figure{margin:1.2rem 0}
figcaption{font-family:var(--font-ui);font-size:var(--fs-sm);color:var(--text-muted);margin-top:.3rem;text-align:center}

/* ═══ META ═══ */
.breadcrumbs{font-family:var(--font-ui);font-size:var(--fs-sm);color:var(--text-muted);margin-bottom:1rem}
.breadcrumb-list{list-style:none;display:flex;flex-wrap:wrap;gap:.12rem;padding:0}
.breadcrumb-list a{color:var(--text-sec);text-decoration:none}
.breadcrumb-list a:hover{color:var(--brand)}
.breadcrumb-sep{margin:0 .2rem;color:var(--text-muted)}
.entry-meta{font-family:var(--font-ui);font-size:var(--fs-sm);color:var(--text-muted);margin-bottom:1.2rem;padding-bottom:.55rem;border-bottom:1px solid var(--border-lt);display:flex;flex-wrap:wrap;gap:.25rem .75rem;align-items:center}
.entry-meta__item{display:flex;align-items:center;gap:.15rem}
.entry-meta__label{font-weight:600;text-transform:uppercase;font-size:var(--fs-xs);letter-spacing:.04em;color:var(--brand)}
.entry-meta a{color:var(--text-sec);text-decoration:none}
.entry-meta a:hover{color:var(--brand)}
.author-avatar{width:26px!important;height:26px!important;border-radius:50%!important;object-fit:cover;display:inline-block!important;vertical-align:middle;margin-right:.18rem;border:1.5px solid var(--brand-border)}
.entry-meta img{width:26px!important;height:26px!important;border-radius:50%!important;object-fit:cover}
.tag-list{display:flex;flex-wrap:wrap;gap:.25rem;list-style:none;padding:0;margin:0}
.tag-list a{font-family:var(--font-ui);display:inline-block;font-size:var(--fs-xs);padding:.12rem .38rem;border:1px solid var(--brand-border);border-radius:4px;text-decoration:none;color:var(--text-sec)}
.tag-list a:hover{background:var(--brand);color:#fff;border-color:var(--brand)}

/* ═══ FEATURED / POST LIST ═══ */
.featured-card{margin-bottom:2rem;padding-bottom:1.5rem;border-bottom:1px solid var(--border-lt)}
.featured-card img:not(.author-avatar){width:100%;border-radius:8px;margin-bottom:.6rem}
.post-category{font-family:var(--font-ui);display:inline-block;font-size:var(--fs-xs);font-weight:700;text-transform:uppercase;letter-spacing:.06em;color:var(--brand);margin-bottom:.2rem}
.post-category a{text-decoration:none;color:inherit}
.featured-card h2{border:none;padding:0;margin-top:0;margin-bottom:.3rem}
.featured-card h2 a{text-decoration:none;color:var(--text)}
.featured-card h2 a:hover{color:var(--brand)}
.excerpt{font-family:var(--font-ui);font-size:var(--fs-sm);color:var(--text-sec);line-height:1.55;margin-bottom:.5rem}
.read-more{font-family:var(--font-ui);display:inline-block;font-size:var(--fs-sm);font-weight:600;color:#fff;background:var(--brand);text-decoration:none;padding:.3rem .8rem;border-radius:5px}
.read-more:hover{opacity:.85;color:#fff}
.post-list{list-style:none;padding:0}
.post-item{padding:.6rem 0;border-bottom:1px solid var(--border-lt);display:grid;grid-template-columns:1fr auto;gap:.2rem .7rem;align-items:baseline}
.post-item:last-child{border-bottom:none}
.post-item__title{font-family:var(--font-ui);font-weight:600}
.post-item__title a{text-decoration:none;color:var(--text)}
.post-item__title a:hover{color:var(--brand)}
.post-item__date{font-family:var(--font-mono);font-size:var(--fs-xs);color:var(--text-muted);white-space:nowrap}

/* ═══ HOMEPAGE ═══ */
.home-section{margin-bottom:2rem}
.home-section__title{font-family:var(--font-ui);font-size:var(--fs-xs);font-weight:700;text-transform:uppercase;letter-spacing:.1em;color:var(--brand);margin-bottom:.5rem;padding-bottom:.2rem;border-bottom:2px solid var(--brand-border)}
.home-cats{display:grid;grid-template-columns:repeat(auto-fill,minmax(175px,1fr));gap:.6rem}
.home-cat-card{border:1px solid var(--border-lt);border-radius:8px;padding:.65rem;background:var(--bg)}
.home-cat-card:hover{border-color:var(--brand-border);background:var(--brand-pale)}
.home-cat-card__title{font-family:var(--font-brand);font-weight:600;margin-bottom:.06rem}
.home-cat-card__title a{text-decoration:none;color:var(--text)}
.home-cat-card__title a:hover{color:var(--brand)}
.home-cat-card__count{font-size:var(--fs-xs);color:var(--text-muted);font-family:var(--font-mono)}

/* ═══ ADS ═══ */
.ad-slot{margin:0;text-align:center;overflow:hidden;min-height:0}
.ad-slot--header{margin:.3rem auto 0;max-width:1100px;padding:0 var(--pad);min-height:90px}
.ad-slot--in-article{margin:1.5rem 0;padding:.7rem 0}
.ad-slot--in-article::before{content:"— Sponsored —";display:block;text-align:center;font-size:.55rem;font-weight:600;text-transform:uppercase;letter-spacing:.14em;color:var(--text-muted);margin-bottom:.3rem;opacity:.35;font-family:var(--font-ui)}
.ad-slot--sidebar{margin-bottom:1rem;min-height:250px}
.ad-slot--footer{margin:1.2rem 0 0;min-height:90px}

/* ═══ SIDEBAR ═══ */
.widget{margin-bottom:1.2rem}
.widget-title{font-family:var(--font-ui);font-size:var(--fs-xs);font-weight:700;text-transform:uppercase;letter-spacing:.07em;color:var(--brand);margin-bottom:.35rem;padding-bottom:.15rem;border-bottom:2px solid var(--brand-border)}
.widget ul{list-style:none;padding:0}
.widget li{margin-bottom:.15rem}
.widget li a{font-size:var(--fs-sm);text-decoration:none;color:var(--text-sec)}
.widget li a:hover{color:var(--brand)}
.site-sidebar .ad-slot--sidebar:first-child{margin-bottom:1.2rem}
.site-sidebar .ad-slot--sidebar-top{position:sticky;top:90px;z-index:10}
.toc{margin-bottom:1.2rem}
.toc-title{font-family:var(--font-ui);font-size:var(--fs-xs);font-weight:700;text-transform:uppercase;letter-spacing:.07em;color:var(--brand);margin-bottom:.35rem}
.toc-list{list-style:none;line-height:1.4;padding:0}
.toc-list li{margin-bottom:.1rem}
.toc-list a{text-decoration:none;color:var(--text-sec);display:block;padding:.06rem 0 .06rem .5rem;border-left:2px solid transparent;font-size:var(--fs-sm)}
.toc-list a:hover,.toc-list a.active{color:var(--brand);border-left-color:var(--brand);background:var(--brand-pale)}
.toc-depth-1{padding-left:1rem!important;font-size:var(--fs-xs)!important}
.toc-depth-2{padding-left:1.5rem!important;font-size:var(--fs-xs)!important}

/* ═══ FLOATING TOC ═══ */
.floating-toc-btn{position:fixed;right:16px;top:50%;transform:translateY(-50%);z-index:9999;width:46px;height:46px;border-radius:50%;background:var(--brand);border:none;box-shadow:0 4px 16px rgba(8,145,178,.4);cursor:pointer;display:flex;align-items:center;justify-content:center;color:#fff;opacity:1}
.floating-toc-btn:hover{box-shadow:0 6px 24px rgba(8,145,178,.55);transform:translateY(-50%) scale(1.05)}
.floating-toc-btn.is-hidden{opacity:0;pointer-events:none}
.floating-toc-btn svg{width:20px;height:20px;stroke:#fff;fill:none;stroke-width:2;stroke-linecap:round}
.floating-toc-panel{position:fixed;right:16px;top:50%;transform:translateY(-50%) scale(.92);z-index:10000;width:290px;max-height:55vh;overflow-y:auto;background:var(--bg);color:var(--text);border:1px solid var(--border);border-radius:14px;box-shadow:0 12px 40px var(--shadow-md);padding:.85rem 1rem;opacity:0;pointer-events:none;transition:all .15s ease;scrollbar-width:thin}
.floating-toc-panel.open{opacity:1;pointer-events:auto;transform:translateY(-50%) scale(1)}
.ftoc-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:.4rem;padding-bottom:.25rem;border-bottom:2px solid var(--brand-border)}
.ftoc-title{font-family:var(--font-brand);font-size:var(--fs-sm);font-weight:700;color:var(--brand);text-transform:uppercase;letter-spacing:.04em}
.floating-toc-close{background:none;border:none;cursor:pointer;color:var(--text-muted);font-size:1.3rem;padding:0;line-height:1}
.floating-toc-close:hover{color:var(--text)}
.floating-toc-panel .toc-list{margin:0;padding:0}
.floating-toc-panel .toc-list a{color:var(--text-sec);padding:.18rem 0 .18rem .45rem}
.floating-toc-panel .toc-list a:hover,.floating-toc-panel .toc-list a.active{color:var(--brand);border-left-color:var(--brand);background:var(--brand-pale)}

/* ═══ FORMS ═══ */
input[type="text"],input[type="email"],input[type="url"],input[type="search"],textarea{width:100%;padding:.4rem .55rem;border:1px solid var(--border);border-radius:6px;background:var(--bg-input);color:var(--text);font-family:var(--font-ui);font-size:var(--fs-base);margin-bottom:.5rem}
input:focus,textarea:focus{outline:none;border-color:var(--brand);box-shadow:0 0 0 2px var(--brand-pale)}
textarea{min-height:110px;resize:vertical}
.comment-form .submit,.comment-form button[type="submit"]{font-family:var(--font-ui);font-weight:600;padding:.42rem 1rem;background:var(--brand);color:#fff;border:none;border-radius:6px;cursor:pointer;font-size:var(--fs-sm)}
.comment-form label{font-family:var(--font-ui);font-weight:600;display:block;margin-bottom:.1rem;font-size:var(--fs-sm);color:var(--text)}
.comments-area{margin-top:1.8rem;padding-top:1rem;border-top:1px solid var(--border-lt)}
.comment-list{list-style:none;padding:0}
.comment{padding:.5rem 0;border-bottom:1px solid var(--border-lt)}
.comment-meta{font-size:var(--fs-sm);color:var(--text-muted)}
.comment-meta .fn{font-weight:700;color:var(--text)}

/* ═══ FOOTER ═══ */
.site-footer{margin-top:auto;background:var(--bg-alt);border-top:1px solid var(--border-lt);padding:1.3rem var(--pad)}
.footer-inner{max-width:1100px;margin:0 auto;display:grid;grid-template-columns:1fr 1fr;gap:1rem}
.footer-col__title{font-family:var(--font-brand);font-weight:700;margin-bottom:.4rem;color:var(--text)}
.footer-links{list-style:none;padding:0;display:flex;flex-wrap:wrap;gap:.25rem .6rem}
.footer-links li{list-style:none}
.footer-links a{font-family:var(--font-ui);font-size:var(--fs-sm);color:var(--text-sec);text-decoration:none}
.footer-links a:hover{color:var(--brand)}
.footer-bottom{max-width:1100px;margin:.7rem auto 0;padding-top:.55rem;border-top:1px solid var(--border-lt);display:flex;justify-content:space-between;align-items:center;font-size:var(--fs-sm);color:var(--text-muted)}
.footer-bottom a{color:var(--brand);text-decoration:none}
.pagination{display:flex;justify-content:center;gap:.25rem;margin:1.8rem 0 .7rem;font-size:var(--fs-sm)}
.pagination a,.pagination span{display:inline-flex;align-items:center;justify-content:center;min-width:1.7rem;padding:.25rem .5rem;border:1px solid var(--border);border-radius:4px;text-decoration:none;color:var(--text-sec)}
.pagination a:hover,.pagination .current{background:var(--brand);color:#fff;border-color:var(--brand)}
.search-form{display:flex;align-items:stretch;gap:0;margin-bottom:1.1rem;max-width:100%;width:100%}
.search-form input[type="search"]{flex:1 1 auto;min-width:0;background:var(--bg-input);color:var(--text);border:1px solid var(--border);border-right:none;border-radius:6px 0 0 6px;margin:0;height:2.7rem;padding:.45rem .75rem;box-sizing:border-box;box-shadow:none;-webkit-appearance:none;appearance:none}
.search-form button,
.search-form button[type="submit"]{
  font-family:var(--font-ui);
  font-size:var(--fs-xs);
  font-weight:700;
  padding:0 1rem;
  min-width:5.2rem;
  height:2.7rem;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  background:var(--brand);
  color:#fff;
  border:1px solid var(--brand);
  border-radius:0 6px 6px 0;
  cursor:pointer;
  line-height:1;
  white-space:nowrap;
  appearance:none;
  box-sizing:border-box;
  box-shadow:none;
}
.search-form button:hover{background:var(--brand-border);border-color:var(--brand-border)}
.search-form button:focus-visible{outline:2px solid var(--brand);outline-offset:2px}.header-search-panel .search-form{margin:0}
.error-404{text-align:center;padding:3rem 0}
.error-404__code{font-family:var(--font-mono);font-size:4rem;font-weight:800;color:var(--brand-border)}
.error-404__title{font-family:var(--font-brand);font-size:var(--fs-xl);margin:.7rem 0;color:var(--text)}
#reading-progress{position:fixed;top:0;left:0;height:2.5px;background:var(--brand);z-index:999;width:0;pointer-events:none;will-change:width}

/* ═══ HIDE SIDEBAR SEARCH ON DESKTOP ═══ */
.site-sidebar .widget_search{display:none}

/* ═══ RESPONSIVE ═══ */
@media(max-width:960px){.main-wrap{grid-template-columns:1fr}.site-sidebar{position:static}.footer-inner{grid-template-columns:1fr}}
@media(max-width:680px){:root{--pad:1rem;--fs-base:1rem}.tagline-bar{display:none}.site-nav{display:none}.site-nav.open{display:block;position:absolute;top:50px;left:0;right:0;background:#fff;color:#1a1a1a;border-bottom:1px solid #ddd;box-shadow:0 6px 18px rgba(0,0,0,.08);z-index:250;max-height:80vh;overflow-y:auto}.site-nav.open .primary-menu,.site-nav.open .menu{flex-direction:column;padding:.2rem 0}.site-nav.open .primary-menu>li>a{padding:.55rem 1rem;border-bottom:1px solid #f0f0f0}.site-nav.open .sub-menu{position:static;opacity:1;visibility:visible;transform:none;box-shadow:none;border:none;background:#f8f8f8;padding:0;pointer-events:auto;border-radius:0}.site-nav.open .sub-menu a{padding-left:1.6rem}.nav-toggle{display:block}.header-search-panel{display:block;padding:.7rem var(--pad) .85rem;background:var(--hdr-bg);border-bottom:1px solid var(--hdr-border)}.header-search-panel[hidden]{display:none!important}.header-search-panel .search-form{margin:0;max-width:none}.post-item{grid-template-columns:1fr}.home-cats{grid-template-columns:1fr 1fr}.footer-bottom{flex-direction:column;gap:.2rem;text-align:center}.floating-toc-btn{right:12px;width:42px;height:42px}.floating-toc-panel{right:12px;left:14px;right:14px;width:auto;max-width:none}.search-form{grid-template-columns:minmax(0,1fr) auto}.search-form input[type="search"]{min-height:2.5rem}.search-form button,.search-form button[type="submit"]{min-height:2.5rem;padding:0 .9rem;min-width:4.8rem}}
@media(max-width:420px){.home-cats{grid-template-columns:1fr}}
@media print{.site-header,.site-nav,.tagline-bar,.site-sidebar,.site-footer,.ad-slot,.theme-toggle,.comments-area,.nav-toggle,#reading-progress,.floating-toc-btn,.floating-toc-panel{display:none!important}body{font-size:11pt;color:#000;background:#fff}.main-wrap{display:block;max-width:100%;padding:0}}
.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}
.skip-link{position:absolute;top:-100%;left:0;background:var(--brand);color:#fff;padding:.4rem .8rem;z-index:1000;font-weight:600}.skip-link:focus{top:0}
:focus-visible{outline:2px solid var(--brand);outline-offset:2px}


/* ==== AdSense Labels ==== */
.ad-slot::before,
.post-intro-ad::before {
  content: "Advertisement";
  display: block;
  font-size: 12px;
  color: #888;
  margin-bottom: 6px;
  text-align: center;
}

/* In-article ad spacing */
.ad-slot--in-article {
  margin: 24px 0;
  text-align: center;
}


/* ===== Advanced Ad Management ===== */
.ad-slot{margin:1rem 0;text-align:center}
.ad-label{font-family:var(--font-ui);font-size:11px;letter-spacing:.08em;text-transform:uppercase;color:var(--text-muted);margin:0 0 .35rem;line-height:1}
.ad-slot--header,.ad-slot--sidebar,.ad-slot--footer,.ad-slot--feed,.ad-slot--in-article{width:100%}
.ad-slot--feed{margin:1.1rem 0 1.4rem;padding:.25rem 0;border-top:1px solid var(--border-lt);border-bottom:1px solid var(--border-lt)}
.ad-slot--in-article{margin:1.2rem 0 1.5rem}
.post-item--ad{list-style:none;margin:0;padding:0}
.post-item--ad .ad-slot{margin:.8rem 0}
@media (max-width: 768px){
  .ad-slot--sidebar{display:none}
}

/* ═══════════════════════════════════════════════════════════
   ★ WITHOUT DISTURB MODE — Ultra-subtle, elite ad styling
   ═══════════════════════════════════════════════════════════
   Ads blend seamlessly into the content. No borders, no labels,
   no background highlights, no visual separation. Just clean.
   ═══════════════════════════════════════════════════════════ */

/* Hide ALL labels in disturb-free mode */
body.without-disturb-mode .gwa-disturb-free .ad-label,
body.without-disturb-mode .gwa-disturb-free::before {
  display: none !important;
  content: none !important;
}

/* Base container — invisible, zero visual footprint */
body.without-disturb-mode .gwa-disturb-free {
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  text-align: left;
  line-height: 0;
  font-size: 0;
  overflow: hidden;
}

/* Mid-article ad — blends like a natural content break */
body.without-disturb-mode .gwa-disturb-free--mid-article {
  margin: 2.2rem 0;
}

/* After-content ad — sits naturally at the end */
body.without-disturb-mode .gwa-disturb-free--after-content {
  margin: 2rem 0 1rem;
}

/* The ins element itself — no decorations */
body.without-disturb-mode .gwa-disturb-free ins.adsbygoogle {
  display: block;
  background: transparent;
  border: none;
  outline: none;
  box-shadow: none;
  padding: 0;
  margin: 0;
  width: 100%;
}

/* Dark mode — keep ads transparent */
[data-theme="dark"] body.without-disturb-mode .gwa-disturb-free {
  background: transparent;
}
[data-theme="dark"] body.without-disturb-mode .gwa-disturb-free ins.adsbygoogle {
  background: transparent;
}

/* Mobile — ensure no overflow or extra spacing */
@media (max-width: 768px) {
  body.without-disturb-mode .gwa-disturb-free--mid-article {
    margin: 1.6rem 0;
  }
  body.without-disturb-mode .gwa-disturb-free--after-content {
    margin: 1.2rem 0;
  }
}

.ad-after-toc { margin:20px 0; text-align:center; }
.ad-label { font-size:12px; color:#888; margin-bottom:6px; }


/* ═══ GWERN-STYLE ARTICLE LAYOUT ═══ */
.single-post .main-wrap{max-width:1200px;gap:2.5rem;align-items:flex-start}
.single-post .site-content{max-width:900px;margin:0 auto;width:100%}
.single-post article{max-width:880px;margin:0 auto;padding:0 0 1rem}
.single-post .post-category{display:inline-flex;align-items:center;margin:0 auto .85rem;padding:.18rem .7rem;border:1px solid var(--border-lt);border-radius:999px;background:var(--bg-alt);font-family:var(--font-ui);font-size:var(--fs-xs);letter-spacing:.08em;text-transform:uppercase}
.single-post header{text-align:center}
.single-post .entry-title{font-family:var(--font-brand);font-size:clamp(2.4rem,5vw,4.45rem);line-height:.95;letter-spacing:-.045em;text-wrap:balance;max-width:13ch;margin:1rem auto .6rem}
.single-post .entry-meta{justify-content:center;flex-wrap:wrap;gap:.7rem;margin:0 0 1.2rem;font-size:var(--fs-sm)}
.single-post .entry-meta__item{padding:0 .25rem}
.single-post .entry-content{font-size:clamp(1.05rem,1vw + .95rem,1.18rem);line-height:1.85;max-width:none;margin:0 auto;padding:.7rem .9rem}
.single-post .entry-content p{margin-bottom:1.15rem}
.single-post .entry-content h2,
.single-post .entry-content h3,
.single-post .entry-content h4{margin-top:2.6rem;text-align:center;text-wrap:balance}
.single-post .entry-content h2{font-size:clamp(1.55rem,2vw,2.05rem)}
.single-post .entry-content h3{font-size:clamp(1.25rem,1.7vw,1.55rem)}
.single-post .entry-content img,
.single-post .entry-content figure,
.single-post .entry-content iframe,
.single-post .entry-content video{display:block;max-width:100%;height:auto;margin:1.4rem auto}
.single-post .entry-content figure{padding:0}
.single-post .entry-content figcaption{font-family:var(--font-ui);font-size:var(--fs-xs);color:var(--text-muted);text-align:center;margin-top:.4rem}
.single-post .entry-content blockquote{max-width:unset;margin:1.5rem 0;padding:.7rem 1.05rem}
.single-post .entry-content table{font-size:var(--fs-sm)}
.single-post .tag-list{justify-content:center}
.single-post .post-intro-ad,
.single-post .ad-after-toc{max-width:860px;margin:1.4rem auto 1.6rem}
.single-post .ad-label{font-size:11px;letter-spacing:.12em;text-transform:uppercase;text-align:center;color:var(--text-muted);margin-bottom:.35rem}
.single-post .toc{padding:1rem 1rem .75rem;border:1px solid var(--border-lt);border-radius:12px;background:var(--brand-pale)}
.single-post .toc-title{font-size:var(--fs-sm);text-align:center}
.single-post .toc-list a{font-size:var(--fs-sm)}
.single-post .floating-toc-panel .toc-list a{border-radius:6px}
.single-post nav[style]{max-width:880px;margin:1.25rem auto 0;text-align:center}
.single-post .navigation.post-navigation .nav-links,
.single-post .post-navigation .nav-links{display:flex;gap:1rem;justify-content:space-between;align-items:flex-start}
.single-post .post-navigation a{display:block;padding:.9rem 1rem;border:1px solid var(--border-lt);border-radius:12px;background:var(--bg-alt)}
.single-post .post-navigation .nav-previous,
.single-post .post-navigation .nav-next{flex:1}
.single-post .post-navigation .entry-meta__label{display:block;margin-bottom:.2rem;font-size:var(--fs-xs);text-transform:uppercase;letter-spacing:.08em;color:var(--text-muted)}
.single-post .comment{max-width:880px;margin:1.6rem auto 0}
.single-post .breadcrumbs{max-width:880px;margin:0 auto 1rem;text-align:center}

/* Mobile TOC / section bar like Gwern */
.mobile-toc-slot{display:none}
.mobile-section-bar{display:none}

@media (max-width: 768px){
  .single-post .site-content{width:100%;overflow-x:hidden}
  .single-post .main-wrap{overflow-x:hidden}
  .single-post .sidebar,
  .single-post .site-sidebar{display:none}

  /* Hide the desktop floating TOC UI on mobile; only keep the bottom section bar */
  .floating-toc-btn,
  .floating-toc-panel{display:none!important}

  .mobile-toc-slot{display:none!important}

  .mobile-section-bar{
    display:flex;
    align-items:center;
    justify-content:center;
    gap:.5rem;
    position:fixed;
    left:0;
    right:0;
    bottom:0;
    z-index:300;
    min-height:44px;
    padding:.45rem .9rem calc(.45rem + env(safe-area-inset-bottom));
    background:rgba(255,255,255,.98);
    backdrop-filter:blur(8px);
    border-top:1px solid #cfcfcf;
    box-shadow:none;
    font-family:var(--font-body);
    overflow:hidden;
    cursor:pointer;
  }
  .mobile-section-bar.open{border-top-color:var(--brand)}
  [data-theme="dark"] .mobile-section-bar{background:rgba(16,16,16,.96);border-top-color:var(--border-lt)}
  .mobile-section-bar__label{display:none}
  .mobile-section-bar__current{
    font-size:var(--fs-base);
    line-height:1.1;
    font-weight:700;
    color:var(--text);
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    min-width:0;
    text-align:center;
    letter-spacing:.01em;
  }
  .mobile-section-bar__chev{font-size:.75rem;opacity:.8;transform:translateY(-1px)}
  .mobile-section-bar.open .mobile-section-bar__chev{transform:translateY(-1px) rotate(180deg)}
  .mobile-section-panel{
    position:fixed;
    left:0;
    right:0;
    bottom:calc(44px + env(safe-area-inset-bottom));
    z-index:299;
    max-height:min(48vh,420px);
    background:rgba(255,255,255,.985);
    border-top:1px solid #d6d6d6;
    box-shadow:0 -10px 30px rgba(0,0,0,.1);
    padding:.7rem .8rem .9rem;
    overflow-y:auto;
    -webkit-overflow-scrolling:touch;
    scrollbar-width:thin;
    scrollbar-color:var(--border) transparent;
  }
  .mobile-section-panel::-webkit-scrollbar{width:8px}
  .mobile-section-panel::-webkit-scrollbar-thumb{background:var(--border);border-radius:999px}
  .mobile-section-panel::-webkit-scrollbar-track{background:transparent}
  [data-theme="dark"] .mobile-section-panel{background:rgba(18,18,18,.985);border-top-color:var(--border-lt);box-shadow:0 -10px 30px rgba(0,0,0,.45)}
  .mobile-section-panel__header{display:flex;align-items:center;justify-content:space-between;gap:.5rem;margin-bottom:.45rem;padding-bottom:.35rem;border-bottom:1px solid var(--border-lt)}
  .mobile-section-panel__title{font-family:var(--font-ui);font-size:var(--fs-xs);font-weight:700;text-transform:uppercase;letter-spacing:.08em;color:var(--brand)}
  .mobile-section-panel__close{background:none;border:none;color:var(--text-muted);font-size:1.5rem;line-height:1;cursor:pointer;padding:0 0 .1rem}
  .mobile-section-panel__close:hover{color:var(--text)}
  .mobile-section-panel .toc-list{margin:0;padding:0}
  .mobile-section-panel .toc-list a{display:block;padding:.35rem .45rem;border-left:2px solid transparent;border-bottom:1px solid transparent}
  .mobile-section-panel .toc-list a:hover,.mobile-section-panel .toc-list a.active{background:var(--brand-pale);border-left-color:var(--brand);color:var(--brand)}
  body{padding-bottom:3.2rem}
}
/* Keep title/article colors sane when toggling modes */
.single-post .entry-title,
.single-post .entry-meta,
.single-post .post-category,
.single-post .entry-meta a,
.single-post .post-navigation a,
.single-post .toc,
.single-post .toc a{color:var(--text)}
.single-post .post-category a,
.single-post .post-navigation a:hover,
.single-post .toc a:hover{color:var(--brand)}

@media (max-width:768px){html,body{overflow-x:hidden;width:100%;max-width:100%}.site,.main-wrap,.site-content{overflow-x:hidden;max-width:100%}img,figure,pre,table,iframe{max-width:100%}}

html,body{overflow-x:hidden;max-width:100%}
@media (max-width:768px){
  .site-wrapper,.main-wrap,.site-content,article{max-width:100%;overflow-x:hidden}
  body{overscroll-behavior-x:none;touch-action:pan-y}
}

/* ═══════════════════════════════════════════════════════════════
   GWERN-STYLE ARTICLE HEADER
   ─────────────────────────────────────────────────────────────── */

/* ── Title ── */
.gwern-title {
  font-family: var(--font-body);
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  font-weight: 700;
  letter-spacing: .01em;
  text-align: center;
  margin: 1.2rem auto .7rem;
  line-height: 1.15;
  text-transform: uppercase;
  font-variant: small-caps;
  max-width: 28ch;
  color: var(--text);
}

/* ── Tags: italic monospace, comma-separated, dotted underline ── */
.gwern-tags {
  text-align: center;
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  font-style: italic;
  line-height: 1.9;
  margin-bottom: .9rem;
  color: var(--text-sec);
}
.gwern-tags a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: .18em;
  text-decoration-color: var(--border);
}
.gwern-tags a:hover { color: var(--brand); text-decoration-color: var(--brand); }

/* ── Abstract: centered italic ── */
.gwern-abstract {
  font-family: var(--font-body);
  font-size: var(--fs-base);
  font-style: italic;
  text-align: center;
  line-height: 1.75;
  color: var(--text);
  margin: 0 auto 1rem;
  max-width: 54ch;
}

/* ── Metadata strip ── */
.gwern-meta {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--text-muted);
  text-align: center;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: .1rem .28rem;
  margin-bottom: 1.2rem;
  line-height: 2;
}
.gwern-meta__sep { opacity: .35; margin: 0 .05rem; }
.gwern-meta__dates { font-weight: 600; color: var(--text-sec); }
.gwern-meta__status em { font-style: normal; }
.gwern-meta__label {
  text-decoration: none;
  border-bottom: 1px dashed var(--border);
  color: var(--text-muted);
  transition: color .12s;
}
.gwern-meta__label:hover { color: var(--brand); border-bottom-color: var(--brand); }
.gwern-meta__action {
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 1px dashed var(--border);
  transition: color .12s;
}
.gwern-meta__action:hover { color: var(--brand); border-bottom-color: var(--brand); }
.gwern-meta__item { display: inline-flex; align-items: baseline; gap: .15rem; }

/* ══════════════════════════════════════════════════
   TWO-COLUMN TOC TABLE  — matches Gwern screenshot
   ══════════════════════════════════════════════════ */
.gwern-toc-table {
  display: block;
  /* Thin visible border — slightly darker than bg-alt, matching screenshot */
  border: 1px solid #c8c8c8;
  border-radius: 2px;
  /* Margin from all sides so it doesn't touch the content edges */
  margin: 0 0 1.8rem 0;
  overflow: hidden;
  font-family: var(--font-ui);
  font-size: var(--fs-sm);
  /* Off-white bg — matches Gwern's subtle box */
  background: #f8f8f8;
}

.gwern-toc-col {
  padding: .75rem .85rem;
}
.gwern-toc-col:first-child {
  border-right: 1px solid #c8c8c8;
}

/* Reset all inherited toc-list styles inside gwern-toc-table */
.gwern-toc-table .toc-list {
  padding: 0;
  list-style: none;
}
.gwern-toc-table .toc-list li {
  margin-bottom: .22rem;
  line-height: 1.35;
}

/*
  The TOC is a FLAT list — every <li> is a direct child of .toc-list.
  Depth is set via class: toc-depth-0 = h2 (bold), toc-depth-1 = h3, toc-depth-2 = h4
*/

/* h2 items: bold, full text color, no indent, no left border */
.gwern-toc-table .toc-list .toc-depth-0 > a {
  display: block;
  font-weight: 700;
  font-size: var(--fs-sm);
  color: #1a1a1a;
  text-decoration: none;
  padding: .04rem 0;
  border-left: none;
  background: none;
  margin-top: .35rem;
}
.gwern-toc-table .toc-list .toc-depth-0:first-child > a { margin-top: 0; }

/* h3 items: regular weight, slightly muted, 1rem indent */
.gwern-toc-table .toc-list .toc-depth-1 > a {
  display: block;
  font-weight: 400;
  font-size: var(--fs-xs);
  color: #555;
  text-decoration: none;
  padding: .04rem 0 .04rem 1rem;
  border-left: none;
  background: none;
}

/* h4 items: lighter still, more indent */
.gwern-toc-table .toc-list .toc-depth-2 > a {
  display: block;
  font-weight: 400;
  font-size: var(--fs-xs);
  color: #777;
  text-decoration: none;
  padding: .04rem 0 .04rem 1.8rem;
  border-left: none;
  background: none;
}

/* Hover states */
.gwern-toc-table .toc-list a:hover {
  color: var(--brand) !important;
  background: none !important;
  border-left: none !important;
}

/* Active scroll-spy state */
.gwern-toc-table .toc-list a.active {
  color: var(--brand) !important;
  background: none !important;
  border-left: none !important;
  font-weight: 600 !important;
}

/* ── Footer tags ── */
.gwern-footer-tags {
  margin-top: 1.4rem;
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}

/* ══ DARK MODE — Gwern header ══ */
[data-theme="dark"] .gwern-title { color: var(--text); }
[data-theme="dark"] .gwern-abstract { color: var(--text); }
[data-theme="dark"] .gwern-tags { color: var(--text-sec); }
[data-theme="dark"] .gwern-tags a { color: var(--text); text-decoration-color: var(--border); }

[data-theme="dark"] .gwern-toc-table {
  background: #1a1a1a;
  border-color: #3a3a3a;
}
[data-theme="dark"] .gwern-toc-col:first-child {
  border-right-color: #3a3a3a;
}
[data-theme="dark"] .gwern-toc-table .toc-list .toc-depth-0 > a {
  color: #f1f1f1;
}
[data-theme="dark"] .gwern-toc-table .toc-list .toc-depth-1 > a {
  color: #aaa;
}
[data-theme="dark"] .gwern-toc-table .toc-list .toc-depth-2 > a {
  color: #888;
}


/* ═══════════════════════════════════════════════════════════════
   BOTTOM TOC BAR  — sticky, full-width, progress-integrated
   ─────────────────────────────────────────────────────────────── */

.bottom-toc-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 500;
  min-height: 42px; height: auto;
  background: var(--bg);
  border-top: 1px solid var(--border-lt);
  cursor: pointer;
  user-select: none;
  /* subtle shadow up */
  box-shadow: 0 -2px 12px var(--shadow);
  display: flex;
  align-items: stretch;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  transition: background .15s;
}
.bottom-toc-bar:hover { background: var(--brand-pale); }

/* Progress bar sits at the very top edge of the bar */
.bottom-toc-bar__progress {
  position: absolute;
  top: 0;
  left: 0;
  height: 2px;
  width: 0%;
  background: var(--brand);
  transition: width .1s linear;
  pointer-events: none;
  z-index: 1;
}

/* Inner layout: title left, section+chev right */
.bottom-toc-bar__inner {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: .45rem 1rem;
  gap: .55rem;
  position: relative;
  z-index: 2;
}
.bottom-toc-bar__section-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .38rem;
  flex: 1 1 auto;
  min-width: 0;
  max-width: min(100%, 60rem);
}
.bottom-toc-bar__section {
  font-family: var(--font-ui);
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--text);
  min-width: 0;
  flex: 0 1 auto;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}
.bottom-toc-bar__chev {
  font-size: .65rem;
  color: var(--text-muted);
  transition: transform .2s;
  flex-shrink: 0;
  line-height: 1;
  margin-top: 0;
}
/* Chevron flips when panel is open */
.bottom-toc-bar.is-open .bottom-toc-bar__chev {
  transform: rotate(180deg);
}

/* ── Panel slides up above the bar ── */
.bottom-toc-panel {
  position: fixed;
  bottom: 42px; /* sits right above the bar */
  left: 50%;
  right: auto;
  z-index: 499;
  width: min(760px, calc(100vw - 1.5rem));
  max-height: 60vh;
  overflow-y: auto;
  background: var(--bg);
  border-top: 1px solid var(--border-lt);
  box-shadow: 0 -4px 24px var(--shadow-md);
  border-radius: 12px 12px 0 0;

  /* Animation: slide up from bar */
  transform: translate(-50%, 100%);
  transition: transform .22s cubic-bezier(.22,1,.36,1);
  /* hidden state managed by hidden attr + transform */
}
.bottom-toc-panel:not([hidden]) {
  transform: translate(-50%, 0);
}
/* Override hidden to allow CSS animation */
.bottom-toc-panel[hidden] {
  display: block !important;  /* keep in flow for animation */
  transform: translate(-50%, 100%);
  pointer-events: none;
  visibility: hidden;
}
.bottom-toc-panel.is-open {
  transform: translate(-50%, 0);
  pointer-events: auto;
  visibility: visible;
}

.bottom-toc-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .55rem 1rem .4rem;
  border-bottom: 1px solid var(--border-lt);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 2;
}
.bottom-toc-panel__title {
  font-family: var(--font-ui);
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: calc(100% - 2.5rem);
}
.bottom-toc-panel__close {
  background: none;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  color: var(--text-muted);
  padding: .2rem .3rem;
  line-height: 1;
  flex-shrink: 0;
}
.bottom-toc-panel__close:hover { color: var(--text); }

.bottom-toc-panel__body {
  padding: .4rem .9rem .9rem;
}
/* Style TOC links inside the panel — clean, no left-border coloring from sidebar styles */
.bottom-toc-panel__body .toc-list {
  padding: 0;
  list-style: none;
}
.bottom-toc-panel__body .toc-list li { margin-bottom: .2rem; }
.bottom-toc-panel__body .toc-list a {
  font-size: var(--fs-sm);
  padding: .18rem 0 .18rem .5rem;
  color: var(--text-sec);
  border-left: 2px solid transparent;
  border-radius: 0;
  background: none;
}
.bottom-toc-panel__body .toc-list a:hover,
.bottom-toc-panel__body .toc-list a.active {
  color: var(--brand);
  border-left-color: var(--brand);
  background: var(--brand-pale);
}
/* Depth indents inside panel */
.bottom-toc-panel__body .toc-list .toc-depth-1 > a { padding-left: 1.2rem; font-size: var(--fs-xs); }
.bottom-toc-panel__body .toc-list .toc-depth-2 > a { padding-left: 2rem;   font-size: var(--fs-xs); color: var(--text-muted); }

/* ══ DARK MODE — floating TOC button ══
   The button already uses var(--brand) which flips to #22d3ee in dark.
   Override icon stroke and bg explicitly so it's clean on dark bg. */
[data-theme="dark"] .floating-toc-btn {
  background: #1e1e1e;
  border: 1.5px solid #3a3a3a;
  box-shadow: 0 4px 16px rgba(0,0,0,.6);
}
[data-theme="dark"] .floating-toc-btn:hover {
  background: #2a2a2a;
  box-shadow: 0 6px 20px rgba(34,211,238,.25);
}
[data-theme="dark"] .floating-toc-btn svg {
  stroke: var(--brand); /* cyan brand in dark */
}

/* ══ DARK MODE — bottom TOC bar ══ */
[data-theme="dark"] .bottom-toc-bar {
  background: #0e0e0e;
  border-top: 1px solid #2a2a2a;
  box-shadow: 0 -2px 12px rgba(0,0,0,.6);
}
[data-theme="dark"] .bottom-toc-bar:hover {
  background: #161616;
}
[data-theme="dark"] .bottom-toc-bar__title {
  color: #666;
}
[data-theme="dark"] .bottom-toc-bar__section {
  color: #e0e0e0;
}
[data-theme="dark"] .bottom-toc-bar__chev {
  color: #555;
}
[data-theme="dark"] .bottom-toc-bar__progress {
  background: var(--brand); /* stays cyan */
}

/* ══ DARK MODE — bottom TOC panel ══ */
[data-theme="dark"] .bottom-toc-panel {
  background: #111;
  border-top: 1px solid #2a2a2a;
  box-shadow: 0 -6px 32px rgba(0,0,0,.8);
}
[data-theme="dark"] .bottom-toc-panel__header {
  background: #111;
  border-bottom: 1px solid #2a2a2a;
}
[data-theme="dark"] .bottom-toc-panel__title {
  color: #e0e0e0;
}
[data-theme="dark"] .bottom-toc-panel__close {
  color: #666;
}
[data-theme="dark"] .bottom-toc-panel__close:hover {
  color: #e0e0e0;
}
/* TOC links inside panel in dark mode */
[data-theme="dark"] .bottom-toc-panel__body .toc-list a {
  color: #ccc;
  border-left-color: transparent;
}
[data-theme="dark"] .bottom-toc-panel__body .toc-list a:hover,
[data-theme="dark"] .bottom-toc-panel__body .toc-list a.active {
  color: var(--brand);
  border-left-color: var(--brand);
  background: rgba(34,211,238,.06);
}

/* ── Prevent body from hiding content behind bar ── */
body { padding-bottom: var(--bottom-toc-h,42px); }

/* ── Remove old mobile-section-bar since bottom-toc-bar replaces it ── */
.mobile-section-bar,
.mobile-section-panel { display: none !important; }

/* ── Hide reading-progress div appended by JS (bar replaces it) ── */
#reading-progress { display: none !important; }

/* ── Desktop: keep bottom bar but slightly narrower centered ── */
@media (min-width: 769px) {
  .bottom-toc-bar,
  .bottom-toc-panel {
    max-width: 100%;
  }
  .bottom-toc-bar__section { max-width: min(70vw, 52rem); }
  .bottom-toc-panel { width: min(760px, calc(100vw - 2rem)); }
}

/* ═══════════════════════════════════════════════════════════════
   COT BULLETIN — chain-of-thought abstract callout
   ─────────────────────────────────────────────────────────────── */
.cot-bulletin {
  position: relative;
  margin: 0 0 1.6rem 0;
  padding: .8rem 1rem .8rem 1.1rem;
  /* Thin left accent + full border matching article box */
  border: 1px solid #d4d0c8;
  border-left: 3px solid #8a8070; /* warm sepia accent — Gwern earthy tone */
  border-radius: 2px;
  background: #faf9f6;            /* warm off-white — same Gwern parchment feel */
  font-family: var(--font-body);
}
.cot-bulletin__label {
  display: block;
  font-family: var(--font-ui);
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: #8a8070;
  margin-bottom: .28rem;
}
.cot-bulletin__body {
  font-style: italic;
  font-size: var(--fs-base);
  line-height: 1.72;
  color: var(--text);
  margin: 0;
}

/* Dark mode */
[data-theme="dark"] .cot-bulletin {
  background: #161410;
  border-color: #3a3630;
  border-left-color: #7a7060;
}
[data-theme="dark"] .cot-bulletin__label { color: #9a8870; }
[data-theme="dark"] .cot-bulletin__body  { color: var(--text); }


/* ═══════════════════════════════════════════════════════════════
   ARTICLE CONTENT — thin border + margin on all sides
   ─────────────────────────────────────────────────────────────── */
.entry-content {
  border: 1px solid var(--border-lt);
  border-radius: 2px;
  padding: .85rem 1rem;
  margin: 0 0 1rem 0;
  /* Ensure border doesn't bleed into sidebar grid */
  min-width: 0;
  box-sizing: border-box;
}

/* Dark mode — slightly stronger border so it reads on dark bg */
[data-theme="dark"] .entry-content {
  border-color: #2e2e2e;
}


/* ═══════════════════════════════════════════════════════════════
   READING-PROGRESS % in meta strip
   ─────────────────────────────────────────────────────────────── */
.gwern-meta__readtime {
  color: var(--text-muted);
}
.gwern-meta__readpct {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  min-width: 5ch;
  text-align: left;
}
/* Highlight once reading starts */
.gwern-meta__readpct.is-reading {
  color: var(--brand);
}


/* ═══════════════════════════════════════════════════════════════
   THEME TOGGLE — locked appearance, does NOT change with dark mode
   The header intentionally stays white; the toggle always looks
   the same so it's a stable target regardless of current theme.
   ─────────────────────────────────────────────────────────────── */
.theme-toggle {
  background: #fff !important;
  border: 1px solid #d8d8d8 !important;
  color: #333 !important;
  border-radius: 6px;
  padding: .25rem .48rem;
  cursor: pointer;
  font-size: var(--fs-sm);
  line-height: 1;
  /* No transition so it doesn't "switch" visually */
  transition: none !important;
}
.theme-toggle:hover {
  background: #f0f0f0 !important;
  border-color: #bbb !important;
}
/* Also lock the icon so it stays readable */
#themeIcon {
  color: #333 !important;
}

/* ═══════════════════════════════════════════════════════════════
   ✦ STAR — shared token used in all TOC titles
   ═══════════════════════════════════════════════════════════════ */
.toc-star {
  color: var(--brand);
  font-size: 1em;          /* full size — same as surrounding text */
  line-height: 1;
  display: inline-block;
  vertical-align: middle;
  margin-right: .22em;
  opacity: 1;
}

/* ✦ bullet before EVERY toc link — bright, visible */
.toc-list a::before {
  content: "✦";
  display: inline-block;
  font-size: .75em;        /* larger — clearly readable */
  line-height: 1;
  vertical-align: middle;
  margin-right: .32em;
  opacity: 1;              /* fully opaque — no fade */
  color: var(--brand);
}
/* Sub-items: slightly smaller star, still fully visible */
.toc-list .toc-depth-1 > a::before,
.toc-list .toc-depth-2 > a::before {
  opacity: .65;
  font-size: .62em;
}


/* ═══════════════════════════════════════════════════════════════
   GWERN ARTICLE HEADER — title, tags, abstract, meta
   ═══════════════════════════════════════════════════════════════ */
.gwern-title {
  font-family: var(--font-body);
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
  font-variant: small-caps;
  letter-spacing: .01em;
  line-height: 1.15;
  margin: 1.2rem auto .7rem;
  max-width: 28ch;
  color: var(--text);
}
.gwern-tags {
  text-align: center;
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  font-style: italic;
  line-height: 1.9;
  margin-bottom: .9rem;
  color: var(--text-sec);
}
.gwern-tags a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: .18em;
  text-decoration-color: var(--border);
}
.gwern-tags a:hover { color: var(--brand); }

.gwern-abstract {
  font-family: var(--font-body);
  font-size: var(--fs-base);
  font-style: italic;
  text-align: center;
  line-height: 1.75;
  color: var(--text);
  margin: 0 auto 1rem;
  max-width: 54ch;
}

.gwern-meta {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--text-muted);
  text-align: center;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: .1rem .28rem;
  margin-bottom: 1.2rem;
  line-height: 2;
}
.gwern-meta__sep   { opacity: .35; margin: 0 .05rem; }
.gwern-meta__dates { font-weight: 600; color: var(--text-sec); }
.gwern-meta__label {
  text-decoration: none;
  border-bottom: 1px dashed var(--border);
  color: var(--text-muted);
}
.gwern-meta__label:hover { color: var(--brand); }
.gwern-meta__item  { display: inline-flex; align-items: baseline; gap: .15rem; }

/* Dark overrides */
[data-theme="dark"] .gwern-title   { color: var(--text); }
[data-theme="dark"] .gwern-abstract{ color: var(--text); }
[data-theme="dark"] .gwern-tags    { color: var(--text-sec); }
[data-theme="dark"] .gwern-tags a  { color: var(--text); text-decoration-color: var(--border); }


/* ═══════════════════════════════════════════════════════════════
   TWO-COLUMN TOC TABLE (article header)
   ═══════════════════════════════════════════════════════════════ */
.gwern-toc-table {
  border: 1px solid #c8c8c8;
  border-radius: 2px;
  margin: 0 0 1.8rem 0;
  overflow: hidden;
  font-family: var(--font-ui);
  font-size: var(--fs-sm);
  background: #f8f8f8;
}

/* ✦ Contents title bar — spans full width */
.gwern-toc-table__title {
  display: flex;
  align-items: center;
  gap: .28rem;
  padding: .42rem .85rem;
  font-family: var(--font-ui);
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: #888;
  border-bottom: 1px solid #c8c8c8;
  background: #f2f1ee;
}

/* Two-column row */
.gwern-toc-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.gwern-toc-col { padding: .75rem .85rem; }
.gwern-toc-col:first-child { border-right: 1px solid #c8c8c8; }

/* Reset list styles inside table */
.gwern-toc-table .toc-list  { padding: 0; list-style: none; }
.gwern-toc-table .toc-list li { margin-bottom: .22rem; line-height: 1.35; }

/* h2 = bold, no indent */
.gwern-toc-table .toc-list .toc-depth-0 > a {
  display: block; font-weight: 700; font-size: var(--fs-sm);
  color: #1a1a1a; text-decoration: none;
  padding: .04rem 0; border-left: none; background: none; margin-top: .35rem;
}
.gwern-toc-table .toc-list .toc-depth-0:first-child > a { margin-top: 0; }

/* h3 = regular, 1rem indent */
.gwern-toc-table .toc-list .toc-depth-1 > a {
  display: block; font-weight: 400; font-size: var(--fs-xs);
  color: #555; text-decoration: none;
  padding: .04rem 0 .04rem 1rem; border-left: none; background: none;
}
/* h4 = lighter, 1.8rem indent */
.gwern-toc-table .toc-list .toc-depth-2 > a {
  display: block; font-weight: 400; font-size: var(--fs-xs);
  color: #777; text-decoration: none;
  padding: .04rem 0 .04rem 1.8rem; border-left: none; background: none;
}

.gwern-toc-table .toc-list a:hover  { color: var(--brand) !important; background: none !important; border-left: none !important; }
.gwern-toc-table .toc-list a.active { color: var(--brand) !important; font-weight: 600 !important; background: none !important; border-left: none !important; }

/* Dark mode */
[data-theme="dark"] .gwern-toc-table          { background: #1a1a1a; border-color: #3a3a3a; }
[data-theme="dark"] .gwern-toc-table__title   { background: #141414; border-bottom-color: #3a3a3a; color: #777; }
[data-theme="dark"] .gwern-toc-col:first-child { border-right-color: #3a3a3a; }
[data-theme="dark"] .gwern-toc-table .toc-list .toc-depth-0 > a { color: #f1f1f1; }
[data-theme="dark"] .gwern-toc-table .toc-list .toc-depth-1 > a { color: #aaa; }
[data-theme="dark"] .gwern-toc-table .toc-list .toc-depth-2 > a { color: #888; }


/* ═══════════════════════════════════════════════════════════════
   COT BULLETIN — abstract callout before article body
   ═══════════════════════════════════════════════════════════════ */
.cot-bulletin {
  margin: 0 0 1.6rem;
  padding: .8rem 1rem .8rem 1.1rem;
  border: 1px solid #d4d0c8;
  border-left: 3px solid #8a8070;
  border-radius: 2px;
  background: #faf9f6;
  font-family: var(--font-body);
}
.cot-bulletin__label {
  display: block;
  font-family: var(--font-ui);
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: #8a8070;
  margin-bottom: .28rem;
}
.cot-bulletin__body {
  font-style: italic;
  font-size: var(--fs-base);
  line-height: 1.72;
  color: var(--text);
  margin: 0;
}
[data-theme="dark"] .cot-bulletin         { background: #161410; border-color: #3a3630; border-left-color: #7a7060; }
[data-theme="dark"] .cot-bulletin__label  { color: #9a8870; }
[data-theme="dark"] .cot-bulletin__body   { color: var(--text); }


/* ═══════════════════════════════════════════════════════════════
   ARTICLE CONTENT — thin slightly visible border, all sides
   ═══════════════════════════════════════════════════════════════ */
.entry-content {
  border: 1px solid #b8b8b8;   /* clear grey — visible but not harsh */
  border-radius: 3px;
  padding: .85rem 1rem;
  margin: 0 0 1rem 0;
  min-width: 0;
  box-sizing: border-box;
}
[data-theme="dark"] .entry-content { border-color: #3a3a3a; }


/* ═══════════════════════════════════════════════════════════════
   THEME TOGGLE — identical in both light and dark mode
   Header stays white intentionally; toggle is always white-bg.
   ═══════════════════════════════════════════════════════════════ */
.theme-toggle,
[data-theme="dark"] .theme-toggle {
  background:   #fff          !important;
  border:       1px solid #d0d0d0 !important;
  color:        #333          !important;
  border-radius: 6px;
  padding: .25rem .48rem;
  cursor: pointer;
  font-size: var(--fs-sm);
  line-height: 1;
  transition: none !important;  /* no flash on toggle */
}
.theme-toggle:hover,
[data-theme="dark"] .theme-toggle:hover {
  background: #f0f0f0 !important;
  border-color: #bbb !important;
}
#themeIcon { color: #333 !important; }


/* ═══════════════════════════════════════════════════════════════
   BOTTOM TOC BAR + PANEL
   ═══════════════════════════════════════════════════════════════ */
.bottom-toc-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 500;
  min-height: 42px;
  height: auto;
  background: var(--bg);
  border-top: 1px solid var(--border-lt);
  box-shadow: 0 -2px 12px var(--shadow);
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: stretch;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  transition: background .15s;
}
.bottom-toc-bar:hover { background: var(--brand-pale); }
.bottom-toc-bar__progress {
  position: absolute;
  top: 0;
  left: 0;
  height: 2px;
  width: 0%;
  background: var(--brand);
  transition: width .1s linear;
  pointer-events: none;
  z-index: 1;
}
.bottom-toc-bar__inner {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: .45rem 1rem;
  gap: .55rem;
  position: relative;
  z-index: 2;
}
.bottom-toc-bar__section-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .38rem;
  flex: 1 1 auto;
  min-width: 0;
  max-width: min(100%, 60rem);
}
.bottom-toc-bar__section {
  font-family: var(--font-ui);
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--text);
  min-width: 0;
  flex: 0 1 auto;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}
.bottom-toc-bar__chev {
  font-size: .65rem;
  color: var(--text-muted);
  transition: transform .2s;
  flex-shrink: 0;
  line-height: 1;
  margin-top: 0;
}
.bottom-toc-bar.is-open .bottom-toc-bar__chev { transform: rotate(180deg); }

.bottom-toc-panel {
  position: fixed;
  bottom: var(--bottom-toc-h,42px);
  left: 50%;
  right: auto;
  z-index: 499;
  width: min(760px, calc(100vw - 1.5rem));
  max-height: 60vh;
  overflow-y: auto;
  background: var(--bg);
  border-top: 1px solid var(--border-lt);
  box-shadow: 0 -4px 24px var(--shadow-md);
  border-radius: 12px 12px 0 0;
  transform: translate(-50%, 100%);
  transition: transform .22s cubic-bezier(.22,1,.36,1);
}
.bottom-toc-panel[hidden] {
  display: block !important;
  transform: translate(-50%, 100%);
  pointer-events: none;
  visibility: hidden;
}
.bottom-toc-panel.is-open {
  transform: translate(-50%, 0);
  pointer-events: auto;
  visibility: visible;
}
.bottom-toc-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .55rem 1rem .4rem;
  border-bottom: 1px solid var(--border-lt);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 2;
}
.bottom-toc-panel__title {
  font-family: var(--font-ui);
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: calc(100% - 2.5rem);
}
.bottom-toc-panel__close {
  background: none;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  color: var(--text-muted);
  padding: .2rem .3rem;
  line-height: 1;
  flex-shrink: 0;
}
.bottom-toc-panel__close:hover { color: var(--text); }
.bottom-toc-panel__body { padding: .4rem .9rem .9rem; }
.bottom-toc-panel__body .toc-list { padding: 0; list-style: none; }
.bottom-toc-panel__body .toc-list li { margin-bottom: .2rem; }
.bottom-toc-panel__body .toc-list a {
  font-size: var(--fs-sm);
  color: var(--text-sec);
  padding: .18rem 0 .18rem .5rem;
  border-left: 2px solid transparent;
  display: block;
  text-decoration: none;
}
.bottom-toc-panel__body .toc-list a:hover,
.bottom-toc-panel__body .toc-list a.active {
  color: var(--brand);
  border-left-color: var(--brand);
  background: var(--brand-pale);
}
.bottom-toc-panel__body .toc-list .toc-depth-1 > a { padding-left: 1.2rem; font-size: var(--fs-xs); }
.bottom-toc-panel__body .toc-list .toc-depth-2 > a { padding-left: 2rem;   font-size: var(--fs-xs); color: var(--text-muted); }

/* Dark — bottom bar + panel */
[data-theme="dark"] .bottom-toc-bar { background: #0e0e0e; border-top-color: #2a2a2a; }
[data-theme="dark"] .bottom-toc-bar:hover { background: #161616; }
[data-theme="dark"] .bottom-toc-bar__title   { color: #555; }
[data-theme="dark"] .bottom-toc-bar__section { color: #e0e0e0; }
[data-theme="dark"] .bottom-toc-bar__chev    { color: #444; }
[data-theme="dark"] .bottom-toc-panel { background: #111; border-top-color: #2a2a2a; }
[data-theme="dark"] .bottom-toc-panel__header { background: #111; border-bottom-color: #2a2a2a; }
[data-theme="dark"] .bottom-toc-panel__title { color: #e0e0e0; }
[data-theme="dark"] .bottom-toc-panel__close { color: #555; }
[data-theme="dark"] .bottom-toc-panel__body .toc-list a { color: #bbb; }
[data-theme="dark"] .bottom-toc-panel__body .toc-list a:hover,
[data-theme="dark"] .bottom-toc-panel__body .toc-list a.active {
  color: var(--brand);
  border-left-color: var(--brand);
  background: rgba(34,211,238,.06);
}

/* ── Sidebar TOC title with ✦ ── */
.toc-title { display: flex; align-items: center; gap: .22rem; }

/* ── Misc ── */
body { padding-bottom: var(--bottom-toc-h,42px); }
.mobile-section-bar, .mobile-section-panel { display: none !important; }
#reading-progress { display: none !important; }
.gwern-footer-tags { margin-top: 1.4rem; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.gwern-featured-image { margin: .9rem 0 1.1rem; }
.gwern-featured-image img { display: block; width: 100%; height: auto; border-radius: 12px; }


.ad-slot--sidebar-category { margin-top: 1rem; }

/* Keep common social/share widgets in their own visual style across theme switches */
.sharedaddy, .sd-sharing, .addtoany_list, .a2a_kit, .wp-block-social-links, .wp-social-link,
.swp_social_panel, .nc_socialPanel, .et_social_share, .ssb_item, .social-share-button,
.social-share, .share-buttons, .heateor_sss_sharing_ul, .ultp-social-share, .jetpack-sharing-buttons,
.st-social, .sharethis-inline-share-buttons, .mashsb-container, .ssba, .sassy-social-share {
  color: inherit;
}
.sharedaddy a, .sd-sharing a, .addtoany_list a, .a2a_kit a, .wp-block-social-links a, .wp-social-link a,
.swp_social_panel a, .nc_socialPanel a, .et_social_share a, .ssb_item a, .social-share-button a,
.social-share a, .share-buttons a, .heateor_sss_sharing_ul a, .ultp-social-share a, .jetpack-sharing-buttons a,
.st-social a, .sharethis-inline-share-buttons a, .mashsb-container a, .ssba a, .sassy-social-share a {
  color: inherit !important;
  background-color: initial;
}
