html { scroll-behavior: smooth; }
.home-page #contenido { width: 100%; }
.home-page {
  --case-list-padding: clamp(1.7rem, 3.5vw, 3rem);
  --home-content-width: 65rem;
  --home-gutter: 1.25rem;
}
#misterios, .home-rules {
  width: min(100% - 2 * var(--home-gutter), var(--home-content-width));
  margin-inline: auto;
}
#misterios { position: relative; }
.home-hero {
  position: relative;
  isolation: isolate;
  display: grid;
  align-items: center;
  min-height: 22rem;
  padding-block: clamp(2rem, 4vw, 4rem);
  padding-inline: max(var(--home-gutter), calc((100% - var(--home-content-width)) / 2));
  background: linear-gradient(180deg, #edf6ff, #fff);
}
.hero-copy { position: relative; z-index: 1; width: min(100%, 42rem); min-width: 0; container-type: inline-size; }
/* El título va en una línea y se ajusta al ancho de su bloque (unas 9,8 em), sin invadir el margen. */
.hero-copy h1 { font-size: clamp(1.25rem, 8vw, 4rem); font-size: min(4rem, 10cqi); line-height: 1.05; margin-bottom: .65rem; white-space: nowrap; }
/* «Cas pratiques d’informatique» mide unas 13,3 em: en francés el tamaño se limita al ancho de la pantalla
   para que no se corte en móvil; en escritorio sigue a 4rem y puede ocupar el espacio libre de la derecha. */
.hero-copy h1:lang(fr) { font-size: min(4rem, (100vw - 2 * var(--home-gutter)) / 13.4); }
.hero-copy .hero-logo { display: inline-block; width: .82em; height: .72em; margin-right: .22em; vertical-align: -.02em; color: var(--blue); }
.hero-copy p { font-size: clamp(1rem, 1.6vw, 1.25rem); }
.hero-copy .hero-subtitle { font-size: clamp(1.2rem, 2.2vw, 1.75rem); font-weight: 750; line-height: 1.2; text-wrap: balance; }
.hero-circuit {
  position: absolute;
  inset: 0 0 auto auto;
  width: 78%;
  height: calc(100% + var(--case-list-padding) + 3rem);
  pointer-events: none;
  background: radial-gradient(ellipse at 70% 35%, #e6f2fe, #f7fbff 75%);
  mask-image: linear-gradient(90deg, transparent, #000 44%), linear-gradient(0deg, transparent, #000 16%);
  mask-composite: intersect;
}
.data-point { opacity: .8; }
.data-point-west { --from-x: -30px; --from-y: 19px; }
.data-point-center { --from-x: -20px; --from-y: 15px; }
.data-point-east { --from-x: -24px; --from-y: 17px; }
.data-connections { opacity: .58; }
@media (prefers-reduced-motion: no-preference) {
  .data-point { animation: gather-data 22s ease-in-out infinite; }
  .data-connections path { stroke-dasharray: 1; animation: reveal-network 22s ease-in-out infinite; }
}
@keyframes gather-data {
  0%, 100% { opacity: 0; transform: translate(var(--from-x), var(--from-y)); }
  20% { opacity: .65; }
  44%, 80% { opacity: .8; transform: translate(0, 0); }
}
@keyframes reveal-network {
  0%, 36%, 100% { opacity: 0; stroke-dashoffset: 1; }
  68%, 84% { opacity: 1; stroke-dashoffset: 0; }
  95% { opacity: 0; stroke-dashoffset: 0; }
}
#misterios { padding-block: var(--case-list-padding); scroll-margin-top: 1rem; }
.home-rules {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2.2fr);
  align-items: start;
  gap: 1rem clamp(1.5rem, 4vw, 3.5rem);
  padding-block: clamp(1.5rem, 4vw, 3rem) 1rem;
  border-top: 1px solid var(--line);
}
.home-rules h2 {
  margin: 0;
  font-size: clamp(1.45rem, 2.5vw, 2rem);
  line-height: 1.15;
  text-wrap: balance;
}
.home-rules-body p { max-width: 70ch; line-height: 1.65; }
.home-rules-body p:last-child { margin-bottom: 0; }
@media (max-width: 48rem) {
  .home-rules { grid-template-columns: minmax(0, 1fr); }
}
.cards {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(1.75rem, 3.5vw, 3.0625rem) clamp(1.5rem, 3vw, 2.75rem);
  margin-top: 0;
}
.card {
  --card-folder-blue: #f3f8fe;
  --card-folder-edge: #7eb3e4;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  overflow: visible;
  border: 0;
  border-radius: .55rem .7rem .7rem .7rem;
}
.card:hover { color: var(--navy); }
.card:focus-visible {
  --card-folder-blue: #d5eaff;
  --card-folder-edge: #7eb3e4;
  outline-color: var(--blue);
}
.card-folder {
  flex: 1;
  align-self: stretch;
  overflow: hidden;
  padding: clamp(.45rem, 1vw, .7rem);
  border: 1px solid var(--card-folder-edge);
  border-radius: 0 .7rem .7rem .7rem;
  background: var(--card-folder-blue);
}
.card-image-frame { display: flow-root; overflow: hidden; margin-inline: 4px; border-radius: .45rem; }
.card-image { width: 90%; margin-inline: auto; aspect-ratio: 12 / 11; object-fit: contain; }
.card-copy { padding: .8rem .35rem .4rem; text-align: left; }
.card-number {
  position: relative;
  margin-bottom: -1px;
  padding: .45rem .95rem .4rem;
  border: 1px solid var(--card-folder-edge);
  border-bottom: 0;
  border-radius: .55rem 1.1rem 0 0;
  background: var(--card-folder-blue);
  color: #074b9a;
  font-size: .8rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.card h3 {
  padding: 0;
  font-size: clamp(1.25rem, 1.8vw, 1.55rem);
  font-weight: 400;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
@media (hover: hover) {
  .cards > li:hover .card {
    --card-folder-blue: #e5f2ff;
    --card-folder-edge: #c6dff5;
  }
  .cards > li:hover .card-folder {
    box-shadow: 0 6px 14px #0a204c20;
  }
  .cards > li:hover .card-number { color: var(--navy); }
}
@media (prefers-reduced-motion: no-preference) {
  .card { transition: transform .2s ease; }
  .card-folder, .card-number {
    transition: background-color .2s ease, border-color .2s ease, box-shadow .2s ease;
  }
  @media (hover: hover) {
    .cards > li:hover .card { transform: translateY(-4px); }
  }
}
@media (max-width: 1023px) {
  .home-page { --home-content-width: 44rem; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 559px) {
  .home-page { --home-content-width: 20rem; }
  .cards { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 740px) {
  .home-hero { min-height: 17rem; }
  .hero-circuit {
    width: 100%;
    opacity: .65;
    mask-image: linear-gradient(90deg, transparent, #000 75%), linear-gradient(0deg, transparent, #000 18%);
  }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
/* Etiquetas de categoría: discretas, del mismo estilo para todas y subordinadas al título. */
/* Las etiquetas se alinean al pie de la carpeta aunque los títulos ocupen distinto número de líneas. */
.card-folder { display: flex; flex-direction: column; }
.card-copy { flex: 1; display: flex; flex-direction: column; }
.card-tags { display: flex; flex-wrap: wrap; gap: .35rem; margin: auto 0 0; padding-top: .65rem; }
.card-tag {
  padding: .1rem .55rem;
  border: 1px solid var(--card-folder-edge);
  border-radius: 999px;
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.5;
}
