/* Shared stylesheet for the static public pages: the four certification pages
   and /about/.
 *
 * Served straight off disk by nginx, like the pages themselves. No CDN, no web
 * font, no build step - one file, cached across the whole set. The palette and
 * the shape language are the same ones theme/claudeprep/scss/pre.scss compiles
 * into Moodle, so a visitor crossing from a static page into a course does not
 * see the site change under them.
 *
 * Contrast: every foreground token below clears WCAG AA (4.5:1) against its own
 * background in both schemes. --acc is the fill colour for solid buttons only,
 * where the text on top is white; --accd is the one used for text on the page
 * background, because --acc alone is 2.9:1 there and would fail.
 */

:root {
  color-scheme: light dark;

  --bg:      #ffffff;
  --ink:     #1d2125;  /* 15.8:1 on --bg */
  --mut:     #5b6477;  /*  5.9:1 on --bg */
  --acc:     #d97757;  /* fills only - never text on --bg */
  --accd:    #b45a3c;  /*  4.7:1 on --bg */
  --line:    rgba(128, 128, 128, .45);
  --faint:   rgba(128, 128, 128, .22);
  --panel:   rgba(128, 128, 128, .06);
  --ok:      #2e7d32;
  --okbg:    rgba(46, 125, 50, .10);
  --warn:    #a8520f;
  --warnbg:  rgba(168, 82, 15, .10);

  --sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
          "Liberation Mono", monospace;

  --wrap: 46rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:      #14161a;
    --ink:     #e6e8ec;  /* 14.6:1 on --bg */
    --mut:     #9aa4b8;  /*  7.4:1 on --bg */
    --acc:     #d97757;
    --accd:    #ef9d78;  /*  8.6:1 on --bg */
    --line:    rgba(150, 158, 175, .40);
    --faint:   rgba(150, 158, 175, .20);
    --panel:   rgba(150, 158, 175, .07);
    --ok:      #7bc47f;
    --okbg:    rgba(123, 196, 127, .12);
    --warn:    #e9a05c;
    --warnbg:  rgba(233, 160, 92, .12);
  }
}

* { box-sizing: border-box; }

html {
  background: var(--bg);
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--sans);
  line-height: 1.6;
  margin: 0;
  padding: 0 1rem 3rem;
}

.wrap { max-width: var(--wrap); margin: 0 auto; }

a { color: var(--accd); }
a:hover { text-decoration: none; }

/* --- Program strip -------------------------------------------------------
   Sits above everything, including the nav. It states which published version
   of the program the page describes, so a reader can tell at a glance whether
   what follows is current - the single most useful thing a reference page can
   say about itself. */
.programbar {
  border-bottom: 1px solid var(--faint);
  background: var(--panel);
  margin: 0 -1rem 0;
  padding: .45rem 1rem;
  font-family: var(--mono);
  font-size: .75rem;
  color: var(--mut);
  letter-spacing: .01em;
}
.programbar .wrap { display: flex; flex-wrap: wrap; gap: .5rem; align-items: baseline; }
.programbar .sep { opacity: .55; }

/* --- Site nav ------------------------------------------------------------ */
.sitenav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .35rem 1rem;
  padding: .85rem 0;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--faint);
  font-family: var(--mono);
  font-size: .875rem;
}
.sitenav .brand {
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  margin-right: auto;
}
.sitenav a { color: var(--mut); text-decoration: none; }
.sitenav a:hover,
.sitenav a[aria-current="page"] { color: var(--accd); }
.sitenav a[aria-current="page"] { font-weight: 600; }

/* --- Headings and prose --------------------------------------------------- */
h1 {
  font-size: 1.9rem;
  line-height: 1.18;
  letter-spacing: -.02em;
  margin: 0 0 .5rem;
}
h2 {
  font-size: 1.3rem;
  line-height: 1.25;
  letter-spacing: -.01em;
  margin: 2.6rem 0 .6rem;
  scroll-margin-top: 1rem;
}
h3 { font-size: 1.05rem; margin: 1.8rem 0 .5rem; }
p { margin: 0 0 1rem; }
ul, ol { margin: 0 0 1rem; padding-left: 1.3rem; }
li { margin-bottom: .35rem; }

.crumb {
  font-family: var(--mono);
  font-size: .8rem;
  color: var(--mut);
  margin-bottom: .9rem;
}
.crumb a { color: var(--mut); }

.lede { font-size: 1.08rem; color: var(--ink); margin-bottom: 1rem; }
.note { color: var(--mut); font-size: .92rem; }

/* Independence disclaimer. Deliberately plain: it reads as a statement of fact
   rather than a legal footnote, which is the point of putting it up top. */
.independent {
  font-size: .875rem;
  color: var(--mut);
  border-left: 3px solid var(--line);
  padding: .1rem 0 .1rem .8rem;
  margin: 0 0 1.6rem;
}

/* --- Certification code row ---------------------------------------------- */
.codes {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin: 0 0 1.3rem;
  padding: 0;
  list-style: none;
  font-family: var(--mono);
  font-size: .8rem;
}
.codes a, .codes span {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .25rem .7rem;
  text-decoration: none;
  color: var(--mut);
}
.codes a:hover { border-color: var(--acc); color: var(--accd); }
.codes .here { border-color: var(--acc); color: var(--accd); font-weight: 600; }

