/* ===================================================================
   Portafolio — Sebastián Méndez Villegas (SMV)
   Sistema de diseño base. Ajusta color/tipografía en :root
   Basado en el diseño "portfolio SMV.pdf"
   =================================================================== */

:root {
  /* ---- Colores ---- */
  --red: #e00034;
  --red-dark: #bd002c;
  --ink: #0d0d0d;
  --ink-soft: #1a1a1a;
  --paper: #f3f3f4;
  --white: #f3f3f4;
  --muted: #6b7280;
  --card: #0a0a0a;

  /* ---- Tipografía ---- */
  --font-display: "Playfair Display", Georgia, "Times New Roman", serif;
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* ---- Layout ---- */
  --max: 1180px;
  --radius: 16px;
  --radius-btn: 7px;
  --radius-pill: 999px;
  --transition: 0.2s ease;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

img {
  display: block;
  max-width: 100%;
}

/* ===== Utilidades ===== */
.container {
  width: 100%;
  /* Ancho máximo: el contenido queda centrado en monitores grandes. */
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 3vw, 3.5rem);
}

.serif {
  font-family: var(--font-display);
}

.section {
  padding-block: 4.5rem;
}

/* ===== Botones / pills ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  /* font: inherit asegura que <button> y <a> midan igual (los <button>
     no heredan tipografía por defecto → se veían más delgados) */
  font: inherit;
  padding: 0.55rem 1.2rem;
  border-radius: var(--radius-btn);
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.15;
  letter-spacing: 0.01em;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: transform var(--transition), background var(--transition),
    color var(--transition), box-shadow var(--transition);
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.14);
}

/* Botones de la top bar: más compactos para no llenar la barra */
.nav__actions .btn {
  padding: 0.34rem 0.9rem;
  font-size: 0.82rem;
}

.btn--red {
  background: var(--red);
  color: var(--white);
}

.btn--red-outline {
  border-color: var(--red);
  color: var(--red);
  background: transparent;
}

.btn--red-outline:hover {
  background: var(--red);
  color: var(--white);
}

.btn--white {
  background: var(--white);
  color: var(--ink);
}

.btn--black {
  background: var(--ink);
  color: var(--white);
}

.btn--black.is-link {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.btn--ghost-light {
  border-color: rgba(255, 255, 255, 0.6);
  color: var(--white);
}

.btn--ghost-light:hover {
  background: var(--white);
  color: var(--red);
}

/* ===== Header ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: var(--ink);
  color: var(--white);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.nav__logo {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.7rem;
  letter-spacing: 0.02em;
  color: var(--white);
}

.nav__actions {
  display: flex;
  gap: 0.75rem;
}

/* ===== Hero (banda roja) ===== */
.hero {
  background: var(--red);
  color: var(--white);
}

.hero__inner {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 2rem;
  padding-block: 2.5rem;
}

.hero__text {
  /* Sin tope de ancho: el texto usa toda la columna para caber en 2 líneas
     en vista de monitor (en tablet/móvil se reajusta con el responsive). */
  max-width: none;
}

.hero__eyebrow {
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: 0.5rem;
}

.hero__title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(2rem, 4.6vw, 3.2rem);
  line-height: 1.05;
  max-width: 16ch;
  margin-bottom: 1rem;
}

.hero__lead {
  /* Texto de apoyo (el rol ya va destacado en el h1) */
  max-width: 46rem;
  font-size: 0.98rem;
  line-height: 1.6;
  margin-bottom: 1.5rem;
  color: rgba(255, 255, 255, 0.92);
}

.hero__cta {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.hero__photo {
  /* Contenida dentro de la banda roja, con espaciado del padding del hero. */
  position: relative;
  z-index: 2;
  width: 190px;
  height: 190px;
  flex-shrink: 0;
  border-radius: 50%;
  overflow: hidden;
  background: transparent;
  border: none;
}

/* Nombre sobre la foto, aparece al hacer hover */
.hero__photo-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  padding: 0 15%;
  text-align: center;
  background: rgba(0, 0, 0, 0.55);
  color: #ffffff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.2rem;
  line-height: 1.25;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.hero__photo:hover .hero__photo-overlay {
  opacity: 1;
}

.hero__photo img {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero__photo-fallback {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.7);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 2.5rem;
}

/* ===== Section head ===== */
.section-head {
  margin-bottom: 2.5rem;
}

.section-head--center {
  text-align: center;
}

.section-head__title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(2rem, 5vw, 2.8rem);
  line-height: 1;
}

