html {
    font-size: 14px;
    position: relative;
    min-height: 100%;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

/* ===== Theme Variables ===== */
:root {
    --accent: #0ea5a4;
    --bg: #ffffff;
    --text: #111111;
    --card: #ffffff;
    --cardBorder: #e5e5e5;
    --muted: #6b7280;
    --radius: 18px;
    --radius-xl: 24px;
    --radius-lg: 18px;
    --radius-md: 14px;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    --font: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    --pattern: none;
    --site-max-width: 1380px;
    --transition-fast: 0.25s ease;
}

/* ===== Base ===== */
body {
    min-height: 100vh;
    margin: 0;
    background: #f8fafc;
    background-image: var(--pattern);
    background-size: 16px 16px;
    color: var(--text);
    font-family: var(--font);
}

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
    box-shadow: 0 0 0 0.1rem #fff, 0 0 0 0.25rem rgba(37, 140, 251, 0.25);
}

.site-shell {
    width: min(var(--site-max-width), calc(100% - 40px));
    margin: 0 auto;
}

/* ===== Generic Buttons ===== */
.btn-outline-dark {
    border-color: var(--accent);
    color: var(--accent);
}

    .btn-outline-dark:hover {
        background: var(--accent);
        color: #fff;
    }

/* ===== Generic Post Cards ===== */
.post-card {
    border: 1px solid var(--cardBorder);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--card);
    transition: all 0.2s ease;
    box-shadow: var(--shadow);
}

    .post-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    }

    .post-card img {
        width: 100%;
        height: 180px;
        object-fit: cover;
        display: block;
    }

.post-card-body {
    padding: 14px;
}

.post-category {
    font-size: 12px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.2px;
}

.post-title {
    font-size: 18px;
    font-weight: 900;
    margin-top: 6px;
}

.post-meta {
    font-size: 12px;
    color: var(--muted);
    margin-top: 6px;
}

/* ===== Optional animation ===== */
.theme-anim .post-card {
    transition: transform 0.15s ease;
}

    .theme-anim .post-card:hover {
        transform: translateY(-2px);
    }

/* ===== Header / Navbar ===== */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1030;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.custom-navbar {
    background: rgba(255, 255, 255, 0.82);
    border-bottom: 1px solid var(--cardBorder);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
    padding: 16px 0;
}

.navbar-collapse {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.nav-left,
.nav-center,
.nav-right {
    display: flex;
    align-items: center;
}

.nav-left {
    flex: 1;
    justify-content: flex-start;
}

.nav-center {
    flex: 1;
    justify-content: center;
}

.nav-right {
    flex: 1;
    justify-content: flex-end;
    gap: 16px;
}

.brand-title,
.brand-mark {
    text-decoration: none;
    color: var(--text);
    font-weight: 900;
    letter-spacing: 0.14em;
    font-size: 1.75rem;
    transition: var(--transition-fast);
}

.brand-title {
    text-transform: uppercase;
}

    .brand-title:hover,
    .brand-mark:hover {
        color: var(--accent);
    }

.main-nav {
    gap: 8px;
}

    .main-nav .nav-link {
        color: var(--text) !important;
        font-weight: 600;
        padding: 10px 14px !important;
        border-radius: 999px;
        transition: var(--transition-fast);
        position: relative;
    }

        .main-nav .nav-link:hover,
        .main-nav .nav-link:focus {
            color: var(--accent) !important;
            background: rgba(14, 165, 164, 0.08);
        }

/* ===== Navbar Toggler ===== */
.custom-navbar-toggler {
    border: 1px solid rgba(17, 17, 17, 0.12);
    border-radius: 12px;
    padding: 8px 10px;
    background: #ffffff;
    transition: var(--transition-fast);
}

    .custom-navbar-toggler:hover {
        border-color: var(--accent);
        background: rgba(14, 165, 164, 0.05);
    }

    .custom-navbar-toggler:focus {
        box-shadow: none;
    }

    .custom-navbar-toggler .navbar-toggler-icon {
        width: 1.3em;
        height: 1.3em;
        background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%2820,20,20,0.9%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2.2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
    }

.dropdown-menu {
    border: 1px solid var(--cardBorder);
    border-radius: 16px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.08);
    padding: 10px;
    background: var(--card);
}

