/*
 * The frame of the pages: the header, the app bar of the mockups, the list cards. The values come
 * from docs/maquettes/ (index.html, ajout-v2.html); colours from tokens.css only. Everything fits
 * a 360 px wide screen.
 */

/*
 * Header: the brand, and for an account its menu. Under the status bar of a phone with a notch,
 * when the page fills the screen (viewport-fit=cover): 0 elsewhere.
 */
.topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
    padding: 12px 16px;
    padding-top: calc(12px + env(safe-area-inset-top, 0px));
    width: 100%;
    max-width: 1240px;
    margin: 0 auto;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font: 650 1.375rem/1 var(--display);
    letter-spacing: -0.01em;
    color: var(--ink);
    text-decoration: none;
}

.brand-dot {
    width: 11px;
    height: 11px;
    flex: none;
    border-radius: 50%;
    background: var(--accent);
}

.topnav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 16px;
    font-size: 0.875rem;
}

.topnav a {
    color: var(--ink);
    text-decoration: none;
}

.topnav a:hover,
.topnav a:focus-visible {
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* The current page: in ink, underlined in the accent. The accent as the colour of the text reads
   at 3.6:1 on the background, below the 4.5:1 of WCAG AA. */
.topnav a[aria-current="page"] {
    color: var(--ink);
    font-weight: 600;
    text-decoration: underline;
    text-decoration-color: var(--accent);
    text-decoration-thickness: 2px;
    text-underline-offset: 5px;
}

/* A button that reads as a link: archiving, a new share link. */
.linklike {
    font: inherit;
    color: var(--muted);
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.linklike:hover,
.linklike:focus-visible {
    color: var(--ink);
}

/*
 * The home page of a visitor (home/index.html.twig, plan 18, A1): one narrow column, centred on a
 * wide screen and longer than it, read from the top. Its button, how it works, a drawing of a
 * list, « Et aussi », the button again; each part well apart from the next.
 */
.wrap.home {
    max-width: 480px;
}

.home .section-title {
    margin-top: 40px;
}

/* « Créer ma liste », what it costs, and the way in for an account, centred under the button. */
.home-start {
    margin: 24px 0 0;
    text-align: center;
}

.home-start .hint {
    margin: 8px 0 0;
}

.home-login {
    margin: 16px 0 0;
    font-size: 0.875rem;
    color: var(--muted);
}

.home-login a {
    padding: 0.5rem 0;
}

/* How it works: each step after its number, in a disc of the accent as the brand's dot. */
.home-steps {
    display: grid;
    gap: 18px;
    margin: 16px 0 0;
    padding: 0;
    list-style: none;
    counter-reset: step;
}

.home-steps li {
    display: grid;
    grid-template-columns: 2rem minmax(0, 1fr);
    column-gap: 14px;
    counter-increment: step;
}

/* The number is drawn, not read: the list says it already. A browser without the alternative text
   of "content" keeps the first value. */
.home-steps li::before {
    content: counter(step);
    content: counter(step) / "";
    grid-row: 1 / span 2;
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--accent);
    color: var(--paper);
    font: 650 0.9375rem/1 var(--display);
}

.home-steps h3 {
    margin: 0;
    padding-top: 0.3125rem;
    font: 650 1.0625rem/1.25 var(--display);
}

.home-steps p {
    margin: 4px 0 0;
    color: var(--muted);
}

/* The drawing of a list as the relatives see it: its caption, then a card holding two wish rows
   (wishlist.css), smaller than the real ones. Nothing in it can be clicked. */
.home-example {
    margin: 40px 0 0;
}

.home-example figcaption {
    margin: 0 0 10px;
    text-align: center;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--muted);
}

.example-list {
    padding: 16px 14px 14px;
    border: 1.5px solid var(--line);
    border-radius: 18px;
    background: var(--bg);
}

.example-list .items {
    margin: 0;
}

.example-list .prod {
    align-items: center;
}

