/* ============================================================
   OU-SKIER — DESIGN SYSTEM CSS
   Source unique de vérité pour les composants UI.
   Importé par index.html et design-system.html.
   ============================================================
   ARCHITECTURE :
     1. FONTS & TOKENS     — @font-face, variables CSS
     2. COMPOSANTS BASE    — styles desktop par défaut
     3. RESPONSIVE ≤640px  — overrides MOBILE (65% du trafic)

   Règle : penser MOBILE FIRST. Tester sur 375px avant desktop.
   ============================================================ */

/* === FONT FACE === */
@font-face {
    font-family: "Garnett";
    src: url("fonts/Garnett-Medium.ttf") format("truetype");
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

/* Garnett Regular — remplacer par Garnett-Regular.ttf quand disponible */
@font-face {
    font-family: "Garnett";
    src: url("fonts/Garnett-Medium.ttf") format("truetype");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

/* === DESIGN TOKENS === */
:root {
    /* Couleurs Principales */
    --deep-blue: #1a5276;
    --glacier: #5dade2;
    --powder: #d4e9f7;
    --storm-gray: #5d6d7e;
    --fresh-green: #27ae60;
    --shadow-blue: rgba(0, 0, 0, 0.1);
    --ice-blue: #d4e9f7;
    --snow-white: #fafbfc;
    --fresh-snow: #ecf0f1;

    /* Couleurs Météo */
    --temp-cold: #3498db;
    --temp-warm: #e67e22;
    --warning-orange: #e67e22;
    --heavy-snow: #e74c3c;

    /* Espacements */
    --padding-xs: 4px;
    --padding-sm: 8px;
    --padding-md: 15px;
    --padding-lg: 20px;
    --padding-xl: 40px;

    --margin-xs: 4px;
    --margin-sm: 8px;
    --margin-md: 15px;
    --margin-lg: 25px;
    --margin-xl: 40px;

    --space-between-sections: 40px;
    --space-between-elements: 15px;
}

/* === RESET === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* === BOUTONS === */
/*
 * 2 boutons uniquement :
 *   .btn .btn-primary  — fond noir #1F2023, texte blanc
 *   .btn .btn-secondary — fond gris #F0F0F0, texte foncé
 */
.btn {
    padding: 10px 22px;
    border: none;
    border-radius: 50px;
    font-family: "Inter", sans-serif;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    line-height: normal;
}

.btn-primary {
    background: #1F2023;
    color: white;
}

.btn-primary:hover {
    background: #333;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.btn-secondary {
    background: #F0F0F0;
    color: #1F2023;
    border: 1px solid #E0E0E0;
}

.btn-secondary:hover {
    background: #E5E5E5;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* === TOGGLES === */
.toggle {
    display: inline-flex;
    align-items: center;
    width: 202px;
    height: 36px;
    border-radius: 15px;
    background: #E5E7EF;
    padding: 2px;
}

.toggle-btn {
    width: 100px;
    height: 32px;
    border: none;
    background: transparent;
    font-family: "Inter", sans-serif;
    font-size: 12px;
    font-weight: 400;
    font-style: normal;
    line-height: normal;
    cursor: pointer;
    border-radius: 15px;
    transition: all 0.2s ease;
    color: #1F2023;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.toggle-btn.active {
    background: #FFF;
    color: #000;
}

.toggle-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.5);
}

.toggle-btn svg {
    width: 15px;
    height: 15px;
    fill: #1F2023;
}

/* Toggle 3 boutons (ex: Par jour / Par heure / Nuages) */
.toggle.toggle-3 {
    width: 302px;
}
.toggle.toggle-3 .toggle-btn {
    width: auto;
    flex: 1;
    padding: 0 12px;
}

/* === TAGS === */
.tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: #E5E7EF;
    color: #1F2023;
    border-radius: 20px;
    font-family: "Inter", sans-serif;
    font-weight: 500;
    font-size: 0.85rem;
}

/* === MODALS === */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeInOverlay 0.2s ease-out;
}

.modal {
    background: white;
    border-radius: 14px;
    padding: 32px;
    max-width: 560px;
    width: 92%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    animation: slideInModal 0.2s ease-out;
}

.modal-header {
    font-family: "Barlow Condensed", sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--deep-blue);
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* === ICÔNES === */
.icon {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
}

.icon svg {
    width: 24px;
    height: 24px;
}

/* === INPUTS === */
.input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-family: "JetBrains Mono", monospace;
    font-size: 0.9rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background: #f8fafc;
}

