/*!
 * Theme Name:           MiniBlog
 * Theme URI:            https://example.com/miniblog
 * Description:          A clean, modern, minimal high-end WordPress blog theme. White-driven design with light gray, black text and a subtle brand accent. Perfect for personal, tech, lifestyle and photography blogs.
 * Version:             1.0.0
 * Requires at least:   5.8
 * Tested up to:        6.5
 * Requires PHP:        7.4
 * Author:              WorkBuddy
 * Author URI:          https://example.com
 * License:             GPL-2.0-or-later
 * License URI:         https://www.gnu.org/licenses/gpl-2.0.html
 * Text Domain:         miniblog
 * Domain Path:         /languages
 * Tags:                blog, minimal, white, responsive, custom-colors, custom-logo, featured-images, threaded-comments, translation-ready, accessibility-ready
 */

/* ==========================================================================
   1. DESIGN TOKENS
   ========================================================================== */
:root {
    /* Brand & surfaces (overridden at runtime by the Customizer) */
    --brand: #4f6df5;
    --brand-strong: #3b54d6;
    --brand-soft: rgba(79, 109, 245, 0.10);

    --bg: #ffffff;
    --bg-alt: #f6f7f9;
    --surface: #ffffff;
    --surface-2: #f6f7f9;
    --border: #ececf1;
    --border-strong: #e0e0e8;

    --text: #1a1c20;
    --text-2: #5b606b;
    --text-3: #8b909c;

    --shadow-sm: 0 1px 2px rgba(20, 23, 33, 0.04), 0 1px 3px rgba(20, 23, 33, 0.06);
    --shadow-md: 0 4px 14px rgba(20, 23, 33, 0.06), 0 2px 6px rgba(20, 23, 33, 0.04);
    --shadow-lg: 0 18px 50px rgba(20, 23, 33, 0.10);

    /* Geometry (overridden by Customizer) */
    --radius: 14px;
    --radius-sm: 10px;
    --radius-pill: 999px;
    --container: 1200px;
    --content-gap: 32px;

    /* Spacing scale */
    --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
    --sp-5: 24px; --sp-6: 32px; --sp-7: 48px; --sp-8: 64px;

    /* Typography */
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    --font-mono: "SFMono-Regular", "JetBrains Mono", "Fira Code", Consolas,
                 "Liberation Mono", Menlo, monospace;

    --fs-xs: 12px; --fs-sm: 13px; --fs-base: 15px; --fs-md: 17px;
    --fs-lg: 20px; --fs-xl: 26px; --fs-2xl: 34px; --fs-3xl: 44px;

    --leading: 1.75;
    --transition: 180ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark mode tokens */
[data-theme="dark"] {
    --brand: #7c93ff;
    --brand-strong: #6a82ff;
    --brand-soft: rgba(124, 147, 255, 0.14);

    --bg: #0f1115;
    --bg-alt: #14171d;
    --surface: #171a21;
    --surface-2: #1d212a;
    --border: #262b35;
    --border-strong: #323845;

    --text: #e7e9ee;
    --text-2: #aab1bf;
    --text-3: #7b8290;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 20px 55px rgba(0, 0, 0, 0.45);
}

/* ==========================================================================
   2. RESET & BASE
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	*, *::before, *::after {
		animation-duration: 0.001ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.001ms !important;
		scroll-behavior: auto !important;
	}
	.carousel-track { transition: none !important; }
}

body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: var(--fs-base);
    line-height: var(--leading);
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    transition: background var(--transition), color var(--transition);
}

img, svg, video { max-width: 100%; height: auto; display: block; }
a { color: var(--brand); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--brand-strong); }
h1, h2, h3, h4, h5, h6 { margin: 0 0 var(--sp-3); font-weight: 700; line-height: 1.3; color: var(--text); }
h1 { font-size: var(--fs-3xl); letter-spacing: -0.02em; }
h2 { font-size: var(--fs-2xl); letter-spacing: -0.01em; }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-lg); }
p { margin: 0 0 var(--sp-4); }
ul, ol { margin: 0 0 var(--sp-4) var(--sp-5); padding: 0; }
blockquote {
    margin: var(--sp-5) 0; padding: var(--sp-3) var(--sp-5);
    border-left: 3px solid var(--brand); background: var(--surface-2);
    border-radius: var(--radius-sm); color: var(--text-2); font-style: italic;
}
code, kbd, pre { font-family: var(--font-mono); font-size: 0.9em; }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--sp-6) 0; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

/* ==========================================================================
   3. LAYOUT PRIMITIVES
   ========================================================================== */
.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 var(--sp-5); }
.site-content { padding: var(--sp-7) 0; }
.layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: var(--content-gap);
    align-items: start;
}
.layout.no-sidebar { grid-template-columns: minmax(0, 1fr); }
.layout.no-sidebar .sidebar { display: none; }
body.sidebar-left .layout { grid-template-columns: 320px minmax(0, 1fr); }
body.sidebar-left .layout > .main-col { order: 2; }
body.sidebar-left .layout > .sidebar { order: 1; }
@media (max-width: 900px) {
	body.sidebar-left .layout,
	body.sidebar-left .layout.no-sidebar { grid-template-columns: 1fr; }
	body.sidebar-left .layout > .main-col { order: 1; }
	body.sidebar-left .layout > .sidebar { order: 2; }
}
.main-col { min-width: 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;
}

