:root {
  --crema: #ffd9a0;
  --naranja: #ff9f1c;
  --azul-oscuro: #0e1a2b;
  --negro-azulado: #0f141e;
  --texto: #e0f0ff;
  --texto-claro: #dff1ff;
}

body {
  margin: 0;
  overflow: hidden;
}

/* =====================================================
   BASE COMÚN (solo lo que comparten todos los pop-ups)
   ===================================================== */
dialog.modal-portfolio {
  box-sizing: border-box;
  animation: modalFadeIn 0.3s ease-out forwards;
}

dialog.modal-portfolio::backdrop {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  dialog.modal-portfolio {
    animation: none;
  }
}

.modal-form {
  text-align: right;
}

.btn-tancar {
  cursor: pointer;
  font-weight: bold;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.btn-tancar:focus-visible,
.social-links a:focus-visible {
  outline: 2px solid var(--crema);
  outline-offset: 2px;
}

/* =====================================================
   POP-UP ABOUT ME
   ===================================================== */
dialog.modal-about {
  /* Tamaño: crece con la pantalla, con mínimo y máximo */
  width: min(92vw, clamp(340px, 42vw, 820px));
  max-width: none;
  max-height: 90vh;
  overflow: auto;
  padding: 2em;
  /* Todo lo de dentro va en em, así escala con esta línea */
  font-size: clamp(14px, 1.05vw, 24px);

  background: rgba(15, 20, 30, 0.92);
  color: var(--texto);
  border: 1px solid rgba(255, 217, 160, 0.3);
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7),
              0 0 20px rgba(223, 241, 255, 0.1);
  backdrop-filter: blur(8px);
}

.modal-about h2 {
  margin: 0 0 0.7em;
  color: var(--crema);
  font-family: sans-serif;
  font-size: 1.8em;
  border-bottom: 2px solid rgba(255, 217, 160, 0.2);
  padding-bottom: 0.3em;
}

.modal-about .about-body {
  display: flex;
  gap: 1.5em;
  align-items: center;
  margin-bottom: 1.5em;
}

.modal-about .about-avatar img {
  width: 5em;
  height: 5em;
  border-radius: 50%;
  border: 2px solid var(--crema);
  object-fit: cover;
  box-shadow: 0 0 15px rgba(255, 217, 160, 0.4);
}

.modal-about .about-text p {
  margin: 0 0 0.8em;
  line-height: 1.5;
  font-size: 0.95em;
}

.modal-about .social-links {
  display: flex;
  gap: 1em;
  margin-top: 0.8em;
}

.modal-about .social-links a {
  color: var(--crema);
  text-decoration: none;
  font-size: 0.9em;
  font-weight: bold;
  border: 1px solid rgba(255, 217, 160, 0.4);
  padding: 0.3em 0.8em;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.modal-about .social-links a:hover {
  background: var(--crema);
  color: var(--negro-azulado);
  box-shadow: 0 0 10px rgba(255, 217, 160, 0.6);
}

.modal-about .btn-tancar {
  background: transparent;
  color: var(--texto-claro);
  border: 1px solid var(--texto-claro);
  padding: 0.5em 1.1em;
  font-size: 1em;
}

.modal-about .btn-tancar:hover {
  background: var(--texto-claro);
  color: var(--negro-azulado);
  box-shadow: 0 0 10px rgba(223, 241, 255, 0.5);
}

@media (max-width: 520px) {
  .modal-about .about-body {
    flex-direction: column;
    text-align: center;
  }
}

/* =====================================================
   POP-UP CONTACTO (letrero de estación)
   ===================================================== */
dialog.modal-contacte {
  /* Posición de los iconos sobre la imagen (% del pop-up). Ajustar a ojo */
  --gmail-x: 16.2%;
  --gmail-y: 49%;
  --github-x: 84.3%;
  --github-y: 49.8%;

  /* Tamaño: ~56% del ancho de pantalla, sin pasarse de alto */
  width: min(92vw, 130vh, max(56vw, 520px));
  max-width: none;
  aspect-ratio: 1200 / 800;       /* ancho / alto de tu imagen */
  padding: 0;
  overflow: hidden;

  /* Para que el texto escale con el ancho del pop-up (unidades cqw) */
  container-type: inline-size;

  background-color: var(--azul-oscuro);
  background-image: url("media/contacte/cartell-estacio.svg");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 100% 100%;

  color: #f3eee2;
  border: 3px solid var(--naranja);
  border-radius: 14px;
  box-shadow: 0 0 30px rgba(255, 159, 28, 0.35);
}

/* Capa de enlaces sobre los iconos de la imagen */
.modal-contacte .sign-links {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.modal-contacte .sign-link {
  position: absolute;
  width: 9%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  pointer-events: auto;
  cursor: pointer;
  transition: box-shadow 0.15s;
}

.modal-contacte .sign-gmail  { left: var(--gmail-x);  top: var(--gmail-y); }
.modal-contacte .sign-github { left: var(--github-x); top: var(--github-y); }

.modal-contacte .sign-link:hover,
.modal-contacte .sign-link:focus-visible {
  box-shadow: 0 0 0 3px var(--naranja), 0 0 18px rgba(255, 159, 28, 0.6);
  outline: none;
}

/* Texto y botón, debajo del letrero */
.modal-contacte .modal-content {
  position: absolute;
  top: 68%;
  left: 0;
  right: 0;
  bottom: 0;
  box-sizing: border-box;
  padding: 0 7% 4%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-size: clamp(11px, 2.1cqw, 26px);
}

/* El título ya está en el letrero: se oculta solo visualmente */
.modal-contacte h2 {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.modal-contacte .about-text p {
  margin: 0;
  line-height: 1.4;
  font-size: 1em;
}

.modal-contacte .btn-tancar {
  background: var(--naranja);
  color: #1a1208;
  border: 1px solid var(--naranja);
  padding: 0.4em 1.1em;
  font-size: 1em;
}

.modal-contacte .btn-tancar:hover {
  background: #ffc870;
  box-shadow: 0 0 10px rgba(255, 159, 28, 0.6);
}