/* Speedcubing course — shared stylesheet. Every lesson and reference links this. */

:root {
  --bg: #fdfcf9;
  --ink: #1d1e20;
  --muted: #6b6e76;
  --accent: #b0413e;        /* cube red, used sparingly */
  --rule: #e3e0d8;
  --card: #f5f3ec;
  --mono-bg: #ecebe4;
  --good: #2e7d4f;
  --bad: #b0413e;
  /* cube sticker colors */
  --c-w: #f4f4f2; --c-y: #f5c518; --c-g: #2e9e4f;
  --c-b: #2f6fd0; --c-r: #cc3b33; --c-o: #f07f2d;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17181b; --ink: #e8e6e1; --muted: #9a9da6;
    --rule: #2e3036; --card: #1f2126; --mono-bg: #26282e;
    --good: #5dbb85; --bad: #e0716d;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 18px/1.65 Charter, Georgia, 'Times New Roman', serif;
}
main { max-width: 42rem; margin: 0 auto; padding: 3rem 1.25rem 5rem; }

h1, h2, h3 {
  font-family: -apple-system, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.2; letter-spacing: -0.01em;
}
h1 { font-size: 2rem; margin: 0 0 0.25rem; }
h2 { font-size: 1.3rem; margin: 2.5rem 0 0.75rem; padding-top: 1.25rem; border-top: 1px solid var(--rule); }
h3 { font-size: 1.05rem; margin: 1.5rem 0 0.5rem; }

.kicker {
  font-family: -apple-system, 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--accent); margin-bottom: 0.5rem;
}
.lede { font-size: 1.1rem; color: var(--muted); margin-top: 0; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

.alg {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 0.92em;
  background: var(--mono-bg);
  padding: 0.1em 0.4em; border-radius: 5px;
  white-space: nowrap;
}
.alg-block {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 1.35rem; letter-spacing: 0.15em;
  background: var(--card); border: 1px solid var(--rule); border-radius: 10px;
  padding: 1rem 1.25rem; margin: 1rem 0; text-align: center;
}

.card {
  background: var(--card); border: 1px solid var(--rule); border-radius: 10px;
  padding: 1rem 1.25rem; margin: 1.25rem 0;
}
.card--task { border-left: 4px solid var(--accent); }
.card h3:first-child { margin-top: 0; }

table { border-collapse: collapse; width: 100%; margin: 1rem 0; font-size: 0.95rem; }
th, td { text-align: left; padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--rule); }
th {
  font-family: -apple-system, 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted);
}
td .alg { font-size: 0.95em; }

.footnote { font-size: 0.88rem; color: var(--muted); border-top: 1px solid var(--rule); margin-top: 3rem; padding-top: 1rem; }

/* ------- report-back checklist (paired with report.js) ------- */
.card--report { border-left: 4px solid var(--good); }
.report label {
  display: block; padding: 0.3rem 0; cursor: pointer;
}
.report input[type="checkbox"] {
  width: 1.05rem; height: 1.05rem; margin-right: 0.5rem;
  vertical-align: -0.15rem; accent-color: var(--good); cursor: pointer;
}

/* ------- quiz widget (paired with quiz.js) ------- */
.quiz { margin: 1.5rem 0; }
.quiz-q {
  background: var(--card); border: 1px solid var(--rule); border-radius: 10px;
  padding: 1rem 1.25rem; margin-bottom: 1rem;
}
.quiz-q p.prompt { margin: 0 0 0.75rem; font-weight: 600; }
.quiz-q button.opt {
  display: block; width: 100%; text-align: left;
  font: inherit; color: inherit;
  background: var(--bg); border: 1px solid var(--rule); border-radius: 8px;
  padding: 0.5rem 0.75rem; margin: 0.4rem 0; cursor: pointer;
}
.quiz-q button.opt:hover:not(:disabled) { border-color: var(--muted); }
.quiz-q button.opt.correct { border-color: var(--good); background: color-mix(in srgb, var(--good) 12%, var(--bg)); }
.quiz-q button.opt.wrong { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, var(--bg)); }
.quiz-q .explain { font-size: 0.92rem; color: var(--muted); margin: 0.5rem 0 0; display: none; }
.quiz-q.answered .explain { display: block; }
.quiz-score {
  font-family: -apple-system, 'Helvetica Neue', Arial, sans-serif;
  font-weight: 600; margin-top: 0.5rem;
}

/* ------- flat cube-face diagram (3x3 grid of stickers) ------- */
.face {
  display: inline-grid;
  grid-template-columns: repeat(3, 1.4rem);
  grid-auto-rows: 1.4rem;
  gap: 2px; padding: 3px;
  background: var(--ink); border-radius: 6px;
  vertical-align: middle;
}
.face i { border-radius: 2px; }
.face .w { background: var(--c-w); } .face .y { background: var(--c-y); }
.face .g { background: var(--c-g); } .face .b { background: var(--c-b); }
.face .r { background: var(--c-r); } .face .o { background: var(--c-o); }

@media print {
  body { font-size: 11pt; background: #fff; color: #000; }
  .quiz, .no-print { display: none; }
  a { color: #000; }
}
