/* Anime Stat Sheet styles; shared site styles live in /styles.css. Several
   class names here intentionally mirror /nasubi/styles.css (stat-grid,
   data-table, bar-chart, filters) - same visual language for the
   same kind of "curated data analysis" page, just computed live instead of
   from committed JSON. */

/* Hero */

.vs-hero {
  box-shadow: var(--shadow-card);
  padding: 1.5rem;
  background-color: var(--color-surface);
  border-radius: var(--radius-card);
}

.vs-hero h1 {
  font-family: var(--font-heading);
  font-size: 2.2rem;
  font-weight: 900;
  margin-bottom: 0.25rem;
  color: var(--color-title);
  text-shadow: var(--shadow-heading);
}

.vs-subtitle {
  color: var(--color-muted);
  font-style: italic;
}

.vs-prose {
  margin: 0.6rem 0;
  font-size: 0.95rem;
}

.vs-prose a {
  color: var(--color-accent);
}

/* Two-column layout for paired sections (best/worst, top OP/ED) */

.vs-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

/* Without this, a grid item's automatic minimum width is its content's
 * min-content size - and a wide .data-table (nowrap columns) inside pushes
 * that past the viewport, blowing out the whole column (and every plain-text
 * sibling in it) instead of just scrolling within .table-scroll. */
.vs-two-col > * {
  min-width: 0;
}

.vs-two-col h3 {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--color-accent);
}

/* A titled part of a section that isn't split into columns (Revisits' blocks). */
.vs-block {
  margin-top: 1.25rem;
}

.vs-block h3 {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--color-accent);
}

@media (max-width: 768px) {
  .vs-two-col {
    grid-template-columns: 1fr;
  }
}

/* Loves & Hates: genres / studios / tags side by side */

.vs-three-col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.vs-three-col > * {
  min-width: 0;
}

.vs-three-col h3 {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  color: var(--color-accent);
}

.vs-loves-hates-label {
  margin: 0.75rem 0 0.25rem;
  font-size: 0.7rem;
  letter-spacing: 0.1rem;
  text-transform: uppercase;
  color: var(--color-muted);
}

.vs-loves::before {
  content: '\2665  ';
}

.vs-hates::before {
  content: '\2717  ';
}

@media (max-width: 900px) {
  .vs-three-col {
    grid-template-columns: 1fr;
  }
}

/* Taste Profile's dimension switch - pills on the page background, pressed
 * one inverted, the way /vqar's filter chips do it (no opacity tricks). */

.vs-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.vs-switch-button {
  padding: 0.25rem 0.8rem;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  border: 1px solid var(--color-accent);
  border-radius: 999px;
  background-color: transparent;
  color: var(--color-accent);
  cursor: pointer;
}

.vs-switch-button[aria-pressed="true"] {
  background-color: var(--color-accent);
  color: var(--color-bg);
}

.vs-switch-button:hover {
  text-decoration: underline;
}

.vs-switch-button:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.vs-note {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  font-style: italic;
  color: var(--color-muted);
}

.vs-filter-note {
  margin: 0 0 1rem;
  padding: 0 0.5rem;
}

/* Which view the sections below belong to: "Career", or one season's report. */
.vs-view-heading {
  margin: 0 0 1rem;
  padding: 0 0.5rem;
}

.vs-view-title {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--color-title);
}

.vs-view-heading .vs-note {
  margin-top: 0.25rem;
}

/* A table name that links off to the filtered /vqar view: the cell's own
 * text colour, so it stays inside the pairings the contrast test covers,
 * marked as a link by its underline. */
.data-table td a {
  color: inherit;
  text-decoration: underline;
}

/* Stat tiles */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.stat-tile {
  box-shadow: var(--shadow-card);
  padding: 0.85rem 0.75rem;
  text-align: center;
  background-color: var(--color-surface);
  border: 1px solid var(--color-article-border);
  border-radius: var(--radius-card);
}

.stat-value {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--color-accent);
  line-height: 1.2;
}

.stat-label {
  margin-top: 0.25rem;
  font-size: 0.7rem;
  letter-spacing: 0.03rem;
  text-transform: uppercase;
  color: var(--color-muted);
}

/* Data tables */

