/* =========================================================
   Arango Code — Camilo Arango
   Hoja de estilos principal
   ========================================================= */

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Colores base (tema oscuro por defecto) */
  --bg:            #070b14;
  --bg-soft:       #0d1424;
  --surface:       rgba(255, 255, 255, .045);
  --surface-2:     rgba(255, 255, 255, .07);
  --border:        rgba(255, 255, 255, .10);
  --border-strong: rgba(255, 255, 255, .18);
  --text:          #eef2ff;
  --text-soft:     #a8b3cf;
  --text-dim:      #6f7c9b;

  --accent:        #7c5cff;
  --accent-2:      #22d3ee;

  --radius-sm: 12px;
  --radius:    18px;
  --radius-lg: 26px;

  --shadow:    0 18px 50px -18px rgba(0, 0, 0, .75);
  --shadow-sm: 0 8px 24px -12px rgba(0, 0, 0, .6);

  --maxw: 1080px;
  --ease: cubic-bezier(.22, 1, .36, 1);
}

/* ---------- Tema claro ---------- */
html[data-theme="light"] {
  --bg:            #f4f6fc;
  --bg-soft:       #ffffff;
  --surface:       rgba(255, 255, 255, .82);
  --surface-2:     rgba(255, 255, 255, .95);
  --border:        rgba(16, 24, 48, .10);
  --border-strong: rgba(16, 24, 48, .18);
  --text:          #101833;
  --text-soft:     #4d5878;
  --text-dim:      #7c87a5;
  --shadow:        0 18px 50px -22px rgba(30, 40, 80, .35);
  --shadow-sm:     0 8px 24px -14px rgba(30, 40, 80, .32);
}

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  font-family: 'Outfit', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background .35s var(--ease), color .35s var(--ease);
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }

svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
svg.filled, .social svg, .card__icon svg.solid { fill: currentColor; stroke: none; }

:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 3px; border-radius: 8px; }

/* =========================================================
   Fondo decorativo
   ========================================================= */
