/*
    Clamp expressions generated with:
    https://www.superspeedapp.com/clamp-calculator/

    Breakpoints used (taken from Bootstrap v5):
    36em = 576px (smaller widths assumed to be a phone)
    62em = 992px (larger widths assumed to be on desktop)
*/

/* CSS Reset */
/* https://www.joshwcomeau.com/css/custom-css-reset/ */

*, *::before, *::after {
  box-sizing: border-box;
}

* {
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
}

body {
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
}

input, button, textarea, select {
  font: inherit;
}

p, h1, h2, h3, h4, h5, h6 {
  overflow-wrap: break-word;
}

#root, #__next {
  isolation: isolate;
}

/* Custom styles */

:root {
    --font-size: 16px;
    --font-family-text: Geist, sans-serif;
    --font-family-header: Chivo, sans-serif;

    --color: #e2e2e2;
    --color-bg: #0a0c12;
    --color-alt: #ebbbb4;
    --color-highlight: #ff5540;
    --color-border: #1e2637;
    --color-bg-light: #1c2435;
    --color-bg-dark: #111622;

    --color-highlight-muted: #ff554066; /* --color-highlight opacity 0.4 */
    --color-bg-table-row-hover: #ff55400d; /* --color-highlight opacity 0.05 */
    --color-border-faint: #1e263766; /* --color-border opacity 0.4 */
    --color--faint: #e2e2e266; /* --color opacity 0.4 */

    --padding-inline: max(1em, 5vw);
}

/* Global styles */

body {
    color: var(--color);
    background: var(--color-bg);
    font-size: var(--font-size);
    font-family: var(--font-family-text);
    text-transform: uppercase;
}

main {
    max-width: 80rem;
    margin-inline: auto;
    padding-inline: var(--padding-inline);
}

h1, h2, h3 {
    font-family: var(--font-family-header);
}

h2 {
    font-size: 1.85em;
    font-weight: 600;
    line-height: 1;
    letter-spacing: -0.05em;
}

h3 {
    font-size: 1.5rem;
    font-weight: 400;
    letter-spacing: -0.05em;
}

hgroup .sub {
    font-size: 0.9rem;
    color: var(--color-alt);
}

hgroup + p {
    margin-top: 2rem;
}

sup[data-tippy-content] {
    font-size: 65%;
    position: absolute;
    color: var(--color-highlight);
}

sup[data-tippy-content]:hover {
    cursor: pointer;
}

.section {
    padding-block: clamp(4rem, 1.2308rem + 7.6923vw, 6rem);
}

.section:not(:last-of-type) {
    border-bottom: 1px solid var(--color-border);
}

.no-caps, .tippy-content {
    text-transform: none;
}

/*  Header */

header {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem 2rem;
    justify-content: space-between;
    align-items: baseline;
    padding-block: 1.5rem;
    padding-inline: var(--padding-inline);
    border-bottom: 1px solid var(--color-border);
}

.logo {
    font-size: 2rem;
    font-weight: 900;
    font-family: var(--font-family-header);
    line-height: 1;
    letter-spacing: -0.025em;
}

a.logo:link, a.logo:visited {
    color: var(--color-highlight);
    text-decoration: none;
}

a.logo:hover, a.logo:active {
    color: var(--color-highlight);
}

@keyframes pulse {
  0% { opacity: 1; }
  50% { opacity: 0.25; }
  100% { opacity: 1; }
}

