/* Material 3 foundations: fonts, type scale, shapes, states, reset. */

@font-face {
  font-family: "Roboto Flex";
  src: url("../fonts/roboto-flex-latin-wght.woff2") format("woff2");
  font-weight: 100 1000;
  font-display: swap;
}
@font-face {
  font-family: "Roboto Mono";
  src: url("../fonts/roboto-mono-latin-wght.woff2") format("woff2");
  font-weight: 100 700;
  font-display: swap;
}

:root {
  --font-brand: "Roboto Flex", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Roboto Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  /* M3 shape scale */
  --shape-xs: 4px;
  --shape-sm: 8px;
  --shape-md: 12px;
  --shape-lg: 16px;
  --shape-lg-inc: 20px;
  --shape-xl: 28px;
  --shape-xl-inc: 32px;
  --shape-full: 9999px;

  /* State layers */
  --state-hover: 0.08;
  --state-focus: 0.1;
  --state-press: 0.1;

  /* Elevation (levels 2 and 3) */
  --elevation-2: 0 1px 2px rgb(0 0 0 / 0.3), 0 2px 6px 2px rgb(0 0 0 / 0.15);
  --elevation-3: 0 1px 3px rgb(0 0 0 / 0.3), 0 4px 8px 3px rgb(0 0 0 / 0.15);

  /* Adaptive margins (compact / medium / large) */
  --gutter: 12px;
  --gap: 12px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}
@media (min-width: 600px) {
  :root { --gutter: 16px; --gap: 16px; }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  font: 400 1rem/1.5 var(--font-brand);
  letter-spacing: 0.03125rem;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p { margin: 0; }
button, input { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

/* M3 type scale ("emphasized" weights = the -em variants) */
.display-small    { font: 400 2.25rem/2.75rem var(--font-brand); letter-spacing: 0; }
.headline-medium  { font: 400 1.75rem/2.25rem var(--font-brand); letter-spacing: 0; }
.headline-medium-em { font: 600 1.75rem/2.25rem var(--font-brand); letter-spacing: -0.01em; }
.headline-small   { font: 400 1.5rem/2rem var(--font-brand); letter-spacing: 0; }
.title-large      { font: 400 1.375rem/1.75rem var(--font-brand); letter-spacing: 0; }
.title-large-em   { font: 600 1.375rem/1.75rem var(--font-brand); letter-spacing: -0.005em; }
.title-medium     { font: 500 1rem/1.5rem var(--font-brand); letter-spacing: 0.009375rem; }
.title-small      { font: 500 0.875rem/1.25rem var(--font-brand); letter-spacing: 0.00625rem; }
.body-large       { font: 400 1rem/1.5rem var(--font-brand); letter-spacing: 0.03125rem; }
.body-medium      { font: 400 0.875rem/1.25rem var(--font-brand); letter-spacing: 0.015625rem; }
.body-small       { font: 400 0.75rem/1rem var(--font-brand); letter-spacing: 0.025rem; }
.label-large      { font: 500 0.875rem/1.25rem var(--font-brand); letter-spacing: 0.00625rem; }
.label-medium     { font: 500 0.75rem/1rem var(--font-brand); letter-spacing: 0.03125rem; }

.muted { color: var(--md-sys-color-on-surface-variant); }
.mono  { font-family: var(--font-mono); }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Material Symbols icons (embedded SVG) */
.icon { width: 1.5rem; height: 1.5rem; flex: none; fill: currentColor; display: block; }
.icon-sm { width: 1.125rem; height: 1.125rem; }

/* Visible keyboard focus */
:focus-visible {
  outline: 3px solid var(--md-sys-color-secondary);
  outline-offset: 2px;
}

/* Discreet scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--md-sys-color-outline-variant) transparent; }

::selection { background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container); }

@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;
  }
}
