/* ==========================================================================
   Componentes de la pagina publica
   ========================================================================== */

/* --------------------------------------------------------------------------
   Botones
   -------------------------------------------------------------------------- */
.btn {
  --btn-bg: var(--brand);
  --btn-fg: var(--on-brand);
  --btn-border: transparent;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.85rem 1.6rem;
  border: 1px solid var(--btn-border);
  border-radius: var(--radius-full);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  overflow: hidden;
  isolation: isolate;
  transition: transform var(--dur-fast) var(--ease-spring),
    box-shadow var(--dur-mid) var(--ease-out),
    background-color var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out);
}

/* Barrido de luz al pasar el cursor */
.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(
    120deg,
    transparent 20%,
    rgba(255, 255, 255, 0.22) 50%,
    transparent 80%
  );
  transform: translateX(-120%);
  transition: transform var(--dur-slow) var(--ease-out);
}

.btn:hover::before {
  transform: translateX(120%);
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn:active {
  transform: translateY(0) scale(0.98);
}

.btn--ghost {
  --btn-bg: transparent;
  --btn-fg: var(--brand);
  --btn-border: var(--border);
}

.btn--ghost:hover {
  --btn-bg: var(--surface-alt);
  --btn-border: var(--brand-accent);
}

/* Para acciones irreversibles (borrar, reiniciar contadores): mismo peso
   visual que --ghost pero en tono de alerta, para que no se confunda con
   un boton neutro de al lado. */
.btn--danger {
  --btn-bg: transparent;
  --btn-fg: var(--danger);
  --btn-border: color-mix(in srgb, var(--danger) 45%, transparent);
}

.btn--danger:hover {
  --btn-bg: var(--danger-soft);
  --btn-border: var(--danger);
}

.btn--soft {
  --btn-bg: var(--brand-soft);
  --btn-fg: var(--brand);
}

.btn--on-band {
  --btn-bg: #ffffff;
  --btn-fg: var(--navy-900);
}

.btn--sm {
  padding: 0.55rem 1.1rem;
  font-size: 0.82rem;
}

.btn--block {
  width: 100%;
}

.btn[disabled],
.btn.is-loading {
  opacity: 0.6;
  pointer-events: none;
}

.btn.is-loading .icon {
  animation: spin 900ms linear infinite;
}

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--brand-accent);
  font-weight: 600;
  font-size: 0.88rem;
}

.link-arrow .icon {
  transition: transform var(--dur-fast) var(--ease-out);
}

.link-arrow:hover .icon {
  transform: translateX(4px);
}

/* --------------------------------------------------------------------------
   Superficies
   -------------------------------------------------------------------------- */
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: clamp(1.35rem, 2.5vw, 2rem);
  transition: transform var(--dur-mid) var(--ease-out),
    border-color var(--dur-mid) var(--ease-out),
    box-shadow var(--dur-mid) var(--ease-out);
}

.card:hover {
  border-color: var(--brand-accent);
  box-shadow: var(--shadow-glow);
}

/* Foco luminoso que sigue al cursor (lo alimenta animations.js) */
.card--spotlight::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(
    260px circle at var(--mx, 50%) var(--my, 50%),
    color-mix(in srgb, var(--brand-accent) 14%, transparent),
    transparent 65%
  );
  transition: opacity var(--dur-mid) var(--ease-out);
}

.card--spotlight:hover::after {
  opacity: 1;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.7rem;
  border-radius: var(--radius-full);
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.badge--outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.75rem;
}

.badge--live {
  background: color-mix(in srgb, var(--success) 15%, transparent);
  color: var(--success);
}

.badge--soon {
  background: color-mix(in srgb, var(--warning) 15%, transparent);
  color: var(--warning);
}

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */
.hero {
  position: relative;
  min-height: min(100svh, 900px);
  display: flex;
  align-items: center;
  padding-block: calc(var(--nav-height) + 3rem) 4rem;
  overflow: hidden;
}

/* Manchas de luz con parallax */
.aurora {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.5;
  pointer-events: none;
  z-index: 0;
  will-change: transform;
}

.aurora--1 {
  width: min(52vw, 620px);
  aspect-ratio: 1;
  background: radial-gradient(circle, var(--navy-300), transparent 68%);
  top: -14%;
  left: -12%;
}

