/* ============================================
   TypeZen - Medium 2024 Design System (Optimized)
   ============================================ */

:root {
    /* --------------------------------
       Color System (Refined)
       -------------------------------- */
    --m-white: #ffffff;
    --m-black: #191919;
    --m-gray-50: #fafafa;
    --m-gray-100: #f2f2f2;
    --m-gray-200: #e6e6e6;
    --m-gray-300: #d4d4d4;
    --m-gray-400: #a0a0a0;
    --m-gray-500: #6b6b6b;
    --m-gray-600: #525252;
    --m-gray-700: #3d3d3d;
    --m-gray-900: #191919;

    /* Monochrome Brand System */
    --m-brand: #000000;
    --m-brand-hover: #333333;
    --m-link: #1a1a1a;
    --m-link-hover: #000000;

    /* --------------------------------
       Typography (Enhanced)
       -------------------------------- */
    --m-font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans CN", sans-serif;
    --m-font-serif: "Songti SC", "Noto Serif SC", "SimSun", serif;
    --m-line-height-tight: 1.25;
    --m-line-height-base: 1.5;
    --m-line-height-relaxed: 1.75;

    /* --------------------------------
       Spacing Scale (8px base)
       -------------------------------- */
    --m-space-1: 4px;
    --m-space-2: 8px;
    --m-space-3: 12px;
    --m-space-4: 16px;
    --m-space-5: 20px;
    --m-space-6: 24px;
    --m-space-8: 32px;
    --m-space-10: 40px;
    --m-space-12: 48px;

    /* --------------------------------
       Layout Dimensions
       -------------------------------- */
    --m-header-height: 57px;
    --m-sidebar-left: 240px;
    --m-sidebar-right: 368px;
    --m-content-width: 680px;
    --m-content-padding-x: 145px;
    --m-main-width: calc(var(--m-content-width) + (var(--m-content-padding-x) * 2));
    --m-search-width: 240px;

    /* --------------------------------
       Transitions
       -------------------------------- */
    --m-transition-fast: 0.15s ease;
    --m-transition-base: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    /* --------------------------------
       Transitions
       -------------------------------- */
    --m-transition-fast: 0.15s ease;
    --m-transition-base: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    /* --------------------------------
       Typography & Spacing System (Refined)
       -------------------------------- */
    /* Font Sizes */
    --m-font-size-xs: 12px;
    --m-font-size-sm: 14px;
    --m-font-size-base: 17px;
    --m-font-size-lg: 19px;
    --m-font-size-xl: 22px;
    --m-font-size-xxl: 26px;
    --m-font-size-xxxl: 30px;
    --m-font-size-display: 32px;

    /* Line Heights */
    --m-line-height-tight: 1.25;
    --m-line-height-base: 1.5;
    --m-line-height-relaxed: 1.75;

    /* Letter Spacing */
    --m-letter-spacing-tight: -0.02em;
    --m-letter-spacing-base: 0;
    --m-letter-spacing-relaxed: 0.01em;
    /* Adjusted for KaiTi */

    /* Section Spacing (Block Level) */
    --m-section-spacing-lg: 64px;
    --m-section-spacing-md: 40px;
    --m-section-spacing-sm: 32px;

    /* Content Spacing (Flow Level) */
    --m-content-spacing-lg: 32px;
    --m-content-spacing-md: 20px;
    --m-content-spacing-sm: 16px;
    --m-content-spacing-xs: 8px;
    /* For lists */

    /* Component Spacing */
    --m-image-spacing: 40px;
    --m-blockquote-spacing: 48px;
    --m-code-spacing: 32px;

    /* --------------------------------
       Text Colors
       -------------------------------- */
    --m-text-primary: #111;
    --m-text-secondary: #666;
    --m-text-tertiary: #888;
    --m-text-placeholder: #bbb;
    --m-text-primary-dark: #2c2c2c;
    --m-text-secondary-dark: #555;

    /* --------------------------------
       Border Colors
       -------------------------------- */
    --m-border-color-subtle: rgba(0, 0, 0, 0.04);
    --m-border-color-default: #e5e7eb;

    /* --------------------------------
       Background Colors
       -------------------------------- */
    --m-bg-quote: #f9f9f9;
    --m-bg-code-inline: rgba(0, 0, 0, 0.05);
    --m-bg-table-header: #f8f9fa;
    --m-bg-tag: #f3f4f6;
    --m-bg-tag-hover: #e5e7eb;
    --m-selection-bg: rgba(0, 0, 0, 0.1);

    /* --------------------------------
       Shadows
       -------------------------------- */
    --m-shadow-subtle: 0 0 0 1px rgba(0, 0, 0, 0.1);
    --m-shadow-modal: 0 0 24px rgba(0, 0, 0, 0.15);
    --m-shadow-card: 0 4px 12px rgba(0, 0, 0, 0.08);
    --m-shadow-subtle-light: 0 4px 12px rgba(0, 0, 0, 0.02);
    --m-shadow-focus: 0 0 0 3px rgba(0, 0, 0, 0.05);
    --m-shadow-subtle-sm: 0 1px 2px rgba(0, 0, 0, 0.02);
    --m-shadow-card-light: 0 4px 12px rgba(0, 0, 0, 0.05);
    --m-shadow-subtle-sm: 0 1px 2px rgba(0, 0, 0, 0.02);
    --m-shadow-card-light: 0 4px 12px rgba(0, 0, 0, 0.05);

    /* --------------------------------
       Z-Index Scale
       -------------------------------- */
    --m-z-base: 1;
    --m-z-sidebar: 1000;
    --m-z-mobile-nav: 1050;
    --m-z-topbar: 1100;
    --m-z-overlay: 1150;
    --m-z-modal: 1200;
    --m-z-dropdown: 1300;
}

@media (max-width: 767px) {
    :root {
        /* Mobile Font Sizes */
        --m-font-size-base: 16px;
        --m-font-size-lg: 17px;
        --m-font-size-xl: 20px;
        --m-font-size-xxl: 24px;
        --m-font-size-xxxl: 28px;
        --m-font-size-display: 28px;

        /* Mobile Spacing Overrides */
        --m-section-spacing-lg: 56px;
        /* Corrected to maintain hierarchy */
        --m-section-spacing-md: 32px;
        --m-section-spacing-sm: 24px;

        --m-content-spacing-lg: 24px;
        /* Paragraph gap */
        --m-content-spacing-md: 16px;

        --m-image-spacing: 24px;
        --m-blockquote-spacing: 32px;
        --m-code-spacing: 24px;
    }
}

/* Preload: Disable transitions on load */
html body.m-preload * {
    transition: none !important;
}

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

body {
    margin: 0;
    font-family: var(--m-font-sans);
    font-size: var(--m-font-size-base);
    line-height: var(--m-line-height-base);
    background: var(--m-white) !important;
    color: var(--m-black);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Remove defaults/overrides */
ul,
ol {
    list-style: none;
    padding: 0;
    margin: 0;
}

a {
    text-decoration: none !important;
    color: inherit;
}

a:hover,
a:focus,
a:active {
    text-decoration: none !important;
}

h1,
h2,
h3,
h4,
p {
    margin: 0;
}

button {
    font-family: inherit;
}

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

/* Override Framework Gradients */
.navbar.m-topbar,
.m-sidebar-left,
.m-sidebar-right {
    background: var(--m-white);
    background-image: none;
}

/* ============================================
   Top Navigation Bar
   ============================================ */
.m-topbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--m-header-height);
    background: var(--m-white);
    border-bottom: 1px solid rgba(242, 242, 242, 1);
    z-index: var(--m-z-topbar);
}

