/*
 * UMBC Guide — A-Z Index View
 * Extends style-umbc-guide.css tokens. Scoped to .az-* classes.
 * Dark mode: both @media and [data-theme] blocks kept in sync.
 */

/* ==========================================================================
   Tokens (A-Z supplements — inherits --guide-* from style-umbc-guide.css)
   Only redefine here if this file can load standalone without the core file.
   ========================================================================== */

:root {
    --guide-text-primary:    #2a2b2c;
    --guide-text-secondary:  #636466;
    --guide-text-tertiary:   #8a8b8d;
    --guide-text-teal:       #007176;
    --guide-teal-light:      #c6e1e2;
    --guide-bg-page:         #fff;
    --guide-bg-light:        #f0f0f0;
    --guide-bg-lighter:      #fcfcfc;
    --guide-border:          #757575;
    --guide-border-light:    #f0f0f0;
    --guide-accent:          #fdb515;
    --guide-accent-light:    rgba(253, 181, 21, 0.10);
    --guide-focus:           rgba(253, 181, 21, 0.40);
    --guide-radius:          6px;
    --guide-radius-sm:       4px;
    --guide-speed:           0.2s;
    --guide-ease:            cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --guide-shadow-sm:       0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.08);
}

@media (prefers-color-scheme: dark) {
    :root {
        --guide-text-primary:    #e8e9ea;
        --guide-text-secondary:  #a8aaac;
        --guide-text-tertiary:   #787a7c;
        --guide-text-teal:       #4db8bc;
        --guide-teal-light:      rgba(77, 184, 188, 0.15);
        --guide-bg-page:         #1e1f20;
        --guide-bg-light:        #2a2b2c;
        --guide-bg-lighter:      #1e1f20;
        --guide-border:          #555759;
        --guide-border-light:    #3a3b3c;
        --guide-accent-light:    rgba(253, 181, 21, 0.12);
        --guide-shadow-sm:       0 1px 3px rgba(0,0,0,0.40), 0 1px 2px rgba(0,0,0,0.30);
    }
}

[data-theme="light"] {
    --guide-text-primary:    #2a2b2c;
    --guide-text-secondary:  #636466;
    --guide-text-tertiary:   #8a8b8d;
    --guide-text-teal:       #007176;
    --guide-teal-light:      #c6e1e2;
    --guide-bg-page:         #fff;
    --guide-bg-light:        #f0f0f0;
    --guide-bg-lighter:      #fcfcfc;
    --guide-border:          #757575;
    --guide-border-light:    #f0f0f0;
    --guide-accent-light:    rgba(253, 181, 21, 0.10);
    --guide-shadow-sm:       0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.08);
}

[data-theme="dark"] {
    --guide-text-primary:    #e8e9ea;
    --guide-text-secondary:  #a8aaac;
    --guide-text-tertiary:   #787a7c;
    --guide-text-teal:       #4db8bc;
    --guide-teal-light:      rgba(77, 184, 188, 0.15);
    --guide-bg-page:         #1e1f20;
    --guide-bg-light:        #2a2b2c;
    --guide-bg-lighter:      #1e1f20;
    --guide-border:          #555759;
    --guide-border-light:    #3a3b3c;
    --guide-accent-light:    rgba(253, 181, 21, 0.12);
    --guide-shadow-sm:       0 1px 3px rgba(0,0,0,0.40), 0 1px 2px rgba(0,0,0,0.30);
}

/* ==========================================================================
   Layout
   ========================================================================== */

.guide-az-single-column {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
}

.show-entry-text-no-filter { gap: 4em; }

.az-search-container {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 2em;
}

.az-search-container .guide-entry-search-label {
    width: 100%;
    margin-bottom: 0 !important;
}

.az-search-container .guide-entry-search-div {
    position: relative;
    display: flex;
    align-items: center;
    background-color: var(--guide-bg-page);
    border: 2px solid var(--guide-border);
    border-radius: var(--guide-radius);
    transition: all var(--guide-speed) var(--guide-ease);
}

.az-search-container .guide-entry-search-div:focus-within {
    border-color: var(--guide-accent);
    box-shadow: 0 0 0 3px var(--guide-focus);
}

.az-search-container input[type="text"] {
    flex: 1;
    padding: 0.5rem 1rem;
    padding-right: 40px;
    border: none;
    background: transparent;
    font-size: 0.95rem;
    color: var(--guide-text-primary);
    outline: none;
}

.az-search-container input[type="text"]::placeholder { color: var(--guide-text-tertiary); }

