/* ========== Kalia Code v3 — Bone & Lime ========== */
:root {
  /* Base — oscuros */
  --bg-0: #0B0B0C;
  --bg-1: #141416;
  --bg-2: #1E1E22;
  --surface: #141416;
  --surface-2: #1E1E22;

  /* Base — claros (crema) */
  --bone: #EFECE3;
  --bone-dim: #C8C4B8;
  --bone-2: rgba(239, 236, 227, 0.78);
  --bone-3: rgba(239, 236, 227, 0.55);
  --bone-4: rgba(239, 236, 227, 0.32);

  /* Acento — lima ácido */
  --lime: #C5F03A;
  --lime-glow: #D4FF52;
  --lime-deep: #8FBA1A;

  /* Apoyo — púrpura */
  --plum: #2D0F3C;
  --plum-2: #451A5E;

  /* Líneas */
  --line: rgba(239, 236, 227, 0.10);
  --line-2: rgba(239, 236, 227, 0.20);
  --line-strong: rgba(239, 236, 227, 0.22);
  --line-lime: rgba(197, 240, 58, 0.35);

  /* Neutro extra */
  --muted: #6B6B70;

  /* Aliases retrocompatibles (no romper componentes) */
  --ink: var(--bone);
  --ink-2: var(--bone-2);
  --ink-3: var(--bone-3);
  --ink-4: var(--bone-4);
  --green: var(--lime);
  --green-glow: var(--lime-glow);
  --green-deep: var(--lime-deep);
  --line-green: var(--line-lime);
  --violet: var(--plum);

  --font-sans: 'Alexandria', system-ui, sans-serif;
  --font-serif: 'Instrument Serif', 'Playfair Display', Georgia, serif;
  --font-italic: 'Bricolage Grotesque', 'Alexandria', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  --maxw: 1240px;
  --pad: clamp(24px, 5vw, 72px);
}

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

html, body {
  background: #000;
  color: var(--ink);
  font-family: var(--font-sans);
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  background:
    radial-gradient(1100px 700px at 82% -10%, rgba(69, 26, 94, 0.28), transparent 65%),
    radial-gradient(900px 600px at 0% 90%, rgba(45, 15, 60, 0.18), transparent 70%),
    linear-gradient(180deg, #0B0B0C 0%, #0E0E10 40%, #141416 100%);
  background-attachment: fixed;
  min-height: 100vh;
  cursor: none;
}
@media (max-width: 800px) { body { cursor: auto; } }

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: none; border: none; background: none; color: inherit; }
@media (max-width: 800px) { button { cursor: pointer; } a { cursor: pointer; } }

::selection { background: var(--lime); color: var(--bg-0); }

/* === Global text wrapping & justification ===
   Aplicado a todos los párrafos del sitio: evita líneas huérfanas con una sola
   palabra, justifica el texto (con hifenación automática para que el justify no
   deje huecos enormes), y rompe palabras largas (URLs, emails) antes de que se
   salgan del contenedor. Los headings usan text-wrap: balance para distribuir
   palabras de forma pareja entre líneas. */
html { hyphens: auto; -webkit-hyphens: auto; }
p, li {
  text-wrap: pretty;
  hyphens: auto;
  -webkit-hyphens: auto;
  overflow-wrap: break-word;
  word-wrap: break-word;
  /* Justified body copy with hyphenation — avoids the "one word per line" look */
  text-align: justify;
  text-justify: inter-word;
  hyphenate-limit-chars: 6 3 2;
}
h1, h2, h3, h4, h5, h6, .h-mega, .h-display, .h-section, .h-card {
  text-wrap: balance;
  overflow-wrap: break-word;
}
/* Botones y chips de un solo renglón: no deben envolverse. .mono y .eyebrow
   se usan en etiquetas que pueden ser largas (ej. "PERMISSION LAYER · CLAUDE
   CODE · CODEX · GEMINI") — esas SÍ deben envolverse para no desbordar. */
