/* Guides: the list (views/guides.js) and one guide (views/guide.js), pages of the almanac. A guide is
   a column of reading at the measure of the rest of the site, its contents beside it on a wide
   screen; its drawings are night plates (guides/diagrams.js, the class night-scope), so their
   colours below are the Night tokens in either theme. */

/* ---- The list of guides ---- */
.guides-group { margin-top: var(--space-10); }
.guides-group:first-of-type { margin-top: 0; }
.guides-group > h2 { margin: 0 0 var(--space-4); padding-bottom: var(--space-2); border-bottom: 1px solid var(--hairline); }
.guide-cards {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); gap: var(--space-4);
  margin: 0; padding: 0; list-style: none;
}
/* The whole card is its title's link (the link's ::after covers it), so it is one target and one
   stop for the keyboard, read as the guide's title. */
.guide-card {
  position: relative; padding: var(--space-5); background: var(--surface);
  border: 1px solid var(--hairline); border-radius: var(--radius); box-shadow: var(--shadow-1);
  transition: border-color var(--dur-fast) var(--ease-out);
}
.guide-card h3 { margin: 0 0 var(--space-2); font: 600 var(--step-1)/var(--leading-snug) var(--font-display); }
.guide-card h3 a { color: var(--ink); text-decoration: none; }
.guide-card h3 a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.guide-card p { margin: 0; color: var(--ink-2); font-size: var(--step--1); line-height: 1.5; }
.guide-card:hover { border-color: var(--field-border); }
.guide-card:hover h3 a { color: var(--accent-ink); text-decoration: underline; }
/* The ring goes round the card, where the link's target is, wherever :has() is understood. */
@supports selector(:has(a)) {
  .guide-card h3 a:focus-visible { outline: none; }
  .guide-card:has(h3 a:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
}
.guides-about { margin-top: var(--space-10); }

/* ---- One guide ---- */
.guide-page .page-head, .guide-page .page-head-text { max-width: calc(var(--measure) + 4rem); }
/* The answer, which the reader may stop at: the ink of the text, a size up, "In short" before it. */
.guide-page .page-head .lead { color: var(--ink); font-size: var(--step-1); line-height: 1.45; margin-top: var(--space-4); }
.guide-answer-label {
  display: block; margin-bottom: var(--space-1); color: var(--ink-2);
  font-size: var(--step--2); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
}
.guide-layout { display: grid; grid-template-columns: minmax(0, 1fr); row-gap: var(--space-8); }
.guide-body, .guide-end { max-width: var(--measure); }

/* The contents: above the first section, or beside the guide on a wide screen. */
.guide-contents {
  max-width: var(--measure); padding: var(--space-4) var(--space-5); border-radius: var(--radius);
  background: var(--surface-2);
}
.guide-contents-label { margin: 0 0 var(--space-2); color: var(--ink-2); font-size: var(--step--2); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.guide-contents ol { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; counter-reset: contents; }
.guide-contents li { counter-increment: contents; }
.guide-contents a {
  display: flex; gap: var(--space-2); align-items: baseline; min-height: 32px; padding: 4px 0;
  color: var(--ink); font-size: var(--step--1); font-weight: 600; text-decoration: none;
}
.guide-contents a::before { content: counter(contents); min-width: 1.4em; color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 650; }
.guide-contents a:hover { color: var(--accent-ink); text-decoration: underline; }
@media (min-width: 1100px) {
  .guide-layout { grid-template-columns: minmax(0, var(--measure)) minmax(13rem, 17rem); column-gap: var(--space-16); justify-content: start; }
  .guide-contents {
    grid-column: 2; grid-row: 1 / span 2; align-self: start; position: sticky; top: calc(var(--topbar-h) + var(--space-6));
    padding: 0 0 0 var(--space-5); border-left: 1px solid var(--hairline); border-radius: 0; background: none;
  }
  .guide-body, .guide-end { grid-column: 1; }
}

/* The sections: running text at the site's measure, headings in the display face. */
.guide-section + .guide-section { margin-top: var(--space-10); }
.guide-section > h2 { margin: 0 0 var(--space-3); }
.guide-section p { margin-bottom: 1em; }
.guide-section > :last-child { margin-bottom: 0; }
.guide-list, .guide-steps { margin: 0 0 1em; padding-left: 1.4em; }
.guide-list li, .guide-steps li { margin-bottom: var(--space-2); padding-left: 0.2em; }
.guide-steps li::marker { font-weight: 700; font-variant-numeric: tabular-nums; }
.guide-terms { margin: 0 0 1em; border-top: 1px solid var(--hairline); }
.guide-term { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px var(--space-5); padding: var(--space-3) 0; border-bottom: 1px solid var(--hairline); }
.guide-term dt { font-weight: 700; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; }
.guide-term dd { margin: 0; color: var(--ink-2); }
@media (min-width: 560px) {
  .guide-term { grid-template-columns: minmax(9rem, 13rem) minmax(0, 1fr); }
}
.guide-note { margin: var(--space-4) 0 1em; }
.guide-live { margin: var(--space-2) 0 1em; }
.guide-live .state { padding: var(--space-6) var(--space-4); border: 1px solid var(--hairline); border-radius: var(--radius); background: var(--surface); }
.guide-tiles { grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr)); margin-bottom: var(--space-4); }

