/*
 * China Kanta icon system.
 *
 * One language for every glyph in the storefront. Two halves:
 *
 *   components/storefront/icon.blade.php  — the geometry. Lucide v1.70.0 paths (ISC),
 *       drawn on the same 24x24 grid, weight 2, round caps and joins, currentColor.
 *   this sheet                            — the size, colour, container and press state.
 *
 * Before this file, the same app carried five stroke weights (1.4 to 2.6) and sixteen
 * icon sizes (13px to 42px) across four hand-written layers, because each layer sized
 * the icons it happened to render. Sizing is now stated once, in a ramp of eight steps,
 * and this sheet is the only place a glyph's pixel size is decided. The layers above it
 * still mention icon sizes; they are restated here and this file is later, so at equal
 * specificity the browser resolves to the ramp — which ck-msg-browser.mjs reads back as
 * a computed style rather than trusting.
 *
 * Loads AFTER mobile-nav-v7.css, home-storefront-v3.css, messenger-v3.css and
 * checkout-pay-v2.css.
 */

:root {
    /*
     * The brand red is already #e31e24 across the logo, the buttons and the active tab.
     * Icons take that same token rather than a second near-identical red, so a tile and
     * the control under it can never read as two different brands.
     */
    --ck-tile-max: 80px;
    --ck-tile-radius: 22px;
    --ck-tile-bg: #f7f7f8;
    --ck-tile-press: #efeff2;
    --ck-tile-shadow: 0 1px 1px rgba(17, 17, 19, 0.04), 0 6px 14px -7px rgba(17, 17, 19, 0.14);
    --ck-tile-press-shadow: 0 1px 1px rgba(17, 17, 19, 0.05), 0 2px 6px -4px rgba(17, 17, 19, 0.14);
    --ck-icon-ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ---------- the ramp ---------- */

/*
 * The default is the middle of the ramp, so a glyph that nobody sized on purpose still
 * lands on a step rather than on whatever the old width attribute said.
 */
.ck-ico {
    display: block;
    flex: none;
    /*
     * Stroke icons are only crisp if nothing resamples them twice; the svg is the unit
     * that gets resampled, so it is told to prefer geometry over speed.
     */
    shape-rendering: geometricPrecision;
}

/*
 * The base size is deliberately zero-specificity, because the component adds ck-ico to
 * every glyph by merging it into the caller's own class attribute. Written as a normal
 * rule it would beat a Tailwind h-4 w-4 on the same element purely because this sheet is
 * last in the stack, and every hand-sized icon in the app would silently become 20px.
 * As a :where() it is only a floor: any size class written on the element, utility or
 * ramp step, wins.
 */
:where(.ck-ico) {
    width: 20px;
    height: 20px;
}

.ck-ico--14 { width: 14px; height: 14px; }
.ck-ico--16 { width: 16px; height: 16px; }
.ck-ico--18 { width: 18px; height: 18px; }
.ck-ico--20 { width: 20px; height: 20px; }
.ck-ico--24 { width: 24px; height: 24px; }
.ck-ico--28 { width: 28px; height: 28px; }
.ck-ico--32 { width: 32px; height: 32px; }
.ck-ico--40 { width: 40px; height: 40px; }

/*
 * A glyph that sits inside a sentence — a check in a bullet, an arrow in a button label —
 * has to join the text baseline instead of becoming a block. Without this the line breaks
 * because display:block on an svg ends the run of text around it.
 */
.ck-ico--inline {
    display: inline-block;
    vertical-align: -2px;
    margin-right: 4px;
}

/* ---------- bottom bar ---------- */

/*
 * Five tabs, 24px glyphs, and the press scale the nav layer already had. The tab icon is
 * the one glyph a user taps hundreds of times, so its transform stays compositor-only and
 * the colour change stays on the label, not the box.
 */
.ck-tab-icon {
    width: 24px;
    height: 24px;
    transition: transform 180ms var(--ck-icon-ease);
}

.ck-tab:active .ck-tab-icon {
    transform: scale(0.9);
}

/* ---------- header ---------- */

.ck-mnav-action svg,
.ck-support-door svg {
    width: 18px;
    height: 18px;
}

.ck-mnav-camera svg {
    width: 20px;
    height: 20px;
}

.ck-mnav-action,
.ck-mnav-camera,
.ck-sheet-close {
    transition:
        transform 180ms var(--ck-icon-ease),
        background-color 180ms var(--ck-icon-ease);
}

.ck-mnav-action:active,
.ck-mnav-camera:active,
.ck-sheet-close:active {
    transform: scale(0.93);
}

/* ---------- homepage quick actions ---------- */

/*
 * Five doors on one row. The track is minmax(0, 1fr), not 1fr: a plain 1fr track refuses
 * to shrink below the widest thing inside it, which is how the payment rails ran off the
 * phone once already. The tile then takes the smaller of the premium size and the room
 * actually available, so 430px gets the full 76px square and 320px gets a 58px one rather
 * than a page that scrolls sideways.
 */
.ck-quick {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
    padding: 6px 12px 16px;
}

.ck-quick-item {
    min-width: 0;
    gap: 8px;
    padding: 6px 0 4px;
    border-radius: 18px;
    background: none;
}

.ck-quick-icon {
    display: grid;
    place-items: center;
    width: min(var(--ck-tile-max), 100%);
    height: auto;
    aspect-ratio: 1;
    border-radius: var(--ck-tile-radius);
    background: var(--ck-tile-bg);
    color: var(--ck-brand);
    box-shadow: var(--ck-tile-shadow);
    transition:
        transform 200ms var(--ck-icon-ease),
        background-color 200ms var(--ck-icon-ease),
        box-shadow 200ms var(--ck-icon-ease);
}

.ck-quick-icon .ck-ico {
    width: clamp(26px, 8.2vw, 32px);
    height: clamp(26px, 8.2vw, 32px);
}

.ck-quick-label {
    font-size: clamp(10px, 2.75vw, 12.5px);
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: -0.011em;
    white-space: nowrap;
    color: var(--ck-ink);
}

/*
 * Press feedback lives on the tile, not the link: the label must not move, and a
 * background flash across the whole column reads as a table row rather than a button.
 * Scale is compositor-only, so nothing reflows and nothing around it repaints.
 */
.ck-quick-item:active .ck-quick-icon {
    transform: scale(0.93);
    background: var(--ck-tile-press);
    box-shadow: var(--ck-tile-press-shadow);
}

.ck-quick-item:focus-visible .ck-quick-icon {
    outline: 2px solid var(--ck-brand);
    outline-offset: 3px;
}

/*
 * Below 360px the row buys its own room back: tighter gutters keep the tile square and
 * the label on one line instead of wrapping "Get a quote" under itself.
 */
@media (max-width: 359.98px) {
    .ck-quick {
        gap: 4px;
        padding-inline: 8px;
    }

    .ck-quick-icon {
        border-radius: 18px;
    }
}

/*
 * The door tile and the file chip were sized by sheets that predate this one, and both
 * landed their glyph on 22px — a step nothing else in the app uses. Here, not in those
 * sheets: this file is linked last, so one rule moves them onto the ramp without editing
 * a shipped wave. The block below still takes the door glyph up to 30px on a desktop.
 */
.ck-door-icon .ck-ico,
.ck-msg-file .ck-ico {
    width: 24px;
    height: 24px;
}

/* ---------- the same row, desktop ---------- */

/*
 * On a tablet and up the doors are the three-card layout in home/quick-actions, and there
 * is room to let each tile breathe.
 */
@media (min-width: 1024px) {
    .ck-door-icon {
        display: grid;
        place-items: center;
        width: 64px;
        height: 64px;
        border-radius: 20px;
        background: var(--ck-tile-bg);
        color: var(--ck-brand);
        box-shadow: var(--ck-tile-shadow);
        transition:
            transform 220ms var(--ck-icon-ease),
            background-color 220ms var(--ck-icon-ease);
    }

    .ck-door-icon .ck-ico {
        width: 30px;
        height: 30px;
    }

    .ck-door:active .ck-door-icon {
        transform: scale(0.96);
        background: var(--ck-tile-press);
    }
}

.ck-door-arrow {
    width: 16px;
    height: 16px;
}

/* ---------- the rest of the storefront, on the ramp ---------- */

.ck-head-arrow,
.ck-card-ship svg,
.ck-card-add-icon,
.ck-msg-verified svg { width: 14px; height: 14px; }

.ck-supplier-seal,
.ck-supplier-arrow,
.ck-sheet-close svg,
.ck-msg-shortcut svg,
.ck-msg-search svg,
.ck-msg-search-clear svg,
.ck-msg-action svg,
.ck-msg-labelrow svg,
.ck-msg-tools svg,
.ck-msg-reactpicker summary svg { width: 16px; height: 16px; }

.ck-rail-nav svg,
.ckp-rail-tick,
.ckp-secure svg,
.ck-msg-send svg,
.ck-msg-thumb svg { width: 18px; height: 18px; }

.ck-trust-icon svg,
.ck-msg-back svg,
.ck-msg-file svg,
.ck-msg-attach-btn svg { width: 20px; height: 20px; }

.ck-cat-more-icon { width: 24px; height: 24px; }

.ckp-mark svg { width: 32px; height: 32px; }

.ck-msg-empty svg { width: 40px; height: 40px; }

/*
 * The rail arrows and the sheet close are round controls, so they get the same press
 * behaviour as the header pills rather than a flat background flash.
 */
.ck-rail-nav,
.ck-sheet-close {
    transition:
        transform 180ms var(--ck-icon-ease),
        background-color 180ms var(--ck-icon-ease);
}

.ck-rail-nav:active,
.ck-sheet-close:active {
    transform: scale(0.92);
}

/* ---------- rating stars ---------- */

/*
 * The rating widget used a text star, which is a font glyph: it inherited the body font,
 * sat on the text baseline and could not be sized. The Lucide star is the same drawing as
 * every other glyph, and :filled keeps the stroke so a filled star is exactly the outline
 * star filled in, not a heavier shape.
 */
.ck-star {
    display: block;
    flex: none;
    width: 16px;
    height: 16px;
    color: #e5e7eb;
}

.ck-star.is-on {
    color: #f59e0b;
}

.ck-star--lg { width: 20px; height: 20px; }

/* ---------- dark ---------- */

/*
 * The nav layer's dark rules are more specific than a bare class, so the tile has to
 * answer them here rather than hope the light value carries over. The nav sheet's own
 * dark block sets #17171a on these tiles; that is the surface colour the rest of the dark
 * chrome uses, so the tiles keep it and only gain the shadow.
 */
html[data-theme="dark"] .ck-quick-icon {
    background-color: #17171a;
    color: #ff5b5f;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.35), 0 6px 14px -7px rgba(0, 0, 0, 0.55);
}

html[data-theme="dark"] .ck-door-icon {
    background-color: #1f1f23;
    color: #ff5b5f;
}

html[data-theme="dark"] .ck-quick-item:active .ck-quick-icon,
html[data-theme="dark"] .ck-door:active .ck-door-icon {
    background-color: #2a2a2e;
}

html[data-theme="dark"] .ck-quick-label {
    color: #f2f2f4;
}

/* ---------- motion ---------- */

/*
 * The press scale is the point of the interaction, so it is kept and only the easing is
 * removed: a user who asks for less motion still gets the state change.
 */
@media (prefers-reduced-motion: reduce) {
    .ck-quick-icon,
    .ck-door-icon,
    .ck-tab-icon,
    .ck-mnav-action,
    .ck-mnav-camera,
    .ck-rail-nav,
    .ck-sheet-close {
        transition-duration: 1ms;
    }

    .ck-quick-item:active .ck-quick-icon,
    .ck-door:active .ck-door-icon,
    .ck-tab:active .ck-tab-icon,
    .ck-mnav-action:active,
    .ck-mnav-camera:active,
    .ck-rail-nav:active,
    .ck-sheet-close:active {
        transform: none;
    }
}
