@charset "UTF-8";

/* ============================================
 * Single Theme v3 — Claude-inspired Redesign
 * A warm, refined Typecho blog theme
 * ============================================ */

/* ---- 0. Design Tokens ---- */
:root {
    /* Warm light palette */
    --bg-primary: #faf9f7;
    --bg-surface: #ffffff;
    --bg-elevated: #f5f4f2;
    --bg-hover: #eeedea;

    --text-primary: #1c1917;
    --text-secondary: #78716c;
    --text-tertiary: #a8a29e;

    --accent: #d97706;
    --accent-hover: #b45309;
    --accent-subtle: #fffbeb;
    --accent-border: #fde68a;

    --border: #e5e2dd;
    --border-light: #eeedea;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, .06);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, .08);
    --shadow-glow: 0 0 0 3px rgba(217, 119, 6, .12);

    --radius-sm: .375em;
    --radius-md: .625em;
    --radius-lg: 1em;

    --header-blur: blur(12px);
    --header-bg: rgba(250, 249, 247, .82);

    --font-heading: 'Sora', 'DM Sans', system-ui, -apple-system, sans-serif;
    --font-body: 'DM Sans', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', 'Consolas', monospace;
}

/* Dark mode */
.dark-theme {
    --bg-primary: #171614;
    --bg-surface: #1e1d1b;
    --bg-elevated: #272624;
    --bg-hover: #2f2d2a;

    --text-primary: #e8e6e1;
    --text-secondary: #a8a29e;
    --text-tertiary: #78716c;

    --accent: #f59e0b;
    --accent-hover: #d97706;
    --accent-subtle: rgba(217, 119, 6, .12);
    --accent-border: rgba(217, 119, 6, .25);

    --border: #2f2d2a;
    --border-light: #272624;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .2);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, .3);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, .4);

    --header-bg: rgba(23, 22, 20, .85);
}
.dark-theme,
.dark-theme .head-search input {
    color-scheme: dark;
}

/* ---- 1. Base ---- */
body {
    color: var(--text-primary);
    background: var(--bg-primary);
    font: 400 1rem/1.65 var(--font-body);
    transition: background .4s ease, color .4s ease;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ---- 2. Header ---- */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    background: var(--header-bg);
    -webkit-backdrop-filter: var(--header-blur);
    backdrop-filter: var(--header-blur);
    border-bottom: 1px solid var(--border-light);
    transition: background .4s ease, border-color .4s ease;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 72em;
    margin: 0 auto;
    padding: 0 1.5em;
    height: 3.5em;
    position: relative;
}

.head-title {
    display: flex;
    align-items: center;
}
.head-title h4 {
    margin: 0;
    font: 600 1.1em var(--font-heading);
    color: var(--text-primary);
    letter-spacing: -.02em;
}

.head-actions {
    display: flex;
    align-items: center;
    gap: .25em;
}

.head-actions button {
    width: 2.25em;
    height: 2.25em;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: background var(--transition), color var(--transition);
}
.head-actions button:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.head-actions button svg {
    width: 1.15em;
    height: 1.15em;
}

/* Light/dark toggle icon */
.light-on,
.dark-theme .light-off { display: none }
.dark-theme .light-on { display: block }

/* Search bar */
.head-search {
    display: flex;
    align-items: center;
    gap: .5em;
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s ease;
    position: absolute;
    right: 1.5em;
    top: 50%;
    transform: translateY(-50%);
}
.head-search.active {
    opacity: 1;
    pointer-events: all;
}
.head-search input {
    width: 14em;
    height: 2.35em;
    padding: 0 .875em;
    border: 1px solid var(--border);
    border-radius: 100px;
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: .875em;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.head-search input:focus {
    border-color: var(--accent);
    box-shadow: var(--shadow-glow);
}

/* Desktop navigation */
.head-menu {
    display: flex;
    align-items: center;
    gap: .125em;
}
.head-menu a {
    display: block;
    padding: .5em .875em;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: .875em;
    font-weight: 450;
    transition: background var(--transition), color var(--transition);
}
.head-menu a:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.head-menu .has-child {
    position: relative;
}
.head-menu .has-child > a {
    display: flex;
    align-items: center;
    gap: .3em;
}
.head-menu .has-child > a:after {
    content: '';
    display: inline-block;
    width: .55em;
    height: .55em;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg);
    margin-top: -.2em;
    opacity: .5;
}

