/* ============================================================
   SandIA Solutions — design system
   Plain CSS, no framework. One source of truth.
   ============================================================ */

:root {
  /* Backgrounds */
  --ink: #060504;
  --ink-2: #0b0909;
  --ink-3: #111010;

  /* Semantic surfaces */
  --surface: #0e0c0c;
  --surface-raised: #171313;
  --surface-overlay: rgba(255, 255, 255, 0.034);

  /* Borders */
  --hairline: rgba(255, 245, 243, 0.07);
  --hairline-2: rgba(255, 245, 243, 0.13);

  /* Text */
  --bone: #f2efed;
  --bone-dim: rgba(242, 239, 237, 0.57);
  --bone-faint: rgba(242, 239, 237, 0.33);

  /* Brand palette */
  --coral: #e03535;
  --coral-soft: #f07060;
  --petrol: #1a4a53;
  --petrol-light: #257070;

  /* Accent (tweakable) */
  --accent: var(--coral);
  --accent-soft: rgba(224, 53, 53, 0.10);
  --accent-glow: rgba(224, 53, 53, 0.062);

  /* Type */
  --font-sans: "Inter", system-ui, -apple-system, sans-serif;
  --font-serif: "Instrument Serif", "Times New Roman", serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  /* Layout */
  --section-y: 7rem;
  --content-w: 1320px;

  /* Radius */
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 22px;
  --r-xl: 32px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--ink);
  color: var(--bone);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  font-feature-settings: "ss01", "cv11";
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

/* ---------- Layout ---------- */
.wrap {
  max-width: var(--content-w);
  margin: 0 auto;
  padding: 0 28px;
}
@media (min-width: 768px) {
  .wrap { padding: 0 48px; }
}

section { padding: var(--section-y) 0; position: relative; }
section.tight { padding: calc(var(--section-y) * 0.55) 0; }

/* ---------- Type ---------- */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--bone-faint);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.eyebrow::before {
  content: "";
  width: 22px;
  height: 1px;
  background: var(--bone-faint);
}

h1, h2, h3, h4 {
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.02;
}

.h-display {
  font-size: clamp(2.8rem, 7.5vw, 7rem);
  letter-spacing: -0.04em;
  line-height: 0.93;
}
.h-section {
  font-size: clamp(2rem, 4.4vw, 3.8rem);
  letter-spacing: -0.03em;
  line-height: 1.02;
}
.h-card {
  font-size: clamp(1.3rem, 1.6vw, 1.65rem);
  letter-spacing: -0.015em;
  line-height: 1.15;
}

.serif { font-family: var(--font-serif); font-style: italic; font-weight: 400; letter-spacing: -0.01em; }
.body-l { font-size: clamp(1rem, 1.15vw, 1.2rem); line-height: 1.6; color: var(--bone-dim); }
.body { color: var(--bone-dim); }
.muted { color: var(--bone-faint); }
.mono { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.02em; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 22px;
  border-radius: 999px;
  font-weight: 500;
  font-size: 14px;
  letter-spacing: -0.005em;
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  white-space: nowrap;
}
.btn-primary {
  background: #000;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.18);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06), 0 2px 8px rgba(0,0,0,0.5);
}
.btn-primary:hover { transform: translateY(-1px); background: var(--accent); border-color: var(--accent); box-shadow: 0 8px 24px -8px rgba(224,53,53,0.5); }
.btn-ghost {
  background: #000;
  border: 1px solid rgba(255,255,255,0.18);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06), 0 2px 8px rgba(0,0,0,0.5);
}
.btn-ghost:hover { transform: translateY(-1px); background: var(--accent); border-color: var(--accent); box-shadow: 0 8px 24px -8px rgba(224,53,53,0.5); }
.btn-accent {
  background: #000;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.18);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06), 0 2px 8px rgba(0,0,0,0.5);
}
.btn-accent:hover { transform: translateY(-1px); background: var(--accent); border-color: var(--accent); box-shadow: 0 8px 24px -8px rgba(224,53,53,0.5); }

.btn .arrow {
  display: inline-block;
  transition: transform 0.2s ease;
}
.btn:hover .arrow { transform: translateX(3px); }

