/* ─── Dark Web Slang Dictionary ─────────────────────────────
   Laid out like a printed dictionary: the search sits in the masthead;
   below it, a filter rail down the left, the entries set in two columns
   under guide words (the page's first and last headwords), and a thumb
   index (A–Z tabs) cut into the right edge. The sheet, masthead, facts and
   notes come from the editorial kit in style.css, as do all colours. */

/* Shared small caps label (filters, sort, notes) */
.sd-flabel {
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--point);
}

/* ─── Search, in the masthead ──────────────────────────── */

.sd-search {
    display: flex;
    align-items: center;
    gap: 14px;
    max-width: 560px;
    height: 54px;
    box-sizing: border-box;
    margin-top: 26px;
    padding: 0 18px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 14px;
    background: rgba(8, 10, 24, 0.45);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
    transition: border-color 0.15s, box-shadow 0.15s;
    cursor: text;
}

.sd-search:focus-within {
    border-color: var(--pink);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 0 0 4px rgba(245, 61, 107, 0.18);
}

.sd-search i {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.5);
}

.sd-search input {
    flex: 1;
    min-width: 0;
    padding: 0;
    border: 0;
    outline: 0;
    background: transparent;
    font-family: 'Rajdhani', sans-serif;
    font-size: 20px;
    font-weight: 600;
    color: #fff;
}

.sd-search input::placeholder {
    font-weight: 500;
    color: rgba(255, 255, 255, 0.4);
}

/* The browser's clear button, light on the dark */
.sd-search input::-webkit-search-cancel-button {
    filter: invert(1);
    opacity: 0.6;
}

/* ─── The book: filter rail | pages | thumb index ──────── */

.sd-book {
    display: grid;
    grid-template-columns: 196px minmax(0, 1fr) 30px;
    align-items: start;
    gap: 0 34px;
    margin-top: 44px;
}

/* ─── Filter rail ──────────────────────────────────────── */

.sd-rail {
    position: sticky;
    top: 24px;
    display: grid;
    gap: 24px;
    max-height: calc(100dvh - 48px);
    overflow-y: auto;
    scrollbar-width: thin;
}

.sd-rail-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--rule-head);
}

.sd-rail-head .sd-flabel {
    font-weight: 600;
    color: var(--ink);
}

.sd-rail-head .sd-link {
    margin-left: 0;
    font-size: 14px;
}

.sd-facet > .sd-flabel {
    display: block;
    margin-bottom: 8px;
}

/* Options as rows, count on the right; the selected ones marked in the
   page's colour */
.sd-rail .sd-opts {
    flex-direction: column;
    align-items: stretch;
    gap: 1px;
}

.sd-rail .sd-opt {
    width: 100%;
    height: 30px;
    padding: 0 10px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    font-size: 15px;
}

.sd-rail .sd-opt:hover {
    background: var(--surface-hover);
}

.sd-rail .sd-opt .sd-n {
    margin-left: auto;
    padding-left: 10px;
}

.sd-rail .sd-opt[aria-pressed="true"] {
    border: 0;
    background: color-mix(in srgb, var(--c-violet) 12%, transparent);
    box-shadow: inset 3px 0 0 var(--c-violet);
    font-weight: 700;
    color: var(--ink);
}

.sd-rail .sd-opt[aria-pressed="true"] .sd-n {
    color: var(--black-3);
}

.sd-rail .sd-opt.has-icon[aria-pressed="true"] > i {
    color: var(--c);
}

/* "All" (nothing chosen) is only marked, not filled */
.sd-rail .sd-opt[data-value=""][aria-pressed="true"] {
    background: transparent;
}

.sd-rail .sd-toggle {
    font-size: 14px;
    color: var(--pink-ink);
}

/* Chips: the selected one is filled */
.sd-opt {
    all: unset;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    height: 32px;
    padding: 0 13px;
    border: 1px solid var(--rule-strong);
    border-radius: 999px;
    background: var(--surface);
    font-size: 15px;
    font-weight: 600;
    line-height: 1;
    color: var(--black-2);
    white-space: nowrap;
    cursor: pointer;
    transition: color 0.15s, background-color 0.15s, border-color 0.15s;
}

.sd-opt:hover {
    border-color: var(--point);
    color: var(--ink);
}

.sd-opt[aria-pressed="true"] {
    border-color: var(--ink);
    background: var(--ink);
    color: var(--surface);
}

.sd-opt[aria-pressed="true"] .sd-n {
    color: color-mix(in srgb, var(--surface) 62%, var(--ink));
}

/* Languages: the top few until "+N more" opens the rest */
.sd-opts.is-collapsed .sd-extra:not([aria-pressed="true"]) {
    display: none;
}

.sd-toggle {
    border-style: dashed;
    color: var(--point);
}

