﻿/* ===============================
   GLOBAL VARIABLES
=============================== */

:root {
    --nav-h: 4.5rem;
    --brand-color: #0062ff;
    --accent-blue: var(--brand-color);
    --accent-light: #0dcaf0;
    --site-container-max: 1600px;
    --font-family-base: "Ubuntu", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    --font-family-heading: var(--font-family-base);
    --font-weight-text: 400;
    --font-weight-ui: 500;
    --font-weight-heading: 700;
    --font-weight-strong: 700;
    --color-text: #0f172a;
    --color-text-strong: #111827;
    --color-muted: #64748b;
    --color-muted-soft: #94a3b8;
    --color-page: #f6f9fc;
    --color-surface: #ffffff;
    --color-surface-subtle: #f8fafc;
    --color-surface-tint: #f0f7ff;
    --color-border: rgba(15, 23, 42, 0.08);
    --color-border-strong: rgba(15, 23, 42, 0.14);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-pill: 999px;
    --shadow-sm: 0 8px 20px rgba(15, 23, 42, 0.05);
    --shadow-md: 0 10px 26px rgba(15, 23, 42, 0.06);
    --shadow-lg: 0 18px 40px rgba(15, 23, 42, 0.10);
    --control-height: 44px;
    --control-height-lg: 52px;
    --ease-default: 0.25s ease;
    --status-published-bg: #e6fcf5;
    --status-published-text: #0b8f68;
    --status-draft-bg: #f1f3f5;
    --status-draft-text: #495057;
    --status-hidden-bg: #fff9db;
    --status-hidden-text: #b26a00;
    --status-pending-bg: #fff4d6;
    --status-pending-text: #a16207;
    --status-rejected-bg: #ffe3e3;
    --status-rejected-text: #c92a2a;
    --bs-primary: #0062ff;
    --bs-primary-rgb: 0, 98, 255;
    --bs-body-color: var(--color-text);
    --bs-body-bg: var(--color-surface);
    --bs-border-color: var(--color-border);
    --bs-font-sans-serif: var(--font-family-base);
    --bs-body-font-family: var(--font-family-base);
}

@media (min-width: 992px) {
    :root {
        --nav-h: 4.75rem;
    }
}

/* ===============================
   BASE
=============================== */

html {
    scroll-behavior: smooth;
    scrollbar-gutter: stable;
    max-width: 100%;
}

@supports not (scrollbar-gutter: stable) {
    html {
        overflow-y: scroll;
    }
}

body {
    padding-top: var(--nav-h);
    display: flex;
    flex-direction: column;
    font-family: var(--font-family-base);
    color: var(--color-text);
    background: var(--color-surface);
    max-width: 100%;
    overflow-x: clip;
}

img,
video,
iframe {
    max-width: 100%;
}

a,
button {
    transition: all 0.2s ease-in-out;
}

button,
input,
optgroup,
select,
textarea {
    font-family: inherit;
}

/* ===============================
   BOOTSTRAP CONTAINER WIDTH
=============================== */

.container,
.container-sm,
.container-md,
.container-lg,
.container-xl,
.container-xxl {
    width: 100%;
    min-width: 0;
    max-width: var(--site-container-max) !important;
}

/* ===============================
   SCROLLBAR
=============================== */

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* ===============================
   UTILITIES
=============================== */

.card-soft {
    border: 0;
    box-shadow: var(--shadow-md);
    border-radius: var(--radius-md);
}

.divider {
    height: 1px;
    background: rgba(0, 0, 0, 0.06);
    margin: 0.75rem 0 1rem;
}

.accent-line {
    width: 60px;
    height: 3px;
    background-color: var(--brand-color, #0d6efd);
    margin-top: 1rem;
}

/* ===============================
   SKELETONS
=============================== */

.while-loading {
    display: none;
}

.htmx-request .while-loading {
    display: block;
}

.skeleton {
    position: relative;
    overflow: hidden;
    background: linear-gradient(90deg, #f2f3f5 25%, #f8f9fb 37%, #f2f3f5 63%);
    background-size: 400% 100%;
    animation: sk 1.4s ease infinite;
}

.skeleton-line {
    height: 140px;
    border-radius: 12px;
    margin-bottom: 8px;
}

@keyframes sk {
    0% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0 50%;
    }
}

/* ===============================
   NAVBAR OVER HERO
=============================== */

#mainNav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    min-height: 64px;
    background: transparent;
    border-bottom: 1px solid transparent;
    transition:
        background-color 0.25s ease,
        box-shadow 0.25s ease,
        border-color 0.25s ease;
}

