/**
 * Ce soir, on joue - page d'accueil des jeux
 * Monochrome et minimaliste : Inter pour le texte, JetBrains Mono pour les titres.
 * Les captures restent en noir et blanc jusqu'au survol, la seule couleur de la page.
 */

:root {
    --white: #ffffff;
    --gray-50: #fafafa;
    --gray-100: #f5f5f5;
    --gray-200: #e5e5e5;
    --gray-300: #d4d4d4;
    --gray-400: #a3a3a3;
    --gray-500: #737373;
    --gray-600: #525252;
    --gray-700: #404040;
    --gray-800: #262626;
    --gray-900: #171717;
    --black: #0a0a0a;

    --text: var(--gray-900);
    --text-soft: var(--gray-600);
    --text-muted: #6b6b6b; /* contraste AA sur fond blanc */
    --line: var(--gray-200);

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

    --page: 1120px;
    --gutter: clamp(16px, 4vw, 48px);
    --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text);
    background-color: var(--white);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: inherit;
    text-decoration: none;
}

a:focus-visible {
    outline: 2px solid var(--gray-500);
    outline-offset: 3px;
}

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

/* ==================== BARRE DU HAUT ==================== */
.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    max-width: var(--page);
    margin: 0 auto;
    padding: 18px var(--gutter);
    background-color: rgba(255, 255, 255, 0.86);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.wordmark {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: -0.02em;
}

.cursor {
    animation: blink 1.1s steps(1) infinite;
}

@keyframes blink {
    50% { opacity: 0; }
}

.gh-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px 4px 4px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-soft);
    border: 1px solid var(--line);
    border-radius: 999px;
    transition: border-color 150ms ease, color 150ms ease;
}

.gh-chip:hover {
    color: var(--text);
    border-color: var(--gray-400);
}

.gh-chip-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    filter: grayscale(1);
}

/* ==================== ACCROCHE ==================== */
.hero {
    max-width: var(--page);
    margin: 0 auto;
    padding: clamp(40px, 8vw, 96px) var(--gutter) clamp(32px, 5vw, 56px);
}

.hero-title {
    margin: 0 0 20px;
    font-family: var(--font-mono);
    font-weight: 800;
    font-size: clamp(2.6rem, 8vw, 5.5rem);
    line-height: 0.95;
    letter-spacing: -0.05em;
}

.hero-text {
    max-width: 34rem;
    font-size: clamp(1.05rem, 1.6vw, 1.2rem);
    color: var(--text-soft);
}

/* ==================== BOUTONS ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 0 22px;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    font-weight: 600;
    border: 1px solid var(--gray-900);
    border-radius: 4px;
    transition: background-color 150ms ease, color 150ms ease;
}

.btn span {
    transition: transform 250ms var(--ease);
}

.btn:hover span {
    transform: translateX(4px);
}

.btn--solid {
    background-color: var(--gray-900);
    color: var(--white);
}

.btn--solid:hover {
    background-color: var(--black);
}

.btn--ghost:hover {
    background-color: var(--gray-900);
    color: var(--white);
}

/* ==================== CATALOGUE ==================== */
.catalog {
    width: min(100% - 2 * var(--gutter), var(--page) - 2 * var(--gutter));
    margin: 0 auto;
    padding: clamp(32px, 5vw, 56px) 0 clamp(48px, 7vw, 80px);
    border-top: 1px solid var(--line);
}

.catalog-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 28px;
}

.catalog-title {
    font-family: var(--font-mono);
    font-size: 1.25rem;
    font-weight: 700;
}

.catalog-count {
    margin-left: 8px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
}

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip {
    min-height: 34px;
    padding: 0 14px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-soft);
    background: none;
    border: 1px solid var(--line);
    border-radius: 999px;
    cursor: pointer;
    transition: all 150ms ease;
}

.chip:hover {
    color: var(--text);
    border-color: var(--gray-400);
}

.chip[aria-pressed="true"] {
    color: var(--white);
    background-color: var(--gray-900);
    border-color: var(--gray-900);
}

.chip:focus-visible {
    outline: 2px solid var(--gray-500);
    outline-offset: 2px;
}

.catalog-grid {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr));
    gap: 24px;
}

.tile {
    position: relative; /* le lien du titre couvre toute la tuile */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background-color: var(--white);
    transition: border-color 250ms ease, box-shadow 250ms ease, transform 250ms var(--ease);
}

.tile[hidden] {
    display: none;
}

.tile:hover {
    border-color: var(--gray-400);
    box-shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.25);
    transform: translateY(-3px);
}

.tile-cover {
    position: relative;
    aspect-ratio: 8 / 5;
    overflow: hidden;
    background-color: var(--gray-200);
    border-bottom: 1px solid var(--line);
}

