/* ==========================================================================
   base.css — reset, page defaults, line icons, the theme cross-fade and the
   shared motion keyframes (with their reduced-motion versions).
   Only consumes tokens from tokens.css; no literal colours here.
   ========================================================================== */

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

* {
  margin: 0;
  padding: 0;
}

html {
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overscroll-behavior: none;
}

body {
  font-family: var(--font-ui);
  font-size: var(--text-base);
  line-height: 1.5;
  color: var(--text);
  background: var(--rail);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior: none;
}

h1,
h2,
h3,
h4 {
  font-weight: 700;
  line-height: 1.2;
}

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

button {
  font: inherit;
  color: inherit;
  text-align: inherit;
  background: none;
  border: 0;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

button:disabled {
  cursor: default;
}

svg {
  display: block;
  flex: none;
}

ul,
ol {
  list-style: none;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

/* Line icons: <svg class="i" viewBox="0 0 24 24"> */
.i {
  width: 1em;
  height: 1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Filled glyphs from the sprite, such as the wheat mark at icon size. */
.i-solid {
  fill: currentColor;
  stroke: none;
}

/* The <svg> holding the icon <symbol>s: present, never drawn. */
.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

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

.num {
  font-variant-numeric: tabular-nums;
}

/* Flipping the theme cross-fades colours for a moment instead of snapping. */
.theme-fade,
.theme-fade *,
.theme-fade *::before,
.theme-fade *::after {
  transition:
    background-color 240ms ease,
    border-color 240ms ease,
    color 240ms ease,
    box-shadow 240ms ease !important;
}

/* ---- Motion vocabulary ------------------------------------------------- */

@keyframes arrive {
  from { opacity: 0; transform: translateY(6px); }
}

@keyframes pop-in {
  from { opacity: 0; transform: scale(0.9); }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(16px) scale(0.985); }
}

@keyframes leave {
  to { opacity: 0; transform: translateY(-12px); }
}

@keyframes typing-dot {
  0%, 60%, 100% { opacity: 0.35; transform: none; }
  30% { opacity: 1; transform: translateY(-2px); }
}

@keyframes flash {
  from { box-shadow: inset 0 0 0 1px var(--metric-line, transparent), 0 0 0 3px var(--flash, transparent); }
}

/* Reduced motion: keep the fades that explain what changed, drop the travel. */
@media (prefers-reduced-motion: reduce) {
  @keyframes arrive { from { opacity: 0; } }
  @keyframes pop-in { from { opacity: 0; } }
  @keyframes rise { from { opacity: 0; } }
  @keyframes leave { to { opacity: 0; } }
  @keyframes typing-dot { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }
}