/* ==========================================================================
   4. BUTTONS & TAGS
   ========================================================================== */
.btn {
    display: inline-flex; align-items: center; gap: var(--sp-2);
    padding: 10px 18px; border-radius: var(--radius-pill);
    font-size: var(--fs-sm); font-weight: 600; cursor: pointer;
    border: 1px solid transparent; transition: all var(--transition); line-height: 1;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-strong); color: #fff; transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }

.tag-pill, .cat-link {
    display: inline-flex; align-items: center;
    padding: 3px 10px; border-radius: var(--radius-pill);
    font-size: var(--fs-xs); font-weight: 500; line-height: 1.6;
    background: var(--surface-2); color: var(--text-2);
    transition: all var(--transition);
}
.tag-pill:hover, .cat-link:hover { background: var(--brand-soft); color: var(--brand); }
.cat-link { background: var(--brand-soft); color: var(--brand); }
.meta { color: var(--text-3); font-size: var(--fs-sm); display: inline-flex; align-items: center; gap: 6px; }
.meta svg { width: 14px; height: 14px; opacity: 0.7; }

/* ==========================================================================
   5. HEADER
   ========================================================================== */
.site-header {
    position: sticky; top: 0; z-index: 100;
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--border);
    transition: box-shadow var(--transition), background var(--transition);
}
.site-header.is-scrolled { box-shadow: var(--shadow-sm); }
.header-inner { display: flex; align-items: center; gap: var(--sp-5); height: 64px; }
.site-brand { display: flex; align-items: center; gap: var(--sp-3); flex-shrink: 0; }
.site-brand img { width: 36px; height: 36px; border-radius: var(--radius-sm); object-fit: cover; }
.site-brand .brand-name { font-size: var(--fs-md); font-weight: 700; color: var(--text); }
.site-brand .brand-sub { font-size: var(--fs-xs); color: var(--text-3); }
.site-brand .brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.site-brand .brand-mark { font-family: var(--font-sans); }

.primary-nav { margin-left: auto; }
.primary-nav ul { display: flex; align-items: center; gap: var(--sp-2); list-style: none; margin: 0; padding: 0; }
.primary-nav a {
    display: inline-block; padding: 8px 12px; border-radius: var(--radius-sm);
    color: var(--text-2); font-size: var(--fs-sm); font-weight: 500;
}
.primary-nav a:hover, .primary-nav .current-menu-item > a, .primary-nav .current-menu-ancestor > a { color: var(--brand); background: var(--brand-soft); }