.dropdown-item {
    border-radius: 10px;
    padding: 10px 14px;
}

    .dropdown-item:hover {
        background: rgba(0, 0, 0, 0.05);
    }

/* ===== Search ===== */
.search-form {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 360px;
}

.search-input {
    border-radius: 999px;
    border: 1px solid var(--cardBorder);
    background: #fff;
    min-height: 44px;
    padding: 0 16px;
    box-shadow: none !important;
}

    .search-input:focus {
        border-color: var(--accent);
        box-shadow: 0 0 0 0.2rem rgba(0, 0, 0, 0.05) !important;
    }

.search-btn {
    border-radius: 999px;
    min-height: 44px;
    padding: 0 18px;
    border: 1px solid var(--text);
    color: var(--text);
    background: #fff;
    font-weight: 600;
    transition: var(--transition-fast);
}

    .search-btn:hover {
        background: var(--text);
        color: #fff;
    }

/* ===== Login Area ===== */
.login-area {
    display: flex;
    align-items: center;
    gap: 10px;
}

    .login-area a,
    .login-area .nav-link {
        color: var(--text) !important;
        font-weight: 600;
        text-decoration: none;
        transition: var(--transition-fast);
    }

        .login-area a:hover,
        .login-area .nav-link:hover {
            color: var(--accent) !important;
        }

/* ===== Main Layout ===== */
.site-page {
    padding: 28px 0 40px;
}

.site-main {
    min-height: calc(100vh - 180px);
}

/* ===== Footer ===== */
.site-footer {
    border-top: 1px solid var(--cardBorder);
    margin-top: 40px;
    background: rgba(255, 255, 255, 0.6);
}

.footer-inner {
    min-height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    color: var(--muted);
}

    .footer-inner a {
        color: var(--text);
        text-decoration: none;
    }

        .footer-inner a:hover {
            color: var(--accent);
        }

/* ===== Utility / Legacy helpers ===== */
.quote-soft {
    background: rgba(0, 0, 0, 0.03);
}

.quote-neon {
    background: rgba(34, 197, 94, 0.08);
    border: 1px solid rgba(34, 197, 94, 0.35);
}

.sticker-left {
    text-align: left;
}

.sticker-center {
    text-align: center;
}

.sticker-right {
    text-align: right;
}

/* =========================
   HOME PAGE
========================= */
.home-grid {
    display: grid;
    grid-template-columns: 280px minmax(0, 1.7fr) 320px;
    gap: 24px;
    align-items: start;
}

.home-left,
.home-center,
.home-right {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.home-panel {
    background: var(--card);
    border: 1px solid var(--cardBorder);
    border-radius: 24px;
    padding: 24px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.06);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    position: relative;
    overflow: hidden;
}

    .home-panel:hover {
        transform: translateY(-4px);
        border-color: #d5d5d5;
        box-shadow: 0 20px 48px rgba(0, 0, 0, 0.08);
    }

.panel-heading {
    margin-bottom: 18px;
}

.panel-kicker {
    display: inline-block;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-weight: 900;
    color: var(--accent);
    margin-bottom: 10px;
}

.home-box-title {
    font-size: 1.4rem;
    font-weight: 800;
    margin: 0;
    color: var(--text);
}

.panel-subtitle {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 0.96rem;
    line-height: 1.6;
}

/* ===== Hero ===== */
.hero-panel {
    padding: 34px;
    background: radial-gradient(circle at top right, rgba(14, 165, 164, 0.14), transparent 30%), linear-gradient(135deg, #ecfeff, #f0fdfa);
    border: 1px solid rgba(14,165,164,0.15);
}

    .hero-panel::after {
        content: "";
        display: block;
        width: 84px;
        height: 4px;
        margin-top: 22px;
        border-radius: 999px;
        background: var(--accent);
        opacity: 0.9;
    }

.hero-kicker {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(14, 165, 164, 0.12);
    color: #0f766e;
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 16px;
}

.home-welcome-title {
    font-size: clamp(2rem, 4vw, 3.4rem);
    line-height: 1.05;
    font-weight: 900;
    margin: 0 0 16px;
    letter-spacing: -0.03em;
    max-width: 10ch;
}

.home-welcome-text {
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--muted);
    max-width: 62ch;
    margin: 0;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 26px;
}

