/* =========================================================
   CINEMATIC LAYER — motion system for arqwama.com
   Preloader, custom cursor, neural canvas, marquees,
   watermark type, portfolio tilt, magnetic buttons.
   ========================================================= */

:root {
  --cx-accent: #d44729;
  --cx-ink: #0b0b0d;
  --cx-blue: #4285f4;
  --cx-purple: #8b5cf6;
  --cx-cyan: #22d3ee;
}

/* ---------- Preloader ---------- */
#cx-preloader {
  position: fixed;
  inset: 0;
  z-index: 20000;
  background: var(--cx-ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#cx-preloader .cx-preloader-panel {
  position: absolute;
  inset: 0;
  background: radial-gradient(60% 60% at 50% 42%, rgba(212, 71, 41, 0.1), transparent 70%), var(--cx-ink);
}

#cx-preloader .cx-preloader-core {
  position: relative;
  width: 132px;
  height: 132px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#cx-preloader .cx-preloader-pulse {
  position: absolute;
  inset: 18px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(212, 71, 41, 0.4), transparent 70%);
  filter: blur(6px);
  animation: cx-preloader-pulse 2.4s ease-in-out infinite;
}

#cx-preloader .cx-preloader-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

#cx-preloader .cx-ring-ticks {
  fill: none;
  stroke: rgba(255, 255, 255, 0.22);
  stroke-width: 1;
  stroke-dasharray: 1 7;
  transform-origin: 60px 60px;
  animation: cx-ring-spin 12s linear infinite;
}

#cx-preloader .cx-ring-track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 2;
}

#cx-preloader .cx-ring-progress {
  fill: none;
  stroke: var(--cx-accent);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-dasharray: 314.159;
  stroke-dashoffset: 314.159;
  transform: rotate(-90deg);
  transform-origin: 60px 60px;
  filter: drop-shadow(0 0 6px rgba(212, 71, 41, 0.75));
}

#cx-preloader .cx-preloader-mark {
  position: relative;
  width: 40px;
  height: 40px;
  opacity: 0.95;
  filter: brightness(0) invert(1) drop-shadow(0 0 10px rgba(212, 71, 41, 0.45));
  animation: cx-mark-breathe 2.4s ease-in-out infinite;
}

#cx-preloader .cx-preloader-count {
  margin-top: 28px;
  display: flex;
  align-items: baseline;
  font-family: "Playfair Display", Georgia, serif;
  font-style: italic;
  font-weight: 600;
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  line-height: 1;
  background: linear-gradient(90deg, #fff, var(--cx-accent) 130%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-variant-numeric: tabular-nums;
}

#cx-preloader .cx-count-percent {
  font-size: 0.5em;
  margin-left: 3px;
  opacity: 0.7;
}

#cx-preloader .cx-preloader-label {
  margin-top: 14px;
  font-family: Roboto, sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.4);
}

@keyframes cx-preloader-pulse {

  0%,
  100% {
    transform: scale(0.85);
    opacity: 0.5;
  }

  50% {
    transform: scale(1.15);
    opacity: 0.9;
  }
}

@keyframes cx-ring-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes cx-mark-breathe {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.06);
  }
}

body.cx-loading {
  overflow: hidden;
  height: 100vh;
}

/* ---------- Custom cursor (fine pointers only) ---------- */
.cx-cursor-dot,
.cx-cursor-ring {
  position: fixed;
  top: 0;
  left: 0;
  border-radius: 50%;
  pointer-events: none;
  z-index: 19000;
  will-change: transform;
  transform: translate(-50%, -50%);
}

.cx-cursor-dot {
  width: 6px;
  height: 6px;
  background: #fff;
  mix-blend-mode: difference;
}

.cx-cursor-ring {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  mix-blend-mode: difference;
  transition: width 0.25s ease, height 0.25s ease, border-color 0.25s ease, opacity 0.25s ease;
}

.cx-cursor-ring.cx-cursor--hover {
  width: 64px;
  height: 64px;
  border-color: var(--cx-accent);
  background: rgba(212, 71, 41, 0.08);
}

