/* =====================================================================
   wixct portfolio · the Collections+ / SubSyncer / Wiki look, pushed into 3D
   1. Tokens   2. Base   3. Hero   4. Work   5. Collections+   6. Tunnel
   7. SubSyncer   8. Wiki   9. About   10. Contact   11. Footer
   12. Motion   13. Arabic   14. Phone
   ===================================================================== */

/* ---------- 1. Tokens (same values as the three sites) ---------- */
:root,
:root[data-theme="dark"]{
  color-scheme:dark;
  --bg:#0f1113;
  --raised:#181b1f;
  --raised-2:#1f2328;
  --ink:#ece7dc;
  --muted:#b5b0a6;
  --accent:#ff8a3d;
  --on-accent:#1b0e04;
  --btn:#ece7dc;
  --on-btn:#141618;
  --float:0 30px 70px rgba(0,0,0,.55);
}
:root[data-theme="light"]{
  color-scheme:light;
  --bg:#f1ebdf;
  --raised:#e8e0d1;
  --raised-2:#ded4c2;
  --ink:#211d18;
  --muted:#574f45;
  --accent:#cf5a17;
  --on-accent:#fff7ef;
  --btn:#211d18;
  --on-btn:#f6f0e5;
  --float:0 30px 70px rgba(80,60,30,.28);
}
:root{
  --latin:'Space Grotesk','IBM Plex Sans Arabic',system-ui,sans-serif;
  --arabic:'IBM Plex Sans Arabic','Space Grotesk',Tahoma,sans-serif;
  --m:clamp(16px, 2.2vw, 32px);
  --ease:cubic-bezier(.22,1,.36,1);
  --r:18px;
  /* five type steps */
  --t-big:clamp(44px, 5.4vw, 80px);
  --t-mid:clamp(28px, 2.6vw, 40px);
  --t-body:18px;
  --t-small:15px;
}

/* ---------- 2. Base ---------- */
*,*::before,*::after{ box-sizing:border-box; }
html{ background:var(--bg); -webkit-text-size-adjust:100%; }
body{ margin:0; background:var(--bg); color:var(--ink); font:400 var(--t-body)/1.55 var(--latin); overflow-x:clip; transition:background-color .4s ease, color .4s ease; }
img{ display:block; max-width:100%; height:auto; }
a{ color:inherit; }
h1,h2,h3,p,ul,ol,dl,dd,figure{ margin:0; }
ul,ol{ padding:0; list-style:none; }
button{ font:inherit; color:inherit; background:none; border:0; cursor:pointer; }
:focus-visible{ outline:2px solid var(--accent); outline-offset:3px; border-radius:6px; }
::selection{ background:var(--accent); color:var(--on-accent); }
.sr{ position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; }
.skip{ position:absolute; left:var(--m); top:-60px; z-index:50; padding:10px 16px; border-radius:999px; background:var(--btn); color:var(--on-btn); text-decoration:none; }
.skip:focus{ top:var(--m); }

.btn{ display:inline-flex; align-items:center; justify-content:center; min-height:48px; padding:0 24px; border-radius:999px; background:var(--btn); color:var(--on-btn); font-weight:600; font-size:var(--t-small); text-decoration:none; transition:transform .2s var(--ease), background-color .2s ease; }
.btn:hover{ background:var(--accent); color:var(--on-accent); }
.btn:active{ transform:scale(.96); }
.btn.small{ min-height:40px; padding:0 18px; }

.logo{ width:56px; height:56px; border-radius:14px; }
.chapter-h{ font:700 var(--t-big)/1 var(--latin); letter-spacing:-.04em; }
.mini-h{ font:600 var(--t-body)/1.4 var(--latin); margin-top:36px; }
.small-h{ font:600 var(--t-mid)/1.1 var(--latin); letter-spacing:-.02em; }

/* cells: the two actions of every chapter */
.cells{ display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-top:40px; }
.cell{ display:flex; align-items:center; justify-content:center; min-height:72px; padding:0 16px; border-radius:999px; font-weight:600; font-size:var(--t-small); text-decoration:none; text-align:center; transition:transform .2s var(--ease), background-color .2s ease, color .2s ease; }
.cell.ink{ background:var(--btn); color:var(--on-btn); }
.cell.tone{ background:var(--raised-2); color:var(--ink); }
.cell:hover{ background:var(--accent); color:var(--on-accent); }
.cell:active{ transform:scale(.97); }

