/* ===========================
   THALOR AGENCY - STYLES
   Automation Agency Design System
   =========================== */

:root {
  --color-core-black: #090909;
  --color-rich-carbon: #111111;
  --color-urban-smoke: #1b1b1b;
  --color-pulse-ash: #535353;
  --color-off-white: #e7e7e7;
  --color-neural-fog: #dadada;
  --color-white-flash: #f5f5f5;
  --color-electric-teal: #5c939f;
  --color-infrared: #ed6d40;
  --easing: cubic-bezier(.62, .16, .13, 1.01);
}

/* ===== GLOBAL ===== */

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  overflow-x: hidden;
}

[x-cloak] { display: none !important; }

::selection {
  background: var(--color-electric-teal);
  color: var(--color-core-black);
}

/* ===== TYPOGRAPHY SYSTEM ===== */

.h2 {
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  line-height: 0.95;
  text-transform: uppercase;
  letter-spacing: -0.02em;
  font-size: 2.25rem;
}
@media (min-width: 768px) {
  .h2 { font-size: 3.75rem; }
}

.h4 {
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  line-height: 0.95;
  text-transform: uppercase;
  letter-spacing: -0.01em;
  font-size: 1.75rem;
}
@media (min-width: 768px) {
  .h4 { font-size: 2.5rem; }
}

.h5 {
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  line-height: 0.95;
  text-transform: uppercase;
  font-size: 1.5rem;
}
@media (min-width: 768px) {
  .h5 { font-size: 1.875rem; }
}

.h6 {
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  line-height: 0.95;
  text-transform: uppercase;
  font-size: 1.125rem;
}
@media (min-width: 768px) {
  .h6 { font-size: 1.375rem; }
}

/* Mono labels */
.p1-mono {
  font-family: 'JetBrains Mono', monospace;
  text-transform: uppercase;
  font-size: 0.75rem;
  line-height: 120%;
  letter-spacing: 0.1em;
}
@media (min-width: 768px) {
  .p1-mono { font-size: 0.875rem; }
}

.p2-mono {
  font-family: 'JetBrains Mono', monospace;
  text-transform: uppercase;
  font-size: 0.688rem;
  line-height: 120%;
  letter-spacing: 0.15em;
}
@media (min-width: 768px) {
  .p2-mono { font-size: 0.75rem; }
}

.p3-mono {
  font-family: 'JetBrains Mono', monospace;
  text-transform: uppercase;
  font-size: 0.688rem;
  line-height: 130%;
  letter-spacing: 0.1em;
}

/* Body text */
.p1 {
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  line-height: 120%;
}
@media (min-width: 768px) {
  .p1 { font-size: 1rem; }
}

.p2 {
  font-family: 'Inter', sans-serif;
  font-size: 0.938rem;
  line-height: 110%;
}

/* ===== LOADER ===== */

.loader {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--color-core-black);
  display: flex;
  align-items: center;
  justify-content: center;
}

.loader-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.loader-logo {
  width: 140px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 32px;
  border: 1px solid #e8e0d4;
  animation: loader-logo-anim 1.8s var(--easing) forwards;
}

@keyframes loader-logo-anim {
  0% { transform: scale(1.3) rotate(-5deg); opacity: 0; }
  40% { transform: scale(1) rotate(0deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

@keyframes loader-letter-reveal {
  0% { clip-path: inset(0 100% 0 0); }
  100% { clip-path: inset(0 0% 0 0); }
}

.loader-bar {
  width: 200px;
  height: 2px;
  background: rgba(232, 224, 212, 0.15);
  border-radius: 1px;
  overflow: hidden;
}

.loader-bar-fill {
  height: 100%;
  background: #e8e0d4;
  border-radius: 1px;
  transition: width 0.3s var(--easing);
}

/* ===== CORNER ACCENTS ===== */

.corner-accent {
  position: absolute;
  pointer-events: none;
}

.corner-accent:first-of-type {
  left: var(--inset, 0);
  top: var(--inset, 0);
}

.corner-accent:nth-of-type(2) {
  right: var(--inset, 0);
  top: var(--inset, 0);
  transform: rotate(90deg);
}

.corner-accent:nth-of-type(3) {
  bottom: var(--inset, 0);
  left: var(--inset, 0);
  transform: rotate(270deg);
}

.corner-accent:nth-of-type(4) {
  bottom: var(--inset, 0);
  right: var(--inset, 0);
  transform: rotate(180deg);
}

/* ===== NAV LINK (Double-slide hover) ===== */

.nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.688rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--color-off-white);
  text-decoration: none;
  overflow: hidden;
}

.nav-link-text {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  overflow: hidden;
  height: 1.3em;
}

.nav-link-label {
  display: block;
  transition: transform 0.4s var(--easing);
  white-space: nowrap;
}

.nav-link-label--clone {
  position: absolute;
  top: 0;
  left: 0;
  transform: translateY(100%);
  color: var(--color-electric-teal);
}

.nav-link:hover .nav-link-label:first-child {
  transform: translateY(-100%);
}

.nav-link:hover .nav-link-label--clone {
  transform: translateY(0);
}

/* ===== BUTTONS ===== */

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 28px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  text-decoration: none;
  cursor: pointer;
  border: none;
  outline: none;
  overflow: hidden;
  isolation: isolate;
  transition: all 0.4s var(--easing);
  --inset: -1px;
}

