/* ===========================================================================
   Homepage — the tour poster.

   One printed object, not three stacked sections: the name and the dates on
   the left, what is new down a column on the right, and the rest of the site
   as tear-off stubs along the foot. The point is that nothing on this page
   needs scrolling to: an organiser landing here sees who, when, what is new
   and where to go next in one screen.

   The whole poster sits on --scene in BOTH schemes, so it redefines the role
   tokens once on .home: the gig list, links and rules in theme.css read those
   variables and re-tint themselves without a single duplicated rule.

   Every rule is scoped under .home so nothing here leaks into content pages.
   =========================================================================== */

/* Material's content padding would inset the poster from the header.
   Targeted with :has() so no template override is needed just for a body
   class. */
.md-content__inner:has(.home) {
  margin-top: 0;
  margin-bottom: 0;
  padding-top: 0;
}

.md-content__inner:has(.home) > :first-child {
  margin-top: 0;
}

/* Material hides the first child's top margin with an ::before spacer. */
.md-content__inner:has(.home)::before {
  display: none;
}

/* --- The poster ---------------------------------------------------------- */

.home {
  /* Local role tokens: this block is always on the dark ground. */
  --ink: var(--chalk);
  --ink-soft: rgba(234, 242, 232, 0.68);
  /* 4.5:1 on --scene; the decorative --lighter below is never used for text. */
  --ink-faint: rgba(234, 242, 232, 0.55);
  --rule: rgba(234, 242, 232, 0.18);
  --edge: rgba(234, 242, 232, 0.4);
  --signal: var(--marigold);
  --link: var(--mint);
  --md-default-fg-color: var(--chalk);
  --md-default-fg-color--light: rgba(234, 242, 232, 0.68);
  --md-default-fg-color--lighter: rgba(234, 242, 232, 0.45);
  --md-default-fg-color--lightest: rgba(234, 242, 232, 0.08);
  --md-typeset-a-color: var(--mint);

  display: grid;
  grid-template-areas:
    "hero"
    "rail"
    "bill"
    "strip"
    "stubs";
  margin: 0;
  padding: 2.2rem 1.4rem 0;
  background: var(--scene);
  color: var(--chalk);
}

.home .hero {
  grid-area: hero;
  min-width: 0;
}

/* --- The name ------------------------------------------------------------ */

.md-typeset .home .hero__name {
  font-variation-settings: "wdth" 118;
  font-weight: 800;
  /* Capped lower than the type scale would allow: two lines of this at 4.6rem
     ate a third of the fold on their own. */
  font-size: clamp(2.2rem, 6vw, 3.1rem);
  line-height: 0.9;
  letter-spacing: -0.03em;
  text-transform: uppercase;
  color: var(--chalk);
  margin: 0 0 0.6rem;
}

.md-typeset .home .hero__role {
  max-width: 58ch;
  margin: 0 0 0.9rem;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--ink-soft);
}

.md-typeset .home .hero__badges,
.md-typeset .home .hero__social {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0 0 0.5rem;
  max-width: none;
}

.md-typeset .home .hero__badges img,
.md-typeset .home .hero__social img {
  display: block;
}

.md-typeset .home .hero__social {
  margin-bottom: 1.4rem;
}

/* A label carrying a rule across the column, used by the hero, the rail and
   the repo band so all three heads sit on one line. */
.md-typeset .home .hero__rule,
.md-typeset .home .rail__head,
.md-typeset .home .strip__head,
.md-typeset .home .bill__head {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin: 0 0 0.2rem;
  font-size: 1rem;
}

.md-typeset .home .hero__rule > span,
.md-typeset .home .rail__head > span,
.md-typeset .home .strip__head > span,
.md-typeset .home .bill__head > span {
  flex: 0 0 auto;
  font-variation-settings: "wdth" 92;
  font-weight: 650;
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--chalk);
}

.md-typeset .home .hero__rule::after,
.md-typeset .home .rail__head::after,
.md-typeset .home .strip__head::after,
.md-typeset .home .bill__head::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  background: var(--rule);
}

