/* Novedades Funnelchat — estilos.
   Paleta NEUTRA a propósito: para pasar a los colores de Funnelchat solo hay
   que cambiar los tokens de :root (--brand, --brand-ink). Nada más depende
   de la marca. */

:root {
  /* --- tokens de marca (cambiar acá y listo) --- */
  --brand: #4f46e5;
  --brand-ink: #ffffff;
  --brand-soft: #eef2ff;

  /* --- neutros --- */
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #f1f3f7;
  --border: #e3e7ee;
  --text: #14181f;
  --text-soft: #5b6472;
  --text-mute: #8b95a5;

  /* --- categorías --- */
  --nueva: #0f8a5f;
  --nueva-soft: #e7f6ef;
  --correccion: #c2410c;
  --correccion-soft: #fdf0e7;
  --mantenimiento: #4b5563;
  --mantenimiento-soft: #eef0f3;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 6px 20px -8px rgba(16, 24, 40, .12);
  --shadow-lg: 0 12px 40px -12px rgba(16, 24, 40, .28);
  --maxw: 1180px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1017;
    --surface: #151a23;
    --surface-2: #1b2230;
    --border: #262f3d;
    --text: #e8ecf3;
    --text-soft: #a3adbd;
    --text-mute: #7a869a;
    --brand: #7c8cff;
    --brand-soft: #1c2340;
    --nueva: #4ade80;
    --nueva-soft: #10291d;
    --correccion: #fb923c;
    --correccion-soft: #2a1a10;
    --mantenimiento: #9aa5b5;
    --mantenimiento-soft: #1e242f;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px -10px rgba(0, 0, 0, .6);
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: none; }
img { max-width: 100%; display: block; }
button { font: inherit; cursor: pointer; }

.muted { color: var(--text-mute); }

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--brand); color: var(--brand-ink); padding: .6rem 1rem; border-radius: 0 0 8px 0;
}
.skip:focus { left: 0; }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar__inner {
  max-width: var(--maxw); margin: 0 auto; padding: .7rem 1.25rem;
  display: flex; align-items: center; gap: 1rem;
}
.brand { display: flex; align-items: center; gap: .6rem; flex: 0 0 auto; }
.brand__mark { font-size: 1.4rem; }
.brand__text { display: flex; flex-direction: column; line-height: 1.05; }
.brand__text strong { font-size: 1.02rem; letter-spacing: -.01em; }
.brand__text small { color: var(--text-mute); font-size: .72rem; text-transform: uppercase; letter-spacing: .09em; }

.search { position: relative; flex: 1 1 auto; max-width: 520px; }
.search__icon { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); font-size: .85rem; opacity: .7; }
.search input {
  width: 100%; padding: .58rem .6rem .58rem 2.1rem;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface-2); color: var(--text); font-size: .92rem;
  transition: border-color .15s, box-shadow .15s;
}
.search input::placeholder { color: var(--text-mute); }
.search input:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent);
  background: var(--surface);
}
.search__clear {
  position: absolute; right: .5rem; top: 50%; transform: translateY(-50%);
  border: 0; background: transparent; color: var(--text-mute); padding: .2rem .35rem; border-radius: 6px;
}
.search__clear:hover { background: var(--surface-2); color: var(--text); }

.topnav { display: flex; align-items: center; gap: .35rem; flex: 0 0 auto; }
.topnav > a {
  padding: .42rem .7rem; border-radius: 999px; font-size: .88rem; font-weight: 550; color: var(--text-soft);
}
.topnav > a:hover { background: var(--surface-2); color: var(--text); }
.topnav > a.is-active { background: var(--brand-soft); color: var(--brand); }

/* ---------- Layout ---------- */
.layout {
  max-width: var(--maxw); margin: 0 auto; padding: 1.5rem 1.25rem 3rem;
  display: grid; grid-template-columns: 258px minmax(0, 1fr); gap: 2rem; align-items: start;
}
.sidebar { position: sticky; top: 74px; display: flex; flex-direction: column; gap: 1rem; }
.content { min-width: 0; }

/* ---------- Hero ---------- */
.hero { margin-bottom: 1.25rem; }
.hero h1 { font-size: 1.7rem; letter-spacing: -.02em; margin: 0 0 .3rem; }
.hero p { margin: 0; color: var(--text-soft); font-size: .95rem; }
.hero__stats { display: flex; gap: 1.1rem; margin-top: .8rem; flex-wrap: wrap; }
.hero__stat { font-size: .82rem; color: var(--text-mute); }
.hero__stat strong { color: var(--text); font-size: 1.05rem; display: block; font-variant-numeric: tabular-nums; }

