/* ==========================================================================
   decorations.css — Adornos geométricos, parallax y animaciones scroll
   Motivos minimalistas de arquitectura e ingeniería
   ========================================================================== */

/* ---------- Decorative Grid Pattern (Blueprint) ---------- */
.deco-blueprint {
  position: absolute;
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.deco-blueprint.is-visible {
  opacity: 1;
}

.deco-blueprint--grid {
  width: 200px;
  height: 200px;
  background-image:
    linear-gradient(rgba(75, 187, 201, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(75, 187, 201, 0.06) 1px, transparent 1px);
  background-size: 20px 20px;
}

.deco-blueprint--grid-lg {
  width: 320px;
  height: 320px;
  background-image:
    linear-gradient(rgba(75, 187, 201, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(75, 187, 201, 0.04) 1px, transparent 1px);
  background-size: 32px 32px;
}

/* ---------- Geometric Shapes ---------- */
.deco-shape {
  position: absolute;
  pointer-events: none;
  z-index: 0;
  will-change: transform;
}

/* Thin angle bracket — like an architectural dimension line */
.deco-shape--angle {
  width: 80px;
  height: 80px;
  border-left: 1px solid rgba(75, 187, 201, 0.15);
  border-bottom: 1px solid rgba(75, 187, 201, 0.15);
}

.deco-shape--angle-r {
  width: 80px;
  height: 80px;
  border-right: 1px solid rgba(75, 187, 201, 0.15);
  border-top: 1px solid rgba(75, 187, 201, 0.15);
}

/* Square frame — like a floor plan outline */
.deco-shape--square {
  width: 120px;
  height: 120px;
  border: 1px solid rgba(75, 187, 201, 0.08);
}

.deco-shape--square-sm {
  width: 60px;
  height: 60px;
  border: 1px solid rgba(248, 138, 27, 0.1);
}

.deco-shape--square-dashed {
  width: 100px;
  height: 100px;
  border: 1px dashed rgba(75, 187, 201, 0.08);
  transform: rotate(45deg);
}

/* Circle — like a compass or dimension mark */
.deco-shape--circle {
  width: 160px;
  height: 160px;
  border: 1px solid rgba(75, 187, 201, 0.07);
  border-radius: 50%;
}

.deco-shape--circle-sm {
  width: 8px;
  height: 8px;
  background: rgba(75, 187, 201, 0.2);
  border-radius: 50%;
}

.deco-shape--circle-dot {
  width: 4px;
  height: 4px;
  background: var(--color-orange);
  border-radius: 50%;
  opacity: 0.4;
}

/* Cross marker — like a survey/reference point */
.deco-shape--cross {
  width: 20px;
  height: 20px;
  position: absolute;
}

.deco-shape--cross::before,
.deco-shape--cross::after {
  content: '';
  position: absolute;
  background: rgba(75, 187, 201, 0.15);
}

.deco-shape--cross::before {
  width: 100%;
  height: 1px;
  top: 50%;
}

.deco-shape--cross::after {
  width: 1px;
  height: 100%;
  left: 50%;
}

/* Ruler ticks — like a scale ruler */
.deco-ruler {
  position: absolute;
  pointer-events: none;
  z-index: 0;
  display: flex;
  gap: 12px;
  opacity: 0.12;
}

.deco-ruler--v {
  flex-direction: column;
}

.deco-ruler__tick {
  width: 16px;
  height: 1px;
  background: var(--color-teal);
}

.deco-ruler--v .deco-ruler__tick {
  width: 1px;
  height: 16px;
}

.deco-ruler__tick--long {
  width: 28px;
}

.deco-ruler--v .deco-ruler__tick--long {
  width: 1px;
  height: 28px;
}

/* Diagonal line — like a section cut line */
.deco-shape--line {
  width: 200px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(75, 187, 201, 0.12), transparent);
}

.deco-shape--line-v {
  width: 1px;
  height: 200px;
  background: linear-gradient(180deg, transparent, rgba(75, 187, 201, 0.1), transparent);
}

.deco-shape--line-diag {
  width: 150px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(248, 138, 27, 0.1), transparent);
  transform: rotate(-35deg);
}

/* Triangle — like an arrow/direction indicator */
.deco-shape--triangle {
  width: 0;
  height: 0;
  border-left: 30px solid transparent;
  border-right: 30px solid transparent;
  border-bottom: 40px solid rgba(75, 187, 201, 0.04);
}

/* Protractor arc — engineering tool */
.deco-shape--arc {
  width: 200px;
  height: 100px;
  border: 1px solid rgba(75, 187, 201, 0.06);
  border-bottom: none;
  border-radius: 200px 200px 0 0;
}

/* ---------- SVG Architecture Icons (Floating) ---------- */
.deco-svg {
  position: absolute;
  pointer-events: none;
  z-index: 0;
  opacity: 0.05;
  will-change: transform;
}

.deco-svg--compass {
  width: 120px;
  height: 120px;
}

.deco-svg--protractor {
  width: 100px;
  height: 60px;
}

.deco-svg--ruler {
  width: 140px;
  height: 20px;
}

/* ---------- Parallax Layers ---------- */
[data-parallax] {
  will-change: transform;
  transition: transform 0.1s linear;
}

/* ---------- Interactive Figures ---------- */
.interactive-figures {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
}

.interactive-figures--page {
  z-index: 0;
}

.interactive-figure {
  position: absolute;
  pointer-events: none;
  opacity: 0.5;
  will-change: transform, opacity;
  transform:
    translate3d(var(--figure-shift-x, 0px), var(--figure-shift-y, 0px), 0)
    rotate(var(--figure-rotate, 0deg))
    scale(var(--figure-scale, 1));
  transition: transform 0.18s ease-out, opacity 0.3s ease, filter 0.3s ease;
  filter: drop-shadow(0 0 18px rgba(75, 187, 201, 0.06));
}

.interactive-figure.is-active {
  opacity: 0.75;
}

.interactive-figure--ring {
  width: 180px;
  height: 180px;
  border: 1px solid rgba(75, 187, 201, 0.18);
  border-radius: 50%;
}

.interactive-figure--ring::after {
  content: '';
  position: absolute;
  inset: 18px;
  border: 1px solid rgba(75, 187, 201, 0.08);
  border-radius: 50%;
}

.interactive-figure--diamond {
  width: 84px;
  height: 84px;
  border: 1px solid rgba(248, 138, 27, 0.18);
}

.interactive-figure--crosshair {
  width: 140px;
  height: 140px;
}

.interactive-figure--crosshair::before,
.interactive-figure--crosshair::after {
  content: '';
  position: absolute;
  background: rgba(75, 187, 201, 0.14);
}

.interactive-figure--crosshair::before {
  top: 50%;
  left: 0;
  width: 100%;
  height: 1px;
}

.interactive-figure--crosshair::after {
  left: 50%;
  top: 0;
  width: 1px;
  height: 100%;
}

.interactive-figure--beam {
  width: 220px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(248, 138, 27, 0.45), transparent);
}

