/* =========================================================
   HAEGL HERO SECTION — 3D Particle Sculpture & 3D Depth Flip
   Extracted into dedicated static stylesheet
   ========================================================= */

/* ---------------------------------------------------------
   Hero Section Container & Layout
   --------------------------------------------------------- */
.haegl-hero {
  --hero-red: #d4002a;
  position: relative;
  width: 100%;
  min-height: calc(100vh - var(--header-height, 80px) + 20mm);
  min-height: calc(100dvh - var(--header-height, 80px) + 20mm);
  min-height: max(740px, calc(100vh - var(--header-height, 80px) + 20mm));
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(var(--header-height, 80px) + 3vh) 5vw calc(4vh + 12mm);
  background: radial-gradient(ellipse 55% 75% at 72% 54%, #a80020 0%, #5c0716 42%, #12030a 85%);
  user-select: none;
  -webkit-user-select: none;
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  color: #fff;
  box-sizing: border-box;
}

/* Background 3D WebGL Canvas */
.haegl-hero canvas.hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: default;
  touch-action: pan-y;
  z-index: 1;
}

/* ---------------------------------------------------------
   Left Column: Content & 3D Depth Flip Typography
   --------------------------------------------------------- */
.haegl-hero .hero-content-col {
  position: relative;
  z-index: 4;
  width: 100%;
  max-width: 620px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  pointer-events: none;
}

.haegl-hero .hero-content-col * {
  pointer-events: auto;
}

/* Studio Badge */
.haegl-hero .hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  padding: 7px 16px;
  border-radius: 999px;
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.16) 0%, rgba(255, 255, 255, 0.06) 100%);
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.haegl-hero .hero-badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ff4d6d;
  box-shadow: 0 0 10px #ff4d6d;
  animation: badgePulse 2s infinite ease-in-out;
}

@keyframes badgePulse {
  0%, 100% { transform: scale(1); opacity: 0.9; }
  50% { transform: scale(1.35); opacity: 1; }
}

/* 3D Depth Flip Stage — Fixed Anchor Stage */
.haegl-hero .depth-flip-stage {
  position: relative;
  width: 100%;
  min-height: 185px;
  perspective: 1200px;
  transform-style: preserve-3d;
  display: block;
}

/* Both phrase layers are anchored to the exact same top-left origin */
.haegl-hero .depth-phrase-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
  transform-style: preserve-3d;
  margin: 0;
  padding: 0;
  opacity: 0;
  pointer-events: none;
}

.haegl-hero .depth-phrase-layer.layer-active {
  opacity: 1;
  pointer-events: auto;
}

.haegl-hero .depth-line {
  font-family: "Bricolage Grotesque", system-ui, sans-serif !important;
  font-size: clamp(38px, 5.2vw, 84px) !important;
  font-weight: 800 !important;
  line-height: 0.98 !important;
  letter-spacing: -0.04em !important;
  margin: 0 !important;
  padding: 0 !important;
  color: #ffffff;
  display: block;
  white-space: nowrap;
  overflow: visible;
  transform-style: preserve-3d;
}

.haegl-hero .depth-line.line-highlight {
  color: #ffd3da;
  text-shadow: 0 0 40px rgba(255, 77, 109, 0.35);
}

.haegl-hero .flip-word {
  display: inline-block;
  white-space: nowrap;
  transform-style: preserve-3d;
}

/* Individual 3D Flip Character */
.haegl-hero .flip-char {
  display: inline-block;
  transform-style: preserve-3d;
  backface-visibility: hidden;
  will-change: transform, opacity;
}

.haegl-hero .flip-space {
  display: inline-block;
  width: 0.28em;
}

/* Subtitle */
.haegl-hero .hero-sub {
  font-family: "Bricolage Grotesque", system-ui, sans-serif !important;
  font-size: clamp(16px, 1.45vw, 19px) !important;
  line-height: 1.55 !important;
  opacity: 0.92;
  max-width: 500px;
  margin: 4px 0 10px;
  color: #ffffff;
  font-weight: 400;
}

/* CTA Buttons */
.haegl-hero .hero-cta {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
}

.haegl-hero .btn-hero {
  font-family: "Space Mono", monospace !important;
  font-weight: 700 !important;
  font-size: 14px !important;
  border-radius: 999px !important;
  padding: 13px 28px !important;
  text-decoration: none !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  line-height: 1.2 !important;
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease, background 0.25s ease, color 0.25s ease !important;
  border: 1.5px solid transparent !important;
}

.haegl-hero .btn-hero:hover {
  transform: translateY(-2px) scale(1.02);
}

.haegl-hero .btn-hero-solid {
  background: #ffffff !important;
  color: #d4002a !important;
  border-color: #ffffff !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.haegl-hero .btn-hero-solid:hover {
  background: #ffe9ec !important;
  box-shadow: 0 14px 38px rgba(212, 0, 42, 0.3);
}

.haegl-hero .btn-hero-ghost {
  background: rgba(255, 255, 255, 0.08) !important;
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.35) !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.haegl-hero .btn-hero-ghost:hover {
  background: rgba(255, 255, 255, 0.16) !important;
  border-color: #ffffff !important;
}