/* ---------- Nav ---------- */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: 68px;
  padding: 0 28px;
  backdrop-filter: blur(24px) saturate(1.8);
  -webkit-backdrop-filter: blur(24px) saturate(1.8);
  background: rgba(6, 5, 4, 0.88);
  border-bottom: 1px solid var(--hairline);
}
.nav-inner {
  max-width: var(--content-w);
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-size: 17px;
  transition: opacity 0.2s;
}
.brand:hover { opacity: 0.72; }
.brand img { width: 26px; height: 26px; }

.nav-links {
  display: flex;
  gap: 40px;
  font-size: 15px;
  font-weight: 500;
  color: var(--bone-dim);
}
.nav-links a {
  position: relative;
  padding-bottom: 2px;
  transition: color 0.22s ease;
}
.nav-links a::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 1.5px;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.26s cubic-bezier(0.4, 0, 0.2, 1);
}
.nav-links a:hover { color: var(--accent); }
.nav-links a:hover::after { width: 100%; }
.nav-links a.active { color: var(--bone); }
.nav-links a.active::after {
  width: 100%;
  background: var(--hairline-2);
}

.nav-cta { padding: 10px 20px; font-size: 14px; }

@media (max-width: 760px) {
  .nav-links { display: none; }
}

/* ---------- Hero ---------- */
.hero {
  min-height: 200vh;
  position: relative;
  padding: 0; /* cancel generic section padding — hero uses sticky scroll */
}
.hero-sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  align-items: center;
  padding-top: 68px;
  padding-bottom: 68px;
  overflow: hidden;
}
@media (max-width: 960px) {
  /* Matches the grid collapse breakpoint — 1-column layout is too tall for sticky */
  .hero { min-height: 100vh; }
  .hero-sticky {
    position: relative;
    height: auto;
    min-height: 100vh;
    padding-top: 120px;
    padding-bottom: 80px;
  }
}
.particle-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
  opacity: 1;
}
.hero-sticky::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 50% at 80% 20%, var(--accent-glow), transparent 60%),
    radial-gradient(ellipse 60% 50% at 10% 90%, rgba(26, 74, 83, 0.07), transparent 60%);
  pointer-events: none;
  z-index: 0;
}
.hero-sticky::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.06 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  opacity: 0.28;
  mix-blend-mode: overlay;
  pointer-events: none;
  z-index: 0;
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 80px;
  align-items: center;
  position: relative;
  z-index: 2;
}
@media (max-width: 960px) {
  .hero-grid { grid-template-columns: 1fr; gap: 56px; }
}

/* ---- Hero scroll-reveal items ---- */
.hero-line-wrap {
  display: block;
  overflow: hidden;
  padding-bottom: 0.1em;
  margin-bottom: -0.1em;
}
.hero-line {
  display: block;
  transform: translateY(110%);
  opacity: 0;
  transition: transform 0.9s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.6s ease;
}
.hero-line.visible {
  transform: translateY(0);
  opacity: 1;
}
.hero-item {
  opacity: 0;
  transition: opacity 0.85s ease;
}
.hero-item.visible {
  opacity: 1;
}
@media (prefers-reduced-motion: reduce) {
  .hero-line, .hero-item { transition: none; }
}

.accent { color: var(--accent); }
.hero h1 .accent { color: var(--accent); }
.hero h1 em { font-family: var(--font-serif); font-style: italic; font-weight: 400; color: var(--bone-dim); }
.hero-sub {
  margin-top: 28px;
  max-width: 520px;
  font-size: 18px;
  line-height: 1.55;
  color: var(--bone-dim);
}
.hero-actions { display: flex; gap: 12px; margin-top: 36px; flex-wrap: wrap; }
.hero-stats {
  margin-top: 56px;
  border-top: 1px solid var(--hairline);
  padding-top: 24px;
}
.hero-stats-title {
  display: block;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--bone-faint);
  margin-bottom: 16px;
}
.hero-meta {
  display: flex;
  gap: 28px;
}
.hero-meta > div { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.hero-meta .num {
  font-size: 32px;
  font-weight: 500;
  letter-spacing: -0.03em;
}
.hero-meta .num .unit {
  font-size: 0.5em;
  font-weight: 400;
  margin-left: 3px;
  letter-spacing: 0;
}
.hero-meta .lbl { font-size: 12px; color: var(--bone-faint); }

/* ---------- Chat demo widget ---------- */
.chat {
  background: var(--surface);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid var(--hairline-2);
  border-radius: var(--r-lg);
  padding: 18px;
  position: relative;
  box-shadow: 0 24px 64px -24px rgba(0,0,0,0.6);
}
.chat-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 16px;
}
.chat-head .title {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px;
}
.chat-head .dot {
  width: 8px; height: 8px;
  background: #4ade80;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(74, 222, 128, 0.14);
  animation: pulse 2.5s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; } 50% { opacity: 0.55; }
}
.chat-tag { font-family: var(--font-mono); font-size: 10px; color: var(--bone-faint); text-transform: uppercase; letter-spacing: 0.12em; }