.example-list .thumb {
    width: 56px;
    height: 56px;
}

.home-example .prod-title {
    margin: 0;
    font-size: 0.9375rem;
}

.home-example .resa-status {
    width: fit-content;
}

.home-also p {
    margin: 8px 0 0;
}

.home-end {
    margin: 32px 0 0;
}

/* The buttons of an error page (templates/error/_layout.html.twig), one under the other. */
.error-actions {
    display: grid;
    gap: 10px;
    margin: 24px 0 0;
    max-width: 320px;
}

/* App bar of the mockups: back, crumb and title, for the pages inside a list. */
.appbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 16px 12px;
}

.appbar .back {
    font-size: 1.625rem;
    line-height: 1;
    color: var(--muted);
    text-decoration: none;
}

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

.apptitle {
    font: 650 1.1875rem/1.2 var(--display);
}

/* On a page of one column (the settings of a list), flush with the cards underneath. */
.narrow > .appbar {
    align-items: flex-start;
    padding: 0 0 4px;
}

.narrow > .appbar .apptitle {
    margin: 0;
    overflow-wrap: anywhere;
}

.pad {
    padding: 0 16px 16px;
}

/* The lists: "Mes listes" and the home page. */
.section-title {
    font: 650 1.25rem/1.2 var(--display);
    margin: 28px 0 0;
}

.lists,
.archived-lists {
    display: grid;
    gap: 12px;
    margin-top: 16px;
}

.list-card {
    background: var(--paper);
    border: 1.5px solid var(--line);
    border-radius: 18px;
    padding: 16px;
    min-width: 0;
}

.list-title {
    font: 650 1.125rem/1.25 var(--display);
    margin: 0;
    overflow-wrap: anywhere;
}

.list-title a {
    color: var(--ink);
    text-decoration: none;
}

.list-title a:hover,
.list-title a:focus-visible {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.list-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 12px;
    margin: 6px 0 0;
    font-size: 0.84375rem;
    color: var(--muted);
}

.list-actions {
    margin: 10px 0 0;
    font-size: 0.8125rem;
}

.empty {
    color: var(--muted);
}

.archived {
    margin-top: 28px;
}

.archived summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--muted);
}

.archived .list-card {
    background: var(--drop-bg);
}

.more {
    color: var(--ink);
    font-size: 0.875rem;
    text-underline-offset: 3px;
}

/* The rare ways under the lists of the home page and « Mes listes » (wishlist/_page_links.html.twig,
 * plan 17, D5): plain links side by side, one under the other on a narrow screen, each tall enough
 * for a finger. */
.page-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.25rem 1.5rem;
    margin: 1.75rem 0 0;
}

.page-links a {
    padding: 0.5rem 0;
}

/* The invitation to install Plopi (pwa/_install_card.html.twig, plan 11): a card at the bottom of
 * the home page and « Mes listes » (plan 17, D5). No "display" on what the hidden attribute toggles
 * (the card, its two blocks). « Plus tard » sits closer to the button than .card .btn would. */
.install-card {
    margin-top: 1.25rem;
}

.install-card h2 {
    font: 650 1.0625rem/1.25 var(--display);
    margin: 0 0 0.25rem;
}

.install-card p {
    margin: 0;
}

.install-card p + p {
    margin-top: 0.5rem;
}

.install-card a {
    color: var(--ink);
    text-underline-offset: 3px;
}

.install-card .btn.ghost {
    margin-top: 0.5rem;
}

/* The banner « Connexion plus rapide ? » (account/_passkey_prompt.html.twig, plan 18, B1): a bar
 * fixed at the bottom of the screen, above the iPhone's safe area, on the first page of an account
 * after an e-mail login; its words in a narrow column on a wide screen. No "display" on what the
 * hidden attribute toggles (the banner, its question, its message, its last words). While it shows,
 * the bottom of the page and the sticky buttons of a form make room for its height
 * (--passkey-prompt-height, which the passkey controller measures), so that nothing stays under it. */