.m-topbar-inner {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.m-topbar-left,
.m-topbar-right {
    display: flex;
    align-items: center;
    gap: 24px;
}

.m-topbar-icon {
    color: var(--m-gray-500);
    display: flex;
    align-items: center;
}

/* Sidebar Toggle */
.m-sidebar-toggle {
    margin-right: 16px;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    color: var(--m-gray-900);
    display: flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    width: 32px;
    transition: background 0.1s;
}

.m-sidebar-toggle:hover {
    background: rgba(0, 0, 0, 0.05);
}

.m-topbar-icon:hover {
    color: var(--m-black);
}

.m-btn-text {
    font-size: 15px;
    font-weight: 400;
    /* Regular weight for elegance */
    color: var(--m-gray-600);
    padding: 8px 16px;
    text-decoration: none !important;
    transition: color 0.2s;
}

.m-btn-text:hover {
    color: var(--m-black);
}

/* Primary Login Button (Header) */
.m-btn-login {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 36px;
    padding: 0 20px;
    background: transparent;
    color: #f05e1c;
    /* Logo Orange */
    border: 1px solid #f05e1c;
    font-size: 14px;
    font-weight: 500;
    border-radius: 18px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none !important;
}

.m-btn-login:hover {
    background: #f05e1c;
    color: var(--m-white);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(240, 94, 28, 0.25);
    /* Orange shadow */
}

.m-btn-login:active {
    transform: translateY(0);
    background: #d64d12;
    /* Darker orange */
    border-color: #d64d12;
    opacity: 1;
}

.m-btn-login:focus-visible {
    outline: 2px solid #f05e1c;
    outline-offset: 2px;
}

/* User Actions */
.m-btn-write {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 12px;
    color: var(--m-gray-600);
    font-size: 14px;
    font-weight: 500;
    border-radius: 16px;
    transition: all 0.2s;
    background: transparent;
}

.m-btn-write:hover {
    color: var(--m-black);
    background: var(--m-gray-100);
}

.m-user-toggle {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 2px;
    border-radius: 50%;
    transition: opacity 0.2s;
}

.m-user-toggle:hover {
    opacity: 1;
}

/* Duplicate .m-avatar removed, using L511 definition */

.m-btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 20px;
    background: transparent;
    color: var(--m-black);
    border: 1px solid var(--m-black);
    border-radius: 100px;
    font-size: 14px;
    font-weight: 400;
    /* Regular weight */
    cursor: pointer;
    text-decoration: none !important;
    transition: all 0.2s ease;
}

.m-btn-primary:hover {
    background: var(--m-black);
    color: var(--m-white);
    opacity: 1;
}

.m-btn-primary:active {
    transform: scale(0.98);
    /* Minimal feedback */
    background: var(--m-black);
    color: var(--m-white);
}

.m-btn-sm {
    padding: 8px 20px;
    font-size: 13px;
}

/* "Write" Call to Action Button - Minimalist Transparent */
.m-btn-write {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    /* Tighter gap */
    padding: 8px 8px;
    /* Reduced visual padding */
    font-size: 15px;
    font-weight: 400;
    color: var(--m-gray-600);
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.m-btn-write:hover {
    color: var(--m-black);
    background: transparent;
    /* Remove background on hover */
}

.m-avatar {
    width: 40px;
    /* Optimized from 32px for better presence */
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--m-gray-100);
    /* Definition ring */
}

/* Tabs */
.m-tabs {
    display: flex;
    gap: var(--m-space-8);
    border-bottom: 1px solid var(--m-gray-100);
    margin: 0;
    padding: 0;
    position: relative;
}

.m-tabs.m-tabs-centered {
    justify-content: center;
    border-bottom: none;
}

.m-tab {
    padding: var(--m-space-4) 0;
    font-size: 14px;
    font-weight: 400;
    color: var(--m-gray-500);
    border-bottom: 1px solid transparent;
    margin-bottom: -1px;
    cursor: pointer;
    transition: var(--m-transition-fast);
    transition-property: color, border-color;
}

.m-tab:hover {
    color: var(--m-gray-600);
}

.m-tab.active {
    color: var(--m-black);
    border-bottom-color: var(--m-black);
}

/* Article List Container */
.m-articles {
    padding-top: 16px;
    /* 16px container + 24px item = 40px total gap */
    position: relative;
}

.m-articles.is-loading {
    opacity: 0.5;
    pointer-events: none;
}

/* Loading Overlay */
.m-loading-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    color: var(--m-gray-400);
    z-index: 10;
}

/* Breadcrumb */
.m-breadcrumb {
    font-size: 13px;
    color: var(--m-gray-500);
    padding: var(--m-space-4) 0;
    border-bottom: 1px solid var(--m-gray-200);
    margin-bottom: var(--m-space-6);
    display: flex;
    align-items: center;
    gap: 8px;
    /* Breadcrumb separator spacing */
}

.m-breadcrumb-item {
    color: var(--m-gray-500);
}

.m-breadcrumb-item:hover {
    color: var(--m-black);
}

.m-breadcrumb-separator {
    color: var(--m-gray-300);
}

/* Channel Header */
.m-channel-header {
    padding: 48px 0 32px 0;
    border-bottom: 1px solid var(--m-gray-200);
    margin-bottom: 32px;
}

.m-channel-title {
    font-size: 42px;
    font-weight: 700;
    color: var(--m-black);
    margin: 0;
    line-height: 1.15;
    letter-spacing: 0;
}

@media (max-width: 768px) {
    .m-channel-header {
        padding: 32px 0 24px 0;
    }

    .m-channel-title {
        font-size: 32px;
    }
}

.m-channel-description {
    font-size: 16px;
    color: var(--m-gray-500);
    margin-top: 12px;
    line-height: 1.5;
}

/* Sub Channels (Synced with Home Tabs) */
.m-sub-channels {
    display: flex;
    gap: var(--m-space-8);
    border-bottom: 1px solid var(--m-gray-100);
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
    position: relative;
}

.m-sub-channel-item {
    display: inline-flex;
    align-items: center;
    padding: var(--m-space-4) 0;
    background: transparent;
    border: none;
    border-bottom: 1px solid transparent;
    border-radius: 0;
    font-size: 14px;
    color: var(--m-gray-500);
    font-weight: 400;
    line-height: 1.5;
    transition: var(--m-transition-fast);
    margin-bottom: -1px;
    cursor: pointer;
}

.m-sub-channel-item:hover {
    color: var(--m-gray-600);
}

.m-sub-channel-item.active {
    color: var(--m-black);
    border-bottom-color: var(--m-black);
    font-weight: 400;
    background: transparent;
    border-left: none;
    border-right: none;
    border-top: none;
}

