/* wh-lab preview 2026-11-16 — dot-matrix edition */

:root {
  --shell: #e4e4dc; /* device body */
  --shell-dot: #d3d3c9;
  --lcd: #c9d4c0; /* screen */
  --lcd-dim: #b8c5ae;
  --ink: #1d261c; /* lit pixel */
  --ink-2: #47553f;
  --paper: #f7f7f0;
  --mark: #e0431b; /* the pinky column, and buttons */

  --px: 4px; /* one "dot" */
  --dot: "DotGothic16", "Hiragino Kaku Gothic ProN", "Yu Gothic", monospace;

  --gutter: clamp(16px, 4vw, 48px);
  --max: 1216px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 8px;
}

body {
  margin: 0;
  background-color: var(--shell);
  background-image: radial-gradient(var(--shell-dot) 1px, transparent 1.5px);
  background-size: 8px 8px;
  color: var(--ink);
  font-family: var(--dot);
  font-size: 16px;
  line-height: 2;
  line-break: strict;
  overflow-wrap: anywhere;
  -webkit-font-smoothing: none;
  font-smooth: never;
}

img,
svg {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

a {
  color: inherit;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.3em;
}

a:hover {
  background: var(--ink);
  color: var(--lcd);
  text-decoration: none;
}

:focus-visible {
  outline: var(--px) solid var(--mark);
  outline-offset: var(--px);
}

h1,
h2,
h3,
p,
dl,
dd,
ul,
ol,
figure,
table {
  margin: 0;
  padding: 0;
  font-weight: 400;
}

ul,
ol {
  list-style: none;
}

.wrap {
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip {
  position: absolute;
  left: -9999px;
}

.skip:focus {
  left: var(--gutter);
  top: 8px;
  z-index: 10;
  background: var(--ink);
  color: var(--lcd);
  padding: 4px 12px;
}

/* ---------- Sprites ---------- */

.sprite {
  width: 64px;
  height: 64px;
  flex: none;
  width: auto !important; /* height is set per context; width follows each sprite's viewBox (tails widen it) */
}

.sprite .fb {
  visibility: hidden;
}

/* ---------- Screen (LCD panel) ---------- */

.screen {
  background-color: var(--lcd);
  background-image: linear-gradient(rgba(29, 38, 28, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(29, 38, 28, 0.05) 1px, transparent 1px);
  background-size: var(--px) var(--px);
  border: var(--px) solid var(--ink);
  box-shadow: 8px 8px 0 rgba(29, 38, 28, 0.16);
}

/* ---------- Header ---------- */

.site-header {
  background: var(--ink);
  color: var(--lcd);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px 24px;
  padding-block: 10px;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 24px;
  line-height: 1;
  text-decoration: none;
}

.wordmark .sprite {
  width: 32px;
  height: 32px;
}

.site-header a:hover,
.site-footer a:hover {
  background: var(--lcd);
  color: var(--ink);
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  justify-content: flex-end;
}

.site-nav a {
  display: block;
  font-size: 16px;
  line-height: 1;
  padding: 8px 10px;
  text-decoration: none;
  white-space: nowrap;
}

.site-nav a[aria-current="page"] {
  background: var(--lcd);
  color: var(--ink);
}

/* ---------- Section index (in-page) ---------- */

.toc {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--shell);
  border-bottom: var(--px) solid var(--ink);
}

.toc ul {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-block: 8px;
}

.toc ul::-webkit-scrollbar {
  display: none;
}

.toc a {
  display: block;
  font-size: 16px;
  line-height: 1;
  padding: 6px 10px;
  text-decoration: none;
  white-space: nowrap;
}

/* ---------- Page head ---------- */

.page-head {
  padding-block: clamp(28px, 5vw, 56px) clamp(24px, 4vw, 40px);
}

.page-head .wrap {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: 24px;
  align-items: end;
}

.page-head .title {
  grid-column: 1 / span 6;
}

.page-head .summary {
  grid-column: 8 / span 5;
  padding-bottom: 12px;
}

.kind {
  display: inline-block;
  font-size: 14px;
  line-height: 1;
  background: var(--ink);
  color: var(--lcd);
  padding: 5px 8px;
  margin-bottom: 16px;
}

.page-head h1 {
  font-size: clamp(72px, 13vw, 176px);
  line-height: 0.95;
  letter-spacing: -0.08em;
  margin-left: -0.05em;
}

.page-head.is-small h1 {
  font-size: clamp(40px, 6.6vw, 88px);
  line-height: 1.1;
  margin-left: -0.03em;
}

.summary p {
  font-size: clamp(16px, 1.6vw, 20px);
  line-height: 1.9;
  text-wrap: balance;
  word-break: auto-phrase;
}

/* ---------- Figures ---------- */

figure img {
  width: 100%;
  background: var(--lcd-dim);
  border: var(--px) solid var(--ink);
}

figcaption {
  margin-top: 10px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--ink-2);
}

figcaption::before {
  content: "▲ ";
}

.hero-photo img {
  box-shadow: 8px 8px 0 rgba(29, 38, 28, 0.16);
}

/* ---------- Facts (readouts) ---------- */

.facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: clamp(28px, 4vw, 44px);
}

