/* Home page map: the mapa page's idea on the home page's background: ejes on the left and, on the right,
   the films, the corpus or the publications (tabs), joined by splines. Loaded after style.css and menu.css.
   (The prototype's home-mapa.html is an earlier version of this page.) */

/* the page is taller than the screen: keep the home background as it looks in one screen */
body { background-attachment: fixed; }

.hm {
  position: relative;
  display: grid;
  grid-template-columns: 30% 1fr;
  column-gap: var(--l-2);   /* two lines of air between the sections and the stack */
  grid-template-rows: auto 1fr;
  font-family: var(--font-mono);
  font-size-adjust: var(--font-size-adjust);
}

/* title: same type as the inner pages' h1 (article.css), as wide as the stack of sections below it */
.hm .title {
  grid-column: 1;         /* as wide as the stack of sections */
  grid-row: 1;
  margin: 0 0 var(--l-1);
  font-family: var(--font-titulo);
  font-size-adjust: var(--ajuste-titulo);
  font-weight: var(--fw-titulo);
  letter-spacing: var(--ls-titulo);
  font-size: var(--fs-h1);
  line-height: var(--lh-h1);
  text-wrap: balance;
}

.hm-edges { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

/* ejes: boxes all the same size (as wide as the column, as tall as the tallest), kept in view while the list scrolls */
.hm-ejes {
  grid-column: 1;
  grid-row: 2;
  align-self: start;
  position: sticky;
  top: 96px;
  display: grid;
  grid-auto-rows: 1fr;
  gap: 24px;
  z-index: 1;
}

/* like the mapa page's tags (.map2-tag), on an 85% white background (legible over any of the home stills) */
.hm-eje {
  display: flex;
  align-items: center;
  padding: 14px 20px;
  border: 1px solid #fff;
  background: rgba(255, 255, 255, .85);
  color: var(--c-tinta-suave);
  font-size: 13.5px; /* as large as the items' */
  font-weight: 500;
  line-height: 22px;
  text-decoration: none;
  transition: background-color .25s, border-color .25s, color .25s, opacity .25s;
}

/* right-hand side: the stack of lists (films, corpus or publications), as wide as what is left of the
   page, so it can run past the bottom of the screen without wasting horizontal space */
.hm-side {
  grid-column: 2;
  grid-row: 1 / 3;   /* the stack runs to the container's right edge */
  position: relative;
  z-index: 1;
}

/* tabs, centred over the list (as in production): the selected one and the hovered one at full
   opacity, the rest at 60% */
.hm-tabs {
  margin-bottom: 16px;
  color: #fff;
  font-size: var(--fs-chico);
  font-weight: 400;
  text-align: right;   /* the selector lines up with the stack's right edge */
  line-height: var(--lh-chico);
  letter-spacing: var(--ls-etiqueta);
  text-transform: uppercase;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .45);
}

.hm-tab {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  opacity: .6;
  transition: opacity .25s;
}

.hm-tab.active, .hm-tab:hover { opacity: 1; }

.hm-tab-sep { margin: 0 .5em; opacity: .6; }

/* one stack at a time, plain: the tab swaps which one is in the box. The stacks stay hidden until the
   webfont is in, so the chips don't change height in front of you while it loads */
.hm-lists { position: relative; transition: opacity .25s; }

.hm.cargando .hm-lists { opacity: 0; }

.hm-list {
  position: relative;
  display: grid;
  grid-template-columns: var(--ancho-fichas, max-content); /* as wide as the widest film, set in js */
  justify-content: end;               /* the stack sits flush right */
  align-content: start;
  max-width: 100%;
}

.hm-list[data-list="corpus"] .hm-item,
.hm-list[data-list="publicaciones"] .hm-item { display: block; white-space: normal; }

/* one box per item (title in bold, then two lines of details), 5px apart. Each list keeps its own
   colour, one of the palette's accents darkened until white text clears AA (js/banda.js). */
