/* Prism · base — reset, typography, focus, scrollbar, utilities */

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

* { margin: 0; }

html {
  height: 100%;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  scrollbar-gutter: stable;
}

body {
  min-height: 100dvh;
  font-family: var(--font-body);
  font-size: var(--type-body-lg);
  line-height: 1.65;
  color: var(--md-on-surface);
  background: var(--md-surface);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  transition: background-color var(--dur-medium) var(--ease-standard);
}

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

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

a { color: var(--md-primary); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.18;
  letter-spacing: -0.015em;
  text-wrap: balance;
  color: var(--md-on-surface);
}

p { text-wrap: pretty; }

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

:focus-visible {
  outline: 2.5px solid var(--md-primary);
  outline-offset: 2px;
  border-radius: var(--shape-xs);
}

@supports (scrollbar-width: thin) {
  * { scrollbar-width: thin; scrollbar-color: var(--md-outline-variant) transparent; }
}

/* visually hidden (labels for icon buttons) */
.vh {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 0.6rem; left: 0.6rem;
  z-index: 200;
  padding: 0.7rem 1.2rem;
  border-radius: var(--shape-full);
  background: var(--md-inverse-surface);
  color: var(--md-inverse-on-surface);
  font-size: var(--type-label-lg);
  transform: translateY(-260%);
  transition: transform var(--dur-short) var(--ease-emphasized);
}
.skip-link:focus { transform: none; }

/* page grain — barely-there texture that makes flat surfaces feel printed */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  background: var(--grain);
  opacity: 0.028;
  mix-blend-mode: overlay;
}

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