/* Sort & Filter */
.m-filter {
    display: flex;
    gap: var(--m-space-6);
    padding: var(--m-space-4) 0;
    border-bottom: 1px solid var(--m-gray-200);
}

.m-filter-item {
    font-size: 14px;
    color: var(--m-gray-500);
    font-weight: 400;
    transition: color 0.2s;
}

.m-filter-item:hover {
    color: var(--m-gray-700);
}

.m-filter-item.active {
    color: var(--m-black);
    font-weight: 500;
}

/* Empty State */
.m-empty-state {
    text-align: center;
    padding: var(--m-space-12) 0;
    color: var(--m-gray-500);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.m-empty-icon {
    width: 48px;
    height: 48px;
    color: var(--m-gray-300);
    margin-bottom: 16px;
}

/* Search Bar */
.m-search {
    position: relative;
    width: var(--m-search-width);
}

.m-search input {
    width: 100%;
    height: 40px;
    border: none;
    border-radius: 20px;
    background: var(--m-gray-50);
    padding: 0 12px 0 40px;
    font-size: 14px;
    outline: none;
    transition: all 0.2s ease;
}

.m-search input:focus {
    background: #ffffff;
    border-color: transparent;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
}

.m-search input::placeholder {
    color: var(--m-gray-500);
}

.m-search label {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1;
    cursor: text;
    display: flex;
    align-items: center;
}

.m-search svg {
    /* Position handled by label now */
    width: 20px;
    height: 20px;
    color: var(--m-gray-500);
}



/* ============================================
   Left Sidebar
   ============================================ */
.m-sidebar-left {
    position: fixed;
    width: var(--m-sidebar-left);
    height: calc(100vh - var(--m-header-height));
    top: var(--m-header-height);
    left: 0;
    border-right: 1px solid rgba(242, 242, 242, 1);
    /* Strict Alignment: 24px */
    padding: 24px 0 24px 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    background: var(--m-white);
    z-index: 1000;
    z-index: 1000;
    overflow-x: hidden;
    /* Expand: Slow down at the end (Ease Out) */
    transform: translateX(0);
    will-change: transform;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Sidebar Collapsed State */
body.m-sidebar-collapsed .m-sidebar-left {
    transform: translateX(-100%);
}

body.m-sidebar-collapsed .m-main-wrapper {
    margin-left: 0;
}

/* Logo in Topbar (Generic) */
.m-logo {
    display: flex;
    align-items: center;
    color: inherit;
    flex-shrink: 0;
    padding: 0;
    margin: 0;
    margin-right: 20px;
    text-decoration: none !important;
}

.m-logo img {
    height: 36px;
    width: auto;
    display: block;
}

/* Navigation Items */
.m-nav {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 0;
}

.m-nav-item {
    display: flex;
    align-items: center;
    height: 44px;
    /* Slightly taller touch target */
    color: var(--m-gray-500);
    margin: 2px 12px;
    /* Capsule style spacing */
    transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
    padding-left: 16px;
    /* Adjusted padding */
    width: auto;
    /* Allow margin to work */
    box-sizing: border-box;
    border-radius: 8px;
    /* Rounded corners */
}

.m-nav-item:hover {
    background: var(--m-gray-50);
    /* Subtle hover bg */
    color: var(--m-black);
}

.m-nav-item.active {
    color: var(--m-black);
    /* Active = Black (Prominent) */
    background: transparent;
    font-weight: 500;
    /* Active = Medium Weight */
}

/* Ensure active item also gets hover background */
.m-nav-item.active:hover {
    background: var(--m-gray-50);
}

.m-nav-item svg {
    min-width: 24px;
    width: 24px;
    height: 24px;
    stroke-width: 1.5;
    fill: none;
}

.m-nav-item.active svg {
    stroke: var(--m-gray-500);
    fill: none;
}

.m-nav-item span {
    display: inline-block;
    opacity: 1;
    margin-left: 12px;
    white-space: nowrap;
    font-size: 15px;
}

/* ============================================
   Main Layout & Content
   ============================================ */
.m-layout {
    display: flex;
    min-height: calc(100vh - var(--m-header-height));
}

.m-main-wrapper {
    flex: 1;
    margin-left: var(--m-sidebar-left);
    will-change: margin-left;
    transition: margin-left 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    justify-content: center;
    min-width: 0;
    padding-top: var(--m-header-height);
}

/* Main Column */
.m-main {
    display: flex;
    flex-direction: column;
    width: var(--m-main-width);
    max-width: 100%;
    flex-shrink: 0;
    /* Alignment: 23px (96 - 57 - 16 = 23) */
    padding: 23px var(--m-content-padding-x);
    margin: 0;
    border-right: 1px solid var(--m-gray-100);
}

.m-content {
    width: 100%;
}

/* ============================================
   Article Components
   ============================================ */
.m-article {
    display: flex;
    gap: 24px;
    /* User requested 24px */
    padding: 24px 0;
    /* User requested 24px */
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    /* Ultra-subtle divider */
}

.m-article:first-child {
    padding-top: var(--m-space-4);
}

.m-article-body {
    flex: 1;
    min-width: 0;
}

.m-article-meta {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    margin-bottom: 12px;
    /* More space before title */
}

.m-article-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    margin-right: 4px;
}

.m-article-author {
    font-weight: 500;
    color: var(--m-black);
}

.m-article-channel {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--m-gray-600);
    transition: color 0.2s;
    font-size: 13px;
    font-weight: 500;
}

.m-article-channel:hover {
    color: var(--m-black);
}

.m-article-channel svg {
    width: 15px;
    height: 15px;
    stroke-width: 2px;
}

.m-article-date {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--m-gray-500);
    font-size: 13px;
}

.m-article-date svg {
    width: 15px;
    height: 15px;
    color: var(--m-gray-400);
}

.m-link-title {
    color: inherit;
}

.m-article-title {
    font-size: 22px;
    /* Refined size */
    font-weight: 600;
    /* Modern Bold */
    line-height: 1.4;
    /* Comfortable reading */
    color: var(--m-black);
    margin-bottom: 8px;
    letter-spacing: 0;
    /* Tighter tracking */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-clamp: 2;
    overflow: hidden;
    cursor: pointer;
    transition: color 0.15s;
}

.m-link-title:hover .m-article-title {
    color: var(--m-gray-500);
}

.m-article-channel:hover,
.m-article-channel:focus {
    color: var(--m-black);
}

.m-article-desc {
    font-size: 15px;
    /* Slightly smaller for elegance */
    line-height: 1.6;
    /* Better readability */
    color: var(--m-gray-500);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-clamp: 2;
    overflow: hidden;
    margin-bottom: 12px;
    /* Closer to footer */
}

.m-article-footer {
    display: flex;
    align-items: center;
    gap: 16px;
    /* Clear separation */
    font-size: 13px;
    width: 100%;
    margin-top: 0;
}

/* ... existing dot/star ... */
.m-article-footer .m-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--m-brand);
}

.m-article-footer .m-star {
    color: var(--m-brand);
    font-size: 14px;
}

.m-article-actions {
    display: flex;
    align-items: center;
    gap: 20px;
    /* More breathing room */
    margin-left: auto;
}

.m-article-actions svg {
    width: 20px;
    height: 20px;
    color: var(--m-gray-400);
    cursor: pointer;
}