.pill-green, .chip, .nav-pill, .btn {
  text-align: left;
  hyphens: manual;
  -webkit-hyphens: manual;
  white-space: nowrap;
}
.mono, .eyebrow, .bracket-strip, .section-num {
  text-align: left;
  hyphens: manual;
  -webkit-hyphens: manual;
  /* Permitimos wrap normal pero sin partir palabras con guion */
  overflow-wrap: break-word;
}
/* En pantallas estrechas, dejar text-align: left en párrafos para evitar que el
   justify con poco ancho produzca espacios horribles entre palabras. */
@media (max-width: 720px) {
  p, li { text-align: left; }
}

/* === Type ramp === */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.20em;
  text-transform: uppercase;
  color: var(--green);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 14px;
}
.eyebrow::before {
  content: "";
  width: 28px;
  height: 1px;
  background: var(--green);
  display: inline-block;
}
.eyebrow .num { color: var(--ink-3); }

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

.h-mega {
  font-size: clamp(56px, 11vw, 180px);
  line-height: 0.92;
  font-weight: 600;
  letter-spacing: -0.045em;
}

.h-display {
  font-size: clamp(44px, 7.2vw, 110px);
  line-height: 0.96;
  font-weight: 600;
  letter-spacing: -0.04em;
}

.h-section {
  font-size: clamp(36px, 5vw, 76px);
  line-height: 1.0;
  font-weight: 500;
  letter-spacing: -0.03em;
}

.h-card {
  font-size: clamp(22px, 1.8vw, 30px);
  line-height: 1.15;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.italic-serif {
  font-family: var(--font-italic);
  font-style: italic;
  font-weight: 600;
  letter-spacing: -0.02em;
  padding-right: 0.08em;
}

.green { color: var(--green); }
.muted { color: var(--ink-2); }
.dim   { color: var(--ink-3); }
.mono  { font-family: var(--font-mono); }

/* === Layout === */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--pad); position: relative; }
.section { padding: clamp(48px, 7vw, 100px) 0; position: relative; }

/* === CTA buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 18px 26px;
  border-radius: 999px;
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 14px;
  letter-spacing: 0.01em;
  transition: all 0.25s ease;
  white-space: nowrap;
}
.btn-primary {
  background: var(--lime);
  color: #0B0B0C;
  box-shadow: 0 0 0 1px var(--lime), 0 6px 24px rgba(197, 240, 58, 0.18);
}
.btn-primary:hover {
  background: var(--lime-glow);
  box-shadow: 0 0 0 1px var(--lime-glow), 0 10px 32px rgba(197, 240, 58, 0.32);
  transform: translateY(-2px);
}
.btn-ghost {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line-2);
  color: var(--ink);
  backdrop-filter: blur(10px);
}
.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--ink-3);
  transform: translateY(-1px);
}
.btn .arrow { width: 14px; height: 14px; transition: transform 0.25s; }
.btn:hover .arrow { transform: translateX(4px); }

/* === Chip === */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  border-radius: 999px;
  background: rgba(197, 240, 58, 0.06);
  border: 1px solid var(--line-lime);
  color: var(--lime);
}
.chip .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 10px var(--lime);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.7); }
}

/* === Image / video placeholders === */
.placeholder {
  position: relative;
  width: 100%;
  border-radius: 14px;
  overflow: hidden;
  border: 1px dashed var(--line-2);
  background:
    repeating-linear-gradient(135deg, rgba(255,255,255,0.04) 0 14px, rgba(255,255,255,0.015) 14px 28px);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  transition: border-color 0.25s, background 0.25s;
}
.placeholder:hover {
  border-color: var(--green);
  color: var(--green);
}
.placeholder.green-tint {
  background: repeating-linear-gradient(135deg, rgba(101,206,33,0.10) 0 14px, rgba(101,206,33,0.03) 14px 28px);
}
.placeholder svg { opacity: 0.5; }

/* === Reveal on scroll === */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.9s ease, transform 0.9s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.reveal.is-in { opacity: 1; transform: translateY(0); }