/* Dropdown */
.head-menu .sub-menu {
    position: absolute;
    top: calc(100% + .4em);
    left: 0;
    min-width: 120px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: .35em;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity .2s ease, transform .2s ease, visibility .2s ease;
    box-shadow: var(--shadow-md);
    z-index: 60;
}
.head-menu .sub-menu a {
    padding: .45em .75em;
    border-radius: var(--radius-sm);
    white-space: nowrap;
}
.head-menu .has-child:hover .sub-menu,
.head-menu .has-child:focus-within .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Mobile navigation */
@media screen and (max-width: 767px) {
    .head-menu {
        position: fixed;
        top: 3.5em;
        left: 0;
        right: 0;
        bottom: 0;
        flex-direction: column;
        align-items: stretch;
        background: var(--bg-surface);
        padding: 1em;
        gap: .125em;
        opacity: 0;
        visibility: hidden;
        transform: translateY(-8px);
        transition: opacity .25s ease, transform .25s ease, visibility .25s ease;
        overflow-y: auto;
        z-index: 40;
    }
    .head-menu.active {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }
    .head-menu a {
        font-size: 1em;
        padding: .75em 1em;
    }
    .head-menu .sub-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        border: none;
        padding: 0 0 0 1em;
        background: transparent;
        display: none;
    }
    .head-menu .has-child.open .sub-menu { display: block }
    .head-menu .has-child > a:after { transition: transform .2s }
    .head-menu .has-child.open > a:after { transform: rotate(-135deg); margin-top: .1em }
}

/* Hamburger toggle */
.toggle-btn {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    width: 2.25em;
    height: 2.25em;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition);
}
.toggle-btn:hover { background: var(--bg-hover) }
.toggle-btn span {
    display: block;
    width: 16px;
    height: 2px;
    background: var(--text-secondary);
    border-radius: 1px;
    transition: transform .3s ease, opacity .3s ease;
}
.toggle-btn.active span:nth-child(1) { transform: rotate(45deg) translate(2.5px, 2.5px) }
.toggle-btn.active span:nth-child(2) { opacity: 0 }
.toggle-btn.active span:nth-child(3) { transform: rotate(-45deg) translate(2.5px, -2.5px) }

@media screen and (min-width: 768px) {
    .toggle-btn { display: none }
}

/* ---- 3. Main Content ---- */
main {
    padding-top: calc(3.5em + 3em);
    padding-bottom: 4em;
    min-height: 70vh;
}
main img {
    height: auto;
    border-radius: var(--radius-md);
    transition: filter .4s ease, opacity .4s ease;
}
.dark-theme main img { opacity: .85 }

/* ---- 4. Home Page ---- */

/* Hero section */
.home-title {
    text-align: center;
    padding: 3em 0 3.5em;
    animation: fade-in-up .6s ease both;
}
.home-title h1 {
    font: 700 2.75em/1.15 var(--font-heading);
    color: var(--text-primary);
    letter-spacing: -.03em;
    margin-bottom: .35em;
}
.home-title span {
    display: block;
    color: var(--text-secondary);
    font-size: 1.1em;
    font-weight: 400;
    max-width: 28em;
    margin: 0 auto 1em;
}

/* Social links */
.home-social {
    display: flex;
    justify-content: center;
    gap: .5em;
    margin-top: 1.5em;
}
.home-social a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5em;
    height: 2.5em;
    border-radius: 100%;
    color: var(--text-secondary);
    background: var(--bg-elevated);
    transition: background var(--transition), color var(--transition), transform var(--transition);
}
.home-social a:hover {
    background: var(--accent);
    color: #fff;
    transform: translateY(-2px);
}
.home-social svg {
    width: 1.2em;
    height: 1.2em;
}

/* Post list */
.home-posts {
    max-width: 42em;
    margin: 0 auto;
}

.post-item {
    padding: 1.75em 0;
    border-bottom: 1px solid var(--border-light);
    animation: fade-in-up .5s ease backwards;
}
.post-item:last-child { border-bottom: none }

.post-item:nth-child(1) { animation-delay: .1s }
.post-item:nth-child(2) { animation-delay: .18s }
.post-item:nth-child(3) { animation-delay: .26s }
.post-item:nth-child(4) { animation-delay: .34s }
.post-item:nth-child(5) { animation-delay: .42s }
.post-item:nth-child(6) { animation-delay: .5s }
.post-item:nth-child(7) { animation-delay: .58s }
.post-item:nth-child(8) { animation-delay: .66s }
.post-item:nth-child(9) { animation-delay: .74s }
.post-item:nth-child(10) { animation-delay: .82s }

