/* ===== Page d'un patron de crochet : palette du site =====
   Turquoise : 85ECE4 · 55E0D6 · 30D5C9 · 0CC9BB · 00A094
   Bleu      : 91B0EE · 6590E4 · 4275DB · 205BD0 · 0C42AC
   Vert      : 95F68B · 6AF05C · 46EB35 · 22E50E · 14D200
*/
.patron {
    --tq1: #85ECE4; --tq2: #55E0D6; --tq3: #30D5C9; --tq4: #0CC9BB; --tq5: #00A094;
    --bl1: #91B0EE; --bl2: #6590E4; --bl3: #4275DB; --bl4: #205BD0; --bl5: #0C42AC;
    --vt1: #95F68B; --vt2: #6AF05C; --vt3: #46EB35; --vt4: #22E50E; --vt5: #14D200;
    width: 100%;
    max-width: 1000px;
    margin: 18px auto 10px;
    padding: 0 15px;
    color: var(--bl5);
}
[hidden] { display: none !important; }
.patron h1 { font-size: clamp(1.8rem, 5vw, 2.5rem); font-weight: 900; line-height: 1.1; margin: 4px 0 8px; }
.patron h2 { font-size: 1.35rem; font-weight: 900; }
.patron p { line-height: 1.6; margin-bottom: 10px; }

/* ----- Présentation ----- */
.patron-haut {
    display: grid;
    grid-template-columns: minmax(200px, 300px) 1fr;
    gap: 22px;
    align-items: center;
    padding: 18px;
    background-image:
        linear-gradient(160deg, var(--tq1), var(--tq2)),
        linear-gradient(135deg, var(--bl4), var(--vt3));
    background-origin: border-box;
    background-clip: padding-box, border-box;
    border: 4px solid transparent;
    border-radius: 28px;
    box-shadow: 0 10px 30px rgba(12, 66, 172, 0.3);
}
.patron-photo {
    width: 100%;
    height: auto;
    border-radius: 20px;
    border: 4px solid #fff;
    box-shadow: 0 6px 16px rgba(12, 66, 172, 0.35);
}
.patron-sur {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--tq5);
}
.patron-niveau strong {
    padding: 2px 12px;
    color: #fff;
    background: var(--bl4);
    border-radius: 20px;
}
.patron-fils { display: flex; flex-wrap: wrap; gap: 10px; margin: 6px 0; }
.patron-pelote {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 14px 4px 5px;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.7);
    border: 3px solid var(--bl3);
    border-radius: 30px;
}
.patron-pelote i {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid var(--bl5);
}
.patron-note {
    margin-top: 8px;
    padding: 8px 12px;
    font-size: 0.95rem;
    background: rgba(255, 255, 255, 0.55);
    border-left: 5px solid var(--bl3);
    border-radius: 8px;
}

