/* =====================================================================
   ITSB — components (shared primitives + site chrome)
   ===================================================================== */

/* ---- Buttons ---- */
.btn {
  --bg: var(--ink); --fg: #fff;
  display: inline-flex; align-items: center; justify-content: center; gap: .55em;
  font-family: var(--font-sans); font-weight: 600; font-size: var(--fs-sm); line-height: 1;
  padding: .92em 1.5em;
  border-radius: var(--r);
  border: 1px solid transparent;
  background: var(--bg); color: var(--fg);
  cursor: pointer; text-decoration: none;
  transition: transform var(--tr), box-shadow var(--tr), background var(--tr), color var(--tr), border-color var(--tr);
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 8px 22px -10px rgba(8,38,42,.5); color: var(--fg); }
.btn:active { transform: translateY(0); }
.btn--primary { --bg: var(--ink); --fg: #fff; }
.btn--primary:hover { --bg: var(--ink-700); }
.btn--accent  { --bg: var(--accent); --fg: #fff; }
.btn--accent:hover { --bg: var(--accent-700); }
.btn--brass   { --bg: var(--brass); --fg: #fff; }
.btn--brass:hover { --bg: var(--brass-deep); }
.btn--ghost   { --bg: transparent; --fg: var(--ink-2); border-color: var(--line-2); }
.btn--ghost:hover { --bg: var(--surface); box-shadow: 0 6px 16px -10px rgba(8,38,42,.4); }
.btn--lg { font-size: var(--fs-base); padding: 1.04em 1.9em; }
.btn--block { display: flex; width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
/* A pressed button shows it is working: a slow sheen across the face, the label dimmed a touch,
   and no further presses (quiz.js pressBtn()). It outranks the disabled fade so a wait the
   script imposes reads as progress, not as a dead control. */
.btn.is-busy, .btn.is-busy[disabled] { position: relative; overflow: hidden; opacity: .85; cursor: progress; pointer-events: none; transform: none; box-shadow: none; }
.btn.is-busy::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 25%, rgba(255,255,255,.28) 50%, transparent 75%); transform: translateX(-100%); animation: btn-sheen 1.1s ease-in-out infinite; }
.btn--ghost.is-busy::after { background: linear-gradient(100deg, transparent 25%, rgba(14,53,58,.08) 50%, transparent 75%); }
@keyframes btn-sheen { to { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { .btn.is-busy { opacity: .7; } .btn.is-busy::after { animation: none; } }

.linkarrow {
  display: inline-flex; align-items: center; gap: .4em;
  font-weight: 600; font-size: var(--fs-sm); color: var(--ink-2);
}
.linkarrow .ar { transition: transform var(--tr); }
.linkarrow:hover { color: var(--accent); }
.linkarrow:hover .ar { transform: translateX(3px); }

/* ---- Kicker — the rule + label motif ---- */
.kicker {
  display: inline-flex; align-items: center; gap: .75rem;
  font-family: var(--font-mono); font-size: .72rem; font-weight: 500;
  letter-spacing: .22em; text-transform: uppercase; color: var(--brass-deep);
}
.kicker::before { content: ""; width: 30px; height: 1px; background: var(--brass); opacity: .8; }
.kicker.is-light { color: var(--brass-2); }
.kicker.is-center { justify-content: center; }

/* ---- Card / panel ---- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--sp-5); box-shadow: var(--shadow-sm); }
.card--lg { padding: var(--sp-6); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }

/* ---- Badges & pills ---- */
.badge {
  display: inline-flex; align-items: center; gap: .45em;
  font-family: var(--font-mono); font-size: var(--fs-xs); font-weight: 500; letter-spacing: .04em;
  padding: .4em .7em; border-radius: var(--r-sm);
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--line);
}
.badge--open   { background: var(--correct-bg); color: #13633b; border-color: var(--correct-line); }
.badge--closed { background: var(--paper-2); color: var(--faint); border-color: var(--line); }
.badge--brass  { background: var(--brass-soft); color: var(--brass-deep); border-color: #e2d2ad; }

.pill {
  display: inline-flex; align-items: center; gap: .4em;
  font-size: var(--fs-xs); font-weight: 600;
  padding: .4em .85em; border-radius: var(--r-pill);
  background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line);
}

/* ---- Status dot ---- */
.dot { width: .55rem; height: .55rem; border-radius: 50%; display: inline-block; background: var(--faint); flex: none; }
.dot--ok { background: var(--correct); }
.dot--warn { background: var(--warn); }
.dot--off { background: var(--line-2); }

/* ---- Forms ---- */
.field { margin-bottom: var(--sp-4); }
.label { display: block; font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); margin-bottom: .4em; }
.input, .select, textarea.input {
  width: 100%;
  font-family: var(--font-sans); font-size: var(--fs-base); color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-2); border-radius: var(--r);
  padding: .8em .9em;
  transition: border-color var(--tr), box-shadow var(--tr);
}
.input::placeholder { color: var(--faint); }
.input:focus, .select:focus, textarea.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus); }
.hint { font-size: var(--fs-xs); color: var(--muted); margin-top: .4em; }