.facts div {
  padding: 10px 14px 12px;
}

.facts dt {
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-2);
}

.facts dd {
  font-size: clamp(28px, 3.6vw, 48px);
  line-height: 1.2;
  margin-top: 2px;
}

.facts dd small {
  font-size: 16px;
  margin-left: 4px;
}

/* ---------- Sections ---------- */

.section {
  padding-block: clamp(36px, 5.5vw, 72px);
}

.section > .wrap {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: 24px;
}

.section > .wrap::before {
  content: "";
  grid-column: 1 / -1;
  height: var(--px);
  margin-bottom: 20px;
  background-image: linear-gradient(90deg, var(--ink) 50%, transparent 50%);
  background-size: 8px var(--px);
}

.section-label {
  grid-column: 1 / span 3;
  align-self: start;
  position: sticky;
  top: 56px;
}

.section-label h2 {
  font-size: 24px;
  line-height: 1.3;
}

.section-label h2::before {
  content: "▶";
  display: inline-block;
  font-size: 16px;
  margin-right: 8px;
  vertical-align: 3px;
  color: var(--mark);
}

.section-label p {
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-2);
  margin: 2px 0 0 24px;
}

.section-body {
  grid-column: 4 / span 9;
  min-width: 0;
}

.section-body > * + * {
  margin-top: clamp(24px, 3.5vw, 40px);
}

.prose p {
  font-size: 16px;
  line-height: 2.1;
  max-width: 36em;
}

.prose p + p {
  margin-top: 1em;
}

.prose .statement {
  font-size: clamp(20px, 2.5vw, 32px);
  line-height: 1.7;
  max-width: 22em;
  margin-bottom: 0.9em;
  text-wrap: balance;
  word-break: auto-phrase;
}

/* definition row, e.g. name origin */
.defline {
  display: grid;
  grid-template-columns: 9em 1fr;
  gap: 16px;
  border-top: 2px dotted var(--ink);
  border-bottom: 2px dotted var(--ink);
  padding-block: 10px;
  max-width: 36em;
  font-size: 16px;
  line-height: 1.6;
}

.defline dt {
  color: var(--ink-2);
}

.defline dd b {
  color: var(--mark);
  font-weight: 400;
}

.defline + .defline {
  margin-top: 0;
  border-top: 0;
}

/* ---------- Features ---------- */

