/* Shared stylesheet for the Game UI in Unity course.
   Every lesson and reference page links this. The app's content.css owns the page
   chrome (navigator, header, footer); this file owns typography, the teaching blocks
   and the widgets. */

:root {
  --paper: #f7f6f1;
  --ink: #14180f;
  --muted: #64695a;
  --rule: #d8d8cc;
  --accent: #2b5d8c;
  --panel: #fffffc;
  --pass: #216e39;
  --warn: #8a4b12;
  --fail: #a33;
}

body {
  font: 1.05rem/1.65 Georgia, "Iowan Old Style", "Palatino Linotype", serif;
  padding-bottom: 2rem;
  -webkit-font-smoothing: antialiased;
}

.lesson-content > * { max-width: 34rem; }

h1, h2, h3 {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

h1 { font-size: clamp(1.9rem, 5vw, 2.6rem); margin: 0 0 .4rem; }
h2 { font-size: 1.35rem; margin: 2.75rem 0 .6rem; }
h3 { font-size: 1.05rem; margin: 1.9rem 0 .4rem; }

.eyebrow {
  color: var(--muted);
  font: 600 .74rem/1.4 system-ui, sans-serif;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.subtitle, .lede { color: var(--muted); font-size: 1.12rem; font-style: italic; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: .16em; }

hr { max-width: 34rem; margin: 3rem 0; border: 0; border-top: 1px solid var(--rule); }

blockquote {
  margin: 1.5rem 0;
  padding-left: 1.1rem;
  border-left: 3px solid var(--rule);
  color: var(--muted);
}

code, kbd {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: .88em;
}

code { padding: .1em .3em; border-radius: .25em; background: color-mix(in srgb, var(--ink) 7%, transparent); }

kbd {
  padding: 0 .3em;
  border: 1px solid var(--rule);
  border-bottom-width: 2px;
  border-radius: .25em;
  background: var(--panel);
}

table { border-collapse: collapse; font-size: .92rem; }
th, td { padding: .45rem .8rem .45rem 0; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: top; }
th { font: 600 .78rem/1.3 system-ui, sans-serif; letter-spacing: .04em; text-transform: uppercase; }
td.num, th.num { font-variant-numeric: tabular-nums; text-align: right; padding-right: 1.2rem; }

/* Numbered Unity steps: the thing the learner actually does. */
ol.steps { padding-left: 1.4rem; }
ol.steps li { margin: .55rem 0; }
ol.steps li > strong { font-family: system-ui, sans-serif; }

/* ---- Pixel art display -------------------------------------------------- */

figure { margin: 2rem 0; }

figure figcaption {
  margin-top: .7rem;
  color: var(--muted);
  font-size: .88rem;
  line-height: 1.5;
}

/* A row of pixel-art plates with labels underneath. */
.plate {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 1rem;
  max-width: none;
  margin: 0;
  padding: 0;
  list-style: none;
}

.plate li { flex: 0 0 auto; margin: 0; text-align: center; }

.plate img {
  display: block;
  max-width: 100%;
  border: 1px solid var(--rule);
  background:
    repeating-conic-gradient(#f2f2ee 0 25%, #e6e6e0 0 50%) 0 0 / 18px 18px;
  image-rendering: pixelated;
}

.plate b {
  display: block;
  margin-top: .4rem;
  font: 600 .72rem/1.3 system-ui, sans-serif;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.plate small { display: block; color: var(--muted); font-size: .74rem; font-family: system-ui, sans-serif; }

/* ---- Teaching callout --------------------------------------------------- */

.rule-card {
  margin: 2rem 0;
  padding: 1.1rem 1.3rem;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--rule));
  border-left-width: 4px;
  border-radius: .3rem;
  background: color-mix(in srgb, var(--accent) 5%, var(--panel));
}

.rule-card p:first-child { margin-top: 0; }
.rule-card p:last-child { margin-bottom: 0; }
.rule-card strong { font-family: system-ui, sans-serif; }

/* ---- Widget shell (shared by every interactive component) --------------- */

.widget {
  max-width: none;
  margin: 2.5rem 0;
  padding: 1.2rem;
  border: 1px solid var(--rule);
  border-radius: .5rem;
  background: var(--panel);
  font-family: system-ui, -apple-system, sans-serif;
  font-size: .92rem;
}

.widget h3 { margin: 0 0 .2rem; font-size: .95rem; }
.widget > p { margin: .3rem 0 .8rem; }

.widget button {
  padding: .45rem .8rem;
  border: 1px solid color-mix(in srgb, var(--ink) 30%, transparent);
  border-radius: .3rem;
  background: var(--panel);
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.widget button:hover { background: color-mix(in srgb, var(--accent) 10%, var(--panel)); }
.widget button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.widget button[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); }

.widget__row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: .5rem 0; }

.widget .hint { color: var(--muted); font-size: .84rem; }

.lesson-content > figure { max-width: 44rem; }
.lesson-content > .widget { max-width: 44rem; }

@media (prefers-reduced-motion: no-preference) {
  .widget button { transition: background-color .12s ease, border-color .12s ease; }
}

/* ---- quiz.js ------------------------------------------------------------ */

.quiz__question { margin: 0 0 .7rem; color: var(--ink); font-size: .98rem; font-weight: 600; }

.quiz__options { display: grid; gap: .45rem; margin: 0 0 .6rem; padding: 0; list-style: none; }
.quiz__options li { margin: 0; }
.quiz__options button { width: 100%; text-align: left; }

.quiz__options button[data-state="correct"] {
  border-color: var(--pass);
  background: color-mix(in srgb, var(--pass) 14%, transparent);
}

.quiz__options button[data-state="wrong"] {
  border-color: var(--fail);
  background: color-mix(in srgb, var(--fail) 12%, transparent);
}

.quiz__feedback { margin: .6rem 0 0; color: var(--ink); font-size: .88rem; }
.quiz__progress { color: var(--muted); font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; }

/* ---- slice-lab.js ------------------------------------------------------- */

.sl-panels { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .8rem; }
.sl-panels button { display: inline-flex; align-items: center; gap: .5rem; font-size: .86rem; }
.sl-panels img { width: 24px; height: 24px; image-rendering: pixelated; }

.sl-modes { display: flex; flex-wrap: wrap; gap: .3rem 1rem; margin: .4rem 0 .8rem; }
.sl-modes label { display: inline-flex; align-items: center; gap: .35rem; }

.sl-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: .5rem 1.2rem;
  margin: .6rem 0 .9rem;
  max-width: 34rem;
}

