/* ==========================================================
   «مبدعون عراقيون» — قاعة المبدعين ثلاثية الأبعاد
   الفهرس: حلقة بورتريهات دوّارة + بطاقات بعمق + سلّم الانضمام
   صفحة المبدع: إطار ذهبي بطبقات، ممرّ أعمال منحني (coverflow)، شهادة تنقلب، بطاقة تعريف
   الحركة في assets/js/pages/cr3d.js · الإمالة (--rx/--ry/--mx/--my) من fx.js عبر data-tilt
   ========================================================== */

.crx { --cr-frame: linear-gradient(145deg, #fff3c9, var(--gold) 34%, var(--gold-3) 72%, #ffe3a0); --cr-paper: #fbf4e4; --cr-ink: #1d1708; }

/* ---------- shared ---------- */
.crx-kicker { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px 7px 12px; border-radius: 999px; font-size: .88rem; font-weight: 700; color: var(--gold);
  background: var(--gold-soft); border: 1px solid var(--stroke); }
.crx-kicker svg { width: 16px; height: 16px; }
.crx-giant { position: absolute; z-index: -1; inset: auto 0 6% 0; text-align: center; font-family: var(--font-mega); font-weight: 700; font-size: clamp(7rem, 30vw, 24rem); line-height: .8;
  color: transparent; -webkit-text-stroke: 1px color-mix(in srgb, var(--gold) 16%, transparent); white-space: nowrap; overflow: hidden; pointer-events: none; user-select: none;
  transform: translate3d(0, calc(var(--p, 0) * 90px), 0); }
.crx-head { max-width: 720px; margin: 0 auto 30px; text-align: center; display: grid; gap: 8px; justify-items: center; }
.crx-head h2 { font-family: var(--font-mega); font-size: clamp(1.9rem, 5vw, 3.1rem); line-height: 1.25; margin: 0; }
.crx-head p { margin: 0; color: var(--muted); line-height: 1.9; }

/* ---------- index hero ---------- */
.crx-hero { position: relative; isolation: isolate; overflow: hidden; min-height: 100svh; display: flex; flex-direction: column; justify-content: center;
  padding: calc(var(--header-h) + 20px) 0 28px; }
.crx-hero::before { content: ""; position: absolute; inset: -10% -10% 30%; z-index: -2; pointer-events: none;
  background: radial-gradient(48% 42% at 30% 46%, color-mix(in srgb, var(--lapis) 26%, transparent), transparent 70%),
              radial-gradient(38% 36% at 72% 38%, color-mix(in srgb, var(--gold) 16%, transparent), transparent 70%); }
.crx-hero-grid { display: grid; gap: 8px; align-items: center; width: 100%; }
@media (min-width: 980px) { .crx-hero-grid { grid-template-columns: .95fr 1.05fr; gap: 24px; } }
.crx-hero-text { position: relative; z-index: 3; display: grid; gap: 16px; justify-items: start;
  transform: translate3d(0, calc(var(--x, 0) * -110px), 0); opacity: calc(1 - var(--x, 0) * 1.5); }
.crx-hero-text .breadcrumbs { margin: 0; }
.crx-hero h1 { margin: 0; font-family: var(--font-mega); font-weight: 700; font-size: clamp(3.3rem, 12vw, 7.6rem); line-height: 1; letter-spacing: 0; }
.crx-hero h1 span { display: block; }
.crx-hero h1 .l1 { background: linear-gradient(180deg, var(--gold-2), var(--gold) 55%, var(--gold-3)); -webkit-background-clip: text; background-clip: text; color: transparent; padding-bottom: .08em; }
.crx-hero h1 .l2 { color: transparent; -webkit-text-stroke: 1.6px var(--text); }
.crx-lead { margin: 0; max-width: 34em; color: var(--muted); font-size: clamp(1rem, 2.4vw, 1.14rem); line-height: 2; }
.crx-hero .btn-row { gap: 10px; }
/* entrance */
.fx-on .crx-hero-text > *, .fx-on .crd-head > * { animation: crxUp .9s var(--ease) both; }
.fx-on .crx-hero-text > :nth-child(2), .fx-on .crd-head > :nth-child(2) { animation-delay: .08s; }
.fx-on .crx-hero-text > :nth-child(3), .fx-on .crd-head > :nth-child(3) { animation-delay: .16s; }
.fx-on .crx-hero-text > :nth-child(4), .fx-on .crd-head > :nth-child(4) { animation-delay: .24s; }
.fx-on .crx-hero-text > :nth-child(5), .fx-on .crd-head > :nth-child(5) { animation-delay: .32s; }
.fx-on .crd-head > :nth-child(6) { animation-delay: .4s; }
@keyframes crxUp { from { opacity: 0; transform: translate3d(0, 40px, 0) rotateX(-18deg); } to { opacity: 1; transform: none; } }

/* the rotating hall of portraits */
.crx-ring-wrap { position: relative; height: clamp(380px, 62vw, 620px); display: grid; place-items: center; perspective: 1300px; perspective-origin: 50% 30%;
  touch-action: pan-y; cursor: grab; user-select: none; -webkit-user-select: none; transform: translate3d(0, calc(var(--x, 0) * 80px), 0); }
.crx-ring-wrap.dragging { cursor: grabbing; }
.crx-gl { position: absolute; inset: 6% 12%; --gl-o: .95; pointer-events: none; }
.crx-floor { position: absolute; left: 50%; bottom: 8%; width: min(86%, 640px); aspect-ratio: 3.2; translate: -50% 0; border-radius: 50%; pointer-events: none;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--gold) 26%, transparent), transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--gold) 22%, transparent) inset; transform: rotateX(70deg); }
.crx-ring { --rad: clamp(220px, 19vw, 280px); --w: clamp(120px, 10vw, 140px); position: relative; width: var(--w); aspect-ratio: .72; transform-style: preserve-3d; transform: rotateX(-7deg) rotateY(0deg); will-change: transform; }
.crx-ring-item { position: absolute; inset: 0; display: grid; align-content: start; justify-items: center; gap: 6px; padding: 10px 10px 12px; border-radius: 20px; text-align: center;
  color: var(--text); background: var(--card); border: 1px solid var(--stroke); box-shadow: var(--shadow-lg);
  transform: rotateY(calc(var(--i) * 360deg / var(--n))) translateZ(var(--rad)); backface-visibility: hidden; -webkit-backface-visibility: hidden;
  opacity: calc(.18 + .82 * var(--f, 1)); filter: saturate(calc(.4 + .6 * var(--f, 1))); }
