@font-face {
    font-family: "OdorMeanChey";
    src: url("../font/OdorMeanChey-Regular.ttf") format("truetype");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

/* Shared breadcrumb trail (blog, gallery, projects, …). Keeps the trail on a
   single line: long titles scroll horizontally within the row instead of
   wrapping to a second line (mostly a mobile problem). min-width:0 lets the
   heading shrink inside its flex row so scrolling engages; scrollbar hidden. */
.app-breadcrumb {
    min-width: 0;
    white-space: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;        /* Firefox */
    -ms-overflow-style: none;     /* IE/Edge */
}
.app-breadcrumb::-webkit-scrollbar {
    display: none;                /* Chrome/Safari */
}

@font-face {
    font-family: "InterRoman";
    src: url("../font/inter-roman-latin.Di8DUHzh.woff2") format("woff2");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

/* All design tokens (colors, shadows, etc.) live in theme_bridge.css.
 * Do NOT add :root or [data-theme] token blocks here â€” edit the bridge file instead.
 */

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

html {
    scrollbar-gutter: stable;
    background: var(--surface-page);
    scroll-behavior: smooth;
}

/* Golbal Body Styles */
body {
    font-family: "InterRoman", var(--bs-font-sans-serif), system-ui, sans-serif;
    background: var(--surface-page);
    color: var(--text-primary);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    margin: 0;
    padding: 0;
    padding-bottom: env(safe-area-inset-bottom);
}

/* Global Theme Styles */
html[data-theme="navy"],
html[data-theme="dark"] {
    color-scheme: dark;
}

html[data-theme="light"] {
    color-scheme: light;
}

body:not(.theme-loaded),
body:not(.theme-loaded) *,
body:not(.theme-loaded) *::before,
body:not(.theme-loaded) *::after {
    transition: none !important;
    animation: none !important;
}

/* Gobal Sidebar Styles */

body:not(.theme-loaded) #sidebar {
    top: 0 !important;
    height: 100vh !important;
    transition: none !important;
}

body.theme-loaded {
    transition: background-color 0.3s ease, color 0.3s ease;
}

#sidebar {
    top: 0 !important;
    height: 100vh !important;
    height: 100dvh;
    min-height: -webkit-fill-available;
    background: var(--sidebar-bg);
    color: var(--text-primary);
    width: 280px;
    height: 100vh;
    padding: 0;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 2000;
    box-shadow: 3px 0 20px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color, rgba(124, 133, 134, 0.2));
    transform: translateX(-100%);
    overflow: hidden;

    will-change: transform;

    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#sidebar.sidebar-visible {
    transform: translateX(0);
}

.sidebar-branding-spacer {
    height: 32px;
    width: 100%;
    flex-shrink: 0;
    background: var(--sidebar-bg);
}

.sidebar-overlay,
#sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    min-height: 100dvh;
    min-height: -webkit-fill-available;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease !important;
}

.sidebar-overlay.active,
#sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

.sidebar-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}

.profile-wrapper {
    width: 100%;
    margin-top: 0;
    text-align: center;
    padding: 45px 20px 25px 20px !important;
    background: var(--sidebar-bg);
    position: relative;
    margin-bottom: 0;
    border-bottom: 2px solid rgba(124, 133, 134, 0.2);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    flex-shrink: 0;
}

.profile-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="75" cy="75" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="50" cy="10" r="0.5" fill="rgba(255,255,255,0.1)"/><circle cx="10" cy="60" r="0.5" fill="rgba(255,255,255,0.1)"/><circle cx="90" cy="40" r="0.5" fill="rgba(255,255,255,0.1)"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    opacity: 0.2;
}

#avatar {
    display: inline-block;
    position: relative;
    margin-bottom: 10px;
    z-index: 1;
}

#avatar img {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
    object-fit: cover;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

