:root {
    --bg-color: #f5f5f7;
    /* Very light grey background */
    --card-bg: #ffffff;
    --text-primary: #1d1d1f;
    --text-secondary: #79716b;
    --text-body: #57534d;
    --text-date: #9a9a9a;
    --accent-blue: #0071e3;
    --font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Dark Mode */
[data-theme="dark"] {
    --bg-color: #1d1d1f;
    --card-bg: #2c2c2e;
    --text-primary: #f5f5f7;
    --text-secondary: #a6a09b;
    --text-body: #d6d3d1;
    --text-date: #8e8e93;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Pointer clicks should not leave a focus ring; keyboard focus stays visible. */
:is(a, button, [role="button"], [tabindex]):focus:not(:focus-visible) {
    outline: none;
}

:is(a, button, [role="button"], [tabindex]) {
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-color);
    font-family: var(--font-family);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
    padding-bottom: 40px;
    overflow-y: scroll; /* Prevent layout shift from scrollbar */
}

/* Shared feedback covers every link, including links inside authored content. */
@media (hover: hover) and (pointer: fine) {
    a[href]:hover {
        opacity: 0.75;
    }

    .detail-body a[href]:hover,
    p a[href]:hover,
    li a[href]:hover {
        text-decoration-line: underline;
        text-decoration-thickness: 2px;
        text-underline-offset: 4px;
    }
}

/* Shared masthead: identical dimensions on home and inner pages. */
.site-header {
    height: 72px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 32px;
    max-width: 1280px;
    margin: 0 auto;
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-color);
}
.logo { display: flex; align-items: center; gap: 18px; color: var(--text-primary); }
.logo-img { height: 18px; width: auto; }
.brand-caption { font-size: 12px; letter-spacing: .08em; }
[data-theme="dark"] .logo-img { filter: invert(1); }
.header-icons { display: flex; align-items: center; gap: 24px; color: var(--text-secondary); }
.header-link { font-size: 12px; color: inherit; text-decoration: none; padding: 12px 0; }
.icon { width: 32px; height: 36px; padding: 7px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; border: 0; background: transparent; color: inherit; }
.icon svg { width: 18px; height: 18px; flex-shrink: 0; }
.header-link:hover, .icon:hover { color: var(--text-primary); }
.header-icons .icon { border-radius: 6px; transition: background-color 0.15s ease, color 0.15s ease; }
@media (hover: hover) and (pointer: fine) {
    .header-icons .icon:hover { background-color: color-mix(in srgb, var(--text-primary) 7%, transparent); }
    .logo:hover { opacity: 0.7; }
}
.site-header :focus-visible, .category-bar :focus-visible { outline: 2px solid var(--text-primary); outline-offset: 4px; }

/* A quiet editorial opening, separate from the sticky masthead. */
.home-intro {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: end;
    gap: 48px;
    max-width: 1280px;
    margin: 0 auto;
    padding: 48px 32px 46px;
}
.home-intro-copy h1 {
    color: var(--text-primary);
    font-family: "Songti SC", "Noto Serif CJK SC", "STSong", serif;
    font-size: clamp(28px, 3vw, 40px);
    font-weight: 400;
    line-height: 1.55;
    letter-spacing: .045em;
}
.home-intro-note { justify-self: end; padding: 0 32px 6px 0; color: var(--text-body); font-size: 13px; line-height: 1.9; letter-spacing: .025em; }
.home-intro-note p + p { margin-top: 12px; color: var(--text-secondary); }
.collection-count { flex-shrink: 0; margin-left: 28px; font-size: 11px; color: var(--text-secondary); white-space: nowrap; }
.collection-count span { color: var(--text-primary); font-variant-numeric: tabular-nums; margin-right: 4px; }
@media (max-width: 640px) {
    .site-header { padding: 0 16px; }
    .brand-caption { display: none; }
    .header-icons { gap: 16px; }
    .home-intro { grid-template-columns: 1fr; gap: 22px; padding: 28px 16px 30px; }
    .home-intro-note { justify-self: start; padding: 0; font-size: 12px; }
    .home-intro-note br { display: none; }
    .home-intro-note p + p { margin-top: 4px; }
}

/* Category Filter Bar */
.category-bar {
    display: flex;
    align-items: center;
    max-width: 1280px;
    margin: 0 auto 24px;
    padding: 0 32px;
    position: sticky;
    top: 72px; /* matches the shared masthead */
    z-index: 99;
    background-color: var(--bg-color);
}

