/** Reset, base typography, and shared utilities. */

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

* { margin: 0; }

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

body {
  min-height: 100%;
  font-family: var(--font-ui);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Colour changes are animated so switching theme or mode reads as a
     transition rather than a flash. */
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

img, svg, video, canvas { display: block; max-width: 100%; }

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

button { cursor: pointer; background: none; border: none; padding: 0; }
button:disabled { cursor: not-allowed; opacity: 0.55; }

a { color: var(--accent-text); text-decoration-thickness: 1px; text-underline-offset: 2px; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: var(--lh-tight);
  letter-spacing: var(--letter-display);
  font-weight: var(--fw-bold);
  text-wrap: balance;
}
h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); }
h4 { font-size: var(--fs-md); }

p { text-wrap: pretty; }

ul, ol { padding: 0; list-style: none; }

/* One visible focus style everywhere, never removed - keyboard users need to
   see where they are, and the calendar grid is navigated by arrow keys. */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
:focus:not(:focus-visible) { outline: none; }

::selection { background: var(--accent); color: var(--accent-contrast); }

/* Scrollbars follow the theme instead of staying stark white in dark mode. */
* { scrollbar-color: var(--border-strong) transparent; scrollbar-width: thin; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-pill);
  border: 2px solid var(--bg);
}

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

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

/* Skip link: hidden until focused, then pinned to the top-left. */
.skip-link {
  position: absolute;
  left: var(--sp-3);
  top: -100px;
  z-index: 999;
  padding: var(--sp-2) var(--sp-4);
  background: var(--accent);
  color: var(--accent-contrast);
  border-radius: var(--radius);
  transition: top var(--dur) var(--ease);
}
.skip-link:focus { top: var(--sp-3); }

.stack { display: flex; flex-direction: column; gap: var(--sp-3); }
.row { display: flex; align-items: center; gap: var(--sp-2); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.center { display: flex; align-items: center; justify-content: center; }

.muted { color: var(--text-muted); }
.subtle { color: var(--text-subtle); }
.small { font-size: var(--fs-sm); }
.tiny { font-size: var(--fs-xs); }
.bold { font-weight: var(--fw-semibold); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-center { text-align: center; }

.hidden { display: none !important; }

.icon { flex: none; }

/* Horizontal scroll containers: wide content scrolls itself so the page body
   never scrolls sideways. */
.scroll-x { overflow-x: auto; overscroll-behavior-x: contain; }

/* The <noscript> fallback. Its rules used to live in a style="" attribute, but
   the CSP forbids inline styles in markup, and no exception is worth carving
   for four declarations. */
.noscript-notice {
  padding: 2rem;
  text-align: center;
  font-family: system-ui, sans-serif;
}
