/* ==== tokens.css ==== */

/* 
   1. Theme tokens
    */
:root {
    /* Spacing scale (4px base) */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;

    --max-width: 1400px;
    --page-padding: var(--space-5);

    --text-xs: 0.75rem;
    --text-sm: 0.8125rem;
    --text-base: 0.9375rem;
    --text-md: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.375rem;
    --text-2xl: 1.75rem;
    --text-3xl: 2.25rem;

    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-full: 999px;

    --brand-50: #ecfdf5;
    --brand-100: #d1fae5;
    --brand-200: #a7f3d0;
    --brand-300: #6ee7b7;
    --brand-400: #34d399;
    --brand-500: #10b981;
    --brand-600: #059669;
    --brand-700: #047857;
    --brand-800: #065f46;
    --brand-900: #064e3b;

    --max-w-content: 880px;
    --max-w-wide: 1100px;
    --nav-height: 60px;

    --ease: cubic-bezier(0.16, 1, 0.3, 1);
    --duration: 200ms;
    --duration-slow: 350ms;

    --focus-ring: 0 0 0 3px var(--brand-200);

    --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
    --font-serif: "Instrument Serif", Georgia, "Times New Roman", serif;
}

/* Light theme (default) */
[data-theme="light"] {
    --bg: #ffffff;
    --bg-subtle: #fafafa;
    --bg-muted: #f5f5f5;
    --bg-elevated: #ffffff;
    --bg-overlay: rgba(0, 0, 0, 0.4);
    --bg-skeleton: #f0f0f0;
    --bg-skeleton-shimmer: #e8e8e8;

    --text: #0a0a0a;
    --text-secondary: #525252;
    --text-tertiary: #737373;
    --text-disabled: #a3a3a3;
    --text-on-brand: #ffffff;

    --border: #e5e5e5;
    --border-strong: #d4d4d4;
    --border-focus: var(--brand-600);

    --brand: var(--brand-600);
    --brand-hover: var(--brand-700);
    --brand-subtle: var(--brand-50);
    --brand-subtle-hover: var(--brand-100);
    --brand-text: var(--brand-700);

    --success: #16a34a;
    --success-bg: #f0fdf4;
    --warning: #d97706;
    --warning-bg: #fffbeb;
    --danger: #dc2626;
    --danger-bg: #fef2f2;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06), 0 2px 4px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.10), 0 4px 8px rgba(0, 0, 0, 0.04);

    --focus-ring: 0 0 0 3px rgba(5, 150, 105, 0.18);
}

[data-theme="dark"] {
    --bg: #0a0a0a;
    --bg-subtle: #111111;
    --bg-muted: #171717;
    --bg-elevated: #161616;
    --bg-overlay: rgba(0, 0, 0, 0.65);
    --bg-skeleton: #1f1f1f;
    --bg-skeleton-shimmer: #2a2a2a;

    --text: #f5f5f5;
    --text-secondary: #a3a3a3;
    --text-tertiary: #737373;
    --text-disabled: #525252;
    --text-on-brand: #ffffff;

    --border: #262626;
    --border-strong: #383838;
    --border-focus: var(--brand-400);

    --brand: var(--brand-500);
    --brand-hover: var(--brand-400);
    --brand-subtle: rgba(16, 185, 129, 0.12);
    --brand-subtle-hover: rgba(16, 185, 129, 0.18);
    --brand-text: var(--brand-300);

    --success: #4ade80;
    --success-bg: rgba(74, 222, 128, 0.10);
    --warning: #fbbf24;
    --warning-bg: rgba(251, 191, 36, 0.10);
    --danger: #f87171;
    --danger-bg: rgba(248, 113, 113, 0.10);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.6);

    --focus-ring: 0 0 0 3px rgba(52, 211, 153, 0.25);
}


/* ==== base.css ==== */
/*  2. Reset & base   */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    text-transform: lowercase;
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    min-height: 100vh;
    min-height: 100dvh;
    padding-bottom: env(safe-area-inset-bottom);
    transition: background-color 200ms ease, color 200ms ease;
}