.hm-item {
  max-width: 100%;
  padding: 6px 16px;
  border: 0;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  font-size: 13.5px;
  line-height: 19px;
  font-weight: 400;
  text-decoration: none;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .25);
  transition: opacity .18s, border-color .18s, background-color .18s, transform .2s cubic-bezier(.2, .7, .2, 1);
}

/* each list carries its own colour, flat: the boxes are told apart by the space between them */
.hm-list[data-list="peliculas"] .hm-item { background: var(--color-peliculas, rgba(0, 0, 0, .55)); }

.hm-list[data-list="corpus"] .hm-item { background: var(--color-corpus, rgba(0, 0, 0, .55)); }

.hm-list[data-list="publicaciones"] .hm-item { background: var(--color-escritos, rgba(0, 0, 0, .55)); }

.hm-item + .hm-item { margin-top: 5px; }

/* wide screens: one line per chip, the kinds of information told apart by style — the title in
   italic, a middot, then director and year/country at 80% size */
@media (min-width: 992px) {
  .hm-item {
    display: flex;
    align-items: baseline;
    white-space: nowrap;
    overflow: hidden;
  }

  .hm-item strong { display: inline; flex: none; }

  .hm-item-meta { display: inline; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  .hm-item-meta::before { content: "·"; margin: 0 .6em; opacity: .7; }

  .hm-item-anio::before { content: "·"; margin: 0 .6em; opacity: .7; }
}

/* hover keeps each chip's own ink: the light section boxes stay with dark text, the coloured
   film/text boxes with white (the old `color: #fff` on both put white text on the pale boxes) */
a.hm-item:hover { color: #fff; }

/* unselected boxes only: on the active one the hover must not repaint the text dark over the accent */
a.hm-eje:not(.selected):hover { color: var(--c-tinta-suave); }

.hm-item strong { display: block; font-weight: 400; font-style: italic; }

/* details at 80% */
.hm-item-meta { display: block; font-size: .8em; line-height: 16px; }

.hm-edges path {
  fill: none;
  stroke: #fff;
  stroke-opacity: .8;    /* the curves have to read over the still */
  stroke-width: 1.2px;
  transition: stroke-opacity .25s, opacity .25s;
}

/* an activated chip: it, its edges and its neighbours stay lit, the rest fades (as on the mapa page) */
.hm.focused .hm-eje, .hm.focused .hm-item, .hm.focused .hm-edges path { opacity: .15; }

/* the lit ones keep the weight and the white they had before the click: the selector has to out-rank
   the fade rule above, which names .hm-edges path and so would otherwise win on specificity */
.hm.focused .on,
.hm.focused .hm-edges path.on { opacity: 1; }

/* a chip related to the active one: outlined, not filled */
.hm-eje.on { border-color: var(--color-acento); box-shadow: inset 0 0 0 1px var(--color-acento); }

/* only the clicked chip is filled, and only it carries the arrow */
.hm-eje.selected { background: var(--color-acento); border-color: var(--color-acento); color: #fff; box-shadow: none; }

/* a lit item draws above its neighbours */
.hm-item.on { position: relative; z-index: 1; }

.hm-item.selected { filter: brightness(.82); }

/* the active chip stays marked — the arrow says a second click follows its link */
.hm-eje, .hm-item { position: relative; }
.hm-eje::after, .hm-item::after {
  content: "→";
  position: absolute;
  right: 9px;
  top: 50%;
  transform: translateY(-50%);
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.hm-eje.selected::after, .hm-item.selected::after { opacity: 1; }
.hm-eje.selected, .hm-item.selected { padding-right: 28px; }

@media (max-width: 991.98px) {
  .hm { grid-template-columns: 40% 1fr; }

  .hm .title { grid-column: 1 / -1; }

  .hm-ejes { grid-row: 2; position: static; }

  .hm-side { grid-column: 2; grid-row: 2; margin-right: 0; }

  .hm-item { font-size: 11px; line-height: 15px; }

  .hm-item-anio { display: block; }

  .hm-item-meta { line-height: 13px; }

  .hm-eje { font-size: 11px; line-height: 17px; padding: 10px 12px; }
}
