html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

:root {
    --bg-color: #1f2130;
    --text-color: #ffffff;
    --accent-color: #7ed957;
    --max-content-width: 960px;
    --page-padding: clamp(20px, 5vw, 48px);
}

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

img {
    max-width: 100%;
    height: auto;
}

h1, h2, h3, h4 {
    color: var(--text-color);
    font-weight: 600;
    line-height: 1.3;
    margin: 0 0 12px 0;
}

h2 {
    font-size: clamp(1.3rem, 3vw, 1.6rem);
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    line-height: 1.6;
    font-size: 16px;
    max-width: 100%;
    box-sizing: border-box;
}

/* The content-wrapper takes all available space, and we distribute space so that 
   header is at top, main in the middle, and author-info + footer at the bottom. */
.content-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 100%;
    max-width: var(--max-content-width);
    margin: 0 auto;
    padding: var(--page-padding);
}

.content-wrapper-results {
    width: 100%;
    max-width: var(--max-content-width);
    margin: 0 auto;
    padding: var(--page-padding);
}

.container {
    width: 100%;
    max-width: var(--max-content-width);
    margin: 0 auto;
}

/* Header at the top */
.header-container {
    text-align: center;
    margin-bottom: 20px;
    flex-shrink: 0;
}

.main-logo {
    width: 100%;
    max-width: clamp(240px, 60vw, 420px);
    margin: 0 auto 20px auto;
}

.subtitle {
    font-size: clamp(1.05rem, 2.5vw, 1.3rem);
    color: var(--text-color);
    line-height: 1.4;
    text-align: center;
    margin: 0 auto 32px auto;
}

/* main stretches to fill space between header and author-info/footer */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

#query, #location {
    text-align: center;
    word-break: break-word;
    font-size: clamp(1.1rem, 3vw, 1.5rem);
}

#location {
    font-size: clamp(1.05rem, 2.8vw, 1.25rem);
    font-weight: 500;
}

/* Search form at the top of main (no grow) */
.search-form {
    width: 100%;
    max-width: 720px;
    margin: 0 auto 20px auto; /* some space below form to separate from progress */
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    align-items: stretch;
    flex-shrink: 0;
}


.example-queries {
    width: 100%;
    max-width: 720px;
    margin: 0 auto 12px auto;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

.example-query-button {
    flex: 1 1 220px;
    min-width: 200px;
    background: rgba(126, 217, 87, 0.1);
    color: var(--accent-color);
    border: 1px solid var(--accent-color);
    text-transform: none;
    font-size: 0.9rem;
    letter-spacing: 0.01em;
    transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.example-query-button:hover,
.example-query-button:focus-visible {
    background: var(--accent-color);
    color: #1f2130;
}

.search-input {
    background: transparent;
    border: 2px solid var(--accent-color);
    color: var(--text-color);
    padding: 12px;
    font-size: clamp(1rem, 2vw, 1.05rem);
    width: 100%;
    max-width: 640px;
    min-width: 0;
    flex: 1 1 320px;
    box-sizing: border-box;
    border-radius: 6px;
}

.search-input::placeholder {
    color: #cccccc;
}

.search-input:focus {
    outline: none;
    border-color: #7ed957;
}

.techy-button {
    background: var(--accent-color);
    color: #1f2130;
    border: none;
    padding: 12px 20px;
    cursor: pointer;
    font-size: 0.95rem;
    text-transform: uppercase;
    font-weight: bold;
    min-height: 44px;
    border-radius: 6px;
    transition: box-shadow 0.2s ease-in-out;
    margin-left: 0;
}

.techy-button:hover {
    box-shadow: 0 0 10px #7ed957;
}

/* Progress container takes up remaining space in main and centers contents */
#progress-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center; /* Center spinner and text both horizontally and vertically */
    background: none; /* Transparent background */
}

/* Spinner styles */
#progress-circle {
    width: 50px;
    height: 50px;
    border: 8px solid #ffffff;
    border-top: 8px solid #7ed957;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 10px;
}

#progress-text {
    font-size: 16px;
    font-weight: 400;
    font-style: italic;
    text-align: center;
    color: #ffffff;
}

/* Author info above the footer */
.author-info {
    font-style: italic;
    text-align: center;
    color: #ffffff;
    margin-bottom: 0; /* Keep it tight above the footer */
    flex-shrink: 0;
}