.status {
    font-size: .75em;
    text-align: right;
    color: var(--color-highlight);
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Intro */

.intro {
    @media (min-width: 36em) {
        border-left: 4px solid var(--color-highlight);
        padding-left: 2rem;
    }
}

.badge {
    color: var(--color-bg);
    background: var(--color-highlight);
    display: inline-block;
    padding: .25em .75em;
    margin-bottom: 1rem;
}

h1 {
    font-size: clamp(3.5rem, -1.6429rem + 14.2857vw, 7.5rem);
    line-height: 1;
    font-weight: 900;
    letter-spacing: -0.04em;
}

.blurb {
    max-width: 35ch;
    font-size: clamp(1.5rem, 1.125rem + 1.0417vw, 1.75rem);
    color: var(--color-alt);
    margin-top: 1.5rem;
    margin-bottom: 2rem;
    text-transform: none;
}

.socials {
    list-style: none;
    padding-left: 0;
    display: flex;
    gap: .75rem .5rem;
    flex-direction: column;

    @media (min-width: 36em) {
        flex-direction: row;
    }
}

.socials a {
    display: block;
    font-weight: 600;
    text-align: center;
    letter-spacing: .1em;
    padding: 1em 1.4em;
    border: 1px solid var(--color-border);
}

.socials a:link, .socials a:visited {
    color: var(--color);
    background: var(--color-bg-light);
    text-decoration: none;
    transition: all .1s;
}

.socials a:hover, .socials a:active {
    color: var(--color-bg);
    background: var(--color-highlight);
}

/* Vital Statistics */

.vitals {
    display: grid;
    gap: max(1em, 2vw);
    grid-template-columns: 1fr;
    grid-auto-rows: 1fr; /* force all rows to be equal height */

    margin-top: 2.5em;

    @media (min-width: 36em) {
        grid-template-columns: repeat(2, 1fr);
    }

    @media (min-width: 62em) {
        grid-template-columns: repeat(4, 1fr);
    }
}

.vitals div {
    padding: 1em;
    background: var(--color-bg-dark);
    border: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.vitals dt {
    font-size: .9rem;
    font-weight: 700;
    letter-spacing: .15em;
    color: var(--color-highlight);
}

.vitals dd {
    font-weight: 700;
    font-family: var(--font-family-header);
    font-size: clamp(2rem, -1rem + 8.3333vw, 3rem);
}

/* Mini-tables */

.mini-table-wrapper {
    display: flex;
    flex-direction: column;
    gap: 3rem min(5vw, 5rem);
    margin-top: 4rem;

    @media (min-width: 36em) {
        flex-direction: row;
    }
}

.mini-table {
    width: 100%;
    font-size: 85%;
    border-collapse: collapse;
}

.mini-table thead tr {
    border-bottom: 2px solid var(--color-highlight);
}

.mini-table th {
    padding-block: 1em;
    letter-spacing: .1em;
}

.mini-table th.name {
    font-weight: 600;
    color: var(--color-highlight);
}

.mini-table th.count, .mini-table th.percent {
    font-size: 85%;
    font-weight: normal;
    color: var(--color-alt);
}

.mini-table td {
    padding-block: .85em;
    font-weight: 500;
}

.mini-table td.count {
    font-weight: 600;
    color: var(--color-highlight);
}

.mini-table td.percent {
    color: var(--color-alt);
}

.mini-table .name {
    text-align: left;
}

.mini-table .count, .mini-table .percent {
    width: 20%;
    text-align: center;
}

.mini-table tbody tr {
    border-bottom: 1px solid var(--color-border-faint);
}

.mini-table tbody tr:hover {
    background: var(--color-bg-table-row-hover);
}

.mini-table tbody tr:hover .name {
    color: var(--color-highlight);
}

/* Leaderboards */

.filter-wrapper {
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.filter-toggle svg {
    vertical-align: middle;
}

.filter-toggle.expanded svg {
    transform: rotate(180deg);
}

a.filter-toggle:link, a.filter-toggle:visited {
    color: var(--color-alt);
    opacity: .65;
    text-decoration: none;
    transition: .1s opacity;
}

a.filter-toggle:hover, a.filter-toggle:active {
    opacity: 1;
}

.filtersets {
    display: flex;
    gap: 1em;
    flex-wrap: wrap;
    margin-block: 1rem;
}

.filterset {
    display: flex;
    flex-direction: column;
    gap: .5em;

    @media (min-width: 36em) {
        flex-direction: row;
    }
}

.filterset button {
    color: var(--color);
    background: var(--color-bg);
    padding: .75em 1.5em;
    border: 1px solid var(--color-border);
    text-transform: uppercase;
    font-size: clamp(0.85rem, 0rem + 2.0833vw, 1rem);

    @media (min-width: 36em) {
        padding: .5em 1em;
    }
}

.filterset button:hover {
    cursor: pointer;
    background: var(--color-bg-light);
}

.filterset button:disabled {
    color: gray;
    background: initial;
    cursor: not-allowed;
}

.filterset button.selected {
    color: var(--color-bg);
    background: var(--color-highlight);
}

.leaderboard {
    width: 100%;
    border-collapse: collapse;
}

.leaderboard th, .leaderboard td {
    padding-block: 1em;
}

.leaderboard th {
    font-weight: normal;
    font-size: clamp(0.9rem, 0.7615rem + 0.3846vw, 1rem);
    color: var(--color-alt);
    background: var(--color-bg-light);
}

.leaderboard tbody tr:hover {
    background: var(--color-bg-table-row-hover);
}

.leaderboard tbody tr:hover td .title, .leaderboard tbody tr:hover td.rank {
    color: var(--color-highlight);
}

.leaderboard tbody tr:not(:last-child) {
    border-bottom: 1px solid var(--color-bg-light);
}

.leaderboard .rank, .leaderboard .count {
    width: 6rem;
    text-align: center;
}

.leaderboard .rank {
    display: none;

    @media (min-width: 36em) {
        display: table-cell;
    }
}

.leaderboard .album {
    text-align: left;
    padding-left: 1rem;

    @media (min-width: 36em) {
        padding-left: 0;
    }
}

.leaderboard td .title, .leaderboard td.rank, .leaderboard td.count {
    font-size: clamp(1.05rem, 0.6346rem + 1.1538vw, 1.35rem);
    font-weight: 600;
    font-family: var(--font-family-header);
}

.leaderboard td.rank {
    color: var(--color-highlight-muted);
}

.leaderboard td .artist {
    font-size: clamp(0.85rem, 0.7115rem + 0.3846vw, 0.95rem);
    color: var(--color-alt);
}

.leaderboard td .year {
    font-size: clamp(0.75rem, 0.6115rem + 0.3846vw, 0.85rem);
    color: var(--color-alt);
    padding-left: .5em;
}

/* Footer */

footer h2 {
    color: var(--color);
    font-size: clamp(2rem, -0.0769rem + 5.7692vw, 3.5rem);
    font-weight: 900;
    line-height: 1;
}

footer {
    font-size: 75%;
    color: var(--color--faint);
    text-align: center;
    padding-block: 4rem;
    padding-inline: var(--padding-inline);
    letter-spacing: .35em;
    display: flex;
    flex-direction: column;
    gap: 1rem 5rem;
    border-top: 1px solid var(--color-border);

    @media (min-width: 36em) {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: space-between;
        align-items: baseline;
    }
}

footer ul {
    list-style: none;
    padding-left: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .5rem 1rem;
}

footer a:link, footer a:visited {
    color: inherit;
    text-decoration: none;
}

footer a:hover, footer a:active {
    color: var(--color);
}
