/* DIAICR — Digital Innovation & Artificial Intelligence · Costa Rica */
/* Main styles — layout and components */

:root {
  --bg-deep: #090E1A;
  --bg-surface: #101828;
  --bg-border: #1A2740;
  --accent: #00E5FF;
  --accent-glow: rgba(0, 229, 255, 0.12);
  --accent-strong: rgba(0, 229, 255, 0.35);
  --text-primary: #E8F0FE;
  --text-muted: #6B7FA3;
  --text-dim: #3A4A6B;
}

/* Typography */
/* FIX 1: Prevent flash — body hidden until GSAP reveals after fonts load */
body {
  font-family: 'DM Sans', system-ui, sans-serif;
  font-weight: 400;
  color: var(--text-primary);
  background-color: var(--bg-deep);
  opacity: 0;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
}

/* Layout */
/* FIX 2: Lenis handles smooth scroll — no scroll-behavior here */

/* ========== HEADER ========== */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  background: transparent;
  transition: background 0.3s ease, backdrop-filter 0.3s ease, border-color 0.3s ease;
}

.header.scrolled {
  background: rgba(9, 14, 26, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--bg-border);
}

.header__logo {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.header__logo-wordmark {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 1.4rem;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.header__logo-diai {
  color: #FFFFFF;
}

.header__logo-cr {
  color: #00E5FF;
}

.header__logo-subtitle {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: #6B7FA3;
  letter-spacing: 0.15em;
  margin-top: 2px;
}

@media (max-width: 1279px) {
  .header__logo-subtitle {
    display: none;
  }
}

.header__nav {
  display: none;
}

.header__nav-list {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.header__nav-link {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  color: var(--text-muted);
  position: relative;
  transition: color 0.2s ease;
}

.header__nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 100%;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}

.header__nav-link:hover {
  color: var(--text-primary);
}

.header__nav-link:hover::after {
  transform: scaleX(1);
}

.header__cta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  padding: 0.5rem 1rem;
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 6px;
  transition: background 0.25s ease, box-shadow 0.25s ease;
}

.header__cta:hover {
  background: var(--accent-glow);
  box-shadow: 0 0 20px var(--accent-glow);
}

/* Hamburger */
.header__hamburger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 28px;
  height: 28px;
  background: none;
  border: none;
  padding: 0;
  z-index: 110;
}

.header__hamburger span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text-primary);
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.header__hamburger.active span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.header__hamburger.active span:nth-child(2) {
  opacity: 0;
}

.header__hamburger.active span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Mobile overlay nav */
.nav-overlay {
  position: fixed;
  inset: 0;
  z-index: 105;
  background: var(--bg-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.nav-overlay.active {
  opacity: 1;
  visibility: visible;
}

.nav-overlay__list {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
}

/* REVIEW: nav-overlay__link opacity:0 — GSAP animates on open; ensure closeMobileNav resets via gsap.set */
.nav-overlay__link {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 1.5rem;
  color: var(--text-primary);
  opacity: 0;
}

/* ========== HERO ========== */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  overflow: hidden;
}

.hero__bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.hero__grid {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.12;
  background-image:
    linear-gradient(var(--accent) 1px, transparent 1px),
    linear-gradient(90deg, var(--accent) 1px, transparent 1px);
  background-size: 60px 60px;
  transform: perspective(500px) rotateX(60deg);
  transform-origin: center top;
}

.hero__map-wrap {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: clamp(300px, 40vw, 580px);
  opacity: 0.55;
}

.hero__map {
  width: clamp(400px, 55vw, 750px);
  height: auto;
  aspect-ratio: 648.29871 / 612.98956;
}

.hero__map path {
  fill: none;
  stroke: #00E5FF;
  stroke-width: 1px;
  opacity: 0.85;
}

@media (max-width: 767px) {
  .hero__map {
    width: 90vw;
  }
}

.hero__content {
  position: relative;
  z-index: 2;
  text-align: center;
  max-width: 900px;
}

.hero__eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.15em;
  color: var(--accent);
  margin-bottom: 1.5rem;
  opacity: 0;
}

/* FIX 3: Hero headline — clamp(2rem, 4.5vw, 3.5rem), line-height 1.15, max-width 700px */
.hero__headline {
  font-size: clamp(2rem, 4.5vw, 3.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin: 0 auto 1.5rem;
  max-width: 700px;
}

.hero__headline-line1,
.hero__headline-line2 {
  display: block;
}

.hero__subheadline {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 560px;
  margin: 0 auto 2rem;
  line-height: 1.7;
  opacity: 0;
}

.hero__cta-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  opacity: 0;
}

.hero__cta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  padding: 0.875rem 1.75rem;
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 8px;
  position: relative;
  overflow: hidden;
  transition: background 0.25s ease;
}

.hero__cta:hover {
  background: var(--accent-glow);
}

.hero__cta-secondary {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 4px;
  transition: color 0.2s ease;
}

.hero__cta-secondary:hover {
  color: var(--accent);
}

