/*
 * Adding a wish from a link (plan 05), with the values of docs/maquettes/ajout-v2.html: step 1
 * (/ajouter), « ça réfléchit », and step 2, prefilled. Colours from tokens.css only: where the
 * mockup has a shade of its own, the nearest token stands in for it. Everything fits a 360 px wide
 * screen. Every motion stops under prefers-reduced-motion (at the end).
 */

/* ===== Step 1 ===== */

.bigpaste {
    background: var(--paper);
    border: 1.5px solid var(--line);
    border-radius: 18px;
    padding: 16px;
    margin-top: 8px;
}

/* The label of the link field. */
.bp-title {
    display: block;
    font: 650 1.0625rem/1.25 var(--display);
    margin-bottom: 10px;
}

.bp-field {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 2px solid var(--accent);
    border-radius: 14px;
    padding: 6px 6px 6px 12px;
    background: var(--quote-bg);
}

/*
 * The field itself: the frame above is its border; the frame shows the focus. At 1rem, as every
 * field (forms.css): Safari on iPhone zooms in on a smaller one.
 */
.bp-field input {
    flex: 1;
    min-width: 0;
    font: inherit;
    font-size: 1rem;
    color: var(--ink);
    background: transparent;
    border: 0;
    padding: 6px 0;
    text-overflow: ellipsis;
}

.bp-field input::placeholder {
    color: var(--placeholder);
}

.bp-field input:focus {
    outline: none;
}

.bp-field:focus-within {
    box-shadow: 0 0 0 3px var(--accent-soft);
}

/* « Coller », then « OK »: the submit button of the import. */
.pastebtn {
    flex: none;
    font: inherit;
    font-weight: 600;
    font-size: 0.8125rem;
    border: 0;
    border-radius: 10px;
    padding: 8px 12px;
    background: var(--accent);
    color: var(--paper);
    cursor: pointer;
}

.pastebtn:focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: 2px;
}

.or {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 22px 0;
    color: var(--muted);
    font-size: 0.8125rem;
}

.or::before,
.or::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--line);
}

/* The list the wish goes to, under the ways in. */
.add-list {
    margin-top: 22px;
}

/* The third way in (plan 15), the link of a list kept elsewhere: since plan 17 (decision 6), one
 * discreet line at the bottom, its button read as a link (.linklike). */
.add-other-list {
    margin: 32px 0 0;
    text-align: center;
    font-size: 0.8125rem;
    color: var(--muted);
}

/* ===== « Ça réfléchit » ===== */

.urlbox {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    font-size: 0.875rem;
    background: var(--paper);
    border: 1.5px solid var(--line);
    border-radius: 12px;
    padding: 10px 12px;
}

.urlbox .url {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--muted);
}

.urlbox.done {
    border-color: var(--ok);
}

.urlbox .ok {
    color: var(--ok);
    font-weight: 700;
}

.spinner {
    width: 16px;
    height: 16px;
    flex: none;
    border-radius: 50%;
    border: 2px solid var(--accent-soft);
    border-top-color: var(--accent);
    animation: spin .8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* The card the product will fill: a picture and three lines, shimmering. */
.skel {
    display: flex;
    gap: 12px;
    background: var(--paper);
    border: 1.5px solid var(--line);
    border-radius: var(--radius);
    padding: 12px;
    margin-top: 14px;
}

.sh {
    border-radius: 8px;
    background: linear-gradient(90deg, var(--lilac) 0%, var(--paper) 50%, var(--lilac) 100%);
    background-size: 200% 100%;
    animation: shimmer 1.3s ease-in-out infinite;
}

@keyframes shimmer {
    from {
        background-position: 100% 0;
    }

    to {
        background-position: -100% 0;
    }
}

.sh.thumb {
    width: 76px;
    height: 76px;
    flex: none;
    border-radius: 10px;
}

.sh.l1 {
    height: 14px;
    width: 90%;
    margin-top: 6px;
}

.sh.l2 {
    height: 14px;
    width: 60%;
    margin-top: 8px;
}

.sh.l3 {
    height: 18px;
    width: 40%;
    margin-top: 14px;
}

.checklist {
    list-style: none;
    padding: 0;
    margin: 18px 0 0;
    font-size: 0.875rem;
}

.checklist li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    color: var(--placeholder);
    transition: color .3s;
}

.checklist li .ic {
    width: 20px;
    height: 20px;
    flex: none;
    border-radius: 50%;
    border: 2px solid var(--heart-off);
    display: grid;
    place-items: center;
    font-size: 0.6875rem;
    font-weight: 700;
}

.checklist li.doing {
    color: var(--ink);
}

.checklist li.doing .ic {
    border-color: var(--accent-soft);
    border-top-color: var(--accent);
    animation: spin .8s linear infinite;
}

.checklist li.done {
    color: var(--ink);
}

