/* raysan-ui · base.css
   Reset, page defaults, type roles, icons, focus and the state layer.
   Load after tokens.css. */

*, *::before, *::after { box-sizing: border-box; }
html {
  background: var(--md-surface);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
body {
  margin: 0;
  background: var(--md-surface);
  color: var(--md-on-surface);
  font: var(--body-l);
  -webkit-font-smoothing: antialiased;
}
img, video, svg { max-width: 100%; height: auto; display: block; }
a { color: var(--md-primary); }
h1, h2, h3, h4, p, figure { margin: 0; }
h1, h2, h3, h4 { text-wrap: balance; }
p { text-wrap: pretty; }
button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible { outline: 3px solid var(--md-primary); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- Layout helpers ---------- */
.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: var(--margin); }
.stack { display: grid; gap: var(--gap); }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 20; }
.skip:focus { left: 8px; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Type roles as classes ---------- */
.display-l { font: var(--display-l); }
.display-m { font: var(--display-m); }
.headline-l { font: var(--headline-l); }
.headline-m { font: var(--headline-m); }
.headline-s { font: var(--headline-s); }
.title-l { font: var(--title-l); }
.title-m { font: var(--title-m); }
.title-s { font: var(--title-s); }
.body-l { font: var(--body-l); }
.body-m { font: var(--body-m); }
.label-l { font: var(--label-l); }
.label-m { font: var(--label-m); }
.muted { color: var(--md-on-surface-variant); }
.overline { font: var(--label-m); letter-spacing: .04em; text-transform: uppercase; color: var(--rd-chip-ink); }
@media (max-width: 599px) {
  .display-l { font-size: var(--fs-48); line-height: 3.5rem; }
  .display-m { font-size: var(--fs-36); line-height: 2.5rem; }
}

/* ---------- Material Symbols ---------- */
.ms {
  font-family: var(--md-font-icon); font-weight: normal; font-style: normal; font-size: 24px; line-height: 1;
  display: inline-block; white-space: nowrap; direction: ltr; -webkit-font-smoothing: antialiased; flex: none;
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24; user-select: none; width: 1em; overflow: hidden;
}
.ms.fill { font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24; }

/* ---------- State layer: M3 hover .08, focus/pressed .10 ---------- */
.sl { position: relative; isolation: isolate; overflow: hidden; }
.sl::before {
  content: ""; position: absolute; inset: 0; background: currentColor; opacity: 0; z-index: -1;
  pointer-events: none; border-radius: inherit; transition: opacity var(--dur-s) linear;
}
.sl:hover::before { opacity: .08; }
.sl:focus-visible::before, .sl:active::before { opacity: .10; }
@media (hover: none) { .sl:hover::before { opacity: 0; } }

/* ---------- Brand bar ---------- */
.brand-bar { height: 4px; background: var(--rd-brand-bar); }

/* ---------- Short color fade while switching themes ---------- */
:root.theme-fading, :root.theme-fading *, :root.theme-fading *::before, :root.theme-fading *::after {
  transition: background-color .3s ease, color .3s ease, border-color .3s ease, fill .3s ease !important;
}
@media (prefers-reduced-motion: reduce) {
  :root.theme-fading, :root.theme-fading *, :root.theme-fading *::before, :root.theme-fading *::after { transition: none !important; }
}