/* --- Next date ----------------------------------------------------------- */

.md-typeset .home .hero__next {
  margin: 0.9rem 0 0;
  padding: 0.6rem 0.85rem;
  background: rgba(240, 169, 43, 0.12);
  border-left: 2px solid var(--marigold);
}

.md-typeset .home .hero__next-label {
  display: block;
  font-variation-settings: "wdth" 92;
  font-weight: 650;
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--marigold);
}

.md-typeset .home .hero__next .gigs {
  margin-top: 0.2rem;
}

.md-typeset .home .hero__next .gig {
  border: none;
  padding: 0.2rem 0;
}

.md-typeset .home .hero__next .gig:last-child {
  border-bottom: none;
}

.md-typeset .home .hero__next--open {
  font-size: 0.8rem;
  color: var(--chalk);
}

/* The past dates run tighter here than on /talks/, where they are the page.
   The venue and the slides/replay links share one wrapped line instead of
   stacking, which is what lets three dates and the strip below them all land
   above the fold without dropping anything. */
.md-typeset .home .hero .gigs {
  margin-top: 0.8rem;
}

.md-typeset .home .hero .gigs > .gig {
  padding: 0.45rem 0;
}

.md-typeset .home .hero .gig__body {
  display: block;
}

.md-typeset .home .hero .gig__title {
  display: block;
  margin-bottom: 0.22rem;
  font-size: 0.84rem;
}

.md-typeset .home .hero .gig__meta,
.md-typeset .home .hero .gig__links {
  display: inline-flex;
  vertical-align: baseline;
}

.md-typeset .home .hero .gig__links {
  margin-left: 1.1rem;
}

/* --- All dates ----------------------------------------------------------- */

.md-typeset .home .hero__all {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.3rem 0.8rem;
  margin: 0.8rem 0 0;
  font-size: 0.78rem;
  font-weight: 650;
}

.md-typeset .home .hero__all-count {
  font-weight: 400;
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
  color: var(--ink-faint);
}

/* --- The news rail -------------------------------------------------------
   A column of print down the right edge: hairline rows, no cards, no
   shadows. Each item names its own kind on the meta line rather than wearing
   a label above it, so three rows read as one column instead of three
   headings. */

.home .rail {
  grid-area: rail;
  min-width: 0;
  margin-top: 2.4rem;
}

.md-typeset .home .rail__item {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
}

.md-typeset .home .rail__item:first-of-type {
  margin-top: 0.9rem;
  padding-top: 0;
  border-top: none;
}

.md-typeset .home .rail__thumb {
  position: relative;
  display: block;
  margin-bottom: 0.6rem;
  text-decoration: none;
  background: var(--scene-deep);
}

/* YouTube's hqdefault.jpg is 480x360 with the real 480x270 frame centred in
   it, so a 16/9 crop lands exactly on the frame and the black bars never
   reach the page. */
.md-typeset .home .rail__thumb img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.md-typeset .home .rail__play {
  position: absolute;
  inset: auto auto 0.55rem 0.55rem;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--marigold);
}

.md-typeset .home .rail__play::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 54%;
  transform: translate(-50%, -50%);
  border-style: solid;
  border-width: 0.34rem 0 0.34rem 0.55rem;
  border-color: transparent transparent transparent var(--scene);
}

.md-typeset .home .rail__title {
  margin: 0 0 0.3rem;
  font-variation-settings: "wdth" 104;
  font-weight: 700;
  font-size: 0.92rem;
  line-height: 1.25;
  letter-spacing: -0.005em;
}

.md-typeset .home .rail__title a {
  text-decoration: none;
  color: var(--chalk);
}

.md-typeset .home .rail__title a:hover,
.md-typeset .home .rail__title a:focus-visible {
  color: var(--link);
}

.md-typeset .home .rail__blurb {
  margin: 0 0 0.35rem;
  font-size: 0.7rem;
  line-height: 1.45;
  color: var(--ink-soft);
}

