/* Shared building blocks for the hand-made product pages (loaded after product.css).
   - .flow   : the "step explorer" (see js/core/stepper.js)
   - .mock   : a mini interface drawn in HTML instead of a screenshot
   - .features--4 / .audience : 4-up feature grid and "who it is for" row
   Accent colours always come from the product's .theme-* class in tokens.css. */
/* ---------- Workflow explorer (see js/core/stepper.js) ----------
   Wide screens: step list on the left, the open step's illustration on the right.
   Phones: one column, each illustration opens directly under its own step. */
.flow {
    display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); grid-template-rows: repeat(4, auto) 1fr;
    column-gap: clamp(20px, 4vw, 56px); row-gap: 10px; align-items: start;
}
.flow__heading { grid-column: 1; grid-row: var(--n); margin: 0; scroll-margin-top: calc(var(--header-h) + 16px); }
.flow__step {
    display: flex; align-items: flex-start; gap: 16px; width: 100%; padding: 18px 20px; text-align: start; cursor: pointer;
    color: var(--muted); background: transparent; border: 1.5px solid var(--line); border-radius: var(--radius-lg);
    transition: background-color .2s var(--ease), border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.flow__step::after {
    content: ""; flex: none; align-self: center; width: 9px; height: 9px; margin-inline-start: auto;
    border: solid currentColor; border-width: 2px 2px 0 0; opacity: .45; transform: rotate(45deg);
    transition: transform .2s var(--ease), opacity .2s var(--ease);
}
[dir="rtl"] .flow__step::after { transform: rotate(225deg); }
.flow__step:hover { color: var(--ink-2); border-color: var(--accent); }
.flow__step[aria-expanded="true"] { color: var(--ink-2); background: var(--surface); border-color: var(--accent); box-shadow: var(--shadow-sm); }
.flow__step[aria-expanded="true"]::after { opacity: 1; color: var(--accent); }
.flow__num {
    display: grid; place-items: center; flex: none; width: 34px; height: 34px;
    font-family: var(--font-display); font-weight: 700; color: var(--muted);
    background: var(--surface-2); border-radius: 50%; transition: background-color .2s var(--ease), color .2s var(--ease);
}
.flow__step.is-done .flow__num { color: var(--accent); background: var(--accent-soft); }
.flow__step[aria-expanded="true"] .flow__num { color: var(--on-accent); background: var(--accent); }
.flow__text { display: grid; gap: 2px; line-height: 1.5; }
.flow__text b { font-family: var(--font-display); font-size: 1.2rem; color: var(--ink); }
body.rtl .flow__text b { font-family: "IBM Plex Sans Arabic", var(--font-display); }
.flow__text span { font-size: .96rem; }

.flow__panel {
    grid-column: 2; grid-row: 1 / -1; min-width: 0; min-height: 420px; padding: clamp(18px, 3vw, 40px);
    background:
        radial-gradient(520px 300px at 100% 0%, color-mix(in srgb, var(--accent-bright) 22%, transparent), transparent 70%),
        var(--accent-soft);
    border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--line)); border-radius: var(--radius-xl);
}
.flow__panel:not([hidden]) { animation: flow-in .4s var(--ease); }
@keyframes flow-in { from { opacity: 0; transform: translateY(10px); } }
.flow__note { margin: 14px 4px 0; font-size: .82rem; color: var(--muted); }
.flow__nav { display: flex; justify-content: flex-end; margin-block-start: 14px; }

/* no JavaScript: a plain single column, all steps visible */
.flow:not(.is-enhanced) { grid-template-columns: 1fr; grid-template-rows: none; }
.flow:not(.is-enhanced) > * { grid-column: 1; grid-row: auto; order: calc(var(--n) * 2); }
.flow:not(.is-enhanced) .flow__heading { order: calc(var(--n) * 2 - 1); }
.flow:not(.is-enhanced) .flow__nav { display: none; }

