/* ============ 7. Responsive ============ */
/* Phones: header buttons show icons only, and the timer gets its own line */
@media (max-width: 560px) {
  .panel { padding: 16px; gap: 14px; border-radius: 22px; bottom: calc(12px + var(--safe-bottom)); }
  .panel > header { gap: 8px; }
  .header-actions { gap: 6px; }
  .header-actions .btn { width: 44px; padding: 0; }
  /* Same technique as .vh, on phones only, so the buttons keep their names */
  .header-actions .label {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%);
  }
  .options { padding-top: 14px; }
  .options > .btn { flex: 1; }
  .timer { width: 100%; justify-content: space-between; }
  .select select { min-width: 160px; }
}
/* The narrowest phones: six swatches no longer fit in a row, and the header needs the logo's space */
@media (max-width: 345px) {
  .swatches { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  header .logo { display: none; }
}
/* Short screens (phones in landscape): tighter spacing so everything fits */
@media (max-height: 440px) {
  .panel {
    padding: 10px 16px; gap: 8px; bottom: calc(8px + var(--safe-bottom));
    max-height: calc(100dvh - 16px - var(--safe-top) - var(--safe-bottom));
  }
  .swatches { margin-top: 8px; }
  .options { padding-top: 8px; }
}
/* Page content: the four uses sit in two columns once there is room */
@media (min-width: 720px) {
  .uses { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px 40px; }
}
@media (prefers-reduced-motion: reduce) {
  .ready .dot { transition: none; }
}

/* ============ 8. Forced colors (Windows contrast themes) ============
   This mode drops our backgrounds and shadows, so controls and their states
   are redrawn with borders, outlines and system colors. */
@media (forced-colors: active) {
  /* The light is the content, so it keeps its real color. Set this on the light only:
     it is inherited, and on html or body it would switch off the system colors for the controls. */
  #light { forced-color-adjust: none; }
  .wake-alert { border-color: ButtonText; }

  /* A scene is a picture, so it keeps its own colors, as the light does. Only its border follows the system. */
  .use-art { forced-color-adjust: none; border-color: CanvasText; }

  .btn { border: 1px solid ButtonText; }
  .btn[aria-pressed="true"] { forced-color-adjust: none; background: Highlight; color: HighlightText; border-color: Highlight; }
  .btn[aria-pressed="true"]:focus-visible { outline-color: CanvasText; }

  #wakeText::before, .wake-alert::before { forced-color-adjust: none; background: CanvasText; }

  .switch-track { forced-color-adjust: none; border-color: ButtonText; background: ButtonFace; }
  .switch-track::after { background: ButtonText; }
  .switch[aria-checked="true"] .switch-track { border-color: Highlight; background: Highlight; }
  .switch[aria-checked="true"] .switch-track::after { background: HighlightText; }

  .swatch input:checked ~ .dot { outline-color: Highlight; }
  .swatch input:focus-visible ~ .dot { outline-color: CanvasText; }

  input[type="range"]::-webkit-slider-runnable-track {
    forced-color-adjust: none; outline: 1px solid CanvasText;
    background: linear-gradient(to right, Highlight var(--pct, 100%), Canvas var(--pct, 100%));
  }
  input[type="range"]::-webkit-slider-thumb { forced-color-adjust: none; background: Canvas; border-color: CanvasText; }
  input[type="range"]::-moz-range-track { border: 1px solid CanvasText; }
  input[type="range"]::-moz-range-progress { forced-color-adjust: none; background: Highlight; }
}