#avatar:hover img {
    transform: scale(1.05);
    border-color: rgba(252, 250, 250, 0.6);
    box-shadow: 0 5px 15px rgba(252, 251, 251, 0.3);
}

.site-title {
    font-size: 1.5rem;
    font-weight: 650;
    margin: 5px auto;
    color: var(--text-primary);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    letter-spacing: -0.5px;
    z-index: 1;
    position: relative;
}

.site-title::after {
    content: '';
    display: block;
    margin: 9px auto 0;
    /* Brought border closer to title */
    width: 120px;
    height: 3px;
    border-radius: 3px;
    background: var(--text-primary);
    opacity: 0.7;
}

.site-subtitle {
    font-size: 1.05rem;
    color: var(--text-muted);
    font-style: italic;
    margin: 14px auto 25px;
    /* Brought bio closer to the border */
    line-height: 1.6;
    z-index: 1;
    position: relative;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-width: 240px;
    display: inline-block;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    /* Vertically center nav between profile bottom border and sidebar-bottom top border */
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.sidebar-donation {
    display: none;
}

.nav-item {
    width: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    padding: 0.85rem 1.5rem;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.nav-item i {
    display: flex;
    font-size: 1.25rem;
    min-width: 24px;
    text-align: center;
    transition: transform 0.3s ease;
}

.nav-item:hover {
    background: var(--surface-overlay);
    color: var(--accent-primary);
    transform: translateX(5px);
}

.nav-item.active {
    background: var(--surface-overlay);
    color: var(--accent-primary);
}

.sidebar-bottom {
    padding: 45px 20px 25px 20px !important;
    background: var(--sidebar-bg);
    border-top: 2px solid rgba(124, 133, 134, 0.2) !important;
    /* Restored border */
    display: flex;
    justify-content: flex-start;
    gap: 15px;
    margin-top: auto;
    flex-shrink: 0;
}

.sidebar-bottom a {
    color: var(--text-primary);
    font-size: 1.25rem;
    transition: all 0.3s ease;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: var(--surface-overlay);
    border: 1px solid var(--border-default);
}

.sidebar-close-btn {
    display: block;
    position: absolute;
    top: max(12px, calc(env(safe-area-inset-top) + 6px));
    right: max(15px, env(safe-area-inset-right));
    background: var(--surface-overlay);
    border: none;
    color: var(--text-primary) !important;
    /* Ensure visibility */
    font-size: 1.4rem;
    z-index: 2200;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    cursor: pointer;
}

.sidebar-close-btn:hover {
    background: var(--surface-raised);
}

/* Gobal Hamburger Menu */
#sidebar-trigger {
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-primary);
    width: 42px;
    height: 42px;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}

#sidebar-trigger:hover {
    background-color: var(--surface-overlay);
    color: var(--accent-primary);
}

.sidebar-icon-trigger {
    color: var(--text-primary);
    background: none;
    border: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.2rem;
    box-shadow: none;
}

.sidebar-icon-trigger:hover {
    background: var(--surface-overlay) !important;
    color: var(--accent-primary) !important;
    box-shadow: none !important;
}



.sidebar-icon-trigger svg {
    width: 20px;
    height: 20px;
}

/* Icon links must never render a text underline (the sidebar socials and the
   topbar notification bell are <a> tags — the underline showed on the glyph). */
.sidebar-bottom a,
.topbar-action-btn,
.topbar-action-btn:hover {
    text-decoration: none;
}

.sidebar-icon-trigger:active {
    transform: scale(0.95);
}


/* Golbal Main Wrapper (Topbar, PWA, Mobile Menu, etc...) */
#main-wrapper {
    padding: 0;
    margin: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Gobal Topbar */
body.theme-loaded #topbar {
    transition: transform 0.3s ease, background-color 0.3s ease;
}

#topbar.hidden {
    transform: translateY(-110%);
}

#topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    isolation: isolate;
    min-height: 70px;
    background: var(--topbar-bg);
    padding: 5px 15px;
    border-radius: 0;
    margin-bottom: 0;
    box-shadow: 0 4px 12px var(--shadow-color);
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    border: none;
    border-bottom: 1px solid var(--border-color);
    gap: 12px;
    z-index: 100;
    will-change: transform, background-color;
    overflow: visible;
    /* Allow dropdown menu to appear outside topbar */
}

#topbar-title-wrap {
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

#topbar .topbar-actions {
    flex-shrink: 0;
    min-width: 0;
}

.topbar-brand-cluster {
    min-width: 0;
    gap: 1.5rem;
    justify-content: space-between;
    padding-left: 60px;
    /* Accounts for sidebar trigger in the corner */
}

#topbar-title {
    font-family: "OdorMeanChey", var(--bs-font-sans-serif), system-ui, sans-serif;
    letter-spacing: 0.02em;
    font-weight: 1000;
    font-size: 1.4rem;
    color: var(--text-primary);
    margin: 5px;
    text-shadow: 0 2px 4px var(--shadow-color);
    position: relative;
    left: 0;
    padding: 6px 0;
    transition: color 0.3s ease;
    white-space: nowrap;
    flex: 0 0 auto;
    min-width: 0;
}

#topbar-title a {
    text-decoration: none;
    color: inherit;
}

#topbar-title::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--text-primary);
    border-radius: 2px;
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

/* Gobal Logo Name */
#topbar-title:hover::before {
    transform: scaleX(1);
}

/* Match the menu (user) dropdown top gap to the ads/notification dropdown */
.dropdown-menu.user-dropdown-menu {
    margin-top: 17px !important;
    background: var(--surface-raised) !important;
    border: 1px solid var(--border-default) !important;
    border-radius: 0px !important;
    box-shadow: var(--shadow-md) !important;
    padding: 8px !important;
    overflow: hidden;
}

.user-dropdown-menu .dropdown-item:hover,
.user-dropdown-menu .dropdown-item:focus,
.user-dropdown-menu .dropdown-item:active,
.user-dropdown-menu .dropdown-item.active {
    background: var(--surface-overlay) !important;
    color: var(--text-primary) !important;
}

/* Keep the Logout (danger) item red on hover/focus */
.user-dropdown-menu .dropdown-item.text-danger:hover,
.user-dropdown-menu .dropdown-item.text-danger:focus,
.user-dropdown-menu .dropdown-item.text-danger:active {
    background: var(--surface-overlay) !important;
    color: var(--bs-danger, #dc3545) !important;
}

/* Gobal Login btn  */
.login-btn {
    background: var(--surface-raised);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-weight: 700;
    box-shadow: 0 2px 5px var(--shadow-color);
}

.login-avatar-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    display: inline-block;
    border: 2px solid transparent;
    transition: all 0.3s;
}

.login-avatar-btn img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.login-btn:hover {
    color: var(--text-primary);
    background: var(--surface-overlay);
}


#topbar .topbar-search-icon,
#topbar .topbar-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    /* Center icons */
    background: none;
    border: none;
    color: var(--text-primary);
    /* Adaptive color */
    font-size: 1.2rem;
    cursor: pointer;
    width: 42px;
    /* Standard size */
    height: 42px;
    /* Standard size */
    border-radius: 10px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    line-height: 1;
    -webkit-tap-highlight-color: transparent;
}

#topbar .topbar-search-icon:hover,
#topbar .topbar-action-btn:hover {
    background-color: var(--surface-overlay);
    color: var(--text-app-interactive, var(--accent-primary));
}

#topbar .topbar-action-btn.switching {
    transform: rotate(360deg);
}

.topbar-search-dock {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: none;
    align-items: center;
    justify-content: flex-start;
    padding: 4px 12px;
    box-sizing: border-box;
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.topbar-search-dock[hidden] {
    display: none !important;
}

#topbar.topbar-search-open .topbar-search-dock {
    display: flex !important;
}

