/* Premium Portfolio Section - Greatic */
.gr-portfolio-section {
  padding: 120px 0 0;
  background: #ffffff;
  color: #0d1117;
  position: relative;
}

.gr-portfolio-container {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 40px;
  position: relative;
  z-index: 2;
}

/* Scroll Word Switcher */
.gr-word-scroller {
  position: relative;
  height: 700vh;
  /* ~100vh per word + breathing room */
}

.gr-word-sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 5;
}

.gr-word-subtitle {
  font-family: "Tasa", sans-serif;
  font-size: clamp(1.2rem, 2.5vw, 1.8rem);
  font-weight: 400;
  color: #71717a;
  margin: 0 0 16px;
  letter-spacing: -0.01em;
}

.gr-word-display {
  position: relative;
  height: clamp(5rem, 12vw, 9rem);
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  /* overflow: hidden; removido para não cortar acentos altos (como do Ê) nem o blur */
}

.gr-word {
  position: absolute;
  font-family: "Instrument Serif", serif;
  font-size: clamp(4rem, 10vw, 8rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  padding: 0.2em 0.15em;
  /* Padding vertical testado para não cortar em cima/baixo */
  white-space: nowrap;
  opacity: 0;
  transform: translateY(100%);
  filter: blur(12px);
  transition:
    opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.6s cubic-bezier(0.22, 1, 0.36, 1),
    filter 0.6s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform, opacity, filter;
  background: linear-gradient(
    90deg,
    #404040 0%,
    #424247 25%,
    #44454b 50%,
    #424247 75%,
    #3d3d3d 100%
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.gr-word.active {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0px);
}

.gr-word.exit-up {
  opacity: 0;
  transform: translateY(-100%);
  filter: blur(12px);
}

/* 3D Spline Block */
.gr-portfolio-hero {
  text-align: center;
  margin-bottom: 0;
  position: relative;
}

/* Spline: transparent, no card, robot floats freely */
.gr-spline-wrapper {
  position: relative;
  width: 100%;
  max-width: 900px;
  height: 500px;
  margin: -40px auto 0;
  overflow: hidden;
  background: transparent;
  z-index: 2;
}

.gr-spline-wrapper.is-mobile-fallback {
  background: transparent;
}

canvas#canvas3d {
  width: 100% !important;
  height: calc(100% + 80px) !important;
  outline: none;
  cursor: grab;
  transform: scale(1.25);
  transform-origin: center 40%;
}

canvas#canvas3d:active {
  cursor: grabbing;
}

/* Neon Video Card - GitHub Style */
.gr-neon-card-container {
  display: flex;
  justify-content: center;
  margin-top: 0px;
  padding: 0 24px 0;
  position: relative;
  z-index: 10;
}

.gr-neon-video-card {
  position: relative;
  width: 100%;
  max-width: 1100px;
  border-radius: 16px;
  background: #161b22;
  border: 1px solid rgba(154, 124, 255, 0.2);
  overflow: hidden;
}

.gr-neon-glow {
  position: absolute;
  inset: -2px;
  border-radius: 16px;
  background: radial-gradient(
    141.53% 114.68% at 87.46% 55.27%,
    #9a7cff 36.75%,
    #0e0aa200 100%
  );
  filter: blur(40px);
  z-index: -1;
  opacity: 0.6;
}

.gr-neon-video-card video {
  width: 100%;
  display: block;
  border-radius: 16px;
  position: relative;
  z-index: 1;
}

/* Zig Zag Clients Showcase */
.gr-clients-list {
  display: flex;
  flex-direction: column;
  gap: 160px;
  padding-top: 120px;
}

.gr-client-card {
  display: flex;
  align-items: stretch;
  gap: 64px;
}

.gr-client-card.reverse {
  flex-direction: row-reverse;
}

.gr-client-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  opacity: 0;
  transform: translateY(40px);
  transition: all 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.gr-client-card.in-view .gr-client-content,
.gr-client-card.in-view .gr-client-media {
  opacity: 1;
  transform: translateY(0);
}

.gr-client-name {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: #18181b;
}

.gr-client-desc {
  font-size: 1.125rem;
  line-height: 1.6;
  color: #a1a1aa;
  margin-bottom: 32px;
}

.gr-client-stats {
  display: flex;
  gap: 32px;
  margin-bottom: 40px;
}

.gr-stat-item {
  display: flex;
  flex-direction: column;
}

.gr-stat-val {
  font-size: 1.75rem;
  font-weight: 700;
  color: #18181b;
  /* Updated to black for visibility on white bg */
}