.aurora--2 {
  width: min(44vw, 520px);
  aspect-ratio: 1;
  background: radial-gradient(circle, color-mix(in srgb, var(--brand-accent) 55%, transparent), transparent 70%);
  bottom: -18%;
  right: -10%;
  opacity: 0.35;
}

:root[data-theme="dark"] .aurora {
  opacity: 0.28;
}

/* Rejilla técnica de fondo */
.hero__grid-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: linear-gradient(var(--border-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--border-soft) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, #000 20%, transparent 78%);
  mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, #000 20%, transparent 78%);
  opacity: 0.7;
}

.hero__inner {
  position: relative;
  z-index: 1;
  display: grid;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
}

.hero__title {
  font-size: var(--step-5);
  color: var(--brand);
  margin-top: var(--space-md);
  line-height: 1.02;
}

.hero__title .accent {
  color: var(--brand-accent);
}

.hero__role {
  font-family: var(--font-mono);
  font-size: clamp(0.95rem, 2vw, 1.2rem);
  color: var(--text-muted);
  margin-top: var(--space-md);
  min-height: 1.7em;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.hero__role .caret {
  display: inline-block;
  width: 2px;
  height: 1.05em;
  background: var(--brand-accent);
  animation: caret-blink 1.05s steps(2, start) infinite;
}

.hero__lead {
  margin-top: var(--space-lg);
  max-width: 58ch;
  font-size: var(--step-1);
  color: var(--text-muted);
}

.hero__actions {
  margin-top: var(--space-xl);
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.hero__meta {
  margin-top: var(--space-xl);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-lg);
  font-size: 0.85rem;
  color: var(--text-subtle);
}

.hero__meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

/* En celular se muestran ubicación, rol y reubicación; el headline
   completo (que ya se repite en el subtítulo animado) espera al ancho
   de una tablet. Se apunta con "span" para superar la especificidad
   de ".hero__meta span" de arriba. */
.hero__meta span.hero__meta-extra {
  display: none;
}

@media (min-width: 640px) {
  .hero__meta span.hero__meta-extra {
    display: inline-flex;
  }
}

/* --------------------------------------------------------------------------
   Banda de estadisticas
   -------------------------------------------------------------------------- */
.stats {
  background: var(--band-bg);
  color: var(--band-text);
  padding-block: clamp(2.5rem, 5vw, 4rem);
}

.stats__grid {
  display: grid;
  gap: clamp(1.5rem, 3vw, 2.5rem);
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.stat {
  border-left: 2px solid var(--band-border);
  padding-left: var(--space-lg);
}

.stat__value {
  font-family: var(--font-display);
  font-size: var(--step-3);
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.03em;
}

:root[data-theme="dark"] .stat__value {
  color: var(--band-text);
}

.stat__label {
  color: var(--band-text-muted);
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

/* --------------------------------------------------------------------------
   Linea del tiempo
   -------------------------------------------------------------------------- */
.timeline {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: clamp(1.5rem, 3vw, 2.5rem);
  padding-left: 2.75rem;
}

/* Riel de fondo + riel que se "dibuja" con el scroll */
.timeline::before,
.timeline__progress {
  content: "";
  position: absolute;
  left: 15px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  border-radius: 2px;
}

.timeline::before {
  background: var(--border-soft);
}

.timeline__progress {
  background: linear-gradient(var(--brand-strong), var(--brand-accent));
  transform-origin: top;
  transform: scaleY(var(--progress, 0));
  transition: transform 120ms linear;
}

.timeline-item {
  position: relative;
}

/* Distingue empleo / formación / proyecto personal / certificación: sin
   esto, un proyecto personal intercalado entre dos empleos se leía como
   si fuera otro puesto de trabajo. */
.timeline-item__kind {
  margin-bottom: var(--space-sm);
}

.timeline-item__dot {
  position: absolute;
  left: -2.75rem;
  top: 1.5rem;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--border);
  color: var(--brand-accent);
  z-index: 2;
  transition: transform var(--dur-mid) var(--ease-spring),
    border-color var(--dur-mid) var(--ease-out),
    box-shadow var(--dur-mid) var(--ease-out);
}

.timeline-item.is-visible .timeline-item__dot {
  border-color: var(--brand-accent);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--brand-accent) 12%, transparent);
}