/* === Sticky section number === */
.section-num { display: none !important; }
.section-num--legacy {
  position: absolute;
  top: 60px;
  right: var(--pad);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.20em;
  color: var(--ink-3);
  text-transform: uppercase;
  text-align: right;
}
.section-num span { color: var(--green); }

/* === Editorial section mark — § left-margin === */
.section-mark {
  position: absolute;
  top: clamp(80px, 12vw, 180px);
  left: var(--pad);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--ink-4);
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.section-mark::before {
  content: "";
  display: inline-block;
  width: 22px;
  height: 1px;
  background: currentColor;
}

/* === Bracketed mono strip — boarding-pass meta === */
.bracket-strip {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.bracket-strip .bracket-l,
.bracket-strip .bracket-r { color: var(--ink-4); }
.bracket-strip .live-dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  margin-right: 8px;
  vertical-align: 1px;
  animation: pulse 2s ease-in-out infinite;
}
.bracket-strip .green { color: var(--green); }

/* === Numbered nav links === */
.nav-link-numbered {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  position: relative;
  transition: color 0.2s;
  color: var(--bone-2);
  font-size: 13px;
  padding: 6px 0;
}
.nav-link-numbered .nv-num {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--bone-4);
  font-weight: 400;
  transition: color 0.2s;
}
.nav-link-numbered:hover { color: var(--bone); }
.nav-link-numbered:hover .nv-num { color: var(--lime); }
.nav-link-numbered::after {
  content: ''; position: absolute; left: 0; bottom: 0;
  width: 0; height: 1px; background: var(--lime);
  transition: width 0.25s ease;
}
.nav-link-numbered:hover::after { width: 100%; }

.nav-link-numbered.is-active { color: var(--bone); }
.nav-link-numbered.is-active .nv-num { color: var(--lime); }
.nav-link-numbered.is-active .nv-dot {
  position: absolute;
  bottom: -4px; left: 50%;
  transform: translateX(-50%);
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 8px var(--lime);
}

/* === Nav pills (clickable, no numbers) === */
.nav-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 9px 16px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: -0.005em;
  color: var(--bone-2);
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.nav-pill:hover {
  color: var(--bone);
  background: rgba(239, 236, 227, 0.06);
  border-color: var(--line-2);
  transform: translateY(-1px);
}
.nav-pill.is-active {
  color: var(--lime);
  background: rgba(197, 240, 58, 0.08);
  border-color: rgba(197, 240, 58, 0.28);
}
.nav-pill.is-active:hover {
  background: rgba(197, 240, 58, 0.12);
  border-color: rgba(197, 240, 58, 0.40);
}

@media (max-width: 920px) {
  .nav-links { display: none !important; }
  .nav-cta { display: none !important; }
  .nav-burger { display: inline-flex !important; }
}

/* === Hand-drawn underline SVG accent === */
.accent-underline {
  position: relative;
  display: inline-block;
}
.accent-underline svg {
  position: absolute;
  left: -4%;
  right: -4%;
  bottom: -0.18em;
  width: 108%;
  height: 0.32em;
  pointer-events: none;
  overflow: visible;
}
.accent-underline svg path {
  fill: none;
  stroke: var(--green);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  animation: kc-draw 1.4s cubic-bezier(0.5, 0, 0.2, 1) forwards 0.6s;
}
@keyframes kc-draw {
  to { stroke-dashoffset: 0; }
}

