/*
 * The presentation of STask (STASK-926): a 16:9 deck of 1920 x 1080 CSS
 * pixels, scaled as a whole to the window (js/engine.js). The colours are
 * the custom properties --c-<name> the engine writes from js/palette.js;
 * the only font is the embedded Inter (css/inter.css), numbers with tabular
 * figures (STASK-923).
 */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #000; }
body {
  font-family: 'Inter';
  color: var(--c-ink);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; }

#stage { position: fixed; inset: 0; overflow: hidden; background: #000; outline: none; touch-action: pan-y pinch-zoom; }
#deck {
  position: absolute;
  left: 0;
  top: 0;
  width: 1920px;
  height: 1080px;
  transform-origin: 0 0;
  background: var(--c-bg);
  overflow: hidden;
  opacity: 0;
}
body.ready #deck { opacity: 1; transition: opacity 0.3s; }
body.idle, body.idle * { cursor: none !important; }

/* numbers in tabular figures of the same font (STASK-923): the footer, labels, tables */
.foot, .label, .typed, .help, .tile .cap b, .chip small, .tnum { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.noscript { color: #fff; font-size: 20px; padding: 24px; position: relative; z-index: 5; }

/* ---- slides ----------------------------------------------------------------------- */
/* the brand mark (STASK-990, js/mark.js): the first element of the deck, above its background and below the
   slides, which have no background of their own; in a still (overview, print) it is an SVG below the content */
.mark { position: absolute; right: 21.6px; bottom: 21.6px; width: 270px; height: 270px; pointer-events: none; display: block; }
.slide > svg.mark { z-index: -1; }
.slide { position: absolute; inset: 0; z-index: 0; overflow: hidden; }
.slide[hidden] { display: none; }
.slide.leaving { pointer-events: none; z-index: 1; }
.content { position: absolute; inset: 0; padding: 84px 120px 132px; display: flex; flex-direction: column; }
.foot {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 76px;
  padding: 0 120px;
  display: flex;
  align-items: center;
  gap: 40px;
  font-size: 22px;
  color: var(--c-ink2);
  border-top: 2px solid var(--c-faint);
}
.foot .who { font-weight: 650; color: var(--c-ink); }
.foot .num { margin-left: auto; font-weight: 600; }

h1, h2, h3, p, ul, ol { margin: 0; }
.kicker { font-size: 26px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--c-accent); margin-bottom: 14px; }
h2 { font-size: 64px; line-height: 1.08; font-weight: 750; letter-spacing: -0.02em; }
.lead { font-size: 30px; line-height: 1.4; color: var(--c-ink2); margin-top: 18px; max-width: 1500px; }
.body { flex: 1; min-height: 0; display: grid; grid-template-columns: 700px 1fr; gap: 64px; margin-top: 44px; }
.body.wide-visual { grid-template-columns: 600px 1fr; }
.body.stacked { grid-template-columns: 1fr; grid-template-rows: auto 1fr; gap: 28px; }
.points { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 22px; }
.points li { position: relative; padding-left: 34px; font-size: 29px; line-height: 1.36; }
.points li::before { content: ''; position: absolute; left: 0; top: 0.36em; width: 12px; height: 12px; border-radius: 3px; background: var(--c-accent); }
.points li b { font-weight: 700; }
.points .sub { display: block; font-size: 23px; color: var(--c-ink2); margin-top: 4px; }
.note { font-size: 22px; color: var(--c-ink2); line-height: 1.4; }
.points + .note { margin-top: 28px; }
.error-note { font-size: 30px; color: var(--c-bad); margin-top: 40px; }

/* build steps (STASK-914): hidden until their step, also for screen readers */
#deck [data-step], .print-root [data-step] { opacity: 0; transform: translateY(18px); visibility: hidden; transition: opacity 0.5s, transform 0.5s, visibility 0s 0.5s; }
#deck [data-step].on, .print-root [data-step].on { opacity: 1; transform: none; visibility: visible; transition: opacity 0.5s, transform 0.5s, visibility 0s; }
.instant [data-step], .print-root [data-step] { transition: none !important; }

/* the title slide */
.title-slide .content { justify-content: center; padding: 120px 140px; }
.title-slide h1 { font-size: 150px; line-height: 1; font-weight: 800; letter-spacing: -0.035em; }
.title-slide .fullname { font-size: 34px; line-height: 1.3; font-weight: 600; color: var(--c-ink2); margin-top: 14px; }
.title-slide .tagline { font-size: 48px; line-height: 1.25; font-weight: 600; margin-top: 28px; max-width: 1100px; }
.title-slide .byline { font-size: 26px; color: var(--c-ink2); margin-top: 44px; display: flex; gap: 36px; }
.title-slide .visual { position: absolute; inset: 0; z-index: 0; }
.title-slide .content > :not(.visual) { position: relative; z-index: 1; }

/* ---- visualisations ----------------------------------------------------------------- */
.visual { position: relative; min-height: 0; min-width: 0; }
.visual canvas.gl, .visual canvas.still { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.visual .vis { position: absolute; inset: 0; }
.visual .hint {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  max-width: 80%;
  padding: 20px 28px;
  font-size: 24px;
  text-align: center;
  color: var(--c-ink2);
  background: var(--c-surface);
  border: 2px dashed var(--c-line);
  border-radius: 12px;
}
.title-slide .visual .hint { top: auto; bottom: 60px; transform: translateX(-50%); }

/* labels of a visualisation: real text on a surface of its own (the contrast is checked) */
.chip {
  position: absolute;
  left: 0;
  top: 0;
  padding: 8px 16px;
  font-size: 22px;
  line-height: 1.25;
  font-weight: 600;
  color: var(--c-ink);
  background: var(--c-surface);
  border: 2px solid var(--c-line);
  border-radius: 10px;
  white-space: nowrap;
  will-change: transform, opacity;
}
.chip small { display: block; font-size: 17px; font-weight: 500; color: var(--c-ink2); }
.chip.accent { border-color: var(--c-accent); }
.chip.accent2 { border-color: var(--c-accent2); }
.chip.ok { border-color: var(--c-ok); }
.chip.warn { border-color: var(--c-warn); }
.chip.bad { border-color: var(--c-bad); }
.chip.violet { border-color: var(--c-violet); }
.chip.strong { background: var(--c-accent); color: var(--c-onAccent); border-color: var(--c-accent); }
.chip.strong small { color: var(--c-onAccent); }
.chip.center { text-align: center; }
.label { position: absolute; left: 0; top: 0; font-size: 20px; font-weight: 600; color: var(--c-ink2); white-space: nowrap; }
.tag-bad { color: var(--c-bad); }
.tag-ok { color: var(--c-ok); }

/* labels of single slides */
.chip.glass { background: transparent; }
.chip.hub { font-size: 34px; padding: 18px 34px; border-radius: 16px; }
.chip.layer { padding: 12px 20px; }
.sign-card { white-space: normal; text-align: left; padding: 20px 28px 8px; }
.sign-title { font-size: 22px; font-weight: 700; padding-bottom: 12px; border-bottom: 2px solid var(--c-faint); }
.sign-row { padding: 16px 0 52px; border-bottom: 2px dashed var(--c-faint); position: relative; }
.sign-row:last-child { border-bottom: 0; }
.sign-row b { font-size: 24px; }
.sign-row small { margin-top: 2px; }
.sign-row.done b { color: var(--c-ok); }
.rule-card { font-weight: 500; line-height: 1.5; text-align: left; }
.rule-card b { color: var(--c-accent); font-weight: 700; }
.mock-form { white-space: normal; padding: 24px 28px; display: flex; flex-direction: column; gap: 18px; }
.mock-row { display: grid; grid-template-columns: 150px 1fr; align-items: center; gap: 16px; }
.mock-label { font-size: 22px; font-weight: 600; color: var(--c-ink2); }
.mock-input { height: 46px; border: 2px solid var(--c-line); border-radius: 8px; background: var(--c-bg); }
.mock-buttons { display: flex; gap: 16px; justify-content: flex-end; margin-top: 6px; }
.mock-button { padding: 10px 26px; border: 2px solid var(--c-line); border-radius: 8px; font-size: 22px; font-weight: 650; background: var(--c-surface); color: var(--c-ink); }
.mock-button.primary { background: var(--c-accent); border-color: var(--c-accent); color: var(--c-onAccent); }
.shot { position: absolute; left: 0; top: 0; margin: 0; will-change: transform, opacity; }
.shot img { display: block; width: 100%; height: auto; border-radius: 10px; border: 2px solid var(--c-line); box-shadow: 0 18px 50px rgb(0 0 0 / 28%); background: var(--c-surface); }
.shot figcaption { position: absolute; left: 12px; bottom: 12px; padding: 4px 12px; border-radius: 8px; font-size: 18px; font-weight: 650; background: var(--c-surface); color: var(--c-ink); border: 2px solid var(--c-line); }

/* ---- controls (STASK-905): hidden after 3 s without a movement -------------------------- */
.controls {
  position: absolute;
  right: max(10px, env(safe-area-inset-right));
  top: max(10px, env(safe-area-inset-top));
  display: flex;
  gap: 6px;
  padding: 6px;
  border-radius: 12px;
  background: rgb(20 24 28 / 72%);
  z-index: 10;
  transition: opacity 0.4s;
}
/* they stay while a key has put the focus on one of them */
body.idle .controls:not(:has(:focus-visible)) { opacity: 0; pointer-events: none; }
/* an open overview or help has its own Close button */
#stage:has(.overlay) .controls { display: none; }
.controls button {
  width: clamp(24px, 4.2vmin, 44px);
  height: clamp(24px, 4.2vmin, 44px);
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #fff;
  cursor: pointer;
}
.controls button:hover, .controls a:hover { background: rgb(255 255 255 / 16%); }
.controls button[hidden], .controls a[hidden] { display: none; }
/* the way back to the login page (STASK-931): text, as high as the buttons */
.controls a {
  display: flex;
  align-items: center;
  height: clamp(24px, 4.2vmin, 44px);
  padding: 0 clamp(6px, 1.4vmin, 14px);
  border-radius: 8px;
  color: #fff;
  font-size: clamp(11px, 1.9vmin, 18px);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.controls svg { width: 64%; height: 64%; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.controls svg .fill { fill: currentColor; stroke: none; }
body.single #btn-prev, body.single #btn-next, body.single #btn-overview, body.single #btn-help { display: none; }

:focus { outline: none; }
:focus-visible { outline: 3px solid var(--c-accent); outline-offset: 3px; }
.controls button:focus-visible, .controls a:focus-visible { outline: 3px solid #fff; outline-offset: 1px; box-shadow: 0 0 0 5px #000; }

/* ---- overlays: overview (STASK-919) and help ------------------------------------------- */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 8;
  background: var(--c-bg);
  padding: 56px 120px 48px;
  display: flex;
  flex-direction: column;
}
.overlay-head { display: flex; align-items: center; gap: 24px; margin-bottom: 28px; }
.overlay-head h2 { font-size: 48px; }
.overlay .sign-in {
  margin-left: auto;
  font-size: 24px;
  font-weight: 600;
  color: var(--c-accent);
}
.overlay .sign-in + .close { margin-left: 0; }
.overlay .close {
  margin-left: auto;
  font-size: 24px;
  font-weight: 600;
  padding: 10px 26px;
  border-radius: 10px;
  border: 2px solid var(--c-line);
  background: var(--c-surface);
  color: var(--c-ink);
  cursor: pointer;
}
.tiles { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(6, 260px); gap: 30px 24px; align-content: start; padding: 6px; }
.tile {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--c-ink);
  text-align: left;
  cursor: pointer;
}
.tile .thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 10px;
  border: 2px solid var(--c-line);
  background: var(--c-bg);
}
.tile.current .thumb { border: 4px solid var(--c-accent); }
.tile .thumb .slide { width: 1920px; height: 1080px; transform-origin: 0 0; transform: scale(0.13541667); inset: auto; left: 0; top: 0; }
.tile .cap { font-size: 21px; font-weight: 600; line-height: 1.3; }
.tile .cap b { color: var(--c-accent); margin-right: 6px; }
.tile:focus-visible { outline: none; }
.tile:focus-visible .thumb { outline: 4px solid var(--c-accent); outline-offset: 4px; }
.help table { border-collapse: collapse; font-size: 28px; }
.help th, .help td { text-align: left; padding: 14px 32px 14px 0; border-bottom: 2px solid var(--c-faint); vertical-align: top; }
.help th { font-weight: 650; white-space: nowrap; }
.help td { color: var(--c-ink2); }

.typed {
  position: absolute;
  left: 50%;
  bottom: 110px;
  transform: translateX(-50%);
  z-index: 9;
  padding: 14px 28px;
  border-radius: 12px;
  font-size: 30px;
  font-weight: 650;
  background: var(--c-surface);
  color: var(--c-ink);
  border: 2px solid var(--c-accent);
}
.missing { position: absolute; inset: 0; display: grid; place-items: center; padding: 120px; font-size: 44px; font-weight: 600; text-align: center; color: var(--c-ink); }
.blank { position: fixed; inset: 0; z-index: 20; }
.blank.black { background: #000; }
.blank.white { background: #fff; }
.measure { position: fixed; left: -4000px; top: 0; width: 1920px; height: 1080px; visibility: hidden; pointer-events: none; }
.measure .slide { inset: 0; }
.print-root { display: none; }

/* ---- print (STASK-921): one slide per landscape page, all steps, stills, light ---------- */
@page { size: 1920px 1080px; margin: 0; }
@media print {
  html, body { height: auto; overflow: visible; background: #fff; }
  #stage, #announce, .blank, .measure { display: none !important; }
  .print-root { display: block; }
  .print-page { position: relative; width: 1920px; height: 1080px; overflow: hidden; break-after: page; page-break-after: always; background: var(--c-bg); }
  .print-page:last-child { break-after: auto; page-break-after: auto; }
  .print-page .slide { position: absolute; inset: 0; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
