/* =========================================================
   ZYB Maillot — Design System
   ========================================================= */

/* ---------------------------------------------------------
   1. Design Tokens
   --------------------------------------------------------- */
:root {
    --bg: #FAFAF8;
    --text: #1A1A18;
    --muted: #8A8A82;
    --surface: #F0F0EC;
    --surface-alt: #F5F5F2;
    --border: #E8E8E4;
    --border-strong: #E0E0DC;
    --accent: #E8432A;
    --twitch: #6441A4;

    --font-display: 'Space Grotesk', sans-serif;
    --font-body: 'Inter', sans-serif;

    --section-gap: 56px;
    --group-gap: 22px;
    --element-gap: 10px;
    --page-padding: 32px;
}

/* ---------------------------------------------------------
   2. Reset & Base
   --------------------------------------------------------- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img {
    max-width: 100%;
    display: block;
}

a {
    color: inherit;
}

/* ---------------------------------------------------------
   3. Typography
   --------------------------------------------------------- */
h1,
h2,
h3 {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: -0.02em;
}

h4,
h5,
h6 {
    font-family: var(--font-display);
    font-weight: 600;
}

.label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
    font-weight: 600;
}

/* ---------------------------------------------------------
   4. Layout
   --------------------------------------------------------- */
.page-container {
    max-width: 1312px;
    margin: 0 auto;
    padding: 0 var(--page-padding);
}

.section {
    margin-bottom: var(--section-gap);
}

/* ---------------------------------------------------------
   5. Nav Bar
   --------------------------------------------------------- */
.nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.nav-inner {
    max-width: 1312px;
    margin: 0 auto;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    height: 78px;
    padding: 0 var(--page-padding);
}

.nav-logo {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.125rem;
    text-decoration: none;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 0.02em;
}

.nav-logo-icon {
    display: block;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    flex-shrink: 0;
    object-fit: contain;
}

.nav-links {
    display: flex;
    flex-direction: row;
    gap: 32px;
    align-items: center;
}

.nav-link {
    text-decoration: none;
    color: var(--muted);
    font-weight: 500;
    font-size: 0.9375rem;
    transition: color 0.15s;
}

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

.nav-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.nav-user {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text);
    font-weight: 500;
}

.nav-auth {
    display: flex;
    flex-direction: row;
    align-items: center;
}

/* ---------------------------------------------------------
   6. Buttons
   --------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s;
    border: none;
    text-decoration: none;
    font-family: var(--font-body);
    line-height: 1;
    gap: 12px;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: #d03a23;
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--border-strong);
    color: var(--text);
}

.btn-secondary:hover {
    background: var(--surface);
}

.btn-twitch {
    background: var(--twitch);
    color: white;
}

.btn-twitch:hover {
    background: #5535a0;
}

.btn-voted {
    background: var(--accent);
    color: white;
    opacity: 0.8;
}

.btn-large {
    padding: 14px 28px;
    font-size: 1rem;
    border-radius: 10px;
}

.btn-full {
    width: 100%;
}

.btn-link {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    text-decoration: underline;
    font-family: var(--font-body);
    font-size: inherit;
    padding: 0;
}

/* ---------------------------------------------------------
   7. Hero Section
   --------------------------------------------------------- */
.hero {
    display: flex;
    gap: 48px;
    padding: 48px 0 56px;
    align-items: flex-start;
}

.hero-content {
    flex: 1;
}

.hero-title {
    font-size: 44px;
    line-height: 48px;
    letter-spacing: -0.03em;
    margin-bottom: 16px;
}

.hero-subtitle {
    color: var(--muted);
    font-size: 1rem;
    margin-bottom: 28px;
    max-width: 400px;
    line-height: 1.5;
}

.hero-sidebar {
    width: 420px;
    flex-shrink: 0;
}

/* ---------------------------------------------------------
   8. Stats — inline below hero CTA
   --------------------------------------------------------- */
.hero-stats {
    margin-top: 40px;
}

.hero-stats-row {
    display: flex;
    align-items: baseline;
    gap: 32px;
}

.hero-stat {
    display: flex;
    flex-direction: column;
}

.hero-stat-number {
    font-family: var(--font-display);
    font-size: 2.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1;
    color: var(--text);
}

.hero-stat-label {
    font-size: 0.8125rem;
    color: var(--muted);
    margin-top: 4px;
}

