/* ==========================================================================
   Base: reset, typography, focus, scrollbars, keyframes, reduced motion
   ========================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--grad-page);
  background-attachment: fixed;
  color: var(--text);
  font: 400 var(--fs-md) / 1.65 var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
[hidden] {
  display: none !important;
}
h1,
h2,
h3,
h4,
p {
  margin: 0;
}
h1,
h2,
h3,
h4,
b,
strong,
.num {
  font-family: var(--font-display);
}
h1 {
  font-size: clamp(1.55rem, 1.1rem + 1.6vw, var(--fs-3xl));
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
}
h3 {
  font-size: var(--fs-xl);
  font-weight: 600;
  line-height: 1.35;
}
h4 {
  font-size: var(--fs-lg);
  font-weight: 600;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  border: 0;
  background: none;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}
img {
  max-width: 100%;
  display: block;
}
small {
  font-size: var(--fs-xs);
}
.num,
[dir='ltr'] {
  font-variant-numeric: tabular-nums;
}
table {
  border-collapse: collapse;
  width: 100%;
}
.sr-only,
.skip-link:not(:focus) {
  position: absolute;
  inset: 0 auto auto 0;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.skip-link:focus {
  position: fixed;
  inset-block-start: 12px;
  inset-inline-start: 12px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: var(--r-sm);
  background: var(--ink-900);
  color: #fff;
}

/* Keyboard focus: always visible, never on mouse click */
:focus {
  outline: none;
}
:focus-visible {
  outline: 2px solid var(--aqua-500);
  outline-offset: 2px;
  box-shadow: var(--focus);
}
::selection {
  background: var(--aqua-200);
  color: var(--ink-950);
}
* {
  scrollbar-width: thin;
  scrollbar-color: var(--ink-200) transparent;
}
::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}
::-webkit-scrollbar-thumb {
  background: var(--ink-200);
  border-radius: var(--r-pill);
  border: 2px solid transparent;
  background-clip: content-box;
}

/* Icons (inline SVG, inherit colour) */
.ico {
  width: 1.15em;
  height: 1.15em;
  flex: none;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---- Keyframes ---- */
@keyframes viewIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes popIn {
  0% {
    transform: scale(0.6);
  }
  60% {
    transform: scale(1.12);
  }
  100% {
    transform: scale(1);
  }
}
@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes ripple {
  to {
    transform: scale(1);
    opacity: 0;
  }
}
@keyframes flashRow {
  0% {
    background: rgb(31 179 132 / 0.28);
  }
  100% {
    background: transparent;
  }
}
@keyframes pulseDot {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgb(31 179 132 / 0.5);
  }
  50% {
    box-shadow: 0 0 0 6px rgb(31 179 132 / 0);
  }
}
@keyframes drift {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(3%, -4%, 0) scale(1.08);
  }
}

/* View transition + staggered entrance (index set by motion.js as --i) */
.view-enter {
  animation: viewIn var(--t-slow) var(--ease-out) both;
}
.rise {
  animation: riseIn var(--t-slow) var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 45ms);
}

/* Users who ask for less motion get none: no animation, no smooth scroll, instant state changes */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

html {
  scroll-padding-top: calc(var(--topbar-h) + 24px);
}

html,
body {
  overflow-x: clip;
}