.interactive-figure--beam-v {
  width: 1px;
  height: 220px;
  background: linear-gradient(180deg, transparent, rgba(75, 187, 201, 0.3), transparent);
}

.interactive-figure--node {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(248, 138, 27, 0.9) 0%, rgba(248, 138, 27, 0.15) 38%, transparent 70%);
  box-shadow: 0 0 20px rgba(248, 138, 27, 0.22);
}

.interactive-ping {
  position: absolute;
  width: 18px;
  height: 18px;
  margin-left: -9px;
  margin-top: -9px;
  border: 1px solid rgba(75, 187, 201, 0.3);
  border-radius: 50%;
  pointer-events: none;
  animation: interactivePing 0.9s ease-out forwards;
}

.interactive-ping::after {
  content: '';
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: rgba(248, 138, 27, 0.28);
}

/* ---------- Scroll-triggered Motion Classes ---------- */
.slide-up {
  opacity: 1;
  transform: none;
  transition: none;
}

.slide-up.is-visible {
  opacity: 1;
  transform: none;
}

.slide-left {
  opacity: 1;
  transform: none;
  transition: none;
}

.slide-left.is-visible {
  opacity: 1;
  transform: none;
}

.slide-right {
  opacity: 1;
  transform: none;
  transition: none;
}

