/* ------------------------------------------------------------------
   Página personal de Miguel García Silvente
   CSS autocontenido (sin dependencias). Modo claro y oscuro automáticos.
------------------------------------------------------------------- */

:root {
  color-scheme: light dark;

  --bg: #faf8f4;
  --bg-alt: #f1ede5;
  --surface: #ffffff;
  --ink: #1c2030;
  --muted: #4a5063;
  --line: #d9d3c5;
  --accent: #1d3f8a;
  --accent-ink: #ffffff;
  --accent-soft: #e6ecfa;
  --highlight-bg: #fff4d6;
  --highlight-line: #8a5a00;
  --focus: #8a3b00;

  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-head: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;

  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 24, 40, 0.06), 0 6px 18px rgba(20, 24, 40, 0.06);
  --shadow-hover: 0 14px 34px rgba(20, 24, 40, 0.18);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12141c;
    --bg-alt: #181b26;
    --surface: #1d2130;
    --ink: #eceef4;
    --muted: #b6bccd;
    --line: #333953;
    --accent: #9db9ff;
    --accent-ink: #0d1220;
    --accent-soft: #232c4a;
    --highlight-bg: #2a2310;
    --highlight-line: #e0b24a;
    --focus: #ffd479;
    --shadow: none;
    --shadow-hover: 0 0 0 1px var(--accent), 0 14px 34px rgba(0, 0, 0, 0.55);
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem; /* 17 px */
  line-height: 1.65;
}

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

/* ---------- Utilidades de accesibilidad ---------- */

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

.skip-link {
  position: absolute;
  left: 0.75rem;
  top: -4rem;
  z-index: 100;
  padding: 0.75rem 1.1rem;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  border-radius: 0 0 10px 10px;
  text-decoration: none;
}
.skip-link:focus {
  top: 0;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 4px;
}

main:focus {
  outline: none; /* destino del enlace «saltar al contenido», no es interactivo */
}

[id] {
  scroll-margin-top: 1.5rem;
}

/* ---------- Enlaces ---------- */

a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.18em;
  text-decoration-thickness: 0.08em;
}
a:hover {
  text-decoration-thickness: 0.16em;
}

/* Icono «enlace externo» (decorativo: no se lee) */
a.ext::after {
  content: "";
  display: inline-block;
  width: 0.7em;
  height: 0.7em;
  margin-left: 0.3em;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 17 17 7M8 7h9v9'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 17 17 7M8 7h9v9'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* ---------- Estructura ---------- */

.wrap {
  width: min(100% - 2.5rem, 68rem);
  margin-inline: auto;
}

.section {
  padding-block: clamp(2.5rem, 6vw, 4.5rem);
}
.section.alt {
  background: var(--bg-alt);
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-head);
  line-height: 1.2;
  margin: 0 0 0.6em;
  text-wrap: balance;
}
h1 {
  font-size: clamp(2.1rem, 5.5vw, 3.2rem);
  letter-spacing: -0.01em;
}
h2 {
  font-size: clamp(1.7rem, 4vw, 2.3rem);
  padding-bottom: 0.45em;
  position: relative;
}
h2::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 3.5rem;
  height: 4px;
  border-radius: 2px;
  background: var(--accent);
}
h3 {
  font-size: 1.4rem;
  margin-top: 2.2rem;
}
h4 {
  font-size: 1.15rem;
  margin-bottom: 0.4em;
}

p {
  margin: 0 0 1em;
  max-width: 70ch;
}
.intro {
  font-size: 1.15rem;
}

/* ---------- Cabecera ---------- */

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem 1.5rem;
  padding-block: 0.5rem;
}
.brand {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--ink);
  text-decoration: none;
  padding-block: 0.5rem;
}
.main-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.main-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0.25rem 0.8rem;
  border-radius: 999px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.98rem;
}
.main-nav a:hover {
  background: var(--accent-soft);
}
.main-nav a[aria-current="true"] {
  background: var(--accent-soft);
  box-shadow: inset 0 -3px 0 var(--accent);
}