#mainNav .navbar-brand,
#mainNav .nav-link {
    color: #fff !important;
}

#mainNav .navbar-toggler {
    color: #fff !important;
}

#mainNav.navbar-scrolled {
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    border-bottom-color: rgba(0, 0, 0, 0.06);
}

#mainNav.navbar-scrolled .navbar-brand,
#mainNav.navbar-scrolled .nav-link {
    color: #212529 !important;
}

#mainNav.navbar-scrolled .nav-link.active {
    color: var(--brand-color, #0062ff) !important;
}

#mainNav.navbar-scrolled .navbar-toggler {
    color: #212529 !important;
}

#mainNav .navbar-brand {
    font-size: 1.1rem;
    line-height: 1;
}

#mainNav .brand-mark {
    width: 32px;
    height: 32px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.14);
}

#mainNav .brand-tagline {
    font-size: 0.72rem;
    letter-spacing: 0.04em;
}

#mainNav.navbar-scrolled .brand-mark,
.surface-nav-page #mainNav .brand-mark {
    border-color: rgba(var(--bs-primary-rgb), 0.14);
    background: rgba(var(--bs-primary-rgb), 0.08);
    color: var(--brand-color);
}

.surface-nav-page #mainNav {
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom-color: var(--color-border);
    box-shadow: var(--shadow-sm);
}

.surface-nav-page #mainNav .navbar-brand,
.surface-nav-page #mainNav .nav-link,
.surface-nav-page #mainNav .navbar-toggler {
    color: var(--color-text) !important;
}

.surface-nav-page #mainNav .nav-link.active {
    color: var(--brand-color) !important;
}

#mainNav .mobile-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-height: 40px;
    padding: 0.45rem 0.7rem !important;
    border-radius: 999px;
    font-size: 0.95rem;
    line-height: 1.1;
    text-decoration: none;
}

#mainNav .mobile-nav-link:hover,
#mainNav .mobile-nav-link:focus {
    background: rgba(255, 255, 255, 0.12);
    color: #fff !important;
}

#mainNav .mobile-nav-link.active {
    background: rgba(255, 255, 255, 0.16);
    color: #fff !important;
}

#mainNav.navbar-scrolled .mobile-nav-link:hover,
#mainNav.navbar-scrolled .mobile-nav-link:focus {
    background: rgba(0, 98, 255, 0.08);
    color: #111827 !important;
}

#mainNav.navbar-scrolled .mobile-nav-link.active {
    background: rgba(0, 98, 255, 0.1);
    color: var(--brand-color, #0062ff) !important;
}

#mainNav .mobile-nav-link.dropdown-toggle::after {
    margin-left: 0.15rem;
}

#mainNav .dropdown-menu {
    padding: 0.45rem;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 16px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12) !important;
}

#mainNav .dropdown-item {
    display: flex;
    align-items: center;
    min-height: 38px;
    border-radius: 12px;
    color: #111827;
    font-size: 0.94rem;
    font-weight: var(--font-weight-ui);
}

#mainNav .dropdown-item:hover,
#mainNav .dropdown-item:focus {
    background: rgba(0, 98, 255, 0.08);
    color: var(--brand-color, #0062ff);
}

/* ===============================
   MOBILE NAVBAR UX/UI
=============================== */

.navbar-brand {
    min-width: 0;
}

.navbar-toggler {
    min-width: 44px;
    min-height: 44px;
}

.navbar-toggler-line {
    display: block;
    width: 20px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
}

.mobile-nav-icon,
.mobile-nav-subtitle,
.mobile-menu-header {
    display: none;
}