.sl-controls label { display: grid; grid-template-columns: 3.4rem 1fr 2.6rem; align-items: center; gap: .5rem; font-size: .86rem; }
.sl-controls input[type="range"] { width: 100%; accent-color: var(--accent); }
.sl-controls output { font-variant-numeric: tabular-nums; text-align: right; }

.sl-borders { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .9rem; margin: .4rem 0 .9rem; }
.sl-borders label { display: inline-flex; align-items: center; gap: .35rem; font-size: .86rem; }
.sl-borders input[type="number"] {
  width: 3.4rem;
  padding: .3rem .4rem;
  border: 1px solid var(--rule);
  border-radius: .25rem;
  background: var(--panel);
  font: inherit;
  font-variant-numeric: tabular-nums;
}
.sl-borders input[type="number"]:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; }

.sl-stage {
  overflow: auto;
  padding: 1rem;
  border: 1px solid var(--rule);
  border-radius: .4rem;
  background:
    repeating-conic-gradient(#f2f2ee 0 25%, #e6e6e0 0 50%) 0 0 / 18px 18px;
}

.sl-canvas {
  box-sizing: border-box;
  border-style: solid;
  border-color: transparent;
  image-rendering: pixelated;
}

.sl-verdict { margin: .8rem 0 .2rem; font-size: .9rem; font-weight: 600; }
.sl-verdict.is-pass { color: var(--pass); }
.sl-verdict.is-warn { color: var(--warn); }
.sl-verdict.is-fail { color: var(--fail); }
.sl-detail { margin: 0; font-size: .85rem; color: var(--muted); }
