/* La web pública de Tiza: la misma pizarra que la app (docs/design/IDENTIDAD.md).
   Tiza sobre pizarra, el amarillo solo para lo que decide el coach y el rojo solo para
   los riesgos, que aquí son lo que falta por rellenar en un borrador. */

@font-face {
  font-family: "Big Shoulders";
  src: url("/fonts/BigShoulders-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "Big Shoulders";
  src: url("/fonts/BigShoulders-ExtraBold.ttf") format("truetype");
  font-weight: 800;
  font-display: swap;
}

@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("/fonts/AtkinsonHyperlegibleNext-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("/fonts/AtkinsonHyperlegibleNext-Italic.ttf") format("truetype");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("/fonts/AtkinsonHyperlegibleNext-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --pizarra: #131c1a;
  --tiza: #eceee7;
  --tiza-gastada: #a3b0aa;
  --tiza-tenue: #7d8a85;
  --amarillo: #f1d45c;
  --rojo: #ee7d6b;
  --contorno: #667a74;
  --raya: #2c3b37;
  --alerta: #3a2421;
  --titulo: "Big Shoulders", "Arial Narrow", sans-serif;
  --texto: "Atkinson Hyperlegible Next", system-ui, sans-serif;
  --margen: clamp(1rem, 5vw, 3rem);
  --ancho: 66rem;
  /* Unos 70 caracteres por línea. */
  --medida: 38rem;
}

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

html {
  background: var(--pizarra);
  color: var(--tiza);
  font-family: var(--texto);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  font-size: 1.0625rem;
  line-height: 1.6;
}

.cabecera,
main,
.pie {
  width: 100%;
  max-width: var(--ancho);
  margin-inline: auto;
  padding-inline: var(--margen);
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.saltar {
  position: absolute;
  top: -5rem;
  left: var(--margen);
  z-index: 1;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  background: var(--amarillo);
  color: var(--pizarra);
  font-weight: 600;
}

.saltar:focus {
  top: 0.75rem;
}

a {
  color: var(--tiza);
  text-decoration-color: var(--contorno);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration-color: var(--tiza);
}

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

/* Cabecera */

.cabecera {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  column-gap: 2rem;
  padding-block: 0.5rem;
}

.nombre {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  font-family: var(--titulo);
  font-weight: 800;
  font-size: 1.75rem;
  letter-spacing: 0.01em;
  text-decoration: none;
}

.cabecera ul {
  display: flex;
  flex-wrap: wrap;
  column-gap: 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.cabecera nav a {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  color: var(--tiza-gastada);
  text-decoration: none;
}

.cabecera nav a:hover,
.cabecera nav a[aria-current="page"] {
  color: var(--tiza);
}

.cabecera nav a[aria-current="page"] {
  text-decoration: underline;
  text-decoration-color: var(--tiza);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.45em;
}

/* Texto */

main {
  padding-block: 2.5rem 4rem;
}

h1,
h2 {
  font-family: var(--titulo);
  font-weight: 800;
  letter-spacing: 0.01em;
  text-wrap: balance;
}

h1 {
  margin: 0 0 1rem;
  font-size: clamp(2.75rem, 9vw, 4.75rem);
  line-height: 0.95;
}

h2 {
  margin: 2.75rem 0 0.75rem;
  font-size: 1.875rem;
  line-height: 1.05;
}

h3 {
  margin: 2rem 0 0.5rem;
  font-size: 1.1875rem;
  font-weight: 600;
  line-height: 1.3;
}

p,
ul,
ol {
  margin: 0 0 1rem;
}

p,
li {
  text-wrap: pretty;
}

strong {
  font-weight: 600;
}

.texto > :not(h1, .tabla) {
  max-width: var(--medida);
}

/* "Última actualización", justo debajo del título. */
.texto > h1 + p {
  color: var(--tiza-gastada);
}

ul {
  padding-left: 1.25rem;
}

ul > li::marker {
  color: var(--tiza-tenue);
}

main li + li {
  margin-top: 0.375rem;
}

/* Pasos numerados, como los ejercicios de la app: el orden es real. */
.pasos {
  padding: 0;
  list-style: none;
}

.pasos > li {
  display: grid;
  grid-template-columns: 2.25rem 1fr;
  align-items: baseline;
}

.pasos > li + li {
  margin-top: 0.75rem;
}

.paso {
  font-family: var(--titulo);
  font-weight: 700;
  font-size: 1.875rem;
  line-height: 1;
}

/* Borradores */

.borrador {
  max-width: var(--medida);
  margin: 0 0 2.5rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  background: var(--alerta);
}

.borrador strong {
  color: var(--rojo);
}

mark.pendiente {
  padding: 0 0.2em;
  border-radius: 4px;
  background: var(--alerta);
  color: var(--rojo);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

/* Tablas */

.tabla {
  margin: 1.5rem 0 2rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  line-height: 1.5;
}

th,
td {
  padding: 0.75rem 1.25rem 0.75rem 0;
  text-align: left;
  vertical-align: top;
}

th {
  padding-top: 0;
  border-bottom: 1px solid var(--contorno);
  color: var(--tiza-gastada);
  font-weight: 600;
}

td {
  border-bottom: 1px solid var(--raya);
}

/* En el móvil, cada fila se apila y cada celda dice de qué columna es. */
@media (max-width: 40rem) {
  .tabla thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .tabla table,
  .tabla tbody,
  .tabla tr,
  .tabla td {
    display: block;
  }

  .tabla tr {
    padding: 1rem 0;
    border-bottom: 1px solid var(--raya);
  }

  .tabla td {
    padding: 0;
    border: 0;
  }

  .tabla td:first-child {
    font-weight: 600;
  }

  .tabla td + td {
    margin-top: 0.5rem;
  }

  .tabla td + td::before {
    content: attr(data-label);
    display: block;
    color: var(--tiza-tenue);
    font-size: 0.8125rem;
  }
}

/* Portada */

.portada h1 {
  font-size: clamp(3.25rem, 13vw, 6.5rem);
  line-height: 0.9;
}

.portada > :is(p, ul, h2) {
  max-width: var(--medida);
}

.entradilla {
  max-width: 34rem;
  color: var(--tiza-gastada);
  font-size: 1.1875rem;
}

.casos {
  padding: 0;
  list-style: none;
}

.casos > li + li {
  margin-top: 0.75rem;
}

/* El ejemplo: una fila de la pantalla Hoy con la corrección del coach. */
.ejemplo {
  max-width: 36rem;
  margin: 3rem 0 3.5rem;
}

.fila {
  display: grid;
  grid-template-columns: 2.25rem 1fr auto;
  align-items: baseline;
  column-gap: 0.75rem;
}

.orden {
  font-family: var(--titulo);
  font-weight: 700;
  font-size: 1.875rem;
  line-height: 1;
}

.ejercicio {
  font-weight: 600;
  font-size: 1.125rem;
}

.objetivo {
  color: var(--tiza-gastada);
  font-family: var(--titulo);
  font-weight: 700;
  font-size: 1.5rem;
}

.peso {
  grid-column: 2 / -1;
  margin-top: 0.5rem;
  font-family: var(--titulo);
  font-weight: 800;
  font-size: clamp(3.5rem, 16vw, 5rem);
  line-height: 1;
}

.viejo {
  position: relative;
  margin-right: 0.25em;
  color: var(--tiza-tenue);
}

/* La raya de tiza amarilla que tacha el peso viejo, como en la app. */
.viejo::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -0.08em;
  left: -0.08em;
  height: 0.08em;
  border-radius: 0.04em;
  background: var(--amarillo);
  transform: rotate(-8deg);
  transform-origin: left center;
}

.nuevo {
  color: var(--amarillo);
}

.unidad {
  margin-left: 0.15em;
  color: var(--tiza-gastada);
  font-weight: 700;
  font-size: 0.4em;
}

.motivo {
  grid-column: 2 / -1;
  margin-top: 0.5rem;
  color: var(--tiza-gastada);
  font-size: 0.9375rem;
}

.ejemplo figcaption {
  max-width: 30rem;
  margin-top: 1.5rem;
  color: var(--tiza-tenue);
  font-size: 0.9375rem;
}

/* El único momento animado: la raya tacha el peso viejo y aparece el nuevo. */
@media (prefers-reduced-motion: no-preference) {
  .viejo::after {
    animation: tachar 220ms ease-out 700ms both;
  }

  .nuevo,
  .motivo {
    animation: aparecer 220ms ease-out 920ms both;
  }
}

@keyframes tachar {
  from {
    transform: rotate(-8deg) scaleX(0);
  }
}

@keyframes aparecer {
  from {
    opacity: 0;
  }
}

/* Pie */

.pie {
  padding-block: 1.5rem 3rem;
  border-top: 1px solid var(--raya);
  color: var(--tiza-tenue);
  font-size: 0.875rem;
}

.pie p {
  max-width: var(--medida);
  margin: 0;
}

/* Los textos legales también se imprimen o se guardan en PDF: tinta negra sobre blanco. */
@media print {
  :root {
    color-scheme: light;
  }

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

  body {
    font-size: 11pt;
  }

  .saltar,
  .cabecera nav,
  .pie {
    display: none;
  }

  a {
    color: #000;
  }

  .texto > h1 + p,
  th {
    color: #333;
  }

  th {
    border-color: #000;
  }

  td {
    border-color: #999;
  }

  .borrador,
  mark.pendiente {
    background: none;
    color: #000;
    outline: 1px dashed #000;
  }

  .borrador strong {
    color: #000;
  }

  h2,
  h3 {
    break-after: avoid;
  }

  tr {
    break-inside: avoid;
  }
}