/* Desktop dropdown sub-menus (WP outputs .sub-menu for depth >= 2). */
.primary-nav li { position: relative; }
.primary-nav .sub-menu {
	position: absolute; top: 100%; left: 0; min-width: 200px;
	background: var(--surface); border: 1px solid var(--border);
	border-radius: var(--radius); box-shadow: var(--shadow-md);
	padding: var(--sp-2); margin: 0; list-style: none;
	display: flex; flex-direction: column; gap: 2px;
	opacity: 0; visibility: hidden; transform: translateY(6px);
	transition: opacity var(--transition), transform var(--transition), visibility var(--transition);
	z-index: 120;
}
.primary-nav li:hover > .sub-menu,
.primary-nav li:focus-within > .sub-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.primary-nav .sub-menu a { padding: 8px 10px; border-radius: var(--radius-sm); white-space: nowrap; background: transparent; }
.primary-nav .sub-menu a:hover { background: var(--brand-soft); }
.primary-nav .sub-menu .sub-menu { top: 0; left: 100%; }

.header-actions { display: flex; align-items: center; gap: var(--sp-2); flex-shrink: 0; }
.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; border-radius: var(--radius-sm);
    border: 1px solid transparent; background: transparent; color: var(--text-2);
    cursor: pointer; transition: all var(--transition);
}
.icon-btn:hover { background: var(--surface-2); color: var(--brand); }
.icon-btn svg { width: 20px; height: 20px; }

