/* Catalogue de composants (docs/spec/redesign.md) */
/* --- en-tête de page ----------------------------------------------------------------------------------- */
.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem 1.25rem;
    margin-bottom: 2rem;
}

.page-head__icon {
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    flex-shrink: 0;
    border: var(--line);
    border-radius: var(--radius);
    background: var(--yellow);
    box-shadow: var(--shadow);
    transform: rotate(-4deg);
}

.page-head__icon .icon {
    width: 28px;
    height: 28px;
}

.page-head__icon--cyan {
    background: var(--cyan);
    transform: rotate(3deg);
}

.page-head__icon--blue {
    background: var(--blue);
    color: var(--paper);
}

.page-head__icon--coral {
    background: var(--coral);
}

.page-head__text {
    flex: 1 1 260px;
    min-width: 0;
}

.page-head__meta {
    margin-top: 0.25rem;
    color: var(--muted);
    font-size: 0.875rem;
}

.page-head__actions {
    flex-basis: 100%;
}

/* --- sections et cartes -------------------------------------------------------------------------------- */
.section + .section {
    margin-top: 3rem;
}

.section__title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1.25rem;
}

.section__title .icon {
    width: 1em;
    height: 1em;
}

.section__title::after {
    content: "";
    flex: 1;
    height: var(--border-width);
    margin-left: 0.5rem;
    background: repeating-linear-gradient(90deg, var(--navy) 0 6px, transparent 6px 12px);
    opacity: 0.35;
}