#topbar.topbar-search-open #topbar-main-content {
    visibility: hidden;
    pointer-events: none;
}

body.theme-loaded #topbar .topbar-search-dock {
    transition: opacity 0.2s ease;
}

.topbar-search-dock-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 0;
    padding: 0 6px 0 14px;
    min-height: 48px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    box-shadow: 0 2px 12px var(--shadow-color);
}

.topbar-search-dock-form-icon {
    color: var(--text-secondary);
    flex-shrink: 0;
    font-size: 0.95rem;
}

.topbar-search-dock-input {
    flex: 1 1 auto;
    min-width: 0;
    height: 44px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.9375rem;
    outline: none;
}

.topbar-search-dock-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.9;
}

.topbar-search-dock-close {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    width: 36px;
    height: 36px;
    margin: 2px 2px 2px 0;
    padding: 0;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    flex-shrink: 0;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.topbar-search-dock-close:hover {
    background: rgba(148, 163, 184, 0.25);
    color: var(--text-primary);
}

/* Golbal Container */
.container {
    background: var(--bg-secondary);
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    margin-top: 0;
    max-width: none;
    width: 100%;
    margin: 0 auto;
    padding-top: 2rem;
}

[data-theme="dark"] #sidebar,
[data-theme="dark"] .profile-wrapper,
[data-theme="dark"] .sidebar-bottom {
    border-top: 2px solid rgba(124, 133, 134, 0.2);
    color: #fff;
}

[data-theme="dark"] .profile-wrapper {
    width: 100%;
    margin-top: 0;
    border-bottom: 1px solid var(--border-default);
    box-shadow: none;
}

[data-theme="dark"] .profile-wrapper::before {
    display: none;
}

[data-theme="dark"] .site-subtitle,
[data-theme="dark"] .sidebar-bottom a {
    color: var(--text-primary);
    font-size: 1.25rem;
    transition: all 0.3s ease;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: var(--surface-overlay);
    border: 1px solid var(--border-default);
}

[data-theme="dark"] .sidebar-bottom a:hover {
    color: #232946;
    background: #fff;
}

[data-theme="dark"] #topbar {
    background: var(--topbar-bg);
    box-shadow: var(--shadow-md);
}

[data-theme="dark"] .sidebar-bottom a,
html[data-theme="navy"] .sidebar-bottom a,
html[data-theme="black"] .sidebar-bottom a {
    color: #fff !important;
}

[data-theme="dark"] .sidebar-bottom a i,
html[data-theme="navy"] .sidebar-bottom a i,
html[data-theme="black"] .sidebar-bottom a i {
    color: #fff !important;
}

[data-theme="dark"] .topbar-search-dock-form {
    background: rgba(34, 40, 68, 0.92);
}

/* ==========================================================================
   Mobile Layout (max-width: 470px)
   ========================================================================== */
