/* =========================================================
   ALPHA — theme-v5.css · "Apex" layer
   Loads LAST. Owns ONLY the v5 additions:
   ⌘K Spotlight palette · liquid-gold WebGL hero · cart toast ·
   pointer glare on product cards. RTL + dark-theme + lite aware.
   ========================================================= */

/* ---------- 1) Palette trigger (desktop pill, injected by apex.js) ---------- */
.pal-trigger {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 9px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--hairline); background: var(--surface);
  color: var(--muted); font-size: .9rem; font-weight: 500;
  transition: border-color var(--t-fast), color var(--t-fast), box-shadow var(--t-fast);
}
.pal-trigger:hover { color: var(--ink); border-color: rgba(201,162,39,.55); box-shadow: 0 4px 16px rgba(201,162,39,.14); }
.pal-trigger svg { width: 16px; height: 16px; }
.pal-trigger .pk {
  direction: ltr; display: inline-flex; gap: 3px; align-items: center;
  font: 600 .68rem/1 var(--font-display); color: var(--muted-2);
  border: 1px solid var(--hairline-2); border-radius: 6px; padding: 3px 6px;
  background: var(--bg);
}
/* mobile: icon-only trigger sits beside the hamburger */
.pal-trigger-m {
  display: none; align-items: center; justify-content: center;
  min-width: 44px; min-height: 44px; border-radius: 12px; cursor: pointer; color: var(--ink);
}
.pal-trigger-m svg { width: 21px; height: 21px; }
@media (max-width: 979.98px) { .pal-trigger-m { display: inline-flex; } }

/* ---------- 2) ALPHA Spotlight (command palette) ---------- */
.palette {
  position: fixed; inset: 0; z-index: 420; display: none;
  background: rgba(20, 18, 12, .38);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.palette.open { display: block; animation: palFade .22s var(--out); }
@keyframes palFade { from { opacity: 0; } to { opacity: 1; } }

.pal-panel {
  position: absolute; left: 50%; top: 14vh; transform: translateX(-50%);
  width: min(640px, calc(100vw - 32px));
  background: rgba(255,255,255,.94);
  -webkit-backdrop-filter: blur(26px) saturate(1.5); backdrop-filter: blur(26px) saturate(1.5);
  border: 1px solid rgba(201,162,39,.25); border-radius: 22px; overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,.14), 0 40px 90px rgba(0,0,0,.30), 0 0 0 6px rgba(201,162,39,.06);
}
.palette.open .pal-panel { animation: palPop .3s var(--out); }
@keyframes palPop { from { opacity: 0; transform: translateX(-50%) translateY(14px) scale(.975); } to { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); } }

.pal-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--hairline-2); }
.pal-head .si { color: var(--gold-deep); flex: none; display: grid; place-items: center; }
.pal-head input {
  flex: 1; border: 0; outline: 0; background: transparent; color: var(--ink);
  font-family: "Tajawal", var(--font); font-size: 1.08rem; font-weight: 500; min-width: 0;
}
.pal-head input::placeholder { color: var(--muted-2); }
.pal-esc {
  direction: ltr; flex: none; font: 600 .66rem/1 var(--font-display); color: var(--muted-2);
  border: 1px solid var(--hairline-2); border-radius: 6px; padding: 4px 7px; background: var(--bg); cursor: pointer;
}

.pal-body { max-height: min(54vh, 480px); overflow-y: auto; overscroll-behavior: contain; padding: 10px; }
.pal-group { padding: 10px 12px 4px; font: 700 .72rem/1 var(--font-display); color: var(--muted-2); letter-spacing: .04em; }
.pal-empty { padding: 34px 18px; text-align: center; color: var(--muted); font-size: .95rem; }
.pal-empty b { display: block; color: var(--ink); margin-bottom: 4px; font-size: 1.02rem; }

