/* ============================================================
   CALENDRIER — page à part entière
   ------------------------------------------------------------
   Jetons d'index.css : les deux thèmes suivent sans règle de plus.
   Téléphone d'abord : la bande des jours défile à l'horizontale, les
   matchs s'empilent ; sur écran large, les cartes passent en grille.
   ============================================================ */

body.fz-cal-page { background: var(--bg); }

.cal-page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px 16px 48px;
    color: var(--text-main);
}

/* ---- En-tête ---- */
.cal-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
}
/* Seul titre de la page : discret, la semaine porte l'en-tête. */
.cal-eyebrow {
    margin: 0;
    font-size: .74rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--primary-text);
}
.cal-season {
    margin: 6px 0 0;
    font-size: .88rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.cal-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Semaine : ‹ 21 sept. - 27 › dans une seule pastille. Les flèches n'ont
   pas de cadre à elles ; c'est la pastille qui en porte un. */
.cal-week {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 2px;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    background: var(--card);
}
.cal-nav {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
}
.cal-nav svg {
    fill: none;
    stroke: currentColor;
    stroke-width: 2.25;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.cal-nav:hover:not(:disabled) { color: var(--primary-text); }
.cal-nav:disabled { opacity: .35; cursor: default; }
.cal-week-label {
    min-width: 8.5em;
    padding: 0 2px;
    text-align: center;
    font-weight: 800;
    font-size: .95rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    color: var(--text-main);
}
@media (max-width: 559px) {
    /* Téléphone : la pastille prend la ligne, la date au centre. */
    .cal-controls { width: 100%; }
    .cal-week { flex: 1 1 100%; }
    .cal-week-label { flex: 1; }
}
.cal-nav:focus-visible,
.cal-chip:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---- Retour à aujourd'hui ----
   Flotte au centre, au-dessus des onglets fixes du téléphone, dès qu'on
   quitte la semaine en cours (calendrier.js, rendreSemaine). */
.cal-return {
    position: fixed;
    left: 50%;
    bottom: calc(96px + env(safe-area-inset-bottom, 0px));
    z-index: 990;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 18px 0 14px;
    border: 0;
    border-radius: 999px;
    background: var(--primary);
    color: var(--on-primary);
    font: inherit;
    font-size: .92rem;
    font-weight: 800;
    white-space: nowrap;
    box-shadow: var(--elevation-4);
    cursor: pointer;
    transform: translateX(-50%);
    animation: calSurgit .2s cubic-bezier(.4, 0, .2, 1);
}
.cal-return[hidden] { display: none; }
.cal-return svg {
    fill: none;
    stroke: currentColor;
    stroke-width: 2.25;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.cal-return:hover { background: var(--primary-deep); }
.cal-return:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
@media (min-width: 769px) { .cal-return { bottom: 40px; } }
@keyframes calSurgit { from { opacity: 0; transform: translate(-50%, 10px); } }
@media (prefers-reduced-motion: reduce) { .cal-return { animation: none; } }
/* La dernière carte peut toujours remonter au-dessus de la pastille. */
.cal-page:has(.cal-return:not([hidden])) { padding-bottom: 112px; }

/* ---- Bande des jours ---- */
.cal-strip {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(72px, 1fr);
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    margin-bottom: 14px;
    scrollbar-width: thin;
    scroll-snap-type: x proximity;
}
.cal-chip {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-height: 76px;
    padding: 10px 6px;
    border: 1px solid var(--border-light);
    border-radius: 14px;
    background: var(--card);
    color: var(--text-main);
    font: inherit;
    cursor: pointer;
    scroll-snap-align: start;
}
.cal-chip-dow { font-size: .72rem; font-weight: 700; text-transform: uppercase; color: var(--text-secondary); }
.cal-chip-num { font-family: 'Bebas Neue', system-ui, sans-serif; font-size: 1.6rem; line-height: 1; }
.cal-chip-count { font-size: .7rem; color: var(--text-gray); }
.cal-chip-mine {
    position: absolute;
    top: 6px;
    right: 6px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--primary);
    color: var(--on-primary);
    font-size: .66rem;
    font-weight: 800;
    line-height: 18px;
}
.cal-chip.is-today { border-color: var(--primary); }
.cal-chip.is-active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--on-primary);
}
/* Blanc plein : à 85 %, il tombait à 3,6:1 sur le rouge. La pastille reste
   blanche dans les deux thèmes, d'où le rouge-texte du thème clair (5,38:1). */