.features {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.features li {
  background: var(--paper);
  border: var(--px) solid var(--ink);
  padding: 14px 18px 18px;
}

.features h3 {
  font-size: 20px;
  line-height: 1.5;
}

.features h3::before {
  content: "■";
  color: var(--mark);
  margin-right: 8px;
}

.features p {
  font-size: 16px;
  line-height: 1.9;
  margin-top: 6px;
}

/* ---------- Layout drawing ---------- */

.drawing {
  padding: clamp(12px, 3vw, 36px) clamp(4px, 2vw, 28px);
}

.drawing svg {
  width: 100%;
  height: auto;
}

.drawing .key {
  fill: var(--paper);
  stroke: var(--ink);
  stroke-width: 0.5;
}

.drawing .key.pinky {
  fill: var(--mark);
  stroke: var(--ink);
}

.drawing .legend {
  font-family: var(--dot);
  font-size: 6px;
  fill: var(--ink-2);
  text-anchor: middle;
  dominant-baseline: central;
}

.drawing .legend.on {
  fill: #fff;
}

.drawing .part {
  fill: none;
  stroke: var(--ink-2);
  stroke-width: 0.5;
  stroke-dasharray: 1 1;
}

.drawing .ball {
  fill: var(--paper);
  stroke: var(--ink);
  stroke-width: 0.5;
}

.drawing .dim {
  stroke: var(--ink);
  stroke-width: 0.4;
  fill: none;
}

.drawing .dim-text {
  font-family: var(--dot);
  font-size: 5.5px;
  fill: var(--ink);
}

.keylist {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 28px;
  font-size: 14px;
  line-height: 1.8;
  margin-top: 16px;
}

.keylist .chip {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 8px;
  vertical-align: -1px;
  background: var(--paper);
  border: 2px solid var(--ink);
}

.keylist .chip.pinky {
  background: var(--mark);
}

.keylist .chip.dash {
  background: none;
  border-style: dotted;
}

/* ---------- Tables ---------- */

.spec {
  width: 100%;
  border-collapse: collapse;
  font-size: 16px;
  line-height: 1.8;
}

.spec th,
.spec td {
  text-align: left;
  vertical-align: top;
  font-weight: 400;
  padding: 10px 0;
  border-bottom: 2px dotted var(--ink);
}

.spec tr:first-child th,
.spec tr:first-child td {
  border-top: 2px dotted var(--ink);
}

.spec th {
  width: 32%;
  color: var(--ink-2);
  padding-right: 20px;
}

.spec td small {
  display: block;
  font-size: 14px;
  color: var(--ink-2);
}

/* ---------- Color ---------- */

.swatches {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: 24px;
}

.swatches li {
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 2px dotted var(--ink);
  padding-block: 10px;
  font-size: 16px;
  line-height: 1.5;
}

.swatch {
  flex: none;
  width: 24px;
  height: 24px;
  border: var(--px) solid var(--ink);
}

.swatch.two {
  background: linear-gradient(90deg, var(--a) 50%, var(--b) 50%);
}

/* ---------- Gallery ---------- */

.gallery {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px 16px;
}

.gallery img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: var(--px) solid var(--ink);
}

.gallery p {
  font-size: 14px;
  line-height: 1.7;
  margin-top: 8px;
}

.note {
  font-size: 14px;
  line-height: 1.9;
  color: var(--ink-2);
  max-width: 44em;
}

/* ---------- Buttons ---------- */

.button {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: var(--mark);
  color: #fff;
  font-size: 18px;
  line-height: 1.4;
  padding: 12px 20px;
  text-decoration: none;
  border: var(--px) solid var(--ink);
  box-shadow: var(--px) var(--px) 0 var(--ink);
}

.button::after {
  content: "▶";
  font-size: 14px;
}

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

.button:active {
  transform: translate(var(--px), var(--px));
  box-shadow: none;
}

/* ---------- Top page ---------- */

.intro {
  padding-block: clamp(28px, 5vw, 56px) clamp(8px, 2vw, 24px);
}

.pet {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 24px;
  padding: clamp(20px, 4vw, 48px);
}

.pet h1 {
  font-size: clamp(64px, 12vw, 160px);
  line-height: 0.95;
  letter-spacing: -0.08em;
  margin-left: -0.05em;
}

.pet .lead {
  font-size: clamp(16px, 2vw, 24px);
  line-height: 1.8;
  margin-top: clamp(16px, 2.5vw, 28px);
  max-width: 22em;
  text-wrap: balance;
  word-break: auto-phrase;
}

.cats {
  display: flex;
  align-items: flex-end;
  gap: clamp(8px, 2vw, 24px);
  padding-bottom: 12px;
  border-bottom: var(--px) dotted var(--ink);
}

.cats figure {
  text-align: center;
}

.cats .sprite {
  width: clamp(80px, 13vw, 160px);
  height: clamp(80px, 13vw, 160px);
}

.cats figcaption {
  margin-top: 4px;
  font-size: 14px;
  line-height: 1.4;
  color: var(--ink);
}

.cats figcaption::before {
  content: none;
}

.works li + li {
  margin-top: 16px;
}

.works a {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  column-gap: 24px;
  align-items: start;
  padding: 12px;
  background: var(--paper);
  border: var(--px) solid var(--ink);
  text-decoration: none;
  color: inherit;
}

