/* ============================================================================
   DESIGN SYSTEM · 06 · RESPONSIVE OVERRIDES & UTILITIES
   ----------------------------------------------------------------------------
   Cross-component responsive concerns kept here so component files stay clean.
   Mobile-first: smaller queries override larger.
   ============================================================================ */

/* ── Hide / show by breakpoint (matches Tailwind scale: sm 640, md 768, lg 1024, xl 1280) */
.hide-mobile  { display: none !important; }
@media (min-width: 768px)  { .hide-mobile  { display: revert !important; } }

.hide-tablet  { display: revert !important; }
@media (min-width: 768px) and (max-width: 1023px) { .hide-tablet { display: none !important; } }

.hide-desktop { display: revert !important; }
@media (min-width: 1024px) { .hide-desktop { display: none !important; } }

.show-mobile  { display: revert !important; }
@media (min-width: 768px)  { .show-mobile  { display: none !important; } }

/* ── Touch targets enforced on coarse pointers ──────────────────────────── */
@media (pointer: coarse) {
  .btn-xs { --btn-h: 32px; }   /* still tappable */
  .nav-item { min-height: var(--ds-touch-min); }
  .tab      { min-height: var(--ds-touch-min); }
  .field-input,
  .field-select { min-height: var(--ds-touch-min); }
}

/* ── Safe-area helpers (notches, home indicator) ────────────────────────── */
.safe-top    { padding-top:    env(safe-area-inset-top, 0px); }
.safe-bottom { padding-bottom: env(safe-area-inset-bottom, 0px); }
.safe-x      { padding-left:   env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }

/* ── Foldable / wide-mobile support ─────────────────────────────────────── */
@media (min-width: 600px) and (max-width: 767px) {
  .grid-kpi { grid-template-columns: repeat(2, 1fr); }
}

/* ── Landscape compact (short heights) ──────────────────────────────────── */
@media (max-height: 500px) and (orientation: landscape) {
  .card-hero { padding: var(--ds-space-4); }
  .card-kpi  { padding: var(--ds-space-3) var(--ds-space-4); }
  .card-kpi__value { font-size: var(--ds-text-xl); }
  .page-header { margin-bottom: var(--ds-space-3); }
}

/* ── Scrollbar (subtle, matches design) ─────────────────────────────────── */
.scrollbar-thin::-webkit-scrollbar { width: 6px; height: 6px; }
.scrollbar-thin::-webkit-scrollbar-track { background: transparent; }
.scrollbar-thin::-webkit-scrollbar-thumb {
  background: var(--ds-border-strong);
  border-radius: var(--ds-radius-pill);
}
.scrollbar-thin::-webkit-scrollbar-thumb:hover { background: var(--ds-text-subtle); }
.scrollbar-thin { scrollbar-width: thin; scrollbar-color: var(--ds-border-strong) transparent; }

.scrollbar-hide::-webkit-scrollbar { display: none; }
.scrollbar-hide { -ms-overflow-style: none; scrollbar-width: none; }

/* ── Print ──────────────────────────────────────────────────────────────── */
@media print {
  .no-print, .toast-stack, .modal-backdrop, .modal { display: none !important; }
  .card { box-shadow: none !important; border-color: var(--ds-border-default) !important; }
  body { background: white; }
}

/* ── Focus-visible global polish ────────────────────────────────────────── */
*:focus-visible {
  outline: 2px solid var(--ds-brand);
  outline-offset: 2px;
  border-radius: var(--ds-radius-xs);
}
.btn:focus-visible,
.field-input:focus-visible,
.field-select:focus-visible,
.field-textarea:focus-visible {
  outline: none;          /* component already shows ring via box-shadow */
}

/* ── Selection (uses brand) ─────────────────────────────────────────────── */
::selection {
  background: var(--ds-brand-tint);
  color: var(--ds-brand-strong);
}