.search-pop {
    position: absolute; top: 64px; right: var(--sp-5); width: min(420px, 92vw);
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow-lg);
    padding: var(--sp-4); opacity: 0; visibility: hidden; transform: translateY(-8px);
    transition: all var(--transition); z-index: 110;
}
.search-pop.open { opacity: 1; visibility: visible; transform: translateY(0); }
.search-pop form { display: flex; gap: var(--sp-2); }
.search-pop input {
    flex: 1; padding: 10px 14px; border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm); background: var(--bg); color: var(--text); font-size: var(--fs-base);
}
.search-pop input:focus { outline: none; border-color: var(--brand); }
.search-pop button, .widget-search button {
    padding: 10px 16px; border: 0; border-radius: var(--radius-sm);
    background: var(--brand); color: #fff; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.search-pop button:hover, .widget-search button:hover { background: var(--brand-strong); }

/* Mobile menu */
.nav-toggle { display: none; }
.mobile-nav {
    position: fixed; inset: 0 0 0 auto; width: min(320px, 84vw);
    background: var(--surface); box-shadow: var(--shadow-lg);
    transform: translateX(100%); transition: transform var(--transition); z-index: 200;
    padding: var(--sp-6) var(--sp-5); overflow-y: auto;
}
.mobile-nav.open { transform: translateX(0); }
.mobile-nav ul { list-style: none; margin: 0; padding: 0; }
.mobile-nav a { display: block; padding: 12px 8px; border-radius: var(--radius-sm); color: var(--text); font-weight: 500; }
.mobile-nav a:hover { background: var(--surface-2); color: var(--brand); }
.mobile-nav .menu-item-has-children { position: relative; }
.mobile-nav .sub-menu { padding-left: var(--sp-4); border-left: 1px solid var(--border); margin: 2px 0 6px; display: none; }
.mobile-nav .menu-item-has-children.open > .sub-menu { display: block; }
.mobile-nav .sub-menu a { font-size: var(--fs-sm); color: var(--text-2); font-weight: 400; }
.mobile-nav .submenu-toggle {
	position: absolute; top: 4px; right: 4px; width: 36px; height: 36px;
	display: inline-flex; align-items: center; justify-content: center;
	border: 0; background: transparent; color: var(--text-2); cursor: pointer; border-radius: var(--radius-sm);
}
.mobile-nav .submenu-toggle svg { width: 18px; height: 18px; transition: transform var(--transition); }
.mobile-nav .menu-item-has-children.open > .submenu-toggle svg { transform: rotate(180deg); }
.mobile-nav .menu-close { position: absolute; top: 14px; right: 14px; }
.nav-overlay {
    position: fixed; inset: 0; background: rgba(10, 12, 18, 0.45);
    opacity: 0; visibility: hidden; transition: all var(--transition); z-index: 150;
}
.nav-overlay.open { opacity: 1; visibility: visible; }

/* ==========================================================================
   6. CAROUSEL (HERO)
   ========================================================================== */
.hero { margin-bottom: var(--sp-7); }
.carousel { position: relative; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-md); }
.carousel-track { display: flex; transition: transform 600ms cubic-bezier(0.4, 0, 0.2, 1); }
.carousel-slide { position: relative; min-width: 100%; aspect-ratio: 21 / 9; }
@media (max-width: 768px) { .carousel-slide { aspect-ratio: 16 / 10; } }
.carousel-slide img { width: 100%; height: 100%; object-fit: cover; }
.carousel-slide .overlay {
    position: absolute; inset: 0;
    background: linear-gradient(90deg, rgba(10,12,18,0.62) 0%, rgba(10,12,18,0.28) 45%, rgba(10,12,18,0) 75%);
    display: flex; align-items: center;
}
.carousel-caption {
    max-width: 560px; padding: 0 var(--sp-7); color: #fff;
}
.carousel-caption .eyebrow {
    display: inline-block; font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.08em;
    text-transform: uppercase; background: rgba(255,255,255,0.18); padding: 4px 10px; border-radius: var(--radius-pill); margin-bottom: var(--sp-3);
}
.carousel-meta { display: flex; flex-wrap: wrap; gap: var(--sp-3); margin-bottom: var(--sp-3); font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: rgba(255,255,255,0.9); }
.carousel-meta .cat { background: var(--brand); padding: 4px 10px; border-radius: var(--radius-pill); }
.carousel-meta .date { background: rgba(255,255,255,0.18); padding: 4px 10px; border-radius: var(--radius-pill); }
.carousel-caption h2 { color: #fff; font-size: var(--fs-3xl); margin-bottom: var(--sp-3); }
.carousel-caption p { color: rgba(255,255,255,0.88); font-size: var(--fs-md); margin-bottom: var(--sp-4); }
@media (max-width: 768px) { .carousel-caption h2 { font-size: var(--fs-xl); } .carousel-caption { padding: 0 var(--sp-5); } }

.carousel-arrow {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer;
    background: rgba(255,255,255,0.85); color: #1a1c20; display: flex; align-items: center; justify-content: center;
    box-shadow: var(--shadow-md); transition: all var(--transition); z-index: 5;
}
.carousel-arrow:hover { background: #fff; transform: translateY(-50%) scale(1.06); }
.carousel-arrow.prev { left: var(--sp-4); }
.carousel-arrow.next { right: var(--sp-4); }
.carousel-arrow svg { width: 20px; height: 20px; }
.carousel-dots { position: absolute; bottom: var(--sp-4); left: 50%; transform: translateX(-50%); display: flex; gap: 8px; z-index: 5; }
.carousel-dots button {
    width: 9px; height: 9px; border-radius: 50%; border: 0; cursor: pointer; padding: 0;
    background: rgba(255,255,255,0.55); transition: all var(--transition);
}
.carousel-dots button.active { background: #fff; width: 26px; border-radius: var(--radius-pill); }

/* ==========================================================================
   7. POST CARDS / LIST
   ========================================================================== */
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: var(--sp-5); }
.section-head h1, .section-head h2 { font-size: var(--fs-xl); margin: 0; }
.section-head .see-all { font-size: var(--fs-sm); color: var(--text-3); }

.post-grid { display: grid; gap: var(--sp-5); }
.post-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.post-grid.cols-1 { grid-template-columns: 1fr; }
@media (max-width: 640px) { .post-grid.cols-2 { grid-template-columns: 1fr; } }

.post-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    overflow: hidden; box-shadow: var(--shadow-sm); transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
    display: flex; flex-direction: column;
}
.post-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--border-strong); }
.post-card .thumb { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: var(--surface-2); }
.post-card .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 400ms ease; }
.post-card:hover .thumb img { transform: scale(1.05); }
.post-card .thumb .cat-badge {
    position: absolute; top: var(--sp-3); left: var(--sp-3);
    background: rgba(255,255,255,0.92); color: #1a1c20; font-size: var(--fs-xs); font-weight: 600;
    padding: 4px 10px; border-radius: var(--radius-pill);
}
.post-card .body { padding: var(--sp-4) var(--sp-5) var(--sp-5); display: flex; flex-direction: column; gap: var(--sp-3); flex: 1; }
.post-card h3 { font-size: var(--fs-lg); margin: 0; }
.post-card h3 a { color: var(--text); }
.post-card h3 a:hover { color: var(--brand); }
.post-card .excerpt { color: var(--text-2); font-size: var(--fs-sm); margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.post-card .post-meta { margin-top: auto; display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center; }
.post-card .post-meta .meta { font-size: var(--fs-xs); }

/* Classic list variant */
.post-list { display: flex; flex-direction: column; gap: var(--sp-4); }
.post-list .item { display: grid; grid-template-columns: 200px 1fr; gap: var(--sp-5); padding: var(--sp-4); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); transition: box-shadow var(--transition); }
.post-list .item:hover { box-shadow: var(--shadow-md); }
.post-list .item .thumb { aspect-ratio: 16/9; border-radius: var(--radius-sm); overflow: hidden; }
.post-list .item .thumb img { width: 100%; height: 100%; object-fit: cover; }
.post-list .item h3 { font-size: var(--fs-md); margin: 0 0 var(--sp-2); }
.post-list .item h3 a { color: var(--text); }
.post-list .item h3 a:hover { color: var(--brand); }
.post-list .item .excerpt { color: var(--text-2); font-size: var(--fs-sm); margin: 0 0 var(--sp-2); }
@media (max-width: 640px) { .post-list .item { grid-template-columns: 1fr; } }

