/* StatsCentral Apps Next — base: reset, focus, layout primitives, override classes. */

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

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

body {
  margin: 0;
}

.sc-template {
  background: rgb(var(--color-bg));
}

.sc-template__body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  margin: 0;
  background: rgb(var(--color-bg));
  color: rgb(var(--color-text));
  font-family: var(--font-sans);
  font-size: var(--text-body);
  line-height: var(--leading-body);
  font-weight: var(--weight-regular);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-variant-numeric: lining-nums;
}

.sc-template__body > .sc-width-container,
.sc-template__body > main {
  flex: 1 0 auto;
}

img, svg, video { max-width: 100%; }
img { height: auto; }

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

[hidden] { display: none !important; }

/* Fallback focus for anything a component has not styled itself. */
:focus-visible {
  outline: var(--focus-width) solid rgb(var(--color-focus));
  outline-offset: 0;
  box-shadow: 0 0 0 calc(var(--focus-width) + 3px) rgb(var(--color-focus-text));
}

/* ── Layout ── */
.sc-width-container {
  width: 100%;
  max-width: calc(var(--page-width) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.sc-main-wrapper {
  display: block;
  padding-block: var(--space-7) var(--space-10);
}

.sc-main-wrapper--l { padding-top: var(--space-9); }
.sc-main-wrapper--s { padding-top: var(--space-5); }

.sc-grid-row {
  display: flex;
  flex-wrap: wrap;
  margin-inline: calc(var(--space-5) * -1);
}

.sc-grid-row > [class*="sc-grid-column-"] {
  padding-inline: var(--space-5);
  width: 100%;
  min-width: 0;
}

/* Columns stack below 769px, so the gutter would only push the row past the page edge. */
@media (max-width: 768px) {
  .sc-grid-row { margin-inline: 0; }
  .sc-grid-row > [class*="sc-grid-column-"] { padding-inline: 0; }
}

@media (min-width: 769px) {
  .sc-grid-column-two-thirds   { flex: 0 0 66.6667%; max-width: 66.6667%; }
  .sc-grid-column-one-third    { flex: 0 0 33.3333%; max-width: 33.3333%; }
  .sc-grid-column-one-half     { flex: 0 0 50%;      max-width: 50%; }
  .sc-grid-column-three-quarters { flex: 0 0 75%;    max-width: 75%; }
  .sc-grid-column-one-quarter  { flex: 0 0 25%;      max-width: 25%; }
}

.sc-grid-column-full { flex: 0 0 100%; }

.sc-stack > * + * { margin-top: var(--space-6); }
.sc-stack--l > * + * { margin-top: var(--space-8); }

/* ── Skip link ── */
.sc-skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: var(--space-3) var(--space-4);
  background: rgb(var(--color-focus));
  color: rgb(var(--color-focus-text));
  font-size: var(--text-body-s);
  font-weight: var(--weight-semibold);
  text-decoration: underline;
  z-index: 100;
}

.sc-skip-link:focus,
.sc-skip-link:focus-visible {
  position: static;
  display: block;
  outline: var(--focus-width) solid rgb(var(--color-focus));
  outline-offset: 0;
  box-shadow: none;
}

/* ── Visually hidden ── */
.sc-visually-hidden,
.sc-visually-hidden-focusable:not(:focus):not(:active) {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  border: 0 !important;
  white-space: nowrap !important;
  user-select: none;
}

/* ── Override classes ── The only utilities; anything else is a component. */
.sc-\!-margin-0       { margin: 0 !important; }
.sc-\!-margin-bottom-0 { margin-bottom: 0 !important; }
.sc-\!-margin-bottom-2 { margin-bottom: var(--space-2) !important; }
.sc-\!-margin-bottom-4 { margin-bottom: var(--space-4) !important; }
.sc-\!-margin-bottom-6 { margin-bottom: var(--space-6) !important; }
.sc-\!-margin-bottom-8 { margin-bottom: var(--space-8) !important; }
.sc-\!-margin-top-0    { margin-top: 0 !important; }
.sc-\!-margin-top-6    { margin-top: var(--space-6) !important; }
.sc-\!-margin-top-8    { margin-top: var(--space-8) !important; }
.sc-\!-text-secondary  { color: rgb(var(--color-text-secondary)) !important; }
.sc-\!-text-align-right { text-align: right !important; }
.sc-\!-font-weight-bold { font-weight: var(--weight-bold) !important; }
.sc-\!-tabular        { font-variant-numeric: tabular-nums !important; }
.sc-\!-width-full     { width: 100% !important; }

@keyframes sc-spin { to { transform: rotate(360deg); } }
@keyframes sc-slide-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

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