@import url('https://fonts.googleapis.com/css2?family=Geist:wght@300;400;500;600;700&family=Geist+Mono:wght@400;500&display=swap');

@font-face { font-family: "SF Pro Display"; src: url("fonts/SFPro-Regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "SF Pro Display"; src: url("fonts/SFPro-Medium.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "SF Pro Display"; src: url("fonts/SFPro-Bold.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "SF Pro Display"; src: url("fonts/SFPro-Bold.woff2") format("woff2"); font-weight: 900; font-style: normal; font-display: swap; }
@font-face { font-family: "SF Pro Display"; src: url("fonts/SFPro-HeavyItalic.woff2") format("woff2"); font-weight: 900; font-style: italic; font-display: swap; }

:root {
  --ink: #000;
  --ink-muted: rgba(0,0,0,0.7);
  --ink-subtle: rgba(0,0,0,0.5);
  --ink-quiet: rgba(0,0,0,0.25);
  --ink-hairline: rgba(0,0,0,0.12);
  --paper: #fff;
  --paper-tint: oklch(0.985 0.004 85);
  --paper-sink: oklch(0.965 0.005 85);
  --font-sans: "Geist", ui-sans-serif, system-ui, sans-serif;
  --font-display: "SF Pro Display", -apple-system, "Geist", system-ui, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, monospace;

  /* Candidate palette — used ONLY in chart strokes (data viz), never chrome. */
  --c1: #7B1818;
  --c2: #A52929;
  --c3: #C53E3E;
  --c4: #5C1010;
  --c5: #D45A5A;
  --c6: #8E3535;
  --gris: #7F7F7F;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  background: var(--paper); color: var(--ink); font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
input, textarea, select { font-family: inherit; color: inherit; }
img, svg { display: block; }

/* — TYPE — */
.display { font-family: var(--font-display); font-weight: 900; text-transform: uppercase; letter-spacing: -0.04em; }
.display-xl { font-size: 77px; line-height: 0.95; letter-spacing: -3.08px; }
.display-lg { font-size: 60px; line-height: 0.95; letter-spacing: -2.4px; }
.display-md { font-size: 50px; line-height: 0.98; letter-spacing: -2px; }
.display-sm { font-size: 36px; line-height: 1;    letter-spacing: -1.44px; }
.display-xs { font-size: 24px; line-height: 1;    letter-spacing: -0.96px; }

.title-xl { font-weight: 500; font-size: 50px; line-height: 1;    letter-spacing: -2px; text-transform: capitalize; }
.title-lg { font-weight: 500; font-size: 36px; line-height: 1.15; letter-spacing: -1.44px; text-transform: capitalize; }
.title-md { font-weight: 500; font-size: 24px; line-height: 1.05; letter-spacing: -0.96px; }
.title-sm { font-weight: 500; font-size: 18px; line-height: 1.1;  letter-spacing: -0.72px; }
.title-xs { font-weight: 500; font-size: 14px; line-height: 1.15; letter-spacing: -0.42px; }

.body-md  { font-weight: 500; font-size: 16px; line-height: 1.5;  letter-spacing: -0.32px; }
.body-sm  { font-weight: 500; font-size: 14px; line-height: 1.5;  letter-spacing: -0.28px; }
.meta     { font-weight: 500; font-size: 12px; line-height: 1.3;  letter-spacing: 0.02em; }
.mono     { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0; }
.mono-sm  { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0; }

.tabular  { font-variant-numeric: tabular-nums; }

/* — RULES — */
.rule    { height: 0; border: 0; border-top: 2px solid var(--ink); }
.hairline{ height: 0; border: 0; border-top: 1px solid var(--ink-hairline); }

/* — BUTTONS / PILLS — */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; padding: 0 20px; border: 2px solid var(--ink); border-radius: 10px;
  background: transparent; color: var(--ink); font-weight: 500; font-size: 18px; letter-spacing: -0.72px;
  transition: background 0.25s ease, color 0.25s ease, opacity 0.25s ease;
  white-space: nowrap;
}
.btn:hover { background: var(--ink); color: var(--paper); }
.btn.solid { background: var(--ink); color: var(--paper); }
.btn.solid:hover { background: var(--paper); color: var(--ink); }
.btn.sm { height: 36px; padding: 0 14px; font-size: 14px; letter-spacing: -0.42px; gap: 6px; border-width: 1.5px; border-radius: 8px; }
.btn.xs { height: 28px; padding: 0 10px; font-size: 12px; letter-spacing: -0.24px; gap: 4px; border-width: 1px; border-radius: 6px; }
.btn[disabled] { opacity: 0.35; cursor: not-allowed; }
.btn[disabled]:hover { background: transparent; color: var(--ink); }

.pill {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 16px; border: 1.5px solid var(--ink); border-radius: 9999px;
  background: transparent; color: var(--ink); font-weight: 500; font-size: 14px; letter-spacing: -0.42px;
  transition: background 0.2s ease, color 0.2s ease;
  white-space: nowrap;
}
.pill:hover:not(.is-active) { background: rgba(0,0,0,0.05); }
.pill.is-active { background: var(--ink); color: var(--paper); }

.link { transition: opacity 0.4s ease; cursor: pointer; }
.link:hover { opacity: 0.6; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border: 1.5px solid var(--ink); border-radius: 8px;
  background: transparent; color: var(--ink); transition: background 0.2s, color 0.2s;
}
.icon-btn:hover { background: var(--ink); color: var(--paper); }
.icon-btn.bare { border: 0; }
.icon-btn.bare:hover { background: transparent; opacity: 0.6; }

/* — INPUTS — */
.input {
  width: 100%; height: 44px; padding: 0 12px;
  border: 0; border-bottom: 1.5px solid var(--ink); background: transparent;
  font-weight: 500; font-size: 16px; letter-spacing: -0.32px; color: var(--ink);
  outline: none;
}
.input::placeholder { color: var(--ink-quiet); }
.input:focus { border-bottom-color: var(--ink); }
.input.boxed {
  border: 1.5px solid var(--ink); border-radius: 8px; padding: 0 14px;
}
.input.boxed:focus { outline: 2px solid var(--ink); outline-offset: 2px; }

textarea.input { height: auto; min-height: 88px; padding: 12px; resize: vertical; line-height: 1.4; }

/* — TABS — */
.tab-bar { display: flex; gap: 0; border-bottom: 2px solid var(--ink); }
.tab {
  position: relative; padding: 14px 22px 14px 0; margin-right: 28px;
  font-weight: 500; font-size: 18px; letter-spacing: -0.72px; color: var(--ink-subtle);
  text-transform: capitalize; cursor: pointer; transition: color 0.2s;
}
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--ink); }
.tab.is-active::after {
  content: ""; position: absolute; left: 0; right: 22px; bottom: -2px; height: 4px; background: var(--ink);
}

/* — KBD — */
.kbd {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0;
  border: 1px solid var(--ink-hairline); padding: 1px 5px; border-radius: 3px;
  background: var(--paper-tint); color: var(--ink-muted);
}

/* — SCRIM / PHOTO PLACEHOLDER for chart card backs — */
.surface-tint { background: var(--paper-tint); }
.surface-sink { background: var(--paper-sink); }

/* — Edit-mode focus ring — */
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* — Reveals — */
@keyframes reveal-up { from { opacity: 0; transform: translateY(14px);} to { opacity: 1; transform: translateY(0);} }
.reveal-up { animation: reveal-up 0.5s cubic-bezier(0.16,0.7,0.2,1) both; }
@keyframes rule-sweep { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.rule-sweep { transform-origin: left center; animation: rule-sweep 0.6s cubic-bezier(0.65,0,0.35,1) both; }

@media (prefers-reduced-motion: reduce) {
  .reveal-up, .rule-sweep { animation: none !important; transform: none !important; opacity: 1 !important; }
}

/* — Scrollbar genérico — */
.scroll::-webkit-scrollbar { width: 10px; height: 10px; }
.scroll::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.18); border-radius: 0; }
.scroll::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.35); }
.scroll::-webkit-scrollbar-track { background: transparent; }

