/**
 * XEYROX Homepage - Hero Section Styles
 * Phase 03: One business. Connected.
 */

/* ==========================================================================
   1. Section Container & Background Atmosphere
   ========================================================================== */
.hero-section {
  position: relative;
  overflow: hidden;
  background-color: var(--x-white);
  padding-top: var(--space-7);
  padding-bottom: var(--space-10);
  min-height: calc(100vh - var(--header-height));
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

/* Atmospheric Background Layer */
.hero-background {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.hero-bg-graphic {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 1920px;
  height: 100%;
  min-height: 900px;
  background-image: url('/storage/images/hero/hero-background.webp');
  background-repeat: no-repeat;
  background-position: top center;
  background-size: cover;
  opacity: 0.95;
}

/* Base Container */
.hero-container {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ==========================================================================
   2. Hero Upper Content (Eyebrow, Headline, Paragraph, CTAs)
   ========================================================================== */
.hero-content {
  text-align: center;
  max-width: 820px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Eyebrow */
.hero-eyebrow {
  font-family: var(--font-primary);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--x-blue-700);
  margin-bottom: var(--space-2);
  line-height: 1.2;
}

/* Headline */
.hero-headline {
  font-family: var(--font-primary);
  font-size: clamp(38px, 5.2vw, 64px);
  font-weight: 800;
  line-height: 1.04;
  letter-spacing: -0.028em;
  color: var(--x-navy-900);
  margin: 0 0 var(--space-3) 0;
}

.hero-headline .hero-highlight {
  color: var(--x-blue-700);
  font-weight: 800;
}

/* Paragraph */
.hero-paragraph {
  font-family: var(--font-primary);
  font-size: clamp(16px, 1.35vw, 18px);
  font-weight: 400;
  line-height: 1.55;
  color: var(--x-text-secondary);
  max-width: 620px;
  margin: 0 auto var(--space-4) auto;
}

/* CTA Button Group */
.hero-cta-group {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-bottom: 0;
}

/* Primary CTA Button: Explore XEYROX */
.btn-hero-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 50px;
  padding: 0 26px;
  background: linear-gradient(105deg, #155EEF 0%, #1769FF 45%, #19C88B 100%);
  color: var(--x-white);
  font-family: var(--font-primary);
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--radius-pill);
  border: none;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(21, 94, 239, 0.25);
  transition: transform 220ms ease, box-shadow 220ms ease, filter 220ms ease;
}

.btn-hero-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(21, 94, 239, 0.35);
  filter: brightness(1.04);
  text-decoration: none;
}

.btn-hero-primary .btn-arrow {
  display: inline-block;
  font-size: 17px;
  line-height: 1;
  transition: transform 220ms ease;
}

.btn-hero-primary:hover .btn-arrow {
  transform: translateX(4px);
}

.btn-hero-primary:focus-visible {
  outline: 2px solid var(--x-blue-700);
  outline-offset: 3px;
}

/* Secondary CTA Button: See how it works */
.btn-hero-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 50px;
  padding: 0 24px;
  background: var(--x-white);
  color: var(--x-navy-900);
  border: 1px solid #B8C8DF;
  font-family: var(--font-primary);
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--radius-pill);
  cursor: pointer;
  text-decoration: none;
  transition: border-color 220ms ease, color 220ms ease, box-shadow 220ms ease, transform 220ms ease;
}

.btn-hero-secondary:hover {
  border-color: var(--x-navy-900);
  color: var(--x-navy-950);
  transform: translateY(-1px);
  box-shadow: var(--shadow-card);
  text-decoration: none;
}

.btn-hero-secondary .btn-arrow {
  display: inline-block;
  font-size: 17px;
  line-height: 1;
  transition: transform 220ms ease;
}

.btn-hero-secondary:hover .btn-arrow {
  transform: translateX(4px);
}

.btn-hero-secondary:focus-visible {
  outline: 2px solid var(--x-navy-900);
  outline-offset: 3px;
}

/* ==========================================================================
   3. Lower Hero: Handwritten Annotation & Product Interface Layout
   ========================================================================== */
