/* ==========================================================================
   Unbanded — base layer: reset, typography, layout, utilities
   Reads only the custom properties in css/tokens.css. No colour, size or
   face is written here as a literal; if a value is missing, add a token.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Reset
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  height: 100%;
  background: var(--bg0);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overscroll-behavior-y: contain;      /* no pull-to-refresh bounce: data is local */
}

body {
  min-height: 100%;
  margin: 0;
  background: var(--bg0);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-weight: var(--fw-body);
  font-variant-numeric: lining-nums tabular-nums;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: contain;
  -webkit-tap-highlight-color: transparent;
  transition: background-color var(--t-fade) linear, color var(--t-fade) linear;
}

body.sheet-open { overflow: hidden; }

h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd, ul, ol, pre { margin: 0; }
ul, ol { padding: 0; list-style: none; }       /* lists are components; .prose restores bullets */
img, svg, video, canvas, picture { display: block; max-width: 100%; }
img { height: auto; }
iframe { border: 0; }
hr { border: 0; height: 1px; margin: var(--sp-4) 0; background: var(--border); }
strong, b { font-weight: 600; }
small { font-size: var(--fs-caption); }
sub, sup { font-size: 75%; line-height: 0; position: relative; vertical-align: baseline; }
sup { top: -0.4em; }
sub { bottom: -0.2em; }

button, input, select, textarea {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
  margin: 0;
}
button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-align: inherit;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
button:disabled { cursor: default; }
a {
  color: var(--accent-strong);
  text-decoration: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
:where(a:not([class])):active { color: var(--accent); }   /* bare links only; components own their pressed colour */
[data-href], [data-action] { cursor: pointer; }

input::placeholder, textarea::placeholder { color: var(--text-muted); opacity: 1; }
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; }
input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }
textarea { resize: vertical; }
summary { cursor: pointer; }
[hidden] { display: none !important; }
::selection { background: var(--accent); color: var(--accent-text); }

/* Inline icons: App.icon() sets width/height attributes; components resize via CSS. */
.icon { display: inline-block; vertical-align: middle; flex: none; }
svg.icon { fill: none; stroke: currentColor; }

/* Every screen scopes its own CSS in a <style> inside <main>; it must never render. */
.screen > style, .screen style { display: none; }

/* --------------------------------------------------------------------------
   2. Focus — the brass ring on everything interactive. Components that carry
      their own box-shadow compose the ring in components.css.
   -------------------------------------------------------------------------- */
:focus { outline: none; }
:focus-visible { outline: none; box-shadow: var(--focus); }
.topbar-title:focus, .topbar-title:focus-visible, [tabindex="-1"]:focus:not(:focus-visible) { box-shadow: none; }

/* --------------------------------------------------------------------------
   3. Typography
   -------------------------------------------------------------------------- */
h1, h2, .display {
  font-family: var(--font-display);
  font-weight: var(--fw-title-md);
  font-variation-settings: var(--display-soft), var(--display-opsz-title);
  letter-spacing: var(--ls-title-lg);
  color: var(--text);
  overflow-wrap: anywhere;
}
h1 { font-size: var(--fs-title-lg); line-height: var(--lh-title-lg); font-weight: var(--fw-title-lg); }
h2 { font-size: var(--fs-title-md); line-height: var(--lh-title-md); font-variation-settings: var(--display-soft), var(--display-opsz-md); letter-spacing: 0; }
h3, h4 { font-family: var(--font-body); font-size: var(--fs-body-lg); line-height: var(--lh-body-lg); font-weight: 600; color: var(--text); }

.title-xl {
  font-family: var(--font-display);
  font-size: var(--fs-title-xl);
  line-height: var(--lh-title-xl);
  font-weight: var(--fw-title-xl);
  letter-spacing: var(--ls-title-xl);
  font-variation-settings: var(--display-soft), var(--display-opsz-title);
  color: var(--text);
}
.title-lg {
  font-family: var(--font-display);
  font-size: var(--fs-title-lg);
  line-height: var(--lh-title-lg);
  font-weight: var(--fw-title-lg);
  letter-spacing: var(--ls-title-lg);
  font-variation-settings: var(--display-soft), var(--display-opsz-title);
  color: var(--text);
}
.title-md {
  font-family: var(--font-display);
  font-size: var(--fs-title-md);
  line-height: var(--lh-title-md);
  font-weight: var(--fw-title-md);
  letter-spacing: 0;
  font-variation-settings: var(--display-soft), var(--display-opsz-md);
  color: var(--text);
}
.stat-type {
  font-family: var(--font-display);
  font-size: var(--fs-stat);
  line-height: var(--lh-stat);
  font-weight: var(--fw-stat);
  letter-spacing: var(--ls-stat);
  font-variation-settings: var(--display-soft), var(--display-opsz-num);
  font-variant-numeric: tabular-nums lining-nums;
  color: var(--text);
}
.body-lg { font-size: var(--fs-body-lg); line-height: var(--lh-body-lg); font-weight: var(--fw-body-lg); }
.body { font-size: var(--fs-body); line-height: var(--lh-body); font-weight: var(--fw-body); }
.label {
  font-size: var(--fs-label);
  line-height: var(--lh-label);
  font-weight: var(--fw-label);
  letter-spacing: var(--ls-label);
  color: var(--text-2);
}
.caption {
  font-size: var(--fs-caption);
  line-height: var(--lh-caption);
  font-weight: var(--fw-caption);
  letter-spacing: var(--ls-caption);
  color: var(--text-muted);
}
/* The band-label eyebrow: section titles, third names, the large-title eyebrow. Nowhere else. */
.eyebrow {
  font-family: var(--font-body);
  font-size: var(--fs-overline);
  line-height: var(--lh-overline);
  font-weight: var(--fw-overline);
  letter-spacing: var(--ls-overline);
  text-transform: uppercase;
  color: var(--text-muted);
}
.num, .tabular { font-variant-numeric: tabular-nums lining-nums; }
.unit { font-size: calc(1em - 2px); color: var(--text-2); font-weight: 500; }
.mono { font-family: var(--font-mono); }
.link { color: var(--accent-strong); font-weight: 600; }