img, svg { display: block; max-width: 100%; }
button { font: inherit; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
input, textarea, code, pre,
.preserve-case, [data-preserve-case],
.user-avatar, .brand-mark + * em {
    text-transform: none;
}

a {
    color: var(--brand-text);
    text-decoration: none;
    transition: color var(--duration) var(--ease);
}
a:hover { color: var(--brand-hover); }

* {
    -webkit-tap-highlight-color: transparent;
}

.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--brand);
    color: var(--text-on-brand);
    padding: var(--space-2) var(--space-4);
    border-radius: 0 0 var(--radius) 0;
    font-size: var(--text-sm);
    font-weight: 500;
    z-index: 1000;
    transition: top 200ms;
}
.skip-link:focus {
    top: 0;
    color: var(--text-on-brand);
}

:focus { outline: none; }
:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
    border-radius: var(--radius-sm);
}
/* ==== layout.css ==== */
/*  5. Main content */
.main-content {
    max-width: var(--max-width);
    padding-left: var(--page-padding);
    padding-right: var(--page-padding);
    margin: 0 auto;
    /*padding-bottom: var(--space-6) var(--space-4) var(--space-16);*/
    min-height: calc(100vh - var(--nav-height) - 80px);
}
.main-content:focus { outline: none; }

.page-header {
    margin-bottom: var(--space-8);
}

.page-eyebrow {
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--brand-text);
    font-weight: 600;
    margin-bottom: var(--space-2);
}

.page-title {
    font-family: var(--font-serif);
    font-size: var(--text-3xl);
    font-weight: 400;
    letter-spacing: -0.02em;
    line-height: 1.15;
    color: var(--text);
    margin-bottom: var(--space-2);
}

.page-subtitle {
    font-size: var(--text-md);
    color: var(--text-secondary);
    line-height: 1.55;
    max-width: 60ch;
}


/* 9. Two-column grid for home page   */
.two-col-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}
@media (min-width: 720px) {
    padding: 2px var(--space-2);
    border-radius: var(--radius-full);
    font-weight: 500;
}

/* 11. Section heading  */
.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: var(--space-3);
}

.section-title {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.01em;
}

.section-link {
    font-size: var(--text-sm);
    color: var(--brand-text);
    font-weight: 500;
}

/* ==== components/nav.css ==== */
/* 
   3. Top navigation
*/

.top-nav {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--border);
    padding-top: env(safe-area-inset-top);
}

[data-theme="dark"] .top-nav {
    background: rgba(10, 10, 10, 0.80);
}

.nav-inner {
    max-width: var(--max-width);
    padding-left: var(--page-padding);
    padding-right: var(--page-padding);
    margin: 0 auto;
    height: var(--nav-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--text);
    font-weight: 600;
    font-size: var(--text-md);
    letter-spacing: -0.01em;
}
.nav-brand:hover { color: var(--text); }

.brand-mark {
    color: var(--brand);
    flex-shrink: 0;
}

.brand-text {
    white-space: nowrap;
}
.brand-text em {
    font-family: var(--font-serif);
    font-style: italic;
    font-weight: 400;
    font-size: 1.15em;
    letter-spacing: 0;
    margin-left: 1px;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.nav-link {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    font-weight: 500;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius);
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    transition: all var(--duration) var(--ease);
}
.nav-link:hover {
    color: var(--text);
    background: var(--bg-muted);
}

/* Hamburger button, mobile only */
.nav-hamburger {
    display: none;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    align-items: center;
    justify-content: center;
    transition: background var(--duration) var(--ease);
}
.nav-hamburger:hover { background: var(--bg-muted); }

.nav-user-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-full);
    background: var(--bg-muted);
    border: 1px solid var(--border);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text);
    transition: all var(--duration) var(--ease);
    min-height: 36px;
}
.nav-user-chip:hover {
    background: var(--bg-subtle);
    border-color: var(--border-strong);
    color: var(--text);
}

.user-avatar {
    width: 22px;
    height: 22px;
    border-radius: var(--radius-full);
    background: var(--brand);
    color: var(--text-on-brand);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    flex-shrink: 0;
}