.works a:hover {
  background: var(--lcd);
  color: var(--ink);
  box-shadow: 8px 8px 0 var(--ink);
  transform: translate(-4px, -4px);
}

.works .thumb {
  grid-column: 1 / span 4;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border: var(--px) solid var(--ink);
}

.works .text {
  grid-column: 5 / span 5;
  padding-top: 4px;
}

.works .kind {
  margin-bottom: 10px;
}

.works h3 {
  font-size: clamp(28px, 3.6vw, 48px);
  line-height: 1.15;
}

.works p.desc {
  font-size: 16px;
  line-height: 1.9;
  margin-top: 8px;
  max-width: 26em;
}

.works .more {
  display: inline-block;
  font-size: 16px;
  margin-top: 10px;
}

.works .more::before {
  content: "▶ ";
  color: var(--mark);
}

/* ---------- Profiles (About) ---------- */

.profiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.profiles li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 20px;
  align-items: center;
  padding: 20px;
}

.profiles .sprite {
  width: 128px;
  height: 128px;
}

.profiles h3 {
  font-size: 28px;
  line-height: 1.3;
}

.profiles p {
  font-size: 14px;
  line-height: 1.8;
  color: var(--ink-2);
}

/* ---------- Plain lists ---------- */

.plain li {
  border-bottom: 2px dotted var(--ink);
  padding-block: 10px;
  font-size: 16px;
  line-height: 1.9;
  max-width: 40em;
}

.plain li::before {
  content: "■";
  color: var(--mark);
  margin-right: 10px;
}

/* ---------- Footer ---------- */

.site-footer {
  background: var(--ink);
  color: var(--lcd);
  margin-top: clamp(40px, 6vw, 80px);
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px 32px;
  padding-block: 20px 16px;
}

.site-footer .wordmark {
  font-size: 20px;
}

.site-footer p {
  font-size: 14px;
  line-height: 1.5;
}

.site-footer .pair {
  display: flex;
  gap: 8px;
}

.site-footer .pair .sprite {
  width: 48px;
  height: 48px;
}

/* ---------- Narrow screens ---------- */

@media (max-width: 900px) {
  .page-head .title,
  .page-head .summary {
    grid-column: 1 / -1;
  }

  .page-head .summary {
    margin-top: 20px;
    padding-bottom: 0;
  }

  .section-label,
  .section-body {
    grid-column: 1 / -1;
  }

  .section-label {
    position: static;
    margin-bottom: 20px;
  }

  .gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .site-header .wrap {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .site-nav ul {
    justify-content: flex-start;
    margin-left: -10px;
  }

  .facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .features,
  .swatches,
  .profiles {
    grid-template-columns: minmax(0, 1fr);
  }

  .spec th {
    width: 38%;
  }

  .defline {
    grid-template-columns: 6.5em 1fr;
  }

  .pet {
    grid-template-columns: minmax(0, 1fr);
  }

  .cats {
    justify-content: flex-start;
  }

  .works a {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 12px;
  }

  .works .thumb,
  .works .text {
    grid-column: 1 / -1;
  }

  .profiles .sprite {
    width: 96px;
    height: 96px;
  }
}

/* ---------- Motion ---------- */

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }

  .sprite .fa {
    animation: frame-a 4s steps(1) infinite;
  }

  .sprite .fb {
    animation: frame-b 4s steps(1) infinite;
  }

  .sprite.is-haku .fa,
  .sprite.is-haku .fb {
    animation-delay: -1.7s;
  }

  .cats .sprite,
  .site-footer .pair .sprite {
    animation: hop 1.2s steps(1) infinite;
  }

  .cats .sprite.is-haku,
  .site-footer .pair .sprite.is-haku {
    animation-delay: -0.6s;
  }
}

@keyframes frame-a {
  0%,
  100% {
    visibility: visible;
  }
  93% {
    visibility: hidden;
  }
}

@keyframes frame-b {
  0%,
  100% {
    visibility: hidden;
  }
  93% {
    visibility: visible;
  }
}

@keyframes hop {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6.25%);
  }
}

/* =====================================================================
   Colour and weight pass — bolder pixels, toy-gadget palette
   ===================================================================== */