.input:focus {
    outline: none;
    border-color: var(--glacier);
    box-shadow: 0 0 0 3px rgba(93, 173, 226, 0.15);
    background: white;
}

/* === SNOW TABLE === */
.snow-table {
    display: flex;
    width: 100%;
    max-width: 1290px;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    border-radius: 15px;
    overflow: hidden;
}

.snow-table table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
}

.snow-table thead tr {
    height: 84px;
    border-radius: 15px 15px 0 0;
    border: 1px solid #E1E8F2;
    background: #F9FAFC;
}

.snow-table thead th {
    padding: 16px;
    text-align: center;
    font-family: "Garnett", sans-serif;
    font-size: 16px;
    font-weight: 500;
    color: #1F2023;
    border: 1px solid #E1E8F2;
    background: #F9FAFC;
    vertical-align: middle;
}

.snow-table thead th:first-child {
    text-align: left;
    padding-left: 24px;
    min-width: 277px;
    position: sticky;
    left: 0;
    z-index: 3;
}

.snow-table .day-abbr {
    display: block;
    color: #5E7690;
    font-family: "Garnett", sans-serif;
    font-size: 14px;
    font-weight: 600;
    line-height: normal;
}

.snow-table .day-num {
    display: block;
    color: #1F2023;
    font-family: "Garnett", sans-serif;
    font-size: 16px;
    font-weight: 600;
    line-height: normal;
}

.snow-table tbody td {
    min-height: 87px;
    border: 1px solid #E1E8F2;
    vertical-align: middle;
}

.snow-table tbody td:first-child {
    min-width: 277px;
    background: #FFF;
    padding: 16px 24px;
    position: sticky;
    left: 0;
    z-index: 2;
}

.snow-table tbody td:not(:first-child) {
    background: #F9FAFC;
    text-align: center;
    padding: 16px;
}

.snow-table .sector-name {
    color: #0F172B;
    font-family: "Inter", sans-serif;
    font-size: 16px;
    font-weight: 600;
    line-height: 24px;
}

.snow-table .sector-altitude {
    color: #5E7690;
    font-family: "Garnett", sans-serif;
    font-size: 13px;
    font-weight: 500;
    line-height: normal;
}

.snow-table .snow-value {
    color: #1F2023;
    text-align: center;
    font-family: "Garnett", sans-serif;
    font-size: 16px;
    font-weight: 500;
    line-height: normal;
}

.snow-table .snow-unit {
    color: #5E7690;
    font-family: "Garnett", sans-serif;
    font-size: 13px;
    font-weight: 500;
    line-height: normal;
}

.snow-table .table-blank-state {
    text-align: center;
    color: var(--storm-gray);
    padding: 32px 16px;
    font-size: 13px;
    font-style: italic;
    opacity: 0.6;
}

.snow-table .manteau-last-fall {
    display: block;
    color: #5E7690;
    font-family: "Garnett", sans-serif;
    font-size: 10px;
    font-weight: 500;
    line-height: normal;
    margin-top: 4px;
}

/* === TYPOGRAPHIES GLOBALES === */

/* Titre XL — Garnett Medium 36px/500 #1F2023 */
.title-xl {
    color: #1F2023;
    font-family: "Garnett", sans-serif;
    font-size: 36px;
    font-style: normal;
    font-weight: 500;
    line-height: normal;
}

/* Titre — Garnett Medium 24px/500 #1F2023 */
.title {
    color: #1F2023;
    font-family: "Garnett", sans-serif;
    font-size: 24px;
    font-style: normal;
    font-weight: 500;
    line-height: normal;
}

/* Sous-titre — Inter 14px/400 #5E7690 */
.subtitle {
    color: #5E7690;
    font-family: "Inter", sans-serif;
    font-size: 14px;
    font-style: normal;
    font-weight: 400;
    line-height: 20px;
    letter-spacing: -0.15px;
}


