/*
 * The home page (docs/home2.md; templates/home.html, home2.html, js/home2.js), the site's front page since
 * Dec 2, 2026. Phone first: one column; two from 700 px, three from 1040 px. The story colours are the
 * room's (--b0 .. --b7 in site.css).
 */

.h2-top, .h2-groups, .h2-cards { max-width: 1080px; margin-left: auto; margin-right: auto; padding-left: var(--gutter); padding-right: var(--gutter); }

/* ---------- the slogan and its one quiet line ---------- */
.h2-top { padding-top: 20px; padding-bottom: 12px; }
.h2-line { margin-top: 6px; color: var(--muted); font-size: 15.5px; line-height: 1.45; text-wrap: pretty; }
.h2-line strong { color: var(--text); font-weight: 650; }
.h2-play-slot[hidden] { display: none; }

/* ---------- the chips (as the old home's: one row, a second tap goes back to All) ---------- */
.h2-groups { display: flex; gap: 8px; padding-top: 2px; padding-bottom: 6px; overflow-x: auto; scrollbar-width: none; }
.h2-groups::-webkit-scrollbar { display: none; }
@media (max-width: 600px) { .h2-groups:not(.at-end) { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 44px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 44px), transparent); } }
.h2-groups button {
  flex: none; min-height: 44px; padding: 6px 14px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
  color: var(--muted); font-size: 14px;
}
.h2-groups button:hover { color: var(--text); }
.h2-groups .swatch { margin-right: 7px; transform: translateY(-1px); }
.h2-groups button[aria-pressed="true"] .swatch { box-shadow: 0 0 0 1.5px var(--surface); }
.h2-groups button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent); color: var(--on-accent); font-weight: 600; }
/* without scripts the chips cannot filter: they are not shown */
:root:not(.h2-js) .h2-groups { display: none; }

/* ---------- the cards ---------- */
.h2-cards { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; padding-top: 10px; padding-bottom: 30px; }
@media (min-width: 700px) { .h2-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; } }
@media (min-width: 1040px) { .h2-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.h2-card {
  position: relative; min-width: 0; min-height: 44px;
  display: flex; flex-direction: column;
  padding: 16px 18px 14px;
  border: 1px solid var(--border); border-radius: 16px; background: var(--surface);
}
.h2-card[hidden] { display: none; }
.h2-card:hover { border-color: var(--accent); }
.h2-card:focus-within { border-color: var(--accent); }

/* the picture in the corner beside the name, as the old cards had it */
.h2-art { position: absolute; top: 14px; right: 16px; width: min(40%, calc(48px * var(--art))); height: 48px; }
.h2-card.has-art .h2-name { padding-right: calc(min(40%, 48px * var(--art)) + 18px); }
.h2-cards.lazy .h2-card:not(.shown) .h2-art { visibility: hidden; }

/* the name: the card's one link; its ::after covers the card, so a tap anywhere else on it opens the room */
.h2-name { position: static; min-height: 44px; display: flex; align-items: center; font-size: 21px; line-height: 1.2; font-weight: 620; }
.h2-link { color: var(--text); text-decoration: none; }
.h2-link::after { content: ""; position: absolute; inset: 0; border-radius: 16px; }
.h2-link:focus-visible { outline: none; }
.h2-card:has(.h2-link:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

/* this week's headline */
.h2-head { margin-top: 4px; color: var(--soft); font-size: 16px; line-height: 1.4; text-wrap: pretty; }

/* the two stories: the room's pills, in its colours; each a link above the card's own */
.h2-pills { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; column-gap: 8px; }
.h2-pills li { min-width: 0; max-width: 100%; }
.h2-pill {
  position: relative; z-index: 1;
  display: flex; align-items: center; min-height: 44px; max-width: 100%;
  color: var(--c); text-decoration: none;
}
.h2-pill-in {
  display: inline-flex; align-items: center; gap: 6px; min-width: 0; max-width: 100%;
  height: 32px; padding: 0 13px;
  border: 1px solid color-mix(in srgb, var(--c) 45%, transparent); border-radius: 999px;
  background: var(--bg); font-weight: 600; font-size: 14.5px; line-height: 1;
}
.h2-pill-name { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.h2-pill:hover .h2-pill-in { border-color: var(--c); }
.h2-pill:focus-visible { outline: none; }
.h2-pill:focus-visible .h2-pill-in { outline: 2px solid var(--c); outline-offset: 2px; }

/* the still: the last four weeks, for recognition; not a tap target, not read out */
.h2-still { display: block; width: 100%; height: 26px; margin-top: 8px; pointer-events: none; overflow: visible; }
.h2-still * { vector-effect: non-scaling-stroke; fill: none; stroke-linecap: round; }
.h2-still .h2-still-main { fill: var(--line); stroke: none; opacity: .5; }   /* the stories come forward, the line steps back (calm=5's way) */
.h2-still .h2-quiet { opacity: .28; stroke-width: 1px; stroke-dasharray: 1 3; }
.h2-still .h2-stem { opacity: .6; stroke-width: 1px; }
.h2-s0 { stroke: var(--b0); } .h2-s1 { stroke: var(--b1); } .h2-s2 { stroke: var(--b2); } .h2-s3 { stroke: var(--b3); }
.h2-s4 { stroke: var(--b4); } .h2-s5 { stroke: var(--b5); } .h2-s6 { stroke: var(--b6); } .h2-s7 { stroke: var(--b7); }
:root[data-theme="dark"] .h2-still { opacity: .85; }

/* ---------- unread: the room's one mark, a small filled dot and the name a step bolder ---------- */
.h2-dot { display: none; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--text); }   /* the page's ink: green is the chips' (follow-up 11) */
.h2-name .h2-dot { margin-right: 8px; }
.h2-card.is-unread .h2-name .h2-dot { display: inline-block; }
.h2-card.is-unread .h2-name { font-weight: 760; }
.h2-pill .h2-dot { background: var(--c); width: 7px; height: 7px; }
.h2-pill.is-unread .h2-dot { display: inline-block; }
.h2-pill.is-unread .h2-pill-in { font-weight: 720; }
.h2-unread-word { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.h2-link .h2-topic { min-width: 0; }
.h2-link { display: inline-flex; align-items: center; min-height: 44px; }

/* a returning reader: the line between the cards with something new and the rest */
.h2-quiet-line { grid-column: 1 / -1; margin: 10px 0 0; color: var(--muted); font-size: 14.5px; }
.h2-quiet-line[hidden] { display: none; }

@media (prefers-reduced-motion: reduce) { .h2-cards.lazy .h2-card:not(.shown) .h2-art { visibility: visible; } }
@media (max-width: 600px) {
  .h2-name { font-size: 20px; }
  .h2-head { font-size: 15.5px; }
}