.slide-right.is-visible {
  opacity: 1;
  transform: none;
}

.scale-in {
  opacity: 1;
  transform: none;
  transition: none;
}

.scale-in.is-visible {
  opacity: 1;
  transform: none;
}

.rotate-in {
  opacity: 1;
  transform: none;
  transition: none;
}

.rotate-in.is-visible {
  opacity: 1;
  transform: none;
}

/* Stagger delays for children */
.stagger > *:nth-child(1) { transition-delay: 0s; }
.stagger > *:nth-child(2) { transition-delay: 0s; }
.stagger > *:nth-child(3) { transition-delay: 0s; }
.stagger > *:nth-child(4) { transition-delay: 0s; }
.stagger > *:nth-child(5) { transition-delay: 0s; }
.stagger > *:nth-child(6) { transition-delay: 0s; }

/* ---------- Hero Enhancements ---------- */
.hero__deco {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

/* Floating geometric shapes in hero */
.hero__geo {
  position: absolute;
  will-change: transform;
  animation: float 8s ease-in-out infinite;
}

.hero__geo--1 {
  top: 15%;
  left: 8%;
  width: 100px;
  height: 100px;
  border: 1px solid rgba(75, 187, 201, 0.15);
  animation-delay: 0s;
  animation-duration: 10s;
}

.hero__geo--2 {
  top: 60%;
  right: 10%;
  width: 60px;
  height: 60px;
  border: 1px solid rgba(248, 138, 27, 0.12);
  transform: rotate(45deg);
  animation-delay: -3s;
  animation-duration: 12s;
}

.hero__geo--3 {
  bottom: 25%;
  left: 15%;
  width: 140px;
  height: 140px;
  border: 1px solid rgba(75, 187, 201, 0.07);
  border-radius: 50%;
  animation-delay: -5s;
  animation-duration: 14s;
}

.hero__geo--4 {
  top: 30%;
  right: 20%;
  width: 80px;
  height: 80px;
  border-left: 1px solid rgba(75, 187, 201, 0.12);
  border-bottom: 1px solid rgba(75, 187, 201, 0.12);
  animation-delay: -2s;
  animation-duration: 9s;
}

.hero__geo--5 {
  bottom: 15%;
  right: 30%;
  width: 6px;
  height: 6px;
  background: var(--color-teal);
  border-radius: 50%;
  opacity: 0.3;
  animation-delay: -1s;
  animation-duration: 6s;
}

.hero__geo--6 {
  top: 45%;
  left: 30%;
  width: 4px;
  height: 4px;
  background: var(--color-orange);
  border-radius: 50%;
  opacity: 0.25;
  animation-delay: -4s;
  animation-duration: 7s;
}

/* Animated compass SVG in hero */
.hero__compass {
  position: absolute;
  top: 18%;
  right: 8%;
  width: 220px;
  height: 220px;
  opacity: 0.04;
  z-index: 1;
  animation: slowRotate 60s linear infinite;
}

/* Blueprint grid in hero corner */
.hero__blueprint {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 300px;
  height: 200px;
  background-image:
    linear-gradient(rgba(75, 187, 201, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(75, 187, 201, 0.05) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: linear-gradient(135deg, rgba(0,0,0,0.4), transparent 70%);
  -webkit-mask-image: linear-gradient(135deg, rgba(0,0,0,0.4), transparent 70%);
  z-index: 1;
}

/* ---------- Section Decorations ---------- */
.section {
  position: relative;
  overflow: hidden;
}

.section:not(.section--navy) {
  background-image:
    radial-gradient(circle at 14% 18%, rgba(75, 187, 201, 0.05) 0, rgba(75, 187, 201, 0.05) 1px, transparent 1px, transparent 100%),
    linear-gradient(135deg, transparent 0 47%, rgba(30, 62, 100, 0.024) 47.5%, transparent 48%, transparent 100%),
    linear-gradient(90deg, rgba(75, 187, 201, 0.03) 1px, transparent 1px),
    linear-gradient(rgba(75, 187, 201, 0.03) 1px, transparent 1px),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='560' height='320' viewBox='0 0 560 320'%3E%3Cg fill='none' stroke='rgba(30,62,100,0.06)' stroke-width='1'%3E%3Ccircle cx='448' cy='92' r='52'/%3E%3Cpath d='M52 248h128'/%3E%3Cpath d='M112 188v120'/%3E%3Cpath d='M350 220l58-58 46 46'/%3E%3C/g%3E%3Cg fill='rgba(30,62,100,0.075)' font-family='Space Mono, monospace' font-size='18'%3E%3Ctext x='62' y='76'%3Ea%5E2 %2B b%5E2 = c%5E2%3C/text%3E%3Ctext x='304' y='68'%3Ef(x) = x%5E2%3C/text%3E%3Ctext x='364' y='240'%3EDelta t %3E= 0%3C/text%3E%3Ctext x='80' y='208'%3Ex %2B y = z%3C/text%3E%3Ctext x='214' y='278'%3Esin(t)%3C/text%3E%3C/g%3E%3C/svg%3E");
  background-repeat: no-repeat, no-repeat, repeat, repeat, repeat;
  background-size: 520px 520px, 420px 420px, 28px 28px, 28px 28px, 560px 320px;
  background-position: -180px -40px, calc(100% + 60px) calc(100% - 120px), 0 0, 0 0, center top;
}

.section--alt {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0.35)),
    radial-gradient(circle at 14% 18%, rgba(75, 187, 201, 0.045) 0, rgba(75, 187, 201, 0.045) 1px, transparent 1px, transparent 100%),
    linear-gradient(135deg, transparent 0 47%, rgba(30, 62, 100, 0.02) 47.5%, transparent 48%, transparent 100%),
    linear-gradient(90deg, rgba(75, 187, 201, 0.028) 1px, transparent 1px),
    linear-gradient(rgba(75, 187, 201, 0.028) 1px, transparent 1px),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='560' height='320' viewBox='0 0 560 320'%3E%3Cg fill='none' stroke='rgba(30,62,100,0.05)' stroke-width='1'%3E%3Ccircle cx='448' cy='92' r='52'/%3E%3Cpath d='M52 248h128'/%3E%3Cpath d='M112 188v120'/%3E%3Cpath d='M350 220l58-58 46 46'/%3E%3C/g%3E%3Cg fill='rgba(30,62,100,0.065)' font-family='Space Mono, monospace' font-size='18'%3E%3Ctext x='62' y='76'%3Ea%5E2 %2B b%5E2 = c%5E2%3C/text%3E%3Ctext x='304' y='68'%3Ef(x) = x%5E2%3C/text%3E%3Ctext x='364' y='240'%3EDelta t %3E= 0%3C/text%3E%3Ctext x='80' y='208'%3Ex %2B y = z%3C/text%3E%3Ctext x='214' y='278'%3Esin(t)%3C/text%3E%3C/g%3E%3C/svg%3E");
  background-repeat: no-repeat, no-repeat, no-repeat, repeat, repeat, repeat;
  background-size: auto, 520px 520px, 420px 420px, 28px 28px, 28px 28px, 560px 320px;
  background-position: 0 0, -180px -40px, calc(100% + 60px) calc(100% - 120px), 0 0, 0 0, center top;
}

/* Decorative corner marks for sections */
.deco-corner {
  position: absolute;
  pointer-events: none;
  z-index: 0;
}

.deco-corner--tl {
  top: var(--space-md);
  left: var(--space-md);
  width: 40px;
  height: 40px;
  border-top: 1px solid rgba(75, 187, 201, 0.12);
  border-left: 1px solid rgba(75, 187, 201, 0.12);
}

.deco-corner--br {
  bottom: var(--space-md);
  right: var(--space-md);
  width: 40px;
  height: 40px;
  border-bottom: 1px solid rgba(75, 187, 201, 0.12);
  border-right: 1px solid rgba(75, 187, 201, 0.12);
}

.deco-corner--tr {
  top: var(--space-md);
  right: var(--space-md);
  width: 30px;
  height: 30px;
  border-top: 1px solid rgba(248, 138, 27, 0.1);
  border-right: 1px solid rgba(248, 138, 27, 0.1);
}

/* ---------- Animated Dotted Trail ---------- */
.deco-dots {
  position: absolute;
  pointer-events: none;
  z-index: 0;
  display: flex;
  gap: 24px;
}

.deco-dots--v {
  flex-direction: column;
}

.deco-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(75, 187, 201, 0.15);
  animation: dotPulse 3s ease-in-out infinite;
}