/* ----- Avancement ----- */
.patron-suivi {
    position: sticky;
    top: 0;             /* ajusté par patron.js : juste sous l'en-tête fixe */
    z-index: 3;
    margin: 16px 0;
    padding: 10px 16px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 16px;
    background: rgba(255, 255, 255, 0.92);
    border: 3px solid var(--tq3);
    border-radius: 24px;
}
.suivi-barre {
    flex: 1 1 200px;
    height: 16px;
    overflow: hidden;
    background: #fff;
    border: 2px solid var(--bl3);
    border-radius: 10px;
}
.suivi-rempli {
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--vt3), var(--vt5));
    transition: width 0.4s;
}
.suivi-texte { margin: 0 !important; font-weight: 700; white-space: nowrap; }
.suivi-boutons { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.suivi-ecran { font-size: 0.95rem; font-weight: 700; cursor: pointer; }
.suivi-ecran input { width: 18px; height: 18px; margin-right: 5px; vertical-align: middle; accent-color: var(--bl4); }
.btnPatron {
    padding: 8px 18px;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, var(--bl4), var(--bl3));
    border: none;
    border-radius: 24px;
    cursor: pointer;
    box-shadow: 0 3px 0 var(--bl5);
}
.btnPatron:hover { background: linear-gradient(135deg, var(--vt5), var(--vt3)); color: var(--bl5); }
.btnPatron:focus-visible, .tour:focus-visible, .onglet:focus-visible { outline: 4px solid var(--vt4); outline-offset: 2px; }
.btnPatronDiscret { color: var(--bl5); background: #fff; border: 2px solid var(--bl3); box-shadow: none; }

/* ----- Pièces ----- */
.piece {
    margin-bottom: 18px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.55);
    border: 3px solid var(--tq3);
    border-radius: 24px;
}
.pieces {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    align-items: start;
    margin-bottom: 18px;
}
.pieces .piece { margin-bottom: 0; }
.piece-large { grid-column: 1 / -1; }
.patron-titre-section { margin: 4px 0 12px; font-size: 1.7rem !important; }
.piece-titre {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 10px;
    font-size: 1.4rem;
    font-weight: 900;
}
.piece-pastille {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 3px solid var(--bl5);
    flex: none;
}
.piece-pastille-fil { background: repeating-linear-gradient(45deg, var(--bl2) 0 6px, #fff 6px 12px); }
.piece-fois { color: var(--tq5); }
.piece-compte { margin-left: auto; font-size: 0.9rem; font-weight: 700; color: var(--bl3); }
.piece.finie { border-color: var(--vt4); }
.piece.finie .piece-compte { color: var(--vt5); }
.piece-resume { margin: 4px 0 12px; font-size: 0.95rem; }

/* ----- Niveau et matériel ----- */
.fiche { display: grid; grid-template-columns: minmax(180px, 1fr) 2fr; gap: 16px; margin-top: 16px; }
.fiche-carte {
    padding: 16px 18px;
    background: rgba(255, 255, 255, 0.7);
    border: 3px solid var(--bl3);
    border-radius: 22px;
}
.fiche-carte h2 { margin-bottom: 8px; color: var(--tq5); font-size: 1rem; letter-spacing: 2px; text-transform: uppercase; }
.fiche-niveau-mot { font-size: 1.8rem; font-weight: 900; line-height: 1.1; margin-bottom: 8px !important; }
.fiche-petit { font-size: 0.9rem; margin: 8px 0 0 !important; }
.fiche-materiel ul { list-style: none; display: grid; gap: 8px; }
.fiche-materiel li { display: flex; align-items: center; gap: 10px; line-height: 1.3; }
.pelote { flex: none; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--bl5); }
.pelote-vide { background: repeating-linear-gradient(45deg, var(--bl1) 0 5px, #fff 5px 10px); }

.piece-large .piece-corps { display: grid; grid-template-columns: 1fr 230px; gap: 18px; align-items: start; }
.tours { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.tour {
    width: 100%;
    display: grid;
    grid-template-columns: 30px 78px 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    font-size: 1.1rem;
    text-align: left;
    color: var(--bl5);
    background: #fff;
    border: 3px solid var(--bl1);
    border-radius: 16px;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
}
.tour:hover { border-color: var(--bl3); }
.tour-case {
    width: 26px;
    height: 26px;
    border: 3px solid var(--bl3);
    border-radius: 8px;
    background: #fff;
}
.tour-num { font-weight: 900; }
.tour-texte { font-weight: 500; }
.tour-total {
    padding: 2px 10px;
    font-size: 0.95rem;
    font-weight: 700;
    color: #fff;
    background: var(--bl3);
    border-radius: 12px;
    white-space: nowrap;
}
.tour[aria-pressed="true"] { background: var(--vt1); border-color: var(--vt5); }
.tour[aria-pressed="true"] .tour-case { background: var(--vt4); border-color: var(--vt5); position: relative; }
.tour[aria-pressed="true"] .tour-case::after {
    content: "";
    position: absolute;
    left: 6px; top: 1px;
    width: 7px; height: 14px;
    border: solid #fff;
    border-width: 0 4px 4px 0;
    transform: rotate(45deg);
}
.tour[aria-pressed="true"] .tour-texte { text-decoration: line-through; text-decoration-thickness: 2px; opacity: 0.7; }
.tour.suivant { border-color: var(--bl5); box-shadow: 0 0 0 4px rgba(32, 91, 208, 0.25); }
.tour-verifier {
    margin: 4px 0 0 40px !important;
    font-size: 0.9rem;
    font-weight: 700;
    color: #7a4b00;
}
.consigne {
    padding: 8px 14px;
    font-weight: 700;
    background: var(--bl1);
    border-radius: 12px;
}
.consigne-fin { background: var(--tq1); }

/* ----- Forme de la pièce ----- */
.profil { position: sticky; top: 150px; margin: 0; text-align: center; }
.profil-svg { width: 100%; height: auto; background: #fff; border: 3px solid var(--bl1); border-radius: 16px; }
.profil figcaption { margin-top: 4px; font-size: 0.85rem; }
/* Bec et pattes : un dessin au lieu des barres, à droite comme le corps ; il passe au vert quand le tour est fait */
.schema .part { fill: var(--bl1); stroke: var(--bl3); stroke-width: 1.5; transition: fill 0.3s; }
.schema .detail { fill: #fff; stroke: var(--bl3); stroke-width: 1; }
.schema-txt { fill: var(--bl5); font-size: 12px; font-weight: 700; }
.schema.fait .part { fill: var(--vt2); stroke: var(--vt5); }
.barre-maille { fill: var(--bl1); stroke: var(--bl3); stroke-width: 1; transition: fill 0.3s; }
.barre-maille.fait { fill: var(--vt2); stroke: var(--vt5); }
.barre-maille.suivant { fill: var(--bl4); }

/* ----- Bas de page ----- */
.patron-droits {
    margin-bottom: 18px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.55);
    border-radius: 20px;
}
.patron-abreviations {
    /* panneau flottant : posé par-dessus la page, sous le bandeau d'avancement (top réglé par patron.js) */
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    z-index: 6;
    width: min(1000px, calc(100% - 20px));
    overflow-y: auto;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.98);
    border: 3px solid var(--tq3);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(12, 66, 172, 0.45);
}
.abr-entete { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.patron-abreviations .patron-note { margin-bottom: 0; }
.patron-abreviations dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 8px; margin-top: 10px; }
.patron-abreviations dl div { display: flex; align-items: baseline; gap: 10px; }
.patron-abreviations dt { min-width: 70px; padding: 1px 10px; font-weight: 900; text-align: center; color: #fff; background: var(--bl4); border-radius: 12px; }
.patron .fiche-liens a {
    text-transform: none; letter-spacing: normal; text-shadow: none;
    font-size: 16px; font-weight: 700; color: var(--bl5); text-decoration: underline;
}

/* ----- Téléphone ----- */
@media (max-width: 760px) {
    .pieces, .fiche { grid-template-columns: 1fr; }
    .patron-haut { grid-template-columns: 1fr; text-align: center; }
    .patron-photo { max-width: 240px; margin: 0 auto; }
    .patron-fils { justify-content: center; }
    .piece-large .piece-corps { grid-template-columns: 1fr; }
    .profil { position: static; max-width: 260px; margin: 6px auto 0; }
}
@media (max-width: 520px) {
    .tour { grid-template-columns: 28px 1fr auto; gap: 4px 8px; font-size: 1rem; }
    .tour-num { grid-column: 2; }
    .tour-total { grid-column: 3; grid-row: 1; }
    .tour-texte { grid-column: 1 / -1; }
    .tour-verifier { margin-left: 8px !important; }
    /* le bandeau (et sa case des abréviations) reste collé en haut, en plus compact */
    .patron-suivi { margin: 8px 0; padding: 6px 12px; gap: 4px 10px; }
    .suivi-texte { font-size: 0.9rem; }
}

/* ----- Impression ----- */
@media print {
    header, footer, .pubLateral, .patron-suivi, .fiche-liens, .profil { display: none !important; }
    body { background: #fff !important; padding: 0 !important; }
    .pieces { display: block; }
    .piece { margin-bottom: 10px; break-inside: avoid; border-color: #999; background: #fff; }
    .tour { border-color: #999; }
    /* à l'impression, les abréviations sont toujours là */
    .patron .patron-abreviations[hidden] { display: block !important; }
    .patron-abreviations { position: static; transform: none; width: auto; max-height: none !important; overflow: visible; box-shadow: none; border-color: #999; margin-bottom: 10px; }
    #btnFermerAbr { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    .suivi-rempli, .tour, .barre-maille, .schema .part { transition: none; }
}