@media (max-width: 900px) {
    .flow, .flow.is-enhanced { grid-template-columns: 1fr; grid-template-rows: none; }
    .flow__heading { grid-column: 1; grid-row: auto; order: calc(var(--n) * 2 - 1); }
    .flow__panel { grid-column: 1; grid-row: auto; order: calc(var(--n) * 2); min-height: 0; margin-block-end: 6px; }
    .flow__step::after { transform: rotate(135deg); }
    [dir="rtl"] .flow__step::after { transform: rotate(135deg); }
    .flow__step[aria-expanded="true"]::after { transform: rotate(-45deg); }
    .flow.is-enhanced .flow__step[aria-expanded="false"] .flow__text span { display: none; }
}

/* mini interface drawn in HTML (not a screenshot) */
.mock { padding: clamp(16px, 2.4vw, 26px); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); }
.mock__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-block-end: 18px; }
.mock__head b { font-family: var(--font-display); font-size: 1.15rem; }
.mock__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-block-end: 18px; }
.mock__field { display: grid; gap: 2px; padding: 10px 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; }
.mock__field span { font-size: .78rem; color: var(--muted); }
.mock__field b { font-size: .95rem; }
.mock__tests { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-block-end: 20px; font-size: .85rem; color: var(--muted); }
.mock__tests ul { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.mock__tests li { padding: 3px 12px; font-weight: 600; color: var(--accent); background: var(--accent-soft); border-radius: 999px; }
.mock__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-block-start: 20px; }
.mbtn { display: inline-flex; align-items: center; padding: 9px 20px; font-size: .9rem; font-weight: 650; color: var(--ink); background: var(--surface); border: 1.5px solid var(--line-strong); border-radius: 9px; }
.mbtn--primary { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
.mbtn--danger { color: var(--danger); border-color: var(--danger); }
.bad { color: var(--danger); }

.mock__table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.mock__table th { padding: 8px 10px; font-size: .78rem; font-weight: 650; text-align: start; color: var(--muted); border-block-end: 1px solid var(--line); }
.mock__table td { padding: 12px 10px; border-block-end: 1px solid var(--line); vertical-align: middle; }
.mock__table tr:last-child td { border-block-end: 0; }
.mock__table td:nth-child(2), .mock__table td:nth-child(3) { white-space: nowrap; }
@media (max-width: 560px) { .mock__table th:nth-child(4), .mock__table td:nth-child(4) { display: none; } .mock__grid { grid-template-columns: 1fr; } }

.mock__list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.mock__list li { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 16px; padding: 10px 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; }
.mock__callout { display: flex; align-items: center; gap: 10px; margin: 16px 0 0; padding: 12px 14px; font-size: .9rem; font-weight: 550; color: var(--warn); background: var(--warn-soft); border-radius: 10px; }
.mock__callout svg { flex: none; width: 20px; height: 20px; }


/* ---------- Features (4-up) and audience ---------- */
.features--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1060px) { .features--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .features--4 { grid-template-columns: 1fr; } }