.m-article-actions svg:hover {
    color: var(--m-black);
}

.m-article-image {
    width: 160px;
    height: 107px;
    flex-shrink: 0;
    flex-shrink: 0;
    border-radius: 8px;
    /* Softer corners */
    overflow: hidden;
    /* Subtle image hover setup */
    transform: translateZ(0);
}

.m-article-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.m-article:hover .m-article-image img {
    transform: scale(1.05);
}

/* ============================================
   Right Sidebar
   ============================================ */
.m-sidebar-right {
    width: var(--m-sidebar-right);
    flex-shrink: 0;
    /* Alignment: Final value 40px */
    padding: 40px var(--m-space-6) var(--m-space-6) var(--m-space-12);
    /* Smart Sticky: JS controls --m-sticky-top, fallback to header height */
    position: sticky;
    top: var(--m-sticky-top, 57px);
    height: fit-content;
    z-index: var(--m-z-sidebar);
}

.m-sidebar-right::-webkit-scrollbar {
    display: none;
}

.m-section {
    margin-bottom: var(--m-space-10);
}

.m-section:last-of-type {
    margin-bottom: 0;
}

.m-section-title {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--m-black);
    margin-top: 0 !important;
    /* Force reset */
    margin-bottom: var(--m-space-5);
}

/* ============================================
   Responsive Design
   ============================================ */

/* Large Laptops / Moderate Desktops */
@media (max-width: 1480px) {
    :root {
        --m-content-padding-x: 80px;
        /* Reduce luxurious padding */
    }
}

/* Standard Laptops / Tablets Landscape */
@media (max-width: 1200px) {
    :root {
        --m-content-padding-x: 48px;
    }

    .m-sidebar-right {
        display: none;
        /* Hide auxiliary sidebar to focus on reading */
    }

    .m-main {
        border-right: none;
        /* Remove divider when sidebar is gone */
        width: 100%;
        /* Allow fluid expansion up to max-width */
        max-width: 780px;
        /* 680 + 48*2 approx */
        margin: 0 auto;
        /* Center content */
    }
}

/* Tablets Portrait / Small Laptops */
@media (max-width: 992px) {
    :root {
        --m-sidebar-left: 72px;
        /* Auto-switch to slim sidebar or collapsed */
        --m-content-padding-x: 24px;
    }

    .m-main {
        padding-top: 24px;
        padding-bottom: 24px;
    }
}

/* Mobile Devices */
@media (max-width: 768px) {
    :root {
        --m-content-width: 100%;
        --m-content-padding-x: 20px;
    }

    /* Mobile Header */
    .m-topbar {
        padding: 0;
    }

    .m-sidebar-toggle {
        margin-right: 0;
        /* Let gap handle spacing */
    }

    /* Mobile Header Layout */
    .m-topbar-left {
        gap: 12px;
        flex: 1;
        /* Allow taking available space */
        min-width: 0;
        /* Prevent flex layout blowout */
    }

    .m-logo img {
        height: 28px !important;
    }

    /* Unhide and Resize Search */
    .m-search {
        display: block;
        width: auto;
        flex: 1;
        min-width: 60px;
    }

    .m-search input {
        padding: 0 12px 0 32px;
        /* Tighter padding */
    }

    .m-search svg {
        left: 10px;
        /* Adjustment for tighter padding */
    }

    /* Restore and Optimization Topbar Right */
    .m-topbar-right {
        display: flex;
        gap: 8px;
    }

    .m-btn-write span {
        display: none;
    }

    .m-btn-write {
        padding: 8px;
    }

    .m-btn-login span {
        display: none;
    }

    .m-btn-login {
        padding: 8px;
    }

    /* Sidebar behavior on mobile */
    .m-sidebar-left {
        transform: translateX(-100%);
        /* Hidden by default */
        width: 280px;
        /* Drawer width */
        height: 100vh;
        top: 0;
        z-index: var(--m-z-modal);
        /* Above header */
        box-shadow: 0 0 24px rgba(0, 0, 0, 0.15);
    }

    /* Open state for mobile */
    body.m-sidebar-open .m-sidebar-left {
        transform: translateX(0);
    }

    /* Overlay for mobile sidebar */
    body.m-sidebar-open::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1150;
    }

    .m-main-wrapper {
        margin-left: 0 !important;
        /* Content always full width */
    }

    .m-main {
        padding: 24px 20px;
        border: none;
        width: 100%;
        max-width: 100%;
    }

    /* Article Card Mobile */
    .m-article {
        flex-direction: column-reverse;
        /* Image on top for cards */
        gap: 16px;
        padding: 24px 0;
    }

    .m-article-image {
        width: 100%;
        height: auto;
        aspect-ratio: 16/9;
    }

    .m-article-title {
        font-size: 20px;
        /* Smaller title */
    }

    .m-article-desc {
        font-size: 15px;
        -webkit-line-clamp: 3;
        line-clamp: 3;
    }
}

/* Staff Picks, Topics, Users list styles... */
/* (Keeping them concise for file size, implicitly included from original optimized flow) */

/* Hot Articles (Picks) */
.m-picks {
    display: flex;
    flex-direction: column;
    gap: 16px;
    /* Increased gap for better rhythm */
}

.m-pick {
    display: block;
    padding: var(--m-space-4);
    background: var(--m-gray-50);
    border-radius: 12px;
    transition: var(--m-transition-base);
    transition-property: background, transform, box-shadow;
}

.m-pick:hover {
    background: var(--m-white);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    /* Deeper shadow */
    transform: translateY(-2px);
    /* Higher lift */
    z-index: 1;
    /* Ensure pop out */
}

.m-pick-title {
    font-size: 14px;
    font-weight: 600;
    line-height: var(--m-line-height-tight);
    color: var(--m-black);
    margin-bottom: var(--m-space-2);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-clamp: 2;
    overflow: hidden;
}

.m-pick-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--m-gray-500);
}

.m-pick-channel {
    color: var(--m-gray-600);
}

.m-pick-dot {
    color: var(--m-gray-300);
    font-size: 10px;
}

.m-pick-date {
    color: var(--m-gray-400);
}

/* Read More Link */
.m-see-more {
    font-size: 14px;
    color: var(--m-brand);
    margin-top: 16px;
    display: inline-block;
}

.m-see-more:hover {
    color: var(--m-brand-hover);
}

/* Topics */
.m-topics {
    display: flex;
    flex-wrap: wrap;
    gap: var(--m-space-2);
}

.m-topic {
    padding: var(--m-space-2) var(--m-space-4);
    background: var(--m-gray-50);
    border: 1px solid var(--m-gray-100);
    border-radius: 100px;
    font-size: 13px;
    color: var(--m-gray-600);
    transition: var(--m-transition-fast);
    transition-property: background, border-color, color;
}

.m-topic:hover {
    background: var(--m-gray-100);
    border-color: var(--m-gray-200);
    color: var(--m-black);
}

/* Who to Follow */
.m-users {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.m-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.m-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
}

.m-user-info {
    flex: 1;
    min-width: 0;
}

.m-user-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--m-black);
}

