/* Learn & play: the intro and four sections share one spread, with the four-beat bar pinned beside them. Read top to bottom. */

/* Each section is a small grid of its own; on phones it is one column with a slim count row at its top. */
.Guide-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 1.25rem var(--space-between-columns);
  scroll-margin-block-start: 1rem;
}
.Guide-section:not(.Intro) { padding-block-start: clamp(1.5rem, 5vh, 3.5rem); }
.Guide-section > .Heading { max-inline-size: 100%; }
/* The opening crop is 4:3 on phones; on the wide spread it is shortened (see below) so the picture ends with the words beside it. */
.Intro .Photo-frame { aspect-ratio: 4 / 3; }

/* The slim four-key row that opens each section on phones. */
.Guide-row { --size-of-a-beat: 1.125rem; justify-self: start; }

/* The pinned bar's own solid ground, cut with the one stepped shoulder. */
.Guide-bar, .Guide-note {
  position: relative;
  isolation: isolate;
  color: var(--colour-of-the-pale-ink);
}
.Guide-bar::before, .Guide-note::before {
  --depth-of-the-step: 1.25rem;
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--colour-of-the-deep-slate);
  clip-path: polygon(0 0, calc(100% - var(--depth-of-the-step)) 0, calc(100% - var(--depth-of-the-step)) var(--depth-of-the-step), 100% var(--depth-of-the-step), 100% 100%, 0 100%);
}
.Guide-bar { display: none; padding: 1.25rem 1.5rem 1.5rem; }

/* The panel's own heading carries the ochre bar, so the bar sits under a heading and nowhere else. */
.Guide-title {
  margin: 0 0 1.25rem;
  padding-block-end: calc(var(--thickness-of-the-bar) + var(--space-above-the-bar));
  background: linear-gradient(var(--colour-of-the-ochre), var(--colour-of-the-ochre)) no-repeat 0 100% / 100% var(--thickness-of-the-bar);
  font-size: var(--size-of-small-type);
  font-weight: 500;
  font-variation-settings: "wght" 500;
}

/* The vertical count: keys and labels flush with the panel's own left edge, one line each, no list indent and no bar of its own. */
.Guide-count {
  --size-of-a-beat: 1.75rem;
  --colour-behind-the-count: var(--colour-of-the-deep-slate);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1rem;
  margin: 0;
  padding: 0;
  border-block-end: 0;
  list-style: none;
}
.Guide-beat { display: flex; align-items: center; gap: 1rem; }
.Guide-beat .Count-beat { flex: none; }
.Guide-label {
  padding-block: 0.5rem;
  line-height: 1.25;
  opacity: 0.7;
  text-decoration: none;
  transition: opacity 300ms var(--ease-with-weight);
}
.Guide-label:hover { text-decoration: underline; text-decoration-color: var(--colour-of-the-ochre); text-decoration-thickness: 0.1875rem; }
.Guide-beat[data-state="lit"] .Guide-label { opacity: 1; font-weight: 500; font-variation-settings: "wght" 500; }
.Guide-optional { display: block; font-size: 0.9rem; font-weight: 400; font-variation-settings: "wght" 400; }

/* Section furnishings. A side column's heading starts on the same top line as the story beside it. */
.Guide-bring h3, .Guide-compare h3 { margin-block-start: 0; }
.Guide-bring .Beats { margin-block-start: 0.75rem; }

/* The two formats set as terms: a stepped key, the term in Geologica Medium, the sentence under it, kept on a hanging line. */
.Guide-compare { margin-block-start: 0; }
.Guide-terms {
  --depth-of-the-step: 0.3125rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  margin-block-start: 1rem;
}
.Guide-terms dt {
  display: grid;
  grid-template-columns: 1rem minmax(0, 1fr);
  align-items: center;
  column-gap: 0.75rem;
  margin-block-start: 1.625rem;
  font-size: var(--size-of-running-type);
  font-weight: 500;
  font-variation-settings: "wght" 500;
  line-height: 1.3;
}
.Guide-terms dt:first-of-type { margin-block-start: 0; }
.Guide-terms dt::before {
  content: "";
  inline-size: 1rem;
  block-size: 1rem;
  background: var(--colour-of-the-ochre);
  clip-path: polygon(0 0, calc(100% - var(--depth-of-the-step)) 0, calc(100% - var(--depth-of-the-step)) var(--depth-of-the-step), 100% var(--depth-of-the-step), 100% 100%, 0 100%);
}
.Guide-terms dd {
  margin: 0.25rem 0 0;
  padding-inline-start: 1.75rem;
  line-height: 1.5;
}

.Guide-wide .Photo-frame { aspect-ratio: 16 / 9; }
.Guide-note { padding: 1.5rem 1.75rem; font-size: var(--size-of-running-type); }
.Guide-note strong { font-weight: 500; font-variation-settings: "wght" 500; }

/* The closing row: the two secondary tabs stand in deep slate with pale ink, so only the call key is ochre and none reads as a blank panel. */
.Onward .Key[data-state="released"] {
  --colour-of-the-key: var(--colour-of-the-deep-slate);
  color: var(--colour-of-the-pale-ink);
}

/* The pinned call key on phones: an opaque ground of its own on the element itself, so the page's text passes beneath it; the ochre key still shows its stepped shoulder against the deep slate. Kept small. */
@media (max-width: 47.99em) {
  .Learn-guide .Dial {
    background-color: var(--colour-of-the-deep-slate);
    font-size: 0.9375rem;
    padding: 0.5rem 0.75rem;
    padding-inline-end: 1.125rem;
  }
}

/* From the wide spread up: the bar takes the three-column lane and is pinned across the whole run of five rows, so it travels down beside the intro and the four sections instead of leaving the lane empty. */
@media (min-width: 56em) {
  .Guide-row { display: none; }
  .Guide { grid-template-rows: repeat(5, auto); }
  .Guide-bar {
    display: block;
    grid-column: 1 / span 3;
    grid-row: 1 / -1;
    align-self: start;
    position: sticky;
    inset-block-start: 1rem;
  }
  .Guide-section { grid-column: 4 / -1; grid-template-columns: subgrid; }
  .Guide-section > .Heading { grid-column: 1 / -1; }
  .Guide-section > .Spread-story { grid-column: 1 / span 5; }
  .Guide-section > .Spread-side { grid-column: 6 / span 4; }
  .Guide-section > .Spread-pull,
  .Guide-section > .Guide-wide,
  .Guide-section > .Guide-note { grid-column: 1 / -1; }

  /* The opening photograph is cropped wide here so it ends about where the intro sentence does, and the first section follows closely with no empty slate in the middle lane. */
  .Intro .Photo-frame { aspect-ratio: 16 / 9; }
  .Guide .Intro-sentence { margin-block-end: 0; }
  .Intro + .Guide-section { padding-block-start: clamp(0.5rem, 2vh, 1.5rem); }
}

/* Reduced motion: the label does not fade; the script shows all four states at once. */
@media (prefers-reduced-motion: reduce) {
  .Guide-label { transition: none; }
}