/* Footer at the very bottom */
.footer-section {
    background-color: #ffffff;
    text-align: center;
    padding: 10px;
    flex-shrink: 0;
}

.footer-logos {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 33px;
    flex-wrap: wrap;
    margin: 0 auto;
}

.footer-logo {
    max-height: 120px;
    width: auto;
    max-width: 170px;
    height: auto;
    margin: 0;
}

.legal-links {
    width: 100%;
    max-width: var(--max-content-width);
    margin: 24px auto 0;
    padding-top: 12px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.legal-links a {
    flex: 1 1 160px;
    text-align: center;
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.legal-links a:hover,
.legal-links a:focus-visible {
    text-decoration: underline;
}

/* Keyframe for spinner animation */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Carousel and other existing classes remain unchanged if present */
.carousel {
    margin: 0 auto;
    width: 100%;
}

#results-carousel {
    margin-top: 24px;
}

.carousel-item {
    position: relative;
    box-sizing: border-box;
    width: 100%;
}

.carousel-image-wrapper {
    position: relative;
    width: 100%;
}

.carousel-image {
    width: 100%;
    height: 550px;
    max-width: 850px;
    max-height: 550px;
    object-fit: cover;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.carousel-title {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background-color: rgba(0, 0, 0, 0.6);
    color: #fff;
    padding: 10px;
    border-radius: 4px;
    font-size: 18px;
    font-weight: bold;
}

p {
    font-size: clamp(1rem, 2.2vw, 1.05rem);
    margin: 10px 0;
    color: var(--text-color);
}

/* Error message styling */
.error-message {
    color: #ff9aa2; /* pastel red */
    text-align: center;
    margin: 10px auto 0 auto;
}

.slick-prev, .slick-next {
    background-color: #7ed957;
    color: #1f2130;
    font-size: 36px;
    border-radius: 50%;
    border: none;
}

.slick-prev:hover, .slick-next:hover {
    background-color: #66c64c;
}


/* Style for author name */
.author-name {
    font-style: bold;
    font-size: clamp(1.2rem, 3vw, 1.4rem); /* Same size as the subtitle */
    color: #ffffff;
    line-height: 1.4;
    text-align: center;
    margin: 0 auto 20px auto;
}

/* Style for affiliations */
.affiliations {
    font-style: italic;
    font-size: clamp(1.05rem, 2.8vw, 1.2rem); /* Larger text */
    color: #ffffff;
    text-align: left;
    margin: 0 auto 20px auto;
}

/* Style for summary */
.summary {
    font-size: clamp(0.98rem, 2.6vw, 1.05rem); /* Easy to read size */
    color: #ffffff;
    text-align: justify;
    text-justify: inter-word;
    margin: 0 auto 20px auto;
}

/* Style for references title */
.references-title {
    font-weight: bold;
    font-size: clamp(1.05rem, 2.8vw, 1.2rem); /* Larger text */
    color: #ffffff;
    text-align: left;
    margin: 0 auto 10px auto;
}

/* Style for references */
.references {
    font-size: clamp(0.98rem, 2.6vw, 1.05rem);
    color: #ffffff;
    text-align: left;
    margin: 0 auto;
}

@media (max-width: 900px) {
    .main-logo {
        max-width: min(70vw, 300px);
    }
}

@media (max-width: 768px) {
    .content-wrapper,
    .content-wrapper-results {
        padding: clamp(16px, 5vw, 28px);
    }

    .header-container {
        margin-bottom: 12px;
    }

    .subtitle {
        margin-bottom: 24px;
    }

    .search-form {
        flex-direction: column;
        align-items: stretch;
    }

    .techy-button {
        width: 100%;
        margin-left: 0;
        text-align: center;
    }

    .footer-logo {
        max-height: 80px;
    }

    .author-info {
        font-size: 0.95rem;
    }

    .carousel-image {
        max-height: 360px;
        height: auto;
    }
}

@media (max-width: 480px) {
    body {
        font-size: 15px;
    }

    .subtitle {
        font-size: clamp(1rem, 4vw, 1.15rem);
    }

    #query, #location {
        font-size: clamp(1.05rem, 4vw, 1.35rem);
    }
}
