/* Q8DM v2 — interaction styles (loads after q8dm-styles.css) */

/* JS-confirmed animation escape hatch: if entrance animations never advance
   (frozen timelines in some embeds), .no-anim forces final visible state */
html.no-anim .hero-load { animation: none !important; opacity: 1 !important; transform: none !important; }
html.no-anim .fx-reveal { transition: none !important; opacity: 1 !important; transform: none !important; }

/* brand lockup (tower-8 mark) */
.brand-text { display: flex; flex-direction: column; gap: 2px; }
.brand-text .nav-name { display: flex; align-items: center; line-height: 1; }
.brand-cursor {
  display: inline-block; width: 7px; height: 14px;
  background: var(--accent);
  margin-inline-start: 5px;
}
@media (prefers-reduced-motion: no-preference) {
  .brand-cursor { animation: caretBlink 1.1s steps(1) infinite; }
}
.brand-tag {
  font-family: var(--font-mono); font-size: 9.5px;
  letter-spacing: 0.13em; color: var(--muted);
  white-space: nowrap;
}

/* scroll progress */
.fx-progress {
  position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: var(--accent);
  transform-origin: left;
  transform: scaleX(0);
}
html[dir="rtl"] .fx-progress { transform-origin: right; }

/* nav active link */
.nav-links a { position: relative; padding-bottom: 3px; }
.nav-links a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 2px;
  background: var(--accent); border-radius: 2px;
  transform: scaleX(0); transition: transform 0.2s;
}
.nav-links a.nav-active { color: var(--text); }
.nav-links a.nav-active::after { transform: scaleX(1); }

/* hero load stagger + mouse glow */
@media (prefers-reduced-motion: no-preference) {
  .hero-load {
    opacity: 0; transform: translateY(18px);
    animation: heroIn 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
    animation-delay: var(--d, 0ms);
  }
  @keyframes heroIn { to { opacity: 1; transform: none; } }
}
.hero-v2 { position: relative; overflow: hidden; }
.hero-grid-glow {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(320px 320px at var(--hx, 70%) var(--hy, 30%),
    color-mix(in oklab, var(--accent) 10%, transparent), transparent 70%);
}
.hero-inner, .hero-stats { position: relative; }

/* typewriter line */
.hero-typeline {
  display: flex; gap: 10px; align-items: baseline;
  margin-top: 22px;
  font-family: var(--font-mono);
  font-size: clamp(15px, 1.6vw, 18px);
  min-height: 1.6em;
}
.type-prefix { color: var(--muted); }
.fx-type { color: var(--accent); font-weight: 500; }
.fx-caret {
  display: inline-block; width: 9px; height: 1.1em;
  background: var(--accent);
  margin-inline-start: 3px;
  vertical-align: text-bottom;
  animation: caretBlink 1s steps(1) infinite;
}
@keyframes caretBlink { 50% { opacity: 0; } }

/* scroll reveal */
@media (prefers-reduced-motion: no-preference) {
  .fx-reveal {
    opacity: 0; transform: translateY(26px);
    transition: opacity 0.7s cubic-bezier(0.2, 0.7, 0.2, 1),
                transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
  }
  .fx-reveal.fx-in { opacity: 1; transform: none; }
}

/* spotlight cards */
.fx-spot { position: relative; overflow: hidden; }
.fx-spot-glow {
  position: absolute; inset: 0; pointer-events: none;
  opacity: 0; transition: opacity 0.25s;
  background: radial-gradient(220px 220px at var(--mx, 50%) var(--my, 50%),
    color-mix(in oklab, var(--accent) 12%, transparent), transparent 70%);
}
.fx-spot:hover .fx-spot-glow { opacity: 1; }
.fx-spot > *:not(.fx-spot-glow) { position: relative; }

/* tilt tiles */
.fx-tilt {
  transition: transform 0.18s ease-out, box-shadow 0.18s;
  will-change: transform;
}
.fx-tilt:hover { box-shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.5); }