.m-user-bio {
    font-size: 13px;
    color: var(--m-gray-500);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.m-btn-follow {
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 400;
    color: var(--m-black);
    background: transparent;
    border: 1px solid var(--m-gray-200);
    border-radius: 99px;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s;
}

.m-btn-follow:hover {
    border-color: var(--m-black);
}

/* Sidebar Footer */
.m-sidebar-footer {
    margin-top: var(--m-space-10);
    padding-top: var(--m-space-6);
    border-top: 1px solid var(--m-gray-100);
}

.m-footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: var(--m-space-2) var(--m-space-4);
    margin-bottom: var(--m-space-3);
}

.m-footer-links a {
    font-size: 13px;
    color: var(--m-gray-400);
    transition: var(--m-transition-fast);
}

.m-footer-links a:hover {
    color: var(--m-gray-600);
}

.m-footer-copyright {
    font-size: 12px;
    color: var(--m-gray-400);
    line-height: var(--m-line-height-relaxed);
}

/* Pagination */
.m-pagination {
    padding: 32px 0;
    display: flex;
    justify-content: center;
}

.pagination {
    display: flex;
    gap: 4px;
    list-style: none;
}

.pagination>li>a,
.pagination>li>span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    font-size: 14px;
    color: var(--m-gray-500);
    background: transparent;
    border: none;
    border-radius: 4px;
}

.pagination>li>a:hover {
    background: var(--m-gray-100);
    color: var(--m-black);
}

.pagination>.active>a,
.pagination>.active>span {
    background: var(--m-black);
    color: var(--m-white);
}

/* Load More / Infinite Scroll */
.m-loadmore-wrap {
    display: flex;
    justify-content: center;
    padding: 32px 0;
}

.m-btn-loadmore {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 32px;
    font-size: 14px;
    font-weight: 500;
    color: var(--m-gray-600);
    background: var(--m-white);
    border: 1px solid var(--m-gray-200);
    border-radius: 24px;
    cursor: pointer;
    transition: all 0.2s;
}

.m-btn-loadmore:hover {
    color: var(--m-black);
    border-color: var(--m-black);
}

.m-btn-loadmore:disabled,
.m-btn-loadmore[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

.m-loadmore {
    text-align: center;
    padding: 24px 0;
    color: var(--m-gray-500);
    font-size: 14px;
}

.m-loadmore-nodata {
    color: var(--m-gray-400);
}

/* ============================================
   Article Detail Page
   ============================================ */
/* No right sidebar - main content fills available space */
.m-no-sidebar .m-main {
    flex: 1;
    max-width: none;
    border-right: none;
}

/* Detail content container - centered within main area */
/* Content width: 728px - 48px(padding) = 680px */
.m-article-detail {
    max-width: 728px;
    margin: 0 auto;
    padding: 48px 24px 80px;
}

/* Back Link (Substack Style - Refined) */
.m-back-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
    color: var(--m-gray-500);
    text-decoration: none;
    margin-bottom: 16px;
    /* Closer to title */
    transition: all 0.2s ease;
    font-family: var(--m-font-sans);
    padding: 6px 16px 6px 6px;
    border-radius: 20px;
    margin-left: -6px;
    /* Align icon visually */
}

.m-back-link i {
    font-size: 14px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--m-gray-100);
    border-radius: 50%;
    transition: all 0.2s ease;
    color: var(--m-gray-600);
}

.m-back-link:hover {
    color: var(--m-black);
    background: var(--m-gray-50);
}

.m-back-link:hover i {
    background: var(--m-black);
    color: #fff;
    transform: translateX(-2px);
}




/* Category */
.m-article-category {
    text-decoration: none !important;
    color: var(--m-brand);
    font-weight: 500;
}

.m-article-category:hover {
    color: var(--m-brand-hover);
}



/* Hero Image (Detail) */
.m-article-hero {
    margin: 32px 0 32px;
    /* Consistent rhythm */
    border-radius: 8px;
    overflow: hidden;
    background: var(--m-gray-50);
}

.m-article-hero img {
    width: 100%;
    height: auto;
    display: block;
    aspect-ratio: 21/9;
    object-fit: cover;
}

.m-article-detail-title {
    font-family: var(--m-font-sans);
    font-size: 30px;
    /* Refined & Exquisite */
    line-height: 1.3;
    font-weight: 700;
    color: #111;
    margin: 0 0 32px;
    letter-spacing: -0.02em;
    /* Tighter for Chinese elegance */
}

.m-article-abstract {
    font-family: var(--m-font-sans);
    font-size: 17px;
    line-height: 1.6;
    color: #555;
    background: #f9f9f9;
    /* Subtle Abstract Card */
    padding: 20px 24px;
    border-radius: 6px;
    margin: 0 0 32px;
    font-weight: 400;
    text-align: justify;
    text-justify: inter-ideograph;
}

/* Meta/Author Line - Refined Style */
.m-article-meta-large {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 24px;
    /* Tighter coupling */
    padding: 16px 0;
    margin-bottom: 32px;
    border-top: 1px solid var(--m-gray-100);
    border-bottom: 1px solid var(--m-gray-100);
    font-size: 14px;
    color: var(--m-gray-500);
}

.m-article-meta-large>span,
.m-article-meta-large>time {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--m-gray-600);
    line-height: 1.2;
    /* Force consistent line-height */
}

.m-article-meta-large i {
    font-size: 16px;
    color: var(--m-gray-400);
    /* width: 18px; removed to let gap control precise spacing */
}

.m-author-name {
    font-weight: 400;
    color: inherit !important;
}

.m-article-category a {
    color: var(--m-gray-600);
    transition: color 0.2s;
}

.m-article-category a:hover {
    color: var(--m-black);
}

.m-author-date {
    font-weight: 400;
    color: var(--m-gray-500);
}

.m-author-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.m-author-info {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 32px;
    /* Wider spacing */
    font-size: 14px;
}

.m-author-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--m-gray-600);
}

.m-author-item i {
    color: var(--m-gray-400);
    font-size: 16px;
}



.m-author-name {
    font-size: 15px;
    font-weight: 500;
    color: var(--m-black);
}

.m-author-meta {
    font-size: 14px;
    color: var(--m-gray-500);
}

/* Hero Image */

/* Article Body (Detail Page Only) */
.typezen-typography {
    font-family: var(--m-font-sans);
    font-size: var(--m-font-size-base);
    line-height: 1.75;
    color: #2c2c2c;
    /* Deep Gray for comfort */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-align: justify;
    /* Boxed alignment */
    text-justify: inter-ideograph;
    word-wrap: break-word;
    letter-spacing: var(--m-letter-spacing-base);
}

/* Premium Selection */
.typezen-typography ::selection {
    background: var(--m-black);
    color: #fff;
}

.typezen-typography p {
    margin: 0 0 30px;
    /* Optimal reading flow */
}

.typezen-typography a {
    color: inherit;
    text-decoration: none !important;
    border-bottom: 1px solid var(--m-gray-300) !important;
    transition: all 0.2s;
    font-weight: inherit;
}

.typezen-typography a:hover {
    color: var(--m-brand) !important;
    border-bottom-color: var(--m-brand) !important;
}