/* ==========================================================================
   8. SIDEBAR WIDGETS
   ========================================================================== */
.sidebar { display: flex; flex-direction: column; gap: var(--sp-5); }
body.sidebar-sticky .sidebar { position: sticky; top: 88px; align-self: start; }
.widget { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--sp-5); box-shadow: var(--shadow-sm); }
.widget-title { font-size: var(--fs-md); margin: 0 0 var(--sp-4); padding-bottom: var(--sp-3); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: var(--sp-2); }
.widget-title::before { content: ""; width: 4px; height: 16px; border-radius: 2px; background: var(--brand); }

.widget-search form { display: flex; gap: var(--sp-2); }
.widget-search input { flex: 1; padding: 9px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--bg); color: var(--text); }
.widget-search input:focus { outline: none; border-color: var(--brand); }

.author-card { text-align: center; }
.author-card img { width: 84px; height: 84px; border-radius: 50%; margin: 0 auto var(--sp-3); object-fit: cover; border: 3px solid var(--surface-2); }
.author-card .name { font-weight: 700; font-size: var(--fs-md); }
.author-card .bio { color: var(--text-2); font-size: var(--fs-sm); margin: var(--sp-2) 0 var(--sp-4); }
.author-card .socials { display: flex; justify-content: center; gap: var(--sp-2); }
.author-card .socials a { width: 34px; height: 34px; border-radius: 50%; background: var(--surface-2); display: flex; align-items: center; justify-content: center; color: var(--text-2); }
.author-card .socials a:hover { background: var(--brand); color: #fff; }

.widget-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.widget-list li a { display: flex; align-items: center; justify-content: space-between; padding: 9px 8px; border-radius: var(--radius-sm); color: var(--text-2); font-size: var(--fs-sm); }
.widget-list li a:hover { background: var(--surface-2); color: var(--brand); }
.widget-list .count { font-size: var(--fs-xs); color: var(--text-3); background: var(--surface-2); border-radius: var(--radius-pill); padding: 1px 8px; }

.tag-cloud { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.tag-cloud a { font-size: var(--fs-xs); padding: 5px 12px; border-radius: var(--radius-pill); background: var(--surface-2); color: var(--text-2); }
.tag-cloud a:hover { background: var(--brand); color: #fff; }
/* Safety: if a raw wp_tag_cloud() wrapper appears, keep its links as pills. */
.tag-cloud .tagcloud { display: flex; flex-wrap: wrap; gap: var(--sp-2); width: 100%; }

.mini-post { display: grid; grid-template-columns: 64px 1fr; gap: var(--sp-3); align-items: center; padding: 8px 0; }
.mini-post + .mini-post { border-top: 1px solid var(--border); }
.mini-post img { width: 64px; height: 48px; border-radius: var(--radius-sm); object-fit: cover; }
.mini-post .t { font-size: var(--fs-sm); font-weight: 600; color: var(--text); line-height: 1.4; }
.mini-post a:hover .t { color: var(--brand); }
.mini-post .m { font-size: var(--fs-xs); color: var(--text-3); }

.widget-ads img { width: 100%; border-radius: var(--radius-sm); }
.subscribe-box { text-align: center; }
.subscribe-box input { width: 100%; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--bg); color: var(--text); margin-bottom: var(--sp-3); }

/* ==========================================================================
   9. SINGLE POST
   ========================================================================== */
.article { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--sp-7); box-shadow: var(--shadow-sm); }
.article-header { margin-bottom: var(--sp-6); }
.article-header .cat-link { margin-bottom: var(--sp-3); }
.article-header h1 { font-size: var(--fs-2xl); letter-spacing: -0.01em; }
.article-header .excerpt { font-size: var(--fs-md); color: var(--text-2); }
.article-meta { display: flex; flex-wrap: wrap; gap: var(--sp-4); align-items: center; padding: var(--sp-3) 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); margin-bottom: var(--sp-6); }
.article-meta .avatar { width: 36px; height: 36px; border-radius: 50%; }
.article-meta .byline { display: flex; align-items: center; gap: var(--sp-2); }
.article-meta .byline .name { font-weight: 600; font-size: var(--fs-sm); }
.article-meta .meta { font-size: var(--fs-sm); }

