/* ==========================================================
   Portal de Proyectos - Laboratorio de Innovaci\0000F3n
   Est\0000E9tica: gradientes modernos (tipo "Pandora") + hero
   editorial grande (tipo "Resto"). Inter + Playfair Display.
   ========================================================== */

:root {
  --brand-1: #6366f1;   /* indigo  */
  --brand-2: #ec4899;   /* pink    */
  --brand-3: #f59e0b;   /* amber   */
  --brand-4: #10b981;   /* emerald */
  --bg:       #fbfaff;
  --ink:      #0f172a;
  --muted:    #64748b;
  --card:     #ffffff;
  --border:   rgba(15, 23, 42, 0.08);
  --shadow-sm: 0 6px 18px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 18px 40px rgba(99, 102, 241, 0.10), 0 6px 16px rgba(236, 72, 153, 0.06);
  --radius:   1rem;
  --radius-lg: 1.4rem;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(800px 500px at 0% -10%, rgba(99, 102, 241, 0.18), transparent 60%),
    radial-gradient(700px 420px at 100% 0%, rgba(236, 72, 153, 0.16), transparent 62%),
    radial-gradient(640px 420px at 50% 100%, rgba(245, 158, 11, 0.12), transparent 60%),
    var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: 'Playfair Display', Georgia, serif;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0 0 .5rem;
}

h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); line-height: 1.05; font-weight: 700; }
h2 { font-size: clamp(1.6rem, 3vw, 2.3rem); font-weight: 700; }
h3 { font-size: 1.25rem; font-weight: 600; font-family: 'Inter', sans-serif; letter-spacing: -0.01em; }

p { color: var(--muted); line-height: 1.65; }

a { color: inherit; text-decoration: none; }

.container {
  width: min(1180px, 92%);
  margin-inline: auto;
}