.deco-dot:nth-child(2) { animation-delay: 0.3s; }
.deco-dot:nth-child(3) { animation-delay: 0.6s; }
.deco-dot:nth-child(4) { animation-delay: 0.9s; }
.deco-dot:nth-child(5) { animation-delay: 1.2s; }
.deco-dot:nth-child(6) { animation-delay: 1.5s; }
.deco-dot:nth-child(7) { animation-delay: 1.8s; }
.deco-dot:nth-child(8) { animation-delay: 2.1s; }

/* ---------- Keyframe Animations ---------- */
@keyframes float {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  25% { transform: translate(8px, -12px) rotate(2deg); }
  50% { transform: translate(-4px, -20px) rotate(-1deg); }
  75% { transform: translate(12px, -8px) rotate(1.5deg); }
}

@keyframes slowRotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes dotPulse {
  0%, 100% { opacity: 0.15; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.5); }
}

@keyframes drawLine {
  from { stroke-dashoffset: 1000; }
  to { stroke-dashoffset: 0; }
}

@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes interactivePing {
  0% {
    opacity: 0.8;
    transform: scale(0.3);
  }
  100% {
    opacity: 0;
    transform: scale(4.2);
  }
}

/* ---------- Stats Section Enhancement ---------- */
.stats {
  overflow: hidden;
}