.category-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 32px;
    right: 32px;
    border-top: 1px solid color-mix(in srgb, var(--text-secondary) 20%, transparent);
    pointer-events: none;
}

.category-bar-inner {
    display: flex;
    flex: 1;
    min-width: 0;
    gap: 28px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 0;
    scroll-behavior: smooth;
}

.category-bar-inner::-webkit-scrollbar {
    display: none;
}

.cat-tab {
    display: inline-block;
    padding: 16px 0 12px;
    border-bottom: 1px solid transparent;
    border-radius: 0;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    background: transparent;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.15s ease, color 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.cat-tab:hover {
    color: var(--text-primary);
}

@media (min-width: 641px) and (hover: hover) and (pointer: fine) {
    .cat-tab:hover {
        border-bottom-color: var(--text-secondary);
    }
}

.cat-tab.active {
    border-bottom-color: var(--text-primary);
    color: var(--text-primary);
}

/* Show every category on phones without scrolling or disclosure. */
@media (max-width: 640px) {
    .category-bar::before { display: none; }
    .category-bar { position: static; padding: 0 16px 12px; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
    .category-bar-inner { flex-basis: 100%; flex-wrap: wrap; gap: 0 6px; overflow: visible; border-top: 1px solid color-mix(in srgb, var(--text-secondary) 20%, transparent); padding: 12px 0 0; }
    .cat-tab { display: inline-flex; align-items: center; justify-content: center; padding: 0 12px; min-height: 44px; border: 0; border-radius: 6px; font-size: 12px; background: transparent; }
    .cat-tab.active { color: var(--text-primary); background: color-mix(in srgb, var(--text-primary) 7%, transparent); font-weight: 600; }
    .collection-count { margin-left: 0; font-size: 11px; }
}
.page-back { max-width: 1280px; margin: 0 auto; padding: 0 32px; }
@media (max-width: 640px) { .page-back { padding: 0 16px; } }

.card-hidden {
    display: none !important;
}

/* Container for JS Masonry layout */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 32px;
    position: relative;
}

@media (max-width: 640px) {
    .container {
        padding: 0 16px;
    }
}

/* Card Styles */
.card {
    text-decoration: none;
    color: inherit;
    display: block;
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    break-inside: avoid;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    /* JS will handle width and position on Desktop */
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.05);
}

/* Loading state for dynamically loaded cards */
.card.card-loading {
    opacity: 0;
}

.card.card-loaded {
    opacity: 1;
    transition: opacity 0.3s ease;
}

.card-image {
    width: 100%;
    display: block;
    object-fit: cover;
    background-color: #f0f0f0;
    /* Placeholder color */
}

/* Specific aspect ratios for text-only cards or specific images */
.card-content {
    padding: 24px;
}

.card-title {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.card-subtitle {
    display: flex;
    justify-content: flex-start;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 4px 8px;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    font-weight: 500;
}

.card-text {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.6;
    text-align: justify;
}

.card-date {
    font-size: 12px;
    color: var(--text-date);
}


/* Detail Page Styles */
.detail-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 32px;
}

@media (max-width: 768px) {
    .detail-container {
        padding: 0 16px;
    }
}

.detail-back-home {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    margin-bottom: 12px;
    color: var(--text-body);
    font-size: 14px;
    text-decoration: none;
    border-radius: 4px;
}

.detail-back-home:hover {
    color: var(--text-primary);
    text-decoration: underline;
    text-underline-offset: 4px;
}

.detail-back-home:focus-visible {
    outline: 2px solid var(--text-primary);
    outline-offset: 4px;
}

.detail-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    margin-bottom: 60px;
    align-items: stretch;
    /* Ensure Text expands to Image height */
}

.detail-image-wrapper {
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    background-color: #f0f0f0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
    display: flex;
    justify-content: center;
    align-items: center;
    align-self: start;
    /* Prevent Grid stretching */
}

.detail-image {
    width: 100%;
    height: auto;
    /* Maintain aspect ratio */
    display: block;
}