.chat-body {
  min-height: 240px;
  max-height: 320px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding-right: 4px;
}
.chat-body::-webkit-scrollbar { width: 4px; }
.chat-body::-webkit-scrollbar-thumb { background: var(--hairline-2); border-radius: 4px; }

.msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.45;
  animation: rise 0.35s ease;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.msg.user {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.msg.bot {
  align-self: flex-start;
  background: var(--surface-overlay);
  border: 1px solid var(--hairline);
  border-bottom-left-radius: 4px;
}
.msg.bot .typing { display: inline-flex; gap: 3px; }
.msg.bot .typing span {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--bone-dim);
  animation: blink 1.2s infinite;
}
.msg.bot .typing span:nth-child(2) { animation-delay: 0.2s; }
.msg.bot .typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.2; } 40% { opacity: 1; } }

.chat-form {
  margin-top: 14px;
  display: flex;
  gap: 8px;
  border-top: 1px solid var(--hairline);
  padding-top: 14px;
}
.chat-form input {
  flex: 1;
  background: transparent;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 10px 16px;
  color: var(--bone);
  font-size: 13.5px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s;
}
.chat-form input:focus { border-color: var(--accent); }
.chat-form button {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  transition: filter 0.2s, transform 0.2s;
}
.chat-form button:hover { transform: scale(1.05); filter: brightness(1.07); }

.chat-suggestions {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 12px;
}
.chat-suggestions button {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid var(--hairline-2);
  color: var(--bone-dim);
  transition: all 0.2s;
}
.chat-suggestions button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ---------- Hero → servicios seam ---------- */
/* Soft bridge between the sticky hero and the first content section: a
   fading hairline plus a faint accent glow that continues the hero light. */
#servicios { position: relative; }
#servicios::before {
  content: "";
  position: absolute;
  top: calc(var(--section-y) * -0.65);
  left: 0; right: 0;
  height: calc(var(--section-y) * 1.6);
  background: radial-gradient(ellipse 70% 100% at 50% 0%, var(--accent-glow), transparent 72%);
  pointer-events: none;
  z-index: 0;
}
#servicios::after {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--hairline-2) 30%, var(--hairline-2) 70%, transparent);
  pointer-events: none;
  z-index: 0;
}
#servicios .wrap { position: relative; z-index: 1; }

/* ---------- Section header ---------- */
.section-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 40px;
  margin-bottom: 64px;
  flex-wrap: wrap;
}
.section-header .left { max-width: 720px; }
.section-header h2 { margin-top: 16px; }
.section-header p { margin-top: 18px; max-width: 520px; }

/* ---------- Problem grid ---------- */
.problems {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border-top: 1px solid var(--hairline);
  border-left: 1px solid var(--hairline);
}
@media (max-width: 900px) { .problems { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .problems { grid-template-columns: 1fr; } }
.problem {
  padding: 36px 28px;
  border-right: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 200px;
  position: relative;
  transition: background 0.3s;
}
.problem:hover { background: var(--surface-overlay); }
.problem .num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 0.1em;
}
.problem h3 {
  font-size: 19px;
  font-weight: 500;
  letter-spacing: -0.015em;
}
.problem p { font-size: 13.5px; color: var(--bone-dim); margin-top: auto; }

