/* =========================================================
   Portafolio de Actividades — estilos propios
   Sistemas Embebidos y Mecatrónica · Universidad Iberoamericana Puebla
   Tema oscuro · Paleta: negro, gris, rojo, blanco
   ========================================================= */

:root {
  --port-red: #e0303f;
  --port-red-dark: #8c1c2b;
  --port-black: #0b0b0c;
  --port-ink: #f4f4f4;
  --port-muted: #a3a3a3;
  --port-bg-page: #121213;
  --port-bg-soft: #0a0a0b;
  --port-card-bg: #1b1b1d;
  --port-card-bg-alt: #202022;
  --port-border: rgba(255, 255, 255, 0.1);
  --port-accent-2: #8a8a8a;
  --port-radius: 18px;
  --port-shadow: 0 14px 34px -14px rgba(0, 0, 0, 0.7);
  --port-shadow-soft: 0 4px 16px -8px rgba(0, 0, 0, 0.6);
}

/* Reafirma los tokens neutros de Material en modo oscuro (slate) con
   una escala de grises pura, sin el tinte azulado que trae por
   defecto, para respetar la paleta negro/gris/rojo/blanco. */
[data-md-color-scheme="slate"] {
  --md-default-fg-color: rgba(255, 255, 255, 0.87);
  --md-default-fg-color--light: rgba(255, 255, 255, 0.62);
  --md-default-fg-color--lighter: rgba(255, 255, 255, 0.38);
  --md-default-fg-color--lightest: rgba(255, 255, 255, 0.12);
  --md-default-bg-color: var(--port-bg-page);
  --md-default-bg-color--light: rgba(18, 18, 19, 0.6);
  --md-default-bg-color--lighter: rgba(18, 18, 19, 0.3);
  --md-default-bg-color--lightest: rgba(18, 18, 19, 0.1);
  --md-typeset-color: var(--md-default-fg-color);
  --md-code-bg-color: #1c1c1e;
  --md-code-fg-color: rgba(255, 255, 255, 0.82);
  --md-footer-bg-color: #000000;
  --md-footer-bg-color--dark: #000000;
}

body {
  background: var(--port-bg-page);
}

/* Deja que las secciones propias ocupen todo el ancho, sin el
   padding/typografía por defecto de Material para el contenido markdown. */
.md-content .md-typeset .port-page {
  margin: -1.2rem -1.2rem 0;
}

@media screen and (min-width: 76.25em) {
  .md-content .md-typeset .port-page {
    margin: -1.2rem -1.6rem 0;
  }
}

.port-page * {
  box-sizing: border-box;
}

/* =========================================================
   Menú: siempre detrás del botón de 3 barras (sin barra lateral
   fija), incluso en escritorio. Material ya trae el botón y el
   panel deslizable listos para móvil; aquí forzamos ese mismo
   comportamiento "off-canvas" en cualquier ancho de pantalla.
   ========================================================= */
.md-header__button[for="__drawer"] {
  display: inline-flex !important;
}

.md-sidebar--secondary {
  display: none !important;
}

@media screen and (min-width: 76.25em) {
  .md-sidebar--primary {
    position: fixed !important;
    top: 0 !important;
    left: -12.1rem !important;
    height: 100% !important;
    /* Fondo explícito: a este ancho Material no lo trae por defecto
       (solo lo aplica en su propia media query móvil), así que sin
       esta línea el panel queda transparente y el contenido de abajo
       se transparenta a través del menú. */
    background-color: var(--md-default-bg-color) !important;
    transform: translateX(0) !important;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s !important;
    z-index: 20 !important;
  }

  [data-md-toggle="drawer"]:checked ~ .md-container .md-sidebar--primary {
    box-shadow: var(--md-shadow-z3);
    transform: translateX(12.1rem) !important;
  }

  .md-content__inner {
    margin-left: 0.8rem !important;
    margin-right: 0.8rem !important;
  }
}

/* ---------- HERO ---------- */
.hero {
  position: relative;
  overflow: hidden;
  padding: 3.2rem 1.5rem 4.5rem;
  color: #fff;
  background: var(--port-black);
}

.hero__photo {
  position: absolute;
  inset: 0;
  background-image: url("https://commons.wikimedia.org/wiki/Special:FilePath/Macro_photograph_of_the_RP2350_microcontroller_on_a_Raspberry_Pi_Pico_2_board.jpg?width=1600");
  background-size: cover;
  background-position: center;
  filter: grayscale(45%) contrast(1.05) brightness(0.9);
}