/* ========== TRUST BAR ========== */
.trust-bar {
  background: var(--bg-surface);
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--bg-border);
  border-bottom: 1px solid var(--bg-border);
}

.trust-bar__list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem 1.5rem;
  justify-items: center;
  align-items: center;
  max-width: 900px;
  margin: 0 auto;
}

.trust-bar__item {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text-muted);
  opacity: 0;
}

.trust-bar__item:not(:last-child)::after {
  content: ' · ';
  color: var(--accent);
  margin-left: 0.5rem;
}

@media (max-width: 767px) {
  .trust-bar__item:not(:last-child)::after {
    display: none;
  }
}

/* ========== SECTIONS COMMON ========== */
.section {
  padding: 4rem 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

.section__eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.15em;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.section__title {
  font-size: clamp(2rem, 4vw, 3rem);
  margin-bottom: 3rem;
  position: relative;
}

.section__title-line {
  display: block;
  width: 80px;
  height: 3px;
  background: var(--accent);
  margin-bottom: 1rem;
  transform-origin: left;
}

.section__title-text {
  opacity: 0;
}

/* ========== SOLUTIONS ========== */
.solutions__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

.solution-card {
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: 12px;
  padding: 2rem;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: box-shadow 0.3s ease, transform 0.3s ease, border-color 0.3s ease;
}

.solution-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent);
}

.solution-card:hover {
  box-shadow: 0 0 32px var(--accent-glow);
  transform: translateY(-4px);
  border-color: var(--accent-strong);
}

.solution-card__icon {
  width: 48px;
  height: 48px;
  margin-bottom: 1rem;
  color: var(--accent);
}

.solution-card__title {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.solution-card__tagline {
  font-size: 0.9375rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  line-height: 1.5;
}

.solution-card__items {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--text-dim);
}

.solution-card__items li {
  padding: 0.25rem 0;
  position: relative;
  padding-left: 1rem;
}

.solution-card__items li::before {
  content: '·';
  position: absolute;
  left: 0;
  color: var(--accent);
}

/* ========== NOSOTROS ========== */
.nosotros {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3rem;
  align-items: center;
}

.nosotros__content .section__eyebrow {
  margin-bottom: 0.75rem;
}

.nosotros__title {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  margin-bottom: 1.25rem;
}

.nosotros__title.section__title .section__title-text {
  display: block;
}

.nosotros__body {
  font-size: 1rem;
  color: var(--text-muted);
  line-height: 1.7;
}

.nosotros__values {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* REVIEW: value-block opacity:0 — ScrollTrigger animates on scroll; initial hidden state intentional */
.value-block {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  opacity: 0;
}

.value-block__icon {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  color: var(--accent);
}

.value-block__label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  font-weight: 500;
  color: var(--accent);
  margin-bottom: 0.25rem;
}

.value-block__text {
  font-size: 0.9375rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ========== CONTACTO ========== */
.contacto {
  background: var(--bg-surface);
  padding: 4rem 1.5rem;
  text-align: center;
}

.contacto__title {
  font-size: clamp(2rem, 4vw, 3rem);
  margin-bottom: 0.75rem;
}

.contacto__subtext {
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
}

.contacto__btn {
  font-family: 'JetBrains Mono', monospace;
  font-size: 16px;
  padding: 1rem 2rem;
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 8px;
  position: relative;
  overflow: hidden;
  transition: background 0.25s ease, color 0.25s ease;
}

.contacto__btn:hover {
  background: var(--accent);
  color: var(--bg-deep);
}

/* ========== FOOTER ========== */
.footer {
  padding: 2rem 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

.footer__row1 {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  align-items: center;
  margin-bottom: 1.5rem;
}

.footer__logo-link {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.footer__logo-diai {
  color: #FFFFFF;
}

.footer__logo-cr {
  color: #00E5FF;
}

.footer__nav {
  display: flex;
  gap: 1.5rem;
}

.footer__nav-link {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  color: var(--text-muted);
  transition: color 0.2s ease;
}

.footer__nav-link:hover {
  color: var(--accent);
}

.footer__row2 {
  padding-top: 1.5rem;
  border-top: 1px solid var(--bg-border);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
  text-align: center;
}

.footer__copyright {
  font-size: 13px;
  color: var(--text-muted);
}

.footer__tagline {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text-dim);
}

/* ========== DIAIBOT WIDGET ========== */
.diaibot {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 200;
}

.diaibot__trigger {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  box-shadow: 0 4px 20px var(--accent-glow);
}

.diaibot__trigger::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  opacity: 0.4;
  animation: diaibot-pulse 2s ease-in-out infinite;
}

.diaibot__trigger-icon {
  width: 24px;
  height: 24px;
  color: var(--bg-deep);
  position: relative;
  z-index: 1;
}

.diaibot__panel,
.bot-panel {
  width: 420px;
  max-width: calc(100vw - 2rem);
  height: 580px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  position: fixed;
  bottom: 5rem;
  right: 1.5rem;
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0, 229, 255, 0.1);
  z-index: 200;
  overflow: hidden;
  transform-origin: bottom right;
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  transition: pointer-events 0s 0.3s;
}

