/* Home (modules/home.php): headline + live totals + moving brand wall, "Popular right now", the brand catalog and
   how it works. Colours come from the theme tokens (light / dark); logical properties keep the layout right in RTL. */
.home main { overflow-x: clip; } /* the hero glow reaches past the stage edge */

/* —— Headline —— */
.hx { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); align-items: center; gap: 28px; padding-top: clamp(8px, 3vw, 44px); }
.hx::before { content: ""; position: absolute; z-index: -1; top: -160px; inset-inline-end: -14%; width: min(780px, 72%); aspect-ratio: 1.25; pointer-events: none;
  background: radial-gradient(closest-side, rgb(var(--accent-rgb) / .09), rgb(var(--accent-rgb) / .035) 55%, transparent); }
.hx-copy { display: grid; justify-items: start; min-width: 0; }
.hx-kicker { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 18px; padding: 6px 13px 6px 11px; border: 1px solid var(--line-2); border-radius: 999px;
  background: var(--panel); color: var(--text-2); font-size: .84rem; font-weight: 600; }
.hx-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); animation: hx-pulse 2.2s ease-out infinite; }
@keyframes hx-pulse { 0% { box-shadow: 0 0 0 0 rgb(74 222 128 / .55); } 70%, 100% { box-shadow: 0 0 0 8px rgb(74 222 128 / 0); } }
.home-title { max-width: 11.6em; color: var(--text); font-size: clamp(2.1rem, 1rem + 3.4vw, 4.4rem); font-weight: 800; line-height: 1.04; letter-spacing: -.048em; }
.home-accent { color: var(--accent); white-space: nowrap; } /* the phrase stays on one line where it fits */
html[dir="rtl"] .home-title { letter-spacing: 0; line-height: 1.3; } /* tracking breaks Arabic joins */
.home-lead { max-width: 56ch; margin-top: clamp(10px, .9vw, 16px); color: var(--text-2); font-size: clamp(1rem, .94rem + .32vw, 1.2rem); }

.home-search { display: flex; align-items: center; gap: 12px; width: min(620px, 100%); height: 60px; margin-top: clamp(20px, 1.65vw, 28px); padding-inline: 20px 8px;
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 16px; box-shadow: 0 1px 2px rgb(var(--shade-rgb) / .05), 0 14px 34px -24px rgb(var(--shade-rgb) / .4);
  transition: border-color .2s, box-shadow .2s; }
.home-search:focus-within { border-color: rgb(var(--accent-rgb) / .55); box-shadow: 0 0 0 4px rgb(var(--accent-rgb) / .12), 0 14px 34px -24px rgb(var(--shade-rgb) / .4); }
.home-search > .ic { flex: none; color: var(--accent); }
.home-search input { flex: 1 1 auto; min-width: 0; height: 100%; padding: 0; border: 0; outline: 0; background: none; color: var(--text); font-size: 1.04rem; }
.home-search input::placeholder { color: var(--muted); opacity: .9; }
.home-search input::-webkit-search-cancel-button { cursor: pointer; }
.home-search-btn { flex: none; height: 42px; padding: 0 20px; border: 0; border-radius: 11px; background: var(--accent); color: var(--accent-ink); font-size: .95rem; font-weight: 700; cursor: pointer;
  box-shadow: 0 8px 20px -10px rgb(var(--accent-rgb) / .8); transition: transform .15s var(--ease), box-shadow .2s, filter .2s; }