:root {
  --ink: #241d45;
  --ink-2: #554c80;
  --shell: #fff3d0;
  --shell-dot: #ffdc8f;
  --lcd: #bfe8c6;
  --lcd-dim: #a5dcb0;
  --paper: #ffffff;
  --mark: #ff4f2e;

  --yellow: #ffd23f;
  --pink: #ff9fbd;
  --sky: #8ed8ff;
  --mint: #96e6aa;
  --violet: #c2b0ff;

  --dot: "Pixelify Sans", "DotGothic16", "Hiragino Kaku Gothic ProN", "Yu Gothic", monospace;
  --stripe: repeating-linear-gradient(
    90deg,
    var(--yellow) 0 16px,
    var(--pink) 16px 32px,
    var(--sky) 32px 48px,
    var(--mint) 48px 64px
  );
}

body {
  font-weight: 500;
  /* double-strike bold: keeps the dot font crisp while thickening it */
  text-shadow: 0.055em 0 0 currentColor;
}

h1,
h2,
h3,
.wordmark,
.site-nav a,
.toc a,
.button,
.kind,
.facts dd,
.cats figcaption,
.cast figcaption {
  font-weight: 700;
}

.page-head h1,
.pet h1 {
  letter-spacing: -0.02em;
  text-shadow: 0.05em 0.05em 0 var(--yellow);
}

a:hover {
  background: var(--ink);
  color: var(--yellow);
}

/* header / footer */
.site-header {
  border-bottom: 8px solid;
  border-image: var(--stripe) 8;
}

.site-footer {
  border-top: 8px solid;
  border-image: var(--stripe) 8;
}

.wordmark {
  color: var(--yellow);
}

.site-header a:hover,
.site-footer a:hover,
.site-nav a[aria-current="page"] {
  background: var(--yellow);
  color: var(--ink);
}

.toc {
  background: var(--yellow);
}

.kind {
  color: var(--yellow);
}

/* screens and hard shadows */
.screen {
  box-shadow: 8px 8px 0 var(--ink);
}

figure img {
  box-shadow: 6px 6px 0 var(--ink);
}

.gallery img,
.works .thumb {
  box-shadow: none;
}

.pet.screen {
  background-color: var(--sky);
}

.facts div:nth-child(1) {
  background-color: var(--yellow);
}
.facts div:nth-child(2) {
  background-color: var(--pink);
}
.facts div:nth-child(3) {
  background-color: var(--sky);
}
.facts div:nth-child(4) {
  background-color: var(--mint);
}

.facts dt,
figcaption,
.section-label p,
.spec th,
.spec td small,
.note,
.defline dt {
  color: var(--ink-2);
}

/* cards */
.features li,
.works a {
  box-shadow: 4px 4px 0 var(--ink);
}

.features li:nth-child(1),
.works li:nth-child(1) a {
  background: #fff1ad;
}
.features li:nth-child(2),
.works li:nth-child(2) a {
  background: #ffd3e0;
}
.features li:nth-child(3),
.works li:nth-child(3) a {
  background: #cdeeff;
}
.features li:nth-child(4),
.works li:nth-child(4) a {
  background: #d0f6d8;
}

.works a:hover {
  box-shadow: 8px 8px 0 var(--ink);
}

.works li:nth-child(1) a:hover {
  background: var(--yellow);
}
.works li:nth-child(2) a:hover {
  background: var(--pink);
}
.works li:nth-child(3) a:hover {
  background: var(--sky);
}
.works li:nth-child(4) a:hover {
  background: var(--mint);
}

/* section markers cycle through the palette */
.section:nth-of-type(4n + 2) .section-label h2::before {
  color: #2f9bff;
}
.section:nth-of-type(4n + 3) .section-label h2::before {
  color: #ff5fa0;
}
.section:nth-of-type(4n + 4) .section-label h2::before {
  color: #2fbf63;
}

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

/* characters */
.cast {
  display: flex;
  gap: 24px;
}

.cast figure {
  text-align: center;
}

.cast .sprite {
  width: 96px;
  height: 96px;
}

.cast figcaption,
.cats figcaption {
  font-size: 16px;
  color: var(--ink);
  margin-top: 4px;
}

.cast figcaption::before {
  content: none;
}

.profiles li {
  display: block;
  padding: 16px 20px 20px;
}