.pal-item {
  display: flex; align-items: center; gap: 13px; width: 100%; text-align: start;
  padding: 11px 12px; border-radius: 14px; cursor: pointer; border: 1px solid transparent;
}
.pal-item .pi-ic {
  flex: none; width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  background: var(--bg); border: 1px solid var(--hairline-2); overflow: hidden;
}
.pal-item .pi-ic img { width: 22px; height: 22px; object-fit: contain; }
.pal-item .pi-ic svg { width: 19px; height: 19px; color: var(--gold-deep); }
.pal-item .pi-ic .mono { font: 800 1rem/1 var(--font-display); background: var(--gold-text); -webkit-background-clip: text; background-clip: text; color: transparent; }
.pal-item .pi-tx { flex: 1; min-width: 0; }
.pal-item .pi-tx b { display: block; font-size: .96rem; font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pal-item .pi-tx span { display: block; font-size: .78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pal-item .pi-price { flex: none; font: 700 .8rem/1.3 var(--font-display); color: var(--gold-deep); white-space: nowrap; }
.pal-item .pi-go { flex: none; opacity: 0; color: var(--muted-2); transition: opacity var(--t-fast); }
.pal-item.sel { background: rgba(201,162,39,.10); border-color: rgba(201,162,39,.30); }
.pal-item.sel .pi-go { opacity: 1; }

.pal-foot {
  display: flex; align-items: center; gap: 16px; padding: 10px 18px;
  border-top: 1px solid var(--hairline-2); background: var(--surface-2);
  font-size: .72rem; color: var(--muted-2);
}
.pal-foot .fk { display: inline-flex; align-items: center; gap: 5px; }
.pal-foot kbd {
  direction: ltr; font: 600 .64rem/1 var(--font-display); color: var(--muted);
  border: 1px solid var(--hairline-2); border-bottom-width: 2px; border-radius: 5px;
  padding: 2px 5px; background: var(--surface);
}
@media (max-width: 640px) {
  .pal-panel { top: 10px; width: calc(100vw - 20px); border-radius: 18px; }
  .pal-body { max-height: calc(100dvh - 170px); }
  .pal-foot { display: none; }
  .pal-item .pi-price { font-size: .72rem; }
}

/* dark theme */
html[data-theme="dark"] .palette { background: rgba(0,0,0,.55); }
html[data-theme="dark"] .pal-panel { background: rgba(28,28,32,.92); border-color: rgba(201,162,39,.30); }
html[data-theme="dark"] .pal-trigger { background: rgba(255,255,255,.06); }
html[data-theme="dark"] .pal-trigger .pk, html[data-theme="dark"] .pal-esc, html[data-theme="dark"] .pal-foot kbd { background: rgba(255,255,255,.07); }
html[data-theme="dark"] .pal-item .pi-ic { background: rgba(255,255,255,.06); }
html[data-theme="dark"] .pal-item.sel { background: rgba(201,162,39,.16); }
html[data-theme="dark"] .pal-foot { background: rgba(255,255,255,.03); }

/* ---------- 3) Liquid-gold WebGL hero ---------- */
.hero-gl {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; z-index: 0; pointer-events: none;
  opacity: 0; transition: opacity 900ms ease;
}
.hero.gl-on .hero-gl { opacity: 1; }
.hero.gl-on .hero-bg { display: none; } /* shader replaces the video — never both */
/* phones / reduced motion never get the canvas (apex.js guards too) */
@media (max-width: 820px), (pointer: coarse), (prefers-reduced-motion: reduce) {
  .hero-gl { display: none; }
}

/* ---------- 4) Add-to-cart toast ---------- */
.toast {
  position: fixed; bottom: 26px; left: 50%; z-index: 380;
  transform: translateX(-50%) translateY(18px); opacity: 0; pointer-events: none;
  display: flex; align-items: center; gap: 14px;
  padding: 12px 14px 12px 18px; border-radius: 999px;
  background: rgba(29,29,31,.94); color: #f5f5f7;
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border: 1px solid rgba(201,162,39,.4);
  box-shadow: 0 18px 50px rgba(0,0,0,.35), 0 0 0 5px rgba(201,162,39,.08);
  font-size: .92rem; font-weight: 500;
  transition: transform .34s var(--spring), opacity .25s ease;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; pointer-events: auto; }
.toast .tk {
  flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  background: var(--gold-grad); color: #2a2008;
}
.toast .tk svg { width: 13px; height: 13px; }
.toast button {
  flex: none; border-radius: 999px; padding: 8px 16px; cursor: pointer;
  background: var(--gold-grad); color: #2a2008; font-weight: 800; font-size: .84rem;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5);
}
@media (max-width: 640px) { .toast { bottom: 92px; width: max-content; max-width: calc(100vw - 24px); font-size: .85rem; } }

/* ---------- 5) Pointer glare on product cards (desktop hover only) ---------- */
@media (hover: hover) and (pointer: fine) {
  .product { position: relative; }
  .product::after {
    content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
    opacity: 0; transition: opacity .35s ease; z-index: 2;
    background: radial-gradient(380px circle at var(--gx, 50%) var(--gy, 50%),
      rgba(255,243,192,.22), rgba(201,162,39,.07) 38%, transparent 62%);
  }
  .product:hover::after { opacity: 1; }
}

/* keyboard focus ring inside the palette */
.pal-item:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }

/* ---------- 6) Brand-panel Arabic headline fix ----------
   v3 set line-height:1.05 + negative letter-spacing — crops Arabic marks
   and breaks Safari's bidi shaping on mixed lines. Even spacing, taller line. */
.hpanel h3 { letter-spacing: 0; line-height: 1.32; padding-block: .06em; }
.hpanel .hp-in { max-width: 680px; }
/* RTL-overflow interop: Chrome right-anchors the over-wide LTR track inside the
   RTL pin (slider starts on panel 5 and slides out of view); Safari left-anchors.
   Forcing the pin LTR makes every browser start on panel 1 like Safari. */
@media (min-width: 821px) { .hp-pin { direction: ltr; } }
/* Each panel inherited LTR from the track, anchoring its text block to the panel's
   LEFT — so the text was the first thing to slide off-screen, leaving a long empty
   panel behind (the "cut" the user saw). RTL panels anchor text to the RIGHT edge:
   it enters first and exits last. (hp-num watermark flips to the top-right too.) */
.hpanel { direction: rtl; }

/* ---------- 7) App Store "genie" — product modal grows from the clicked card ---------- */
#product-modal .modal-card {
  transform: translate(var(--ox, 0px), var(--oy, 16px)) scale(.6);
}
#product-modal.open .modal-card { transform: none; }
@media (prefers-reduced-motion: reduce) { #product-modal .modal-card { transform: none !important; } }

/* ---------- 8) iOS-style glass dock (mobile only) ---------- */
.dock {
  position: fixed; z-index: 360; bottom: 0; left: 0; right: 0;
  display: none; padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
  background: rgba(255,255,255,.82);
  -webkit-backdrop-filter: blur(22px) saturate(1.6); backdrop-filter: blur(22px) saturate(1.6);
  border-top: 1px solid var(--hairline-2);
  box-shadow: 0 -10px 36px rgba(0,0,0,.08);
}
.dock-in { display: grid; grid-template-columns: repeat(4, 1fr); max-width: 480px; margin-inline: auto; }
.dock button, .dock a {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 4px; min-height: 52px; border-radius: 12px; cursor: pointer;
  color: var(--muted); font-size: .66rem; font-weight: 700; position: relative;
  -webkit-tap-highlight-color: transparent;
}
.dock svg { width: 23px; height: 23px; }
.dock .d-wa { color: #1faf53; }
.dock button:active, .dock a:active { color: var(--ink); transform: scale(.94); }
.dock .cart-badge {
  position: absolute; top: 2px; inset-inline-end: calc(50% - 21px);
  min-width: 17px; height: 17px; border-radius: 999px; display: grid; place-items: center;
  background: var(--gold-grad); color: #2a2008; font-size: .62rem; font-weight: 800; padding-inline: 4px;
}
html[data-theme="dark"] .dock { background: rgba(24,24,28,.86); }
@media (max-width: 820px) {
  .dock { display: block; }
  .fabs { display: none; }                  /* dock replaces the floating buttons */
  .toast { bottom: calc(86px + env(safe-area-inset-bottom, 0px)); }
  .site-footer { padding-bottom: calc(86px + env(safe-area-inset-bottom, 0px)); } /* footer clears the dock */
}

/* ---------- 9) macOS-Dock magnification on desktop nav links ---------- */
@media (hover: hover) and (pointer: fine) {
  .nav-links a { transition: transform .18s var(--out); transform-origin: 50% 100%; will-change: transform; }
}


/* ---------- 10) "Show all products" expander (mobile catalog cap) ---------- */
.catalog-more {
  grid-column: 1 / -1; justify-self: center; margin-top: 10px;
  padding: 14px 34px; font-weight: 800; font-size: 1rem;
  border: 1.5px solid var(--gold-deep, #a98517); color: var(--gold-deep, #a98517);
  background: transparent; border-radius: 999px;
}
.catalog-more:active { transform: scale(.97); }

/* ---------- 11) Dark-mode visibility fixes ----------
   The bento tints sat on a white base and .act-success is a white pill —
   both kept light backgrounds in dark mode while the text flipped to light ink,
   making the words invisible. */

/* activation success pill: the card is always white → pin dark text in BOTH themes */
.act-success b { color: #1d1d1f; }
.act-success span { color: #6e6e73; }

/* bento cells: same category hues, dark glass base in dark mode */
html[data-theme="dark"] .bento-cell { border-color: rgba(255,255,255,.12); }
html[data-theme="dark"] .bento-cell[data-cat="design"]        { background: linear-gradient(135deg, rgba(255,90,120,.18), rgba(150,80,255,.12)), #15151b; }
html[data-theme="dark"] .bento-cell[data-cat="arch3d"]        { background: linear-gradient(135deg, rgba(60,180,120,.18), rgba(40,120,90,.10)), #15151b; }
html[data-theme="dark"] .bento-cell[data-cat="productivity"]  { background: linear-gradient(135deg, rgba(60,130,220,.20), rgba(40,90,180,.10)), #15151b; }
html[data-theme="dark"] .bento-cell[data-cat="entertainment"] { background: linear-gradient(135deg, rgba(230,70,160,.18), rgba(150,60,220,.10)), #15151b; }
html[data-theme="dark"] .bento-cell[data-cat="security"]      { background: linear-gradient(135deg, rgba(40,190,170,.18), rgba(30,140,120,.10)), #15151b; }
html[data-theme="dark"] .bento-cell[data-cat="dev"]           { background: linear-gradient(135deg, rgba(120,130,150,.22), rgba(70,80,100,.10)), #15151b; }
html[data-theme="dark"] .bento-cell[data-cat="education"]     { background: linear-gradient(135deg, rgba(240,170,40,.20), rgba(200,120,30,.10)), #15151b; }
html[data-theme="dark"] .bento-cell[data-cat="media"]         { background: linear-gradient(135deg, rgba(220,60,200,.18), rgba(150,50,180,.10)), #15151b; }
html[data-theme="dark"] .bento-cell[data-cat="all"]           { background: linear-gradient(135deg, rgba(201,162,39,.22), rgba(154,123,21,.12)), #15151b; }
