/* Coloring Jay — a quiet white gallery: logo top left, lowercase nav, a masonry wall of pages. */
@font-face { font-family: 'Karla'; font-weight: 400; font-style: normal; font-display: swap; src: url('/assets/fonts/karla-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Karla'; font-weight: 700; font-style: normal; font-display: swap; src: url('/assets/fonts/karla-latin-700-normal.woff2') format('woff2'); }

:root {
  --bg: #ffffff;
  --ink: #232323;
  --soft: #6b6b6b;
  --tile: #f2f2ef;
  --blue: #2f6fd0;
  --max: 82rem;
  --pad: clamp(1rem, 4.5vw, 4.3rem);
  --gap: 1rem;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: 'Karla', system-ui, sans-serif; font-size: 1.0625rem; line-height: 1.55; -webkit-font-smoothing: antialiased; }
h1, h2, h3, p, figure, ul, ol, dl, dd { margin: 0; }
ul[class], ol[class] { padding: 0; list-style: none; }
img, svg, canvas { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
::selection { background: #cfe0fa; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: 1rem; top: -4rem; background: var(--ink); color: #fff; padding: 0.6rem 1rem; z-index: 10; }
.skip:focus { top: 1rem; }
.wrap { width: 100%; max-width: calc(var(--max) + 2 * var(--pad)); margin-inline: auto; padding-inline: var(--pad); }
.link { text-decoration: none; transition: color 180ms ease; }
.link:hover { color: var(--blue); }
.u { text-decoration: underline; text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
.u:hover { color: var(--blue); }
.small { font-size: 0.875rem; }
.soft { color: var(--soft); }

/* ---------- header ---------- */
.top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-top: 1rem; padding-bottom: 1.25rem; }
.brand { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; }
.brand-name { font-weight: 700; font-size: 1.5rem; letter-spacing: -0.01em; line-height: 1; }
.nav { display: flex; gap: 0.25rem 1.5rem; flex-wrap: wrap; font-size: 0.95rem; }
.nav a[aria-current="page"] { color: var(--blue); }
.social { display: flex; align-items: center; gap: 1rem; }
.social a { display: inline-flex; align-items: center; gap: 0.45rem; text-decoration: none; font-size: 0.95rem; }
.social svg { width: 22px; height: 22px; }
/* color-set toggle: three swatches, the chosen one ringed */
.sets { display: none; align-items: center; gap: 0.15rem; }
.js .sets { display: inline-flex; }
.sets button { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; color: var(--ink); }
.sets svg { width: 20px; height: 20px; border-radius: 50%; transition: transform 180ms var(--ease); }
.sets button:hover svg { transform: scale(1.12); }
.sets button[aria-checked="true"] { box-shadow: inset 0 0 0 1.5px var(--ink); }
@media (prefers-reduced-motion: reduce) { .sets svg { transition: none; } .sets button:hover svg { transform: none; } }
.social svg, .sets { flex-shrink: 0; }
@media (max-width: 40em) { .social { gap: 0.5rem; } .sets { gap: 0; } .sets button { width: 30px; height: 30px; } .sets svg { width: 18px; height: 18px; } }
@media (max-width: 40em) { .brand .jay { width: 72px; } .brand-name { font-size: 1.3rem; } .social .label { display: none; } }

/* ---------- the jay (holds still) ---------- */
.brand .jay { width: 96px; height: auto; }

/* ---------- intro line ---------- */
.intro { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 1rem; margin-bottom: 1.5rem; }
.intro h1 { font-size: 1.0625rem; font-weight: 700; }
.intro p { color: var(--soft); max-width: 70ch; }
.intro .actions { margin-left: auto; font-size: 0.95rem; }

/* ---------- masonry wall ---------- */
.wall { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap); align-items: start; }
@media (max-width: 64em) { .wall { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 40em) { .wall { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; } }
.piece { position: relative; display: block; background: #fff; text-decoration: none; overflow: hidden; }
.piece img { width: 100%; height: auto; box-shadow: none; transition: transform 600ms var(--ease); }
.piece .title { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 1rem; text-align: center; background: rgba(255, 255, 255, 0.82); font-weight: 700; font-size: 1.05rem; opacity: 0; transition: opacity 250ms ease; }
.piece:hover .title, .piece:focus-visible .title { opacity: 1; }
.piece:hover img { transform: scale(1.03); }
@media (hover: none) { .piece .title { position: static; opacity: 1; background: none; padding: 0.6rem 0 0; font-size: 0.95rem; } }

/* ---------- sections on inner pages ---------- */
.section { margin-top: 4.5rem; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: 1.25rem; }
.section-head h2 { font-size: 1.0625rem; font-weight: 700; }
.themes { display: flex; flex-wrap: wrap; gap: 0.4rem 1.5rem; margin-bottom: 1.5rem; font-size: 0.95rem; }

/* ---------- a single page ---------- */
.crumbs { font-size: 0.875rem; color: var(--soft); margin-bottom: 1.25rem; }
.crumbs ol { display: flex; flex-wrap: wrap; gap: 0.25rem 0.5rem; }
.crumbs li + li::before { content: '/'; margin-right: 0.5rem; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { color: var(--blue); }
.detail { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 2rem clamp(2rem, 5vw, 5rem); align-items: start; }
.art { background: var(--tile); padding: clamp(1rem, 4vw, 3rem); }
.art .sheet { background: #fff; padding: 4%; }
.art .sheet img, .art .sheet canvas { width: 100%; height: auto; }
.info { position: sticky; top: 1.5rem; }
.info h1 { font-size: clamp(1.75rem, 1.2rem + 1.6vw, 2.5rem); font-weight: 700; line-height: 1.1; letter-spacing: -0.015em; }
.info .desc { margin-top: 1rem; color: var(--soft); }
.downloads { margin-top: 1.75rem; display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 2.9rem; padding: 0 1.3rem; border-radius: 999px; background: var(--ink); color: #fff; font-weight: 700; font-size: 0.95rem; text-decoration: none; transition: background-color 180ms ease, transform 140ms var(--ease); }
.btn:hover { background: var(--blue); }
.btn:active { transform: scale(0.97); }
.btn.alt { background: var(--tile); color: var(--ink); }
.btn.alt:hover { background: #e3eaf6; }
.more-links { margin-top: 0.9rem; display: flex; gap: 0.4rem 1.25rem; flex-wrap: wrap; font-size: 0.95rem; }
.facts { margin-top: 2rem; font-size: 0.9rem; }
.facts div { display: flex; justify-content: space-between; gap: 1rem; padding: 0.3rem 0; }
.facts dt { color: var(--soft); }
.tips { margin-top: 2rem; font-size: 0.95rem; color: var(--soft); }
.tips p + p { margin-top: 0.5rem; }
@media (max-width: 52em) { .detail { grid-template-columns: 1fr; } .info { position: static; } }

/* colorer */
.colorer { position: relative; }
.colorer canvas { display: block; cursor: crosshair; touch-action: manipulation; }
.colorer .lines { position: absolute; inset: 0; width: 100%; height: 100%; mix-blend-mode: multiply; pointer-events: none; }
.palette { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 1rem; }
.palette button { width: 2.5rem; height: 2.5rem; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgba(0,0,0,0.12); transition: transform 140ms var(--ease); }
.palette button[aria-pressed="true"] { outline: 3px solid var(--ink); outline-offset: 2px; }
.palette button:active { transform: scale(0.9); }
.color-tools { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; margin-top: 0.9rem; font-size: 0.9rem; }
.color-tools button { text-decoration: underline; text-underline-offset: 0.2em; }

/* ---------- reading pages ---------- */
.read { max-width: 44rem; }
.read h1 { font-size: clamp(1.75rem, 1.2rem + 1.6vw, 2.5rem); font-weight: 700; line-height: 1.12; letter-spacing: -0.015em; }
.read .lead { margin-top: 1rem; font-size: 1.15rem; color: var(--soft); }
.read .answer { margin-top: 1.75rem; padding: 1.25rem 1.5rem; background: var(--tile); font-size: 1.15rem; }
.read h2 { font-size: 1.25rem; font-weight: 700; margin: 2.5rem 0 0.75rem; }
.read p { max-width: 66ch; }
.read p + p { margin-top: 0.9em; }
.read figure { margin: 2rem 0; background: var(--tile); padding: 1.5rem; max-width: 22rem; }
.read figure .sheet { background: #fff; padding: 4%; }
.read figcaption { margin-top: 0.75rem; font-size: 0.875rem; color: var(--soft); }
.read .toc { margin-top: 1.5rem; display: flex; flex-wrap: wrap; gap: 0.3rem 1.25rem; font-size: 0.95rem; }
.qa > div { padding: 1.25rem 0; }
.qa > div + div { border-top: 1px solid #ececec; }
.qa h2 { margin: 0 0 0.4rem; font-size: 1.1rem; }
.qa h2 a { text-decoration: none; }
.qa h2 a:hover { color: var(--blue); }
.related { margin-top: 0.5rem; }
.related li + li { margin-top: 0.4rem; }

.notfound { padding: 6rem 0; text-align: center; }
.notfound h1 { font-size: 2rem; }
.notfound p { margin: 1rem auto 2rem; }

/* ---------- footer ---------- */
.foot { margin-top: 6rem; padding-top: 2rem; padding-bottom: 2.5rem; text-align: center; font-size: 0.875rem; color: var(--soft); }
.foot nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.3rem 1.25rem; margin-bottom: 1.1rem; }
.foot .social { justify-content: center; margin-top: 0.9rem; }
.foot .social svg { width: 20px; height: 20px; }

/* the coloring animation draws on a canvas laid exactly over each page */
.frame { position: relative; display: block; }
.frame .paint { position: absolute; inset: 0; width: 100%; height: 100%; display: block; transition: transform 600ms var(--ease); }
.piece:hover .paint { transform: scale(1.03); }
main { padding-bottom: 4rem; }
