/* ═══════════════════════════════════════════════════════════════════════════
   Henkia · tema para Langfuse
   Se inyecta al final de <body>, por lo que sobrescribe la hoja de estilos de
   Langfuse sin modificar su imagen de contenedor.

   Paleta oficial (Manual de marca V.1 — 04_COLOR):
     Verde darker    #00170C   hsl(151 100%  4.5%)   fondos / degradado dark
     Cielo           #B5FDFF   hsl(182 100% 85.5%)   fondos / acentos light
     Blanco          #FFFFFF                          acentos
     Verde dark      #112F24   hsl(158  47% 12.5%)   texto/elementos sobre blanco
     Verde medio     #09B17B   hsl(161  90% 36.5%)   acento, degradado dark
     Verde light     #00BC52   hsl(146 100% 36.9%)   degradado light
     Cielo medio     #9DD8FF   hsl(204 100% 80.8%)   degradado dark

   Langfuse define sus colores como tripletas HSL sin la funcion hsl(), que
   luego consume como hsl(var(--token)). Aqui se respeta ese formato.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Tipografias de marca ─────────────────────────────────────────────────── */
/* Cuerpo de texto: Sora (Manual de marca — 07_TIPOGRAFIAS, <P>) */
@font-face {
  font-family: "Sora";
  src: url("/henkia/fonts/Sora-Variable.ttf") format("truetype");
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}
/* Titulares: Darker Grotesque (Manual de marca — 07_TIPOGRAFIAS, <h1>) */
@font-face {
  font-family: "Darker Grotesque";
  src: url("/henkia/fonts/DarkerGrotesque-Variable.ttf") format("truetype");
  font-weight: 300 900;
  font-style: normal;
  font-display: swap;
}

:root,
html:root {
  --henkia-font-sans: "Sora", ui-sans-serif, system-ui, sans-serif,
    "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  --henkia-font-display: "Darker Grotesque", "Sora", ui-sans-serif, system-ui, sans-serif;
  --font-sans: var(--henkia-font-sans);

  /* Colores de marca disponibles como variables sueltas para reutilizar. */
  --henkia-verde-darker: #00170c;
  --henkia-cielo: #b5fdff;
  --henkia-verde-dark: #112f24;
  --henkia-verde-medio: #09b17b;
  --henkia-verde-light: #00bc52;
  --henkia-cielo-medio: #9dd8ff;
  --henkia-degradado-dark: linear-gradient(135deg, #00170c 0%, #09b17b 62%, #9dd8ff 100%);
  --henkia-degradado-light: linear-gradient(135deg, #00bc52 0%, #b5fdff 100%);
}

html,
body {
  font-family: var(--henkia-font-sans);
}

/* Titulares de pagina con la tipografia display de marca. Darker Grotesque
   tiene una caja tipografica pequena: se compensa el tamano y el interlineado.
   Se limita a h1 para no alterar la densidad del resto de la interfaz. */
h1,
[data-henkia-display] {
  font-family: var(--henkia-font-display);
  font-weight: 500;
  letter-spacing: 0.005em;
  font-size: 1.12em;
  line-height: 1.15;
}

/* ═══ Tema claro ═══════════════════════════════════════════════════════════ */
html:root {
  --background: 0 0% 100%;
  --foreground: 158 47% 12.5%;          /* Verde dark */
  --muted: 160 25% 96%;
  --muted-foreground: 158 12% 42%;
  --foreground-tertiary: 158 10% 58%;
  --surface-code: 160 22% 94%;
  --surface-code-header: 160 20% 89%;

  --popover: 0 0% 100%;
  --card: 0 0% 100%;
  --modal: 0 0% 100%;
  --header: 160 30% 98%;

  --border: 158 20% 89%;
  --border-contrast: 158 18% 78%;
  --input: 158 20% 89%;

  --primary: 158 47% 12.5%;             /* Verde dark */
  --primary-foreground: 0 0% 100%;
  --secondary: 160 25% 96%;
  --secondary-foreground: 158 47% 12.5%;
  --tertiary: 158 22% 90%;
  --tertiary-foreground: 158 47% 12.5%;
  --accent: 165 40% 95%;
  --accent-foreground: 158 30% 26%;

  --ring: 161 90% 36.5%;                /* Verde medio */
  --primary-accent: 161 90% 36.5%;      /* Verde medio */
  --link: 161 90% 30%;
  --link-hover: 158 90% 21%;

  --control-fill: 158 47% 12.5%;
  --control-track: 158 20% 89%;
  --control-border: 158 15% 60%;

  --muted-green: 161 90% 36.5%;
  --accent-light-green: 163 60% 95%;
  --accent-dark-green: 161 90% 29%;

  --sidebar-background: 160 33% 98%;
  --sidebar-foreground: 158 15% 32%;
  --sidebar-primary: 158 47% 12.5%;
  --sidebar-primary-foreground: 0 0% 100%;
  --sidebar-accent: 163 42% 93%;
  --sidebar-accent-foreground: 158 47% 14%;
  --sidebar-border: 158 20% 89%;
  --sidebar-ring: 161 90% 36.5%;

  /* Graficas: la serie principal usa el verde de marca y la segunda el cielo
     medio. El resto conserva la paleta de Langfuse para que las categorias
     sigan siendo distinguibles entre si. */
  --chart-1: 161 90% 37%;
  --chart-2: 204 80% 52%;
}

/* ═══ Tema oscuro ══════════════════════════════════════════════════════════ */
/* Mayor especificidad que el bloque claro para ganar siempre que exista .dark */
html:root.dark {
  --background: 151 100% 4.5%;          /* Verde darker */
  --foreground: 170 15% 80%;
  --muted: 155 45% 9%;
  --muted-foreground: 165 12% 58%;
  --foreground-tertiary: 160 10% 45%;
  --surface-code: 152 60% 3%;
  --surface-code-header: 155 45% 8%;

  --popover: 156 42% 9.5%;
  --card: 154 50% 7%;
  --modal: 156 42% 9%;
  --header: 152 70% 3%;

  --border: 156 30% 15%;
  --border-contrast: 158 25% 27%;
  --input: 156 28% 18%;

  --primary: 182 100% 85.5%;            /* Cielo */
  --primary-foreground: 151 100% 4.5%;
  --secondary: 155 45% 11%;
  --secondary-foreground: 175 20% 86%;
  --tertiary: 156 35% 16%;
  --tertiary-foreground: 175 20% 86%;
  --accent: 156 35% 18%;
  --accent-foreground: 182 60% 91%;

  --ring: 182 100% 85.5%;
  --primary-accent: 182 100% 85.5%;     /* Cielo */
  --link: 182 100% 82%;
  --link-hover: 182 100% 92%;

  --control-fill: 182 80% 80%;
  --control-track: 156 30% 22%;
  --control-border: 158 25% 27%;

  --muted-green: 161 70% 60%;
  --accent-light-green: 155 40% 10%;
  --accent-dark-green: 161 70% 56%;

  --sidebar-background: 152 90% 3.2%;
  --sidebar-foreground: 165 12% 62%;
  --sidebar-primary: 182 100% 85.5%;
  --sidebar-primary-foreground: 151 100% 4.5%;
  --sidebar-accent: 155 45% 10%;
  --sidebar-accent-foreground: 182 60% 92%;
  --sidebar-border: 156 30% 13%;
  --sidebar-ring: 182 100% 85.5%;

  --chart-1: 161 75% 52%;
  --chart-2: 204 100% 74%;              /* Cielo medio */
}

/* ── Logotipo ─────────────────────────────────────────────────────────────── */
/* Langfuse dimensiona su wordmark con `max-w-22`/`max-w-24`, medidas atadas a
   la proporcion de su logotipo (4.3:1). El imagotipo de Henkia es mas apaisado
   (7.9:1), asi que se libera el ancho para que no se deforme. */
img[src$="/wordart-black.svg"],
img[src$="/wordart-white.svg"],
img[alt="Langfuse Logo"] {
  max-width: none !important;
  width: auto !important;
  height: 1.15rem;
}

/* ── Pantalla de acceso ───────────────────────────────────────────────────── */
/* theme.js marca la ruta en <html data-henkia-route="auth">.
   El contenedor raiz de Langfuse pinta `bg-primary-foreground` a pantalla
   completa, asi que el degradado va ahi y no en <body>. El velo blanco/oscuro
   por encima mantiene el degradado de marca reconocible sin comprometer la
   legibilidad del texto que queda fuera de la tarjeta. */
html[data-henkia-route="auth"] #__next > div {
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.93) 0%, rgba(255, 255, 255, 0.7) 100%),
    var(--henkia-degradado-light);
  background-attachment: fixed;
}
html[data-henkia-route="auth"].dark #__next > div {
  background-image: linear-gradient(180deg, rgba(0, 23, 12, 0.9) 0%, rgba(0, 23, 12, 0.8) 100%),
    var(--henkia-degradado-dark);
}