.text-primary { color: var(--text); }
.text-secondary { color: var(--text-2); }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent-strong); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-info { color: var(--info); }
.text-right { text-align: right; }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.nowrap { white-space: nowrap; }
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
/* A data table kept for screen readers under a chart lays out at 1px instead of its full width */
.sr-only table, table.sr-only { width: 1px; max-width: 1px; table-layout: fixed; }

/* Running copy (reference articles, guides) */
.prose { color: var(--text-2); }
.prose > * + * { margin-top: var(--sp-3); }
.prose h2, .prose h3 { color: var(--text); margin-top: var(--sp-6); }
.prose ul { list-style: disc; padding-left: 20px; }
.prose ol { list-style: decimal; padding-left: 20px; }
.prose li + li { margin-top: var(--sp-1); }
.prose strong { color: var(--text); }

/* --------------------------------------------------------------------------
   4. Layout — the content column
   -------------------------------------------------------------------------- */
.screen {
  position: relative;
  width: 100%;
  max-width: var(--col-max);
  margin: 0 auto;
  padding-top: var(--sp-2);
  padding-right: max(var(--gutter), var(--safe-right));
  padding-bottom: calc(var(--tabbar-total) + var(--sp-6));
  padding-left: max(var(--gutter), var(--safe-left));
}
body.has-actionbar .screen,
body[data-actionbar] .screen { padding-bottom: calc(var(--tabbar-total) + var(--actionbar-h) + var(--sp-4)); }
body[data-topbar="none"] .screen { padding-top: calc(var(--safe-top) + var(--sp-2)); }
[data-dim] .screen { padding-top: calc(var(--safe-top) + var(--sp-2)); padding-bottom: calc(var(--safe-bottom) + var(--sp-6)); }
body[data-dim].has-actionbar .screen, body[data-dim][data-actionbar] .screen { padding-bottom: calc(var(--safe-bottom) + var(--actionbar-h) + var(--sp-4)); }
/* No tab bar (extra-dim, def.hideTabbar): everything positioned above it drops to the safe area */
body[data-dim], body[data-hide-tabbar] { --tabbar-total: var(--safe-bottom); }

/* Edge to edge inside the column (chip rows, hero photos, band swatches) */
.bleed { margin-left: calc(-1 * var(--gutter)); margin-right: calc(-1 * var(--gutter)); }

/* Stacks and clusters */
.stack { display: flex; flex-direction: column; gap: var(--sp-3); }
.stack-1 { display: flex; flex-direction: column; gap: var(--sp-1); }
.stack-2 { display: flex; flex-direction: column; gap: var(--sp-2); }
.stack-4 { display: flex; flex-direction: column; gap: var(--sp-4); }
.stack-6 { display: flex; flex-direction: column; gap: var(--sp-6); }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.inline { display: inline-flex; align-items: center; gap: 6px; vertical-align: middle; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.flex-1 { flex: 1 1 auto; min-width: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-2); }
.grid-2 > .btn, .grid-3 > .btn { width: 100%; }
@media (max-width: 345px) {
  .grid-2:not(.grid-keep) { grid-template-columns: minmax(0, 1fr); }
}

/* Horizontal scroller (cards, thumbs). Chip rows have their own component. */
.scroll-x {
  display: flex;
  gap: var(--sp-2);
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x proximity;
  scroll-padding-left: var(--gutter);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  touch-action: pan-x pan-y;
}
.scroll-x::-webkit-scrollbar { display: none; }
.scroll-x > * { flex: none; scroll-snap-align: start; }
.scroll-x.bleed { padding-left: var(--gutter); padding-right: var(--sp-8); }
.hide-scrollbar { scrollbar-width: none; }
.hide-scrollbar::-webkit-scrollbar { display: none; }

/* Spacing */
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: var(--sp-1); }
.mt-2 { margin-top: var(--sp-2); }
.mt-3 { margin-top: var(--sp-3); }
.mt-4 { margin-top: var(--sp-4); }
.mt-5 { margin-top: var(--sp-5); }
.mt-6 { margin-top: var(--sp-6); }
.mt-8 { margin-top: var(--sp-8); }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: var(--sp-1); }
.mb-2 { margin-bottom: var(--sp-2); }
.mb-3 { margin-bottom: var(--sp-3); }
.mb-4 { margin-bottom: var(--sp-4); }
.mb-6 { margin-bottom: var(--sp-6); }
.mt-auto { margin-top: auto; }
.divider { height: 1px; background: var(--border); margin: var(--sp-2) 0; }

/* The thumb zone: pushes its content toward the bottom 40% when a screen is short */
.thumb-zone { margin-top: auto; padding-top: var(--sp-6); }

/* --------------------------------------------------------------------------
   5. Reduced motion — durations are tokens (0ms under reduce, except the
      120ms opacity fade). This is the safety net for keyframe animations.
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0ms !important;
    scroll-behavior: auto !important;
  }
}
html[data-reduce-motion] *, html[data-reduce-motion] *::before, html[data-reduce-motion] *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  animation-delay: 0ms !important;
  scroll-behavior: auto !important;
}
