/* ============================================================
   Tierra Firme Labs — Landing
   Estilos del sitio. Tokens en colors/typography/spacing/fonts.
   Tema: variables semánticas que cambian con html.dark
   ============================================================ */

:root {
  --bg: var(--sand-50);
  --surface: #ffffff;
  --border: var(--stone-200);
  --text-strong: var(--stone-900);
  --text-body: var(--stone-600);
  --text-muted: var(--stone-500);
  --chip-bg: var(--stone-100);
  --chip-text: var(--stone-500);
}

html.dark {
  --bg: var(--stone-900);
  --surface: var(--stone-800);
  --border: var(--border-on-dark);
  --text-strong: #ffffff;
  --text-body: var(--sand-100);
  --text-muted: rgba(255, 255, 255, 0.55);
  --chip-bg: rgba(255, 255, 255, 0.08);
  --chip-text: var(--sand-100);
  /* Overrides para el formulario de contacto (tokens semánticos del DS) */
  --surface-sunken: #232220;
  --text-faint: var(--stone-400);
  --border-default: rgba(255, 255, 255, 0.24);
  --danger-50: rgba(168, 58, 42, 0.16);
  --success-50: rgba(94, 107, 67, 0.18);
}

html { scroll-behavior: smooth; }
html, body { margin: 0; padding: 0; }
* { box-sizing: border-box; }

body {
  background: var(--bg);
  min-height: 100vh;
  transition: background var(--duration-base) ease;
  font-family: var(--font-sans);
}

a { color: var(--clay-500); text-decoration: none; }
a:hover { color: var(--clay-600); }

.container { max-width: 1240px; margin: 0 auto; padding-left: 56px; padding-right: 56px; }
.container-narrow { max-width: 1128px; margin: 0 auto; }

.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--clay-500); display: inline-block; flex-shrink: 0; }
.dot-lg { width: 8px; height: 8px; border-radius: 50%; background: var(--clay-500); flex-shrink: 0; }

.section-head { display: flex; align-items: baseline; gap: 10px; }
.section-head h2 {
  font-family: var(--font-display);
  font-weight: var(--weight-semibold);
  font-size: var(--text-2xl);
  color: var(--text-strong);
  margin: 0;
}

.btn-primary {
  display: inline-block;
  text-decoration: none;
  font-family: var(--font-sans);
  font-weight: var(--weight-semibold);
  font-size: var(--text-sm);
  border-radius: var(--radius-md);
  padding: 10px 18px;
  border: none;
  background: var(--clay-500);
  color: #fff;
  cursor: pointer;
}
.btn-primary, .btn-primary:hover { color: #fff; }
.btn-primary:hover { background: var(--clay-600); }
.btn-primary.btn-lg { font-size: var(--text-md); padding: 14px 24px; }

/* ---- Nav ---- */
.nav {
  padding: 18px 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
  transition: background var(--duration-base) ease;
}
.nav-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.nav-brand img { height: 26px; }
.nav-brand .labs {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--text-muted);
}
.nav-links { display: flex; gap: 32px; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-muted);
}
.nav-link.active { color: var(--text-strong); }
.nav-right { display: flex; align-items: center; gap: 18px; }

.logo-light { display: inline; }
.logo-dark { display: none; }
html.dark .logo-light { display: none; }
html.dark .logo-dark { display: inline; }

/* Toggle claro/oscuro */
.theme-toggle {
  width: 44px;
  height: 24px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--surface);
  position: relative;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}
.theme-toggle .knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--clay-500);
  transition: left 180ms ease;
}
html.dark .theme-toggle .knob { left: 22px; }

