:root { color-scheme: light; --bg: #080e1b; --bg-soft: #0d1626; --panel: rgba(19, 31, 50, .66); --panel-strong: rgba(23, 37, 59, .82); --panel-border: rgba(183, 213, 255, .12); --text: #eef4ff; --text-soft: #a7b4c9; --muted: #73829a; --accent: #83c4ff; --accent-strong: #6daeff; --mint: #8fdbc8; --shadow: 0 18px 48px rgba(0, 0, 0, .17); --sidebar-width: 246px; --radius-xl: 21px; --radius-lg: 17px; --radius-md: 12px; --font: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif; }
html:has(> body[data-theme="dark"]) { color-scheme: dark; }
.icon { width: 16px; height: 16px; display: block; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.search-icon { width: 16px; height: 16px; }
.card-open.icon { width: 13px; height: 13px; }
.theme-icon { display: inline-grid; width: 17px; height: 17px; place-items: center; color: #c8b487; }
.theme-icon .icon { width: 16px; height: 16px; }
.dialog-close .icon, .sidebar-close .icon { width: 16px; height: 16px; }
.mobile-menu .icon { width: 18px; height: 18px; }
.sort-button .icon, .site-footer .icon { width: 14px; height: 14px; }
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 96px; }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--text); font: 14px/1.65 var(--font); letter-spacing: .01em; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button { color: inherit; }
::selection { background: rgba(115, 181, 246, .35); color: white; }
.backdrop { position: fixed; z-index: -2; inset: 0; overflow: hidden; background: linear-gradient(145deg, #0c1421, #090f19 68%, #0c1420); }
.site-shell { min-height: 100vh; }
.glass-panel, .glass-subtle { border: 1px solid var(--panel-border); background: var(--panel); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); box-shadow: var(--shadow); }
.glass-subtle { background: rgba(24, 39, 61, .55); }
.sidebar { position: fixed; z-index: 20; inset: 14px auto 14px 14px; width: var(--sidebar-width); display: flex; flex-direction: column; padding: 18px 14px 14px; border: 1px solid rgba(191, 218, 255, .12); border-radius: 20px; background: rgba(19, 30, 46, .92); box-shadow: 0 16px 44px rgba(0,0,0,.18); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); }
.brand { display: flex; align-items: center; gap: 12px; padding: 5px 8px 25px; }
.brand-mark { width: 40px; height: 40px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; overflow: hidden; border-radius: 10px; border: 1px solid rgba(157, 190, 219, .18); background: rgba(120, 166, 202, .08); box-shadow: none; }
.brand-mark span { display: block; width: 16px; height: 1px; border-radius: 1px; background: #9bbbd3; box-shadow: none; }
.brand-mark span:nth-child(1) { width: 12px; height: 1px; }.brand-mark span:nth-child(2) { width: 19px; height: 1px; }.brand-mark span:nth-child(3) { width: 15px; height: 1px; }
.brand-copy { display: grid; line-height: 1.25; }.brand-copy strong { font-size: 16px; letter-spacing: .11em; }.brand-copy small { margin-top: 4px; color: #8c9caf; font: 10px/1.2 var(--font); letter-spacing: .02em; }
.nav-caption { margin: 10px 9px 9px; color: #8a9aae; font: 10px/1.4 var(--font); letter-spacing: .04em; }.nav-caption-spaced { margin-top: 28px; }
.nav-list { display: grid; gap: 5px; }
.nav-link { min-height: 42px; display: flex; align-items: center; gap: 12px; padding: 0 11px; border: 1px solid transparent; border-radius: 12px; color: #9cabc1; transition: .2s ease; }
.nav-link:hover, .topic-link:hover { color: var(--text); background: rgba(163, 199, 246, .07); }.nav-link[aria-current="location"] { color: #edf6ff; border-color: rgba(143, 196, 255, .12); background: rgba(97, 160, 233, .11); box-shadow: inset 2px 0 #89c5ff; }
.nav-icon { width: 17px; height: 17px; color: #8faed0; }
.topic-nav { display: grid; gap: 4px; }.topic-link { width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 0; border-radius: 10px; background: transparent; text-align: left; color: #96a6bd; cursor: pointer; transition: .2s; }.topic-link > span:last-child { margin-left: auto; color: #667993; font: 10px "DM Mono", monospace; }
.topic-dot { width: 7px; height: 7px; border-radius: 50%; box-shadow: none; }.dot-blue { color: #83c4ff; background: currentColor; }.dot-violet { color: #b39aff; background: currentColor; }.dot-mint { color: #75d9bc; background: currentColor; }.dot-amber { color: #e8b970; background: currentColor; }
.sidebar-spacer { flex: 1; min-height: 30px; }
.sidebar-bottom { padding: 11px 5px 0; border-top: 1px solid rgba(186, 211, 246, .1); }.theme-toggle { width: 100%; display: flex; align-items: center; gap: 9px; padding: 7px 6px; border: 0; background: transparent; color: #92a4bd; text-align: left; cursor: pointer; }.theme-state { margin-left: auto; color: #647893; font-size: 11px; }
.main-column { min-height: 100vh; margin-left: calc(var(--sidebar-width) + 28px); padding-right: clamp(20px, 3.2vw, 56px); }
.topbar { position: sticky; z-index: 12; top: 0; height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 clamp(20px, 2.5vw, 42px); border-bottom: 1px solid rgba(177, 205, 245, .08); background: rgba(8, 14, 27, .68); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }
.breadcrumbs { display: flex; align-items: center; gap: 11px; color: #71829b; font-size: 12px; }.breadcrumbs b { color: #4b5b73; font-weight: 400; }.breadcrumbs strong { color: #c5d1e2; font-weight: 500; }
.top-actions { display: flex; align-items: center; }.search-box { height: 37px; width: min(270px, 28vw); display: flex; align-items: center; gap: 8px; padding: 0 10px; border: 1px solid rgba(173, 203, 243, .13); border-radius: 11px; background: rgba(22, 36, 57, .53); color: #91a3bd; transition: border-color .2s, background .2s; }.search-box:focus-within { border-color: rgba(130, 193, 255, .4); background: rgba(29, 47, 73, .72); }.search-icon { width: 16px; height: 16px; flex: 0 0 auto; }.search-box input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 11px; }.search-box input::placeholder { color: #71819a; }.search-box kbd { flex-shrink: 0; padding: 2px 5px; border: 1px solid rgba(174, 199, 233, .14); border-radius: 5px; color: #73849d; font: 9px "DM Mono", monospace; }
.mobile-menu { display: none; }
.page-content { max-width: 1420px; margin: 0 auto; padding: 30px 0 22px; }
.hero { position: relative; min-height: 330px; display: flex; align-items: center; overflow: hidden; padding: clamp(28px, 4vw, 55px); border-radius: var(--radius-xl); isolation: isolate; }.hero::before { content: ""; position: absolute; z-index: -1; inset: 0; background: linear-gradient(100deg, rgba(17, 31, 51, .97), rgba(17, 31, 51, .84) 56%, rgba(16, 30, 49, .48)); }.hero-copy { position: relative; z-index: 2; width: min(60%, 580px); }.hero h1 { margin: 0 0 12px; font-size: clamp(31px, 3.5vw, 48px); line-height: 1.28; letter-spacing: -.045em; font-weight: 700; }.hero-description { max-width: 470px; margin: 0; color: #9aaac0; font-size: 13px; line-height: 1.9; }.hero-actions { display: flex; align-items: center; gap: 20px; margin-top: 23px; }
.hero-link { display: inline-flex; align-items: center; min-height: 39px; color: var(--text-soft); font-size: 13px; }
.hero-link-primary { color: #a6d0f4; font-weight: 600; }
.hero-link-primary, .hero-link:hover { text-decoration: underline; text-underline-offset: .28em; }
body[data-theme="light"] .hero-link-primary { color: #285c82; }
.hero-meta { display: flex; align-items: center; gap: 8px; margin-top: 26px; color: #788ba7; font-size: 10px; }.hero-meta strong { color: #b5c7dd; font: 10px "DM Mono", monospace; }.meta-divider { height: 11px; margin: 0 5px; border-left: 1px solid rgba(181, 205, 236, .18); }
.hero-art { position: absolute; z-index: 1; top: 0; right: 0; bottom: 0; width: 53%; overflow: hidden; }.hero-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(17, 31, 51, .95), transparent 42%), linear-gradient(0deg, rgba(12, 24, 40, .62), transparent 47%); }.landscape { position: absolute; right: -3%; bottom: -4%; width: min(100%, 620px); opacity: .78; filter: saturate(.6); }

.content-layout { display: grid; margin-top: clamp(20px, 3vw, 34px); grid-template-columns: minmax(0, 1fr) 254px; gap: clamp(20px, 2.8vw, 38px); }.articles-section { min-width: 0; }.section-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 17px; }.section-heading h2 { display: flex; align-items: center; gap: 10px; margin: 5px 0 0; font-size: 21px; letter-spacing: -.025em; }.heading-count { align-self: center; display: inline-grid; min-width: 24px; height: 19px; place-items: center; padding: 0 5px; border: 1px solid rgba(159, 194, 237, .14); border-radius: 6px; color: #86b9e5; background: rgba(94, 144, 196, .12); font: 9px "DM Mono", monospace; }.sort-button { display: inline-flex; align-items: center; gap: 5px; padding: 7px 0 7px 12px; border: 0; background: transparent; color: #8192a9; font-size: 10px; cursor: pointer; }.filter-bar { display: flex; gap: 7px; margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }.filter-bar::-webkit-scrollbar { display: none; }.filter-chip { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px; border: 1px solid rgba(173, 203, 242, .11); border-radius: 20px; background: rgba(20, 32, 51, .47); color: #8697af; font-size: 10px; cursor: pointer; transition: .2s ease; }.filter-chip:hover { color: #c8e2fa; border-color: rgba(139, 192, 243, .3); }.filter-chip.selected { color: #d7ecff; border-color: rgba(127, 190, 247, .32); background: rgba(93, 153, 207, .17); box-shadow: inset 0 0 13px rgba(91, 155, 212, .06); }.filter-chip span { color: #6f8bab; font: 8px "DM Mono", monospace; }
.article-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }.article-card { position: relative; min-height: 182px; display: flex; flex-direction: column; overflow: hidden; padding: 16px 16px 13px; border: 1px solid rgba(177, 204, 241, .11); border-radius: 14px; background: rgba(20, 32, 49, .72); box-shadow: 0 10px 28px rgba(0,0,0,.1); cursor: pointer; transition: transform .2s, border-color .2s, background .2s; }.article-card:hover { transform: translateY(-1px); border-color: rgba(152, 204, 251, .22); background: rgba(26, 42, 62, .82); }.article-topline { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; }.article-category { display: inline-flex; align-items: center; gap: 6px; color: #9ac9f1; font-size: 9px; }.article-category::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--category-color, #89c8f2); }.article-date { color: #70829a; font: 9px "DM Mono", monospace; }.article-card h3 { position: relative; z-index: 1; margin: 16px 0 8px; color: #dce7f5; font-size: 15px; line-height: 1.65; letter-spacing: -.02em; font-weight: 600; }.article-card p { position: relative; z-index: 1; display: -webkit-box; overflow: hidden; margin: 0; color: #a0afc2; font-size: 12px; line-height: 1.65; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }.article-bottom { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 13px; }.article-tags { display: flex; gap: 5px; }.article-tag { padding: 3px 7px; border: 1px solid rgba(165, 192, 230, .1); border-radius: 6px; color: #8194ac; background: rgba(255,255,255,.025); font-size: 8px; }.read-time { color: #7688a1; font: 9px "DM Mono", monospace; }.article-read { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.card-open { color: var(--muted); }.article-card:hover .card-open, .article-card:focus-visible .card-open { color: var(--accent); }
.empty-state { min-height: 180px; display: grid; place-content: center; justify-items: center; gap: 5px; border-radius: 16px; color: #8fa0b6; box-shadow: none; }.empty-state[hidden] { display: none; }.empty-state > .icon { width: 21px; height: 21px; color: var(--accent); }.empty-state strong { color: #c8d8ea; font-size: 12px; }.empty-state small { color: #7f90a7; font-size: 10px; }
.right-rail { display: grid; align-content: start; gap: 13px; }
.about-card, .overview-card { align-self: start; padding: 16px; border-radius: 16px; box-shadow: none; }
.about-card h2, .overview-heading h2 { margin: 0; color: #8496ab; font: 600 12px/1.4 var(--font); letter-spacing: .02em; }
.about-card p { margin: 9px 0 0; color: var(--text-soft); font-size: 12px; line-height: 1.65; }
.overview-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.overview-heading > span { color: var(--muted); font: 9px "DM Mono", monospace; }
.overview-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 12px; border-top: 1px solid rgba(173, 202, 239, .1); }
.overview-stat { display: grid; gap: 2px; min-width: 0; padding: 11px 8px 9px 0; border-bottom: 1px solid rgba(173, 202, 239, .1); }
.overview-stat:nth-child(even) { padding-left: 10px; border-left: 1px solid rgba(173, 202, 239, .1); }
.overview-stat strong { overflow: hidden; color: var(--text); font-size: 17px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.overview-stat:last-child strong { font: 11px "DM Mono", monospace; }
.overview-stat span { color: var(--muted); font-size: 10px; }
.overview-note { margin: 12px 0 0; color: var(--text-soft); font-size: 11px; line-height: 1.65; }

.site-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 34px; padding: 17px 2px 4px; border-top: 1px solid rgba(173, 202, 239, .09); color: #667a94; font-size: 9px; }.site-footer a { display: inline-flex; align-items: center; gap: 5px; color: #8ca2bc; }.site-footer a:hover { color: #c9e4fb; }
.article-dialog { width: min(720px, calc(100% - 28px)); max-height: min(85vh, 850px); overflow-y: auto; padding: 0; border-radius: 22px; color: var(--text); }.article-dialog::backdrop { background: rgba(2, 7, 16, .72); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }.dialog-close { position: sticky; z-index: 2; top: 14px; float: right; width: 34px; height: 34px; margin: 14px 14px -48px 0; border: 1px solid rgba(186, 212, 247, .16); border-radius: 11px; background: rgba(20, 34, 54, .78); color: #bbcee3; cursor: pointer; }.dialog-content { padding: 45px clamp(22px, 6vw, 54px) 42px; }.dialog-eyebrow { color: #a7c7e0; font: 11px/1.5 var(--font); letter-spacing: .02em; }.dialog-content h2 { margin: 13px 0 10px; font-size: clamp(23px, 4vw, 34px); line-height: 1.4; }.dialog-meta { color: #7f92ab; font: 10px "DM Mono", monospace; }.dialog-content .dialog-lead { margin: 24px 0; padding: 13px 16px; border-left: 2px solid #81c2ee; border-radius: 0 10px 10px 0; background: rgba(96, 156, 209, .09); color: #b6cadf; font-size: 13px; }.dialog-content h3 { margin: 25px 0 8px; color: #d9e8f9; font-size: 16px; }.dialog-content p { color: #9bacbf; font-size: 12px; line-height: 2; }.dialog-code { overflow-x: auto; padding: 14px 16px; border: 1px solid rgba(169, 202, 240, .12); border-radius: 11px; background: rgba(4, 10, 19, .62); color: #a7dfd0; font: 11px/1.8 "DM Mono", monospace; white-space: pre; }.dialog-tags { display: flex; gap: 7px; margin-top: 22px; }.dialog-tags span { padding: 4px 9px; border: 1px solid rgba(163, 197, 235, .12); border-radius: 20px; color: #8ea5bf; font-size: 9px; }
.mobile-overlay { display: none; }.sidebar-close { display: none; }
body[data-theme="light"] { color-scheme: light; --bg: #e8f0f7; --bg-soft: #f5f8fb; --panel: rgba(255,255,255,.68); --panel-strong: rgba(255,255,255,.87); --panel-border: rgba(70, 104, 144, .16); --text: #192b42; --text-soft: #4e647e; --muted: #71849a; --accent: #3f89c5; --accent-strong: #3579b2; --shadow: 0 26px 75px rgba(57, 91, 126, .13); }
body[data-theme="light"] .backdrop { background: linear-gradient(145deg, #edf3f8, #e4edf4 68%, #eef3f7); }
body[data-theme="light"] .sidebar { background: rgba(246, 250, 253, .94); } body[data-theme="light"] .topbar { background: rgba(235, 243, 250, .72); }
body[data-theme="light"] .hero::before { background: linear-gradient(100deg, rgba(241, 248, 254, .98) 0%, rgba(239, 247, 253, .91) 45%, rgba(223, 240, 248, .4) 100%); }
body[data-theme="light"] .hero h1 { color: #172b42; }body[data-theme="light"] .hero-description { color: #617891; } body[data-theme="light"] .hero-meta, body[data-theme="light"] .hero-meta strong { color: #5f7894; }
body[data-theme="light"] .article-card { background: rgba(255, 255, 255, .72); } body[data-theme="light"] .article-card h3 { color: #273b52; } body[data-theme="light"] .article-card p, body[data-theme="light"] .about-card p, body[data-theme="light"] .overview-note { color: #60758c; } body[data-theme="light"] .about-card h2, body[data-theme="light"] .overview-heading h2 { color: #5b738b; }
body[data-theme="light"] .glass-subtle { background: rgba(255,255,255,.56); } body[data-theme="light"] .section-heading h2 { color: #24394f; } 
body[data-theme="light"] .search-box, body[data-theme="light"] .filter-chip { background: rgba(255,255,255,.55); color: #536b83; } body[data-theme="light"] .search-box input { color: #24394f; } body[data-theme="light"] .filter-chip.selected { color: #285b84; background: rgba(117, 177, 221, .2); }
body[data-theme="light"] .article-dialog { color: #1d334a; } body[data-theme="light"] .dialog-content h2, body[data-theme="light"] .dialog-content h3 { color: #24394f; } body[data-theme="light"] .dialog-content p { color: #536b83; }
@media (max-width: 1120px) { :root { --sidebar-width: 218px; }.content-layout { grid-template-columns: minmax(0, 1fr) 225px; gap: 20px; }.hero-copy { width: 65%; }.article-card { min-height: 194px; } }
@media (max-width: 850px) { :root { --sidebar-width: 245px; }.sidebar { z-index: 31; transform: translateX(calc(-100% - 20px)); transition: transform .25s ease; }.sidebar.open { transform: translateX(0); }.main-column { margin-left: 0; padding-right: 20px; }.topbar { height: 66px; padding: 0 20px; }.mobile-menu { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--panel-border); border-radius: 10px; background: rgba(24,39,61,.55); color: #b9d5f3; cursor: pointer; }.breadcrumbs { margin-right: auto; }.mobile-overlay { position: fixed; z-index: 30; inset: 0; display: block; background: rgba(2,7,14,.56); opacity: 0; pointer-events: none; transition: .25s; }.mobile-overlay.visible { opacity: 1; pointer-events: auto; }.page-content { padding-top: 22px; }.content-layout { grid-template-columns: minmax(0,1fr); }.hero { min-height: 320px; }.hero-copy { width: 73%; }.hero-art { width: 60%; opacity: .78; } }
@media (max-width: 600px) { .main-column { padding-right: 12px; }.topbar { gap: 10px; padding: 0 13px; }.breadcrumbs { gap: 7px; font-size: 10px; }.search-box { width: 38px; padding: 0 9px; border-color: transparent; background: transparent; }.search-box input { opacity: 0; }.search-box kbd { display: none; }.page-content { padding: 14px 0 16px; }.hero { min-height: 390px; align-items: flex-start; padding: 26px 21px; border-radius: 20px; }.hero-copy { width: 100%; }.hero h1 { position: relative; z-index: 3; font-size: clamp(30px, 9vw, 39px); }.hero-description { position: relative; z-index: 3; max-width: 360px; font-size: 11px; }.hero-actions { position: relative; z-index: 3; margin-top: 17px; }.hero-meta { position: absolute; z-index: 3; bottom: 18px; left: 21px; flex-wrap: wrap; gap: 6px; font-size: 9px; }.hero-meta strong { font-size: 9px; }.hero-art { top: auto; right: -10px; bottom: 6px; width: 92%; height: 205px; opacity: .66; }.hero-art::after { background: linear-gradient(90deg, rgba(17,31,51,.74), transparent 58%), linear-gradient(0deg, rgba(12,24,40,.54), transparent 70%); }.landscape { width: 100%; }.content-layout { gap: 25px; }.section-heading h2 { font-size: 19px; }.sort-button { font-size: 9px; }.article-grid { grid-template-columns: 1fr; gap: 10px; }.article-card { min-height: 162px; padding: 14px; }.article-card h3 { margin: 12px 0 5px; }.article-bottom { padding-top: 9px; }.about-card { padding: 14px; }.site-footer { flex-wrap: wrap; justify-content: center; text-align: center; gap: 6px 14px; }.dialog-content { padding: 43px 20px 29px; }.dialog-content h2 { font-size: 23px; }.dialog-code { font-size: 9px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; } }

/* Sidebar keeps its closing note readable on short viewports. */
.sidebar { overflow-y: auto; scrollbar-width: none; }
.sidebar::-webkit-scrollbar { display: none; }
.sidebar-spacer { flex: 1 1 auto; min-height: 12px; }
.sidebar-bottom { flex: 0 0 auto; }

/* Higher-contrast light theme: keep the glass effect without washing out text. */
body[data-theme="light"] .nav-caption { color: #657d96; }
body[data-theme="light"] .nav-link { color: #506a84; }
body[data-theme="light"] .nav-link .nav-icon { color: #547fa5; }
body[data-theme="light"] .nav-link[aria-current="location"] {
  color: #244d70;
  border-color: rgba(74, 139, 194, .28);
  background: linear-gradient(100deg, rgba(113, 177, 225, .26), rgba(120, 173, 213, .12));
  box-shadow: inset 3px 0 #5d9fd1, 0 7px 20px rgba(52, 94, 131, .08);
}
body[data-theme="light"] .nav-link[aria-current="location"] .nav-icon { color: #356c99; }
body[data-theme="light"] .topic-link { color: #536c85; }
body[data-theme="light"] .topic-link > span:last-child { color: #71869d; }
body[data-theme="light"] .sidebar-bottom { border-top-color: rgba(89, 124, 159, .18); }
body[data-theme="light"] .theme-toggle { color: #4c6781; }
body[data-theme="light"] .theme-state { color: #71869d; }
body[data-theme="light"] .breadcrumbs span { color: #5e7893; }
body[data-theme="light"] .breadcrumbs b { color: #9aabbb; }
body[data-theme="light"] .breadcrumbs strong { color: #304f6c; }
body[data-theme="light"] .search-box { border-color: rgba(82, 123, 163, .21); color: #456886; background: rgba(255,255,255,.62); }
body[data-theme="light"] .search-box input { color: #294863; }
body[data-theme="light"] .search-box input::placeholder { color: #6b8197; }
body[data-theme="light"] .search-box kbd { border-color: rgba(82, 123, 163, .2); color: #637a91; }
body[data-theme="light"] .hero-art::after {
  background: linear-gradient(90deg, rgba(239,247,253,.88), rgba(239,247,253,.48) 18%, transparent 48%),
              linear-gradient(0deg, rgba(31,55,77,.24), transparent 48%);
}

body[data-theme="light"] .hero-meta { color: #58738e; }
body[data-theme="light"] .hero-meta strong { color: #345b7d; }

body[data-theme="light"] .sort-button { color: #4f6b85; }
body[data-theme="light"] .heading-count {
  color: #3b6487;
  border-color: var(--panel-border);
}
body[data-theme="light"] .filter-chip { border-color: rgba(82, 121, 159, .19); color: #536d85; }
body[data-theme="light"] .filter-chip:hover { color: #245a82; border-color: rgba(70, 137, 192, .36); }
body[data-theme="light"] .filter-chip.selected { color: #285f88; border-color: rgba(65, 137, 193, .34); background: rgba(113, 177, 221, .23); }
body[data-theme="light"] .filter-chip span { color: #64829c; }
body[data-theme="light"] .article-category { color: #3f739b; }
body[data-theme="light"] .article-date,
body[data-theme="light"] .read-time { color: #6d8297; }
body[data-theme="light"] .article-tag { border-color: rgba(81, 119, 156, .16); color: #5a7188; background: rgba(86, 136, 179, .055); }

body[data-theme="light"] .about-card h2 { color: #5b738b; }

body[data-theme="light"] .site-footer { color: #647b91; }
body[data-theme="light"] .site-footer a { color: #456e90; }
@media (max-height: 720px) {
  .sidebar { gap: 0; }
  .brand { padding-bottom: 16px; }
  .nav-caption-spaced { margin-top: 18px; }
}

/* Mobile polish: keep the drawer usable and prevent hero metadata from covering actions. */
@media (max-width: 850px) {
  .sidebar {
    top: max(14px, env(safe-area-inset-top));
    bottom: max(14px, env(safe-area-inset-bottom));
    left: max(14px, env(safe-area-inset-left));
    width: min(var(--sidebar-width), calc(100vw - 28px));
    overscroll-behavior: contain;
  }
  body[data-theme="light"] .mobile-menu,
  body[data-theme="light"] .sidebar-close {
    border-color: var(--panel-border);
    background: var(--panel);
    color: #456886;
  }
  .sidebar-close {
    position: absolute;
    top: 19px;
    right: 17px;
    display: grid;
    width: 32px;
    height: 32px;
    place-items: center;
    border: 1px solid rgba(173, 205, 243, .16);
    border-radius: 10px;
    background: rgba(23, 39, 61, .68);
    color: #c2d8ef;
    font-size: 21px;
    line-height: 1;
    cursor: pointer;
  }
  body.menu-open { overflow: hidden; }
  .mobile-overlay { touch-action: none; }
}

@media (max-width: 600px) {
  html { scroll-padding-top: calc(76px + env(safe-area-inset-top)); }
  .main-column {
    padding-left: max(0px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }
  .topbar {
    height: calc(66px + env(safe-area-inset-top));
    padding-top: env(safe-area-inset-top);
    padding-right: max(13px, env(safe-area-inset-right));
    padding-left: max(13px, env(safe-area-inset-left));
  }
  .mobile-menu { flex: 0 0 36px; width: 36px; height: 36px; }
  .hero {
    min-height: 0;
    align-items: flex-start;
    padding: 25px 20px 20px;
  }
  .hero-copy { width: 100%; }
  .hero-description { max-width: 34ch; }
  .hero-meta {
    position: relative;
    bottom: auto;
    left: auto;
    flex-wrap: wrap;
    gap: 5px 7px;
    width: fit-content;
    max-width: 100%;
    margin-top: 16px;
    padding: 5px 8px;
    border: 1px solid var(--panel-border);
    border-radius: 9px;
    background: var(--panel-strong);
    line-height: 1.45;
  }
  .hero-art {
    right: -8px;
    bottom: 0;
    width: 80%;
    height: 158px;
    opacity: .48;
    pointer-events: none;
  }
  .hero-art::after {
    background: linear-gradient(90deg, rgba(17, 31, 51, .72), transparent 72%),
                linear-gradient(0deg, rgba(12, 24, 40, .55), transparent 80%);
  }
  .filter-bar { overscroll-behavior-inline: contain; }
  .article-card { min-width: 0; }
  .dialog-tags { flex-wrap: wrap; }
  .article-dialog { max-height: min(88vh, 850px); max-height: min(88dvh, 850px); overscroll-behavior: contain; }
  .dialog-content { overflow-wrap: anywhere; }
  .site-footer { padding-bottom: max(4px, env(safe-area-inset-bottom)); }
}

@media (max-width: 380px) {
  .breadcrumbs { font-size: 9px; }
  .hero { padding-right: 16px; padding-left: 16px; }
  .hero h1 { font-size: 30px; }
  .hero-meta { font-size: 8px; }
  .meta-divider { display: none; }

  .section-heading { align-items: center; }
}

/* Compact the fixed desktop rail on short windows so its theme control stays in view. */
@media (max-height: 720px) {
  .sidebar-spacer { min-height: 0; }
  .brand { padding-bottom: 14px; }
  .nav-caption { margin-top: 6px; margin-bottom: 5px; }
  .nav-caption-spaced { margin-top: 14px; }
  .nav-link { min-height: 36px; }
  .topic-link { padding-top: 6px; padding-bottom: 6px; }
  .sidebar-bottom { padding-top: 7px; }
  .theme-toggle { padding-top: 5px; padding-bottom: 5px; }
}

@media (max-width: 850px) and (max-height: 700px) {
  .brand { padding-bottom: 10px; }
  .nav-caption { margin-top: 4px; margin-bottom: 3px; }
  .nav-caption-spaced { margin-top: 10px; }
  .nav-link { min-height: 34px; }
  .topic-link { padding-top: 4px; padding-bottom: 4px; }
  .sidebar-bottom { padding-top: 5px; }
  .theme-toggle { padding-top: 3px; padding-bottom: 3px; }
}

/* Reading dialog: opaque surfaces and stronger text contrast in both themes. */
.article-dialog {
  background: rgba(11, 20, 33, .98);
  border-color: rgba(173, 205, 243, .2);
  box-shadow: 0 32px 100px rgba(0, 0, 0, .58);
}
.dialog-close {
  display: grid;
  place-items: center;
  padding: 0;
  line-height: 1;
  text-align: center;
  font-family: Arial, sans-serif;
  font-weight: 400;
  box-shadow: 0 8px 22px rgba(0, 0, 0, .2), inset 0 1px rgba(255, 255, 255, .08);
}
.dialog-eyebrow { color: #a7d4f5; }
.dialog-meta { color: #a9bad0; }
.dialog-content .dialog-lead { color: #d0dceb; font-size: 14px; }
.dialog-content h3 { color: #e5eef8; font-size: 17px; }
.dialog-content p { color: #c0ccda; font-size: 13px; line-height: 1.9; }
.dialog-tags span { color: #b4c5d8; }

body[data-theme="light"] .article-dialog {
  color: #1a3047;
  background: #f5f8fc;
  border-color: rgba(65, 98, 132, .28);
  box-shadow: 0 32px 90px rgba(28, 52, 78, .3);
}
body[data-theme="light"] .dialog-eyebrow { color: #2f668e; }
body[data-theme="light"] .dialog-content h2,
body[data-theme="light"] .dialog-content h3 { color: #192f46; }
body[data-theme="light"] .dialog-meta { color: #506983; }
body[data-theme="light"] .dialog-content .dialog-lead {
  border-left-color: #4388b7;
  background: #e5eff7;
  color: #304b65;
}
body[data-theme="light"] .dialog-content p { color: #3f5871; }
body[data-theme="light"] .dialog-code {
  border-color: rgba(57, 86, 116, .24);
  background: #17283a;
  color: #b9eadb;
}
body[data-theme="light"] .dialog-tags span {
  border-color: rgba(65, 98, 132, .24);
  background: rgba(78, 128, 171, .07);
  color: #405a73;
}
body[data-theme="light"] .dialog-close {
  border-color: rgba(62, 103, 141, .3);
  background: #e7f0f7;
  color: #244b6b;
  box-shadow: 0 6px 18px rgba(42, 76, 108, .14), inset 0 1px rgba(255, 255, 255, .9);
}

/* Desktop header shares the content column and hero's inner alignment, like the fixed glass sidebar. */
@media (min-width: 851px) {
  .topbar {
    top: 14px;
    width: 100%;
    max-width: 1420px;
    height: 70px;
    margin: 14px auto 0;
    padding: 0 clamp(28px, 4vw, 55px);
    border: 1px solid var(--panel-border);
    border-radius: 18px;
    background: rgba(14, 25, 42, .78);
    box-shadow: 0 14px 40px rgba(0, 0, 0, .16), inset 0 1px rgba(255, 255, 255, .06);
  }
  .page-content { padding-top: 24px; }
  body[data-theme="light"] .topbar {
    background: rgba(244, 249, 253, .84);
    box-shadow: 0 14px 40px rgba(47, 81, 113, .1), inset 0 1px rgba(255, 255, 255, .9);
  }
}

body[data-theme="light"] .sidebar { background: rgba(246, 250, 253, .94); }
body[data-theme="light"] .brand-mark { background: rgba(96, 145, 184, .08); }
body[data-theme="light"] .brand-mark span { background: #6385a1; }
body[data-theme="light"] .nav-link[aria-current="location"] { background: rgba(97, 160, 210, .13); box-shadow: inset 2px 0 #5d9fd1; }
body[data-theme="light"] .article-card:hover { background: rgba(255, 255, 255, .92); }

.sort-button.oldest-first .icon { transform: rotate(180deg); }

@media (max-width: 600px) {
  .page-content { margin-left: max(12px, env(safe-area-inset-left)); }
  .hero-description { font-size: 13px; }

}

.site-search {
  position: relative;
  --search-surface: #142137;
  --search-hover: #223752;
  --search-link: var(--accent);
  --search-shadow: 0 14px 38px rgba(0, 0, 0, .3);
}
body[data-theme="light"] .site-search {
  --search-surface: #f5f9fd;
  --search-hover: #e6eff7;
  --search-link: #285c82;
  --search-shadow: 0 14px 38px rgba(46, 81, 119, .16);
}
.search-box input { flex: 1; }
.search-box label { flex: 0 0 auto; cursor: text; }
.search-box input {
  flex: 1;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 13px;
}
.search-box input::placeholder { color: var(--text-soft); }
.search-box input::-webkit-search-cancel-button { display: none; }
.search-clear {
  display: grid;
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
}
.search-clear:hover { background: var(--search-hover); color: var(--text); }
.search-clear:not([hidden]) + kbd { display: none; }
.search-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: max(100%, 350px);
  max-height: min(26rem, calc(100vh - 96px));
  max-height: min(26rem, calc(100dvh - 96px));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  background: var(--search-surface);
  box-shadow: var(--search-shadow);
}
.site-search [hidden] { display: none; }
.search-status {
  overflow: hidden;
  margin: 0;
  padding: 8px 10px;
  color: var(--text-soft);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-results { margin: 0; padding: 0; list-style: none; }
.search-result, .search-all {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.search-result > span { display: grid; min-width: 0; gap: 1px; }
.search-result-title { font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.search-result-meta { color: var(--text-soft); font-size: 11px; }
.search-result .icon { color: var(--text-soft); }
.search-result:hover, .search-all:hover { background: var(--search-hover); }
.search-all {
  margin-top: 4px;
  border-top: 1px solid var(--panel-border);
  color: var(--search-link);
  font-size: 13px;
}
.search-empty { margin: 0; padding: 4px 10px 12px; color: var(--text-soft); }
.site-search button:focus-visible, #articlesTitle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.active-search-query { margin: -6px 0 12px; color: var(--text-soft); overflow-wrap: anywhere; }
.article-grid[hidden] { display: none; }
.article-card:only-child { grid-column: 1 / -1; min-height: 0; }
.filter-bar { scroll-margin-top: 8px; }

.articles-section:target .section-heading h2,
.filter-bar:target,
.about-card:target {
  outline: 2px solid var(--accent-strong);
  outline-offset: 4px;
}
.articles-section:target .section-heading h2,
.filter-bar:target { border-radius: 8px; }

@media (max-width: 600px) {
  .site-search { position: static; width: 38px; }
  .search-box { position: relative; }
  .site-search:not(:focus-within) .search-box label {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
  }
  .site-search:not(:focus-within) .search-clear { display: none; }
  .site-search:focus-within .search-box {
    position: absolute;
    top: calc((100% - 37px + env(safe-area-inset-top)) / 2);
    left: 54px;
    right: max(13px, env(safe-area-inset-right));
    z-index: 3;
    width: auto;
    background: var(--search-surface);
    border-color: var(--accent);
  }
  .site-search:focus-within .search-box input { opacity: 1; font-size: 16px; }
  .search-panel {
    top: calc(100% + 3px);
    right: 0;
    left: max(12px, env(safe-area-inset-left));
    width: auto;
  }
}