.timeline-item:hover .timeline-item__dot {
  transform: scale(1.12);
}

.timeline-item__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}

.timeline-item__role {
  font-size: var(--step-2);
  color: var(--brand);
}

.timeline-item__period {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.3rem 0.7rem;
  border-radius: var(--radius-full);
  background: var(--brand-soft);
  color: var(--brand);
  white-space: nowrap;
}

.timeline-item__org {
  font-weight: 600;
  color: var(--brand-accent);
  margin-bottom: var(--space-sm);
}

.timeline-item__summary {
  color: var(--text-muted);
}

.timeline-item__summary a {
  color: var(--link);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--link) 45%, transparent);
  text-underline-offset: 2px;
}

.timeline-item__summary a:hover {
  text-decoration-color: var(--link);
}

/* Detalle plegable */
.timeline-item__toggle {
  margin-top: var(--space-md);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: none;
  border: 0;
  padding: 0;
  color: var(--brand-accent);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.timeline-item__toggle .icon {
  transition: transform var(--dur-mid) var(--ease-spring);
}

.timeline-item__toggle[aria-expanded="true"] .icon {
  transform: rotate(180deg);
}

.timeline-item__detail {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows var(--dur-slow) var(--ease-out);
}

.timeline-item__detail > div {
  overflow: hidden;
}

.timeline-item__detail.is-open {
  grid-template-rows: 1fr;
}

.detail-block {
  margin-top: var(--space-lg);
}

.detail-block__title {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-subtle);
  margin-bottom: var(--space-sm);
}

.bullet-list li {
  position: relative;
  padding-left: 1.5rem;
  margin-bottom: 0.55rem;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.bullet-list li::before {
  content: "";
  position: absolute;
  left: 0.25rem;
  top: 0.6em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand-accent);
}

.bullet-list--wins li::before {
  border-radius: 2px;
  background: var(--success);
}

.bullet-list li a {
  color: var(--link);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--link) 45%, transparent);
  text-underline-offset: 2px;
}

.bullet-list li a:hover {
  text-decoration-color: var(--link);
}

/* --------------------------------------------------------------------------
   Proyectos
   -------------------------------------------------------------------------- */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: var(--space-xl);
}

.filter-chip {
  padding: 0.5rem 1.05rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
}

.filter-chip:hover {
  border-color: var(--brand-accent);
  color: var(--brand);
}

.filter-chip.is-active {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--on-brand);
}

/* Grids de tarjetas: columnas fijas (1/2/3) en vez de auto-fill/auto-fit.
   Con columnas fluidas, el último elemento de una lista que no cierra pareja
   con el número de columnas queda solo y angosto (le pasaba a "Idiomas" en
   Skills, a la 3ra tarjeta en Proyectos, etc.). Con columnas fijas se puede
   detectar ese huérfano por posición (nth-child) y estirarlo a todo el
   ancho, sin importar cuántos elementos tenga la lista. */
.projects-grid,
.skills-grid,
.homelab-grid,
.cert-grid {
  display: grid;
  gap: clamp(1rem, 2vw, 1.75rem);
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .projects-grid,
  .skills-grid,
  .homelab-grid,
  .cert-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Único huérfano posible en 2 columnas: el último, en posición impar. */
  .projects-grid > :last-child:nth-child(odd),
  .skills-grid > :last-child:nth-child(odd),
  .homelab-grid > :last-child:nth-child(odd),
  .cert-grid > :last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
}

@media (min-width: 1024px) {
  .projects-grid,
  .skills-grid,
  .homelab-grid,
  .cert-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  /* En 3 columnas ya no aplica la regla de 2; solo queda huérfano el
     último cuando sobra exactamente 1 (posición 3n+1). */
  .projects-grid > :last-child:nth-child(odd),
  .skills-grid > :last-child:nth-child(odd),
  .homelab-grid > :last-child:nth-child(odd),
  .cert-grid > :last-child:nth-child(odd) {
    grid-column: auto;
  }

  .projects-grid > :last-child:nth-child(3n + 1),
  .skills-grid > :last-child:nth-child(3n + 1),
  .homelab-grid > :last-child:nth-child(3n + 1),
  .cert-grid > :last-child:nth-child(3n + 1) {
    grid-column: 1 / -1;
  }

  /* Listas con exactamente 2 elementos (ej. Certificaciones): en vez de
     dejar un tercer hueco vacío, se pasa a 2 columnas para esa lista. */
  .projects-grid:has(> :nth-child(2):last-child),
  .skills-grid:has(> :nth-child(2):last-child),
  .homelab-grid:has(> :nth-child(2):last-child),
  .cert-grid:has(> :nth-child(2):last-child) {
    grid-template-columns: repeat(2, 1fr);
  }
}

