/*
 * DEV-20 VXL: catalog analysis section (#analyze-catalog). Designer-owned.
 * Load after vxl.css and the other jp-assets VXL stylesheets.
 *
 * State contract (read only, set by jp-assets/vxl-analyze.js):
 *   .vxl-analyze[data-analyze-ready]       JS is ready. Without it every panel shows and the step buttons are hidden.
 *   .vxl-analyze[data-step="1|2|3"]        current step.
 *   [data-analyze-step][aria-pressed]      current step button.
 *   [data-analyze-panel][hidden]           panels that are not shown. Never overridden here.
 *   details.vxl-analyze__category[open]    native disclosure, opened and closed by the browser only.
 * Values read from the page: .vxl-analyze__rows li style="--vxl-an-value: 0..1" sets each bar length
 *   as a share of the largest count across all four example groups.
 *   .vxl-analyze__swatch style="--swatch: <colour>" colours a row's swatch.
 *   .vxl-analyze__board style="--vxl-an-panel-min: <length>" may raise the reserved panel height.
 * This file writes no text, numbers or names. Motion uses transform and opacity only.
 * Each panel's motion starts when the panel is shown again (hidden removed), and the content of a
 * details element animates each time it opens, so every step and every opening replays its motion.
 */

.vxl-analyze {
    --vxl-an-ease: cubic-bezier(0.22, 1, 0.36, 1);
    --vxl-an-accent: var(--vxl-accent, #4f44ff);
    --vxl-an-accent-dark: var(--vxl-accent-dark, #3a30e0);
    --vxl-an-ink: var(--vxl-ink, #0f172a);
    --vxl-an-muted: var(--vxl-muted, #475569);
    --vxl-an-line: var(--vxl-line, #d7d9e6);
    --vxl-an-tint: #eceaff;
    --vxl-an-focus: #07004e;
    padding: 48px 0;
    border-top: 1px solid var(--vxl-an-line);
}

@media (min-width: 1024px) {
    .vxl-analyze { padding: 72px 0; }
}

/* JS hides the panels it does not show; keep that true whatever display a rule sets */
.vxl-analyze [hidden] { display: none !important; }

/* ---------- layout: intro | board, notice below ---------- */

.vxl-analyze__layout {
    display: grid;
    gap: 24px;
}

@media (min-width: 1024px) {
    .vxl-analyze__layout {
        grid-template-columns: minmax(0, 38fr) minmax(0, 62fr);
        column-gap: 40px;
        align-items: start;
    }
}

.vxl-analyze__intro { min-width: 0; }

/* ---------- board ---------- */

/* vxl.css frames the board. Spacing and type separate its contents. */
.vxl-analyze__board {
    display: grid;
    gap: 24px;
    min-width: 0;
    container-type: inline-size;
}

.vxl-analyze__board > h3 {
    margin: 0;
    font-size: var(--type-lead);
    font-weight: 800;
    line-height: 1.4;
}

/* metrics: dl > div > dt / dd. 2 x 2 by default, 4 x 1 when the board is at least 36em wide,
   one column when enlarged text leaves the board under 16em (container units follow the text size). */
.vxl-analyze__metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin: 0;
}

@container (min-width: 36em) {
    .vxl-analyze__metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@container (max-width: 16em) {
    .vxl-analyze__metrics { grid-template-columns: minmax(0, 1fr); }
}

.vxl-analyze__metrics > div { min-width: 0; }

.vxl-analyze__metrics dt {
    color: var(--vxl-an-muted);
    font-size: var(--type-body);
    line-height: 1.5;
}

.vxl-analyze__metrics dd {
    margin: 4px 0 0;
    color: var(--vxl-an-ink);
    font-family: 'Barlow Condensed', var(--ja, sans-serif);
    font-size: var(--type-section);
    font-weight: 700;
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* ---------- step buttons ---------- */

.vxl-analyze__steps {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

/* without JS the buttons do nothing: hide them, every panel shows instead */
.vxl-analyze:not([data-analyze-ready]) .vxl-analyze__steps { display: none; }

.vxl-analyze [data-analyze-step] {
    min-width: 0;
    min-height: 48px;
    padding: 8px;
    border: 1px solid #767b98; /* 4.15:1 on white */
    border-radius: 12px;
    background: #fff;
    color: #07004e;
    font: inherit;
    font-size: var(--type-body);
    font-weight: 700;
    line-height: 1.3;
    overflow-wrap: anywhere;
    cursor: pointer;
    transition: background-color 200ms var(--vxl-an-ease), color 200ms var(--vxl-an-ease), border-color 200ms var(--vxl-an-ease);
}

.vxl-analyze [data-analyze-step]:hover { border-color: var(--vxl-an-accent); }

.vxl-analyze [data-analyze-step][aria-pressed="true"] {
    border-color: var(--vxl-an-accent);
    background: var(--vxl-an-accent);
    color: #fff;
}

.vxl-analyze [data-analyze-step]:active { transform: translateY(1px); }

/* ---------- panels ----------
   With JS one panel shows at a time. Every panel keeps the same minimum height, so the board does
   not jump between steps; the floor is in em, so it grows with enlarged text.
   The floor is estimated from the box model of the current content (not measured): step 2 as a
   2 x 2 chart grid, step 3 with one category open, about 25em at 320-1440px and 100% text.
   Re-measure after content changes. A single-column step 2 (enlarged text) and step 3 with both
   categories open are taller; the second is a user action, not a step change.
   Each panel is the size container its charts and thumbnails lay out against. */
.vxl-analyze__panel {
    min-width: 0;
    container: vxl-an-panel / inline-size;
}

.vxl-analyze[data-analyze-ready] .vxl-analyze__panel {
    min-height: var(--vxl-an-panel-min, 25em);
}

.vxl-analyze__panel > h3 {
    margin: 0 0 4px;
    font-size: var(--type-body);
    font-weight: 800;
    line-height: 1.5;
}

.vxl-analyze__panel > p {
    margin: 0 0 12px;
    color: var(--vxl-an-muted);
    font-size: var(--type-body);
    line-height: 1.6;
}

/* ---------- product cards (panel 1, and the examples inside each category) ---------- */

.vxl-analyze__products {
    position: relative;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 9em));
    gap: 8px;
    overflow: hidden;
}

.vxl-analyze__products figure {
    position: relative;
    min-width: 0;
    margin: 0;
}

.vxl-analyze__products img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 5;
    object-fit: contain;
    border-radius: 8px;
}

.vxl-analyze__products figcaption {
    padding-top: 4px;
    color: var(--vxl-an-ink);
    font-size: var(--type-body);
    line-height: 1.5;
    overflow-wrap: anywhere;
}

/* panel 1 only: the line the new cards flow into, a pulse along it, a scan and a tick per card */
.vxl-analyze__panel[data-analyze-panel="1"] .vxl-analyze__products { padding-bottom: 20px; }

.vxl-analyze__panel[data-analyze-panel="1"] .vxl-analyze__products::after {
    content: '';
    position: absolute;
    inset: auto 0 6px;
    height: 4px;
    border-radius: 2px;
    background: #e3e1f7;
}

.vxl-analyze__panel[data-analyze-panel="1"] .vxl-analyze__products::before {
    content: '';
    position: absolute;
    bottom: 6px;
    left: 0;
    z-index: 1;
    width: 30%;
    height: 4px;
    border-radius: 2px;
    background: linear-gradient(90deg, transparent, var(--vxl-an-accent) 50%, transparent);
    opacity: 0;
}

.vxl-analyze__panel[data-analyze-panel="1"] .vxl-analyze__products figure::before {
    content: '';
    position: absolute;
    inset: 0 0 auto;
    z-index: 1;
    aspect-ratio: 4 / 5;
    border-radius: 8px;
    background: linear-gradient(transparent 0, transparent 44%, rgba(79, 68, 255, 0.28) 49%, rgba(79, 68, 255, 0.55) 50%, transparent 56%, transparent 100%);
    pointer-events: none;
    opacity: 0;
}

.vxl-analyze__panel[data-analyze-panel="1"] .vxl-analyze__products figure::after {
    content: '';
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 2;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m6 12.5 4 4 8-9' fill='none' stroke='white' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 16px no-repeat, var(--vxl-an-accent);
}

.vxl-analyze[data-analyze-ready] [data-analyze-panel="1"] .vxl-analyze__products figure { animation: vxl-an-enter 290ms var(--vxl-an-ease) both; }
.vxl-analyze[data-analyze-ready] [data-analyze-panel="1"] .vxl-analyze__products figure::before { animation: vxl-an-scan 340ms var(--vxl-an-ease) both; }
.vxl-analyze[data-analyze-ready] [data-analyze-panel="1"] .vxl-analyze__products figure::after { animation: vxl-an-pop 170ms var(--vxl-an-ease) both; }
.vxl-analyze[data-analyze-ready] [data-analyze-panel="1"] .vxl-analyze__products::before { animation: vxl-an-flow 430ms var(--vxl-an-ease) 290ms 2 both; }

.vxl-analyze[data-analyze-ready] [data-analyze-panel="1"] .vxl-analyze__products figure:nth-child(2) { animation-delay: 70ms; }
.vxl-analyze[data-analyze-ready] [data-analyze-panel="1"] .vxl-analyze__products figure:nth-child(3) { animation-delay: 140ms; }
.vxl-analyze[data-analyze-ready] [data-analyze-panel="1"] .vxl-analyze__products figure:nth-child(1)::before { animation-delay: 380ms; }
.vxl-analyze[data-analyze-ready] [data-analyze-panel="1"] .vxl-analyze__products figure:nth-child(2)::before { animation-delay: 480ms; }
.vxl-analyze[data-analyze-ready] [data-analyze-panel="1"] .vxl-analyze__products figure:nth-child(3)::before { animation-delay: 580ms; }
.vxl-analyze[data-analyze-ready] [data-analyze-panel="1"] .vxl-analyze__products figure:nth-child(1)::after { animation-delay: 700ms; }
.vxl-analyze[data-analyze-ready] [data-analyze-panel="1"] .vxl-analyze__products figure:nth-child(2)::after { animation-delay: 790ms; }
.vxl-analyze[data-analyze-ready] [data-analyze-panel="1"] .vxl-analyze__products figure:nth-child(3)::after { animation-delay: 890ms; }

/* ---------- panel 2: catalog charts ----------
   Groups: div > h4, ul.vxl-analyze__rows, span.vxl-analyze__more (decorative: the list goes on).
   Row: [swatch? name | count] on one line, the bar on its own full-width line below, on a neutral
   track. Every bar in a group starts at the same edge and uses the same track width, so lengths
   compare directly. Two groups per line from a 16em panel, one per line below (enlarged text). */
.vxl-analyze__panel[data-analyze-panel="2"] .vxl-analyze__groups {
    display: grid;
    gap: 20px 24px;
}

@container vxl-an-panel (min-width: 16em) {
    .vxl-analyze__panel[data-analyze-panel="2"] .vxl-analyze__groups { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.vxl-analyze__panel[data-analyze-panel="2"] .vxl-analyze__groups > div { min-width: 0; }

.vxl-analyze__panel[data-analyze-panel="2"] .vxl-analyze__groups h4 {
    margin: 0 0 8px;
    font-size: var(--type-body);
    font-weight: 800;
    line-height: 1.5;
}

.vxl-analyze__rows {
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.vxl-analyze__rows li {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 4px 12px;
    min-width: 0;
}

.vxl-analyze__label {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    color: var(--vxl-an-ink);
    font-size: var(--type-body);
    line-height: 1.5;
    overflow-wrap: anywhere;
}

/* the inset ring keeps white and very light colours visible on white */
.vxl-analyze__swatch {
    flex: none;
    display: block;
    width: 0.875em;
    height: 0.875em;
    border-radius: 50%;
    background: var(--swatch, #c9ccdb);
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.24);
}

.vxl-analyze__count {
    color: var(--vxl-an-ink);
    font-size: var(--type-body);
    font-weight: 700;
    line-height: 1.5;
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* A common scale makes the eight example counts comparable. */
.vxl-analyze__bar {
    grid-column: 1 / -1;
    display: block;
    height: 6px;
    border-radius: 999px;
    background: #ebecf3;
    overflow: hidden;
}

.vxl-analyze__bar::before {
    content: '';
    display: block;
    width: calc(var(--vxl-an-value, 0) * 100%);
    height: 100%;
    border-radius: inherit;
    background: var(--vxl-an-accent); /* 5.83:1 on white */
    transform-origin: 0 50%;
}

/* three muted dots drawn here, centred under the swatches (em = the label's text size);
   any glyph in the span is pushed out of its box and not shown */
.vxl-analyze__more {
    display: block;
    width: 4px;
    height: 16px;
    margin: 6px 0 0 calc(0.4375em - 2px);
    overflow: hidden;
    font-size: var(--type-body);
    text-indent: 100%;
    white-space: nowrap;
    background: radial-gradient(circle, #a3a8bf 1.5px, transparent 2px) 50% 0 / 4px 6px repeat-y;
}

/* groups start one after another, the second row of each a little later, then the dots */
.vxl-analyze__panel[data-analyze-panel="2"] .vxl-analyze__groups > div:nth-child(2) { --vxl-an-group: 150ms; }
.vxl-analyze__panel[data-analyze-panel="2"] .vxl-analyze__groups > div:nth-child(3) { --vxl-an-group: 300ms; }
.vxl-analyze__panel[data-analyze-panel="2"] .vxl-analyze__groups > div:nth-child(4) { --vxl-an-group: 450ms; }
.vxl-analyze__panel[data-analyze-panel="2"] .vxl-analyze__rows li:nth-child(2) { --vxl-an-row: 120ms; }

.vxl-analyze[data-analyze-ready] [data-analyze-panel="2"] .vxl-analyze__bar::before {
    animation: vxl-an-fill 540ms var(--vxl-an-ease) calc(100ms + var(--vxl-an-group, 0ms) + var(--vxl-an-row, 0ms)) both;
}

.vxl-analyze[data-analyze-ready] [data-analyze-panel="2"] .vxl-analyze__label,
.vxl-analyze[data-analyze-ready] [data-analyze-panel="2"] .vxl-analyze__count {
    animation: vxl-an-fade 400ms var(--vxl-an-ease) calc(100ms + var(--vxl-an-group, 0ms) + var(--vxl-an-row, 0ms)) both;
}

.vxl-analyze[data-analyze-ready] [data-analyze-panel="2"] .vxl-analyze__more {
    animation: vxl-an-fade 400ms var(--vxl-an-ease) calc(400ms + var(--vxl-an-group, 0ms)) both;
}

/* ---------- panel 3: categories open to two example thumbnails ---------- */

.vxl-analyze__panel[data-analyze-panel="3"] .vxl-analyze__groups {
    display: grid;
    gap: 8px;
}

/* site.css styles every details/summary on the site (padding 14px 0, margin-top 22px, summary colour);
   reset that here so the categories stay compact */
.vxl-analyze__category {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 1px solid #8b90ad; /* the disclosure control's outline, 3.14:1 on white */
    border-radius: 12px;
    background: #fff;
}

.vxl-analyze__category[open] { border-color: var(--vxl-an-accent); }

/* summary: whole row is the control, 48px+, own open/closed triangle */
.vxl-analyze__category > summary {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 12px;
    min-height: 48px;
    padding: 8px 16px 8px 40px;
    border-radius: 11px;
    color: #07004e;
    font-size: var(--type-body);
    font-weight: 700;
    line-height: 1.5;
    list-style: none;
    cursor: pointer;
}

.vxl-analyze__category > summary::-webkit-details-marker { display: none; }

.vxl-analyze__category > summary::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 16px;
    width: 0;
    height: 0;
    margin-top: -6px;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-left: 9px solid currentColor;
    transition: transform 200ms var(--vxl-an-ease);
}

.vxl-analyze__category[open] > summary::before { transform: rotate(90deg); }

.vxl-analyze__category > summary > span {
    margin-left: auto;
    color: var(--vxl-an-muted);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.vxl-analyze__category > summary:hover { background: #f7f7fb; }

.vxl-analyze__category[open] > summary { color: var(--vxl-an-accent-dark); }

.vxl-analyze__category[open] > summary > span { color: var(--vxl-an-accent-dark); }

/* body of an open category: two equal cards [square photo / name / count].
   Under a 15em panel (enlarged text) one card per line as [photo | caption].
   (details does not lay its own content out as a grid in every browser; the inner div does.) */
.vxl-analyze__category > .vxl-analyze__products {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 4px 16px 16px;
}

.vxl-analyze__products > .vxl-analyze__more {
    grid-column: 1 / -1;
    margin: 0 auto;
}

.vxl-analyze__category > .vxl-analyze__products figure {
    display: grid;
    align-content: start;
    border: 1px solid var(--vxl-an-line);
    border-radius: 10px;
    background: #fff;
    overflow: hidden;
}

.vxl-analyze__category > .vxl-analyze__products img {
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 0;
    background: #f5f5f9;
}

.vxl-analyze__category > .vxl-analyze__products figcaption {
    display: grid;
    min-width: 0;
    padding: 6px 10px 8px;
}

.vxl-analyze__category > .vxl-analyze__products figcaption > span { font-weight: 700; }

.vxl-analyze__category > .vxl-analyze__products figcaption > small {
    color: var(--vxl-an-muted);
    font-size: var(--type-body);
    line-height: 1.5;
    font-variant-numeric: tabular-nums;
}

@container vxl-an-panel (max-width: 15em) {
    .vxl-analyze__category > .vxl-analyze__products { grid-template-columns: minmax(0, 1fr); }

    .vxl-analyze__category > .vxl-analyze__products figure {
        grid-template-columns: 4em minmax(0, 1fr);
        align-items: center;
    }

    .vxl-analyze__category > .vxl-analyze__products figcaption { padding: 6px 10px; }
}

/* motion stays below the summary: the summary itself never moves, so it is always easy to press */
.vxl-analyze__category[open] > .vxl-analyze__products figure { animation: vxl-an-enter 520ms var(--vxl-an-ease) 100ms both; }
.vxl-analyze__category[open] > .vxl-analyze__products figure:nth-child(2) { animation-delay: 220ms; }

/* when the step is shown, the categories appear (opacity only) */
.vxl-analyze[data-analyze-ready] [data-analyze-panel="3"] .vxl-analyze__category { animation: vxl-an-fade 400ms var(--vxl-an-ease) both; }
.vxl-analyze[data-analyze-ready] [data-analyze-panel="3"] .vxl-analyze__category + .vxl-analyze__category { animation-delay: 150ms; }

/* ---------- notice and contact ---------- */

.vxl-analyze__notice {
    display: grid;
    gap: 16px;
    justify-items: start;
    margin-top: 32px;
}

.vxl-analyze__notice p {
    max-width: 66ch;
    margin: 0;
    color: var(--vxl-an-muted);
    font-size: var(--type-body);
    line-height: 1.7;
}

.vxl-analyze__contact {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 8px 20px;
    border-radius: 999px;
    background: var(--vxl-an-accent);
    color: #fff;
    font-size: var(--type-body);
    font-weight: 700;
    line-height: 1.4;
    text-align: center;
    text-decoration: none;
    transition: background-color 200ms var(--vxl-an-ease);
}

.vxl-analyze__contact:hover { background: #07004e; color: #fff; }

/* focus: 3px #07004e on the light backgrounds of this section */
.vxl-analyze [data-analyze-step]:focus-visible,
.vxl-analyze__category > summary:focus-visible,
.vxl-analyze__contact:focus-visible {
    outline: 3px solid var(--vxl-an-focus);
    outline-offset: 3px;
}

/* ---------- keyframes (transform and opacity only) ---------- */

@keyframes vxl-an-enter {
    from { opacity: 0; transform: translateX(24px); }
    to   { opacity: 1; transform: none; }
}

@keyframes vxl-an-scan {
    0%   { opacity: 1; transform: translateY(-60%); }
    85%  { opacity: 1; }
    100% { opacity: 0; transform: translateY(60%); }
}

@keyframes vxl-an-pop {
    0%   { opacity: 0; transform: scale(0.4); }
    70%  { opacity: 1; transform: scale(1.15); }
    100% { opacity: 1; transform: scale(1); }
}

@keyframes vxl-an-flow {
    from { opacity: 1; transform: translateX(-100%); }
    to   { opacity: 1; transform: translateX(340%); }
}

@keyframes vxl-an-fill {
    from { transform: scaleX(0); }
    to   { transform: scaleX(1); }
}

@keyframes vxl-an-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ---------- reduced motion: every step and every opened category shows its finished frame ---------- */

@media (prefers-reduced-motion: reduce) {
    .vxl-analyze *,
    .vxl-analyze *::before,
    .vxl-analyze *::after {
        animation: none !important;
        transition: none !important;
    }

    .vxl-analyze [data-analyze-step]:active { transform: none; }
}
