/* ===== Dark theme base ===== */

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

:root {
    --bg: #0f0f13;
    --bg-card: #1a1a24;
    --bg-elevated: #242433;
    --text: #e0e0e8;
    --text-muted: #8888a0;
    --accent: #7c5ce7;
    --accent-hover: #9478f0;
    --border: #2a2a3a;
    --radius: 12px;
}

html {
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
        Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--accent);
    text-decoration: none;
}

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

/* ===== Header ===== */

header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
}

header h1 {
    font-size: 1.4rem;
    font-weight: 700;
}

header h1 a {
    color: var(--text);
    text-decoration: none;
}

header .subtitle {
    color: var(--text-muted);
    font-size: 0.85rem;
}

nav .back-link {
    font-size: 0.9rem;
    color: var(--text-muted);
    transition: color 0.15s;
}

nav .back-link:hover {
    color: var(--text);
}

/* ===== Main content ===== */

main {
    flex: 1;
    padding: 1.5rem;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

/* ===== User grid (index) ===== */

.user-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.25rem;
}

.user-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    transition: transform 0.15s, border-color 0.15s;
    display: flex;
    flex-direction: column;
}

.user-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
}

.card-thumb {
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: var(--bg-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-thumb.placeholder span {
    font-size: 2.5rem;
    opacity: 0.4;
}

.card-info {
    padding: 0.75rem 1rem;
}

.card-info h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

.card-info .username {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.card-info .count {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* ===== Profile page ===== */

.profile-header {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--bg-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    flex-shrink: 0;
}

.profile-info h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.15rem;
}

.profile-info .username {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.profile-info .bio {
    color: var(--text);
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
    max-width: 500px;
}

.profile-info .stats {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.profile-info .stats strong {
    color: var(--text);
}

/* ===== Media grid ===== */

.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

.media-item {
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--bg-card);
    transition: transform 0.15s;
}

.media-item:hover {
    transform: translateY(-2px);
}

.media-item img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    display: block;
}

.video-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.video-placeholder {
    aspect-ratio: 1 / 1;
    background: var(--bg-elevated);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.video-placeholder span {
    font-size: 2rem;
}

.video-placeholder p {
    font-size: 0.8rem;
    color: var(--text-muted);
    word-break: break-all;
    padding: 0 0.5rem;
    text-align: center;
}

/* ===== Empty state ===== */

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* ===== Footer ===== */

footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 1rem 1.5rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* ===== Responsive ===== */

@media (max-width: 600px) {
    main {
        padding: 1rem;
    }

    .user-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 0.75rem;
    }

    .media-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 0.5rem;
    }

    .profile-header {
        gap: 1rem;
    }

    .profile-avatar {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }

    .profile-info h2 {
        font-size: 1.25rem;
    }
}
