/* ==========================================================================
   The Sopranos Wiki — theme overrides

   Palette taken from the show's own iconography: the Bada Bing neon, the
   red of the title card, asphalt grey, and the sickly fluorescent green of
   a strip-club back room at 4am.
   ========================================================================== */

:root {
  --sop-red: #9e2020;
  --sop-red-bright: #cf3b3b;
  --sop-neon: #e34a4a;
  --sop-asphalt: #2b2b2e;
  --sop-bone: #f4f1ec;
  --sop-ink: #17171a;
}

/* ---- Light scheme ---- */
[data-md-color-scheme="default"] {
  --md-primary-fg-color: #17171a;
  --md-accent-fg-color: #8d1c1c;
  --md-typeset-a-color: #8d1c1c;
  --md-default-bg-color: var(--sop-bone);
  --md-typeset-color: var(--sop-ink);
  --md-code-bg-color: #e8e4dd;
}

/* ---- Dark scheme ---- */
[data-md-color-scheme="slate"] {
  --md-primary-fg-color: #0c0c0e;
  --md-accent-fg-color: var(--sop-red-bright);
  --md-typeset-a-color: var(--sop-red-bright);
  --md-default-bg-color: #131316;
  --md-default-fg-color: #e6e3de;
  --md-typeset-color: #dbd7d1;
  --md-code-bg-color: #1d1d21;
}

/* ---- Typography ---- */
.md-typeset h1,
.md-typeset h2 {
  font-weight: 600;
  letter-spacing: -0.01em;
}

.md-typeset h1 {
  color: var(--md-typeset-color);
  border-bottom: 1px solid rgba(158, 32, 32, 0.4);
  padding-bottom: 0.3em;
}

.md-typeset h2 {
  margin-top: 2em;
}

/* ---- Epigraph ---- */
.md-typeset .epigraph {
  border-left: 3px solid var(--sop-red);
  padding: 0.2rem 0 0.2rem 1.1rem;
  margin: 1.4rem 0 2rem;
  font-style: italic;
  font-size: 1.05em;
  line-height: 1.55;
  opacity: 0.92;
}

.md-typeset .epigraph cite {
  display: block;
  margin-top: 0.5rem;
  font-style: normal;
  font-size: 0.8em;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.65;
}

/* ---- Infobox ---- */
.md-typeset .infobox {
  float: right;
  clear: right;
  width: 20rem;
  max-width: 100%;
  margin: 0 0 1.2rem 1.5rem;
  padding: 0.9rem 1.1rem;
  border: 1px solid rgba(158, 32, 32, 0.42);
  border-radius: 3px;
  background: rgba(158, 32, 32, 0.06);
  font-size: 0.72rem;
  line-height: 1.5;
}

.md-typeset .infobox h4 {
  margin: 0 0 0.6rem;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--md-accent-fg-color);
}

.md-typeset .infobox dl {
  margin: 0;
  display: grid;
  grid-template-columns: minmax(5.5rem, auto) 1fr;
  gap: 0.25rem 0.7rem;
}

.md-typeset .infobox dt {
  font-weight: 600;
  opacity: 0.7;
  margin: 0;
}

.md-typeset .infobox dd {
  margin: 0;
}

@media screen and (max-width: 60em) {
  .md-typeset .infobox {
    float: none;
    width: 100%;
    margin: 0 0 1.5rem 0;
  }
}

/* ---- Tables ---- */
.md-typeset__table {
  min-width: 0;
}

.md-typeset table:not([class]) {
  font-size: 0.7rem;
}

.md-typeset table:not([class]) th {
  background: rgba(158, 32, 32, 0.12);
  font-weight: 600;
}

/* ---- Episode tables: tighter, since seasons run to 21 rows ---- */
.md-typeset .episodes table:not([class]) {
  font-size: 0.67rem;
}

.md-typeset .episodes td:first-child {
  text-align: right;
  opacity: 0.6;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---- Bar charts, pure HTML/CSS ---- */
.md-typeset .chart {
  margin: 1.5rem 0;
  font-size: 0.74rem;
}

.md-typeset .chart-row {
  display: grid;
  grid-template-columns: minmax(6rem, 11rem) 1fr minmax(4.5rem, auto);
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.42rem;
}

.md-typeset .chart-label {
  text-align: right;
  opacity: 0.85;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.md-typeset .chart-track {
  background: rgba(128, 128, 128, 0.14);
  border-radius: 2px;
  overflow: hidden;
  height: 1.05rem;
}

.md-typeset .chart-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--sop-red) 0%, var(--sop-red-bright) 100%);
  border-radius: 2px;
}

.md-typeset .chart-bar.alt {
  background: linear-gradient(90deg, #3d5a6c 0%, #6b93aa 100%);
}

.md-typeset .chart-bar.warn {
  background: linear-gradient(90deg, #6b5a1e 0%, #b09437 100%);
}

.md-typeset .chart-value {
  font-variant-numeric: tabular-nums;
  opacity: 0.75;
}

.md-typeset .chart-caption {
  margin-top: 0.7rem;
  font-size: 0.68rem;
  opacity: 0.6;
}

/* ---- Card grids ---- */
.md-typeset .grid.cards > ul > li {
  border-color: rgba(158, 32, 32, 0.3);
}

/* ---- Fate line in character infoboxes ---- */
.md-typeset .fate {
  color: var(--sop-red);
  font-weight: 600;
}

[data-md-color-scheme="slate"] .md-typeset .fate {
  color: #e08585;
}

/* ---- Embedded video ---- */
.md-typeset .video {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  margin: 1.4rem 0 0.6rem;
  border: 1px solid rgba(158, 32, 32, 0.35);
  border-radius: 3px;
  overflow: hidden;
  background: #000;
}

.md-typeset .video iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.md-typeset .video-caption {
  margin: 0 0 1.6rem;
  font-size: 0.7rem;
  line-height: 1.5;
  opacity: 0.7;
}

.md-typeset .video-caption strong {
  opacity: 0.95;
}

/* ---- Mermaid ---- */
.md-typeset .mermaid {
  overflow-x: auto;
  margin: 1.5rem 0;
}

/* ---- The cut to black, used once, on the ending page ---- */
.md-typeset .cut-to-black {
  background: #000;
  color: #000;
  border: 1px solid rgba(158, 32, 32, 0.3);
  border-radius: 3px;
  padding: 3.2rem 1rem;
  text-align: center;
  margin: 1.6rem 0;
  font-size: 0.78rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  user-select: none;
  transition: color 0.9s ease;
}

.md-typeset .cut-to-black:hover {
  color: #4a4a4a;
}