/* ---------------- NAVBAR ---------------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(14px);
  background: linear-gradient(180deg, rgba(255,255,255,.9), rgba(255,255,255,.72));
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: .95rem 0;
}
.brand {
  display: flex; align-items: center; gap: .7rem;
  font-weight: 700; letter-spacing: -0.01em;
}
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px;
  background: conic-gradient(from 200deg, var(--brand-1), var(--brand-2), var(--brand-3), var(--brand-4), var(--brand-1));
  box-shadow: var(--shadow-sm);
}
.brand-text small { display:block; font-size: .72rem; color: var(--muted); font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; }
.nav-links { display: flex; gap: .25rem; align-items: center; }
.nav-links a {
  padding: .55rem .9rem; border-radius: .75rem;
  color: var(--muted); font-weight: 500; font-size: .94rem;
  transition: all .2s ease;
}
.nav-links a:hover { background: rgba(99,102,241,.08); color: var(--ink); }
.nav-links a.active {
  background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
  color: #fff;
  box-shadow: 0 8px 18px rgba(99,102,241,.25);
}
.nav-cta {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .6rem 1rem; border-radius: .75rem;
  background: var(--ink); color: #fff; font-weight: 600; font-size: .9rem;
}
.nav-cta:hover { background: #1e293b; }
.nav-toggle { display: none; background: none; border: 1px solid var(--border); border-radius: .6rem; padding: .45rem .6rem; cursor: pointer; }

@media (max-width: 860px) {
  .nav-toggle { display: inline-block; }
  .nav-links, .nav-cta-desktop { display: none; }
  .nav-links.open {
    display: flex; flex-direction: column; align-items: stretch;
    position: absolute; top: 68px; left: 4%; right: 4%;
    background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
    padding: .6rem; box-shadow: var(--shadow-md);
  }
}

/* ---------------- BUTTONS ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  padding: .85rem 1.3rem; border-radius: .9rem;
  font-weight: 600; font-size: .95rem;
  border: 1px solid transparent; cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
  text-decoration: none;
}
.btn-primary {
  background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
  color: #fff;
  box-shadow: 0 14px 28px rgba(99,102,241,.25);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 20px 34px rgba(99,102,241,.32); }
.btn-ghost {
  background: #fff; color: var(--ink); border-color: var(--border);
}
.btn-ghost:hover { background: #f8fafc; }

/* ---------------- HERO (Landing) ---------------- */
.hero {
  padding: 4rem 0 3rem;
  display: grid; grid-template-columns: 1.05fr .95fr; gap: 3rem;
  align-items: center;
}
.hero .eyebrow {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .35rem .75rem; border-radius: 999px;
  background: linear-gradient(135deg, rgba(99,102,241,.08), rgba(236,72,153,.08));
  border: 1px solid rgba(99,102,241,.15);
  color: #4338ca; font-weight: 600; font-size: .78rem; letter-spacing: .02em;
  margin-bottom: 1.1rem;
}
.hero h1 .accent {
  background: linear-gradient(90deg, var(--brand-1), var(--brand-2) 55%, var(--brand-3));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-lead { font-size: 1.08rem; margin: 1.1rem 0 1.6rem; max-width: 52ch; }
.hero-ctas { display: flex; gap: .75rem; flex-wrap: wrap; margin-bottom: 2rem; }
.hero-stats {
  display: flex; gap: 2rem; padding-top: 1.4rem;
  border-top: 1px solid var(--border);
}
.hero-stat strong { display: block; font-size: 1.4rem; color: var(--ink); font-family: 'Playfair Display', serif; }
.hero-stat span { color: var(--muted); font-size: .85rem; }

.hero-visual {
  position: relative; aspect-ratio: 4/5; border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 20% 15%, rgba(99,102,241,.22), transparent 55%),
    radial-gradient(circle at 85% 20%, rgba(236,72,153,.18), transparent 52%),
    radial-gradient(circle at 50% 95%, rgba(245,158,11,.20), transparent 58%),
    linear-gradient(180deg, #ffffff, #f5f3ff);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.hero-svg {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: block;
  z-index: 1;
}
.hero-visual::after {
  content: none;
}
.hero-visual .float-badge {
  position: absolute; z-index: 2;
  background: rgba(255,255,255,.96); border-radius: 1rem;
  padding: .8rem 1rem; font-size: .85rem; font-weight: 600;
  box-shadow: var(--shadow-sm);
  display: flex; align-items: center; gap: .6rem;
}
.hero-visual .badge-top { top: 1.2rem; left: 1.2rem; }
.hero-visual .badge-bottom { bottom: 1.4rem; right: 1.4rem; }
.badge-dot { width: .55rem; height: .55rem; border-radius: 50%; background: var(--brand-4); box-shadow: 0 0 0 3px rgba(16,185,129,.2); }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; gap: 2rem; padding: 2rem 0; }
  .hero-visual { aspect-ratio: 16/11; }
  .hero-stats { flex-wrap: wrap; gap: 1.2rem; }
}

/* ---------------- SECTION ---------------- */
.section { padding: 4rem 0; }
.section-title { text-align: center; margin-bottom: 2.5rem; }
.section-title .eyebrow {
  display: inline-flex; padding: .35rem .75rem; border-radius: 999px;
  background: rgba(99,102,241,.08); color: #4338ca; font-weight: 600; font-size: .78rem;
  margin-bottom: .8rem; letter-spacing: .04em; text-transform: uppercase;
}
.section-title p { max-width: 52ch; margin: .5rem auto 0; }