.gr-stat-label {
  font-size: 0.875rem;
  color: #52525b;
  /* Darkened slightly for better readability */
}

/* Client non-clickable tags styling related to the attachment */
.gr-client-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}

.gr-client-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 18px;
  font-size: 0.95rem;
  font-weight: 400;
  color: #52525b;
  background-color: transparent;
  border: 1px solid #d4d4d8;
  /* light gray outline */
  border-radius: 9999px;
  /* full pill shape */
  user-select: none;
  font-family: inherit;
}

/* Media Column */
.gr-client-media {
  flex: 1.2;
  position: relative;
  border-radius: 24px;
  overflow: hidden;
  opacity: 0;
  transform: translateY(40px);
  transition: all 1.2s cubic-bezier(0.22, 1, 0.36, 1) 0.1s;
  cursor: pointer;
}

.gr-client-video-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: 24px;
  overflow: hidden;
  background: #000;
}

.gr-client-video-wrap video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.gr-client-media:hover .gr-client-video-wrap video {
  transform: scale(1.05);
}

.gr-play-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.4s ease;
}

.gr-client-media:hover .gr-play-overlay {
  background: rgba(0, 0, 0, 0.4);
}

.gr-play-btn {
  width: 72px;
  height: 72px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(10px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  transform: scale(0.9);
}

.gr-client-media:hover .gr-play-btn {
  transform: scale(1);
  background: rgba(255, 255, 255, 0.2);
}

.gr-play-btn svg {
  width: 24px;
  height: 24px;
  fill: #fff;
  margin-left: 4px;
}

/* Lightbox minimalist */
.gr-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.gr-lightbox.active {
  opacity: 1;
  pointer-events: auto;
}

.gr-lightbox-content {
  width: 90%;
  max-width: 1200px;
  aspect-ratio: 16/9;
  position: relative;
  transform: scale(0.95);
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.gr-lightbox.active .gr-lightbox-content {
  transform: scale(1);
}

.gr-lightbox-close {
  position: absolute;
  top: -60px;
  right: 0;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.1);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: background 0.3s ease;
}

.gr-lightbox-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.gr-lightbox video {
  width: 100%;
  height: 100%;
  border-radius: 16px;
  object-fit: contain;
}

@media (max-width: 991px) {
  .gr-client-card,
  .gr-client-card.reverse {
    flex-direction: column;
    gap: 40px;
  }

  .gr-portfolio-section {
    padding: 80px 0;
  }

  .gr-clients-list {
    gap: 100px;
  }

  .gr-spline-wrapper {
    height: 350px;
  }

  .gr-neon-video-card {
    border-radius: 12px;
  }
}

@media (max-width: 767px) {
  .gr-word-scroller {
    height: 350vh;
  }

  .gr-portfolio-main-title {
    font-size: 2.5rem;
  }

  .gr-spline-wrapper {
    height: 250px;
  }

  .gr-client-name {
    font-size: 2rem;
  }

  .gr-portfolio-container {
    padding: 0 8px;
  }

  .gr-neon-card-container {
    padding: 0 8px;
  }
}

/* Pinned Scroll Portfolio Animation */
.gr-scroll-stack-section {
  position: relative;
  width: 100vw;
  left: 50%;
  transform: translateX(-50%);
  background: #ffffff;
  /* Massive height to ensure long scroll duration for all GSAP stages (many images) */
  height: 800vh;
}

.gr-scroll-stack-sticky {
  position: sticky;
  top: 0;
  width: 100%;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 10vh;
  /* space for title */
}

/* Base Desktop Header Position */
.gr-stack-header {
  position: absolute;
  top: 10%;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  z-index: 10;
  width: 90%;
  max-width: 800px;
}

.gr-stack-title {
  font-family: "Instrument Serif", serif;
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-style: italic;
  font-weight: 400;
  color: #111;
  margin-bottom: 20px;
  line-height: 1.1;
}

.gr-stack-title .gr-tasa {
  font-family: "Tasaorbiterdeck", sans-serif;
  color: var(
    --primary-black-500,
    #111
  ); /* Added fallback in case variable is not defined */
  letter-spacing: -1.7px;
  white-space: normal;
  margin-top: 0;
  margin-bottom: 0;
  font-size: 32px;
  font-weight: 500;
  line-height: 110%;
}

.gr-stack-title .gr-serif {
  font-family: "Instrument Serif", serif;
  font-weight: 700;
  font-style: italic;
}

.gr-stack-paragraph {
  font-family: "Inter", sans-serif;
  font-size: 1.1rem;
  color: #555;
  line-height: 1.6;
  margin-bottom: 160px;
  /* Increased from 16px */
}

.gr-stack-cards-container {
  position: relative;
  width: 100%;
  height: 60vh;
  margin-top: 15vh;
  /* Enough space below absolute header */
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 1200px;
}

.gr-stacked-card {
  position: absolute;
  width: 800px;
  height: 590px;
  border-radius: 16px; /* Elegant rounding */
  overflow: hidden;
  will-change: transform, opacity;
  transform-origin: center center;
  opacity: 0;

  /* 1. Base dark bluish layer with soft base glows */
  background:
    radial-gradient(
      circle at 50% -10%,
      rgba(100, 50, 200, 0.25) 0%,
      transparent 60%
    ),
    radial-gradient(
      circle at 50% 110%,
      rgba(20, 100, 180, 0.2) 0%,
      transparent 60%
    ),
    linear-gradient(180deg, #0b101e 0%, #05070f 100%);

  /* Subtle subtle low-opacity light purple/blue border */
  border: 1px solid rgba(138, 120, 255, 0.15);

  /* Strong but elegant outer glow */
  box-shadow:
    0 0 50px rgba(100, 70, 250, 0.25),
    0 30px 60px rgba(0, 0, 0, 0.5);

  /* Glass / dreamy feel */
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

/* 2. Internal blurred purple and blue glow layer (foggy gradient wash) */
.gr-stacked-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(
      ellipse 120% 60% at 50% -5%,
      rgba(140, 80, 255, 0.35) 0%,
      transparent 70%
    ),
    radial-gradient(
      ellipse 100% 50% at 50% 105%,
      rgba(0, 180, 255, 0.25) 0%,
      transparent 70%
    );
  filter: blur(30px);
  z-index: 1; /* Below content */
}

/* 3. Subtle bright border inner highlight layer */
.gr-stacked-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.25);
  z-index: 3; /* Above content to act as the inner shiny rim */
}