/* ---------------------------------------------------------
   Under-the-Dots Creative Floating HUD
   Ultra-sleek, lightweight, non-clumsy minimalist display
   --------------------------------------------------------- */
.haegl-hero .sculpture-hud {
  position: absolute;
  right: 4.5vw;
  bottom: calc(4.5vh + 10px);
  width: min(440px, 34vw);
  max-width: 440px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  z-index: 10;
  pointer-events: auto;
  text-align: center;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Floating Glassmorphic Pill Tag */
.haegl-hero .hud-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 7px 18px;
  border-radius: 999px;
  background: rgba(20, 3, 8, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
  transition: all 0.3s ease;
}

.haegl-hero .hud-pill:hover {
  background: rgba(20, 3, 8, 0.75);
  border-color: rgba(255, 255, 255, 0.35);
  box-shadow: 0 16px 45px rgba(212, 0, 42, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.haegl-hero .hud-icon {
  font-size: 14px;
  line-height: 1;
  color: #ff6685;
  flex-shrink: 0;
}

.haegl-hero .hud-name {
  color: #ffffff;
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: -0.01em;
  flex-shrink: 0;
}

.haegl-hero .hud-dot-sep {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  flex-shrink: 0;
}

.haegl-hero .hud-caption {
  color: #ffd3da;
  font-size: 12px;
  font-weight: 450;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
  opacity: 0.95;
  flex-shrink: 1;
}

/* Minimalist Segment Progress Controls */
.haegl-hero .hud-segments {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  max-width: 380px;
  justify-content: center;
}

.haegl-hero .hud-segment-btn {
  flex: 1;
  height: 26px;
  padding: 0 4px;
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  position: relative;
  user-select: none;
}

.haegl-hero .hud-segment-bar {
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  position: relative;
  overflow: hidden;
  transition: background 0.3s ease;
}

.haegl-hero .hud-segment-btn:hover .hud-segment-bar {
  background: rgba(255, 255, 255, 0.45);
}

.haegl-hero .hud-segment-bar-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  background: linear-gradient(90deg, #ff4d6d, #ffffff);
  border-radius: 999px;
}

.haegl-hero .hud-segment-btn.active .hud-segment-bar {
  background: rgba(255, 255, 255, 0.3);
}

.haegl-hero .hud-segment-btn.active .hud-segment-bar-fill {
  animation: hudFill var(--dur, 4.2s) linear forwards;
}

@keyframes hudFill {
  from { width: 0; }
  to { width: 100%; }
}

.haegl-hero .hud-segment-label {
  font-family: "Space Mono", monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.45);
  transition: color 0.25s ease;
  text-transform: uppercase;
}

.haegl-hero .hud-segment-btn:hover .hud-segment-label {
  color: rgba(255, 255, 255, 0.9);
}

.haegl-hero .hud-segment-btn.active .hud-segment-label {
  color: #ffffff;
  font-weight: 700;
}

/* Desktop: mobile canvas zone is hidden */
.haegl-hero .hero-mobile-canvas-zone {
  display: none;
}

/* ---------------------------------------------------------
   Responsive & Mobile Adaptations — Universal Mobile Fit
   --------------------------------------------------------- */
@media (max-width: 900px) {
  .haegl-hero {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-start !important;
    min-height: auto !important;
    padding-top: calc(var(--header-height, 70px) + var(--intern-banner-height-mb, 36px) + clamp(8px, 1.8vh, 14px)) !important;
    padding-bottom: clamp(20px, 3vh, 32px) !important;
    padding-left: clamp(14px, 4vw, 24px) !important;
    padding-right: clamp(14px, 4vw, 24px) !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    width: 100% !important;
  }

  /* Flatten content col so children can be ordered with the canvas spacer & HUD */
  .haegl-hero .hero-content-col {
    display: contents !important;
  }

  /* 1. TOP: Studio Badge */
  .haegl-hero .hero-badge {
    order: 1 !important;
    margin: 0 auto clamp(6px, 1.4vh, 10px) !important;
    padding: 5px clamp(10px, 3vw, 14px) !important;
    font-size: clamp(10px, 2.7vw, 11.5px) !important;
    letter-spacing: 0.01em !important;
    pointer-events: auto !important;
    max-width: 92% !important;
    box-sizing: border-box !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  /* 2. TOP: "Custom Software. Smarter with AI." */
  .haegl-hero .depth-flip-stage {
    order: 2 !important;
    width: 100% !important;
    min-height: clamp(64px, 15vw, 80px) !important;
    margin: 0 auto clamp(2px, 0.8vh, 6px) !important;
    text-align: center !important;
    pointer-events: auto !important;
  }

  .haegl-hero .depth-phrase-layer {
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    width: 100% !important;
  }

  .haegl-hero .depth-line {
    font-size: clamp(23px, 6.8vw, 35px) !important;
    line-height: 1.06 !important;
    letter-spacing: -0.035em !important;
    white-space: normal !important;
    text-align: center !important;
    margin: 0 !important;
  }

  /* 3. MIDDLE: 3D Particle Sculpture Visual Zone */
  .haegl-hero .hero-mobile-canvas-zone {
    display: block !important;
    width: 100% !important;
    height: clamp(165px, 24vh, 205px) !important;
    flex: 0 0 clamp(165px, 24vh, 205px) !important;
    pointer-events: none !important;
    order: 3 !important;
  }

  /* 4. BELOW PARTICLES: HUD Discipline Pill & Segment Controls */
  .haegl-hero .sculpture-hud {
    order: 4 !important;
    position: relative !important;
    right: auto !important;
    bottom: auto !important;
    width: 100% !important;
    max-width: min(360px, 94vw) !important;
    margin: 0 auto clamp(10px, 2vh, 16px) !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: clamp(6px, 1.2vh, 9px) !important;
    pointer-events: auto !important;
    z-index: 10 !important;
    box-sizing: border-box !important;
  }

  .haegl-hero .hud-pill {
    padding: 6px clamp(10px, 3vw, 15px) !important;
    font-size: clamp(10px, 2.8vw, 11.5px) !important;
    gap: clamp(4px, 1.5vw, 7px) !important;
    max-width: 96% !important;
    box-sizing: border-box !important;
  }

  .haegl-hero .hud-name {
    font-size: clamp(10.5px, 2.8vw, 12px) !important;
    white-space: nowrap !important;
  }

  .haegl-hero .hud-icon {
    font-size: clamp(12px, 3.2vw, 14px) !important;
  }

  .haegl-hero .hud-caption {
    font-size: clamp(9.5px, 2.6vw, 11px) !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .haegl-hero .hud-segments {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    max-width: min(340px, 92vw) !important;
    gap: clamp(3px, 1.2vw, 6px) !important;
    box-sizing: border-box !important;
  }

  .haegl-hero .hud-segment-btn {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    height: 22px !important;
    padding: 0 1px !important;
  }

  .haegl-hero .hud-segment-label {
    font-size: clamp(7.5px, 2.1vw, 8.5px) !important;
    letter-spacing: clamp(0.1px, 0.4vw, 0.4px) !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: clip !important;
    text-align: center !important;
  }

  /* 5. BOTTOM: Description Text */
  .haegl-hero .hero-sub {
    order: 5 !important;
    font-size: clamp(12.5px, 3.4vw, 14px) !important;
    line-height: 1.48 !important;
    max-width: min(360px, 92vw) !important;
    text-align: center !important;
    margin: 0 auto clamp(10px, 2.2vh, 16px) !important;
    opacity: 0.88 !important;
    pointer-events: auto !important;
  }

  /* 6. BOTTOM: CTA Buttons */
  .haegl-hero .hero-cta {
    order: 6 !important;
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    justify-content: center !important;
    align-items: center !important;
    gap: clamp(8px, 2.5vw, 14px) !important;
    margin: 0 auto !important;
    width: 100% !important;
    max-width: min(380px, 94vw) !important;
    pointer-events: auto !important;
  }

  .haegl-hero .btn-hero {
    flex: 0 1 auto !important;
    padding: 10px clamp(12px, 3.8vw, 22px) !important;
    font-size: clamp(11.5px, 3vw, 13px) !important;
    border-radius: 999px !important;
    white-space: nowrap !important;
  }
}

/* Compact adaptation for short mobile screens (e.g. iPhone SE, height <= 720px) */
@media (max-width: 900px) and (max-height: 720px) {
  .haegl-hero {
    padding-top: calc(var(--header-height, 65px) + var(--intern-banner-height-mb, 34px) + 8px) !important;
    padding-bottom: 18px !important;
  }

  .haegl-hero .hero-badge {
    margin-bottom: 4px !important;
    padding: 4px 10px !important;
    font-size: 10px !important;
  }

  .haegl-hero .depth-flip-stage {
    min-height: 60px !important;
    margin-bottom: 2px !important;
  }

  .haegl-hero .depth-line {
    font-size: 23px !important;
  }

  .haegl-hero .hero-mobile-canvas-zone {
    height: 155px !important;
    flex: 0 0 155px !important;
  }

  .haegl-hero .sculpture-hud {
    margin-bottom: 10px !important;
    gap: 6px !important;
  }

  .haegl-hero .hero-sub {
    font-size: 12px !important;
    line-height: 1.4 !important;
    margin-bottom: 12px !important;
    max-width: 320px !important;
  }

  .haegl-hero .btn-hero {
    padding: 8px 16px !important;
    font-size: 11.5px !important;
  }
}

/* Ultra-compact screens (width <= 360px) */
@media (max-width: 360px) {
  .haegl-hero .depth-line {
    font-size: 22px !important;
  }

  .haegl-hero .hero-mobile-canvas-zone {
    height: 155px !important;
    flex: 0 0 155px !important;
  }

  .haegl-hero .hud-segments {
    max-width: 290px !important;
    gap: 2.5px !important;
  }

  .haegl-hero .hud-segment-label {
    font-size: 7px !important;
    letter-spacing: 0.1px !important;
  }

  .haegl-hero .hero-sub {
    font-size: 12px !important;
    max-width: 290px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .haegl-hero * {
    animation: none !important;
    transition: none !important;
  }
}
