/* Desktop controls share geometry, palette and interaction states.
   Compact mobile/fullscreen controls keep their established touch layout. */
@layer studio {
  body[data-layout=desktop]:not(.preview-fullscreen) {
    --control-size: 32px;
  }
  body[data-layout=desktop]:not(.preview-fullscreen) :is(.ratio-picker, .font-picker, .position-picker, .magazine-font-picker, .magazine-spacing-picker, .place-position-picker, .adjust-place-position-buttons, .photo-crop-ratio-picker, .crop-slot-picker, .dual-photo-direction-picker, .tray-format-buttons) button {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--control-surface);
    color: var(--ink);
    box-shadow: none;
  }
  body[data-layout=desktop]:not(.preview-fullscreen) :is(.ratio-picker, .font-picker, .position-picker, .magazine-font-picker, .magazine-spacing-picker, .place-position-picker, .adjust-place-position-buttons, .photo-crop-ratio-picker, .crop-slot-picker, .dual-photo-direction-picker, .tray-format-buttons) button:hover:not(:disabled) {
    background: var(--control-hover);
  }
  body[data-layout=desktop]:not(.preview-fullscreen) :is(.ratio-picker, .font-picker, .position-picker, .magazine-font-picker, .magazine-spacing-picker, .place-position-picker, .adjust-place-position-buttons, .photo-crop-ratio-picker, .crop-slot-picker, .dual-photo-direction-picker, .tray-format-buttons) button.is-active {
    border-color: var(--selection-line);
    background: var(--accent-soft);
    color: var(--ink);
    box-shadow: none;
  }
  body[data-layout=desktop]:not(.preview-fullscreen) .number-stepper {
    display: inline-grid;
    grid-template-columns: var(--control-size) minmax(34px, auto) var(--control-size);
    align-items: center;
    flex: none;
    gap: 0;
    min-width: 104px;
    height: 38px;
    padding: 2px;
    margin: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--control-surface);
    color: var(--ink);
    font: 500 13px/1.4 system-ui, sans-serif;
    font-variant-numeric: tabular-nums;
  }
  body[data-layout=desktop]:not(.preview-fullscreen) .number-stepper > button {
    appearance: none;
    position: relative;
    display: grid;
    place-items: center;
    width: var(--control-size);
    min-width: 0;
    height: var(--control-size);
    min-height: 0;
    padding: 0;
    margin: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--ink);
    font: 400 18px/1 system-ui, sans-serif;
    cursor: pointer;
    box-shadow: none;
  }
  body[data-layout=desktop]:not(.preview-fullscreen) .number-stepper > button::before {
    content: none;
  }
  body[data-layout=desktop]:not(.preview-fullscreen) .number-stepper > button:hover:not(:disabled) {
    background: var(--control-hover);
  }
  body[data-layout=desktop]:not(.preview-fullscreen) .number-stepper > button:active:not(:disabled) {
    background: var(--accent-soft);
  }
  body[data-layout=desktop]:not(.preview-fullscreen) .number-stepper > button:disabled {
    opacity: .35;
    cursor: default;
  }
  body[data-layout=desktop]:not(.preview-fullscreen) .number-stepper > output {
    display: block;
    min-width: 34px;
    padding: 0 3px;
    color: var(--ink);
    font: 500 13px/1.4 system-ui, sans-serif;
    text-align: center;
    font-variant-numeric: tabular-nums;
  }
  body[data-layout=desktop]:not(.preview-fullscreen) .adjust-toggle,
  body[data-layout=desktop]:not(.preview-fullscreen) .auto-color-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 40px;
    margin: 0;
    padding: 8px 0;
    color: var(--ink);
    font-size: 12px;
    cursor: pointer;
  }
  body[data-layout=desktop]:not(.preview-fullscreen) .tray-save-controls .adjust-toggle {
    flex: 1 1 100%;
    border-bottom: 1px solid var(--line);
  }
  body[data-layout=desktop]:not(.preview-fullscreen) .adjust-toggle > i {
    display: none;
  }
  body[data-layout=desktop]:not(.preview-fullscreen) .adjust-toggle input[type=checkbox],
  body[data-layout=desktop]:not(.preview-fullscreen) .auto-color-row input[type=checkbox] {
    appearance: none;
    -webkit-appearance: none;
    position: static;
    display: grid;
    place-content: center;
    flex: 0 0 20px;
    width: 20px;
    height: 20px;
    margin: 0;
    padding: 0;
    opacity: 1;
    border: 1px solid #c9c8be;
    border-radius: 6px;
    background: var(--control-surface);
    color: var(--ink);
    cursor: pointer;
  }
  body[data-layout=desktop]:not(.preview-fullscreen) .adjust-toggle input:checked,
  body[data-layout=desktop]:not(.preview-fullscreen) .auto-color-row input:checked {
    border-color: var(--selection-line);
    background: var(--action-fill);
  }
  body[data-layout=desktop]:not(.preview-fullscreen) .adjust-toggle input::before,
  body[data-layout=desktop]:not(.preview-fullscreen) .auto-color-row input::before {
    content: "";
    width: 9px;
    height: 5px;
    margin-top: -2px;
    border-left: 1.8px solid currentColor;
    border-bottom: 1.8px solid currentColor;
    transform: rotate(-45deg) scale(0);
  }
  body[data-layout=desktop]:not(.preview-fullscreen) .adjust-toggle input:checked::before,
  body[data-layout=desktop]:not(.preview-fullscreen) .auto-color-row input:checked::before {
    transform: rotate(-45deg) scale(1);
  }
  body[data-layout=desktop]:not(.preview-fullscreen) .adjust-toggle:hover input,
  body[data-layout=desktop]:not(.preview-fullscreen) .auto-color-row:hover input {
    border-color: var(--selection-line);
  }
  body[data-layout=desktop]:not(.preview-fullscreen) .number-stepper > button:focus-visible,
  body[data-layout=desktop]:not(.preview-fullscreen) .adjust-toggle input:focus-visible,
  body[data-layout=desktop]:not(.preview-fullscreen) .auto-color-row input:focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 2px;
  }
  body[data-layout=desktop]:not(.preview-fullscreen) .adjust-toggle input:disabled,
  body[data-layout=desktop]:not(.preview-fullscreen) .auto-color-row input:disabled {
    opacity: .4;
    cursor: default;
  }
}
