/* ===== VARIABLES (paleta corporativa/seria) ===== */
:root {
  --color-primary: #6d3d4f;
  --color-secondary: #c17a5a;
  --color-bg: #ffffff;
  --color-bg-alt: #faf1ed;
  --color-text: #2b2b2b;
  --color-text-light: #6b7280;
  --font-heading: 'Georgia', 'Times New Roman', serif;
  --font-body: 'Segoe UI', Arial, sans-serif;
  --max-width: 1100px;
}

/* ===== RESET BÁSICO ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font-body);
  color: var(--color-text);
  line-height: 1.6;
  background: var(--color-bg);
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

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

/* ===== HEADER ===== */
.header {
  border-bottom: 1px solid #e5e7eb;
  padding: 20px 0;
}
.header__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.logo {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: bold;
  color: var(--color-primary);
}
.nav a { margin-left: 28px; font-size: 0.95rem; color: var(--color-text); transition: color 0.2s; }
.nav a:hover, .nav a.active { color: var(--color-secondary); }

/* ===== HERO ===== */
.hero {
  background: var(--color-bg-alt);
  padding: 80px 0;
  position: relative;
  overflow: hidden;
}
#hero-canvas,
.network-canvas {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}
.section--canvas {
  position: relative;
  overflow: hidden;
}
.section--canvas .container {
  position: relative;
  z-index: 1;
}
.hero__inner {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 48px;
}
.hero__text { flex: 1; }
.hero__eyebrow {
  color: var(--color-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 12px;
}
.hero__title {
  font-family: var(--font-heading);
  font-size: 2.6rem;
  color: var(--color-primary);
  margin-bottom: 16px;
}
.hero__subtitle {
  font-size: 1.1rem;
  color: var(--color-text-light);
  max-width: 480px;
  margin-bottom: 32px;
}
.hero__cta { display: flex; gap: 16px; }

.btn {
  display: inline-block;
  padding: 12px 24px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.2s;
}
.btn--primary {
  background: var(--color-primary);
  color: #fff;
}
.btn--primary:hover { background: #0f1c33; }
.btn--ghost {
  border: 1.5px solid var(--color-primary);
  color: var(--color-primary);
}
.btn--ghost:hover { background: var(--color-primary); color: #fff; }

.hero__image {
  flex: 0 0 280px;
  perspective: 900px; /* le da profundidad 3D al contenedor */
}
.hero__image img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  object-fit: cover;
  cursor: pointer;
  transition: transform 0.15s ease-out, box-shadow 0.3s ease;
  transform-style: preserve-3d;
  box-shadow: 0 8px 24px rgba(26, 43, 74, 0);
}
.hero__image img:hover,
.hero__image img.is-active {
  box-shadow: 0 20px 40px rgba(26, 43, 74, 0.25);
}
.hero__image img.resetting {
  transition: transform 0.4s ease, box-shadow 0.4s ease;
}

/* ===== RESPONSIVE (hero) ===== */
@media (max-width: 768px) {
  .hero__inner { flex-direction: column-reverse; text-align: center; }
  .hero__subtitle { margin-left: auto; margin-right: auto; }
  .hero__cta { justify-content: center; flex-wrap: wrap; }
  .nav a { margin-left: 16px; font-size: 0.85rem; }
}

/* ===== TAGS (chips de tecnologías/skills) ===== */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.tag {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 20px;
  background: var(--color-bg-alt);
  border: 1px solid #e5e7eb;
  font-size: 0.85rem;
  color: var(--color-primary);
  font-weight: 500;
}
.tags--compact {
  gap: 6px;
}
.tags--compact .tag {
  padding: 4px 10px;
  font-size: 0.78rem;
}

/* ===== SECCIÓN GENÉRICA ===== */
.section {
  padding: 72px 0;
}
.section--alt { background: var(--color-bg-alt); }
.section__eyebrow {
  color: var(--color-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 10px;
}
.section__title {
  font-family: var(--font-heading);
  font-size: 2.1rem;
  color: var(--color-primary);
  margin-bottom: 12px;
}
.section__intro {
  color: var(--color-text-light);
  max-width: 620px;
  margin-bottom: 40px;
}

/* ===== HOME: pila principal + educación ===== */
.home-extra {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  margin-top: 56px;
}
.home-extra > div:nth-child(1) { grid-column: 1; grid-row: 1; }
.home-extra > div:nth-child(2) { grid-column: 2; grid-row: 1 / span 4; }
.home-extra > div:nth-child(3) { grid-column: 1; grid-row: 2; }
.home-extra > div:nth-child(4) { grid-column: 1; grid-row: 3; }
.home-extra > div:nth-child(5) { grid-column: 1; grid-row: 4; }
.home-extra h3 {
  font-size: 1rem;
  color: var(--color-primary);
  margin-bottom: 16px;
}
.edu-cards { display: flex; flex-direction: column; gap: 12px; }
.card {
  display: block;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 18px 20px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s, transform 0.15s;
}
.card:hover {
  border-color: var(--color-secondary);
  transform: translateY(-2px);
}
.card h4 {
  font-size: 0.95rem;
  color: var(--color-primary);
  margin-bottom: 4px;
}
.card p {
  font-size: 0.85rem;
  color: var(--color-text-light);
}

/* ===== ACERCA DE ===== */
.about-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 48px;
}
.about-item {
  padding-bottom: 20px;
  margin-bottom: 20px;
  border-bottom: 1px solid #e5e7eb;
}
.about-item:last-child { border-bottom: none; }
.about-item h4 {
  color: var(--color-primary);
  margin-bottom: 6px;
  font-size: 1rem;
}
.about-item p {
  color: var(--color-text-light);
  font-size: 0.95rem;
}
.about-sidebar .card { margin-bottom: 20px; }
.about-sidebar h4 {
  color: var(--color-primary);
  font-size: 0.95rem;
  margin-bottom: 12px;
}

/* ===== PROYECTOS ===== */
.projects-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.project-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 24px;
  display: flex;
  flex-direction: column;
}
.project-card h3 {
  color: var(--color-primary);
  font-size: 1.1rem;
  margin-bottom: 10px;
}
.project-card p {
  color: var(--color-text-light);
  font-size: 0.9rem;
  margin-bottom: 16px;
  flex-grow: 1;
}
.project-card .tags { margin-top: auto; }

.project-card--featured {
  grid-column: 1 / -1;
  padding: 32px;
  border-color: #d8b5aa;
  border-left: 5px solid var(--color-primary);
  background: linear-gradient(120deg, #fff 45%, #faf1ed);
}

.project-card--featured h3 {
  font-family: var(--font-heading);
  font-size: 1.65rem;
}

.project-card--featured p {
  max-width: 800px;
  font-size: 1rem;
}

.project-label {
  display: block;
  margin-bottom: 12px;
  color: var(--color-secondary);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

@media (max-width: 600px) {
  .project-card--featured {
    padding: 24px;
  }
}

/* ===== CONTACTO ===== */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-bottom: 40px;
}
.contact-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 24px;
}
.contact-card h4 {
  color: var(--color-primary);
  margin-bottom: 8px;
}
.contact-card p {
  color: var(--color-text-light);
  font-size: 0.9rem;
  margin-bottom: 14px;
}
.contact-meta {
  color: var(--color-text-light);
  font-size: 0.9rem;
}

/* ===== RESPONSIVE (general) ===== */
@media (max-width: 768px) {
  .home-extra, .about-grid, .projects-grid, .contact-grid {
    grid-template-columns: 1fr;
  }
  .home-extra > div {
    grid-column: 1 !important;
    grid-row: auto !important;
  }
  .home-extra > div:nth-child(2) {
    order: 5;
  }
}


.section--canvas {
  background: var(--color-bg-alt);
}
/* ===== CITA DESTACADA ===== */
.quote-block {
  border-left: 4px solid var(--color-secondary);
  padding: 8px 0 8px 24px;
  margin: 56px 0;
}
.quote-block p {
  font-family: var(--font-heading);
  font-style: italic;
  font-size: 1.4rem;
  color: var(--color-primary);
  line-height: 1.5;
}
.quote-block strong {
  color: var(--color-secondary);
  font-style: normal;
}

/* ===== SERVICIOS ===== */
.services-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 24px;
}
.service-card {
  flex: 1 1 calc(33.333% - 24px);
  max-width: calc(33.333% - 24px);
}