.gr-stacked-card img,
.gr-stacked-card video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: relative;
  z-index: 2; /* Content sits cleanly above the internal fog but below the inner rim */
}

/* Nav Arrows */
.gr-nav-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 60px;
  height: 60px;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(8px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 50;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
  transition:
    transform 0.2s,
    background 0.2s,
    opacity 0.3s;
  pointer-events: none;
  /* Inactive initially */
  opacity: 0;
  color: #111;
}

.gr-nav-arrow:hover {
  background: #fff;
  transform: translateY(-50%) scale(1.05);
}

.gr-nav-arrow.prev {
  left: 5vw;
}

.gr-nav-arrow.next {
  right: 5vw;
}

/* Ensure mobile looks clean and NEVER overlaps */
@media (max-width: 767px) {
  .gr-stack-header {
    /* Critical: relative positioning protects the flow, no overlapping cards */
    position: relative;
    top: auto;
    left: auto;
    transform: none;
    margin-bottom: 5vh;
  }

  .gr-stack-cards-container {
    margin-top: 0;
    /* Header pushes it natively */
    height: 50vh;
  }

  .gr-stacked-card {
    width: calc(100vw - 16px);
    /* 8px margin from each border = 16px total */
    height: calc((100vw - 16px) * (590 / 800));
    /* Maintain 800:590 aspect ratio */
    /* PERFORMANCE: Remove expensive GPU effects on mobile */
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  }

  /* PERFORMANCE: Kill blur pseudo-element on mobile — saves massive GPU compositing per card */
  .gr-stacked-card::before {
    display: none !important;
  }

  .gr-scroll-stack-section {
    height: 450vh;
    /* Scaled scroll height for mobile vertical list */
  }

  .gr-nav-arrow {
    display: none !important;
    /* Hide arrows on mobile vertical list flow */
  }
}

/* Footer Video Experience Section */
.gr-footer-video-container {
  width: 100%;
  max-width: 960px;
  /* Reduced by 20% from 1200px */
  margin: 120px auto;
  /* 40px top/bottom */
  padding: 0 20px;
  display: flex;
  justify-content: center;
  position: relative;
  z-index: 2;
}

.gr-footer-video-wrapper {
  position: relative;
  width: 100%;
  overflow: hidden;
  /* Removed shadow, border and bg to blend with white site background */
}

.gr-footer-video {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

.gr-video-overlay-glow {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(
    circle at 50% 0%,
    rgba(32, 35, 66, 0.02) 0%,
    transparent 80%
  );
  pointer-events: none;
}

@media (max-width: 767px) {
  .gr-footer-video-container {
    margin: 80px auto 40px;
    padding: 0 8px;
  }
}
