/* ============================================================
   Kakuat — sistema de diseño
   Tres temas: claro, oscuro y automático (sigue al sistema).
   El tema elegido se guarda en localStorage['kakuat-theme'] y
   se aplica como data-mode en <html> antes de pintar.
   ============================================================ */

:root {
  --canvas: #EFEBE0;
  --surface: #FBFAF4;
  --surface-2: #E4DFD1;
  --surface-3: #D9D3C1;
  --ink: #171710;
  --ink-2: #55523F;
  --ink-3: #817D68;
  --line: #DBD5C4;
  --line-strong: #C3BCA5;
  --brand: #0E6B45;
  --brand-2: #0A5236;
  --brand-soft: #DDEAD9;
  --on-brand: #F3F0E8;
  --signal: #AF461C;
  --signal-soft: #F0DBCC;
  --grid: rgba(23, 23, 16, .05);
  color-scheme: light;
}

html[data-mode="dark"],
html[data-mode="auto"].sys-dark {
  --canvas: #0E0F08;
  --surface: #16180F;
  --surface-2: #20241A;
  --surface-3: #2A2F21;
  --ink: #ECEADB;
  --ink-2: #A5A48E;
  --ink-3: #77765F;
  --line: #282C1D;
  --line-strong: #3A3F2C;
  --brand: #59C88D;
  --brand-2: #84DAAB;
  --brand-soft: #152720;
  --on-brand: #08130D;
  --signal: #E58C57;
  --signal-soft: #2C1E12;
  --grid: rgba(236, 234, 219, .05);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--canvas);
}

body {
  color: var(--ink);
  font-family: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background .35s ease, color .35s ease;
}

::selection { background: #0E6B45; color: #F3F0E8; }

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-2); }

button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}

@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: .15; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* --- tipografía --- */
.display { font-family: 'Archivo', sans-serif; letter-spacing: -.03em; }
.mono { font-family: 'IBM Plex Mono', monospace; }

h1, h2, h3 { font-family: 'Archivo', sans-serif; letter-spacing: -.03em; }

.eyebrow {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12.5px;
  letter-spacing: .14em;
  color: var(--brand);
  text-transform: uppercase;
}

/* --- layout --- */
.wrap { max-width: 1240px; margin: 0 auto; }
.section { padding: clamp(56px, 7vw, 110px) clamp(18px, 5vw, 72px); }
.section--band {
  background: var(--surface);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.grid12 {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: clamp(28px, 4vw, 56px);
}
.cols3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }

/* --- header --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
  background: color-mix(in srgb, var(--canvas) 82%, transparent);
  border-bottom: 1px solid var(--line);
}
.site-header .bar {
  max-width: 1240px;
  margin: 0 auto;
  padding: 14px clamp(18px, 5vw, 72px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand { display: flex; align-items: center; gap: 9px; color: var(--ink); }
.brand:hover { color: var(--ink); }
.brand .dot {
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-soft);
}
.brand .name {
  font-family: 'Archivo', sans-serif;
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -.02em;
}

/* --- selector de tema --- */
.theme {
  display: flex;
  padding: 3px;
  gap: 2px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.theme button {
  border: none;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  height: 28px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  transition: .2s;
}
.theme button[data-seg="light"], .theme button[data-seg="dark"] { width: 32px; }
.theme button[data-seg="auto"] {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  padding: 0 9px;
}
html[data-mode="light"] .theme [data-seg="light"],
html[data-mode="dark"] .theme [data-seg="dark"],
html[data-mode="auto"] .theme [data-seg="auto"] {
  background: var(--ink);
  color: var(--canvas);
}

/* --- botones --- */
.btn {
  font-family: 'IBM Plex Sans', sans-serif;
  font-weight: 600;
  background: var(--brand);
  color: var(--on-brand);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: .2s;
  display: inline-block;
}
.btn:hover { background: var(--brand-2); color: var(--on-brand); }
.btn--sm { font-size: 15px; padding: 9px 18px; white-space: nowrap; }
.btn--lg { font-size: 17px; padding: 15px 30px; box-shadow: 0 10px 30px -12px var(--brand); }

/* --- chips de ley --- */
.chip {
  display: inline-flex;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: var(--brand);
  background: var(--brand-soft);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 4px 10px;
}
.chip--mute { color: var(--ink-2); background: var(--surface-2); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }

/* --- tarjetas --- */
.card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px 26px 30px;
  background: var(--surface);
}
.panel {
  background: var(--canvas);
  border: 1px solid var(--line-strong);
  border-radius: 16px;
}