/* ---- Level scale (brand signature) ---- */
.level-scale { display: inline-flex; align-items: flex-end; gap: .3rem; }
.level-scale .lv { width: .48rem; background: var(--line-2); border-radius: 1.5px; }
.level-scale .lv.on { background: var(--brass); }
.level-scale .lv:nth-child(1) { height: .55rem; }
.level-scale .lv:nth-child(2) { height: .85rem; }
.level-scale .lv:nth-child(3) { height: 1.15rem; }
.level-scale .lv:nth-child(4) { height: 1.45rem; }
.level-scale .lv:nth-child(5) { height: 1.75rem; }
.level-scale.is-1 .lv:nth-child(-n+1),
.level-scale.is-2 .lv:nth-child(-n+2),
.level-scale.is-3 .lv:nth-child(-n+3),
.level-scale.is-4 .lv:nth-child(-n+4),
.level-scale.is-5 .lv:nth-child(-n+5) { background: var(--brass); }
.lvtag {
  display: inline-flex; align-items: center; gap: .5rem;
  font-family: var(--font-mono); font-size: .72rem; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted);
}

/* ---- Answer option states (quiz) ---- */
.answer {
  display: flex; gap: .8rem; align-items: flex-start; width: 100%;
  text-align: left; background: var(--surface);
  border: 1.5px solid var(--line-2); border-radius: var(--r);
  padding: 1em 1.1em; font: inherit; color: var(--text); cursor: pointer;
  transition: border-color var(--tr), background var(--tr), box-shadow var(--tr);
}
.answer:hover { border-color: var(--accent); box-shadow: var(--shadow-sm); }
.answer .key {
  flex: none; width: 1.7rem; height: 1.7rem; border-radius: var(--r-sm);
  display: grid; place-items: center;
  font-family: var(--font-mono); font-size: var(--fs-sm);
  background: var(--surface-2); border: 1px solid var(--line-2); color: var(--muted);
}
.answer.is-correct { border-color: var(--correct-line); background: var(--correct-bg); }
.answer.is-correct .key { background: var(--correct); border-color: var(--correct); color: #fff; }
.answer.is-wrong { border-color: var(--wrong-line); background: var(--wrong-bg); }
.answer.is-wrong .key { background: var(--wrong); border-color: var(--wrong); color: #fff; }
.answer.is-disabled { cursor: default; pointer-events: none; }

/* ---- Brand mark ---- */
.brandmark { display: inline-flex; align-items: center; gap: .75rem; }
.brandmark .seal { flex: none; }
.brandmark .wordmark {
  font-family: var(--font-display); font-weight: 600; color: var(--ink-2);
  font-size: 1.35rem; line-height: 1; letter-spacing: .06em;
}
.brandmark .wordmark small {
  display: block; max-width: 30ch;
  font-family: var(--font-mono); font-weight: 400; font-size: .73rem;
  letter-spacing: .13em; text-transform: uppercase; color: var(--brass-deep);
  margin-top: .34rem; line-height: 1.3;
}

/* ---- Institutional masthead strip ---- */
.masthead { background: var(--ink-2); color: var(--on-dark-muted); }
.masthead.is-accreditation {
  background: var(--ink);
  border-bottom: 2px solid var(--brass);
}
.masthead.is-accreditation .in { padding-block: .3rem; }
.masthead .in {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-block: .5rem;
  font-family: var(--font-mono); font-size: .73rem; letter-spacing: .16em;
  text-transform: uppercase; text-align: left;
}
.masthead-context { min-width: 0; white-space: nowrap; }
/* The cross-link between the educator site and the institutional one. It lives here
   rather than in corp.css because both sides of the site render it. */
.masthead-cross {
  margin-left: .9rem; padding-left: .9rem;
  border-left: 1px solid rgba(255, 255, 255, .22);
  color: inherit; text-decoration: none; white-space: nowrap;
}
.masthead-cross:hover { text-decoration: underline; }
.masthead-right { display: inline-flex; align-items: center; gap: 0; }
@media (max-width: 900px) {
  .masthead .in { flex-wrap: wrap; justify-content: center; text-align: center; }
  .masthead-context { width: 100%; white-space: normal; }
  .masthead-right { width: 100%; justify-content: center; margin-top: .35rem; }
  .masthead-cross { padding-left: .9rem; }
}

/* ---- Language picker (inc/lang_picker.php) ----
   A <details> and a list of links: it has to work on the first paint, because a visitor
   who cannot read the page will not wait for a script to load. The open menu is absolute,
   so it does not push the masthead taller when it opens. */
.lang-pick { position: relative; }
.lang-pick > summary {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .1rem .9rem; cursor: pointer; list-style: none;
  border-left: 1px solid rgba(255, 255, 255, .22);
  color: inherit; white-space: nowrap;
}
.lang-pick > summary::-webkit-details-marker { display: none; }
.lang-pick > summary:hover { color: #fff; }
.lp-globe { width: .95rem; height: .95rem; opacity: .8; }
.lp-caret { width: .5rem; height: .4rem; opacity: .7; }
.lang-pick[open] > summary { color: #fff; }
.lp-menu {
  position: absolute; z-index: 60; top: calc(100% + .45rem); right: 0;
  min-width: 9.5rem; margin: 0; padding: .3rem; list-style: none;
  background: var(--paper); border: 1px solid var(--line-2);
  border-radius: var(--r-sm); box-shadow: 0 10px 26px rgba(14, 53, 58, .16);
  text-align: left;
}
.lp-menu a {
  display: block; padding: .5rem .7rem;
  font-family: var(--font-sans); font-size: var(--fs-sm);
  letter-spacing: 0; text-transform: none;
  color: var(--text); text-decoration: none; border-radius: var(--r-sm);
}
.lp-menu a:hover { background: var(--surface-2); color: var(--ink); }
.lp-menu a.is-on { color: var(--ink); font-weight: 600; }
.lp-menu a.is-on::after { content: " ✓"; color: var(--brass-deep); }
@media (max-width: 700px) {
  /* The picker sits at the left edge of the compact masthead. Centring a 9.5rem menu on
     that summary pushes it outside the viewport and creates a horizontal page scrollbar. */
  .lp-menu { right: auto; left: 0; transform: none; }
}

/* ---- Site header ---- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--paper);
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  backdrop-filter: saturate(1.1) blur(9px);
  -webkit-backdrop-filter: saturate(1.1) blur(9px);
  border-bottom: 1px solid var(--line);
}
.site-header .bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-block: .85rem; }
.site-nav { position: relative; display: flex; align-items: center; gap: 1.7rem; }
.site-nav .links { display: flex; align-items: center; gap: 1.7rem; }
.site-nav a.nav { font-size: var(--fs-sm); font-weight: 500; color: var(--ink-2); padding-block: .2rem; border-bottom: 1px solid transparent; }
.site-nav a.nav:hover { color: var(--ink-2); border-bottom-color: var(--brass); }
.site-menu { display: none; }
.site-menu > summary {
  cursor: pointer;
  list-style: none;
  padding: .58rem .78rem;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  color: var(--ink-2);
  font-size: var(--fs-sm);
  font-weight: 600;
  line-height: 1;
}
.site-menu > summary::-webkit-details-marker { display: none; }
.site-menu > summary::after { content: " +"; color: var(--brass-deep); }
.site-menu[open] > summary::after { content: " −"; }
.site-menu-panel {
  position: absolute;
  z-index: 70;
  top: calc(100% + .55rem);
  right: 0;
  width: min(18rem, calc(100vw - 2rem));
  padding: .45rem;
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.site-menu-panel a {
  display: block;
  padding: .7rem .75rem;
  border-radius: var(--r-sm);
  color: var(--ink-2);
  font-size: var(--fs-sm);
  text-decoration: none;
}
.site-menu-panel a:hover { background: var(--surface-2); }
@media (max-width: 1050px) and (min-width: 861px) {
  .brandmark .wordmark small { display: none; }
  .site-nav, .site-nav .links { gap: 1rem; }
  .site-nav a.nav { font-size: .85rem; }
}
@media (max-width: 860px) {
  .site-nav .links { display: none; }
  .site-menu { display: block; }
  .brandmark .wordmark small { display: none; }
}

/* ---- Site footer ---- */
.site-footer {
  background: var(--ink-2); color: var(--on-dark-muted);
  border-top: 2px solid var(--brass);
  padding-block: var(--sp-8) var(--sp-6);
  margin-top: var(--sp-9);
}
.site-footer .cols { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 2rem; }
.site-footer a { color: var(--on-dark); }
.site-footer a:hover { color: #fff; }
.site-footer .wordmark { color: #fff; }
.site-footer .wordmark small { color: var(--brass-2); }
.foot-blurb { margin-top: 1.1rem; max-width: 40ch; font-size: var(--fs-sm); color: var(--on-dark-muted); }
.foot-h { color: #fff; font-family: var(--font-mono); font-size: .73rem; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; margin: 0 0 1.1rem; }
.foot-links { list-style: none; margin: 0; padding: 0; }
.foot-links li { margin: 0 0 .65rem; }
.foot-links a { font-size: var(--fs-sm); }
.legal { font-size: var(--fs-xs); color: var(--on-dark-muted); line-height: 1.65; border-top: 1px solid var(--on-dark-line); margin-top: var(--sp-6); padding-top: var(--sp-4); max-width: 80ch; }
/* The site-wide rule paints bold text in ink, which is invisible here: the footer is dark
   and the accreditation disclaimer leads with a bold sentence. */
.legal strong, .legal b { color: var(--on-dark); }
@media (max-width: 720px) { .site-footer .cols { grid-template-columns: 1fr; gap: 2.2rem; } }

/* ---- Small layout helpers ---- */
.row { display: flex; gap: var(--sp-4); align-items: center; flex-wrap: wrap; }
.stack > * + * { margin-top: var(--sp-4); }
.grid { display: grid; gap: var(--sp-4); }