@media (hover: none), (pointer: coarse) {
  .cx-cursor-dot,
  .cx-cursor-ring {
    display: none !important;
  }
}

/* ---------- Neural network canvas (hero) ---------- */
#cx-neural {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.85;
  pointer-events: none;
}

/* ---------- Hero kinetic wrapper ---------- */
.cx-hero-anim {
  will-change: transform, opacity;
}

#ts-hero .ts-background-image {
  will-change: transform;
}

/* ---------- Marquee band ---------- */
.cx-marquee {
  position: relative;
  overflow: hidden;
  background: var(--cx-ink);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 22px 0;
  white-space: nowrap;
}

.cx-marquee .cx-marquee-track {
  display: inline-flex;
  align-items: center;
  animation: cx-marquee-scroll 26s linear infinite;
}

.cx-marquee.cx-marquee--reverse .cx-marquee-track {
  animation-direction: reverse;
}

.cx-marquee .cx-marquee-track span {
  display: inline-flex;
  align-items: center;
  font-size: clamp(1.1rem, 3vw, 2rem);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.85);
  padding: 0 2.2rem;
}

.cx-marquee .cx-marquee-track span i {
  color: var(--cx-accent);
  font-size: 0.5em;
  margin-right: 2.2rem;
  opacity: 0.8;
}

@keyframes cx-marquee-scroll {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}

/* ---------- Watermark giant type ---------- */
.cx-watermark-host {
  position: relative;
  overflow: hidden;
}

.cx-watermark {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-weight: 800;
  font-size: clamp(6rem, 22vw, 20rem);
  line-height: 1;
  letter-spacing: -0.02em;
  color: currentColor;
  opacity: 0.05;
  white-space: nowrap;
  pointer-events: none;
  z-index: 0;
  user-select: none;
}

.cx-watermark-host > .container,
.cx-watermark-host > .ts-title {
  position: relative;
  z-index: 1;
}

/* ---------- AI Edge: colorful animated panel ---------- */
.cx-ai-panel {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.cx-ai-panel::before {
  content: "";
  position: absolute;
  inset: -20%;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(42% 42% at 15% 20%, rgba(66, 133, 244, 0.55), transparent 62%),
    radial-gradient(38% 38% at 85% 22%, rgba(139, 92, 246, 0.5), transparent 62%),
    radial-gradient(48% 48% at 50% 95%, rgba(34, 211, 238, 0.35), transparent 62%),
    radial-gradient(34% 34% at 92% 82%, rgba(212, 71, 41, 0.45), transparent 62%),
    radial-gradient(30% 30% at 10% 85%, rgba(139, 92, 246, 0.3), transparent 60%);
  filter: blur(24px);
  animation: cx-blob-drift 20s ease-in-out infinite alternate;
}

.cx-ai-panel > .container {
  position: relative;
  z-index: 1;
}

.cx-ai-glow {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
  background: radial-gradient(560px circle at var(--mx, 50%) var(--my, 20%), rgba(255, 255, 255, 0.12), transparent 55%);
}

.cx-ai-panel:hover .cx-ai-glow {
  opacity: 1;
}

@keyframes cx-blob-drift {
  0% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(-4%, 3%) scale(1.1);
  }
  100% {
    transform: translate(3%, -4%) scale(1);
  }
}

/* Cursor-tracking glow border on the AI Edge cards */
.cx-glow-card {
  position: relative;
  border-radius: 14px;
  transition: transform 0.35s ease;
}

.cx-glow-card .ts-item-content {
  position: relative;
  z-index: 1;
}

