/* Reset, typography, focus, utilities, shared animation and reduced motion. The shell layout is in components.css. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scrollbar-gutter: stable; }
html.no-scroll { overflow: hidden; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-14);
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: var(--fs-28); font-weight: 600; letter-spacing: -0.01em; line-height: 1.2; }
h2 { font-size: var(--fs-15); font-weight: 600; }
h3 { font-size: var(--fs-14); font-weight: 600; }
a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }
s { text-decoration: line-through; }
ul, ol { margin: 0; padding: 0; list-style: none; }
table { border-collapse: collapse; border-spacing: 0; }
svg { flex: none; }
[hidden] { display: none !important; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.focus-in:focus-visible { outline-offset: -2px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }

.sr { position: absolute; width: 1px; height: 1px; margin: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0; }
.skip-link {
  position: fixed; left: var(--sp-12); top: -60px; z-index: 300; padding: var(--sp-8) var(--sp-14);
  border-radius: var(--r); background: var(--accent); color: var(--on-accent); font-weight: 500;
  transition: top var(--d1) var(--ease);
}
.skip-link:focus { top: var(--sp-12); }

/* utilities */
.c-win { color: var(--win); }
.c-loss { color: var(--loss); }
.c-mute { color: var(--text-3); }
.c-2 { color: var(--text-2); }
.c-pend { color: var(--pending); }
.c-accent { color: var(--accent); }
.r { text-align: right; }
.nowrap { white-space: nowrap; }
.fw5 { font-weight: 500; }
.fw6 { font-weight: 600; }
.fs12 { font-size: var(--fs-12); }
.fs13 { font-size: var(--fs-13); }
.row { display: flex; align-items: center; gap: var(--sp-8); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-12); }
.col { display: flex; flex-direction: column; gap: var(--sp-8); }
.wrap { flex-wrap: wrap; }
.grow { flex: 1 1 0; min-width: 0; }
.stack-12 > * + * { margin-top: var(--sp-12); }
.stack-16 > * + * { margin-top: var(--sp-16); }
.gap-4 { gap: var(--sp-4); } .gap-12 { gap: var(--sp-12); } .gap-16 { gap: var(--sp-16); } .gap-24 { gap: var(--sp-24); }
.mt-4 { margin-top: var(--sp-4); } .mt-8 { margin-top: var(--sp-8); } .mt-12 { margin-top: var(--sp-12); } .mt-16 { margin-top: var(--sp-16); } .mt-24 { margin-top: var(--sp-24); }
/* Grids keep the default stretch, so panels in one row have equal height. */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-16); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-16); }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-16); }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.muted-note { font-size: var(--fs-12); line-height: 16px; color: var(--text-3); }
.page { display: flex; flex-direction: column; gap: var(--sp-24); min-width: 0; }

/* Phone visibility only hides: it never sets a display value, so block and flex elements keep their own. */
@media (min-width: 768px) {
  .show-phone { display: none !important; }
}

@media (max-width: 767px) {
  .hide-phone { display: none !important; }
  h1 { font-size: var(--fs-24); }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
}

/* Loops and placeholders that later components reuse. */
@keyframes ds-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes ds-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.anim-pulse { animation: ds-pulse 1.6s ease-in-out infinite; }
.anim-shimmer {
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--line) 50%, var(--surface-2) 100%);
  background-size: 200% 100%;
  animation: ds-shimmer 1.2s linear infinite;
}

/* Colour cross-fade while ds.js holds html.theme-anim after a theme switch. */
@media (prefers-reduced-motion: no-preference) {
  html.theme-anim *, html.theme-anim *::before, html.theme-anim *::after {
    transition: background-color var(--d3) var(--ease), color var(--d3) var(--ease), border-color var(--d3) var(--ease), fill var(--d3) var(--ease), stroke var(--d3) var(--ease) !important;
  }
}

/* Reduced motion: every animation and transition ends at once and nothing repeats. Keep these last. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    transition-delay: 0s !important;
    scroll-behavior: auto !important;
  }
}
html.no-motion *, html.no-motion *::before, html.no-motion *::after {
  animation-duration: .01ms !important;
  animation-delay: 0s !important;
  animation-iteration-count: 1 !important;
  transition-duration: .01ms !important;
  transition-delay: 0s !important;
  scroll-behavior: auto !important;
}
