/* ===========================
   Base / Mobile-First Styles
   (< 768px)
   =========================== */

/* Global box-sizing */
*,
*::before,
*::after {
    box-sizing: border-box;
}

/* Base typography */
html {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 16px;
}

/* Body: light background, dark text – contrast ratio >= 4.5:1 WCAG AA */
body {
    margin: 0;
    padding: 0;
    background-color: #f5f5f5;
    color: #333333;
    line-height: 1.5;
}

/* Header: distinguishable background */
header {
    background-color: #1a237e;
    color: #ffffff;
    padding: 1.25rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

header h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
}

/* Main content area */
main {
    padding: 1rem;
}

/* Sites list – remove default list styles, single column stacked layout */
#sites-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Site cards: full width, rounded borders, visible shadow */
.site-card {
    width: 100%;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    padding: 1rem;
}

/* Site name: bold, 1.25x base font size */
.site-name {
    display: inline-block;
    font-size: 1.25rem;
    font-weight: 700;
    color: #1a237e;
    text-decoration: none;
}

.site-name:hover,
.site-name:focus {
    text-decoration: underline;
}

/* Site description: base font size */
.site-description {
    margin: 0.5rem 0 0;
    font-size: 1rem;
    color: #333333;
}

/* Footer */
footer {
    background-color: #e8eaf6;
    color: #333333;
    text-align: center;
    padding: 1rem;
    margin-top: 1rem;
}

footer p {
    margin: 0;
    font-size: 0.875rem;
}

/* Error message styling */
.error-message {
    background-color: #ffebee;
    color: #b71c1c;
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
}

/* ===========================
   Fixed Top Wrapper & Search Bar
   =========================== */

/* Fixed top wrapper */
.fixed-top-wrapper {
    position: sticky;
    top: 0;
    width: 100%;
    z-index: 1000;
}

/* Spacer no longer needed with sticky positioning */
.fixed-top-spacer {
    display: none;
}

/* Search bar */
.search-bar {
    background-color: #ffffff;
    padding: 0.5rem 1rem;
    border-bottom: 1px solid #e0e0e0;
}

.search-bar__input-wrapper {
    position: relative;
    max-width: 100%;
}

.search-bar__input {
    width: 100%;
    padding: 0.625rem 2.5rem 0.625rem 0.75rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
}

.search-bar__input:focus {
    outline: 2px solid #1a237e;
    outline-offset: 1px;
}

/* Icons positioning */
.search-bar__icon {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.25rem;
    height: 1.25rem;
}

.search-bar__icon--magnifier {
    display: block;
}

.search-bar__icon--spinner {
    display: none;
}

/* Loading state */
.search-bar--loading .search-bar__icon--magnifier {
    display: none;
}

.search-bar--loading .search-bar__icon--spinner {
    display: block;
}

/* Spinner animation */
@keyframes spin {
    to {
        transform: translateY(-50%) rotate(360deg);
    }
}

.search-bar__icon--spinner {
    animation: spin 0.8s linear infinite;
}

/* No results message */
.no-results-message {
    text-align: center;
    padding: 2rem;
    color: #666;
    font-size: 1rem;
}

/* ===========================
   Desktop Breakpoint Styles
   (>= 768px)
   =========================== */

@media (min-width: 768px) {
    main {
        max-width: 1200px;
        margin: 0 auto;
        padding: 1.5rem 2rem;
    }

    #sites-list {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
        gap: 16px;
    }
}
