/* Digital Greenhouse — reference.css
   The Reference section: /reference (the hub) and the look-it-up pages beside it
   (/reference/international-phonetic-alphabet, /reference/phases-of-the-moon,
   /reference/pencil-grades, /reference/long-division). The hub's cards and shelves come
   from tools.css and topics.css; the page text from articles.css (.prose). */

/* ----- Phonetic symbols -----
   Fonts that carry the whole IPA block, best first. Nothing is downloaded: these are tried
   in order from what the reader's device already has. */
.rf-ipa, .rf-chart td, .rf-chart .rf-sym {
  font-family: "Charis SIL", "Doulos SIL", "Gentium Plus", "Noto Sans", "Segoe UI", "Helvetica Neue", "DejaVu Sans", "Lucida Sans Unicode", "Arial Unicode MS", sans-serif;
}
.rf-ipa { font-size: 1.12em; white-space: nowrap; }

/* The big charts: a symbol per cell, wide enough to scroll sideways on a phone. */
.prose table.rf-chart { width: 100%; border-collapse: collapse; margin: var(--space-4) 0; font-size: var(--fs-sm); }
.prose table.rf-chart th, .prose table.rf-chart td { border: 1px solid var(--grid-line, var(--color-line)); padding: .35rem .45rem; text-align: center; vertical-align: middle; }
.prose table.rf-chart thead th, .prose table.rf-chart tbody th { background: var(--grid-head, var(--bg-card)); font-weight: 600; font-size: var(--fs-xs, .78rem); line-height: 1.25; }
.prose table.rf-chart tbody th { text-align: left; white-space: nowrap; }
.prose table.rf-chart thead th { padding: .35rem .15rem; hyphens: manual; }
.prose table.rf-chart td { font-size: 1.15rem; line-height: 1.2; white-space: nowrap; padding: .35rem .15rem; }
.prose table#rf-consonants tbody th { white-space: normal; min-width: 5.5rem; }
.prose table.rf-chart tr td.rf-none, .prose table.rf-chart tr:hover td.rf-none { background: repeating-linear-gradient(135deg, transparent 0 6px, var(--color-line) 6px 7px); }
.rf-sym { display: inline-block; min-width: 1em; padding: .1rem .1rem; border-radius: 4px; cursor: pointer; }
.rf-sym:hover, .rf-sym:focus-visible { background: var(--color-line); outline: none; }
.rf-sym.is-copied { background: var(--color-emerald, #1f6b4a); color: #fff; }
.rf-copied { min-height: 1.5em; font-size: var(--fs-sm); color: var(--text-muted); }

/* A plain boxed note. */
.rf-note {
  padding: var(--space-4) var(--space-5); margin: var(--space-5) 0;
  background: var(--bg-card); border: 1px solid var(--color-line); border-left: 4px solid var(--color-emerald, #1f6b4a);
  border-radius: var(--radius-sm, 6px);
}
.rf-note > :first-child { margin-top: 0; }
.rf-note > :last-child { margin-bottom: 0; }

/* ----- Moon ----- */
.rf-moon { display: grid; grid-template-columns: minmax(0, 11rem) minmax(0, 1fr); gap: var(--space-5); align-items: center; }
.rf-moon svg { width: 100%; height: auto; display: block; }
.rf-moon__name { font-size: var(--fs-xl, 1.5rem); font-weight: 700; margin: 0 0 .25rem; }
.rf-moon__sub { margin: 0 0 var(--space-3); color: var(--text-muted); }
.rf-seg { display: inline-flex; border: 1px solid var(--color-line); border-radius: 999px; overflow: hidden; margin: var(--space-3) 0 0; }
.rf-seg button { border: 0; background: transparent; color: var(--text); padding: .4rem .9rem; font: inherit; font-size: var(--fs-sm); cursor: pointer; }
.rf-seg button[aria-pressed="true"] { background: var(--color-emerald, #1f6b4a); color: #fff; }
.prose ol.rf-phases, .rf-phases { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); gap: var(--space-4); margin: var(--space-5) 0; padding: 0; list-style: none; }
.prose ol.rf-phases li, .rf-phases li { margin: 0; padding: var(--space-4) var(--space-3); text-align: center; background: var(--bg-card); border: 1px solid var(--color-line); border-radius: var(--radius-sm, 6px); }
.rf-phases svg { width: 4.5rem; height: 4.5rem; display: block; margin: 0 auto var(--space-2); }
.rf-phases strong { display: block; }
.rf-phases span { display: block; font-size: var(--fs-sm); color: var(--text-muted); }
.rf-figure { margin: var(--space-5) 0; }
.rf-figure svg { width: 100%; height: auto; display: block; border-radius: var(--radius-sm, 6px); }
.rf-figure figcaption { margin-top: .5rem; font-size: var(--fs-sm); color: var(--text-muted); }

/* ----- Pencil grades -----
   The strip is drawn on its own paper colour in both themes, so the greys read the same. */
.rf-pencils { display: grid; grid-template-columns: repeat(20, minmax(2rem, 1fr)); gap: 0; margin: var(--space-4) 0 var(--space-2); background: #f6f3ea; border: 1px solid var(--color-line); border-radius: var(--radius-sm, 6px); overflow: hidden; min-width: 40rem; }
.rf-pencils div { padding: .6rem .2rem .5rem; text-align: center; color: #1c2620; font-size: var(--fs-sm); font-weight: 600; }
.rf-pencils i { display: block; height: 3.2rem; margin: 0 .25rem .45rem; border-radius: 3px; }
.rf-pencils .is-mid { background: #e9e3d2; }

/* ----- Long division ----- */
.privacy-badge[hidden] { display: none; }
.prose pre.rf-ld, pre.rf-ld {
  font-family: "Cascadia Mono", Consolas, "DejaVu Sans Mono", Menlo, "Liberation Mono", "Courier New", monospace;
  font-size: 1.15rem; line-height: 1.3; letter-spacing: .06em;
  padding: var(--space-4) var(--space-5); margin: var(--space-4) 0;
  background: var(--bg-card); color: var(--text); border: 1px solid var(--color-line); border-radius: var(--radius-sm, 6px);
  overflow-x: auto; white-space: pre; tab-size: 4;
}
.rf-ld-pair { display: grid; grid-template-columns: minmax(0, auto) minmax(0, 1fr); gap: var(--space-5); align-items: start; }
.rf-ld-pair pre.rf-ld { margin-top: 0; }
.rf-ld-pair ol { margin: 0; padding-left: 1.5rem; list-style: decimal; }
.rf-ld-pair ol li { margin: 0 0 .6rem; }
#ld-result .rf-ld-pair { margin: var(--space-4) 0; }

@media (max-width: 700px) {
  .rf-moon { grid-template-columns: minmax(0, 1fr); text-align: center; }
  .rf-moon svg { max-width: 9rem; margin: 0 auto; }
  .rf-ld-pair { grid-template-columns: minmax(0, 1fr); gap: var(--space-3); }
}