/* --- rejilla de fondo --- */
.gridbg {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(circle at 70% 20%, #000, transparent 78%);
  pointer-events: none;
}

/* --- hero --- */
.hero { position: relative; padding: clamp(64px, 9vw, 132px) clamp(18px, 5vw, 72px) clamp(48px, 7vw, 96px); overflow: hidden; }
.hero h1 { font-weight: 900; line-height: .94; font-size: clamp(46px, 7.4vw, 104px); margin: 0 0 24px; }
.hero .lede { font-size: clamp(17px, 1.5vw, 21px); line-height: 1.55; color: var(--ink-2); max-width: 34ch; margin: 0 0 34px; }
.hero .lede strong { color: var(--ink); font-weight: 600; }
.hero .lede em { font-style: normal; color: var(--ink); }

/* --- ledger del hero --- */
.ledger {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  box-shadow: 0 40px 80px -50px rgba(0, 0, 0, .5);
  overflow: hidden;
}
.ledger .head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.ledger .row {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 11px 18px;
  border-bottom: 1px dashed var(--line);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13.5px;
}
.ledger .row.alert { background: var(--signal-soft); border-bottom: none; }
.ledger .row.alert span:nth-child(2) { color: var(--signal); font-weight: 600; }
.ledger .foot {
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--ink-3);
}

/* --- diferenciadores --- */
.diff {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: clamp(24px, 3vw, 52px);
  align-items: center;
  padding: clamp(28px, 3vw, 44px) 0;
  border-top: 1px solid var(--line);
}
.diff > * { grid-column: span 6; min-width: 0; }
.diff .num {
  font-family: 'Archivo', sans-serif;
  font-weight: 900;
  font-size: clamp(34px, 4vw, 54px);
  color: var(--line-strong);
  line-height: 1;
}
.diff h3 { font-weight: 800; font-size: clamp(22px, 2.3vw, 30px); letter-spacing: -.02em; margin: 0; }
.diff .title { display: flex; align-items: baseline; gap: 16px; margin-bottom: 14px; }
.diff p { font-size: 16.5px; color: var(--ink-2); margin: 0 0 16px; }

/* --- demo del tope legal --- */
.clamp-field {
  display: flex;
  align-items: stretch;
  border: 1.5px solid var(--line-strong);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface);
  transition: border-color .2s;
}
.clamp-field.over { border-color: var(--signal); }
.clamp-field input {
  flex: 1; min-width: 0;
  border: none; background: transparent;
  color: var(--ink);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 26px; font-weight: 600;
  padding: 14px 16px;
  outline: none;
}
.clamp-field .unit {
  display: grid; place-items: center;
  padding: 0 16px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  color: var(--ink-3);
  border-left: 1px solid var(--line);
}
.clamp-msg {
  margin-top: 14px;
  display: flex; align-items: center; gap: 10px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  min-height: 20px;
  color: var(--brand);
}
.clamp-msg .led { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.clamp-msg.over { color: var(--signal); }
.clamp-msg.empty { color: var(--ink-3); }

/* --- FAQ --- */
.faq { border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 22px 0;
  cursor: pointer;
  font-weight: 600;
  font-size: clamp(17px, 1.7vw, 20px);
  list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary .sign {
  flex: none;
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  display: grid; place-items: center;
  font-family: 'IBM Plex Mono', monospace;
  color: var(--brand);
}
.faq summary .sign::after { content: '+'; }
.faq details[open] summary .sign::after { content: '–'; }
.faq details p { margin: 0; padding: 0 0 24px; font-size: 16.5px; color: var(--ink-2); max-width: 70ch; }

/* --- lista de espera --- */
.waitlist { background: var(--brand); color: var(--on-brand); }
.waitlist a { color: var(--on-brand); }
.waitlist .eyebrow { color: inherit; opacity: .75; }
.waitlist h2 { font-weight: 900; line-height: 1; font-size: clamp(34px, 4.6vw, 60px); margin: 0 0 16px; }
.waitlist label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  letter-spacing: .06em;
  text-transform: uppercase;
  opacity: .8;
}
.waitlist input, .waitlist select {
  width: 100%;
  background: color-mix(in srgb, var(--on-brand) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--on-brand) 28%, transparent);
  border-radius: 11px;
  padding: 14px 16px;
  color: var(--on-brand);
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 16px;
  outline: none;
  appearance: none;
}
.waitlist select option { color: #111; }
.waitlist input::placeholder { color: color-mix(in srgb, var(--on-brand) 55%, transparent); }
.waitlist .submit {
  justify-self: start;
  margin-top: 6px;
  background: var(--on-brand);
  color: var(--brand);
  border: none;
  font-weight: 700;
  font-size: 17px;
  padding: 15px 32px;
  border-radius: 999px;
  cursor: pointer;
  transition: .2s;
}
.waitlist .submit:disabled { opacity: .6; cursor: progress; }
.waitlist .done {
  background: color-mix(in srgb, var(--on-brand) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--on-brand) 30%, transparent);
  border-radius: 16px;
  padding: 36px 32px;
}
.waitlist .error {
  font-size: 14.5px;
  color: var(--on-brand);
  background: color-mix(in srgb, #000 22%, transparent);
  border-radius: 10px;
  padding: 10px 14px;
}

/* --- responsive --- */
@media (max-width: 900px) {
  .grid12 > *, .diff > * { grid-column: span 12 !important; }
  .cols3 { grid-template-columns: 1fr; }
  /* en móvil el texto va siempre antes que su ilustración */
  .diff > .diff-visual { order: 2; }
  .diff > .diff-copy { order: 1; }
  .hero .lede { max-width: none; }
}
