/* ==========================================================================
   the task — PREMIUM DESIGN LAYER · "Industrial Luxury"
   --------------------------------------------------------------------------
   ADDITIVE / DECORATIVE ONLY. Loaded AFTER main.css (cascades on top).
   - No layout changes on major containers (.nav/.section/.hero/.footer/grids)
   - RTL-safe: direction-symmetric or logical properties everywhere
   - Grain, glows, gradients = backgrounds/transforms/pseudo-elements only
   - Fixed overlays: z-index <= 3 + pointer-events:none (never blocks clicks)
   - prefers-reduced-motion: all premium motion disabled
   - Depends on tokens from main.css (--c-magenta, --c-black, --ease-out ...)
     and on the parent <link> adding 'Space Grotesk' to the Google Fonts URL.
   ========================================================================== */

/* ================= 1 · TOKENS (cascade overrides) ================= */
:root {
  /* Typography elevation — display font only; --f-body/--f-arabic untouched */
  --f-display: 'Space Grotesk', 'Poppins', system-ui, sans-serif;

  /* Premium gradient system */
  --tt-hot: #FF3DA6;
  --tt-wine: #7A0048;
  --tt-teal: #4a7a8c;
  --tt-grad-hot: linear-gradient(120deg, #EC008C 0%, #FF3DA6 100%);
  --tt-grad-btn: linear-gradient(135deg, #EC008C 0%, #FF3DA6 100%);
  --tt-grad-wine: linear-gradient(135deg, #FF3DA6 0%, #EC008C 45%, #7A0048 100%);

  /* Premium shadows */
  --tt-shadow-mag: 0 8px 28px rgba(236, 0, 140, 0.35);
  --tt-shadow-mag-lg: 0 12px 40px rgba(236, 0, 140, 0.5);
  --tt-shadow-card: 0 20px 48px rgba(0, 0, 0, 0.5);
  --tt-hairline: linear-gradient(90deg, transparent, rgba(236, 0, 140, 0.45), transparent);

  /* Film grain — tiny inline SVG (feTurbulence), no network, no assets */
  --tt-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23g)'/%3E%3C/svg%3E");
}

/* ================= 2 · ATMOSPHERE · film grain overlay ================= */
/* Sits at z-index:1 — above raw content, BELOW nav (100) / mobile menu (200)
   / journey rail & captions (10–25) / WhatsApp button (9998).                */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background-image: var(--tt-grain);
  background-repeat: repeat;
  opacity: 0.035;
}

/* ================= 3 · SCROLL PROGRESS BAR ================= */
#ttProgress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(90deg, var(--c-magenta) 0%, var(--tt-hot) 70%, rgba(255, 61, 166, 0.4) 100%);
  transform: scaleX(0);
  transform-origin: left center;
  opacity: 0.9;
}
body[dir="rtl"] #ttProgress { transform-origin: right center; }

/* ================= 4 · GLASS NAV (is-scrolled added by premium.js) ========= */
.nav.is-scrolled {
  background: rgba(10, 10, 10, 0.72);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  border-bottom-color: transparent;
}
/* Gradient hairline under the nav — fades in once glass engages */
.nav::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--tt-hairline);
  opacity: 0;
  transition: opacity 0.4s var(--ease-out);
  pointer-events: none;
}
.nav.is-scrolled::after { opacity: 1; }

/* ================= 5 · TYPOGRAPHY POLISH ================= */
/* Space Grotesk is a touch wider than Poppins — keep the tight optical set */
.section-title { letter-spacing: -0.035em; }

/* Gradient text (guarded — falls back to existing solid magenta) */
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .section-title .accent,
  .stat-value,
  .division-num,
  .service-index,
  .error-code,
  .stat-num em {
    background-image: var(--tt-grad-hot);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
  }
}

/* Mono micro-labels — magenta + tracking bump */
.overview-card-num { letter-spacing: 0.2em; }
.work-cat { letter-spacing: 0.22em; }

