/* ========== CSS Reset & Base ========== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    /* Color Palette - Apple Pro Inspired */
    --primary: #0071e3;
    --primary-hover: #0077ed;
    --primary-light: rgba(0, 113, 227, 0.1);
    --text: #1d1d1f;
    --text-secondary: #6e6e73;
    --text-tertiary: #86868b;
    --border: rgba(0, 0, 0, 0.08);
    --border-light: rgba(255, 255, 255, 0.5);

    /* Glass Effect Variables */
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.2);
    --glass-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    --glass-shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.06);
    --blur-amount: 20px;

    /* Layout & Radius */
    --container-width: 860px;
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-pill: 99px;
    --header-height: 56px;

    /* Body Background Variable */
    --bg-body: #f5f5f7;

    /* Treemap */
    --treemap-sat: 65%;
    --treemap-light: 80%;
    --treemap-border: #fff;
}

[data-theme="dark"] {
    --primary: #64748B;
    --primary-hover: #94A3B8;
    --primary-light: rgba(100, 116, 139, 0.15);
    --text: #f5f5f7;
    --text-secondary: #86868b;
    --text-tertiary: #6e6e73;
    --border: rgba(255, 255, 255, 0.1);
    --border-light: rgba(255, 255, 255, 0.05);

    --glass-bg: rgba(28, 28, 30, 0.95);
    --glass-border: rgba(255, 255, 255, 0.15);
    --glass-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);

    --bg-body: #000000;

    --treemap-sat: 45%;
    --treemap-light: 35%;
    --treemap-border: #000;
}

html {
    font-size: 16px;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    letter-spacing: -0.01em;
    scrollbar-gutter: stable;
    /* Prevent layout shift when scrollbar appears */
}

body {
    color: var(--text);
    background: var(--bg-body);
    background-attachment: fixed;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-top: calc(var(--header-height) + 24px);
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: opacity 0.2s;
}

a:hover {
    opacity: 0.8;
}

img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-md);
}

/* ========== Layout Utilities ========== */
.container {
    width: 100%;
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 24px;
}

/* Glassmorphism Mixin Utility */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--blur-amount));
    -webkit-backdrop-filter: blur(var(--blur-amount));
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
}

/* ========== Header ========== */
.site-header {
    position: fixed;
    top: calc(1.25rem + env(safe-area-inset-top));
    left: 50%;
    transform: translateX(-50%) translateY(0);
    width: calc(100% - 32px - (env(safe-area-inset-left) + env(safe-area-inset-right)));
    max-width: var(--container-width);
    height: 56px;
    z-index: 1000;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 999px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    align-items: center;
}

[data-theme="dark"] .site-header {
    background: rgba(30, 30, 35, 0.7);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.site-header.hidden {
    transform: translateX(-50%) translateY(calc(-100% - 2rem));
    opacity: 0;
}

.nav-links {
    display: flex;
    align-items: center;
}

.site-header nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 0 20px;
}

.site-header .site-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
    text-decoration: none;
}

.site-header nav ul {
    list-style: none;
    display: flex;
    gap: 4px;
    align-items: center;
}

.site-header nav ul a {
    display: block;
    color: var(--text-secondary);
    font-size: 0.825rem;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 999px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: transparent;
    text-decoration: none;
}

.site-header nav ul a:hover {
    color: var(--text);
    background: rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .site-header nav ul a:hover {
    background: rgba(255, 255, 255, 0.1);
}

.site-header nav ul a.active {
    color: var(--primary) !important;
    background: rgba(var(--primary-rgb, 100, 116, 139), 0.1) !important;
    box-shadow: none !important;
    /* Remove legacy shadows */
}

[data-theme="dark"] .site-header nav ul a.active {
    background: rgba(100, 116, 139, 0.2) !important;
}

/* Theme Toggle */
.theme-toggle {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    margin-left: 8px;
    box-shadow: none;
    /* Override global button shadow */
}

.theme-toggle:hover {
    color: var(--text);
    background: rgba(0, 0, 0, 0.05);
    box-shadow: none;
}

[data-theme="dark"] .theme-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

.theme-toggle .sun-icon {
    display: none;
}

.theme-toggle .moon-icon {
    display: block;
}

[data-theme="dark"] .theme-toggle .sun-icon {
    display: block;
}

[data-theme="dark"] .theme-toggle .moon-icon {
    display: none;
}

/* Mobile Toggle */
/* Mobile Toggle */
.mobile-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.05);
    /* Subtle button background */
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
    border-radius: 50%;
    gap: 5px;
    /* Use gap for spacing instead of space-between */
    transition: background 0.2s;
    box-shadow: none;
    /* Override global button shadow */
}