/* ---- Hero ---- */
.hero { padding: 120px 56px 72px; }
.hero .eyebrow-stamp {
  font-family: var(--font-stamp);
  text-transform: uppercase;
  letter-spacing: var(--tracking-stamp);
  font-size: var(--text-xs);
  color: var(--clay-500);
  margin-bottom: 16px;
}
.hero h1 {
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  font-size: var(--text-6xl);
  line-height: 0.98;
  letter-spacing: var(--tracking-tight);
  color: var(--text-strong);
  margin: 0 0 20px;
  max-width: 12em;
}
.hero p {
  font-size: var(--text-lg);
  line-height: var(--leading-relaxed);
  color: var(--text-body);
  margin: 0 0 32px;
  max-width: 34em;
}
.hero-cta { display: flex; gap: 14px; align-items: center; }
.hero-cta .no-compromiso {
  font-size: var(--text-sm);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---- Separador de marca ---- */
.brand-divider { display: flex; justify-content: center; padding: 25px 0 32px; }
.brand-divider img { height: 50px; width: auto; opacity: 0.85; }

/* ---- Productos ---- */
#productos { padding: 20px 56px 0; scroll-margin-top: 88px; }
#productos .section-head { margin-bottom: 36px; }

.product-row { display: flex; gap: 36px; align-items: center; padding: 0 56px; max-width: 1240px; margin: 0 auto; }
.product-row.rev { flex-direction: row-reverse; }
.product-shot {
  flex: 0 0 340px;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
}
.product-shot img,
.product-shot video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}
/* Links de producto: foto con zoom sutil, título sin subrayado */
a.product-link { display: block; text-decoration: none; }
.product-link img,
.product-link video { transition: transform 500ms var(--ease-out), opacity 600ms ease; }
.product-link:hover img,
.product-link:hover video { transform: scale(1.06); }
.title-link { color: inherit; text-decoration: none; }
.title-link:hover { color: var(--clay-500); }

.product-info { flex: 1; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: var(--weight-medium);
  border-radius: var(--radius-full);
  padding: 3px 10px;
  background: var(--chip-bg);
  color: var(--chip-text);
}
.product-info h3 {
  font-family: var(--font-display);
  font-weight: var(--weight-semibold);
  font-size: var(--text-2xl);
  color: var(--text-strong);
  margin: 12px 0 8px;
}
.eyebrow {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--clay-500);
  margin-bottom: 6px;
}
.product-info p {
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  color: var(--text-body);
  margin: 0;
  max-width: 32em;
}

.divider { height: 1px; background: var(--border); margin: 44px auto; max-width: 1128px; }

/* Rotación cross-fade (PronoX y casos de éxito) */
.rotator img,
.rotator video { transition: opacity 600ms ease; opacity: 0; }
.rotator img.visible,
.rotator video.visible { opacity: 1; }

/* ---- Grilla mini-cards ---- */
.building { padding: 64px 56px 40px; }
.building .section-head { margin-bottom: 20px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.mini-card {
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  gap: 14px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
}
.mini-card.featured { background: var(--clay-50); border: 1.5px dashed var(--clay-300); }
.mini-card .avatar {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mini-card .avatar img { width: 100%; height: 100%; object-fit: cover; }
.mini-card .avatar.qr { background: #ffffff; padding: 4px; }
.mini-card .avatar.qr img { object-fit: contain; }
.mini-card h4 {
  font-family: var(--font-display);
  font-weight: var(--weight-semibold);
  font-size: var(--text-sm);
  color: var(--text-strong);
  margin: 0 0 2px;
}
.mini-card.featured h4 { color: var(--stone-900); }
.mini-card p { font-size: var(--text-xs); color: var(--text-muted); margin: 0; }
.mini-card.featured p { color: var(--stone-500); }
.mini-card-sub { margin-top: 2px !important; opacity: 0.75; }
a.mini-card { text-decoration: none; transition: box-shadow 400ms ease, transform 400ms ease; }
a.mini-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.10); transform: translateY(-2px); }
a.mini-card.featured:hover { box-shadow: 0 4px 20px rgba(245,134,52,0.18); }

/* RespondIQ shot: imagen según tema */
.respondiq-dark-shot { display: none; }
html.dark .product-shot .respondiq-light-shot { display: none; }
html.dark .product-shot .respondiq-dark-shot { display: block; }

/* ---- Casos de éxito ---- */
#casos-de-exito {
  padding: 100px 56px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  scroll-margin-top: 70px;
  transition: background var(--duration-base) ease;
}
#casos-de-exito .section-head { margin-bottom: 28px; }
.casos { display: flex; gap: 18px; }
.caso-card {
  flex: 1;
  background: var(--bg);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
}
.caso-card .shot { aspect-ratio: 1 / 1; position: relative; background: #0f0f10; overflow: hidden; }
.caso-card .shot img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}
.caso-card .body { padding: 16px 18px; }
.caso-card .basado {
  font-size: 10px;
  font-weight: var(--weight-medium);
  color: var(--text-muted);
}
.caso-card h3 {
  font-family: var(--font-display);
  font-weight: var(--weight-semibold);
  font-size: var(--text-md);
  color: var(--text-strong);
  margin: 4px 0;
}
.caso-card p {
  font-size: var(--text-xs);
  line-height: var(--leading-normal);
  color: var(--text-body);
  margin: 0;
}