@media (max-width: 470px) {


    #sidebar {
        z-index: 1050 !important;
    }

    /* Hide navigation items and desktop toggle on mobile, but display the sidebar-nav wrapper for donation widget */
    .sidebar-nav {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        padding: 0 !important;
        margin: 15px 20px !important;
        overflow: hidden;
        flex-shrink: 0 !important;
    }

    .sidebar-nav .nav-item {
        display: none !important;
    }

    .sidebar-donation {
        display: flex !important;
        width: 100%;
        height: 200px;
    }

    .donation-btn {
        width: 100%;
        height: 100%;
        padding: 0;
        border: none;
        background: none;
        position: relative;
        overflow: hidden;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .donation-img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        transition: none;
        border-radius: 12px;
    }

    .donation-btn:hover .donation-img {
        transform: scale(1.06);
    }

    #donation-modal.show {
        display: flex !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        max-width: 100vw !important;
        max-height: 100vh !important;
        transform: none !important;
        border-radius: 0 !important;
        padding: 40px 24px !important;
        box-sizing: border-box !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        background: var(--bg-secondary, #121212) !important;
        color: var(--text-primary, #ffffff) !important;
        z-index: 10001 !important;
    }

    #sidebar-trigger,
    #sidebar-trigger-mobile {
        display: flex !important;
    }

    /* Disable hover for mobile hamburger */
    #sidebar-trigger-mobile:hover {
        background: none !important;
        color: inherit !important;
    }

    .nav-item:hover i {
        transform: none !important;
    }

    /* Disable social icon hover background/effects on mobile */
    .sidebar-bottom a:hover {
        background: var(--surface-overlay) !important;
        transform: none !important;
        box-shadow: none !important;
        border-color: var(--border-default) !important;
    }

    /* Topbar mobile layout overrides */
    #topbar {
        padding: 5px 15px !important;
    }

    #topbar-search-btn-desktop {
        display: none !important;
    }

    #topbar-search-btn-mobile {
        display: flex !important;
    }

    #topbar-main-content {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        position: relative;
    }

    .topbar-brand-cluster {
        position: static !important;
        flex: 1 1 auto;
        display: flex !important;
        align-items: center;
        justify-content: center;
        padding: 0 !important;
        margin: 0 !important;
        gap: 0 !important;
        z-index: 1;
        pointer-events: none;
    }

    #topbar-title-wrap {
        display: block !important;
        position: static !important;
        transform: none !important;
        left: auto !important;
        top: auto !important;
        margin: 0 auto !important;
        font-size: 0.9rem !important;
        text-align: center;
        margin-right: 155px !important;
        pointer-events: auto;
        flex: none !important;
        white-space: nowrap;
    }

    .topbar-actions {
        position: absolute !important;
        right: 0;
        top: 50%;
        transform: translateY(-50%);
        z-index: 2;
        display: flex !important;
        align-items: center;
        gap: 2px !important;
        padding-right: 8px;
        pointer-events: auto;
    }

    /* Disable hover for login icon and navigation items on mobile */
    #topbar-login-btn:hover,
    .topbar-search-icon:hover,
    .topbar-action-btn:hover,
    .nav-item:hover {
        background: none !important;
        color: inherit !important;
        transform: none !important;
    }

    /* Mobile Bottom Navigation (Visible ONLY on mobile) */
    .mobile-bottom-nav {
        display: flex !important;
        position: fixed;
        bottom: calc(8px + env(safe-area-inset-bottom));
        left: 50%;
        transform: translateX(-50%);
        width: calc(100% - 32px);
        max-width: 440px;
        background: rgba(255, 255, 255, 0.03);
        background: color-mix(in srgb, var(--topbar-bg) 35%, transparent);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        border: 1px solid var(--border-default);
        border-radius: 20px;
        z-index: 1000;
        padding: 6px 4px;
        justify-content: space-around;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
        transition: filter 0.3s ease, transform 0.3s ease;
    }

    body.sidebar-open .mobile-bottom-nav {
        filter: blur(4px);
        pointer-events: none;
    }

    .mobile-bottom-nav .nav-item {
        position: relative;
        width: auto !important;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        padding: 6px 12px !important;
        border-radius: 9999px;
        background: transparent !important;
        border: none !important;
        color: var(--text-primary) !important;
        transform: none !important;
        flex: 1;
        transition: color 0.3s ease;
        -webkit-tap-highlight-color: transparent;
        z-index: 1;
    }

    .mobile-bottom-nav .nav-item i {
        font-size: 1.6rem;
        line-height: 1;
        display: block;
        margin: 0 !important;
        padding: 0;
        transition: transform 0.2s ease, color 0.2s ease;
    }

    .mobile-nav-label {
        display: block;
        font-size: 0.6rem;
        font-weight: 600;
        margin: 0;
        padding: 0;
        line-height: 1;
        letter-spacing: 0.02em;
        color: var(--text-muted);
        white-space: nowrap;
        transition: color 0.2s ease;
    }

    .mobile-bottom-nav .nav-item.active .mobile-nav-label,
    .mobile-bottom-nav .nav-item:hover .mobile-nav-label {
        color: var(--accent-primary);
        background: transparent !important;
        transform: none !important;
    }

    .mobile-bottom-nav .nav-item:hover i {
        transform: scale(1.1);
    }

    .mobile-bottom-nav .nav-item:hover,
    .mobile-bottom-nav .nav-item.active {
        color: var(--accent-primary) !important;
        background: transparent !important;
        transform: none !important;
    }

    /* Padding offset to keep content above bottom nav */
    main.flex-grow-1 {
        padding-bottom: calc(105px + env(safe-area-inset-bottom)) !important;
    }
}