.detail-text-area {
    padding: 40px;
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

.detail-title {
    font-size: 17px;
    font-weight: 600;
    /* font-semibold */
    margin-bottom: 4px;
    color: var(--text-primary);
    transition: color 0.2s;
}

@media (min-width: 640px) {

    /* min-width: 40rem */
    .detail-title {
        font-size: 24px;
        /* text-2xl */
        line-height: 32px;
    }
}

.detail-title a {
    text-decoration: underline;
    text-decoration-color: #d6d3d1;
    /* stone-300 */
    text-underline-offset: 4px;
    text-decoration-thickness: 1px;
    transition: text-decoration-color 0.2s;
    color: inherit;
}

.detail-title a:hover {
    text-decoration-color: #78716c;
    /* stone-500 */
}

/* Dark mode support if applicable, but using stone-500 as base hover */

.detail-subtitle {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 6px 8px;
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
    margin-bottom: 12px;
    font-weight: 500;
}

.detail-body {
    flex-grow: 1;
    font-size: 17px;
    line-height: 1.8;
    color: var(--text-body);
}

.detail-body p {
    margin-bottom: 1rem;
    /* mb-4 */
}

.detail-body p:last-child {
    margin-bottom: 0;
}

.detail-body a {
    color: #0066cc;
    text-decoration: underline;
    text-decoration-color: currentColor;
    text-underline-offset: 0.2em;
    text-decoration-thickness: 1px;
    text-decoration-skip-ink: auto;
    overflow-wrap: anywhere;
    border-radius: 2px;
}

.detail-body a:hover,
.detail-body a:active {
    color: #004999;
    text-decoration-thickness: 2px;
}

.detail-body a:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 3px;
    text-decoration-thickness: 2px;
}

[data-theme="dark"] .detail-body a {
    color: #80bfff;
}

[data-theme="dark"] .detail-body a:hover,
[data-theme="dark"] .detail-body a:active {
    color: #b3d9ff;
}

.detail-date {
    font-size: 12px;
    line-height: 1rem;
    color: var(--text-date);
    margin-top: auto;
}

/* Buy Links */
.buy-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 24px;
    margin-bottom: 24px;
}

.buy-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: filter 0.2s;
    border: none;
    font-family: var(--font-family);
}

.buy-btn:hover {
    filter: brightness(0.95);
}

.buy-btn .buy-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.buy-btn .buy-icon svg {
    fill: currentColor;
    stroke: none;
}

.buy-btn .buy-text {
    flex: 1;
    text-align: left;
}

.buy-btn .buy-arrow {
    flex-shrink: 0;
    opacity: 0.6;
    font-size: 18px;
}

.buy-btn-taobao {
    background: #FFF4EE;
    color: #FF5000;
}

.buy-btn-xiaohongshu {
    background: #FFF0F3;
    color: #C81735;
}

[data-theme="dark"] .buy-btn-xiaohongshu {
    background: #3D1720;
    color: #FF8FA2;
}

.buy-btn-jd {
    background: #FFF0F0;
    color: #E42218;
}

.buy-btn-official {
    background: #EEF4FF;
    color: #0071e3;
}

.buy-btn-default {
    background: #F5F5F5;
    color: #666666;
}

.buy-btn-wechat {
    background: #F0FAF4;
    color: #07C160;
}

.buy-btn-tmall {
    background: #F3EEFA;
    color: #6F2DA8;
}

[data-theme="dark"] .buy-btn-taobao {
    background: #3D2014;
}

[data-theme="dark"] .buy-btn-jd {
    background: #3D1414;
}

[data-theme="dark"] .buy-btn-official {
    background: #142040;
}

[data-theme="dark"] .buy-btn-default {
    background: #333333;
}

[data-theme="dark"] .buy-btn-wechat {
    background: #1A3324;
}

[data-theme="dark"] .buy-btn-tmall {
    background: #2A1740;
}

.buy-btn-tmallcs {
    background: #FDF0F0;
    color: #E4393C;
}

[data-theme="dark"] .buy-btn-tmallcs {
    background: #3D1414;
}

.buy-btn-tip {
    background: #F5F5F5;
    color: #999;
    cursor: default;
}

.buy-btn-tip:hover {
    transform: none;
}

[data-theme="dark"] .buy-btn-tip {
    background: #2A2A2A;
    color: #777;
}

/* Buy QR Modal */
.buy-qr-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.buy-qr-overlay.show {
    display: flex;
}

.buy-qr-modal {
    background: #fff;
    border-radius: 16px;
    padding: 32px;
    text-align: center;
    max-width: 320px;
    width: 80%;
}

.buy-qr-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 20px;
}

.buy-qr-img {
    width: 200px;
    height: 200px;
    object-fit: contain;
    border-radius: 8px;
}