[data-theme="dark"] .mobile-toggle {
    background: transparent;
    box-shadow: none;
}

.mobile-toggle:hover {
    background: rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .mobile-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

.mobile-toggle .bar {
    width: 18px;
    /* Balanced icon size inside circle */
    height: 2px;
    background-color: var(--text);
    border-radius: 10px;
    transition: all 0.3s ease;
}

/* X State Transformations */
/* Gap is 5px. Distance from center bar to top/bottom bar center is 2/2 + 5 + 2/2 = 7px */
.mobile-toggle.active .bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.mobile-toggle.active .bar:nth-child(2) {
    opacity: 0;
}

.mobile-toggle.active .bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ========== Main Content ========== */
main.container {
    flex: 1;
    padding-top: 24px;
}

/* Flash Messages */
.flash {
    padding: 12px 20px;
    border-radius: 12px;
    margin-bottom: 24px;
    font-size: 0.9rem;
    animation: slideDown 0.3s ease-out;
}

.flash-success {
    background: rgba(52, 199, 89, 0.1);
    color: #34c759;
    border: 1px solid rgba(52, 199, 89, 0.2);
}

.flash-error {
    background: rgba(255, 59, 48, 0.1);
    color: #ff3b30;
    border: 1px solid rgba(255, 59, 48, 0.2);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column-reverse;
    gap: 12px;
    width: 320px;
    max-width: 90vw;
    pointer-events: none;
}

.toast {
    background: rgba(28, 28, 30, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 14px 20px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
    pointer-events: auto;
    animation: toast-slide-in 0.4s cubic-bezier(0.16, 1, 0.3, 1), toast-fade-out 0.3s ease forwards;
    animation-delay: 0s, 4s;
}



@keyframes toast-slide-in {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes toast-fade-out {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
        visibility: hidden;
    }
}

/* ========== Post Cards ========== */
.posts-timeline {
    max-width: 100%;
    margin: 0 auto;
}

.post-card {
    position: relative;
    /* Base for stretched link */
    background: var(--glass-bg);
    padding: 20px 24px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    box-shadow: var(--glass-shadow);
}

.stretched-link::after {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1;
    content: "";
    cursor: pointer;
    /* Pointer only on the link overlay */
}

.post-card:last-child {
    margin-bottom: 0;
}

@media (hover: hover) {
    .post-card:hover {
        transform: translateY(-4px);
        box-shadow: var(--glass-shadow-hover);
    }
}

.post-card h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 6px;
    line-height: 1.3;
}

.post-card h2 a {
    color: var(--text);
    /* No underline effect in list view */
}

.post-card h2 a:hover {
    opacity: 1;
}

.post-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.post-content {
    font-size: 1.05rem;
    line-height: 1.6;
    color: var(--text);
}

/* Uncut Post Variant Stacked */
.post-card.uncut {
    display: block;
    position: relative;
}

.post-meta-header {
    margin-bottom: 6px;
}

.post-date-badge {
    display: inline-block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-tertiary);
    letter-spacing: 0.5px;
}

.post-card.uncut .post-content {
    font-size: 1.05rem;
    margin-top: 0;
    color: var(--text);
    line-height: 1.7;
}

/* ========== Image Grid ========== */
.image-grid-display {
    display: grid;
    gap: 8px;
    margin: 20px 0;
    max-width: 100%;
}

.image-grid-display img {
    position: relative;
    z-index: 2;
    /* Must be above stretched link */
    height: 100%;
    width: 100%;
    object-fit: cover;
    cursor: zoom-in;
    /* Explicitly set zoom-in */
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1),
        box-shadow 0.4s ease;
}

/* Grid Layouts (Unified sizes for <7, current for >=7) */
.image-grid-display {
    grid-template-columns: repeat(3, 1fr);
}

.image-grid-display.count-1,
.image-grid-display.count-2,
.image-grid-display.count-3,
.image-grid-display.count-4,
.image-grid-display.count-5,
.image-grid-display.count-6 {
    grid-auto-rows: 140px;
    max-width: 100%;
}

/* Adjust for count-1, count-2, count-4 to not span full width if they don't have enough images?
   Actually 1fr will make them wide unless max-width is set on the container or columns fixed.
   But user said "Width same as 3 images". 3 images in a full width row means each is ~1/3.
   So count-1 should be 1/3 width.
*/

.image-grid-display.count-1 {
    grid-template-columns: repeat(3, 1fr);
}