.diaibot__panel.is-open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  transition: none;
}

.diaibot__panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: var(--bg-deep);
  border-bottom: 1px solid var(--bg-border);
}

.diaibot__panel-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.diaibot__panel-title-text {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1rem;
}

.diaibot__panel-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  padding: 0.2rem 0.4rem;
  background: var(--accent);
  color: var(--bg-deep);
  border-radius: 4px;
}

.diaibot__panel-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.25rem;
  transition: color 0.2s ease;
}

.diaibot__panel-close:hover {
  color: var(--text-primary);
}

.diaibot__panel-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.diaibot__chat {
  max-height: 300px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.diaibot__bubble {
  padding: 0.75rem 1rem;
  font-size: 14px;
  line-height: 1.5;
  max-width: 90%;
}

.diaibot__bubble--user {
  align-self: flex-end;
  background: var(--accent);
  color: var(--bg-deep);
  border-radius: 12px 12px 0 12px;
}

.diaibot__bubble--bot {
  align-self: flex-start;
  background: var(--bg-deep);
  color: var(--text-primary);
  border-radius: 12px 12px 12px 0;
}

.diaibot__typing {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 0.75rem 1rem;
}

.diaibot__typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: diaibot-typing 1.4s ease-in-out infinite both;
}

.diaibot__typing span:nth-child(2) { animation-delay: 0.2s; }
.diaibot__typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes diaibot-typing {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
  40% { transform: scale(1); opacity: 1; }
}

.diaibot__input::placeholder {
  color: var(--text-muted);
}

.diaibot__send {
  padding: 0.75rem 1rem;
  background: var(--accent);
  color: var(--bg-deep);
  border: none;
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.diaibot__send:hover {
  opacity: 0.9;
}

/* Bot chat (email/WhatsApp flow) */
.bot-messages {
  flex: 1;
  min-height: 0;
  overflow-y: scroll;
  overscroll-behavior: contain;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  scroll-behavior: smooth;
}

.bot-bubble {
  padding: 0.75rem 1rem;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.6;
  max-width: 82%;
  word-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
}

.bot-bubble.user {
  background: var(--accent);
  color: var(--bg-deep);
  border-radius: 12px 12px 0 12px;
  margin-left: auto;
}

.bot-bubble.bot {
  background: var(--bg-deep);
  color: var(--text-primary);
  border-radius: 12px 12px 12px 0;
  border: 1px solid var(--bg-border);
}

.bot-input-area,
.diaibot__input-wrap {
  flex-shrink: 0;
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--bg-border);
  background: var(--bg-surface);
}

.bot-input-area input,
.diaibot__input-wrap input,
.diaibot__input {
  flex: 1;
  background: var(--bg-deep);
  border: 1px solid var(--bg-border);
  border-radius: 8px;
  padding: 0.6rem 0.9rem;
  color: var(--text-primary);
  font-size: 0.9rem;
  outline: none;
}

.bot-input-area input:focus,
.diaibot__input-wrap input:focus,
.diaibot__input:focus {
  border-color: var(--accent);
}

.bot-typing {
  display: flex;
  gap: 4px;
  padding: 0.6rem 1rem;
  align-self: flex-start;
}

.bot-typing span {
  width: 6px;
  height: 6px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typingDot 1.2s infinite;
}

.bot-typing span:nth-child(2) { animation-delay: 0.2s; }
.bot-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingDot {
  0%, 60%, 100% { opacity: 0.2; transform: translateY(0); }
  30%           { opacity: 1;   transform: translateY(-4px); }
}

.wa-bubble {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.wa-button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #25D366;
  color: #fff;
  padding: 0.5rem 0.9rem;
  border-radius: 8px;
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 600;
  width: fit-content;
  transition: background 0.2s ease;
}

.wa-button:hover {
  background: #1ebe5d;
}

@media (max-width: 768px) {
  .diaibot__panel,
  .bot-panel {
    position: fixed;
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    height: 75vh;
    max-height: 75vh;
    border-radius: 20px 20px 0 0;
  }

  .bot-bubble {
    font-size: 0.95rem;
    max-width: 88%;
  }

  .bot-input-area input,
  .diaibot__input-wrap input,
  .diaibot__input {
    font-size: 16px;
  }
}

/* ========== RESPONSIVE ========== */
@media (min-width: 768px) {
  .header__nav {
    display: block;
  }

  .header__hamburger {
    display: none;
  }

  .trust-bar__list {
    display: flex;
    flex-direction: row;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0 1.5rem;
  }

  .trust-bar__item:not(:last-child)::after {
    display: inline;
    margin-left: 0;
  }

  .solutions__grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  }

  .nosotros {
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
  }

  .footer__row1 {
    flex-direction: row;
    justify-content: space-between;
  }

  .footer__row2 {
    flex-direction: row;
    justify-content: space-between;
    text-align: left;
  }
}

@media (min-width: 1024px) {
  .section {
    padding: 5rem 2rem;
  }

  .hero {
    padding: 2rem 2rem;
  }
}