.project-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
  transform-style: preserve-3d;
}

.project-card.is-filtered-out {
  display: none;
}

.project-card__media {
  position: relative;
  aspect-ratio: 16 / 10;
  background: linear-gradient(140deg, var(--navy-900), var(--brand-accent));
  display: grid;
  place-items: center;
  overflow: hidden;
}

.project-card__media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--dur-slow) var(--ease-out);
}

.project-card:hover .project-card__media img {
  transform: scale(1.06);
}

.project-card__glyph {
  font-size: 3.4rem;
  color: rgba(255, 255, 255, 0.9);
  transition: transform var(--dur-slow) var(--ease-spring);
}

.project-card:hover .project-card__glyph {
  transform: scale(1.12) rotate(-6deg);
}

.project-card__pattern {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.18) 1px, transparent 1px);
  background-size: 18px 18px;
  opacity: 0.6;
}

.project-card__status {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  z-index: 2;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.project-card__body {
  padding: clamp(1.25rem, 2.5vw, 1.75rem);
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: var(--space-sm);
}

.project-card__year {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: var(--text-subtle);
}

.project-card__title {
  font-size: var(--step-2);
  color: var(--brand);
}

.project-card__summary {
  color: var(--text-muted);
  font-size: 0.92rem;
  flex: 1;
  /* Se recorta a 2 líneas en celular; en pantallas más anchas se lee completo. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (min-width: 640px) {
  .project-card__summary {
    display: block;
    -webkit-line-clamp: unset;
    overflow: visible;
  }
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.project-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border-soft);
}

.notice {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  border: 1px dashed var(--border);
  background: var(--surface-alt);
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-bottom: var(--space-lg);
}

.notice .icon {
  color: var(--brand-accent);
}

/* --------------------------------------------------------------------------
   Skills
   -------------------------------------------------------------------------- */

.skill-group__head {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: var(--space-lg);
}

.skill-group__icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: var(--radius-md);
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 1.5rem;
}

.skill-group__title {
  font-size: var(--step-1);
  color: var(--brand);
}

/* --------------------------------------------------------------------------
   Homelab
   -------------------------------------------------------------------------- */

.homelab-card {
  padding: clamp(1.35rem, 2.5vw, 1.85rem);
  border-radius: var(--radius-lg);
  border: 1px solid var(--band-border);
  background: var(--band-surface);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transition: transform var(--dur-mid) var(--ease-out),
    border-color var(--dur-mid) var(--ease-out);
}

.homelab-card:hover {
  transform: translateY(-6px);
  border-color: var(--band-text-muted);
}

.homelab-card__eyebrow {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--band-text-muted);
  margin-bottom: var(--space-md);
}

.homelab-card__title {
  font-size: var(--step-1);
  color: var(--band-text);
  margin-bottom: 0.4rem;
}

.homelab-card__text {
  color: color-mix(in srgb, var(--band-text) 66%, transparent);
  font-size: 0.88rem;
}

/* --------------------------------------------------------------------------
   Certificaciones
   -------------------------------------------------------------------------- */

.cert-card {
  display: flex;
  gap: var(--space-lg);
  align-items: flex-start;
}

.cert-card__icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 1.75rem;
  flex-shrink: 0;
}

.cert-card__icon--logo {
  background: #fff;
  padding: 8px;
}

.cert-card__icon--logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.cert-card__title {
  font-size: var(--step-1);
  color: var(--brand);
}

.cert-card__meta {
  color: var(--brand-accent);
  font-weight: 600;
  font-size: 0.85rem;
  margin-top: 0.15rem;
}

.cert-card__desc {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-top: var(--space-sm);
}

