/* ==========================================================================
   BOG CLOUD — BASE
   Reset, document rhythm, typography, and the accessibility primitives that
   the old codebase lacked entirely (there was no .sr-only and no
   :focus-visible rule anywhere in 23 stylesheets).
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 96px;   /* clears the sticky header on anchor jumps */
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

/* Theme changes should not strobe on every token at once. */
body, .topbar, .sidebar, .card, .btn, .field-input {
  transition: background-color 180ms var(--ease),
              border-color 180ms var(--ease),
              color 180ms var(--ease);
}

img, svg, video { display: block; max-width: 100%; height: auto; }
svg { fill: currentColor; }

/* --- TYPOGRAPHY ----------------------------------------------------------
   The gap between the display size and the body size is the whole trick.
   Headlines are allowed to be loud. Paragraphs are not.                   */

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: var(--lh-snug);
  letter-spacing: var(--track-tight);
  text-wrap: balance;
}

h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }

p { text-wrap: pretty; }

a { color: var(--link); text-underline-offset: 3px; }

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

/* --- FOCUS ---------------------------------------------------------------
   Never suppress this. The old codebase deleted the ring outright at
   auth/css/login.css:12 and account/css/profile.css:68, leaving users with a
   border-colour change they had to be looking for. The offset matters: with
   a 3px border on the element, a zero-offset ring is swallowed.           */
:focus-visible {
  outline: var(--focus-ring) solid var(--sky);
  outline-offset: 3px;
}
/* Fallback for engines without :focus-visible — never outline:none. */
:focus:not(:focus-visible) { outline: none; }

/* --- ACCESSIBILITY PRIMITIVES ------------------------------------------- */

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* First tab stop on every page. Visible only on focus. */
.skip-link {
  position: absolute;
  top: var(--s-2);
  left: var(--s-2);
  z-index: 999;
  padding: var(--s-3) var(--s-5);
  background: var(--flag);
  color: var(--on-fill);
  border: var(--bw) solid var(--fill-edge);
  box-shadow: var(--sh-2);
  font-family: var(--font-heading);
  font-weight: 700;
  text-decoration: none;
  transform: translateY(-200%);
}
.skip-link:focus { transform: translateY(0); }

/* --- LANDMARKS ----------------------------------------------------------- */

main { display: block; }
main:focus { outline: none; }   /* target of the skip link; avoid a ring on a whole page */

section { scroll-margin-top: 96px; }

.nav-group-label,
.eyebrow {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--muted);
}

/* --- LAYOUT PRIMITIVES --------------------------------------------------- */

.container {
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: var(--s-5);
}
@media (max-width: 768px) { .container { padding-inline: var(--s-4); } }

.stack   { display: flex; flex-direction: column; gap: var(--s-4); }
.cluster { display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: center; }

.visually-hidden-heading {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}

/* --- REDUCED MOTION ------------------------------------------------------
   The hover-lift and the press-snap are both disabled, not just the
   transition, so nothing moves at all.                                  */
@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;
    scroll-behavior: auto !important;
  }
}

/* --- FORCED COLOURS ------------------------------------------------------
   Windows High Contrast. Hard shadows disappear in forced-colours mode, so
   borders must carry all the structural information on their own.        */
@media (forced-colors: active) {
  .card, .btn, .field-input, .topbar, .sidebar { border: 2px solid CanvasText !important; }
  .btn { forced-color-adjust: none; background: ButtonFace; color: ButtonText; }
  :focus-visible { outline: 3px solid Highlight; }
}
