/* Marc Gracia i Riera — hoja de estilos
   Paleta fría de "registro de riesgos": tinta azul pizarra, papel gris frío,
   acento verde azulado (control) y una escala de calor para la matriz 5×5. */

@font-face { font-family: "Public Sans"; src: url("../fonts/public-sans-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Public Sans"; src: url("../fonts/public-sans-latin-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Public Sans"; src: url("../fonts/public-sans-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Public Sans"; src: url("../fonts/public-sans-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }

:root {
  --paper: #eef1f4;
  --surface: #f8fafb;
  --ink: #14202b;
  --muted: #4f5d6a;
  --rule: #c9d1d8;
  --accent: #1d6b74;
  --accent-ink: #ffffff;
  --heat-1: #cfe2dd;
  --heat-2: #a3c9c0;
  --heat-3: #e2c36e;
  --heat-4: #d48a4b;
  --heat-5: #b0463a;
  --focus: #1d6b74;
  --measure: 66ch;
  --wide: 72rem;
  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: 1.6rem;
  --step-3: 2.25rem;
  --step-4: clamp(2.6rem, 5.5vw, 4.25rem);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --paper: #0f1a22;
  --surface: #16242f;
  --ink: #e4ebf0;
  --muted: #9fb0bd;
  --rule: #2a3b48;
  --accent: #6cc1bf;
  --accent-ink: #0f1a22;
  --heat-1: #20403f;
  --heat-2: #2f625d;
  --heat-3: #9c8540;
  --heat-4: #a9663a;
  --heat-5: #a7473c;
  --focus: #8fd6d3;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; scroll-padding-top: 6rem; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: var(--step-0);
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 2px; }

h1, h2, h3 { line-height: 1.15; margin: 0; font-weight: 700; letter-spacing: -0.015em; }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-1); font-weight: 600; letter-spacing: 0; }
p { margin: 0 0 1em; max-width: var(--measure); }

.skip { position: absolute; left: -999px; top: 0.5rem; background: var(--ink); color: var(--paper); padding: 0.5rem 0.75rem; z-index: 10; }
.skip:focus { left: 0.5rem; }

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

/* Cabecera */
.site-head {
  position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
}
.site-head .wrap { display: flex; align-items: center; gap: 1.5rem; min-height: 4rem; }
.brand { font-weight: 700; color: var(--ink); text-decoration: none; margin-right: auto; white-space: nowrap; }
.nav { display: flex; gap: 1.25rem; flex-wrap: wrap; }
.nav a { color: var(--muted); text-decoration: none; font-size: var(--step--1); font-weight: 600; }
.nav a:hover { color: var(--ink); }
.theme-toggle {
  display: inline-grid; place-items: center; width: 2.5rem; height: 2.5rem;
  border: 1px solid var(--rule); border-radius: 999px; background: var(--surface);
  color: var(--ink); cursor: pointer;
}
.theme-toggle svg { width: 1.15rem; height: 1.15rem; }
.theme-toggle .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: block; }

@media (max-width: 760px) {
  .site-head .wrap { flex-wrap: wrap; gap: 0.25rem 1rem; padding-top: 0.6rem; }
  .nav { order: 3; width: 100%; flex-wrap: nowrap; overflow-x: auto; gap: 1.1rem; padding-bottom: 0.6rem; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { white-space: nowrap; }
}

/* Portada */
.hero { padding-block: clamp(3rem, 8vw, 6.5rem) clamp(3rem, 7vw, 5.5rem); }
.hero .wrap { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: clamp(2rem, 6vw, 5rem); align-items: center; }
.hero h1 { font-size: var(--step-4); letter-spacing: -0.03em; margin-bottom: 1.25rem; }
.hero .lead { font-size: var(--step-1); line-height: 1.45; max-width: 34ch; margin-bottom: 1.25rem; }
.hero .bio { color: var(--muted); max-width: 52ch; }
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.75rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0.75rem 1.15rem; border-radius: 6px; font-weight: 600; font-size: var(--step--1);
  text-decoration: none; border: 1px solid var(--accent); line-height: 1.2;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { color: var(--accent); background: transparent; }
.btn-ghost:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); }

/* Matriz de riesgo: el elemento memorable */
.matrix { margin: 0; }
.matrix-grid {
  display: grid; grid-template-columns: 1.5rem repeat(5, 1fr); grid-template-rows: repeat(5, 1fr) 1.5rem;
  gap: 5px; aspect-ratio: 1 / 1; max-width: 26rem; margin-left: auto;
}
.matrix-grid .cell { border-radius: 4px; }
.h1 { background: var(--heat-1); } .h2 { background: var(--heat-2); } .h3 { background: var(--heat-3); }
.h4 { background: var(--heat-4); } .h5 { background: var(--heat-5); }
.axis { font-size: 0.75rem; color: var(--muted); font-weight: 600; display: flex; align-items: center; justify-content: center; }
.axis-y { grid-column: 1; grid-row: 1 / 6; writing-mode: vertical-rl; transform: rotate(180deg); }
.axis-x { grid-column: 2 / 7; grid-row: 6; }
.matrix figcaption { font-size: var(--step--1); color: var(--muted); max-width: 26rem; margin: 0.9rem 0 0 auto; }

@media (prefers-reduced-motion: no-preference) {
  .matrix-grid .cell { animation: settle 520ms cubic-bezier(.2,.7,.2,1) both; }
  .matrix-grid .d0 { animation-delay: 150ms; }
  .matrix-grid .d1 { animation-delay: 205ms; }
  .matrix-grid .d2 { animation-delay: 260ms; }
  .matrix-grid .d3 { animation-delay: 315ms; }
  .matrix-grid .d4 { animation-delay: 370ms; }
  .matrix-grid .d5 { animation-delay: 425ms; }
  .matrix-grid .d6 { animation-delay: 480ms; }
  .matrix-grid .d7 { animation-delay: 535ms; }
  .matrix-grid .d8 { animation-delay: 590ms; }
  @keyframes settle { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }
}

@media (max-width: 860px) {
  .hero .wrap { grid-template-columns: 1fr; }
  .matrix-grid { margin-left: 0; max-width: 20rem; }
  .matrix figcaption { margin-left: 0; }
}

/* Secciones */
.section { padding-block: clamp(3.5rem, 8vw, 6rem); border-top: 1px solid var(--rule); }
.section-head { display: grid; grid-template-columns: minmax(0, 18rem) minmax(0, 1fr); gap: 2rem; margin-bottom: 2.5rem; align-items: end; }
.section-head p { color: var(--muted); margin: 0; }
@media (max-width: 760px) { .section-head { grid-template-columns: 1fr; gap: 0.75rem; } }

/* Trayectoria: línea temporal real */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: minmax(0, 18rem) minmax(0, 1fr); gap: 2rem; padding-block: 1.6rem; border-top: 1px solid var(--rule); }
.timeline li:first-child { border-top: 0; padding-top: 0; }
.when { color: var(--muted); font-weight: 600; font-size: var(--step--1); }
.when .org { display: block; color: var(--ink); font-size: var(--step-1); font-weight: 700; margin-top: 0.2rem; }
.role { font-weight: 600; margin-bottom: 0.5rem; }
.timeline p { margin-bottom: 0; }
.timeline li.current .when .org::after {
  content: "Actual"; margin-left: 0.6rem; font-size: 0.75rem; font-weight: 600; vertical-align: middle;
  color: var(--accent); border: 1px solid var(--accent); border-radius: 999px; padding: 0.1rem 0.5rem;
}
@media (max-width: 760px) { .timeline li { grid-template-columns: 1fr; gap: 0.5rem; } }