/* Centra la última fila cuando quedan 8 tarjetas (2 en la última fila) */
.services-grid:has(.service-card:nth-child(8):last-child)::after {
  content: "";
}
.services-grid:has(.service-card:nth-child(8):last-child) {
  justify-content: center;
}
.service-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.service-card .network-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0.18;
  pointer-events: none;
  z-index: 0;
}
.service-card h3,
.service-card p {
  position: relative;
  z-index: 1;
}
.service-card h3 {
  color: var(--color-primary);
  font-size: 1.05rem;
  margin-bottom: 10px;
}
.service-card p {
  color: var(--color-text-light);
  font-size: 0.9rem;
}
@media (max-width: 768px) {
  .service-card {
    flex: 1 1 100%;
    max-width: 100%;
  }
}

.section--white { background: #fff; }

.btn--static { cursor: default; }
/* ===== FOOTER ===== */
.footer {
  background: var(--color-primary);
  color: #fff;
  padding: 32px 0;
}
.footer .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}
.footer__nav a {
  color: #fff;
  opacity: 0.85;
  margin-left: 20px;
  font-size: 0.9rem;
  text-decoration: none;
  transition: opacity 0.2s;
}
.footer__nav a:hover {
  opacity: 1;
}
.footer p {
  font-size: 0.85rem;
  opacity: 0.85;
  margin: 0;
}
@media (max-width: 600px) {
  .footer .container {
    flex-direction: column;
    text-align: center;
  }
  .footer__nav a {
    margin: 0 10px;
  }
}

