/* Variables live in css/engine/root.css */

/* BASE RESET */
html,
body {
  width: 100%;
  max-width: 100vw;
  height: 100%;
  min-height: 100%;
  min-height: -webkit-fill-available;
  min-height: 100dvh;
  margin: 0;
  padding: 0;
  overflow: hidden;
  overflow-x: hidden;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
  background: var(--background);
  font-family: var(--font-sans);
  color: var(--foreground);
  font-size: var(--text-md);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.005em;
}

* {
  box-sizing: border-box;
}

/* HIDE SCROLLBARS (keep for engine layout where native bars are visually hidden) */
html,
body {
  scrollbar-width: none;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
  display: none;
}

/* Custom Scrollbars - Apple style */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(29, 29, 27, 0.16);
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(29, 29, 27, 0.28);
}

::selection {
  background: rgba(29, 79, 145, 0.22);
  color: var(--ui-ink);
}

:where(
  .dropdown-toggle,
  .action-button,
  #camera-controls button,
  .reset-group-btn,
  .saved-item-btn,
  .saved-item-delete,
  .edit-btn,
  .variant-tab,
  .desc-toggle,
  .weather-switch,
  .variant-hotspot
) svg {
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

/* ================================
   GLOBAL FOCUS RING
   Single source of truth for keyboard focus visibility.
   Mouse clicks do NOT show the ring (:focus-visible only).
   Individual components may override per-element if needed.
   ================================ */
:where(
  button,
  [role="button"],
  a,
  input,
  select,
  textarea,
  [tabindex]
):focus-visible {
  outline: 2px solid var(--ui-ring);
  outline-offset: 2px;
  border-radius: var(--radius-2xs);
}

:where(
  .action-button,
  .btn-toggle,
  .reset-group-btn,
  .crm-btn-primary,
  .crm-btn-secondary,
  .modal-buttons button,
  .saved-item-btn,
  .saved-item-delete
) {
  font-family: var(--font-sans);
  font-weight: 500;
  letter-spacing: -0.005em;
}

/* Inputs/selects already have rounded borders — match them */
:where(input, select, textarea):focus-visible {
  outline-offset: 1px;
}

/* ================================
   TOUCH TARGETS
   On coarse pointers (touch screens), every interactive element
   gets at least 44px min-height. Desktop pointer leaves them as-is.
   ================================ */
@media (hover: none) and (pointer: coarse) {
  :where(
    button,
    [role="button"],
    .action-button,
    .btn-toggle,
    .reset-group-btn,
    .saved-item-btn,
    .saved-item-delete,
    .variant-tab,
    .dropdown-toggle,
    input[type="button"],
    input[type="submit"],
    input[type="reset"]
  ):not(.no-touch-bump) {
    min-height: 44px;
  }
}