.hero__scrim {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(6, 6, 7, 0.92) 0%, rgba(6, 6, 7, 0.86) 45%, rgba(15, 3, 4, 0.94) 100%),
    radial-gradient(circle at 85% 0%, rgba(224, 48, 63, 0.32), transparent 55%);
}

.hero::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--port-red-dark), var(--port-red), var(--port-red-dark));
}

.hero__content {
  position: relative;
  max-width: 60rem;
  margin: 0 auto;
}

.hero__brand {
  margin-bottom: 2rem;
}

.hero__institution {
  display: inline-flex;
  align-items: center;
  border-radius: 12px;
  overflow: hidden;
  line-height: 0;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
  transition: transform 0.25s ease;
}

.hero__institution:hover,
.hero__institution:focus-visible {
  transform: translateY(-2px) scale(1.02);
}

.hero__institution img {
  height: 52px;
  width: auto;
  display: block;
}

.hero__eyebrow {
  text-transform: uppercase;
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  color: rgba(255, 255, 255, 0.68);
  margin: 0 0 0.6rem;
}

.hero__title {
  font-size: clamp(2.1rem, 4.5vw, 3.1rem);
  line-height: 1.08;
  font-weight: 800;
  margin: 0 0 0.5rem;
  color: #fff !important;
}

.hero__subtitle {
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  font-weight: 600;
  margin: 0 0 0.9rem;
  color: var(--port-red);
  position: relative;
  display: inline-block;
}

.hero__desc {
  max-width: 38rem;
  color: rgba(255, 255, 255, 0.78);
  font-size: 1rem;
  line-height: 1.6;
  margin: 0 0 1.4rem;
}

.hero__credit {
  margin: 0;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.45);
}

.hero__credit a {
  color: rgba(255, 255, 255, 0.68) !important;
}

.hero__credit a:hover {
  color: #fff !important;
}

/* ---------- SECCIONES ---------- */
.section {
  max-width: 68rem;
  margin: 0 auto;
  padding: 4rem 1.5rem;
  background: var(--port-bg-page);
}

.section--tinted {
  background: var(--port-bg-soft);
  max-width: none;
}

.section--tinted > * {
  max-width: 68rem;
  margin-left: auto;
  margin-right: auto;
}

.section__header {
  max-width: 42rem;
  margin: 0 auto 2.6rem;
  text-align: center;
}

.section__kicker {
  display: inline-block;
  text-transform: uppercase;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--port-red);
  margin-bottom: 0.5rem;
}

.section__header h2 {
  margin: 0 0 0.8rem;
  font-size: 1.9rem;
  color: var(--port-ink) !important;
}

.section__header p {
  color: var(--port-muted);
  line-height: 1.65;
  margin: 0;
}

/* ---------- PERFILES ---------- */
.profiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.6rem;
  margin-top: 1.4rem;
}

.profile-card {
  --accent: var(--port-red);
  position: relative;
  background: var(--port-card-bg);
  border: 1px solid var(--port-border);
  border-radius: var(--port-radius);
  padding: 2rem 1.6rem 1.7rem;
  text-align: center;
  box-shadow: var(--port-shadow-soft);
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.profile-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 6px;
  border-radius: var(--port-radius) var(--port-radius) 0 0;
  background: var(--accent);
}

.profile-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--port-shadow);
  border-color: rgba(255, 255, 255, 0.22);
}

.profile-card__avatar {
  width: 84px;
  height: 84px;
  margin: 0.4rem auto 1rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.3rem;
  letter-spacing: 0.02em;
  color: #fff;
  background: linear-gradient(145deg, var(--accent), var(--port-black));
  box-shadow: 0 6px 16px -6px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.profile-card h3 {
  margin: 0 0 0.2rem;
  font-size: 1.15rem;
  color: var(--port-ink) !important;
}

.profile-card__role {
  margin: 0 0 0.9rem;
  font-style: italic;
  color: var(--port-muted);
  font-size: 0.92rem;
}

.profile-card__tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
  margin-bottom: 1.1rem;
}

.profile-card__email {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: #fff !important;
  text-decoration: none !important;
}

.profile-card__email:hover {
  color: var(--accent) !important;
  text-decoration: underline !important;
}