/* Unified Heading Styles (H1-H6 inside content) */
.typezen-typography h1,
.typezen-typography h2,
.typezen-typography h3,
.typezen-typography h4,
.typezen-typography h5,
.typezen-typography h6 {
    font-family: var(--m-font-sans);
    font-size: 20px;
    /* Unified ~1.15x body */
    font-weight: 700;
    margin: 30px 0 20px;
    /* Unified Rhythm */
    line-height: 1.5;
    color: #1a1a1a;
    letter-spacing: 0;
}

/* Image */
/* Image */
/* Image */
.typezen-typography img {
    max-width: 100%;
    height: auto;
    margin: 48px 0;
    /* Standardized to 48px */
    border-radius: 4px;
    display: block;
    /* Prevent inline gaps */
}

/* Blockquote */
/* Blockquote */
/* Blockquote - KaiTi style */
/* Blockquote - KaiTi style */
/* Blockquote - KaiTi style */
.typezen-typography blockquote {
    margin: 48px 0;
    /* Standardized to 48px */
    padding: 16px 24px;
    border-left: 4px solid var(--m-gray-300);
    background: #f9f9f9;
    border-radius: 4px;
    font-family: "KaiTi", "STKaiti", var(--m-font-serif);
    /* Serif for quotes */
    font-size: var(--m-font-size-base);
    line-height: 1.8;
    color: #555;
    position: relative;
    letter-spacing: var(--m-letter-spacing-relaxed);
}

.typezen-typography blockquote::before {
    display: none;
    /* Remove previous pseudo override */
}

/* Code Inline */
.typezen-typography code {
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
    color: #1a1a1a;
}

.typezen-typography pre {
    background: #f8f9fa;
    border: 1px solid var(--m-gray-100);
    padding: 24px;
    border-radius: 8px;
    overflow-x: auto;
    padding: 24px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 16px 0;
    /* Dense */
    font-size: 15px;
    line-height: 1.6;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
    /* Subtle shadow for depth */
}

/* Horizontal Rule */
.typezen-typography hr {
    border: none;
    height: 1px;
    background: var(--m-gray-200);
    margin: 48px 0;
    width: 100%;
}

.typezen-typography pre code {
    background: transparent;
    padding: 0;
    color: inherit;
}

.typezen-typography ul,
.typezen-typography ol {
    margin: 0 0 48px;
    /* Standardized to 48px */
    padding-left: 24px;
}

.typezen-typography li {
    margin-bottom: var(--m-content-spacing-xs);
    /* 8px compact default */
    padding-left: 8px;
}

/* Tables */
.typezen-typography table {
    width: 100%;
    margin: var(--m-content-spacing-lg) 0;
    border-collapse: collapse;
    font-size: 15px;
    line-height: 1.6;
    display: block;
    overflow-x: auto;
    /* Responsive scroll */
    white-space: nowrap;
}

/* On larger screens, allow table to behave normally if possible, but block/overflow is safest for UGC */
@media (min-width: 768px) {
    .typezen-typography table {
        display: table;
        white-space: normal;
    }
}

.typezen-typography th,
.typezen-typography td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--m-gray-200);
}

.typezen-typography th {
    font-weight: 600;
    color: var(--m-black);
    background-color: var(--m-gray-50);
    border-bottom: 2px solid var(--m-gray-200);
}

.typezen-typography tr:hover td {
    background-color: var(--m-gray-50);
}

/* Tags */
/* Tags (In Header) */
.m-meta-tags {
    margin-left: auto;
    /* Push to right */
    display: flex;
    align-items: center;
    /* Ensure vertical center */
    flex-wrap: wrap;
    gap: 16px;
    /* Text tags need more breathing room */
}

@media (max-width: 767px) {
    .m-meta-tags {
        margin-left: 0;
        width: 100%;
        margin-top: 12px;
    }
}

.m-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--m-gray-600);
    font-size: 14px;
    text-decoration: none !important;
    transition: color 0.2s ease;
    font-weight: 400;
    line-height: 1.2;
    /* Match left side */
}

.m-tag::before {
    content: "\f097";
    /* fa-bookmark-o */
    font-family: "FontAwesome";
    font-size: 16px;
    /* Match left side 16px */
    color: var(--m-gray-400);
}



.m-tag:hover {
    color: var(--m-black);
}

.m-tag:hover::before {
    color: var(--m-gray-400);
    /* Keep icon consistent on hover */
}

/* Actions Bar */
.m-article-actions-bar {
    border-top: none;
    border-bottom: none;
    padding: 24px 0;
    margin: 0 0 24px;
}

.m-article-stats {
    display: flex;
    gap: 24px;
}

.m-stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--m-gray-500);
    font-size: 14px;
}

.m-stat-item svg {
    width: 20px;
    height: 20px;
}



/* Comments Section */
/* Comments Section */
.m-comments-section {
    margin: 0;
    padding: 48px 0 0;
    border: none;
    background: transparent;
    border-radius: 0;
}

.m-comments-title {
    font-size: var(--m-font-size-xxl);
    font-weight: 600;
    color: var(--m-black);
    margin: 0 0 24px;
}

.m-comment-post {
    margin-bottom: 40px;
}

.m-comment-form {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.m-comment-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

.m-comment-avatar img,
.m-comment-avatar-img {
    width: 44px;
    height: 44px;
    object-fit: cover;
    border-radius: 50%;
    flex-shrink: 0;
}

.m-comment-box {
    flex: 1;
    /* Remove wrapper styling to focus on the input itself */
    border: none;
    background: transparent;
    padding: 0;
}

.m-comment-box:focus-within {
    box-shadow: none;
    border-color: transparent;
}

/* Input Styling - Minimalist */
.m-form-control {
    width: 100%;
    border: 1px solid var(--m-gray-200);
    background: var(--m-gray-50);
    /* Subtle contrast */
    padding: 16px;
    font-family: inherit;
    font-size: 15px;
    line-height: 1.6;
    resize: none;
    min-height: 120px;
    /* Slightly taller */
    outline: none;
    border-radius: 12px;
    /* Softer corners */
    transition: all 0.2s ease;
    box-shadow: none;
    color: var(--m-black);
}

.m-form-control:focus {
    background: var(--m-white);
    border-color: var(--m-brand);
    /* Brand color focus */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    /* Elevation on focus */
}

.m-comment-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
    padding-top: 0;
    border-top: none;
    /* Cleaner look */
}

.m-btn-cancel {
    background: none;
    border: none;
    color: var(--m-gray-500);
    font-size: 14px;
    cursor: pointer;
    padding: 8px 16px;
    transition: color 0.2s;
}

.m-btn-cancel:hover {
    color: var(--m-black);
}

/* Login Tip */
.m-login-tip {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px;
    background: var(--m-gray-50);
    border-radius: 8px;
    color: var(--m-gray-500);
    font-size: 15px;
}

.m-login-tip i {
    font-size: 24px;
    color: var(--m-gray-400);
}

.m-login-tip .m-link {
    color: var(--m-brand);
    font-weight: 500;
}

.m-login-tip .m-link:hover {
    text-decoration: underline;
}

/* Comment List */
.m-comment-list {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.m-comment-item {
    display: flex;
    gap: 16px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--m-gray-100);
}

.m-comment-item:last-child {
    border-bottom: none;
}

.m-comment-content {
    flex: 1;
    min-width: 0;
}

