/* Ensure the flag font is checked first on every element */
*,
*::before,
*::after {
    font-family: "Twemoji Country Flags", 'Roboto', serif;
    box-sizing: border-box;
}

/* ===== ALL PUBLICATIONS STYLES ===== */

.all-publications-container {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

/* Shared Card Styling — Fluid Padding replacing fixed 640px step */
.publications-header-container,
.type-sort-container-wrapper {
    background-color: #fff;
    border-radius: 17px;
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, .08);
    margin-bottom: 15px;
    /* Scales padding smoothly between 16px and 24px based on screen width */
    padding: clamp(1rem, 2.5vw, 1.25rem) clamp(1rem, 3.5vw, 1.5rem);
    min-width: 0;
    flex: 1;
}

.all-publications-text p {
    /* Fluid font size: scales smoothly between 1.25rem and 1.5rem */
    font-size: clamp(1.25rem, 3vw, 1.5rem);
    font-weight: bold;
    margin: 0;
}

/* Search Controls */
.publication-search-container {
    position: relative;
    margin-top: 16px;
}

.publication-search-line {
    display: flex;
    align-items: center;
    gap: 9px;
    border-bottom: 1px solid rgba(0, 0, 0, .2);
    transition: border-color 0.2s ease;
}

.publication-search-line:focus-within {
    border-bottom-color: #007bff;
}

.publication-search-icon {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    fill: none;
    stroke: #777;
    stroke-linecap: round;
    stroke-width: 1.7;
    transition: stroke 0.2s ease;
}

.publication-search-line:focus-within .publication-search-icon {
    stroke: #007bff;
}

.publication-search-input {
    width: 100%;
    min-width: 0;
    padding: 11px 0 10px;
    border: none;
    border-radius: 0;
    background: transparent;
    color: #333;
    font: inherit;
    font-size: clamp(0.9rem, 2vw, 1rem);
}

.publication-search-input::placeholder {
    color: rgba(51, 51, 51, 0.52);
}

.publication-search-input:focus {
    outline: none;
}

.publication-search-input::-webkit-search-cancel-button {
    cursor: pointer;
}

/* Tag Suggestions */
.tag-suggestions {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 20;
    max-height: 280px;
    overflow-y: auto;
    padding: 5px;
    border: 1px solid rgba(0, 0, 0, .12);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 8px 22px rgba(0, 0, 0, .14);
}

