/* ============================================
   ZEUS THEME — Dark-First, SEO-Optimized
   Single CSS file • System fonts • Zero animations
   Target: PageSpeed 100
   ============================================ */

/* --- CSS Variables / Theming --- */
:root {
  /* Dark mode (default) */
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-tertiary: #21262d;
  --bg-card: #161b22;
  --bg-card-hover: #1c2128;
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;
  --accent: #58a6ff;
  --accent-hover: #79c0ff;
  --accent-subtle: rgba(56,139,253,.15);
  --border: #30363d;
  --border-light: #21262d;
  --shadow: 0 1px 3px rgba(0,0,0,.3);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.4);
  --code-bg: #1c2128;
  --tag-bg: #1c2128;
  --tag-text: #8b949e;
  --success: #3fb950;
  --warning: #d29922;
  --danger: #f85149;
  --radius: 8px;
  --radius-sm: 4px;
  --max-content: 720px;
  --max-container: 1100px;
}

[data-theme="light"] {
  --bg-primary: #ffffff;
  --bg-secondary: #f6f8fa;
  --bg-tertiary: #eaeef2;
  --bg-card: #ffffff;
  --bg-card-hover: #f6f8fa;
  --text-primary: #1f2328;
  --text-secondary: #656d76;
  --text-muted: #8b949e;
  --accent: #0969da;
  --accent-hover: #0550ae;
  --accent-subtle: rgba(9,105,218,.1);
  --border: #d0d7de;
  --border-light: #eaeef2;
  --shadow: 0 1px 3px rgba(31,35,40,.08);
  --shadow-lg: 0 8px 24px rgba(31,35,40,.12);
  --code-bg: #f6f8fa;
  --tag-bg: #eaeef2;
  --tag-text: #656d76;
}

/* --- Reset --- */
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
html{-webkit-text-size-adjust:100%;scroll-behavior:auto;line-height:1.5;-moz-tab-size:4;tab-size:4}
body{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:16px;line-height:1.6;color:var(--text-primary);background:var(--bg-primary);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}
img,video{max-width:100%;height:auto;display:block}
a{color:var(--accent);text-decoration:none}
a:hover{color:var(--accent-hover)}
ul,ol{list-style:none}
button{font:inherit;cursor:pointer;border:0;background:0 0;color:inherit}
input,textarea{font:inherit;color:inherit;background:var(--bg-secondary);border:1px solid var(--border);border-radius:var(--radius-sm);padding:.5rem .75rem}
input:focus,textarea:focus{outline:2px solid var(--accent);outline-offset:-1px;border-color:var(--accent)}
table{border-collapse:collapse;width:100%}
th,td{padding:.6rem .8rem;border:1px solid var(--border);text-align:left}
th{background:var(--bg-secondary);font-weight:600}

/* --- Layout --- */
.wrap{max-width:var(--max-container);margin:0 auto;padding:0 1rem}
.content-wrap{max-width:var(--max-content);margin:0 auto}

/* --- Header --- */
.site-header{background:var(--bg-secondary);border-bottom:1px solid var(--border);position:sticky;top:0;z-index:100}
.header-inner{display:flex;align-items:center;justify-content:space-between;height:56px;gap:1rem}
.site-brand a{font-size:1.25rem;font-weight:700;color:var(--text-primary);letter-spacing:-.02em}
.header-actions{display:flex;align-items:center;gap:.5rem}

/* Nav */
.nav-menu{display:flex;gap:.25rem}
.nav-menu a{padding:.4rem .75rem;border-radius:var(--radius-sm);font-size:.875rem;font-weight:500;color:var(--text-secondary)}
.nav-menu a:hover{color:var(--text-primary);background:var(--bg-tertiary)}

/* Search */
.search-box{position:relative}
.search-box input{width:220px;padding:.4rem .75rem .4rem 2rem;font-size:.8125rem;border-radius:20px;background:var(--bg-tertiary);border-color:var(--border)}
.search-icon{position:absolute;left:.6rem;top:50%;transform:translateY(-50%);color:var(--text-muted);pointer-events:none}

