/*
 * "My shop" section (sections/myshop.blade.php, myshop.js): the StylMatch side of the product on an ink
 * stage. Left: the app's menu items as a list that walks itself. Right: the creator's shop drawn in HTML;
 * the item in focus is lifted above a dimming veil and gets the lime ring (lime + ink, never lime on white).
 *
 * Motion is transform/opacity only. Every box has its final size from the first paint (no row grows,
 * nothing below moves). The base style is the finished picture: no script, reduced motion or a still
 * capture shows the whole shop with the first item in focus and nothing dimmed.
 *
 * Stacking: the veil is the stage's ::after (z 1). Parts are position: relative without z-index, so a lit
 * part (z 2) rises above the veil from inside the phone. Nothing between the stage and a part may create
 * a stacking context once built, which is why the entrance uses transitions (they leave transform: none),
 * not filled animations.
 */
.nb-ms {
    position: relative; isolation: isolate; overflow: clip;
    padding: var(--sec) 0;
    background: var(--nb-ink); color: #fff;
}
.nb-ms::before {
    content: ""; position: absolute; inset: 0; z-index: -1;
    background: radial-gradient(circle, rgba(255, 255, 255, .07) 1.5px, transparent 2.1px) 0 0 / 26px 26px;
}
.nb-ms .nb-lead { color: rgba(255, 255, 255, .72); }
.nb-ms__in {
    display: grid; gap: 40px;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "head" "stage" "list" "more";
}
.nb-ms__head { grid-area: head; }
.nb-ms__stage { grid-area: stage; }
.nb-ms__list { grid-area: list; }
.nb-ms__more { grid-area: more; }
@media (min-width: 1024px) {
    .nb-ms__in {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: auto auto 1fr;
        grid-template-areas: "head stage" "list stage" "more stage";
        column-gap: clamp(48px, 5vw, 96px); row-gap: 36px;
    }
    .nb-ms__stage { align-self: center; }
}
@media (min-width: 1280px) {
    .nb-ms__stage { max-width: 640px; padding: 76px 0 88px; }
    .nb-ms__phone { zoom: 1.1; }
}