.btn--outline {
  background: transparent;
  border: 1px solid var(--color-pulse-ash);
  color: var(--color-off-white);
}

.btn--outline:hover {
  border-color: var(--color-electric-teal);
  color: var(--color-electric-teal);
}

.btn--primary {
  background: var(--color-infrared);
  color: var(--color-core-black);
}

.btn--primary:hover {
  background: #f5834f;
}

.btn--primary .corner-accent {
  color: var(--color-core-black);
  opacity: 0.3;
}

.btn--dark {
  background: var(--color-core-black);
  color: var(--color-off-white);
  border: 1px solid var(--color-urban-smoke);
}

.btn--dark:hover {
  background: var(--color-rich-carbon);
  border-color: var(--color-pulse-ash);
}

.btn--dark .corner-accent {
  color: var(--color-infrared);
}

.btn-text {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  height: 1.3em;
}

.btn-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0;
  filter: blur(3px);
  transform: translateX(-24px);
  transition: all 0.4s var(--easing);
  flex-shrink: 0;
}

.btn:hover .btn-dot {
  opacity: 1;
  filter: blur(0);
  transform: translateX(-5px);
}

.btn-label {
  display: inline-block;
  transition: transform 0.4s var(--easing);
  white-space: nowrap;
}

.btn-label--clone {
  position: absolute;
  left: 20px;
  top: 0;
  transform: translateY(100%);
}

.btn:hover .btn-label:not(.btn-label--clone) {
  transform: translateY(-100%);
}

.btn:hover .btn-label--clone {
  transform: translateY(0);
}

/* ===== HEADER ===== */

.header--hidden {
  transform: translateY(-100%);
}

header {
  transition: transform 0.6s cubic-bezier(.62,.16,.13,1.01);
}

/* ===== HERO ===== */

/* Circle scale-in animation */
@keyframes heroCircleIn {
  from { transform: scale(0.6); opacity: 0; }
  to { transform: scale(1); opacity: 0.9; }
}

/* Fade-in-up for text elements */
.hero-fade-in {
  opacity: 0;
  transform: translateY(20px);
  animation: heroFadeIn 0.6s var(--easing) forwards;
}

@keyframes heroFadeIn {
  to { opacity: 1; transform: translateY(0); }
}

/* App icons pop-in */
.hero-app-icon {
  opacity: 0;
  transform: scale(0.5) translateY(20px);
  transition: all 0.5s cubic-bezier(.22, 1, .36, 1);
}

.hero-app-icon--visible {
  opacity: 1;
  transform: scale(1) translateY(0);
}

/* Subtle float animation for icons after they appear */
.hero-app-icon--visible:nth-child(1) { animation: heroFloat 4s ease-in-out 2s infinite; }
.hero-app-icon--visible:nth-child(2) { animation: heroFloat 4.5s ease-in-out 2.3s infinite; }
.hero-app-icon--visible:nth-child(3) { animation: heroFloat 3.8s ease-in-out 2.6s infinite; }
.hero-app-icon--visible:nth-child(4) { animation: heroFloat 4.2s ease-in-out 2.9s infinite; }

@keyframes heroFloat {
  0%, 100% { transform: scale(1) translateY(0); }
  50% { transform: scale(1) translateY(-8px); }
}

/* ===== ETHOS SECTION ===== */

.ethos-section {
  position: relative;
  z-index: 10;
}

.ethos-clip-wrapper {
  clip-path: inset(0 0 0 0);
  transition: clip-path 0.6s var(--easing);
}

/* ===== EXPANDING CARDS ===== */

