/*
 * Rules every theme needs to work. Themes style everything else in public/css/themes/<key>.css.
 * Keep this file free of looks: no colours, fonts or borders beyond what accessibility needs.
 */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip {
    position: absolute;
    left: -9999px;
}

.skip:focus {
    left: 8px;
    top: 4px;
    z-index: 1001;
}

/* grid | list: the switch needs its script, and the grid shows the short version of each entry */
.no-js .viewswitch {
    display: none;
}

.js:not(.view-ready) .viewswitch {
    visibility: hidden;
}

.sticker {
    display: none;
}

.view-grid .sticker {
    display: inline-block;
}

.view-grid .text .new,
.view-grid ul.hl,
.view-grid .stack {
    display: none;
}

/*
 * The theme timeline, fixed top right in every theme: a thin line with one dot per era,
 * the years under the dots, and the current era's name. Colours come from the theme
 * (currentColor and --era-accent), so each theme only sets #themes { color, --era-accent, font }.
 */
#themes {
    position: fixed;
    top: 8px;
    right: 8px;
    z-index: 1000;
    margin: 0;
    padding: 6px 8px 16px;
    font-size: 10px;
    line-height: 1.2;
}

#themes .eras {
    position: relative;
    display: flex;
    margin: 0;
    padding: 0;
    list-style: none;
}

/* the line through the dots */
#themes .eras::before {
    content: "";
    position: absolute;
    top: 4px;
    left: 14px;
    right: 14px;
    height: 1px;
    background: currentColor;
    opacity: 0.35;
}

#themes li {
    margin: 0;
    padding: 0;
}

#themes button {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 32px;
    margin: 0;
    padding: 0;
    background: none;
    border: 0;
    color: inherit;
    font: inherit;
    cursor: pointer;
    opacity: 0.6;
}

#themes button:hover,
#themes button:focus-visible,
#themes button[aria-pressed="true"] {
    opacity: 1;
}

#themes .dot {
    width: 7px;
    height: 7px;
    margin-bottom: 3px;
    border: 1px solid currentColor;
    border-radius: 50%;
    background: var(--era-bg, transparent);
}

#themes button[aria-pressed="true"] .dot {
    background: var(--era-accent, currentColor);
    border-color: var(--era-accent, currentColor);
    transform: scale(1.3);
}

#themes .year {
    font-variant-numeric: tabular-nums;
}

/* only the current era shows its name, under the timeline */
#themes .era {
    display: none;
}

#themes button[aria-pressed="true"] .era {
    display: block;
    position: absolute;
    top: 100%;
    right: 50%;
    transform: translateX(50%);
    margin-top: 2px;
    white-space: nowrap;
    font-weight: bold;
}

#themes li:first-child button[aria-pressed="true"] .era {
    right: auto;
    left: 0;
    transform: none;
}

/* the last eras sit at the screen edge: their name hangs to the left */
#themes li:nth-last-child(-n+2) button[aria-pressed="true"] .era {
    right: 0;
    transform: none;
}

@media (max-width: 560px) {
    #themes button {
        width: 28px;
    }

    #themes .eras::before {
        left: 12px;
        right: 12px;
    }
}