.hero-lower {
  position: relative;
  width: 100%;
  max-width: 1020px;
  margin-top: 56px;
  margin-inline: auto;
}

/* Handwritten Annotation */
.hero-annotation {
  position: absolute;
  top: -46px;
  left: -130px;
  z-index: 5;
  /* above showcase and REX hand */
  pointer-events: none;
  user-select: none;
}

.hero-annotation-img {
  width: 140px;
  height: auto;
  display: block;
  filter: drop-shadow(0 2px 4px rgba(11, 23, 51, 0.05));
}

/* ==========================================================================
   4. Outer Browser/Application Interface Frame
   ========================================================================== */
.hero-interface-frame {
  position: relative;
  width: 100%;
  background: var(--x-white);
  border: 1px solid rgba(220, 230, 242, 0.95);
  border-radius: 18px;
  box-shadow: 0 24px 60px -10px rgba(11, 23, 51, 0.12),
    0 12px 24px -6px rgba(11, 23, 51, 0.06);
  overflow: hidden;
  transition: box-shadow 300ms ease;
  /* Showcase must sit above REX body (z:2) but below foreground hand (z:4) */
  z-index: 3;
}

/* Top Browser Bar */
.interface-top-bar {
  background: linear-gradient(110deg, #1E558B 0%, #226798 45%, #2F889E 100%);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Window Control Dots */
.interface-window-dots {
  display: flex;
  align-items: center;
  gap: 6px;
}

.interface-window-dots .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.85);
  display: inline-block;
}

/* Address Bar */
.interface-address-bar {
  flex: 1;
  max-width: 640px;
  background: var(--x-white);
  border-radius: var(--radius-pill);
  padding: 6px 16px;
  display: flex;
  align-items: center;
}

.interface-address-bar .address-text {
  font-family: var(--font-primary);
  font-size: 13px;
  color: var(--x-text-muted);
  line-height: 1.2;
}

/* ==========================================================================
   5. Workspace Interior & Controls
   ========================================================================== */
.interface-workspace {
  background: var(--x-white);
  padding: 38px 44px 44px 44px;
}

/* Workspace Header Row */
.workspace-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 30px;
}

.workspace-heading-group {
  flex: 1;
}

.workspace-heading {
  font-family: var(--font-primary);
  font-size: clamp(26px, 2.8vw, 32px);
  font-weight: 700;
  line-height: 1.15;
  color: var(--x-blue-700);
  margin: 0 0 6px 0;
  letter-spacing: -0.02em;
}

.workspace-subtext {
  font-family: var(--font-primary);
  font-size: 14px;
  font-weight: 400;
  color: var(--x-text-secondary);
  line-height: 1.4;
  margin: 0;
}

/* Top Right Action Button: EXPLORE XEYROX AGENTS */
.workspace-action-group {
  flex-shrink: 0;
  position: relative;
  z-index: 4;
  /* Always above REX mascot */
}

.btn-workspace-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--x-navy-900);
  color: var(--x-white);
  font-family: var(--font-primary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  text-decoration: none;
  line-height: 1;
  transition: background-color 200ms ease, transform 200ms ease;
}

.btn-workspace-action:hover {
  background: var(--x-blue-700);
  transform: translateY(-1px);
  text-decoration: none;
}

.btn-workspace-action .action-arrow {
  display: inline-block;
  font-size: 13px;
  transition: transform 200ms ease;
}

.btn-workspace-action:hover .action-arrow {
  transform: translateX(3px);
}

.btn-workspace-action:focus-visible {
  outline: 2px solid var(--x-blue-700);
  outline-offset: 2px;
}

/* Workspace Section Bar (Featured Apps & Explore All Products) */
.workspace-section-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid #EDF2F7;
}

.featured-apps-label {
  font-family: var(--font-primary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--x-text-muted);
}

.explore-all-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-primary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--x-blue-700);
  text-decoration: none;
  transition: color 200ms ease;
}

.explore-all-link:hover {
  color: var(--x-blue-600);
  text-decoration: none;
}

.explore-all-link .link-arrow {
  display: inline-block;
  font-size: 13px;
  transition: transform 200ms ease;
}