.tile-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 600ms var(--ease), filter 600ms var(--ease);
}

/* Noir et blanc tant qu'on ne s'y intéresse pas : la couleur arrive au survol. */
@media (hover: hover) {
    .tile-cover img {
        filter: grayscale(1) contrast(1.05);
    }

    .tile:hover .tile-cover img,
    .tile:focus-within .tile-cover img {
        filter: none;
        transform: scale(1.04);
    }
}

.tile-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 3px 8px;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--white);
    background-color: rgba(10, 10, 10, 0.82);
    border-radius: 3px;
}

.tile-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 22px;
}

.tile-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.tile-title {
    font-family: var(--font-mono);
    font-weight: 800;
    font-size: 1.6rem;
    line-height: 1.1;
    letter-spacing: -0.03em;
    overflow-wrap: anywhere;
}

.tile-link::after {
    content: '';
    position: absolute;
    inset: 0;
}

.tile-players {
    flex-shrink: 0;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.tile-pitch {
    margin: 6px 0 12px;
    font-family: var(--font-mono);
    font-size: 0.95rem;
    font-weight: 500;
}

.tile-text {
    font-size: 0.9rem;
    color: var(--text-soft);
    margin-bottom: 16px;
}

.tags {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 20px;
}

.tags li {
    padding: 2px 8px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-soft);
    background-color: var(--gray-100);
    border: 1px solid var(--line);
    border-radius: 3px;
}

.tile-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 20px;
    margin-top: auto;
}

.tile-actions a {
    position: relative; /* au-dessus du lien qui couvre la tuile */
    z-index: 1;
}

.tile-secondary {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-muted);
    padding-bottom: 2px;
    border-bottom: 1px solid var(--gray-300);
    transition: color 150ms ease, border-color 150ms ease;
}

.tile-secondary:hover {
    color: var(--text);
    border-bottom-color: var(--gray-900);
}

/* ==================== LANCER UNE PARTIE ==================== */
.how {
    /* the rule above lines up with the catalogue's, inside the gutter */
    width: min(100% - 2 * var(--gutter), var(--page) - 2 * var(--gutter));
    margin: 0 auto;
    padding: clamp(48px, 7vw, 80px) 0;
    border-top: 1px solid var(--line);
}

.how-title {
    font-family: var(--font-mono);
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 28px;
}

.how-steps {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.how-steps li {
    padding: 22px;
    font-size: 0.925rem;
    color: var(--text-soft);
    background-color: var(--gray-50);
    border: 1px solid var(--line);
    border-radius: 6px;
}

.how-num {
    display: block;
    margin-bottom: 10px;
    font-family: var(--font-mono);
    font-weight: 800;
    font-size: 1.6rem;
    line-height: 1;
    color: var(--gray-900);
}

/* ==================== PROFIL GITHUB ==================== */
.maker {
    max-width: var(--page);
    margin: 0 auto;
    padding: 0 var(--gutter) clamp(48px, 7vw, 80px);
}

.gh-card {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 20px;
    align-items: center;
    padding: 22px;
    color: var(--gray-100);
    background-color: var(--gray-900);
    border-radius: 6px;
    transition: background-color 150ms ease;
}

.gh-card:hover {
    background-color: var(--black);
}

.gh-card-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 1px solid var(--gray-700);
    filter: grayscale(1);
    transition: filter 400ms ease;
}

.gh-card:hover .gh-card-avatar {
    filter: none;
}

.gh-card-name {
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--white);
}

.gh-card-login {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--gray-400);
}

.gh-card-bio {
    margin-top: 6px;
    font-size: 0.875rem;
    color: var(--gray-300);
}

.gh-card-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
    margin-top: 8px;
    font-size: 0.8rem;
    color: var(--gray-400);
}

.gh-card-stats strong {
    font-family: var(--font-mono);
    color: var(--white);
}

.gh-card-cta {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    padding-bottom: 2px;
    border-bottom: 1px solid var(--gray-600);
    white-space: nowrap;
}

.gh-card:hover .gh-card-cta {
    border-bottom-color: var(--white);
}

/* ==================== PIED DE PAGE ==================== */
.footer {
    padding: 24px var(--gutter);
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    border-top: 1px solid var(--line);
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 860px) {
    .how-steps {
        grid-template-columns: 1fr;
    }

    .gh-card {
        grid-template-columns: auto 1fr;
    }

    .gh-card-cta {
        grid-column: 1 / -1;
        justify-self: start;
    }
}

@media (max-width: 480px) {
    .tile-body {
        padding: 18px;
    }

    .gh-card {
        gap: 14px;
    }

    .gh-card-avatar {
        width: 56px;
        height: 56px;
    }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .cursor { animation: none; }
    *, *::before, *::after { transition: none !important; }
}