/* === FOOTER CTA === */
.footer-cta {
    background: radial-gradient(95.04% 241.97% at 50% -76.74%, #FFF 54.74%, #FFE7E3 68.1%, #B892F6 84.91%);
    width: 1390px;
    max-width: 100%;
    min-height: 390px;
    margin: 0 auto;
    padding: 80px 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-radius: 0 0 12px 12px;
}

/* .footer-cta-title extends .title-xl */
.footer-cta-title {
    font-family: "Garnett", sans-serif;
    font-size: 36px;
    font-weight: 500;
    color: #1F2023;
    line-height: normal;
    margin-bottom: 28px;
    max-width: 780px;
}

/* === SECTORS BLOCK === */
.sectors-block {
    width: 100%;
    max-width: 1440px;
    min-height: 257px;
    background: #F9FAFC;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 40px 24px;
    margin: 0 auto 30px;
}

.footer-cta-buttons {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}


/* === LOGO === */
/* Wordmark SVG 165×54px — stocké dans icons.js (logoSvg) */
.logo {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}
.logo svg {
    display: block;
}

/* === COMPARISON CARD === */
/*
 * Carte enveloppant le tableau météo comparatif.
 * Usage : <div class="comparison-card"> ... </div>
 *   → .comparison-card-header  — ligne titre + toggle
 *   → .comparison-card-body    — zone scrollable contenant .snow-table
 */
.comparison-card {
    display: flex;
    width: 100%;
    max-width: 1382px;
    flex-direction: column;
    align-items: flex-start;
    border-radius: 16px;
    border: 1px solid #E2E8F0;
    background: #FFF;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.10), 0 4px 6px -4px rgba(0, 0, 0, 0.10);
    /* overflow:clip coupe les coins arrondis comme hidden,
       mais ne crée pas de scroll container — ce qui permet
       à position:sticky de fonctionner dans .comparison-card-body */
    overflow: clip;
}

.comparison-card-header {
    display: flex;
    width: 100%;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #E2E8F0;
    background: #FFF;
    flex-shrink: 0;
}

.comparison-card-header .title {
    margin-bottom: 0;
}

.comparison-card-body {
    width: 100%;
    overflow: auto;
    flex: 1;
}

/* Override snow-table inside a comparison-card: no outer radius/shadow (card handles it) */
.comparison-card .snow-table {
    border-radius: 0;
    /* Allow table to exceed card width so .comparison-card-body overflow:auto can scroll */
    width: max-content;
    min-width: 100%;
    overflow: visible;
}

.comparison-card .snow-table table {
    /* Size to content so min-width on cells is respected and triggers horizontal scroll */
    width: max-content;
    min-width: 100%;
    /* La règle générique `table { overflow: hidden }` du style local bloque
       position:sticky sur th/td — on l'annule ici (border-radius: 0 de toute façon) */
    overflow: visible;
}

.comparison-card .snow-table thead tr {
    border-radius: 0;
}

/* === ANIMATIONS === */
@keyframes fadeInOverlay {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInModal {
    from { opacity: 0; transform: translateY(-50px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-30px); }
    to { opacity: 1; transform: translateY(0); }
}

/* =====================================================
 * 3. RESPONSIVE ≤640px — MOBILE (65% du trafic)
 * Breakpoint principal. Tous les composants partagés
 * doivent être lisibles sur un écran de 375px.
 * ===================================================== */
@media (max-width: 640px) {
    /* Colonne secteur compacte */
    .snow-table thead th:first-child,
    .snow-table tbody td:first-child {
        min-width: 110px;
        width: 110px;
        padding: 10px 8px;
    }
    .snow-table thead tr { height: auto; }
    .snow-table thead th { padding: 10px 8px; font-size: 11px; }
    .snow-table tbody td { padding: 10px 8px; }

    /* Typographie compacte */
    .sector-name { font-size: 13px; line-height: 1.2; }
    .sector-altitude { font-size: 11px; }
    .snow-value { font-size: 14px; }
    .day-abbr { font-size: 11px; }
    .day-num { font-size: 13px; }

    /* Comparison card header */
    .comparison-card-header { padding: 12px 16px; }

    /* Comparison card body : pas de padding pour maximiser la largeur */
    .comparison-card-body {
        padding: 0;
    }

    /* Snow table = scroll container sur mobile.
       - width: 100% (pas max-content) → contraint à la largeur de la card
       - overflow-x: auto → la table scrolle horizontalement à l'intérieur
       - position:sticky sur th/td:first-child fonctionne car sticky est
         relatif au scroll container le plus proche (.snow-table ici) */
    .comparison-card .snow-table {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Seule la <table> garde max-content pour dépasser le .snow-table */
    .comparison-card .snow-table table {
        width: max-content;
    }

    /* Ombre sur la colonne sticky pour indiquer qu'on peut scroller */
    .comparison-card .snow-table th:first-child,
    .comparison-card .snow-table td:first-child {
        box-shadow: 3px 0 6px rgba(0, 0, 0, 0.08);
    }
}