/* ---- Nosotros ---- */
#nosotros { padding: 100px 56px; scroll-margin-top: 70px; }
.nosotros-inner { max-width: 1128px; margin: 0 auto; display: flex; gap: 56px; align-items: center; }
.nosotros-photo {
  flex: 0 0 320px;
  aspect-ratio: 4 / 5;
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.nosotros-photo img { width: 100%; height: 100%; object-fit: cover; object-position: 15%; }
.nosotros-text { flex: 1; }
.nosotros-text .section-head { margin-bottom: 20px; }
.nosotros-text p {
  font-size: var(--text-md);
  line-height: var(--leading-relaxed);
  color: var(--text-body);
  margin: 0 0 16px;
  max-width: 34em;
}
.nosotros-text p:last-child { margin-bottom: 0; }

/* ---- Contacto (componente del design system central) ---- */
#contacto {
  padding: clamp(56px, 9vh, 100px) clamp(20px, 6vw, 64px);
  max-width: 1080px;
  margin: 0 auto;
  scroll-margin-top: 70px;
}
.contacto-head { max-width: 640px; margin: 0 0 40px; }
.contacto-head .eyebrow-stamp {
  font-family: var(--font-stamp);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-stamp);
  text-transform: uppercase;
  color: var(--clay-500);
}
.contacto-head h2 {
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  font-size: clamp(1.9rem, 3.6vw, 2.6rem);
  color: var(--text-strong);
  margin: 0.4em 0 0.3em;
  line-height: 1.15;
}
.contacto-head p { font-size: 1.05rem; line-height: 1.6; margin: 0; color: var(--text-muted); }

.contacto-grid { display: flex; gap: clamp(24px, 4vw, 48px); align-items: flex-start; flex-wrap: wrap; }
.contacto-form-col { flex: 1 1 480px; min-width: 0; }
.contacto-alt-col { flex: 0 1 280px; min-width: 240px; }

form#tf-contact-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: clamp(24px, 3vw, 36px);
  box-shadow: var(--shadow-sm);
}
.tf-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 860px) { .tf-row { grid-template-columns: 1fr; } }

.tf-field { display: flex; flex-direction: column; gap: 6px; }
.tf-field label { font-size: 13px; font-weight: var(--weight-semibold); color: var(--text-strong); }
.tf-field .tf-hint { font-size: 12px; color: var(--text-muted); }
.tf-field .tf-error {
  font-size: 12.5px;
  color: var(--danger-600);
  display: none;
  align-items: center;
  gap: 5px;
}
.tf-field.has-error .tf-error { display: flex; }
.tf-field.has-error input,
.tf-field.has-error textarea {
  border-color: var(--danger-600) !important;
  background: var(--danger-50) !important;
}

.tf-input, .tf-textarea {
  width: 100%;
  font-family: var(--font-sans);
  font-size: 15px;
  color: var(--text-strong);
  background: var(--bg);
  border: 1.5px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 11px 13px;
  outline: none;
  transition: border-color 120ms var(--ease-standard), box-shadow 120ms var(--ease-standard), background 120ms var(--ease-standard);
}
.tf-input::placeholder, .tf-textarea::placeholder { color: var(--text-faint); }
.tf-input:focus, .tf-textarea:focus { border-color: var(--clay-500); box-shadow: 0 0 0 3px var(--action-ring); }
.tf-textarea { min-height: 130px; resize: vertical; line-height: 1.5; }