.passkey-prompt {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 10;
    padding: 14px max(16px, env(safe-area-inset-right, 0px)) calc(14px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
    background: var(--paper);
    border-top: 1.5px solid var(--line);
    box-shadow: 0 -6px 20px var(--line);
}

.passkey-prompt-inner {
    max-width: 560px;
    margin: 0 auto;
}

.passkey-prompt-ask > p {
    margin: 0;
}

.passkey-prompt-ask > .passkey-prompt-title {
    font: 650 1.0625rem/1.25 var(--display);
}

.passkey-prompt-ask > p + p {
    margin-top: 2px;
}

/* Its message, as a .flash.error looks, without being one of the page's. */
.passkey-prompt-ask > .passkey-prompt-error {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--accent-soft);
}

.passkey-prompt-buttons {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.passkey-prompt-buttons .btn {
    flex: 1 1 0;
    padding: 11px 12px;
}

/* « Ne plus me proposer », a small link under the two buttons, tall enough for a finger. */
.passkey-prompt-never {
    margin: 4px 0 0;
    text-align: center;
    font-size: 0.875rem;
}

.passkey-prompt-never .linklike {
    padding: 8px 4px;
}

/* Its last word, in place of the question, until the banner goes: « C’est activé. », or the words
 * of « Plus tard » and « Ne plus me proposer » with their link to « Connexion rapide ». */
.passkey-prompt-done > p {
    margin: 0;
}

.passkey-prompt-done > .passkey-prompt-ok {
    font-weight: 600;
    color: var(--ok);
}

.passkey-prompt-done a {
    color: var(--ink);
    font-weight: 600;
    text-underline-offset: 3px;
}

body:has(> .passkey-prompt:not([hidden])) {
    padding-bottom: var(--passkey-prompt-height, 10rem);
}

body:has(> .passkey-prompt:not([hidden])) .form-actions {
    bottom: var(--passkey-prompt-height, 10rem);
}

/* List settings (/listes/{id}/reglages): the form, the share link, archiving. */
.narrow > section {
    margin-top: 20px;
}

/* « Ton adresse e-mail » on /compte: the code's form, then « Recevoir un nouveau code ». */
.narrow > section > form + form {
    margin-top: 12px;
}

.block-title {
    font: 650 1.0625rem/1.25 var(--display);
    margin: 26px 0 4px;
}

/* A box, then its label with its hint underneath. */
.check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 14px;
}

.check input {
    flex: none;
    width: 20px;
    height: 20px;
    margin: 0;
    accent-color: var(--accent);
    cursor: pointer;
}

.check label {
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
}

.check .hint {
    margin: 4px 0 0;
}

/*
 * "Me prévenir" is inert while the surprise mode is on (Wishlist::shouldNotifyOwnerOnPurchase()):
 * hidden by the style sheet alone while that box is checked, shown as soon as it is unchecked
 * (plan 17, decision 8), still enabled and sent. A browser without :has() shows it always.
 */
.settings:has(#list_settings_surpriseMode:checked) .notify {
    display: none;
}

/*
 * The share link: read only, the address in view as far as it fits. At 1rem as every field
 * (forms.css, decision 2 of plan 09).
 */
.f[readonly] {
    background: var(--drop-bg);
    text-overflow: ellipsis;
}

.share-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 14px;
}

.card .share-actions .btn {
    margin-top: 0;
}

.share-regenerate {
    margin: 14px 0 0;
    font-size: 0.84375rem;
}

/* "Copié", "Lien copié": for a moment after a copy (the copy and share controllers). */
.btn.copied {
    background: var(--ok-soft);
    color: var(--ok);
}

/* The field that holds a text while it is copied (assets/lib/clipboard.js). */
.offscreen {
    position: fixed;
    top: 0;
    left: -10000px;
    width: 1px;
    height: 1px;
    opacity: 0;
}

