/* ============================================================================
   CareLink — base
   ----------------------------------------------------------------------------
   Reset, document defaults, typography and layout primitives.
   Typography (Raleway headings / Roboto body) is deliberately unchanged from
   the previous design; only colour, spacing and rhythm follow the admin theme.
   ========================================================================== */

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

html {
  scroll-behavior: smooth;
  /* Anchor targets clear the sticky header. */
  scroll-padding-top: calc(var(--cl-header-h) + var(--cl-space-4));
}

body {
  font-family: 'Roboto', sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--cl-text);
  background: var(--cl-surface);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Headings are near-black, not navy — the same call the admin portal makes
   (its type scale inherits `text.primary`). Navy is reserved for interactive
   elements so the brand colour still means "you can act on this". */
h1,
h2,
h3,
h4 {
  font-family: 'Raleway', sans-serif;
  font-weight: 800;
  color: var(--cl-text);
  line-height: 1.2;
}

h1 {
  font-size: clamp(2rem, 5vw, 3.25rem);
}

h2 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
}

h3 {
  font-size: 1.375rem;
}

h4 {
  font-size: 1.125rem;
  font-weight: 700;
}

p {
  color: var(--cl-text-weak);
}

a {
  color: var(--cl-link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* `height: auto` is load-bearing: the width/height attributes on an <img> are
   presentational hints, so an image whose width CSS scales but whose height is
   left to the attribute gets stretched at every size except the declared one. */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* One focus treatment everywhere, matching the admin theme's 4px brand ring. */
:where(a, button, input, textarea, select, [tabindex]):focus-visible {
  outline: none;
  box-shadow: var(--cl-focus-ring);
  border-radius: var(--cl-radius-input);
}

/* ── Layout primitives ─────────────────────────────────────────────────────
   .container  — centred max-width wrapper with page gutters
   .section    — vertical rhythm between page bands
   .stack      — flow spacing for a run of related blocks
   ------------------------------------------------------------------------ */

.container {
  width: 100%;
  max-width: var(--cl-container);
  margin-inline: auto;
  padding-inline: var(--cl-gutter);
}

.container--narrow {
  max-width: var(--cl-container-narrow);
}

.section {
  padding-block: var(--cl-section-y);
}

.section--tint {
  background: var(--cl-surface-tint);
}

.section--sunken {
  background: var(--cl-surface-sunken);
}

.section--brand {
  background: var(--cl-surface-brand);
  color: var(--cl-text-on-brand);
}

.section--brand h2,
.section--brand h3,
.section--brand h4 {
  color: var(--cl-text-on-brand);
}

.section--brand p {
  color: rgba(255, 255, 255, 0.78);
}

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

.section-header {
  max-width: 720px;
  margin-inline: auto;
  margin-bottom: var(--cl-space-7);
  text-align: center;
}

.section-header p {
  margin-top: var(--cl-space-3);
  font-size: 1.0625rem;
}

/* For a band whose header *is* the content (no grid follows it). */
.section-header--flush {
  margin-bottom: 0;
}

/* ── Utilities ─────────────────────────────────────────────────────────────
   Kept intentionally tiny — anything reused more than twice becomes a
   component class in components.css instead.
   ------------------------------------------------------------------------ */

.text-center {
  text-align: center;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

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