/* ============================================
   Finaz — C04-A · Valoración Relativa y Múltiplos
   Editorial-analytical design tokens
   ============================================ */

:root {
  /* Type */
  --serif: "Newsreader", "Source Serif 4", Georgia, serif;
  --sans: "IBM Plex Sans", -apple-system, system-ui, sans-serif;
  --mono: "IBM Plex Mono", "JetBrains Mono", ui-monospace, monospace;

  /* Warm cream surface palette */
  --paper: #f3efe5;
  --paper-2: #ece7d8;
  --card: #fbf8f1;
  --card-elev: #ffffff;
  --rule: #d8d2c1;
  --rule-soft: #e6e0d0;

  /* Ink */
  --ink: #161922;
  --ink-2: #3e4452;
  --ink-3: #6b7180;
  --ink-4: #9aa0ad;

  /* Accents — single navy ink */
  --accent: #1d3557;
  --accent-2: #2a4d7a;
  --accent-tint: #e2e6ee;

  /* Signal — muted */
  --green: #3a6a4e;
  --green-tint: #dfe9df;
  --amber: #a06b1d;
  --amber-tint: #f0e4cf;
  --red: #8e3536;
  --red-tint: #ecd9d9;

  /* Premium / tag */
  --gold: #8a6d2c;
  --gold-tint: #ece1be;

  /* Spacing scale */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 64px;
  --s-9: 96px;

  --radius-1: 4px;
  --radius-2: 8px;
  --radius-3: 12px;
  --radius-4: 18px;

  --shadow-sm: 0 1px 0 rgba(22, 25, 34, 0.04), 0 1px 3px rgba(22, 25, 34, 0.04);
  --shadow-md: 0 4px 24px -8px rgba(22, 25, 34, 0.12);
}

/* Dark mode tokens */
.dm-dark {
  --paper: #14161c;
  --paper-2: #1a1d25;
  --card: #1e222b;
  --card-elev: #262a34;
  --rule: #2d313c;
  --rule-soft: #242832;

  --ink: #f1ede2;
  --ink-2: #c2bdaf;
  --ink-3: #8d8a82;
  --ink-4: #5e5d57;

  --accent: #8da9d4;
  --accent-2: #a5bbdf;
  --accent-tint: #243049;

  --green: #7fb094;
  --green-tint: #1f2b25;
  --amber: #d4a85a;
  --amber-tint: #2d2618;
  --red: #c98a8b;
  --red-tint: #2c1d1d;

  --gold: #cba87a;
  --gold-tint: #2a2417;
}

/* Density */
.dm-compact {
  --s-4: 12px;
  --s-5: 18px;
  --s-6: 24px;
  --s-7: 36px;
}

/* Base */
* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  font-feature-settings: "ss01", "ss03";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Typography utilities */
.t-display {
  font-family: var(--serif);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.04;
  font-optical-sizing: auto;
}
.t-serif { font-family: var(--serif); font-optical-sizing: auto; }
.t-mono { font-family: var(--mono); font-feature-settings: "tnum", "zero"; }
.t-eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 500;
}
.t-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 500;
}
.t-num { font-family: var(--mono); font-feature-settings: "tnum"; }

/* Common pieces */
.card {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius-3);
}
.rule { background: var(--rule); height: 1px; width: 100%; border: 0; }
.btn {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-2);
  padding: 10px 16px;
  border: 1px solid var(--rule);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.btn:hover { background: var(--paper-2); }
.btn.primary {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.btn.primary:hover { background: var(--accent); border-color: var(--accent); }
.btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--ink-2);
}
.btn.ghost:hover { background: var(--paper-2); color: var(--ink); }
.btn.small { padding: 6px 10px; font-size: 12px; border-radius: 6px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-family: var(--mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--paper-2);
  color: var(--ink-2);
  border: 1px solid var(--rule);
}
.chip.green { background: var(--green-tint); color: var(--green); border-color: transparent; }
.chip.amber { background: var(--amber-tint); color: var(--amber); border-color: transparent; }
.chip.red { background: var(--red-tint); color: var(--red); border-color: transparent; }
.chip.gold { background: var(--gold-tint); color: var(--gold); border-color: transparent; }
.chip.accent { background: var(--accent-tint); color: var(--accent); border-color: transparent; }

/* Glossary trigger pill */
.gloss-trigger {
  display: inline;
  border-bottom: 1px dotted var(--accent);
  cursor: pointer;
  position: relative;
  color: inherit;
  transition: background 0.12s;
  padding: 0 2px;
}
.gloss-trigger::after {
  content: "i";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-tint);
  color: var(--accent);
  font-family: var(--serif);
  font-style: italic;
  font-size: 10px;
  font-weight: 600;
  margin-left: 4px;
  vertical-align: 1px;
  line-height: 1;
}
.gloss-trigger:hover { background: var(--accent-tint); border-bottom-style: solid; }

/* Inline number callout */
.numcall {
  font-family: var(--mono);
  font-feature-settings: "tnum";
  font-weight: 500;
  color: var(--ink);
}

/* Stepper dots */
.dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--ink-4);
  display: inline-block;
}
.dot.active { background: var(--accent); }
.dot.done { background: var(--green); }

/* Subtle striped placeholder for missing imagery */
.placeholder-stripes {
  background-image: repeating-linear-gradient(
    -45deg,
    var(--rule-soft) 0,
    var(--rule-soft) 1px,
    transparent 1px,
    transparent 10px
  );
  border: 1px dashed var(--rule);
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 16px;
  border-radius: var(--radius-2);
}

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-4); }

/* Selection */
::selection { background: var(--accent-tint); color: var(--accent); }

/* Focus */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Inputs */
input[type="text"], input[type="number"], textarea, select {
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink);
  background: var(--card-elev);
  border: 1px solid var(--rule);
  border-radius: var(--radius-2);
  padding: 10px 12px;
  width: 100%;
  outline: none;
  transition: border-color 0.12s;
}
input[type="number"], .t-mono-input { font-family: var(--mono); font-feature-settings: "tnum"; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); }

/* Tooltip-like popover */
.popover {
  position: absolute;
  background: var(--card-elev);
  border: 1px solid var(--rule);
  border-radius: var(--radius-3);
  box-shadow: var(--shadow-md);
  padding: 16px;
  z-index: 100;
  width: 320px;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}
.anim-in { animation: fadeIn 0.24s ease-out; }