/* Areas grid */
.areas { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1.1rem; }
.area-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.3rem;
  box-shadow: var(--shadow-sm); transition: transform .2s ease, box-shadow .2s ease;
}
.area-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.area-icon {
  width: 42px; height: 42px; border-radius: .7rem;
  display: grid; place-items: center; font-size: 1.1rem;
  margin-bottom: .85rem;
}
.area-icon.c1 { background: linear-gradient(135deg, rgba(99,102,241,.15), rgba(99,102,241,.25)); color: #4338ca; }
.area-icon.c2 { background: linear-gradient(135deg, rgba(236,72,153,.15), rgba(236,72,153,.25)); color: #be185d; }
.area-icon.c3 { background: linear-gradient(135deg, rgba(245,158,11,.15), rgba(245,158,11,.25)); color: #b45309; }
.area-icon.c4 { background: linear-gradient(135deg, rgba(16,185,129,.15), rgba(16,185,129,.25)); color: #047857; }
.area-icon.c5 { background: linear-gradient(135deg, rgba(14,165,233,.15), rgba(14,165,233,.25)); color: #0369a1; }
.area-icon.c6 { background: linear-gradient(135deg, rgba(168,85,247,.15), rgba(168,85,247,.25)); color: #7e22ce; }
.area-card h3 { margin-bottom: .35rem; }
.area-card p { font-size: .92rem; margin: 0; }

/* ---------------- PAGE HEADER (Proyectos) ---------------- */
.page-header { padding: 3.5rem 0 1rem; }
.page-header .eyebrow {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .35rem .75rem; border-radius: 999px;
  background: linear-gradient(135deg, rgba(99,102,241,.08), rgba(236,72,153,.08));
  border: 1px solid rgba(99,102,241,.15);
  color: #4338ca; font-weight: 600; font-size: .78rem;
  margin-bottom: 1rem;
}
.page-header h1 .accent {
  background: linear-gradient(90deg, var(--brand-1), var(--brand-2), var(--brand-3));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.page-header .lead { font-size: 1.05rem; max-width: 60ch; margin: 1rem 0 1.5rem; }

/* Filters */
.filters {
  display: flex; flex-wrap: wrap; gap: .5rem;
  padding: 1rem 0 2rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
}
.chip {
  padding: .4rem .85rem; border-radius: 999px;
  border: 1px solid var(--border); background: #fff;
  font-size: .85rem; font-weight: 500; color: var(--muted);
  cursor: pointer; transition: all .18s ease;
}
.chip:hover { border-color: rgba(99,102,241,.35); color: var(--ink); }
.chip.active {
  background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
  color: #fff; border-color: transparent;
  box-shadow: 0 6px 14px rgba(99,102,241,.22);
}

/* ---------------- PROJECTS GRID ---------------- */
.projects-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.4rem;
}
.project-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
  display: flex; flex-direction: column;
  cursor: pointer;
}
.project-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-md);
  border-color: rgba(99,102,241,.25);
}
.project-card .thumb {
  aspect-ratio: 16/10;
  background: linear-gradient(135deg, rgba(99,102,241,.15), rgba(236,72,153,.15));
  background-size: cover; background-position: center;
  position: relative;
}
.project-card .thumb::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 60%, rgba(15,23,42,.35));
}
.project-card .thumb .badge-cat {
  position: absolute; top: .8rem; left: .8rem; z-index: 2;
  background: rgba(255,255,255,.94); padding: .3rem .65rem;
  border-radius: 999px; font-size: .72rem; font-weight: 600;
  color: #4338ca;
}
.project-card .body { padding: 1.2rem 1.3rem 1.4rem; display: flex; flex-direction: column; gap: .6rem; flex: 1; }
.project-card h3 { font-family: 'Playfair Display', serif; font-size: 1.25rem; font-weight: 700; margin: 0; }
.project-card .summary { color: var(--muted); font-size: .93rem; margin: 0; line-height: 1.55; }
.project-card .team-line { font-size: .8rem; color: var(--muted); margin-top: .3rem; }
.project-card .team-line strong { color: var(--ink); font-weight: 600; }
.project-card .tech { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: auto; padding-top: .4rem; }
.project-card .tech-chip {
  font-size: .72rem; padding: .25rem .6rem; border-radius: 999px;
  background: rgba(99,102,241,.07); color: #4338ca; font-weight: 500;
  border: 1px solid rgba(99,102,241,.12);
}

/* ---------------- DETAIL PAGE ---------------- */
.detail-hero {
  padding: 3rem 0 2rem;
  display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem;
  align-items: center;
}
.detail-hero .cover {
  aspect-ratio: 5/4;
  background-size: cover; background-position: center;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}
.detail-meta { display: flex; gap: .8rem; flex-wrap: wrap; font-size: .85rem; color: var(--muted); margin: .6rem 0 1rem; }
.detail-meta span { background: #fff; padding: .3rem .7rem; border-radius: 999px; border: 1px solid var(--border); }
.detail-back { color: var(--muted); font-size: .9rem; display: inline-flex; gap: .4rem; align-items: center; margin-bottom: 1rem; }
.detail-back:hover { color: var(--brand-1); }

.detail-body { padding: 2rem 0 4rem; }
.detail-grid {
  display: grid; grid-template-columns: 1.4fr .8fr; gap: 2.5rem;
}
.gallery {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px,1fr));
  gap: 1rem; margin: 2rem 0;
}
.gallery img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: var(--radius); box-shadow: var(--shadow-sm); transition: transform .2s; cursor: pointer; }
.gallery img:hover { transform: scale(1.02); }

