/* =============================================================
   BASE.CSS — Shared Foundation for All 4 Brands
   MAH Design System v1.0 | 2026-03-27
   ============================================================= */

/* ── CSS Reset ─────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  tab-size: 4;
  scroll-behavior: smooth;
}

body {
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img, video, svg, canvas {
  display: block;
  max-width: 100%;
}

input, button, textarea, select {
  font: inherit;
}

p, h1, h2, h3, h4, h5, h6 {
  overflow-wrap: break-word;
}

ul, ol {
  list-style: none;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
  background: none;
  border: none;
}

table {
  border-collapse: collapse;
}

/* ── Responsive Breakpoints ────────────────────────────────── */
:root {
  --bp-sm:  640px;   /* Large phone / small tablet */
  --bp-md:  768px;   /* Tablet */
  --bp-lg:  1024px;  /* Desktop */
  --bp-xl:  1280px;  /* Wide screen */
  --bp-2xl: 1536px;  /* Ultra wide */
}

/* ── Touch Targets ─────────────────────────────────────────── */
/* All interactive elements MUST meet 44×44px minimum */
button,
[role="button"],
[role="link"],
input,
select,
textarea,
label[for],
a {
  min-height: 44px;
}

/* Icon-only or tight interactive elements */
.touch-target {
  min-height: 44px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Adjacent interactive elements spacing */
.btn-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/* ── Universal Focus State ─────────────────────────────────── */
/* All brands override --color-focus-ring with their own brand color */
:root {
  --color-focus-ring: #000000;  /* fallback — must be overridden per brand */
  --color-bg: #ffffff;          /* fallback — must be overridden per brand */
}

:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 2px var(--color-bg),
    0 0 0 4px var(--color-focus-ring);
}

/* Skip link for keyboard users */
.skip-link {
  position: absolute;
  top: -100%;
  left: 8px;
  z-index: 9999;
  padding: 8px 16px;
  background: var(--color-focus-ring, #000);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  border-radius: 0 0 4px 4px;
  transition: top 0.1s;
}

.skip-link:focus {
  top: 0;
}

/* ── Reduced Motion ────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── Screen Reader Only ─────────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Utility: Visually Hidden but Focusable ─────────────────── */
.sr-only:focus,
.sr-only:active {
  position: static;
  width: auto;
  height: auto;
  margin: 0;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

/* ── Container ─────────────────────────────────────────────── */
.container {
  width: 100%;
  margin-inline: auto;
  padding-inline: 16px;
}

@media (min-width: 640px)  { .container { max-width: 640px;  padding-inline: 24px; } }
@media (min-width: 768px)  { .container { max-width: 768px; } }
@media (min-width: 1024px) { .container { max-width: 1024px; padding-inline: 32px; } }
@media (min-width: 1280px) { .container { max-width: 1280px; } }

/* ── Typography Base ────────────────────────────────────────── */
/* Brands override these with their own font families */
:root {
  --font-sans: system-ui, -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif;
  --font-serif: Georgia, 'Times New Roman', Times, serif;
  --font-mono: 'SF Mono', 'Fira Code', monospace;
}

/* ── Z-Index Scale ──────────────────────────────────────────── */
:root {
  --z-below:    -1;
  --z-base:      0;
  --z-raised:    1;
  --z-dropdown: 100;
  --z-sticky:   200;
  --z-overlay:  300;
  --z-modal:    400;
  --z-toast:    500;
  --z-tooltip:  600;
}

/* ── Transition Base ────────────────────────────────────────── */
:root {
  --ease-standard: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-decelerate: cubic-bezier(0, 0, 0.2, 1);
  --ease-accelerate: cubic-bezier(0.4, 0, 1, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  --duration-fast:   80ms;
  --duration-normal: 200ms;
  --duration-slow:   350ms;
}