.cx-glow-card::before,
.cx-glow-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.cx-glow-card::before {
  z-index: 0;
  padding: 1px;
  background: radial-gradient(180px circle at var(--cx, 50%) var(--cy, 50%), var(--cx-blue), var(--cx-purple) 45%, transparent 72%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}

.cx-glow-card::after {
  z-index: 0;
  background: radial-gradient(220px circle at var(--cx, 50%) var(--cy, 50%), rgba(66, 133, 244, 0.16), transparent 65%);
}

.cx-glow-card:hover::before,
.cx-glow-card:hover::after {
  opacity: 1;
}

.cx-glow-card:hover {
  transform: translateY(-6px);
}

/* VS Code-style terminal panel */
.cx-code-panel {
  max-width: 560px;
  background: #0d1117;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 25px 60px -20px rgba(0, 0, 0, 0.65);
}

.cx-code-panel-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.cx-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.cx-dot--r {
  background: #ff5f56;
}

.cx-dot--y {
  background: #ffbd2e;
}

.cx-dot--g {
  background: #27c93f;
}

.cx-code-panel-title {
  margin-left: 8px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.45);
  font-family: Roboto, sans-serif;
}

.cx-code-panel-body {
  margin: 0;
  padding: 18px 20px;
  font-size: 13px;
  line-height: 1.75;
  color: #c9d1d9;
  font-family: "Courier New", Courier, monospace;
  white-space: pre;
  overflow-x: auto;
  text-align: left;
}

.cx-tok-fn {
  color: #79c0ff;
}

.cx-tok-key {
  color: #ffa657;
}

.cx-tok-str {
  color: #a5d6ff;
}

.cx-tok-com {
  color: #8b949e;
}

.cx-tok-ok {
  color: #3fb950;
}

.cx-caret {
  display: inline-block;
  width: 7px;
  height: 15px;
  background: var(--cx-accent);
  margin-left: 2px;
  vertical-align: middle;
  animation: cx-caret-blink 1s steps(1) infinite;
}

@keyframes cx-caret-blink {
  50% {
    opacity: 0;
  }
}

@media (max-width: 767px) {
  .cx-code-panel-body {
    font-size: 11.5px;
    padding: 14px 16px;
  }
}

/* ---------- Hero manifesto ---------- */
.cx-manifesto-kicker {
  font-family: Roboto, sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
  margin-bottom: 10px;
}

.cx-manifesto {
  font-size: clamp(2.1rem, 4.6vw, 3.75rem);
  line-height: 1.18;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0;
}

.cx-manifesto-accent {
  display: inline-block;
  font-family: "Playfair Display", Georgia, serif;
  font-style: italic;
  font-weight: 600;
  background: linear-gradient(90deg, #fff, var(--cx-accent) 130%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* The theme's rotating-role bubble measures its box to the active phrase's
   nowrap width via JS, which overflows narrow phones on long translations
   (e.g. "ARQUITECTO Y GERENTE DE LICITACIONES"). Let it wrap on mobile. */
@media (max-width: 575px) {

  #ts-hero .ts-bubble-border,
  #ts-hero .ts-title-rotate {
    max-width: calc(100vw - 40px) !important;
  }

  #ts-hero .ts-title-rotate span {
    white-space: normal !important;
    max-width: calc(100vw - 40px);
    box-sizing: border-box;
  }
}

/* ---------- Field judgment vs. algorithm comparison ---------- */
.cx-compare-label {
  font-family: Roboto, sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 14px;
}

.cx-compare-label--algo {
  color: var(--cx-blue);
}

.cx-compare-label--field {
  color: var(--cx-accent);
}

.cx-compare-arrow {
  color: rgba(255, 255, 255, 0.35);
  font-size: 1.5rem;
}

.cx-compare-arrow span {
  display: block;
  font-family: Roboto, sans-serif;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
  margin-top: 8px;
}

.cx-field-panel {
  max-width: 560px;
  height: 100%;
  background: rgba(212, 71, 41, 0.07);
  border: 1px solid rgba(212, 71, 41, 0.35);
  border-radius: 10px;
  padding: 22px 24px;
  box-shadow: 0 25px 60px -20px rgba(0, 0, 0, 0.5);
}

.cx-field-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.cx-field-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.95rem;
  line-height: 1.55;
  margin-bottom: 16px;
}

.cx-field-list li:last-child {
  margin-bottom: 0;
}

.cx-field-list li i {
  color: var(--cx-accent);
  margin-top: 4px;
  flex-shrink: 0;
}

@media (max-width: 767px) {
  .cx-compare-arrow {
    margin: 10px 0;
  }

  .cx-compare-arrow i {
    display: inline-block;
    transform: rotate(90deg);
  }
}