.highlights { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.5rem; box-shadow: var(--shadow-sm); }
.highlights h4 { font-family: 'Inter', sans-serif; font-size: .95rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 1rem; font-weight: 600; }
.highlights ul { list-style: none; padding: 0; margin: 0; }
.highlights li { padding: .5rem 0; border-bottom: 1px dashed var(--border); display: flex; gap: .6rem; align-items: flex-start; }
.highlights li:last-child { border: none; }
.highlights li::before { content: '\002726'; color: var(--brand-2); font-weight: bold; }

.tech-grid { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1.4rem; }
.tech-grid .tech-chip {
  font-size: .8rem; padding: .4rem .8rem; border-radius: 999px;
  background: linear-gradient(135deg, rgba(99,102,241,.08), rgba(236,72,153,.08));
  color: #4338ca; font-weight: 500;
  border: 1px solid rgba(99,102,241,.15);
}

@media (max-width: 860px) {
  .detail-hero, .detail-grid { grid-template-columns: 1fr; }
}

/* ---------------- CTA / FOOTER ---------------- */
.cta-panel {
  background: linear-gradient(135deg, rgba(99,102,241,.10), rgba(236,72,153,.10), rgba(245,158,11,.10));
  border: 1px solid rgba(99,102,241,.18);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  text-align: center;
  margin: 3rem 0;
}
.footer {
  border-top: 1px solid var(--border);
  padding: 2.2rem 0;
  background: linear-gradient(180deg, transparent, rgba(255,255,255,.6));
}
.footer-inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; }
.footer small { color: var(--muted); }

/* Reveal-on-scroll */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: translateY(0); }

/* Loading skeleton */
.skeleton { background: linear-gradient(90deg, #f1f5f9, #e2e8f0, #f1f5f9); background-size: 200% 100%; animation: skeleton 1.4s ease infinite; border-radius: var(--radius); }
@keyframes skeleton { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

/* ---------------- ADMIN DASHBOARD ---------------- */
.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 1.2rem; box-shadow: var(--shadow-sm); }
.stat-card .label { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.stat-card .value { font-family: 'Playfair Display', serif; font-size: 2rem; margin-top: .35rem; color: var(--ink); }
.table-soft { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.table-soft th, .table-soft td { padding: .75rem 1rem; text-align: left; border-bottom: 1px solid var(--border); font-size: .9rem; }
.table-soft th { background: #f8fafc; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-size: .74rem; }
.table-soft tbody tr:last-child td { border-bottom: none; }
.bar { height: 8px; background: linear-gradient(90deg, var(--brand-1), var(--brand-2)); border-radius: 999px; }