/* Isotipo de la pantalla de acceso, a mayor tamano. Se selecciona por `src`
   porque theme.js reescribe el atributo `alt`. */
html[data-henkia-route="auth"] img[src$="/icon.svg"] {
  width: 3.25rem;
  height: auto;
}

/* ── Detalles ─────────────────────────────────────────────────────────────── */
/* Barra de desplazamiento en tono de marca. */
* {
  scrollbar-color: hsl(var(--border-contrast)) transparent;
}

/* ── Tokens de aviso/banner ───────────────────────────────────────────────── */
/* Langfuse pinta sus avisos con la escala azul. Se pasan a la escala de marca
   para que no compitan con el verde Henkia. */
html:root {
  --preview-banner: 176 60% 93%;
  --preview-banner-foreground: 158 47% 16%;
  --preview-banner-border: 172 45% 82%;
  --preview-banner-link: 161 90% 30%;
  --preview-banner-link-hover: 158 90% 21%;
}
html:root.dark {
  --preview-banner: 158 45% 11%;
  --preview-banner-foreground: 170 15% 80%;
  --preview-banner-border: 158 30% 22%;
  --preview-banner-link: 182 100% 82%;
  --preview-banner-link-hover: 182 100% 92%;
}
/* Los avisos informativos usan las utilidades `bg-light-blue`/`border-light-blue`
   directamente, sin pasar por un token propio. */
.bg-light-blue.border-light-blue {
  background-color: hsl(176 60% 94%);
  border-color: hsl(172 45% 82%);
}
html:root.dark .bg-light-blue.border-light-blue {
  background-color: hsl(158 45% 10%);
  border-color: hsl(158 30% 20%);
}

/* ── Promocion de Langfuse en la barra lateral ────────────────────────────── */
/* Instancia privada de Henkia: se ocultan las llamadas comerciales de Langfuse.
   La tarjeta de GitHub ademas carga una imagen desde img.shields.io, es decir,
   una peticion del navegador a un tercero.
   Para recuperarlas, basta con borrar este bloque y reconstruir el proxy.
   Los enlaces a la documentacion de Langfuse se conservan: apuntan al producto
   real y siguen siendo utiles. */
.bg-card.max-h-60:has(a[href^="https://github.com/langfuse/langfuse"]) {
  display: none;
}
[data-sidebar="menu-item"]:has(a[href*="cal.com/team/langfuse"]),
a[href*="cal.com/team/langfuse"] {
  display: none;
}