.explore-all-link:hover .link-arrow {
  transform: translateX(3px);
}

.explore-all-link:focus-visible {
  outline: 2px solid var(--x-blue-700);
  outline-offset: 2px;
}

/* ==========================================================================
   6. Real Product Cards Grid (3 cols x 2 rows)
   ========================================================================== */
.workspace-product-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 16px;
}

.workspace-product-grid>.interface-product-card:nth-child(-n+3) {
  grid-column: span 2;
}

.workspace-product-grid>.interface-product-card:nth-child(4),
.workspace-product-grid>.interface-product-card:nth-child(5) {
  grid-column: span 3;
}

.interface-product-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: var(--x-white);
  border: 1px solid var(--x-border);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: transform 220ms ease, border-color 220ms ease, box-shadow 220ms ease;
  min-height: 72px;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.interface-product-card:hover {
  transform: translateY(-2px);
  border-color: #B8C8DF;
  box-shadow: 0 8px 22px rgba(11, 23, 51, 0.07);
  text-decoration: none;
}

.interface-product-card:focus-visible {
  outline: 2px solid var(--x-blue-700);
  outline-offset: 2px;
  border-color: var(--x-blue-700);
}

/* Icon Container */
.product-card-icon-box {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.product-card-icon {
  width: 32px;
  height: 32px;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

/* Card Details */
.product-card-details {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  overflow: hidden;
}

.product-card-name {
  font-family: var(--font-primary);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--x-navy-900);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 200ms ease;
}

.interface-product-card:hover .product-card-name {
  color: var(--x-blue-700);
}

.product-card-category {
  font-family: var(--font-primary);
  font-size: 12.5px;
  font-weight: 400;
  line-height: 1.35;
  color: var(--x-text-secondary);
  margin: 2px 0 0 0;
  white-space: normal;
  word-break: break-word;
}

/* ==========================================================================
   7. Responsive Design
   ========================================================================== */
@media (max-width: 1280px) {
  .hero-annotation {
    left: -80px;
  }
}

@media (max-width: 1140px) {
  .hero-annotation {
    left: -30px;
    top: -55px;
    transform: scale(0.85);
    transform-origin: top left;
  }
}

@media (max-width: 1024px) {
  .hero-lower {
    margin-top: 44px;
  }

  .hero-annotation {
    display: none;
  }

  .interface-workspace {
    padding: 30px 28px 32px 28px;
  }

  .workspace-product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workspace-product-grid>.interface-product-card {
    grid-column: auto !important;
  }
}

@media (max-width: 768px) {
  .hero-section {
    padding-top: var(--space-5);
    padding-bottom: var(--space-8);
  }

  .hero-headline {
    font-size: 38px;
    line-height: 1.08;
  }

  .hero-paragraph {
    font-size: 16px;
    margin-bottom: var(--space-3);
  }

  .hero-cta-group {
    flex-direction: column;
    width: 100%;
    max-width: 320px;
  }

  .btn-hero-primary,
  .btn-hero-secondary {
    width: 100%;
  }

  .hero-lower {
    margin-top: 36px;
  }

  .interface-workspace {
    padding: 24px 18px 24px 18px;
  }

  .workspace-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 22px;
  }

  .workspace-heading {
    font-size: 24px;
  }

  .workspace-section-bar {
    flex-direction: row;
    gap: 12px;
  }

  .workspace-product-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .interface-product-card {
    padding: 14px 16px;
  }

  .product-card-category {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    word-break: break-word;
  }
}

@media (max-width: 480px) {
  .interface-address-bar {
    display: none;
  }

  .workspace-section-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
}

/* ==========================================================================
   8. REX Mascot & Energy Trail
   ========================================================================== */

/*
 * Layer order within .hero-lower (position: relative):
 *   z-index: 1  → .rex-energy-trail    (trail, behind everything)
 *   z-index: 2  → .rex-character       (REX body, behind showcase)
 *   z-index: 3  → .hero-interface-frame (showcase, occludes legs/feet)
 *   z-index: 4  → .rex-hand-fg         (left arm/hand only, in front of showcase top bar)
 *   z-index: 5  → .hero-annotation     (handwritten note, always on top)
 *
 * REX is positioned so his feet/legs sit INSIDE the showcase area (hidden by
 * the frame), and head+torso are visible above the top browser bar.
 */