/* ---------- Filtros ---------- */
.filters {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1rem; display: flex; flex-direction: column; gap: .8rem; box-shadow: var(--shadow);
}
.filters__row { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.field { display: flex; flex-direction: column; gap: .3rem; }
.field > span { font-size: .74rem; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--text-mute); }
.field input, .field select {
  width: 100%; padding: .45rem .55rem; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text); font-size: .86rem;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--brand); }

.chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.chip {
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-soft);
  padding: .3rem .6rem; border-radius: 999px; font-size: .78rem; display: inline-flex; align-items: center; gap: .3rem;
  transition: all .15s;
}
.chip em { font-style: normal; color: var(--text-mute); font-variant-numeric: tabular-nums; }
.chip:hover { border-color: var(--brand); color: var(--text); }
.chip--on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.chip--on em { color: color-mix(in srgb, var(--brand-ink) 75%, transparent); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .45rem .85rem; border-radius: var(--radius-sm); border: 1px solid var(--brand);
  background: var(--brand); color: var(--brand-ink); font-size: .86rem; font-weight: 600;
}
.btn:hover { filter: brightness(1.06); }
.btn--ghost { background: transparent; color: var(--text-soft); border-color: var(--border); }
.btn--ghost:hover { background: var(--surface-2); color: var(--text); }
.btn--small { padding: .34rem .65rem; font-size: .8rem; }

.sidebar__stats {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: .85rem 1rem; font-size: .82rem; color: var(--text-soft);
}
.sidebar__stats dl { margin: 0; display: grid; grid-template-columns: 1fr auto; gap: .3rem .5rem; }
.sidebar__stats dt { color: var(--text-mute); }
.sidebar__stats dd { margin: 0; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text); }

.activefilters {
  background: var(--brand-soft); border: 1px solid color-mix(in srgb, var(--brand) 25%, transparent);
  color: var(--text); border-radius: 999px; padding: .4rem .95rem; font-size: .82rem; margin-bottom: 1rem;
  display: inline-flex; gap: .4rem; flex-wrap: wrap; align-items: center;
}
.activefilters__label { color: var(--text-mute); }
.activefilters a { color: var(--brand); font-weight: 600; text-decoration: underline; }

/* ---------- Timeline ---------- */
.timeline { display: flex; flex-direction: column; gap: 2.1rem; }
.day { position: relative; }
.day__head {
  display: flex; align-items: baseline; gap: .7rem; margin-bottom: .85rem;
  padding-bottom: .5rem; border-bottom: 1px solid var(--border);
}
.day__date { display: flex; align-items: baseline; gap: .6rem; flex-wrap: wrap; }
.day__badge {
  background: var(--brand); color: var(--brand-ink); font-size: .68rem; font-weight: 750;
  text-transform: uppercase; letter-spacing: .08em; padding: .2rem .5rem; border-radius: 999px;
}
.day__head h2 { margin: 0; font-size: 1.06rem; letter-spacing: -.01em; text-transform: capitalize; }
.day__head h2 a:hover { color: var(--brand); }
.day__count { margin-left: auto; font-size: .78rem; color: var(--text-mute); white-space: nowrap; }
.day__cards { display: flex; flex-direction: column; gap: .9rem; }
.day__empty {
  background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius);
  padding: 1.4rem; text-align: center;
}
.day__empty p { margin: .2rem 0; font-size: .92rem; }