.entry-content { font-size: var(--fs-md); line-height: 1.85; color: var(--text); }
.entry-content > * + * { margin-top: var(--sp-4); }
.entry-content img { border-radius: var(--radius-sm); margin: var(--sp-5) 0; cursor: zoom-in; }
.entry-content h2, .entry-content h3 { margin-top: var(--sp-7); scroll-margin-top: 90px; }
.entry-content a { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--brand-soft); }
.entry-content ul, .entry-content ol { margin-left: var(--sp-5); }
.entry-content li { margin-bottom: var(--sp-2); }
.entry-content table { width: 100%; border-collapse: collapse; margin: var(--sp-5) 0; font-size: var(--fs-sm); }
.entry-content th, .entry-content td { border: 1px solid var(--border); padding: 10px 12px; text-align: left; }
.entry-content th { background: var(--surface-2); font-weight: 600; }

/* Code blocks */
.entry-content pre {
    position: relative; background: #0f1115; color: #e7e9ee; border-radius: var(--radius);
    padding: var(--sp-5); overflow: auto; font-size: var(--fs-sm); line-height: 1.7; margin: var(--sp-5) 0;
}
[data-theme="dark"] .entry-content pre { background: #0a0c10; }
.entry-content pre code { background: none; color: inherit; padding: 0; font-size: inherit; }
.entry-content :not(pre) > code { background: var(--brand-soft); color: var(--brand-strong); padding: 2px 6px; border-radius: 6px; font-size: 0.88em; }
.copy-code {
    position: absolute; top: 10px; right: 10px; z-index: 2;
    background: rgba(255,255,255,0.10); color: #e7e9ee; border: 0; border-radius: 6px;
    padding: 5px 9px; font-size: var(--fs-xs); cursor: pointer; transition: all var(--transition);
}
.copy-code:hover { background: rgba(255,255,255,0.2); }

/* TOC */
.toc { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--sp-4) var(--sp-5); margin: var(--sp-5) 0; }
.toc-title { font-weight: 700; font-size: var(--fs-sm); margin-bottom: var(--sp-3); display: flex; align-items: center; gap: 6px; }
.toc ol { list-style: none; margin: 0; padding: 0; counter-reset: toc; }
.toc li { padding: 3px 0; }
.toc a { color: var(--text-2); font-size: var(--fs-sm); }
.toc a:hover, .toc a.active { color: var(--brand); }
.toc a.active { font-weight: 600; }