.theme-toggle {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all var(--duration) var(--ease);
    flex-shrink: 0;
}
.theme-toggle:hover {
    color: var(--text);
    background: var(--bg-muted);
    border-color: var(--border-strong);
}
.theme-toggle svg { width: 18px; height: 18px; }
[data-theme="light"] .theme-toggle .icon-moon { display: block; }
[data-theme="light"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/*  4. Mobile menu */
.mobile-menu {
    position: fixed;
    inset: 0;
    z-index: 100;
    visibility: hidden;
    pointer-events: none;
}
.mobile-menu.open {
    visibility: visible;
    pointer-events: auto;
}

.mobile-menu-backdrop {
    position: absolute;
    inset: 0;
    background: var(--bg-overlay);
    opacity: 0;
    transition: opacity var(--duration) var(--ease);
}
.mobile-menu.open .mobile-menu-backdrop {
    opacity: 1;
}

.mobile-menu-panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(320px, 85vw);
    background: var(--bg);
    border-left: 1px solid var(--border);
    transform: translateX(100%);
    transition: transform var(--duration-slow) var(--ease);
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    display: flex;
    flex-direction: column;
}
.mobile-menu.open .mobile-menu-panel {
    transform: translateX(0);
}

.mobile-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border);
    min-height: var(--nav-height);
}

.mobile-menu-title {
    font-size: var(--text-md);
    font-weight: 600;
    color: var(--text);
}

.mobile-menu-body {
    padding: var(--space-3);
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    overflow-y: auto;
}

.mobile-menu-body .nav-link,
.mobile-menu-body .btn {
    width: 100%;
    justify-content: flex-start;
    min-height: 48px;
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-md);
}

.mobile-menu-body .nav-divider {
    height: 1px;
    background: var(--border);
    margin: var(--space-2) 0;
}

.mobile-menu-body .menu-section-label {
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-tertiary);
    padding: var(--space-3) var(--space-4) var(--space-1);
    font-weight: 600;
}

.mobile-menu-body .mobile-link {
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-base);
    border-radius: var(--radius);
}
.mobile-menu-body .mobile-link:hover {
    background: var(--bg-muted);
}

/* primary nav links */
.nav-primary {
    display: flex;
    align-items: center;
    gap: var(--space-5);
    margin-left: var(--space-6);
}
.nav-primary .nav-link {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    padding: var(--space-2) 0;
    transition: color var(--duration) var(--ease);
}
.nav-primary .nav-link:hover {
    color: var(--text);
}

/* ── Search bar in nav ── */
.nav-search {
    flex: 1;
    max-width: 360px;
    margin: 0 var(--space-5);
    position: relative;
    display: flex;
    align-items: center;
}
.nav-search-icon {
    position: absolute;
    left: var(--space-3);
    color: var(--text-muted);
    pointer-events: none;
}
.nav-search-input {
    width: 100%;
    padding: var(--space-2) var(--space-3) var(--space-2) var(--space-8);
    background: var(--bg-muted);
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: var(--text-sm);
    color: var(--text);
    transition: border-color var(--duration) var(--ease), background var(--duration) var(--ease);
}
.nav-search-input:focus {
    outline: none;
    border-color: var(--brand);
    background: var(--bg);
}
.nav-search-input::placeholder {
    color: var(--text-muted);
}

/* ── Hide primary nav + search on mobile ── */
@media (max-width: 900px) {
    .nav-primary,
    .nav-search {
        display: none;
    }
}
/* ==== components/buttons.css ==== */
/*  6. Buttons  */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 0 var(--space-4);
    min-height: 40px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: 500;
    text-decoration: none;
    transition: all var(--duration) var(--ease);
    white-space: nowrap;
    user-select: none;
    position: relative;
}
.btn:hover {
    background: var(--bg-muted);
    border-color: var(--border-strong);
    color: var(--text);
}
.btn:active {
    transform: translateY(0.5px);
}
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: var(--brand);
    color: var(--text-on-brand);
    border-color: var(--brand);
    font-weight: 500;
}
.btn-primary:hover {
    background: var(--brand-hover);
    border-color: var(--brand-hover);
    color: var(--text-on-brand);
}

.btn-ghost {
    border-color: transparent;
    background: transparent;
}
.btn-ghost:hover {
    background: var(--bg-muted);
    border-color: transparent;
}

.btn-danger {
    color: var(--danger);
    border-color: var(--border);
}
.btn-danger:hover {
    background: var(--danger-bg);
    border-color: var(--danger);
    color: var(--danger);
}

.btn-sm {
    min-height: 32px;
    padding: 0 var(--space-3);
    font-size: var(--text-xs);
}

.btn-lg {
    min-height: 48px;
    padding: 0 var(--space-6);
    font-size: var(--text-md);
}

.btn-block { width: 100%; }

.icon-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all var(--duration) var(--ease);
}