/* Old stats-panel (kept for /stats endpoint fallback) */
.stats-panel {
    display: flex;
    gap: 32px;
    padding: 24px;
    background: var(--surface);
    border-radius: 12px;
    margin-bottom: 24px;
}

.stat {
    text-align: center;
    flex: 1;
}

.stat-number {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    display: block;
}

.stat-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
}

/* ---------------------------------------------------------
   9. Live Activity Feed Panel
   --------------------------------------------------------- */
.live-feed {
    background: var(--surface-alt);
    border-radius: 14px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.live-feed-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.live-feed-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
}

.live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    flex-shrink: 0;
}

.live-feed-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text);
}

.live-feed-time {
    font-size: 0.8125rem;
    color: var(--muted);
}

/* ---------------------------------------------------------
   10. Section Headers
   --------------------------------------------------------- */
.section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: var(--group-gap);
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
}

.section-header-left {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.section-title {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 34px;
    color: var(--text);
}

.section-subtitle {
    font-size: 0.875rem;
    color: var(--muted);
}

.section-link {
    font-size: 0.875rem;
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.section-link:hover {
    text-decoration: underline;
}

/* ---------------------------------------------------------
   11. Jersey Cards
   --------------------------------------------------------- */
.jersey-card {
    display: block;
    text-decoration: none;
    color: var(--text);
    transition: transform 0.2s;
}

.jersey-card:hover {
    transform: translateY(-2px);
}

.jersey-card:hover .jersey-card-img {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.jersey-card-visual {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
}

.jersey-card-img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    background: var(--surface);
    transition: box-shadow 0.2s;
    display: block;
}

.jersey-card-placeholder {
    width: 100%;
    aspect-ratio: 4 / 3;
    background: linear-gradient(135deg, #2a2a2a 0%, #4a4a4a 50%, #3a3a3a 100%);
    border-radius: 12px;
}

.jersey-card-badge {
    position: absolute;
    bottom: 16px;
    left: 16px;
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 20px;
    padding: 6px 12px;
    color: white;
    font-size: 0.8125rem;
    font-weight: 600;
}

.jersey-card-info {
    padding-top: 12px;
}

.jersey-card-name {
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--font-body);
    margin-bottom: 4px;
}

.jersey-card-author {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8125rem;
    color: var(--muted);
}

.jersey-card-author-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--twitch);
    flex-shrink: 0;
}

.jersey-card-author-name {
    color: var(--muted);
}

.jersey-card-votes {
    font-size: 0.875rem;
    color: var(--muted);
}

/* ---------------------------------------------------------
   12. Jersey Grid
   --------------------------------------------------------- */
.jersey-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--group-gap);
}

/* ---------------------------------------------------------
   13. Jersey Featured Layout
   --------------------------------------------------------- */
.jersey-featured {
    display: flex;
    gap: var(--group-gap);
}

.featured-main {
    flex: 1;
}

.featured-main .jersey-card-img {
    aspect-ratio: auto;
    min-height: 400px;
}

.featured-side {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--group-gap);
}

/* ---------------------------------------------------------
   14. Jersey Detail
   --------------------------------------------------------- */
.jersey-detail {
    display: flex;
    gap: 48px;
    padding: 32px 0;
}

.jersey-detail-left {
    flex: 1;
}

.jersey-detail-right {
    width: 400px;
    flex-shrink: 0;
}

.jersey-main-image {
    width: 100%;
    border-radius: 12px;
}

.back-link {
    display: inline-block;
    margin-bottom: 24px;
    color: var(--muted);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.15s;
}

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

.badge {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    background: var(--surface);
    padding: 6px 12px;
    border-radius: 4px;
    font-weight: 600;
    display: inline-block;
    margin-bottom: 16px;
}

.badge-twitch {
    background: var(--twitch);
    color: white;
}

.jersey-name {
    font-size: 2rem;
    margin-bottom: 16px;
}

/* ---------------------------------------------------------
   15. Creator Info
   --------------------------------------------------------- */
.creator-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.creator-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.creator-username {
    font-weight: 600;
}

.creator-x {
    color: var(--muted);
    font-size: 0.875rem;
}

/* ---------------------------------------------------------
   16. Jersey Detail Stats (row layout)
   --------------------------------------------------------- */
.detail-rank {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent);
    font-weight: 600;
    display: block;
    margin-bottom: 8px;
}

.jersey-stats-list {
    margin-bottom: 24px;
}