.table-scroll {
  overflow-x: auto;
  margin-top: 0.5rem;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.data-table th,
.data-table td {
  padding: 0.4rem 0.6rem;
  text-align: left;
  border-bottom: 1px solid var(--color-article-border);
  white-space: nowrap;
}

.data-table td:first-child {
  white-space: normal;
  min-width: 10rem;
}

.data-table thead th {
  padding: 0;
  user-select: none;
  background-color: var(--color-chrome);
  color: var(--color-nav-link);
  position: sticky;
  top: 0;
}

/* The sort control is a real button inside the header cell, so it's reachable
 * and activatable by keyboard; it's styled to look like the cell it fills. */
.data-table thead th .sort-button {
  width: 100%;
  padding: 0.4rem 0.6rem;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  /* Same Safari native-chrome reset as .theme-reroll in /styles.css - without
   * it <button> picks up rounded corners and extra padding on iOS. */
  appearance: none;
  -webkit-appearance: none;
}

/* Underlined rather than dimmed: opacity would stack on top of --color-nav-link
 * over --color-chrome and can drop that pairing below AA in some themes. */
.data-table thead th .sort-button:hover {
  text-decoration: underline;
}

.data-table thead th.sorted-asc .sort-button::after {
  content: ' \25B2';
}

.data-table thead th.sorted-desc .sort-button::after {
  content: ' \25BC';
}

.data-table tbody tr:nth-child(even) {
  background-color: color-mix(in srgb, var(--color-bg) 50%, transparent);
}

/* Bar charts: single-hue magnitude bars, direct-labeled */

.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 0.4rem;
  height: 12rem;
  margin: 1rem 0 0.5rem;
  padding: 0.5rem 0.25rem 0;
  border-bottom: 2px solid var(--color-section-border);
}

.bar-col {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  min-width: 0;
}

.bar-value {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 0.2rem;
  white-space: nowrap;
}

.bar-fill {
  width: 100%;
  max-width: 2.5rem;
  background-color: var(--color-accent);
  border-radius: var(--radius-card) var(--radius-card) 0 0;
  min-height: 2px;
}

.bar-label {
  margin-top: 0.35rem;
  font-size: 0.68rem;
  color: var(--color-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Browse Data filters (mirrors /vqar's and /nasubi's filter bar) */

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
  padding: 0.5rem 1rem;
  border: 1px solid var(--color-input-border);
  background-color: var(--color-chrome);
}

/* The season picker and the Reviews switch shouldn't stretch to fill the
   whole row the way .filters does when it holds several fields. */
.vs-season-filters {
  grid-template-columns: minmax(200px, 320px) auto;
  align-items: start;
}

@media (max-width: 560px) {
  .vs-season-filters {
    grid-template-columns: 1fr;
  }
}

.filter-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--color-nav-link);
}

/* The Reviews switch sits on the filter bar's --color-chrome, where the only
   pairing the contrast test covers is --color-nav-link: so it's drawn in
   that, and the pressed pill inverts the same two colors. */
.vs-source-switch {
  margin: 0;
  min-height: 2.75rem;
  align-items: center;
}

.vs-source-switch .vs-switch-button {
  border-color: var(--color-nav-link);
  color: var(--color-nav-link);
}

.vs-source-switch .vs-switch-button[aria-pressed="true"] {
  background-color: var(--color-nav-link);
  color: var(--color-chrome);
}

.vs-source-switch .vs-switch-button:focus-visible {
  outline-color: var(--color-nav-link);
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.filter-group label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--color-nav-link);
}

.filters input,
.filters select {
  height: 2.75rem;
  padding: 0.5rem;
  font: inherit;
  border: 2px solid var(--color-input-border);
  width: 100%;
  box-sizing: border-box;
  background-color: var(--color-surface);
  color: var(--color-text);
}

.filters input:focus,
.filters select:focus {
  border-color: var(--color-input-focus);
  box-shadow: var(--shadow-focus);
  outline: none;
}

@media (max-width: 768px) {
  .vs-hero h1 {
    font-size: 1.6rem;
  }
}

/* Review coverage: reviewed-out-of-lineup progress bar */

.coverage-summary {
  margin: 0 0 0.5rem;
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 900;
  color: var(--color-accent);
}

.coverage-track {
  height: 1.25rem;
  overflow: hidden;
  background-color: color-mix(in srgb, var(--color-bg) 50%, transparent);
  border: 1px solid var(--color-section-border);
  border-radius: var(--radius-card);
}

.coverage-fill {
  height: 100%;
  background-color: var(--color-accent);
}
