/* The solution card as the iPad draws it (SolutionLayout's Colours and metrics), on a page. */
@font-face { font-family: "NewCM10"; src: url("/fonts/NewCM10-Book.otf"); font-weight: 400; font-style: normal; }
@font-face { font-family: "NewCM10"; src: url("/fonts/NewCM10-BookItalic.otf"); font-weight: 400; font-style: italic; }
@font-face { font-family: "NewCM10"; src: url("/fonts/NewCM10-Bold.otf"); font-weight: 700; font-style: normal; }

:root {
  --paper: #ffffff; --page: #f2f2f4; --ink: #1a1a1a; --quiet: #666666; --rule: rgba(0, 0, 0, .12);
  --panel: rgba(0, 0, 0, .035); --raised: #ffffff;
  /* 4U Maths until the iPad says otherwise (ProjectUI CourseColour.mat4). */
  --course-accent: #ff6277; --course-wash: #ffe2e8; --course-ink: #914141;
  --size: 19px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1c1c1c; --page: #000000; --ink: #ededed; --quiet: #a8a8a8; --rule: rgba(255, 255, 255, .16);
    --panel: rgba(255, 255, 255, .06); --raised: #2b2b2b;
    --course-accent: #f0656f; --course-wash: #572b34; --course-ink: #de8283;
  }
}
@media (max-width: 600px) { :root { --size: 17px; } }

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--page); color: var(--ink); }
body { font: 15px/1.4 -apple-system, system-ui, sans-serif; -webkit-text-size-adjust: 100%; }

/* The bar: where the marker is. System font, as the card's chrome is. */
.bar {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 16px;
  padding: max(10px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--page) 82%, transparent); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--rule);
}
.where { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.tag { font: 700 26px/1 ui-rounded, -apple-system, system-ui, sans-serif; }
.meta { color: var(--quiet); font-size: 13px; font-weight: 500; white-space: nowrap; }
.paper { margin-left: auto; color: var(--quiet); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.live { width: 8px; height: 8px; border-radius: 4px; background: var(--quiet); flex: none; opacity: .5; }
.live[data-on="true"] { background: #34c759; opacity: 1; }
@media (max-width: 600px) { .paper { display: none; } .live { margin-left: auto; } }

main { max-width: 760px; margin: 0 auto; padding: 16px 16px max(32px, env(safe-area-inset-bottom)); }

.empty { margin: 18vh auto 0; max-width: 420px; text-align: center; }
.empty-title { font-size: 20px; font-weight: 600; margin-bottom: 6px; }
.empty-body { color: var(--quiet); }

/* The card. */
.card { background: var(--paper); border-radius: 16px; padding: 22px; font-family: "NewCM10", "Latin Modern Roman", serif; font-size: var(--size);
  line-height: 1.37; box-shadow: 0 1px 3px rgba(0, 0, 0, .08); overflow-wrap: break-word; }
@media (max-width: 600px) { .card { padding: 16px; border-radius: 12px; } }
.section + .section { margin-top: 32px; }
.section > * + * { margin-top: 20px; }
.b { font-weight: 700; } .i { font-style: italic; } .u { text-decoration: underline; }
.b.i { font-style: normal; } /* No bold-italic face, as on the iPad. */
.p + .p { margin-top: 6px; }
.block + .block { margin-top: 10px; }
.block.display, .block + .block.display, .block.display + .block { margin-top: 16px; }
.item { display: flex; gap: .5em; } .marker { flex: none; min-width: 1.1em; }
.heading { font-weight: 700; }
.blank { display: inline-block; border-bottom: 1px solid currentColor; height: 1em; vertical-align: baseline; }
.gap { display: inline-block; } .fill { display: inline-block; flex: 1; }

/* Maths: KaTeX at the words' size. A display equation too wide scrolls inside its own line, never the page. */
.katex { font-size: 1.02em; }
.m.display { display: block; overflow-x: auto; overflow-y: hidden; padding: 2px 0; }
.m.display .katex-display { margin: 0; }

.caption, .crop-note { font: 600 12px/1 -apple-system, system-ui, sans-serif; letter-spacing: .06em; text-transform: uppercase; color: var(--quiet); }
.caption.accent { color: var(--course-ink); margin-bottom: 12px; }
.caption-row { display: flex; align-items: center; justify-content: space-between; }
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 28px; height: 24px; padding: 0 8px; border-radius: 12px;
  background: var(--course-wash); color: var(--course-ink); font: 600 13px/1 -apple-system, system-ui, sans-serif; }
.badge.strong { background: var(--course-accent); color: #000; min-width: 32px; height: 32px; border-radius: 16px; font-size: 16px; }
.badge.quiet { background: var(--panel); color: var(--quiet); }

.part { display: flex; justify-content: space-between; align-items: center; font-weight: 700; color: var(--course-ink); }
.key { display: flex; justify-content: space-between; align-items: center; }
.option { display: flex; gap: 12px; padding: 4px 8px; border-radius: 8px; }
.option + .option { margin-top: 4px; }
.option .letter { font-weight: 700; min-width: 1.4em; }
.option.correct { background: var(--course-wash); color: var(--course-ink); }
.asked { color: var(--ink); }

.table-wrap { overflow-x: auto; }
table.grid { border-collapse: collapse; width: 100%; font-size: .8em; }
.grid th, .grid td { border: 1px solid var(--rule); padding: 8px; vertical-align: top; text-align: left; }
.grid th { background: var(--course-wash); color: var(--course-ink); font-weight: 700; }
.grid td.label { font-weight: 700; }
.criteria td.words { font-size: 1.125em; } /* 0.9 of the body, as the iPad's criteria rows. */
.criteria .marks { width: 76px; text-align: center; vertical-align: middle; }

.solution { background: var(--course-wash); border-left: 3px solid var(--course-accent); border-radius: 10px; padding: 14px; }
@media (prefers-color-scheme: dark) { .solution { background: color-mix(in srgb, var(--course-wash) 55%, var(--paper)); } }
.answer { margin-top: 20px; background: var(--raised); border-radius: 8px; padding: 10px 12px; }
.callout { background: var(--panel); border-radius: 8px; padding: 12px; }
.callout-title { font-style: italic; margin-bottom: 6px; }
.columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; }
.comments .comment { color: var(--quiet); font-size: .9em; margin-top: 6px; }

.figure-wrap { text-align: center; }
.figure img { max-width: min(100%, 420px); height: auto; }
@media (prefers-color-scheme: dark) { .invert-at-night img { filter: invert(1) hue-rotate(180deg); } }

/* The fallback: the printed solution, inverted by night as the iPad's crop is. */
.crop-note { margin-bottom: 12px; }
img.crop { display: block; width: 100%; height: auto; border-radius: 6px; }
@media (prefers-color-scheme: dark) { img.crop { filter: invert(.92) hue-rotate(180deg); } }


/* Sign out: quiet, at the bar's end, as on the other staff pages. */
.signout { flex: none; border: 0; background: none; color: var(--quiet); font: 500 13px/1 -apple-system, system-ui, sans-serif; padding: 6px 0; cursor: pointer; }
.signout:hover { color: var(--ink); }
@media (max-width: 600px) { .live { margin-left: auto; } }
