/* Discover page. Shared tokens and the course header live in course.css. */
:root {
  /* Low paper shadow under each card, deeper on hover. */
  --mat: 0 0 0 1px rgb(var(--sh) / .05), 0 1px 1px rgb(var(--sh) / .04), 0 10px 24px -10px rgb(var(--sh) / .18);
  --mat-up: 0 0 0 1px rgb(var(--sh) / .06), 0 2px 2px rgb(var(--sh) / .04), 0 18px 36px -12px rgb(var(--sh) / .24);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --hair: rgb(30 40 34 / .12);
  --track: #dcdfd7;
}

* { box-sizing: border-box; }
p, h1, h2, ol, figure { margin: 0; }
ol { padding: 0; list-style: none; }
button, input, select { font: inherit; color: inherit; }
button, select, input[type=range] { cursor: pointer; }
button, a, input, select { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button { border: 0; }
a { color: var(--ink); text-underline-offset: 3px; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible,
pre:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.mono { font-family: var(--mono); }

.discover { max-width: 1240px; margin: 0 auto; padding: 16px 24px 40px; font-family: var(--ui); -webkit-font-smoothing: antialiased; }
.intro { font-size: 14px; line-height: 1.5; color: var(--muted); margin-bottom: 18px; max-width: 62ch; }

.wall { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; }

/* Mat card: white mat, square corners, hairline around the art, low paper shadow. */
.sketch-card {
  --art: clamp(170px, 18vw, 230px);
  position: relative;
  display: grid;
  grid-template-columns: var(--art) minmax(0, 1fr);
  min-width: 0;
  padding: 16px;
  background: #fff;
  border-radius: 2px;
  box-shadow: var(--mat);
  transition: transform .32s var(--ease), box-shadow .32s var(--ease);
}
@media (hover: hover) {
  .sketch-card:hover { transform: translateY(-3px); box-shadow: var(--mat-up); }
}
/* An open seed tip rides above the neighbouring cards. */
.sketch-card:has([aria-expanded=true]) { z-index: 5; }
/* Only the artwork is clipped, so the seed tip can extend past the card. */
.sketch-art { width: var(--art); aspect-ratio: 1; align-self: start; line-height: 0; overflow: hidden; box-shadow: 0 0 0 1px rgb(var(--sh) / .1); }
.sketch-canvas { display: block; width: 100%; height: auto; aspect-ratio: 1; }
@keyframes settle { from { opacity: .25; transform: scale(.985); } to { opacity: 1; transform: none; } }
.sketch-canvas.settle { animation: settle .42s var(--ease); }

/* Details, top to bottom: title; lineage; seed with New seed; the control; See the code and the lesson link. */
.sketch-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto auto auto 1fr;
  align-items: center;
  gap: 8px 12px;
  min-width: 0;
  padding: 2px 4px 0 20px;
}
.sketch-head { grid-column: 1 / -1; display: flex; align-items: baseline; gap: 8px; }
.sketch-index { font-size: 12px; color: var(--muted); letter-spacing: .04em; }
.sketch-head h2 { font-size: 15px; line-height: 1.3; font-weight: 500; letter-spacing: 0; }
.sketch-lineage { grid-column: 1 / -1; margin-top: -4px; font-size: 13px; line-height: 1.4; color: #4d5850; }
.lineage-label { font-size: 12px; color: var(--muted); }
.sketch-seed { grid-column: 1; font-size: 12px; color: var(--muted); white-space: nowrap; }
.seed-word { color: #242c27; }
.sketch-actions { display: contents; }
.new-seed { grid-column: 2; grid-row: 3; justify-self: end; }
.sketch-control { grid-column: 1 / -1; grid-row: 4; display: grid; gap: 2px; }
.code-button { grid-column: 1; grid-row: 5; align-self: end; justify-self: start; margin-left: -8px; }
.lesson-link { grid-column: 2; grid-row: 5; align-self: end; justify-self: end; }

.field-label { display: block; font-size: 13px; line-height: 1.4; font-weight: 500; color: #3b463f; }
.control-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.control-row output { font-size: 12px; color: var(--muted); }

/* Slider: thin track filled to the value, round thumb that grows under the pointer. --fill is set by discover.mjs. */
.sketch-control input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 24px;
  margin: 0;
  background: transparent;
}
.sketch-control input[type=range]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 99px;
  background: linear-gradient(to right, var(--ink) var(--fill, 50%), var(--track) var(--fill, 50%));
}
.sketch-control input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -6px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--ink);
  box-shadow: 0 1px 3px rgb(var(--sh) / .25);
  transition: transform .18s var(--ease), box-shadow .18s var(--ease);
}
.sketch-control input[type=range]:hover::-webkit-slider-thumb { transform: scale(1.15); }
.sketch-control input[type=range]:active::-webkit-slider-thumb { transform: scale(1.25); box-shadow: 0 0 0 6px rgb(36 62 49 / .12), 0 1px 3px rgb(var(--sh) / .25); }
.sketch-control input[type=range]::-moz-range-track { height: 4px; border-radius: 99px; background: var(--track); }
.sketch-control input[type=range]::-moz-range-progress { height: 4px; border-radius: 99px; background: var(--ink); }
.sketch-control input[type=range]::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 2px solid var(--ink); }

