/* =========================================================
   Portafolio — Bryan Escobar
   ========================================================= */

:root {
  color-scheme: dark;

  --bg: #100e0f;
  --surface: #181416;
  --surface-2: #131012;
  --stage: #0c0a0b;
  --hero-glow: #3a1519;

  --text: #ebe7e8;
  --muted: #a49b9d;
  --accent: #f87171;
  --accent-soft: rgba(248, 113, 113, 0.13);
  --accent-solid: #dc2626;
  --accent-solid-hover: #b91c1c;
  --accent-contrast: #ffffff;

  --border: #2b2427;
  --border-strong: #573034;

  --radius: 12px;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

[data-theme="light"] {
  color-scheme: light;

  --bg: #faf7f7;
  --surface: #ffffff;
  --surface-2: #f4eded;
  --stage: #f0e8e8;
  --hero-glow: #fae3e3;

  --text: #141011;
  --muted: #6b5f61;
  --accent: #b91c1c;
  --accent-soft: rgba(185, 28, 28, 0.08);
  --accent-solid: #c81e1e;
  --accent-solid-hover: #991b1b;
  --accent-contrast: #ffffff;

  --border: #eadede;
  --border-strong: #d8bcbd;
  --shadow: 0 24px 60px rgba(60, 20, 20, 0.16);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

body.modal-open {
  overflow: hidden;
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

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

/* ---------- Accesibilidad ---------- */

.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 100;
  padding: 0.75rem 1.25rem;
  border-radius: 0 0 8px 8px;
  background: var(--accent-solid);
  color: var(--accent-contrast);
  font-weight: 600;
}

.skip-link:focus {
  top: 0;
  text-decoration: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* ---------- Controles superiores ---------- */

.topbar {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 30;
  display: flex;
  gap: 0.5rem;
}

.control {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 0.7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  opacity: 0.92;
  transition: border-color 0.2s ease, opacity 0.2s ease;
}

.control:hover {
  border-color: var(--border-strong);
  opacity: 1;
}

.control svg {
  width: 18px;
  height: 18px;
}

.icon-sun { display: none; }
[data-theme="light"] .icon-sun { display: block; }
[data-theme="light"] .icon-moon { display: none; }

/* ---------- Hero ---------- */

.hero {
  padding: 5.5rem 1.5rem 4.5rem;
  text-align: center;
  background: radial-gradient(60% 100% at 50% 0%, var(--hero-glow) 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--border);
}

.hero__inner {
  max-width: 42rem;
  margin: 0 auto;
}

.portrait {
  display: block;
  width: 160px;
  height: 160px;
  margin: 0 auto 1.5rem;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

@media (min-width: 768px) {
  .portrait {
    width: 244px;
    height: 244px;
  }
}

.portrait__frame {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface-2);
  box-shadow: 0 0 0 6px var(--accent-soft);
}

.portrait__base,
.portrait__photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Solo es la fuente del mosaico: la capa visible son los cubos. */
.portrait__photo {
  opacity: 0;
}

.portrait__tiles {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: repeat(6, 1fr);
  perspective: 900px;
  pointer-events: none;
}

.portrait__tile {
  position: absolute;
  inset: 0;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  backface-visibility: hidden;
  opacity: 0;
  transform: rotateY(-90deg);
  transition: transform 0.3s ease, opacity 0.3s ease;
}

@media (hover: hover) {
  .portrait:hover .portrait__tile {
    transform: rotateY(0deg);
    opacity: 1;
    transition-delay: var(--d, 0s);
  }
}

/* En táctil no hay hover: un toque fija la foto. */
.portrait.is-flipped .portrait__tile {
  transform: rotateY(0deg);
  opacity: 1;
  transition-delay: var(--d, 0s);
}

.hero h1 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 3.25rem);
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.tagline {
  margin: 0.75rem 0 0;
  min-height: 1.65em;
  color: var(--accent);
  font-size: 1.1rem;
  font-weight: 600;
}

.tagline__typed::after {
  content: "";
  display: inline-block;
  width: 2px;
  height: 1.05em;
  margin-left: 0.12em;
  vertical-align: -0.15em;
  background: currentColor;
  animation: caret 1.1s step-end infinite;
}

@keyframes caret {
  50% {
    opacity: 0;
  }
}

.hero__desc {
  margin: 1.25rem auto 0;
  max-width: 34rem;
  color: var(--muted);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 2rem;
}

/* ---------- Botones ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.35rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.2s ease, background 0.2s ease;
}

.btn:hover {
  text-decoration: none;
  transform: translateY(-1px);
}

.btn--primary {
  background: var(--accent-solid);
  color: var(--accent-contrast);
}

.btn--primary:hover {
  background: var(--accent-solid-hover);
  color: var(--accent-contrast);
}

.btn--ghost {
  border-color: var(--border);
  color: var(--text);
  background: transparent;
}

.btn--ghost:hover {
  border-color: var(--border-strong);
}

.btn svg {
  width: 18px;
  height: 18px;
}

/* ---------- Contenido ---------- */

main {
  max-width: 46rem;
  margin: 0 auto;
  padding: 3.5rem 1.5rem;
}

/* En pantallas grandes la rejilla de proyectos necesita más ancho que un
   párrafo: los textos se quedan en su medida de lectura. */
@media (min-width: 1024px) {
  main {
    max-width: 72rem;
  }

  #sobre-mi,
  #experiencia,
  #tecnologias,
  #educacion,
  #certificaciones,
  #contacto {
    max-width: 46rem;
    margin-inline: auto;
  }
}

section + section {
  margin-top: 3.5rem;
}

h2 {
  font-size: 1.35rem;
  margin: 0 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

p {
  color: var(--muted);
}

section p + p {
  margin-top: 0.85rem;
}

.section-intro {
  max-width: 46rem;
  margin: 0 0 1.5rem;
}

/* ---------- Proyectos ---------- */

.projects {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 1024px) {
  .projects {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.projects__more {
  margin: 2rem 0 0;
  text-align: center;
}

.project {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.project:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

.project__link {
  display: block;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

.project__link:hover {
  text-decoration: none;
}

.project__link:focus-visible {
  outline-offset: -2px;
}

.project__img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  object-position: top center;
  background: var(--stage);
  border-bottom: 1px solid var(--border);
}

.project__body {
  padding: 1.25rem 1.5rem 1.5rem;
}

.project__cat {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.project__body h3 {
  margin: 0.35rem 0 0.15rem;
  font-size: 1.15rem;
  line-height: 1.35;
}

.project__client {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
  color: var(--text);
  opacity: 0.75;
}

.project__desc {
  margin: 0;
}

.project__tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 1rem 0 0;
  padding: 0;
}

.project__tags li {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
}

.tag-icon {
  width: 14px;
  height: 14px;
  flex: none;
  fill: currentColor;
}

.stack__items {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 1.1rem 0.5rem;
  margin: 0;
  padding: 0;
}

.stack__items li {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.72rem;
  line-height: 1.25;
  text-align: center;
  color: var(--muted);
}

.stack__icon {
  width: 30px;
  height: 30px;
  flex: none;
  fill: currentColor;
}

.project__more {
  display: inline-block;
  margin-top: 1rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--accent);
}

.project__link:hover .project__more {
  text-decoration: underline;
}

/* En tres columnas la tarjeta más corta iguala su altura y el enlace
   «Ver detalle» queda alineado abajo. */
@media (min-width: 1024px) {
  .project__link {
    display: flex;
    flex-direction: column;
    height: 100%;
  }

  .project__body {
    display: flex;
    flex-direction: column;
    flex: 1;
  }

  .project__more {
    margin-top: auto;
    padding-top: 1rem;
  }
}

/* ---------- Experiencia ---------- */

.jobs {
  list-style: none;
  margin: 0;
  padding: 0;
}

.job {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 1.25rem 1.5rem;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.job__logo {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 0.25rem;
}

.job__logo img {
  display: block;
  width: 160px;
  height: auto;
}

/* El logo cambia con el tema: el de fondo oscuro va todo en rojo. */
.job__logo .job__logo-light {
  display: none;
}

[data-theme="light"] .job__logo .job__logo-dark {
  display: none;
}

[data-theme="light"] .job__logo .job__logo-light {
  display: block;
}

.job__body h3 {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.35;
}

.job__company {
  margin: 0.15rem 0 0;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 500;
}

.job__meta {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
}

.job__dates {
  margin: 0.15rem 0 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
}

.job__list {
  margin: 0.85rem 0 0;
  padding-left: 1.1rem;
}

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

.job__list li::marker {
  color: var(--accent);
}

@media (max-width: 560px) {
  .job {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .job__logo {
    justify-content: flex-start;
    padding-top: 0;
  }

  .job__logo img {
    width: 120px;
  }
}

/* ---------- Tecnologías ---------- */

.stack {
  margin: 0;
  display: grid;
}

.stack__row {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 1rem 1.25rem;
  align-items: start;
  padding: 1rem 0;
}

.stack__row + .stack__row {
  border-top: 1px solid var(--border);
}

.stack__row:first-child {
  padding-top: 0;
}

.stack__row:last-child {
  padding-bottom: 0;
}

.stack__row dt {
  padding-top: 0.3rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.stack__row dd {
  margin: 0;
}

@media (max-width: 560px) {
  .stack__row {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
}

/* ---------- Educación ---------- */

.edu {
  list-style: none;
  margin: 0;
  padding: 0;
}

.edu__item {
  display: grid;
  grid-template-columns: 165px minmax(0, 1fr);
  gap: 0.3rem 1.25rem;
  padding: 1.1rem 0;
  border-top: 1px solid var(--border);
}

.edu__item:first-child {
  padding-top: 0;
  border-top: 0;
}

.edu__item:last-child {
  padding-bottom: 0;
}

.edu__dates {
  margin: 0;
  padding-top: 0.15rem;
  font-size: 0.8rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.edu__body h3 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.35;
}

.edu__place {
  margin: 0.1rem 0 0;
  font-size: 0.92rem;
  color: var(--text);
  opacity: 0.85;
}

.edu__where {
  margin: 0.1rem 0 0;
  font-size: 0.82rem;
}

@media (max-width: 560px) {
  .edu__item {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }

  .edu__dates {
    padding-top: 0;
  }
}

/* ---------- Certificaciones ---------- */

.certs {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1rem;
}

.cert {
  padding: 1.25rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.cert h3 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.4;
}

.cert__issuer {
  margin: 0.35rem 0 0;
  font-size: 0.92rem;
  color: var(--text);
  opacity: 0.85;
}

.cert__tags {
  margin: 0.85rem 0 0;
}

.cert__link {
  display: inline-block;
  margin-top: 0.85rem;
  font-size: 0.85rem;
  font-weight: 500;
}

/* ---------- Página de un proyecto ---------- */

.proj-page {
  max-width: 46rem;
}

.proj-page h1 {
  margin: 0.35rem 0 0.3rem;
  font-size: clamp(1.75rem, 5vw, 2.4rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.proj-page .project__cat {
  display: block;
  margin: 1.75rem 0 0;
}

.proj-page__desc {
  margin: 0.9rem 0 1.75rem;
  font-size: 1.02rem;
}

.proj-page__gallery {
  display: grid;
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.pg-figure {
  margin: 0;
}

.pg-figure img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--stage);
}

.pg-figure figcaption {
  margin-top: 0.45rem;
  font-size: 0.8rem;
}

.proj-page h2 {
  margin-top: 2.25rem;
}

.proj-page .modal__facts,
.proj-page .modal__features {
  margin-bottom: 0;
}

.proj-page .project__tags {
  margin-top: 0.75rem;
}

.pg-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 2.75rem;
}

.pg-nav__link {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.9rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.pg-nav__link:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
  text-decoration: none;
}

.pg-nav__link--next {
  text-align: right;
}

.pg-nav__label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color 0.2s ease;
}

.pg-nav__link--prev .pg-nav__label::before {
  content: "\2190";
}

.pg-nav__link--next .pg-nav__label::after {
  content: "\2192";
}

.pg-nav__link--next .pg-nav__label {
  justify-content: flex-end;
}

.pg-nav__link:hover .pg-nav__label {
  color: var(--accent);
}

.pg-nav__name {
  font-size: 0.92rem;
  line-height: 1.35;
  color: var(--text);
}

@media (max-width: 560px) {
  .pg-nav {
    grid-template-columns: 1fr;
  }
}

.proj-page__cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2.5rem;
}

/* ---------- Archivo de proyectos ---------- */

.archive__head {
  max-width: 46rem;
  margin-bottom: 2rem;
}

.archive__back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.archive__back:hover {
  color: var(--text);
  text-decoration: none;
}

.archive__back svg {
  width: 16px;
  height: 16px;
}

.archive__head h1 {
  margin: 0.75rem 0 0;
  font-size: clamp(1.6rem, 4vw, 2.1rem);
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.archive__head p {
  margin: 0.75rem 0 0;
}

.archive__foot {
  margin: 2.5rem 0 0;
}

/* ---------- Contacto ---------- */

.contact__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

/* ---------- Cambio de tema ---------- */

/* Fallback: fundido de colores en navegadores sin View Transitions. */
.theme-fade,
.theme-fade *,
.theme-fade *::before,
.theme-fade *::after {
  transition:
    background-color 0.28s ease,
    color 0.28s ease,
    border-color 0.28s ease,
    fill 0.28s ease,
    box-shadow 0.28s ease !important;
}

/* Revelado circular: el snapshot nuevo se recorta desde el botón. */
::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}

::view-transition-old(root) {
  z-index: 1;
}

::view-transition-new(root) {
  z-index: 2;
}

/* ---------- Modal ---------- */
.modal {
  width: min(64rem, 94vw);
  max-height: 90vh;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.modal::backdrop {
  background: rgba(5, 7, 10, 0.78);
}

.modal__close {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  z-index: 3;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}

.modal__close:hover {
  border-color: var(--accent);
}

.modal__inner {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  max-height: 90vh;
}

.modal__gallery {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 0;
  padding: 1rem;
  background: var(--stage);
  border-right: 1px solid var(--border);
}

.modal__stage {
  position: relative;
  flex: 1;
  display: grid;
  place-items: center;
  min-height: 0;
}

.modal__img {
  display: block;
  max-width: 100%;
  max-height: 62vh;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--stage);
}

.modal__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.modal__nav:hover {
  border-color: var(--accent);
}

.modal__nav--prev { left: 0.35rem; }
.modal__nav--next { right: 0.35rem; }
.modal__nav[hidden] { display: none; }

.modal__thumbs {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.modal__thumb {
  flex: 0 0 auto;
  width: 84px;
  height: 54px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: none;
  overflow: hidden;
  opacity: 0.55;
  cursor: pointer;
}

.modal__thumb:hover { opacity: 0.85; }

.modal__thumb[aria-current="true"] {
  opacity: 1;
  border-color: var(--accent);
}

.modal__thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

.modal__content {
  position: relative;
  min-width: 0;
  max-height: 90vh;
  padding: 0 3rem 0 0;
  overflow: hidden;
}

/* El scroll vive aquí, no en el borde del modal: así la barra no pasa
   por debajo del botón de cerrar. */
.modal__scroll {
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.75rem 0.5rem 2rem 1.75rem;
  scrollbar-gutter: stable;
}

.modal__title {
  margin: 0.35rem 0 0.75rem;
  padding: 0;
  border: 0;
  font-size: 1.4rem;
  line-height: 1.3;
}

.modal__desc {
  margin: 0 0 1.25rem;
}

.modal__facts {
  display: grid;
  gap: 0.75rem;
  margin: 0 0 1.5rem;
}

.modal__fact {
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}

.modal__fact dt {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.modal__fact dd {
  margin: 0.2rem 0 0;
  font-size: 0.92rem;
  color: var(--text);
}

.modal__sub {
  margin: 0 0 0.6rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.modal__features {
  margin: 0 0 1.5rem;
  padding-left: 1.1rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.modal__features li {
  margin-bottom: 0.35rem;
}

.modal__features li::marker {
  color: var(--accent);
}

#modalStack {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem 0.75rem;
  margin: 0;
}

#modalStack li {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 0;
  border: 0;
  background: none;
  font-size: 0.7rem;
  line-height: 1.3;
  text-align: center;
  color: var(--muted);
}

#modalStack .tag-icon {
  width: 30px;
  height: 30px;
}

#modalStack li.no-icon::before {
  content: "";
  display: block;
  width: 30px;
  height: 30px;
}

@media (max-width: 560px) {
  #modalStack {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.modal__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.5rem;
}

.modal__actions:empty {
  display: none;
}

@media (max-width: 820px) {
  .modal__inner {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }

  .modal__gallery {
    border-right: 0;
    border-bottom: 1px solid var(--border);
    padding: 0.75rem;
  }

  .modal__img {
    max-height: 38vh;
  }

  .modal__content {
    max-height: none;
    padding: 0;
  }

  .modal__scroll {
    max-height: none;
    overflow: visible;
    padding: 1.5rem 1.25rem 1.75rem;
  }
}

/* ---------- Aparición al hacer scroll ---------- */

[data-reveal] {
  transition: opacity 0.5s ease, transform 0.5s ease;
}

[data-reveal].reveal-pending {
  opacity: 0;
  transform: translateY(14px);
}

/* ---------- Movimiento reducido ---------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .project:hover,
  .btn:hover {
    transform: none;
  }
}

/* ---------- Impresión ---------- */

@media print {
  .topbar,
  .modal,
  .skip-link {
    display: none !important;
  }

  body {
    background: #fff;
    color: #000;
  }
}