/* article footer */
.article-tags { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin: var(--sp-6) 0; }
.article-tags a {
    display: inline-flex; align-items: center; padding: 3px 10px; border-radius: var(--radius-pill);
    background: var(--surface-2); color: var(--text-2); font-size: var(--fs-xs); transition: all var(--transition);
}
.article-tags a:hover { background: var(--brand-soft); color: var(--brand); }
.article-share { display: flex; gap: var(--sp-2); align-items: center; }
.copyright-note { background: var(--surface-2); border-radius: var(--radius-sm); padding: var(--sp-4); font-size: var(--fs-sm); color: var(--text-2); margin: var(--sp-6) 0; }

.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); margin: var(--sp-6) 0; }
.post-nav a { display: block; padding: var(--sp-4); border: 1px solid var(--border); border-radius: var(--radius); transition: all var(--transition); }
.post-nav a:hover { border-color: var(--brand); box-shadow: var(--shadow-sm); }
.post-nav .label { font-size: var(--fs-xs); color: var(--text-3); }
.post-nav .ttl { font-weight: 600; color: var(--text); font-size: var(--fs-sm); margin-top: 4px; }
.post-nav .next { text-align: right; }

.related-posts { margin-top: var(--sp-7); }
.related-posts .post-grid { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 900px) { .related-posts .post-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .related-posts .post-grid { grid-template-columns: 1fr; } }

/* Comments */
.comments-area { margin-top: var(--sp-7); }
.comment-list { list-style: none; margin: 0; padding: 0; }
.comment-list .comment { padding: var(--sp-4) 0; border-bottom: 1px solid var(--border); }
.comment-list .comment-meta { display: flex; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-2); }
.comment-list .avatar { width: 40px; height: 40px; border-radius: 50%; }
.comment-list .fn { font-weight: 600; }
.comment-form input, .comment-form textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--bg); color: var(--text); margin-bottom: var(--sp-3); }
.comment-form textarea { min-height: 120px; }

/* ==========================================================================
   10. PAGINATION / LOAD MORE
   ========================================================================== */
.pagination { display: flex; justify-content: center; align-items: center; gap: var(--sp-2); margin-top: var(--sp-7); }
.pagination a, .pagination span {
    min-width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center;
    padding: 0 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); color: var(--text-2); font-size: var(--fs-sm);
}
.pagination a:hover { border-color: var(--brand); color: var(--brand); }
.pagination .current { background: var(--brand); color: #fff; border-color: var(--brand); }
.load-more-wrap { text-align: center; margin-top: var(--sp-7); }
.load-more { position: relative; }
.load-more.loading { opacity: 0.7; pointer-events: none; }

/* ==========================================================================
   11. BREADCRUMB / ARCHIVE / SEARCH
   ========================================================================== */
.breadcrumb { font-size: var(--fs-sm); color: var(--text-3); margin-bottom: var(--sp-4); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.breadcrumb a { color: var(--text-2); }
.breadcrumb a:hover { color: var(--brand); }
.breadcrumb .sep { opacity: 0.5; }
.page-hero { margin-bottom: var(--sp-6); }
.page-hero h1 { font-size: var(--fs-2xl); }
.page-hero p { color: var(--text-2); margin: 0; }
.author-hero { text-align: center; }
.author-avatar { width: 72px; height: 72px; border-radius: 50%; margin: 0 auto var(--sp-3); display: block; }
.author-count { color: var(--text-3); font-size: var(--fs-sm); margin-top: var(--sp-2); }
.archive-list { display: flex; flex-direction: column; gap: var(--sp-2); }
.archive-item { display: flex; align-items: center; gap: var(--sp-4); padding: var(--sp-3) 0; border-bottom: 1px solid var(--border); }
.archive-item .date { color: var(--text-3); font-size: var(--fs-sm); min-width: 96px; }
.archive-item a { color: var(--text); font-weight: 500; }
.archive-item a:hover { color: var(--brand); }

.search-summary { background: var(--surface-2); border-radius: var(--radius-sm); padding: var(--sp-4); margin-bottom: var(--sp-5); font-size: var(--fs-sm); color: var(--text-2); }
.search-summary b { color: var(--brand); }

/* 404 */
.error-404 { text-align: center; padding: var(--sp-8) var(--sp-5); }
.error-404 .code { font-size: 96px; font-weight: 800; color: var(--brand); line-height: 1; }
.error-404 h1 { margin: var(--sp-4) 0 var(--sp-2); }
.error-404 p { color: var(--text-2); margin-bottom: var(--sp-5); }
.error-404 .search-pop-inline { max-width: 420px; margin: 0 auto var(--sp-5); }

/* Generic page */
.page-content { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--sp-7); box-shadow: var(--shadow-sm); }
.page-header { border: 0; padding: 0; margin-bottom: 24px; }
.footer-links { display: flex; gap: 16px; flex-wrap: wrap; }

/* Links page */
.links-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--sp-4); }
.link-card { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-4); border: 1px solid var(--border); border-radius: var(--radius); transition: all var(--transition); }
.link-card:hover { border-color: var(--brand); box-shadow: var(--shadow-sm); transform: translateY(-2px); }
.link-card img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; }
.link-card .name { font-weight: 600; }
.link-card .desc { font-size: var(--fs-xs); color: var(--text-3); }