.cert-card__actions {
  margin-top: var(--space-md);
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.credential-id {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-subtle);
  word-break: break-all;
  /* En celular se prioriza el título y el botón de validar; el detalle
     completo (instructor / folio) queda para la vista de escritorio. */
  display: none;
}

@media (min-width: 640px) {
  .credential-id {
    display: block;
  }
}

/* --------------------------------------------------------------------------
   Contacto multicanal
   -------------------------------------------------------------------------- */
.contact-layout {
  display: grid;
  gap: clamp(1.75rem, 4vw, 3.5rem);
  align-items: start;
}

@media (min-width: 960px) {
  .contact-layout {
    grid-template-columns: 0.95fr 1.05fr;
  }
}

.channel-list {
  display: grid;
  gap: 0.75rem;
}

.channel-option {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  width: 100%;
  text-align: left;
  padding: 1rem 1.15rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
}

.channel-option:hover {
  border-color: var(--channel-accent, var(--brand-accent));
  transform: translateX(4px);
}

.channel-option.is-selected {
  border-color: var(--channel-accent, var(--brand-accent));
  background: color-mix(in srgb, var(--channel-accent, var(--brand-accent)) 8%, var(--surface));
  box-shadow: inset 3px 0 0 var(--channel-accent, var(--brand-accent));
}

.channel-option__icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--channel-accent, var(--brand-accent)) 14%, transparent);
  color: var(--channel-accent, var(--brand-accent));
  font-size: 1.35rem;
  flex-shrink: 0;
}

.channel-option__label {
  font-weight: 600;
  color: var(--text);
}

.channel-option__desc {
  font-size: 0.82rem;
  color: var(--text-subtle);
}

.channel-option__arrow {
  margin-left: auto;
  color: var(--text-subtle);
  transition: transform var(--dur-fast) var(--ease-out);
}

.channel-option:hover .channel-option__arrow {
  transform: translateX(3px);
  color: var(--channel-accent, var(--brand-accent));
}

/* Aviso mostrado mientras no hay canal elegido */
.contact-hint {
  display: flex;
  gap: var(--space-md);
  align-items: flex-start;
  padding: clamp(1.5rem, 3vw, 2.25rem);
  border-radius: var(--radius-lg);
  border: 1px dashed var(--border);
  background: var(--surface);
  transition: opacity var(--dur-mid) var(--ease-out),
    transform var(--dur-mid) var(--ease-out),
    visibility var(--dur-mid);
}

.contact-hint.is-dismissed {
  opacity: 0;
  transform: translateY(-10px);
  visibility: hidden;
  height: 0;
  padding-block: 0;
  border-width: 0;
  overflow: hidden;
}

.contact-hint__glyph {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: var(--radius-md);
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 1.4rem;
  flex-shrink: 0;
}

.contact-hint__text {
  color: var(--text-muted);
  font-size: 0.92rem;
}

.contact-hint__text span {
  display: block;
  margin-top: 0.4rem;
  font-size: 0.84rem;
}

/* --------------------------------------------------------------------------
   Despliegue animado del formulario
   `grid-template-rows: 0fr -> 1fr` permite animar hacia la altura real del
   contenido sin fijarla a mano.
   -------------------------------------------------------------------------- */
.contact-reveal {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transform: translateY(18px) scale(0.97);
  pointer-events: none;
  transition: grid-template-rows var(--dur-slow) var(--ease-out),
    opacity var(--dur-mid) var(--ease-out),
    transform var(--dur-slow) var(--ease-spring);
}

.contact-reveal__inner {
  overflow: hidden;
  min-height: 0;
}

.contact-reveal.is-open {
  grid-template-rows: 1fr;
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

/* Los campos entran escalonados una vez abierto el panel */
.contact-reveal.is-open .contact-field {
  animation: fade-up var(--dur-mid) var(--ease-out) backwards;
}

.contact-reveal.is-open .contact-field:nth-child(1) { animation-delay: 180ms; }
.contact-reveal.is-open .contact-field:nth-child(2) { animation-delay: 240ms; }
.contact-reveal.is-open .contact-field:nth-child(3) { animation-delay: 300ms; }
.contact-reveal.is-open .contact-field:nth-child(4) { animation-delay: 360ms; }
.contact-reveal.is-open .contact-field:nth-child(5) { animation-delay: 420ms; }
.contact-reveal.is-open .contact-field:nth-child(6) { animation-delay: 480ms; }
.contact-reveal.is-open .contact-field:nth-child(7) { animation-delay: 540ms; }
.contact-reveal.is-open .contact-field:nth-child(8) { animation-delay: 600ms; }

@media (prefers-reduced-motion: reduce) {
  .contact-reveal {
    transition: none;
  }
  .contact-reveal.is-open .contact-field {
    animation: none;
  }
}

/* Panel del formulario */
.contact-panel {
  padding: clamp(1.5rem, 3vw, 2.25rem);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-soft);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.contact-panel__head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border-soft);
}