/* ===== MENÚ HAMBURGUESA (mobile) ===== */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.6rem;
  color: var(--color-primary);
  cursor: pointer;
}

@media (max-width: 640px) {
  .nav-toggle { display: block; }

  .nav {
    display: none;
    flex-direction: column;
    width: 100%;
    margin-top: 16px;
  }
  .nav.is-open { display: flex; }
  .nav a {
    margin: 0;
    padding: 10px 0;
    border-top: 1px solid #e5e7eb;
  }
  .header__inner {
    flex-wrap: wrap;
  }
}

 /* Bot del portfolio */
.portfolio-bot {
  position: fixed;
  right: 22px;
  bottom: 20px;
  z-index: 1200;
}

.portfolio-bot__abrir {
  padding: 14px 20px;
  border: 0;
  border-radius: 999px;
  background: var(--color-primary);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 25px #0003;
}

.portfolio-bot__abrir:hover,
.portfolio-bot__form button:hover {
  background: #512b3a;
}

.portfolio-bot__panel {
  position: absolute;
  right: 0;
  bottom: 65px;
  width: min(400px, calc(100vw - 28px));
  height: min(520px, calc(100vh - 100px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #e5d1d4;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 15px 40px #0003;
}

.portfolio-bot__panel[hidden] {
  display: none;
}

.portfolio-bot__cabecera {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 15px;
  background: var(--color-bg-alt);
  border-bottom: 1px solid #e5d1d4;
}

.portfolio-bot__cabecera strong,
.portfolio-bot__cabecera small {
  display: block;
}

.portfolio-bot__cabecera small {
  color: var(--color-text-light);
  font-size: 0.8rem;
}

.portfolio-bot__cabecera button {
  border: 0;
  background: none;
  color: var(--color-primary);
  font-size: 1.6rem;
  cursor: pointer;
}

.portfolio-bot__mensajes {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.portfolio-bot__mensaje {
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--color-bg-alt);
  overflow-wrap: anywhere;
}

.portfolio-bot__mensaje--usuario {
  align-self: flex-end;
  background: #f0e2e6;
}

.portfolio-bot__mensaje a {
  display: block;
  margin-top: 8px;
  color: var(--color-primary);
  font-weight: 700;
  text-decoration: underline;
}

.portfolio-bot__opciones {
  display: flex;
  gap: 6px;
  padding: 10px;
  overflow-x: auto;
}

.portfolio-bot__opciones button {
  flex-shrink: 0;
  padding: 7px 10px;
  border: 1px solid #e5d1d4;
  border-radius: 18px;
  background: #fff;
  color: var(--color-primary);
  cursor: pointer;
}

.portfolio-bot__form {
  display: flex;
  gap: 6px;
  padding: 10px;
  border-top: 1px solid #eee;
}

.portfolio-bot__form input {
  flex: 1;
  min-width: 0;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 7px;
  font: inherit;
}

.portfolio-bot__form button {
  padding: 10px;
  border: 0;
  border-radius: 7px;
  background: var(--color-primary);
  color: #fff;
  cursor: pointer;
}

@media (max-width: 600px) {
  .portfolio-bot {
    right: 14px;
    bottom: 14px;
  }
}