/* Theme + Layout toggles */
.btn-icon{display:inline-flex;align-items:center;justify-content:center;width:36px;height:36px;border-radius:var(--radius-sm);color:var(--text-secondary)}
.btn-icon:hover{background:var(--bg-tertiary);color:var(--text-primary)}
.btn-icon svg{width:18px;height:18px}
[data-theme="light"] .icon-sun{display:none}
[data-theme="dark"] .icon-moon,[data-theme=""] .icon-moon{display:none}
html:not([data-theme="light"]) .icon-moon{display:none}
html:not([data-theme="light"]) .icon-sun{display:inline}
[data-theme="light"] .icon-moon{display:inline}
[data-theme="light"] .icon-sun{display:none}

/* Mobile menu */
.mobile-toggle{display:none;flex-direction:column;gap:4px;padding:8px}
.mobile-toggle span{display:block;width:20px;height:2px;background:var(--text-secondary);border-radius:1px}
.mobile-nav{display:none}

/* --- Home: Dual Layout --- */
.home-header{display:flex;align-items:center;justify-content:space-between;margin:2rem 0 1.25rem;padding-bottom:.75rem;border-bottom:1px solid var(--border)}
.home-header h2{font-size:1.125rem;font-weight:600;color:var(--text-primary)}
.layout-toggle{display:flex;gap:2px;background:var(--bg-tertiary);border-radius:var(--radius-sm);padding:2px}
.layout-btn{padding:6px 8px;border-radius:3px;color:var(--text-muted)}
.layout-btn.active{background:var(--bg-card);color:var(--accent);box-shadow:var(--shadow)}
.layout-btn svg{width:16px;height:16px;display:block}