.contact-panel__close {
  margin-left: auto;
  width: 34px;
  height: 34px;
  font-size: 0.9rem;
}

.contact-panel__title {
  font-size: var(--step-1);
  color: var(--brand);
}

.form-grid {
  display: grid;
  gap: var(--space-md);
}

@media (min-width: 560px) {
  .form-grid--2 {
    grid-template-columns: 1fr 1fr;
  }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.field__label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}

.field__control {
  width: 100%;
  padding: 0.75rem 0.95rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.92rem;
  transition: border-color var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-fast) var(--ease-out);
}

.field__control:focus {
  outline: none;
  border-color: var(--brand-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-accent) 18%, transparent);
}

.field__control::placeholder {
  color: var(--text-subtle);
}

textarea.field__control {
  resize: vertical;
  min-height: 120px;
}

/* Selector de intención en pastillas */
.intent-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.intent-chip {
  position: relative;
}

.intent-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.intent-chip span {
  display: inline-block;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
}

.intent-chip input:checked + span {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--on-brand);
}

.intent-chip input:focus-visible + span {
  outline: 2px solid var(--brand-accent);
  outline-offset: 2px;
}

.consent {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-size: 0.8rem;
  color: var(--text-subtle);
}

.consent input {
  margin-top: 0.2rem;
  accent-color: var(--brand-strong);
}

/* Honeypot: invisible para personas, visible para bots */
.hp-field {
  position: absolute !important;
  left: -9999px;
  opacity: 0;
  height: 0;
  width: 0;
  overflow: hidden;
}

.form-feedback {
  display: none;
  margin-top: var(--space-md);
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
}

.form-feedback.is-visible {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  animation: fade-up var(--dur-mid) var(--ease-out);
}

.form-feedback--ok {
  background: color-mix(in srgb, var(--success) 12%, transparent);
  color: var(--success);
}

.form-feedback--error {
  background: var(--danger-soft);
  color: var(--danger);
}

/* --------------------------------------------------------------------------
   Articulos
   -------------------------------------------------------------------------- */
.article-grid {
  display: grid;
  gap: clamp(1rem, 2vw, 1.75rem);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
}

.article-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  height: 100%;
}

.article-card__meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-subtle);
}

.article-card__title {
  font-size: var(--step-1);
  color: var(--brand);
}

.article-card__excerpt {
  color: var(--text-muted);
  font-size: 0.9rem;
  flex: 1;
}

/* Contenido renderizado desde Markdown */
.prose {
  max-width: 72ch;
  color: var(--text-muted);
  font-size: 1.04rem;
  line-height: 1.78;
}

.prose h2 {
  font-size: var(--step-3);
  color: var(--brand);
  margin-top: 2.5rem;
  margin-bottom: 0.85rem;
}

.prose h3 {
  font-size: var(--step-2);
  color: var(--brand);
  margin-top: 2rem;
  margin-bottom: 0.65rem;
}

.prose p + p {
  margin-top: 1.15rem;
}

.prose ul,
.prose ol {
  margin: 1.15rem 0;
  padding-left: 1.35rem;
  list-style: revert;
}

.prose li {
  margin-bottom: 0.5rem;
}

.prose a {
  color: var(--brand-accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.prose code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  padding: 0.15em 0.4em;
  border-radius: 4px;
  background: var(--surface-alt);
  color: var(--brand);
}

.prose pre {
  background: var(--band-bg);
  color: #e8eeff;
  padding: 1.25rem;
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin: 1.5rem 0;
}

.prose pre code {
  background: none;
  color: inherit;
  padding: 0;
}

.prose blockquote {
  margin: 1.5rem 0;
  padding-left: 1.25rem;
  border-left: 3px solid var(--brand-accent);
  color: var(--text);
  font-style: italic;
}

.prose figure {
  margin: 1.75rem 0;
}

.prose figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-md);
}