.jersey-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.jersey-stat-row:first-child {
    border-top: 1px solid var(--border);
}

.jersey-stat-value {
    font-weight: 700;
}

.jersey-stat-label {
    font-size: 0.875rem;
    color: var(--muted);
}

.creator-avatar-dot {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0;
}

.jersey-description {
    color: var(--muted);
    font-size: 0.9375rem;
    line-height: 1.6;
    margin-bottom: 24px;
}

/* ---------------------------------------------------------
   17. Vote Section
   --------------------------------------------------------- */
#vote-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.vote-count {
    font-size: 0.875rem;
    color: var(--muted);
}

/* ---------------------------------------------------------
   18. Thumbnail Strip
   --------------------------------------------------------- */
.thumbnail-strip {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.thumbnail {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0.6;
    border: 2px solid transparent;
    transition: opacity 0.15s, border-color 0.15s;
}

.thumbnail:hover {
    opacity: 0.85;
}

.thumbnail.active {
    opacity: 1;
    border-color: var(--accent);
}

/* ---------------------------------------------------------
   19. Activity Feed Items
   --------------------------------------------------------- */
.activity-feed {
    /* container */
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-avatar-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    flex-shrink: 0;
}

.activity-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.activity-text {
    font-size: 0.875rem;
    line-height: 1.4;
    flex: 1;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.activity-text a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.activity-text a:hover {
    text-decoration: underline;
}

.activity-time {
    font-size: 0.8125rem;
    color: var(--muted);
    flex-shrink: 0;
}

.activity-empty {
    color: var(--muted);
    font-size: 0.875rem;
    padding: 16px 0;
}

/* ---------------------------------------------------------
   20. Forms
   --------------------------------------------------------- */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: flex;
    justify-content: space-between;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 0.875rem;
}

.form-label-hint {
    font-weight: 400;
    color: var(--muted);
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    font-size: 1rem;
    font-family: var(--font-body);
    background: white;
    color: var(--text);
    transition: border-color 0.15s, box-shadow 0.15s;
    -webkit-appearance: none;
    appearance: none;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(232, 67, 42, 0.1);
}

.form-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    font-size: 1rem;
    font-family: var(--font-body);
    background: white;
    color: var(--text);
    resize: vertical;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(232, 67, 42, 0.1);
}

.form-hint {
    font-size: 0.75rem;
    color: var(--muted);
    margin-top: 4px;
}

.form-disclaimer {
    font-size: 0.75rem;
    color: var(--muted);
    margin-top: 16px;
}

.error-message {
    color: var(--accent);
    font-size: 0.875rem;
    margin-top: 4px;
}

.success-message {
    color: #22c55e;
    font-size: 0.875rem;
    margin-top: 8px;
}

/* ---------------------------------------------------------
   21. Input Prefix
   --------------------------------------------------------- */
.input-prefix {
    display: flex;
}

.input-prefix-icon {
    padding: 10px 0 10px 14px;
    background: white;
    border: 1px solid var(--border-strong);
    border-right: none;
    border-radius: 8px 0 0 8px;
    color: var(--muted);
    font-size: 1rem;
    display: flex;
    align-items: center;
}

.input-prefix-text {
    padding: 10px 0 10px 14px;
    background: white;
    border: 1px solid var(--border-strong);
    border-right: none;
    border-radius: 8px 0 0 8px;
    color: var(--muted);
    font-size: 1rem;
    font-family: var(--font-body);
    white-space: nowrap;
    display: flex;
    align-items: center;
}

.input-prefix .form-input {
    border-left: none;
    border-radius: 0 8px 8px 0;
}

/* ---------------------------------------------------------
   22. Upload Area
   --------------------------------------------------------- */