/* === PLUM section variant === */
.section.section-plum {
  background:
    radial-gradient(900px 600px at 90% 0%, rgba(197, 240, 58, 0.06), transparent 60%),
    linear-gradient(180deg, #2D0F3C 0%, #3a1450 100%);
  color: var(--bone);
  isolation: isolate;
  border-top: 1px solid rgba(197, 240, 58, 0.18);
  border-bottom: 1px solid rgba(197, 240, 58, 0.18);
  overflow: hidden;
}
.section-plum::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'><path d='M10 10 L40 10 L65 40 L40 70 L10 70 L35 40 Z' fill='%23C5F03A' opacity='0.4'/></svg>");
  background-size: 80px 80px;
  opacity: 0.06;
}
.section-plum > * { position: relative; z-index: 1; }
.section-plum .h-display,
.section-plum .h-section,
.section-plum .h-card,
.section-plum h1, .section-plum h2, .section-plum h3 { color: var(--bone); }
.section-plum p { color: rgba(239, 236, 227, 0.82); }
.section-plum .italic-serif.green,
.section-plum .green { color: var(--lime); }
.section-plum .eyebrow { color: var(--lime); }
.section-plum .eyebrow::before { background: var(--lime); }
.section-plum .eyebrow .num { color: rgba(239, 236, 227, 0.5); }
.section-plum .section-num { color: rgba(239, 236, 227, 0.5); }
.section-plum .section-num span { color: var(--lime); }
.section-plum .mono.green { color: var(--lime); }
.section-plum .mono.dim { color: rgba(239, 236, 227, 0.5); }
.section.section-light {
  background: var(--bone);
  color: #0B0B0C;
  isolation: isolate;
}
.section-light .h-section,
.section-light .h-display,
.section-light .h-card,
.section-light h1, .section-light h2, .section-light h3 {
  color: #0B0B0C;
}
.section-light .italic-serif { color: #0B0B0C; }
.section-light .italic-serif.green { color: var(--lime-deep); }
.section-light .green { color: var(--lime-deep); }
.section-light .mono.dim,
.section-light .section-mark { color: rgba(11, 11, 12, 0.45); }
.section-light .mono.green { color: var(--lime-deep); }
.section-light p { color: rgba(11, 11, 12, 0.72); }
.section-light .eyebrow { color: var(--lime-deep); }
.section-light .eyebrow::before { background: var(--lime-deep); }
.section-light .eyebrow .num { color: rgba(11, 11, 12, 0.42); }
.section-light .section-num { color: rgba(11, 11, 12, 0.4); }
.section-light .section-num span { color: var(--lime-deep); }
.section-light .row-divider { border-color: rgba(11, 11, 12, 0.12); }

/* === Dark pill (for duration tags / black chips on light bg) === */
.pill-dark {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  border-radius: 999px;
  background: #0B0B0C;
  color: var(--bone);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* === Lime outline pill (for dark sections) === */
.pill-green,
.pill-lime {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(197, 240, 58, 0.08);
  border: 1px solid var(--line-lime);
  color: var(--lime);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* === Footer link === */
.footer-link {
  position: relative;
  transition: color 0.2s;
}
.footer-link:hover { color: var(--lime); }
.outline-watermark {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: clamp(60px, 16vw, 220px);
  line-height: 0.85;
  letter-spacing: -0.055em;
  color: transparent;
  -webkit-text-stroke: 1px rgba(255, 255, 255, 0.14);
  user-select: none;
  pointer-events: none;
  text-align: center;
  width: 100%;
  white-space: nowrap;
}

/* === Twinkle === */
@keyframes twinkle {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 1; }
}

/* === Custom cursor === */
.kc-cursor {
  position: fixed; pointer-events: none; z-index: 9999;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--green);
  transform: translate(-50%, -50%);
  transition: width 0.18s, height 0.18s, opacity 0.2s;
  mix-blend-mode: screen;
}
.kc-cursor-ring {
  position: fixed; pointer-events: none; z-index: 9999;
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid rgba(197, 240, 58, 0.5);
  transform: translate(-50%, -50%);
  transition: width 0.25s, height 0.25s, border-color 0.25s, opacity 0.2s;
}
@media (max-width: 800px) { .kc-cursor, .kc-cursor-ring { display: none; } }

/* === Marquee === */
@keyframes kc-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* === Footer cert row — responsive collapse === */
@media (max-width: 900px) {
  .cert-row { grid-template-columns: repeat(3, 1fr) !important; }
}
@media (max-width: 540px) {
  .cert-row { grid-template-columns: repeat(2, 1fr) !important; }
}

/* === Helper: chevron motif as bg === */
.chevron-strip {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.04;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'><path d='M10 10 L40 10 L65 40 L40 70 L10 70 L35 40 Z' fill='%23ffffff'/></svg>");
  background-size: 80px 80px;
}
