/* Storify look: a quiet listening journal. Warm paper, dark ink, one indigo
   accent for bars and controls, and a strong orange focus ring. System fonts
   only, so no request leaves the page. */
:root {
  --paper: #f7f4ee;
  --card: #ffffff;
  --ink: #1f1d2b;
  --muted: #545165;
  --line: #ddd8cd;
  --accent: #3d3fa8;
  --accent-soft: #e8e8f7;
  --bar-empty: #ebe7df;
  --focus: #c2410c;
  --error: #a3221a;
  --radius: 10px;
  color-scheme: light;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0 auto;
  max-width: 72rem;
  padding: 1rem;
  overflow-wrap: anywhere;
}

h1,
h2,
h3,
h4,
h5 {
  line-height: 1.25;
  margin: 0 0 0.5rem;
}

h1 {
  font-size: 1.9rem;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 1.35rem;
}

h3 {
  font-size: 1.1rem;
}

h4,
h5 {
  font-size: 1rem;
}

p {
  margin: 0 0 0.75rem;
}

a {
  color: var(--accent);
}

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

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

.skip-link {
  position: absolute;
  left: -999px;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
  background: var(--card);
  padding: 0.5rem;
  z-index: 1;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
}

.site-header {
  display: grid;
  gap: 0 1rem;
}

.brand p,
.hint,
.coverage,
.count,
.comparison,
.sources,
.site-footer {
  color: var(--muted);
}

.import-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  align-items: end;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  max-width: 100%;
}

label {
  font-weight: 600;
}

input,
select,
button {
  font: inherit;
  max-width: 100%;
}

input[type="search"],
select {
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--muted);
  border-radius: 6px;
  background: var(--card);
  color: var(--ink);
}

button {
  cursor: pointer;
  padding: 0.45rem 0.9rem;
  border-radius: 6px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
}

button.secondary,
button.back,
.toggle button,
.row button {
  background: var(--card);
  color: var(--accent);
}

.toggle button[aria-pressed="true"] {
  background: var(--accent);
  color: #fff;
}

button[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
}

progress {
  width: 100%;
  margin-top: 0.75rem;
}

.status:empty,
.error:empty {
  display: none;
}

.status {
  margin: 0.75rem 0 0;
}

.error {
  margin: 0.75rem 0 0;
  color: var(--error);
  font-weight: 600;
}

.guide summary {
  cursor: pointer;
}

.guide summary h2 {
  display: inline;
}

.guide ol {
  padding-left: 1.25rem;
}

.view {
  display: grid;
  gap: 0.75rem;
}

.view > * {
  margin-bottom: 0;
}

.view-heading {
  font-size: 1.6rem;
}

.view-heading:focus {
  outline: none;
}

.view-actions,
.toolbar,
.recap-controls,
.pager,
.sets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  align-items: end;
}

.back {
  justify-self: start;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 0.75rem;
  margin: 0;
}

.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
}

.stat dt {
  color: var(--muted);
  font-size: 0.9rem;
}

.stat dd {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 700;
}

.overview-grid,
.columns,
.royalty-grid {
  display: grid;
  gap: 1rem;
  align-items: start;
}

.stack > .card:last-child,
.columns > .card {
  margin-bottom: 0;
}

.trend-list,
.rows {
  list-style: none;
  margin: 0;
  padding: 0;
}

.entry {
  display: grid;
  grid-template-columns: 6rem 1fr 11rem;
  gap: 0.25rem 0.75rem;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 0.35rem 0.5rem;
  margin-bottom: 0.25rem;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
}

button.entry:hover {
  border-color: var(--line);
  background: var(--accent-soft);
}

.entry .tag {
  grid-column: 2 / -1;
  justify-self: start;
}

.entry.outside {
  color: var(--muted);
}

.entry.outside .bar {
  background: repeating-linear-gradient(135deg, var(--bar-empty) 0 6px, transparent 6px 12px);
}

.entry-label {
  font-weight: 600;
}

.entry-value {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.bar {
  display: block;
  height: 0.8rem;
  border-radius: 4px;
  background: var(--bar-empty);
  overflow: hidden;
}

.bar-fill {
  display: block;
  height: 100%;
  background: var(--accent);
}

.tag {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0 0.4rem;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent);
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 0.75rem;
  align-items: baseline;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--line);
}

.row:last-child {
  border-bottom: 0;
}

.row .name {
  font-weight: 600;
}

.row .by,
.row .detail {
  color: var(--muted);
}

.row .detail,
.row .links,
.row .measures,
.row .drill {
  flex-basis: 100%;
}

.ranked .rank {
  font-weight: 700;
  color: var(--accent);
  min-width: 1.5rem;
}

.measures {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  font-variant-numeric: tabular-nums;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  font-size: 0.92rem;
}

.drill {
  margin-top: 0.5rem;
  padding: 0.75rem;
  border-left: 3px solid var(--accent-soft);
  background: #fbfaf7;
}

.big {
  font-size: 1.3rem;
  font-weight: 700;
}

.royalties {
  margin-top: 1rem;
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}

.royalties h3:focus {
  outline: none;
}

.royalty-block {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
}

.royalty-block.citation {
  background: #fbfaf7;
}

.royalty-explainer {
  margin-top: 1rem;
}

.chapter {
  min-height: 14rem;
}

.chapter h3:focus {
  outline: none;
}

p.empty {
  font-style: italic;
}

.site-footer {
  margin-top: 1.5rem;
}

@media (min-width: 56rem) {
  .site-header {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }

  .brand {
    grid-column: 1 / -1;
  }

  .overview-grid {
    grid-template-columns: 3fr 2fr;
    align-items: start;
  }

  .columns {
    grid-template-columns: 1fr 1fr;
  }

  .royalty-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 30rem) {
  body {
    padding: 0.6rem;
  }

  .entry {
    grid-template-columns: 4.5rem 1fr;
  }

  .entry-value {
    grid-column: 2;
    text-align: left;
  }
}