/* — Sidebar Apariencia (embed settings) — scrollbar refinado overlay-style — */
.appearance-sidebar {
  scroll-behavior: smooth;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,0.20) transparent;
}
.appearance-sidebar::-webkit-scrollbar { width: 6px; height: 6px; }
.appearance-sidebar::-webkit-scrollbar-track { background: transparent; }
.appearance-sidebar::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.16);
  border-radius: 3px;
  transition: background 0.2s ease;
}
.appearance-sidebar::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.42); }
.appearance-sidebar::-webkit-scrollbar-corner { background: transparent; }

/* Fade superior/inferior cuando hay overflow — máscara CSS sutil. */
.appearance-sidebar.has-overflow-top  { mask-image: linear-gradient(to bottom, transparent 0, black 24px); }
.appearance-sidebar.has-overflow-bot  { mask-image: linear-gradient(to top, transparent 0, black 24px); }
.appearance-sidebar.has-overflow-both { mask-image: linear-gradient(to bottom, transparent 0, black 24px, black calc(100% - 24px), transparent 100%); }

/* — Data-grid (Datos tab) — */
.dg { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.dg thead th {
  text-align: right; padding: 12px 14px 12px 14px;
  font-family: var(--font-mono); font-size: 11px; font-weight: 500;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-muted);
  border-bottom: 2px solid var(--ink);
  white-space: nowrap;
  background: var(--paper);
  position: sticky; top: 0;
}
.dg thead th.lead { text-align: left; padding-left: 0; }
.dg tbody td {
  padding: 0; border-bottom: 1px solid var(--ink-hairline);
  height: 44px; vertical-align: middle;
  font-weight: 500; font-size: 16px; letter-spacing: -0.32px;
}
.dg tbody td input {
  width: 100%; height: 44px; padding: 0 14px; text-align: right; border: 0; background: transparent;
  font: inherit; letter-spacing: inherit; color: var(--ink); outline: none;
  font-variant-numeric: tabular-nums;
}
.dg tbody td input:focus { background: var(--paper-tint); box-shadow: inset 0 0 0 1.5px var(--ink); }
.dg tbody td.lead { padding-left: 0; font-weight: 500; }
.dg tbody td.empty input { color: var(--ink-quiet); }
.dg tbody tr:hover td { background: rgba(0,0,0,0.02); }
.dg tbody tr:hover td.lead { background: transparent; }
.dg .swatch {
  display: inline-block; width: 10px; height: 10px; border-radius: 9999px;
  margin-right: 10px; vertical-align: -1px;
}

/* — Stat chip — */
.chip-stat {
  display: inline-flex; align-items: baseline; gap: 4px;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0;
  color: var(--ink-muted);
}
.chip-stat strong { font-family: var(--font-sans); font-size: 14px; font-weight: 500; color: var(--ink); letter-spacing: -0.28px; }

/* — Marquee — */
.marquee-mask { mask-image: linear-gradient(to right, transparent 0%, black 6%, black 94%, transparent 100%); -webkit-mask-image: linear-gradient(to right, transparent 0%, black 6%, black 94%, transparent 100%); }
@keyframes marquee { from { transform: translateX(0);} to { transform: translateX(-50%);} }
.animate-marquee { animation: marquee 40s linear infinite; }
