/* Authority Software Design System — Base
 *
 * Global foundations only. Reusable UI components belong in components.css;
 * navigation-specific presentation belongs in navigation.css.
 */

/* --------------------------------------------------------------------------
 * Box model and document defaults
 * ----------------------------------------------------------------------- */

html {
  box-sizing: border-box;
  scroll-behavior: smooth;
  background: var(--as-colour-canvas);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

body {
  margin: 0;
  background: var(--as-colour-canvas);
  color: var(--as-colour-text);
  font-family: var(--as-font-sans);
  font-size: var(--as-type-body);
  font-weight: var(--as-font-weight-regular);
  line-height: var(--as-leading-body);
}

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

iframe {
  max-width: 100%;
}

::selection {
  background: var(--as-colour-brand);
  color: var(--as-colour-white);
}

/* --------------------------------------------------------------------------
 * Typography
 * ----------------------------------------------------------------------- */

h1,
h2,
h3,
h4,
h5,
h6 {
  margin-top: 0;
  color: var(--as-colour-ink);
  font-family: var(--as-font-sans);
  font-weight: var(--as-font-weight-heavy);
  text-wrap: balance;
}

h1 {
  margin-bottom: var(--as-space-6);
  font-size: var(--as-type-h1);
  line-height: var(--as-leading-heading);
  letter-spacing: var(--as-tracking-display);
}

h2 {
  margin-bottom: var(--as-space-5);
  font-size: var(--as-type-h2);
  line-height: var(--as-leading-heading);
  letter-spacing: var(--as-tracking-heading);
}

h3 {
  margin-bottom: var(--as-space-4);
  font-size: var(--as-type-h3);
  line-height: var(--as-leading-subheading);
  letter-spacing: var(--as-tracking-heading);
}

h4 {
  margin-bottom: var(--as-space-3);
  font-size: var(--as-type-h4);
  line-height: var(--as-leading-subheading);
}

h5,
h6 {
  margin-bottom: var(--as-space-3);
  font-size: var(--as-type-body);
  line-height: var(--as-leading-tight);
}

p {
  margin-top: 0;
  margin-bottom: var(--as-space-5);
}

p:last-child {
  margin-bottom: 0;
}

strong,
b {
  font-weight: var(--as-font-weight-bold);
}

small {
  font-size: var(--as-type-body-sm);
}

mark {
  background: transparent;
  color: inherit;
}

code,
kbd,
samp,
pre {
  font-family: var(--as-font-mono);
}

/* --------------------------------------------------------------------------
 * Links and focus
 * ----------------------------------------------------------------------- */

a {
  color: var(--as-colour-brand-hover);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.16em;
  transition:
    color var(--as-duration-fast) var(--as-ease-soft),
    opacity var(--as-duration-fast) var(--as-ease-soft);
}

a:hover {
  color: var(--as-colour-brand);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid rgba(0, 178, 180, 0.42);
  outline-offset: 3px;
}

/* --------------------------------------------------------------------------
 * Lists
 * ----------------------------------------------------------------------- */

ul,
ol {
  margin-top: 0;
  margin-bottom: var(--as-space-5);
}

li + li {
  margin-top: var(--as-space-2);
}

/* --------------------------------------------------------------------------
 * Structural utilities
 * ----------------------------------------------------------------------- */

.as-container {
  width: min(calc(100% - (2 * var(--as-gutter))), var(--as-container));
  margin-inline: auto;
}

.as-container--sm {
  max-width: var(--as-container-sm);
}

.as-container--md {
  max-width: var(--as-container-md);
}

.as-container--wide {
  width: min(calc(100% - (2 * var(--as-gutter))), var(--as-container-wide));
}

.as-section {
  position: relative;
  padding-block: var(--as-section-space);
}

.as-section--compact {
  padding-block: var(--as-section-space-compact);
}

.as-section--hero {
  padding-block: var(--as-section-space-hero);
}

.as-stack > * {
  margin-block: 0;
}

.as-stack > * + * {
  margin-top: var(--as-space-5);
}

.as-prose {
  max-width: 70ch;
}

.as-prose--narrow {
  max-width: 58ch;
}

.as-lead {
  color: var(--as-colour-text-muted);
  font-size: var(--as-type-lead);
  line-height: 1.55;
}

.as-eyebrow {
  display: inline-block;
  margin-bottom: var(--as-space-4);
  color: var(--as-colour-brand-hover);
  font-size: var(--as-type-label);
  font-weight: var(--as-font-weight-bold);
  letter-spacing: var(--as-tracking-label);
  line-height: 1.2;
  text-transform: uppercase;
}

.as-display {
  font-size: var(--as-type-display);
  line-height: var(--as-leading-display);
  letter-spacing: var(--as-tracking-display);
}

/* --------------------------------------------------------------------------
 * Surface helpers
 * ----------------------------------------------------------------------- */

.as-surface-light {
  background: var(--as-colour-surface);
  color: var(--as-colour-text);
}

.as-surface-dark {
  background: var(--as-colour-surface-dark);
  color: rgba(255, 255, 255, 0.82);
}

.as-surface-dark h1,
.as-surface-dark h2,
.as-surface-dark h3,
.as-surface-dark h4,
.as-surface-dark h5,
.as-surface-dark h6 {
  color: var(--as-colour-white);
}

.as-glass {
  background: var(--as-glass-bg);
  border: 1px solid var(--as-glass-border);
  box-shadow: var(--as-shadow-sm);
  -webkit-backdrop-filter: blur(var(--as-glass-blur)) saturate(var(--as-glass-saturate));
  backdrop-filter: blur(var(--as-glass-blur)) saturate(var(--as-glass-saturate));
}

.as-glass--dark {
  background: var(--as-glass-dark-bg);
  border-color: var(--as-colour-border-on-dark);
  color: rgba(255, 255, 255, 0.82);
}

/* --------------------------------------------------------------------------
 * Accessibility and reduced motion
 * ----------------------------------------------------------------------- */

.screen-reader-text,
.as-sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

/* --------------------------------------------------------------------------
 * Responsive adjustments
 * ----------------------------------------------------------------------- */

@media (max-width: 980px) {
  :root {
    --as-section-space: clamp(4.5rem, 9vw, 7rem);
    --as-section-space-hero: clamp(6rem, 11vw, 8rem);
  }
}

@media (max-width: 767px) {
  :root {
    --as-gutter: 1.25rem;
    --as-section-space: 4.5rem;
    --as-section-space-compact: 3rem;
    --as-section-space-hero: 5.5rem;
  }

  .as-prose,
  .as-prose--narrow {
    max-width: none;
  }
}