/* ── Wrapper: anchored to upper-right of .hero-lower ── */
.rex-mascot-wrapper {
  position: absolute;
  /*
   * The showcase (.hero-interface-frame) starts at top:0 of .hero-lower.
   * Its browser bar height is ~44px.
   * REX image is square; the character occupies roughly 85% of image height
   * with ~7.5% transparent padding at top and ~7.5% at bottom.
   *
   * To hide legs behind the browser bar top edge:
   * We want REX's lower body to start at or below top:0 of .hero-lower.
   * At width:400px the character height in image ≈ 340px (85% of 400).
   * We want the head to appear ~200px above the showcase top (matching reference).
   * So: wrapper top = -(200px + transparent top padding ~30px) = -230px
   *
   * right: -30px lets the character slightly bleed off the right edge,
   * matching the reference where REX's right arm/fin extends beyond the frame.
   */
  top: -165px;
  right: -30px;
  width: 400px;
  height: 400px;
  /* Behind showcase by default; hand foreground sits above it */
  z-index: 2;
  pointer-events: none;
  user-select: none;
}

/* ── Energy Trail (behind REX, behind showcase) ── */
.rex-energy-trail {
  position: absolute;
  /*
   * Trail image is wide landscape. In the reference it sweeps to the far right,
   * extending well beyond the showcase right edge, and does NOT enter the
   * interface text area.
   * Width ~520px puts the trail bulk outside the showcase.
   * Positioned right: -120px pushes the trail rightward off-canvas.
   * bottom: -60px aligns the swirl centre around REX's feet area.
   */
  width: 520px;
  height: auto;
  bottom: -60px;
  right: -120px;
  z-index: 1;
  opacity: 0.85;
  mix-blend-mode: screen;
}

/* ── REX Character: background body layer (behind showcase) ── */
.rex-character {
  position: absolute;
  width: 100%;
  height: auto;
  bottom: 0;
  right: 0;
  left: 0;
  z-index: 2;
  filter: drop-shadow(0 20px 40px rgba(21, 94, 239, 0.18)) drop-shadow(0 4px 10px rgba(11, 23, 51, 0.10));
}

/* ── Foreground Hand Wrapper: in front of showcase (z-index: 4) ── */
.rex-hand-wrapper {
  z-index: 4;
}

/* ── REX Hand: foreground layer (in front of showcase top bar) ── */
/*
 * Same image, same position/size as .rex-character.
 * clip-path reveals ONLY the pointing hand of REX, including its pointing finger
 * and the minimum wrist needed for a natural connection to the arm behind the showcase.
 * Tightly fitted around the hand silhouette so the rest of the arm, torso, and legs
 * remain behind the showcase.
 */
.rex-hand-fg {
  filter: drop-shadow(0 4px 10px rgba(11, 23, 51, 0.10));
  clip-path: polygon(15.5% 37%,
      19% 36.3%,
      21.5% 37.8%,
      23.5% 39.2%,
      24.8% 41.2%,
      24.2% 43.5%,
      22.5% 45%,
      21.3% 46.2%,
      21.6% 49%,
      20.5% 51%,
      18.5% 52%,
      18% 54.5%,
      14.5% 54.5%,
      13.5% 52.5%,
      11% 50%,
      10% 47.5%,
      11.5% 45.5%,
      12.5% 42.5%,
      13.8% 39.5%);
}