/* ---------- ETIQUETAS ---------- */
.tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  background: var(--port-red);
  color: #fff;
}

.tag--alt {
  background: var(--port-accent-2);
  color: #111;
}

.tag--ghost {
  background: transparent;
  color: var(--port-muted);
  border: 1px dashed var(--port-border);
}

/* ---------- PRÁCTICAS ---------- */
.practices-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.6rem;
  margin-top: 1.4rem;
}

.practice-card {
  background: var(--port-card-bg);
  border: 1px solid var(--port-border);
  border-radius: var(--port-radius);
  overflow: hidden;
  box-shadow: var(--port-shadow-soft);
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
  display: flex;
  flex-direction: column;
}

.practice-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--port-shadow);
  border-color: rgba(255, 255, 255, 0.22);
}

.practice-card__image {
  aspect-ratio: 4 / 3;
  background: var(--port-card-bg-alt);
  display: flex;
  align-items: center;
  justify-content: center;
}

.practice-card__image--empty {
  color: #555558;
  font-size: 2rem;
  border-bottom: 1px dashed var(--port-border);
}

.practice-card__body {
  padding: 1.2rem 1.3rem 1.4rem;
}

.practice-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.7rem;
}

.practice-card__body h3 {
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
  color: var(--port-ink) !important;
}

.practice-card__body p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--port-muted);
  line-height: 1.55;
}

.practice-card__link {
  display: inline-block;
  margin-top: 0.8rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--port-red) !important;
  text-decoration: none !important;
}

.practice-card__link:hover {
  text-decoration: underline !important;
}

.practice-card--placeholder {
  border-style: dashed;
}

.practice-card--placeholder .practice-card__body h3,
.practice-card--placeholder .practice-card__body p {
  color: #6f6f72;
}

/* tarjeta "agregar nueva práctica" */
.practice-card--add {
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.6rem;
  min-height: 220px;
  border: 2px dashed var(--port-border);
  color: var(--port-muted);
  background: transparent;
}

.practice-card--add .practice-card__add-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.6rem;
  background: var(--port-card-bg);
  border: 1px dashed var(--port-border);
  color: var(--port-red);
  font-size: 1.1rem;
}

.practice-card--add span {
  display: block;
  font-size: 0.85rem;
  padding: 0 1rem 1rem;
}

/* ---------- ENLACE DE REGRESO EN PÁGINAS DE PARCIAL ---------- */
.parcial-back {
  max-width: 68rem;
  margin: 0 auto;
  padding: 1.6rem 1.5rem 0;
}

.parcial-back__link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--port-muted) !important;
  text-decoration: none !important;
}

.parcial-back__link:hover {
  color: var(--port-red) !important;
}

/* ---------- TRABAJO DE CLASE (BOTONES DE PARCIAL) ---------- */
.parciales-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.6rem;
  margin-top: 1.4rem;
}

.parcial-button {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.5rem;
  padding: 2.4rem 1.6rem;
  background: var(--port-card-bg);
  border: 1px solid var(--port-border);
  border-radius: var(--port-radius);
  box-shadow: var(--port-shadow-soft);
  text-decoration: none !important;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

a.parcial-button:hover,
a.parcial-button:focus-visible {
  transform: translateY(-5px);
  box-shadow: var(--port-shadow);
  border-color: rgba(255, 255, 255, 0.22);
}

.parcial-button__index {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.2rem;
  color: #fff;
  background: linear-gradient(145deg, var(--port-red), var(--port-black));
  box-shadow: 0 6px 16px -6px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.parcial-button__label {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--port-ink) !important;
}

.parcial-button__hint {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--port-red);
}

.parcial-button--soon {
  cursor: default;
  border-style: dashed;
}

.parcial-button--soon .parcial-button__index {
  background: var(--port-card-bg-alt);
  color: var(--port-muted);
  box-shadow: none;
}

.parcial-button--soon .parcial-button__label,
.parcial-button--soon .parcial-button__hint {
  color: var(--port-muted) !important;
}

/* ---------- ANIMACIONES DE ENTRADA ---------- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ---------- RESPONSIVE ---------- */
@media screen and (max-width: 30em) {
  .hero {
    padding: 2.2rem 1.1rem 3.2rem;
  }

  .section {
    padding: 3rem 1.1rem;
  }
}
