/*
 * AVI Learning — site styles.
 *
 * Colour comes from the explainer widgets' own tokens
 * (docs/clinical-ai-explainers/theme.css) so the host page and the embedded
 * widget agree by construction. System fonts only: no third-party requests (R5).
 */

/* Tokens ----------------------------------------------------------------- */
:root {
  --avi-ink: #1f1e1d;
  --avi-ink-2: #5f5e5a;
  --avi-surface: #f5f5f3;        /* widget surface-0: the tile the explainer sits on */
  --avi-sheet: #ffffff;
  --avi-rule: #d9d8d3;
  --avi-rule-strong: #b9b7b0;
  --avi-scrub: #134e48;          /* header: scrub green */
  --avi-link: #0e7457;           /* AA on white */
  --avi-caution-bg: #faeeda;     /* widget citation chip */
  --avi-caution-ink: #633806;
  --avi-caution-rule: #ba7517;
  --avi-focus: #378add;          /* widget focus ring */
  --avi-measure: 42rem;
}

[data-md-color-scheme="slate"] {
  --avi-ink: #ecebe7;
  --avi-ink-2: #b4b2a9;
  --avi-surface: #1a1a19;        /* widget dark surface-0: the embed and tile are one colour */
  --avi-sheet: #2c2c2a;
  --avi-rule: rgba(236, 235, 231, .16);
  --avi-rule-strong: rgba(236, 235, 231, .32);
  --avi-link: #5cc9a4;
  --avi-caution-bg: rgba(250, 199, 117, .12);
  --avi-caution-ink: #fac775;
  --avi-caution-rule: #b8862e;
}

/* Material theme mapping ------------------------------------------------- */
:root,
[data-md-color-scheme="default"] {
  --md-primary-fg-color: var(--avi-scrub);
  --md-primary-fg-color--light: #1d6b62;
  --md-primary-fg-color--dark: #0c3833;
  --md-accent-fg-color: var(--avi-link);
  --md-typeset-a-color: var(--avi-link);
  --md-default-fg-color: var(--avi-ink);
}

[data-md-color-scheme="slate"] {
  --md-primary-fg-color: #0f3d38;
  --md-default-bg-color: #1a1a19;    /* widget dark surface-0, so the embed blends in */
  --md-default-fg-color: var(--avi-ink);
  --md-accent-fg-color: var(--avi-link);
  --md-typeset-a-color: var(--avi-link);
}

/* Reading measure -------------------------------------------------------- */
.md-content__inner {
  max-width: var(--avi-measure);
}

.md-typeset {
  font-size: .9rem;
  line-height: 1.65;
}

.md-typeset h1 {
  font-weight: 650;
  letter-spacing: -.01em;
  color: var(--avi-ink);
  margin-bottom: .6em;
}

.md-typeset h2 {
  font-weight: 620;
  margin-top: 2em;
}

.md-typeset :focus-visible {
  outline: 2px solid var(--avi-focus);
  outline-offset: 2px;
}

/* Course placement and lede ---------------------------------------------- */
.md-typeset .avi-meta {
  color: var(--avi-ink-2);
  font-size: .8rem;
  margin: 0 0 .4rem;
}

.md-typeset .avi-lede {
  font-size: 1.02rem;
  line-height: 1.6;
  color: var(--avi-ink);
}

/* Embedded explainer: a single specimen tile ----------------------------- */
.md-typeset .avi-widget {
  margin: 2rem 0;
  background: var(--avi-surface);
  border-radius: 14px;
  padding: .25rem 0;
}

[data-md-color-scheme="slate"] .md-typeset .avi-widget {
  box-shadow: inset 0 0 0 1px var(--avi-rule);
}

.avi-widget__frame {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
}

.md-typeset .avi-widget figcaption,
.md-typeset .avi-widget__hint {
  font-size: .75rem;
  color: var(--avi-ink-2);
  margin: .25rem 1rem .75rem;
  max-width: none;
}