/* ==== components/cards.css ==== */
/*  7. Cards */
.card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    transition: border-color var(--duration) var(--ease);
}

.card-hover:hover {
    border-color: var(--border-strong);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.card-title {
    font-size: var(--text-md);
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.01em;
}

.card-subtitle {
    font-size: var(--text-sm);
    color: var(--text-tertiary);
    margin-top: var(--space-1);
}

/* ==== components/jumbotron.css ==== */
/* Jumbotron with stats */
.jumbotron {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: var(--space-8) var(--page-padding);
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--space-8);
    align-items: start;
}

.jumbotron-content .jumbotron-eyebrow {
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--brand-text);
    margin-bottom: var(--space-3);
}

.jumbotron-title {
    font-family: var(--font-serif);
    font-size: clamp(2rem, 5vw, 3.5rem);
    line-height: 1.05;
    font-weight: 400;
    color: var(--text);
    margin: 0 0 var(--space-4) 0;
}

.jumbotron-subtitle {
    font-size: var(--text-base);
    line-height: 1.6;
    color: var(--text-muted);
    max-width: 32em;
    margin: 0 0 var(--space-5) 0;
}

.jumbotron-actions {
    display: flex;
    gap: var(--space-3);
    flex-wrap: wrap;
}

.stats-cards {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.stat-card {
    padding: var(--space-4) var(--space-5);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color var(--duration) var(--ease);
}
.stat-card:hover { border-color: var(--brand); }

.stat-value {
    font-family: var(--font-serif);
    font-size: var(--text-3xl);
    font-weight: 400;
    color: var(--text);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}
.stat-value.loading { opacity: 0.4; }

.stat-label {
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-top: var(--space-2);
}

@media (max-width: 720px) {
    .jumbotron {
        grid-template-columns: 1fr;
        gap: var(--space-5);
        padding: var(--space-5);
    }
    .stats-cards {
        flex-direction: row;
    }
    .stat-card {
        flex: 1;
        text-align: center;
    }
}
/* ==== components/tabs.css ==== */
.tabs-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: var(--space-8) var(--page-padding);
}

.tabs-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--space-5);
    flex-wrap: wrap;
    gap: var(--space-3);
}

.tabs-title {
    font-family: var(--font-serif);
    font-size: var(--text-2xl);
    font-weight: 400;
    color: var(--text);
    margin: 0;
}

.tab-buttons {
    display: flex;
    gap: var(--space-1);
}

.tab-btn {
    background: transparent;
    border: none;
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color var(--duration) var(--ease), border-color var(--duration) var(--ease);
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active {
    color: var(--brand-text);
    border-bottom-color: var(--brand);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }
/* ==== components/list.css ==== */
/*    10. List items */
.list {
    display: flex;
    flex-direction: column;
}

.list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-2);
    margin: 0 calc(var(--space-2) * -1);
    border-radius: var(--radius);
    color: var(--text);
    transition: background var(--duration) var(--ease);
    min-height: 48px;
}
.list-item + .list-item {
    border-top: 1px solid var(--border);
    border-radius: 0;
}
.list-item:first-child {
    border-top-left-radius: var(--radius);
    border-top-right-radius: var(--radius);
}
.list-item:last-child {
    border-bottom-left-radius: var(--radius);
    border-bottom-right-radius: var(--radius);
}
a.list-item:hover {
    background: var(--bg-muted);
    color: var(--text);
}

.list-item-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.list-item-title {
    font-size: var(--text-base);
    color: var(--text);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.list-item-meta {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
}

.list-item-trailing {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    flex-shrink: 0;
    background: var(--bg-muted);
    padding: 2px var(--space-2);
    border-radius: var(--radius-full);
    font-weight: 500;
}
/* ==== components/entry.css ==== */
/*  12. Topic page */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    color: var(--text-secondary);
    font-size: var(--text-sm);
    font-weight: 500;
    margin-bottom: var(--space-4);
    padding: var(--space-2) 0;
}
.back-link:hover { color: var(--text); }

.topic-meta-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
    margin-top: var(--space-3);
    color: var(--text-tertiary);
    font-size: var(--text-sm);
}

.entries-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    margin-top: var(--space-6);
}

/* Entry card */
.entry {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    transition: border-color var(--duration) var(--ease);
}
.entry:hover {
    border-color: var(--border-strong);
}