.hero-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0 20px;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 700;
    transition: all 0.25s ease;
}

.hero-btn-primary {
    background: var(--accent);
    color: #fff;
    border: 1px solid var(--accent);
}

    .hero-btn-primary:hover {
        background: #0f766e;
        border-color: #0f766e;
        color: #fff;
        transform: translateY(-2px);
    }

.hero-btn-secondary {
    background: #fff;
    color: var(--text);
    border: 1px solid var(--cardBorder);
}

    .hero-btn-secondary:hover {
        border-color: var(--accent);
        color: var(--accent);
        transform: translateY(-2px);
    }

/* ===== Authors ===== */
.authors-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.author-card {
    display: flex;
    gap: 14px;
    text-decoration: none;
    color: inherit;
    padding: 14px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.65);
    border: 1px solid transparent;
    transition: all 0.25s ease;
}

    .author-card:hover {
        transform: translateY(-3px);
        border-color: #5eead4;
        box-shadow: 0 10px 30px rgba(14,165,164,0.18);
    }

.author-avatar {
    width: 68px;
    height: 68px;
    flex: 0 0 68px;
    border-radius: 18px;
    overflow: hidden;
    background: #f1f1f1;
    border: 1px solid var(--cardBorder);
}

    .author-avatar img,
    .latest-cover {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
    }

.avatar-fallback {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    font-weight: 800;
    color: var(--accent);
    background: rgba(17, 17, 17, 0.08);
}

.author-info {
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.author-name {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 6px;
}

.author-bio {
    font-size: 0.93rem;
    line-height: 1.6;
    color: var(--muted);
    margin-bottom: 8px;
}

.author-link-text {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent);
    opacity: 0.9;
}

/* ===== Latest Posts ===== */
.latest-list {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.latest-item {
    display: grid;
    grid-template-columns: 140px minmax(0, 1fr);
    gap: 18px;
    align-items: stretch;
    text-decoration: none;
    color: inherit;
    padding: 16px;
    border-radius: 20px;
    background: white;
    border: 1px solid #e5e7eb;
    transition: all 0.25s ease;
}

    .latest-item:hover {
        transform: translateY(-4px);
        border-color: #5eead4;
        box-shadow: 0 16px 35px rgba(14,165,164,0.18);
    }

.latest-cover-wrap {
    height: 120px;
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid var(--cardBorder);
    background: #f2f2f2;
}

.placeholder-cover {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 700;
}

.latest-body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.latest-meta-top {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}

.category-badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 12px;
    border-radius: 999px;
    background: rgba(14, 165, 164, 0.12);
    color: #0f766e;
    font-size: 0.8rem;
    font-weight: 800;
}

.post-date {
    font-size: 0.84rem;
    color: var(--muted);
}

.latest-title {
    font-size: 1.2rem;
    font-weight: 800;
    line-height: 1.35;
    margin-bottom: 10px;
    color: var(--text);
}

.latest-summary {
    color: var(--muted);
    line-height: 1.7;
    font-size: 0.95rem;
    margin-bottom: 12px;
}

.latest-readmore {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--accent);
}

.latest-author {
    margin-top: 8px;
    font-size: 14px;
    color: #666;
}

.latest-author-link {
    color: inherit;
    text-decoration: none;
    font-weight: 600;
}

    .latest-author-link:hover {
        text-decoration: underline;
    }

.latest-list .latest-item:first-child {
    grid-template-columns: 180px minmax(0, 1fr);
    padding: 20px;
    box-shadow: 0 12px 30px rgba(14, 165, 164, 0.08);
}

    .latest-list .latest-item:first-child .latest-cover-wrap {
        height: 150px;
    }

    .latest-list .latest-item:first-child .latest-title {
        font-size: 1.35rem;
    }