/* Select: soft field with its own chevron. */
.sketch-control select {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  min-height: 32px;
  margin-top: 4px;
  padding: 5px 30px 5px 10px;
  font-size: 13px;
  border: 1px solid var(--hair);
  border-radius: 2px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23243e31' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 11px center;
  box-shadow: 0 1px 2px rgb(var(--sh) / .05);
  transition: border-color .18s var(--ease);
}
.sketch-control select:hover { border-color: rgb(30 40 34 / .28); }

/* Buttons: quiet raised chips that press in. */
.button {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 5px 12px;
  border: 1px solid var(--hair);
  border-radius: 2px;
  background: #fff;
  box-shadow: 0 1px 2px rgb(var(--sh) / .06);
  font-size: 13px;
  line-height: 1.4;
  font-weight: 500;
  white-space: nowrap;
  color: var(--ink);
  transition: transform .16s var(--ease), background-color .16s var(--ease), box-shadow .16s var(--ease), border-color .16s var(--ease);
}
.button:hover { background: #f3f4ef; border-color: rgb(30 40 34 / .2); box-shadow: 0 2px 6px rgb(var(--sh) / .08); }
.button:active { transform: scale(.97); box-shadow: 0 1px 1px rgb(var(--sh) / .06); }
.code-button { padding-inline: 8px; background: transparent; border-color: transparent; box-shadow: none; }
.code-button:hover { background: rgb(36 62 49 / .07); border-color: transparent; box-shadow: none; }
.code-button .glyph { margin-right: 6px; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.lesson-link {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  font-size: 13px;
  white-space: nowrap;
  text-decoration-color: rgb(36 62 49 / .35);
  transition: text-decoration-color .16s var(--ease);
}
.lesson-link:hover { text-decoration-color: var(--ink); }

.sketch-complete { margin-left: auto; font: 12px/1 var(--mono); color: var(--ink); white-space: nowrap; }
.sketch-complete::before { content: ''; display: inline-block; width: 8px; height: 4px; margin: 0 6px 3px 0; border-left: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); }

.course-map { margin-top: 40px; padding-top: 18px; border-top: 1px solid var(--line); max-width: 860px; }
.course-map h2 { font-size: 15px; font-weight: 500; margin-bottom: 12px; }
.course-parts { display: grid; gap: 8px; counter-reset: part; }
.course-parts li { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 12px; font-size: 14px; line-height: 1.5; counter-increment: part; }
.part-name::before { content: counter(part) "  "; font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: pre; }
.part-name { font-weight: 500; }
.part-line, .optional { color: var(--muted); }
.optional { font-weight: 400; }
.next-step { margin-top: 18px; font-size: 14px; line-height: 1.5; }
.next-step a { display: inline-flex; align-items: center; min-height: 44px; margin-left: 4px; }

/* Two cards across once the details have room for the seed line plus New seed. */
@media (min-width: 1200px) {
  .wall { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Phone: art on top, details below, every control at least 44px tall. */
@media (max-width: 759px) {
  .discover { padding: 12px 16px 32px; }
  .wall { gap: 18px; }
  .sketch-card { grid-template-columns: minmax(0, 1fr); padding: 12px; }
  .sketch-art { width: 100%; }
  .sketch-body { padding: 14px 2px 2px; }
  .sketch-head h2 { font-size: 16px; }
  .sketch-control input[type=range] { height: 44px; }
  .sketch-control select, .button, .lesson-link { min-height: 44px; }
  .course-parts li { grid-template-columns: minmax(0, 1fr); gap: 2px; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
  .sketch-card:hover { transform: none; }
  .sketch-canvas.settle { animation: none !important; }
}