/* ==========================================================================
   12. FOOTER
   ========================================================================== */
.site-footer { background: var(--bg-alt); border-top: 1px solid var(--border); padding: var(--sp-8) 0 var(--sp-6); margin-top: var(--sp-8); }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: var(--sp-6); }
.footer-col h4 { font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); margin-bottom: var(--sp-4); }
.footer-col ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-2); }
.footer-col a { color: var(--text-2); font-size: var(--fs-sm); }
.footer-col a:hover { color: var(--brand); }
.footer-about p { color: var(--text-2); font-size: var(--fs-sm); }
.footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--sp-3); margin-top: var(--sp-7); padding-top: var(--sp-5); border-top: 1px solid var(--border); font-size: var(--fs-sm); color: var(--text-3); }
.footer-bottom .socials { display: flex; gap: var(--sp-2); }
.footer-bottom .socials a { width: 34px; height: 34px; border-radius: 50%; background: var(--surface); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; color: var(--text-2); }
.footer-bottom .socials a:hover { background: var(--brand); color: #fff; border-color: var(--brand); }
.back-to-top { position: fixed; bottom: var(--sp-5); right: var(--sp-5); width: 44px; height: 44px; border-radius: 50%; background: var(--brand); color: #fff; border: 0; cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-md); opacity: 0; visibility: hidden; transform: translateY(10px); transition: all var(--transition); z-index: 120; }
.back-to-top.show { opacity: 1; visibility: visible; transform: translateY(0); }
.back-to-top:hover { background: var(--brand-strong); }

/* ==========================================================================
   13. ADS
   ========================================================================== */
.ad-slot { margin: var(--sp-6) 0; text-align: center; }
.ad-slot img { border-radius: var(--radius-sm); margin: 0 auto; }
.ad-label { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 6px; }
.ad-inline { margin: var(--sp-5) 0; }

/* ==========================================================================
   14. RESPONSIVE
   ========================================================================== */
@media (max-width: 1024px) {
    .layout { grid-template-columns: minmax(0, 1fr) 280px; }
}
@media (max-width: 900px) {
    .layout { grid-template-columns: 1fr; }
    .sidebar, body.sidebar-sticky .sidebar { position: static; flex-direction: column; }
    .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
    :root { --fs-3xl: 32px; --fs-2xl: 26px; --fs-xl: 22px; }
    .primary-nav, .header-actions .search-pop-trigger { display: none; }
    .nav-toggle { display: inline-flex; }
    .search-pop { display: none; /* Hidden on mobile; search uses the widget in sidebar or search page */ }
    .site-content { padding: var(--sp-5) 0; }
    .article, .page-content { padding: var(--sp-5); }
    .post-nav { grid-template-columns: 1fr; }
    .post-nav .next { text-align: left; }
}
@media (max-width: 560px) {
    .footer-grid { grid-template-columns: 1fr; }
    .container { padding: 0 var(--sp-4); }
}

/* Print */
@media print {
    .site-header, .sidebar, .site-footer, .carousel, .post-nav, .comments-area, .back-to-top { display: none !important; }
    .layout { grid-template-columns: 1fr; }
    .article { border: 0; box-shadow: none; }
}
