/* pixan.ai · estilos del sitio. Solo los cargan las páginas del sitio (no /genAI).
   Se sirve tal cual, sin compilar.

   Página blanca y tipográfica: sin sombras, degradados ni modo oscuro. Los dos
   colores del logotipo (índigo y coral) se usan con medida.

   Lo animado es un extra: sin soporte del navegador, o con las animaciones
   desactivadas, la página se ve igual y quieta. */

/* Geist y Geist Mono (SIL Open Font License, ver /fonts/LICENSE.txt), servidas desde el sitio. */
@font-face {
  font-family: 'Geist';
  src: url('/fonts/Geist-Variable.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: 'Geist Mono';
  src: url('/fonts/GeistMono-Variable.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

/* El retraso de cada archivo al escribirse en la portada: se calcula en el
   archivo y lo heredan sus barras. */
@property --file-delay {
  syntax: '<time>';
  inherits: true;
  initial-value: 0ms;
}
/* Por dónde va el mensaje en el recorrido de agent-kernel: de 0 a 4. */
@property --p {
  syntax: '<number>';
  inherits: true;
  initial-value: 0;
}

/* Transición entre páginas sin JavaScript: el navegador funde un documento con el siguiente. */
@view-transition {
  navigation: auto;
}

:root:has(.site) {
  color-scheme: light;
  --paper: #ffffff;
  --wash: #f7f6fa;
  --ink: #141419;
  --muted: #61616e;
  --line: #e6e4ec;
  --indigo: #28106a;
  --coral: #d34c54;
  /* El coral del logotipo no alcanza contraste AA en texto pequeño; este tono sí (4.9 a 1). */
  --coral-text: #c8404a;
  --sans: 'Geist', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'SF Mono', 'Cascadia Code', Menlo, Consolas, monospace;
  background: var(--paper);
  scroll-padding-top: 5rem;
}

body:has(.site) {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  overflow-x: clip;
}

.site {
  max-width: 66rem;
  margin: 0 auto;
  padding: 0 1.25rem;

  a {
    color: var(--indigo);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-decoration-color: color-mix(in srgb, var(--indigo) 30%, transparent);
    text-underline-offset: 0.22em;
    transition: text-decoration-color 0.2s;
  }
  a:hover {
    text-decoration-color: var(--indigo);
  }
  :focus-visible {
    outline: 2px solid var(--coral);
    outline-offset: 3px;
    border-radius: 2px;
  }

  h1,
  h2,
  h3 {
    text-wrap: balance;
    line-height: 1.1;
    letter-spacing: -0.022em;
    font-weight: 700;
  }
  h1 {
    font-size: clamp(2.3rem, 6vw, 4.25rem);
    /* Recorta el aire sobre las mayúsculas y bajo la línea base: el título alinea con lo que lo rodea. */
    text-box: trim-both cap alphabetic;
  }
  h2 {
    font-size: clamp(1.5rem, 3vw, 2rem);
    margin-bottom: 1.25rem;
  }
  h3 {
    font-size: 1.1rem;
    font-weight: 650;
    letter-spacing: -0.01em;
  }
  p {
    text-wrap: pretty;
    max-width: 66ch;
  }
  section {
    padding: 3.5rem 0;
    border-top: 1px solid var(--line);
  }
  section.hero {
    border-top: 0;
  }
  section > p + p,
  section > ul + pre,
  section > p + pre,
  section > pre + p,
  section > ul + p {
    margin-top: 1rem;
  }

  code,
  pre {
    font-family: var(--mono);
    font-size: 0.88em;
  }
  code {
    background: var(--wash);
    padding: 0.12em 0.4em;
    border-radius: 3px;
    overflow-wrap: anywhere;
  }
  pre {
    background: var(--wash);
    border-left: 2px solid var(--indigo);
    padding: 1rem 1.15rem;
    overflow-x: auto;
    line-height: 1.55;
  }

  /* Cabecera y pie */
  .top,
  .bottom {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1.5rem;
    padding: 1.1rem 0;
  }
  .top {
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--paper);
    border-bottom: 1px solid transparent;
  }
  .top nav,
  .bottom nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1.4rem;
  }
  .top nav a,
  .bottom a {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.2s;
  }
  .top nav a:hover,
  .bottom a:hover {
    color: var(--ink);
  }
  .brand {
    display: flex;
  }
  .logo {
    width: 6.25rem;
    height: auto;
  }
  .bottom {
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.95rem;
  }

  /* Hero */
  .hero {
    padding: clamp(3.5rem, 10vw, 7rem) 0 clamp(3rem, 7vw, 5rem);
  }
  .kicker,
  .label {
    font-family: var(--mono);
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--coral-text);
  }
  .hero .kicker {
    margin-bottom: 1.75rem;
  }
  .lede {
    font-size: clamp(1.1rem, 2vw, 1.3rem);
    color: var(--muted);
    margin-top: 1.9rem;
    max-width: 56ch;
  }
  .tagline {
    font-size: 1.2rem;
    color: var(--muted);
    margin: 1rem 0;
  }
  .actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 2.25rem;
  }
  .button {
    background: var(--indigo);
    color: var(--paper);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.97rem;
    padding: 0.65rem 1.15rem;
    border: 1px solid var(--indigo);
    border-radius: 6px;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
  }
  .button:hover {
    background: #1d0b50;
  }
  .button.quiet {
    background: transparent;
    color: var(--ink);
    border-color: var(--line);
  }
  .button.quiet:hover {
    border-color: var(--ink);
    background: transparent;
  }

  /* agent-kernel al centro */
  .flagship h2 {
    font-size: clamp(2rem, 5vw, 3.25rem);
    margin: 0.9rem 0 0;
  }
  .flagship .tagline {
    margin-top: 0.5rem;
  }
  .badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 1.5rem 0;
    max-width: none;
  }
  .badges a {
    display: flex;
  }
  .badges img {
    height: 20px;
    width: auto;
  }

  /* Columnas separadas por una línea, sin cajas */
  .ways,
  .principles {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(15rem, 100%), 1fr));
    gap: 2rem;
    margin-top: 2rem;
  }
  .ways li,
  .principles li {
    border-top: 1px solid var(--ink);
    padding-top: 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    min-width: 0;
  }
  .principles {
    grid-template-columns: repeat(auto-fit, minmax(min(13rem, 100%), 1fr));
  }
  .ways p,
  .principles p {
    color: var(--muted);
    font-size: 0.97rem;
  }
  .ways a,
  .ways code {
    font-size: 0.85rem;
    overflow-wrap: anywhere;
    align-self: flex-start;
  }
  .more {
    font-weight: 600;
    display: inline-block;
    margin-top: 2rem;
  }
  .more::after {
    content: ' →';
    display: inline-block;
    transition: translate 0.2s;
  }
  .more:hover::after {
    translate: 0.25rem 0;
  }

  /* Los demás proyectos: un índice, una fila por proyecto */
  .index {
    list-style: none;
  }
  .row {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 8fr);
    gap: 0.75rem 2.5rem;
    padding: 1.75rem 0;
    border-top: 1px solid var(--line);
  }
  .row:first-child {
    border-top-color: var(--ink);
  }
  .row h3 {
    font-size: 1.35rem;
    margin: 0.4rem 0 0.3rem;
  }
  .row .tagline {
    font-size: 1rem;
    margin: 0;
  }
  .row .text {
    color: var(--muted);
  }
  .row .links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1.25rem;
    margin-top: 0.75rem;
    font-size: 0.95rem;
  }
  /* Teléfono: la cabecera no se queda fija (ocupaba demasiada pantalla) y el
     menú cabe en una línea con blancos cómodos para el dedo. */
  @media (max-width: 44rem) {
    .row {
      grid-template-columns: 1fr;
    }
    .top {
      position: static;
      padding-bottom: 0.25rem;
    }
    .top nav {
      width: 100%;
      flex-wrap: nowrap;
      justify-content: space-between;
      gap: 0;
    }
    .top nav a {
      font-size: 0.9rem;
      padding: 0.75rem 0;
    }
    .hero {
      padding-top: 1.75rem;
    }
    .bottom a {
      padding: 0.6rem 0;
    }
    pre {
      font-size: 0.8em;
    }
  }

  .plain {
    list-style: none;
    display: grid;
    gap: 0.6rem;
    margin: 1rem 0;
    max-width: 66ch;
  }
  .plain li {
    padding-left: 1.1rem;
    border-left: 1px solid var(--line);
  }
  .docs {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(19rem, 100%), 1fr));
    gap: 0 2.5rem;
  }
  .docs li {
    display: grid;
    align-content: start;
    padding: 0.8rem 0;
    border-top: 1px solid var(--line);
  }
  .docs span {
    color: var(--muted);
    font-size: 0.93rem;
  }
}