.post-item h2 {
    margin-bottom: .4em;
    font: 600 1.35em/1.3 var(--font-heading);
    letter-spacing: -.01em;
}
.post-item h2 a {
    color: var(--text-primary);
    transition: color var(--transition);
}
.post-item h2 a:hover { color: var(--accent) }

.post-item .edit-link {
    font-size: .75em;
    font-weight: 400;
    margin-left: .5em;
    color: var(--text-tertiary);
    vertical-align: middle;
}

.post-item p {
    color: var(--text-secondary);
    font-size: .9375em;
    line-height: 1.7;
    margin-bottom: .75em;
}

/* Post meta */
.post-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5em 1em;
    color: var(--text-tertiary);
    font-size: .8125em;
}
.post-meta a { color: inherit }
.post-meta time,
.post-meta span {
    display: inline-flex;
    align-items: center;
    gap: .35em;
}
.post-meta .date:before,
.post-meta .category:before,
.post-meta .tags:before,
.post-meta .comments:before {
    content: '';
    display: inline-block;
    width: .75em;
    height: .75em;
    background: currentColor;
    mask-size: contain;
    mask-repeat: no-repeat;
    -webkit-mask-size: contain;
    -webkit-mask-repeat: no-repeat;
}
.post-meta .date:before {
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpolyline points='12 6 12 12 16 14'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpolyline points='12 6 12 12 16 14'/%3E%3C/svg%3E");
}
.post-meta .category:before {
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 19a2 2 0 01-2 2H4a2 2 0 01-2-2V5a2 2 0 012-2h5l2 3h9a2 2 0 012 2z'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 19a2 2 0 01-2 2H4a2 2 0 01-2-2V5a2 2 0 012-2h5l2 3h9a2 2 0 012 2z'/%3E%3C/svg%3E");
}
.post-meta .tags:before {
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20.59 13.41l-7.17 7.17a2 2 0 01-2.83 0L2 12V2h10l8.59 8.59a2 2 0 010 2.82z'/%3E%3Cline x1='7' y1='7' x2='7.01' y2='7'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20.59 13.41l-7.17 7.17a2 2 0 01-2.83 0L2 12V2h10l8.59 8.59a2 2 0 010 2.82z'/%3E%3Cline x1='7' y1='7' x2='7.01' y2='7'/%3E%3C/svg%3E");
}
.post-meta .comments:before {
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z'/%3E%3C/svg%3E");
}

/* Pagination */
.page-navigator {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: .35em;
    margin-top: 3em;
    animation: fade-in-up .5s ease both;
    animation-delay: .4s;
}
.page-navigator span {
    display: inline-flex;
}
.page-navigator a,
.page-navigator .current {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.35em;
    height: 2.35em;
    padding: 0 .6em;
    border-radius: var(--radius-sm);
    font-size: .875em;
    color: var(--text-secondary);
    transition: background var(--transition), color var(--transition);
}
.page-navigator a:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.page-navigator .current a {
    background: var(--accent);
    color: #fff;
}

/* ---- 5. Post / Page ---- */

.post-title,
.page-title {
    text-align: center;
    padding: 1.5em 0 2em;
    animation: fade-in-up .5s ease both;
}
.post-title h2,
.page-title h2 {
    font: 700 2em/1.25 var(--font-heading);
    color: var(--text-primary);
    letter-spacing: -.02em;
    margin-bottom: .35em;
}
.page-title h2 { margin-bottom: 0 }

.post-title .edit-link,
.page-title .edit-link {
    font-size: .75em;
    color: var(--text-tertiary);
    margin-left: .5em;
}

.post-title .post-meta {
    justify-content: center;
}

/* Post content */
.post-content,
.page-content {
    max-width: 42em;
    margin: 0 auto 3em;
    animation: fade-in-up .5s ease both;
    animation-delay: .1s;
}

article {
    color: var(--text-primary);
    font-size: 1em;
    line-height: 1.8;
}
article a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-thickness: 1px;
    text-decoration-color: var(--accent-border);
    transition: color var(--transition), text-decoration-color var(--transition);
}
article a:hover {
    color: var(--accent-hover);
    text-decoration-color: currentColor;
}