/* Category icon in front of an option, in the category's colour; a
   selected (filled) chip draws it in the chip's text colour */
.sd-opt.has-icon > i {
    margin-right: 7px;
    font-size: 12px;
    color: var(--c);
}

.sd-opt.has-icon[aria-pressed="true"] > i {
    color: inherit;
}

.sd-meta .tag > i {
    font-size: 10px;
}

/* Language flags */
.sd-flag {
    flex: none;
    width: 16px;
    height: 12px;
    border-radius: 2px;
    object-fit: cover;
    box-shadow: 0 0 0 1px rgba(var(--hairline-rgb), 0.12);
}

.sd-opt > .sd-flag {
    margin-right: 7px;
}

/* Colour key in front of an option — the same colour as its tag */
.sd-opt.has-key::before {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 7px;
    border-radius: 2px;
    background: var(--c);
    vertical-align: 1px;
}

.sd-n {
    margin-left: 5px;
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 400;
    color: var(--point);
    font-variant-numeric: tabular-nums;
}

/* A–Z index */
.sd-az {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    margin-left: -7px;
}

.sd-letter {
    all: unset;
    width: 26px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--mono);
    font-size: 13px;
    font-weight: 500;
    color: var(--black-3);
    border-radius: 4px;
    cursor: pointer;
    transition: color 0.15s, background-color 0.15s;
}

.sd-letter:hover:not(:disabled) {
    color: var(--ink);
    background: var(--surface-hover);
}

.sd-letter:disabled {
    color: var(--faint);
    cursor: default;
}

.sd-letter[aria-pressed="true"],
.sd-letter[aria-pressed="true"]:hover {
    color: var(--surface);
    background: var(--ink);
    border-radius: 5px;
}

.sd-opt:focus-visible,
.sd-letter:focus-visible,
.sd-link:focus-visible,
.sd-pg:focus-visible,
.sd-more:focus-visible,
.sd-v-more:focus-visible {
    outline: 2px solid var(--pink);
    outline-offset: 3px;
}

/* ─── Result bar and guide words ──────────────────────── */

.sd-resultbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 24px;
    padding-bottom: 14px;
}

.sd-count {
    font-family: var(--mono);
    font-size: 13px;
    color: var(--point);
}

.sd-count b {
    font-weight: 500;
    color: var(--ink);
}

.sd-link {
    all: unset;
    margin-left: 14px;
    font-family: 'Rajdhani', sans-serif;
    font-size: 15px;
    font-weight: 600;
    color: var(--pink-ink);
    border-bottom: 1px solid transparent;
    cursor: pointer;
}

.sd-link:hover {
    border-bottom-color: currentColor;
}

.sd-link[hidden] {
    display: none;
}

.sd-sort {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.sd-sort .sd-flabel,
.sd-psize .sd-flabel {
    margin-right: 6px;
}

.sd-sort .sd-opt {
    height: 30px;
    padding: 0 12px;
    font-size: 14px;
}

.sd-arrow {
    margin-left: 4px;
    font-family: var(--mono);
    font-size: 11px;
    color: var(--pink);
}

/* Guide words: the first headword on the page at the left, the last at
   the right, between a heavy rule and a hairline */
.sd-guide {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    min-height: 17px;
    padding: 10px 0;
    border-top: 2px solid var(--rule-head);
    border-bottom: 1px solid var(--rule);
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 600;
    line-height: 17px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink);
}

.sd-guide span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ─── Entries: two columns ─────────────────────────────── */

.sd-listwrap {
    position: relative;
    min-height: 180px;
}

.sd-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    transition: opacity 0.15s;
}

.sd-list.is-loading {
    opacity: 0.45;
}

.sd-col {
    min-width: 0;
    margin: 0;
    padding: 0;
    list-style: none;
}

.sd-col:first-child {
    padding-right: 26px;
}

.sd-col + .sd-col {
    padding-left: 26px;
    border-left: 1px solid var(--rule);
}

.sd-entry {
    padding: 18px 0 16px;
    border-bottom: 1px solid var(--rule);
}

/* Headword, and how many posts use it */
.sd-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 14px;
}

.sd-word {
    min-width: 0;
    font-family: var(--mono);
    font-size: 18px;
    font-weight: 700;
    line-height: 1.25;
    color: var(--ink);
    overflow-wrap: anywhere;
}

.sd-entry.is-single .sd-word {
    color: var(--black-3);
}

.sd-posts {
    flex: none;
    font-family: var(--mono);
    font-size: 12px;
    color: var(--point);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.sd-posts b {
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
}

/* Category, type and language, as a part of speech would be; the reach on
   the right */
.sd-sub {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px 14px;
    margin-top: 6px;
}

.sd-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 12px;
}

.sd-pos {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--point);
}

