/*
 * Public site: the card of a product. A cover with the letter on the left, the text on the right; on a
 * phone the cover goes above the text, square. The product colour lives in the cover and in the mark only
 * (rules.md §2.2); a card under the pointer changes its border, never its shadow (--shadow-card-hover).
 * The text column sets the height of the card (owner, 13.10.2026: a card must not look stretched) and the cover
 * repeats it. The modifier --brief is the card of the home page in the short form: cover, name, status, one sentence;
 * the whole card is the link to the page of the product.
 */

.app-pcard {
    position: relative;
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr);
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-card-hover);
    transition: border-color var(--transition);
}

.app-pcard:hover {
    border-color: var(--border-3);
}

.app-pcard:has(.app-cardlink:focus-visible) {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* The cover is stretched by the grid row when the text column is taller; the letter is a stand-in for the artwork. */
.app-pcard__shot {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 112px;
    background: linear-gradient(135deg, color-mix(in srgb, var(--app-prod, var(--text-3)) 12%, var(--surface)) 0%, var(--surface-2) 100%);
}

/* The cover of a product that has one: the picture whole on the gradient of the cover, in place of the letter (D-027). */
.app-pcard__cover {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* percent of the 16px page text: 400% = 64. */
.app-pcard__letter {
    color: color-mix(in srgb, var(--app-prod, var(--text-3)) 35%, transparent);
    font-size: 400%;
    font-weight: var(--fw-bold);
    letter-spacing: -0.03em;
    line-height: 1;
}

.app-pcard__body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: var(--space-1);
    min-width: 0;
    padding: var(--space-3) var(--space-4);
}

/* One row at every width: the longest status (In development) and a long name fit; a name that does not is cut, never wrapped under. */
.app-pcard__head {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    min-width: 0;
}

.app-pcard__name {
    font-size: var(--fs-card);
    font-weight: var(--fw-semibold);
    letter-spacing: -0.01em;
    line-height: var(--lh-tight);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-pcard__head .app-pill {
    flex: none;
}

.app-pcard__tagline {
    color: var(--text-2);
    font-size: var(--fs-site-read);
    font-weight: var(--fw-medium);
}

.app-pcard__desc {
    color: var(--text-2);
    font-size: var(--fs-site-read);
    line-height: 1.5;
}

.app-pcard__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-1);
    padding-top: var(--space-1);
    border-top: 1px solid var(--border);
    color: var(--text-2);
    font-size: var(--fs-site-meta);
}

/* A link is an action, so the accent paints it (rules.md §2.1). */
.app-pcard__link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-0);
    margin-left: auto;
    font-weight: var(--fw-medium);
    white-space: nowrap;
}

.app-pcard__link svg {
    width: var(--glyph-inline);
    height: var(--glyph-inline);
    fill: none;
    stroke: currentColor;
    stroke-width: var(--stroke);
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* The short card: the name is the link (grid.css .app-cardlink), stretched over the whole card. */
.app-pcard--brief {
    grid-template-columns: 160px minmax(0, 1fr);
}

.app-pcard--brief .app-pcard__shot {
    min-height: 0;
}

@container (min-width: 720px) {
    /* An odd last card takes the whole row, its text keeps the measure of a line: the grid leaves no empty cell. */
    .app-grid--products > .app-pcard:last-child:nth-child(odd):not(.app-pcard--single) {
        grid-column: 1 / -1;
    }

    .app-grid--products > .app-pcard:last-child:nth-child(odd):not(.app-pcard--single) .app-pcard__tagline,
    .app-grid--products > .app-pcard:last-child:nth-child(odd):not(.app-pcard--single) .app-pcard__desc {
        max-width: 440px;
    }
}

@container (max-width: 719px) {
    .app-pcard,
    .app-pcard--brief {
        grid-template-columns: minmax(0, 1fr);
    }

    .app-pcard__shot {
        aspect-ratio: 3 / 1;
    }

    .app-pcard__letter {
        font-size: 400%;
    }
}

/*
 * The only visible product (spec §5): the same card, drawn large — a wide cover beside the text, the name and the sentence one step up.
 * Under 720 it is the ordinary card on the full width of the column. The grid modifier (grid.css) gives it the whole row.
 */
@container (min-width: 720px) {
    .app-pcard--single {
        grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    }

    .app-pcard--single .app-pcard__shot {
        min-height: 320px;
    }

    .app-pcard--single.app-pcard--brief .app-pcard__shot {
        min-height: 240px;
    }

    .app-pcard--single .app-pcard__body {
        gap: var(--space-2);
        padding: var(--space-6);
    }

    .app-pcard--single .app-pcard__name {
        font-size: var(--fs-h2);
    }

    .app-pcard--single .app-pcard__tagline,
    .app-pcard--single .app-pcard__desc {
        font-size: var(--fs-text);
        max-width: var(--w-prose);
    }

    /* percent of the 16px page text: 800% = 128, twice the letter of a regular card. */
    .app-pcard--single .app-pcard__letter {
        font-size: 800%;
    }
}