.stats::after {
  content: '';
  position: absolute;
  bottom: -30%;
  left: -10%;
  width: 400px;
  height: 400px;
  border: 1px solid rgba(75, 187, 201, 0.05);
  border-radius: 50%;
  pointer-events: none;
}

/* ---------- Page Hero Enhancements ---------- */
.page-hero {
  overflow: hidden;
}

.page-hero__deco {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.page-hero__geo {
  position: absolute;
  animation: float 10s ease-in-out infinite;
}

.page-hero__geo--1 {
  top: 20%;
  right: 10%;
  width: 120px;
  height: 120px;
  border: 1px solid rgba(75, 187, 201, 0.1);
  border-radius: 50%;
  animation-delay: -2s;
}

.page-hero__geo--2 {
  bottom: 20%;
  left: 8%;
  width: 60px;
  height: 60px;
  border: 1px solid rgba(248, 138, 27, 0.08);
  transform: rotate(45deg);
  animation-delay: -5s;
}

.page-hero__geo--3 {
  top: 40%;
  left: 20%;
  width: 4px;
  height: 4px;
  background: var(--color-teal);
  border-radius: 50%;
  opacity: 0.3;
  animation-delay: -1s;
  animation-duration: 6s;
}

/* ---------- Responsive: hide heavy decorations on mobile ---------- */
@media (max-width: 767px) {
  .hero__compass,
  .hero__blueprint,
  .deco-blueprint,
  .deco-ruler,
  .deco-corner,
  .deco-shape--arc,
  .deco-shape--circle {
    display: none;
  }

  .hero__geo--1,
  .hero__geo--3,
  .hero__geo--4 {
    display: none;
  }

  .interactive-figure--ring,
  .interactive-figure--beam,
  .interactive-figure--beam-v,
  .interactive-figure--crosshair {
    display: none;
  }

  .page-hero__geo--1 {
    width: 80px;
    height: 80px;
  }

  .section:not(.section--navy),
  .section--alt {
    background-size: 360px 360px, 260px 260px, 24px 24px, 24px 24px, 420px 240px;
    background-position: -160px -20px, calc(100% + 20px) calc(100% - 80px), 0 0, 0 0, center center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .interactive-figure,
  .interactive-ping {
    animation: none;
    transition: none;
  }
}

@media (min-width: 768px) {
  .hero__compass {
    width: 280px;
    height: 280px;
  }

  .hero__blueprint {
    width: 400px;
    height: 280px;
  }
}

@media (min-width: 1280px) {
  .hero__compass {
    width: 350px;
    height: 350px;
    opacity: 0.05;
  }
}