/* ---------- Card ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.05rem 1.15rem; box-shadow: var(--shadow);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.card:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--brand) 30%, var(--border)); }
.card__head { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .55rem; align-items: center; }
.card__title { margin: 0 0 .35rem; font-size: 1.08rem; line-height: 1.35; letter-spacing: -.01em; }
.card__title a:hover { color: var(--brand); }
.card__summary { margin: 0; color: var(--text-soft); font-size: .93rem; }
.card__shots { display: flex; gap: .5rem; margin-top: .8rem; flex-wrap: wrap; }
.card__foot {
  display: flex; align-items: center; justify-content: space-between; gap: .8rem;
  margin-top: .9rem; padding-top: .75rem; border-top: 1px solid var(--border); flex-wrap: wrap;
}
.card__more { font-size: .84rem; font-weight: 600; color: var(--brand); white-space: nowrap; }
.card__more:hover { text-decoration: underline; }

.pill {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .74rem; font-weight: 650; padding: .22rem .55rem; border-radius: 999px;
  background: var(--surface-2); color: var(--text-soft); border: 1px solid transparent;
  white-space: nowrap;
}
.pill__emoji { font-size: .82rem; }
.pill--nueva { background: var(--nueva-soft); color: var(--nueva); }
.pill--correccion { background: var(--correccion-soft); color: var(--correccion); }
.pill--mantenimiento { background: var(--mantenimiento-soft); color: var(--mantenimiento); }
.pill--area { background: transparent; border-color: var(--border); color: var(--text-soft); }
.pill--date { background: transparent; border-color: var(--border); color: var(--text-mute); text-transform: capitalize; }
.pill--draft { background: #fff7e6; color: #9a6700; }

/* ---------- Dev chips ---------- */
.devchips { display: flex; flex-wrap: wrap; gap: .5rem; }
.devchip { display: inline-flex; align-items: center; gap: .4rem; font-size: .82rem; }
.devchip__link { display: inline-flex; align-items: center; gap: .45rem; padding: .18rem .45rem .18rem .18rem; border-radius: 999px; }
.devchip__link:hover { background: var(--surface-2); }
.devchip__avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--surface-2); flex: 0 0 auto; }
.devchip__text { display: flex; flex-direction: column; line-height: 1.15; }
.devchip__name { font-weight: 600; }
.devchip__role { font-size: .7rem; color: var(--text-mute); }
.devchip__gh { font-size: .74rem; color: var(--text-mute); }
.devchip__gh:hover { color: var(--brand); text-decoration: underline; }

/* ---------- Capturas ---------- */
.shot {
  border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; padding: 0;
  background: var(--surface-2); width: 148px; height: 92px; flex: 0 0 auto;
  transition: border-color .15s, transform .15s;
}
.shot:hover { border-color: var(--brand); transform: scale(1.02); }
.shot img { width: 100%; height: 100%; object-fit: cover; object-position: top left; }
.shot--more {
  display: flex; align-items: center; justify-content: center;
  width: 62px; font-weight: 700; color: var(--text-soft); font-size: .95rem;
}

/* ---------- Detalle ---------- */
.detail {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.6rem 1.7rem 1.9rem; box-shadow: var(--shadow); max-width: 780px;
}
.detail__back { font-size: .85rem; color: var(--text-mute); display: inline-block; margin-bottom: 1rem; }
.detail__back:hover { color: var(--brand); }
.detail__title { font-size: 1.75rem; line-height: 1.22; letter-spacing: -.025em; margin: .6rem 0 .5rem; }
.detail__summary { font-size: 1.05rem; color: var(--text-soft); margin: 0; }
.detail__devs { display: flex; flex-wrap: wrap; gap: .7rem; margin: 1.3rem 0; }
.devcard {
  display: flex; gap: .7rem; align-items: center; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .6rem .9rem .6rem .6rem;
}
.devcard__avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--surface); }
.devcard__text { display: flex; flex-direction: column; line-height: 1.25; }
.devcard__label { font-size: .66rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-mute); }
.devcard__name { font-weight: 650; }
.devcard__name:hover { color: var(--brand); }
.devcard__role { font-size: .76rem; color: var(--text-soft); }
.devcard__gh { font-size: .74rem; color: var(--text-mute); }
.devcard__gh:hover { color: var(--brand); text-decoration: underline; }

.prose { font-size: 1rem; color: var(--text); }
.prose p { margin: 0 0 .9rem; }
.prose ul { margin: 0 0 1rem; padding-left: 1.15rem; }
.prose li { margin-bottom: .35rem; }
.prose code {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 5px;
  padding: .05rem .3rem; font-size: .88em;
}
.prose strong { font-weight: 650; }

.detail__shots h2, .detail__related h2 { font-size: 1rem; margin: 1.6rem 0 .7rem; }
.detail__shotgrid { display: grid; gap: 1rem; }
.bigshot { margin: 0; }
.bigshot .shot { width: 100%; height: auto; aspect-ratio: 16 / 10; }
.bigshot .shot img { object-fit: contain; object-position: center; background: var(--surface-2); }
.bigshot figcaption { font-size: .82rem; color: var(--text-mute); margin-top: .4rem; }