.audience { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(20px, 3vw, 40px); margin: 0; padding: 0; list-style: none; }
.audience li { padding-block-start: 22px; border-block-start: 2px solid var(--accent); }
.audience__icon { display: grid; place-items: center; width: 44px; height: 44px; margin-block-end: 16px; color: var(--accent); background: var(--accent-soft); border-radius: 12px; }
.audience__icon svg { width: 22px; height: 22px; }
.audience h3 { margin-block-end: 6px; font-size: 1.15rem; }
.audience p { margin: 0; color: var(--muted); font-size: .98rem; }
@media (max-width: 960px) { .audience { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .audience { grid-template-columns: 1fr; } }

/* ---------- Hero visual: main screen + sign-in screen tucked in the corner (AutoHub, BuildX, Market POS) ---------- */
.duo { position: relative; padding-block-end: clamp(24px, 9%, 56px); }
.duo__main img { aspect-ratio: var(--ar, 16 / 9); object-fit: cover; object-position: top; }
.duo__side {
    position: absolute; inset-inline-start: -5%; bottom: 0; width: 46%;
    border-radius: 12px; border-color: var(--line-strong);
    box-shadow: 0 30px 60px -20px rgba(3, 20, 30, .55), 0 0 0 5px var(--paper);
}
@media (max-width: 900px) { .duo__side { inset-inline-start: 0; width: 42%; } }
.product-hero { isolation: isolate; }
.hero-motif {
    position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%; pointer-events: none;
    color: var(--accent-bright); opacity: .24;
    -webkit-mask-image: radial-gradient(ellipse 70% 85% at 74% 45%, #000 18%, transparent 74%);
    mask-image: radial-gradient(ellipse 70% 85% at 74% 45%, #000 18%, transparent 74%);
}
html[data-theme="dark"] .hero-motif { opacity: .3; }
[dir="rtl"] .hero-motif { transform: scaleX(-1); }
.product-hero--wide h1 { max-width: 16ch !important; }
body.rtl .product-hero--wide h1 { max-width: 17ch !important; }

/* ---------- Module map: groups that mirror the product's own side menu ---------- */
.modules { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(20px, 3vw, 40px); margin: 0; padding: 0; list-style: none; }
.modules > li { padding-block-start: 22px; border-block-start: 2px solid var(--accent); }
.modules__icon { display: grid; place-items: center; width: 44px; height: 44px; margin-block-end: 14px; color: var(--accent); background: var(--accent-soft); border-radius: 12px; }
.modules__icon svg { width: 22px; height: 22px; }
.modules h3 { margin-block-end: 12px; font-size: 1.15rem; }
.modules dl { display: grid; gap: 12px; margin: 0; }
.modules dt { font-weight: 650; color: var(--ink); }
.modules dd { margin: 0; font-size: .93rem; line-height: 1.5; color: var(--muted); }
@media (max-width: 1060px) { .modules { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .modules { grid-template-columns: 1fr; } }

/* ---------- "Try it" two-column section used by the interactive demos ---------- */
.demo { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); gap: clamp(28px, 5vw, 72px); align-items: center; }
.demo header p { font-size: 1.1rem; color: var(--muted); }
.demo__note { padding-inline-start: 14px; font-size: .92rem !important; border-inline-start: 3px solid var(--accent); }
@media (max-width: 900px) { .demo { grid-template-columns: 1fr; } }
.demo-card { padding: clamp(18px, 3vw, 32px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); }
.num { unicode-bidi: isolate; font-variant-numeric: tabular-nums; }

/* ---------- Key/value list and receipt used inside step illustrations ---------- */
.kv { display: grid; margin: 0; padding: 0; list-style: none; }
.kv li { display: flex; justify-content: space-between; gap: 16px; padding: 12px 2px; border-block-end: 1px solid var(--line); }
.kv li:last-child { border-block-end: 0; }
.kv span { color: var(--muted); }
.kv b { font-variant-numeric: tabular-nums; }
.kv .is-total { font-size: 1.05rem; }
.receipt { max-width: 22rem; margin-inline: auto; padding: 18px 20px; background: #fff; color: #1a2233; border: 1px solid var(--line); border-radius: 6px; font-size: .9rem; box-shadow: 0 10px 24px -14px rgba(0, 0, 0, .35); }
.receipt h4 { margin: 0 0 2px; text-align: center; font-size: 1rem; }
.receipt small { display: block; margin-block-end: 10px; text-align: center; color: #5b6478; }
.receipt .kv li { padding-block: 7px; border-block-end: 1px dashed #cfd5e3; }
.receipt .kv span { color: #1a2233; }
.receipt .is-total { font-weight: 750; font-size: 1.05rem; }

/* three hero buttons (demo, see more, Try it) should share one row on desktop */
@media (min-width: 901px) {
    .product-hero .hero__actions { gap: 10px; flex-wrap: wrap; }
    .product-hero .hero__actions .button--lg { padding-inline: 18px; font-size: .98rem; white-space: nowrap; }
}