.card {
    position: relative;
    padding: clamp(1.1rem, 3vw, 1.75rem);
    background: var(--paper);
    border: var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

/* contenu d'une carte : chaque bloc espacé du précédent (l'eyebrow reste collé au titre) */
.card:not(.form) > :not(.card__eyebrow) + * {
    margin-top: 1rem;
}

/* une carte qui suit un texte ou un autre bloc dans une section */
:where(.section) > * + .card {
    margin-top: 1.25rem;
}

.card--yellow {
    background: var(--yellow-soft);
}

.card--cyan {
    background: var(--cyan-soft);
}

.card--blue {
    background: var(--blue-soft);
}

.card__eyebrow,
.eyebrow {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}

.card__title {
    margin-bottom: 0.75rem;
}

.grid {
    display: grid;
    gap: 1.25rem;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
}

/* --- boutons ------------------------------------------------------------------------------------------- */
.btn {
    --btn-bg: var(--paper);
    --btn-fg: var(--navy);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 44px;
    padding: 0.5rem 1.1rem;
    background: var(--btn-bg);
    color: var(--btn-fg);
    border: var(--line);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    font-weight: 700;
    font-size: 0.875rem;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.12s var(--ease), box-shadow 0.12s var(--ease), background 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.btn:hover {
    transform: translate(-2px, -2px);
    box-shadow: var(--shadow);
    text-decoration: none;
}

.btn:active {
    transform: translate(2px, 2px);
    box-shadow: 0 0 0 var(--navy);
}

.btn[disabled], .btn.is-disabled {
    opacity: 0.5;
    pointer-events: none;
}

.btn--primary {
    --btn-bg: var(--yellow);
}

.btn--secondary {
    --btn-bg: var(--paper);
}

.btn--info {
    --btn-bg: var(--cyan);
}

.btn--blue {
    --btn-bg: var(--blue);
    --btn-fg: var(--paper);
}

.btn--danger {
    --btn-bg: var(--coral);
}

.btn--success {
    --btn-bg: var(--green);
}

.btn--ghost {
    border-color: transparent;
    box-shadow: none;
    background: transparent;
}

.btn--ghost:hover {
    background: var(--cream);
    border-color: var(--navy);
    box-shadow: none;
    transform: none;
}

.btn--ghost:active {
    transform: none;
}

.btn--sm {
    min-height: 36px;
    padding: 0.35rem 0.8rem;
    font-size: 0.8125rem;
}

.btn--lg {
    min-height: 52px;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

.btn--icon {
    width: 44px;
    padding: 0;
}

.btn--icon.btn--sm {
    width: 36px;
}

.btn--block {
    width: 100%;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.actions form {
    display: contents;
}

/* --- badges -------------------------------------------------------------------------------------------- */
.badge {
    --badge-bg: var(--paper);
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.1rem 0.6rem;
    background: var(--badge-bg);
    border: 2px solid var(--navy);
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.5;
    white-space: nowrap;
    vertical-align: middle;
    color: var(--navy);
}

.badge .icon {
    width: 0.95em;
    height: 0.95em;
}

.badge--yellow {
    --badge-bg: var(--yellow);
}

.badge--cyan {
    --badge-bg: var(--cyan);
}

.badge--blue {
    --badge-bg: var(--blue);
    color: var(--paper);
}

.badge--coral {
    --badge-bg: var(--coral);
}

.badge--green {
    --badge-bg: var(--green);
}

.badge--navy {
    --badge-bg: var(--navy);
    color: var(--paper);
}

/* --- souhaits dépliables (<details>) ------------------------------------------------------------------- */
.wish-list {
    display: grid;
    gap: 0.75rem;
}

.wish {
    background: var(--paper);
    border: var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.15s var(--ease), transform 0.15s var(--ease);
}

.wish:hover {
    box-shadow: var(--shadow);
    transform: translate(-1px, -1px);
}

.wish[open] {
    box-shadow: var(--shadow);
}

.wish--bought {
    background: var(--cream);
}

.wish__summary {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    cursor: pointer;
    list-style: none;
    border-radius: calc(var(--radius) - 3px);
}

.wish__summary::-webkit-details-marker {
    display: none;
}

.wish__summary::after {
    content: "";
    flex-shrink: 0;
    width: 10px;
    height: 10px;
    margin-left: auto;
    border-right: 2.5px solid var(--navy);
    border-bottom: 2.5px solid var(--navy);
    transform: translateY(-3px) rotate(45deg);
    transition: transform 0.2s var(--ease);
}

.wish[open] > .wish__summary {
    border-bottom: 2px dashed rgba(0, 0, 75, 0.25);
    border-radius: calc(var(--radius) - 3px) calc(var(--radius) - 3px) 0 0;
}

.wish[open] > .wish__summary::after {
    transform: translateY(2px) rotate(-135deg);
}

.wish__rank {
    display: grid;
    place-items: center;
    min-width: 30px;
    height: 30px;
    padding: 0 0.4rem;
    flex-shrink: 0;
    border: 2px solid var(--navy);
    border-radius: 8px;
    background: var(--cyan);
    font-size: 0.75rem;
    font-weight: 800;
}

.wish__rank--private {
    background: var(--cream);
}

.wish__title {
    flex: 1;
    min-width: 0;
    font-weight: 700;
}

.wish__tags {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    justify-content: flex-end;
}

.wish__price {
    flex-shrink: 0;
    padding: 0.05rem 0.5rem;
    border-radius: 6px;
    background: var(--yellow-soft);
    font-size: 0.8125rem;
    font-weight: 700;
    white-space: nowrap;
}

.wish__body {
    padding: 1rem 1.1rem 1.1rem;
    display: grid;
    gap: 0.85rem;
}

.wish__info {
    white-space: pre-line;
}

.wish__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1.25rem;
    color: var(--muted);
    font-size: 0.8125rem;
}

.wish__meta span {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.wish__purchases {
    list-style: none;
    padding: 0.75rem 0.9rem;
    display: grid;
    gap: 0.35rem;
    background: var(--cream);
    border: 2px dashed rgba(0, 0, 75, 0.3);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
}

.wish__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding-top: 0.25rem;
}

.wish__actions form {
    display: contents;
}

/* --- tableaux ------------------------------------------------------------------------------------------ */
.table-wrap {
    overflow-x: auto;
    background: var(--paper);
    border: var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.table th,
.table td {
    padding: 0.7rem 0.9rem;
    text-align: left;
    vertical-align: middle;
}

.table thead th {
    background: var(--navy);
    color: var(--paper);
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    white-space: nowrap;
}

.table tbody tr + tr td {
    border-top: 1.5px solid rgba(0, 0, 75, 0.15);
}

.table tbody tr:hover td {
    background: var(--cream);
}

.table td.num,
.table th.num {
    width: 1%;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.table form {
    display: inline;
}

.row--danger td {
    background: var(--coral-soft);
}

/* --- messages ------------------------------------------------------------------------------------------ */
.alert {
    --alert-bg: var(--cyan-soft);
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    background: var(--alert-bg);
    border: var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    font-size: 0.9rem;
}

.alert > .icon {
    margin-top: 0.15em;
}

.alert__text {
    flex: 1;
}

.alert__close {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    margin: -0.2rem -0.3rem -0.2rem 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
}

.alert__close:hover {
    background: rgba(0, 0, 75, 0.1);
}

.alert--success {
    --alert-bg: var(--green-soft);
}

.alert--info,
.alert--primary {
    --alert-bg: var(--cyan-soft);
}

.alert--warning {
    --alert-bg: var(--yellow-soft);
}

.alert--danger {
    --alert-bg: var(--coral-soft);
}

.flashes {
    display: grid;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

/* --- menu d'actions (<details>) ------------------------------------------------------------------------ */
.menu-pop {
    position: relative;
    display: inline-block;
}

.menu-pop > summary {
    list-style: none;
}

.menu-pop > summary::-webkit-details-marker {
    display: none;
}

.menu-pop__list {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    z-index: 30;
    min-width: 220px;
    padding: 0.35rem;
    list-style: none;
    background: var(--paper);
    border: var(--line);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
}

.menu-pop__list form {
    display: block;
}

.menu-pop__item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 0.65rem;
    border: 0;
    border-radius: 6px;
    background: none;
    color: var(--navy);
    font-size: 0.875rem;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.menu-pop__item:hover {
    background: var(--yellow);
}

.menu-pop__item--danger:hover {
    background: var(--coral);
}

.menu-pop__sep {
    height: 0;
    margin: 0.35rem 0;
    border-top: 2px dashed rgba(0, 0, 75, 0.2);
}

/* --- formulaires --------------------------------------------------------------------------------------- */
.form {
    display: grid;
    gap: 1.25rem;
}

/* un formulaire qui suit un tableau, un texte ou une liste dans une section ou une carte */
:where(.section, .card) > :not(.section__title) + form {
    margin-top: 1.5rem;
}

.field {
    display: grid;
    gap: 0.4rem;
    /* case seule (souvent un long libellé) : coins normaux plutôt qu'une pilule */
}

.field > .check {
    justify-self: start;
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.85rem 0.5rem 0.6rem;
}

.jour-mois {
    display: grid;
    grid-template-columns: minmax(5rem, 1fr) minmax(8rem, 2fr);
    gap: 0.5rem;
}

.field__label,
.form-legend {
    font-weight: 700;
    font-size: 0.875rem;
}

.field__label--required::after {
    content: " *";
    color: var(--coral);
}

.field__help {
    color: var(--muted);
    font-size: 0.8125rem;
}

.field__error,
.field__errors {
    color: #c81e24;
    font-size: 0.8125rem;
    font-weight: 700;
    list-style: none;
    padding: 0;
}

.input,
.select,
textarea.input {
    width: 100%;
    min-height: 46px;
    padding: 0.6rem 0.85rem;
    background: var(--paper);
    border: var(--line);
    border-radius: var(--radius-sm);
    box-shadow: inset 2px 2px 0 rgba(0, 0, 75, 0.08);
    transition: box-shadow 0.15s, background 0.15s;
}

.input::placeholder,
.select::placeholder,
textarea.input::placeholder {
    color: rgba(91, 91, 134, 0.7);
}

.input:focus,
.select:focus,
textarea.input:focus {
    outline: none;
    background: #fffdf2;
    box-shadow: var(--shadow-sm);
}

.input[aria-invalid=true],
.select[aria-invalid=true],
textarea.input[aria-invalid=true] {
    border-color: #c81e24;
}

textarea.input {
    min-height: 120px;
    resize: vertical;
}

.select {
    appearance: none;
    padding-right: 2.5rem;
    background-image: linear-gradient(45deg, transparent 50%, var(--navy) 50%), linear-gradient(135deg, var(--navy) 50%, transparent 50%);
    background-position: calc(100% - 20px) 52%, calc(100% - 14px) 52%;
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
}

.select[multiple] {
    height: 9.5em;
    min-height: 0;
    padding: 0.4rem;
    background-image: none;
}

.choices {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.check {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.4rem 0.75rem 0.4rem 0.5rem;
    background: var(--paper);
    border: 2px solid var(--navy);
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.875rem;
    user-select: none;
    transition: background 0.15s;
}

.check:has(input:checked) {
    background: var(--cyan);
    font-weight: 700;
}

.check input {
    appearance: none;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin: 0;
    border: 2px solid var(--navy);
    border-radius: 5px;
    background: var(--paper);
    display: grid;
    place-items: center;
    cursor: pointer;
}

.check input[type=radio] {
    border-radius: 50%;
}

.check input::after {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 2px;
    background: var(--navy);
    transform: scale(0);
    transition: transform 0.15s var(--ease);
}

.check input[type=radio]::after {
    border-radius: 50%;
}

.check input:checked::after {
    transform: scale(1);
}

fieldset {
    border: 0;
    padding: 0;
    min-width: 0;
}

.fieldset {
    display: grid;
    gap: 0.75rem;
}

.fieldset legend {
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.date-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.date-fields .select {
    width: auto;
    flex: 1 1 90px;
}

/* --- divers -------------------------------------------------------------------------------------------- */
.stat {
    display: inline-flex;
    align-items: baseline;
    gap: 0.35rem;
    padding: 0.35rem 0.85rem;
    background: var(--navy);
    color: var(--yellow);
    border-radius: var(--radius-sm);
    font-weight: 800;
    font-size: 1.1rem;
    box-shadow: 3px 3px 0 var(--cyan);
}

.stat small {
    color: var(--paper);
    font-weight: 500;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.empty {
    padding: 2rem 1.25rem;
    text-align: center;
    color: var(--muted);
    border: 2.5px dashed rgba(0, 0, 75, 0.3);
    border-radius: var(--radius);
}

.empty .icon {
    width: 36px;
    height: 36px;
    margin: 0 auto 0.75rem;
    color: var(--navy);
}

.prose {
    max-width: 68ch;
}

.prose > * + * {
    margin-top: 1em;
}

.prose h2,
.prose h3 {
    margin-top: 2em;
}

.prose ul,
.prose ol {
    padding-left: 1.25rem;
}

.prose li + li {
    margin-top: 0.35em;
}

.chain {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
}

hr {
    border: 0;
    border-top: 2px dashed rgba(0, 0, 75, 0.25);
    margin: 2rem 0;
}

/* --- listes de souhaits dépliables (page « Les listes ») ----------------------------------------------------- */
.listes-sections {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.listes-sections > .section {
    margin-top: 0;
}

.liste-depliable__titre {
    list-style: none;
    cursor: pointer;
}

.liste-depliable__titre::-webkit-details-marker {
    display: none;
}

.liste-depliable__titre .section__title {
    margin-bottom: 0;
}

/* chevron après la ligne pointillée du titre */
.liste-depliable__titre .section__title::before {
    content: "";
    order: 10;
    flex-shrink: 0;
    width: 10px;
    height: 10px;
    margin-left: 0.25rem;
    border-right: 2.5px solid var(--navy);
    border-bottom: 2.5px solid var(--navy);
    transform: translateY(-3px) rotate(45deg);
    transition: transform 0.2s var(--ease);
}

.liste-depliable[open] > .liste-depliable__titre .section__title::before {
    transform: translateY(2px) rotate(-135deg);
}

.liste-depliable[open] > .liste-depliable__titre {
    margin-bottom: 1.25rem;
}

/* sous-menu par année (cadeaux reçus) : titre plus petit, sans pointillés */
.liste-depliable--annee {
    padding-left: 0.75rem;
    border-left: 2px dashed rgba(0, 0, 75, 0.25);
}

.liste-depliable--annee > .liste-depliable__titre .section__title {
    font-size: 1rem;
}

.liste-depliable--annee > .liste-depliable__titre .section__title::after {
    display: none;
}

.liste-depliable--annee[open] > .liste-depliable__titre {
    margin-bottom: 0.75rem;
}

.liste-depliable__titre:focus-visible {
    outline: var(--border-width) solid var(--navy);
    outline-offset: 4px;
    border-radius: var(--radius-sm);
}

/* --- hors ligne : actions indisponibles (assets/js/hors-ligne.js) ------------------------------------------------ */
.btn[aria-disabled="true"],
body.page-hors-ligne .btn[disabled] {
    opacity: 0.45;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
    filter: grayscale(1);
}

/* --- étoile des groupes favoris ------------------------------------------------------------------------- */
/* Pas en favori : blanche à bords marine (--navy). En favori : jaune, même contour marine. */
.favori-form {
    display: inline-flex;
    margin: 0;
}

.favori {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem;
    background: transparent;
    border: 0;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

/* fill et stroke sont des attributs du <path> de lucide : on les cible sur le path, pas sur le <svg> */
.favori .icon {
    width: 1.5rem;
    height: 1.5rem;
}

.favori .icon path {
    fill: var(--paper);
    stroke: var(--navy);
}

.favori.is-favori .icon path {
    fill: var(--yellow);
    stroke: var(--navy);
}

.favori:hover .icon {
    transform: scale(1.1);
}

@media (prefers-reduced-motion: reduce) {
    .favori:hover .icon {
        transform: none;
    }
}

/* --- étoile d'un compte en mémoire ---------------------------------------------------------------------- */
/* Même rendu que l'étoile « en favori » (jaune, contour --navy), plus petite, alignée sur le texte. */
.en-memoire {
    display: inline-block;
    vertical-align: baseline;
}

.en-memoire .icon {
    width: 0.9em;
    height: 0.9em;
    vertical-align: -0.1em;
}

.en-memoire .icon path {
    fill: var(--yellow);
    stroke: var(--navy);
}

/* --- graphe du tirage (docs/spec/graphe-tirage.md) ---------------------------------------------------------- */
.graphe-tirage__tri {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-block-end: 0.5rem;
}

.graphe-tirage__tri [aria-pressed="true"] {
    background: var(--navy);
    color: var(--paper);
}

.graphe-tirage--actif .graphe-tirage__scene {
    position: relative;
    display: block;
    height: clamp(26rem, 60vw, 30rem);
    overflow: hidden;
    touch-action: pan-y;
}

.graphe-tirage--vertical .graphe-tirage__scene {
    height: max(34rem, calc(var(--nb, 8) * 3.2rem));
}

.graphe-tirage__svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    color: var(--navy);
    pointer-events: none;
}

.graphe-tirage__svg line {
    stroke: currentColor;
    stroke-width: 1.5;
    opacity: 0.7;
}

.graphe-tirage__svg line.graphe-tirage__fleche--hesite {
    stroke-dasharray: 6 5;
}

.graphe-tirage__svg line.graphe-tirage__fleche--moi {
    stroke: var(--blue);
    stroke-width: 2.5;
    opacity: 1;
}

.graphe-tirage__svg line.graphe-tirage__fleche--erreur {
    stroke: var(--coral);
    opacity: 1;
}

.graphe-tirage__marqueur path {
    fill: currentColor;
}

.graphe-tirage__marqueur--moi path {
    fill: var(--blue);
}

.graphe-tirage__marqueur--erreur path {
    fill: var(--coral);
}

.graphe-tirage__pastille--seule {
    opacity: 0.45;
}

.graphe-legende {
    font-size: 0.85rem;
}

.graphe-tirage--actif .graphe-tirage__pastille {
    position: absolute;
    left: 0;
    top: 0;
    white-space: nowrap;
    cursor: grab;
    user-select: none;
    touch-action: none;
    will-change: transform;
}

.graphe-tirage__pastille--saisie {
    cursor: grabbing;
    z-index: 2;
}