/* magnetic */
.fx-magnet { display: inline-block; transition: transform 0.18s ease-out; }

/* kuwait towers (code glyph canvas) */
.hero-inner-v2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: clamp(24px, 4vw, 72px);
  align-items: center;
}
.towers-wrap {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  justify-self: end;
}
.towers-canvas {
  display: block;
  width: min(440px, 36vw);
  height: auto;
  cursor: crosshair;
}
.towers-cap {
  font-family: var(--font-mono); font-size: 12px;
  color: var(--muted);
  direction: ltr;
}
html[lang="ar"] .towers-cap { direction: rtl; font-family: var(--font-ar); }
@media (max-width: 860px) {
  .hero-inner-v2 { grid-template-columns: 1fr; }
  .towers-wrap { display: none; }
}

/* multi-step form */
.form-steps { gap: 24px; }
.form-progress {
  display: flex; gap: 6px;
}
.fp-item {
  flex: 1;
  display: flex; align-items: center; gap: 8px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--lineSoft);
  color: var(--muted); font-size: 13px;
  transition: border-color 0.25s, color 0.25s;
}
.fp-item.fp-active, .fp-item.fp-done { border-color: var(--accent); color: var(--text); }
.fp-dot {
  width: 22px; height: 22px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  font-family: var(--font-mono); font-size: 11.5px;
  border: 1px solid var(--line); color: var(--muted);
  transition: background 0.25s, color 0.25s, border-color 0.25s;
}
.fp-active .fp-dot { background: var(--accent); color: var(--onAccent); border-color: var(--accent); }
.fp-done .fp-dot { color: var(--accent); border-color: var(--accent); }

.step-pane { display: flex; flex-direction: column; gap: 18px; }
@media (prefers-reduced-motion: no-preference) {
  .step-pane { animation: paneIn 0.35s cubic-bezier(0.2, 0.7, 0.2, 1); }
  @keyframes paneIn { from { opacity: 0; transform: translateY(10px); } }
}

.chip-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.chip {
  font-family: inherit; font-size: 14px; font-weight: 500;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 13px 12px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}
.chip:hover { border-color: color-mix(in oklab, var(--accent) 55%, transparent); }
.chip:active { transform: scale(0.98); }
.chip-on {
  border-color: var(--accent);
  background: color-mix(in oklab, var(--accent) 14%, var(--bg));
  color: var(--text);
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

.step-actions { display: flex; gap: 12px; }
.step-actions .btn-primary { flex: 1; }

.success-summary {
  margin-top: 10px;
  font-size: 14px; color: var(--muted);
  border: 1px dashed color-mix(in oklab, var(--accent) 45%, transparent);
  border-radius: 10px; padding: 12px 18px;
}
.success-summary strong { color: var(--text); }

/* contact email direct link */
.contact-email {
  display: inline-flex; flex-direction: column; gap: 3px;
  margin-top: 26px;
  padding: 14px 20px;
  border: 1px solid var(--line); border-radius: 12px;
  transition: border-color 0.15s, transform 0.15s;
}
.contact-email:hover { border-color: var(--accent); transform: translateY(-1px); }
.contact-email-label { font-size: 12.5px; color: var(--muted); }
.contact-email-addr {
  font-family: var(--font-mono); font-size: 17px; font-weight: 500; color: var(--accent);
}

/* honeypot — hidden from humans */
.hp-field { position: absolute; left: -9999px; opacity: 0; height: 0; overflow: hidden; }

.form-error {
  font-size: 13.5px; color: #ff8a8a;
  background: color-mix(in oklab, #ff5a5a 12%, transparent);
  border: 1px solid color-mix(in oklab, #ff5a5a 40%, transparent);
  border-radius: 9px; padding: 10px 14px;
}

@media (max-width: 520px) {
  .chip-grid { grid-template-columns: 1fr; }
  .fp-label { display: none; }
}