/* Spans with a flex gap, not glyph separators. */
.md-typeset .home .rail__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.12rem 0.7rem;
  margin: 0;
  font-size: 0.68rem;
  line-height: 1.45;
  color: var(--ink-faint);
}

.md-typeset .home .rail__kind {
  flex: 0 0 auto;
  font-variation-settings: "wdth" 88;
  font-weight: 650;
  letter-spacing: 0.04em;
  color: var(--signal);
}

/* --- The contact sheet ---------------------------------------------------
   Photos from the dates listed above, in the order they happened. A poster
   has one image; a tour has a wall of them, and these are the proof that the
   list in the hero is a list of rooms someone stood in.

   The frames keep their own proportions: a fixed height and an intrinsic
   width, so the two portrait shots stay portrait instead of being cropped to
   match the landscape ones. That is also why the hook emits width/height --
   the row would reflow as each file arrived otherwise.

   Scrolling is the native kind: a finger, a trackpad, or the arrow keys on
   the focused strip. The two step buttons on the head's rule are the same
   mechanism for a mouse, and they stay hidden until js/strip.js is running,
   so nothing on the page is a control that does nothing.

   Whitespace between the frames, like the repo band and unlike the hairline
   grid of the tear-off strip: three foot bands that all used rules would
   blur into one. */

.home .strip {
  grid-area: strip;
  min-width: 0;
  margin-top: 1.6rem;
  /* One number drives the whole band: every frame is this tall. Capped well
     below what the row could take, for the same reason the name in the hero
     is capped — the poster has four bands and the photos are not entitled to
     half the scroll. */
  --frame: clamp(9.5rem, 24vw, 13.5rem);
}

/* The step buttons and the counter ride the head's rule, like the repo
   total: `order` puts them past the ::after that draws the hairline. */
/* `display` here beats the browser's own [hidden] rule, so the markup's
   hidden attribute has to be honoured explicitly or the buttons would show
   to a visitor whose JavaScript never ran — the one case they cannot work. */
.md-typeset .home .strip__head .strip__nav[hidden] {
  display: none;
}

.md-typeset .home .strip__head .strip__nav {
  order: 1;
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 0.3rem;
}

.md-typeset .home .strip__step {
  display: grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: 1px solid var(--rule);
  background: none;
  color: var(--chalk);
  cursor: pointer;
  transition: border-color 140ms, color 140ms;
}

.md-typeset .home .strip__step::before {
  content: "";
  border-style: solid;
  border-width: 0.26rem 0.4rem 0.26rem 0;
  border-color: transparent currentcolor transparent transparent;
}

.md-typeset .home .strip__step[data-strip-step="1"]::before {
  border-width: 0.26rem 0 0.26rem 0.4rem;
  border-color: transparent transparent transparent currentcolor;
}

.md-typeset .home .strip__step:hover:not(:disabled),
.md-typeset .home .strip__step:focus-visible {
  border-color: var(--marigold);
  color: var(--marigold);
}

.md-typeset .home .strip__step:focus-visible {
  outline: 2px solid var(--marigold);
  outline-offset: 2px;
}

.md-typeset .home .strip__step:disabled {
  opacity: 0.3;
  cursor: default;
}

.md-typeset .home .strip__count {
  min-width: 3.2em;
  margin-left: 0.2rem;
  font-variation-settings: "wdth" 100;
  font-weight: 400;
  font-size: 0.68rem;
  letter-spacing: 0;
  text-transform: none;
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: var(--ink-faint);
}

/* --- The frames ---------------------------------------------------------- */

.md-typeset .home .strip__scroller {
  display: flex;
  gap: 0.75rem;
  margin: 0.85rem 0 0;
  padding-bottom: 0.5rem;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  scrollbar-color: var(--rule) transparent;
}

/* The strip is focusable so the arrow keys can drive it, which means it also
   has to show where the caret is. */
.md-typeset .home .strip__scroller:focus-visible {
  outline: 2px solid var(--marigold);
  outline-offset: 3px;
}