.buy-qr-hint {
    margin-top: 16px;
    font-size: 13px;
    color: #999;
}

[data-theme="dark"] .buy-qr-modal {
    background: #1C1C1E;
}

[data-theme="dark"] .buy-qr-title {
    color: #eee;
}

[data-theme="dark"] .buy-qr-hint {
    color: #666;
}

/* Buy Toast */
.buy-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    padding: 16px 24px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.buy-toast.show {
    opacity: 1;
}

@media (max-width: 768px) {
    .detail-content {
        grid-template-columns: 1fr;
        /* Stack vertically */
        height: auto;
    }

    .detail-image-wrapper {
        min-height: 300px;
        /* Use min-height instead of fixed height for mobile */
    }

    .buy-links {
        flex-direction: column;
    }

    .detail-text-area {
        padding: 24px;
        /* Restore padding for readability on mobile */
    }
}

/* Pagination */
.pagination {
    margin: 40px 0;
    text-align: center;
}

.pagination .page-number,
.pagination .extend {
    display: inline-block;
    padding: 8px 16px;
    margin: 0 4px;
    background: var(--card-bg);
    border-radius: 6px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 14px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.pagination .page-number:hover,
.pagination .extend:hover {
    background: var(--bg-color);
    transform: translateY(-1px);
}

.pagination .page-number.current {
    background: var(--text-primary);
    color: var(--bg-color);
    cursor: default;
}

/* Restored Navigation Styles */
.detail-navigation {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
}

.nav-link {
    background: var(--card-bg);
    padding: 24px;
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-primary);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.nav-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.05);
}

.nav-link.prev {
    grid-column: 1;
    align-items: flex-start;
}

.nav-link.next {
    grid-column: 2;
    align-items: flex-end;
    text-align: right;
}

.nav-label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.nav-title {
    font-size: 14px;
    font-weight: 600;
}

@media (max-width: 768px) {
    .detail-navigation {
        grid-template-columns: 1fr;
    }

    .nav-link.prev,
    .nav-link.next {
        grid-column: auto;
        align-items: flex-start;
        text-align: left;
    }
}

/* Restored Site Footer */
.site-footer {
    max-width: 1280px;
    margin: 40px auto 0;
    padding: 0 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-secondary);
    font-size: 13px;
}

.copyright a {
    color: inherit;
    text-decoration-color: color-mix(in srgb, currentColor 45%, transparent);
    text-underline-offset: 3px;
    transition: color 0.2s, text-decoration-color 0.2s;
}

.copyright a:hover,
.copyright a:focus-visible {
    color: var(--text-primary);
    text-decoration-color: currentColor;
}

@media (max-width: 768px) {
    .site-footer {
        padding: 0 16px;
        flex-direction: column;
        gap: 20px;
    }
}

.footer-icons {
    display: flex;
    gap: 16px;
}

.footer-icons a {
    color: var(--text-secondary);
    transition: opacity 0.2s;
}

.footer-icon {
    width: 16px;
    height: 16px;
    cursor: pointer;
    opacity: 0.6;
    fill: currentColor;
    stroke: none;
}

.footer-icons a:hover .footer-icon {
    opacity: 1;
}

/* About Page */
.about-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 32px;
}

.about-content {
    max-width: 640px;
}

.about-title {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 24px;
    color: var(--text-primary);
}

.about-body {
    font-size: 17px;
    line-height: 1.8;
    color: var(--text-secondary);
}

.about-body p {
    margin-bottom: 1rem;
}

@media (max-width: 768px) {
    .about-container {
        padding: 0 16px;
    }

    .about-title {
        font-size: 24px;
    }
}

/* 404 Error Page */
.error-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 80px 32px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
}

.error-content {
    text-align: center;
}

.error-code {
    font-size: 120px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 16px;
    opacity: 0.1;
}

.error-message {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.error-description {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.error-link {
    display: inline-block;
    padding: 12px 24px;
    background: var(--card-bg);
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.error-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.05);
}

@media (max-width: 768px) {
    .error-container {
        padding: 60px 16px;
    }

    .error-code {
        font-size: 80px;
    }

    .error-message {
        font-size: 20px;
    }
}

/* Archive Page */
.archive-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 32px;
}

.archive-title {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.archive-count {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 40px;
}

.archive-year-section {
    margin-bottom: 40px;
}

.archive-year {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--card-bg);
}

.archive-list {
    list-style: none;
}