.cal-chip.is-active .cal-chip-dow,
.cal-chip.is-active .cal-chip-count { color: var(--on-primary); }
.cal-chip.is-active .cal-chip-mine { background: #fff; color: #d70015; }

/* ---- Journée ---- */
.cal-day-title {
    margin: 0 0 10px;
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-main);
}
.cal-games {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}
@media (min-width: 640px) { .cal-games { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .cal-games { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.cal-game {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px;
    border: 1px solid var(--border-light);
    border-radius: 14px;
    background: var(--card);
}
.cal-game.is-mine { border-color: rgba(var(--primary-rgb), .55); box-shadow: inset 3px 0 0 var(--primary); }
.cal-game-status { display: flex; align-items: center; gap: 8px; font-size: .82rem; color: var(--text-secondary); }
/* L'horloge avance chaque seconde (calendrier.js) : chiffres à chasse fixe. */
.cal-clock { font-variant-numeric: tabular-nums; }
.cal-team {
    display: grid;
    grid-template-columns: 32px 1fr auto;
    align-items: center;
    gap: 10px;
}
.cal-team img { width: 32px; height: 32px; object-fit: contain; }
.cal-team-abbr { font-weight: 700; letter-spacing: .02em; }
.cal-team-score {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 1.2rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.cal-team.is-winner .cal-team-abbr,
.cal-team.is-winner .cal-team-score { color: var(--text-main); }
.cal-game:has(.cal-team.is-winner) .cal-team:not(.is-winner) { opacity: .6; }
.cal-game-mine {
    margin: 2px 0 0;
    padding-top: 8px;
    border-top: 1px solid var(--border-light);
    font-size: .8rem;
    line-height: 1.4;
    color: var(--text-secondary);
}
.cal-game-mine strong { color: var(--primary-text); }

/* Vers match.html : au pied de la carte, sur toute sa largeur. */
.cal-game-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 44px;
    margin: auto -14px -14px;
    padding: 0 14px;
    border-top: 1px solid var(--border-light);
    border-radius: 0 0 14px 14px;
    color: var(--primary-text);
    font-size: .86rem;
    font-weight: 700;
    text-decoration: none;
}
.cal-game-box span { font-size: 1.2rem; line-height: 1; }
.cal-game-box:hover { background: var(--bg-hover); }
.cal-game-box:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }

.cal-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 8px;
    border-radius: 6px;
    background: var(--bg-hover);
    color: var(--text-main);
    font-size: .72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .03em;
}
.cal-tag.is-soon { background: transparent; border: 1px solid var(--border-gray); }
.cal-tag.is-live { background: var(--danger-deep); color: var(--on-primary); }
.cal-tag.is-live i {
    width: 7px; height: 7px; border-radius: 50%; background: #fff;
    animation: calPouls 1.4s ease-in-out infinite;
}
@keyframes calPouls { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .cal-tag.is-live i { animation: none; } }

.cal-empty,
.cal-loading {
    grid-column: 1 / -1;
    margin: 0;
    padding: 36px 16px;
    border: 1px dashed var(--border-gray);
    border-radius: 14px;
    text-align: center;
    color: var(--text-secondary);
}
.cal-loading { display: flex; align-items: center; justify-content: center; gap: 10px; }
.cal-spinner {
    width: 18px; height: 18px; border-radius: 50%;
    border: 3px solid var(--border-gray); border-top-color: var(--primary);
    animation: calTourne .8s linear infinite;
}
@keyframes calTourne { to { transform: rotate(360deg); } }