.expanding-card {
  position: relative;
  overflow: hidden;
  border-radius: 0;
  cursor: pointer;
  flex: 1;
  transition: flex 0.5s cubic-bezier(.62,.16,.13,1.01) 0.1s;
  min-height: 280px;
}

@media (min-width: 768px) {
  .expanding-card {
    min-height: 450px;
    max-height: 550px;
  }
  .expanding-card:first-child {
    border-radius: 20px 0 0 20px;
  }
  .expanding-card:last-child {
    border-radius: 0 20px 20px 0;
  }
}

.expanding-card.active {
  flex: 2.5;
}

/* When any card is active, non-active cards shrink more */
.expanding-cards:has(.active) .expanding-card:not(.active) {
  flex: 0.7;
}

.expanding-card-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 24px;
  height: 100%;
  z-index: 1;
  overflow: hidden;
  /* Fixed size content - never zooms on hover/active */
  transform: none !important;
}

@media (min-width: 768px) {
  .expanding-card-inner {
    padding: 32px;
    /* Center content horizontally - fixed width so content doesn't scale */
    width: 300px;
    max-width: 100%;
    margin: 0 auto;
    flex-shrink: 0;
  }
}

/* Graphic stays fixed size - no zoom effect */
.expanding-card-graphic svg,
.expanding-card-graphic img {
  max-width: 200px;
  max-height: 200px;
  transition: none;
}

.expanding-card-title {
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 1.125rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: center;
  margin-bottom: auto;
  padding-top: 8px;
}

@media (min-width: 768px) {
  .expanding-card-title {
    font-size: 1.25rem;
    padding-top: 12px;
  }
}

.expanding-card-graphic {
  flex: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 0;
}

@media (min-width: 768px) {
  .expanding-card-graphic {
    padding: 32px 0;
  }
}

.expanding-card-bottom {
  margin-top: auto;
}

.expanding-card-desc {
  font-family: 'Inter', sans-serif;
  font-size: 0.75rem;
  line-height: 1.5;
  margin-top: 8px;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: all 0.5s var(--easing);
}

.expanding-card.active .expanding-card-desc {
  max-height: 400px;
  opacity: 1;
}

/* Mobile: all cards show description */
@media (max-width: 767px) {
  .expanding-card-desc {
    max-height: 200px;
    opacity: 1;
  }
}

/* ===== STACKING CARDS (Scroll-driven overlay) ===== */

.stacking-card-inner {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* Card top row: title left, icon right */
.stacking-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 32px;
}

/* Card bottom: number + description */
.stacking-card-bottom {
  display: flex;
  flex-direction: column;
  gap: 30px;
  margin-top: auto;
}

.stacking-card-bottom .stacking-card-number {
  border-bottom: 1px solid rgba(9, 9, 9, 0.2);
  padding-bottom: 9px;
}

/* ===== CLIENTS SECTION ===== */

#clients {
  position: relative;
  z-index: 15;
  background: #090909;
}

/* GSAP pin creates a wrapper div - make sure it has the right background */
.pin-spacer {
  background: #090909 !important;
}

#cube-three {
  pointer-events: none;
  width: 100%;
  height: 100%;
}

#cube-three canvas {
  pointer-events: none;
  width: 100% !important;
  height: 100% !important;
}

/* ===== PARTNERS / WAVE SECTION ===== */

#partners {
  position: relative;
  z-index: 20;
  background: #090909;
}

#partners .h2 {
  margin-bottom: 1.5rem;
}

#partners .p1 {
  margin-bottom: 2rem;
}

#wave-three {
  pointer-events: none;
}

#wave-three canvas {
  pointer-events: none;
}

/* ===== FOOTER NAV LINKS ===== */

.footer-nav-link {
  display: inline-block;
  text-decoration: none;
  color: var(--color-core-black);
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 1.5rem;
  text-transform: uppercase;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

@media (min-width: 768px) {
  .footer-nav-link {
    font-size: 2rem;
  }
}

.footer-nav-text {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  overflow: hidden;
  height: 1.4em;
}

.footer-nav-label {
  display: block;
  transition: transform 0.4s var(--easing);
  white-space: nowrap;
}

.footer-nav-label--clone {
  position: absolute;
  top: 0;
  left: 0;
  transform: translateY(100%);
  color: var(--color-core-black);
  opacity: 0.5;
}

.footer-nav-link:hover .footer-nav-label:first-child {
  transform: translateY(-100%);
}

.footer-nav-link:hover .footer-nav-label--clone {
  transform: translateY(0);
}

/* ===== CONTACT MODAL ===== */

.contact-panel {
  box-shadow: -20px 0 60px rgba(0, 0, 0, 0.5);
}

.contact-panel select option {
  background: var(--color-rich-carbon);
  color: var(--color-off-white);
}

/* ===== GSAP ANIMATION HELPERS ===== */

.reveal-up {
  opacity: 0;
  transform: translateY(40px);
}

.reveal-left {
  opacity: 0;
  transform: translateX(-40px);
}

.reveal-scale {
  opacity: 0;
  transform: scale(0.95);
}

/* ===== SCROLL BAR ===== */

::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--color-core-black);
}