/* The learner's record sheet — the one bold element ---------------------- */
.md-typeset .avi-artifact {
  margin: 2.5rem 0;
  background: var(--avi-sheet);
  border: 1px solid var(--avi-rule-strong);
  border-radius: 4px;
  padding: 1.5rem 1.5rem 1.25rem;
  box-shadow: 0 1px 0 var(--avi-rule), 0 8px 24px -18px rgba(0, 0, 0, .35);
}

.md-typeset .avi-artifact > h2 {
  margin: 0 0 .5rem;
  padding-bottom: .6rem;
  border-bottom: 2px solid var(--avi-ink);
  font-size: 1.15rem;
}

.md-typeset .avi-artifact__privacy {
  background: var(--avi-caution-bg);
  color: var(--avi-caution-ink);
  border: 1px solid var(--avi-caution-rule);
  border-radius: 4px;
  padding: .6rem .8rem;
  font-size: .78rem;
  line-height: 1.5;
}

.md-typeset .avi-artifact__field {
  margin: 1.4rem 0 0;
}

.md-typeset .avi-artifact__field label {
  display: block;
  font-weight: 620;
  font-size: .85rem;
  color: var(--avi-ink);
  padding-bottom: .25rem;
  border-bottom: 1px solid var(--avi-rule-strong);
}

.md-typeset .avi-artifact__hint {
  font-size: .75rem;
  color: var(--avi-ink-2);
  margin: .35rem 0 0;
}

/* Lined writing space: the rules line up with the text. */
.avi-artifact textarea {
  --line: 1.6rem;
  display: block;
  width: 100%;
  min-height: calc(var(--line) * 3);
  margin-top: .2rem;
  padding: 0 .25rem;
  border: 0;
  resize: vertical;
  font: inherit;
  font-size: .85rem;
  line-height: var(--line);
  color: var(--avi-ink);
  background-color: transparent;
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent calc(var(--line) - 1px),
    var(--avi-rule) calc(var(--line) - 1px),
    var(--avi-rule) var(--line)
  );
  background-attachment: local;
}

.avi-artifact textarea:focus-visible {
  outline: 2px solid var(--avi-focus);
  outline-offset: 2px;
  border-radius: 2px;
}

.md-typeset .avi-artifact__actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin: 1.75rem 0 0;
}

.md-typeset .avi-artifact__actions[hidden],
.md-typeset .avi-artifact__actions [hidden] {
  display: none;
}

.md-typeset .avi-artifact__actions .md-button {
  font-size: .75rem;
  margin: 0;
  padding: .5em 1em;
}

.md-typeset .avi-artifact__status {
  min-height: 1.4em;
  font-size: .75rem;
  color: var(--avi-ink-2);
  margin: .6rem 0 0;
}

/* The course's own rule closes the sheet. */
.md-typeset .avi-artifact::after {
  content: "The tool drafts. The clinician signs.";
  display: block;
  margin-top: 1.25rem;
  padding-top: .6rem;
  border-top: 1px solid var(--avi-rule);
  font-size: .75rem;
  font-style: italic;
  color: var(--avi-ink-2);
}

.avi-artifact__print {
  display: none;
}

/* Where next ------------------------------------------------------------- */
.md-typeset .avi-module-foot {
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--avi-rule);
}

.md-typeset .avi-module-foot h2 {
  margin-top: 0;
  font-size: 1rem;
}

.md-typeset .avi-next__course {
  color: var(--avi-ink-2);
}

.md-typeset .avi-soon {
  color: var(--avi-ink-2);
}

.md-typeset .avi-channel {
  font-size: .8rem;
  color: var(--avi-ink-2);
}

/* Course landing pages: the module list is a real sequence ---------------- */
.md-typeset ol.avi-modules {
  padding-left: 1.4rem;
}

.md-typeset ol.avi-modules li {
  margin-bottom: .35rem;
}

.md-typeset .avi-status {
  color: var(--avi-ink-2);
}

/* Small screens ---------------------------------------------------------- */
@media screen and (max-width: 30em) {
  .md-typeset .avi-artifact {
    padding: 1.1rem 1rem 1rem;
    margin-left: -.2rem;
    margin-right: -.2rem;
  }
  .md-typeset .avi-widget {
    border-radius: 10px;
  }
}
