/* Store sections (modules/home.php, modules/browse.php): the home's brand strip and section cards — the most popular in
   the accent colour, the rest in their own tint — brand rows (section pages, home search results) and the section page
   hero. Each section sets --sx-bg (card), --sx-fg (its line + the hero colour); light theme swaps both. */
.sx-ai { --sx-bg: #1e2408; --sx-fg: #c8f03c; }
.sx-media { --sx-bg: #2a1418; --sx-fg: #ff8f9a; }
.sx-design { --sx-bg: #1d1830; --sx-fg: #b9a6ff; }
.sx-dev { --sx-bg: #0f1f2c; --sx-fg: #7dd3fc; }
.sx-work { --sx-bg: #272010; --sx-fg: #f5c542; }
.sx-learn { --sx-bg: #0f2318; --sx-fg: #5ee39a; }
.sx-vpn { --sx-bg: #0d2426; --sx-fg: #5eead4; }
.sx-other, .sx-all { --sx-bg: var(--panel); --sx-fg: var(--muted); }
[data-theme="light"] .sx-ai { --sx-bg: #f1f9d2; --sx-fg: #4d6b00; }
[data-theme="light"] .sx-media { --sx-bg: #ffe4e8; --sx-fg: #be123c; }
[data-theme="light"] .sx-design { --sx-bg: #ede9fe; --sx-fg: #6d28d9; }
[data-theme="light"] .sx-dev { --sx-bg: #e0f2fe; --sx-fg: #0369a1; }
[data-theme="light"] .sx-work { --sx-bg: #fef3c7; --sx-fg: #b45309; }
[data-theme="light"] .sx-learn { --sx-bg: #e3f7ec; --sx-fg: #047857; }
[data-theme="light"] .sx-vpn { --sx-bg: #ccfbf1; --sx-fg: #0f766e; }
[data-theme="light"] .sx-other, [data-theme="light"] .sx-all { --sx-bg: var(--panel-3); }

/* —— Brand strip (decorative, slowly scrolling) —— */
.sx-mq { min-width: 0; margin-inline: -16px; overflow: hidden; direction: ltr;
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent); -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent); }
.sx-mq-track { display: flex; gap: 10px; width: max-content; animation: sx-mq 26s linear infinite; }
.sx-mq .bt { width: 34px; height: 34px; border-radius: 10px; }
html[dir="rtl"] .sx-mq-track { animation-direction: reverse; }
@keyframes sx-mq { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .sx-mq-track { animation: none; } }

/* —— Section cards —— */
.sx-shelves { display: grid; gap: 12px; }
.sx-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 6px 4px -2px; }
.sx-head h2 { font-size: 17px; font-weight: 800; }
.sx-head span, .sx-head a { color: var(--muted); font-size: 13px; font-weight: 700; }
.sx-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.sx-card { position: relative; isolation: isolate; display: flex; flex-direction: column; justify-content: space-between; gap: 10px; min-width: 0; height: 132px; padding: 14px;
  overflow: hidden; border-radius: 24px; background: var(--sx-bg); color: var(--text); box-shadow: inset 0 1px 0 rgb(255 255 255 / .05);
  transition: transform .2s var(--ease); animation: rise .4s var(--ease) backwards; }
.sx-card:hover { transform: translateY(-2px); }
.sx-card:active { transform: scale(.98); }
.sx-card:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }
.sx-card strong { display: block; overflow: hidden; font-size: 16px; font-weight: 800; line-height: 1.4; text-overflow: ellipsis; white-space: nowrap; }
.sx-card small { display: block; color: var(--sx-fg); font-size: 12px; font-weight: 700; line-height: 1.4; }
.sx-card.is-soon .sx-stack { filter: grayscale(.6); opacity: .7; }
.sx-grid > :nth-child(2) { animation-delay: .04s; }
.sx-grid > :nth-child(3) { animation-delay: .08s; }
.sx-grid > :nth-child(n+4) { animation-delay: .12s; }

/* The section's brands as a row of separate tiles */
.sx-stack { display: flex; gap: 6px; }
.sx-stack .bt { width: 34px; height: 34px; border-radius: 10px; box-shadow: inset 0 1px 0 rgb(255 255 255 / .22), 0 4px 10px -6px rgb(0 0 0 / .5); }

.sx-card.is-featured { justify-content: flex-end; gap: 0; height: 150px; padding: 18px; border-radius: 28px; background: var(--accent); color: var(--accent-ink);
  box-shadow: 0 22px 40px -26px rgb(var(--accent-rgb) / .6); --sx-bg: var(--accent); }
.sx-card.is-featured .sx-stack { position: absolute; top: 18px; inset-inline-end: 18px; gap: 8px; }
.sx-card.is-featured .sx-stack .bt { width: 44px; height: 44px; border-radius: 13px; }
.sx-kicker, .sx-card.is-featured small { color: inherit; font-size: 12.5px; font-weight: 800; opacity: .72; }
.sx-card.is-featured small { font-size: 13px; }
.sx-card.is-featured strong { font-size: 26px; line-height: 1.3; white-space: normal; }

.sx-all { box-shadow: inset 0 0 0 1px var(--line); }
.sx-all-ic { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: var(--panel-3); color: var(--text-2); }

/* A soft light follows the pointer over a card (home.js sets --mx / --my) */
@media (hover: hover) and (pointer: fine) {
  .sx-card::after { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; opacity: 0; pointer-events: none; transition: opacity .3s;
    background: radial-gradient(220px circle at var(--mx, 50%) var(--my, 50%), rgb(255 255 255 / .16), transparent 65%); }
  .sx-card.is-featured::after { background: radial-gradient(240px circle at var(--mx, 50%) var(--my, 50%), rgb(255 255 255 / .35), transparent 65%); }
  .sx-card:hover::after { opacity: 1; }
}
@media (min-width: 640px) { .sx-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1040px) {
  .sx-shelves { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); align-items: start; }
  .sx-head { grid-column: 1 / -1; }
  .sx-card.is-featured { height: 100%; min-height: 276px; }
  .sx-card.is-featured strong { font-size: 34px; }
}

/* —— Brand rows —— */
.sx-list { display: grid; gap: 8px; }
.sx-row { display: flex; align-items: center; gap: 12px; min-height: 72px; padding: 10px 14px; border-radius: 20px; background: var(--panel); color: var(--text);
  transition: background-color .2s, transform .15s var(--ease); animation: rise .35s var(--ease) backwards; }
.sx-row:hover { background: var(--panel-2); }
.sx-row:active { transform: scale(.985); }
.sx-row:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sx-row .bt { width: 48px; height: 48px; border-radius: 15px; box-shadow: inset 0 1px 0 rgb(255 255 255 / .2); }
.sx-main { display: grid; flex: 1 1 auto; min-width: 0; line-height: 1.35; }
.sx-main strong { overflow: hidden; font: 700 16px var(--font); text-overflow: ellipsis; white-space: nowrap; }
.sx-main small { overflow: hidden; color: var(--muted); font-size: 12.5px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.sx-end { display: grid; grid-template-columns: auto auto; justify-items: end; align-items: baseline; column-gap: 4px; row-gap: 4px; flex: none; line-height: 1.2; }
.sx-from { color: var(--muted); font-size: 11.5px; font-weight: 700; }
.sx-price .mn { display: inline-flex; align-items: baseline; gap: 3px; white-space: nowrap; }
.sx-price .mn b { font: 600 17px var(--font); }
.sx-price .mn small { color: var(--muted); font-size: 11.5px; font-weight: 700; }
.sx-badge { grid-column: 1 / -1; display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px; background: var(--panel-3); color: var(--text-2);
  font-size: 11px; font-weight: 800; white-space: nowrap; }
.sx-badge.is-instant { background: var(--accent-soft); color: var(--accent); }
.sx-badge.is-out { background: rgb(245 197 66 / .12); color: #f5c542; }
.sx-badge.is-soon { color: var(--muted); }
.sx-row.is-out, .sx-row.is-soon { opacity: .5; }
[data-theme="light"] .sx-row { background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--line); }
[data-theme="light"] .sx-badge.is-out { color: #b45309; background: #fef3c7; }

/* —— Section page —— */
.sx-page { display: grid; gap: 20px; align-items: start; }
/* Dark hero lit from the far corner in the section's colour over a faint dot grid; the accent for every service */
.sx-page { --sx-glow: var(--sx-fg); }
.sx-page.sx-all, .sx-page.sx-ai { --sx-glow: var(--accent); }
.sx-hero { position: relative; isolation: isolate; display: grid; align-content: end; gap: 18px; min-height: 300px; padding: 22px; overflow: hidden; border-radius: 28px;
  background: radial-gradient(120% 90% at 0% 0%, color-mix(in srgb, var(--sx-glow) 34%, transparent), transparent 58%), var(--sx-hero-base, var(--panel)); color: var(--text); }
html[dir="ltr"] .sx-hero { background: radial-gradient(120% 90% at 100% 0%, color-mix(in srgb, var(--sx-glow) 34%, transparent), transparent 58%), var(--sx-hero-base, var(--panel)); }
.sx-hero::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: radial-gradient(rgb(255 255 255 / .07) 1px, transparent 1.4px) 0 0 / 14px 14px;
  mask-image: linear-gradient(#000, transparent 75%); -webkit-mask-image: linear-gradient(#000, transparent 75%); }
.sx-hero-bar { position: absolute; top: 16px; inset-inline: 16px; display: flex; justify-content: space-between; }
.sx-hero-btn { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: rgb(255 255 255 / .08); color: var(--text);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / .08); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.sx-hero-btn:hover { background: rgb(255 255 255 / .14); }
.sx-hero-main { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.sx-hero h1 { min-width: 0; font-size: clamp(30px, 24px + 1.6vw, 40px); font-weight: 800; line-height: 1.25; text-wrap: balance; }

/* Three brand tiles fanned like cards, "+N" for the rest */
.sx-fan { position: relative; display: flex; flex: none; align-items: center; padding: 10px 6px 14px; direction: ltr; } /* fanned left to right in every language */
.sx-fan .bt { width: 58px; height: 58px; border-radius: 17px; box-shadow: inset 0 1px 0 rgb(255 255 255 / .25), 0 12px 24px -10px rgb(0 0 0 / .7); }
.sx-fan .bt + .bt { margin-inline-start: -18px; }
.sx-fan .bt:nth-child(1) { transform: rotate(-12deg) translateY(6px); }
.sx-fan .bt:nth-child(2) { z-index: 1; transform: rotate(4deg) translateY(-10px); }
.sx-fan .bt:nth-child(3) { z-index: 2; transform: rotate(10deg) translateY(8px); }
.sx-fan-more { position: absolute; z-index: 3; bottom: 2px; inset-inline-end: -2px; display: grid; place-items: center; min-width: 30px; height: 30px; padding: 0 7px; border-radius: 999px;
  background: #fff; color: #09090a; font: 800 12px var(--font); box-shadow: 0 0 0 3px var(--panel); }

/* Services · instant · from price */
.sx-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0; padding: 0; list-style: none; }
.sx-stats li { display: grid; gap: 1px; min-width: 0; padding: 10px 14px; border-radius: 16px; background: rgb(255 255 255 / .04); box-shadow: inset 0 0 0 1px var(--line); }
.sx-stats b { font: 600 20px/1.2 var(--font); }
html[dir="rtl"] .sx-stats b { text-align: right; }
.sx-stats .is-accent b { color: var(--accent); }
.sx-stats span { overflow: hidden; color: var(--muted); font-size: 12px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
[data-theme="light"] .sx-hero::before { background-image: radial-gradient(rgb(0 0 0 / .08) 1px, transparent 1.4px); }
[data-theme="light"] .sx-hero-btn { background: rgb(255 255 255 / .7); box-shadow: inset 0 0 0 1px var(--line); }
[data-theme="light"] .sx-stats li { background: rgb(255 255 255 / .6); }
[data-theme="light"] .sx-fan-more { background: #09090a; color: #fff; }
.sx-body { display: grid; gap: 14px; }
@media (min-width: 901px) {
  .sx-page { grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); }
  .sx-hero { position: sticky; top: 96px; min-height: 380px; }
}
@media (max-width: 900px) {
  .app-shell.sx-browse:not(.home) .shell-stage { padding-top: 0; } /* the hero runs under the status bar */
  .app-shell .shell-stage > .sx-page, .page > .sx-page { gap: 0; max-width: none; margin: 0 -16px; }
  .page > .sx-page { margin-top: -20px; }
  .sx-page { --sx-hero-base: var(--bg); }
  .sx-hero { min-height: 0; padding: calc(78px + env(safe-area-inset-top, 0px)) 18px 52px; border-radius: 0; }
  .sx-hero-bar { top: calc(14px + env(safe-area-inset-top, 0px)); inset-inline: 18px; }
  .sx-body { position: relative; margin-top: -32px; padding: 20px 18px 0; border-radius: 32px 32px 0 0; background: var(--bg); box-shadow: inset 0 1px 0 var(--line); }
}