.entry-body {
    font-size: var(--text-md);
    line-height: 1.7;
    color: var(--text);
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.entry-footer {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

.entry-author {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--text);
    font-weight: 500;
    font-size: var(--text-sm);
}
.entry-author:hover {
    color: var(--brand-text);
}

.entry-meta {
    color: var(--text-tertiary);
    font-size: var(--text-xs);
}

.entry-actions {
    margin-left: auto;
    display: flex;
    gap: var(--space-1);
    align-items: center;
}

/* Like button */
.like-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: var(--text-xs);
    font-weight: 500;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-full);
    min-height: 32px;
    transition: all var(--duration) var(--ease);
}
.like-btn:hover {
    color: var(--danger);
    border-color: var(--danger);
    background: var(--danger-bg);
}
.like-btn.liked {
    color: var(--danger);
    border-color: var(--danger);
    background: var(--danger-bg);
}
.like-btn svg {
    width: 14px;
    height: 14px;
}

.action-icon-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-tertiary);
    width: 32px;
    height: 32px;
    border-radius: var(--radius);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all var(--duration) var(--ease);
}
.action-icon-btn:hover {
    color: var(--text);
    background: var(--bg-muted);
}
.action-icon-btn svg { width: 16px; height: 16px; }
.action-icon-btn.danger:hover { color: var(--danger); }

/*    14. Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px var(--space-2);
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1.4;
    border: 1px solid transparent;
}
.badge-rookie {
    background: rgba(124, 58, 237, 0.1);
    color: #7c3aed;
    border-color: rgba(124, 58, 237, 0.3);
}
[data-theme="dark"] .badge-rookie { color: #a78bfa; }

.badge-writer {
    background: var(--brand-subtle);
    color: var(--brand-text);
    border-color: var(--brand);
}
.badge-moderator {
    background: rgba(20, 184, 166, 0.1);
    color: #0d9488;
    border-color: rgba(20, 184, 166, 0.3);
}
[data-theme="dark"] .badge-moderator { color: #5eead4; }

.badge-admin {
    background: var(--danger-bg);
    color: var(--danger);
    border-color: var(--danger);
}
.badge-pending {
    background: var(--warning-bg);
    color: var(--warning);
    border-color: var(--warning);
}
.badge-approved {
    background: var(--success-bg);
    color: var(--success);
    border-color: var(--success);
}

/*    17. Empty state */
.empty {
    text-align: center;
    padding: var(--space-10) var(--space-4);
    color: var(--text-tertiary);
}
.empty-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto var(--space-4);
    color: var(--text-tertiary);
    opacity: 0.6;
}
.empty-title {
    font-size: var(--text-md);
    color: var(--text);
    font-weight: 500;
    margin-bottom: var(--space-2);
}
.empty-text {
    font-size: var(--text-sm);
    color: var(--text-tertiary);
}
/* ==== components/forms.css ==== */
/*    13. Forms */
.form {
    max-width: 560px;
    margin: 0 auto;
}

.field {
    margin-bottom: var(--space-5);
}

.field-label {
    display: block;
    font-size: var(--text-sm);
    color: var(--text);
    font-weight: 500;
    margin-bottom: var(--space-2);
}

.field-hint {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    margin-top: var(--space-2);
    line-height: 1.5;
}

.field-error {
    font-size: var(--text-sm);
    color: var(--danger);
    margin-top: var(--space-2);
    min-height: 1.2em;
}

.input,
.textarea {
    display: block;
    width: 100%;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-3) var(--space-4);
    color: var(--text);
    font-size: var(--text-md);
    font-family: var(--font-sans);
    line-height: 1.5;
    transition: all var(--duration) var(--ease);
    -webkit-appearance: none;
    appearance: none;
    min-height: 44px;
}
.input:focus,
.textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: var(--focus-ring);
}
.input::placeholder,
.textarea::placeholder {
    color: var(--text-tertiary);
}

.textarea {
    resize: vertical;
    min-height: 140px;
    line-height: 1.65;
    font-family: var(--font-sans);
}

.char-counter {
    text-align: right;
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    margin-top: var(--space-2);
}

.form-actions {
    display: flex;
    gap: var(--space-3);
    margin-top: var(--space-6);
    flex-wrap: wrap;
}
.form-actions .btn {
    min-width: 120px;
}
/* ==== components/profile.css ==== */
/* 15. Profile page */
.profile-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
    margin-bottom: var(--space-6);
}
@media (min-width: 560px) {
    .profile-stats {
        grid-template-columns: repeat(4, 1fr);
    }
}