.crx-ring-item .cr-avatar { width: 100%; height: auto; aspect-ratio: 1; border-radius: 14px; border: 3px solid transparent; background: var(--cr-frame) border-box; object-fit: cover; }
.crx-ring-item .cr-avatar-gen { display: grid; place-items: center; font-size: 3rem; color: var(--on-gold); }
/* لا قصّ بـ overflow أو line-clamp هنا: داخل سياق ثلاثي الأبعاد يقصّ أجسام الحروف ويُبقي النقاط. الاسم يُختصر وقت البناء */
.crx-ring-item b { display: block; font-size: .8rem; line-height: 1.4; max-width: 100%; overflow-wrap: anywhere; }
.crx-ring-item small { font-size: .72rem; color: var(--gold); }
.crx-hint { position: absolute; bottom: 0; left: 50%; translate: -50% 0; margin: 0; display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--muted); white-space: nowrap; }
.crx-hint svg { width: 15px; height: 15px; color: var(--gold); animation: crxWave 2.4s ease-in-out infinite; }
@keyframes crxWave { 0%, 100% { transform: translateX(0) rotate(0); } 50% { transform: translateX(-8px) rotate(-12deg); } }
.crx-empty-emblem { width: 140px; height: 140px; border-radius: 50%; display: grid; place-items: center; color: var(--gold); background: var(--gold-soft); border: 1px solid var(--stroke); }
.crx-empty-emblem svg { width: 60px; height: 60px; }
.crx-hero > .container > .breadcrumbs { margin: 0 0 4px; position: relative; z-index: 3; }
@media (max-width: 979px) {
  .crx-hero { justify-content: flex-start; min-height: 0; padding-bottom: 20px; }
  .crx-ring-wrap { order: -1; height: clamp(320px, 88vw, 460px); margin: -6px 0 6px; }
  .crx-hero h1 { font-size: clamp(3rem, 15vw, 5rem); }
  .crx-ring { --rad: min(40vw, 240px); --w: min(29vw, 132px); }
}
.crx-stats { position: relative; z-index: 3; margin: 18px auto 0; width: calc(100% - 32px); max-width: 1120px; display: grid; grid-template-columns: repeat(4, 1fr);
  border-radius: 24px; overflow: hidden; background: var(--glass); border: 1px solid var(--border-2); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  opacity: calc(1 - var(--x, 0) * 2); }