/* ---------- Blueprint Reveal Lens: full section background ---------- */
/* The lens images become the AI EDGE section's own background (absolute,
   inset:0). All existing text/cards keep sitting in .cx-ai-panel > .container,
   which already has position:relative; z-index:1 (see rule above), so they
   float above the image layer automatically. */
.cx-lens-section {
  cursor: none;
}

.cx-lens-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.cx-lens-base,
.cx-lens-reveal {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
}

.cx-lens-reveal {
  clip-path: circle(0px at 50% 50%);
  filter: grayscale(1) contrast(1.15);
}

.cx-lens-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg,
      rgba(6, 6, 8, 0.88) 0%,
      rgba(6, 6, 8, 0.58) 14%,
      rgba(6, 6, 8, 0.64) 86%,
      rgba(6, 6, 8, 0.9) 100%);
}

.cx-lens-ring {
  position: absolute;
  left: 0;
  top: 0;
  width: 320px;
  height: 320px;
  margin-left: -160px;
  margin-top: -160px;
  border-radius: 50%;
  border: 2px solid var(--cx-accent);
  box-shadow: 0 0 32px rgba(212, 71, 41, 0.55), inset 0 0 28px rgba(212, 71, 41, 0.3);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.cx-lens-section.cx-lens--active .cx-lens-ring {
  opacity: 1;
}

.cx-lens-badge {
  position: absolute;
  top: 24px;
  right: 24px;
  z-index: 2;
  font-family: Roboto, sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--cx-accent);
  background: rgba(10, 10, 12, 0.55);
  border: 1px solid rgba(212, 71, 41, 0.4);
  border-radius: 999px;
  padding: 6px 14px;
  pointer-events: none;
}

@media (max-width: 767px) {
  .cx-lens-ring {
    width: 200px;
    height: 200px;
    margin-left: -100px;
    margin-top: -100px;
  }

  .cx-lens-badge {
    top: 16px;
    right: 16px;
  }
}

/* ---------- About Me portrait: animated brand-gradient ring ---------- */
.cx-portrait-frame {
  position: relative;
  display: inline-block;
  border-radius: 16px;
  will-change: transform;
}

.cx-portrait-frame::before {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 20px;
  background: conic-gradient(from 0deg, var(--cx-accent), var(--cx-purple), var(--cx-blue), var(--cx-cyan), var(--cx-accent));
  filter: blur(1px);
  opacity: 0.9;
  animation: cx-ring-spin 7s linear infinite;
}

.cx-portrait-frame::after {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 20px;
  box-shadow: 0 25px 55px -20px rgba(212, 71, 41, 0.45);
  pointer-events: none;
}

.cx-portrait-frame img {
  position: relative;
  display: block;
  border-radius: 16px;
  z-index: 1;
}

@keyframes cx-ring-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .cx-portrait-frame::before {
    animation: none;
  }
}

/* ---------- Portfolio tilt ---------- */
.ts-gallery__item {
  will-change: transform;
  transform-style: preserve-3d;
  transition: box-shadow 0.35s ease;
}

.ts-gallery__item:hover {
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.55);
  z-index: 2;
}

.ts-gallery__item .card-img {
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.ts-gallery__item:hover .card-img {
  transform: scale(1.08);
}

/* ---------- Magnetic buttons ---------- */
.cx-magnetic {
  display: inline-block;
  will-change: transform;
}

/* ---------- Scroll progress bar ---------- */
#cx-scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: var(--cx-accent);
  z-index: 18000;
}

/* ---------- Odometer punch ---------- */
.ts-promo-number {
  will-change: transform;
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .cx-marquee .cx-marquee-track {
    animation: none;
  }
  #cx-preloader {
    display: none !important;
  }
  .cx-cursor-dot,
  .cx-cursor-ring {
    display: none !important;
  }
  .cx-ai-panel::before {
    animation: none;
  }
  .cx-caret {
    animation: none;
  }
}

@media (max-width: 767px) {
  .cx-watermark {
    display: none;
  }
}

