/* Estilos de apsaro.com. Tokens: piedra (fondo), tinta (texto), mar (acción), niebla (líneas), sello (puertas y aprobación) */
:root {
  --piedra: #f2f3ef;
  --muro: #fafbf8;
  --tinta: #17232b;
  --gris: #4a5a61;
  --mar: #24505c;
  --niebla: #c9d3d1;
  --sello: #b7861f;
  --ancho: 70rem;
  --conector: 1.5rem;
  --texto: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
}

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

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

body {
  margin: 0;
  background: var(--piedra);
  color: var(--tinta);
  font-family: var(--texto);
  font-size: 1.0625rem;
  line-height: 1.6;
}

a {
  color: var(--mar);
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--tinta);
}

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

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

.contenedor {
  max-width: var(--ancho);
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* Encabezado */
.encabezado {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-top: 1.5rem;
  padding-bottom: 1.5rem;
}

.marca {
  color: var(--tinta);
  font-size: 1.375rem;
  font-weight: 800;
  font-stretch: 125%;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.encabezado nav a {
  color: var(--tinta);
}

/* Portada */
.portada {
  display: grid;
  gap: 3.5rem;
  padding-top: 2.5rem;
  padding-bottom: 4.5rem;
}

.portada h1 {
  max-width: 15ch;
  margin: 0 0 1.5rem;
  font-size: clamp(2.25rem, 1.3rem + 3.6vw, 3.75rem);
  font-weight: 800;
  font-stretch: 125%;
  line-height: 1.04;
  letter-spacing: -0.02em;
}

.entrada {
  max-width: 40ch;
  margin: 0 0 2rem;
  color: var(--gris);
  font-size: 1.1875rem;
}

.acciones {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.5rem;
}

.boton {
  display: inline-block;
  padding: 0.8rem 1.3rem;
  border-radius: 4px;
  background: var(--mar);
  color: var(--piedra);
  font-weight: 600;
  text-decoration: none;
}

.boton:hover {
  background: var(--tinta);
  color: var(--piedra);
}

.estado {
  color: var(--gris);
  font-size: 0.9375rem;
}

/* Diagrama del fuerte: agentes → puerta → permisos → puerta → canales */
.fuerte-diagrama {
  display: grid;
  justify-items: center;
  row-gap: var(--conector);
  margin: 0;
}

.lado {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--gris);
  font-size: 0.9375rem;
}

.lado li {
  position: relative;
  white-space: nowrap;
}

.lado .pronto {
  opacity: 0.7;
}

.lado small {
  font-size: 0.75rem;
}

/* En móvil, una línea vertical une cada grupo con su puerta */
.origen::before,
.destino::before {
  content: "";
  position: absolute;
  left: 50%;
  height: var(--conector);
  border-left: 1px solid var(--gris);
}

.origen::before {
  top: 100%;
}

.destino::before {
  bottom: 100%;
}

.fuerte {
  position: relative;
  width: 100%;
  max-width: 22rem;
  padding: 1.25rem 1.5rem 1.4rem;
  border: 3px solid var(--tinta);
  background: var(--muro);
}

/* Las dos puertas del muro, en el color del sello */
.fuerte::before,
.fuerte::after {
  content: "";
  position: absolute;
  left: calc(50% - 1.1rem);
  width: 2.2rem;
  height: 3px;
  background: var(--sello);
}

.fuerte::before {
  top: -3px;
}

.fuerte::after {
  bottom: -3px;
}

.fuerte-nombre {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 800;
  font-stretch: 125%;
}

.fuerte-nota {
  margin: 0 0 0.75rem;
  color: var(--gris);
  font-size: 0.875rem;
}

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

.reglas li {
  display: grid;
  grid-template-columns: 1.4rem 1fr;
  padding: 0.35rem 0;
  border-top: 1px solid var(--niebla);
  font-size: 0.9375rem;
}

.signo {
  font-weight: 700;
}

.reglas .si .signo {
  color: var(--mar);
}

.reglas .pide .signo {
  color: var(--sello);
}

.reglas .no {
  color: var(--gris);
}

.reglas .no .texto {
  text-decoration: line-through;
}

.reglas small {
  display: block;
  color: var(--gris);
  font-size: 0.8125rem;
}

.fuerte-diagrama figcaption {
  max-width: 36ch;
  margin-top: 0.5rem;
  color: var(--gris);
  font-size: 0.875rem;
  text-align: center;
}

@media (min-width: 60rem) {
  .portada {
    gap: 4.5rem;
    padding-top: 5rem;
    padding-bottom: 6.5rem;
  }

  /* El diagrama va debajo del titular, alineado a la izquierda con el texto */
  .fuerte-diagrama {
    grid-template-columns: max-content minmax(0, 22rem) max-content;
    justify-content: start;
    align-items: center;
    column-gap: calc(var(--conector) * 2);
  }

  .lado {
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 0;
  }

  .lado li {
    line-height: 2.5rem;
  }

  .origen {
    text-align: right;
  }

  /* Cada elemento llega por un trazo corto a una línea común que entra por la puerta */
  .origen li::after,
  .destino li::before {
    content: "";
    position: absolute;
    top: 50%;
    width: var(--conector);
    border-top: 1px solid var(--gris);
  }

  .origen li::after {
    left: calc(100% + 0.6rem);
    width: calc(var(--conector) - 0.6rem);
  }

  .destino li::before {
    right: calc(100% + 0.6rem);
    width: calc(var(--conector) - 0.6rem);
  }

  .origen::after,
  .destino::after {
    content: "";
    position: absolute;
    top: 1.25rem;
    bottom: 1.25rem;
    border-left: 1px solid var(--gris);
  }

  .origen::after {
    right: calc(var(--conector) * -1);
  }

  .destino::after {
    left: calc(var(--conector) * -1);
  }

  .origen::before,
  .destino::before {
    top: 50%;
    bottom: auto;
    left: auto;
    width: var(--conector);
    height: 0;
    border-left: 0;
    border-top: 1px solid var(--gris);
  }

  .origen::before {
    right: calc(var(--conector) * -2);
  }

  .destino::before {
    left: calc(var(--conector) * -2);
  }

  .fuerte::before,
  .fuerte::after {
    top: calc(50% - 1.1rem);
    bottom: auto;
    width: 3px;
    height: 2.2rem;
  }

  .fuerte::before {
    left: -3px;
  }

  .fuerte::after {
    left: auto;
    right: -3px;
  }

  .fuerte-diagrama figcaption {
    grid-column: 1 / -1;
    justify-self: start;
    text-align: left;
  }
}

/* Un solo momento de movimiento: las puertas se abren al cargar */
@media (prefers-reduced-motion: no-preference) {
  .fuerte::before,
  .fuerte::after {
    animation: puerta 0.7s ease-out 0.3s both;
  }

  .reglas li {
    animation: aparece 0.4s ease-out both;
  }

  .reglas li:nth-child(1) { animation-delay: 0.6s; }
  .reglas li:nth-child(2) { animation-delay: 0.7s; }
  .reglas li:nth-child(3) { animation-delay: 0.8s; }
  .reglas li:nth-child(4) { animation-delay: 0.9s; }
}

@keyframes puerta {
  from {
    background: var(--tinta);
  }
}

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

/* Qué hace */
.puntos {
  display: grid;
  gap: 2.5rem;
  padding-top: 3.5rem;
  padding-bottom: 3.5rem;
  border-top: 1px solid var(--niebla);
}

@media (min-width: 48rem) {
  .puntos {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 3rem;
  }
}

.punto h3 {
  margin: 0 0 0.6rem;
  font-size: 1.1875rem;
  font-stretch: 112%;
  line-height: 1.25;
}

/* Un tramo de muro sobre cada punto, el mismo trazo del fuerte */
.punto h3::before {
  content: "";
  display: block;
  width: 2.2rem;
  margin-bottom: 1rem;
  border-top: 3px solid var(--tinta);
}

.punto p {
  max-width: 34ch;
  margin: 0;
  color: var(--gris);
}

/* Por qué el nombre */
.nombre {
  padding-top: 3.5rem;
  padding-bottom: 4.5rem;
  border-top: 1px solid var(--niebla);
}

.nombre h2 {
  margin: 0 0 0.75rem;
  font-size: 1.1875rem;
  font-stretch: 112%;
}

.nombre p {
  max-width: 60ch;
  margin: 0;
  font-size: 1.1875rem;
}

/* Pie */
.pie {
  padding: 2.5rem 0 3rem;
  background: var(--tinta);
  color: var(--niebla);
  font-size: 0.9375rem;
}

.pie a {
  color: var(--piedra);
}

.pie a:focus-visible {
  outline-color: var(--piedra);
}

.pie-grid {
  display: grid;
  gap: 1.25rem;
}

@media (min-width: 48rem) {
  .pie-grid {
    grid-template-columns: 2fr 1fr 1.4fr;
  }
}

.pie p {
  margin: 0;
}

.pie .derechos {
  margin: 2rem auto 0;
  color: var(--gris);
}

/* Páginas legales */
/* Mismo borde izquierdo que el encabezado; los párrafos limitan su propio largo de línea */
.legal {
  padding-top: 2.5rem;
  padding-bottom: 5rem;
}

.legal h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(2rem, 1.5rem + 2vw, 2.75rem);
  font-weight: 800;
  font-stretch: 125%;
  line-height: 1.1;
  letter-spacing: -0.015em;
}

.legal .fecha {
  margin: 0 0 2.5rem;
  color: var(--gris);
}

.legal h2 {
  margin: 2.5rem 0 0.75rem;
  font-size: 1.25rem;
  font-stretch: 112%;
  line-height: 1.3;
}

.legal h3 {
  margin: 1.5rem 0 0.5rem;
  font-size: 1.0625rem;
}

.legal p,
.legal li {
  max-width: 68ch;
}

.legal ul {
  padding-left: 1.25rem;
}

.legal li + li {
  margin-top: 0.4rem;
}