.crx-stats > div { padding: 14px 16px; display: grid; gap: 2px; text-align: center; border-inline-start: 1px solid var(--border); }
.crx-stats > div:first-child { border-inline-start: 0; }
.crx-stats strong { font-family: var(--font-mega); font-weight: 700; font-size: clamp(1.5rem, 4vw, 2.3rem); line-height: 1.1;
  background: linear-gradient(180deg, var(--gold-2), var(--gold-3)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.crx-stats span { color: var(--muted); font-size: .8rem; }
@media (max-width: 560px) { .crx-stats { grid-template-columns: repeat(2, 1fr); } .crx-stats > div:nth-child(3) { border-inline-start: 0; } .crx-stats > div:nth-child(n+3) { border-top: 1px solid var(--border); } }

/* ---------- tools (search / filters) ---------- */
.crx-tools { padding: 14px; border-radius: 24px; background: var(--glass); border: 1px solid var(--border-2); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }

/* ---------- 3D creator cards ---------- */
.crx-grid { display: grid; gap: 22px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); margin-top: 14px; }
.cr-card.crx-card { position: relative; display: block; padding: 0; border: 0; background: none; border-radius: 30px; perspective: 900px; color: var(--text); transform: none; box-shadow: none; }
.cr-card.crx-card:hover { transform: none; }
.crx-card[hidden] { display: none; }
.crx-card-in { position: relative; display: grid; gap: 14px; padding: 14px 14px 18px; border-radius: 30px; background: var(--card); border: 1px solid var(--stroke);
  box-shadow: var(--shadow); transform-style: preserve-3d; transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform .6s var(--ease), box-shadow .5s var(--ease), border-color .4s; }
.crx-card.hot .crx-card-in { transition: transform .1s linear, box-shadow .5s var(--ease), border-color .4s; }
.crx-card:hover .crx-card-in, .crx-card:focus-visible .crx-card-in { border-color: color-mix(in srgb, var(--gold) 70%, transparent); box-shadow: var(--glow); }
.crx-card-frame { display: block; padding: 7px; border-radius: 22px; background: var(--cr-frame); transform: translateZ(46px); box-shadow: 0 22px 40px -18px rgba(0, 0, 0, .7); }
.crx-card-frame .cr-avatar { display: grid; place-items: center; width: 100%; height: auto; aspect-ratio: 1; border-radius: 16px; object-fit: cover; }
.crx-card-frame .cr-avatar-gen { font-size: clamp(3rem, 10vw, 4.6rem); color: var(--on-gold); background: radial-gradient(70% 70% at 40% 30%, #fff2c4, var(--gold) 60%, var(--gold-3)); }
.crx-card-body { display: grid; gap: 8px; padding: 0 4px; transform: translateZ(28px); }
.crx-card-body strong { font-size: 1.16rem; line-height: 1.5; overflow-wrap: anywhere; }
.crx-card-body small { color: var(--muted); font-size: .86rem; line-height: 1.8; }
.crx-card-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; color: var(--muted); font-size: .84rem; }
.crx-card-meta > span:not(.badge) { display: inline-flex; align-items: center; gap: 4px; }
.crx-card-meta svg { width: 14px; height: 14px; }
.crx-serial { position: absolute; z-index: 2; top: 22px; inset-inline-end: 22px; transform: translateZ(70px); font-family: var(--font-mega); font-weight: 700; font-size: .9rem;
  padding: 4px 10px; border-radius: 999px; color: var(--cr-ink); background: var(--cr-paper); box-shadow: 0 8px 18px -8px rgba(0, 0, 0, .6); }
.crx-demo { position: absolute; z-index: 2; top: 22px; inset-inline-start: 22px; transform: translateZ(70px); }
.crx-card-go { position: absolute; bottom: 16px; inset-inline-end: 16px; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: var(--on-gold);
  background: var(--gold); transform: translateZ(40px) scale(.85); opacity: 0; transition: opacity .3s, transform .4s var(--ease); }
.crx-card:hover .crx-card-go, .crx-card:focus-visible .crx-card-go { opacity: 1; transform: translateZ(40px) scale(1); }
.crx-card-go svg { width: 18px; height: 18px; }
.crx-glare { position: absolute; inset: 0; border-radius: 30px; pointer-events: none; opacity: 0; transition: opacity .4s;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 0%), rgba(255, 255, 255, .16), transparent 45%); }
.crx-card.hot .crx-glare { opacity: 1; }
.crx-grid-sm { grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 16px; }
.crx-card-sm .crx-card-in { padding: 10px 10px 14px; gap: 10px; }
.crx-card-sm .crx-card-body strong { font-size: 1rem; }
.crx-card-sm .crx-serial, .crx-card-sm .crx-demo { top: 16px; }

/* ---------- join: 3D stairs ---------- */
.crx-join { position: relative; }
.crx-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; perspective: 1400px; counter-reset: none; }
@media (min-width: 900px) { .crx-steps { grid-template-columns: repeat(3, 1fr); align-items: end; } .crx-steps li:nth-child(2) { margin-bottom: 40px; } .crx-steps li:nth-child(3) { margin-bottom: 80px; } }
.crx-steps li { position: relative; padding: 26px 22px 22px; border-radius: 28px; background: var(--card); border: 1px solid var(--stroke); box-shadow: var(--shadow-lg);
  transform: rotateX(calc(14deg - var(--e, 1) * 14deg)) rotateY(-6deg); transform-style: preserve-3d; transition: transform .6s var(--ease); overflow: hidden; }
