/* Nottingham navy and neutral tints; status colours always have a text label. */
:root {
  color-scheme: light dark;
  --navy: #10263b; --bg: #f4f6f8; --surface: #fff; --surface-soft: #f5f7f9;
  --ink: #10263b; --ink-2: #405162; --muted: #586776;
  --line: #dce2e7; --line-soft: #eaf0f3; --accent: #1e4f70; --focus: #32749c;
  --success-bg: #e5f1e9; --success-ink: #005f36;
  --draft-bg: #fff0dc; --draft-ink: #815016;
  --shadow: 0 2px 6px rgb(16 38 59 / 3%);
}
@media screen and (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1722; --surface: #122636; --surface-soft: #182e40;
    --ink: #edf2f6; --ink-2: #ced9e2; --muted: #a6b7c5;
    --line: #324858; --line-soft: #253c4d; --accent: #acd2ec; --focus: #acd2ec;
    --success-bg: #163e32; --success-ink: #a4d5bc;
    --draft-bg: #40321e; --draft-ink: #f3cc91; --shadow: none;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Circular", "Circular Std", -apple-system, BlinkMacSystemFont,
               "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px; line-height: 1.6; -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-underline-offset: .2em; }
a:hover { text-decoration-thickness: 2px; }
button, input { font: inherit; }
button, summary, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
main:focus { outline: none; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
.skip-link { position: absolute; top: -6rem; left: 1rem; z-index: 10; padding: .65rem 1rem; background: var(--surface); color: var(--ink); }
.skip-link:focus { top: 1rem; }

/* University masthead, distinct from the page heading. */
.banner { background: var(--navy); color: #fff; }
.banner-inner { max-width: 76rem; min-height: 88px; margin: auto; padding: .85rem 2rem; display: flex; justify-content: space-between; align-items: center; gap: 1.5rem; }
.brand { display: flex; align-items: center; gap: 1.5rem; color: #fff; text-decoration: none; }
.brand-logo { display: block; width: 156px; height: auto; }
.brand-title { border-left: 1px solid #516171; padding-left: 1.5rem; font-size: .95rem; font-weight: 550; white-space: nowrap; }
.account-nav { display: flex; align-items: center; flex-wrap: wrap; gap: 1.25rem; font-size: .82rem; }
.account-nav a { color: #e2e9ef; text-decoration: none; padding: .4rem 0; }
.account-nav a:hover, .account-nav a[aria-current] { color: #fff; text-decoration: underline; }
.account-name { color: #bdcbd6; }
.account-nav .sign-out { white-space: nowrap; }
.sign-out span { margin-left: .3rem; }
.banner :focus-visible { outline-color: #b8d8ee; }

main { max-width: 68rem; margin: auto; padding: 2.75rem 2rem 1rem; }
.page-heading { margin-bottom: 2rem; }
.eyebrow { margin: 0 0 .45rem; color: var(--muted); font-size: .72rem; font-weight: 650; letter-spacing: .13em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(1.9rem, 4vw, 2.6rem); font-weight: 650; line-height: 1.2; letter-spacing: -.035em; overflow-wrap: anywhere; }
.page-description { margin: .75rem 0 0; color: var(--ink-2); font-size: .95rem; max-width: 44rem; }
.page-description:empty { display: none; }
.portfolio-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .8rem 1.5rem; margin-bottom: 1.5rem; }
.year-picker { display: flex; align-items: center; flex-wrap: wrap; gap: .7rem 1.1rem; }
.toolbar-label, .module-count { font-size: .8rem; color: var(--muted); }
.yearnav { display: flex; flex-wrap: wrap; gap: .3rem; }
.yearnav a, .yearnav .year-on { display: inline-flex; align-items: center; min-height: 40px; padding: .45rem .85rem; font-size: .82rem; font-weight: 550; border: 1px solid transparent; border-radius: 6px; text-decoration: none; white-space: nowrap; }
.yearnav a { color: var(--ink-2); }
.yearnav a:hover { background: var(--surface); border-color: var(--line); }
.yearnav .year-on { background: var(--surface); color: var(--ink); border-color: var(--line); box-shadow: var(--shadow); }
.single-year { font-size: .85rem; font-weight: 600; }
.portfolio-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .75rem 1.1rem; }
.export-help { margin: -0.5rem 0 1.5rem; color: var(--muted); font-size: .78rem; }
.print-only { display: none; }
.print-loading-warning { display: none; }
.portfolio-progress { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: .4rem 1.5rem; margin: -.25rem 0 1.5rem; color: var(--muted); font-size: .8rem; }
.portfolio-progress p { margin: 0; }
.module-placeholder { min-height: 180px; }
.module-loading { display: flex; align-items: center; gap: .65rem; margin: 0; color: var(--muted); font-size: .85rem; }
.module-spinner { display: inline-block; width: 1rem; height: 1rem; flex-shrink: 0; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: module-spin .8s linear infinite; }
.module-skeleton { display: grid; gap: .75rem; margin-top: 1.4rem; }
.module-skeleton span { height: .55rem; width: 88%; background: var(--line-soft); border-radius: 3px; }
.module-skeleton span:nth-child(2) { width: 68%; }
.module-skeleton span:nth-child(3) { width: 77%; }
.retry-module { margin-top: .5rem; }
.button:disabled { opacity: .55; cursor: not-allowed; }
@keyframes module-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .module-spinner { animation: none; } }

/* A module is one surface, with subtle dividers between its sections. */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 1.75rem 2rem; margin-bottom: 1.5rem; }
.course-card { padding: 0; overflow: hidden; }
.course-head { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; padding: 1.65rem 2rem; border-bottom: 1px solid var(--line); }
.course-title { min-width: 0; }
.course-title .eyebrow { font-size: .67rem; margin-bottom: .35rem; }
.course-head h2 { margin: 0; font-size: 1.3rem; font-weight: 650; line-height: 1.35; letter-spacing: -.02em; overflow-wrap: anywhere; }
.stat { flex: 0 0 218px; border-left: 1px solid var(--line); padding-left: 1.5rem; text-align: right; }
.stat .num { display: block; font-size: 1.5rem; font-weight: 600; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat .label { display: block; font-size: .74rem; margin-top: .25rem; color: var(--ink-2); }
.stat-note { display: block; font-size: .75rem; color: var(--muted); line-height: 1.45; margin-top: .55rem; }
.meter { height: 3px; overflow: hidden; border-radius: 2px; background: var(--line); margin: .65rem 0 0 auto; width: 100%; }
.meter > span { display: block; height: 100%; background: var(--muted); }
.course-body { padding: 1.65rem 2rem 1.9rem; }
.section-heading { margin: 0 0 .8rem; font-size: .85rem; font-weight: 650; letter-spacing: .015em; }

/* Full-width feedback sits directly beneath the corresponding assessment. */
.table-wrap { min-width: 0; }
.grade-table { border-collapse: collapse; width: 100%; table-layout: fixed; font-size: .88rem; }
.grade-table .assessment-column { width: 55%; }
.grade-table .mark-column, .grade-table .range-column, .grade-table .percentage-column { width: 15%; }
.grade-table thead th { padding: .65rem .75rem; font-size: .7rem; font-weight: 550; color: var(--muted); background: var(--surface-soft); text-align: left; }
.grade-table thead th:first-child { border-radius: 5px 0 0 5px; }
.grade-table thead th:last-child { border-radius: 0 5px 5px 0; }
.grade-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.grade-row th, .grade-row td { padding: 1.05rem .75rem; vertical-align: top; overflow-wrap: anywhere; }
.assessment-name { font-weight: 500; text-align: left; }
.assessment-name a { color: var(--ink); text-decoration-color: var(--line); }
.assessment-name a:hover { color: var(--accent); text-decoration-color: currentColor; }
.grade-row .mark { font-weight: 650; font-size: .95rem; }
.grade-row .range, .grade-row .percentage { color: var(--ink-2); }
.assessment + .assessment { border-top: 1px solid var(--line-soft); }
.mobile-label { display: none; }
.feedback-row td { padding: 0 .75rem 1.1rem; }
.feedback { padding: .85rem 1.1rem; background: var(--surface-soft); border-radius: 6px; }
.feedback-label { display: block; color: var(--muted); font-size: .72rem; font-weight: 600; margin-bottom: .3rem; }
.rich-text { color: var(--ink-2); font-size: .9rem; line-height: 1.75; overflow-wrap: anywhere; }
.rich-text > :first-child { margin-top: 0; }
.rich-text > :last-child { margin-bottom: 0; }
.rich-text p { margin: .7rem 0; }
.rich-text img, .rich-text video, .rich-text svg { max-width: 100%; height: auto; }
.rich-text pre { max-width: 100%; overflow-x: auto; white-space: pre-wrap; }
.rich-text table { display: block; max-width: 100%; overflow-x: auto; }
.rich-text blockquote { margin: .75rem 0; padding-left: 1rem; border-left: 2px solid var(--line); }

/* Native disclosure keeps the quiz section usable without JavaScript. */
details.quizzes { margin-top: 1.5rem; border-top: 1px solid var(--line); }
details.quizzes:first-child { margin-top: 0; border-top: 0; }
details.quizzes summary { cursor: pointer; padding: 1rem 0; font-size: .85rem; font-weight: 600; color: var(--ink-2); }
details.quizzes summary::marker { color: var(--muted); font-size: .75em; }
details.quizzes summary:hover { color: var(--accent); }
details.quizzes[open] summary { padding-bottom: .85rem; }
.reflections-section { border-top: 1px solid var(--line); margin-top: 1.6rem; padding-top: 1.4rem; }
.reflection { padding: 1.2rem 0; }
.reflection + .reflection { border-top: 1px solid var(--line-soft); }
.reflection:last-child { padding-bottom: 0; }
.reflection-head { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: .65rem 1rem; }
.reflection h4 { margin: 0; font-size: .95rem; font-weight: 550; }
.reflection h4 a { color: var(--ink); text-decoration-color: var(--line); }
.meta { display: flex; flex-wrap: wrap; gap: .3rem 1.2rem; color: var(--muted); font-size: .75rem; margin: .4rem 0 .9rem; }
.reflection-body { max-width: 70ch; border-left: 2px solid var(--line); padding-left: 1.1rem; margin-top: 1rem; }
.submission-files { list-style: none; margin: 1rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .4rem; }
.submission-files a { display: inline-flex; align-items: baseline; gap: .5rem; color: var(--ink); text-decoration-color: var(--line); word-break: break-word; }
.submission-files a::before { content: "\2193"; color: var(--muted); font-weight: 600; }
.group-tag { display: inline-block; margin-top: .4rem; font-size: .78rem; color: var(--muted); font-weight: 550; }
.files-label { margin: .7rem 0 .1rem; font-size: .72rem; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.chip { display: inline-flex; align-items: center; gap: .4rem; padding: .2rem .6rem; border-radius: 5px; background: var(--surface-soft); color: var(--muted); font-size: .7rem; font-weight: 600; white-space: nowrap; }
.chip .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.chip.ok { background: var(--success-bg); color: var(--success-ink); }
.chip.warn { background: var(--draft-bg); color: var(--draft-ink); }
.empty, .unavailable { color: var(--muted); font-size: .9rem; margin: .3rem 0; }

.searchform { display: flex; align-items: center; flex-wrap: wrap; gap: .75rem; }
.searchform input[type="search"] { flex: 1; min-width: 0; width: 100%; padding: .8rem 1rem; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); }
.searchform input::placeholder { color: var(--muted); }
.button { display: inline-flex; align-items: center; justify-content: center; padding: .8rem 1.25rem; border: 1px solid transparent; border-radius: 6px; background: var(--navy); color: #fff; font-size: .88rem; font-weight: 550; text-decoration: none; cursor: pointer; }
.button:hover { background: #28455e; }
.export-button { min-height: 40px; padding: .45rem .85rem; font-size: .82rem; background: var(--surface); color: var(--ink); border-color: var(--line); }
.export-button:hover { background: var(--surface-soft); }
.export-button[hidden] { display: none; }
.search-results > .empty, .search-results > .unavailable { margin-top: 1.2rem; }
.search-status { color: var(--muted); font-size: .9rem; margin: 1.2rem 0 0; }
.search-status:empty { margin: 0; }
.searchform .button { gap: .6rem; min-width: 8.5rem; }
.searchform[aria-busy="true"] .button::before {
  content: ""; width: 1em; height: 1em; flex-shrink: 0;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  animation: search-spin .8s linear infinite;
}
@keyframes search-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .searchform[aria-busy="true"] .button::before { animation: none; }
}
.linklist { margin-top: 1.25rem; }
.linklist a { display: flex; justify-content: space-between; align-items: center; gap: 1rem; color: var(--ink); text-decoration: none; padding: 1rem .5rem; border-bottom: 1px solid var(--line-soft); }
.linklist .result-arrow { color: var(--muted); }
.linklist a:last-child { border-bottom: 0; }
.linklist a:hover { background: var(--surface-soft); color: var(--accent); }
.hero { padding: 2.25rem; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.hero h2 { font-size: 1.45rem; font-weight: 600; letter-spacing: -.02em; line-height: 1.35; max-width: 28rem; margin: 0 0 1rem; }
.hero p { max-width: 38rem; color: var(--ink-2); margin: 0 0 1.5rem; }
.site-footer { max-width: 68rem; margin: auto; padding: .6rem 2rem 2.5rem; display: flex; justify-content: space-between; flex-wrap: wrap; gap: .4rem 1rem; font-size: .75rem; color: var(--muted); }

@media screen and (max-width: 760px) {
  .banner-inner { padding: .9rem 1.25rem; gap: .75rem 1.5rem; flex-wrap: wrap; }
  .brand-logo { width: 135px; }
  .brand, .account-nav { gap: 1rem; }
  .brand-title { padding-left: 1rem; font-size: .85rem; }
  .account-nav { font-size: .78rem; }
  .account-name { display: none; }
  main { padding: 2rem 1.25rem .75rem; }
  .page-heading { margin-bottom: 1.5rem; }
  .course-head, .course-body, .card { padding: 1.4rem; }
  .course-card { padding: 0; }
  .course-head { align-items: flex-start; }
  .stat { flex-basis: 180px; padding-left: 1rem; }
  .site-footer { padding: .5rem 1.25rem 2rem; }
}
@media screen and (max-width: 560px) {
  .banner-inner { min-height: 76px; }
  .brand-logo { width: 125px; }
  .brand-title { font-size: .8rem; }
  main { padding: 1.65rem 1rem .5rem; }
  .page-description { font-size: .88rem; }
  .portfolio-toolbar { align-items: flex-start; }
  .year-picker { gap: .4rem; }
  .toolbar-label { width: 100%; }
  .yearnav { gap: .15rem; }
  .yearnav a, .yearnav .year-on { padding: .35rem .65rem; }
  .module-count { padding-top: .1rem; }
  .course-head { display: block; padding: 1.2rem; }
  .course-head h2 { font-size: 1.2rem; }
  .course-body { padding: 1.2rem; }
  .stat { margin-top: 1.1rem; padding: .9rem 0 0; border-left: 0; border-top: 1px solid var(--line); text-align: left; display: grid; grid-template-columns: auto 1fr; column-gap: 1rem; }
  .stat .num { grid-row: 1 / 3; align-self: center; }
  .stat .label { grid-column: 2; margin: 0; }
  .stat .meter { grid-column: 2; margin-top: .4rem; }
  .stat-note { grid-column: 1 / -1; font-size: .7rem; }
  .grade-table, .grade-table tbody { display: block; width: 100%; }
  .grade-table colgroup { display: none; }
  .grade-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .grade-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .65rem .5rem; padding: .9rem 0; }
  .grade-row .assessment-name { grid-column: 1 / -1; padding: 0; font-size: .92rem; }
  .grade-table .grade-row td { display: block; padding: 0; text-align: left; }
  .mobile-label { display: block; color: var(--muted); font-size: .65rem; font-weight: 500; margin-bottom: .1rem; }
  .grade-row .mark { font-size: 1rem; }
  .feedback-row { display: block; }
  .feedback-row td { display: block; padding: 0 0 1rem; }
  .feedback { padding: .8rem .9rem; }
  .rich-text { font-size: .9rem; }
  .reflection-head { gap: .6rem; }
  .reflection-body { padding-left: .85rem; }
  .hero, .card:not(.course-card) { padding: 1.4rem; }
  .hero h2 { font-size: 1.25rem; }
  .hero .button { width: 100%; text-align: center; }
  .searchform { align-items: stretch; }
  .searchform input[type="search"] { flex-basis: 100%; }
  .searchform .button { width: 100%; }
  .site-footer { padding-right: 1rem; padding-left: 1rem; }
}