.prose figcaption {
  margin-top: 0.6rem;
  font-size: 0.85rem;
  color: var(--text-subtle);
  text-align: center;
}

/* --------------------------------------------------------------------------
   Paginas de detalle (proyecto / articulo)
   -------------------------------------------------------------------------- */
.detail-layout {
  display: grid;
  gap: clamp(1.75rem, 4vw, 3.5rem);
  align-items: start;
}

@media (min-width: 900px) {
  .detail-layout {
    grid-template-columns: minmax(0, 1fr) 320px;
  }
}

.demo-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface-alt);
}

.demo-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.metric-row {
  display: grid;
  gap: var(--space-md);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr));
}

.metric {
  text-align: center;
  padding: var(--space-lg);
}

.metric__value {
  font-family: var(--font-display);
  font-size: var(--step-2);
  font-weight: 800;
  color: var(--brand);
}

.metric__label {
  font-size: 0.82rem;
  color: var(--text-subtle);
  margin-top: 0.25rem;
}

/* --------------------------------------------------------------------------
   Modal
   -------------------------------------------------------------------------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  background: color-mix(in srgb, var(--navy-950) 55%, transparent);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur-mid) var(--ease-out), visibility var(--dur-mid);
}

.modal.is-open {
  opacity: 1;
  visibility: visible;
}

.modal__panel {
  width: min(600px, 100%);
  max-height: 85vh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: clamp(1.5rem, 3vw, 2.25rem);
  box-shadow: var(--shadow-lg);
  transform: scale(0.94) translateY(16px);
  transition: transform var(--dur-mid) var(--ease-spring);
}

.modal.is-open .modal__panel {
  transform: scale(1) translateY(0);
}

.modal__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

/* --------------------------------------------------------------------------
   Cinta de tecnologias
   -------------------------------------------------------------------------- */
.marquee {
  /* Cinta decorativa: en celular repite info que ya está en Skills, así
     que se oculta para no sumar más ruido a una pantalla chica. */
  display: none;
  overflow: hidden;
  border-block: 1px solid var(--border-soft);
  padding-block: 1.1rem;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}

@media (min-width: 640px) {
  .marquee {
    display: block;
  }
}

.marquee__track {
  display: flex;
  gap: 3rem;
  width: max-content;
  animation: marquee 38s linear infinite;
}

.marquee:hover .marquee__track {
  animation-play-state: paused;
}

.marquee__item {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-subtle);
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Cursor personalizado (solo puntero fino)
   -------------------------------------------------------------------------- */
.cursor-dot,
.cursor-ring {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 300;
  pointer-events: none;
  border-radius: 50%;
  opacity: 0;
  transition: opacity var(--dur-mid) var(--ease-out);
  will-change: transform;
}

.cursor-dot {
  width: 6px;
  height: 6px;
  background: var(--brand-accent);
  margin: -3px 0 0 -3px;
}

.cursor-ring {
  width: 34px;
  height: 34px;
  border: 1.5px solid color-mix(in srgb, var(--brand-accent) 55%, transparent);
  margin: -17px 0 0 -17px;
  transition: opacity var(--dur-mid) var(--ease-out),
    width var(--dur-fast) var(--ease-out), height var(--dur-fast) var(--ease-out),
    margin var(--dur-fast) var(--ease-out),
    background-color var(--dur-fast) var(--ease-out);
}

body.cursor-active .cursor-dot,
body.cursor-active .cursor-ring {
  opacity: 1;
}

body.cursor-hover .cursor-ring {
  width: 54px;
  height: 54px;
  margin: -27px 0 0 -27px;
  background: color-mix(in srgb, var(--brand-accent) 12%, transparent);
}

/* --------------------------------------------------------------------------
   Pagina de error
   -------------------------------------------------------------------------- */
.error-page {
  min-height: 78vh;
  display: grid;
  place-items: center;
  text-align: center;
  padding-block: 5rem;
}

.error-page__code {
  font-family: var(--font-display);
  font-size: clamp(5rem, 18vw, 11rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.05em;
  background: linear-gradient(160deg, var(--brand), var(--brand-accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