/* --- Fact card ------------------------------------------------------------ */
.factcard {
  border: 1px solid var(--line);
  border-radius: .875rem;
  padding: .25rem 1.1rem;
  margin: 0 0 1.6rem;
}
.factcard dl { margin: 0; }
.factcard div {
  display: flex;
  flex-wrap: wrap;
  gap: .2rem .8rem;
  padding: .6rem 0;
  border-bottom: 1px solid var(--faint);
}
.factcard div:last-child { border-bottom: 0; }
.factcard dt {
  flex: 0 0 11rem;
  font-family: var(--mono);
  font-size: .8rem;
  color: var(--mut);
  padding-top: .12rem;
}
.factcard dd { flex: 1 1 14rem; margin: 0; }

/* --- Tables --------------------------------------------------------------- */
.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 0 1rem; }
table {
  border-collapse: collapse;
  width: 100%;
  min-width: 22rem;
  font-size: .93rem;
}
th, td {
  text-align: left;
  vertical-align: top;
  padding: .5rem .7rem;
  border-bottom: 1px solid var(--faint);
}
thead th {
  font-family: var(--mono);
  font-size: .78rem;
  font-weight: 700;
  color: var(--mut);
  border-bottom: 2px solid var(--line);
  white-space: nowrap;
}
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
tr.total td { font-weight: 700; border-top: 2px solid var(--line); }

/* --- Callouts ------------------------------------------------------------- */
.callout {
  border: 1px solid var(--line);
  border-left-width: 3px;
  border-radius: .5rem;
  padding: .9rem 1.1rem;
  margin: 0 0 1.2rem;
  font-size: .95rem;
}
.callout p:last-child { margin-bottom: 0; }
.callout.good { border-left-color: var(--ok); background: var(--okbg); }
.callout.warn { border-left-color: var(--warn); background: var(--warnbg); }

/* --- CTA ------------------------------------------------------------------ */
.cta {
  border: 1px solid var(--line);
  border-radius: .875rem;
  padding: 1.2rem 1.3rem;
  margin: 1.6rem 0;
}
.cta h2 { margin-top: 0; font-size: 1.15rem; }
.cta p { margin-bottom: .9rem; }
.btn {
  display: inline-block;
  background: var(--acc);
  border: 1px solid var(--acc);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  padding: .65rem 1.15rem;
  border-radius: .625rem;
}
.btn:hover { background: var(--accd); border-color: var(--accd); color: #fff; }
.btn.ghost { background: transparent; color: var(--accd); border-color: var(--line); }
.btn.ghost:hover { background: transparent; border-color: var(--acc); }

/* --- Email capture -------------------------------------------------------- */
.signup {
  border: 1px solid var(--line);
  border-radius: .875rem;
  padding: 1.2rem 1.3rem;
  margin: 2.4rem 0 0;
}
.signup h2 { margin: 0 0 .4rem; font-size: 1.15rem; }
.signup .row { display: flex; flex-wrap: wrap; gap: .5rem; margin: .9rem 0 .5rem; }
.signup input[type=email] {
  flex: 1 1 15rem;
  font: inherit;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: .625rem;
  padding: .6rem .8rem;
}
.signup input[type=email]:focus-visible { outline: 2px solid var(--acc); outline-offset: 1px; }
.signup button {
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  background: var(--acc);
  border: 1px solid var(--acc);
  color: #fff;
  border-radius: .625rem;
  padding: .6rem 1.1rem;
}
.signup button:hover { background: var(--accd); border-color: var(--accd); }
.signup .fine { font-size: .8rem; color: var(--mut); margin: 0; }
.signup .vh { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.signup .hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.signup .msg { margin: .6rem 0 0; font-size: .9rem; }
.signup .msg.err { color: var(--warn); }
.signup .msg.ok { color: var(--ok); }

/* --- FAQ ------------------------------------------------------------------ */
details.faq { border-bottom: 1px solid var(--faint); }
details.faq summary {
  cursor: pointer;
  padding: .75rem 0;
  font-weight: 600;
  list-style: none;
  display: flex;
  gap: .6rem;
  align-items: flex-start;
}
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::before { content: "+"; color: var(--accd); font-weight: 700; flex: 0 0 auto; }
details.faq[open] summary::before { content: "\2212"; }
details.faq .a { padding: 0 0 .9rem 1.2rem; color: var(--mut); font-size: .95rem; }
details.faq .a p:last-child { margin-bottom: 0; }

/* --- Footer --------------------------------------------------------------- */
.sitefoot {
  margin-top: 3.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--faint);
  font-size: .875rem;
  color: var(--mut);
}
.sitefoot .cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  gap: 1.4rem;
  margin-bottom: 1.8rem;
}
.sitefoot h2 {
  font-family: var(--mono);
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--mut);
  margin: 0 0 .5rem;
}
.sitefoot ul { list-style: none; margin: 0; padding: 0; }
.sitefoot li { margin-bottom: .3rem; }
.sitefoot a { color: var(--mut); text-decoration: none; }
.sitefoot a:hover { color: var(--accd); text-decoration: underline; }
.sitefoot .maintainer { font-size: .8rem; margin-bottom: .6rem; }
.sitefoot .legal { font-size: .78rem; }
.sitefoot .apps { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.2rem; }
.sitefoot .apps a {
  border: 1px solid var(--line);
  border-radius: .5rem;
  padding: .3rem .7rem;
  font-family: var(--mono);
  font-size: .78rem;
}
.sitefoot .apps a:hover { border-color: var(--acc); text-decoration: none; }

/* --- Small screens -------------------------------------------------------- */
@media (max-width: 30rem) {
  h1 { font-size: 1.55rem; }
  .factcard dt { flex-basis: 100%; }
  .sitenav .brand { margin-right: 0; flex: 1 0 100%; }
}

@media print {
  .programbar, .sitenav, .signup, .cta { display: none; }
}