/* A figure: the night plate, then its caption and the numbered key. The drawings' words are 16 units
   in a viewBox 400 wide, so they are 11.5 px on a phone 320 px wide (test/guides.test.js), and the
   plate is kept to 30rem so they are not large on a wide screen. */
.guide-figure { margin: var(--space-6) 0; }
.fig-plate { max-width: 30rem; border-radius: var(--radius); overflow: hidden; background: var(--surface); box-shadow: var(--shadow-1); }
.fig-drawing { display: block; width: 100%; height: auto; }
.guide-figure figcaption { max-width: 30rem; margin-top: var(--space-3); font-size: var(--step--1); color: var(--ink-2); }
.fig-caption { margin: 0 0 var(--space-3); }
.fig-key { display: grid; gap: var(--space-2); margin: 0; padding: 0; list-style: none; }
.fig-key li { display: grid; grid-template-columns: 1.5rem minmax(0, 1fr); gap: var(--space-3); align-items: start; color: var(--ink); }
.fig-key-n {
  display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem; border: 1.5px solid var(--ink-2); border-radius: 50%;
  font-size: var(--step--2); font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1;
}

/* The drawings' parts (Night tokens: the plate is night-scope). */
.fig-space { fill: var(--surface); }
.fig-shadow { fill: var(--page); }
.fig-shadow-edge { fill: none; stroke: var(--muted); stroke-width: 1; stroke-dasharray: 4 4; }
.fig-ray { fill: none; stroke: var(--ink-2); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.fig-orbit { fill: none; stroke: var(--field-border); stroke-width: 1.2; stroke-dasharray: 2 5; }
.fig-day { fill: var(--ink-2); }
.fig-night { fill: var(--map-land); }
.fig-earth-edge { fill: none; stroke: var(--field-border); stroke-width: 1.2; }
.fig-label { fill: var(--ink-2); font: 600 16px var(--font-text); }
.fig-label.fig-on-day { fill: var(--page); }
/* The line of sight to what can be seen, and the satellite in sunlight: starlight gold. */
.fig-sight { fill: none; stroke: var(--gold); stroke-width: 2; stroke-dasharray: 5 4; stroke-linecap: round; }
.fig-sat-lit { fill: var(--gold); stroke: var(--page); stroke-width: 1.5; }
.fig-sat-dark { fill: var(--surface); stroke: var(--muted); stroke-width: 1.6; }
.fig-watcher path { fill: none; stroke: var(--ink); stroke-width: 2.4; stroke-linecap: round; }
.fig-watcher circle { fill: var(--ink); }
.fig-marker circle { fill: var(--raised); stroke: var(--ink-2); stroke-width: 1.4; }
.fig-marker text { fill: var(--ink); font: 700 16px var(--font-text); }
.fig-sky { fill: var(--raised); }
.fig-too-low { fill: var(--page); }
.fig-tick { stroke: var(--ink-2); stroke-width: 1.4; }
.fig-guide { fill: none; stroke: var(--muted); stroke-width: 1; stroke-dasharray: 4 4; }
.fig-horizon { stroke: var(--ink-2); stroke-width: 2; stroke-linecap: round; }

/* The end of a guide: "Try it", its sources, the guides either side. */
.guide-end { display: grid; gap: var(--space-8); }
.guide-try {
  padding: var(--space-6); border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--hairline)); border-radius: var(--radius);
  background: var(--raised); box-shadow: var(--shadow-1);
}
.guide-try h2 { margin: 0 0 var(--space-3); }
.guide-try p { margin: 0; }
.guide-try-link { height: auto; min-height: 44px; padding-block: var(--space-2); white-space: normal; text-align: left; }
.guide-sources { padding-top: var(--space-5); border-top: 1px solid var(--hairline); font-size: var(--step--1); }
.guide-sources h2 { margin: 0 0 var(--space-3); font-size: var(--step-1); }
.guide-sources p { margin: 0; }
.guide-pager { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); }
.guide-pager a {
  display: grid; gap: 2px; align-content: start; min-height: 44px; padding: var(--space-4); border: 1px solid var(--hairline); border-radius: var(--radius);
  background: var(--surface); color: var(--ink); text-decoration: none;
}
.guide-pager a:hover { border-color: var(--field-border); }
.guide-pager a:hover .guide-pager-title { color: var(--accent-ink); text-decoration: underline; }
.guide-pager-next { text-align: right; }
.guide-pager-dir { color: var(--ink-2); font-size: var(--step--2); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.guide-pager-title { font: 600 var(--step-0)/var(--leading-snug) var(--font-display); }
@media (max-width: 640px) {
  .guide-pager { grid-template-columns: minmax(0, 1fr); }
  .guide-pager-next { text-align: left; }
  .guide-try { padding: var(--space-5); }
}
