/* Override these variables in the theme to retune colours and fonts. */
.exd {
    --exd-ink: #2b2d4a;
    --exd-paper: #f3f0e6;
    --exd-card: #ffffff;
    --exd-display: "Anton", "Bebas Neue", "Oswald", Impact, sans-serif;
    --exd-text: inherit;
    color: var(--exd-ink);
    font-family: var(--exd-text);
}

.exd-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.exd-title {
    margin: 0 0 1.5rem;
    font-family: var(--exd-display);
    font-size: clamp(2.5rem, 7vw, 6rem);
    line-height: 1;
    text-align: center;
    text-transform: uppercase;
    color: var(--exd-ink);
}

.exd-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem 1.25rem;
}

.exd-search {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 0 1 390px;
    min-width: 240px;
    height: 56px;
    padding: 0 1.1rem;
    background: var(--exd-paper);
    border: 2px solid var(--exd-ink);
    cursor: text;
}

.exd-search svg {
    flex: none;
}

.exd-search input {
    flex: 1;
    min-width: 0;
    height: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    font: inherit;
    font-size: 1.15rem;
    color: var(--exd-ink);
    outline: none;
    box-shadow: none;
}

.exd-search input::placeholder {
    color: var(--exd-ink);
    opacity: 0.55;
}

.exd-search:focus-within {
    outline: 3px solid var(--exd-ink);
    outline-offset: 2px;
}

.exd-az {
    display: flex;
    flex-wrap: wrap;
    flex: 1 1 520px;
    gap: 0.15rem;
}

.exd-letter {
    min-width: 34px;
    height: 40px;
    padding: 0 0.35rem;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--exd-ink);
    font-family: var(--exd-display);
    font-size: 1.05rem;
    line-height: 1;
    text-transform: uppercase;
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s;
}

.exd-letter:hover:not(:disabled),
.exd-letter:focus-visible {
    background: var(--exd-paper);
    outline: none;
}

.exd-letter.is-active,
.exd-letter.is-active:hover {
    background: var(--exd-ink);
    color: var(--exd-paper);
}

.exd-letter:disabled {
    opacity: 0.25;
    cursor: default;
}

.exd-count {
    margin: 1rem 0 2rem;
    font-size: 1.15rem;
}

.exd-count [hidden] {
    display: none;
}

.exd-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.25rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.exd-card {
    margin: 0;
}

.exd-card[hidden],
.exd-empty[hidden] {
    display: none;
}

.exd-card-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--exd-card);
    border: 2px solid var(--exd-ink);
    color: var(--exd-ink);
    text-decoration: none;
    transition: transform 0.2s, box-shadow 0.2s;
}

a.exd-card-inner:hover,
a.exd-card-inner:focus-visible {
    transform: translate(-3px, -3px);
    box-shadow: 6px 6px 0 var(--exd-ink);
    outline: none;
}

/*
 * Fixed 3:2 box with the logo absolutely placed inside it. Safari does not
 * resolve max-height:100% against an aspect-ratio box, so wide logos used to
 * overflow and stretch rows to uneven heights on iPhone.
 */
.exd-logo {
    position: relative;
    display: block;
    height: 0;
    padding-top: 66.6667%;
    overflow: hidden;
}

.exd .exd-logo img {
    position: absolute;
    top: 14%;
    left: 12%;
    width: 76%;
    height: 72%;
    max-width: none;
    max-height: none;
    margin: 0;
    object-fit: contain;
}

.exd-logo-fallback {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--exd-display);
    font-size: 3rem;
    opacity: 0.3;
}

.exd-name {
    margin-top: auto;
    padding: 0.7rem 0.9rem;
    border-top: 2px solid var(--exd-ink);
    background: var(--exd-paper);
    font-size: 0.95rem;
    line-height: 1.3;
    text-align: center;
}

.exd-empty {
    padding: 3rem 0;
    font-size: 1.15rem;
    text-align: center;
}

@media (max-width: 767px) {
    .exd-search {
        flex-basis: 100%;
        min-width: 0;
        height: 50px;
    }

    /* All letters visible at once: 9 per row, 3 rows. */
    .exd-az {
        display: grid;
        grid-template-columns: repeat(9, 1fr);
        flex-basis: 100%;
        gap: 4px;
    }

    .exd-letter {
        min-width: 0;
        height: 36px;
        padding: 0;
        font-size: 0.95rem;
    }

    .exd-count {
        margin: 0.75rem 0 1.25rem;
    }

    .exd-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .exd-card-inner {
        border-width: 1.5px;
    }

    .exd .exd-logo img {
        top: 10%;
        left: 8%;
        width: 84%;
        height: 80%;
    }
}

@media (max-width: 420px) {
    .exd-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