.crx-steps li:hover { transform: rotateX(0) rotateY(0) translateY(-6px); }
.crx-step-n { position: absolute; inset-inline-end: 10px; top: -18px; font-family: var(--font-mega); font-weight: 700; font-size: 7rem; line-height: 1; color: transparent;
  -webkit-text-stroke: 1.4px color-mix(in srgb, var(--gold) 55%, transparent); pointer-events: none; }
.crx-step-ic { width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; color: var(--on-gold); background: linear-gradient(145deg, var(--gold-2), var(--gold-3));
  box-shadow: 0 14px 26px -12px color-mix(in srgb, var(--gold) 70%, transparent); margin-bottom: 14px; }
.crx-step-ic svg { width: 26px; height: 26px; }
.crx-steps h3 { margin: 0 0 8px; font-size: 1.2rem; }
.crx-steps p { margin: 0; color: var(--muted); line-height: 1.9; font-size: .94rem; }
.crx-cta { margin-top: 30px; display: flex; flex-wrap: wrap; gap: 18px; align-items: center; justify-content: space-between; padding: clamp(22px, 4vw, 36px); border-radius: 30px;
  background: radial-gradient(80% 140% at 100% 0%, color-mix(in srgb, var(--gold) 20%, transparent), transparent 60%), var(--card); border: 1px solid var(--stroke); box-shadow: var(--shadow-lg); }
.crx-cta > div { flex: 1 1 320px; }
.crx-cta h2 { margin: 0 0 6px; font-family: var(--font-mega); font-size: clamp(1.5rem, 4vw, 2.2rem); }
.crx-cta p { margin: 0; color: var(--muted); line-height: 1.9; font-size: .94rem; }

/* ==========================================================
   creator page
   ========================================================== */
.crd-hero { position: relative; isolation: isolate; overflow: hidden; padding: calc(var(--header-h) + 18px) 0 40px; }
.crd-hero::before { content: ""; position: absolute; inset: 0 -10% 10%; z-index: -2; pointer-events: none;
  background: radial-gradient(40% 46% at 72% 40%, color-mix(in srgb, var(--lapis) 24%, transparent), transparent 70%),
              radial-gradient(34% 34% at 28% 30%, color-mix(in srgb, var(--gold) 14%, transparent), transparent 70%); }
.crd-hero .crx-giant { inset: auto 0 2% 0; font-size: clamp(5rem, 22vw, 16rem); }
.crd-hero-grid { display: grid; gap: 10px; align-items: center; margin-top: 8px; }
@media (min-width: 960px) { .crd-hero-grid { grid-template-columns: .9fr 1.1fr; gap: 40px; min-height: calc(100svh - var(--header-h) - 120px); } .crd-stage { order: 2; } }
.crd-stage { position: relative; display: grid; place-items: center; perspective: 1200px; padding: 30px 0 10px;
  transform: translate3d(0, calc(var(--x, 0) * 60px), 0); }