.stat-tile {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
}
.stat-tile-label {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    margin-bottom: var(--space-1);
}
.stat-tile-value {
    font-family: var(--font-serif);
    font-size: var(--text-2xl);
    color: var(--text);
    line-height: 1.1;
}

.profile-section {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    margin-bottom: var(--space-4);
}

.profile-section-title {
    font-size: var(--text-md);
    font-weight: 600;
    color: var(--text);
    margin-bottom: var(--space-4);
}

.profile-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--border);
    font-size: var(--text-sm);
    gap: var(--space-3);
}
.profile-row:last-child { border-bottom: none; }
.profile-row-label {
    color: var(--text-secondary);
    font-weight: 500;
}
.profile-row-value {
    color: var(--text);
}

/* Theme picker (in profile) */
.theme-picker {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-2);
    margin-top: var(--space-2);
}
.theme-option {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-3);
    cursor: pointer;
    text-align: center;
    transition: all var(--duration) var(--ease);
    font-size: var(--text-sm);
    color: var(--text);
    font-weight: 500;
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
}
.theme-option:hover {
    border-color: var(--border-strong);
}
.theme-option.active {
    border-color: var(--brand);
    background: var(--brand-subtle);
    color: var(--brand-text);
}
.theme-option svg { width: 16px; height: 16px; }
/* ==== components/moderation.css ==== */
/* 16. Moderation tabs */
.tabs {
    display: flex;
    gap: var(--space-1);
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--space-5);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-size: var(--text-sm);
    font-weight: 500;
    padding: var(--space-3) var(--space-4);
    margin-bottom: -1px;
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--duration) var(--ease);
    min-height: 44px;
}
.tab:hover { color: var(--text); }
.tab.active {
    color: var(--brand-text);
    border-bottom-color: var(--brand);
}

.mod-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    margin-bottom: var(--space-3);
}
.mod-card-actions {
    display: flex;
    gap: var(--space-2);
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}
/* ==== components/skeleton.css ==== */
/*    18. Skeleton loaders */

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

.skeleton {
    background: linear-gradient(
            90deg,
            var(--bg-skeleton) 0%,
            var(--bg-skeleton-shimmer) 50%,
            var(--bg-skeleton) 100%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.6s ease-in-out infinite;
    border-radius: var(--radius);
}
.skeleton-title { height: 32px; width: 60%; margin-bottom: var(--space-4); }
.skeleton-line { height: 16px; margin-bottom: var(--space-2); }
.skeleton-line.short { width: 70%; }
.skeleton-card {
    height: 120px;
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-3);
}

.page-skeleton {
    padding: var(--space-4) 0;
}

/* ==== components/modal.css ==== */
/* 
   19. Modal dialog
    */
.modal-root {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: none;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
}
.modal-root.open {
    display: flex;
}

@media (min-width: 560px) {
    .modal-root {
        align-items: center;
        padding: var(--space-4);
    }
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: var(--bg-overlay);
    animation: fadeIn 200ms var(--ease);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

@keyframes scaleIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal {
    position: relative;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    width: 100%;
    max-width: 480px;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    animation: slideUp var(--duration-slow) var(--ease);
    box-shadow: var(--shadow-lg);
    padding-bottom: env(safe-area-inset-bottom);
}

@media (min-width: 560px) {
    .modal {
        border-radius: var(--radius-xl);
        animation: scaleIn var(--duration) var(--ease);
        max-height: 85vh;
    }
}

.modal-header {
    padding: var(--space-5) var(--space-5) var(--space-3);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
}
.modal-title {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text);
}
.modal-body {
    padding: var(--space-5);
    overflow-y: auto;
    flex: 1;
}
.modal-footer {
    padding: var(--space-4) var(--space-5);
    border-top: 1px solid var(--border);
    display: flex;
    gap: var(--space-3);
    justify-content: flex-end;
    flex-wrap: wrap;
}
.modal-footer .btn { min-width: 100px; }
/* ==== components/toast.css ==== */
/* 
   20. Toast notifications
    */
.toast-root {
    position: fixed;
    top: calc(var(--nav-height) + var(--space-4) + env(safe-area-inset-top));
    left: 50%;
    transform: translateX(-50%);
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    pointer-events: none;
    width: calc(100% - var(--space-8));
    max-width: 400px;
}