/* ─── List ─── */
.nb-ms__list { display: grid; border-top: 1px solid rgba(255, 255, 255, .12); }
.nb-ms__item {
    position: relative; display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 14px; align-items: start;
    width: 100%; padding: 16px 0 17px; border: 0; border-bottom: 1px solid rgba(255, 255, 255, .12);
    background: none; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.nb-ms__icon {
    display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
    background: rgba(255, 255, 255, .08); color: rgba(255, 255, 255, .8);
    transition: background-color var(--nb-dur-3) ease, color var(--nb-dur-3) ease;
}
.nb-ms__item[aria-pressed="true"] .nb-ms__icon { background: var(--nb-accent); color: var(--nb-on-accent); }
.nb-ms__text { display: grid; gap: 2px; padding-top: 1px; }
.nb-ms__text b { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.4; color: rgba(255, 255, 255, .78); transition: color var(--nb-dur-3) ease; }
.nb-ms__text > span { font-size: 15px; line-height: 1.5; color: rgba(255, 255, 255, .56); text-wrap: pretty; transition: color var(--nb-dur-3) ease; }
.nb-ms__item[aria-pressed="true"] .nb-ms__text b { color: #fff; }
.nb-ms__item[aria-pressed="true"] .nb-ms__text > span { color: rgba(255, 255, 255, .76); }
@media (hover: hover) {
    .nb-ms__item:hover .nb-ms__text b { color: #fff; }
    .nb-ms__item:hover .nb-ms__icon { background: rgba(255, 255, 255, .14); }
    .nb-ms__item[aria-pressed="true"]:hover .nb-ms__icon { background: var(--nb-accent); }
}
.nb-ms__item:focus-visible { outline: 2px solid #fff; outline-offset: 2px; box-shadow: none; border-radius: 6px; }
/* Progress under the item in focus: full when still (base), fills over one step while the list walks. */
.nb-ms__bar { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; overflow: hidden; }
.nb-ms__bar i { display: block; height: 100%; background: var(--nb-accent); transform: scaleX(0); transform-origin: 0 50%; }
.nb-ms__item[aria-pressed="true"] .nb-ms__bar i { transform: scaleX(1); }
.nb-ms.is-walking .nb-ms__item[aria-pressed="true"] .nb-ms__bar i { animation: nb-ms-fill var(--ms-step, 3600ms) linear both; }
.nb-ms.is-held .nb-ms__item .nb-ms__bar i { animation-play-state: paused; }
@keyframes nb-ms-fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.nb-ms__more { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; }
.nb-ms__link {
    display: inline-flex; align-items: center; gap: 6px; min-height: 44px;
    font-weight: 700; color: #fff;
}
.nb-ms__link .nb-i { width: 16px; height: 16px; transition: transform var(--nb-dur-2) var(--nb-ease); }
@media (hover: hover) { .nb-ms__link:hover .nb-i { transform: translateX(3px); } }
.nb-ms :where(a):focus-visible { outline-color: #fff; }

/* ─── Stage ─── */
.nb-ms__stage {
    --veil: rgba(17, 17, 19, .4);
    position: relative; display: grid; place-items: center;
    width: 100%; max-width: 600px; margin: 0 auto; padding: 64px 0 76px;
    border-radius: var(--r-panel); background: #1a1a1f;
    color: var(--nb-ink); font-size: 14px; line-height: 1.35;
    overflow: hidden;
}
.nb-ms__stage::before {
    content: ""; position: absolute; inset: 0;
    background: radial-gradient(circle, rgba(204, 255, 58, .16) 1.5px, transparent 2.1px) 13px 13px / 26px 26px;
    -webkit-mask: radial-gradient(closest-side, #000, transparent); mask: radial-gradient(closest-side, #000, transparent);
}
.nb-ms__stage::after {
    content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
    background: var(--veil); opacity: 0;
    transition: opacity var(--nb-dur-4) ease;
}
.nb-ms.is-live .nb-ms__stage::after { opacity: 1; }

.nb-ms__phone {
    position: relative; display: grid; gap: 8px;
    width: 272px; padding: 18px 14px 16px;
    border-radius: 34px; background: #fff;
    box-shadow: 0 0 0 6px #2a2a30, var(--nb-e-phone);
}
:where(.nb-ms__stage [data-part]) { position: relative; } /* zero specificity: the cards and the badge keep position: absolute */
.nb-ms.is-live .nb-ms__stage [data-part] { transition: transform var(--nb-dur-3) var(--nb-ease); }
.nb-ms__stage[data-active="myshop"] [data-part~="myshop"],
.nb-ms__stage[data-active="earning_links"] [data-part~="earning_links"],
.nb-ms__stage[data-active="group_buy"] [data-part~="group_buy"],
.nb-ms__stage[data-active="booking"] [data-part~="booking"],
.nb-ms__stage[data-active="collab"] [data-part~="collab"],
.nb-ms__stage[data-active="revenue"] [data-part~="revenue"] { z-index: 2; }
/* The ring (lime band between two ink lines) around the part in focus. */
.nb-ms__stage [data-ring]::after {
    content: ""; position: absolute; inset: -6px; border-radius: calc(var(--rr, 14px) + 6px); pointer-events: none;
    border: 3px solid var(--nb-accent); box-shadow: 0 0 0 1.5px var(--nb-ink), inset 0 0 0 1.5px var(--nb-ink);
    opacity: 0; transform: scale(.97);
    transition: opacity var(--nb-dur-3) ease, transform var(--nb-dur-3) var(--nb-ease);
}
.nb-ms__stage[data-active="myshop"] [data-ring="myshop"]::after,
.nb-ms__stage[data-active="earning_links"] [data-ring="earning_links"]::after,
.nb-ms__stage[data-active="group_buy"] [data-ring="group_buy"]::after,
.nb-ms__stage[data-active="booking"] [data-ring="booking"]::after,
.nb-ms__stage[data-active="collab"] [data-ring="collab"]::after,
.nb-ms__stage[data-active="revenue"] [data-ring="revenue"]::after { opacity: 1; transform: none; }

/* Phone content */
.nb-ms__prof { display: flex; align-items: center; gap: 12px; padding: 2px 4px 4px; border-radius: 16px; background: #fff; }
.nb-ms__av { width: 52px; height: 52px; flex: none; border-radius: 50%; object-fit: cover; background: var(--nb-mist); }
.nb-ms__who { display: grid; min-width: 0; }
.nb-ms__who b { font-size: 16px; font-weight: 800; letter-spacing: -0.02em; }
.nb-ms__who span { font-size: 13px; color: var(--nb-ink-3); }
.nb-ms__who .nb-ms__bio { margin-top: 2px; color: var(--nb-ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nb-ms__tabs { display: flex; gap: 4px; padding: 3px; border-radius: 999px; background: var(--nb-mist); }
.nb-ms__tabs span { flex: 1; display: grid; place-items: center; height: 28px; border-radius: 999px; font-size: 13px; font-weight: 700; color: var(--nb-ink-3); }
.nb-ms__tabs .is-on { background: #fff; color: var(--nb-ink); box-shadow: 0 1px 2px rgba(17, 17, 19, .1); }
.nb-ms__grid { --rr: 14px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; border-radius: 14px; background: #fff; }
.nb-ms__tile { position: relative; display: block; aspect-ratio: 1; border-radius: 12px; background: var(--nb-mist); }
.nb-ms__tile img { width: 100%; height: 100%; padding: 8px; object-fit: contain; border-radius: inherit; }
.nb-ms__badge {
    --rr: 999px;
    position: absolute; left: 5px; top: 5px;
    padding: 2px 7px; border-radius: 999px;
    background: var(--nb-ink); color: #fff; font-size: 11px; font-style: normal; font-weight: 700; white-space: nowrap;
}
.nb-ms__row {
    display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; gap: 10px;
    min-height: 52px; padding: 8px 10px; border-radius: 14px; background: var(--nb-mist);
}
.nb-ms__row-i { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: #fff; }
.nb-ms__row-i .nb-i { width: 16px; height: 16px; }
.nb-ms__row-t { display: grid; min-width: 0; }
.nb-ms__row-t b { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nb-ms__row-t small { font-size: 12px; color: var(--nb-ink-3); }
.nb-ms__earn-chip {
    padding: 3px 8px; border-radius: 999px; background: var(--nb-accent); color: var(--nb-on-accent);
    font-size: 12px; font-style: normal; font-weight: 800; font-variant-numeric: tabular-nums;
    box-shadow: inset 0 0 0 1.5px var(--nb-ink);
}
.nb-ms__row-cta { padding: 5px 12px; border-radius: 999px; background: var(--nb-ink); color: #fff; font-size: 12px; font-weight: 700; }
.nb-ms__poll { display: grid; gap: 6px; padding: 10px 12px 12px; border-radius: 14px; background: var(--nb-mist); }
.nb-ms__poll b { font-size: 13px; font-weight: 700; }
.nb-ms__vote { position: relative; display: flex; align-items: center; justify-content: space-between; height: 28px; padding: 0 10px; border-radius: 8px; background: #fff; overflow: hidden; font-size: 12px; font-weight: 600; }
.nb-ms__vote i { position: absolute; inset: 0; background: var(--nb-accent-soft); transform: scaleX(var(--w)); transform-origin: 0 50%; }
.nb-ms__vote:first-of-type i { background: var(--nb-accent); }
.nb-ms__vote span, .nb-ms__vote em { position: relative; font-style: normal; }
.nb-ms__vote em { font-variant-numeric: tabular-nums; }

/* Floating cards around the phone */
.nb-ms__card {
    --rr: 18px;
    position: absolute; display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: 18px; background: #fff;
    box-shadow: 0 1px 2px rgba(17, 17, 19, .2), 0 18px 36px -16px rgba(0, 0, 0, .6);
}
.nb-ms__card--collab { top: 24px; right: max(8px, calc(50% - 284px)); width: 236px; }
.nb-ms__card--earn { bottom: 24px; left: max(8px, calc(50% - 284px)); display: grid; gap: 0; width: 172px; padding: 12px 14px; }
.nb-ms__brand {
    display: grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 10px;
    background: var(--nb-ink); color: var(--nb-accent); font: 800 15px/1 var(--nb-display);
}
.nb-ms__card-t { display: grid; min-width: 0; flex: 1; }
.nb-ms__card-t b { font-size: 13px; font-weight: 800; }
.nb-ms__card-t span { font-size: 12px; color: var(--nb-ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Two states in one cell: the chip never changes width. */
.nb-ms__state { display: grid; flex: none; font-size: 11px; font-weight: 800; }
.nb-ms__state > span { grid-area: 1 / 1; display: inline-flex; align-items: center; justify-content: center; gap: 3px; padding: 4px 8px; border-radius: 999px; white-space: nowrap; transition: opacity var(--nb-dur-3) ease, transform var(--nb-dur-3) var(--nb-ease); }
.nb-ms__state .nb-i { width: 12px; height: 12px; stroke-width: 3; }
.nb-ms__state-a { background: var(--nb-mist); color: var(--nb-ink-2); }
.nb-ms__state-b { background: var(--nb-accent); color: var(--nb-on-accent); box-shadow: inset 0 0 0 1.5px var(--nb-ink); opacity: 0; transform: scale(.9); }
.nb-ms__card--earn > span:first-child { font-size: 12px; font-weight: 600; color: var(--nb-ink-3); }
.nb-ms__card--earn b { font: 800 22px/1.2 var(--nb-display); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.nb-ms__spark { position: relative; display: block; height: 30px; margin-top: 4px; overflow: hidden; }
.nb-ms__spark svg { width: 100%; height: 100%; overflow: visible; }
.nb-ms__spark path { fill: none; stroke: var(--nb-ink); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.nb-ms__spark i { position: absolute; inset: 0 -2px; background: #fff; transform: scaleX(0); transform-origin: 100% 50%; }

/* ─── Live states (myshop.js adds .is-live; reduced motion keeps them still) ─── */
.nb-ms.is-live .nb-ms__earn-chip { opacity: 0; transform: translateY(4px) scale(.8); transition: opacity var(--nb-dur-3) ease, transform var(--nb-dur-3) var(--nb-ease); }
.nb-ms.is-live .nb-ms__stage:is([data-active="earning_links"], [data-active="revenue"]) .nb-ms__earn-chip { opacity: 1; transform: none; transition-delay: 180ms; }
.nb-ms.is-live .nb-ms__vote i { transform: scaleX(.06); transition: transform 700ms var(--nb-ease); }
.nb-ms.is-live .nb-ms__stage[data-active="booking"] .nb-ms__vote i { transform: scaleX(var(--w)); transition-delay: 200ms; }
.nb-ms.is-live .nb-ms__stage[data-active="collab"] .nb-ms__state-a { opacity: 0; transform: scale(.9); transition-delay: 900ms; }
.nb-ms.is-live .nb-ms__stage[data-active="collab"] .nb-ms__state-b { opacity: 1; transform: none; transition-delay: 900ms; }
.nb-ms.is-live .nb-ms__spark i { transform: scaleX(1); }
.nb-ms.is-live .nb-ms__stage[data-active="revenue"] .nb-ms__spark i { transform: scaleX(0); transition: transform 1100ms var(--nb-ease) 200ms; }
.nb-ms.is-live .nb-ms__stage[data-active="group_buy"] .nb-ms__badge { transform: scale(1.12); }
.nb-ms.is-live .nb-ms__stage[data-active="collab"] .nb-ms__card--collab,
.nb-ms.is-live .nb-ms__stage[data-active="revenue"] .nb-ms__card--earn { transform: translateY(-4px); }
.nb-ms.is-live .nb-ms__stage[data-active="group_buy"] .nb-ms__badge { transition: transform var(--nb-dur-3) cubic-bezier(.3, 1.6, .5, 1); }

/* Entrance: the shop assembles once (phone, tiles, rows, then the cards). Hidden only while the motion
   script is in charge (html.nb-motion, dropped after 4s if it never starts). */
.nb-motion .nb-ms__stage:not(.is-built) [data-build] { opacity: 0; transform: translateY(16px) scale(.98); }
.nb-motion .nb-ms__stage:not(.is-built) .nb-ms__card--collab { transform: translate(24px, 8px); }
.nb-motion .nb-ms__stage:not(.is-built) .nb-ms__card--earn { transform: translate(-24px, 8px); }
.nb-ms .nb-ms__stage.is-building [data-build] {
    transition: opacity 420ms ease calc(var(--d, 0) * 80ms), transform 620ms var(--nb-ease-emph) calc(var(--d, 0) * 80ms);
}

/* Narrow phones: the stage keeps the phone at full size and lets the cards overlap its edges. */
@media (max-width: 419.98px) {
    .nb-ms__stage { padding: 40px 0 52px; }
    .nb-ms__phone { width: 256px; padding: 16px 12px 14px; }
    .nb-ms__card--collab { width: 220px; right: 6px; top: 14px; }
    .nb-ms__card--earn { width: 156px; left: 6px; bottom: 12px; }
}
@media (prefers-reduced-motion: reduce) {
    .nb-ms__stage *, .nb-ms__stage *::after, .nb-ms__stage::after { transition: none !important; }
}
