/* Shared polish for the existing indigo, glass and muted-gold visual language. */
:root {
    --focus-ring: #f4d66f;
    --glass-surface: rgba(26, 26, 46, 0.78);
    --glass-surface-hover: rgba(34, 34, 56, 0.87);
    --content-width: 1160px;
    --readable-glass: rgba(26, 26, 46, 0.82);
    color-scheme: dark;
}

[data-theme="light"] {
    --focus-ring: #765711;
    --glass-surface: rgba(250, 249, 255, 0.88);
    --glass-surface-hover: rgba(255, 255, 255, 0.95);
    --readable-glass: rgba(250, 249, 255, 0.94);
    color-scheme: light;
}

.welcome-content .enter-btn, .back-to-top svg { color: #282318; }
.donate-card { color: inherit; text-decoration: none; }
[data-theme="dark"] .toggle-ball { transform: translateX(28px) !important; }
@media (max-width: 768px) {
    [data-theme="dark"] .toggle-ball { transform: translateX(23px) !important; }
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 7rem;
}

body {
    min-height: 100dvh;
    line-height: 1.55;
}

button,
input,
select {
    font: inherit;
}

button,
a,
[role="button"] {
    -webkit-tap-highlight-color: transparent;
}

.skip-link {
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 2000;
    padding: 0.75rem 1rem;
    transform: translateY(-160%);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    background: var(--secondary-bg);
    color: var(--text-color);
    text-decoration: none;
}

.skip-link:focus {
    transform: translateY(0);
}

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

:focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 3px;
}

input:focus-visible,
select:focus-visible {
    outline-offset: 2px;
}

.glass-nav {
    width: min(calc(100% - 2rem), 1240px);
    max-width: none;
    padding: 0.7rem clamp(0.85rem, 2.2vw, 1.75rem);
    border-width: 1px;
    background: color-mix(in srgb, var(--primary-bg) 55%, var(--glass-bg));
}

.nav-container {
    gap: clamp(0.65rem, 2vw, 1.5rem);
}

.nav-menu {
    gap: clamp(0.3rem, 1vw, 0.9rem);
}

.nav-menu a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0.5rem clamp(0.65rem, 1.2vw, 1rem);
    white-space: nowrap;
}

.nav-menu a::after {
    bottom: 0.15rem;
}

.nav-menu a:focus-visible {
    outline-offset: 1px;
}

.nav-logo img {
    display: block;
    object-fit: cover;
}

.theme-toggle {
    flex: 0 0 auto;
}

.resources-main,
.profile-main {
    min-height: 100dvh;
    padding: clamp(7.5rem, 13vh, 9rem) 1.25rem 4rem;
}

.resources-container {
    max-width: var(--content-width);
    padding: 0;
}

.resources-header {
    margin-bottom: clamp(1.5rem, 4vw, 2.75rem);
}

.resources-title,
.profile-title {
    font-size: clamp(2rem, 4vw, 3rem);
    line-height: 1.15;
    text-wrap: balance;
}

.resources-subtitle,
.profile-subtitle {
    line-height: 1.7;
    text-wrap: pretty;
}

.resources-list {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
    gap: clamp(1rem, 2.4vw, 1.6rem);
}

.resource-card,
.resource-item,
.social-card,
.donate-card {
    border-width: 1px;
    background: var(--glass-surface);
    box-shadow: 0 12px 32px var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.resource-card,
.resource-item,
.social-card {
    transition: transform 220ms ease, border-color 220ms ease, background 220ms ease, box-shadow 220ms ease;
}

.resource-card:hover,
.resource-item:hover,
.social-card:hover,
.donate-card:hover {
    transform: translateY(-4px);
    border-color: rgba(var(--accent-color-rgb), 0.62);
    background: var(--glass-surface-hover);
}

.resource-search-container {
    min-height: 50px;
    border-color: var(--glass-border);
    background: var(--glass-surface);
    transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.resource-search-container:focus-within {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(var(--accent-color-rgb), 0.2);
}

#resourceSearchInput,
#softwareSearchInput {
    min-height: 34px;
    font-size: 1rem;
}

#resourceSearchInput::placeholder,
#softwareSearchInput::placeholder {
    opacity: 0.68;
}

