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

:root {
  --bg:          #f8f8f6;
  --surface:     #ffffff;
  --border:      #e8e8e4;
  --text:        #1a1a1a;
  --text-muted:  #6b7280;
  --accent:      #ed2b33;
  --accent-light:#fff0f0;
  --radius:      12px;
  --shadow:      0 2px 12px rgba(0,0,0,0.07);
  --header-h:    60px;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow: hidden; /* evita scroll en body; cada panel scrollea por su cuenta */
}

/* ── Split layout ─────────────────────────────────────────── */
.split-layout {
  display: flex;
  height: 100vh;
}

/* ── Panel izquierdo: Sobre mí ────────────────────────────── */
.panel-about {
  width: 380px;
  flex-shrink: 0;
  overflow-y: auto;
  padding: 3rem 2.5rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

/* scrollbar sutil */
.panel-about::-webkit-scrollbar { width: 4px; }
.panel-about::-webkit-scrollbar-track { background: transparent; }
.panel-about::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.about-inner {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Avatar */
.about-avatar img {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--accent);
  display: block;
}

.avatar-placeholder {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 1.3rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid var(--accent);
}

/* Nombre */
.about-inner h1 {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1.15;
}
.accent { color: var(--accent); }

.about-tagline {
  font-size: 0.88rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: -0.5rem;
}

.about-bio {
  font-size: 0.88rem;
  color: #374151;
  line-height: 1.8;
}

.skills h3 {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.skill-tags { display: flex; flex-wrap: wrap; gap: 0.35rem; }

/* Botones sociales */
.about-social {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding-top: 0.25rem;
  align-items: center;
}

.social-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1.5px solid var(--accent);
  color: var(--accent);
  text-decoration: none;
  transition: all 0.2s;
  background: var(--surface);
}
.social-btn:hover { background: var(--accent-light); }
.social-btn-mail:hover { background: var(--accent-light); }
.social-btn-cv:hover { background: var(--accent-light); }

.tag {
  background: var(--accent-light);
  color: var(--accent);
  border: 1px solid #fecaca;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.2rem 0.55rem;
  border-radius: 100px;
}
.tag.small { font-size: 0.68rem; padding: 0.12rem 0.45rem; }

/* ── Divisor vertical ─────────────────────────────────────── */
.divider {
  width: 1px;
  background: var(--border);
  flex-shrink: 0;
  align-self: stretch;
}

/* ── Panel derecho: Proyectos ─────────────────────────────── */
.panel-projects {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 3rem 2.5rem 4rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.panel-projects::-webkit-scrollbar { width: 4px; }
.panel-projects::-webkit-scrollbar-track { background: transparent; }
.panel-projects::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.projects-header {
  margin-bottom: 2rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.projects-header h2 { font-size: 1.5rem; font-weight: 800; }

.projects-sub { color: var(--text-muted); font-size: 0.88rem; margin-top: 0.2rem; }

/* ── Carousel ─────────────────────────────────────────────── */
.carousel-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

/* Recorta el carrusel: el track se desplaza dentro sin desbordar la página */
.carousel-viewport {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  padding: 0.5rem 0.25rem;
  border-radius: var(--radius);
}

.carousel-track {
  display: flex;
  gap: 1.25rem;
  width: max-content;
  transition: transform 0.35s ease;
  will-change: transform;
}

/* ── Project Card ─────────────────────────────────────────── */
.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem;
  min-width: 270px;
  max-width: 270px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}
.project-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}

/* Fila superior: categoría + badge privado */
.card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-tag {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
}

/* Badge repositorio privado (GitHub logo + texto) */
.card-private-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.65rem;
  font-weight: 700;
  color: #374151;
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  padding: 0.18rem 0.5rem;
  border-radius: 100px;
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1;
}
.card-private-badge svg { flex-shrink: 0; color: #374151; }

.card-title {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
}

.card-desc {
  font-size: 0.82rem;
  color: #4b5563;
  line-height: 1.75;
  flex: 1;
}

.card-cocreate {
  margin-top: -0.15rem;
  margin-bottom: 0.1rem;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.card-cocreate a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}
.card-cocreate a:hover { text-decoration: underline; }

.card-stack { display: flex; flex-wrap: wrap; gap: 0.28rem; }

/* Versión + Fecha */
.card-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border);
}

.card-version {
  font-size: 0.72rem;
  font-weight: 700;
  font-family: "SF Mono", "Fira Code", "Consolas", monospace;
  color: var(--accent);
  background: var(--accent-light);
  padding: 0.12rem 0.45rem;
  border-radius: 5px;
  border: 1px solid #fecaca;
}

.card-version-date {
  font-weight: 400;
  opacity: 0.7;
}

/* Footer: badge privado (izq) + links (der) */
.card-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  width: 100%;
  position: relative;
}

.card-links { display: flex; gap: 0.75rem; margin-left: auto; }