/* ---------- 3. Hero: the project ring ---------- */
.hero{ position:relative; min-height:100svh; padding:var(--m); display:grid; grid-template-rows:auto auto 1fr auto; overflow:hidden; }
.bar{ display:flex; align-items:center; justify-content:space-between; gap:16px; position:relative; z-index:3; }
.me{ display:inline-flex; align-items:center; gap:10px; font-weight:600; text-decoration:none; }
.me img{ width:36px; height:36px; border-radius:50%; transition:transform .5s var(--ease); }
.me:hover img{ transform:rotate(-10deg) scale(1.08); }
.tools{ display:flex; align-items:center; gap:8px; }
.tool{ width:42px; height:42px; display:grid; place-items:center; border-radius:999px; background:var(--raised); color:var(--ink); transition:transform .2s var(--ease), background-color .2s ease, color .2s ease; }
.tool:hover{ background:var(--accent); color:var(--on-accent); }
.tool:active{ transform:scale(.92); }
.tool svg{ width:18px; height:18px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
.tool svg.fill{ fill:currentColor; stroke:none; width:16px; height:16px; }
.tool svg.kofi{ width:22px; height:22px; stroke-width:2.4; }
.tool svg.kofi .heart{ fill:currentColor; stroke:none; }
[data-theme="dark"] .tool .moon, [data-theme="light"] .tool .sun{ display:none; }
.tool.lang{ font:600 18px/1 var(--arabic); }

.intro{ position:relative; z-index:3; display:flex; align-items:center; justify-content:space-between; gap:24px; margin-top:clamp(28px, 6svh, 72px); }
.lead-h{ font:600 var(--t-mid)/1.12 var(--latin); letter-spacing:-.025em; max-width:30ch; }

.ring-stage{ position:relative; z-index:1; display:grid; place-items:center; perspective:1600px; min-height:300px; touch-action:pan-y; cursor:grab; user-select:none; -webkit-user-select:none; }
.ring-stage.dragging{ cursor:grabbing; }
.ring{ --cw:min(48vw, 680px, calc((100svh - 300px) * 1.6)); position:relative; width:var(--cw); aspect-ratio:16/10; transform-style:preserve-3d; transform:rotateX(var(--tx, 4deg)); }
.rcard{ position:absolute; inset:0; border-radius:var(--r); overflow:hidden; background:var(--raised); box-shadow:var(--float); /* taste-skill-ignore: cards float in 3D */
  transform:translateX(calc(var(--o) * 62%)) translateZ(calc(var(--ao) * -260px)) rotateY(calc(var(--o) * -38deg)) scale(calc(1 - var(--ao) * .06));
  opacity:calc(1.3 - var(--ao) * .55); z-index:calc(10 - var(--zi)); transition:transform .8s var(--ease), opacity .6s ease, filter .6s ease; will-change:transform; }
.ring.live .rcard{ transition:none; }
.rcard picture{ display:contents; }
.rcard img{ width:100%; height:100%; object-fit:cover; object-position:top center; pointer-events:none; }
.rcard:not(.front){ filter:saturate(.7) brightness(.62); }
.rcard.front:hover{ filter:none; }

.caption{ position:relative; z-index:3; display:grid; grid-template-columns:auto 1fr auto; align-items:center; gap:20px; width:min(100%, 760px); margin:0 auto; padding-top:8px; }
.cap-text{ text-align:center; min-height:3.6em; }
.cap-name{ font:700 var(--t-mid)/1.1 var(--latin); letter-spacing:-.03em; }
.cap-line{ margin-top:6px; color:var(--muted); font-size:var(--t-small); }
.live{ display:inline-flex; align-items:center; gap:6px; margin-inline-start:10px; color:var(--ink); white-space:nowrap; }
.live i{ width:8px; height:8px; border-radius:50%; background:var(--muted); }
.live[data-state="up"] i{ background:#3ddc84; animation:pulse 2s ease-in-out infinite; }
.live[data-state="down"] i{ background:#ff7d89; }
@keyframes pulse{ 50%{ transform:scale(1.6); opacity:.5; } }
.nav-btn{ width:52px; height:52px; display:grid; place-items:center; border-radius:999px; background:var(--raised); transition:transform .2s var(--ease), background-color .2s ease, color .2s ease; }
.nav-btn:hover{ background:var(--btn); color:var(--on-btn); }
.nav-btn:active{ transform:scale(.9); }
.nav-btn svg{ width:20px; height:20px; fill:none; stroke:currentColor; stroke-width:2.2; stroke-linecap:round; stroke-linejoin:round; }
[dir="rtl"] .nav-btn svg{ transform:scaleX(-1); }

/* ---------- 4. Work index ---------- */
.work{ padding:200px var(--m) 160px; }
.work-grid{ display:grid; grid-template-columns:repeat(12, 1fr); gap:0 var(--m); margin-top:48px; }
.names{ grid-column:1 / span 7; align-self:start; }
.names a{ display:flex; align-items:baseline; justify-content:space-between; gap:24px; padding:10px 0; text-decoration:none; color:var(--muted); transition:color .25s ease; }
.names .nm{ font:700 var(--t-big)/1 var(--latin); letter-spacing:-.04em; transition:transform .45s var(--ease); }
.names .meta{ font-size:var(--t-small); white-space:nowrap; }
.names .thumb{ display:none; width:100%; aspect-ratio:16/10; object-fit:cover; object-position:top center; border-radius:var(--r); margin-bottom:16px; background:var(--raised); }
.names a.on, .names a:hover, .names a:focus-visible{ color:var(--ink); }
.names a.on .nm{ transform:translateX(18px); }
.names a.on .nm::before{ content:''; display:inline-block; width:.22em; height:.22em; margin-inline-end:.18em; border-radius:50%; background:var(--accent); vertical-align:.12em; }
.preview-wrap{ grid-column:8 / span 5; perspective:1200px; }
.preview{ position:sticky; top:15vh; aspect-ratio:4/5; border-radius:var(--r); overflow:hidden; background:var(--raised); box-shadow:var(--float); /* taste-skill-ignore: these cards float in 3D */ transform-style:preserve-3d; }
.preview img{ position:absolute; inset:0; width:100%; height:100%; object-fit:cover; object-position:center top; opacity:0; transform:scale(1.06); transition:opacity .35s ease, transform .9s var(--ease); }
.preview img.on{ opacity:1; transform:scale(1); }

/* ---------- 5. Collections+: plate ---------- */
.plate{ display:grid; grid-template-columns:1fr 1fr; min-height:88svh; background:var(--raised); }
.plate-pic{ display:grid; place-items:center; align-content:center; gap:24px; padding:40px; perspective:1600px; overflow:hidden; }
.cover-deck{ position:relative; width:min(100%, 560px); aspect-ratio:4/3; transform-style:preserve-3d; cursor:pointer; touch-action:manipulation; }
.cover{ position:absolute; left:8%; right:8%; top:30%; aspect-ratio:16/9; border-radius:14px; overflow:hidden; background:var(--bg); box-shadow:var(--float); /* taste-skill-ignore: these cards float in 3D */ transform-origin:50% 100%; transition:transform .8s var(--ease), opacity .5s ease; }
.cover img{ width:100%; height:100%; object-fit:cover; }
.deck-hint{ color:var(--muted); font-size:var(--t-small); }
.plate-text{ display:flex; flex-direction:column; justify-content:space-between; gap:48px; padding:64px var(--m) 64px 40px; }
.tabs{ display:flex; flex-wrap:wrap; gap:4px 24px; }
.tabs button{ font-size:var(--t-body); color:var(--muted); padding:6px 0; position:relative; transition:color .2s ease; }
.tabs button[aria-selected="true"]{ color:var(--ink); font-weight:600; }
.tabs button::after{ content:''; position:absolute; inset-inline:0; bottom:0; height:3px; border-radius:2px; background:var(--accent); transform:scaleX(0); transition:transform .35s var(--ease); }
.tabs button[aria-selected="true"]::after{ transform:scaleX(1); }
.tabs button:hover{ color:var(--ink); }
.plate-copy{ max-width:34ch; }
.plate-copy .chapter-h{ margin:20px 0 32px; }
.facts{ margin-top:28px; display:grid; gap:12px; }
.facts li, .stops li{ position:relative; padding-inline-start:22px; }
.facts li::before{ content:''; position:absolute; inset-inline-start:0; top:.62em; width:8px; height:8px; border-radius:50%; background:var(--accent); }
.plate-text .cells{ margin-top:0; }

/* ---------- 6. Tunnel ---------- */
.tunnel{ height:230vh; position:relative; }
.tunnel-pin{ position:sticky; top:0; height:100svh; overflow:hidden; display:grid; place-items:center; perspective:900px; }
.tunnel-space{ position:absolute; inset:0; transform-style:preserve-3d; }
.tcover{ position:absolute; left:50%; top:50%; width:clamp(200px, 22vw, 360px); aspect-ratio:16/9; margin:calc(clamp(200px,22vw,360px) * -.28125) 0 0 calc(clamp(200px,22vw,360px) * -.5); border-radius:12px; overflow:hidden; background:var(--raised); will-change:transform, opacity; }
.tcover img{ width:100%; height:100%; object-fit:cover; }
.tunnel-copy{ position:relative; z-index:2; text-align:center; max-width:min(92vw, 900px); padding:28px 32px; border-radius:28px; background:var(--bg); }
.tunnel-h{ font:700 var(--t-big)/1 var(--latin); letter-spacing:-.04em; }
.tunnel-copy p{ margin:24px auto 0; max-width:46ch; }

/* ---------- 7. SubSyncer ---------- */
.sync{ display:grid; grid-template-columns:5fr 7fr; gap:var(--m); align-items:center; padding:200px var(--m) 120px; }
.sync-text{ max-width:46ch; }
.sync-text .chapter-h{ margin:20px 0 28px; }
.stops{ margin-top:16px; display:grid; gap:10px; counter-reset:s; }
.stops li::before{ content:''; position:absolute; inset-inline-start:0; top:.5em; width:10px; height:10px; border-radius:3px; border:2px solid var(--accent); }
.sources{ margin-top:28px; color:var(--muted); }
.sync-pic{ position:relative; perspective:1600px; padding-bottom:90px; }
.screen{ border-radius:var(--r); overflow:hidden; box-shadow:var(--float); /* taste-skill-ignore: these cards float in 3D */ transform:rotateX(var(--tilt,22deg)) rotateZ(calc(var(--tilt,22deg) * -.12)) scale(var(--sc,.92)); transform-origin:50% 100%; will-change:transform; }
.screen img{ width:100%; }
.syncer{ position:absolute; inset-inline-end:4%; bottom:0; width:min(440px, 78%); padding:20px; border-radius:var(--r); background:var(--raised-2); box-shadow:var(--float); /* taste-skill-ignore: these cards float in 3D */ font-size:var(--t-small); }
.sy-row{ display:grid; grid-template-columns:72px 1fr; align-items:center; gap:12px; margin-bottom:10px; }
.sy-label{ color:var(--muted); }
.sy-track{ position:relative; height:28px; border-radius:8px; background:var(--bg); overflow:hidden; }
.sy-track i{ position:absolute; top:6px; bottom:6px; left:calc(var(--s) * 1%); width:calc(var(--w) * 1%); border-radius:5px; }
.voice i{ background:var(--muted); opacity:.55; }
.subs i{ background:var(--accent); transform:translateX(calc(var(--off,1) * 34px)); transition:transform 1s cubic-bezier(.34,1.56,.64,1); }
.sy-foot{ display:flex; align-items:center; justify-content:space-between; gap:12px; margin-top:6px; }
.sy-foot output{ font-variant-numeric:tabular-nums; }

/* ---------- 8. Wiki ---------- */
.wiki{ overflow:clip; display:grid; grid-template-columns:7fr 5fr; gap:var(--m); align-items:center; padding:160px var(--m) 200px; background:var(--raised); }
.wiki-pics{ position:relative; perspective:1400px; padding:0 0 60px; }
.desk{ border-radius:var(--r); overflow:hidden; box-shadow:var(--float); /* taste-skill-ignore: these cards float in 3D */ transform-style:preserve-3d; }
.phone{ position:absolute; inset-inline-end:0; bottom:0; width:26%; border-radius:26px; overflow:hidden; box-shadow:var(--float); /* taste-skill-ignore: these cards float in 3D */ border:6px solid var(--bg); transform:rotate(6deg) translateY(var(--py,0px)); transition:transform .2s linear; }
.wiki-text{ max-width:44ch; }
.wiki-text .chapter-h{ margin-bottom:28px; }
.guides{ margin-top:16px; display:grid; grid-template-columns:1fr 1fr; gap:6px 24px; font:500 var(--t-body)/1.5 var(--arabic); }
.guides a{ text-decoration:none; display:inline-block; transition:color .2s ease, transform .3s var(--ease); }
.guides a:hover{ color:var(--accent); transform:translateX(-4px); }

/* ---------- 12. Motion ---------- */
.js .rv{ opacity:0; transform:translateY(26px); transition:opacity .8s var(--ease), transform .9s var(--ease); transition-delay:calc(var(--i,0) * 80ms); }
.js .rv.in{ opacity:1; transform:none; }
.js .rvo{ opacity:0; transition:opacity 1s ease; transition-delay:calc(var(--i,0) * 80ms); }
.js .rvo.in{ opacity:1; }
.tilt{ transition:transform .5s var(--ease); }
@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{ transition-duration:.01ms !important; animation-duration:.01ms !important; }
  .js .rv, .js .rvo{ opacity:1; transform:none; }
  .tunnel{ height:auto; }
  .tunnel-pin{ position:relative; height:auto; min-height:80svh; }
}

/* ---------- 13. Arabic ---------- */
[lang="ar"] .names .nm, [lang="ar"] .cap-name{ font-family:var(--latin); }
[lang="ar"] body, [lang="ar"] .chapter-h, [lang="ar"] .mini-h, [lang="ar"] .small-h, [lang="ar"] .tunnel-h, [lang="ar"] .lead-h, [lang="ar"] .cap-line, [lang="ar"] .names .meta{ font-family:var(--arabic); letter-spacing:0; }
[dir="rtl"] .names a.on .nm{ transform:translateX(-18px); }

/* ---------- 14. Tablet and phone ---------- */
@media (max-width:1100px){
  .work-grid{ grid-template-columns:1fr; }
  .names{ grid-column:1; }
  .preview-wrap{ display:none; }
  .names li{ margin-bottom:40px; }
  .names .thumb{ display:block; }
  .names a{ color:var(--ink); flex-direction:column; gap:4px; }
  .names a.on .nm{ transform:none; }
  .plate, .sync, .wiki{ grid-template-columns:1fr; }
  .plate-text{ padding:40px var(--m) 56px; }
  .plate-copy{ max-width:none; display:grid; grid-template-columns:1fr 1fr; gap:0 var(--m); align-items:start; }
  .plate-copy > :not(.facts){ grid-column:1; }
  .plate-copy .facts{ grid-column:2; grid-row:1 / span 3; margin-top:0; }
  .sync{ padding-top:140px; }
  .wiki-text{ order:-1; }
}
@media (max-width:640px){
  :root{ --t-body:17px; --m:18px; }
  .intro{ flex-direction:column; align-items:stretch; }
  .intro .btn{ width:100%; }
  .ring{ --cw:min(62vw, calc((100svh - 420px) * .8)); aspect-ratio:4/5; }
  .rcard{ transform:translateX(calc(var(--o) * 52%)) translateZ(calc(var(--ao) * -200px)) rotateY(calc(var(--o) * -34deg)) scale(calc(1 - var(--ao) * .08)); }
  .ring-stage{ min-height:0; padding:28px 0 12px; }
  .caption{ gap:10px; }
  .nav-btn{ width:44px; height:44px; }
  .live{ display:flex; justify-content:center; margin:6px 0 0; }
  .work{ padding:120px var(--m) 80px; }
  .names .nm{ font-size:9.5vw; }
  .names .meta{ font-size:15px; }
  .plate-pic{ padding:24px var(--m); }
  .plate-copy{ grid-template-columns:1fr; }
  .plate-copy .facts{ grid-column:1; grid-row:auto; margin-top:28px; }
  .cells{ grid-template-columns:1fr; }
  .cell{ min-height:60px; }
  .tunnel{ height:240vh; }
  .tcover{ width:46vw; margin:-13vw 0 0 -23vw; }
  .sync-pic{ padding-bottom:150px; }
  .syncer{ width:92%; inset-inline-end:4%; }
  .wiki{ padding:120px var(--m); }
  .guides{ grid-template-columns:1fr; }
  .phone{ width:34%; inset-inline-end:2%; }
}