.toast {
    background: var(--bg-elevated);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    padding: var(--space-3) var(--space-4);
    box-shadow: var(--shadow-md);
    font-size: var(--text-sm);
    color: var(--text);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    pointer-events: auto;
    animation: toastIn 250ms var(--ease);
    min-height: 48px;
}
.toast.toast-success {
    border-left: 3px solid var(--success);
}
.toast.toast-error {
    border-left: 3px solid var(--danger);
}
.toast.toast-out {
    animation: toastOut 200ms var(--ease) forwards;
}

@keyframes toastIn {
    from { transform: translateY(-12px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
@keyframes toastOut {
    from { transform: translateY(0); opacity: 1; }
    to { transform: translateY(-12px); opacity: 0; }
}
/* ==== components/footer.css ==== */
/*
    Footer
*/
.site-footer {
    margin-top: var(--space-10);
    padding: var(--space-8) 0 var(--space-5);
    background: var(--bg-muted);
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: var(--text-sm);
}

.footer-inner {
    max-width: var(--max-width);
    padding-left: var(--page-padding);
    padding-right: var(--page-padding);
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: var(--space-8);
    padding-bottom: var(--space-6);
    border-bottom: 1px solid var(--border);
}

.footer-brand-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--text);
    text-decoration: none;
    font-family: var(--font-serif);
    font-size: var(--text-lg);
}
.footer-brand-link em {
    font-style: italic;
    color: var(--brand-text);
}

.footer-tagline {
    margin-top: var(--space-3);
    line-height: 1.5;
    color: var(--text-muted);
}

.footer-cols {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-5);
}

.footer-col-title {
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text);
    margin: 0 0 var(--space-3) 0;
}

.footer-col ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.footer-col a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--duration) var(--ease);
}
.footer-col a:hover {
    color: var(--brand-text);
}

.footer-bottom {
    max-width: var(--max-width);
    padding-left: var(--page-padding);
    padding-right: var(--page-padding);
    margin: 0 auto;
    padding-top: var(--space-5);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: var(--text-xs);
    color: var(--text-muted);
}

@media (max-width: 720px) {
    .footer-inner {
        grid-template-columns: 1fr;
        gap: var(--space-6);
    }
    .footer-cols {
        grid-template-columns: 1fr 1fr;
    }
    .footer-bottom {
        flex-direction: column;
        gap: var(--space-2);
        text-align: center;
    }
}
/* ==== responsive.css ==== */
/*    22. Responsive overrides    */
@media (max-width: 720px) {
    /* Hide desktop nav, show hamburger */
    #nav-actions-desktop {
        display: none;
    }
    .nav-hamburger {
        display: inline-flex;
    }
    /* Smaller hero */
    .hero {
        padding: var(--space-6) 0 var(--space-8);
    }
    /* Tighter spacing */
    .main-content {
        padding: var(--space-4) var(--space-4) var(--space-12);
    }
    .page-title {
        font-size: var(--text-2xl);
    }
}

/* Larger tap targets on touch devices */
@media (pointer: coarse) {
    .btn { min-height: 44px; }
    .btn-sm { min-height: 36px; }
    .icon-btn { width: 44px; height: 44px; }
    .like-btn { min-height: 36px; }
    .action-icon-btn { width: 36px; height: 36px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Yesterday's most liked + random entries */
.yesterday-item, .random-item {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
}
.yesterday-topic {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--brand-text);
    text-transform: lowercase;
    letter-spacing: 0.05em;
}
.yesterday-snippet {
    font-size: var(--text-sm);
    color: var(--text-primary);
    line-height: 1.5;
    font-weight: 400;
}
.yesterday-item .list-item-trailing,
.random-item .list-item-trailing {
    align-self: flex-end;
    margin-top: calc(-1 * var(--space-5));
}

.user-avatar-official {
    background: var(--brand-text);
    color: white;
}
.official-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    padding: 2px 6px;
    margin-left: var(--space-2);
    border-radius: 4px;
    background: var(--brand-text);
    color: white;
    vertical-align: middle;
}

.entry-number {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    font-variant-numeric: tabular-nums;
    padding: 0 var(--space-2);
    transition: color 0.15s ease;
}
.entry-number:hover {
    color: var(--brand-text);
}