/* ===== Quote ===== */
.quote-panel {
    background: linear-gradient(135deg, #f0fdfa, #ecfeff);
}

.quote-text {
    margin: 0;
    padding: 18px 20px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid var(--cardBorder);
    font-size: 1.02rem;
    line-height: 1.9;
    font-style: italic;
    color: var(--text);
    position: relative;
}

    .quote-text::before {
        content: '"';
        position: absolute;
        top: -6px;
        left: 14px;
        font-size: 2.5rem;
        opacity: 0.25;
    }

/* ===== Leaderboard ===== */
.leader-list {
    list-style: none;
    margin: 0;
    padding: 0;
    counter-reset: leader-counter;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.leader-item {
    counter-increment: leader-counter;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 18px;
    border: 1px solid var(--cardBorder);
    background: rgba(255, 255, 255, 0.72);
    transition: all 0.25s ease;
}

    .leader-item:hover {
        transform: translateY(-2px);
        border-color: #d6d6d6;
        background: #fff;
    }

.leader-author {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    min-width: 0;
}

.leader-rank::before {
    content: counter(leader-counter);
    width: 34px;
    height: 34px;
    display: inline-grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(14, 165, 164, 0.14);
    color: #0f766e;
    font-weight: 800;
    font-size: 0.95rem;
}

.leader-name {
    color: var(--text);
    font-weight: 700;
}

.leader-score {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text);
}

.leader-item:nth-child(1) .leader-rank::before {
    background: #fef3c7;
    color: #b45309;
}

.leader-item:nth-child(2) .leader-rank::before {
    background: #e5e7eb;
    color: #374151;
}

.leader-item:nth-child(3) .leader-rank::before {
    background: #fde68a;
    color: #92400e;
}

/* ===== Empty State ===== */
.empty-state {
    padding: 18px 20px;
    border-radius: 16px;
    border: 1px dashed var(--cardBorder);
    color: var(--muted);
    background: rgba(255, 255, 255, 0.55);
}

/* ===== Responsive ===== */
@media (max-width: 1199.98px) {
    .home-grid {
        grid-template-columns: 240px minmax(0, 1fr) 280px;
    }
}

@media (max-width: 991.98px) {
    .navbar-collapse {
        align-items: stretch;
        gap: 18px;
        padding: 16px;
        margin-top: 14px;
        background: rgba(255, 255, 255, 0.96);
        border: 1px solid var(--cardBorder);
        border-radius: 20px;
        box-shadow: 0 18px 40px rgba(0, 0, 0, 0.08);
    }

    .nav-left,
    .nav-center,
    .nav-right {
        flex: unset;
        width: 100%;
        justify-content: flex-start;
    }

    .nav-left,
    .nav-right {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
    }

    .nav-right {
        border-top: 1px solid var(--cardBorder);
        padding-top: 14px;
    }

    .search-form {
        max-width: 100%;
    }

    .main-nav {
        gap: 4px;
        width: 100%;
    }

        .main-nav .nav-link {
            display: block;
            width: 100%;
            border-radius: 14px;
        }

    .brand-mark {
        font-size: 1.2rem;
        max-width: calc(100% - 72px);
        line-height: 1.2;
        letter-spacing: 0.08em;
    }

    .home-grid {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .home-left {
        order: 3;
        gap: 18px;
    }

    .home-center {
        order: 1;
        display: flex;
        flex-direction: column;
        gap: 18px;
    }

    .home-right {
        order: 4;
        gap: 18px;
    }

    .latest-item {
        grid-template-columns: 1fr;
    }

    .latest-cover-wrap {
        height: 200px;
    }

    .latest-list .latest-item:first-child {
        grid-template-columns: 1fr;
    }

        .latest-list .latest-item:first-child .latest-cover-wrap {
            height: 200px;
        }

    .home-welcome-title {
        font-size: clamp(2.2rem, 4vw, 3.6rem);
        line-height: 1.05;
        font-weight: 900;
        margin: 0 0 16px;
        letter-spacing: -0.03em;
        max-width: 12ch;
    }
}

@media (max-width: 575.98px) {
    .site-shell {
        width: min(var(--site-max-width), calc(100% - 24px));
    }

    .home-panel {
        padding: 18px;
        border-radius: 20px;
    }

    .hero-panel {
        padding: 24px 18px;
    }

    .home-box-title {
        font-size: 1.2rem;
    }

    .home-welcome-title {
        font-size: 2rem;
    }

    .author-avatar {
        width: 58px;
        height: 58px;
        flex-basis: 58px;
    }

    .hero-actions {
        flex-direction: column;
    }

    .hero-btn {
        width: 100%;
    }

    .footer-inner {
        flex-direction: column;
        justify-content: center;
        text-align: center;
        padding: 14px 0;
    }
}
