/* AirDraw — Fushift Portfolio design system (see ~/DESIGN.md).
   Warm bone canvas, charcoal ink, ultra-flat cards, spot pastels for status only. */

/* Local names are aliases onto the shared tokens in /css/fushift-theme.css —
   that file owns the palette and flips it for dark mode. Never put a literal
   colour here; it would not follow the theme. */
:root {
  --primary: var(--fx-accent);
  --bg: var(--fx-bg);
  --surface: var(--fx-surface);
  --border: var(--fx-border);
  --text: var(--fx-text);
  --muted: var(--fx-text-muted);

  --pale-blue: var(--fx-pale-blue);
  --pale-green: var(--fx-pale-green);
  --pale-amber: var(--fx-pale-amber);

  --r-sm: var(--fx-r-sm);
  --r-md: var(--fx-r-md);
  --r-lg: var(--fx-r-lg);

  --s-sm: var(--fx-s-sm);
  --s-md: var(--fx-s-md);
  --s-lg: var(--fx-s-lg);
  --s-xl: var(--fx-s-xl);

  --display: var(--fx-font-display);
  --body: var(--fx-font-body);
  --mono: var(--fx-font-mono);

  --ease: var(--fx-ease);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 64px var(--s-lg) 96px;
}

/* --- masthead ------------------------------------------------------- */

.masthead {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--s-xl);
  margin-bottom: var(--s-xl);
}

.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 var(--s-sm);
}

.display {
  font-family: var(--display);
  font-size: clamp(2.5rem, 8vw, 4.5rem);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin: 0 0 var(--s-md);
}

.lede {
  margin: 0;
  max-width: 58ch;
  color: var(--muted);
}

.status-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
  padding-top: 6px;
}

.badge {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--border);
  color: var(--muted);
  white-space: nowrap;
  transition: background 160ms var(--ease), color 160ms var(--ease);
}
.badge[data-state="live"]    { background: var(--pale-green); color: var(--fx-pale-green-ink); }
.badge[data-state="loading"] { background: var(--pale-amber); color: var(--fx-pale-amber-ink); }
.badge[data-state="idle"]    { background: var(--pale-blue);  color: var(--fx-pale-blue-ink); }
.badge[data-state="error"]   { background: var(--fx-pale-red); color: var(--fx-pale-red-ink); }

.meta {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--muted);
  text-align: right;
}

/* --- stage ---------------------------------------------------------- */

.stage-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.stage {
  position: relative;
  width: 100%;
  background: var(--bg);
  /* Replaced from JS once the real camera aspect ratio is known. */
  aspect-ratio: 4 / 3;
}

#video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* The feed is mirrored so moving right moves the pen right. Landmark x is
     flipped to match in app.js — change one and you must change the other. */
  transform: scaleX(-1);
  opacity: 0;
  transition: opacity 200ms var(--ease);
}
#video.visible { opacity: 0.16; }

#view {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;  /* let pointer-drawing work without the page panning */
  cursor: crosshair;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s-lg);
  background: var(--fx-overlay);
  z-index: 2;
}
.overlay[hidden] { display: none; }

.overlay-inner { max-width: 46ch; text-align: center; }

.overlay-title {
  font-family: var(--display);
  font-size: 2rem;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0 0 var(--s-sm);
}

.overlay-body { margin: 0 0 var(--s-lg); color: var(--muted); }

.overlay-actions {
  display: flex;
  gap: var(--s-sm);
  justify-content: center;
  flex-wrap: wrap;
}

/* --- toolbar -------------------------------------------------------- */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-lg);
  align-items: center;
  padding: var(--s-md) var(--s-lg);
  border-top: 1px solid var(--border);
}

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

.label {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.swatches { display: flex; gap: 6px; }

.swatch {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  cursor: pointer;
  background-clip: padding-box;
  transition: transform 160ms var(--ease), box-shadow 160ms var(--ease);
}
.swatch:hover { transform: translateY(-2px); }
.swatch:active { transform: scale(0.97); }
.swatch[aria-checked="true"] {
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--primary);
}

/* --- buttons -------------------------------------------------------- */

.btn {
  font-family: var(--body);
  font-size: 14px;
  font-weight: 500;
  padding: 12px 24px;
  border: 1px solid var(--primary);
  border-radius: var(--r-sm);
  background: var(--primary);
  color: var(--fx-accent-ink);
  cursor: pointer;
  transition: background 160ms var(--ease), transform 160ms var(--ease),
              border-color 160ms var(--ease), color 160ms var(--ease);
}
.btn:hover { background: var(--fx-accent-hover); border-color: var(--fx-accent-hover); }
.btn:active { transform: scale(0.97); }

.btn-sm { padding: 7px 14px; font-size: 13px; }

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--bg); border-color: var(--fx-border-strong); }
.btn-ghost[aria-pressed="true"] {
  background: var(--primary);
  color: var(--fx-accent-ink);
  border-color: var(--primary);
}

.btn:focus-visible, .swatch:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* --- info grid ------------------------------------------------------ */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--s-md);
  margin-top: var(--s-xl);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--s-lg);
  transition: transform 200ms var(--ease), box-shadow 200ms var(--ease);
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--fx-shadow-hover);
}

.card-title {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.3;
  margin: 0 0 var(--s-md);
}

.card-body {
  margin: 0 0 var(--s-md);
  font-size: 15px;
  color: var(--muted);
}
.card-body:last-child { margin-bottom: 0; }

.deflist { margin: 0; font-size: 15px; }
.deflist dt {
  font-weight: 600;
  margin-top: var(--s-md);
}
.deflist dt:first-child { margin-top: 0; }
.deflist dd { margin: 2px 0 0; color: var(--muted); }

kbd {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 650;
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: var(--r-sm);
  background: var(--bg);
  color: var(--text);
}

code {
  font-family: var(--mono);
  font-size: 0.9em;
}

.foot {
  margin-top: var(--s-xl);
  padding-top: var(--s-lg);
  border-top: 1px solid var(--border);
}
.foot .meta { text-align: left; max-width: 70ch; }

/* --- responsive ----------------------------------------------------- */

@media (max-width: 720px) {
  .wrap { padding: 40px var(--s-md) 64px; }
  .masthead { flex-direction: column; gap: var(--s-md); }
  .status-stack { align-items: flex-start; padding-top: 0; }
  .meta { text-align: left; }
  .toolbar { gap: var(--s-md); padding: var(--s-md); }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .card:hover, .swatch:hover { transform: none; }
}
