/**
 * Site-wide visual refresh — tokens, surfaces, navigation, cards, forms.
 * Loaded after style.css; overrides design tokens and polishes core UI.
 */

:root {
    --bg: #08090e;
    --surface: #12141c;
    --surface-2: #1a1e2a;
    --surface-elevated: #1e2230;
    --text: #f4f6fc;
    --muted: #9aa3bd;
    --accent: #6b8cff;
    --accent-2: #9b7bff;
    --accent-gradient: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
    --border: color-mix(in oklab, #3d4660 55%, transparent);
    --border-subtle: color-mix(in oklab, var(--border) 65%, transparent);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-pill: 999px;
    --shadow-sm: 0 1px 2px color-mix(in oklab, #000 35%, transparent);
    --shadow-md: 0 8px 28px color-mix(in oklab, #000 42%, transparent);
    --shadow-lg: 0 18px 48px color-mix(in oklab, #000 48%, transparent);
    --shadow-glow: 0 0 0 1px color-mix(in oklab, var(--accent) 22%, transparent),
        0 12px 32px color-mix(in oklab, var(--accent) 18%, transparent);
    --focus-ring: 0 0 0 3px color-mix(in oklab, var(--accent) 28%, transparent);
}

body.light {
    --bg: #f3f5fb;
    --surface: #ffffff;
    --surface-2: #eef2fb;
    --surface-elevated: #ffffff;
    --text: #0c1222;
    --muted: #5c657d;
    --accent: #3d5ce8;
    --accent-2: #6b4fe8;
    --border: color-mix(in oklab, #c5cee4 85%, transparent);
    --border-subtle: color-mix(in oklab, var(--border) 70%, transparent);
    --shadow-sm: 0 1px 3px rgba(12, 18, 34, 0.06);
    --shadow-md: 0 10px 32px rgba(12, 18, 34, 0.08);
    --shadow-lg: 0 20px 48px rgba(12, 18, 34, 0.1);
    --shadow-glow: 0 0 0 1px color-mix(in oklab, var(--accent) 15%, transparent),
        0 12px 28px color-mix(in oklab, var(--accent) 12%, transparent);
}

body {
    font-size: 15px;
    line-height: 1.55;
    font-feature-settings: "kern" 1, "liga" 1;
    background-color: var(--bg);
    background-image:
        radial-gradient(ellipse 120% 80% at 0% -20%, color-mix(in oklab, var(--accent) 14%, transparent), transparent 55%),
        radial-gradient(ellipse 90% 60% at 100% 0%, color-mix(in oklab, var(--accent-2) 10%, transparent), transparent 50%);
    background-attachment: fixed;
}

body.light {
    background-image:
        radial-gradient(ellipse 100% 70% at 0% -10%, color-mix(in oklab, var(--accent) 8%, transparent), transparent 50%),
        radial-gradient(ellipse 80% 50% at 100% 0%, color-mix(in oklab, var(--accent-2) 6%, transparent), transparent 45%);
}

.site-main {
    padding: 28px 0 56px;
}

.container > h1,
.container > h1:first-child {
    margin: 0 0 18px;
    font-size: clamp(1.45rem, 2.8vw, 2.05rem);
    font-weight: 800;
    letter-spacing: -0.035em;
    line-height: 1.15;
}

/* —— Header —— */
.site-header {
    border-bottom-color: var(--border-subtle);
    background: color-mix(in oklab, var(--bg) 72%, transparent);
    backdrop-filter: blur(16px) saturate(140%);
    box-shadow: var(--shadow-sm);
}

.logo {
    font-size: 1.05rem;
    letter-spacing: 0.1em;
}

.logo span {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.nav-search {
    --nav-search-height: 40px;
    gap: 8px;
    padding: 0;
    border: none;
    background: transparent;
    box-shadow: none;
    align-items: center;
}

.nav-search input[type="search"] {
    flex: 1;
    min-width: 110px;
    max-width: min(360px, 50vw);
    height: var(--nav-search-height);
    min-height: var(--nav-search-height);
    padding: 0 16px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-pill);
    background: color-mix(in oklab, var(--surface) 70%, transparent);
    font-size: 14px;
    color: var(--text);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.nav-search input[type="search"]::placeholder {
    color: color-mix(in oklab, var(--muted) 90%, transparent);
}

.nav-search input[type="search"]:hover {
    border-color: color-mix(in oklab, var(--accent) 22%, var(--border));
    background: color-mix(in oklab, var(--surface) 88%, transparent);
}

.nav-search input[type="search"]:focus {
    outline: none;
    border-color: color-mix(in oklab, var(--accent) 48%, var(--border));
    background: var(--surface);
    box-shadow: var(--focus-ring);
}

.nav-search:focus-within {
    border: none;
    box-shadow: none;
}

.nav-search-submit.btn.primary {
    flex-shrink: 0;
    width: var(--nav-search-height);
    height: var(--nav-search-height);
    min-height: var(--nav-search-height);
    margin: 0;
    padding: 0;
    gap: 0;
    border: none;
    border-radius: var(--radius-pill);
    background: var(--accent-gradient);
    color: #fff;
    box-shadow:
        inset 0 1px 0 color-mix(in oklab, #fff 24%, transparent),
        0 2px 10px color-mix(in oklab, var(--accent) 28%, transparent);
    transition: transform 0.14s ease, box-shadow 0.14s ease, filter 0.14s ease;
}

.nav-search-submit.btn.primary:hover {
    filter: brightness(1.07) saturate(1.06);
    box-shadow:
        inset 0 1px 0 color-mix(in oklab, #fff 30%, transparent),
        0 6px 16px color-mix(in oklab, var(--accent) 42%, transparent);
}

.nav-search-submit.btn.primary:active {
    transform: scale(0.94);
    filter: brightness(0.96);
}

.nav-search-submit.btn--fa > i:first-child {
    margin: 0;
    font-size: 14px;
    line-height: 1;
    opacity: 1;
}

.nav-search-submit__label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (min-width: 1280px) {
    .nav-search-submit.btn.primary {
        width: auto;
        min-width: 4.35rem;
        height: var(--nav-search-height);
        min-height: var(--nav-search-height);
        padding: 0 15px 0 14px;
        gap: 7px;
    }

    .nav-search-submit__label {
        position: static;
        width: auto;
        height: auto;
        margin: 0;
        overflow: visible;
        clip: auto;
        white-space: nowrap;
        font-size: 13px;
        font-weight: 700;
        letter-spacing: 0.03em;
    }
}

.nav-link {
    border-radius: var(--radius-pill);
    font-size: 13px;
    font-weight: 600;
}

.nav-link.is-active {
    color: var(--text);
    background: color-mix(in oklab, var(--accent) 14%, var(--surface-2));
    box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--accent) 28%, var(--border));
}

.nav-account-trigger,
.nav-lang-dd__summary {
    border-radius: var(--radius-pill);
}

.nav-lang-dd__panel,
.nav-account-panel {
    border-radius: var(--radius-lg);
    border-color: var(--border-subtle);
    box-shadow: var(--shadow-lg);
}

.nav-toggle {
    border-radius: var(--radius-md);
}

/* —— Buttons —— */
.btn {
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 14px;
    padding: 9px 14px;
    border-color: var(--border-subtle);
    background: var(--surface-elevated);
}

.btn.primary {
    background: var(--accent-gradient);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 2px 10px color-mix(in oklab, var(--accent) 32%, transparent);
}

.btn.primary:hover {
    filter: brightness(1.08);
    box-shadow: var(--shadow-glow);
}

.btn.ghost {
    background: transparent;
}

/* —— Cards & grid —— */
.grid {
    gap: 18px;
    grid-template-columns: repeat(auto-fill, minmax(248px, 1fr));
}

.card {
    border-radius: var(--radius-lg);
    border-color: var(--border-subtle);
    background: color-mix(in oklab, var(--surface) 96%, var(--surface-2));
    box-shadow: var(--shadow-sm);
}

@media (prefers-reduced-motion: no-preference) {
    .card:hover {
        border-color: color-mix(in oklab, var(--accent) 38%, var(--border));
        box-shadow: var(--shadow-md);
        transform: translateY(-3px);
    }
}

.card-cover {
    border-bottom-color: var(--border-subtle);
}

.card-body {
    padding: 14px 15px 15px;
}

.card.leak-card .leak-card__title {
    font-size: 0.98rem;
    letter-spacing: -0.02em;
}

.card.leak-card .leak-card__stats {
    border-top-color: var(--border-subtle);
}

.card.leak-card .leak-card__stat {
    border-radius: var(--radius-sm);
    background: color-mix(in oklab, var(--surface-2) 80%, transparent);
}

/* —— Home & sections —— */
.home-section__title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.home-section__title:not(.home-section__title--trending):not(.home-section__title--liked)::before {
    content: "";
    width: 4px;
    height: 1.1em;
    border-radius: 4px;
    background: var(--accent-gradient);
    flex-shrink: 0;
}

.home-section__title--trending::before,
.home-section__title--liked::before {
    display: none;
}

.home-section__title--liked .home-section__title-icon {
    color: #f472b6;
}

.home-section + .home-section {
    margin-top: 40px;
    padding-top: 8px;
}

.filters {
    gap: 10px;
}

.leaks-filters,
.filters.home-actions {
    padding: 12px 14px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    background: color-mix(in oklab, var(--surface) 92%, transparent);
    box-shadow: var(--shadow-sm);
}

.filters.home-actions {
    margin-bottom: 20px;
}

/* —— Forms —— */
input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]),
select,
textarea {
    border-radius: var(--radius-md);
    border-color: var(--border-subtle);
    background: color-mix(in oklab, var(--surface-2) 88%, var(--surface));
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]):focus,
select:focus,
textarea:focus {
    border-color: color-mix(in oklab, var(--accent) 50%, var(--border));
    box-shadow: var(--focus-ring);
    outline: none;
}

.leaks-filters select {
    min-height: 40px;
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 500;
}

.meta {
    font-size: 13px;
    line-height: 1.5;
}

.meta a {
    color: var(--accent);
    font-weight: 600;
}

.meta a:hover {
    color: var(--accent-2);
}

/* —— Hero & panels —— */
.hero {
    border-radius: var(--radius-xl);
    border-color: var(--border-subtle);
    padding: clamp(28px, 5vw, 42px);
    background:
        linear-gradient(145deg, color-mix(in oklab, var(--accent) 12%, var(--surface)), var(--surface-2));
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.hero::after {
    content: "";
    position: absolute;
    inset: -40% -20% auto auto;
    width: 55%;
    height: 120%;
    background: radial-gradient(circle, color-mix(in oklab, var(--accent-2) 18%, transparent), transparent 68%);
    pointer-events: none;
}

.hero h1 {
    position: relative;
    letter-spacing: -0.04em;
    font-weight: 800;
}

.hero p {
    position: relative;
}

/* —— Footer —— */
.site-footer {
    border-top-color: var(--border-subtle);
    background: color-mix(in oklab, var(--surface) 55%, var(--bg));
    backdrop-filter: blur(12px);
}

.footer-logo span {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* —— Auth & upload shells —— */
.auth-card-head {
    background: linear-gradient(
        155deg,
        color-mix(in oklab, var(--accent) 16%, var(--surface)),
        color-mix(in oklab, var(--accent-2) 6%, var(--surface)) 40%,
        var(--surface) 100%
    );
}

.auth-shell .auth-card.card,
.upload-shell .upload-card.card {
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
}

/* —— Pagination —— */
.pagination {
    margin-top: 28px;
    padding: 10px 12px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    background: color-mix(in oklab, var(--surface) 90%, transparent);
}

.pagination .pagination__num.btn.primary {
    box-shadow: var(--shadow-glow);
}

/* —— Profile & user cards —— */
.user-card {
    transition: border-color 0.15s ease, box-shadow 0.18s ease, transform 0.15s ease;
}

@media (prefers-reduced-motion: no-preference) {
    .user-card:hover {
        border-color: color-mix(in oklab, var(--accent) 38%, var(--border));
        box-shadow: var(--shadow-md);
        transform: translateY(-2px);
    }
}

/* —— FAQ —— */
.faq-list .card,
.faq-list details {
    border-radius: var(--radius-lg);
}

.leak-header h1 {
    letter-spacing: -0.035em;
}

.thumb-grid .thumb {
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-subtle);
}

/* —— Error pages —— */
.opleak-error-page.card {
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
}

@media (max-width: 900px) {
    .nav-search input[type="search"] {
        max-width: none;
        min-width: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .card:hover,
    .user-card:hover {
        transform: none;
    }
}