.crd-gl { position: absolute; inset: -6% -10%; --gl-o: .8; pointer-events: none; }
.crd-portrait { position: relative; margin: 0; width: min(74vw, 360px); transform-style: preserve-3d;
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition: transform .7s var(--ease); animation: crdFloat 7s ease-in-out infinite; }
.crd-portrait.hot { transition: transform .1s linear; animation-play-state: paused; }
@keyframes crdFloat { 0%, 100% { translate: 0 0; } 50% { translate: 0 -12px; } }
.crd-plate { position: absolute; inset: 8% -9% 14% -9%; border-radius: 34px; transform: translateZ(-70px) rotate(-6deg);
  background: linear-gradient(150deg, color-mix(in srgb, var(--lapis) 70%, #0b1530), #0b1530); border: 1px solid color-mix(in srgb, var(--lapis-2) 40%, transparent);
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .8); }
.crd-plate::after { content: ""; position: absolute; inset: 14px; border-radius: 24px; opacity: .5;
  background: repeating-linear-gradient(45deg, transparent 0 18px, rgba(242, 194, 91, .14) 18px 19px), repeating-linear-gradient(-45deg, transparent 0 18px, rgba(242, 194, 91, .14) 18px 19px); }
.crd-frame { position: relative; display: block; padding: 14px; border-radius: 30px; background: var(--cr-frame); transform: translateZ(10px);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .6) inset, 0 -6px 14px rgba(0, 0, 0, .25) inset, 0 50px 70px -34px rgba(0, 0, 0, .9); }
.crd-frame::before { content: ""; position: absolute; inset: 7px; border-radius: 24px; border: 1px solid rgba(90, 60, 10, .45); pointer-events: none; }
.crd-frame .cr-avatar { display: grid; place-items: center; width: 100%; height: auto; aspect-ratio: 1; border-radius: 20px; object-fit: cover; }
.crd-frame .cr-avatar-gen { font-size: clamp(6rem, 24vw, 9rem); color: var(--on-gold); background: radial-gradient(70% 70% at 40% 30%, #fff2c4, var(--gold) 60%, var(--gold-3)); }
.crd-label { position: relative; z-index: 2; width: 84%; margin: -26px auto 0; padding: 12px 16px 14px; border-radius: 16px; display: grid; gap: 2px; text-align: center;
  background: var(--cr-paper); color: var(--cr-ink); transform: translateZ(60px); box-shadow: 0 18px 30px -14px rgba(0, 0, 0, .6); }
.crd-label b { font-size: 1.02rem; line-height: 1.5; overflow-wrap: anywhere; }
.crd-label small { font-size: .8rem; color: #6b5a33; }
.crd-label .ltr { font-family: var(--font-mega); font-weight: 700; font-size: .78rem; color: #8a6a1c; letter-spacing: .08em; }
.crd-head { display: grid; gap: 16px; justify-items: start; position: relative; z-index: 3; }
.crd-serial { margin-inline-start: 4px; padding-inline-start: 8px; border-inline-start: 1px solid var(--stroke); }
.crd-head h1 { margin: 0; font-family: var(--font-mega); font-weight: 700; font-size: clamp(2.4rem, 8vw, 4.8rem); line-height: 1.12; overflow-wrap: anywhere;
  background: linear-gradient(180deg, var(--text) 30%, color-mix(in srgb, var(--gold) 70%, var(--text))); -webkit-background-clip: text; background-clip: text; color: transparent; }
.crd-lead { margin: 0; color: var(--muted); font-size: clamp(1rem, 2.3vw, 1.12rem); line-height: 2; max-width: 36em; }
.crd-facts { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.crd-facts li { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 999px; font-size: .88rem; background: var(--surface-2); border: 1px solid var(--border-2); }
.crd-facts svg { width: 16px; height: 16px; color: var(--gold); }
.cr-links.crd-links { margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.crd-links li { display: contents; }
.crd-links a { padding: 10px 16px; border-radius: 999px; background: var(--glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.crd-links a span { flex: 0 1 auto; }

.crd-body { padding-top: 10px; padding-bottom: 40px; display: grid; gap: clamp(40px, 7vw, 70px); }
.crd-sec { min-width: 0; }
.crd-sec-head { display: grid; gap: 4px; justify-items: start; margin-bottom: 18px; }
.crd-works .crd-sec-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px; }
.crd-works .crd-sec-head > div:first-child { display: grid; gap: 4px; }
.crd-sec h2 { margin: 0; font-family: var(--font-mega); font-size: clamp(1.7rem, 4.6vw, 2.6rem); line-height: 1.25; scroll-margin-top: calc(var(--header-h) + 20px); }
.crd-about .prose { position: relative; max-width: 760px; padding: clamp(22px, 4vw, 36px); padding-top: clamp(30px, 5vw, 44px); border-radius: 30px; background: var(--card); border: 1px solid var(--stroke); }
.crd-about .prose::before { content: "”"; position: absolute; top: -.18em; inset-inline-start: 18px; font-family: Georgia, serif; font-size: 7rem; line-height: 1; color: var(--gold); opacity: .55; }
.crd-about .prose p:first-child { font-size: 1.14rem; color: var(--text); }

/* works: curved corridor */
.crd-nav { display: flex; gap: 8px; }
/* معرض مثبّت: يقف القسم على الشاشة والتمرير العمودي العادي يحرّك صف الأعمال (fx.js → data-hscroll)، ثم تكمل الصفحة.
   لا تمرير أفقي داخلي يتنازع مع تمرير الصفحة. الميل ثلاثي الأبعاد يأتي من --cf (بُعد العمل عن منتصف الشاشة). */
.crd-works { margin-inline: calc(50% - 50vw); }
.crd-works .hg-sticky { gap: clamp(10px, 2.5vh, 22px); }
.crd-works .crd-sec-head { width: 100%; max-width: 1240px; margin: 0 auto; padding-inline: 16px; }
.crd-works .crd-sec-head > div:first-child { display: grid; gap: 8px; justify-items: start; }
.crd-works .hg-progress { width: 140px; }
.crd-track.hg-track { gap: clamp(14px, 3vw, 28px); padding: 16px calc(50vw - min(39vw, 160px)) 30px; transform-style: preserve-3d; outline: none; }
.crd-track.hg-track:focus-visible .crd-work-in { box-shadow: 0 0 0 2px var(--gold); }
.crd-work { flex: 0 0 min(78vw, 320px); transform-style: preserve-3d;
  transform: rotateY(calc(var(--cf, 0) * 46deg)) translateZ(calc(var(--cfa, 0) * -150px)) scale(calc(1 - var(--cfa, 0) * .06));
  opacity: calc(1 - var(--cfa, 0) * .42); transition: opacity .2s linear; }
@media (min-width: 900px) { .crd-work { transform: rotateY(calc(var(--cf, 0) * 70deg)) translateZ(calc(var(--cfa, 0) * -220px)); } }
html.rm .crd-works, html.lite .crd-works { margin-inline: 0; }
html.rm .crd-track.hg-track, html.lite .crd-track.hg-track { padding-inline: 4px; scroll-snap-type: x mandatory; }
html.rm .crd-work, html.lite .crd-work { transform: none; opacity: 1; scroll-snap-align: center; }
.crd-work-in { border-radius: 26px; overflow: hidden; background: var(--card); border: 1px solid var(--stroke); box-shadow: var(--shadow-lg); }
.crd-work-in > img, .crd-work-in > .cr-work-gen { display: grid; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; background: var(--surface); }
.crd-work-cap { padding: 16px 18px 18px; display: grid; gap: 6px; }
.crd-work-cap h3 { margin: 0; font-size: 1.05rem; line-height: 1.6; }
.crd-work-cap small { color: var(--gold); font-size: .8rem; font-family: var(--font-mega); }
.crd-work-cap p { margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.8; }
.crd-work-cap .link { display: inline-flex; align-items: center; gap: 4px; font-size: .9rem; justify-self: start; }
.crd-work-cap .link svg { width: 15px; height: 15px; }

/* id card */
.crd-idcard { display: grid; gap: 18px; align-items: center; max-width: 760px; padding: clamp(18px, 3.4vw, 28px); border-radius: 30px; position: relative; overflow: hidden;
  background: linear-gradient(135deg, color-mix(in srgb, var(--lapis) 26%, transparent), transparent 55%), var(--card); border: 1px solid var(--stroke); box-shadow: var(--shadow-lg);
  transform: perspective(1000px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition: transform .6s var(--ease); }
.crd-idcard.hot { transition: transform .1s linear; }
.crd-idcard::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(420px circle at var(--mx, 30%) var(--my, 0%), rgba(255, 255, 255, .1), transparent 45%); }
@media (min-width: 640px) { .crd-idcard { grid-template-columns: 170px 1fr; } }
.crd-id-photo { padding: 6px; border-radius: 22px; background: var(--cr-frame); width: min(100%, 170px); }
.crd-id-photo .cr-avatar { display: grid; place-items: center; width: 100%; height: auto; aspect-ratio: 1; border-radius: 17px; object-fit: cover; }
.crd-id-photo .cr-avatar-gen { font-size: 4rem; color: var(--on-gold); background: radial-gradient(70% 70% at 40% 30%, #fff2c4, var(--gold) 60%, var(--gold-3)); }
.crd-id-name { margin: 0 0 8px; font-family: var(--font-mega); font-weight: 700; font-size: 1.3rem; overflow-wrap: anywhere; }
.crd-idcard .kv th { width: 42%; }

/* certificate: a 3D card that flips */
.crd-cert-grid { display: grid; gap: 26px; align-items: center; }
@media (min-width: 900px) { .crd-cert-grid { grid-template-columns: 1.05fr .95fr; } }
.crd-cert3d { position: relative; width: min(100%, 560px); aspect-ratio: 1.414; margin-inline: auto; perspective: 1400px; cursor: pointer; outline: none;
  transform-style: preserve-3d; transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); animation: crdSway 9s ease-in-out infinite; }
.crd-cert3d:focus-visible { outline: 2px solid var(--gold); outline-offset: 8px; border-radius: 22px; }
@keyframes crdSway { 0%, 100% { transform: rotateX(6deg) rotateY(-9deg); } 50% { transform: rotateX(2deg) rotateY(9deg); } }
.crd-cface { position: absolute; inset: 0; border-radius: 22px; display: grid; place-content: center; justify-items: center; gap: 6px; padding: 7% 8%; text-align: center;
  backface-visibility: hidden; -webkit-backface-visibility: hidden; transition: transform 1s var(--ease); box-shadow: 0 50px 80px -40px rgba(0, 0, 0, .85); overflow: hidden; }
.crd-front { background: linear-gradient(160deg, #0f1d44, #0b1530 60%, #070d22); color: #f6efdc; border: 2px solid #c99a2e; transform: rotateY(0deg); }
.crd-back { background: linear-gradient(160deg, #fbf4e4, #efe2c2); color: var(--cr-ink); border: 2px solid #c99a2e; transform: rotateY(180deg); }
.crd-cert3d.flipped .crd-front { transform: rotateY(-180deg); }
.crd-cert3d.flipped .crd-back { transform: rotateY(0deg); }
.crd-cface::before { content: ""; position: absolute; inset: 10px; border-radius: 14px; border: 1px solid rgba(242, 194, 91, .55); pointer-events: none; }
.crd-front::after { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background: repeating-linear-gradient(45deg, transparent 0 22px, rgba(242, 194, 91, .08) 22px 23px), repeating-linear-gradient(-45deg, transparent 0 22px, rgba(242, 194, 91, .08) 22px 23px); }
.crd-cert-crown { position: relative; z-index: 1; width: clamp(44px, 9vw, 62px); height: clamp(44px, 9vw, 62px); border-radius: 50%; display: grid; place-items: center; color: #160f02;
  background: radial-gradient(70% 70% at 40% 30%, #fff2c4, #f2c25b 60%, #b07d14); box-shadow: 0 10px 24px -10px rgba(242, 194, 91, .8); }
.crd-cert-crown svg { width: 55%; height: 55%; }
.crd-cface small { position: relative; z-index: 1; font-size: clamp(.72rem, 1.8vw, .9rem); letter-spacing: .02em; color: #e8c877; }
.crd-back small { color: #8a6a1c; }
/* بلا overflow:hidden داخل الوجه ثلاثي الأبعاد (يُخفي النص في Chrome)؛ الاسم الطويل يُختصر وقت البناء */
.crd-cface strong { position: relative; z-index: 1; display: block; font-family: var(--font-mega); font-weight: 700; font-size: clamp(1.2rem, 4.4vw, 2.1rem); line-height: 1.3; overflow-wrap: anywhere; max-width: 100%; }
.crd-front strong { background: linear-gradient(180deg, #fff3c9, #f2c25b 60%, #c99a2e); -webkit-background-clip: text; background-clip: text; color: transparent; }
.crd-cface p { position: relative; z-index: 1; margin: 0; font-size: clamp(.72rem, 1.9vw, .92rem); line-height: 1.7; opacity: .85; }
.crd-cert-code { position: relative; z-index: 1; margin-top: 4px; padding: 3px 12px; border-radius: 999px; font-size: clamp(.68rem, 1.7vw, .82rem); letter-spacing: .1em;
  border: 1px solid rgba(242, 194, 91, .5); color: #f2c25b; }
.crd-cert-flip { position: absolute; z-index: 1; bottom: 16px; display: inline-flex; gap: 6px; align-items: center; font-size: .8rem; color: #8a6a1c; }
.crd-cert-flip svg { width: 15px; height: 15px; }
.crd-cert-copy { display: grid; gap: 12px; }
.crd-cert-copy > p:first-child { margin: 0; font-size: 1.04rem; line-height: 2; }
.crd-cert-copy .small svg { display: inline-block; width: 14px; height: 14px; vertical-align: -2px; color: var(--gold); }
@media (max-width: 520px) { .crd-cert-copy .btn { flex: 1 1 100%; justify-content: center; } }

.crx-more { padding-top: 10px; }

/* ---------- light theme ---------- */
:root[data-theme="light"] .crx { --cr-paper: #fffaf0; }
:root[data-theme="light"] .crx-hero h1 .l2 { -webkit-text-stroke-color: var(--navy); }
:root[data-theme="light"] .crx-ring-item, :root[data-theme="light"] .crx-card-in { box-shadow: 0 30px 60px -34px rgba(20, 30, 70, .45), 0 0 0 1px rgba(176, 125, 20, .12); }
:root[data-theme="light"] .crx-glare { background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 0%), rgba(255, 255, 255, .6), transparent 45%); }
:root[data-theme="light"] .crd-head h1 { background: linear-gradient(180deg, var(--navy) 40%, var(--gold-3)); -webkit-background-clip: text; background-clip: text; }

/* ---------- calm modes: lite, reduced motion, print ---------- */
html.rm .crx-ring, html.lite .crx-ring { transform: rotateX(-7deg) rotateY(-12deg) !important; }
html.rm .crd-portrait, html.rm .crd-cert3d, html.lite .crd-portrait, html.lite .crd-cert3d { animation: none; }
html.rm .crx-hint, html.lite .crx-hint { display: none; }
@media (prefers-reduced-motion: reduce) {
  .crx-hero-text > *, .crd-head > *, .crd-portrait, .crd-cert3d, .crx-hint svg { animation: none !important; }
  .crd-cface { transition: none; }
}
@media print { .crx-ring-wrap, .crd-stage, .crd-works, .crd-cert3d, .crx-giant { display: none !important; } }

/* phones: two portraits per row, like a gallery wall */
@media (max-width: 560px) {
  .crx-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .crx-card-in { padding: 8px 8px 12px; gap: 10px; border-radius: 22px; }
  .crx-card-frame { padding: 5px; border-radius: 16px; transform: translateZ(30px); }
  .crx-card-frame .cr-avatar { border-radius: 12px; }
  .crx-card-body { padding: 0 2px; gap: 6px; }
  .crx-card-body strong { font-size: .95rem; }
  .crx-card-body small { display: none; }
  .crx-card-meta { font-size: .76rem; }
  .crx-serial { top: 14px; inset-inline-end: 14px; font-size: .72rem; padding: 3px 8px; }
  .crx-demo { top: 14px; inset-inline-start: 14px; font-size: .68rem; }
  .crx-card-go { display: none; }
  .crx-glare { border-radius: 22px; }
}

/* ---------- certificate preview: Ishtar Gate wall + clay tablet (matches the downloadable certificate) ---------- */
.crd-front { --brick: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='40'%3E%3Crect width='72' height='40' fill='%230b1840'/%3E%3Crect x='2' y='2' width='68' height='16' rx='1' fill='%23203f96'/%3E%3Crect x='2' y='2' width='68' height='5' fill='%23ffffff' fill-opacity='.08'/%3E%3Crect x='-34' y='22' width='68' height='16' rx='1' fill='%231a3584'/%3E%3Crect x='38' y='22' width='68' height='16' rx='1' fill='%23234499'/%3E%3C/svg%3E");
  --rose: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='44' height='34' viewBox='0 0 44 34'%3E%3Cg transform='translate(22 17)'%3E%3Cg fill='%23f7f1e1'%3E%3Cellipse rx='2.3' ry='6' cy='-7'/%3E%3Cellipse rx='2.3' ry='6' cy='-7' transform='rotate(30)'/%3E%3Cellipse rx='2.3' ry='6' cy='-7' transform='rotate(60)'/%3E%3Cellipse rx='2.3' ry='6' cy='-7' transform='rotate(90)'/%3E%3Cellipse rx='2.3' ry='6' cy='-7' transform='rotate(120)'/%3E%3Cellipse rx='2.3' ry='6' cy='-7' transform='rotate(150)'/%3E%3Cellipse rx='2.3' ry='6' cy='-7' transform='rotate(180)'/%3E%3Cellipse rx='2.3' ry='6' cy='-7' transform='rotate(210)'/%3E%3Cellipse rx='2.3' ry='6' cy='-7' transform='rotate(240)'/%3E%3Cellipse rx='2.3' ry='6' cy='-7' transform='rotate(270)'/%3E%3Cellipse rx='2.3' ry='6' cy='-7' transform='rotate(300)'/%3E%3Cellipse rx='2.3' ry='6' cy='-7' transform='rotate(330)'/%3E%3C/g%3E%3Ccircle r='4' fill='%23e7a92e'/%3E%3C/g%3E%3C/svg%3E");
  display: flex; flex-direction: column; justify-content: space-between; place-content: normal; padding: 0; gap: 0;
  background: var(--brick) 0 0 / 54px 30px, #14296b; border: 2px solid #c99a2e; color: var(--cr-ink); }
.crd-front::after { display: none; }
.crd-front::before { inset: 6px; border-color: rgba(231, 181, 74, .5); }
.crd-band { position: relative; z-index: 1; flex: 0 0 12%; background: var(--rose) center / auto 74% repeat-x, #0e1f52;
  border-block: 3px solid #e7b54a; box-shadow: 0 2px 0 #f7f1e1 inset, 0 -2px 0 #f7f1e1 inset; }
.crd-tab { position: relative; z-index: 1; align-self: center; width: 74%; flex: 1 1 0; min-height: 0; margin: 3.5% 0; padding: 7% 5% 3%; display: grid; place-content: center; justify-items: center; gap: 4px; text-align: center;
  background: linear-gradient(180deg, #f7eed9, #e6d4ad); border-radius: 0 0 12px 12px; box-shadow: 0 14px 30px -12px rgba(0, 0, 0, .7);
  clip-path: polygon(0 9%, 4% 9%, 4% 4.5%, 7% 4.5%, 7% 0, 13% 0, 13% 4.5%, 16% 4.5%, 16% 9%, 24% 9%, 24% 4.5%, 27% 4.5%, 27% 0, 33% 0, 33% 4.5%, 36% 4.5%, 36% 9%, 44% 9%, 44% 4.5%, 47% 4.5%, 47% 0, 53% 0, 53% 4.5%, 56% 4.5%, 56% 9%, 64% 9%, 64% 4.5%, 67% 4.5%, 67% 0, 73% 0, 73% 4.5%, 76% 4.5%, 76% 9%, 84% 9%, 84% 4.5%, 87% 4.5%, 87% 0, 93% 0, 93% 4.5%, 96% 4.5%, 96% 9%, 100% 9%, 100% 100%, 0 100%); }
.crd-front .crd-cert-crown { width: clamp(30px, 6vw, 44px); height: clamp(30px, 6vw, 44px); }
.crd-front small { color: #8a5a14; font-family: var(--font-mega); font-weight: 700; font-size: clamp(.8rem, 2.4vw, 1.15rem); }
.crd-front strong { font-family: var(--font-mega); background: none; -webkit-background-clip: border-box; background-clip: border-box; color: #10225a; font-size: clamp(1rem, 3.6vw, 1.75rem); }
.crd-front p { color: #4b3c22; font-size: clamp(.64rem, 1.6vw, .82rem); opacity: 1; }
.crd-front .crd-cert-code { color: #8a5a14; border-color: rgba(181, 121, 29, .5); }
.crd-back { background: radial-gradient(70% 60% at 50% 40%, #f7eed9, #e3d0a6); }