.profiles li:nth-child(1) {
  background-color: #ffd3e0;
}

.profiles li:nth-child(2) {
  background-color: #cdeeff;
}

.profiles h3 {
  font-size: 32px;
  line-height: 1.2;
}

.poses {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
}

.profiles .poses .sprite {
  width: 96px;
  height: 96px;
}

@media (prefers-reduced-motion: no-preference) {
  .cast .sprite {
    animation: hop 1.2s steps(1) infinite;
  }

  .cast .sprite.is-haku {
    animation-delay: -0.6s;
  }
}

@media (max-width: 640px) {
  .profiles .poses .sprite {
    width: 80px;
    height: 80px;
  }
}

/* weight tuning: real bold where the font has it, double-strike only for body text */
body {
  font-weight: 400;
  text-shadow: 1px 0 0 currentColor;
}

h1,
h2,
h3,
.wordmark,
.site-nav a,
.toc a,
.button,
.kind,
.facts dd,
.cats figcaption,
.cast figcaption {
  text-shadow: none;
}

.page-head h1,
.pet h1 {
  text-shadow: 0.05em 0.05em 0 var(--yellow);
}

.prose .statement,
.summary p,
.pet .lead {
  text-shadow: 0.05em 0 0 currentColor;
}

.poses {
  flex-wrap: nowrap;
}

.profiles .poses .sprite {
  flex: 30 1 0;
  min-width: 0;
  max-width: 140px;
  height: auto;
}

.profiles .poses .sprite[viewBox^="-9"] {
  flex-grow: 33;
  max-width: 154px;
}

/* =====================================================================
   3D viewer
   ===================================================================== */

.viewer {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background-color: var(--sky);
}

.viewer canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  touch-action: none;
}

.viewer canvas:active {
  cursor: grabbing;
}

.viewer:not([data-state="ready"]) canvas {
  visibility: hidden;
}