/* The footer of every page (_footer.html.twig): the legal notice and the privacy policy. */
.site-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px 10px;
    max-width: 1240px;
    margin: 0 auto;
    padding: 28px 16px calc(28px + env(safe-area-inset-bottom, 0px));
    font-size: 0.8125rem;
    color: var(--muted);
}

.site-footer a {
    color: var(--muted);
    text-underline-offset: 3px;
}

.site-footer a:hover,
.site-footer a:focus-visible {
    color: var(--ink);
}

/* An unknown of the legal pages, « [à compléter] » (legal/_macros.html.twig): seen at a glance. */
mark.todo {
    padding: 0 4px;
    border-radius: 4px;
    background: var(--gold-soft);
    color: var(--gold-ink);
    box-shadow: inset 0 0 0 1px var(--gold-line);
    white-space: nowrap;
}

/* The legal pages (templates/legal/): a column of text. */
.wrap.legal {
    max-width: 760px;
}

.legal h2 {
    font: 650 1.1875rem/1.25 var(--display);
    margin: 30px 0 8px;
}

.legal p,
.legal li {
    overflow-wrap: anywhere;
}

.legal ul {
    margin: 8px 0;
    padding-left: 20px;
}

.legal li + li {
    margin-top: 6px;
}

.legal code {
    font-size: .92em;
}

.legal a {
    color: var(--ink);
    text-underline-offset: 3px;
}

/* While the purge is not active (PURGE_ACTIVE=0): said above the table of what Plopi keeps. */
.purge-off {
    margin: 10px 0 0;
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--gold-soft);
    color: var(--gold-ink);
    border: 1px solid var(--gold-line);
}

.legal-updated {
    margin-top: 32px;
    font-size: 0.84375rem;
    color: var(--muted);
}

/* The help page (/aide, help/index.html.twig, plan 11): a column of text like the legal pages, the
 * Shortcut's steps numbered, and the address it opens broken anywhere on a phone's width. */
.wrap.help {
    max-width: 760px;
}

.help h2 {
    font: 650 1.1875rem/1.25 var(--display);
    margin: 30px 0 8px;
}

.help h3 {
    font-size: 0.9375rem;
    font-weight: 600;
    margin: 14px 0 4px;
}

.help p,
.help li {
    overflow-wrap: anywhere;
}

.help .steps {
    margin: 8px 0;
    padding-left: 22px;
}

.help .steps li + li {
    margin-top: 6px;
}

.help code {
    font-size: .92em;
    overflow-wrap: anywhere;
}

.help a:not(.btn) {
    color: var(--ink);
    text-underline-offset: 3px;
}

/* « Ce que Plopi garde »: a table, then one card per row on a narrow screen. */
.retention {
    width: 100%;
    margin-top: 12px;
    border-collapse: collapse;
    font-size: 0.875rem;
    background: var(--paper);
}

.retention th,
.retention td {
    padding: 10px 12px;
    border: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
    overflow-wrap: anywhere;
}

.retention thead th {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--muted);
    background: var(--drop-bg);
}

.retention tbody th {
    width: 38%;
    font-weight: 400;
}

.retention tbody th strong {
    font-weight: 600;
}

@media (max-width: 640px) {
    .retention,
    .retention tbody,
    .retention tr,
    .retention th,
    .retention tbody th,
    .retention td {
        display: block;
        width: auto;
    }

    .retention {
        background: none;
    }

    /* The column titles move into each card (data-label), still read by screen readers. */
    .retention thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
    }

    .retention tbody tr {
        margin-top: 10px;
        padding: 12px 14px;
        background: var(--paper);
        border: 1.5px solid var(--line);
        border-radius: var(--radius);
    }

    .retention th,
    .retention td {
        padding: 0;
        border: 0;
    }

    .retention td {
        margin-top: 6px;
    }

    .retention td::before {
        content: attr(data-label) "\00a0: ";
        font-weight: 600;
        color: var(--muted);
    }
}
