/* MAT040 class pages. Colours, buttons, the top bar and focus styles come from ../assets/theme.css (shared by every class). */
:root { --side: 280px; }

/* layout */
.layout { display: flex; align-items: flex-start; }
.menu-btn { display: none; background: transparent; border: 1px solid rgba(255,255,255,.7); color: var(--bar-ink); border-radius: 8px; font-size: 20px; width: 40px; height: 38px; cursor: pointer; }
.menu-btn:hover { background: rgba(255,255,255,.16); }
.score { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 14px; }
.score .bar { width: 120px; height: 8px; background: rgba(255,255,255,.3); border-radius: 4px; overflow: hidden; }
.score #scorebar { height: 100%; width: 0; background: #9be8b8; transition: width .3s; }
.sidebar { position: sticky; top: 54px; flex: 0 0 var(--side); width: var(--side); height: calc(100vh - 54px); overflow-y: auto; padding: 16px 12px 40px 16px; background: var(--wash); border-right: 1px solid var(--line); font-size: 15px; }
.sidebar a { display: block; padding: 6px 8px; border-radius: 6px; text-decoration: none; color: var(--ink); line-height: 1.35; }
.sidebar a:hover { background: var(--accent-2); }
.sidebar a.current { background: var(--accent-2); font-weight: 600; color: var(--link); }
.sidebar .home-link { font-weight: 700; margin-bottom: 4px; }
.sidebar .all-classes { color: var(--link); text-decoration: underline; font-size: 14px; margin-bottom: 2px; }
.sidebar .part-title { margin: 14px 8px 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.sidebar .num { display: inline-block; min-width: 1.6em; color: var(--muted); }
.sidebar .onpage { margin: 2px 0 8px 22px; padding-left: 8px; border-left: 2px solid var(--line); font-size: 14px; }
.sidebar .onpage a { padding: 5px 6px; color: var(--muted); }
.sidebar .onpage a:hover { color: var(--ink); }
main { flex: 1; min-width: 0; max-width: 900px; padding: 28px 34px 80px; margin: 0 auto; }

/* typography */
h1 { font-size: 2rem; line-height: 1.2; margin: .2em 0 .6em; }
h2 { font-size: 1.45rem; margin: 2em 0 .5em; padding-bottom: .2em; border-bottom: 2px solid var(--accent-2); }
h3 { font-size: 1.15rem; margin: 1.6em 0 .4em; color: var(--link); }
p { margin: .7em 0; }
.eyebrow { margin: 0; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.lead { font-size: 1.15rem; color: var(--muted); }
.muted { color: var(--muted); }
.howto { background: var(--accent-2); border-left: 4px solid var(--link); padding: 10px 14px; border-radius: 6px; font-size: .95rem; }
.howto-box { background: var(--wash); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 20px 12px; margin: 20px 0; }
.howto-box h2 { border: 0; margin-top: .8em; font-size: 1.15rem; }
.display { margin: .8em 0; overflow-x: auto; overflow-y: hidden; padding: 2px 0; }
.display .katex-display { margin: .3em 0; }
.center { text-align: center; }
.center p { margin: .5em 0; }
.keybox { border: 1.5px solid var(--ink); border-radius: 4px; padding: 6px 16px; margin: 1em 0; background: var(--key-bg); }
.keybox p { margin: .5em 0; }
.keybox .display { margin: .4em 0; }
ul, ol { padding-left: 1.5em; }
li { margin: .25em 0; }
li > p { margin: .2em 0; }
.tablewrap { overflow-x: auto; margin: 1em auto; }
table.nt { border-collapse: collapse; margin: 0 auto; }
table.nt th { padding: 5px 12px; font-weight: 700; text-align: center; }
table.nt td { padding: 5px 12px; vertical-align: top; }
table.nt td.br, table.nt th.br { border-right: 1px solid var(--ink); }
table.nt td.bl, table.nt th.bl { border-left: 1px solid var(--ink); }
table.nt tr.hl td, table.nt tr.hl th { border-top: 1px solid var(--ink); }
figure { margin: 1em auto; text-align: center; }
figcaption { color: var(--muted); font-size: .9rem; margin-top: .3em; }
/* figures: drawn at 2x their natural size (width and height attributes are set when the pages are built), never wider than the column */
img.fig { max-width: 100%; height: auto; vertical-align: middle; filter: var(--fig-filter); }
.figure-inline, .center img.fig { margin: .6em .8em; }
.attrib { margin-top: 3em; font-size: .88rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: 12px; }
.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 28px; flex-wrap: wrap; }
.pager a { padding: 10px 16px; border: 1px solid var(--ctl-border); border-radius: var(--radius); text-decoration: none; font-weight: 600; }
.pager a:hover { background: var(--accent-2); }
.chapter-group { margin: 28px 0; }
.chapter-list { list-style: none; padding: 0; }
.chapter-list li { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; flex-wrap: wrap; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius); margin: 8px 0; position: relative; }
.chapter-list li:hover { background: var(--accent-2); }
.chapter-list a { text-decoration: none; }
.chapter-list a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.chapter-list a:focus-visible { outline: none; }
.chapter-list a:focus-visible::after { outline: 3px solid var(--focus); outline-offset: 2px; }
.chapter-list .meta { color: var(--muted); font-size: .88rem; }