.archive-item {
    margin-bottom: 12px;
}

.archive-link {
    display: flex;
    align-items: baseline;
    gap: 16px;
    text-decoration: none;
    padding: 12px 16px;
    background: var(--card-bg);
    border-radius: 8px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.archive-link:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

.archive-item-date {
    font-size: 13px;
    color: var(--text-date);
    flex-shrink: 0;
    min-width: 60px;
}

.archive-item-title {
    font-size: 15px;
    color: var(--text-primary);
    font-weight: 500;
}

@media (max-width: 768px) {
    .archive-container {
        padding: 0 16px;
    }

    .archive-title {
        font-size: 24px;
    }

    .archive-link {
        flex-direction: column;
        gap: 4px;
    }
}

/* Tag Page */
.tag-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 32px;
}

.tag-title {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.tag-count {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 40px;
}

.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.tag-cloud-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--card-bg);
    border-radius: 8px;
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.tag-cloud-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.tag-name {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
}

.tag-post-count {
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--bg-color);
    padding: 2px 8px;
    border-radius: 10px;
}

.tag-posts-list {
    list-style: none;
    margin-bottom: 40px;
}

.tag-post-item {
    margin-bottom: 12px;
}

.tag-post-link {
    display: flex;
    align-items: baseline;
    gap: 16px;
    text-decoration: none;
    padding: 12px 16px;
    background: var(--card-bg);
    border-radius: 8px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.tag-post-link:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

.tag-post-date {
    font-size: 13px;
    color: var(--text-date);
    flex-shrink: 0;
    min-width: 80px;
}

.tag-post-title {
    font-size: 15px;
    color: var(--text-primary);
    font-weight: 500;
}

.back-link {
    display: inline-block;
    font-size: 14px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s;
}

.back-link:hover {
    color: var(--text-primary);
}

@media (max-width: 768px) {
    .tag-container {
        padding: 0 16px;
    }

    .tag-title {
        font-size: 24px;
    }

    .tag-post-link {
        flex-direction: column;
        gap: 4px;
    }
}

/* Category Page */
.category-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 32px;
}

.category-title {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.category-count {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 40px;
}

.category-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.category-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--card-bg);
    border-radius: 8px;
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.category-list-item:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

.category-name {
    font-size: 15px;
    color: var(--text-primary);
    font-weight: 500;
}

.category-post-count {
    font-size: 13px;
    color: var(--text-secondary);
}

.category-posts-list {
    list-style: none;
    margin-bottom: 40px;
}

.category-post-item {
    margin-bottom: 12px;
}

