/* Apex Academia page CSS: the Class Board world on the kit's system.
   Slate boards (authored raster, assets/img/slate-*.jpg), chalk white, red chalk, yellow chalk only on the scholarship;
   ruled handout sheets for long reading; the stencil wordmark from the posters. */
:root {
  --slate: #161716; --chalk: #f4f1ea; --chalk-dim: #c9c5bb; --chalk-red: #e0362c; --chalk-yellow: #e8c547;
  --rule: rgb(70 110 160 / .22); --margin-red: rgb(200 32 26 / .45);
}

/* the stencil wordmark, from the posters' lettering */
.wordmark { font-family: "Black Ops One", "Archivo", sans-serif; font-weight: 400; letter-spacing: .02em; text-transform: uppercase; }
.nav__logo.wordmark { font-size: 22px; }

/* headings: Archivo at its narrowest, heavy, like the posters' condensed caps */
h1, h2, .close__word:not(.wordmark), .unit__mark, .board-note__mark { font-stretch: 62%; font-weight: 800; letter-spacing: -0.01em; }
h1 { font-variation-settings: "wdth" 62; }

/* ---------- the board (hero and results) ---------- */
.hero--board, .board-section { --ink: var(--chalk); --muted: var(--chalk-dim); --line: rgb(244 241 234 / .22); --line-strong: rgb(244 241 234 / .55);
  color: var(--chalk); background: var(--slate) url(img/slate-lg.jpg) center / cover; }
@media (max-width: 1023px) { .hero--board, .board-section { background-image: url(img/slate-md.jpg); } }
@media (max-width: 639px) { .hero--board, .board-section { background-image: url(img/slate-sm.jpg); } }

.hero--board { position: relative; }
.board-hero { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gutter); align-content: center; height: 100%; }
.board-hero .hero__text { grid-column: 1 / span 7; }
.board-hero h1 { font-size: clamp(44px, 6.4vw, 104px); line-height: .98; max-width: 11ch; }
.board-hero .hero__lead { margin-top: var(--s-5); max-width: 40ch; font-size: var(--t-lead); line-height: 1.5; color: var(--chalk); }
.board-hero__actions { grid-column: 1 / -1; margin-top: var(--s-8); }