/* ================= 6 · SECTION HEADERS · eyebrow line + pulse dot ========== */
.section-eyebrow::before {
  content: '';
  display: inline-block;
  width: 22px;
  height: 1px;
  background: var(--tt-grad-hot);
  vertical-align: middle;
  margin-inline-end: 10px;
}
.section-eyebrow::after {
  content: '';
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--c-magenta);
  vertical-align: middle;
  margin-inline-start: 10px;
  animation: tt-dot 2s var(--ease-in-out) infinite;
}
@keyframes tt-dot {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(236, 0, 140, 0.5); }
  50%      { opacity: 0.55; box-shadow: 0 0 0 5px rgba(236, 0, 140, 0); }
}

/* ================= 7 · PAGE HEADER · blueprint grid + dual glow ============ */
/* Strengthen the existing magenta glow (was a single 500px blob @ 0.15) and
   add a teal depth glow bottom-left, painted with one full-bleed pseudo.     */
.page-header::before {
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: auto;
  height: auto;
  opacity: 1;
  background:
    radial-gradient(620px 480px at 82% 8%, rgba(236, 0, 140, 0.28), transparent 65%),
    radial-gradient(560px 430px at 5% 100%, rgba(74, 122, 140, 0.22), transparent 68%);
}
body[dir="rtl"] .page-header::before {
  left: 0;
  right: 0;
  background:
    radial-gradient(620px 480px at 18% 8%, rgba(236, 0, 140, 0.28), transparent 65%),
    radial-gradient(560px 430px at 95% 100%, rgba(74, 122, 140, 0.22), transparent 68%);
}
/* Blueprint grid texture — 56px cells, masked so it dissolves outward */
.page-header::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(120% 100% at 50% 0%, #000 0%, transparent 78%);
  mask-image: radial-gradient(120% 100% at 50% 0%, #000 0%, transparent 78%);
}

/* ================= 8 · HERO (classic hero template) ======================== */
/* Deepen overlay legibility: bottom-heavy black + magenta tint top-right,
   plus a soft top vignette. (Live pages use the .journey hero — see §13.)    */
.hero-overlay {
  background:
    radial-gradient(60% 50% at 85% 0%, rgba(236, 0, 140, 0.14) 0%, transparent 60%),
    linear-gradient(180deg, rgba(10, 10, 10, 0.55) 0%, rgba(10, 10, 10, 0.35) 35%, rgba(10, 10, 10, 0.92) 100%);
}
.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 90px;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(10, 10, 10, 0.55), transparent);
}

/* ================= 9 · BUTTONS ================= */
.btn-primary,
.nav-cta,
.form-submit {
  background-image: var(--tt-grad-btn);
  box-shadow: var(--tt-shadow-mag);
}
.btn-primary:hover,
.nav-cta:hover,
.form-submit:hover:not(:disabled) {
  box-shadow: var(--tt-shadow-mag-lg);
}
.btn-primary:active,
.nav-cta:active,
.form-submit:active:not(:disabled) {
  transform: translateY(0) scale(0.98);
}
.nav-cta:hover { transform: translateY(-2px); }

/* Outline button — pure-CSS sweep fill (transform-only, no geometry change) */
.btn-outline {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border-color: rgba(236, 0, 140, 0.4);
  transition: color var(--dur-fast), border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.btn-outline::before {
  content: '';
  position: absolute;
  inset: -1px;
  z-index: -1;
  background: var(--tt-grad-btn);
  transform: translateX(-101%) skewX(-12deg);
  transition: transform 0.45s var(--ease-out);
}
.btn-outline:hover {
  border-color: var(--c-magenta);
  color: var(--c-white);
  box-shadow: var(--tt-shadow-mag);
}
.btn-outline:hover::before { transform: translateX(0) skewX(0); }
body[dir="rtl"] .btn-outline::before { transform: translateX(101%) skewX(12deg); }
body[dir="rtl"] .btn-outline:hover::before { transform: translateX(0) skewX(0); }

/* Ghost — quiet magenta echo */
.btn-ghost:hover {
  box-shadow: 0 0 0 1px rgba(236, 0, 140, 0.18), 0 10px 26px rgba(0, 0, 0, 0.35);
}

/* Keyboard focus — consistent premium ring on EVERY interactive element */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--c-magenta);
  outline-offset: 3px;
}