/* Podcast */
.podcast { background: var(--surface); }
.podcast-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(2rem, 5vw, 4rem); }
.big-number { margin: 0 0 0.5rem; font-size: clamp(3.5rem, 9vw, 6rem); font-weight: 700; line-height: 1; letter-spacing: -0.04em; color: var(--accent); }
.big-number + p { color: var(--muted); }
.links { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1.5rem; }
@media (max-width: 760px) { .podcast-body { grid-template-columns: 1fr; } }

/* Formación */
.edu { display: grid; grid-template-columns: minmax(0, 18rem) minmax(0, 1fr); gap: 2rem; }
.certs { list-style: none; margin: 0; padding: 0; }
.certs li { padding: 0.55rem 0; border-bottom: 1px solid var(--rule); }
.certs li strong { display: block; }
.certs li span { color: var(--muted); font-size: var(--step--1); }
.study { padding-bottom: 2rem; margin-bottom: 2rem; border-bottom: 1px solid var(--rule); }
.study:last-child { border-bottom: 0; margin-bottom: 0; }
.study .meta { color: var(--muted); font-size: var(--step--1); margin-bottom: 0.75rem; }
.thesis { margin-top: 1rem; padding: 1rem 1.15rem; background: var(--surface); border-left: 3px solid var(--accent); border-radius: 0 6px 6px 0; }
.thesis h4 { margin: 0 0 0.35rem; font-size: var(--step-0); }
.thesis p { font-size: var(--step--1); margin-bottom: 0.75rem; }
.small-note { font-size: var(--step--1); color: var(--muted); }
@media (max-width: 760px) { .edu { grid-template-columns: 1fr; } }

