/* ==========================================================================
   Maraya — craft layer v3
   Built on: apple-design (WWDC "Designing Fluid Interfaces"), emil-design-eng,
   mobile-native (Emil Kowalski, MIT). Loaded last on every page.
   Direction: velvet plum + rose gold, editorial calm. No glowing gradients,
   no infinite shimmer; depth from soft layered shadow and translucent material.
   ========================================================================== */

:root {
  /* motion tokens — strong ease-out for UI, never ease-in */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --t-press: 120ms;
  --t-ui: 200ms;

  /* palette, refined (same brand family) */
  --ink: #2a1726;            /* text */
  --plum: #4a2346;           /* primary action */
  --plum-2: #5e2f59;
  --rose: #c8517f;           /* accent, used sparingly */
  --rosegold: #c99482;       /* hairlines, ornaments */
  --blush: #f8ebee;          /* tinted surface */
  --cream: #fffaf7;

  /* depth: layered, low-contrast shadows (bigger surface = thicker) */
  --sh-1: 0 1px 2px rgba(42, 23, 38, .06), 0 2px 6px rgba(42, 23, 38, .04);
  --sh-2: 0 1px 2px rgba(42, 23, 38, .05), 0 8px 24px rgba(74, 35, 70, .08);
  --sh-3: 0 2px 4px rgba(42, 23, 38, .06), 0 18px 48px rgba(74, 35, 70, .14);
  --hair: 1px solid rgba(74, 35, 70, .09);
}