.bg-fx { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: .5;
  animation: float 18s ease-in-out infinite;
}
.blob--1 { width: 46vmax; height: 46vmax; top: -16vmax; left: -12vmax; background: radial-gradient(circle, #7c5cff, transparent 68%); }
.blob--2 { width: 40vmax; height: 40vmax; top: 22%; right: -14vmax; background: radial-gradient(circle, #22d3ee, transparent 68%); animation-delay: -6s; }
.blob--3 { width: 38vmax; height: 38vmax; bottom: -14vmax; left: 18%; background: radial-gradient(circle, #f43f8e, transparent 68%); animation-delay: -12s; }

html[data-theme="light"] .blob { opacity: .28; }

.grid-lines {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(124, 92, 255, .07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(124, 92, 255, .07) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 30%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 30%, transparent 78%);
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%      { transform: translate(4vmax, -3vmax) scale(1.08); }
  66%      { transform: translate(-3vmax, 3vmax) scale(.94); }
}

/* =========================================================
   Layout
   ========================================================= */
.shell {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(20px, 5vw, 56px) clamp(16px, 4vw, 32px) 40px;
}

/* =========================================================
   Botón de tema
   ========================================================= */
.theme-toggle {
  position: fixed;
  top: clamp(12px, 3vw, 22px);
  right: clamp(12px, 3vw, 22px);
  z-index: 60;
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--text-soft);
  transition: transform .25s var(--ease), color .25s, border-color .25s;
}
.theme-toggle:hover { transform: rotate(-18deg) scale(1.08); color: var(--text); border-color: var(--border-strong); }
.theme-toggle svg { width: 19px; height: 19px; }
.theme-toggle .ico-moon { display: none; }
html[data-theme="light"] .theme-toggle .ico-moon { display: block; }
html[data-theme="light"] .theme-toggle .ico-sun  { display: none; }

/* =========================================================
   Perfil
   ========================================================= */
.profile {
  position: relative;
  text-align: center;
  padding: clamp(26px, 5vw, 40px) clamp(18px, 4vw, 40px) clamp(24px, 4vw, 34px);
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.profile::before {
  content: '';
  position: absolute; inset: 0 0 auto 0; height: 3px;
  background: linear-gradient(90deg, #7c5cff, #22d3ee, #f43f8e, #fbbf24, #7c5cff);
  background-size: 300% 100%;
  animation: slide 9s linear infinite;
}
@keyframes slide { to { background-position: 300% 0; } }

/* Botón volver */
.profile__back {
  position: absolute;
  top: 16px; left: 16px;
  display: none;
  align-items: center;
  gap: 6px;
  padding: 7px 14px 7px 10px;
  font-size: .82rem;
  font-weight: 500;
  color: var(--text-soft);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: transform .22s var(--ease), color .22s, border-color .22s;
}
.profile__back svg { width: 15px; height: 15px; }
.profile__back:hover { color: var(--text); border-color: var(--border-strong); transform: translateX(-3px); }
body[data-view="home"] .profile__back { display: none !important; }
body:not([data-view="home"]) .profile__back { display: inline-flex; }

/* Avatar */
.avatar {
  position: relative;
  width: clamp(112px, 26vw, 148px);
  aspect-ratio: 1;
  margin: 6px auto 18px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  isolation: isolate;
}
.avatar__ring {
  position: absolute; inset: -4px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, #7c5cff, #22d3ee, #f43f8e, #fbbf24, #7c5cff);
  animation: spin 6s linear infinite;
  z-index: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }
.avatar img,
.avatar__fallback {
  position: relative;
  z-index: 1;
  width: 100%; height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--bg);
  background: var(--bg-soft);
}
.avatar__fallback {
  display: none;
  place-items: center;
  font-size: clamp(2rem, 8vw, 2.7rem);
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text);
  background: linear-gradient(135deg, #7c5cff33, #22d3ee33);
}
.avatar.is-fallback img { display: none; }
.avatar.is-fallback .avatar__fallback { display: grid; }

.profile__name {
  font-size: clamp(1.7rem, 6vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.15;
}
.profile__brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 5px 15px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: clamp(.78rem, 2.6vw, .9rem);
  font-weight: 500;
  letter-spacing: .04em;
  color: var(--accent-2);
  background: rgba(34, 211, 238, .09);
  border: 1px solid rgba(34, 211, 238, .28);
  border-radius: 999px;
}
.profile__brand .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #22d3ee;
  box-shadow: 0 0 0 0 rgba(34, 211, 238, .7);
  animation: pulse 2.2s infinite;
}
@keyframes pulse {
  70%  { box-shadow: 0 0 0 9px rgba(34, 211, 238, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 211, 238, 0); }
}
.profile__tagline {
  margin: 14px auto 0;
  max-width: 46ch;
  font-size: clamp(.9rem, 2.8vw, 1.02rem);
  color: var(--text-soft);
}

/* Redes */
.socials { display: flex; justify-content: center; gap: 12px; margin-top: 22px; }
.social {
  width: 46px; height: 46px;
  display: grid; place-items: center;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-soft);
  transition: transform .28s var(--ease), color .28s, border-color .28s, box-shadow .28s, background .28s;
}
.social svg { width: 20px; height: 20px; }
.social:hover { transform: translateY(-4px) scale(1.06); color: #fff; }
.social--gh:hover { background: #24292f; border-color: #24292f; box-shadow: 0 12px 26px -12px #24292f; }
.social--x:hover  { background: #000;    border-color: #000;    box-shadow: 0 12px 26px -12px #000; }
.social--ig:hover { background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888); border-color: transparent; box-shadow: 0 12px 26px -12px #dc2743; }

/* =========================================================
   Cabecera de vista
   ========================================================= */
.view-head { margin-top: clamp(26px, 5vw, 40px); text-align: center; }
.view-head__title {
  font-size: clamp(1.35rem, 5vw, 1.9rem);
  font-weight: 700;
  letter-spacing: -.02em;
}
.view-head__desc {
  margin: 8px auto 0;
  max-width: 60ch;
  font-size: clamp(.88rem, 2.6vw, .97rem);
  color: var(--text-soft);
}

/* Chips de categoría */
.chips {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  margin: 20px -4px 0;
  padding: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  scroll-snap-align: start;
  padding: 7px 15px;
  font-size: .83rem;
  font-weight: 500;
  white-space: nowrap;
  color: var(--text-soft);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: color .22s, background .22s, border-color .22s, transform .22s var(--ease);
}
.chip:hover { color: var(--text); border-color: var(--border-strong); transform: translateY(-2px); }
.chip.is-active {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  box-shadow: 0 10px 22px -12px var(--accent);
}
@media (min-width: 760px) { .chips { flex-wrap: wrap; justify-content: center; overflow: visible; } }

/* Buscador */
.search-wrap {
  position: relative;
  max-width: 420px;
  margin: 16px auto 0;
}
.search-wrap svg {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  width: 17px; height: 17px;
  color: var(--text-dim);
  pointer-events: none;
}
.search-wrap input {
  width: 100%;
  padding: 11px 16px 11px 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: .92rem;
  transition: border-color .22s, background .22s;
}
.search-wrap input::placeholder { color: var(--text-dim); }
.search-wrap input:focus { outline: none; border-color: var(--accent); background: var(--surface-2); }
.search-wrap input::-webkit-search-cancel-button { filter: grayscale(1) opacity(.6); cursor: pointer; }

/* =========================================================
   Contenido / rejillas
   ========================================================= */
.content { margin-top: clamp(22px, 4vw, 32px); }

/* --- Rejilla del home: tarjetas grandes de colores --- */
.grid-home {
  display: grid;
  gap: clamp(14px, 2.6vw, 20px);
  grid-template-columns: 1fr;
}
@media (min-width: 720px) { .grid-home { grid-template-columns: repeat(3, 1fr); } }

.hero-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: clamp(20px, 4vw, 28px);
  min-height: 168px;
  border-radius: var(--radius-lg);
  color: #fff;
  overflow: hidden;
  isolation: isolate;
  box-shadow: var(--shadow-sm);
  transition: transform .34s var(--ease), box-shadow .34s var(--ease);
  animation: rise .55s var(--ease) both;
}
.hero-card::before {
  content: '';
  position: absolute; inset: 0; z-index: -2;
  background: var(--grad);
}
.hero-card::after {
  content: '';
  position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(255, 255, 255, .28), transparent 55%),
    radial-gradient(90% 70% at 0% 100%, rgba(0, 0, 0, .28), transparent 60%);
  opacity: .9;
  transition: opacity .34s var(--ease);
}
.hero-card:hover { transform: translateY(-8px) scale(1.015); box-shadow: 0 26px 50px -20px var(--glow); }
.hero-card:hover::after { opacity: 1; }
.hero-card:active { transform: translateY(-2px) scale(.995); }

.hero-card__icon {
  width: 48px; height: 48px;
  display: grid; place-items: center;
  border-radius: 14px;
  background: rgba(255, 255, 255, .2);
  border: 1px solid rgba(255, 255, 255, .3);
  backdrop-filter: blur(6px);
}
.hero-card__icon svg { width: 24px; height: 24px; }
.hero-card__title { font-size: clamp(1.08rem, 3.4vw, 1.22rem); font-weight: 700; letter-spacing: -.01em; line-height: 1.25; }
.hero-card__desc { font-size: .88rem; line-height: 1.5; color: rgba(255, 255, 255, .9); }
.hero-card__foot {
  margin-top: auto;
  padding-top: 12px;
  display: flex; align-items: center; justify-content: space-between;
  font-size: .8rem; font-weight: 600;
  letter-spacing: .02em;
}
.hero-card__count {
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .22);
  border: 1px solid rgba(255, 255, 255, .28);
  font-variant-numeric: tabular-nums;
}
.hero-card__arrow { width: 20px; height: 20px; transition: transform .3s var(--ease); }
.hero-card:hover .hero-card__arrow { transform: translateX(5px); }

@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* --- Rejilla de items --- */
.grid-items {
  display: grid;
  gap: clamp(12px, 2.2vw, 18px);
  grid-template-columns: 1fr;
}
@media (min-width: 560px) { .grid-items { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .grid-items { grid-template-columns: repeat(3, 1fr); } }

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px 18px 18px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  text-align: left;
  width: 100%;
  overflow: hidden;
  transition: transform .3s var(--ease), border-color .3s, background .3s, box-shadow .3s;
  animation: rise .45s var(--ease) both;
}
.card::before {
  content: '';
  position: absolute; inset: 0 0 auto 0; height: 3px;
  background: var(--accent-c, var(--accent));
  opacity: .85;
  transform: scaleX(.25);
  transform-origin: left;
  transition: transform .35s var(--ease);
}
.card:hover {
  transform: translateY(-5px);
  border-color: var(--border-strong);
  background: var(--surface-2);
  box-shadow: 0 20px 40px -22px var(--accent-c, var(--accent));
}
.card:hover::before { transform: scaleX(1); }

.card__top { display: flex; align-items: center; gap: 11px; }
.card__badge {
  flex: 0 0 auto;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 11px;
  font-size: .95rem;
  font-weight: 700;
  color: #fff;
  background: var(--accent-c, var(--accent));
  box-shadow: 0 8px 18px -10px var(--accent-c, var(--accent));
}
.card__top > span:last-child { min-width: 0; }
.card__name { display: block; font-size: 1rem; font-weight: 600; letter-spacing: -.01em; line-height: 1.25; overflow-wrap: anywhere; }
.card__cat {
  display: block;
  font-size: .72rem;
  font-weight: 500;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-top: 2px;
}
.card__desc { font-size: .875rem; color: var(--text-soft); line-height: 1.55; flex: 1; }
.card__foot {
  margin-top: 10px;
  display: flex; align-items: center; gap: 6px;
  font-size: .82rem; font-weight: 600;
  color: var(--accent-c, var(--accent));
}
.card__foot svg { width: 15px; height: 15px; transition: transform .28s var(--ease); }
.card:hover .card__foot svg { transform: translate(3px, -3px); }
.card--prompt:hover .card__foot svg { transform: translateY(-2px); }

.empty {
  text-align: center;
  padding: 50px 20px;
  color: var(--text-dim);
  font-size: .95rem;
}
.empty strong { display: block; color: var(--text-soft); font-size: 1.05rem; margin-bottom: 6px; }

/* =========================================================
   Modal
   ========================================================= */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal__backdrop {
  position: absolute; inset: 0;
  background: rgba(3, 6, 15, .72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fade .25s ease both;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.modal__box {
  position: relative;
  width: min(720px, 100%);
  max-height: min(86vh, 760px);
  display: flex;
  flex-direction: column;
  padding: clamp(20px, 4vw, 30px);
  border-radius: var(--radius-lg);
  background: var(--bg-soft);
  border: 1px solid var(--border-strong);
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, .8);
  animation: pop .34s var(--ease) both;
}
@keyframes pop {
  from { opacity: 0; transform: translateY(22px) scale(.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal__close {
  position: absolute; top: 14px; right: 14px;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 50%;
  color: var(--text-dim);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: color .2s, transform .2s var(--ease);
}
.modal__close:hover { color: var(--text); transform: rotate(90deg); }
.modal__close svg { width: 16px; height: 16px; }

.modal__tag {
  display: inline-block;
  align-self: flex-start;
  padding: 4px 11px;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--accent-2);
  background: rgba(34, 211, 238, .1);
  border: 1px solid rgba(34, 211, 238, .28);
  border-radius: 999px;
}
.modal__title { margin-top: 10px; padding-right: 34px; font-size: clamp(1.15rem, 4vw, 1.4rem); font-weight: 700; letter-spacing: -.02em; }
.modal__desc { margin-top: 6px; font-size: .9rem; color: var(--text-soft); }

.modal__codewrap {
  margin-top: 16px;
  flex: 1;
  min-height: 0;
  overflow: auto;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, .32);
  border: 1px solid var(--border);
}
html[data-theme="light"] .modal__codewrap { background: #f1f3f9; }
.modal__code {
  padding: 16px;
  font-family: 'JetBrains Mono', ui-monospace, 'Courier New', monospace;
  font-size: .82rem;
  line-height: 1.65;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

.modal__actions { margin-top: 16px; display: flex; gap: 10px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px;
  border-radius: 12px;
  font-size: .9rem; font-weight: 600;
  border: 1px solid transparent;
  transition: transform .22s var(--ease), filter .22s, background .22s, border-color .22s;
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { transform: translateY(-2px); }
.btn--primary { color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 14px 28px -14px var(--accent); }
.btn--primary:hover { filter: brightness(1.08); }
.btn--primary.is-done { background: linear-gradient(135deg, #16a34a, #4ade80); box-shadow: 0 14px 28px -14px #16a34a; }
.btn--ghost { color: var(--text-soft); background: var(--surface); border-color: var(--border); }
.btn--ghost:hover { color: var(--text); border-color: var(--border-strong); }
@media (max-width: 460px) { .btn { flex: 1; } }

/* =========================================================
   Toast
   ========================================================= */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 200;
  transform: translate(-50%, 130%);
  padding: 11px 22px;
  border-radius: 999px;
  font-size: .88rem; font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #16a34a, #22c55e);
  box-shadow: 0 18px 40px -16px rgba(22, 163, 74, .8);
  opacity: 0;
  transition: transform .4s var(--ease), opacity .4s var(--ease);
  pointer-events: none;
}
.toast.is-visible { transform: translate(-50%, 0); opacity: 1; }

/* =========================================================
   Footer
   ========================================================= */
.footer {
  margin-top: clamp(38px, 7vw, 64px);
  text-align: center;
  font-size: .83rem;
  color: var(--text-dim);
}
.footer__sub { margin-top: 4px; font-size: .78rem; opacity: .75; }

/* =========================================================
   Accesibilidad
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