.md-typeset .home .strip__frame {
  flex: 0 0 auto;
  min-width: 0;
  max-width: 86vw;
  margin: 0;
  scroll-snap-align: start;
}

.md-typeset .home .strip__frame img {
  display: block;
  height: var(--frame);
  width: auto;
  max-width: 86vw;
  object-fit: cover;
  /* Dark photos would otherwise bleed into the poster's ground. */
  background: var(--scene-deep);
}

/* Material centres and italicises every figcaption, which is right for a
   figure sitting in a column of prose and wrong for a row of frames: the
   captions have to hang off the same left edge as the photo above them. */
.md-typeset .home .strip__cap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.05rem;
  margin: 0.45rem 0 0;
  max-width: 24ch;
  font-style: normal;
  text-align: left;
}

.md-typeset .home .strip__event {
  font-variation-settings: "wdth" 96;
  font-weight: 650;
  font-size: 0.74rem;
  line-height: 1.25;
  color: var(--chalk);
}

.md-typeset .home .strip__place {
  font-size: 0.66rem;
  line-height: 1.4;
  color: var(--ink-faint);
}

@media (prefers-reduced-motion: reduce) {
  .md-typeset .home .strip__step {
    transition: none;
  }
}

/* --- The repos ----------------------------------------------------------
   The merch table: on a tour poster the acts are on the bill and the records
   are listed at the foot, and these are the things someone can take home and
   run after the talk.

   The star count is the only bold element in the band, and it is the whole
   structure: no cards, no dividers, no boxes. It sits in marigold because
   that is what marigold is for here — the few things that need attention —
   and it is the one number on the page a stranger can read as adoption. The
   number is set at poster scale, the name and the one-liner stay at the same
   size as the news column so the two bands read as one printed object.

   Column whitespace separates the repos, unlike the strip below, which is a
   gridded block with hairline gaps. That is what keeps the two foot bands
   from blurring into each other. */

.home .bill {
  grid-area: bill;
  min-width: 0;
  margin-top: 1.6rem;
}

.md-typeset .home .bill__list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.3rem 2.2rem;
  margin: 0.85rem 0 0;
  padding: 0;
  max-width: none;
  list-style: none;
}

.md-typeset .home .bill__item {
  margin: 0;
  min-width: 0;
}

.md-typeset .home .bill__mark {
  display: inline-block;
  margin-left: 0.45em;
  font-size: 0.72em;
  font-weight: 600;
  vertical-align: 0.08em;
  color: var(--marigold);
  white-space: nowrap;
}

.md-typeset .home .bill__title {
  margin: 0 0 0.3rem;
  font-variation-settings: "wdth" 104;
  font-weight: 700;
  font-size: 0.92rem;
  line-height: 1.25;
  letter-spacing: -0.005em;
  overflow-wrap: break-word;
}

.md-typeset .home .bill__title a {
  text-decoration: none;
  color: var(--chalk);
}

.md-typeset .home .bill__title a:hover,
.md-typeset .home .bill__title a:focus-visible {
  color: var(--link);
}

.md-typeset .home .bill__blurb {
  margin: 0 0 0.35rem;
  max-width: 42ch;
  font-size: 0.7rem;
  line-height: 1.45;
  color: var(--ink-soft);
}

/* Spans with a flex gap, not glyph separators — same as .rail__meta. */
.md-typeset .home .bill__facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.12rem 0.7rem;
  margin: 0;
  font-size: 0.68rem;
  line-height: 1.45;
  color: var(--ink-faint);
}

/* The repo total, parked at the far end of the head's rule. `order` puts it
   after the rule: the ::after that draws the hairline counts as the last
   child, so without this the count would sit between the label and the rule. */
.md-typeset .home .bill__head .bill__count {
  order: 1;
  flex: 0 0 auto;
  font-variation-settings: "wdth" 100;
  font-weight: 400;
  font-size: 0.68rem;
  letter-spacing: 0;
  text-transform: none;
  font-variant-numeric: tabular-nums;
  color: var(--ink-faint);
}