.tag-suggestions-header {
    padding: 6px 10px 5px;
    color: #777;
    font-size: .75rem;
    font-weight: bold;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.tag-suggestion {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 12px;
    padding: 9px 10px;
    border: none;
    border-radius: 5px;
    background: transparent;
    color: #333;
    cursor: pointer;
    font: inherit;
    text-align: left;
}

.tag-suggestion:hover,
.tag-suggestion.is-active {
    background: #f0f5ff;
    color: #005fc7;
}

.tag-suggestion-count {
    color: #888;
    font-size: .85rem;
}

/* Advanced Filters Accordion */
.advanced-filters {
    margin-top: 16px;
}

.advanced-filters summary {
    color: #333;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.advanced-filters summary::-webkit-details-marker {
    display: none;
}

.advanced-filters-arrow {
    color: #007bff;
    display: inline-block;
    font-size: .8em;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.advanced-filters-arrow.open {
    transform: rotate(90deg);
}

.advanced-filters[open] summary {
    margin-bottom: 16px;
}

.advanced-filters-panel {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.advanced-filters.open .advanced-filters-panel {
    /* Fluid max height ensuring phone displays have enough room */
    max-height: clamp(280px, 50vh, 500px);
    opacity: 1;
    overflow: auto;
    margin-bottom: 20px;
}

.advanced-filters .tag-filter-container-with-categories {
    margin-top: 0;
}

.tag-filter-container-with-categories .filter-label {
    font-size: 1.125rem;
    font-weight: bold;
    display: block;
    margin-bottom: 12px;
    color: #333;
}

/* Tag Categories */
.tag-categories {
    display: flex;
    flex-direction: column;
    gap: clamp(12px, 2vw, 16px);
}

.tag-category {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tag-category-title {
    font-size: 0.875rem;
    font-weight: bold;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tag-category-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Tag Option */
.tag-option {
    display: inline-flex;
    align-items: center;
    background-color: #d9d9d9;
    color: #979696;
    padding: clamp(4px, 1vw, 5px) clamp(8px, 1.5vw, 10px);
    border-radius: 5px;
    font-size: clamp(0.8125rem, 1.5vw, 0.875rem);
    text-decoration: none;
    border: 1px solid rgba(0, 0, 0, .08);
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.tag-option:hover {
    background-color: #979696;
    color: white;
}

.tag-option.active {
    background-color: #007bff;
    color: white;
}

.tag-option.active:hover {
    background-color: #0069d9;
}

/* Type & Sort Container - Fluid wrapping layout */
.type-sort-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.type-filter-container {
    flex: 1 1 320px;
    /* Takes primary space */
    min-width: 0;
}

.sort-container {
    flex: 0 0 auto;
    /* Pushes to the far right when on the same row */
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
}

.type-filter-container .filter-label,
.sort-container .filter-label {
    font-size: 1.125rem;
    font-weight: bold;
    display: block;
    margin-bottom: 12px;
    color: #333;
}

.type-buttons,
.sort-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.sort-buttons {
    justify-content: flex-start;
}

/* Completely Fluid Content Grid — No Media Query Breakpoints Needed */
.content-grid {
    display: grid;
    /* Automatically fits 3, 2, or 1 column based on container width */
    grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr));
    gap: 16px;
}

/* .content-grid .content {
    padding: clamp(14px, 2vw, 20px);
}

.content-grid .title {
    font-size: clamp(1rem, 2.5vw, 1.25rem);
} */

/* Filter Option Button Base Styling */
.filter-option-news,
.filter-option-article,
.filter-option-opinion,
.filter-option-academic,
.filter-option-live-note {
    background-color: white;
    font-weight: bold;
    border-radius: 15px;
    padding: 0.5rem 1rem;
    min-height: 36px;
    cursor: pointer;
    transition: all 0.3s;
    border: 1px solid transparent;
    flex: 0 0 auto;
}

.filter-option-news {
    color: red;
    border: 1px solid red;
}

.filter-option-article {
    color: #438afc;
    border: 1px solid #438afc;
}

.filter-option-opinion {
    color: #ffa500;
    border: 1px solid #ffa500;
}

.filter-option-academic {
    color: burlywood;
    border: 1px solid burlywood;
}

.filter-option-live-note {
    color: green;
    border: 1px solid green;
}

.filter-option-news.active {
    color: white;
    background: linear-gradient(to right, #ff0000, #ff6666);
    border: none;
}

.filter-option-article.active {
    color: white;
    background: linear-gradient(to right, #438afc, #85b9fd);
    border: none;
}

.filter-option-opinion.active {
    color: white;
    background: linear-gradient(to right, #ffa500, #ffc766);
    border: none;
}

.filter-option-academic.active {
    color: white;
    background: linear-gradient(to right, burlywood, #c7b39a);
    border: none;
}

.filter-option-live-note.active {
    color: white;
    background: linear-gradient(to right, green, rgb(61, 255, 47));
    border: none;
}

/* Sort Buttons */
.sort-option {
    background-color: white;
    font-weight: bold;
    border-radius: 15px;
    padding: 0.5rem 1rem;
    min-height: 36px;
    cursor: pointer;
    transition: all 0.3s;
    border: 1px solid #d9d9d9;
    color: #979696;
    flex: 0 0 auto;
}

.sort-option:hover {
    background-color: #979696;
    color: white;
    border-color: #979696;
}

.sort-option.active {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}

.sort-option.active:hover {
    background-color: #0069d9;
}

/* Optional horizontal scroll overflow for small devices */
@media (max-width: 480px) {

    .type-buttons,
    .sort-buttons {
        flex-wrap: nowrap;
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 4px;
        scrollbar-width: thin;
    }
}