.card-link {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
  line-height: 1;
  display: inline-flex;
  align-items: center;
}
.card-link:hover { color: var(--text); }
.card-link.primary-link { color: var(--accent); }
.card-link.primary-link:hover { color: #c0111a; }

/* ── Carousel Arrows ──────────────────────────────────────── */
.carousel-arrow {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  color: var(--text);
}
.carousel-arrow:hover    { border-color: var(--accent); color: var(--accent); }
.carousel-arrow:disabled { opacity: 0.3; cursor: default; }

/* ── Dots ─────────────────────────────────────────────────── */
.carousel-dots { display: flex; gap: 0.4rem; margin-top: 1.5rem; align-self: center; }

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--border);
  cursor: pointer;
  transition: all 0.2s;
  border: none;
}
.dot.active { background: var(--accent); transform: scale(1.3); }

/* ── Modal streaming demo ──────────────────────────────────── */
.demo-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 1rem;
}

.demo-modal-overlay.open {
  display: flex;
}

.demo-modal-card {
  position: relative;
  width: min(1100px, 96vw);
  height: min(86vh, 820px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.22);
  overflow: hidden;
}

.demo-modal-close {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  z-index: 2;
}

.demo-modal-close:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.demo-modal-frame {
  width: 100%;
  height: 100%;
  border: none;
  background: #fff;
}

/* ── Modal vídeo DataRaices ────────────────────────────────── */
.dataraces-video-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: max(0.75rem, env(safe-area-inset-top)) max(0.75rem, env(safe-area-inset-right))
    max(0.75rem, env(safe-area-inset-bottom)) max(0.75rem, env(safe-area-inset-left));
  box-sizing: border-box;
}

.dataraces-video-overlay.open {
  display: flex;
}

.dataraces-video-card {
  display: flex;
  flex-direction: column;
  width: min(1100px, 100%);
  max-width: 100%;
  max-height: min(92vh, 900px);
  background: linear-gradient(180deg, #141414 0%, #0a0a0a 36%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}

.dataraces-video-header {
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1rem 0.85rem 1.15rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.dataraces-video-header-text {
  min-width: 0;
}

.dataraces-video-eyebrow {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
  margin-bottom: 0.25rem;
}

.dataraces-video-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: #fafafa;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.dataraces-video-sub {
  margin-top: 0.3rem;
  font-size: 0.82rem;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.55);
  max-width: 36em;
}

.dataraces-video-close {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  margin-top: 0.1rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(30, 30, 30, 0.95);
  color: #f4f4f5;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dataraces-video-close:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.dataraces-video-inner {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 0.85rem 0.85rem;
  background: #000;
  line-height: 0;
  width: 100%;
}

.dataraces-video-embed {
  position: relative;
  width: 100%;
  max-width: 100%;
  aspect-ratio: 16 / 9;
  max-height: min(calc(92vh - 9.5rem), 76vh);
  margin: 0 auto;
  border-radius: 10px;
  overflow: hidden;
  background: #000;
}

.dataraces-video-iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* Tablet y móvil: una tarjeta por vista (anchos los fija JS según .carousel-viewport) */
@media (max-width: 1024px) {
  html,
  body {
    overflow-x: hidden;
  }

  .carousel-wrapper {
    gap: 0.5rem;
  }

  .carousel-viewport {
    padding: 0.35rem 0.1rem;
  }

  .project-card {
    min-width: 0;
    max-width: none;
  }

  .carousel-dots {
    width: 100%;
    justify-content: center;
  }
}

/* ── Responsive: móvil ────────────────────────────────────── */
@media (max-width: 768px) {
  html, body { overflow-x: hidden; overflow-y: auto; }

  .split-layout {
    flex-direction: column;
    height: auto;
    overflow-x: hidden;
    overflow-y: visible;
    max-width: 100%;
  }

  .panel-about {
    width: 100%;
    max-width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 2rem 1.5rem;
    overflow-x: hidden;
    box-sizing: border-box;
  }

  .divider { display: none; }

  .panel-projects {
    padding: 2rem 1.5rem 3rem;
    overflow-x: hidden;
    max-width: 100%;
  }

  .carousel-arrow {
    width: 34px;
    height: 34px;
    font-size: 0.9rem;
  }
  .demo-modal-card { width: 96vw; height: 90vh; border-radius: 12px; }

  .dataraces-video-card {
    border-radius: 12px;
    max-height: min(94vh, 900px);
  }

  .dataraces-video-header {
    padding: 0.85rem 0.85rem 0.7rem;
    align-items: center;
  }

  .dataraces-video-title {
    font-size: 1.05rem;
  }

  .dataraces-video-sub {
    font-size: 0.78rem;
    margin-top: 0.25rem;
  }

  .dataraces-video-inner {
    padding: 0.45rem 0.5rem 0.65rem;
  }

  .dataraces-video-embed {
    max-height: min(calc(94vh - 10rem), 70vh);
    border-radius: 8px;
  }
}
