/* Page-only styles for guide pages and the guide index (plan 0007 D14).
   Loaded after css/styles.css, so every rule here wins only on those pages. */

.guide-grid,
.card-grid {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 40rem) {
  .guide-grid,
  .card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 75rem) {
  .guide-grid,
  .card-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.guide-card {
  display: grid;
  padding: var(--space-4);
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  gap: var(--space-2);
  text-decoration: none;
}

.guide-card:hover,
.guide-card:focus-visible {
  border-color: var(--accent);
  box-shadow: inset 0.25rem 0 0 var(--volt);
}

.guide-title {
  margin: 0;
  font-size: var(--text-body);
  font-weight: 800;
}

.guide-summary {
  margin: 0;
  color: var(--muted);
  font-size: var(--text-caption);
}

.guide-meta {
  color: var(--muted);
  font-size: var(--text-micro);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.task-grid {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 40rem) {
  .task-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Plan 0008 S2-T2: the ride-stage hubs read best as three columns; plan 0013 adds a seventh. */
@media (min-width: 64rem) {
  .task-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.link-kind {
  color: var(--muted);
  font-size: var(--text-micro);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.good-to-know {
  margin-block-start: var(--space-16);
}

.good-to-know h2 {
  margin-block-end: var(--space-4);
  font-size: var(--text-heading);
}

/* A3.6: the guides index filter and group intros. */
.guide-filter {
  display: none;
  grid-template-columns: 1fr;
  margin-block-end: var(--space-8);
  gap: var(--space-3);
  padding: var(--space-4);
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

[data-guides-ready] .guide-filter {
  display: grid;
}

.guide-filter .field {
  margin: 0;
}

.guide-group-intro {
  margin-block-end: var(--space-4);
  color: var(--muted);
}

/* A3.5: previous/next wayfinding inside the guide's own group. */
.guide-pager {
  display: flex;
  margin-block: var(--space-6);
  gap: var(--space-3);
  flex-wrap: wrap;
  justify-content: space-between;
}

.guide-pager a {
  display: inline-flex;
  min-height: 1.5rem;
  align-items: center;
  font-weight: 700;
}

.guide-group {
  margin-block-start: var(--space-8);
}

.guide-group h2 {
  margin-block-end: var(--space-4);
  font-size: var(--text-heading);
}

/* Home task cards (A7.6) and guide key points (A7.12) are index/guide-only. */
.task-card {
  padding: var(--space-6);
  border-block-start: 0.25rem solid var(--volt);
  border-radius: var(--radius);
  background: var(--surface);
}

.task-card h3 {
  margin-block-end: var(--space-2);
  font-size: var(--text-heading);
}

.task-card p {
  margin-block-end: var(--space-4);
  color: var(--muted);
}

/* Hub links read as clean rows: no resting underline (the card and arrow already say
   "link"), an aligned kind tag, and a divider between rows. */
.task-links {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}

.task-links li + li {
  border-block-start: var(--border-width) solid var(--border);
}

.task-links a {
  display: flex;
  min-height: 2.5rem;
  align-items: center;
  gap: var(--space-3);
  padding-block: var(--space-2);
  color: var(--text);
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
}

.task-links a::after {
  margin-inline-start: auto;
  color: var(--muted);
  content: "\2192";
  content: "\2192" / "";
  transition: transform 120ms ease;
}

.task-links a:hover,
.task-links a:focus-visible {
  color: var(--accent-ink);
}

.task-links a:hover::after,
.task-links a:focus-visible::after {
  color: var(--accent-ink);
  transform: translateX(0.2rem);
}

.task-links .link-kind {
  flex: none;
  min-width: 3.25rem;
  padding: 0.125rem var(--space-1);
  border-radius: var(--space-1);
  background: var(--surface-2);
  text-align: center;
}

/* Plan 0011 A3.3: Popular questions — a short row of pill links on the home page and the
   guides index. Existing tokens only. */
.popular {
  margin-block: var(--space-8);
}

.popular h2 {
  margin-block-end: var(--space-3);
  font-size: var(--text-heading);
}

.popular-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.popular-links a {
  display: inline-flex;
  min-height: 2.75rem;
  align-items: center;
  padding-inline: var(--space-4);
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

.popular-links a:hover,
.popular-links a:focus-visible {
  border-color: var(--accent-ink);
  color: var(--accent-ink);
}

.related-guides .task-links {
  max-width: 40rem;
}

.key-points {
  margin-block: var(--space-8);
  padding: var(--space-6);
  border-inline-start: 0.375rem solid var(--volt);
  border-radius: var(--radius);
  background: var(--surface);
}

.key-points h2 {
  margin-block-end: var(--space-3);
  font-size: var(--text-heading);
}

.key-points ul {
  display: grid;
  margin: 0;
  padding-inline-start: var(--space-4);
  gap: var(--space-2);
}

.guide-section {
  max-width: var(--measure);
  margin-block-end: var(--space-12);
}

/* Plan 0009 S4-T2 (B2 R4): long text reads best at about 66 characters a line. */
.guide-section > p,
.guide-section > ul,
.guide-section > ol {
  max-width: 66ch;
}

/* Plan 0008 A3.5: supplementary glossary, styled like the contents rail. */
.glossary {
  margin-block-end: var(--space-8);
  padding-block: var(--space-4);
  border-block: var(--border-width) solid var(--border);
  font-size: var(--text-caption);
}

.glossary > summary {
  padding-block: var(--space-1);
  color: var(--muted);
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
}

.glossary dl {
  display: grid;
  margin: var(--space-3) 0 0;
  gap: var(--space-2);
}

.glossary dt {
  font-weight: 700;
}

.glossary dd {
  margin: 0;
}

.table-wrap {
  overflow-x: auto;
}

.illustration {
  margin: var(--space-8) 0;
}

.illustration figcaption {
  margin-block-start: var(--space-2);
  color: var(--muted);
  font-size: var(--text-caption);
}

.diagram-scroll {
  overflow-x: auto;
}

/* Plan 0009 A3.3: superscript source numbers. Raised by the sup's own baseline shift,
   with padding so adjacent numbers never touch, and a visible focus ring. */
.cite-sup {
  margin-inline-start: 0.1em;
  line-height: 0;
  white-space: nowrap;
}

.cite {
  padding-inline: 0.2em;
  color: var(--accent-ink);
  font-size: var(--text-micro);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.cite:focus-visible {
  outline: var(--focus-width) solid var(--focus);
  outline-offset: 0.1em;
  border-radius: 0.2em;
}

/* A3.3: per-section sources fold-out, styled like the words-on-this-page glossary. */
.section-sources {
  margin-block-start: var(--space-6);
  padding-block: var(--space-3);
  border-block: var(--border-width) solid var(--border);
  font-size: var(--text-caption);
}

.section-sources > summary {
  padding-block: var(--space-1);
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
}

.section-sources ol {
  display: grid;
  margin: var(--space-3) 0 0;
  padding-inline-start: var(--space-6);
  gap: var(--space-3);
}

.section-sources li:target {
  outline: var(--focus-width) solid var(--focus);
  outline-offset: var(--space-1);
}

.section-sources .evidence-level {
  font-weight: 700;
}

.section-sources .claim-list,
.section-sources .worked-out,
.section-sources .common-practice {
  color: var(--muted);
}

.section-sources .claim-list {
  display: block;
}

.section-sources .worked-out,
.section-sources .common-practice {
  list-style: none;
  margin-inline-start: calc(-1 * var(--space-6));
}

.source-list {
  padding-inline-start: var(--space-6);
}

.source-list li {
  margin-block-end: var(--space-3);
}

.zone-note {
  color: var(--muted);
  font-size: var(--text-caption);
}

.guide-page {
  padding-block: var(--space-12) var(--space-16);
}

.page-meta {
  margin-block: var(--space-3) 0;
  color: var(--muted);
  font-size: var(--text-caption);
}

.steps {
  display: grid;
  margin: var(--space-4) 0;
  padding: 0;
  gap: var(--space-3);
  list-style: none;
  counter-reset: step;
}

.steps li {
  display: grid;
  align-items: start;
  gap: var(--space-3);
  grid-template-columns: 2rem minmax(0, 1fr);
}

/* A3.5: the step text, badge and citations share one grid cell beside the number. */
.steps .step-body {
  min-width: 0;
}

.steps li::before {
  counter-increment: step;
  content: counter(step);
  display: grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  border-radius: 50%;
  background: var(--volt);
  color: var(--on-volt);
  font-weight: 800;
}

.aside-humour {
  margin-block: var(--space-4);
  padding: var(--space-4);
  border: 2px dashed var(--muted);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.sources-section details > summary {
  font-weight: 700;
  cursor: pointer;
}

.source-citation {
  color: var(--text);
}

.related {
  margin-block-start: var(--space-12);
}

/* Appendix A8 artwork. Every stroke follows the theme through the shared
   .ill-* primitives in css/styles.css; only road signs keep fixed sign colours. */
.illustration svg {
  display: block;
  width: 100%;
  height: auto;
}

.illustration-gallery {
  display: grid;
  margin-block: var(--space-6);
  gap: var(--space-4);
  grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
}

.illustration-gallery .illustration {
  margin: 0;
}

.illustration-gallery figcaption {
  font-size: var(--text-micro);
}

/* Small silhouettes and icons: A8.2 draws with a 3-unit stroke. */
.ill-small .ill-line,
.ill-small .ill-muted,
.ill-small .ill-accent,
.ill-small .ill-accent-strong {
  stroke-width: 3;
}

.ill-rim-sm {
  fill: none;
  stroke: var(--text);
  opacity: 0.35;
  stroke-width: 6;
}

.ill-tyre-wide {
  fill: none;
  stroke: var(--text);
  stroke-width: 7;
}

.ill-thin,
.ill-guide {
  fill: none;
  stroke: var(--muted);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.ill-dash {
  fill: none;
  stroke: var(--muted);
  stroke-dasharray: 4 6;
  stroke-linecap: round;
  stroke-width: 2;
}

/* A8.4: the signalling arm must stand out on both themes. */
.ill-accent-strong {
  fill: none;
  stroke: var(--accent-ink);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 8;
}

.ill-fill-accent-strong {
  fill: var(--accent-ink);
}

/* A8.5: fixed sign colours are the one allowed exception to tokens. */
.sign-red {
  fill: #d4351c;
  stroke: #d4351c;
}

.sign-blue {
  fill: #1d70b8;
  stroke: #1d70b8;
}

.sign-ink {
  fill: #0b0c0c;
  stroke: #0b0c0c;
}

.sign-white {
  fill: #ffffff;
  stroke: #ffffff;
}

.ill-sign-line {
  fill: none;
  stroke-width: 6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Appendix B0.1 (plan 0008) and plan 0009 Appendix A4: one focus per figure, stick
   people drawn with a 7-unit stroke, arrows for movement. Tokens only, so both themes
   stay legible. */
.ill-focus {
  fill: none;
  stroke: var(--accent-ink);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 6;
}

.ill-fill-focus {
  fill: var(--accent-ink);
}

.ill-body {
  fill: none;
  stroke: var(--text);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 7;
}

.ill-body-focus {
  fill: none;
  stroke: var(--accent-ink);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 7;
}

/* Appendix B15: the start pose of an exercise is muted, the end pose is --text. */
.ill-body-muted {
  fill: none;
  stroke: var(--muted);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 7;
}

.ill-fill-muted {
  fill: var(--muted);
}

.ill-leader {
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.5;
}

.ill-arrow {
  fill: none;
  stroke: var(--accent-ink);
  stroke-linecap: round;
  stroke-width: 4;
}

.ill-panel {
  fill: var(--surface-2);
  stroke: var(--border);
}

/* A shaded area whose boundary is drawn separately (Appendix B10 shelter). */
.ill-panel-fill {
  fill: var(--surface-2);
  stroke: none;
}

.ill-label {
  fill: var(--text);
  font-weight: 600;
}

.ill-label-focus {
  fill: var(--accent-ink);
  font-weight: 800;
}

@media (forced-colors: active) {
  .ill-focus,
  .ill-body-focus,
  .ill-arrow {
    stroke: Highlight;
  }

  .ill-fill-focus,
  .ill-label-focus {
    fill: Highlight;
  }
}

/* Simplified road signs keep their fixed sign colours (A8.5). */
.sign-stroke-white {
  fill: none;
  stroke: #ffffff;
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sign-stroke-ink {
  fill: none;
  stroke: #0b0c0c;
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* A8.3: the 21-callout anatomy diagram keeps its drawn size and scrolls instead
   of shrinking the labels below legibility on phones. */
.diagram-scroll svg {
  display: block;
  width: 100%;
  min-width: 40rem;
  height: auto;
}

/* From 48rem the whole bike fits the column, so the figure stops scrolling. */
@media (min-width: 48rem) {
  .diagram-scroll svg {
    min-width: 0;
  }
}

.sign-ink-text {
  fill: #0b0c0c;
  stroke: none;
  font-weight: 800;
}

/* Interactive targets stay at least 24 px tall for the "Open source" links. Inline
   superscript citations are exempt as inline targets (WCAG 2.5.8) and get padding instead. */
.source-list a {
  display: inline-flex;
  min-height: 1.5rem;
  align-items: center;
}

/* Plan 0008 A9/A10: the year leads a history heading in the accent colour, and each
   fun fact is a card that reflows from one column to two from 48rem. */
.section-year {
  color: var(--accent-ink);
  font-weight: 800;
}

.section-icon {
  display: inline-flex;
  width: 1.8em;
  height: 1.8em;
  margin-right: 0.6ch;
  vertical-align: -0.35em;
}

.section-icon svg {
  width: 100%;
  height: 100%;
}

.fun-fact {
  margin-block: 0;
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: var(--text-subhead);
}

.guide-fun-facts .guide-section {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
}

.guide-fun-facts .guide-section h2 {
  grid-column: 1 / -1;
}

@media (min-width: 48rem) {
  .guide-fun-facts .guide-section {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Plan 0008 A8/B17: kids art helper fills and the kids page styling (tokens only). */
.ill-fill-paper {
  fill: var(--bg);
}

.ill-fill-none {
  fill: none;
  stroke: var(--bg);
  stroke-linecap: round;
}

.guide-kids {
  font-size: var(--text-subhead);
}

.story {
  padding: var(--space-6);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
}

.story-label {
  margin-block-end: var(--space-2);
  color: var(--accent-ink);
  font-size: var(--text-caption);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.story-intro {
  font-size: var(--text-subhead);
}

.story-chapter {
  counter-increment: chapter;
  margin-block-start: var(--space-6);
}

.story-chapter h4 {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

.story-chapter h4::before {
  content: counter(chapter);
  display: grid;
  flex: none;
  width: 2rem;
  height: 2rem;
  place-items: center;
  border-radius: 50%;
  background: var(--volt);
  color: var(--on-volt);
  font-weight: 800;
}

.story {
  counter-reset: chapter;
}

.story-ask {
  margin-block-start: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-inline-start: 4px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--surface);
  font-weight: 600;
}

.grownups {
  margin-block-start: var(--space-6);
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

/* Plan 0009 A3.5: the home page's daily fun fact. It lives here, not in styles.css, to keep
   styles.css within its 40 KiB budget; index.html already loads this sheet. */
.fun-fact-card {
  padding-block: var(--space-8);
  border-block-start: var(--border-width) solid var(--border);
}

.fun-fact-card > * {
  max-width: var(--measure);
  margin-block-end: var(--space-3);
}

.fun-fact-card h2 {
  font-size: var(--text-heading);
}

.fun-fact-text {
  font-size: var(--text-subhead);
}

.fun-fact-source {
  color: var(--muted);
  font-size: var(--text-caption);
}

/* Plan 0014: the What's new page and the home "Latest updates" teaser. Existing tokens only;
   lives here because css/styles.css is at its size budget. */
.changelog-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.changelog-entry {
  max-width: var(--measure);
  padding-block: var(--space-6);
  border-block-start: var(--border-width) solid var(--border);
}

.changelog-entry h2 {
  margin-block-end: var(--space-2);
  font-size: var(--text-heading);
}

.changelog-date,
.updates-list time {
  color: var(--muted);
  font-size: var(--text-caption);
}

.changelog-items {
  margin-block: var(--space-3) 0;
  padding-inline-start: var(--space-6);
}

.changelog-items li + li {
  margin-block-start: var(--space-2);
}

.updates {
  padding-block: var(--space-8);
  border-block-start: var(--border-width) solid var(--border);
}

.updates > * {
  max-width: var(--measure);
}

.updates h2 {
  margin-block-end: var(--space-3);
  font-size: var(--text-heading);
}

.updates-list {
  margin: 0 0 var(--space-4);
  padding: 0;
  list-style: none;
}

.updates-list li {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: baseline;
  padding-block: var(--space-2);
}
