:root {
  color-scheme: light;
  --ink: #000;
  --paper: #faf4e9;
  --white: #fff;
  --yellow: #fdc600;
  --blue: #1c5dfb;
  --red: #fa3039;
  --green: #81ce8b;
  --plot-ink: #1745bc;
  --mono: "IBM Plex Mono", "DejaVu Sans Mono", monospace;
  color: var(--ink);
  background: var(--paper);
  font-family: "DejaVu Sans", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
body, figure, h1, h2, p { margin: 0; }
a { color: inherit; }
button { color: inherit; font: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--plot-ink); outline-offset: 5px; }

.field {
  position: relative;
  min-height: max(100svh, 720px);
}
.registration { position: absolute; font: 400 1rem var(--mono); color: #525252; }
.top-left { top: 4%; left: 3%; }
.top-right { top: 4%; right: 3%; }
.bottom-left { bottom: 8%; left: 3%; }
.bottom-right { bottom: 8%; right: 3%; }

.hero { position: absolute; inset: 50% auto auto 50%; transform: translate(-50%, -50%); }
.hero h1 { display: flex; gap: .16em; align-items: center; font-size: clamp(5rem, 11vw, 9.625rem); line-height: .96; letter-spacing: -.105em; font-weight: 900; }
.hero img { width: .49em; height: auto; }
.hero h1 span { padding-right: .095em; background: linear-gradient(transparent 46%, var(--yellow) 46% 92%, transparent 92%); }
.hero p { position: absolute; left: 50%; top: calc(100% + 15px); transform: translateX(-50%); white-space: nowrap; font-size: clamp(.85rem, 1.5vw, 1.15rem); }

[data-feature="preview"] { --feature-bg: var(--blue); --feature-ink: var(--white); }
[data-feature="images"] { --feature-bg: var(--green); }
[data-feature="export"] { --feature-bg: var(--red); }
[data-feature="color"] { --feature-bg: var(--yellow); }
[data-feature="results"] { --feature-bg: var(--ink); --feature-ink: var(--white); }
[data-feature="credits"] { --feature-bg: #d4c6ff; }

.float {
  position: absolute;
  z-index: 1;
  left: var(--x);
  top: var(--y);
  display: flex;
  align-items: center;
  gap: clamp(.65rem, 1.6vw, 1.2rem);
  transform: translate(-50%, -50%) rotate(var(--angle));
  min-height: 44px;
  border: 2px solid var(--ink);
  background: var(--feature-bg, var(--white));
  color: var(--feature-ink, var(--ink));
  box-shadow: 4px 4px var(--ink);
  padding: .6rem .75rem;
  white-space: nowrap;
  font: 700 clamp(.7rem, 1.1vw, .91rem)/1.2 var(--mono);
  transition: transform 120ms;
}
.float span { font-size: 1rem; }
.float:hover, .float:focus-visible, .float[aria-expanded="true"] { transform: translate(-50%, -50%); }
.float-svg { --x: 26.55%; --y: 17%; --angle: -3deg; }
.float-preview { --x: 73.45%; --y: 17%; --angle: 3deg; }
.float-images { --x: 13.3%; --y: 50%; --angle: 3deg; }
.float-export { --x: 86.7%; --y: 50%; --angle: -3deg; }
.float-color { --x: 26.55%; --y: 83.2%; --angle: -3deg; }
.float-results { --x: 73.45%; --y: 83.2%; --angle: 3deg; }

.sample-pair {
  position: absolute;
  left: 50%;
  display: grid;
  align-items: center;
  grid-template-columns: minmax(0, 3fr) minmax(0, 4fr);
  gap: clamp(.85rem, 2.4vw, 2rem);
  width: min(30vw, 390px);
  transform: translate(-50%, -50%);
}
.samples-top { top: 17%; }
.samples-bottom { top: 81%; width: min(32vw, 394px); }
.sample { min-width: 0; text-align: center; transform: rotate(var(--tilt)); }
.sample-outline { --tilt: -7deg; width: 90%; }
.sample-stipple { --tilt: 5deg; }
.sample-portrait { --tilt: -5deg; width: 87%; justify-self: center; }
.sample-tone { --tilt: 6deg; }
.drawing { position: relative; }
.drawing > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; filter: grayscale(1); opacity: .14; }
.sample canvas { position: relative; display: block; width: 100%; height: auto; }
.sample .drawing { border: 1px solid #c5b9a2; background: #fffaf1; }
.replay { margin-top: .3rem; padding: .45rem .3rem; border: 0; background: transparent; font: 600 .68rem var(--mono); }
.replay:hover { text-decoration: underline; text-underline-offset: .25em; }
footer {
  position: absolute;
  right: 3%;
  bottom: 2.5%;
  left: 3%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: .55rem;
  font: 600 .7rem var(--mono);
}
footer a { text-decoration: none; }
footer a:hover { text-decoration: underline; }
footer a:last-child { justify-self: end; }
.credit-trigger {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  min-height: 36px;
  padding: .35rem .5rem;
  border: 2px solid var(--ink);
  background: var(--feature-bg);
  box-shadow: 3px 3px var(--ink);
  transform: rotate(-2deg);
}
.credit-trigger:hover, .credit-trigger:focus-visible, .credit-trigger[aria-expanded="true"] { transform: none; }

dialog {
  position: fixed;
  inset: auto;
  margin: 0;
  width: min(390px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 3px solid var(--ink);
  color: var(--ink);
  background: var(--white);
  box-shadow: 6px 6px var(--ink);
}
dialog::backdrop { background: #0002; }
dialog.has-examples { width: min(475px, calc(100vw - 32px)); }
.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .8rem;
  background: var(--feature-bg, var(--white));
  color: var(--feature-ink, var(--ink));
  border-bottom: 3px solid var(--ink);
  padding: .3rem .6rem .3rem .85rem;
}
.dialog-header h2 { font: 700 1rem var(--mono); }
.close { width: 2rem; height: 2rem; border: 1px solid currentColor; background: transparent; font-size: 1.2rem; }
.close:focus-visible { outline-color: currentColor; outline-offset: 2px; }
.dialog-body { padding: .9rem; font-size: .9rem; line-height: 1.55; }
.dialog-body p + p { margin-top: .8rem; }
.credit-links { display: flex; flex-wrap: wrap; column-gap: .85rem; row-gap: .4rem; font: 700 .73rem var(--mono); }
.example-selector { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .85rem; }
.example-selector button { min-height: 36px; border: 2px solid var(--ink); background: var(--white); padding: .3rem .5rem; font: 700 .75rem var(--mono); }
.example-selector button[aria-pressed="true"] { background: var(--yellow); }
.example-description { margin-top: .7rem; }
.comparison { display: flex; align-items: start; justify-content: center; gap: .75rem; margin-top: .85rem; }
.comparison img, .comparison canvas { display: block; max-width: 100%; width: auto; height: auto; max-height: 155px; object-fit: contain; margin-inline: auto; }
.comparison figcaption { margin-top: .3rem; font: .7rem var(--mono); text-align: center; }
.comparison .replay { display: block; margin-inline: auto; }
.comparison figure { flex: 0 1 50%; min-width: 0; }
.comparison .replay { white-space: normal; }
.example-credit { display: inline-block; margin-top: .5rem; font: .7rem var(--mono); }

@media (901px <= width <= 1240px) {
  .float-svg, .float-color { --x: 22%; }
  .float-preview, .float-results { --x: 78%; }
  .samples-bottom { width: 29vw; }
}

@media (max-width: 900px) {
  .field { min-height: max(100svh, 820px); }
  .hero h1 { font-size: clamp(4.5rem, 15vw, 6.5rem); }
  .sample-pair { width: min(calc(100% - 48px), 332px); gap: 1rem; }
  .samples-top { top: 11%; width: min(calc(100% - 56px), 250px); }
  .samples-bottom { top: 81%; }
  .float {
    gap: .5rem;
    width: max-content;
    max-width: calc(48vw - 12px);
    padding-inline: .5rem;
    text-align: left;
    white-space: normal;
  }
  .float-svg, .float-images, .float-color { --x: 26%; }
  .float-preview, .float-export, .float-results { --x: 74%; }
  .float-svg, .float-preview { --y: 24%; }
  .float-images, .float-export { --y: 34%; }
  .float-color, .float-results { --y: 63.5%; }
  .bottom-left, .bottom-right { bottom: 6%; }
  footer {
    bottom: 1%;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  .float { transition: none; }
}