.upload-area {
    border: 2px dashed var(--border-strong);
    border-radius: 12px;
    padding: 48px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.upload-area:hover {
    border-color: var(--muted);
}

.upload-area.drag-over {
    border-color: var(--accent);
    background: rgba(232, 67, 42, 0.04);
}

.upload-text {
    font-weight: 600;
    margin-bottom: 4px;
}

.upload-hint {
    font-size: 0.875rem;
    color: var(--muted);
}

.upload-input {
    display: none;
}

/* ---------------------------------------------------------
   23. Submit Layout
   --------------------------------------------------------- */
.submit-layout {
    display: flex;
    gap: 48px;
}

.submit-left {
    flex: 1;
}

.submit-right {
    flex: 1;
}

/* ---------------------------------------------------------
   24. Profile / Centered Card
   --------------------------------------------------------- */
.centered-card {
    max-width: 480px;
    margin: 64px auto;
    text-align: center;
    padding: 48px 0;
}

.profile-avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 16px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.profile-username {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.profile-connected {
    color: var(--muted);
    font-size: 0.875rem;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.profile-form {
    text-align: left;
    margin-top: 32px;
    border-top: 1px solid var(--border);
    padding-top: 32px;
}

.profile-logout {
    margin-top: 24px;
}

/* ---------------------------------------------------------
   25. Footer
   --------------------------------------------------------- */
.footer {
    padding: 40px 0;
    border-top: 1px solid var(--border);
    margin-top: var(--section-gap);
}

.footer-inner {
    max-width: 1312px;
    margin: 0 auto;
    padding: 0 var(--page-padding);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 8px;
}

.footer-logo {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.125rem;
    letter-spacing: 0.02em;
}

.footer-tagline {
    color: var(--muted);
    font-size: 0.875rem;
}

.footer-links {
    display: flex;
    gap: 24px;
}

.footer-link {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.15s;
}

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

.footer-link-accent {
    color: var(--accent);
}

.footer-link-accent:hover {
    color: #d03a23;
}

/* ---------------------------------------------------------
   26. Browse Page
   --------------------------------------------------------- */
.browse-header {
    margin-bottom: var(--group-gap);
    border-bottom: 1px solid var(--border);
    padding-bottom: 0;
}

.browse-tabs {
    display: flex;
    gap: 0;
}

.browse-tab {
    padding: 12px 20px;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--muted);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s;
}

.browse-tab:hover {
    color: var(--text);
}

.browse-tab-active {
    color: var(--text);
    border-bottom-color: var(--accent);
    font-weight: 600;
}

.browse-sentinel {
    height: 1px;
    grid-column: 1 / -1;
}

/* ---------------------------------------------------------
   27. Empty State
   --------------------------------------------------------- */
.empty-state {
    color: var(--muted);
    text-align: center;
    padding: 32px;
    font-size: 0.875rem;
    grid-column: 1 / -1;
}

/* ---------------------------------------------------------
   27. Utilities
   --------------------------------------------------------- */
.flex {
    display: flex;
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.gap-8 {
    gap: 8px;
}

.gap-16 {
    gap: 16px;
}

.mt-8 {
    margin-top: 8px;
}

.mt-16 {
    margin-top: 16px;
}

.mt-24 {
    margin-top: 24px;
}

.mb-8 {
    margin-bottom: 8px;
}

.mb-16 {
    margin-bottom: 16px;
}

.mb-24 {
    margin-bottom: 24px;
}

.text-muted {
    color: var(--muted);
}

.text-accent {
    color: var(--accent);
}

/* ---------------------------------------------------------
   28. Page Title
   --------------------------------------------------------- */
.page-title {
    font-size: 2rem;
    margin-bottom: 8px;
}

.page-subtitle {
    color: var(--muted);
    margin-bottom: 32px;
}

/* ---------------------------------------------------------
   29. Responsive
   --------------------------------------------------------- */
@media (max-width: 768px) {
    :root {
        --page-padding: 20px;
        --section-gap: 40px;
    }

    .hero {
        flex-direction: column;
        padding: 40px var(--page-padding);
    }

    .hero-title {
        font-size: 2rem;
        line-height: 1.1;
    }

    .hero-sidebar {
        width: 100%;
    }

    .jersey-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .jersey-featured {
        flex-direction: column;
    }

    .featured-main .jersey-card-img {
        min-height: 280px;
    }

    .jersey-detail {
        flex-direction: column;
    }

    .jersey-detail-right {
        width: 100%;
    }

    .submit-layout {
        flex-direction: column;
    }

    .footer-inner {
        flex-direction: column;
        gap: 24px;
        text-align: center;
    }

    .footer-links {
        flex-wrap: wrap;
        justify-content: center;
    }

    .nav-inner {
        padding: 0 20px;
    }

    .centered-card {
        margin: 24px auto;
        padding: 32px 24px;
    }
}

@media (max-width: 480px) {
    .jersey-grid {
        grid-template-columns: 1fr;
    }

    .hero-title {
        font-size: 1.75rem;
        line-height: 1.1;
    }
}