.checklist li.done .ic {
    border-color: var(--ok);
    background: var(--ok);
    color: var(--paper);
}

/* « Trop long ? Remplis à la main, on garde le lien. », under the checklist. */
.fallback {
    display: block;
    margin-top: 22px;
    font-size: 0.8125rem;
    color: var(--muted);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-align: center;
}

/* The three lines of the card, beside its picture (the mockup's inline "flex: 1"). */
.skel-lines {
    flex: 1;
    min-width: 0;
}

/* « La connexion a coincé. » and « Réessayer », once the loop gives up; « Continuer » without
   JavaScript. */
.import-screen .import-error,
.import-continue {
    margin: 18px 0 0;
}

.import-retry {
    margin-top: 10px;
}

/* ===== Step 2, prefilled ===== */

/* « Fiche récupérée sur Fnac », under the link. */
.fetched {
    font-size: 0.78125rem;
    color: var(--ok);
    margin-top: 6px;
}

/* The photo chosen, whole in its frame (a percentage max-height would not hold in a grid). */
.photo-main {
    height: 150px;
    border-radius: var(--radius);
    background: var(--lilac);
    margin-top: 14px;
    overflow: hidden;
}

.photo-main img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* The other candidate photos, each a radio inside its label: the one checked is framed. */
.photo-alt {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
    align-items: center;
}

.photo-alt .p {
    position: relative;
    width: 46px;
    height: 46px;
    border-radius: 10px;
    background: var(--lilac);
    display: grid;
    place-items: center;
    border: 2px solid transparent;
    overflow: hidden;
    cursor: pointer;
}

.photo-alt .p img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.photo-alt .p:has(:checked) {
    border-color: var(--accent);
}

/* The radio of a photo: out of sight, never by style="" (CSP), but still reached by the keyboard. */
.photo-alt .p input[type="radio"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 1px;
    height: 1px;
    margin: 0;
    opacity: 0;
    pointer-events: none;
}

/* « Sans photo »: a pill beside the photos, framed once chosen as they are. */
.photo-alt .p.none {
    width: auto;
    padding: 0 12px;
    border-radius: 999px;
    background: var(--paper);
    border-color: var(--line);
    font-size: 0.75rem;
    color: var(--muted);
}

.photo-alt .p.none:has(:checked) {
    border-color: var(--accent);
    color: var(--accent);
    font-weight: 600;
}

.photo-alt .p:has(:focus-visible) {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.photo-alt small {
    font-size: 0.75rem;
    color: var(--muted);
    margin-left: 4px;
}

/* The name found, on two lines: the mockup's inline "min-height: 0". */
.f.title-edit {
    font-weight: 600;
    min-height: 0;
}

/* The link that was read, at the top of step 2. */
.import-form > .urlbox {
    margin-top: 4px;
}

.price {
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
}

.price b {
    font-size: 1.125rem;
}

.price span {
    font-size: 0.75rem;
    color: var(--muted);
}

/* « Autre boutique »: the link and « Chercher le prix » side by side. */
.other-shop {
    display: flex;
    gap: 8px;
}

.other-shop .f {
    flex: 1;
    min-width: 0;
}

.other-shop .btn {
    width: auto;
    flex: none;
    padding: 10px 14px;
    font-size: 0.875rem;
}

/* Empty until « Chercher le prix » says why nothing started. */
#other-shop-error:empty,
.offer-rows:empty {
    display: none;
}

/* The shops looked at, each with its price once read. */
.offer-rows {
    list-style: none;
    margin: 8px 0 0;
    padding: 0;
}

.offer-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-top: 1px solid var(--line);
    font-size: 0.8125rem;
}

.offer-row .offer-body {
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
}

.offer-row .offer-error {
    color: var(--accent);
    font-size: 0.75rem;
}

.offer-retry,
.offer-remove {
    font: inherit;
    background: none;
    border: 0;
    padding: 4px 6px;
    cursor: pointer;
}

.offer-retry {
    color: var(--accent);
    font-weight: 600;
    font-size: 0.78125rem;
}

/* No "display" on these two: the hidden attribute must keep hiding them. */
.offer-remove {
    color: var(--muted);
    font-size: 1.125rem;
    line-height: 1;
}

/* No spinning, no shimmer, no fading for those who asked their system for less motion. */
@media (prefers-reduced-motion: reduce) {
    .spinner,
    .sh,
    .checklist li.doing .ic {
        animation: none;
    }

    .checklist li {
        transition: none;
    }
}

/*
 * « Ça ressemble à une liste » (plan 15, import/list_suggestion.html.twig): the link, then the
 * question and its two answers, one under the other.
 */
.list-suggestion {
    margin-top: 12px;
}

.list-suggestion .hint {
    margin: 0 0 14px;
}

.list-suggestion form {
    margin: 10px 0 0;
}
