/*
 * The app's look, built on ICANHAZUIKIT role tokens (docs/uikit.md). The kit loads first; this file
 * never redeclares a kit name and never reads a primitive. App-only variables carry the --pc- prefix.
 *
 * Black and white (Dave, 2026-11-22): the interface uses only the kit's neutral, inverse and border
 * roles, never the accent or a status color, so nothing in the chrome competes with the colors being
 * judged. Swatches, drapes and the photo keep their real color. Light theme is near-black on white;
 * dark theme is near-white on near-black.
 */
:root {
  /* Figma's Button has a 112px minimum width (--size-button-min-width), which the built kit doesn't
     carry yet (ICANHAZDESIGN 7a4623a). Asked of the kit's owner; swap to the kit's name when it lands. */
  --pc-button-min-width: 7rem;
  --pc-content-width: 40rem;
  --pc-stage-ratio: 3 / 4;
  --pc-swatch-size: 3rem;
}

body {
  font-family: var(--font-family-sans);
}

/* `hidden` must win over the display a class sets (.stack is flex), or every screen shows at once. */
[hidden] {
  display: none !important;
}

/* The kit's focus ring is the accent; in black and white it takes the text color. */
:focus-visible {
  outline-color: var(--color-text-primary);
}

.container {
  max-width: var(--pc-content-width);
  margin: 0 auto;
  padding: var(--gap-lg) var(--gap-md);
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap-md);
  margin-bottom: var(--gap-lg);
}

h1,
h2,
h3,
p {
  margin: 0;
}

.muted {
  color: var(--color-text-secondary);
}

.card {
  background: var(--color-surface-raised);
  border: var(--border-width-default) solid var(--color-border-subtle);
  border-radius: var(--radius-container);
  padding: var(--gap-md);
  margin-bottom: var(--gap-md);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--gap-sm);
}

.stack-lg {
  display: flex;
  flex-direction: column;
  gap: var(--gap-md);
}

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--gap-sm);
}

label {
  display: flex;
  flex-direction: column;
  gap: var(--gap-xs);
  color: var(--color-text-secondary);
}

input {
  font: inherit;
  color: var(--color-text-primary);
  background: var(--color-surface-page);
  border: var(--border-width-default) solid var(--color-border-default);
  border-radius: var(--radius-control);
  min-height: var(--size-control);
  padding: 0 var(--inset-control-x);
}

/* Buttons: the COMPONENTS file's Button (Primary, Secondary, Quiet, Danger). */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--gap-sm);
  min-height: var(--size-control);
  min-width: var(--pc-button-min-width);
  padding: 0 var(--inset-control-x);
  border: var(--border-width-default) solid transparent;
  border-radius: var(--radius-control);
  background: var(--color-surface-inverse);
  color: var(--color-text-inverse);
  cursor: pointer;
  text-decoration: none;
}

.btn-secondary {
  background: transparent;
  color: var(--color-text-primary);
  border-color: var(--color-border-strong);
}

/* Quiet has no fill or border, so in black and white the underline is what says "button". */
.btn-quiet {
  background: transparent;
  color: var(--color-text-primary);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.btn:disabled {
  background: var(--color-surface-sunken);
  color: var(--color-text-disabled);
  border-color: transparent;
  cursor: default;
}

/* A file input dressed as a Secondary button (test mode's "Use a photo"). */
.file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.tag {
  display: inline-block;
  border: var(--border-width-default) solid var(--color-border-strong);
  background: transparent;
  color: var(--color-text-primary);
  border-radius: var(--radius-pill);
  padding: 0 var(--gap-sm);
  white-space: nowrap;
}

/* Errors: the strongest thing on the page, so they're inverted rather than colored. */
.flash {
  background: var(--color-surface-inverse);
  color: var(--color-text-inverse);
  border-radius: var(--radius-control);
  padding: var(--gap-sm) var(--gap-md);
  margin-bottom: var(--gap-md);
}

.notice {
  border: var(--border-width-default) solid var(--color-border-strong);
  background: var(--color-surface-sunken);
  color: var(--color-text-primary);
  border-radius: var(--radius-control);
  padding: var(--gap-sm) var(--gap-md);
}

.checklist {
  margin: 0;
  padding-left: var(--gap-lg);
  display: flex;
  flex-direction: column;
  gap: var(--gap-xs);
}

/* The camera stage: the live video, mirrored like a mirror, under a face oval. */
.stage {
  position: relative;
  width: 100%;
  aspect-ratio: var(--pc-stage-ratio);
  background: var(--color-surface-inverse);
  border-radius: var(--radius-container);
  overflow: hidden;
}

.stage video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

.stage .oval {
  position: absolute;
  left: 22%;
  top: 10%;
  width: 56%;
  height: 58%;
  border: var(--border-width-strong) dashed var(--color-text-inverse);
  border-radius: 50%;
  pointer-events: none;
}

/* Good light: the dashed oval turns solid. */
.stage .oval.ready {
  border-style: solid;
}

.hint {
  min-height: 1.5em;
}

/* Something to fix reads heavier; good light reads quieter. */
.hint.bad {
  color: var(--color-text-primary);
  font-weight: 600;
}

.hint.good {
  color: var(--color-text-secondary);
}

/* Readout tables. */
table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: var(--gap-xs) var(--gap-sm);
  border-bottom: var(--border-width-default) solid var(--color-border-subtle);
}

td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.chip {
  display: inline-block;
  width: var(--gap-md);
  height: var(--gap-md);
  border-radius: var(--radius-small);
  border: var(--border-width-default) solid var(--color-border-default);
  vertical-align: middle;
}

/* Axis bars: -1 to +1, with the marker placed by the script. */
.axis {
  display: grid;
  grid-template-columns: 6rem 1fr 6rem;
  align-items: center;
  gap: var(--gap-sm);
}

.axis .track {
  position: relative;
  height: var(--gap-sm);
  background: var(--color-surface-sunken);
  border-radius: var(--radius-pill);
}

.axis .marker {
  position: absolute;
  top: 50%;
  width: var(--gap-md);
  height: var(--gap-md);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: var(--color-surface-inverse);
  border: var(--border-width-strong) solid var(--color-surface-raised);
}

.axis span:last-child {
  text-align: right;
}

/* Drape pairs: two renders side by side; tapping one picks it. */
.pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap-sm);
}

.pair button {
  padding: 0;
  border: var(--border-width-strong) solid transparent;
  border-radius: var(--radius-container);
  background: none;
  cursor: pointer;
  overflow: hidden;
}

.pair button:hover {
  border-color: var(--color-border-strong);
}

.pair canvas {
  display: block;
  width: 100%;
  height: auto;
}

/* Palettes. */
.swatches {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--pc-swatch-size), 1fr));
  gap: var(--gap-sm);
}

.swatch {
  aspect-ratio: 1;
  border-radius: var(--radius-control);
  border: var(--border-width-default) solid var(--color-border-subtle);
}

.progress {
  width: 100%;
  accent-color: var(--color-text-primary);
}