.section-head__sub {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  margin-left: 0.15rem;
}

/* ===== Timeline horizontal (index) ===== */
.timeline {
  position: relative;
  overflow-x: auto;
  padding-block: 2rem 3rem;
}

.timeline__track {
  position: relative;
  display: flex;
  gap: 0;
  min-width: 640px;
  border-top: 3px solid var(--ink);
  margin-top: 90px;
}

.tl-node {
  position: relative;
  flex: 1 1 0;
  min-width: 140px;
}

/* Pin de año (rojo, apunta hacia abajo, sobre la línea) */
.tl-year {
  position: absolute;
  bottom: 100%;
  left: 0;
  transform: translateY(-6px);
  width: 56px;
  height: 56px;
  background: var(--red);
  color: var(--white);
  font-weight: 700;
  font-size: 0.95rem;
  display: grid;
  place-items: center;
  clip-path: polygon(0 0, 100% 0, 100% 62%, 50% 100%, 0 62%);
  padding-bottom: 8px;
}

/* Pin de mes (contorno, debajo de la línea) */
.tl-month {
  position: absolute;
  top: 14px;
  left: 0;
  width: 54px;
  height: 46px;
  color: var(--red);
  font-weight: 700;
  font-size: 0.8rem;
  display: grid;
  place-items: center;
  background: var(--paper);
  border: 2px solid var(--red);
  clip-path: polygon(0 0, 100% 0, 100% 62%, 50% 100%, 0 62%);
  padding-bottom: 6px;
}

/* ===== Proyectos destacados (tarjetas) ===== */
.apps__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 1.75rem;
  align-items: stretch;
}

.app-card {
  position: relative;
  overflow: hidden;
  background: var(--red);
  color: var(--white);
  border-radius: 20px;
  padding: 3rem 2rem 2.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.app-card .feature__art {
  margin-bottom: 1.5rem;
}

.feature__art {
  position: relative;
  width: 230px;
  height: 230px;
  border-radius: 50%;
  background: var(--paper);
  overflow: hidden;
  justify-self: center;
}

/* Carrusel: avatar + capturas de proyecto que rotan con crossfade */
.feature__art .slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.6s ease;
}

.feature__art .slide.is-avatar {
  object-fit: contain;
  padding: 11%;
}

.feature__art .slide.is-active {
  opacity: 1;
}

/* Botones outline sobre fondo rojo: siempre visibles (contorno claro) */
.app-card .btn--red-outline {
  border-color: var(--white);
  color: var(--white);
  background: transparent;
}

.app-card .btn--red-outline:hover {
  background: var(--white);
  color: var(--red);
}

.app-card .btn[disabled] {
  cursor: default;
}

.app-card .btn[disabled]:hover {
  transform: none;
  box-shadow: none;
}

.brandmark {
  /* Altura fija: las 3 placas (MECATRONICA / REMOTE HANDS / TOPOLOGÍAS)
     miden exactamente lo mismo; el contenido se centra vertical. */
  height: 3.4rem;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: var(--ink);
  color: var(--white);
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.9rem;
  letter-spacing: 0.06em;
  padding: 0 1.2rem;
  border-radius: 10px;
  margin-bottom: 1.25rem;
}

/* Variante con imagen de logo (Capa8 = "Topologías", fondo negro) */
.brandmark--logo {
  padding: 0 0.9rem;
  background: #000; /* igual al fondo del PNG, sin borde visible */
}

.brandmark__img {
  display: block;
  height: 2.5rem;
  width: auto;
}

/* Variante solo texto (Remote Hands, sin logo propio) */
.brandmark--text {
  font-size: 1.5rem;
  letter-spacing: 0.02em;
}

/* "O" de MECATRONICA = engrane 100% CSS.
   Dos capas sobre un span vacío:
   ::before = disco dentado (12 dientes vía clip-path) que gira.
   ::after  = disco central del color del fondo (--ink) = agujero falso. */
.gear-o {
  width: 1.15em;
  height: 1.15em;
  position: relative;
  display: inline-block;
  vertical-align: middle;
  margin: 0 1px;
}