/* El pulso: una franja angosta sobre la cabecera. Lo dibuja /pulse.js. */
.site .pulse {
  display: block;
  width: 100%;
  height: 2rem;
  margin-top: 0.75rem;
  cursor: pointer;
  touch-action: pan-y;
}

/* La portada: una barra por cada línea de Bash de agent-kernel, archivo por archivo. */
.site .lede strong {
  color: var(--ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.site .map {
  list-style: none;
  columns: 4;
  column-gap: 0.75rem;
  margin-top: 1.75rem;
}
.site .map li {
  break-inside: avoid;
  padding-bottom: 0.9rem;
}
.site .file {
  display: block;
  text-decoration: none;
}
.site .file b {
  display: block;
  font: 500 0.66rem/1.2 var(--mono);
  color: var(--muted);
  margin-bottom: 0.35rem;
  transition: color 0.2s;
}
.site .file svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
.site .file rect {
  fill: var(--indigo);
  transition: fill 0.2s;
}
.site .file rect.go {
  fill: var(--coral);
}
.site .file:hover b,
.site .file:focus-visible b {
  color: var(--ink);
}
.site .file:hover rect:not(.go),
.site .file:focus-visible rect:not(.go) {
  fill: var(--ink);
}
.site .caption {
  font: 0.78rem/1.5 var(--mono);
  color: var(--muted);
  margin-top: 0.5rem;
}
.site .caption em {
  font-style: normal;
  color: var(--coral-text);
}
@media (min-width: 40rem) {
  .site .map {
    columns: 5;
  }
  .site .pulse {
    height: 2.5rem;
  }
}
@media (min-width: 56rem) {
  .site .map {
    columns: 6;
    column-gap: 1.5rem;
  }
}

/* El recorrido de un mensaje por agent-kernel. En teléfono baja; en pantalla ancha va de lado. */
.site .track {
  list-style: none;
  position: relative;
  display: grid;
  grid-auto-rows: 1fr;      /* cinco filas iguales: el punto avanza una quinta parte por parada */
  margin: 1.5rem 0 1.75rem;
}
.site .track::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 0.75rem;
  bottom: calc(20% - 0.75rem);
  width: 1px;
  background: var(--line);
}
.site .node {
  position: relative;
  padding: 0 0 1.5rem 2rem;
}
.site .node::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.25rem;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--paper);
  border: 1.5px solid var(--indigo);
}
.site .node .meta {
  font: 0.76rem/1.4 var(--mono);
  color: var(--muted);
}
.site .node .policy {
  color: var(--coral-text);
}
.site .bubble {
  display: inline-block;
  margin-top: 0.35rem;
  font-size: 0.9rem;
  line-height: 1.4;
  background: var(--wash);
  border-radius: 10px 10px 10px 2px;
  padding: 0.4rem 0.7rem;
  max-width: 34ch;
}
.site .bubble.reply {
  background: var(--indigo);
  color: var(--paper);
  border-radius: 10px 10px 2px 10px;
}
.site .attachment {
  display: block;
  font: 0.72rem/1.6 var(--mono);
  color: var(--muted);
}
.site .attachment::before {
  content: '▤ ';
}
.site .dot {
  position: absolute;
  left: 2.5px;
  top: calc(0.25rem + 2.5px + var(--p) * 20%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--coral);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--coral) 18%, transparent);
  display: none;
}
@media (min-width: 46rem) {
  .site .track {
    grid-template-columns: repeat(5, 1fr);
    grid-auto-rows: auto;
    gap: 0 1rem;
  }
  .site .track::before {
    left: 10%;
    right: 10%;
    top: 7px;
    bottom: auto;
    width: auto;
    height: 1px;
  }
  .site .node {
    padding: 1.75rem 0 0;
    text-align: center;
  }
  .site .node::before {
    left: calc(50% - 7.5px);
    top: 0;
  }
  .site .bubble {
    border-radius: 10px;
    text-align: left;
  }
  .site .dot {
    top: 2.5px;
    left: calc(10% - 5px + var(--p) * 20%);
  }
}