@media (max-width: 991.98px) {
    body {
        overflow-x: hidden;
    }

    #mainNav {
        background: rgba(255, 255, 255, 0.96);
        backdrop-filter: blur(18px);
        -webkit-backdrop-filter: blur(18px);
        box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
        border-bottom-color: rgba(15, 23, 42, 0.08);
    }

    #mainNav .container {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) 44px;
        grid-template-rows: 64px auto;
        column-gap: 0.75rem;
        min-height: 64px;
        align-items: center !important;
    }

    #mainNav .navbar-brand {
        grid-column: 1;
        grid-row: 1;
        max-width: calc(100% - 56px);
        margin-right: 0 !important;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
        color: #111827 !important;
    }

    #mainNav .navbar-brand span {
        min-width: 0;
    }

    #mainNav .navbar-toggler {
        grid-column: 2;
        grid-row: 1;
        width: 44px;
        height: 44px;
        justify-self: end;
        margin-left: 0;
        display: inline-flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 5px;
        padding: 0;
        border-radius: 14px;
        background: rgba(0, 98, 255, 0.08);
        color: #111827 !important;
    }

    #mainNav .navbar-toggler:focus {
        box-shadow: 0 0 0 0.2rem rgba(0, 98, 255, 0.16);
    }

    #mainNav .navbar-collapse {
        grid-column: 1 / -1;
        grid-row: 2;
        width: 100%;
        margin-top: 0.75rem;
        padding: 0.25rem 0 1rem;
        border-top: 1px solid rgba(15, 23, 42, 0.08);
    }

    .mobile-menu-header {
        display: block;
    }

    .mobile-nav-list {
        width: 100%;
        gap: 0.25rem;
        align-items: stretch !important;
    }

    #mainNav .mobile-nav-link {
        gap: 0.85rem;
        min-height: 58px;
        padding: 0.75rem 0.25rem !important;
        border-radius: 16px;
        color: #111827 !important;
    }

    #mainNav .mobile-nav-link:hover,
    #mainNav .mobile-nav-link:focus {
        background: rgba(0, 98, 255, 0.08);
        color: #111827 !important;
    }

    #mainNav .mobile-nav-link.active {
        background: rgba(0, 98, 255, 0.12);
        color: #0062ff !important;
        font-weight: 700;
    }

    #mainNav .mobile-nav-link.dropdown-toggle::after {
        margin-left: auto;
        color: currentColor;
    }

    .mobile-nav-icon {
        width: 42px;
        height: 42px;
        flex: 0 0 42px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 14px;
        background: rgba(0, 98, 255, 0.08);
        color: #0062ff;
        font-size: 1.1rem;
    }

    .mobile-nav-text {
        display: flex;
        flex-direction: column;
        line-height: 1.15;
        min-width: 0;
    }

    .mobile-nav-title {
        font-size: 0.98rem;
    }

    .mobile-nav-subtitle {
        display: block;
        margin-top: 0.2rem;
        font-size: 0.78rem;
        color: #6b7280;
        font-weight: 400;
    }

    #mainNav .dropdown-menu {
        position: static;
        width: 100%;
        margin: 0.25rem 0 0.5rem;
        background: #fff;
        box-shadow: none !important;
    }
}

@media (min-width: 992px) {
    .mobile-nav-icon {
        display: none;
    }

    .mobile-nav-text {
        display: inline;
    }
}

/* ===============================
   STORIES
=============================== */

.stories-container {
    max-width: var(--site-container-max);
    margin: 40px auto;
    padding: 0 20px;
    font-family: var(--font-family-base);
}

.stories-header {
    text-align: center;
    margin-bottom: 60px;
}

.stories-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 10px;
}

.stories-subtitle {
    color: #666;
    font-style: italic;
}

.stories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 40px;
}

.story-card {
    background: #fff;
    transition: transform 0.3s ease;
}

.story-card:hover {
    transform: translateY(-5px);
}

.story-image {
    width: 100%;
    height: 250px;
    object-fit: cover;
    border-radius: 4px;
}

.story-meta {
    margin-top: 15px;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #888;
}

.story-card-title {
    margin: 10px 0;
    font-size: 1.6rem;
    line-height: 1.2;
}

.story-card-title a {
    text-decoration: none;
    color: #1a1a1a;
}

.story-card-title a:hover {
    color: #0056b3;
}

.story-description {
    color: #444;
    line-height: 1.6;
    font-size: 0.95rem;
}

/* ===============================
   LOGIN
=============================== */

.login-section {
    min-height: 60vh;
}

.login-form-fields input {
    display: block;
    width: 100%;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: #212529;
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    transition:
        border-color 0.15s ease-in-out,
        box-shadow 0.15s ease-in-out;
}

.login-form-fields input:focus {
    color: #212529;
    background-color: #fff;
    border-color: #86b7fe;
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* ===============================
   LEGACY PAGE HELPERS
=============================== */

.about-hero-img {
    height: 300px;
    background-size: cover;
    background-position: center;
}

.category-hero-img {
    min-height: 300px;
}

.item-card-img {
    min-height: 180px;
}

.list-card-hover {
    transition: transform 0.2s ease-in-out;
}

.list-card-hover:hover {
    transform: translateY(-3px);
}

.category-card-img-wrapper {
    height: 160px;
    overflow: hidden;
}
.ritm-card-primary-link::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
}

.ritm-card-primary-link:focus-visible::after {
    outline: 3px solid rgba(13, 110, 253, 0.35);
    outline-offset: -3px;
}

.favorite-toggle {
    position: relative;
    z-index: 5;
}