article h1,
article h2,
article h3 {
    font-family: var(--font-heading);
    font-weight: 600;
    letter-spacing: -.01em;
    margin-top: 2.5em;
    scroll-margin-top: 5em;
}
article h1 { font-size: 1.65em }
article h2 { font-size: 1.4em }
article h3 { font-size: 1.2em }
article h4 { font-size: 1.1em }

article h1:before,
article h2:before,
article h3:before {
    content: "#";
    color: var(--accent);
    margin-right: .5em;
    font-weight: 400;
    opacity: .6;
}

article img {
    border-radius: var(--radius-md);
    margin: 1.5em 0;
    box-shadow: var(--shadow-sm);
}

article ul p:first-child {
    margin-top: .5em;
    margin-bottom: 0;
}

/* Post near nav */
.post-near {
    max-width: 42em;
    margin: 0 auto 2.5em;
    display: flex;
    justify-content: space-between;
    gap: 1em;
    animation: fade-in-up .5s ease both;
    animation-delay: .2s;
}
.post-near ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: space-between;
    width: 100%;
    gap: 1em;
}
.post-near li {
    flex: 1;
    font-size: .875em;
}
.post-near li:first-child { text-align: left }
.post-near li:last-child { text-align: right }
.post-near li a {
    color: var(--accent);
    transition: color var(--transition);
}
.post-near li a:hover { color: var(--accent-hover) }

/* Tags */
.post-tags {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5em;
    max-width: 42em;
    margin: 0 auto 2.5em;
    padding: 1.25em 0;
    border-top: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
    animation: fade-in-up .5s ease both;
    animation-delay: .25s;
}
.post-tags:before {
    content: '🏷';
    font-size: .875em;
    margin-right: .25em;
}
.post-tags a {
    display: inline-block;
    padding: .25em .75em;
    border-radius: 100px;
    background: var(--bg-elevated);
    color: var(--text-secondary);
    font-size: .8125em;
    transition: background var(--transition), color var(--transition);
}
.post-tags a:hover {
    background: var(--accent-subtle);
    color: var(--accent);
}

/* Author card */
.post-author {
    display: flex;
    align-items: center;
    gap: 1.25em;
    max-width: 42em;
    margin: 0 auto 2.5em;
    padding: 1.5em;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    animation: fade-in-up .5s ease both;
    animation-delay: .3s;
}
.post-author .author-avatar {
    flex-shrink: 0;
}
.post-author .author-avatar img {
    width: 4em;
    height: 4em;
    border-radius: 100%;
    margin: 0;
    box-shadow: none;
}
.post-author .author-info h4 {
    font: 600 1em var(--font-heading);
    margin-bottom: .25em;
    color: var(--text-primary);
}
.post-author .author-info p {
    color: var(--text-secondary);
    font-size: .875em;
    margin: 0;
    line-height: 1.6;
}

/* ---- 6. Comments ---- */
.post-comments {
    max-width: 42em;
    margin: 0 auto;
    animation: fade-in-up .5s ease both;
    animation-delay: .4s;
}
.post-comments > h3 {
    font: 600 1.125em var(--font-heading);
    margin-bottom: 1.5em;
    padding-bottom: .75em;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
}
.post-comments input,
.post-comments textarea {
    -webkit-appearance: none;
}

/* Comment form */
.comment-form {
    margin-bottom: 2.5em;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5em;
}
.comment-form fieldset {
    margin: 0;
}
.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"] {
    width: 100%;
}
.comment-form textarea {
    width: 100%;
    min-height: 6em;
}
.comment-form .btn,
.comment-form button[type="submit"] {
    margin-top: .5em;
}
.comment-form p {
    font-size: .875em;
    color: var(--text-secondary);
}
.comment-form p a { color: var(--accent) }

/* Cancel reply */
.cancel-comment-reply {
    display: block;
    text-align: right;
    margin-bottom: .75em;
}
.cancel-comment-reply a {
    font-size: .8125em;
    color: var(--text-tertiary);
}

/* Comment list */
.comment-list {
    margin-bottom: 2em;
}
.comment-single {
    position: relative;
    padding: 1.25em 0 1.25em 3.5em;
    border-bottom: 1px solid var(--border-light);
    transition: background var(--transition);
}
.comment-single:last-child { border-bottom: none }
.comment-child { margin-left: 2em }

