/**
 * Styles specific to the Week 3 tools (Color Wheel Generator, Color
 * Blindness Simulator, Image Color Extractor, Color Format Converter).
 * Loaded only on those four pages — same design tokens and component
 * conventions as components.css/tools-week2.css, kept separate so neither
 * existing file grows unwieldy and no other page's CSS changes.
 */

/* ---------- Color Wheel Generator ---------- */

.wheel-layout {
  display: grid;
  gap: var(--space-6);
  grid-template-columns: 1fr;
  align-items: start;
  margin-bottom: var(--space-5);
}

@media (min-width: 900px) {
  .wheel-layout { grid-template-columns: 280px 1fr; }
}

.wheel-interactive-wrap {
  display: flex;
  justify-content: center;
}

.wheel-interactive {
  position: relative;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: conic-gradient(
    hsl(0 100% 50%), hsl(60 100% 50%), hsl(120 100% 50%),
    hsl(180 100% 50%), hsl(240 100% 50%), hsl(300 100% 50%), hsl(360 100% 50%)
  );
  border: 1px solid var(--color-border);
  cursor: grab;
  touch-action: none;
}

.wheel-interactive:active { cursor: grabbing; }

.wheel-interactive:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 3px;
}

.wheel-interactive__handle {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 22px;
  height: 22px;
  margin: -11px;
  border-radius: 50%;
  border: 4px solid #fff;
  box-shadow: 0 0 0 1.5px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

.wheel-output {
  margin-bottom: var(--space-5);
}

.wheel-preview-swatch {
  width: 100%;
  min-height: 72px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  margin-bottom: var(--space-4);
}

.relationship-section {
  margin-bottom: var(--space-5);
}

.relationship-section h3 {
  margin-bottom: var(--space-3);
}

.relationship-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: var(--space-3);
}

.relationship-swatch {
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  min-height: 90px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: var(--space-3);
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.relationship-swatch__hex {
  font-family: var(--font-family-mono);
  font-weight: 700;
  font-size: 0.85rem;
}

/* ---------- Color Blindness Simulator ---------- */

.compare-grid {
  display: grid;
  gap: var(--space-5);
  grid-template-columns: 1fr;
  margin-bottom: var(--space-5);
}

@media (min-width: 768px) {
  .compare-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.compare-panel__label {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: var(--space-2);
  display: block;
}

.compare-panel__canvas-wrap {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--color-border);
  background: repeating-conic-gradient(#e2e6ea 0% 25%, #f5f6f8 0% 50%) 50% / 20px 20px;
}

.compare-panel__canvas-wrap canvas {
  width: 100%;
  height: auto;
  display: block;
}

.vision-type-field {
  max-width: 340px;
  margin-bottom: var(--space-5);
}

.vision-type-field .select { width: 100%; }

/* ---------- Image Color Extractor (Advanced) ---------- */

.key-colors-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.key-color-card {
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  min-height: 120px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: var(--space-3);
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.key-color-card__label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  opacity: 0.85;
}

.key-color-card__hex {
  font-family: var(--font-family-mono);
  font-weight: 700;
}

.extract-swatch {
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  min-height: 96px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: var(--space-2);
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.extract-swatch__hex {
  font-family: var(--font-family-mono);
  font-size: 0.8rem;
  font-weight: 700;
}

.extract-swatch__percent {
  font-size: 0.7rem;
  opacity: 0.85;
}

/* ---------- Color Format Converter ---------- */

.format-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

@media (min-width: 700px) {
  .format-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.format-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.format-field label {
  font-weight: 600;
  font-size: 0.9rem;
}

.format-field__row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.format-field__row input {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  font-size: 16px;
  padding: 0 var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  font-family: var(--font-family-mono);
}

.format-field__row input:focus-visible {
  border-color: var(--color-primary);
}

.format-field__row input[aria-invalid="true"] {
  border-color: var(--color-error);
}

.format-field__name-hint {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

/* ---------- Shared: format selector + export row (all 4 tools) ---------- */

.export-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-5);
}