.resource-item .resource-btn,
.social-btn,
.enter-btn,
.btn-back {
    min-height: 44px;
}

.resource-item .resource-btn,
.social-btn {
    color: #282318;
    font-weight: 650;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.18);
}

.resource-item .resource-btn:not(.disabled):hover,
.social-btn:hover,
.enter-btn:hover {
    filter: brightness(1.08);
}

.profile-main {
    align-items: flex-start;
}

.profile-container {
    max-width: 900px;
}

.profile-header {
    margin-bottom: clamp(2rem, 5vw, 3.5rem);
}

.social-links {
    gap: clamp(1rem, 2.5vw, 1.5rem);
}

.social-card {
    min-height: 170px;
    border-radius: 18px;
    padding: clamp(1.25rem, 3vw, 2rem);
}

.donate-container,
.payment-container {
    width: min(100%, 860px);
}

.donate-card {
    border-radius: 18px;
    transition: transform 220ms ease, border-color 220ms ease, background 220ms ease, box-shadow 220ms ease;
}

.donate-card:focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 4px;
}

.payment-qr img,
.qr-code {
    background: #fff;
    padding: 0.55rem;
}

.back-to-top {
    right: max(1.25rem, env(safe-area-inset-right));
    bottom: max(1.25rem, env(safe-area-inset-bottom));
    color: #282318;
}

.welcome-screen {
    height: 100dvh;
}

@media (max-width: 900px) {
    .glass-nav {
        width: min(calc(100% - 1.5rem), 1240px);
        top: 0.75rem;
    }

    .nav-menu {
        gap: 0.15rem;
    }

    .nav-menu a {
        padding-inline: 0.55rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 680px) {
    .glass-nav {
        top: max(0.5rem, env(safe-area-inset-top));
        width: calc(100% - 1rem);
        padding: 0.6rem 0.8rem;
        border-radius: 17px;
    }

    .nav-container {
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
        gap: 0.4rem 0.65rem;
    }

    .nav-logo {
        order: 1;
    }

    .nav-logo img {
        width: 36px;
        height: 36px;
    }

    .nav-container > .theme-toggle,
    .nav-container > .language-selector {
        order: 2;
        margin-left: auto;
    }

    .nav-menu {
        order: 3;
        flex: 1 0 100%;
        justify-content: space-between;
        gap: 0.2rem;
        min-width: 0;
        overflow-x: auto;
        scrollbar-width: none;
        padding: 0.15rem 0 0.05rem;
    }

    .nav-menu::-webkit-scrollbar {
        display: none;
    }

    .nav-menu a {
        min-height: 40px;
        padding: 0.4rem 0.55rem;
        font-size: 0.86rem;
    }

    .resources-main,
    .profile-main {
        padding: 8.5rem 1rem 3rem;
    }

    .resources-container,
    .profile-container {
        width: 100%;
    }

    .resources-list {
        grid-template-columns: minmax(0, 1fr);
        gap: 1rem;
    }

    .resource-item {
        flex-direction: row;
        text-align: left;
        gap: 0.9rem;
    }

    .resource-item .resource-icon {
        width: 48px;
        height: 48px;
    }

    .resource-item .resource-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .resource-item .resource-actions {
        justify-content: flex-start;
    }

    .social-links {
        grid-template-columns: minmax(0, 1fr);
    }

    .social-card {
        min-height: 0;
    }
}

@media (max-width: 420px) {
    .nav-menu a {
        padding-inline: 0.38rem;
        font-size: 0.8rem;
    }

    .resources-main,
    .profile-main {
        padding-inline: 0.85rem;
    }

    .resource-item {
        padding: 1rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }

    #particles-js {
        display: none;
    }
}