.category-post-link {
    display: flex;
    align-items: baseline;
    gap: 16px;
    text-decoration: none;
    padding: 12px 16px;
    background: var(--card-bg);
    border-radius: 8px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.category-post-link:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

.category-post-date {
    font-size: 13px;
    color: var(--text-date);
    flex-shrink: 0;
    min-width: 80px;
}

.category-post-title {
    font-size: 15px;
    color: var(--text-primary);
    font-weight: 500;
}

@media (max-width: 768px) {
    .category-container {
        padding: 0 16px;
    }

    .category-title {
        font-size: 24px;
    }

    .category-post-link {
        flex-direction: column;
        gap: 4px;
    }
}

/* ===== Site Search ===== */
.search-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 0 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}
.search-overlay.show {
    opacity: 1;
    visibility: visible;
}
.search-panel {
    margin-top: 12vh;
    width: 100%;
    max-width: 600px;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
    transform: translateY(-12px);
    transition: transform 0.2s ease;
}
.search-overlay.show .search-panel {
    transform: translateY(0);
}
.search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 18px;
    border-bottom: 1px solid rgba(128, 128, 128, 0.15);
}
.search-bar-icon {
    color: var(--text-secondary);
    flex-shrink: 0;
}
.search-input {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    background: none;
    font-family: inherit;
    font-size: 16px;
    color: var(--text-primary);
}
.search-input::placeholder {
    color: var(--text-secondary);
}
.search-close {
    flex-shrink: 0;
    border: none;
    background: none;
    padding: 2px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.2s ease;
}
.search-close:hover {
    color: var(--text-primary);
}
.search-status {
    padding: 14px 18px;
    font-size: 13px;
    color: var(--text-secondary);
}
.search-results {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}
.search-result {
    display: block;
    padding: 12px 18px;
    border-bottom: 1px solid rgba(128, 128, 128, 0.15);
    transition: background 0.15s ease;
    text-decoration: none;
}
.search-result:last-child {
    border-bottom: none;
}
.search-result:hover,
.search-result.is-active {
    background: var(--bg-color);
}
.search-result-title {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}
.search-result-snippet {
    display: block;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-body);
}
.search-result-date {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-date);
}
.search-result mark {
    background-color: rgba(0, 113, 227, 0.14);
    color: var(--accent-blue);
    padding: 0 2px;
    border-radius: 2px;
}
.search-footer {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 18px;
    flex-shrink: 0;
    padding: 10px 18px;
    border-top: 1px solid rgba(128, 128, 128, 0.15);
    font-size: 12px;
    color: var(--text-secondary);
}
.search-hint {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.search-footer kbd {
    display: inline-block;
    min-width: 18px;
    padding: 1px 5px;
    font-family: inherit;
    font-size: 11px;
    line-height: 1.5;
    text-align: center;
    color: var(--text-secondary);
    background: var(--bg-color);
    border: 1px solid rgba(128, 128, 128, 0.2);
    border-radius: 4px;
}
body.search-open {
    overflow: hidden;
}
@media (max-width: 768px) {
    .search-panel {
        margin-top: 8vh;
        max-height: 80vh;
    }
    .search-footer {
        gap: 12px;
        font-size: 11px;
    }
}

.card-price { color: inherit; font-size: inherit; font-weight: inherit; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.detail-price { color: inherit; font-size: inherit; font-weight: inherit; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

.not-recommended-badge { position: absolute; top: 12px; right: 12px; z-index: 1; padding: 5px 10px; border-radius: 4px; background: #8c302b; color: #fff; font-size: 12px; font-weight: 600; }
.detail-image-wrapper { position: relative; }
.recommendation-filter { display: flex; align-items: center; flex-shrink: 0; gap: 8px; margin-left: 24px; color: var(--text-secondary); font-size: 12px; }
@media (max-width: 640px) { .recommendation-filter { margin-left: 0; } .collection-count { margin-left: auto; } }
.recommendation-filter { position: relative; min-height: 44px; cursor: pointer; white-space: nowrap; }
.recommendation-filter input { position: absolute; width: 36px; height: 24px; margin: 0; opacity: 0; }
.recommendation-switch { display: inline-block; width: 32px; height: 18px; padding: 2px; box-sizing: content-box; border-radius: 20px; background: var(--text-secondary); }
.recommendation-switch::after { content: ''; display: block; width: 18px; height: 18px; border-radius: 50%; background: var(--bg-color); }
.recommendation-filter input:checked + .recommendation-switch { background: var(--text-primary); }
.recommendation-filter input:checked + .recommendation-switch::after { transform: translateX(14px); background: #fff; }
.recommendation-filter input:focus-visible + .recommendation-switch { outline: 2px solid var(--text-primary); outline-offset: 4px; }

/* Keep small product packshots comfortably framed without altering source images. */
.product-image-padded { box-sizing: border-box; padding: 16%; background-color: #fff; }

.detail-image-wrapper > a { display: block; width: 100%; min-width: 0; }

.detail-brand { color: inherit; text-underline-offset: 4px; }
.detail-brand:hover { color: var(--text-primary); }
.brand-page { max-width: 1280px; margin: 0 auto; padding: 0 32px 64px; }
.brand-intro { max-width: 720px; padding: 24px 0 40px; }
.brand-eyebrow, .brand-count { color: var(--text-secondary); font-size: 12px; }
.brand-intro h1 { font-size: clamp(32px, 5vw, 56px); line-height: 1.15; margin: 16px 0 24px; }
.brand-description { color: var(--text-secondary); font-size: 16px; line-height: 1.9; }
.brand-products { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; align-items: start; }
.brand-product:focus-visible, .detail-brand:focus-visible { outline: 2px solid var(--text-primary); outline-offset: 4px; }
@media (max-width: 1024px) { .brand-products { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .brand-page { padding: 0 16px 40px; } .brand-products { grid-template-columns: minmax(0, 1fr); } .brand-intro { padding-top: 8px; } }

.detail-brand { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.detail-brand span { font-size: .8em; opacity: .65; }
.detail-brand:hover span { opacity: 1; }
.brand-description { margin-bottom: 0; }
.brand-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 24px; margin-top: 28px; }
.brand-count { margin: 0; }
.brand-filters { display: inline-flex; gap: 24px; }
.brand-filters button { min-height: 44px; padding: 10px 0; border: 0; border-bottom: 1px solid transparent; background: transparent; color: var(--text-secondary); font: inherit; font-size: 12px; cursor: pointer; }
.brand-filters button[aria-pressed="true"] { border-bottom-color: var(--text-primary); color: var(--text-primary); }
.brand-filters button:focus-visible { outline: 2px solid var(--text-primary); outline-offset: 2px; }
.brand-product[hidden] { display: none; }

.brand-source { display: inline-block; margin-top: 12px; color: var(--text-secondary); font-size: 12px; text-decoration: none; }
.brand-source:hover { color: var(--text-primary); }
.brand-source:focus-visible { outline: 2px solid var(--text-primary); outline-offset: 4px; }

.brand-directory-link { text-decoration: none; }
.brand-directory-count { margin-top: 28px; font-size: 12px; color: var(--text-secondary); }
.brand-directory { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 48px; }
.brand-directory-item { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 24px 0; border-top: 1px solid color-mix(in srgb, var(--text-secondary) 20%, transparent); text-decoration: none; color: var(--text-primary); }
.brand-directory-name { font-size: 18px; overflow-wrap: anywhere; }
.brand-directory-meta { flex-shrink: 0; font-size: 12px; color: var(--text-secondary); }
.brand-directory-meta span { margin-left: 16px; }
.brand-directory-item:hover .brand-directory-name { color: var(--text-secondary); }
.brand-directory-item:focus-visible, .brand-directory-link:focus-visible { outline: 2px solid var(--text-primary); outline-offset: 4px; }
@media (max-width: 640px) { .brand-directory { grid-template-columns: minmax(0, 1fr); } .brand-directory-name { font-size: 16px; } }

.brand-intro { max-width: none; }
.brand-intro h1 { word-break: keep-all; overflow-wrap: anywhere; }

.brand-heading { display: flex; align-items: center; flex-wrap: wrap; gap: 24px; margin: 16px 0 24px; }
.brand-heading h1 { margin: 0; }
.brand-logo-frame { display: flex; align-items: center; justify-content: center; flex-shrink: 0; width: 176px; height: 96px; padding: 12px 16px; box-sizing: border-box; border-radius: 6px; background: #fff; }
.brand-logo { width: 100%; height: 100%; object-fit: contain; }
.brand-directory-identity { display: flex; align-items: center; gap: 20px; min-width: 0; }
.brand-logo-frame-small { width: 104px; height: 64px; padding: 12px; }
@media (max-width: 640px) { .brand-heading { gap: 16px; } .brand-logo-frame { width: 136px; height: 80px; } .brand-logo-frame-small { width: 80px; height: 56px; padding: 10px; } .brand-directory-identity { gap: 12px; } }

.archive-link { align-items: center; }
.archive-thumbnail { display: flex; align-items: center; justify-content: center; width: 48px; height: 48px; flex-shrink: 0; overflow: hidden; border-radius: 4px; background: #fff; }
.archive-thumbnail img { display: block; width: 100%; height: 100%; object-fit: contain; }
.archive-item-copy { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.archive-item-title { overflow-wrap: anywhere; }
.archive-item-brand { color: var(--text-secondary); font-size: 12px; }
.archive-not-recommended { color: #8c302b; font-size: 11px; white-space: nowrap; flex-shrink: 0; }
.archive-link:focus-visible { outline: 2px solid var(--text-primary); outline-offset: 3px; }
@media (max-width: 768px) {
    .archive-link { flex-direction: row; gap: 10px; padding: 12px 8px; }
    .archive-item-date { min-width: 48px; font-size: 11px; }
    .archive-thumbnail { width: 40px; height: 40px; }
    .archive-item-title { font-size: 14px; }
    .archive-not-recommended { font-size: 10px; }
}

.archive-list .archive-link,
.archive-list .archive-link:visited,
.archive-list .archive-link:hover,
.archive-list .archive-link:focus-visible {
    color: var(--text-primary);
    text-decoration: none;
}
.archive-list .archive-link { transition: background-color 0.2s ease; }
.archive-list .archive-link:hover {
    background-color: color-mix(in srgb, var(--card-bg) 92%, var(--text-secondary));
    opacity: 1;
    transform: none;
    box-shadow: none;
}

.card-image { height: auto; }

.card { position: relative; }