.detail__commits { margin-top: 1.6rem; border-top: 1px solid var(--border); padding-top: .9rem; }
.detail__commits summary { font-size: .84rem; color: var(--text-mute); cursor: pointer; }
.detail__commits summary:hover { color: var(--text); }
.commits { list-style: none; margin: .8rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .45rem; }
.commits li { display: flex; gap: .6rem; align-items: baseline; font-size: .82rem; flex-wrap: wrap; }
.commits__sha { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--text-mute); background: var(--surface-2); padding: .05rem .35rem; border-radius: 4px; }
.commits__msg { color: var(--text-soft); }
.commits__repo { color: var(--text-mute); font-size: .74rem; }

.related { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .4rem; }
.related a { font-size: .9rem; color: var(--text-soft); }
.related a:hover { color: var(--brand); text-decoration: underline; }

/* ---------- Equipo ---------- */
.devgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .9rem; }
.devtile {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.1rem .9rem; text-align: center; display: flex; flex-direction: column; align-items: center; gap: .25rem;
  box-shadow: var(--shadow); transition: transform .15s, border-color .15s;
}
.devtile:hover { transform: translateY(-2px); border-color: var(--brand); }
.devtile img { width: 54px; height: 54px; border-radius: 50%; margin-bottom: .3rem; background: var(--surface-2); }
.devtile__name { font-weight: 650; font-size: .92rem; }
.devtile__role { font-size: .74rem; color: var(--text-mute); }
.devtile__count { font-size: .78rem; color: var(--brand); font-weight: 600; margin-top: .25rem; }

/* ---------- Estados ---------- */
.empty {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 3rem 1.5rem; text-align: center;
}
.empty__icon { font-size: 2.3rem; margin-bottom: .5rem; }
.empty h2 { margin: 0 0 .4rem; font-size: 1.15rem; }
.empty p { margin: 0 auto 1rem; max-width: 40ch; font-size: .92rem; }

.loading { display: flex; flex-direction: column; gap: .8rem; }
.skeleton { height: 90px; border-radius: var(--radius); background: linear-gradient(100deg, var(--surface-2) 30%, var(--surface) 50%, var(--surface-2) 70%); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
.skeleton--title { height: 34px; width: 45%; }
@keyframes shimmer { to { background-position: -200% 0; } }

.error {
  background: var(--correccion-soft); color: var(--correccion);
  border: 1px solid currentColor; border-radius: var(--radius); padding: 1rem 1.2rem;
}
.error code { background: rgba(0,0,0,.06); padding: .05rem .3rem; border-radius: 4px; }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 90; background: rgba(6, 9, 14, .86);
  display: flex; align-items: center; justify-content: center; padding: 2.5rem 1.5rem;
  backdrop-filter: blur(3px);
}
.lightbox[hidden] { display: none; }
.lightbox figure { margin: 0; max-width: 1100px; max-height: 100%; }
.lightbox img { max-height: 78vh; width: auto; margin: 0 auto; border-radius: 10px; box-shadow: 0 25px 60px rgba(0,0,0,.55); background: #fff; }
.lightbox figcaption { color: #d6dbe4; text-align: center; margin-top: .8rem; font-size: .88rem; }
.lightbox__close {
  position: absolute; top: 1rem; right: 1.2rem; background: rgba(255,255,255,.14); color: #fff;
  border: 0; width: 38px; height: 38px; border-radius: 50%; font-size: 1rem;
}
.lightbox__close:hover { background: rgba(255,255,255,.26); }

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--border); padding: 1.6rem 1.25rem 2.4rem; text-align: center;
  color: var(--text-mute); font-size: .84rem;
}
.footer p { margin: .15rem 0; }

/* ---------- Responsive ---------- */
@media (max-width: 940px) {
  .layout { grid-template-columns: 1fr; gap: 1.2rem; }
  .sidebar { position: static; display: none; }
  .sidebar.is-open { display: flex; }
  .topbar__inner { flex-wrap: wrap; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .detail { padding: 1.2rem; }
  .detail__title { font-size: 1.4rem; }
}
@media (max-width: 560px) {
  .topnav > a { padding: .35rem .5rem; font-size: .84rem; }
  .card { padding: .9rem; }
  .shot { width: 120px; height: 76px; }
  .day__count { flex-basis: 100%; margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}