.m-comment-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.m-comment-author {
    font-size: var(--m-font-size-base);
    font-weight: 600;
    color: var(--m-black);
}

.m-comment-date {
    font-size: var(--m-font-size-xs);
    color: var(--m-gray-400);
}

.m-comment-text {
    font-size: var(--m-font-size-sm);
    line-height: 1.6;
    color: var(--m-gray-700);
    word-wrap: break-word;
}

.m-comment-footer {
    margin-top: 12px;
}

.m-comment-footer .reply {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--m-gray-500);
    cursor: pointer;
    transition: color 0.2s;
}

.m-comment-footer .reply:hover {
    color: var(--m-brand);
}

.m-comment-footer .reply i {
    font-size: 12px;
}

/* Empty State */
.m-comment-empty {
    text-align: center;
    padding: 48px 24px;
    color: var(--m-gray-400);
}

.m-comment-empty i {
    font-size: 48px;
    margin-bottom: 16px;
    display: block;
}

.m-comment-empty p {
    font-size: 15px;
    margin: 0;
}

/* Pagination */
.m-comment-pager {
    margin-top: 24px;
    padding-top: 24px;
    border-top: none;
}




/* Image Captions */
/* Image Captions */
.typezen-typography figcaption {
    font-family: var(--m-font-sans);
    font-size: var(--m-font-size-sm);
    color: var(--m-gray-500);
    text-align: center;
    margin-top: calc(var(--m-image-spacing) * -0.5);
    /* Negative half spacing */
    margin-bottom: var(--m-content-spacing-lg);
    font-style: italic;
}

/* Selection Style */
::selection {
    background: rgba(0, 0, 0, 0.1);
    /* Brand color green with opacity */
    color: inherit;
}

/* ============================================
   Related Articles (List Style)
   ============================================ */
.m-related-section {
    margin-top: 0;
    padding: 48px 0 0;
    background: transparent;
    border: none;
    border-radius: 0;
}

.m-related-header {
    margin-bottom: 24px;
}

.m-related-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    color: var(--m-black);
}

.m-related-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.m-related-item {
    border-bottom: none;
    /* Clean list without separators */
}

.m-related-item:last-child {
    border-bottom: none;
}

.m-related-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 16px 0;
    text-decoration: none;
    transition: all 0.2s ease;
}

.m-related-link:hover {
    background: transparent;
}

.m-related-item-title {
    font-size: 16px;
    /* Slightly larger */
    font-weight: 500;
    color: var(--m-black);
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.2s;
}

.m-related-link:hover .m-related-item-title {
    color: var(--m-brand-hover);
    text-decoration: none;
}

.m-related-item-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    font-size: 13px;
    color: var(--m-gray-500);
    font-family: var(--m-font-sans);
}

.m-related-category {
    padding: 0;
    background: transparent;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    color: var(--m-gray-400);
}

.m-related-date {
    color: var(--m-gray-400);
    font-variant-numeric: tabular-nums;
}

.m-comments-closed {
    text-align: center;
    padding: 32px;
    color: var(--m-gray-400);
    font-size: 14px;
}

/* Responsive - Mobile */
@media (max-width: 768px) {
    .m-related-link {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .m-related-item-title {
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        line-clamp: 2;
        overflow: hidden;
    }




    .m-article-detail {
        padding: 0 16px;
    }

    .m-article-detail-title {
        font-size: 28px;
    }

    .m-article-detail-subtitle {
        font-size: 18px;
    }

    .m-article-body {
        font-size: 16px;
    }

    .m-article-hero {
        margin: 0 -16px 24px;
    }

    .m-article-nav {
        grid-template-columns: 1fr;
        /* Stack vertically */
        gap: 32px;
    }

    .m-nav-prev,
    .m-nav-next {
        padding: 0;
        /* Reset padding */
    }

    .m-nav-prev::before {
        left: 16px;
    }

    .m-nav-next {
        text-align: left;
        align-items: flex-start;
        padding: 16px 44px 16px 20px;
    }

    .m-nav-next::after {
        right: 16px;
    }
}

/* Author Card (Bottom) */
.m-author-card {
    background: transparent;
    padding: 0;
    margin: 48px 0;
    /* Standard Section Break */
}

.m-author-header {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

.m-author-card-avatar {
    flex-shrink: 0;
}

.m-author-card-avatar img {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
}

.m-author-card-info {
    flex: 1;
}

.m-author-card-top {
    display: flex;
    justify-content: flex-start;
    /* Left align */
    align-items: baseline;
    /* Align text baseline */
    gap: 8px;
    /* Space between 'Author:' and Name */
    margin-bottom: 8px;
}

.m-author-card-name {
    font-size: 20px;
    font-weight: 700;
    color: var(--m-black);
    text-decoration: none !important;
    line-height: 1.2;
}

.m-author-card-bio {
    color: var(--m-gray-600);
    font-size: 15px;
    line-height: 1.5;
    margin-bottom: 0;
}

.m-author-card-stats {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: var(--m-gray-500);
    padding: 0;
    margin: 6px 0 12px;
    /* Visual breathing room */
    border: none;
    line-height: 1;
}

.m-author-card-stats span {
    display: flex;
    align-items: center;
    gap: 6px;
}



/* Author Card Responsive Fix */
@media (max-width: 767px) {
    .m-author-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .m-author-card-info {
        width: 100%;
    }

    .m-author-card-top {
        justify-content: center;
        flex-direction: column;
        gap: 8px;
    }

    .m-author-card-stats {
        justify-content: center;
    }
}

/* Back Link in Navbar (Layout Alignment) - App Style (Solid) */
.m-back-link.in-navbar {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    /* Align with content width (680px) */
    left: calc(50% - 340px);
    margin: 0;
    z-index: 100;

    /* Solid Circle Button */
    margin-left: -4px;
    /* Optical alignment for the circle edge */
    width: 36px;
    height: 36px;
    padding: 0;
    background: var(--m-gray-100);
    /* Visible solid background */
    border: none;
    border-radius: 50%;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s ease;
}

.m-back-link.in-navbar:hover {
    background: var(--m-gray-200);
    /* Darker on hover */
    color: var(--m-black);
}

.m-back-link.in-navbar i {
    font-size: 15px;
    background: transparent;
    color: var(--m-gray-600);
    display: flex;
    align-items: center;
    justify-content: center;
    width: auto;
    height: auto;
    transition: color 0.2s ease;
}

.m-back-link.in-navbar:hover i {
    color: var(--m-black);
    transform: none;
}

/* Mobile override */
@media (max-width: 1024px) {
    .m-back-link.in-navbar {
        position: static;
        transform: none;
        margin: 0 0 0 8px;
        left: auto;
        padding: 0;
        width: 32px;
        /* Icon only on mobile? or minimal */
        justify-content: flex-start;
    }

    .m-back-link.in-navbar span {
        display: none;
        /* Optional: hide text on mobile */
    }
}

/* Scroll Fade Effect */
.m-back-link.in-navbar {
    transition: opacity 0.3s ease, background 0.2s ease, transform 0.3s ease;
    opacity: 1;
}

.m-back-link.in-navbar.fade-out {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-50%) scale(0.9);
    /* Slight shrink effect */
}

/* Intelligent Reveal: Show when hovering the navbar */
.m-topbar:hover .m-back-link.in-navbar.fade-out {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(-50%) scale(1);
}

/* ============================================
   Article Detail Page (Show News)
   ============================================ */
.m-article-header {
    margin-bottom: 0;
}


/* Deprecated: .m-article-title-large replaced by .m-article-detail-title */

.m-article-meta-large {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
    font-size: var(--m-font-size-sm);
    color: #888;
    margin-bottom: 32px;
    /* Standardized to 32px */
    font-family: var(--m-font-sans);
}



.m-article-category a {
    color: #666;
    text-decoration: none;
    transition: color 0.2s;
}

.m-article-category a:hover {
    color: var(--m-black);
}

.m-article-featured-image {
    margin: 0 0 40px 0;
    border-radius: 4px;
    overflow: hidden;
}

.m-article-featured-image img {
    width: 100%;
    height: auto;
    display: block;
}

/* Duplicate Typography Block Removed */

/* Footer & Comments */
.m-article-footer-actions {
    margin-top: 64px;
    padding-top: 32px;
    border-top: 1px solid var(--m-gray-100);
}

.m-comments-section {
    margin-top: 48px;
}

/* 
   New Detail Layout System (Full Width Support)
   Overrides defaults to allow "White Content" + "Gray Footer" zones
*/

/* 1. Reset Global Layout Constraints for Detail Page */
body.m-detail-page .m-main-wrapper {
    max-width: none !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

body.m-detail-page .m-main {
    max-width: none !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
}

body.m-detail-page .m-content {
    width: 100%;
}

/* 2. White Zone Wrapper */
.m-detail-content-wrap {
    background: var(--m-white);
    width: 100%;
    padding: 92px 0 48px;
    /* 92px top = Optically aligns Title Cap-Height with Sidebar (97px - 5px half-leading) */
}

/* 3. Gray Zone Wrapper */
.m-detail-footer-wrap {
    background: var(--m-gray-50);
    width: 100%;
    padding: 48px 0 0;
    /* Removed bottom padding - footer has its own */
}

/* 4. Reading Container (Central Column) */
.m-detail-container {
    max-width: 728px;
    /* Classic reading width */
    margin: 0 auto;
    padding: 0 24px;
    position: relative;
}

/* ============================================
   Site Footer (Global)
   ============================================ */
.m-site-footer {
    background: var(--m-gray-50);
    border-top: 1px solid var(--m-gray-100);
    padding: 24px 0;
    margin-top: 0;
    color: #6b6b6b !important;
}

.m-site-footer * {
    color: #6b6b6b !important;
}

.m-site-footer a:hover,
.m-site-footer a:hover * {
    color: var(--m-black) !important;
}

.m-footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    text-align: center;
}

.m-footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    margin-bottom: 0;
    /* No extra margin */
}

