/* ═══════════════════════════════════════════════════════════
   الباشمبرمج · Visual enhancements (additive — original untouched)
   WebGL bg · cinematic scroll · micro-interactions · 3D keycaps + globe
   ═══════════════════════════════════════════════════════════ */

/* ── WebGL animated background ── */
#fx-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.4s ease;
}
.fx-ready #fx-canvas { opacity: 1; }

/* ── Scroll progress bar ── */
#scroll-progress {
  position: fixed;
  top: 0;
  inset-inline-start: 0;
  height: 2px;
  width: 0%;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold), var(--gold-soft));
  box-shadow: 0 0 12px rgba(212, 172, 116, 0.6);
  z-index: 200;
  pointer-events: none;
}

/* ── Skip to content (a11y) ── */
.skip-link {
  position: fixed;
  top: 10px;
  inset-inline-start: 10px;
  z-index: 9999;
  background: var(--gold);
  color: #0A0C0F;
  font-weight: 700;
  padding: 10px 18px;
  border-radius: 10px;
  transform: translateY(-150%);
  transition: transform 0.2s ease;
}
.skip-link:focus { transform: translateY(0); outline: none; }

/* slightly larger section kicker labels (readability) */
.sec-num { font-size: 0.95rem; }

/* contact-form honeypot (hidden from humans, catches bots) — clip-based so it never expands the page width (no horizontal scroll on mobile) */
.hp-field { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; opacity: 0; pointer-events: none; }

/* lang-toggle "coming soon" toast */
#bm-toast {
  position: fixed;
  bottom: 24px;
  inset-inline-start: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-elev);
  color: var(--fg);
  border: 1px solid var(--line-gold);
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 0.9rem;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}
#bm-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── 3D tilt on cards ── */
.cap-card, .work-card, .sprint, .eco-card, .testi {
  transform-style: preserve-3d;
  will-change: transform;
}

/* ── Magnetic buttons keep their own transition off so JS drives it ── */
.btn, .nav-cta, .sprint-cta { will-change: transform; }

/* ── Editor live-typing line reveal ── */
.editor-body .eline { display: block; }
.fx-typing .editor-body .eline { opacity: 0; transform: translateX(10px); }

/* ── Big-title scrub reveal helper ── */
.fx-title-rise { display: inline-block; }

/* Respect reduced motion — kill the heavy stuff (also overrides original main.css) */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto !important; }
  #fx-canvas, #scroll-progress { display: none !important; }
  .marquee, .marquee-track { animation: none !important; }
  .fx-typing .editor-body .eline { opacity: 1; transform: none; }
}

/* ── v2 3D elements: tech keycaps (#tech) + contact globe (#globe) ── */
#tech {
  display: block;
  width: 100%;
  height: clamp(300px, 40vh, 440px);
  margin-top: 0;
  cursor: grab;
}
.tech-hint {
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
  color: var(--gold);
  font-size: 0.82rem;
  margin-top: 0.6rem;
  opacity: 0.95;
}
/* ── v2-style contact: full-bleed particle globe + centered CTA on top ── */
.cta.cta-v2 {
  position: relative;
  overflow: hidden;
  min-height: 88vh;
  min-height: 88dvh; /* size to the visible viewport so mobile browser chrome doesn't clip it */
  padding-block: 0;  /* the inner owns the vertical spacing; don't stack main.css .cta padding */
  display: flex;
  align-items: center;
}
.cta.cta-v2 #globe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  /* fade the globe into the background at every edge so it never looks "cut off" */
  -webkit-mask-image: radial-gradient(ellipse 86% 86% at 50% 50%, #000 52%, rgba(0,0,0,0) 100%);
          mask-image: radial-gradient(ellipse 86% 86% at 50% 50%, #000 52%, rgba(0,0,0,0) 100%);
}
.cta.cta-v2 .cta-v2-inner {
  position: relative;
  z-index: 2;
  text-align: center;
  max-width: 760px;
  margin-inline: auto;
  padding-block: clamp(4rem, 14vh, 9rem);
}
/* soft radial scrim behind the text so it stays readable over the globe */
.cta.cta-v2 .cta-v2-inner::before {
  content: "";
  position: absolute;
  inset: -25% -18%;
  z-index: -1;
  background: radial-gradient(ellipse at center, rgba(10, 12, 15, 0.85) 0%, rgba(10, 12, 15, 0.55) 42%, rgba(10, 12, 15, 0) 72%);
  pointer-events: none;
}
.cta.cta-v2 .cta-prompt { color: var(--green); justify-content: center; display: flex; }
.cta.cta-v2 .cta-v2-title { font-size: clamp(2.2rem, 6vw, 4rem); line-height: 1.1; margin: 0.6rem 0 1.1rem; }
.cta.cta-v2 .cta-v2-sub { color: var(--fg-muted); max-width: 56ch; margin-inline: auto; line-height: 1.7; }
.cta.cta-v2 .cta-v2-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 2.2rem;
}
.cta.cta-v2 .cta-v2-alt { margin-top: 1.6rem; color: var(--fg-muted); font-size: 0.85rem; }
.cta.cta-v2 .cta-v2-alt a { color: var(--gold); text-underline-offset: 3px; }
@media (max-width: 600px) {
  .cta.cta-v2 { min-height: 82vh; min-height: 82dvh; }
  .cta.cta-v2 .cta-v2-actions .btn { width: 100%; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  #tech, #globe, .tech-hint { display: none !important; }
}

/* ── Capability icons: consistent Lucide SVG (replaces text glyphs) ── */
.cap-icon svg { width: 24px; height: 24px; display: block; }

/* ── Form: required-field indicator + sending state ── */
.form-field label .req { color: var(--gold); font-weight: 700; margin-inline-start: 0.15rem; }
.btn.is-sending { opacity: 0.65; cursor: progress; }
.btn.is-sending .arrow { display: none; }

/* ── Homepage "latest work" → uniform grid of browser-framed cards (no big hero) ── */
.ws-sp { display: flex; flex-direction: column; gap: 1.2rem; }
.ws-sp img { transition: transform 0.5s ease; }
.ws-sp .strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.ws-sp .strip a { border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: var(--bg-elev); text-decoration: none; color: inherit; transition: border-color 0.3s, transform 0.3s; }
.ws-sp .strip a:hover { border-color: var(--gold); transform: translateY(-4px); }
.ws-sp .strip .v { aspect-ratio: 16 / 10; overflow: hidden; position: relative; }
.ws-sp .strip .v img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ws-sp .strip a:hover .v img { transform: scale(1.05); }
.ws-sp .strip .m { display: flex; align-items: center; gap: 0.6rem; padding: 0.75rem 0.9rem; font-size: 0.92rem; font-weight: 600; }
.ws-sp .strip .m .wlogo { width: 34px; height: 34px; flex: 0 0 auto; border-radius: 8px; object-fit: contain; background: rgba(255,255,255,0.06); padding: 3px; }
.ws-sp .strip .m .wtxt { min-width: 0; line-height: 1.35; }
.ws-sp .strip .m span { display: block; color: var(--gold); font-size: 0.72rem; font-weight: 400; margin-top: 0.15rem; }
/* tiqnia-style browser-chrome frame over each work screenshot (dots-only bar) */
.ws-sp .strip .v::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 28px; z-index: 3;
  background: #15181f; border-bottom: 1px solid rgba(255,255,255,0.07);
}
.ws-sp .strip .v::after {
  content: ''; position: absolute; top: 10.5px; left: 14px; z-index: 4;
  width: 7px; height: 7px; border-radius: 50%;
  background: #ff5f57; box-shadow: 12px 0 0 #febc2e, 24px 0 0 #28c840;
}
@media (max-width: 760px) {
  /* tiqnia-style: horizontal swipe carousel instead of a long vertical stack */
  .ws-sp .strip { display: flex; grid-template-columns: none; overflow-x: auto; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding-bottom: 0.4rem; }
  .ws-sp .strip::-webkit-scrollbar { display: none; }
  .ws-sp .strip > a { flex: 0 0 76%; scroll-snap-align: start; }
}
/* tighter, consistent vertical rhythm — the old clamp(5rem,12vh,9rem) section padding +
   4.5rem sec-head gap left big empty bands between/inside sections */