/* ── Entrance Animations ── */
@keyframes rex-enter {
  from {
    opacity: 0;
    transform: translateX(56px) scale(0.90);
  }

  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes rex-trail-enter {
  from {
    opacity: 0;
    transform: scale(0.85) rotate(-8deg);
  }

  to {
    opacity: 0.85;
    transform: scale(1) rotate(0deg);
  }
}

/*
 * Idle float applies to the WRAPPER so both body and hand foreground
 * move together — the mask never separates from the body.
 */
@keyframes rex-float {

  0%,
  100% {
    transform: translateY(0px);
  }

  40% {
    transform: translateY(-9px);
  }

  70% {
    transform: translateY(-4px);
  }
}

/* Apply animations when hero is loaded */
.hero-section.is-loaded .rex-energy-trail {
  animation: rex-trail-enter 1000ms cubic-bezier(0.16, 1, 0.3, 1) 350ms both;
}

.hero-section.is-loaded .rex-character {
  animation: rex-enter 750ms cubic-bezier(0.16, 1, 0.3, 1) 180ms both;
}

/* Hand enters with same timing as body so they stay in sync */
.hero-section.is-loaded .rex-hand-fg {
  animation: rex-enter 750ms cubic-bezier(0.16, 1, 0.3, 1) 180ms both;
}

/* Idle float on the wrapper after both entry animations finish (~950ms total) */
.hero-section.is-loaded .rex-mascot-wrapper {
  animation: rex-float 5.5s ease-in-out 980ms infinite;
}

/* Initial visible state */
.rex-character,
.rex-energy-trail {
  opacity: 1;
}

/* ── REX Responsive Breakpoints ── */

/* Large desktop: 1280px — everything at full scale, ref calibrated at 1440px */
@media (max-width: 1280px) {
  .rex-mascot-wrapper {
    width: 360px;
    height: 360px;
    top: -148px;
    right: -20px;
  }

  .rex-energy-trail {
    width: 460px;
    bottom: -50px;
    right: -100px;
  }
}

/* Standard desktop / large tablet: 1024px */
@media (max-width: 1024px) {
  .rex-mascot-wrapper {
    width: 280px;
    height: 280px;
    top: -112px;
    right: -10px;
  }

  .rex-energy-trail {
    width: 360px;
    bottom: -40px;
    right: -80px;
  }
}

/* Small tablet: 860px — reduce further, keep inside bounds */
@media (max-width: 860px) {
  .rex-mascot-wrapper {
    width: 220px;
    height: 220px;
    top: -88px;
    right: 0px;
  }

  .rex-energy-trail {
    width: 280px;
    bottom: -30px;
    right: -60px;
  }
}

/* Mobile: 768px — small, keep visible above showcase */
@media (max-width: 768px) {
  .rex-mascot-wrapper {
    width: 160px;
    height: 160px;
    top: -64px;
    right: 4px;
  }

  .rex-energy-trail {
    width: 210px;
    bottom: -22px;
    right: -44px;
    opacity: 0.65;
  }

  /* Hand clip is same polygon, scales naturally with element */
}

/* Small mobile: 480px */
@media (max-width: 480px) {
  .rex-mascot-wrapper {
    width: 128px;
    height: 128px;
    top: -51px;
    right: 4px;
  }

  .rex-energy-trail {
    width: 168px;
    bottom: -18px;
    right: -36px;
    opacity: 0.50;
  }
}

/* ==========================================================================
   9. Motion & Reduced Motion Support
   ========================================================================== */
.hero-content,
.hero-interface-frame,
.hero-annotation {
  opacity: 1;
  transform: none;
  transition: opacity 600ms cubic-bezier(0.16, 1, 0.3, 1),
    transform 600ms cubic-bezier(0.16, 1, 0.3, 1);
}

.hero-section.is-loaded .hero-content {
  opacity: 1;
  transform: translateY(0);
}

.hero-section.is-loaded .hero-annotation {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 150ms;
}

.hero-section.is-loaded .hero-interface-frame {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 200ms;
}

@media (prefers-reduced-motion: reduce) {

  .hero-content,
  .hero-interface-frame,
  .hero-annotation {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  /* REX: show immediately without animation */
  .rex-character,
  .rex-energy-trail,
  .rex-hand-fg,
  .rex-mascot-wrapper {
    opacity: 1 !important;
    animation: none !important;
    transform: none !important;
  }

  .rex-energy-trail {
    opacity: 0.85 !important;
  }

  .btn-hero-primary,
  .btn-hero-secondary,
  .btn-workspace-action,
  .interface-product-card,
  .btn-arrow,
  .action-arrow,
  .link-arrow {
    transition: none !important;
    transform: none !important;
  }
}