::-webkit-scrollbar-thumb {
  background: var(--color-pulse-ash);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-electric-teal);
}

/* ===== RESPONSIVE ===== */

@media (max-width: 767px) {
  /* Expanding cards: stack vertically, all visible */
  .expanding-cards {
    flex-direction: column !important;
    gap: 8px !important;
    padding: 0 12px !important;
  }

  .expanding-card {
    min-height: 220px;
    border-radius: 12px !important;
    flex: none !important;
  }

  .expanding-card.active {
    flex: none !important;
  }

  .expanding-card-inner {
    min-width: unset;
  }

  /* Section 3 mobile: keep stacking animation, adjust layout to column */
  #clients > div {
    flex-direction: column !important;
    padding-top: 80px !important;
  }

  #clients-text {
    width: 100% !important;
    padding-right: 0 !important;
    margin-bottom: 16px;
  }

  #clients-cards {
    width: 100% !important;
    margin-left: 0 !important;
    height: 55vh !important;
    max-height: 400px !important;
  }

  /* Less negative margin on mobile so S3 and S4 don't overlap */
  #partners {
    margin-top: -20vh !important;
  }

  /* Terrain on mobile - keep size, reduce spacing */
  #wave-three {
    height: 400px !important;
    margin-top: -40px !important;
    margin-bottom: -60px !important;
  }

  /* ===== MOBILE HERO: vertical stack, no overlap ===== */
  #hero {
    height: auto !important;
    min-height: 100vh;
    padding: 100px 20px 40px !important;
  }

  #hero > div {
    position: relative !important;
    height: auto !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 32px !important;
  }

  /* Circle - centered, not absolute */
  #hero .absolute.left-1\/2.top-1\/2.z-0,
  #hero .absolute.left-1\/2.z-0 {
    position: relative !important;
    left: auto !important;
    top: auto !important;
    transform: none !important;
    display: flex !important;
    justify-content: center !important;
  }

  #hero .absolute.left-1\/2.top-1\/2.z-0 > div,
  #hero .absolute.left-1\/2.z-0 > div {
    width: 60vw !important;
    height: 60vw !important;
    max-width: 280px !important;
    max-height: 280px !important;
  }

  /* Icons container - on top of circle */
  #hero .absolute.left-1\/2.top-1\/2.z-10,
  #hero .absolute.left-1\/2.z-10 {
    position: absolute !important;
    width: 66vw !important;
    height: 66vw !important;
    max-width: 310px !important;
    max-height: 310px !important;
    left: 50% !important;
    top: auto !important;
    transform: translateX(-50%) !important;
  }

  #hero .hero-app-icon .w-20 {
    width: 3rem !important;
    height: 3rem !important;
  }

  /* Headline - below circle, centered */
  #hero .absolute.right-\[8\%\] {
    position: relative !important;
    right: auto !important;
    top: auto !important;
    transform: none !important;
    text-align: center !important;
  }

  #hero h1 {
    font-size: 2.5rem !important;
    text-align: center !important;
    line-height: 0.9 !important;
  }

  /* Description - below headline, centered */
  #hero .absolute.left-6 {
    position: relative !important;
    left: auto !important;
    bottom: auto !important;
    top: auto !important;
    transform: none !important;
    max-width: 100% !important;
    text-align: center !important;
  }

  #hero .absolute.left-6 p {
    max-width: 100% !important;
    margin: 0 auto !important;
  }

  #hero .absolute.left-6 button {
    margin: 16px auto 0 !important;
  }

  /* Cube: reduce opacity on mobile */
  #cube-three {
    opacity: 0.3;
  }

  /* Footer: full width, no split */
  #contact .flex.flex-col.md\\:flex-row {
    flex-direction: column !important;
  }

  #contact .md\\:w-1\\/2 {
    width: 100% !important;
  }

  /* Hide left dark half on mobile footer */
  #contact > div > div:first-child {
    min-height: 120px !important;
  }
}