.home-search-btn:hover { filter: brightness(1.07); transform: translateY(-1px); }
.home-search-btn:active { transform: scale(.97); }
.home-search-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.hx-stats { display: flex; flex-wrap: wrap; gap: 12px 0; margin: 24px 0 0; padding: 0; list-style: none; }
.hx-stats li { display: grid; gap: 2px; padding-inline: 0 24px; }
.hx-stats li + li { padding-inline-start: 24px; border-inline-start: 1px solid var(--line-2); }
.hx-stats strong { display: inline-flex; align-items: center; gap: 4px; color: var(--text); font-size: 1.55rem; font-weight: 800; line-height: 1.1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.hx-stats span { color: var(--muted); font-size: .84rem; font-weight: 500; }
.hx-stats .is-accent strong { color: var(--accent); }

/* Brand wall: three columns drifting in opposite directions (decorative; the catalog below has the links) */
.hx-wall { display: none; }
@media (min-width: 1100px) {
  .hx { grid-template-columns: minmax(0, 1.12fr) minmax(0, .88fr); gap: 36px; }
  .hx-wall { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; height: 452px; overflow: hidden;
    -webkit-mask-image: linear-gradient(transparent, #000 16%, #000 84%, transparent); mask-image: linear-gradient(transparent, #000 16%, #000 84%, transparent); }
}
.hx-col { min-width: 0; }
.hx-col:nth-child(2) { padding-top: 46px; }
.hx-track { display: grid; gap: 12px; animation: hx-drift 44s linear infinite; }
.hx-track-2 { animation-duration: 52s; animation-direction: reverse; }
.hx-track-3 { animation-duration: 48s; }
@keyframes hx-drift { to { transform: translateY(calc(-50% - 6px)); } } /* the list is doubled: half its height + half a gap loops seamlessly */
.hx-wall:hover .hx-track { animation-play-state: paused; }
.hx-tile { display: flex; align-items: center; gap: 11px; min-width: 0; padding: 11px 12px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel);
  box-shadow: 0 1px 2px rgb(var(--shade-rgb) / .05); }
.hx-tile small { overflow: hidden; color: var(--text-2); font-size: .88rem; font-weight: 700; white-space: nowrap; text-overflow: ellipsis; }

/* Shared logo tile (catalog, wall, popular): always light, so brand colours and black marks read in both themes */
.cc-logo { --mono: #3f3f46; display: grid; place-items: center; width: 52px; height: 52px; flex: none; overflow: hidden; border-radius: 13px; background: #fff; border: 1px solid #e6e9ef;
  box-shadow: 0 1px 2px rgb(15 23 42 / .06), 0 6px 14px -8px rgb(15 23 42 / .25); }
.cc-logo img { width: 28px; height: 28px; object-fit: contain; }
.cc-logo .cc-logo-file { width: 100%; height: 100%; object-fit: cover; }
.cc-logo .logo-mono { color: var(--mono); font-size: .95rem; font-weight: 800; letter-spacing: .02em; }
[data-theme="dark"] .cc-logo { background: #f4f4f5; border-color: transparent; box-shadow: 0 6px 14px -8px rgb(0 0 0 / .6); }
.hx-tile .cc-logo, .hp-top .cc-logo { width: 40px; height: 40px; border-radius: 11px; }
.hx-tile .cc-logo img:not(.cc-logo-file), .hp-top .cc-logo img:not(.cc-logo-file) { width: 22px; height: 22px; }
.cc-logo.tint-lime { --mono: #4d6b00; }
.cc-logo.tint-emerald { --mono: #047857; }
.cc-logo.tint-sky { --mono: #0369a1; }
.cc-logo.tint-violet { --mono: #6d28d9; }
.cc-logo.tint-rose { --mono: #be123c; }
.cc-logo.tint-orange { --mono: #c2410c; }
.cc-logo.tint-amber { --mono: #b45309; }
.cc-logo.tint-teal { --mono: #0f766e; }
.cc-logo.tint-fuchsia { --mono: #a21caf; }

/* —— Popular right now —— */
.hp { margin-top: clamp(34px, 4vw, 52px); }
.hp-head, .hc-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px; margin-bottom: 14px; }
.hp-head h2, .hc-head h2 { display: inline-flex; align-items: center; gap: 9px; color: var(--text); font-size: 1.28rem; font-weight: 800; letter-spacing: -.01em; }
.hp-head h2 .ic { color: var(--accent); }
.hp-all { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: .9rem; font-weight: 600; transition: color .2s; }
.hp-all:hover { color: var(--text); }
.hp-row { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 74%); gap: 12px; overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory; scroll-padding-inline: 2px; padding: 2px 2px 8px; scrollbar-width: thin; }
.hp-card { display: flex; flex-direction: column; gap: 12px; min-width: 0; padding: 16px; scroll-snap-align: start; border: 1px solid var(--line); border-radius: 18px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel)); box-shadow: 0 1px 2px rgb(var(--shade-rgb) / .05);
  transition: transform .25s var(--ease), border-color .2s, box-shadow .25s var(--ease); }
.hp-card:hover { transform: translateY(-3px); border-color: rgb(var(--accent-rgb) / .35); box-shadow: 0 18px 36px -22px rgb(var(--accent-rgb) / .5); }
.hp-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.hp-top { display: flex; align-items: center; gap: 10px; min-width: 0; }
.hp-brand { overflow: hidden; color: var(--muted); font-size: .85rem; font-weight: 700; white-space: nowrap; text-overflow: ellipsis; }
.hp-name { display: -webkit-box; min-height: 2.7em; overflow: hidden; color: var(--text); font-size: 1rem; font-weight: 800; line-height: 1.35; overflow-wrap: anywhere;
  -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.hp-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 12px; border-top: 1px dashed var(--line-2); }
.hp-price strong { color: var(--accent); font-size: 1.15rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.hp-price s { margin-inline-start: 6px; color: var(--muted); font-size: .82rem; }
.hp-chip, .cc-flag { display: inline-flex; flex: none; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; background: var(--panel-3); color: var(--text-2);
  font-size: .74rem; font-weight: 700; white-space: nowrap; }
.hp-chip.is-instant, .cc-flag.is-instant { background: var(--accent-soft); color: var(--accent); }
@media (min-width: 700px) {
  .hp-row { grid-auto-flow: row; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); overflow: visible; padding: 0; }
}

/* —— Brand catalog —— */
.home-catalog { margin-top: clamp(34px, 4vw, 52px); scroll-margin-top: 92px; }
.hc-count { padding: 2px 9px; border-radius: 999px; background: var(--panel-3); color: var(--muted); font-size: .8rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.hf { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 5px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 15px; }
.hf-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 14px; border: 0; border-radius: 11px; background: transparent;
  color: var(--text-2); font-size: .94rem; font-weight: 600; white-space: nowrap; cursor: pointer; transition: background-color .2s, color .2s, box-shadow .2s; }
.hf-btn .ic { color: var(--muted); transition: color .2s; }
.hf-btn:hover { color: var(--text); }
.hf-btn.is-active { background: var(--panel-3); color: var(--text); font-weight: 700; box-shadow: 0 1px 2px rgb(var(--shade-rgb) / .12), 0 0 0 1px var(--line); }
.hf-btn.is-active .ic, .hf-btn.is-active .hf-count { color: var(--accent); }
.hf-count { color: var(--muted); font-size: .76rem; font-weight: 700; font-variant-numeric: tabular-nums; }
[data-theme="light"] .hf-btn.is-active { background: #fff; }

.cc-grid { position: relative; display: grid; grid-template-columns: repeat(auto-fill, minmax(198px, 1fr)); gap: 13px; margin-top: 6px; }
.cc { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 156px; padding: 16px 16px 17px; border: 1px solid var(--line); border-radius: 18px;
  background: var(--panel); box-shadow: 0 1px 2px rgb(var(--shade-rgb) / .05);
  transition: transform .25s var(--ease), border-color .2s, box-shadow .25s var(--ease), background-color .2s; }
.cc:hover { transform: translateY(-3px); border-color: rgb(var(--accent-rgb) / .35); box-shadow: 0 18px 36px -22px rgb(var(--accent-rgb) / .5); }
.cc:active { transform: translateY(-1px) scale(.99); }
.cc:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 18px; }
.cc-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.cc-name { margin-top: auto; padding-top: 16px; color: var(--text); font-size: 1.05rem; font-weight: 800; line-height: 1.3; letter-spacing: -.01em; overflow-wrap: anywhere; }
.cc-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 10px; margin-top: 3px; }
.cc-price { color: var(--accent); font-size: .9rem; font-weight: 700; }
.cc-plans { color: var(--muted); font-size: .8rem; font-weight: 500; }
.cc.is-out, .cc.is-soon { background: var(--panel-2); box-shadow: none; }
.cc.is-out .cc-price { color: var(--muted); font-weight: 600; }
.cc.is-out .cc-logo, .cc.is-soon .cc-logo { filter: saturate(.35); opacity: .85; }
.cc.is-out:hover, .cc.is-soon:hover { border-color: var(--line-2); box-shadow: 0 14px 30px -24px rgb(var(--shade-rgb) / .55); }

/* Folded catalog (home.js): the last shown row fades into the page above a "View all" button */
.cc-grid.is-collapsed::after { content: ""; position: absolute; inset-inline: -6px; bottom: -2px; height: 118px; pointer-events: none; background: linear-gradient(rgb(var(--bg-rgb) / 0), var(--bg) 92%); }
.cc-more { display: flex; align-items: center; gap: 8px; width: fit-content; height: 42px; margin: 6px auto 0; padding: 0 18px; border: 1px solid var(--line-2); border-radius: 999px;
  background: var(--panel); color: var(--text); font-size: .9rem; font-weight: 700; cursor: pointer; position: relative; z-index: 1;
  box-shadow: 0 1px 2px rgb(var(--shade-rgb) / .06); transition: border-color .2s, color .2s, transform .15s var(--ease); }
.cc-more:hover { border-color: rgb(var(--accent-rgb) / .45); color: var(--accent); transform: translateY(-1px); }
.cc-more .hf-count { color: var(--accent); }
.cc-empty { display: grid; justify-items: center; gap: 8px; margin-top: 20px; padding: 40px 16px; border: 1px dashed var(--line-2); border-radius: 18px; color: var(--muted); text-align: center; }

/* Cards rise in on load and again whenever a filter brings them back */
.cc-grid > *, .hp-row > * { animation: rise .4s var(--ease) backwards; }
.cc-grid > :nth-child(2), .hp-row > :nth-child(2) { animation-delay: .03s; }
.cc-grid > :nth-child(3), .hp-row > :nth-child(3) { animation-delay: .06s; }
.cc-grid > :nth-child(4), .hp-row > :nth-child(4) { animation-delay: .09s; }
.cc-grid > :nth-child(5), .hp-row > :nth-child(5) { animation-delay: .12s; }
.cc-grid > :nth-child(6), .hp-row > :nth-child(6) { animation-delay: .15s; }
.cc-grid > :nth-child(7), .hp-row > :nth-child(7) { animation-delay: .18s; }
.cc-grid > :nth-child(n+8), .hp-row > :nth-child(n+8) { animation-delay: .21s; }

@media (prefers-reduced-motion: reduce) {
  .hx-track, .hx-dot { animation: none; }
}
@media (max-width: 640px) {
  .home-search { height: 54px; padding-inline: 14px 6px; gap: 10px; }
  .home-search-btn { height: 42px; padding: 0 14px; }
  .hx-stats strong { font-size: 1.3rem; }
  .hx-stats li { padding-inline-end: 16px; }
  .hx-stats li + li { padding-inline-start: 16px; }
  .hc-head .hf { display: flex; width: 100%; }
  .hf-btn { flex: 1 1 auto; padding: 0 10px; gap: 6px; font-size: .88rem; }
  .cc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .cc { min-height: 146px; padding: 14px; border-radius: 16px; }
  .cc-logo { width: 44px; height: 44px; border-radius: 12px; }
  .cc-logo img { width: 24px; height: 24px; }
  .cc-flag { padding: 2px 7px; font-size: .68rem; }
  .cc-flag.is-instant span { display: none; } /* the bolt alone on small cards; the filter names it */
  .cc-name { font-size: .98rem; }
}
@media (max-width: 420px) {
  .home-accent { white-space: normal; }
  .hf-btn .ic { display: none; }
}