/* examples */
.example { border: 1px solid var(--line); border-left: 5px solid var(--link); border-radius: var(--radius); margin: 1.4em 0; background: var(--paper); box-shadow: 0 1px 3px var(--shadow); }
.example.done { border-left-color: var(--good); }
.ex-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 16px 0; }
.ex-label { font-weight: 700; border: 1.5px solid var(--ink); padding: 1px 8px; border-radius: 3px; }
.ex-status { color: var(--good); font-weight: 600; font-size: .9rem; }
.ex-btns { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.ex-body { padding: 4px 16px 6px; }
.ex-body > p:first-child { margin-top: .4em; }
.ex-instr { margin: .5em 0; }
.ex-display { margin: .4em 0; overflow-x: auto; }
.ex-figure { margin: .6em 0; text-align: center; overflow-x: auto; }
.ex-figure svg, .part-main svg { max-width: 100%; height: auto; }
.hint { color: var(--muted); font-size: .9rem; margin: .3em 0; }
.part { display: flex; gap: 10px; padding: 10px 12px; margin: 8px 0; border: 1px solid var(--line); border-radius: 8px; background: var(--wash); }
.part.correct { background: var(--good-bg); border-color: var(--good-line); }
.part.wrong { background: var(--bad-bg); border-color: var(--bad-line); }
.part-label { font-weight: 700; min-width: 1.4em; padding-top: 4px; }
.part-main { flex: 1; min-width: 0; }
.part-q { margin-bottom: 6px; overflow-x: auto; overflow-y: hidden; }
.fields { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.field { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; border-radius: 6px; max-width: 100%; }
.field .flabel { color: var(--muted); font-size: .95rem; }
.field.ok input.answer { border-color: var(--good); background: var(--good-bg); }
.field.bad input.answer { border-color: var(--bad); background: var(--bad-bg); }
input.answer, input.gw-num { min-width: 0; font: inherit; padding: 6px 9px; min-height: 38px; border: 1.5px solid var(--ctl-border); border-radius: 6px; background: var(--paper); color: var(--ink); max-width: 100%; }
input.answer::placeholder { color: var(--muted); opacity: 1; }
input.answer:focus { border-color: var(--focus); }
.choices { display: inline-flex; flex-wrap: wrap; gap: 4px 16px; }
.choice { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; min-height: 32px; }
.choice input { width: 1.25rem; height: 1.25rem; margin: 0; accent-color: var(--accent); flex: none; }
.checkline { display: flex; align-items: center; gap: 12px; margin-top: 8px; min-height: 38px; flex-wrap: wrap; }
.feedback { font-weight: 600; font-size: .98rem; }
.feedback.good { color: var(--good); }
.feedback.bad { color: var(--bad); }
.feedback.warn { color: var(--warn); }
.ex-foot { padding: 4px 16px 14px; }
.solution { margin-top: 10px; padding: 10px 14px; background: var(--sol-bg); border: 1px dashed var(--sol-line); border-radius: 8px; }
.solution[hidden], .ex-video[hidden] { display: none; }
.solution .sol-part { margin: .5em 0; overflow-x: auto; overflow-y: hidden; }
.solution .plabel { font-weight: 700; }
.ex-video { padding: 0 16px 10px; }
.video-note { font-size: .9rem; }
.scrolls { overflow-x: auto; overflow-y: hidden; }
.scrolls:focus-visible { outline-offset: -3px; }

/* graph widgets and svg figures */
.graphwidget { margin: 4px 0; max-width: 100%; }
.gw-msg { font-size: .9rem; color: var(--muted); margin-bottom: 4px; }
.gw-controls { display: flex; flex-wrap: wrap; gap: 8px 12px; margin-top: 8px; align-items: center; }
.gw-coords { display: flex; flex-wrap: wrap; gap: 8px 12px; margin-top: 8px; align-items: center; }
.gw-coords label { display: inline-flex; align-items: center; gap: 6px; }
.gw-coords input.gw-num { width: 5.2em; }
.gw-list { margin: 6px 0 0; font-size: .95rem; }
.gw-list ul { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 10px; margin: 4px 0 0; padding: 0; }
.gw-list li { margin: 0; display: inline-flex; align-items: center; gap: 4px; }
.gw-err { color: var(--bad); font-weight: 600; font-size: .92rem; min-height: 1.2em; margin-top: 4px; }
svg .hit { cursor: crosshair; }
svg.plane .grid { stroke: var(--svg-grid); stroke-width: 1; }
svg.plane .axis, svg.numline .axis { stroke: var(--svg-ink); stroke-width: 1.6; }
svg.plane .tick, svg.numline .tick { font: 13px "Segoe UI", system-ui, sans-serif; fill: var(--svg-ink); }
svg.plane .alabel { font: italic 15px Georgia, serif; fill: var(--svg-ink); }
svg.plane .ptitle { font: 15px "Segoe UI", system-ui, sans-serif; fill: var(--svg-ink); }
svg.plane .plabel, svg.numline .plabel { font: 13.5px "Segoe UI", system-ui, sans-serif; fill: var(--svg-label); }
svg.plane .gline { stroke: var(--svg-line); stroke-width: 2.6; fill: none; }
svg.plane .seg { stroke: var(--svg-line); stroke-width: 2.6; }
svg.plane .rr { stroke: var(--svg-red); stroke-width: 2.4; fill: none; }
svg.plane .pt { fill: var(--svg-line); stroke: var(--paper); stroke-width: 1.2; }
svg.numline .shade { stroke: var(--svg-shade); stroke-width: 6; opacity: .85; }
svg.numline .brk { stroke: var(--svg-ink); stroke-width: 2.4; fill: none; }
svg.numline .arrowhead { fill: var(--svg-ink); }
svg.geoboard .gb { fill: var(--svg-gb-fill); stroke: var(--svg-gb-line); }
svg.geoboard .peg { fill: var(--svg-peg); }
svg.geoboard .band { stroke: var(--svg-band); stroke-width: 5; stroke-linecap: round; }

/* videos */
.videos { margin-top: 3em; }
.video-card { margin: 18px 0; }
.video-card h3 { margin: 0 0 .3em; color: var(--ink); }
.video-embed { position: relative; width: 100%; max-width: 760px; aspect-ratio: 16 / 9; background: #000; border-radius: var(--radius); overflow: hidden; }
.video-embed iframe, .video-embed video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-link { margin: 8px 0; }

/* small screens */
@media (max-width: 900px) {
  .menu-btn { display: inline-block; }
  .sidebar { position: fixed; z-index: 15; left: 0; top: 54px; transform: translateX(-100%); visibility: hidden; transition: transform .2s, visibility 0s linear .2s; box-shadow: 2px 0 12px rgba(0,0,0,.3); }
  .sidebar.open { transform: none; visibility: visible; transition: transform .2s, visibility 0s; }
  main { padding: 20px 16px 60px; }
  .score .bar { width: 70px; }
  .score { white-space: nowrap; font-size: 13px; flex: none; }
  .topbar .brand { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  body { font-size: 16px; }
  .part { flex-direction: column; gap: 2px; }
  .topbar .top-link { display: none; }
}
.score .sc-short { display: none; }
@media (max-width: 600px) {
  .score .sc-full { display: none; }
  .score .sc-short { display: inline; }
  .score .bar { width: 48px; }
}
@media print { .sidebar, .ex-btns, .btn, .pager, .menu-btn { display: none !important; } main { padding: 0; max-width: none; } .solution { display: block !important; } img.fig { filter: none; } }