/* ================= 10 · CARDS · hover life ================= */
/* Base: soften existing #2a2a2a hairlines */
.division-card,
.overview-card,
.faq-item,
.contact-block,
.step,
.service-item,
.work-item {
  border-color: rgba(255, 255, 255, 0.08);
}
.faq-item,
.contact-block,
.step,
.service-item {
  position: relative;
  transition:
    transform var(--dur-med) var(--ease-out),
    border-color var(--dur-fast),
    box-shadow var(--dur-med) var(--ease-out),
    background var(--dur-med);
}
/* Inner top hairline that glows in on hover */
.faq-item::before,
.contact-block::before,
.step::before,
.service-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--tt-hairline);
  opacity: 0;
  transition: opacity var(--dur-med) var(--ease-out);
  pointer-events: none;
}
.faq-item:hover,
.step:hover,
.service-item:hover {
  border-color: rgba(236, 0, 140, 0.45);
  transform: translateY(-4px);
  box-shadow: var(--tt-shadow-card);
  background: var(--c-surface-2);
}
.contact-block:hover {
  border-color: rgba(236, 0, 140, 0.45);
  transform: translateY(-2px);
}
.faq-item:hover::before,
.contact-block:hover::before,
.step:hover::before,
.service-item:hover::before { opacity: 1; }

/* Division cards live inside an overflow:hidden grid — lift/shadow would clip,
   so we deepen borders + sweep the existing top bar + glow hairline (::after,
   ::before is already used by main.css for the magenta sweep).               */
.division-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--tt-hairline);
  opacity: 0;
  transition: opacity var(--dur-med) var(--ease-out);
  pointer-events: none;
}
.division-card:hover { border-color: rgba(236, 0, 140, 0.45); }
.division-card:hover::after { opacity: 1; }

/* Overview cards (work pages) */
.overview-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  z-index: 3;
  background: var(--tt-hairline);
  opacity: 0;
  transition: opacity var(--dur-med) var(--ease-out);
  pointer-events: none;
}
.overview-card:hover {
  border-color: rgba(236, 0, 140, 0.45);
  box-shadow: var(--tt-shadow-card), 0 0 0 1px rgba(236, 0, 140, 0.3), 0 0 36px rgba(236, 0, 140, 0.12);
}
.overview-card:hover::after { opacity: 1; }

/* Work grid items */
.work-item {
  transition: transform var(--dur-med) var(--ease-out), border-color var(--dur-fast), box-shadow var(--dur-med) var(--ease-out);
}
.work-item:hover {
  border-color: rgba(236, 0, 140, 0.45);
  box-shadow: var(--tt-shadow-card);
}

/* ================= 11 · IMAGE TREATMENT · cinematic micro-grade ============ */
.work-img,
.overview-card-img {
  filter: saturate(1.05) contrast(1.02);
}
.work-item:hover .work-img {
  filter: brightness(0.6) saturate(1.08) contrast(1.03);
}
.overview-card:hover .overview-card-img {
  filter: brightness(0.5) saturate(1.08) contrast(1.03);
}

/* ================= 12 · TICKER · edge fade masks =========================== */
.ticker::before,
.ticker::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 110px;
  z-index: 2;
  pointer-events: none;
}
.ticker::before {
  left: 0;
  background: linear-gradient(90deg, var(--c-black) 0%, transparent 100%);
}
.ticker::after {
  right: 0;
  background: linear-gradient(90deg, transparent 0%, var(--c-black) 100%);
}