.comment-single .avatar {
    position: absolute;
    left: 0;
    top: 1.25em;
    width: 2.5em;
    height: 2.5em;
    border-radius: 100%;
}
.comment-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: .35em .75em;
    margin-bottom: .35em;
    font-size: .875em;
}
.comment-author {
    font-weight: 500;
    color: var(--text-primary);
}
.comment-author a { color: inherit }
.comment-author a:hover { color: var(--accent) }
.comment-time {
    color: var(--text-tertiary);
    font-size: .8125em;
}
.comment-time:before {
    content: '·';
    margin-right: .4em;
}
.comment-content {
    color: var(--text-secondary);
    font-size: .9375em;
    margin: 0;
    line-height: 1.7;
}
.comment-content a { color: var(--accent) }

.comment-reply {
    opacity: 0;
    transition: opacity var(--transition);
}
.comment-single:hover .comment-reply { opacity: 1 }
.comment-reply a {
    font-size: .8125em;
    color: var(--text-tertiary);
}
.comment-reply a:hover { color: var(--accent) }

/* ---- 7. Footer ---- */
footer {
    border-top: 1px solid var(--border-light);
    background: var(--bg-surface);
    transition: border-color .4s ease, background .4s ease;
}

footer .buttons {
    position: fixed;
    right: 1.5em;
    bottom: 2em;
    z-index: 30;
    display: flex;
    flex-direction: column;
    gap: .5em;
}

.to-top {
    width: 2.75em;
    height: 2.75em;
    border-radius: 100%;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transform: translateY(4em);
    opacity: 0;
    transition: transform .35s ease, opacity .35s ease, background var(--transition), color var(--transition);
    box-shadow: var(--shadow-sm);
}
.to-top.active {
    transform: translateY(0);
    opacity: 1;
}
.to-top:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.to-top svg {
    width: 1.1em;
    height: 1.1em;
}

/* Widget section */
footer .widget {
    padding: 2.5em 0;
}
footer .widget h3 {
    font: 600 1em var(--font-heading);
    color: var(--text-primary);
    margin-bottom: 1em;
}
footer .widget ul {
    list-style: none;
    margin: 0;
}
footer .widget ul li {
    margin-bottom: .5em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: .875em;
}
footer .widget ul li a {
    color: var(--text-secondary);
    transition: color var(--transition);
}
footer .widget ul li a:hover { color: var(--accent) }

/* Sub footer */
.sub-footer {
    padding: 1.25em 0;
    text-align: center;
    border-top: 1px solid var(--border-light);
}
.sub-footer p {
    color: var(--text-tertiary);
    font-size: .8125em;
    margin: 0;
}
.sub-footer a {
    color: var(--text-secondary);
    transition: color var(--transition);
}
.sub-footer a:hover { color: var(--accent) }

/* ---- 8. Special Pages ---- */

/* 404 */
.error-page {
    text-align: center;
    padding: 4em 0;
    animation: fade-in-up .6s ease both;
}
.error-page h1 {
    font: 700 6em/1 var(--font-heading);
    background: linear-gradient(135deg, var(--accent), #f59e0b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: .15em;
}
.error-page p {
    color: var(--text-secondary);
    font-size: 1.15em;
    margin-bottom: 2em;
}
.error-page img { max-width: 20em; opacity: .6 }

/* Tags page */
.tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: .5em;
}
.tags-list a {
    display: inline-block;
    padding: .4em .875em;
    border-radius: 100px;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: .875em;
    transition: border-color var(--transition), color var(--transition), background var(--transition);
}
.tags-list a:hover {
    border-color: var(--accent);
    background: var(--accent-subtle);
    color: var(--accent);
}

/* ---- 9. Article Tree (Table of Contents) ---- */
.article-list {
    position: fixed;
    top: calc(3.5em + 1em);
    right: 1.5em;
    width: 14em;
    max-height: calc(100vh - 7em);
    overflow-y: auto;
    padding: 1em;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity .25s ease, transform .25s ease, visibility .25s ease;
    z-index: 20;
}
.article-list.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.article-list::-webkit-scrollbar { width: 0; height: 0 }

.article-list h4 {
    font: 600 .875em var(--font-heading);
    text-align: center;
    padding-bottom: .75em;
    margin-bottom: .75em;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
}
.article-list .title { font-weight: inherit }

.article-list a {
    display: block;
    padding: .25em 0;
    font-size: .8125em;
    color: var(--text-secondary);
    transition: color var(--transition);
    line-height: 1.5;
}
.article-list a:hover { color: var(--accent) }

