/* the homepage: the legend that filters it, the grid of cards, and the look picker. what each
   look does with the cards is in css/looks/, one file per look */

/* the legend: a tag per stage, pressed to show only those */

.legend {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  /* wrapped rows sit as centred clusters, not spread across the box */
  justify-content: center;
  gap: var(--s3) var(--s5);
  padding: var(--s4);
  margin-bottom: var(--s4);
  background: var(--paper);
  font-family: var(--hand);
  font-size: var(--h-s);
  line-height: 1.2;
  color: var(--dim);
}

.legend .pairing {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
}

.legend .pairing:hover { text-shadow: var(--glow); }

.legend .selected { color: var(--ink); }

.legend.filtering .pairing:not(.selected) { opacity: 0.5; }

/* phones: one row that scrolls sideways. the boiling edge can't follow a scrolled box, so it wears
   a plain one. its sides are paper fading in, stuck to the box's ends, so tags scroll under a fade
   rather than being cut off at the border; they stand in for the side padding, so at rest they
   cover nothing */
@media (max-width: 700px) {
  .legend {
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
    padding: var(--s3) 0;
    border: var(--edge);
  }
  .legend::-webkit-scrollbar { display: none; }
  .legend > :not(.edge) { flex: none; }
  .legend > .edge { display: none; }

  .legend::before,
  .legend::after {
    content: "";
    position: sticky;
    z-index: 1;
    flex: none;
    align-self: stretch;
    width: var(--s4);
    pointer-events: none;
  }

  .legend::before {
    left: 0;
    margin-right: calc(-1 * var(--s4));
    background: linear-gradient(to right, var(--paper), transparent);
  }

  .legend::after {
    right: 0;
    margin-left: calc(-1 * var(--s4));
    background: linear-gradient(to left, var(--paper), transparent);
  }
}

/* the grid: js/home.js places the cards for the wall's masonry; the other looks set them in a column */

.grid {
  position: relative;
  width: 100%;
}

.grid-item { position: absolute; }

/* a card: the squares sit tight on the title, everything after it gets a little more air */

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--s3);
  padding: var(--s4);
  background: var(--paper);
}

.card:hover .edge { border-color: var(--pale); }

.name {
  font-family: var(--hand);
  font-size: var(--h-m);
  line-height: 1.15;
}

.card img {
  display: block;
  width: 100%;
  height: auto;
}

/* a post's opening lines, faded out at the foot */
.excerpt {
  position: relative;
  max-height: calc(1.6em * 7);
  overflow: hidden;
  font-size: var(--small);
  line-height: 1.6;
  color: var(--text);
}

.excerpt::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2.4em;
  background: linear-gradient(transparent, var(--paper));
}

/* the note's lines, a little apart like paragraphs */
.excerpt .line { display: block; }
.excerpt .line + .line { margin-top: 0.6em; }

/* a dashed rule between one box of the post and the next */
.excerpt p + p {
  margin-top: var(--s2);
  padding-top: var(--s2);
  border-top: 1px dashed var(--faint);
}

.card img + .excerpt { max-height: calc(1.6em * 3); }

/* a bit's line in the index is its words, not a title; a picture says so in dim ink */
.name.bit-name { font-family: var(--sans); font-size: var(--small); }
.name.bit-name.picture { color: var(--dim); }
.card .name img.thumb { display: inline-block; vertical-align: middle; width: auto; height: 1lh; max-width: none; }

/* a bit is all there is of it, so none of it is cut short */
.card .excerpt.bit-text { max-height: none; }
.card .excerpt.bit-text::after { content: none; }

/* when it was observed, in a line: the wall's foot, the reader's on a phone */
.meta {
  font-size: var(--note);
  line-height: 1.4;
  color: var(--dim);
}

/* the look picker, a dock centred at the bottom: every look side by side, the current one inked.
   it blends by exclusion, a softer difference: over paper it reads as a pale grey box with dark
   drawings, and whatever passes under it shows through faintly inside out. the colours here are
   what they become over white, flipped */

.switches {
  /* the dock's own greys, which exclusion turns into the pale box, its rules and its drawings */
  --dock: #141414;
  --dock-rule: #3d3d3d;
  --dock-ink: #898989;
  --dock-on: #eee;

  position: fixed;
  left: 50%;
  bottom: var(--s4);
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  padding: var(--s2) 0;
  --edge: 1px dashed var(--dock-rule);
  background: var(--dock);
  color: var(--dock-ink);
  mix-blend-mode: exclusion;
}

/* each look its own cell, a dashed rule between one and the next */
/* a phone has only the wall (js/head.js) */
@media (max-width: 700px) {
  .switches { display: none; }
}

.switches button { display: block; padding: 0 var(--s4); color: inherit; }
.switches button + button { border-left: var(--edge); }
.switches button:is(:hover, [aria-pressed="true"]) { color: var(--dock-on); }

/* the little drawings of each look, here and in the index's head */
.glyph {
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.2;
}