/* For count < 7, we already set grid-auto-rows: 140px above.
   We just need to ensure they only take up the necessary columns. 
   Wait, if it's 1fr 1fr 1fr, 1 item will only fill 1 cell. Correct.
*/

.image-grid-display.count-7,
.image-grid-display.count-8,
.image-grid-display.count-9 {
    grid-auto-rows: 120px;
}

/* ========== Post Detail ========== */
.post-detail {
    max-width: 100%;
    margin: 0 auto;
    background: var(--glass-bg);
    backdrop-filter: blur(var(--blur-amount));
    -webkit-backdrop-filter: blur(var(--blur-amount));
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: var(--radius-lg);
    padding: 32px;
}


.post-detail h1 {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 0.4em;
    color: var(--text);
    background: none;
    background-clip: border-box;
    -webkit-background-clip: border-box;
    -webkit-text-fill-color: currentcolor;
    line-height: 1.2;
}

.post-detail .post-meta {
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 16px;
    font-size: 0.9rem;
}

.post-meta .edit-link {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
    background: rgba(var(--primary-rgb), 0.1);
    padding: 2px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.post-meta .edit-link:hover {
    background: var(--primary);
    color: white;
}

.post-detail .post-content,
.home-content-wrapper .post-content {
    font-size: 1.125rem;
    line-height: 1.8;
}

.post-detail .post-content img,
.home-content-wrapper .post-content img {
    max-width: 100%;
    max-height: 60vh;
    width: auto;
    height: auto;
    display: block;
    margin: 0 auto;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    object-fit: contain;
}

.post-detail .post-content p,
.home-content-wrapper .post-content p {
    margin-bottom: 1.5em;
    text-align: justify;
}

.post-detail .post-content h2,
.home-content-wrapper .post-content h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 1.5em;
    margin-bottom: 1.5em;
    line-height: 1.3;
}

.post-detail .post-content h3,
.home-content-wrapper .post-content h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-top: 1.2em;
    margin-bottom: 1.5em;
}

.post-detail .post-content blockquote,
.home-content-wrapper .post-content blockquote {
    border-left: 4px solid #e0e0e0;
    background: #f9f9f9;
    padding: 16px 20px;
    margin: 20px 0;
    border-radius: 0 12px 12px 0;
    color: #555;
    font-style: italic;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

[data-theme="dark"] .post-detail .post-content blockquote,
[data-theme="dark"] .home-content-wrapper .post-content blockquote {
    background: rgba(255, 255, 255, 0.05);
    border-left-color: var(--border);
    color: var(--text-secondary);
}

.post-detail .post-content blockquote p:last-child,
.home-content-wrapper .post-content blockquote p:last-child {
    margin-bottom: 0;
}

.post-detail .post-content ul,
.post-detail .post-content ol,
.home-content-wrapper .post-content ul,
.home-content-wrapper .post-content ol {
    margin-bottom: 1.5em;
    padding-left: 2em;
}

.post-detail .post-content li,
.home-content-wrapper .post-content li {
    margin-bottom: 0.5em;
}

.post-detail .post-content code,
.home-content-wrapper .post-content code {
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.9em;
    color: #e83e8c;
}

.post-detail .post-content pre,
.home-content-wrapper .post-content pre {
    background: #1e1e1e;
    color: #f8f8f2;
    padding: 20px;
    border-radius: 12px;
    overflow-x: auto;
    margin: 24px 0;
    font-size: 0.9rem;
    line-height: 1.5;
}

.post-detail .post-content pre code {
    background: none;
    padding: 0;
    color: inherit;
    font-size: inherit;
}

.post-detail .post-content img {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    /* Default for article images */
}

/* Force grid images back to 100% height even in details */
.post-detail .post-content .image-grid-display img {
    height: 100% !important;
    object-fit: cover;
}

.post-nav {
    max-width: 100%;
    margin: 24px auto 40px;
    /* Center with same width as post */
    padding-top: 20px;
}

.post-nav a {
    display: inline-flex;
    align-items: center;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(10px);
    border-radius: 99px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: all 0.2s;
}

.post-nav a:hover {
    background: var(--primary);
    color: #fff;
    transform: translateX(-4px);

}

/* ========== Tags Treemap ========== */
.tags-page {
    padding: 20px 0;
}

.treemap-container {
    position: relative;
    width: 100%;
    overflow: hidden;
    background: transparent;
}

.treemap-cell {
    --cell-hue: 210;
    position: absolute;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    padding: 8px;
    overflow: hidden;
    background: hsl(var(--cell-hue), var(--treemap-sat), var(--treemap-light));
    border: 1px solid var(--treemap-border);
    box-sizing: border-box;
    transition: all 0.2s ease;
}

.treemap-cell:hover {
    z-index: 10;
    transform: scale(1.02);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.4),
        0 8px 25px hsla(var(--cell-hue), 70%, 40%, 0.4);
    background: linear-gradient(145deg,
            hsl(var(--cell-hue), 75%, 82%) 0%,
            hsl(var(--cell-hue), 70%, 72%) 100%);
}