/* The category, first, in its colour */
.sd-meta > .sd-pos:first-child {
    color: color-mix(in srgb, var(--c) 72%, var(--ink));
}

.sd-pos > i {
    font-size: 11px;
    color: var(--c, currentColor);
}

.sd-reach {
    display: inline-flex;
    align-items: center;
    gap: 9px;
}

.sd-def {
    margin-top: 10px;
}

/* Definition: three lines, then a fade and "More" */
.sd-def-body {
    max-height: 4.65em;            /* 3 lines × 1.55 */
    overflow: hidden;
    font-size: 16px;
    line-height: 1.55;
    color: var(--black-2);
}

.sd-def.is-overflowing:not(.is-open) .sd-def-body {
    -webkit-mask-image: linear-gradient(to bottom, #000 55%, transparent);
    mask-image: linear-gradient(to bottom, #000 55%, transparent);
}

.sd-def.is-open .sd-def-body {
    max-height: none;
}

.sd-more {
    all: unset;
    margin-top: 2px;
    font-size: 14px;
    font-weight: 700;
    color: var(--pink-ink);
    cursor: pointer;
}

.sd-more:hover {
    text-decoration: underline;
}

.sd-also {
    margin-top: 8px;
    font-family: var(--mono);
    font-size: 12px;
    line-height: 1.7;
    color: var(--black-3);
    overflow-wrap: anywhere;
}

.sd-also .sd-flabel {
    margin-right: 10px;
}

/* Keep each spelling whole; lines break between them, not inside. */
.sd-v {
    display: inline-block;
    max-width: 100%;
}

.sd-sep {
    margin: 0 7px;
    color: var(--faint);
}

.sd-v-more {
    all: unset;
    margin-left: 10px;
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 500;
    color: var(--pink-ink);
    cursor: pointer;
}

.sd-v-more:hover {
    text-decoration: underline;
}

/* Prevalence meter: one heat gradient across the track, revealed up to
   the entry's share of the most-posted term (log scale). */
.sd-meter {
    flex: none;
    width: 56px;
    height: 4px;
    border-radius: 2px;
    background: var(--rule);
    overflow: hidden;
}

.sd-bar {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--c-amber), var(--c-orange) 50%, var(--c-red));
    clip-path: inset(0 calc(100% - var(--w, 0%)) 0 0);
}

.sd-forums {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-family: var(--mono);
    font-size: 12px;
    color: var(--black-2);
}

.sd-forums::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--c-sky);
}

.sd-entry.is-single .sd-forums {
    color: var(--point);
}

.sd-entry.is-single .sd-forums::before {
    background: var(--faint);
}

/* ─── Thumb index: A–Z tabs cut into the right edge ────── */

.sd-thumbs {
    position: sticky;
    top: 24px;
    margin-right: calc(-1 * var(--pad-x));
}

.sd-thumbs .sd-az {
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 2px;
    margin: 0;
}

.sd-thumbs .sd-letter {
    box-sizing: border-box;
    justify-content: flex-start;
    width: calc(30px + var(--pad-x));
    height: 21px;
    padding-left: 10px;
    border-radius: 6px 0 0 6px;
    background: color-mix(in srgb, var(--c-violet) 8%, var(--surface));
    font-size: 11px;
    transition: transform 0.15s, color 0.15s, background-color 0.15s;
}

.sd-thumbs .sd-letter:hover:not(:disabled) {
    transform: translateX(-3px);
    background: color-mix(in srgb, var(--c-violet) 18%, var(--surface));
}

.sd-thumbs .sd-letter:disabled {
    background: transparent;
}

.sd-thumbs .sd-letter[aria-pressed="true"],
.sd-thumbs .sd-letter[aria-pressed="true"]:hover {
    transform: translateX(-6px);
    border-radius: 6px 0 0 6px;
    background: var(--c-violet);
    color: #fff;
}

/* Search matches: a highlighter stroke, not a box */
.sd-list mark {
    padding: 0 1px;
    color: inherit;
    background: linear-gradient(transparent 55%, var(--mark) 55%);
}

/* Loading: a thin line along the top rule */
.sd-progress {
    position: absolute;
    top: -1px;
    left: 0;
    right: 0;
    height: 2px;
    overflow: hidden;
    z-index: 2;
}

.sd-progress::after {
    content: "";
    position: absolute;
    top: 0;
    left: -30%;
    width: 30%;
    height: 100%;
    background: var(--pink);
    animation: sd-slide 1s ease-in-out infinite;
}

@keyframes sd-slide {
    to { left: 100%; }
}

.sd-progress[hidden],
.sd-empty[hidden] {
    display: none;
}

.sd-empty {
    padding: 56px 0;
    text-align: center;
}

.sd-empty-text {
    margin-bottom: 10px;
    font-family: var(--mono);
    font-size: 14px;
    color: var(--point);
}