/* Grid mode */
.posts-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));gap:1.25rem}
.post-card{background:var(--bg-card);border:1px solid var(--border);border-radius:var(--radius);overflow:hidden}
.post-card:hover{border-color:var(--accent);box-shadow:var(--shadow)}
.post-card-img{aspect-ratio:16/9;overflow:hidden;background:var(--bg-tertiary)}
.post-card-img img{width:100%;height:100%;object-fit:cover}
.post-card-body{padding:1rem}
.post-card-cat{font-size:.75rem;font-weight:600;color:var(--accent);text-transform:uppercase;letter-spacing:.04em;margin-bottom:.4rem}
.post-card-title{font-size:1rem;font-weight:600;line-height:1.4;color:var(--text-primary);display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.post-card-title a{color:inherit}
.post-card-title a:hover{color:var(--accent)}
.post-card-excerpt{font-size:.8125rem;color:var(--text-secondary);margin-top:.5rem;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;line-height:1.5}
.post-card-meta{display:flex;align-items:center;gap:.75rem;margin-top:.75rem;font-size:.75rem;color:var(--text-muted)}
.post-card-meta svg{width:14px;height:14px;flex-shrink:0}

/* List mode */
/* list view — handled below */

/* Hide class */
.hidden{display:none!important}

/* --- Sidebar --- */
.home-layout{display:grid;grid-template-columns:1fr 300px;gap:2rem;align-items:start}
.sidebar{position:sticky;top:72px}
.sidebar-widget{background:var(--bg-card);border:1px solid var(--border);border-radius:var(--radius);padding:1.25rem;margin-bottom:1.25rem}
.sidebar-widget h3{font-size:.875rem;font-weight:600;text-transform:uppercase;letter-spacing:.04em;color:var(--text-muted);margin-bottom:1rem;padding-bottom:.5rem;border-bottom:1px solid var(--border)}
.cat-list a{display:flex;justify-content:space-between;padding:.5rem 0;border-bottom:1px solid var(--border-light);font-size:.875rem;color:var(--text-secondary)}
.cat-list a:last-child{border-bottom:0}
.cat-list a:hover{color:var(--accent)}

/* --- Pagination --- */
.pagination{display:flex;justify-content:center;align-items:center;gap:.5rem;margin:2.5rem 0}
.pagination a,.pagination span{display:inline-flex;align-items:center;justify-content:center;min-width:36px;height:36px;padding:0 .75rem;border-radius:var(--radius-sm);font-size:.875rem;font-weight:500;border:1px solid var(--border);color:var(--text-secondary)}
.pagination a:hover{background:var(--bg-tertiary);color:var(--text-primary);border-color:var(--accent)}
.pagination .current{background:var(--accent);color:#fff;border-color:var(--accent)}

/* --- Single Post --- */
.breadcrumb{font-size:.8125rem;color:var(--text-muted);margin:1.5rem 0 1rem;display:flex;flex-wrap:wrap;gap:.25rem}
.breadcrumb a{color:var(--text-secondary)}
.breadcrumb a:hover{color:var(--accent)}
.breadcrumb .sep{color:var(--text-muted)}

.post-header{margin-bottom:2rem}
.post-header h1{font-size:2rem;font-weight:700;line-height:1.3;letter-spacing:-.02em;color:var(--text-primary)}
.post-meta{display:flex;flex-wrap:wrap;align-items:center;gap:.75rem;margin-top:1rem;font-size:.8125rem;color:var(--text-muted)}
.post-meta svg{width:14px;height:14px}
.author-chip{display:inline-flex;align-items:center;gap:.4rem;font-weight:500;color:var(--text-secondary)}
.author-avatar{width:28px;height:28px;border-radius:50%;background:var(--accent-subtle);display:flex;align-items:center;justify-content:center;font-weight:700;font-size:.75rem;color:var(--accent)}

.featured-image{margin:0 0 2rem;border-radius:var(--radius);overflow:hidden;border:1px solid var(--border)}
.featured-image img{width:100%;height:auto;display:block}

/* Entry Content */
.entry-content{line-height:1.8;color:var(--text-primary);font-size:1.0625rem}
.entry-content h2{font-size:1.5rem;font-weight:700;margin:2.5rem 0 1rem;padding-bottom:.5rem;border-bottom:1px solid var(--border);letter-spacing:-.01em}
.entry-content h3{font-size:1.25rem;font-weight:600;margin:2rem 0 .75rem}
.entry-content h4{font-size:1.1rem;font-weight:600;margin:1.5rem 0 .5rem}
.entry-content p{margin-bottom:1.25rem}
.entry-content ul,.entry-content ol{margin:1rem 0 1.25rem 1.5rem}
.entry-content li{margin-bottom:.4rem}
.entry-content ul{list-style:disc}
.entry-content ol{list-style:decimal}
.entry-content blockquote{border-left:3px solid var(--accent);padding:.75rem 1.25rem;margin:1.5rem 0;background:var(--bg-secondary);border-radius:0 var(--radius-sm) var(--radius-sm) 0;color:var(--text-secondary);font-style:italic}
.entry-content pre{background:var(--code-bg);border:1px solid var(--border);border-radius:var(--radius-sm);padding:1rem;overflow-x:auto;margin:1.5rem 0;font-size:.875rem;line-height:1.6}
.entry-content code{font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,monospace;font-size:.875em;padding:.15rem .35rem;background:var(--code-bg);border-radius:3px}
.entry-content pre code{padding:0;background:0 0}
.entry-content a{color:var(--accent);text-decoration:underline;text-underline-offset:2px}
.entry-content a:hover{color:var(--accent-hover)}
.entry-content img{border-radius:var(--radius-sm);margin:1rem 0}
.entry-content strong{font-weight:600}

/* TOC */
.toc-container{background:var(--bg-secondary);border:1px solid var(--border);border-radius:var(--radius);padding:1.25rem;margin:1.5rem 0}
.toc-container summary{font-weight:600;font-size:.9375rem;cursor:pointer;color:var(--text-primary);list-style:none;display:flex;align-items:center;justify-content:space-between}
.toc-container summary::-webkit-details-marker{display:none}
.toc-container summary::after{content:"▾";font-size:.75rem;color:var(--text-muted)}
.toc-container[open] summary::after{content:"▴"}
.toc-container ol{margin:.75rem 0 0 1.25rem;list-style:decimal}
.toc-container li{margin-bottom:.35rem;font-size:.875rem}
.toc-container a{color:var(--text-secondary)}
.toc-container a:hover{color:var(--accent)}

/* FAQ */
.faq-item{border:1px solid var(--border);border-radius:var(--radius-sm);margin-bottom:.5rem;overflow:hidden}
.faq-question{width:100%;padding:.875rem 1rem;text-align:left;font-weight:600;font-size:.9375rem;display:flex;justify-content:space-between;align-items:center;background:var(--bg-secondary);color:var(--text-primary)}
.faq-question::after{content:"+";font-size:1.125rem;color:var(--text-muted);flex-shrink:0}
.faq-item.active .faq-question::after{content:"−"}
.faq-answer{display:none;padding:1rem;font-size:.9375rem;color:var(--text-secondary);line-height:1.7}
.faq-item.active .faq-answer{display:block}

/* Share */
.share-bar{display:flex;gap:.5rem;margin:2rem 0;padding:1.5rem 0;border-top:1px solid var(--border);border-bottom:1px solid var(--border)}
.share-btn{display:inline-flex;align-items:center;justify-content:center;width:40px;height:40px;border-radius:var(--radius-sm);background:var(--bg-tertiary);color:var(--text-secondary)}
.share-btn:hover{background:var(--accent);color:#fff}
.share-btn svg{width:18px;height:18px}

/* Related Posts */
.related-section{margin:3rem 0 2rem}
.related-section h2{font-size:1.125rem;font-weight:600;margin-bottom:1.25rem;padding-bottom:.5rem;border-bottom:1px solid var(--border)}
.related-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:1rem}
.related-card{background:var(--bg-card);border:1px solid var(--border);border-radius:var(--radius);overflow:hidden}
.related-card:hover{border-color:var(--accent)}
.related-card-img{aspect-ratio:16/9;overflow:hidden;background:var(--bg-tertiary)}
.related-card-img img{width:100%;height:100%;object-fit:cover}
.related-card-body{padding:.875rem}
.related-card-title{font-size:.875rem;font-weight:600;line-height:1.4;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.related-card-title a{color:var(--text-primary)}
.related-card-title a:hover{color:var(--accent)}
.related-card-date{font-size:.75rem;color:var(--text-muted);margin-top:.4rem}

/* --- Footer --- */
.site-footer{border-top:1px solid var(--border);padding:2rem 0;margin-top:3rem;background:var(--bg-secondary)}
.footer-inner{display:flex;justify-content:space-between;align-items:center;font-size:.8125rem;color:var(--text-muted)}
.footer-brand{font-weight:600;color:var(--text-secondary)}

/* Back to top */
.back-top{position:fixed;bottom:1.5rem;right:1.5rem;width:40px;height:40px;border-radius:var(--radius);background:var(--bg-tertiary);border:1px solid var(--border);color:var(--text-secondary);display:none;align-items:center;justify-content:center;z-index:50}
.back-top.visible{display:flex}
.back-top:hover{background:var(--accent);color:#fff;border-color:var(--accent)}
.back-top svg{width:18px;height:18px}

/* --- Static Pages --- */
.static-page{max-width:var(--max-content);margin:2rem auto;padding:0 1rem}
.static-page h1{font-size:1.75rem;font-weight:700;margin-bottom:1.5rem;padding-bottom:.75rem;border-bottom:1px solid var(--border)}
.static-page .entry-content h2{font-size:1.25rem}

/* --- Print --- */
@media print{
  .site-header,.site-footer,.share-bar,.related-section,.back-top,.sidebar,.pagination,.breadcrumb,.layout-toggle,.search-box{display:none!important}
  body{background:#fff;color:#000;font-size:12pt}
  .entry-content a{color:#000;text-decoration:underline}
  .entry-content a::after{content:" (" attr(href) ")";font-size:.8em}
}

/* --- Responsive --- */
@media(max-width:1024px){
  .home-layout{grid-template-columns:1fr}
  .sidebar{display:none}
}
@media(max-width:768px){
  .nav-menu{display:none}
  .mobile-toggle{display:flex}
  .mobile-nav.open{display:block;position:absolute;top:56px;left:0;right:0;background:var(--bg-secondary);border-bottom:1px solid var(--border);padding:1rem;z-index:99}
  .mobile-nav a{display:block;padding:.6rem 1rem;font-size:.9375rem;color:var(--text-secondary);border-radius:var(--radius-sm)}
  .mobile-nav a:hover{background:var(--bg-tertiary);color:var(--text-primary)}
  .search-box input{width:160px}
  .posts-grid{grid-template-columns:1fr}
  .posts-list .post-card{flex-direction:column}
  .posts-list .post-card-img{width:100%;min-width:auto;aspect-ratio:16/9}
  .post-header h1{font-size:1.5rem}
  .related-grid{grid-template-columns:1fr}
  .footer-inner{flex-direction:column;gap:.5rem;text-align:center}
  .header-inner{flex-wrap:wrap;height:auto;padding:.75rem 0}
}
@media(max-width:480px){
  .search-box{display:none}
  .post-header h1{font-size:1.3rem}
  .entry-content{font-size:1rem}
  .home-header{flex-direction:column;align-items:flex-start;gap:.75rem}
}

/* Recent Posts Widget */
.recent-item{display:flex;gap:10px;padding:10px 0;border-bottom:1px solid var(--border)}
.recent-item:last-child{border-bottom:none}
.recent-item img{width:64px;height:64px;object-fit:cover;border-radius:6px;flex-shrink:0}
.recent-item div{display:flex;flex-direction:column;gap:4px;min-width:0}
.recent-item a{font-size:13px;line-height:1.4;color:var(--text);font-weight:500;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.recent-item a:hover{color:var(--accent)}
.recent-item time{font-size:11px;color:var(--muted)}
/* Posts List View */
.posts-list{display:flex!important;flex-direction:column!important;gap:14px!important}
.posts-list .post-card{display:grid!important;grid-template-columns:200px 1fr!important;flex-direction:unset!important;border-radius:10px;overflow:hidden;border:1px solid var(--border);background:var(--bg-card)}
.posts-list .post-card-img{width:200px!important;min-width:200px!important;height:140px!important;aspect-ratio:unset!important;overflow:hidden;flex-shrink:0}
.posts-list .post-card-img img{width:100%!important;height:140px!important;object-fit:cover!important;display:block}
.posts-list .post-card-body{padding:14px 18px!important;display:flex!important;flex-direction:column!important;min-width:0;overflow:hidden;justify-content:flex-start!important}
.posts-list .post-card-cat{margin-bottom:4px}
.posts-list .post-card-title{font-size:1rem;margin-bottom:6px;-webkit-line-clamp:2}
.posts-list .post-card-excerpt{font-size:13px;-webkit-line-clamp:2;flex:1;color:var(--text-secondary)}
.posts-list .post-card-meta{margin-top:8px;font-size:12px}

/* Static Pages */
.static-page{max-width:800px;margin:0 auto;padding:40px 0}
.static-page h1{font-size:2rem;margin-bottom:24px;color:var(--text)}
.static-page .entry-content h2{font-size:1.3rem;margin:28px 0 12px;color:var(--text)}
.static-page .entry-content p{margin-bottom:16px;line-height:1.8;color:var(--text-muted,var(--text))}
.static-page .entry-content ul,.static-page .entry-content ol{margin:12px 0 16px 24px}
.static-page .entry-content li{margin-bottom:6px;line-height:1.7}

/* Footer copyright center */
.footer-inner{justify-content:center!important;text-align:center}

/* Mobile sidebar */
@media(max-width:900px){
  .home-layout{flex-direction:column}
  .sidebar{display:flex;flex-direction:row;flex-wrap:wrap;gap:16px;padding-top:8px;border-top:1px solid var(--border);margin-top:8px}
  .sidebar-widget{flex:1;min-width:240px}
  .sidebar-widget h3{margin-bottom:12px}
  .cat-list{display:flex;flex-wrap:wrap;gap:8px}
  .cat-list a{padding:5px 12px;background:var(--card-bg);border:1px solid var(--border);border-radius:20px;font-size:12px}
  .recent-item{padding:8px 0}
}
@media(max-width:600px){
  .sidebar{flex-direction:column}
  .sidebar-widget{min-width:unset;width:100%}
}