/* ---------------------------------------------------------------------------
   Material 3 structural layer for the Bonakude platform.

   WHAT IS ADOPTED: the typescale, the shape ladder, state layers, tonal
   elevation, motion tokens, and the focus treatment. These are structural and
   brand-neutral, and they are what M3 actually improves here.

   WHAT IS NOT ADOPTED, deliberately:
   - M3's generated primary/secondary roles for brand surfaces. The
     Treasury-aligned reference reports fixed the Bonakude identity and the
     workstream brief required it be carried forward. Brand values are pinned
     below. This mirrors Audit 360's own deviation (its navigation shell keeps
     a brand surface rather than an M3 surface-container).
   - M3's default density. M3 spacing is phone-first and looser than an
     analytical register needs. Audit 360 records the same deviation.
   - Any "M3 table". M3 has NO data table component; it was dropped after M2.
     The registers here are their own component under an M3 theme and are not
     corrected against a spec that does not exist.

   Token values: md-sys, as emitted by @material/material-color-utilities
   0.3.0 (see tools/gen-m3-tokens.mjs). Typescale, shape, elevation, state and
   motion values from .claude/ux-knowledge/MATERIAL3.md (md-sys v0_192).
--------------------------------------------------------------------------- */

:root {
  /* ── Shape scale (M3: 0/4/8/12/16/28/full) ──────────────────────────── */
  --md-sys-shape-corner-none: 0px;
  --md-sys-shape-corner-extra-small: 4px;
  --md-sys-shape-corner-small: 8px;
  --md-sys-shape-corner-medium: 12px;
  --md-sys-shape-corner-large: 16px;
  --md-sys-shape-corner-extra-large: 28px;
  --md-sys-shape-corner-full: 9999px;

  /* ── State layer opacities ──────────────────────────────────────────── */
  --md-sys-state-hover-state-layer-opacity: 0.08;
  --md-sys-state-focus-state-layer-opacity: 0.12;
  --md-sys-state-pressed-state-layer-opacity: 0.12;

  /* ── Motion. M3's standard easing is cubic-bezier(0.2, 0, 0, 1).
        cubic-bezier(0.4, 0, 0.2, 1) is the MATERIAL 2 curve, which Google
        labels "legacy" in the M3 tokens. It is not used here. ─────────── */
  --md-sys-motion-easing-standard: cubic-bezier(0.2, 0, 0, 1);
  --md-sys-motion-easing-emphasized: cubic-bezier(0.2, 0, 0, 1);
  --md-sys-motion-duration-short2: 100ms;
  --md-sys-motion-duration-short4: 200ms;
  --md-sys-motion-duration-medium2: 300ms;

  /* ── Elevation (dp). M3 raises by surface TONE first, shadow second. ─── */
  --md-sys-elevation-level0: 0;
  --md-sys-elevation-level1: 1px;
  --md-sys-elevation-level2: 3px;
  --md-sys-elevation-level3: 6px;
}

/* ── Typescale ─────────────────────────────────────────────────────────────
   The 15 M3 roles. Sizes, line heights, weights and tracking are Material's;
   the typefaces are Bonakude's (Montserrat display, Poppins text). M3 permits
   a brand typeface — only the scale is Material's. */
.md-display-large   { font-size: 3.5625rem; line-height: 4rem;    font-weight: 400; letter-spacing: -0.015625rem; }
.md-display-medium  { font-size: 2.8125rem; line-height: 3.25rem; font-weight: 400; letter-spacing: 0; }
.md-display-small   { font-size: 2.25rem;   line-height: 2.75rem; font-weight: 400; letter-spacing: 0; }
.md-headline-large  { font-size: 2rem;      line-height: 2.5rem;  font-weight: 400; letter-spacing: 0; }
.md-headline-medium { font-size: 1.75rem;   line-height: 2.25rem; font-weight: 400; letter-spacing: 0; }
.md-headline-small  { font-size: 1.5rem;    line-height: 2rem;    font-weight: 400; letter-spacing: 0; }
.md-title-large     { font-size: 1.375rem;  line-height: 1.75rem; font-weight: 400; letter-spacing: 0; }
.md-title-medium    { font-size: 1rem;      line-height: 1.5rem;  font-weight: 500; letter-spacing: 0.009375rem; }
.md-title-small     { font-size: 0.875rem;  line-height: 1.25rem; font-weight: 500; letter-spacing: 0.00625rem; }
.md-body-large      { font-size: 1rem;      line-height: 1.5rem;  font-weight: 400; letter-spacing: 0.03125rem; }
.md-body-medium     { font-size: 0.875rem;  line-height: 1.25rem; font-weight: 400; letter-spacing: 0.015625rem; }
.md-body-small      { font-size: 0.75rem;   line-height: 1rem;    font-weight: 400; letter-spacing: 0.025rem; }
.md-label-large     { font-size: 0.875rem;  line-height: 1.25rem; font-weight: 500; letter-spacing: 0.00625rem; }
.md-label-medium    { font-size: 0.75rem;   line-height: 1rem;    font-weight: 500; letter-spacing: 0.03125rem; }
.md-label-small     { font-size: 0.6875rem; line-height: 1rem;    font-weight: 500; letter-spacing: 0.03125rem; }

/* ── State layers ──────────────────────────────────────────────────────────
   Hover, focus and press are a layer of the element's OWN content colour at
   the M3 opacities, not a bespoke hover colour. The layer sits above the
   container and below the label, so text never dims. */
.md-state { position: relative; isolation: isolate; }
.md-state::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background-color: currentColor;
  opacity: 0;
  pointer-events: none;
  z-index: -1;
  transition: opacity var(--md-sys-motion-duration-short2) var(--md-sys-motion-easing-standard);
}
@media (hover: hover) {
  .md-state:hover:not(:disabled)::after { opacity: var(--md-sys-state-hover-state-layer-opacity); }
}
.md-state:focus-visible::after { opacity: var(--md-sys-state-focus-state-layer-opacity); }
.md-state:active:not(:disabled)::after { opacity: var(--md-sys-state-pressed-state-layer-opacity); }

/* ── Focus ─────────────────────────────────────────────────────────────────
   A visible focus ring on every interactive element. The application had none
   beyond the browser default, which is an accessibility defect rather than a
   Material one. */
:where(a, button, select, input, [tabindex]):focus-visible {
  outline: 3px solid var(--md-sys-color-primary);
  outline-offset: 2px;
  border-radius: var(--md-sys-shape-corner-extra-small);
}

/* ── Tonal elevation ───────────────────────────────────────────────────────
   M3 raises a surface by stepping the surface-container ladder. Shadow is the
   secondary cue, not the primary one. */
.md-surface        { background: var(--md-sys-color-surface); }
.md-surface-1      { background: var(--md-sys-color-surface-container-low); }
.md-surface-2      { background: var(--md-sys-color-surface-container); }
.md-surface-3      { background: var(--md-sys-color-surface-container-high); }
.md-surface-4      { background: var(--md-sys-color-surface-container-highest); }

/* ── 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;
  }
}