/* the written-up result on the right of the board */
.board-note { grid-column: 9 / span 4; align-self: center; position: relative; display: grid; gap: var(--s-2); justify-items: start; }
.board-note p { margin: 0; }
.board-note__label { font-size: var(--t-small); color: var(--chalk-dim); }
.board-note__name { font-size: var(--t-lead); font-weight: 500; }
.board-note__mark { font: 800 clamp(56px, 6vw, 96px)/1 var(--font-display); font-stretch: 62%; font-variant-numeric: tabular-nums; }
.board-note__arrow { width: 96px; height: 56px; margin-left: var(--s-5); overflow: visible; }
.board-note__arrow path { fill: none; stroke: var(--chalk-red); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.board-note__iit { font-size: var(--t-h3); font-weight: 500; }

/* the chalk ledge under the board, the buttons resting just above it */
.board-ledge { position: absolute; left: 0; right: 0; bottom: 0; height: 18px; background: #3a3936;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .18), 0 -6px 14px rgb(0 0 0 / .35); }
.hero--board .btn { border-radius: 2px; }
.hero--board .btn--secondary, .board-section .btn--secondary { background: transparent; color: var(--chalk); border: 2px solid var(--chalk); }

/* phone: the board fills the screen, the note stacks under the words */
@media (max-width: 1023px) {
  .board-hero .hero__text, .board-note, .board-hero__actions { grid-column: 1 / -1; }
  .board-note { margin-top: var(--s-6); grid-template-columns: auto auto; column-gap: var(--s-4); align-items: end; }
  .board-note__label, .board-note__name { grid-column: 1 / -1; }
  .board-note__arrow { display: none; }
  .board-hero__actions { margin-top: var(--s-6); }
}

/* red chalk: the underline wipes on once on load; rings redraw when a result is hovered */
.chalk-mark { position: relative; white-space: nowrap; }
.chalk-mark::after { content: ""; position: absolute; left: 0; right: 0; bottom: -0.1em; height: 0.22em; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 24' preserveAspectRatio='none'%3E%3Cpath d='M4 15 C 60 7, 130 20, 190 11 S 270 9, 296 13' fill='none' stroke='%23e0362c' stroke-width='5' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat center / 100% 100%; }
.chalk-ring { position: relative; display: inline-block; padding: 4px 14px; white-space: nowrap; color: var(--chalk); font-weight: 500; }
.chalk-ring svg { position: absolute; left: -10px; top: -8px; width: calc(100% + 20px); height: calc(100% + 16px); max-width: none; overflow: visible; pointer-events: none; }
.chalk-ring path { fill: none; stroke: var(--chalk-red); stroke-width: 2.5; stroke-linecap: round; stroke-dasharray: 420; stroke-dashoffset: 0; vector-effect: non-scaling-stroke; }
@media (prefers-reduced-motion: no-preference) {
  .chalk-mark::after { clip-path: inset(0 100% 0 0); animation: chalk-wipe 900ms cubic-bezier(.16, 1, .3, 1) 500ms forwards; }
  .board-note .chalk-ring path, .board-note__arrow path { stroke-dashoffset: 420; animation: chalk-draw 1100ms cubic-bezier(.16, 1, .3, 1) 900ms forwards; }
  .board-note__arrow path { stroke-dasharray: 420; }
  .unit:hover .chalk-ring path { animation: chalk-redraw 700ms cubic-bezier(.16, 1, .3, 1); }
}
@keyframes chalk-wipe { to { clip-path: inset(0 0 0 0); } }
@keyframes chalk-draw { to { stroke-dashoffset: 0; } }
@keyframes chalk-redraw { from { stroke-dashoffset: 420; } to { stroke-dashoffset: 0; } }

/* ---------- results: one identical unit per student, written up on the board ---------- */
.units { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-6) var(--gutter); }
.unit { display: grid; align-content: start; gap: var(--s-1); padding-top: var(--s-4); border-top: 1px solid var(--line); }
.unit p { margin: 0; }
.unit__label { font-size: var(--t-small); color: var(--chalk-dim); }
.unit__name { font-size: var(--t-body); font-weight: 500; }
.unit__mark { font: 800 clamp(40px, 3.6vw, 56px)/1.05 var(--font-display); font-stretch: 62%; font-variant-numeric: tabular-nums; }
.unit__iit { margin-top: var(--s-2); }
.unit--yellow .unit__mark, .unit--yellow .unit__name { color: var(--chalk-yellow); }
.unit--yellow { border-top-color: rgb(232 197 71 / .5); }
.unit__note { font-size: var(--t-small); color: var(--chalk-dim); }
.units__more { margin-top: var(--s-7); }
@media (max-width: 1023px) { .units { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-5) var(--gutter); } }

/* ---------- ruled handout sheets for the long reading ---------- */
.sheet { background-color: #fffdf8;
  background-image: linear-gradient(90deg, transparent 47px, var(--margin-red) 47px, var(--margin-red) 48px, transparent 48px),
                    repeating-linear-gradient(transparent 0 31px, var(--rule) 31px 32px);
  padding: var(--s-6) var(--s-6) var(--s-6) 72px; border-radius: 2px; box-shadow: 0 1px 2px rgb(22 22 22 / .08), 0 8px 24px rgb(22 22 22 / .06); }
.sheet .rows > li, .sheet.faq > .faq__item { border-bottom-color: transparent; }
/* text sits on the rules: every line and gap is one 32px ruled line */
.sheet { padding-top: 32px; padding-bottom: 32px; }
.sheet :is(p, h3, .rows__name, li) { line-height: 32px; margin: 0; }
.sheet h3 { font-size: var(--t-lead); }
.sheet .rows > li, .sheet.faq > .faq__item { padding: 0 0 32px; gap: 0; }
.sheet .rows > li:last-child, .sheet.faq > .faq__item:last-child { padding-bottom: 0; }
.sheet .rows > li:first-child, .sheet.faq > .faq__item:first-child { padding-top: 0; }
.sheet :is(p, .rows__name) { transform: translateY(-6px); }
@media (max-width: 639px) { .sheet { padding: var(--s-5) var(--s-4) var(--s-5) 40px;
  background-image: linear-gradient(90deg, transparent 23px, var(--margin-red) 23px, var(--margin-red) 24px, transparent 24px), repeating-linear-gradient(transparent 0 31px, var(--rule) 31px 32px); } }

/* links: a drawn arrow instead of the text glyph */
.link::after { content: ""; width: 12px; height: 12px; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M1 6h8M5.5 2.5 9 6l-3.5 3.5' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M1 6h8M5.5 2.5 9 6l-3.5 3.5' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat; }

/* the classes at rest on a phone: taller pictures, so the three steps fill two screens */
@media (max-width: 639px) { #classes:not(.is-live) .mo-pc__visual > img { aspect-ratio: 4 / 3; max-height: none; } }

/* the name across the close, hand-set to fit the .wrap */
.close__word.wordmark { font-size: clamp(36px, 10.2vw, 148px); white-space: nowrap; letter-spacing: 0; }
.footer__address { font-size: var(--t-h3); line-height: 1.2; }

/* the full results list on results/ */
.results--plain .rows__name { font-size: var(--t-body); }
.results--plain .rows__value { font: 500 var(--t-body)/1.5 var(--font-text); font-variant-numeric: tabular-nums; }
.results--plain > li { padding-block: var(--s-2); }
.results__group { margin-bottom: var(--s-4); color: var(--muted); }
.results__group--gap { margin-top: var(--s-7); }

::selection { background: var(--chalk-red); color: #faf8f3; }

/* results/: the board opens the page */
.results-hero h1 { font-size: clamp(40px, 4.6vw, 72px); line-height: 1; margin-bottom: var(--s-7); }
.results-hero > .wrap { padding-top: calc(var(--nav) + var(--s-8)); }
.results-hero .units { gap: var(--s-5) var(--gutter); }
.sheet .results__group { color: var(--muted); }
.sheet .results__group--gap { margin-top: 32px; }
.sheet .results--plain > li { padding: 0; }
.sheet :is(.rows__value) { line-height: 32px; transform: translateY(-6px); }
.sheet--two { display: grid; grid-template-columns: 1fr 1fr; column-gap: var(--s-8); }
@media (max-width: 1023px) { .sheet--two { grid-template-columns: 1fr; row-gap: 32px; } }
.close__word.wordmark { font-size: clamp(26px, 8.4vw, 124px); }
@media (max-width: 639px) {
  .units { gap: var(--s-4) var(--s-3); }
  .unit { padding-top: var(--s-3); }
  .unit__mark { font-size: 34px; }
  .unit__name { font-size: var(--t-small); line-height: 1.35; }
  .results-hero > .wrap { padding-top: calc(var(--nav) + var(--s-5)); }
  .results-hero h1 { margin-bottom: var(--s-5); font-size: 34px; }
  .results-hero .units__more { margin-top: var(--s-5); }
}
.close__word.wordmark { line-height: 1.05; overflow: visible; }

/* one button shape across the page: the chalk-box corner */
:root { --r-btn: 2px; }
.btn { border-radius: 2px; }
/* figures stay under the section headings' size (one heading scale) */
.board-note__mark { font-size: clamp(40px, 3.4vw, 50px); }
.unit__mark { font-size: clamp(34px, 3.2vw, 50px); }
.board-note__arrow { margin-left: 0; }
.board-note__iit { margin-left: 0; }
@media (max-width: 1023px) { .board-note { grid-template-columns: 1fr; } }
@media (max-width: 639px) { .unit__mark, .board-note__mark { font-size: 30px; } }
.unit__note { color: var(--chalk); }

/* ---------- fix round ---------- */
/* condensed display words need air between them */
h1, h2, .unit__mark, .board-note__mark, .close__word { word-spacing: .12em; }

/* chalk grain on every red-chalk stroke: a raster alpha mask (assets/img/chalk-grain.png) */
.chalk-ring svg, .board-note__arrow, .chalk-mark::after {
  -webkit-mask: url(img/chalk-grain.png) repeat 0 0 / 80px; mask: url(img/chalk-grain.png) repeat 0 0 / 80px; }
.hero--board .btn--secondary { border-style: solid; border-image: none; -webkit-mask: none; }

/* the ledge is a real rail: aluminium lip, a chalk stub and a felt duster resting on it; the buttons sit on it */
.board-ledge { height: 22px; background: linear-gradient(#5a5953, #3a3936 40%, #2a2927); box-shadow: inset 0 1px 0 rgb(255 255 255 / .25), 0 -8px 18px rgb(0 0 0 / .4); }
.board-ledge::before { content: ""; position: absolute; right: 12%; bottom: 14px; width: 46px; height: 10px; border-radius: 5px; background: #ece8dd; box-shadow: inset -6px 0 0 rgb(0 0 0 / .08); }
.board-ledge::after { content: ""; position: absolute; right: 6%; bottom: 14px; width: 88px; height: 26px; border-radius: 4px; background: linear-gradient(#6b5a45 0 55%, #3d3a36 55%); box-shadow: 0 2px 0 rgb(0 0 0 / .3); }
.hero--board > .wrap { position: static; }
.board-hero__actions { position: absolute; bottom: 22px; left: max(var(--gut), calc((100% - 1280px) / 2)); margin: 0; z-index: 2; }
.board-hero__actions .btn { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
@media (max-width: 639px) {
  .board-hero__actions { left: var(--gut); right: var(--gut); }
  .board-ledge::after { display: none; }
}

/* the signature again for keyboards: focusing the board's link redraws its rings */
@media (prefers-reduced-motion: no-preference) {
  .board-section:has(.units__more a:focus-visible) .chalk-ring path { animation: chalk-redraw 700ms cubic-bezier(.16, 1, .3, 1); }
}

/* ruled sheets: rules sit under the text's baseline (32px lines, the rule at 25px) */
.sheet, .sheet-ground { --rules: repeating-linear-gradient(transparent 0 25px, var(--rule) 25px 26px, transparent 26px 32px); }
.sheet { background-image: linear-gradient(90deg, transparent 47px, var(--margin-red) 47px, var(--margin-red) 48px, transparent 48px), var(--rules); }
.sheet :is(p, .rows__name, .rows__value) { transform: none; }
@media (max-width: 639px) { .sheet { background-image: linear-gradient(90deg, transparent 23px, var(--margin-red) 23px, var(--margin-red) 24px, transparent 24px), var(--rules); } }

/* the classes section is a handout sheet too: ruled ground, no coloured side bar, square photo corners */
.sheet-ground { background-color: #fffdf8; background-image: var(--rules); }
#classes .mo-pc__step { border-left-color: var(--line); }
#classes .mo-pc__step.is-on { border-left-color: var(--ink); border-left-width: 1px; }
#classes .mo-pc__visual, #classes .mo-pc__visuals { border-radius: 2px; }
#classes .mo-pc__step { border-left-width: 1px; }
.hero--board .hero-text { position: static; }
.board-hero__actions { left: max(var(--gut), calc((100% - 1280px) / 2)); }
/* the classes ground: fainter rules, so free-set text over them stays clean */
.sheet-ground { --rules: repeating-linear-gradient(transparent 0 25px, rgb(70 110 160 / .1) 25px 26px, transparent 26px 32px); }
/* seat the buttons on the ledge without absolute positioning: the board's last row, the hero padding ending at the ledge */
.board-hero__actions { position: static; left: auto; bottom: auto; grid-column: 1 / -1; align-self: end; margin: 0; }
.hero--board { --hpadb: 22px; }
.board-hero { grid-template-rows: 1fr auto; align-content: stretch; }
.board-hero .hero__text, .board-note { align-self: center; grid-row: 1; }
@media (max-width: 1023px) {
  .board-hero { grid-template-rows: auto auto 1fr; }
  .board-hero .hero__text { grid-row: 1; } .board-note { grid-row: 2; align-self: start; } .board-hero__actions { grid-row: 3; }
}
/* the chalk-outlined button's hover fills with chalk, its label turns slate (the kit's hover would put chalk text on white) */
.hero--board .btn--secondary:hover, .board-section .btn--secondary:hover { background: var(--chalk); color: var(--slate); border-color: var(--chalk); }
/* phones: the two actions come right after the words, so they stay on the first screen of a short phone */
@media (max-width: 639px) {
  .board-hero { grid-template-rows: auto auto auto 1fr; }
  .board-hero__actions { grid-row: 2; align-self: start; margin-top: var(--s-5); }
  .board-note { grid-row: 3; }
}
/* the classes ground is plain handout paper: its free-set text cannot sit on rules */
.sheet-ground { background-image: none; }

/* students' portraits, pinned to the board above their marks (parental consent collected) */
.unit__photo { width: 84px; height: 84px; object-fit: cover; border-radius: 2px; margin-bottom: var(--s-3);
  box-shadow: 0 0 0 3px rgb(244 241 234 / .9), 0 6px 14px rgb(0 0 0 / .45); }
@media (max-width: 639px) { .unit__photo { width: 64px; height: 64px; margin-bottom: var(--s-2); } }
.board-note__photo { width: 120px; height: 120px; } @media (max-width: 639px) { .board-note__photo { display: none; } }