.az-search-container .guide-entry-search-icon {
    position: absolute;
    right: 1rem;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.az-search-container .guide-entry-search-icon svg { width: 16px; height: 16px; opacity: 0.5; }

/* Header row */
.show-entry-text-and-button .show-entry-text-no-filter,
.az-search-container {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
}

/* ==========================================================================
   A-Z grid
   ========================================================================== */

.az-index-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    contain: layout style paint;
}

.az-letter-section {
    background-color: var(--guide-bg-page);
    border: 1px solid var(--guide-border-light);
    border-radius: var(--guide-radius);
    padding: 1rem;
    transition: all var(--guide-speed) var(--guide-ease);
    break-inside: avoid;
    page-break-inside: avoid;
}

.az-letter-section:hover {
    box-shadow: var(--guide-shadow-sm);
    border-color: var(--guide-border);
}

.az-letter-heading {
    font-size: 2rem;
    font-weight: 700;
    color: var(--guide-text-primary);
    margin: 0 0 1rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 3px solid var(--guide-accent);
    letter-spacing: -0.02em;
}

.az-letter-column {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.az-entry-item {
    list-style: none;
    padding: 0;
    margin: 0;
    border-bottom: 1px solid var(--guide-border-light);
}

.az-entry-item:last-child { border-bottom: none; }

.az-entry-item a {
    display: block;
    padding: 0.5rem 0.25rem;
    color: var(--guide-text-secondary);
    text-decoration: none;
    border-radius: var(--guide-radius-sm);
    transition: all var(--guide-speed) var(--guide-ease);
    font-size: 0.95rem;
    line-height: 1.4;
    position: relative;
}

.az-entry-item a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 2px;
    background-color: var(--guide-text-teal);
    transition: width var(--guide-speed) var(--guide-ease);
}

.az-entry-item a:hover {
    background-color: var(--guide-teal-light);
    color: var(--guide-text-teal);
    padding-left: 1rem;
    font-weight: 500;
}

.az-entry-item a:hover::before { width: 4px; }

.az-entry-item a:focus {
    outline: 2px solid var(--guide-focus);
    outline-offset: 2px;
    background-color: var(--guide-accent-light);
    color: var(--guide-text-primary);
}

/* ==========================================================================
   Loading / empty states
   ========================================================================== */

.az-preloader,
.az-error,
.az-no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 2rem;
    color: var(--guide-text-secondary);
    background-color: var(--guide-bg-lighter);
    border-radius: var(--guide-radius);
    border: 2px dashed var(--guide-border);
}

.az-preloader .lines {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 1rem;
    justify-content: center;
    height: 20px;
}

.az-preloader .line {
    width: 4px;
    height: 100%;
    background: var(--guide-border);
    animation: guide-pulse 1.2s infinite ease-in-out;
    border-radius: 2px;
}

.az-preloader .line-2 { animation-delay: 0.3s; }
.az-preloader .line-3 { animation-delay: 0.6s; }

.az-preloader #loader-msg {
    font-style: italic;
    font-size: 0.95rem;
    color: var(--guide-text-tertiary);
}

@keyframes guide-pulse {
    0%, 80%, 100% { transform: scaleY(0.4); opacity: 0.5; }
    40%           { transform: scaleY(1); opacity: 1; background-color: var(--guide-accent); }
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1024px) {
    .az-index-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
}

@media (max-width: 768px) {
    .show-entry-text-and-button .show-entry-text-no-filter,
    .az-search-container { flex-direction: column; }

    .az-index-grid { grid-template-columns: 1fr; gap: 1rem; }
    .az-letter-heading { font-size: 1.5rem; }
    .az-letter-section { padding: 0.5rem 1rem; }
    .az-entry-item a { font-size: 0.9rem; padding: 0.25rem; }
}

@media (max-width: 600px) {
    .az-letter-heading { font-size: 1.3rem; padding-bottom: 0.25rem; }
    .az-letter-section { padding: 0.5rem; }
    .az-entry-item a { padding: 6px 0.25rem; }
}

@media (prefers-reduced-motion: reduce) {
    .az-entry-item a::before { display: none; }
    .az-entry-item a:hover { transform: none; }
    .az-preloader .line { animation: none; }
}

@media print {
    .az-index-grid { display: block; columns: 3; column-gap: 2rem; }
    .az-letter-section { break-inside: avoid; page-break-inside: avoid; border: 1px solid #000; margin-bottom: 1rem; }
    .az-entry-item a { color: #000; }
    .az-entry-item a::before { display: none; }
}