/* Asesorías */
.offers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem; }
.offer { padding: 1.75rem; background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; display: flex; flex-direction: column; }
.offer.primary { border-color: var(--accent); }
.price { display: flex; align-items: baseline; gap: 0.5rem; margin: 0.75rem 0 1rem; }
.price strong { font-size: var(--step-3); letter-spacing: -0.02em; }
.price span { color: var(--muted); font-size: var(--step--1); }
.offer ul { padding-left: 1.1rem; margin: 0 0 1.5rem; }
.offer ul li { margin-bottom: 0.35rem; }
.offer .actions { margin-top: auto; }
.terms { margin-top: 2rem; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.5rem; color: var(--muted); font-size: var(--step--1); }
.terms strong { color: var(--ink); display: block; margin-bottom: 0.2rem; }
@media (max-width: 860px) { .offers, .terms { grid-template-columns: 1fr; } }

/* Cursos */
.course { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1.5rem; align-items: center; padding: 1.5rem 0; border-top: 1px solid var(--rule); }
.course:first-of-type { border-top: 0; }
.status { font-size: var(--step--1); font-weight: 600; color: var(--accent); }
@media (max-width: 760px) { .course { grid-template-columns: 1fr; } }

/* Contacto y pie */
.contact-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.6rem; }
.contact-list span { color: var(--muted); display: inline-block; min-width: 6.5rem; }
.site-foot { border-top: 1px solid var(--rule); padding-block: 2rem; font-size: var(--step--1); color: var(--muted); }
.site-foot .wrap { display: flex; flex-wrap: wrap; gap: 1.25rem; justify-content: space-between; }
.site-foot nav { display: flex; gap: 1.25rem; }
.site-foot a { color: var(--muted); }

/* Páginas legales */
.legal { padding-block: 3rem 5rem; }
.legal h1 { font-size: var(--step-3); margin-bottom: 1.5rem; }
.legal h2 { font-size: var(--step-1); margin: 2rem 0 0.75rem; }
.legal .todo { background: color-mix(in srgb, var(--heat-3) 35%, transparent); padding: 0 0.25rem; border-radius: 3px; }
.notice { padding: 1rem 1.15rem; border-left: 3px solid var(--heat-4); background: var(--surface); margin-bottom: 2rem; max-width: var(--measure); }
.spaced { margin-top: 2rem; }
