/**
 * CLEO Studio — Global base reset + utility classes.
 *
 * Applied once from `src/routes/+layout.svelte` alongside `tokens.css`.
 * Only rules that genuinely need to be global live here — per-component
 * styling stays scoped inside each `.svelte` file.
 *
 * @task T990
 * @wave 0
 */

/* -------------------------------------------------------------------
 * Reset — border-box everywhere, zero default margins.
 * ----------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
  padding: 0;
}

/* -------------------------------------------------------------------
 * HTML / body defaults — typography, colour, scrollbar, numerals.
 * ----------------------------------------------------------------- */
html {
  scrollbar-color: var(--border-strong) transparent;
  scrollbar-width: thin;
}

body.cleo-root,
body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  font-variant-numeric: tabular-nums;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* -------------------------------------------------------------------
 * Selection — accent-soft for a subtle brand tint on highlight.
 * ----------------------------------------------------------------- */
::selection {
  background: var(--accent-soft);
  color: var(--text);
}

/* -------------------------------------------------------------------
 * Keyboard skip link — hidden off-canvas until focused by Tab.
 * ----------------------------------------------------------------- */
.skip-link {
  position: absolute;
  top: -40px;
  left: var(--space-2);
  z-index: 9999;
  padding: var(--space-2) var(--space-4);
  background: var(--accent);
  color: var(--bg);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  box-shadow: var(--shadow-md);
  transition: top var(--ease);
}

.skip-link:focus,
.skip-link:focus-visible {
  top: var(--space-2);
  outline: 2px solid var(--bg);
  outline-offset: 2px;
}

/* -------------------------------------------------------------------
 * Utility — sr-only pattern (visually-hidden but announced by AT).
 * ----------------------------------------------------------------- */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* -------------------------------------------------------------------
 * Utility — cluster-flow: horizontal gap wrapper for toolbar content.
 * ----------------------------------------------------------------- */
.cluster-flow {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: center;
}

/* -------------------------------------------------------------------
 * Main landmark — programmatic focus target (Skip-link destination).
 * `tabindex="-1"` + :focus-visible style ensures keyboard users see
 * where they landed without a permanent outline.
 * ----------------------------------------------------------------- */
main#main:focus {
  outline: none;
}

main#main:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
