/* PRISM base: the .pr root, element defaults inside it, shared utilities.
   Every colour, space, radius and shadow is a --pr-* token from tokens.css.
   Motion uses the --pr-dur-* / --pr-ease-* tokens in tokens-ext.css (fast
   for hover/press, base for overlays, slow for page fades). Icon sizes live
   in components/icon.css.
   Phone rules sit in @media (max-width: 768px): 768px is the phone boundary. */

.pr {
  --acc: var(--pr-dept-none-fill);
  --acc-text: var(--pr-text-primary);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--pr-text-primary);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  box-sizing: border-box;
}
.pr *, .pr *::before, .pr *::after { box-sizing: border-box; }

/* A page that is PRISM end to end paints its own ground (flat, no texture). */
body.pr, .pr-page { background: var(--pr-surface-page); color: var(--pr-text-primary); margin: 0; }

:where(.pr) :where(h1, h2, h3, h4, p, dl, dd, figure) { margin: 0; }
:where(.pr) :where(button, input, select, textarea) { font: inherit; color: inherit; }
:where(.pr) :where(button) { background: none; border: 0; padding: 0; cursor: pointer; }
:where(.pr) :where(a) { color: var(--pr-text-link); }
:where(.pr) :where(fieldset) { border: 0; margin: 0; padding: 0; min-width: 0; }
:where(.pr) :where(legend) { padding: 0; }

/* Element defaults above sit in :where() so every component class wins over them. */

/* Focus: 2px ring with a 2px gap in the surface colour; never red. */
:where(.pr) :focus-visible { outline: var(--pr-border-focus) solid var(--pr-focus-ring); outline-offset: var(--pr-border-focus); }
:where(.pr) :focus:not(:focus-visible) { outline: none; }

/* Department scope: one class sets every accent a page or tile needs. */
.pr-dept--ops { --acc: var(--pr-dept-ops-fill); --acc-text: var(--pr-dept-ops-text); }
.pr-dept--maint { --acc: var(--pr-dept-maint-fill); --acc-text: var(--pr-dept-maint-text); }
.pr-dept--mkt { --acc: var(--pr-dept-mkt-fill); --acc-text: var(--pr-dept-mkt-text); }
.pr-dept--hr { --acc: var(--pr-dept-hr-fill); --acc-text: var(--pr-dept-hr-text); }
.pr-dept--none { --acc: var(--pr-dept-none-fill); --acc-text: var(--pr-dept-none-text); }

/* Spinner (icon and glyph sizes: components/icon.css) */
.pr-spin { animation: pr-rot 1s linear infinite; transform-origin: center; }
@keyframes pr-rot { to { transform: rotate(360deg); } }

/* Visually hidden, still read aloud */
.pr-sr {
  position: absolute; top: 0; left: 0; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* Layout helpers */
.pr-row { display: flex; align-items: center; gap: var(--pr-space-sm); }
.pr-row--wrap { flex-wrap: wrap; }
.pr-col { display: flex; flex-direction: column; gap: var(--pr-space-sm); }
.pr-grow { flex: 1; min-width: 0; }
.pr-stack { display: grid; gap: var(--pr-space-lg); }

.pr-card {
  background: var(--pr-surface-card);
  border: var(--pr-border-hairline) solid var(--pr-border-subtle);
  border-radius: var(--pr-radius-lg);
  padding: var(--pr-space-xl);
}
.pr-card--flush { padding: 0; overflow: hidden; }

/* Text roles not covered by the type classes in tokens.css */
.pr-h-lg { font-size: 1.25rem; line-height: 1.3; font-weight: 600; }
.pr-h-md { font-size: 1.125rem; line-height: 1.35; font-weight: 600; }
.pr-cap { font-size: 0.75rem; line-height: 1.4; color: var(--pr-text-caption); }
.pr-sec { color: var(--pr-text-secondary); }
.pr-mono { font-family: var(--font-mono); font-size: 0.85rem; font-feature-settings: "zero" 1; }
.pr-num { font-variant-numeric: tabular-nums; text-align: right; }
.pr-null { color: var(--pr-text-caption); }
.pr-link { color: var(--pr-text-link); text-decoration: underline; text-underline-offset: 2px; }

@media (max-width: 768px) {
  .pr-card { padding: var(--pr-space-lg); }
  .pr-card--flush { padding: 0; }
}

/* Under reduced motion nothing slides, lifts or shimmers. */
@media (prefers-reduced-motion: reduce) {
  .pr *, .pr *::before, .pr *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