/* Honeypot: invisible para personas, presente en el DOM para bots */
.tf-hp {
  position: absolute;
  left: -9999px;
  top: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
}

.tf-submit {
  margin-top: 6px;
  align-self: flex-start;
  font-family: var(--font-sans);
  font-weight: var(--weight-semibold);
  font-size: 15px;
  color: #fff;
  background: var(--clay-500);
  border: none;
  border-radius: var(--radius-md);
  padding: 13px 26px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: background 120ms var(--ease-standard), transform 80ms var(--ease-standard);
}
.tf-submit:hover { background: var(--clay-600); }
.tf-submit:active { background: var(--clay-700); transform: translateY(1px); }
.tf-submit:disabled { background: var(--stone-400); cursor: not-allowed; }

.tf-spinner {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  animation: tf-spin 0.7s linear infinite;
  display: none;
}
.tf-submit.is-loading .tf-spinner { display: inline-block; }
.tf-submit.is-loading .tf-submit-label { opacity: 0.85; }
@keyframes tf-spin { to { transform: rotate(360deg); } }

.tf-net-error { font-size: 13px; color: var(--danger-600); display: none; }
.tf-net-error.is-visible { display: block; }

.tf-alt-card {
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 26px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.tf-alt-card h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: var(--weight-semibold);
  color: var(--text-strong);
  margin: 0;
}
.tf-alt-card p { font-size: 14px; line-height: 1.55; margin: 0; color: var(--text-muted); }
.tf-alt-card a.tf-mail,
.tf-success a.tf-mail {
  font-family: var(--font-sans);
  font-weight: var(--weight-semibold);
  font-size: 15px;
  color: var(--clay-600);
  text-decoration: none;
  word-break: break-word;
}
.tf-alt-card a.tf-mail:hover,
.tf-success a.tf-mail:hover { color: var(--clay-700); text-decoration: underline; }

.tf-success {
  display: none;
  flex-direction: column;
  gap: 14px;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: clamp(32px, 4vw, 44px);
  box-shadow: var(--shadow-sm);
}
.tf-success.is-visible { display: flex; }
.tf-success .tf-success-icon {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--success-50);
  color: var(--success-600);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.tf-success h3 {
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  font-size: 1.5rem;
  color: var(--text-strong);
  margin: 0;
}
.tf-success p { font-size: 15px; line-height: 1.6; color: var(--text-body); margin: 0; max-width: 480px; }

/* ---- Footer ---- */
.footer {
  padding: 36px 56px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
}
.footer-left { display: flex; align-items: center; gap: 10px; }
.footer-left img { height: 20px; }
.footer-left .sep { width: 1px; height: 18px; background: var(--border); }
.footer-left .legal { font-size: var(--text-xs); color: var(--text-muted); line-height: 1.4; }
.footer-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  font-size: var(--text-xs);
  color: var(--text-muted);
}
.footer-right .mail { display: flex; align-items: center; gap: 6px; }

/* ---- Volver arriba ---- */
.back-top {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--clay-500);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  z-index: 20;
}
.back-top:hover { background: var(--clay-600); }

/* ---- Responsive ---- */
@media (max-width: 860px) {
  .nav { padding: 18px 24px; }
  .nav-links { display: none; }
  .hero { padding: 72px 24px 56px; }
  .hero h1 { font-size: var(--text-4xl); }
  #productos, .building, #casos-de-exito, #nosotros { padding-left: 24px; padding-right: 24px; }
  .footer { padding: 36px 24px; }
  .product-row, .product-row.rev { flex-direction: column; align-items: flex-start; padding-left: 24px; padding-right: 24px; }
  .product-shot { flex: none; width: 100%; }
  .grid3 { grid-template-columns: 1fr; }
  .casos { flex-direction: column; }
  .nosotros-inner { flex-direction: column; align-items: flex-start; }
  .nosotros-photo { flex: none; width: 100%; max-width: 360px; }
}