@media (min-width: 48em) and (min-height: 40em) {
  .site-header {
    position: sticky;
    top: 0;
    z-index: 50;
  }
  [id] {
    scroll-margin-top: 5rem;
  }
}

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

.hero {
  padding-block: clamp(2.5rem, 7vw, 4.5rem);
  background:
    radial-gradient(60rem 22rem at 90% -10%, var(--accent-soft), transparent 70%),
    var(--bg);
}
.hero-inner {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: clamp(1.25rem, 4vw, 2.5rem);
  align-items: center;
}
.portrait {
  width: 120px;
  height: auto;
  border-radius: 50%;
  aspect-ratio: 1;
  object-fit: cover;
  border: 4px solid var(--surface);
  box-shadow: var(--shadow), 0 0 0 1px var(--line);
}
.role {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.6em;
}
.lead {
  font-size: 1.1rem;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  list-style: none;
  padding: 0;
  margin: 1.2rem 0 0;
}
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0.3rem 1rem;
  border: 2px solid var(--accent);
  border-radius: 999px;
  font-weight: 700;
  text-decoration: none;
  background: var(--surface);
}
.chip:hover {
  background: var(--accent-soft);
}

@media (max-width: 36em) {
  .hero-inner {
    grid-template-columns: 1fr;
    justify-items: start;
  }
}

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

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.55rem 1.4rem;
  border: 2px solid var(--accent);
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  text-decoration: none;
}
.button:hover {
  filter: brightness(1.08);
}
.button.secondary {
  background: transparent;
  color: var(--accent);
}
.button.secondary:hover {
  background: var(--accent-soft);
  filter: none;
}

/* ---------- Oferta de contrato ---------- */

.offer-section {
  background: var(--highlight-bg);
  border-block: 4px solid var(--highlight-line);
}
.eyebrow {
  display: inline-block;
  margin: 0 0 0.8rem;
  padding: 0.2rem 0.8rem;
  border-radius: 999px;
  background: var(--highlight-line);
  color: var(--highlight-bg);
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.offer-section h2::after {
  background: var(--highlight-line);
}
.deadline {
  display: inline-block;
  padding: 0.6rem 1rem;
  border: 2px solid var(--highlight-line);
  border-radius: 10px;
  background: var(--surface);
  font-size: 1.1rem;
}
.deadline[hidden] {
  display: none;
}

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 0.9rem;
  margin: 1.6rem 0 0.5rem;
}
.facts > div {
  padding: 0.9rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.facts dt {
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.facts dd {
  margin: 0.2rem 0 0;
  font-weight: 600;
}

.offer-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 24rem), 1fr));
  gap: 0 3rem;
}
.tasks {
  padding-left: 1.25rem;
}
.tasks li {
  margin-bottom: 0.7em;
  max-width: 62ch;
}

.criteria {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
  display: grid;
  gap: 0.9rem;
}
.criteria > li {
  padding: 1rem 1.2rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.criteria p {
  margin-bottom: 0.4em;
}
.criteria ul {
  margin: 0.3rem 0 0;
  padding-left: 1.25rem;
}
.criterion-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}
.criterion-head h4 {
  margin: 0;
}
.weight {
  margin: 0;
  font-family: var(--font-head);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent);
}
.offer-section .weight {
  color: var(--ink);
}

.offer-actions {
  margin-top: 2rem;
}
.note {
  font-size: 0.95rem;
  color: var(--muted);
}
.offer-section .note a {
  color: var(--ink);
}

/* ---------- Sobre mí ---------- */

.split {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(1.25rem, 4vw, 3rem);
  align-items: center;
  margin-top: 2rem;
}
.split h3 {
  margin-top: 0;
}
.split figure {
  margin: 0;
}
.split img {
  width: 100%;
  border-radius: var(--radius);
  box-shadow: var(--shadow), 0 0 0 1px var(--line);
}
@media (min-width: 48em) {
  .split.reverse figure {
    order: 2;
  }
}
@media (max-width: 47.99em) {
  .split {
    grid-template-columns: 1fr;
  }
}

