@import url('../tools/study.css');

:root[data-theme="dark"] {
  --study-background: #181c1b;
  --study-ink: #e7ebe4;
  --study-muted: #a0aaa2;
  --study-line: #39413b;
  --study-accent: #a8d9bb;
  --control-count: 4;
  color-scheme: dark;
}

.chromatic-study { letter-spacing: 0; }
.chromatic-study .study-header { gap: 20px; }
.chromatic-study h1 { font-size: 36px; line-height: 1.1; letter-spacing: 0; }
.chromatic-study .title-stop { color: #ed806f; }
.chromatic-study .study-identity p { color: #b3bbb3; }
.chromatic-study .study-actions { flex-wrap: wrap; gap: 5px; }
.chromatic-study .tool { flex: 0 0 38px; width: 38px; height: 38px; }
.chromatic-study .tool svg { width: 17px; height: 17px; }
.chromatic-study .study-stage { min-height: 360px; background: #181c1b; overflow: hidden; }
.chromatic-study #canvas { display: block; position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; outline-offset: -3px; }
.chromatic-study #canvas:focus-visible { outline: 1px solid var(--study-accent); }
.chromatic-study .study-stats,
.chromatic-study .study-readout { z-index: 1; pointer-events: none; font-variant-numeric: tabular-nums; }
.chromatic-study .study-stats > span:first-child { display: flex; align-items: center; gap: 8px; }
.state-mark { width: 5px; height: 5px; background: #a8d9bb; display: inline-block; }
.chromatic-study[data-paused="true"] .state-mark { background: #dcb963; }
.chromatic-study .study-readout { gap: 18px; }
.coverage { flex: 1; max-width: 120px; height: 2px; background: #39413b; margin-right: auto; }
.coverage i { display: block; width: 0; height: 100%; background: #a8d9bb; }
.chromatic-study .control { min-width: 0; }
.chromatic-study legend { width: 100%; }
#color-name { float: right; color: #c4ccc4; text-transform: none; font-weight: 400; }
.swatches { display: flex; gap: 5px; align-items: center; }
.swatch { position: relative; display: grid; place-items: center; width: 29px; height: 32px; flex: 0 0 29px; cursor: pointer; }
.swatch input { position: absolute; width: 100%; height: 100%; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.swatch i { display: block; width: 21px; height: 21px; background: var(--swatch); border-radius: 2px; pointer-events: none; }
.swatch input:checked + i { outline: 1px solid var(--study-ink); outline-offset: 3px; }
.swatch input:focus-visible + i { outline: 2px solid var(--study-ink); outline-offset: 3px; }
.ivory { --swatch: #f0eee3; }
.coral { --swatch: #ed806f; }
.mint { --swatch: #a8d9bb; }
.jade { --swatch: #318c79; }
.iris { --swatch: #a59bcf; }
.saffron { --swatch: #dcb963; }
.chromatic-study .inlay-control { display: flex; flex-direction: column; justify-content: space-between; gap: 12px; }
.chromatic-study .toggle { justify-content: space-between; }
.chromatic-study .colophon { gap: 14px; }
.chromatic-study .colophon > span { min-width: 0; overflow-wrap: anywhere; }
.chromatic-study .experiment-panel-trigger { flex-shrink: 0; }
.experiment-panel[data-theme="dark"] { --panel-background: #202622; }

@media (min-width: 761px) {
  .chromatic-study .study-controls { grid-template-columns: minmax(210px, 1.2fr) repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .chromatic-study { min-height: max(780px, 100svh); }
  .chromatic-study .study-header { flex: 0 0 auto; align-items: flex-start; flex-direction: column; flex-wrap: nowrap; gap: 16px; padding: 24px 0 18px; }
  .chromatic-study .study-identity { flex: none; }
  .chromatic-study h1 { font-size: 32px; }
  .chromatic-study .study-actions { gap: 3px; margin-left: 0; }
  .chromatic-study .tool { width: 40px; height: 40px; flex-basis: 40px; }
  .chromatic-study .study-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chromatic-study .palette-control { grid-column: 1 / -1; }
  .chromatic-study .inlay-control { grid-column: 1 / -1; flex-direction: row; align-items: center; }
  .chromatic-study .inlay-control .toggle { min-width: 140px; }
  .swatch { width: 40px; height: 40px; flex-basis: 40px; }
  .swatch i { width: 26px; height: 26px; }
  .chromatic-study .colophon { font-size: 9px; }
  .chromatic-study .study-stats,
  .chromatic-study .study-readout { font-size: 9px; gap: 8px; }
}

@media (max-width: 360px) {
  .chromatic-study h1 { font-size: 28px; }
  .chromatic-study .study-actions { gap: 1px; }
  .chromatic-study .tool { width: 36px; height: 38px; flex-basis: 36px; }
  .chromatic-study .colophon { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  .chromatic-study *, .chromatic-study *::before, .chromatic-study *::after { transition: none !important; animation: none !important; }
}