/* El título de agent-kernel viaja de la portada a su página. */
.site .vt-agent-kernel {
  view-transition-name: agent-kernel-title;
}
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.22s;
}

/* La cabecera gana su línea inferior al empezar a bajar: ligada al scroll, sin JavaScript. */
@supports (animation-timeline: scroll()) {
  .site .top {
    animation: hairline linear both;
    animation-timeline: scroll(root);
    animation-range: 0 4rem;
  }
}

@media (prefers-reduced-motion: no-preference) {
  /* Entrada del hero al cargar. Cada elemento espera según su posición entre
     sus hermanos (sibling-index), sin escribir un retraso por elemento. */
  .site .hero > * {
    transition: opacity 0.6s ease, translate 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
    transition-delay: calc((sibling-index() - 1) * 70ms);
    @starting-style {
      opacity: 0;
      translate: 0 0.75rem;
    }
  }

  /* La portada se escribe sola: cada archivo espera su turno y cada barra el
     suyo dentro del archivo, con sibling-index(). Sin soporte, aparecen juntas. */
  .site .map li {
    --file-delay: calc(sibling-index() * 110ms + 300ms);
  }
  .site .file rect {
    transform-box: fill-box;
    transform-origin: 0 50%;
    animation: write 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both;
    animation-delay: calc(var(--file-delay) + sibling-index() * 7ms);
  }
  .site .file rect.go {
    animation-name: write-go;
  }

  /* El mensaje recorre el camino en ciclos de ocho segundos; cada parada se
     enciende cuando llega. */
  .site .track {
    animation: travel 8s linear infinite;
  }
  .site .dot {
    display: block;
  }
  .site .node::before {
    animation: arrive 8s linear infinite;
  }
  .site .node:nth-child(2)::before { animation-delay: 1.6s; }
  .site .node:nth-child(3)::before { animation-delay: 3.2s; }
  .site .node:nth-child(4)::before { animation-delay: 5.44s; }
  .site .node:nth-child(5)::before { animation-delay: 7.04s; }
  .site .bubble.reply {
    animation: reply 8s linear infinite;
  }

  /* Animaciones disparadas por el scroll: cada bloque entra una sola vez, a
     su propio ritmo, cuando llega a la pantalla. */
  @supports (animation-trigger: --reveal play-once) {
    .site .reveal {
      timeline-trigger: --reveal view() entry 10% exit 100%;
      animation: rise 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) both;
      animation-trigger: --reveal play-once;
    }
  }

  /* Donde aún no existen, la entrada sigue al scroll. */
  @supports (animation-timeline: view()) and (not (animation-trigger: --reveal play-once)) {
    .site .reveal {
      animation: rise linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 60%;
    }
  }
}

@keyframes hairline {
  to {
    border-bottom-color: var(--line);
  }
}

@keyframes write {
  from {
    transform: scaleX(0);
    fill: var(--coral);
  }
  60% {
    fill: var(--coral);
  }
}
@keyframes write-go {
  from {
    transform: scaleX(0);
  }
}
@keyframes travel {
  0%, 8% { --p: 0; }
  20%, 28% { --p: 1; }
  40%, 56% { --p: 2; }
  68%, 76% { --p: 3; }
  88%, 100% { --p: 4; }
}
@keyframes arrive {
  0% { scale: 1.5; border-color: var(--coral); }
  14%, 100% { scale: 1; border-color: var(--indigo); }
}
@keyframes reply {
  0%, 86% { opacity: 0.2; }
  90%, 100% { opacity: 1; }
}

@keyframes rise {
  from {
    opacity: 0;
    translate: 0 2.5rem;
  }
}

/* Quien desactiva las animaciones tampoco ve la transición entre páginas. */
@media (prefers-reduced-motion: reduce) {
  @view-transition {
    navigation: none;
  }
}
