/*
 * ck-photo-search-v2.css — the picture search page, with the two doors and the three chips.
 *
 * What changed from v1 is the top of the page and what sits under it. v1 offered one dashed field
 * that said "choose a picture" and let the phone decide what to open; v2 splits that into the two
 * things a shopper actually means — point the camera at the thing in front of them, or send a
 * picture they already have — and puts the answer behind a row of chips that only ever offers
 * categories, colours and price bands the rows on screen really have.
 *
 * The row grid is still not here. A match is the same .ck-card the home shelf draws, in the same
 * .ck-grid, so nothing about a picture result has to be learned; this layer only adds the one line
 * above each card that says how close it is.
 *
 * A new filename, never a query string: the edge holds a CSS URL for seven days, and v1 is still
 * what a phone that visited yesterday has.
 */

.ckps-title {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: #111827;
}

.ckps-lede {
    margin: 6px 0 0;
    max-width: 56ch;
    font-size: 14px;
    line-height: 1.5;
    color: #4b5563;
}

/* ------------------------------------------------------------------ the two doors */

.ckps-doors {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 16px;
}

/* The file field is the control and the label is the chrome around it, so the box is the grid
   item and the label fills it: two doors side by side that are the same height whatever the
   wording does at a given text size. */
.ckps-door-box {
    position: relative;
    min-width: 0;
}

.ckps-pick {
    display: flex;
    height: 100%;
    box-sizing: border-box;
    align-items: flex-start;
    gap: 8px;
    padding: 13px 14px;
    border: 1px dashed #d1d5db;
    border-radius: 14px;
    background: #fff;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: border-color 120ms ease, background-color 120ms ease;
}

/* The camera is what the page is for, so it is the one door that does not look optional. */
.ckps-pick.is-camera {
    border-style: solid;
    border-color: #f3c9cb;
    background: #fff7f7;
}

.ckps-pick:active {
    background: #f5f5f5;
}

.ckps-pick.is-camera:active {
    background: #fdeeee;
}

.ckps-pick:focus-within {
    border-color: #e31e24;
    border-style: solid;
    box-shadow: 0 0 0 3px rgba(227, 30, 36, 0.14);
}

/* A real input, kept out of sight but not out of the tab order: no styled button can ask a phone
   for its camera, and capture="environment" only rides on a field the browser owns. */
.ckps-input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

.ckps-pick-text {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 2px;
}

.ckps-pick-main {
    font-size: 14.5px;
    font-weight: 600;
    color: #111827;
}

.ckps-pick-sub {
    font-size: 12.5px;
    line-height: 1.35;
    color: #6b7280;
}

/* ------------------------------------------------------------------ what it got */

.ckps-chosen {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
}

.ckps-thumb {
    width: 46px;
    height: 46px;
    flex: none;
    border-radius: 10px;
    background: #f3f4f6;
    object-fit: cover;
}

/* The name of the file a shopper just sent, allowed to break rather than push the page sideways:
    supplier files arrive named in sixty characters of something nobody typed. */
.ckps-chosen-name {
    margin: 0;
    min-width: 0;
    overflow-wrap: anywhere;
    font-size: 13px;
    color: #4b5563;
}

.ckps-busy {
    margin-top: 10px;
    font-size: 13px;
    color: #6b7280;
}

.ckps-hint {
    margin: 10px 0 0;
    max-width: 56ch;
    font-size: 12.5px;
    line-height: 1.5;
    color: #6b7280;
}

/* ------------------------------------------------------------------ the notices */

.ckps-notice {
    margin-top: 16px;
    padding: 14px 16px;
    border: 1px solid #fde3e3;
    border-radius: 14px;
    background: #fef2f2;
}

.ckps-notice-head {
    margin: 0;
    font-size: 14.5px;
    font-weight: 600;
    color: #7c1c1c;
}

.ckps-notice-body {
    margin: 4px 0 0;
    max-width: 62ch;
    font-size: 13.5px;
    line-height: 1.5;
    color: #4b5563;
}

.ckps-sidoor {
    display: inline-block;
    margin-top: 10px;
    padding: 9px 14px;
    border-radius: 9999px;
    background: #e31e24;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
}

.ckps-sidoor:active {
    background: #b71c1c;
}

/* ------------------------------------------------------------------ the chips */

.ckps-filters {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 18px;
}

.ckps-facet {
    min-width: 0;
}

.ckps-facet-label {
    margin: 0 0 5px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #9ca3af;
}

/* One row per facet, scrolling sideways rather than wrapping into a wall: three categories and
   four colours at phone width is otherwise a block of pills taller than the pictures under them. */
.ckps-chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.ckps-chips::-webkit-scrollbar {
    display: none;
}

.ckps-chip {
    flex: none;
    padding: 8px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 9999px;
    background: #fff;
    font-size: 13.5px;
    font-weight: 600;
    white-space: nowrap;
    color: #374151;
    -webkit-tap-highlight-color: transparent;
}

.ckps-chip:active {
    background: #f9fafb;
}

.ckps-chip.is-on {
    border-color: #e31e24;
    background: #e31e24;
    color: #fff;
}

/* The count is the promise that tapping the chip gives something, so it stays legible on a selected
   pill rather than turning into red-on-red. */
.ckps-chip-n {
    margin-inline-start: 5px;
    font-size: 12px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    opacity: 0.65;
}

.ckps-chip.is-clear {
    border-style: dashed;
    color: #6b7280;
}

/* ------------------------------------------------------------------ the results */

.ckps-results-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 20px;
}

.ckps-count {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: #111827;
}

.ckps-count-sub {
    margin-inline-start: 6px;
    font-size: 12.5px;
    font-weight: 500;
    color: #6b7280;
}

.ckps-clear,
.ckps-more-door {
    flex: none;
    padding: 8px 13px;
    border: 1px solid #e5e7eb;
    border-radius: 9999px;
    background: #fff;
    font-size: 13.5px;
    font-weight: 600;
    color: #374151;
    -webkit-tap-highlight-color: transparent;
}

.ckps-clear:active,
.ckps-more-door:active {
    background: #f9fafb;
}

/* The shelf's grid is reused as-is for the columns; only its row gap is this page's, because a row
   of results is a fit line sitting above a card rather than a card alone. */
.ckps-grid {
    row-gap: 16px;
}

/* The slot is the grid item, and the card is what the shelf already knows how to draw inside it.
   min-width:0 because the card's own name line ellipses against its container, and a flex item
   that refuses to shrink below its content is how a long supplier title used to widen the grid. */
.ckps-slot {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 5px;
}

.ckps-fit {
    margin: 0;
    padding-inline-start: 2px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
    color: #6b7280;
}

/* Green, not the store's red: red is what this shop uses for a price and for a button, and a
   reader who mistakes "same item" for an offer taps it expecting one. */
.ckps-fit.is-same {
    color: #0e7a3c;
}

.ckps-more {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 14px;
    padding: 12px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    background: #f9fafb;
}

.ckps-more-said {
    margin: 0;
    min-width: 0;
    font-size: 13.5px;
    line-height: 1.4;
    color: #4b5563;
}

@media (max-width: 340px) {
    .ckps-doors {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 640px) {
    .ckps-title {
        font-size: 24px;
    }

    .ckps-lede {
        font-size: 15px;
    }

    .ckps-doors {
        gap: 12px;
    }

    .ckps-pick {
        padding: 16px 18px;
    }
}