.sec { padding-block: clamp(3rem, 7vh, 5rem); }
.sec-head { margin-bottom: 3rem; }

/* Scroll hardening: instant (no slow smooth-scroll animation) + no scroll-anchoring
   jumps when content height shifts (lazy media / 3D) — fixes the "stuck / won't
   reach the top / cut" feeling on scroll-back-up. scroll-padding-top so anchor
   jumps clear the fixed nav. */
html { scroll-behavior: auto; overflow-anchor: none; scroll-padding-top: 90px; }

/* Mobile: trim the testimonials to 3 to cut the very long scroll */
@media (max-width: 700px) { .testi-grid .testi:nth-child(n+4) { display: none; } }

/* ── Mobile nav: surface the primary CTA inside the dropdown, declutter the top bar ── */
.nav { --bm-navfix: 1; }              /* sentinel: tells main.js this CSS has the nav-cta fix */
.nav-menu .nav-cta-li { display: none; } /* hidden until main.js confirms (.has-navcta-clone) */
@media (max-width: 1000px) {
  /* scoped to .has-navcta-clone so an old main.js (no clone) never loses the top-bar CTA */
  .nav.has-navcta-clone .nav-inner > .nav-cta { display: none; }
  .nav.has-navcta-clone .nav-menu .nav-cta-li { display: block; width: 100%; padding: 0.7rem 1.5rem 0.3rem; }
  .nav.has-navcta-clone .nav-menu .nav-cta-li .nav-cta {
    display: inline-flex; width: 100%; justify-content: center;
    color: var(--bg);          /* beat .nav-menu a (cream) so text shows on the cream pill */
    border-bottom: 0;          /* cancel the menu-link divider */
    padding: 0.85rem 1.3rem;   /* restore pill padding, not the tall menu-link padding */
    font-size: 0.95rem;
  }
}

/* ── Sprints: honesty note + premium anchor bar (Fable pricing review, 2026-07) ── */
.sprint-note { max-width: 700px; margin: 1.6rem auto 0; text-align: center; color: var(--fg-dim); font-size: 0.8rem; line-height: 1.8; }
.sprint-anchor { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.35rem 1rem; margin-top: 1.1rem; padding: 1.1rem 1.5rem; border: 1px solid var(--line-gold); border-radius: 16px; background: var(--bg-card); text-decoration: none; color: var(--fg); transition: border-color 0.3s, background 0.3s; }
.sprint-anchor:hover { border-color: var(--gold); }
.sprint-anchor span { color: var(--fg-muted); }
.sprint-anchor strong { color: var(--gold); font-weight: 700; }