/* ==========================================================================
   Tablet Layout (min-width: 471px) and (max-width: 1023px)
   ========================================================================== */
@media (min-width: 471px) and (max-width: 1023px) {

    /* Tablet navigation styling */
    .sidebar-nav .nav-item {
        width: 80% !important;
        justify-content: center !important;
        gap: 16px !important;
        padding: 10px 20px !important;
        transition: background 0.3s ease, transform 0.2s ease;
        border-radius: 50px;
        position: relative;
        overflow: hidden;
    }

    #sidebar .sidebar-nav .nav-item i {
        display: none !important;
    }

    .sidebar-nav .nav-item span {
        display: inline !important;
        font-size: 1.05rem;
        color: var(--text-primary);
        font-weight: 600;
    }

    .sidebar-nav .nav-item::before {
        content: '';
        position: absolute;
        inset: 0;
        background: var(--surface-raised);
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .sidebar-nav .nav-item:hover {
        background: var(--surface-overlay);
        transform: translateX(4px);
    }

    .sidebar-nav .nav-item:hover::before {
        opacity: 0.05;
    }

    /* Topbar tablet layout overrides */
    #topbar {
        padding: 5px 15px !important;
    }

    #topbar-main-content {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        position: relative;
    }

    .topbar-brand-cluster {
        position: static !important;
        flex: 1 1 auto;
        display: flex !important;
        align-items: center;
        justify-content: center;
        padding: 0 !important;
        margin: 0 !important;
        gap: 0 !important;
        z-index: 1;
        pointer-events: none;
    }

    #topbar-title-wrap {
        position: absolute !important;
        left: 50% !important;
        top: 50% !important;
        transform: translate(-50%, -50%) !important;
        pointer-events: auto;
        flex: none !important;
        text-align: center !important;
        white-space: nowrap;
    }

    .topbar-actions {
        position: absolute !important;
        right: 0;
        top: 50%;
        transform: translateY(-50%);
        z-index: 2;
        display: flex !important;
        align-items: center;
        gap: 4px !important;
        padding-right: 8px;
        pointer-events: auto;
    }

    #topbar-search-btn-desktop {
        display: none !important;
    }

    #topbar-search-btn-mobile {
        display: flex !important;
    }

    /* Hide mobile bottom navigation on tablet */
    .mobile-bottom-nav {
        display: none !important;
    }

    main.flex-grow-1 {
        padding-bottom: 0 !important;
    }

}

/* ==========================================================================
   Desktop Layout (min-width: 1024px)
   ========================================================================== */

