/* Стиль по мотивам jack.art/credits: белый лист, моноширинный 11 px капсом, тонкие серые рамки */
:root { --ink: #111; --muted: #767676; --line: #e3e3e3; --faint: #bbb; }
* { box-sizing: border-box; }
body { margin: 0; background: #fff; color: var(--ink); font: 11px/1.65 ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Roboto Mono", monospace; text-transform: uppercase; }
a, button { font: inherit; color: inherit; text-transform: inherit; }
a { text-decoration: none; }
a:hover, button:hover { opacity: .6; }
a:focus-visible, button:focus-visible { outline: 1px solid var(--ink); outline-offset: 5px; }
h1, h2, p, figure { margin: 0; font: inherit; }
h1, h2, strong { font-weight: 700; }
.muted { color: var(--muted); }
img { display: block; max-width: 100%; height: auto; }
.px { image-rendering: pixelated; }

header, footer { display: flex; justify-content: space-between; gap: 16px; max-width: 1440px; margin: auto; padding: 22px 40px; }
header nav { display: flex; gap: 28px; white-space: nowrap; }
main { max-width: 1440px; margin: auto; padding: 18px 40px 0; }
.lost { min-height: 50vh; }
.intro { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 28px; }

.works, .construction { display: grid; grid-template-columns: 1fr 1fr; gap: 64px; align-items: start; }
.construction { margin-top: 65px; padding-bottom: 65px; align-items: stretch; }
.construction figure { display: flex; flex-direction: column; }
.construction .frame { flex: 1; }
.copy { display: flex; flex-direction: column; justify-content: center; }
/* схема на главной: три шага в строку, на телефоне столбиком */
.strip { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; align-items: center; align-content: center; gap: 10px; padding: 6%; }
.dstep { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.dstep .node { width: 100%; padding: 7px 4px; }
.dstep img { width: 100%; }
.strip .arrow { padding: 0 2px; }
.frame { border: 1px solid var(--line); }
.caption { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 58px; }

/* большой просмотр: холст, метка пикселя под курсором, ряд кнопок; справа разбор кредита на краски */
.works { align-items: stretch; }
.works figure { display: flex; flex-direction: column; }
.works .frame { flex: 1; }
.canvas-wrap { position: relative; }
#view { display: block; width: 100%; height: auto; cursor: pointer; touch-action: manipulation; }
#view:focus-visible { outline: 1px solid var(--ink); outline-offset: 4px; }
.loading { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; text-align: center; }
.ready .loading { display: none; }
.mark { position: absolute; width: calc(100% / 24); height: calc(100% / 24); outline: 1px solid var(--ink); outline-offset: 1px; pointer-events: none; }
.mark.hover { outline-color: #b5b5b5; }
.controls { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); }
.controls button { padding: 18px 0; border: 0; border-left: 1px solid var(--line); background: #fff; cursor: pointer; }
.controls button:first-child { border-left: 0; }
.controls button[aria-pressed="true"] { text-decoration: underline; text-underline-offset: 4px; }
.actions { display: flex; gap: 20px; }
.inspector { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 8%; }
.swatch { display: inline-block; width: 11px; height: 11px; margin-right: 8px; vertical-align: -1px; border: 1px solid var(--line); }
.credit { width: 40%; height: auto; image-rendering: pixelated; border: 1px solid var(--line); }
.ink canvas { display: block; width: 100%; height: auto; image-rendering: pixelated; border: 1px solid var(--line); }
.meta { margin-top: 24px; text-align: center; }
.wall { margin-top: 65px; }
.thumbs { display: grid; grid-template-columns: repeat(12, 1fr); padding: 3%; }
.thumbs button { padding: 0; border: 0; background: #fff; cursor: pointer; }
.thumbs img { display: block; width: 100%; height: auto; }
.thumbs button[aria-current="true"] { outline: 1px solid var(--ink); outline-offset: -1px; }
.textbtn { padding: 0; border: 0; background: none; cursor: pointer; }
.caption > span, .actions > * { white-space: nowrap; }
.keys { display: none; }
@media (min-width: 1100px) and (hover: hover) { .keys { display: inline; } }

.sheet { display: grid; place-items: center; padding: 8%; }
.sheet img { width: 100%; }

.copy { padding: 8%; line-height: 1.8; }
.copy p { max-width: 470px; }
.copy p + p { margin-top: 24px; }

.diagram { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 8%; }
.node { width: 76%; padding: 7px; border: 1px solid #e8e8e8; text-align: center; }
.arrow { padding: 8px 0; color: var(--faint); line-height: 1; }
.step.small { width: 40%; }
.step.wide { width: 64%; }

/* статья: пары «текст и картинка», широкие картинки на всю строку, текст строчными для чтения */
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 64px; align-items: start; margin-bottom: 65px; }
.wide { margin-bottom: 65px; }
.wide .frame { padding: 5%; }
.wide img { width: 100%; }
.prose { display: flex; flex-direction: column; justify-content: center; padding: 8%; text-transform: none; font-size: 12.5px; line-height: 1.75; }
.prose h2 { margin-bottom: 22px; font-size: 11px; text-transform: uppercase; }
.prose p { max-width: 62ch; }
.prose p + p { margin-top: 18px; }
.prose a { text-decoration: underline; text-underline-offset: 3px; }
.inks { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; width: 76%; }
.ink img { width: 100%; border: 1px solid var(--line); }
.ink span { display: block; margin-top: 6px; color: var(--muted); text-align: center; }
nav a[aria-current="page"] { text-decoration: underline; text-underline-offset: 4px; }
/* Checks: настоящие работы с цепочки, от 80 галочек до одной, последней клеткой Black Check */
.checks { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; width: 100%; }
.checks figure img { width: 100%; }
.checks figcaption { margin-top: 6px; color: var(--muted); text-align: center; }
.bc { display: flex; flex-direction: column; align-items: center; justify-content: center; aspect-ratio: 1; border: 1px solid #e8e8e8; text-align: center; }

footer { margin-top: 30px; }

@media (max-width: 900px) { .pair { grid-template-columns: 1fr; gap: 35px; } }

/* соседние окна статьи одной высоты: картинка тянется до высоты текста, а под текстом место на подпись */
@media (min-width: 901px) {
  .pair { align-items: stretch; }
  .pair > figure { display: flex; flex-direction: column; }
  .pair > figure > .frame { flex: 1; }
  .pair > .prose { margin-bottom: 58px; }
}

/* на компьютере первый ряд главной целиком в окне: высота окон зависит от высоты экрана,
   холст и разбор кредита ужимаются под неё (размеры в единицах контейнера) */
@media (min-width: 701px) {
  .works .frame { flex: none; height: clamp(440px, min(calc(100svh - 186px), calc((min(100vw, 1440px) - 144px) / 2 * 1.25)), 780px); }
  .explorer { display: flex; flex-direction: column; }
  .explorer .stage { flex: 1; min-height: 0; container-type: size; display: grid; place-items: center; padding: 5%; }
  .explorer .canvas-wrap { width: min(100cqw, 100cqh); }
  .inspector { container-type: size; padding: 6%; }
  .inspector .credit { width: min(40cqw, calc((100cqh - 190px) / 1.6)); }
  .inspector .inks { width: min(76cqw, calc((100cqh - 190px) / 1.6 * 2.4)); }
}

@media (max-width: 700px) {
  header, footer { padding: 22px; }
  header nav { gap: 16px; }
  main { padding: 38px 22px 0; }
  .intro { flex-direction: column; gap: 20px; }
  .works, .construction { grid-template-columns: 1fr; gap: 35px; }
  .construction { margin-top: 35px; }
  .pair { grid-template-columns: 1fr; gap: 35px; margin-bottom: 35px; }
  .wide { margin-bottom: 35px; }
  .inks { width: 100%; }
  .thumbs { grid-template-columns: repeat(6, 1fr); }
  .strip { grid-template-columns: 1fr; padding: 8% 22%; }
  .strip .arrow { padding: 4px 0; transform: rotate(90deg); justify-self: center; }
  .checks { gap: 8px; }
  .wall { margin-top: 35px; }
  .step.small { width: 50%; }
  .step.wide { width: 84%; }
}