/* --- The tear-off strip --------------------------------------------------
   The rest of the site, along the poster's foot. The perforation is the one
   piece of ornament on the page and it is doing a job: it says these are
   things to take away with you, unlike the dates above.

   The dividers are the 1px grid gap with the strip's own background showing
   through, so they stay exact however the row wraps. Six items divide evenly
   into 6, 3 and 2 columns, so a row is never left part-empty. */

.home .stubs {
  grid-area: stubs;
  margin-top: 1.4rem;
  padding-top: 1px;
  border-top: 1px dashed var(--rule);
}

.md-typeset .home .stubs__list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: 0;
  padding: 0;
  max-width: none;
  list-style: none;
  background: var(--rule);
}

.md-typeset .home .stubs__list li {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  margin: 0;
  padding: 0.6rem 0.8rem 0.7rem;
  background: var(--scene);
  transition: background-color 140ms;
}

.md-typeset .home .stubs__list li:hover,
.md-typeset .home .stubs__list li:focus-within {
  background: color-mix(in srgb, var(--chalk) 6%, var(--scene));
}

.md-typeset .home .stubs__list a {
  font-variation-settings: "wdth" 96;
  font-weight: 650;
  font-size: 0.8rem;
  line-height: 1.25;
  text-decoration: none;
  color: var(--chalk);
}

.md-typeset .home .stubs__list a:hover,
.md-typeset .home .stubs__list a:focus-visible {
  color: var(--link);
}

/* A colour shift alone is not enough to follow a caret across a dark poster,
   so every link in it also takes a marigold ring. Offset outwards, because
   several of these sit flush against a hairline or a thumbnail edge. */
.md-typeset .home a:focus-visible {
  outline: 2px solid var(--marigold);
  outline-offset: 2px;
}

.md-typeset .home .stubs__pic {
  margin-right: 0.35rem;
  font-size: 0.92em;
}

.md-typeset .home .stubs__list span:not(.stubs__pic) {
  font-size: 0.66rem;
  font-weight: 400;
  line-height: 1.4;
  color: var(--ink-faint);
}

/* --- The one motion moment ----------------------------------------------
   The name settles into its full width once, on load. Nothing else animates
   without a person asking for it. */

@media (prefers-reduced-motion: no-preference) {
  .md-typeset .home .hero__name {
    animation: hero-settle 520ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
  }

  @keyframes hero-settle {
    from {
      font-variation-settings: "wdth" 94;
      opacity: 0;
    }

    to {
      font-variation-settings: "wdth" 118;
      opacity: 1;
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  .md-typeset .home .stubs__list li {
    transition: none;
  }
}

/* --- Three stubs a row --------------------------------------------------- */

@media screen and (min-width: 34em) {
  .md-typeset .home .stubs__list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  /* Two repos a row: the one-liners need more measure than a stub's label, so
     the band splits later than the strip does. */
  .md-typeset .home .bill__list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* --- Two columns ---------------------------------------------------------
   The rail moves alongside the hero and the strip spans both. The rail's left
   hairline runs the full height of the row, because a grid item stretches. */

@media screen and (min-width: 66em) {
  .home {
    grid-template-columns: minmax(0, 1fr) 20rem;
    grid-template-areas:
      "hero rail"
      "bill bill"
      "strip strip"
      "stubs stubs";
    column-gap: 2.2rem;
    padding: 1.6rem 2.2rem 0;
  }

  /* The band spans the poster, so it can run the repos in one row across
     both columns above it. */
  .md-typeset .home .bill__list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .home .bill {
    margin-top: 1.4rem;
  }

  .home .strip {
    margin-top: 1.5rem;
  }

  .home .rail {
    margin-top: 0;
    padding-left: 2.4rem;
    border-left: 1px solid var(--rule);
  }

  .md-typeset .home .stubs__list {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

@media screen and (min-width: 82em) {
  .home {
    grid-template-columns: minmax(0, 1fr) 22rem;
  }
}