.viewer-fallback {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.viewer-load {
  position: absolute;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  white-space: nowrap;
  cursor: pointer;
  font-family: inherit;
}

.viewer-load:active {
  transform: translate(calc(-50% + var(--px)), var(--px));
}

.viewer[data-state="ready"] .viewer-fallback,
.viewer[data-state="ready"] .viewer-load,
.viewer[data-state="error"] .viewer-fallback,
.viewer[data-state="error"] .viewer-load {
  display: none;
}

.viewer[data-state="loading"] .viewer-load {
  pointer-events: none;
  opacity: 0.75;
}

/* Controls sit in the corners of the 3D screen, over the canvas. */
.viewer-hud {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: none;
  justify-content: flex-end;
  align-items: flex-start;
  gap: 8px;
  padding: 16px;
  pointer-events: none;
  font-size: 15px;
  line-height: 1.4;
}

.viewer[data-state="ready"] .viewer-hud {
  display: flex;
}

/* The menus stay unpositioned so their panels can size against the whole screen. */
.hud-top-left,
.hud-bottom-left {
  position: absolute;
}

.viewer-hud > * {
  pointer-events: auto;
}

.hud-top-left {
  top: 16px;
  left: 16px;
}

.hud-top-right {
  display: contents;
}

/* One row along the bottom edge: buttons, then a slim slider, leaving the model clear. */
.hud-bottom-left {
  left: 16px;
  right: 88px;
  bottom: 16px;
  display: flex;
  align-items: flex-end;
  gap: 12px;
  pointer-events: none;
}

.hud-bottom-left > * {
  pointer-events: auto;
}

.hud-bottom-left .viewer-toolbar {
  order: -1;
  flex: none;
}

.viewer-hud .seg {
  gap: 8px;
}

.viewer-hud .seg button,
.viewer-hud summary {
  padding: 6px 10px;
  white-space: nowrap;
}

.hud-bottom-left .slider {
  flex: 1 1 0;
  min-width: 0;
  max-width: 320px;
  min-height: 44px;
  grid-template-columns: auto minmax(0, 1fr) 3em;
  gap: 0 10px;
  padding: 0 10px;
  font-size: 14px;
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  border: var(--px) solid var(--ink);
}

.hud-bottom-left .slider label {
  grid-area: 1 / 1;
  white-space: nowrap;
}

.hud-bottom-left .slider input {
  grid-area: 1 / 2;
  height: 24px;
}

.hud-bottom-left .slider output {
  grid-area: 1 / 3;
  text-align: right;
}

.viewer-hud summary {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  list-style: none;
  font-weight: 700;
  text-shadow: none;
  color: var(--ink);
  background: var(--paper);
  border: var(--px) solid var(--ink);
  box-shadow: var(--px) var(--px) 0 var(--ink);
  cursor: pointer;
}

.viewer-hud summary::-webkit-details-marker {
  display: none;
}

.viewer-hud summary::after {
  content: "▼";
  font-size: 10px;
  color: var(--mark);
}

.viewer-hud summary:hover {
  background: var(--sky);
}

.viewer-hud details[open] > summary {
  background: var(--yellow);
}

.viewer-hud details[open] > summary::after {
  content: "▲";
}

/* Panels hang from the top-right corner and scroll inside the screen. */
.hud-panel {
  position: absolute;
  top: 72px;
  right: 16px;
  z-index: 3;
  width: min(300px, calc(100% - 32px));
  max-height: calc(100% - 88px);
  overflow-y: auto;
  margin: 0;
  padding: 12px;
  min-width: 0;
  display: grid;
  gap: 10px;
  background: var(--paper);
  border: var(--px) solid var(--ink);
  box-shadow: var(--px) var(--px) 0 var(--ink);
}

.hud-panel legend {
  float: left;
  width: 100%;
  padding: 0;
  font-size: 14px;
  color: var(--ink-2);
}

.hud-panel .chips {
  padding-top: 0;
  gap: 0 12px;
}

.hud-panel .chip {
  font-size: 14px;
  gap: 8px;
}

.hud-panel .viewer-status {
  margin: 0;
}

.viewer-shell > .viewer-status {
  margin-top: 12px;
}

.seg {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.seg button,
.future-reset {
  font: inherit;
  font-weight: 700;
  line-height: 1.4;
  text-shadow: none;
  color: var(--ink);
  background: var(--paper);
  border: var(--px) solid var(--ink);
  box-shadow: var(--px) var(--px) 0 var(--ink);
  padding: 8px 14px;
  min-height: 44px;
  cursor: pointer;
}

.seg button.primary,
.seg button[aria-pressed="true"] {
  background: var(--yellow);
}

.seg button:not(:disabled):hover,
.future-reset:not(:disabled):hover {
  background: var(--sky);
}

.seg button:not(:disabled):active,
.future-reset:not(:disabled):active {
  transform: translate(var(--px), var(--px));
  box-shadow: none;
}

.seg button:disabled,
.future-reset:disabled {
  opacity: 0.45;
  cursor: default;
}

.future-reset {
  justify-self: start;
}

.slider {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 16px;
  align-items: center;
  font-size: 16px;
  line-height: 1.5;
}

.slider input {
  grid-column: 1 / -1;
  width: 100%;
  height: 32px;
  margin: 0;
  accent-color: var(--mark);
  cursor: pointer;
}

.chips {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 16px;
  padding-top: 8px;
}

.chip {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  font-size: 16px;
  line-height: 1.4;
  cursor: pointer;
}

.chip input {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--mark);
}

.model-notes {
  border-top: 2px dotted var(--ink);
}

.model-notes {
  border-bottom: 2px dotted var(--ink);
}

.model-notes summary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  cursor: pointer;
  list-style: none;
  font-weight: 700;
  text-shadow: none;
}

.model-notes summary::-webkit-details-marker {
  display: none;
}

.model-notes summary::before {
  content: "▶";
  font-size: 12px;
  color: var(--mark);
}

.model-notes[open] > summary::before {
  content: "▼";
}

.viewer-status,
.model-notes p {
  font-size: 14px;
  line-height: 1.9;
  color: var(--ink-2);
}

.model-notes p {
  max-width: 44em;
  margin-bottom: 12px;
}

/* demo frame page */
.demo-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}

.demo-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 20px;
  padding: 10px var(--gutter);
  background: var(--ink);
  color: var(--paper);
  border-bottom: 8px solid;
  border-image: var(--stripe) 8;
}

.demo-bar a {
  color: var(--yellow);
  font-weight: 700;
  text-shadow: none;
}

.demo-bar a:hover {
  background: var(--yellow);
  color: var(--ink);
}