/* ---------- Tarjetas y listas ---------- */

.cards {
  list-style: none;
  padding: 0;
  margin: 1.2rem 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 26rem), 1fr));
  gap: 1.1rem;
}
.cards > li {
  padding: 1.3rem 1.4rem 0.6rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.cards p {
  max-width: none;
}
.cards .icon {
  display: block;
  width: 56px;
  height: 56px;
  margin-bottom: 0.9rem;
  color: var(--accent);
}

.tags {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}
.tags li {
  padding: 0.45rem 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.plain {
  padding-left: 1.25rem;
}

/* ---------- Pie ---------- */

.site-footer {
  padding-block: 2rem;
  background: var(--surface);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.95rem;
}
.site-footer p {
  margin-bottom: 0.4em;
}

/* ---------- Preferencias del usuario ---------- */

@media (forced-colors: active) {
  .button,
  .chip,
  .deadline,
  .facts > div,
  .criteria > li,
  .cards > li {
    border: 2px solid CanvasText;
  }
  .main-nav a[aria-current="true"] {
    outline: 2px solid Highlight;
  }
}

@media print {
  .site-header,
  .skip-link,
  .chips,
  .offer-actions {
    display: none;
  }
  body {
    background: #fff;
    color: #000;
    font-size: 11pt;
  }
  .section,
  .section.alt,
  .offer-section {
    background: #fff;
    padding-block: 1rem;
  }
  a {
    color: #000;
  }
}

/* ------------------------------------------------------------------
   Efectos al pasar el ratón (y al enfocar con teclado)
------------------------------------------------------------------- */

.cards > li,
.facts > div,
.criteria > li,
.tags li,
.split figure,
.chip,
.button,
.portrait {
  transition:
    transform 0.25s ease,
    box-shadow 0.25s ease,
    border-color 0.25s ease,
    background-color 0.25s ease,
    color 0.25s ease;
}

/* Tarjetas de docencia e investigación: franja superior, borde y sombra */
.cards > li:hover,
.cards > li:focus-within {
  border-color: var(--accent);
  box-shadow: inset 0 5px 0 var(--accent), var(--shadow-hover);
}
.cards > li:hover h4,
.cards > li:focus-within h4 {
  color: var(--accent);
}
.cards .icon {
  transition: transform 0.3s ease;
}

/* Datos y criterios de la oferta */
.facts > div:hover,
.criteria > li:hover,
.criteria > li:focus-within {
  border-color: var(--highlight-line);
  box-shadow: var(--shadow-hover);
}
.facts > div:hover {
  box-shadow: inset 5px 0 0 var(--highlight-line), var(--shadow-hover);
}

/* Temas de TFM */
.tags li:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}

/* Fotos de la ETSIIT */
.split figure {
  overflow: hidden;
  border-radius: var(--radius);
}
.split img {
  transition: transform 0.5s ease;
}
.split figure:hover {
  box-shadow: var(--shadow-hover);
}

/* Botones y perfiles */
.button:hover,
.chip:hover {
  box-shadow: var(--shadow-hover);
}
.portrait:hover {
  box-shadow: var(--shadow-hover), 0 0 0 1px var(--accent);
}

/* Movimiento: solo si la persona no ha pedido reducirlo */
@media (prefers-reduced-motion: no-preference) {
  .cards > li:hover,
  .cards > li:focus-within,
  .facts > div:hover,
  .criteria > li:hover,
  .criteria > li:focus-within {
    transform: translateY(-6px);
  }
  .cards > li:hover .icon,
  .cards > li:focus-within .icon {
    transform: scale(1.12) rotate(-4deg);
  }
  .tags li:hover {
    transform: translateY(-2px);
  }
  .split figure:hover img {
    transform: scale(1.05);
  }
  .button:hover,
  .chip:hover {
    transform: translateY(-2px);
  }
  .portrait:hover {
    transform: scale(1.06);
  }
}