.m-footer-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.m-footer-logo {
    font-size: 16px;
    font-weight: 600;
}

.m-footer-slogan {
    font-size: 13px;
}

.m-footer-links {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    justify-content: center;
}

.m-footer-link {
    font-size: 14px;
    text-decoration: none;
    transition: color 0.2s;
}

.m-footer-copyright {
    font-size: 13px;
    line-height: 1.6;
}

/* Utilities */
.text-danger {
    color: #ef4444 !important;
}

.text-vip {
    color: #d4af37 !important;
}

.m-footer-container p,
.m-footer-container div,
.m-footer-container span {
    margin: 0 !important;
    padding: 0 !important;
    color: #6b6b6b !important;
}

.m-footer-links {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
}

.m-footer-links>* {
    margin-bottom: 0 !important;
}

/* ============================================
   Mobile Navigation
   ============================================ */
.m-mobile-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 56px;
    background: #ffffff;
    border-top: 1px solid var(--m-border-color-default);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: var(--m-z-mobile-nav);
    padding-bottom: env(safe-area-inset-bottom);
}

.m-mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: var(--m-gray-500);
    text-decoration: none;
    font-size: 10px;
    transition: all 0.2s;
}

.m-mobile-nav-item:hover,
.m-mobile-nav-item.active {
    color: var(--m-black);
}

.m-mobile-nav-icon {
    width: 24px;
    height: 24px;
    margin-bottom: 2px;
}

/* Hide on Desktop */
@media (min-width: 768px) {
    .m-mobile-nav {
        display: none;
    }
}

/* ============================================
   Accessibility & Keyboard Navigation
   ============================================ */

/* High Visibility Focus Indicators (WCAG 2.1 AA) */
.m-sidebar-toggle:focus-visible,
.m-btn-write:focus-visible,
.m-user-toggle:focus-visible,
.m-btn-login:focus-visible,
.m-btn-back:focus-visible,
.m-btn-text:focus-visible,
.m-btn-primary:focus-visible {
    outline: 2px solid var(--m-black);
    outline-offset: 2px;
    border-radius: 4px;
    /* Slight rounding for focus ring */
    z-index: 10;
}

.m-user-toggle:focus-visible {
    border-radius: 50%;
    /* Match avatar shape */
}

/* Missing Back Button Styles */
.m-btn-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: var(--m-gray-600);
    transition: all 0.2s;
    /* Ensure it has layout for focus ring */
}

.m-btn-back:hover {
    background: var(--m-gray-100);
    color: var(--m-black);
}


/* End of TypeZen Core Styles */

/* ==============================================
   Dropdown Menu (TypeZen Override)
   ============================================== */
body .dropdown-menu.m-dropdown-menu {
    border: 1px solid var(--m-gray-100);
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08) !important;
    padding: 8px;
    margin-top: 14px;
    min-width: 220px;
    background-color: var(--m-white);
    left: auto;
    right: 0;
}

/* Arrow/Caret (Optional: Remove if not needed, or Add) */
body .dropdown-menu.m-dropdown-menu::before {
    display: none;
}

/* List Items */
body .m-dropdown-menu>li>a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    color: var(--m-gray-600);
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s ease;
    margin: 2px 0;
    line-height: 1.5;
    background: transparent;
}

/* Hover State */
body .m-dropdown-menu>li>a:hover,
body .m-dropdown-menu>li>a:focus {
    background-color: var(--m-gray-50);
    color: var(--m-black);
    text-decoration: none;
}

/* Icon Styling */
body .m-dropdown-menu>li>a i {
    width: 20px;
    text-align: center;
    color: var(--m-gray-400);
    font-size: 15px;
    transition: inherit;
}

body .m-dropdown-menu>li>a:hover i {
    color: var(--m-black);
}

/* Divider */
body .dropdown-menu.m-dropdown-menu .divider {
    background-color: var(--m-gray-100);
    margin: 8px 0;
}

/* Special Text Colors */
body .m-dropdown-menu .text-vip {
    color: #d97706 !important;
}

body .m-dropdown-menu .text-danger {
    color: #ef4444 !important;
}

body .m-dropdown-menu>li>a.text-danger:hover {
    background-color: #fef2f2;
    color: #dc2626 !important;
}

/* Remove default Bootstrap arrow if persisting */
body .dropdown-menu.m-dropdown-menu:after,
body .dropdown-menu.m-dropdown-menu:before {
    display: none;
}