.demo-bar strong {
  font-weight: 700;
  text-shadow: none;
}

.demo-bar p {
  font-size: 14px;
  line-height: 1.6;
}

.demo-frame {
  flex: 1;
  width: 100%;
  border: 0;
  background: #fff;
}

@media (max-width: 640px) {
  .viewer {
    aspect-ratio: 4 / 5;
  }

  .viewer-hud {
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-end;
    padding: 8px;
    font-size: 13px;
  }

  .hud-top-left {
    top: 8px;
    left: 8px;
  }

  .hud-bottom-left {
    left: 8px;
    right: 64px;
    bottom: 8px;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .hud-bottom-left .viewer-toolbar {
    order: 0;
  }

  .hud-bottom-left .slider {
    flex: none;
    width: 100%;
    max-width: none;
    min-height: 32px;
    font-size: 13px;
  }

  .viewer-hud .seg {
    gap: 6px;
  }

  .viewer-hud .seg button,
  .viewer-hud summary {
    padding: 6px 7px;
  }

  .hud-panel {
    top: 112px;
    right: 8px;
    width: calc(100% - 16px);
    max-height: calc(100% - 120px);
  }

  .hud-panel .chips {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 8px;
  }

  .hud-panel .chip {
    font-size: 13px;
    gap: 6px;
  }

  .viewer-zoom {
    right: 8px;
    bottom: 8px;
  }

  .viewer-load {
    font-size: 16px;
  }

  .chips {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* =====================================================================
   Japanese line breaking: break between phrases, never inside one
   ===================================================================== */

body {
  word-break: auto-phrase;
  text-wrap: pretty;
}

.ph {
  display: inline-block;
}

.prose p {
  max-width: 42em;
}

.prose .lines span:not(.ph) {
  display: block;
}

.prose .lines span:not(.ph) + span:not(.ph) {
  margin-top: 0.35em;
}

/* layout switch and viewer zoom buttons */
.layout-switch + figure {
  margin-top: 16px;
}

.viewer-zoom {
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: 2;
  display: none;
  flex-direction: column;
  box-shadow: var(--px) var(--px) 0 var(--ink);
}

.viewer[data-state="ready"] .viewer-zoom {
  display: flex;
}

.viewer-zoom button {
  width: 48px;
  height: 48px;
  padding: 0;
  font: inherit;
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  text-shadow: none;
  color: var(--ink);
  background: var(--paper);
  border: var(--px) solid var(--ink);
  cursor: pointer;
}

.viewer-zoom button + button {
  border-top: 0;
}

.viewer-zoom button:hover {
  background: var(--yellow);
}

.viewer-zoom button:active {
  background: var(--sky);
}

/* legend chips must not pick up the viewer's checkbox-row styles */
.keylist .chip {
  display: inline-block;
  min-height: 0;
  gap: 0;
  cursor: default;
}

/* small labels inside the drawing: the plain dot face stays legible at this size */
.drawing .legend,
.drawing .dim-text {
  font-family: "DotGothic16", monospace;
  font-size: 7px;
}

/* gallery: nine photos first, the rest behind a toggle */
.gallery li {
  line-height: 0;
}

.gallery-more {
  margin-top: 16px;
}

.gallery-more summary,
.gallery-close {
  display: flex;
  justify-content: center;
  align-items: center;
  width: fit-content;
  min-height: 48px;
  margin-inline: auto;
  padding: 8px 24px;
  list-style: none;
  cursor: pointer;
  font-weight: 700;
  text-shadow: none;
  background: var(--paper);
  border: var(--px) solid var(--ink);
  box-shadow: var(--px) var(--px) 0 var(--ink);
}

.gallery-more summary::-webkit-details-marker {
  display: none;
}

.gallery-more summary:hover,
.gallery-close:hover {
  background: var(--yellow);
}

.gallery-more summary:active,
.gallery-close:active {
  transform: translate(var(--px), var(--px));
  box-shadow: none;
}

.gallery-more .when-open,
.gallery-more[open] .when-closed {
  display: none;
}

.gallery-more[open] .when-open {
  display: inline;
}

.gallery-more .gallery {
  margin-top: 20px;
}

.gallery-close {
  font: inherit;
  font-weight: 700;
  color: var(--ink);
  margin-top: 20px;
}