/* ================= 13 · JOURNEY HERO (home) · quiet accents ================ */
.journey-cta { will-change: transform; }
.journey-cta:hover {
  border-color: var(--c-magenta);
  box-shadow: 0 10px 30px rgba(236, 0, 140, 0.25), 0 0 0 1px rgba(236, 0, 140, 0.2);
}
.journey-rail-item.is-active .journey-rail-line {
  box-shadow: 0 0 10px rgba(236, 0, 140, 0.55);
}

/* ================= 14 · FOOTER ================= */
/* Gradient hairline replaces the solid top border (background trick — the
   .footer itself keeps its exact layout/position).                           */
.footer {
  border-top-color: transparent;
  background-image: var(--tt-hairline);
  background-repeat: no-repeat;
  background-size: 100% 1px;
  background-position: 0 0;
}
.social-icon:hover {
  color: var(--c-magenta);
  border-color: rgba(236, 0, 140, 0.6);
  box-shadow: 0 0 0 1px rgba(236, 0, 140, 0.35), 0 0 18px rgba(236, 0, 140, 0.3), 0 8px 20px rgba(0, 0, 0, 0.4);
}

/* ================= 15 · FORMS ================= */
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--c-magenta);
  box-shadow: 0 0 0 3px rgba(236, 0, 140, 0.15);
}

/* ================= 16 · SCROLL REVEAL · compositing polish ================= */
.reveal {
  will-change: opacity, transform;
  filter: blur(0);
}
.reveal.is-visible {
  transition-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ================= 17 · SCROLLBAR ================= */
html {
  scrollbar-color: #3a3a3a #0a0a0a; /* Firefox — matches existing geometry */
}
::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--c-magenta) 0%, var(--tt-hot) 100%);
}

/* ================= 18 · 404 (Next.js built-in) · brand the void ============ */
/* Scoped via :has() so it can never touch normal pages.                      */
body:has(.next-error-h1) {
  background: var(--c-black);
  color: var(--c-off-white);
}
body:has(.next-error-h1) h2 { color: var(--c-off-white); }
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .next-error-h1 {
    background-image: var(--tt-grad-wine);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
  }
}

/* ================= 19 · MOBILE (≤768px) · perf-first ======================= */
@media (max-width: 768px) {
  /* No backdrop-filter on small screens — compensate with opacity */
  body::after { opacity: 0.02; }
  .nav,
  .nav.is-scrolled,
  .nav-dropdown-menu,
  .mobile-menu,
  .overview-card-num {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .nav.is-scrolled { background: rgba(10, 10, 10, 0.92); }
  /* Touch devices: skip lift/shadow hover layer */
  .faq-item:hover,
  .step:hover,
  .service-item:hover,
  .contact-block:hover {
    transform: none;
    box-shadow: none;
  }
}

/* ================= 20 · REDUCED MOTION · kill all premium motion =========== */
@media (prefers-reduced-motion: reduce) {
  .section-eyebrow::after { animation: none; }
  .reveal { will-change: auto; }
  #ttProgress { transition: none; }
  .nav::after,
  .division-card::after,
  .overview-card::after,
  .faq-item::before,
  .contact-block::before,
  .step::before,
  .service-item::before,
  .btn-outline::before,
  .btn-primary,
  .btn-outline,
  .btn-ghost,
  .nav-cta,
  .form-submit,
  .social-icon,
  .faq-item,
  .contact-block,
  .step,
  .service-item,
  .work-item,
  .overview-card,
  .overview-card-img,
  .work-img,
  .journey-cta {
    transition: none !important;
    animation: none !important;
  }
  .btn-primary:hover,
  .btn-outline:hover,
  .nav-cta:hover,
  .form-submit:hover,
  .faq-item:hover,
  .step:hover,
  .service-item:hover,
  .contact-block:hover,
  .work-item:hover,
  .overview-card:hover {
    transform: none;
  }
}