/* ---------- mobile-native baseline ---------- */
html { -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; }
button, a, [role="button"], .chip, .tab, summary, label { touch-action: manipulation; }
button, [role="button"], .btn, .chip, .tab, .q, .fab {
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
@media (pointer: coarse) { input, textarea, select { font-size: 16px; } }
.modal .body, .sheet, .req-panel, .list { overscroll-behavior: contain; }

/* ---------- typography: tracking and leading by size ---------- */
body:not(.world-page):not(.game-page) { color: var(--ink); line-height: 1.6; font-feature-settings: "kern"; text-rendering: optimizeLegibility; }
h1, h2, h3 { line-height: 1.15; text-wrap: balance; }
p, li { text-wrap: pretty; }
/* Latin display text tightens as it grows; Arabic is a connected script — never track it */
[dir="ltr"] h1, [dir="ltr"] .hero h1 { letter-spacing: -0.025em; line-height: 1.06; }
[dir="ltr"] h2 { letter-spacing: -0.015em; }
[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3 { letter-spacing: 0; }
[dir="rtl"] .hero h1 { line-height: 1.35; }
small, .muted { letter-spacing: .005em; }

/* ---------- buttons: one quiet primary, instant press ---------- */
body:not(.world-page):not(.game-page) .btn {
  border-radius: 14px; border: var(--hair); background: #fff; color: var(--plum);
  box-shadow: var(--sh-1); animation: none;
  transition: transform var(--t-press) var(--ease-out), box-shadow var(--t-ui) var(--ease-out), background-color var(--t-ui) ease, border-color var(--t-ui) ease;
}
body:not(.world-page):not(.game-page) .btn::after { display: none; }   /* no sheen sweep */
body:not(.world-page):not(.game-page) .btn.primary {
  background: var(--plum); color: #fff; border-color: transparent;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), 0 1px 2px rgba(42, 23, 38, .2), 0 8px 20px rgba(74, 35, 70, .22);
}
body:not(.world-page):not(.game-page) .btn.cyan {
  background: var(--rose); color: #fff; border-color: transparent;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), 0 6px 16px rgba(200, 81, 127, .22);
}
body:not(.world-page):not(.game-page) .btn.gold { background: #f3e6df; color: var(--plum); border-color: rgba(201, 148, 130, .45); box-shadow: none; }
body:not(.world-page):not(.game-page) .btn.danger { color: #b3364a; border-color: rgba(179, 54, 74, .3); }
body:not(.world-page):not(.game-page) .btn:disabled { opacity: .5; box-shadow: none; }
/* feedback on press, not on release */
.btn:active, .q:active, .chip:active, .tab:active, .pc:active, .fab:active { transform: scale(.97); transition-duration: 80ms; }
/* hover only where a real pointer exists — no stuck hover after a tap */
@media (hover: hover) and (pointer: fine) {
  body:not(.world-page):not(.game-page) .btn:hover { transform: none; box-shadow: var(--sh-2); border-color: rgba(74, 35, 70, .18); }
  body:not(.world-page):not(.game-page) .btn.primary:hover { background: var(--plum-2); box-shadow: inset 0 1px 0 rgba(255,255,255,.14), 0 2px 4px rgba(42,23,38,.2), 0 12px 28px rgba(74,35,70,.28); }
}
@media (hover: none) {
  .btn:hover, .q:hover, .pc:hover, .card:hover { transform: none; }
}

/* ---------- material: translucent chrome, edge appears only on scroll ---------- */
.nav, .topbar {
  background: rgba(255, 250, 247, .72);
  -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid transparent;
  padding-top: max(10px, env(safe-area-inset-top));
  transition: border-color var(--t-ui) ease, box-shadow var(--t-ui) ease;
}
.scrolled .nav, .scrolled .topbar { border-bottom-color: rgba(74, 35, 70, .08); box-shadow: 0 6px 20px rgba(74, 35, 70, .06); }

/* ---------- surfaces: shadow instead of borders, calm radius ---------- */
body:not(.world-page):not(.game-page) .card { border: var(--hair); box-shadow: var(--sh-2); border-radius: 22px; }
.q { border: var(--hair); box-shadow: var(--sh-1); border-radius: 20px; background: #fff;
  transition: transform var(--t-press) var(--ease-out), box-shadow var(--t-ui) var(--ease-out); }
.q b[data-ic] { width: 44px; height: 44px; border-radius: 14px; background: var(--blush); }
.q b[data-ic] .ic { color: var(--plum) !important; width: 22px !important; height: 22px !important; }
.q span { font-weight: 700; color: var(--ink); }
.q.hot { background: var(--plum); border-color: transparent; box-shadow: 0 10px 26px rgba(74, 35, 70, .25); }
.q.hot span { color: #fff; } .q.hot small { color: rgba(255, 255, 255, .72); }
.q.hot b[data-ic] { background: rgba(255, 255, 255, .12); }
.q.hot b[data-ic] .ic { color: #fff !important; }
@media (hover: hover) and (pointer: fine) { .q:hover { transform: translateY(-2px); box-shadow: var(--sh-2); border-color: rgba(74,35,70,.12); } }

/* product cards */
.pc { border: var(--hair) !important; box-shadow: var(--sh-1); border-radius: 20px !important; transition: transform var(--t-press) var(--ease-out), box-shadow var(--t-ui) var(--ease-out); }
@media (hover: hover) and (pointer: fine) { .pc:hover { transform: translateY(-3px); box-shadow: var(--sh-3); } }
.pc img { transition: transform 600ms var(--ease-out); }
@media (hover: hover) and (pointer: fine) { .pc:hover img { transform: scale(1.03); } }

/* chips & tabs */
body:not(.world-page) .chip, .tab { border-radius: 999px; transition: background-color var(--t-ui) ease, color var(--t-ui) ease, transform var(--t-press) var(--ease-out); }
body:not(.world-page):not(.game-page) .tab.on, body:not(.world-page):not(.game-page) .chip.on { background: var(--plum); color: #fff; border-color: var(--plum); }

/* fields */
body:not(.world-page):not(.game-page) input:not([type=checkbox]):not([type=radio]), body:not(.world-page):not(.game-page) select, body:not(.world-page):not(.game-page) textarea {
  border-radius: 12px; border: 1px solid rgba(74, 35, 70, .14); background: #fff;
  transition: border-color var(--t-ui) ease, box-shadow var(--t-ui) ease;
}
body:not(.world-page):not(.game-page) input:focus, body:not(.world-page):not(.game-page) select:focus, body:not(.world-page):not(.game-page) textarea:focus {
  outline: none; border-color: var(--rose); box-shadow: 0 0 0 4px rgba(200, 81, 127, .12);
}

/* ---------- landing ---------- */
.hero h1 span { animation: none !important; }               /* no endless shimmer on the headline */
.hero-in > * { animation-duration: .6s !important; animation-timing-function: var(--ease-out) !important; }
.block h2 { color: var(--ink); }
.block h2::after { background: var(--rosegold) !important; }
.stats, .hero .stats { box-shadow: var(--sh-2); border: var(--hair); }
.ticker { border-block: 1px solid rgba(201, 148, 130, .25); }

/* reveal: short travel, strong ease-out (not 26px over .7s) */
.reveal { opacity: 0; transform: translateY(12px); transition: opacity .5s var(--ease-out), transform .5s var(--ease-out); }
.reveal.in { opacity: 1; transform: none; }

/* modals materialize (scale from .96 + fade), never from scale(0) */
.modal-wrap { -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.modal { border-radius: 24px; box-shadow: var(--sh-3); }

/* toasts */
.toast { border-radius: 14px; box-shadow: var(--sh-3); -webkit-backdrop-filter: blur(16px) saturate(180%); backdrop-filter: blur(16px) saturate(180%); }

/* WhatsApp: no infinite pulse, no spin-in from scale(0) */
.wa-float { animation: wa-in2 .4s .6s var(--ease-out) both; box-shadow: 0 8px 20px rgba(37, 211, 102, .35); }
.wa-float::before { animation: none; display: none; }
@keyframes wa-in2 { from { opacity: 0; transform: scale(.9) translateY(8px); } }

/* product page buy bar = floating material */
@media (max-width: 760px) { .pd-bar { background: rgba(255, 255, 255, .78) !important; -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%); border-top: 1px solid rgba(255, 255, 255, .6) !important; } }

/* ---------- accessibility: motion, transparency, contrast ---------- */
@media (prefers-reduced-motion: reduce) {
  .reveal { transition: opacity .2s ease; transform: none !important; }
  .btn:active, .q:active, .pc:active { transform: none; }
}
@media (prefers-reduced-transparency: reduce) {
  .nav, .topbar, .toast, .pd-bar { background: var(--cream); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (prefers-contrast: more) {
  body:not(.world-page):not(.game-page) .btn, .q, .pc, .card { border: 1px solid var(--ink) !important; }
}

/* small phones: the top bar never pushes past the screen */
.topbar .brand, .nav .brand { min-width: 0; flex-shrink: 1; }
.topbar .brand-t, .nav .brand-t { min-width: 0; overflow: hidden; }
@media (max-width: 520px) {
  .topbar, .nav { gap: 6px; padding-inline: 10px; }
  .topbar .btn.sm, .nav .btn.sm { padding-inline: 9px; min-width: 38px; }
  .topbar .brand small, .nav .brand small { letter-spacing: 2px; }
}
@media (max-width: 400px) { .topbar .brand small { display: none; } }

/* product buy bar: the main button shrinks before anything leaves the screen */
.pd-bar #pd-buy { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 420px) {
  .pd-bar { gap: 6px; padding-inline: 10px; }
  .pd-bar #pd-buy { font-size: .95rem; padding-inline: 10px; }
  .pd-bar .pd-addc, .pd-bar .wa { min-width: 46px; }
}

/* product photos cut out of their background (scripts/cutout.py): float on a soft blush ground */
img[src*=".cut."] { object-fit: contain !important; background: radial-gradient(70% 65% at 50% 45%, #fff 0%, #fbeef1 70%, #f6e3e9 100%) !important;
  filter: drop-shadow(0 12px 14px rgba(74, 35, 70, .16)); padding: 6%; box-sizing: border-box; }
.arch .slides img[src*=".cut."] { padding: 14% 12% 10%; filter: drop-shadow(0 22px 22px rgba(74, 35, 70, .22)); }

/* ---------- accessibility pass (Taste-skill checker, Nov 2026) ---------- */
/* text colours that reach WCAG AA (4.5:1) on cream and white */
:root { --muted: #6c5866; --rose-t: #a8365f; --gold-t: #7a4f41; }
body:not(.world-page):not(.game-page) { --rose-ink: var(--rose-t); }
.brand small, .nav .brand small, .topbar .brand small { color: var(--gold-t) !important; }
.pc small, .bx-t > span, .step p, .muted { color: var(--muted); }
.pc { min-width: 0; }
.pc > a { display: block; min-width: 0; }
.pc b { overflow-wrap: anywhere; max-height: 2.8em; overflow: hidden; }
/* a focus ring you can see at once, also on custom controls */
:where(a, button, select, input, textarea, [tabindex]):focus-visible { outline: 3px solid var(--rose-t); outline-offset: 2px; border-radius: 10px; }
.more, a.more { color: var(--rose-t); font-weight: 600; }
body:not(.world-page):not(.game-page) .btn.cyan { background: var(--rose-t); }
.pc small[style*="gold"], .pc small span[style*="gold"], .stars, .pc .stars { color: #a86a12 !important; }
.wa-float { background: #128c4a; }
.pc b, .float.f1 b, .fd h3 { unicode-bidi: plaintext; } /* Latin product names read left-to-right inside Arabic cards */

/* ---------- ☰ menu (all pages) + services grid (homepage) ---------- */
.menu-btn .ic { width: 20px; height: 20px; }
.menu-wrap { position: fixed; inset: 0; z-index: 1200; }
.menu-scrim { position: absolute; inset: 0; background: rgba(42, 23, 38, .35); opacity: 0; transition: opacity 220ms var(--ease-out);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.menu-panel { position: absolute; top: 0; bottom: 0; inset-inline-end: 0; width: min(420px, 92vw); overflow-y: auto; overscroll-behavior: contain;
  background: var(--cream); box-shadow: var(--sh-3); padding: calc(14px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom));
  transform: translateX(105%); transition: transform 320ms var(--ease-drawer); }
[dir="rtl"] .menu-panel { transform: translateX(-105%); }
.menu-wrap.open .menu-scrim { opacity: 1; }
.menu-wrap.open .menu-panel { transform: none; }
.menu-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.menu-head b { font-family: "Playfair Display", serif; font-style: italic; font-size: 1.5rem; color: var(--plum); }
.menu-panel h3 { font-size: .8rem; letter-spacing: .02em; color: var(--rose-t, #a8365f); margin: 16px 2px 8px; }
html.menu-open { overflow: hidden; }
.svc-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.svc { display: grid; justify-items: center; gap: 6px; padding: 12px 6px; border-radius: 16px; background: #fff; border: var(--hair); box-shadow: var(--sh-1);
  color: var(--ink); text-decoration: none; text-align: center; font-size: .82rem; font-weight: 600; line-height: 1.3;
  transition: transform 120ms var(--ease-out), box-shadow 200ms ease; }
.svc:active { transform: scale(.96); }
@media (hover: hover) and (pointer: fine) { .svc:hover { box-shadow: var(--sh-2); transform: translateY(-1px); } }
.svc.on { border-color: var(--plum); box-shadow: 0 0 0 2px rgba(74, 35, 70, .25); }
.svc-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--blush); color: var(--plum); }
.svc-ic .ic { width: 20px; height: 20px; }
.allsvc .svc-group h3 { font-size: .9rem; color: var(--rose-t, #a8365f); margin: 18px 2px 10px; }
.svc-grid.big { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
@media (max-width: 520px) { .svc-grid.big { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (prefers-reduced-motion: reduce) { .menu-panel, .menu-scrim { transition: none; } }