.gear-o::before {
  content: "";
  position: absolute;
  inset: 4.5%;
  border-radius: 50%;
  background: var(--red);
  clip-path: polygon(
    50% 0%, 58% 12%, 72% 7%, 78% 21%, 93% 22%, 88% 38%,
    100% 50%, 88% 62%, 93% 78%, 78% 79%, 72% 93%, 58% 88%,
    50% 100%, 42% 88%, 28% 93%, 22% 79%, 7% 78%, 12% 62%,
    0% 50%, 12% 38%, 7% 22%, 22% 21%, 28% 7%, 42% 12%
  );
  transform-origin: center;
  animation: spin-slow 18s linear infinite;
}

/* Agujero central falso: DEBE coincidir con el fondo del brandmark (--ink) */
.gear-o::after {
  content: "";
  position: absolute;
  inset: 32%;
  border-radius: 50%;
  background: var(--ink);
}

/* Capa8: engrane blanco */
.gear-o--light::before {
  background: var(--white);
}

@keyframes spin-slow {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .gear-o::before {
    animation: none;
  }
}

.feature__desc {
  max-width: 560px;
  margin: 0 auto 1.75rem;
  line-height: 1.7;
}

.feature__actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* Cinta "IA powered" */
.ribbon {
  position: absolute;
  top: 0;
  right: 1.5rem;
  background: var(--ink);
  color: var(--white);
  text-align: center;
  padding: 0.5rem 0.7rem 1rem;
  line-height: 1.1;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 82%, 0 100%);
}

.ribbon__ia {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.1rem;
  display: block;
}

.ribbon__txt {
  font-size: 0.62rem;
  letter-spacing: 0.05em;
}

/* ===== Projects page ===== */
.hero__github {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  background: var(--white);
  color: var(--ink);
  padding: 0.55rem 1.3rem;
  border-radius: var(--radius-pill);
  font-weight: 700;
}

.hero__github svg {
  width: 34px;
  height: 34px;
}

.hero__github span {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Tabs / slider de categorías */
.tabs {
  display: flex;
  justify-content: center;
  padding-block: 2rem 0;
}

.tabs__group {
  display: inline-flex;
  background: var(--ink);
  border-radius: var(--radius-pill);
  padding: 5px;
  gap: 4px;
}

.tab {
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.75);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.5rem 1.1rem;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.tab:hover {
  color: var(--white);
}

.tab.is-active {
  background: #3a3a3a;
  color: var(--white);
}

/* Encabezado de año: número en negro + línea delimitadora */
.year-block {
  padding-block: 1.5rem 0.5rem;
}

.year-head {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.year-label {
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: 2rem;
  line-height: 1;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.year-line {
  flex: 1;
  height: 1px;
  background: rgba(13, 13, 13, 0.15);
}

.cards {
  /* Se agregan columnas conforme crece el ancho (las tarjetas mantienen
     su tamaño en vez de estirarse en monitores grandes). */
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

/* Tarjeta = imagen de portada + panel inferior que se expande en hover */
.pcard {
  position: relative;
  aspect-ratio: 3 / 2;
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  color: var(--white);
  background: #0a0a0a center / cover no-repeat;
}

.pcard--noimg {
  background: linear-gradient(135deg, #1a1a1a, #0a0a0a);
}

/* Atenúa la imagen y oscurece la base para el texto */
.pcard__scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.92) 0%,
    rgba(0, 0, 0, 0.55) 32%,
    rgba(0, 0, 0, 0.28) 60%,
    rgba(0, 0, 0, 0.28) 100%
  );
}

.pcard:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 3px;
}

/* Indicador de keywords (arriba-izquierda) */
.pcard__kw {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--white);
  background: var(--red);
  padding: 0.22rem 0.6rem;
  border-radius: var(--radius-pill);
}

/* Icono GitHub (arriba-derecha) */
.pcard__gh {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--white);
  display: grid;
  place-items: center;
}

.pcard__gh svg {
  width: 21px;
  height: 21px;
  color: #111;
}

/* Panel inferior */
.pcard__panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  padding: 1rem 1.15rem 1.15rem;
}

.pcard__title {
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.2;
  margin: 0;
}

/* Detalle: colapsado por defecto, se despliega en hover/focus */
.pcard__detail {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition: grid-template-rows 0.35s ease, opacity 0.3s ease;
}

.pcard__detail-inner {
  overflow: hidden;
  min-height: 0;
}

.pcard:hover .pcard__detail,
.pcard:focus-visible .pcard__detail,
.pcard:focus-within .pcard__detail {
  grid-template-rows: 1fr;
  opacity: 1;
}