.article-list .item-2 { padding-left: 1em }
.article-list .item-3 { padding-left: 2em }
.article-list .item-4 { padding-left: 3em }
.article-list .item-5 { padding-left: 4em }
.article-list .item-6 { padding-left: 5em }

@media screen and (min-width: 1200px) {
    body.has-trees main .wrap.min,
    body.has-trees .post-title,
    body.has-trees .post-content,
    body.has-trees .post-near,
    body.has-trees .post-tags,
    body.has-trees .post-author,
    body.has-trees .post-comments {
        max-width: 44em;
    }
    body.has-trees .home-posts { max-width: 44em }
}
@media screen and (min-width: 1300px) {
    .article-list {
        opacity: 1;
        visibility: visible;
        transform: none;
    }
}
@media screen and (max-width: 1299px) {
    .article-list {
        left: 1.5em;
        right: auto;
        width: auto;
        max-width: 18em;
    }
    body.has-trees main .wrap.min,
    body.has-trees .post-title,
    body.has-trees .post-content,
    body.has-trees .post-near,
    body.has-trees .post-tags,
    body.has-trees .post-author,
    body.has-trees .post-comments,
    body.has-trees .home-posts {
        max-width: 42em;
    }
}
@media screen and (max-width: 767px) {
    .article-list {
        left: 1em;
        right: 1em;
        top: auto;
        bottom: 0;
        width: auto;
        max-width: none;
        max-height: 50vh;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        border-bottom: none;
        transform: translateY(100%);
    }
    .article-list.active {
        transform: translateY(0);
    }
}

/* ---- 10. Prism Code Theme (claude-inspired warm) ---- */
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
    color: #a8a29e;
    font-style: italic;
}
.token.punctuation { color: #78716c }
.token.property,
.token.tag,
.token.boolean,
.token.number,
.token.constant,
.token.symbol,
.token.deleted { color: #b45309 }
.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted { color: #65a30d }
.token.operator,
.token.entity,
.token.url,
.token.variable { color: #d97706 }
.token.atrule,
.token.attr-value,
.token.keyword,
.token.class-name { color: #2563eb }
.token.regex,
.token.important { color: #ea580c }
.language-css .token.string,
.style .token.string {
    color: #d97706;
    background: transparent;
}
.token.bold { font-weight: bold }
.token.italic { font-style: italic }
.token.entity { cursor: help }
.namespace { opacity: .7 }

.dark-theme pre {
    background: #1e1d1b;
    border-color: #2f2d2a;
}
.dark-theme blockquote {
    background: rgba(217, 119, 6, .08);
    color: #fbbf24;
    border-left-color: #f59e0b;
}
.dark-theme :not(pre) > code {
    background: #2f2d2a;
    color: #fbbf24;
}
.dark-theme .token.comment,
.dark-theme .token.prolog,
.dark-theme .token.doctype,
.dark-theme .token.cdata { color: #78716c }
.dark-theme .token.punctuation { color: #a8a29e }
.dark-theme .token.property,
.dark-theme .token.tag,
.dark-theme .token.boolean,
.dark-theme .token.number,
.dark-theme .token.constant,
.dark-theme .token.symbol,
.dark-theme .token.deleted { color: #fb923c }
.dark-theme .token.selector,
.dark-theme .token.attr-name,
.dark-theme .token.string,
.dark-theme .token.char,
.dark-theme .token.builtin,
.dark-theme .token.inserted { color: #a3e635 }
.dark-theme .token.atrule,
.dark-theme .token.attr-value,
.dark-theme .token.keyword,
.dark-theme .token.class-name { color: #60a5fa }

/* ---- 11. Dark mode specific overrides ---- */
.dark-theme ::selection {
    background: rgba(217, 119, 6, .35);
    color: #fff;
}
.dark-theme .post-author {
    background: var(--bg-elevated);
    border-color: var(--border);
}
.dark-theme .comment-form {
    background: var(--bg-elevated);
    border-color: var(--border);
}
.dark-theme .to-top { border-color: var(--border) }

/* Image brightness in dark mode */
.dark-theme img {
    filter: brightness(.8);
    transition: filter .4s ease;
}
.dark-theme img:hover {
    filter: brightness(1);
}

/* ---- 12. Misc animations & refinements ---- */
@media (prefers-reduced-motion: reduce) {
    *, *:before, *:after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}

/* Bottom fade for long content */
.post-content::after {
    content: '';
    display: block;
    height: 2em;
}

/* Nice focus ring for accessibility */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