.sd-empty .sd-link {
    margin-left: 0;
}

/* ─── Pagination ───────────────────────────────────────── */

.sd-pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 28px;
}

.sd-pages {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    font-family: var(--mono);
    font-size: 14px;
}

.sd-pg {
    all: unset;
    min-width: 14px;
    padding: 6px 9px;
    border-radius: 6px;
    text-align: center;
    color: var(--black-3);
    cursor: pointer;
    transition: color 0.15s, background-color 0.15s;
}

.sd-pg:hover:not(:disabled) {
    color: var(--ink);
    background: var(--surface-hover);
}

.sd-pg[aria-current],
.sd-pg[aria-current]:hover {
    color: var(--surface);
    background: var(--ink);
}

.sd-pg:disabled {
    color: var(--faint);
    cursor: default;
}

.sd-pg.sd-step {
    font-family: 'Rajdhani', sans-serif;
    font-size: 15px;
    font-weight: 600;
}

.sd-gap {
    color: var(--faint);
}

.sd-psize {
    display: flex;
    align-items: center;
    gap: 6px;
}

.sd-psize .sd-opt {
    height: 30px;
    padding: 0 11px;
    font-family: var(--mono);
    font-size: 13px;
    font-weight: 500;
}

/* ─── Narrow sheets ────────────────────────────────────── */

/* No room for a side rail: the filters go above the pages, as rows of
   chips (the kit's .sd-opt) with their label in front */
@container sheet (max-width: 980px) {
    .sd-book {
        grid-template-columns: minmax(0, 1fr) 30px;
    }

    .sd-rail {
        grid-column: 1 / -1;
        position: static;
        gap: 12px;
        max-height: none;
        margin-bottom: 44px;
        overflow: visible;
    }

    .sd-facet {
        display: grid;
        grid-template-columns: 96px minmax(0, 1fr);
        align-items: start;
        gap: 16px;
    }

    .sd-facet > .sd-flabel {
        margin: 0;
        padding-top: 10px;
    }

    .sd-rail .sd-opts {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px;
    }

    .sd-rail .sd-opt {
        width: auto;
        height: 32px;
        padding: 0 13px;
        border: 1px solid var(--rule-strong);
        border-radius: 999px;
        background: var(--surface);
        box-shadow: none;
    }

    .sd-rail .sd-opt:hover {
        border-color: var(--point);
        background: var(--surface);
    }

    .sd-rail .sd-opt .sd-n {
        margin-left: 5px;
        padding-left: 0;
    }

    .sd-rail .sd-opt[aria-pressed="true"],
    .sd-rail .sd-opt[data-value=""][aria-pressed="true"] {
        border-color: var(--ink);
        background: var(--ink);
        box-shadow: none;
        font-weight: 600;
        color: var(--surface);
    }

    .sd-rail .sd-opt[aria-pressed="true"] .sd-n {
        color: color-mix(in srgb, var(--surface) 62%, var(--ink));
    }

    .sd-rail .sd-opt.has-icon[aria-pressed="true"] > i {
        color: inherit;
    }

    .sd-rail .sd-toggle {
        border-style: dashed;
        color: var(--point);
    }
}

/* One column of entries */
@container sheet (max-width: 720px) {
    .sd-list {
        grid-template-columns: minmax(0, 1fr);
    }

    .sd-col:first-child {
        padding-right: 0;
    }

    .sd-col + .sd-col {
        padding-left: 0;
        border-left: 0;
    }

}

/* The thumb index turns into a row of letters above the pages */
@container sheet (max-width: 560px) {
    .sd-book {
        grid-template-columns: minmax(0, 1fr);
    }

    .sd-thumbs {
        position: static;
        margin: 0 0 24px;
    }

    .sd-pagecol {
        order: 1;
    }

    .sd-thumbs .sd-az {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .sd-thumbs .sd-letter {
        justify-content: center;
        width: 26px;
        height: 28px;
        padding: 0;
        border-radius: 5px;
    }

    .sd-thumbs .sd-letter:hover:not(:disabled),
    .sd-thumbs .sd-letter[aria-pressed="true"],
    .sd-thumbs .sd-letter[aria-pressed="true"]:hover {
        transform: none;
        border-radius: 5px;
    }

    .sd-facet {
        grid-template-columns: minmax(0, 1fr);
        gap: 8px;
    }

    .sd-facet > .sd-flabel {
        padding-top: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .sd-card * {
        transition: none !important;
    }

    .sd-progress::after {
        animation-duration: 3s;
    }
}

/* Masthead diagram: the lede takes ~560px */
.masthead-art {
    --art-room: 604px;
    --art-max: 300px;
}

@container sheet (max-width: 764px) {
    .masthead-art {
        display: none;
    }
}