.pcard__desc {
  font-size: 0.9rem;
  color: #d5d7da;
  margin: 0.6rem 0 0;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pcard__tools {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.7rem;
  font-size: 0.8rem;
  color: #b6bbc0;
}

.pcard__tools svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.pcard__more {
  display: inline-block;
  margin-top: 0.9rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--white);
  background: var(--red);
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-btn);
}

/* Estado vacío (Papers, Competitions, PCB's) */
.empty-state {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--muted);
}

.empty-state h3 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--ink);
  margin-bottom: 0.5rem;
}

/* ===== Modal de proyecto (galería) ===== */
.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  animation: fade-in 0.2s ease;
}

.modal__window {
  position: relative;
  z-index: 1;
  width: min(920px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  background: #141414;
  color: var(--white);
  border-radius: 18px;
  padding: 1.75rem;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
  animation: pop-in 0.22s ease;
}

.modal__close {
  position: absolute;
  top: 0.75rem;
  right: 1rem;
  background: none;
  border: none;
  color: var(--white);
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity var(--transition);
}

.modal__close:hover {
  opacity: 1;
}

.modal__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  padding-right: 2rem;
}

.modal__desc {
  color: #c7cbd0;
  font-size: 0.95rem;
  line-height: 1.55;
  margin-bottom: 1.1rem;
}

.modal__stage {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  display: grid;
  place-items: center;
}

.modal__img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.modal__empty {
  color: var(--muted);
  font-size: 0.95rem;
}

.modal__caption {
  text-align: center;
  color: #9aa0a6;
  font-size: 0.9rem;
  min-height: 1.2em;
  margin: 0.85rem 0 1rem;
}

.modal__thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.modal__thumb {
  width: 84px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 7px;
  cursor: pointer;
  opacity: 0.5;
  border: 2px solid transparent;
  transition: opacity var(--transition), border-color var(--transition);
}

.modal__thumb:hover {
  opacity: 0.85;
}

.modal__thumb.is-active {
  opacity: 1;
  border-color: var(--red);
}

.modal__renders {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.modal__renders[hidden] {
  display: none;
}

.modal__subtitle {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 0.25rem;
}

.modal__render {
  width: 100%;
  border-radius: 10px;
}

.modal__cta {
  width: 100%;
  justify-content: center;
  font-size: 1rem;
  padding: 0.75rem 1.2rem;
}

.modal__cta.is-disabled {
  opacity: 0.5;
  pointer-events: none;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
}

/* ===== Contact page ===== */
.contact-hero {
  text-align: center;
  max-width: 620px;
  margin-inline: auto;
}

.contact-hero .section-head__title {
  margin-bottom: 1rem;
}

.pcb-placeholder {
  margin: 2.5rem auto;
  max-width: 480px;
  aspect-ratio: 16 / 10;
  border: 2px dashed var(--red);
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  padding: 1.5rem;
  background: rgba(228, 0, 58, 0.03);
}

.contact-links {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

/* ===== Footer ===== */
.site-footer {
  background: var(--ink);
  color: rgba(255, 255, 255, 0.65);
  padding-block: 2rem;
  text-align: center;
  font-size: 0.9rem;
}

.site-footer a {
  color: var(--white);
}

/* ===== About me ===== */
.about__inner {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) 1.15fr;
  gap: 2.5rem;
  align-items: center;
}

.about__media {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: 18px;
  overflow: hidden;
  background: #111;
}

.about__media .slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.8s ease;
}

.about__media .slide.is-active {
  opacity: 1;
}

.about__body .section-head__title {
  margin-bottom: 1rem;
}

.about__body p {
  color: #3f4145;
  line-height: 1.7;
  margin-bottom: 1rem;
  max-width: 62ch;
}

/* ===== Responsive ===== */
@media (max-width: 760px) {
  .about__inner {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .hero__inner {
    grid-template-columns: 1fr;
    text-align: center;
    justify-items: center;
  }

  .hero__photo {
    margin-block: 0;
    width: 200px;
    height: 200px;
  }

  .hero__title,
  .hero__lead {
    margin-inline: auto;
  }

  .hero__cta {
    justify-content: center;
  }

  .cards {
    grid-template-columns: 1fr;
  }

  .nav__logo {
    font-size: 1.4rem;
  }

  .tabs__group {
    flex-wrap: wrap;
    justify-content: center;
  }
}
