:root {
  --desk: #1b1916;
  --desk-2: #24211d;
  --ink: #ece5d6;
  --muted: #9d9585;
  --line: rgba(236, 229, 214, 0.13);
  --paper: #f4efe4;
  --graphite: #1d1b19;
  --accent: #de5632;
  --good: #2f6b4f;
  --display: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --body: 'Hanken Grotesk', 'Avenir Next', sans-serif;
  --mono: 'DM Mono', 'SF Mono', Menlo, monospace;
  --noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' seed='4'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .5 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  /* Paper-coloured speckle laid over the strokes: the tooth of the paper showing through graphite. */
  --tooth: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cfilter id='t' color-interpolation-filters='sRGB'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.15' numOctaves='2' seed='11'/%3E%3CfeColorMatrix values='0 0 0 0 .957 0 0 0 0 .937 0 0 0 0 .894 3.4 0 0 0 -1.42'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23t)'/%3E%3C/svg%3E");
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  display: grid;
  grid-template-rows: 58px minmax(0, 1fr);
  color: var(--ink);
  font: 400 16px/1.55 var(--body);
  background:
    radial-gradient(1100px 760px at 8% -12%, rgba(255, 207, 140, 0.16), transparent 62%),
    var(--noise),
    var(--desk);
  background-blend-mode: normal, soft-light, normal;
  overflow: hidden;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

/* ---------- header ---------- */

.top {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
}

.brand {
  font: 600 24px/1 var(--display);
  font-variation-settings: 'opsz' 60;
  letter-spacing: -0.01em;
}

.brand span {
  margin-left: 12px;
  font: 400 11px/1 var(--mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.lesson-name {
  flex: 1;
  font: 400 12px/1 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.lesson-name b {
  color: var(--ink);
  font-weight: 500;
}

.top-actions {
  display: flex;
  gap: 8px;
}

.ghost {
  background: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 16px;
  font: 400 12px/1 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: border-color 0.2s, color 0.2s;
}

.ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ---------- layout ---------- */

main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  min-height: 0;
}

.desk {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 26px 34px 22px;
  min-width: 0;
}

.sheet {
  position: relative;
  width: min(100%, calc((100vh - 58px - 190px) * 4 / 3));
  aspect-ratio: 4 / 3;
  background: var(--paper);
  border-radius: 2px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.5) inset,
    0 2px 3px rgba(0, 0, 0, 0.35),
    0 18px 30px -8px rgba(0, 0, 0, 0.55),
    0 44px 70px -30px rgba(0, 0, 0, 0.7);
  animation: settle 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

/* Masking tape holding the sheet to the desk. */
.sheet::before,
.sheet::after {
  content: '';
  position: absolute;
  top: -11px;
  width: 92px;
  height: 26px;
  background: rgba(233, 219, 181, 0.78);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  z-index: 3;
}

.sheet::before {
  left: 34px;
  transform: rotate(-4deg);
}

.sheet::after {
  right: 34px;
  transform: rotate(3deg);
}

.sheet svg,
.grain {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.grain {
  background-image: var(--tooth);
  pointer-events: none;
}

#overlay {
  pointer-events: none;
}

.note text {
  font: 500 17px var(--mono);
  fill: var(--accent);
  letter-spacing: 0.02em;
}

.note line,
.note path {
  stroke: var(--accent);
  stroke-width: 1.4;
  fill: none;
}

.note circle {
  fill: var(--accent);
}

#notes {
  transition: opacity 0.25s;
}

#notes.off {
  opacity: 0;
}

/* ---------- transport ---------- */

.transport {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: min(100%, calc((100vh - 58px - 190px) * 4 / 3));
}

.spacer {
  flex: 1;
}

.chip {
  background: rgba(236, 229, 214, 0.05);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 12px;
  font: 400 12px/1 var(--mono);
  letter-spacing: 0.04em;
  color: var(--muted);
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.chip:hover {
  color: var(--ink);
  border-color: rgba(236, 229, 214, 0.3);
}

.chip[aria-pressed='true'] {
  color: var(--desk);
  background: var(--ink);
  border-color: var(--ink);
}

/* ---------- ruler (step navigation) ---------- */

.ruler {
  position: relative;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  width: min(100%, calc((100vh - 58px - 190px) * 4 / 3));
  padding-top: 14px;
  /* One long tick per step, four short ones between; --n is the number of steps. */
  --n: 8;
  background:
    repeating-linear-gradient(90deg, rgba(236, 229, 214, 0.28) 0 1px, transparent 1px calc(100% / var(--n))) top / 100% 12px no-repeat,
    repeating-linear-gradient(90deg, rgba(236, 229, 214, 0.14) 0 1px, transparent 1px calc(100% / var(--n) / 5)) top / 100% 6px no-repeat;
  border-top: 1px solid rgba(236, 229, 214, 0.28);
}

.ruler button {
  position: relative;
  display: grid;
  gap: 3px;
  justify-items: start;
  padding: 8px 6px 4px 9px;
  background: none;
  border: 0;
  text-align: left;
  color: var(--muted);
  transition: color 0.2s;
}

.ruler button .n {
  font: 500 13px/1 var(--mono);
}

.ruler button .t {
  font-size: 12px;
  line-height: 1.25;
}

.ruler button:hover {
  color: var(--ink);
}

/* More than 14 steps: equal narrow columns, and only the current title. */

.ruler.dense {
  grid-auto-columns: minmax(0, 1fr);
}

.ruler.dense button {
  padding-right: 0;
}

.ruler.dense button .t {
  display: none;
  white-space: nowrap;
}

.ruler.dense button.current .t {
  display: block;
}

.ruler.dense button.current:nth-last-child(-n + 3) .t {
  justify-self: end;
  padding-right: 6px;
}

.ruler button.done .n::after {
  content: ' ✓';
  color: var(--good);
  filter: brightness(1.7);
}

.ruler button.current {
  color: var(--ink);
}

.ruler button.current::before {
  content: '';
  position: absolute;
  top: -15px;
  left: -5px;
  border: 6px solid transparent;
  border-top: 9px solid var(--accent);
}

/* ---------- lesson card ---------- */

.card {
  overflow-y: auto;
  padding: 30px 32px 36px;
  border-left: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(36, 33, 29, 0.85), rgba(27, 25, 22, 0.6));
}

.reveal {
  animation: rise 0.55s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.card > .reveal:nth-child(2) {
  animation-delay: 0.06s;
}
.card > .reveal:nth-child(3) {
  animation-delay: 0.12s;
}
.card > .reveal:nth-child(4) {
  animation-delay: 0.18s;
}
.card > .reveal:nth-child(5) {
  animation-delay: 0.24s;
}

.eyebrow {
  margin: 0 0 10px;
  font: 400 12px/1 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

h1 {
  margin: 0 0 14px;
  font: 500 40px/1.02 var(--display);
  font-variation-settings: 'opsz' 144;
  letter-spacing: -0.02em;
}

.lead {
  margin: 0 0 12px;
  color: #ded6c6;
}

.tip {
  margin: 0;
  padding-left: 14px;
  border-left: 2px solid var(--accent);
  font: italic 400 15px/1.5 var(--display);
  color: var(--muted);
}

.block {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

h2 {
  margin: 0 0 12px;
  font: 400 11px/1 var(--mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

/* reference photo */

.ref {
  margin-bottom: 10px;
  overflow: hidden;
  background: #fff;
  border-radius: 3px;
  box-shadow: 0 10px 20px -12px rgba(0, 0, 0, 0.7);
}

.ref img {
  display: block;
  width: 100%;
}

/* graphite scale */

.grades {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.grade {
  position: relative;
  padding: 6px 6px 7px;
  border: 1px solid transparent;
  border-radius: 6px;
  text-align: center;
  font: 500 13px/1 var(--mono);
  color: var(--muted);
}

.grade i {
  display: block;
  height: 34px;
  margin-bottom: 7px;
  border-radius: 3px;
  background:
    repeating-linear-gradient(-45deg, rgba(29, 27, 25, var(--k)) 0 2.4px, transparent 2.4px 5px),
    var(--paper);
}

.grade.on {
  border-color: var(--accent);
  color: var(--ink);
  background: rgba(222, 86, 50, 0.1);
}

.extra {
  margin: 10px 0 0;
  font-size: 14px;
  color: var(--muted);
}

.extra b {
  color: var(--ink);
  font-weight: 500;
}

/* grip + stroke */

.grip-photo {
  height: 190px;
  margin-bottom: 14px;
  overflow: hidden;
  background: var(--paper);
  border-radius: 3px;
  box-shadow: 0 10px 20px -12px rgba(0, 0, 0, 0.7);
}

.grip-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: left top;
}

/* The left-hand photo has its pencil tip on the right. */
.grip-photo img.left {
  object-position: right top;
}

.grip {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 16px;
  align-items: center;
}

.grip-figure svg {
  display: block;
  width: 100%;
  height: auto;
}

.grip-name {
  margin: 0 0 4px;
  font: 500 18px/1.2 var(--display);
}

.grip-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
}

.stroke {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.pressure {
  display: grid;
  justify-items: end;
  gap: 6px;
  font: 400 11px/1 var(--mono);
  letter-spacing: 0.06em;
  color: var(--muted);
  white-space: nowrap;
}

.pressure .bars {
  display: flex;
  align-items: flex-end;
  gap: 4px;
}

.pressure .bars i {
  width: 9px;
  border-radius: 2px;
  background: rgba(236, 229, 214, 0.16);
}

.pressure .bars i:nth-child(1) {
  height: 10px;
}
.pressure .bars i:nth-child(2) {
  height: 17px;
}
.pressure .bars i:nth-child(3) {
  height: 24px;
}

.pressure .bars i.on {
  background: var(--accent);
}

/* actions */

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 26px;
}

.primary,
.secondary {
  padding: 13px 14px;
  border-radius: 8px;
  font: 600 15px/1.1 var(--body);
  transition: transform 0.15s, background 0.2s, border-color 0.2s;
}

.primary {
  background: var(--accent);
  border: 1px solid var(--accent);
  color: #fff6ee;
}

.primary:hover {
  background: #ea6440;
}

.secondary {
  background: none;
  border: 1px solid rgba(236, 229, 214, 0.32);
}

.secondary:hover {
  border-color: var(--ink);
}

.primary:active,
.secondary:active {
  transform: translateY(1px);
}

button:disabled {
  opacity: 0.45;
  cursor: default;
}

.hint {
  margin: 10px 0 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
}

.hint code {
  font: 400 12px var(--mono);
  color: var(--ink);
}

/* teacher's note */

.feedback {
  position: relative;
  margin-top: 18px;
  padding: 18px 20px 20px;
  background: var(--paper);
  color: var(--graphite);
  border-radius: 3px;
  box-shadow: 0 14px 26px -12px rgba(0, 0, 0, 0.7);
  animation: rise 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.feedback .stamp {
  display: inline-block;
  margin-bottom: 10px;
  padding: 5px 10px 4px;
  border: 2px solid currentColor;
  border-radius: 4px;
  font: 500 12px/1 var(--mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  transform: rotate(-2.5deg);
  color: var(--good);
}

.feedback .stamp.fix,
.feedback .stamp.error {
  color: #b8401f;
}

.feedback p {
  margin: 0 0 10px;
}

.feedback h3 {
  margin: 14px 0 6px;
  font: 500 11px/1 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #6f685c;
}

.feedback ul {
  margin: 0;
  padding-left: 18px;
}

.feedback li {
  margin-bottom: 6px;
  line-height: 1.45;
}

.feedback li b {
  font-weight: 600;
}

.feedback img {
  display: block;
  width: 100%;
  margin-bottom: 12px;
  border-radius: 2px;
}

.feedback.loading {
  font: italic 400 16px/1.4 var(--display);
  color: #5d574d;
}

/* The repeat task under a finished lesson, set apart on the same note. */
.feedback .practice {
  margin-top: 14px;
  padding: 12px 14px 2px;
  background: rgba(29, 27, 25, 0.05);
  border-left: 3px solid var(--accent);
  border-radius: 2px;
}

.feedback .practice h3 {
  margin: 0 0 7px;
  color: #b8401f;
}

.goal img {
  display: block;
  width: 100%;
  border-radius: 2px;
  box-shadow: 0 10px 20px -10px rgba(0, 0, 0, 0.7);
}

/* ---------- dialogs ---------- */

dialog {
  width: min(560px, calc(100vw - 32px));
  padding: 26px 28px 28px;
  color: var(--ink);
  background: var(--desk-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 40px 80px rgba(0, 0, 0, 0.6);
}

dialog::backdrop {
  background: rgba(12, 11, 9, 0.72);
  backdrop-filter: blur(3px);
}

.dlg-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.dlg-head h2 {
  margin: 0;
  font: 500 26px/1 var(--display);
  letter-spacing: -0.01em;
  text-transform: none;
  color: var(--ink);
}

.dlg-text {
  margin: 0 0 14px;
  font-size: 14px;
  color: var(--muted);
}

.lessons {
  margin: 0;
  padding: 0;
  list-style: none;
}

.lessons li {
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.lessons .row {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 12px;
  align-items: baseline;
  width: 100%;
  padding: 12px 0;
  background: none;
  border: 0;
  text-align: left;
  font: inherit;
  color: inherit;
}

.lessons button.row:hover b {
  color: var(--accent);
}

.lessons li.current .s {
  color: var(--muted);
}

.lessons li .n {
  font: 400 13px var(--mono);
}

.lessons li b {
  display: block;
  font: 500 18px/1.2 var(--display);
}

.lessons li span.d {
  font-size: 13px;
}

.lessons li .s {
  font: 400 11px var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.lessons li.open {
  color: var(--ink);
}

.lessons li.open .s {
  color: var(--accent);
}

.cam {
  position: relative;
  aspect-ratio: 4 / 3;
  background: #0f0e0c;
  border-radius: 8px;
  overflow: hidden;
}

.cam video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.cam-msg {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 24px;
  text-align: center;
  font-size: 14px;
  color: var(--muted);
}

.cam-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: 12px;
}

select {
  min-width: 0;
  padding: 10px 12px;
  color: var(--ink);
  background: rgba(236, 229, 214, 0.06);
  border: 1px solid var(--line);
  border-radius: 8px;
  font: 400 14px var(--body);
}

.upload {
  display: block;
  margin-top: 14px;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
}

.upload input {
  display: none;
}

.upload span {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.upload:hover span {
  color: var(--ink);
}

.lessons li.part {
  padding: 22px 0 8px;
  font: 400 11px var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

/* the learner's own photo */

.lessons .swap {
  display: block;
  margin: -6px 0 12px 46px;
  padding: 0;
  background: none;
  border: 0;
  font-size: 13px;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.lessons .swap:hover {
  color: var(--ink);
}

.own-preview {
  display: grid;
  place-items: center;
  padding: 12px;
  background: #0f0e0c;
  border-radius: 8px;
}

.own-preview[hidden] {
  display: none;
}

.own-preview canvas {
  display: block;
  max-width: 100%;
  max-height: 46vh;
  border-radius: 3px;
}

.own-wide {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  margin-top: 12px;
  font-size: 13px;
  color: var(--muted);
}

.own-wide[hidden] {
  display: none;
}

.own-wide input {
  width: 100%;
  accent-color: var(--accent);
}

.own-check {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
}

.own-check[hidden] {
  display: none;
}

.own-check input {
  accent-color: var(--accent);
}

.own-msg {
  margin: 12px 0 0;
  font-size: 14px;
  line-height: 1.45;
}

.own-msg.error {
  color: #f0a08a;
}

.own-row {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.own-pick {
  flex: 1;
  text-align: center;
  cursor: pointer;
}

.own-pick input {
  display: none;
}

.own-row .primary {
  flex: 1;
}

.dlg-note {
  margin: 14px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}

/* before you start: head and button stay put, the text between them scrolls */

dialog.prep {
  width: min(640px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 0;
  overflow: hidden;
}

dialog.prep[open] {
  display: flex;
  flex-direction: column;
}

/* Lines above and below the scrolling text, so it does not slide straight under the title. */
dialog.prep .dlg-head {
  margin: 0;
  padding: 24px 28px 12px;
  border-bottom: 1px solid var(--line);
}

.prep-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 28px 18px;
}

.prep-body .dlg-text {
  margin: 0;
}

.prep-part {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.prep-part h3 {
  margin: 0 0 10px;
  font: 400 11px/1 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.prep-grades .grade {
  padding: 0;
  color: var(--ink);
}

.prep-grades .use {
  display: block;
  margin-top: 6px;
  font: 400 12px/1.35 var(--body);
  color: var(--muted);
}

.prep-note {
  margin: 12px 0 0;
  font-size: 14px;
  color: var(--muted);
}

.prep-list {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.prep-list li {
  position: relative;
  padding-left: 16px;
  font-size: 14px;
  line-height: 1.5;
  color: #ded6c6;
}

.prep-list li::before {
  content: '';
  position: absolute;
  top: 0.68em;
  left: 0;
  width: 7px;
  height: 2px;
  background: var(--accent);
}

.prep-list b {
  font-weight: 600;
  color: var(--ink);
}

.prep-foot {
  display: flex;
  justify-content: flex-end;
  padding: 14px 28px 20px;
  border-top: 1px solid var(--line);
}

/* ---------- motion ---------- */

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

@keyframes settle {
  from {
    opacity: 0;
    transform: translateY(14px) rotate(-0.6deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .reveal,
  .sheet,
  .feedback {
    animation: none;
  }
}

/* ---------- narrow screens ---------- */

@media (max-width: 1020px) {
  body {
    overflow: auto;
    grid-template-rows: 58px auto;
  }

  main {
    grid-template-columns: 1fr;
  }

  .sheet,
  .transport,
  .ruler {
    width: 100%;
  }

  .card {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .ruler button .t {
    display: none;
  }
}