.treemap-cell.untagged {
    background: var(--treemap-border);
    opacity: 0.8;
}

.treemap-cell.untagged:hover {
    transform: scale(1.02);
    opacity: 1;
    background: var(--text-tertiary);
}

.cell-name {
    font-size: clamp(0.7rem, 2vw, 1.1rem);
    font-weight: 700;
    color: hsl(var(--cell-hue), 50%, 20%);
    text-align: center;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 90%;
}

[data-theme="dark"] .cell-name {
    color: hsl(var(--cell-hue), 80%, 85%);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.treemap-cell.untagged .cell-name {
    color: #666;
}

.cell-count {
    font-size: clamp(0.6rem, 1.5vw, 0.85rem);
    font-weight: 500;
    color: hsl(var(--cell-hue), 40%, 30%);
    opacity: 0.8;
}

[data-theme="dark"] .cell-count {
    color: hsl(var(--cell-hue), 60%, 80%);
}

.treemap-cell.mini-cell * {
    display: none;
}

.treemap-cell.untagged .cell-count {
    color: #888;
}

.empty-state {
    text-align: center;
    padding: 80px 40px;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 16px;
    opacity: 0.8;
}

.empty-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

.empty-hint {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

/* ========== Error Page ========== */
.error-page {
    text-align: center;
    padding: 100px 40px;
    max-width: 500px;
    margin: 0 auto;
}

.error-page .error-icon {
    font-size: 5rem;
    margin-bottom: 20px;
}

.error-page h1 {
    font-size: 6rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary) 0%, #5856d6 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0 0 16px 0;
    line-height: 1;
}

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

.error-page .error-hint {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

/* ========== Tag Detail Page ========== */
.tag-detail-page {
    padding: 20px 0;
}

.tag-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

[data-theme="dark"] .tag-header {
    border-bottom-color: var(--border);
}

.tag-header-left {
    display: flex;
    align-items: baseline;
    gap: 16px;
}

.tag-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    margin: 0;
}

.tag-total {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.tag-filter {
    display: flex;
    gap: 8px;
}

.filter-btn {
    padding: 6px 14px;
    border: none;
    background: transparent;
    border-radius: 99px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.filter-btn:hover {
    color: var(--primary);
    background: rgba(0, 122, 255, 0.06);
}

.filter-btn.active {
    color: #fff;
    background: var(--primary);
    box-shadow: 0 2px 12px rgba(0, 122, 255, 0.35);
}

[data-theme="dark"] .filter-btn.active {
    box-shadow: none;
}

.tag-content {
    max-width: 100%;
}

/* ========== Forms (Login/Settings) ========== */
.login-form,
.editor-form {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.05);
    border-radius: 24px;
    padding: 40px;
    max-width: 400px;
    margin: 60px auto;
}

.editor-form {
    max-width: 100%;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}

input[type="text"],
input[type="password"],
textarea,
.tags-input-wrapper {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid transparent;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    font-size: 1rem;
    transition: all 0.2s;
    font-family: inherit;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

input:focus,
textarea:focus,
.tags-input-wrapper:focus-within {
    outline: none;
    background: #fff;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.15);
}

input[type="datetime-local"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.6);
    font-size: 0.95rem;
    font-family: inherit;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

.form-hint {
    display: block;
    margin-top: 6px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

button,
.btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 12px 24px;
    border-radius: 99px;
    font-weight: 600;
    font-size: 0.95rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    background: linear-gradient(135deg, #007AFF 0%, #0063ce 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.25);
}

button:hover,
.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 122, 255, 0.35);
    filter: brightness(1.1);
    opacity: 1;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.5);
    color: var(--text);
    box-shadow: none;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* ========== Archive ========== */
.archive-container {
    padding: 0 0 40px;
    max-width: 100%;
    margin: 0 auto;
}

.archive-header {
    margin-bottom: 40px;
    text-align: center;
}

.archive-layout {
    display: grid;
    grid-template-columns: 1fr 80px;
    gap: 24px;
    position: relative;
    align-items: start;
}

.archive-sidebar {
    position: sticky;
    top: 100px;
}

.year-nav {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.year-nav li a {
    display: block;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 99px;
    transition: all 0.2s;
    text-align: right;
    border: 1px solid transparent;
}

.year-nav li a:hover {
    color: var(--primary);
    background: rgba(255, 255, 255, 0.5);
}

.year-nav li a.active {
    color: #fff;
    background: var(--primary);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
}

[data-theme="dark"] .year-nav li a.active {
    box-shadow: none;
}

.year-section {
    display: none;
    animation: slideUpFade 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    margin-bottom: 60px;
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading Overlay */
.archive-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease-out;
    border-radius: 20px;
}

.archive-loading-overlay.visible {
    opacity: 1;
    pointer-events: all;
}

/* Spinner: centered on screen */
.spinner {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 44px;
    height: 44px;
    transform: translate(-50%, -50%);
    border: 3px solid rgba(0, 122, 255, 0.2);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 0.8s linear infinite;
    box-shadow: 0 4px 20px rgba(0, 122, 255, 0.25);
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.spinner.visible {
    opacity: 1;
}

/* Global Loading Overlay (for page transitions) */
.global-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 9998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease-out;
}

.global-loading-overlay.visible {
    opacity: 1;
    pointer-events: all;
}

.global-spinner {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 44px;
    height: 44px;
    transform: translate(-50%, -50%);
    border: 3px solid rgba(0, 122, 255, 0.2);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 0.8s linear infinite;
    box-shadow: 0 4px 20px rgba(0, 122, 255, 0.25);
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.global-spinner.visible {
    opacity: 1;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.archive-main {
    position: relative;
    min-height: 400px;
    transition: opacity 0.3s;
    min-width: 0;
}

.archive-main.loading .year-section {
    opacity: 0.3;
    filter: grayscale(100%);
}

.year-section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Capsule Archive List */
.archive-list {
    list-style: none !important;
    padding: 0;
    margin: 16px 0 0 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.archive-card-link {
    text-decoration: none !important;
    display: block;
}

.archive-item {
    background: var(--glass-bg);
    border: 1px solid var(--border);
    padding: 10px 20px;
    border-radius: 100px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

.archive-item:hover {
    transform: translateX(8px);
    background: #fff;
    border-color: var(--primary);
    box-shadow: 0 4px 20px rgba(0, 113, 227, 0.12);
}

[data-theme="dark"] .archive-item:hover {
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.archive-item time {
    font-family: inherit;
    color: var(--text-tertiary);
    font-size: 0.85rem;
    min-width: 42px;
    flex-shrink: 0;
}

.archive-item .post-type-tag {
    font-size: 0.65rem;
    padding: 1px 8px;
    border-radius: 99px;
    min-width: unset;
    font-weight: 700;
}

.archive-item-main {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
}

.archive-post-title {
    font-size: 0.95rem;
    color: var(--text);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 60%;
    /* Allow space for tags */
}

.archive-item-tags {
    margin-left: auto;
    display: flex;
    gap: 6px;
    padding-right: 12px;
}

.mini-tag {
    font-size: 0.7rem;
    color: var(--text-tertiary);
    background: rgba(0, 0, 0, 0.04);
    padding: 1px 8px;
    border-radius: 99px;
    white-space: nowrap;
}

[data-theme="dark"] .mini-tag {
    background: rgba(255, 255, 255, 0.08);
}

.archive-item-arrow {
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    color: var(--primary);
    font-weight: bold;
    font-size: 1.1rem;
}

.archive-item:hover .archive-item-arrow {
    opacity: 1;
    transform: translateX(0);
}

.archive-post-title.empty-hint {
    color: var(--text-tertiary);
    font-style: italic;
    font-weight: 400;
}

.archive-month {
    margin-top: 32px;
}

.archive-month:first-of-type {
    margin-top: 0;
}

.archive-month h2 {
    font-size: 1rem;
    padding: 6px 16px;
    background: var(--glass-bg);
    margin: 0 0 12px 0;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 99px;
    display: inline-block;
    position: sticky;
    top: 80px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    z-index: 10;
    color: var(--text-secondary);
    font-weight: 500;
}

[data-theme="dark"] .archive-month h2 {
    background: rgba(255, 255, 255, 0.1);
}

/* Chart */
.year-chart {
    height: 160px;
    display: flex;
    align-items: flex-end;
    gap: 6px;
    margin-bottom: 40px;
    padding: 20px 16px;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.02);
    width: 100%;
    box-sizing: border-box;
    position: relative;
    overflow: visible;
}

[data-theme="dark"] .year-chart {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border);
}

.chart-column {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    height: 100%;
    justify-content: flex-end;
    position: relative;
    cursor: pointer;
}

.chart-bar-track {
    width: 60%;
    max-width: 20px;
    height: 100%;
    display: flex;
    flex-direction: column-reverse;
    /* Stack from bottom */
    justify-content: flex-start;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.03);
    overflow: hidden;
    position: relative;
}

[data-theme="dark"] .chart-bar-track {
    background: rgba(255, 255, 255, 0.1);
}

.chart-bar-segment {
    width: 100%;
    transition: height 0.5s ease, opacity 0.2s;
}

.chart-bar-segment.type-pulp {
    background: var(--primary);
    z-index: 2;
    /* Blue for Articles */
    opacity: 0.8;
}

.chart-bar-segment.type-uncut {
    background: #34C759;
    /* Green for Status */
    opacity: 0.8;
}

.chart-column:hover .chart-bar-segment {
    opacity: 1;
    filter: brightness(1.1);
}

.chart-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
}

/* Tooltip (CSS only simpler approach) */
.chart-column::after {
    content: attr(data-tooltip);
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s;
    z-index: 100;
}

.chart-column:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.chart-value {
    display: none;
    /* Replaced by tooltip */
}

.post-type-tag {
    font-size: 0.7rem;
    padding: 2px 4px;
    border-radius: 4px;
    font-weight: 600;
    flex-shrink: 0;
    min-width: 3.8rem;
    text-align: center;
    display: inline-block;
    transition: all 0.3s ease;
    letter-spacing: 0.5px;
    /* Default (Article) - Blue */
    background: rgba(0, 122, 255, 0.1);
    color: #007AFF;
    border: 1px solid rgba(0, 122, 255, 0.2);
}

/* Short/Status - Green */
.post-type-tag.uncut {
    background: rgba(var(--text-secondary-rgb), 0.1);
    color: var(--text-secondary);
    border: 1px solid rgba(52, 199, 89, 0.2);
}

/* Post Detail Tags Footer */
.post-tags-footer {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-pill {
    font-size: 0.9rem;
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.03);
    color: var(--text-secondary);
    border-radius: 99px;
    transition: all 0.2s;
    text-decoration: none;
}

.tag-pill:hover {
    background: rgba(0, 122, 255, 0.1);
    color: var(--primary);
}

/* ========== Footer ========== */
footer {
    margin-top: 80px;
    padding: 40px 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
    background: transparent;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

footer:hover {
    opacity: 1;
}

/* Post Navigation (Back Button) */
.post-nav {
    margin-top: 40px;
    margin-bottom: 20px;
}

.post-nav a {
    display: inline-flex;
    align-items: center;
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 99px;
    font-weight: 500;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.post-nav a:hover {
    background: var(--primary);
    color: #fff;
    transform: translateX(-4px);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.2);
}

[data-theme="dark"] .post-nav a {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border);
    color: var(--text);
}

[data-theme="dark"] .post-nav a:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

footer .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.footer-github-link {
    color: var(--text-secondary);
    opacity: 0.6;
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
}

.footer-github-link:hover {
    opacity: 1;
    color: var(--primary);
    transform: scale(1.1);
}

.footer-links {
    display: flex;
    align-items: center;
    gap: 20px;
}

.footer-link,
.footer-admin-link {
    font-size: 0.85rem;
    opacity: 0.8;
    transition: all 0.2s ease;
    text-decoration: none;
    color: var(--text-secondary);
}

.footer-link:hover,
.footer-admin-link:hover {
    opacity: 1;
    color: var(--primary);
}

/* ========== Pagination ========== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 40px 0;
    gap: 16px;
    font-size: 0.95rem;
    padding: 20px;
    border-radius: 99px;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
    border: 1px solid var(--glass-border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

.pagination a {
    padding: 8px 16px;
    border-radius: 99px;
    background: rgba(255, 255, 255, 0.5);
    color: var(--text);
    text-decoration: none;
    transition: all 0.2s ease;
    border: 1px solid rgba(0, 0, 0, 0.05);
    font-weight: 500;
}

.pagination a:hover {
    background: #fff;
    color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.15);
}

.pagination span {
    color: var(--text-secondary);
    font-feature-settings: "tnum";
    font-variant-numeric: tabular-nums;
}

/* Dark mode pagination */
[data-theme="dark"] .pagination {
    background: rgba(30, 30, 35, 0.8);
    border-color: var(--border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .pagination a {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--text);
}

[data-theme="dark"] .pagination a:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

@media (max-width: 768px) {

    /* Global Adjustments */
    html {
        font-size: 15px;
    }

    .container {
        padding: 0 24px;
    }

    main.container {
        padding-top: 20px;
    }

    /* Header & Nav Panel Fusion - Google Search Style */
    .site-header {
        height: 60px;
        border-radius: 28px !important;
        /* Fixed radius for consistent look */
        transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        border: 1px solid var(--border) !important;
    }

    .site-header nav {
        padding: 0 10px;
        /* Shift title left and button right within the pill */
    }

    /* Fusion Effect: Square bottom corners of header and fuse with panel */
    .site-header.nav-active {
        border-bottom-left-radius: 0 !important;
        border-bottom-right-radius: 0 !important;
        border-bottom: none !important;
        background: rgba(255, 255, 255, 0.98);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    }

    [data-theme="dark"] .site-header.nav-active {
        background: rgba(28, 28, 30, 0.98);
        border-bottom: none !important;
    }

    .nav-links {
        position: absolute;
        top: 60px;
        left: -1px;
        /* Align with header's outer border */
        right: -1px;
        /* Align with header's outer border */
        width: calc(100% + 2px);
        /* Compensate for header borders */
        max-width: none;
        height: auto;
        max-height: 0;
        background: rgba(255, 255, 255, 0.98);
        /* Increased opacity */
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        flex-direction: column;
        padding: 0 24px;
        transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
        border: 1px solid var(--border) !important;
        border-top: none !important;
        /* Remove top border to fuse with header */
        /* Fusion: straight top, rounded bottom (matches header's 28px) */
        border-top-left-radius: 0 !important;
        border-top-right-radius: 0 !important;
        border-bottom-left-radius: 28px !important;
        border-bottom-right-radius: 28px !important;
        overflow: hidden;
        display: flex;
        visibility: hidden;
        opacity: 0;
        z-index: 999;
    }

    [data-theme="dark"] .nav-links {
        background: rgba(28, 28, 30, 0.98);
        border-color: rgba(255, 255, 255, 0.1);
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    }

    .nav-links.active {
        max-height: 90vh;
        min-height: auto;
        /* Allow dynamic growth */
        padding: 24px 24px 48px;
        /* Balanced bottom padding */
        visibility: visible;
        opacity: 1;
        display: flex;
        flex-direction: column;
    }

    .site-header nav ul {
        flex-direction: column;
        gap: 12px;
        width: 100%;
        padding: 0;
        margin: 0;
    }

    .site-header nav ul li {
        width: 100%;
    }

    /* Centered Pill Links */
    .site-header nav ul a {
        font-size: 1.1rem;
        padding: 14px 24px;
        text-align: center;
        justify-content: center;
        width: 100%;
        background: rgba(var(--text-rgb, 0, 0, 0), 0.05);
        border-radius: 99px;
        display: flex;
        align-items: center;
        margin: 0;
        color: var(--text);
        font-weight: 500;
        text-decoration: none;
    }

    [data-theme="dark"] .site-header nav ul a {
        background: rgba(255, 255, 255, 0.08);
    }

    .site-header nav ul a.active {
        background: #0071e3 !important;
        /* Brighter Blue for Light mode */
        color: #ffffff !important;
        box-shadow: 0 4px 15px rgba(0, 113, 227, 0.3);
    }

    [data-theme="dark"] .site-header nav ul a.active {
        background: #64748B !important;
        /* Original Slate for Dark mode */
        color: #ffffff !important;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    }

    /* Bottom Centered Theme Toggle */
    .theme-toggle {
        margin: 32px auto 0;
        /* Fixed spacing from links */
        margin-top: 32px;
        /* Force minimum gap */
        width: 52px;
        height: 52px;
        background: rgba(var(--text-rgb, 0, 0, 0), 0.05);
        border: 1px solid var(--border);
        border-radius: 50%;
        display: flex;
        justify-content: center;
        align-items: center;
        flex-shrink: 0;
        position: relative;
        left: auto;
        right: auto;
        top: auto;
    }

    [data-theme="dark"] .theme-toggle {
        background: rgba(255, 255, 255, 0.08);
    }

    .mobile-toggle {
        display: flex;
    }

    /* Restore Rest of Mobile Styles */
    .post-card {
        padding: 16px 20px;
        margin-bottom: 12px;
        border-radius: var(--radius-md);
    }

    .post-card h2 {
        font-size: 1.5rem;
        margin-bottom: 6px;
    }

    .post-content {
        font-size: 1rem;
        line-height: 1.6;
    }

    .post-detail {
        margin-left: 0;
        margin-right: 0;
        width: 100%;
        max-width: none;
        border-radius: 0 !important;
        border-left: none;
        border-right: none;
        box-shadow: none;
        padding: 40px 20px;
        background: var(--glass-bg);
    }

    /* Archive */
    .archive-layout {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .archive-sidebar {
        position: relative;
        top: 0;
        margin-bottom: 24px;
        z-index: 10;
        order: -1;
    }

    .year-nav {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 8px;
        gap: 8px;
        scrollbar-width: none;
    }

    .year-nav::-webkit-scrollbar {
        display: none;
    }
}

/* ========== Lightbox ========== */
.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.lightbox-overlay.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-container {
    position: relative;
    width: 85vw;
    height: 96vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.lightbox-image {
    position: absolute;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    object-fit: contain;
    cursor: zoom-out;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8) rotate(-1deg);
    opacity: 0;
    filter: blur(10px);
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1),
        opacity 0.5s ease,
        filter 0.5s ease;
}

.lightbox-image.current {
    z-index: 10;
    opacity: 1;
    filter: blur(0);
    transform: translate(-50%, -50%) scale(1) rotate(0deg);
}

.lightbox-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
    z-index: -1;
}

@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

.lightbox-close {
    position: absolute;
    top: 40px;
    right: 40px;
    z-index: 20;
    background: none;
    border: none;
    color: #fff;
    font-size: 32px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    box-shadow: none;
    text-shadow: none;
    outline: none;
}

.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    font-size: 40px;
    cursor: pointer;
    width: 60px;
    height: 60px;
    line-height: 1;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    margin: 0;
    padding: 0;
    outline: none;
    border: 1px solid transparent;
}

.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(255, 255, 255, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.5);
    transform: translateY(-50%);
    outline: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.lightbox-next {
    text-indent: 2px;
}

.lightbox-prev {
    left: 40px;
    z-index: 20;
}

.lightbox-next {
    right: 40px;
    z-index: 20;
}

.lightbox-counter {
    position: absolute;
    bottom: 40px;
    left: 0;
    right: 0;
    text-align: center;
    color: rgba(255, 255, 255, 0.9);
    font-size: 16px;
    font-weight: 500;
    letter-spacing: 1px;
    z-index: 20;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

@media (max-width: 768px) {

    .lightbox-prev,
    .lightbox-next {
        width: 40px;
        height: 40px;
        font-size: 28px;
        background: rgba(0, 0, 0, 0.5);
    }

    .lightbox-prev {
        left: 10px;
    }

    .lightbox-next {
        right: 10px;
    }

    .lightbox-close {
        top: auto;
        bottom: 30px;
        right: 30px;
        background: rgba(40, 40, 40, 0.7);
        width: 60px;
        height: 60px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        font-size: 32px;
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
        border: 1px solid rgba(255, 255, 255, 0.1);
    }

    .lightbox-counter {
        bottom: 50px;
        left: 40px;
        right: auto;
        text-align: left;
    }
}

/* ========== Image Loading Animation ========== */
.image-placeholder {
    display: block;
    position: relative;
    overflow: hidden;
    min-height: 200px;
    border-radius: var(--radius-md);
    isolation: isolate;
    transform: translateZ(0);
    -webkit-mask-image: -webkit-radial-gradient(white, black);
    mask-image: radial-gradient(white, black);
    margin: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.4s ease;
    position: relative;
    z-index: 2;
    /* Ensure image wrapper stays above card link */
    cursor: zoom-in;
    background: linear-gradient(90deg, #f0f0f0 25%, #f8f8f8 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite linear;
}

@media (hover: hover) {
    .image-placeholder:hover {
        box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
    }

    .image-placeholder:hover img {
        transform: scale(1.08);
    }
}

.image-grid-display .image-placeholder {
    height: 100%;
    width: 100%;
    min-height: auto;
    margin: 0;
    border-radius: var(--radius-md);
}

.image-grid-display .image-placeholder img {
    height: 100%;
}

.image-placeholder img {
    display: block;
    width: 100%;
    height: auto;
    opacity: 0;
    transition: opacity 0.5s ease, transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), filter 0.5s ease;
    object-fit: cover;
    cursor: zoom-in;
    border-radius: 0 !important;
    will-change: transform;
    backface-visibility: hidden;
}

.image-placeholder.loaded {
    animation: none;
    background: transparent;
    min-height: auto;
}

.image-placeholder.loaded img {
    opacity: 1;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* Home Content */
.home-content-wrapper {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0;
}

@media (max-width: 768px) {
    .home-content-wrapper {
        padding: 0;
    }
}

/* Ensure images in cards and details prioritize lightbox cursor */
.post-card .post-content img,
.post-detail .post-content img {
    position: relative;
    z-index: 2;
    cursor: zoom-in !important;
}