/* ==========================================================================
 * GM Dizionario - Archive page styles
 * @since 0.6.0
 * ========================================================================== */

/* Layout
 * -------------------------------------------------------------------------- */
.gm-diz-archive {
    max-width: 1200px !important;
    width: 100%;
    margin: 0 auto;
    padding: 2rem 1rem 4rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
        Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    /* Break out of FSE theme constrained layout */
    align-self: center;
}

/* Header
 * -------------------------------------------------------------------------- */
.gm-diz-header {
    margin-bottom: 1.5rem;
}

.gm-diz-header h1 {
    margin: 0 0 .25rem;
    font-size: 2.5rem;
    font-weight: 700;
    color: #1e293b;
}

.gm-diz-subtitle {
    margin: 0;
    font-size: 1.15rem;
    color: #64748b;
}

/* Search
 * -------------------------------------------------------------------------- */
.gm-diz-search-wrap {
    position: relative;
    display: inline-block;
    width: 100%;
    max-width: 420px;
    margin-bottom: 1rem;
}

.gm-diz-search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 1.3rem;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    display: none;
}
.gm-diz-search-clear:hover {
    color: #334155;
}

.gm-diz-search {
    width: 100%;
    max-width: 420px;
    padding: 10px 36px 10px 14px;
    font-size: 1.05rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    outline: none;
    transition: border-color .2s;
    box-sizing: border-box;
}

.gm-diz-search:focus {
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, .15);
}

/* A-Z Navigation
 * -------------------------------------------------------------------------- */
.gm-diz-az-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
    margin-bottom: 1rem;
    position: sticky;
    top: 0;
    background: #fff;
    padding: 8px 0;
    z-index: 10;
    border-bottom: 1px solid #e2e8f0;
}

.gm-diz-az-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    font-size: .9rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: 4px;
    color: #334155;
    background: #f1f5f9;
    cursor: pointer;
    transition: background .15s, color .15s;
}

.gm-diz-az-link:hover {
    background: #0073aa;
    color: #fff;
}

.gm-diz-az-link:focus-visible {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.gm-diz-az-link.gm-diz-az-active {
    background: #0073aa;
    color: #fff;
}

.gm-diz-az-disabled {
    color: #cbd5e1;
    background: #f8fafc;
    cursor: default;
    pointer-events: none;
}

/* Filter pills
 * -------------------------------------------------------------------------- */
.gm-diz-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 1rem;
}

.gm-diz-filter-pill {
    padding: 6px 16px;
    font-size: .95rem;
    font-weight: 500;
    border: 1px solid #cbd5e1;
    border-radius: 20px;
    background: #fff;
    color: #475569;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
}

.gm-diz-filter-pill:hover {
    border-color: #0073aa;
    color: #0073aa;
}

.gm-diz-filter-btn:focus-visible {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.gm-diz-filter-pill.gm-diz-filter-active {
    background: #0073aa;
    color: #fff;
    border-color: #0073aa;
}

/* Counter
 * -------------------------------------------------------------------------- */
.gm-diz-counter {
    margin: 0 0 1.5rem;
    font-size: 1rem;
    color: #64748b;
}

.gm-diz-counter-total {
    color: #94a3b8;
}

/* List grid (2 columns)
 * -------------------------------------------------------------------------- */
.gm-diz-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 2rem;
}

/* Letter groups
 * -------------------------------------------------------------------------- */
.gm-diz-group {
    margin-bottom: 2rem;
}

.gm-diz-group h2 {
    font-size: 1.6rem;
    font-weight: 700;
    color: #0073aa;
    margin: 0 0 .75rem;
    padding-bottom: .35rem;
    border-bottom: 2px solid #e2e8f0;
}

/* Prev/next letter navigation (around each letter group)
 * -------------------------------------------------------------------------- */
.gm-diz-letter-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.gm-diz-letter-nav-top {
    margin-bottom: .5rem;
}

.gm-diz-letter-nav-bottom {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
}

.gm-diz-letter-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    font-size: .95rem;
    font-weight: 600;
    text-decoration: none;
    color: #0073aa;
    background: #f1f5f9;
    border: 1px solid transparent;
    border-radius: 20px;
    transition: background .15s, color .15s, border-color .15s;
}

.gm-diz-letter-nav-link:hover {
    background: #0073aa;
    color: #fff;
}

.gm-diz-letter-nav-link:focus-visible {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.gm-diz-letter-nav-arrow {
    font-size: 1.1rem;
    line-height: 1;
}

.gm-diz-letter-nav-label {
    font-size: .95rem;
    line-height: 1;
}

/* Keeps layout balanced when there is no prev (or no next) letter */
.gm-diz-letter-nav-placeholder {
    display: inline-block;
    width: 1px;
    height: 1px;
}

/* Cards
 * -------------------------------------------------------------------------- */
.gm-diz-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-left: 3px solid #0073aa;
    border-radius: 4px;
    padding: 12px 16px;
    margin-bottom: 8px;
    transition: box-shadow .2s;
}

.gm-diz-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
}

.gm-diz-card-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
}

.gm-diz-card-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.3;
}

.gm-diz-card-title a {
    color: #1e293b;
    text-decoration: none;
}

.gm-diz-card-title a:hover {
    color: #0073aa;
}

/* Badges */
.gm-diz-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    flex-shrink: 0;
}

.gm-diz-badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: .8rem;
    font-weight: 600;
    color: #0073aa;
    background: #e0f2fe;
    border-radius: 10px;
    white-space: nowrap;
}

/* Excerpt */
.gm-diz-card-excerpt {
    margin: 6px 0 0;
    font-size: .95rem;
    line-height: 1.5;
    color: #64748b;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Hidden utility */
.gm-diz-hidden {
    display: none !important;
}

/* Empty state */
.gm-diz-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: #94a3b8;
    font-size: .95rem;
}

/* Loading spinner
 * -------------------------------------------------------------------------- */
.gm-diz-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .75rem;
    padding: 3rem 1rem;
    color: #64748b;
    font-size: .95rem;
}

.gm-diz-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #e2e8f0;
    border-top-color: #0073aa;
    border-radius: 50%;
    animation: gm-diz-spin .7s linear infinite;
}

@keyframes gm-diz-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Fade-in animation
 * -------------------------------------------------------------------------- */
.gm-diz-fade-in {
    animation: gm-diz-fade .2s ease-out;
}

@keyframes gm-diz-fade {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Responsive (<600px)
 * -------------------------------------------------------------------------- */
@media (max-width: 768px) {
    .gm-diz-list {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .gm-diz-search {
        max-width: 100%;
    }

    .gm-diz-az-bar {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .gm-diz-az-bar::-webkit-scrollbar {
        display: none;
    }

    .gm-diz-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .gm-diz-header h1 {
        font-size: 1.8rem;
    }
}

/* Lemmi correlati (single dizionario page)
 * -------------------------------------------------------------------------- */
.gm-diz-related {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 2px solid #e2e8f0;
}

.gm-diz-related h3 {
    font-size: 1.4rem;
    font-weight: 700;
    color: #0073aa;
    margin: 0 0 1rem;
}

.gm-diz-related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.gm-diz-related-warning {
    background: #fef2f2;
    border-left: 3px solid #dc2626;
    padding: 8px 12px;
    margin-bottom: 1rem;
    font-size: .85rem;
    color: #991b1b;
}