/* ---------- Services ---------- */
.services {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}
.service {
  display: grid;
  grid-template-columns: 60px 1fr 1.2fr 200px;
  gap: 36px;
  align-items: center;
  padding: 36px 8px;
  border-top: 1px solid var(--hairline);
  position: relative;
  transition: padding 0.4s ease, background 0.3s;
}
.service:last-child { border-bottom: 1px solid var(--hairline); }
.service:hover { padding-left: 24px; padding-right: 24px; background: var(--surface-overlay); }
@media (max-width: 900px) {
  .service { grid-template-columns: 1fr; gap: 14px; }
  .service-num { display: none; }
  .service-cta { justify-self: start; }
}
.service-num {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--bone-faint);
}
.service-title {
  font-size: clamp(1.6rem, 2.4vw, 2.4rem);
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1.05;
}
.service-title em {
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--bone-dim);
  font-weight: 400;
}
.service-desc { color: var(--bone-dim); font-size: 15px; line-height: 1.55; }
.service-cta {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--bone);
  border: 1px solid var(--hairline-2);
  padding: 10px 16px;
  border-radius: 999px;
  transition: all 0.25s;
}
.service:hover .service-cta {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ---------- Metrics ---------- */
.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border-top: 1px solid var(--hairline);
}
@media (max-width: 900px) { .metrics { grid-template-columns: repeat(2, 1fr); } }
.metric {
  padding: 40px 28px;
  border-right: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.metric:last-child { border-right: 1px solid var(--hairline); }
.metric .big {
  font-size: clamp(2.6rem, 5vw, 4.2rem);
  font-weight: 400;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--bone);
  font-family: var(--font-serif);
  font-style: italic;
}
.metric .big .unit {
  font-family: var(--font-sans);
  font-style: normal;
  font-size: 0.55em;
  margin-left: 4px;
  color: var(--accent);
  letter-spacing: -0.02em;
}
.metric .lbl { font-size: 13px; color: var(--bone-dim); line-height: 1.4; max-width: 200px; }
.metric .ctx { font-family: var(--font-mono); font-size: 10px; color: var(--bone-faint); letter-spacing: 0.12em; text-transform: uppercase; }

/* ---------- How it works ---------- */
.how-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}
@media (max-width: 900px) { .how-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .how-grid { grid-template-columns: 1fr; } }
.step {
  border-top: 1px solid var(--hairline-2);
  padding-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.step .step-num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 0.12em;
}
.step h3 { font-size: 19px; font-weight: 500; letter-spacing: -0.015em; }
.step p { font-size: 13.5px; color: var(--bone-dim); }

/* ---------- CTA ---------- */
.cta {
  border-top: 1px solid var(--hairline);
  position: relative;
  overflow: hidden;
}
.cta::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 50% 60% at 50% 100%, var(--accent-soft), transparent 60%);
  pointer-events: none;
}
.cta-inner { position: relative; text-align: center; padding: 32px 0; }
.cta h2 {
  font-size: clamp(2.4rem, 6vw, 5rem);
  font-weight: 400;
  font-family: var(--font-serif);
  font-style: italic;
  line-height: 1;
  letter-spacing: -0.025em;
}
.cta h2 .alt { font-family: var(--font-sans); font-style: normal; color: var(--accent); }
.cta p { margin: 24px auto 36px; max-width: 500px; color: var(--bone-dim); }

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--hairline);
  padding: 64px 0 32px;
}
.foot-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 48px;
  padding-bottom: 48px;
}
@media (max-width: 800px) { .foot-grid { grid-template-columns: 1fr 1fr; } }
.foot-col h4 {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--bone-faint);
  font-weight: 500;
  margin-bottom: 18px;
}
.foot-col a, .foot-col p { display: block; font-size: 14px; color: var(--bone-dim); margin-bottom: 10px; transition: color 0.2s; }
.foot-col a:hover { color: var(--bone); }
.foot-bottom {
  border-top: 1px solid var(--hairline);
  padding-top: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 12px;
  color: var(--bone-faint);
  font-family: var(--font-mono);
}

/* ---------- Reveal ---------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.9s ease, transform 0.9s ease; }
.reveal.in { opacity: 1; transform: none; }
