/* Element defaults, page shell, typography. */

*, *::before, *::after { box-sizing: border-box; }
html { font-size: var(--font-size); }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: var(--line-height);
  letter-spacing: var(--letter-spacing);
  word-spacing: var(--word-spacing);
}

h1, h2, h3 { line-height: 1.25; margin: 0 0 0.6em; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 1.4rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 0.75em; }
a { color: inherit; text-underline-offset: 0.2em; }
small, .muted { color: var(--text-muted); }
code { background: var(--surface-2); padding: 0.1em 0.35em; }

/* Keyboard users must always see where they are. */
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.skip-link { position: absolute; left: -999px; top: 0; background: var(--accent); color: var(--accent-contrast); padding: 0.5rem 1rem; z-index: 100; }
.skip-link:focus { left: 0; }

main { max-width: var(--max-width); margin: 0 auto; padding: 1.1rem var(--gap) 1.5rem; }
/* <main> is only focused by the router after navigation, for screen readers: it is not something to click, so no ring. */
main:focus { outline: none; }

/* The header is solid green, like the exam screen. Re-pointing the tokens here makes the buttons, menus
   and links inside it turn white-on-green without any per-element rules. */
.site-header {
  position: sticky; top: 0; z-index: 50;
  --bg: var(--brand); --surface-2: var(--brand-soft); --text: #ffffff; --text-muted: rgb(255 255 255 / 75%);
  --border-strong: #ffffff; --accent: #ffffff; --accent-contrast: var(--brand); --focus: #ffffff;
  background: var(--bg); color: var(--text);
}
[data-theme="dark"] .site-header { --bg: var(--brand-night); --surface-2: var(--brand-night2); --accent-contrast: var(--brand-night); }
[data-cb="protanopia"] .site-header, [data-cb="deuteranopia"] .site-header { --bg: #0b5cad; --surface-2: #2a7fd0; --accent-contrast: #0b5cad; }

.site-header .header-inner { max-width: var(--max-width); margin: 0 auto; padding: 0 var(--gap); display: flex; align-items: center; min-height: 3rem; }
.brand { display: flex; align-items: center; font-weight: 700; text-decoration: none; letter-spacing: 0.02em; }

kbd { font: inherit; font-size: 0.8em; border: 1px solid var(--border); padding: 0 0.35em; color: var(--text-muted); }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* sintat logo: the lockup is white, so it always sits on the brand green. */
.brand-logo { display: block; height: 1.75rem; width: auto; }
.brand-school { margin-left: 0.7rem; padding-left: 0.7rem; border-left: 1px solid var(--border-strong); color: var(--text-muted); font-weight: 600; white-space: nowrap; max-width: 14rem; overflow: hidden; text-overflow: ellipsis; }

/* Text is shown as it is written. `.ut` marks what people typed (names, titles) so it is never restyled. */
.ut { text-transform: none; }

/* ---- the top bar (signed in): brand, where to go, then search and your account menu on the right; on phones the links get their own scrolling row ---- */
.side-inner { display: flex; align-items: center; gap: 0.4rem 1rem; flex-wrap: nowrap; max-width: var(--max-width); margin: 0 auto; padding: 0.45rem var(--gap); min-height: 3rem; }
.side-inner .brand { padding: 0; flex: none; }
.side-nav, .site-header .side-nav { display: flex; flex: 0 1 auto; min-width: 0; gap: 0.15rem; align-items: center; flex-wrap: nowrap; }
.site-header .side-link { display: flex; align-items: center; gap: 0.4rem; padding: 0.3rem 0.7rem; border: 0; margin: 0; border-radius: var(--radius); color: var(--text-muted); text-decoration: none; white-space: nowrap; }
.side-link .icon { margin: 0; flex: none; width: 1.05rem; height: 1.05rem; }
.site-header .side-link:hover { background: rgb(255 255 255 / 12%); color: var(--text); }
.site-header .side-link[aria-current="page"] { background: var(--text); color: var(--bg); font-weight: 600; }
.side-search { margin-left: auto; flex: none; display: flex; align-items: center; gap: 0.5rem; padding: 0.3rem 0.6rem; border: 1px solid rgb(255 255 255 / 35%); border-radius: var(--radius); background: rgb(255 255 255 / 8%); color: var(--text-muted); font: inherit; cursor: pointer; white-space: nowrap; }
.side-search:hover { background: rgb(255 255 255 / 16%); color: var(--text); }
.side-search .icon { margin: 0; }
.side-search kbd { color: inherit; border-color: rgb(255 255 255 / 40%); font-size: 0.75em; }
.side-foot { flex: none; display: flex; align-items: center; }
.side-nav + .side-foot { margin-left: auto; }
@media (max-width: 100rem) { .side-search > span, .side-search kbd { display: none; } }
@media (max-width: 62rem) {
  .side-inner { flex-wrap: wrap; }
  .side-search { order: 2; }
  .side-foot { order: 3; }
  .side-nav, .site-header .side-nav { order: 5; flex: 1 0 100%; overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--gap)); padding: 0 var(--gap) 0.1rem; }
  .account-name { display: none; }
}

/* the account button: initial, name, and a menu with preferences, password and sign out */
.account-btn { display: inline-flex; align-items: center; gap: 0.45rem; padding: 0.2rem 0.45rem 0.2rem 0.2rem; border: 1px solid transparent; border-radius: var(--radius); background: none; color: var(--text); font: inherit; cursor: pointer; }
.account-btn:hover, .account-btn[aria-expanded="true"] { background: rgb(255 255 255 / 12%); border-color: rgb(255 255 255 / 25%); }
.account-btn .icon { margin: 0; width: 1rem; height: 1rem; color: var(--text-muted); }
.avatar { display: inline-grid; place-items: center; width: 1.8rem; height: 1.8rem; border-radius: var(--radius-round); background: var(--text); color: var(--bg); font-weight: 700; font-size: 0.85em; }
.account-name { max-width: 10rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-name .user-role { display: none; }
@media (max-width: 52rem) { .account-name { display: none; } }
/* on a phone the nav is icons, with the name of the page you are on, so every tab fits and none is cut off */
@media (max-width: 30rem) { .site-header .side-link:not([aria-current="page"]) .side-label { display: none; } }
.side-label { white-space: nowrap; }

/* not enough room on one line: the links become icons (see fitHeader) */
.side-inner.compact .side-link .side-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.side-inner.compact .site-header .side-link, .side-inner.compact .side-link { padding: 0.4rem 0.55rem; }
.side-inner.compact .account-name { display: none; }