@media (min-width: 1024px) {

    html {
        --layout-sidebar-width: 280px;
        /* Match desktop #topbar (height + min-height) so main padding and collapsed sidebar rail align */
        --layout-topbar-height: 64px;
        /* Space between avatar rail and minimize control in collapsed sidebar */
        --sidebar-collapsed-trigger-gap: 30px;
    }

    body.sidebar-collapsed {
        --layout-sidebar-width: 80px;
    }

    body.sidebar-collapsed #sidebar {
        width: var(--layout-sidebar-width);
    }

    /* Main/topbar offset uses padding-left: var(--layout-sidebar-width) (desktop block below); no extra margin/left here */

    body.sidebar-collapsed .site-title,
    body.sidebar-collapsed .site-subtitle,
    body.sidebar-collapsed #sidebar-close-btn {
        display: none !important;
    }

    body.sidebar-collapsed .sidebar-branding-spacer {
        display: none !important;
        /* Move content to top in minimized state */
    }

    body.sidebar-collapsed .profile-wrapper {
        width: 100%;
        margin-top: 0;
        padding-top: 15px !important;
        /* Position avatar at the top */
        padding-bottom: 30px !important;
        padding-left: 10px !important;
        padding-right: 10px !important;
        border-bottom: 1px solid var(--border-color, rgba(124, 133, 134, 0.2));
    }

    body.sidebar-collapsed #avatar {
        margin-bottom: 0;
    }

    body.sidebar-collapsed #avatar img {
        width: 55px;
        height: 55px;
    }

    body.sidebar-collapsed .sidebar-bottom {
        flex-direction: column;
        padding: 12px 0px 5px 0 !important;
        gap: 10px !important;
        margin-bottom: 5px !important;
        align-items: center;
        border-top: 1px solid var(--border-color, rgba(124, 133, 134, 0.2));
    }

    body.sidebar-collapsed .sidebar-bottom a {
        padding: 4px !important;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    body.sidebar-collapsed .sidebar-bottom a i {
        font-size: 20px !important;
    }

    body.sidebar-collapsed .nav-item span {
        display: none !important;
    }

    body.sidebar-collapsed .nav-item {
        width: 40px !important;
        height: 40px !important;
        padding: 0 !important;
        justify-content: center !important;
        margin: 0 auto;
    }

    body.sidebar-collapsed .nav-item i {
        display: block !important;
        margin: 0 !important;
    }

    body.sidebar-collapsed .sidebar-nav {
        padding: 0.25rem 0.35rem;
        align-items: center;
        justify-content: center;
        flex: 1 1 auto;
        min-height: 0;
    }

    #sidebar {
        top: 0 !important;
        height: 100vh !important;
        transform: translateX(0);
        width: var(--layout-sidebar-width);
        overflow: hidden;
    }

    .mobile-sidebar-trigger {
        display: none !important;
    }

    .mobile-bottom-nav {
        display: none !important;
    }

    .nav-item {
        background: var(--surface-overlay);
        border: 1px solid var(--border-default);
        border-radius: 10px;
    }

    .nav-item:hover,
    .nav-item.active {
        background: var(--surface-overlay);
        border-color: var(--border-default);
    }

    .sidebar-bottom a {
        color: var(--text-primary);
        font-size: 1.25rem;
        transition: all 0.3s ease;
        width: 42px;
        height: 42px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 10px;
        background: var(--surface-overlay);
        border: 1px solid var(--border-default);
    }

    #topbar {
        position: fixed;
        top: 0;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        justify-content: center !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        padding-left: var(--layout-sidebar-width) !important;
        padding-right: max(0.75rem, env(safe-area-inset-right)) !important;
        height: var(--layout-topbar-height);
        min-height: var(--layout-topbar-height) !important;
        padding-top: 0 !important;
        padding-bottom: 0 !important;
        background: var(--topbar-bg);
        border-radius: 0;
        margin-bottom: 0;
        box-shadow: 0 4px 12px var(--shadow-color);
        display: flex;
        align-items: center;
        justify-content: flex-start;
        border: none;
        border-bottom: 1px solid var(--border-color);
        will-change: background-color, border-color, box-shadow;
        z-index: 100;
        transition: padding 0.3s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.3s ease;
    }

    #topbar-main-content {
        max-width: 1250px !important;
        margin: 0 auto !important;
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    #topbar-title {
        font-size: 1.6rem;
        margin-right: 0;
    }

    .topbar-brand-cluster {
        gap: 1.5rem !important;
    }

    body.theme-loaded #topbar {
        transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease !important;
    }

    main {
        margin-left: 0 !important;
        width: 100% !important;
        /* Only offset for the fixed sidebar — symmetric right padding was shrinking Mac/desktop layout */
        padding-left: var(--layout-sidebar-width) !important;
        padding-right: max(0.75rem, env(safe-area-inset-right)) !important;
        transition: padding 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        min-height: 100vh;
        min-height: 100dvh;
        box-sizing: border-box;
    }

    #main-wrapper {
        padding: 0;
        margin: 0;
        flex: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
    }

    .container {
        flex: 1 1 auto;
        width: 100%;
        max-width: none;
        margin-left: 0;
        padding-left: 0;
        padding-right: 10rem;
        padding-bottom: 0;
        box-sizing: border-box;
        border-radius: 0;
        box-shadow: none;
    }

    .topbar-brand-cluster {
        flex-grow: 0;
        width: auto;
    }

    #topbar-title-wrap {
        flex: 0 0 auto !important;
        flex-grow: 0 !important;
        justify-content: flex-start !important;
        text-align: left !important;
    }

    #topbar .topbar-search-icon {
        display: none !important;
    }

    .topbar-search-dock {
        display: none !important;
    }

    #topbar.topbar-search-open #topbar-main-content {
        visibility: visible;
        pointer-events: auto;
    }

    @media (hover: hover) {
        .sidebar-bottom a:hover {
            color: #ffffff;
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
        }

        .sidebar-bottom a[aria-label="instgram"]:hover {
            background: linear-gradient(135deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
            border-color: transparent;
        }

        .sidebar-bottom a[aria-label="github"]:hover {
            background: #333;
            border-color: transparent;
        }

        .sidebar-bottom a[aria-label="email"]:hover {
            background: linear-gradient(135deg, #ea4335 0%, #ff6b6b 100%);
            border-color: transparent;
        }

        .sidebar-bottom a[aria-label="facebook"]:hover {
            background: linear-gradient(135deg, #1877f2 0%, #42a5f5 100%);
            border-color: transparent;
        }
    }
}



/* Reverted Landscape Blocker Design */
.landscape-blocker {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 200000;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: var(--card-bg);
    color: var(--text-primary);
    text-align: center;
    box-sizing: border-box;
}

@media screen and (orientation: landscape) and (max-height: 500px) {
    html {
        overflow: hidden;
        height: 100%;
    }

    body {
        overflow: hidden;
        position: fixed;
        inset: 0;
        width: 100%;
        height: 100%;
        touch-action: none;
    }

    .landscape-blocker {
        display: flex;
    }
}

@media print {
    .landscape-blocker {
        display: none !important;
    }
}

.landscape-blocker-inner {
    max-width: 22rem;
}

.landscape-blocker-icon {
    color: #667eea;
    opacity: 0.95;
    margin-bottom: 1.5rem;
}

.landscape-blocker-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

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

/* iOS PWA Instructions Modal */
.ios-install-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.ios-install-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.ios-install-content {
    position: relative;
    width: 100%;
    max-width: 400px;
    background: var(--surface-raised);
    border: 1px solid var(--border-default);
    border-radius: 24px;
    padding: 30px;
    z-index: 10001;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.ios-install-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.btn-close-ios {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--text-primary);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-close-ios:hover {
    background: rgba(255, 255, 255, 0.2);
}

.ios-step {
    display: flex;
    gap: 18px;
    align-items: flex-start;
    margin-bottom: 20px;
}

.ios-step-number {
    width: 28px;
    height: 28px;
    background: var(--accent-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
    margin-top: 2px;
}

.ios-step-text {
    font-size: 15px;
    color: var(--text-primary);
    line-height: 1.5;
}

.ios-step-text strong {
    color: var(--accent-primary);
}
