* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
    width: 100%;
}

a {
color: inherit;           
text-decoration: none;    
}

a:hover {
text-decoration: underline; 
}

a:visited {
color: inherit;  
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #1E3765 0%, #1E3765 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 20px;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.logo-mdl {
    height: 100px;
    margin-bottom: 15px;
}

.logo-utl {
    height: 70px;
    margin-bottom: 30px;
}

header p.header-meta {
    color: rgba(255,255,255,0.8);
    font-size: 1.0rem;
    margin-top: 10px;
}

.header-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.header-links a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.loading-indicator {
    display: none;
    text-align: center;
    padding: 20px;
    color: #666;
    font-size: 14px;
}

.sticky-search-wrapper {
    position: sticky;
    top: 0;
    z-index: 100;
    background: transparent;
    padding: 20px 0;
    margin-bottom: 20px;
    transition: opacity 0.3s ease-out, visibility 0.3s ease-out, transform 0.3s ease-out;
    opacity: 1;
    visibility: visible;
    pointer-events: none;
}

.sticky-search-wrapper.scrolled {
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
}

.sticky-search-container {
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
}

.main-content {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 30px;
    align-items: start;
    width: 100%;
    max-width: 100%;
}

.sidebar {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    overflow-x: hidden;
}

.filter-toggle {
    display: none;
    position: fixed;
    top: 90px;
    right: 20px;
    z-index: 101;
    background: white;
    border: 2px solid #1E3765;
    border-radius: 8px;
    padding: 10px 15px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    font-size: 14px;
    font-weight: 600;
    color: #1E3765;
    transition: background-color 0.3s, color 0.3s, translate 200ms ease-out, scale 150ms ease-out;
}

.filter-toggle:hover {
    background: #1E3765;
    color: white;
}

.filter-toggle svg,
#back-to-top svg {
    fill: currentColor;
}

.filter-toggle.scrolled {
    translate: calc(100% + 20px) 0;
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: #f5f5f5;
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: #999;
}

.search-box {
    position: relative;
    pointer-events: auto;
}

.search-box input {
    width: 100%;
    padding: 15px 20px;
    padding-right: 70px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    font-size: 16px;
    transition: background-color 0.3s, border-color 0.3s;
    background: rgba(255, 255, 255, 0.95);
    border-color: #1E3765;
}

.search-box input:focus {
    background: white;
}

/* Two-tone ring: white shows on the navy page, navy shows over the white panels */
.search-box input:focus-visible {
    outline: 2px solid white;
    outline-offset: 2px;
    box-shadow: 0 0 0 6px #1E3765;
}

.search-hint {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(30, 55, 101, 0.1);
    border: 1px solid rgba(30, 55, 101, 0.2);
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 12px;
    color: #1E3765;
    pointer-events: none;
    font-family: monospace;
    font-weight: 600;
}

/* Tactile feedback on press */
.filter-toggle:active,
.clear-filters:active,
.show-more-btn:active,
.tag:active,
#back-to-top:active {
    scale: 0.96;
}

.facet-group {
    margin-bottom: 25px;
}

.section-heading {
    font-size: 20px;
    color: #1E3765;
    margin-bottom: 15px;
}

.facet-group h3 {
    font-size: 14px;
    text-transform: uppercase;
    color: #666;
    margin-bottom: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.facet-option {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.facet-option:hover {
    background-color: #f5f5f5;
}

.facet-option input[type="checkbox"] {
    margin-right: 0;
    cursor: pointer;
    width: 16px;
    height: 16px;
}

.facet-option label {
    padding-left: 8px;
    cursor: pointer;
    font-size: 14px;
    flex: 1;
    display: flex;
    justify-content: space-between;
}

.facet-count {
    color: #999;
    font-size: 12px;
}

.clear-filters {
    width: 100%;
    padding: 10px;
    background-color: #f5f5f5;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: #666;
    transition: background-color 0.2s, scale 150ms ease-out;
}

.clear-filters:hover {
    background-color: #e0e0e0;
}

.show-more-btn {
    width: 100%;
    padding: 6px;
    background: none;
    border: none;
    color: #1E3765;
    cursor: pointer;
    font-size: 12px;
    text-align: center;
    margin-top: 5px;
    border-radius: 4px;
    transition: background-color 0.2s, scale 150ms ease-out;
    font-weight: 500;
}

.show-more-btn:hover {
    background-color: #f5f5f5;
}

.facet-option.hidden {
    display: none;
}

.results-section {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    min-height: 400px;
    min-width: 0;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
    flex-wrap: wrap;
    gap: 15px;
}

.results-count {
    font-size: 18px;
    color: #333;
    font-weight: 600;
}

.results-controls {
    display: flex;
    gap: 15px;
    align-items: center;
}

.per-page-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #666;
}

.per-page-selector select,
.sort-options select {
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    background: white;
}

.guides-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
    grid-auto-columns: 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

/* Limit maximum number of columns */
@media (min-width: 481px) {
    .guides-grid {
        grid-template-columns: repeat(var(--max-cards-per-row), 1fr);
    }
}

@media (max-width: 480px) {
    .guides-grid {
        grid-template-columns: 1fr;
    }
}

.guides-card {
    border-radius: 10px;
    padding: 20px;
    box-shadow:
        0 0 0 1px rgba(0,0,0,0.06),
        0 1px 2px -1px rgba(0,0,0,0.06),
        0 2px 4px rgba(0,0,0,0.04);
    transition: transform 150ms ease-out, box-shadow 150ms ease-out;
    background: white;
    min-width: 0;
    max-width: 100%;
}

.guides-card:hover {
    transform: translateY(-2px);
    box-shadow:
        0 0 0 1px rgba(30, 55, 101, 0.8),
        0 8px 20px rgba(0,0,0,0.1);
}

.guides-card h3 {
    color: #333;
    margin-bottom: 10px;
    font-size: 18px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.guides-card h3 a {
    color: #333;
    text-decoration: none;
    transition: color 0.2s;
}

.guides-card h3 a:hover {
    color: #1E3765;
}

.guides-description {
    color: #666;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    /* clip, not hidden: a screen reader's reading cursor can't scroll the clamped text and garble it */
    overflow: clip;
    text-overflow: ellipsis;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.guides-description.expanded {
    display: block;
    -webkit-line-clamp: unset;
    max-height: none;
}

.guides-description p {
    margin-bottom: 1em;
}

.guides-description p:last-child {
    margin-bottom: 0;
}

.guides-description a {
    color: #0066cc;
    text-decoration: underline;
}

.guides-description a:hover {
    color: #004499;
    text-decoration: underline;
}

.read-more-btn {
    display: block;
    background: none;
    border: none;
    color: #1E3765;
    font-size: 13px;
    cursor: pointer;
    padding: 0;
    margin-bottom: 15px;
    font-weight: 600;
    text-decoration: underline;
    transition: color 0.2s;
}

/* Shown only when the description is clamped */
.read-more-btn[hidden] {
    display: none;
}

.read-more-btn:hover {
    color: #007FA3;
}

.guides-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.tag {
    display: inline-block;
    border: none;
    font-family: inherit;
    padding: 4px 10px;
    background-color: #f0f0f0;
    border-radius: 12px;
    font-size: 12px;
    color: #666;
    cursor: pointer;
    transition: transform 150ms ease-out, box-shadow 150ms ease-out, scale 150ms ease-out;
    user-select: none;
}

.tag:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.tag.technique {
    background-color: #6FC7EA;
    color: #004d63;
}

.tag.technique.active {
    background-color: #007FA3;
    color: white;
    font-weight: 600;
}

.tag.tool {
    background-color: #D896F9;
    color: #3d0d46;
}

.tag.tool.active {
    background-color: #6D247A;
    color: white;
    font-weight: 600;
}

.tag.dataFormat {
    background-color: #B4DF2E;
    color: #3d5200;
}

.tag.dataFormat.active {
    background-color: #8DBF46;
    color: white;
    font-weight: 600;
}

.tag.type {
    background-color: #FFB470;
    color: #8b2816;
}

.tag.type.active {
    background-color: #DC4633;
    color: white;
    font-weight: 600;
}

.guides-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #999;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #f0f0f0;
}

.pagination button {
    padding: 8px 16px;
    border: 2px solid #e0e0e0;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.pagination button:hover:not(:disabled) {
    background-color: #1E3765;
    color: white;
    border-color: rgba(30, 55, 101, 0.8);
}

.pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination .page-numbers {
    display: flex;
    gap: 5px;
}

.pagination .page-number {
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    min-width: 40px;
    text-align: center;
}

.pagination .page-number:hover {
    background-color: #f5f5f5;
}

.pagination .page-number.active {
    background-color: #1E3765;
    color: white;
    border-color: rgba(30, 55, 101, 0.8);
    font-weight: 600;
}

.pagination .page-ellipsis {
    padding: 8px 12px;
    color: #999;
}

.page-info {
    font-size: 14px;
    color: #666;
    text-align: center;
    margin-top: 10px;
}

.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.no-results h3 {
    font-size: 24px;
    margin-bottom: 10px;
}

#back-to-top {
    position: fixed;
    bottom: 40px;
    right: 40px;
    width: 50px;
    height: 50px;
    background-color: white;
    color: #1E3765;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s, transform 0.3s, translate 200ms ease-out, scale 150ms ease-out;
    z-index: 1000;
    cursor: pointer;
}

#back-to-top.show {
    opacity: 1;
    visibility: visible;
}

#back-to-top:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.4);
    background-color: #f5f5f5;
}

#back-to-top.scrolled {
    translate: calc(100% + 40px) 0;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.skip-link {
    position: absolute;
    left: 20px;
    top: -100px;
    z-index: 1001;
    background: white;
    color: #1E3765;
    padding: 10px 15px;
    border-radius: 8px;
    font-weight: 600;
}

.skip-link:focus {
    top: 20px;
}

#results,
#top {
    scroll-margin-top: 20px;
}

.section-heading:focus,
#top:focus {
    outline: none;
}

.sidebar-close {
    display: none;
}

@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .filter-toggle {
        display: inline-flex;
        align-items: center;
        gap: 6px;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        max-width: 280px;
        height: 100vh;
        max-height: 100vh;
        z-index: 102;
        border-radius: 0;
        transform: translateX(-100%);
        visibility: hidden;
        /* Stay visible while sliding out; become visible at once on open so focus can land */
        transition: transform 0.3s ease-out, visibility 0s 0.3s;
        padding: 20px 15px;
        overscroll-behavior: contain;
    }

    .sidebar.open {
        transform: translateX(0);
        visibility: visible;
        transition: transform 0.3s ease-out, visibility 0s;
    }

    .sidebar-close {
        display: block;
        position: absolute;
        top: 8px;
        right: 15px;
        min-width: 44px;
        min-height: 44px;
        padding: 0 12px;
        background: #f5f5f5;
        border: none;
        border-radius: 6px;
        font-size: 14px;
        color: #1E3765;
        cursor: pointer;
    }

    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 101;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s, visibility 0.3s;
    }

    .sidebar-overlay.show {
        opacity: 1;
        visibility: visible;
    }

    .facet-group {
        margin-bottom: 20px;
    }

    .facet-group h3 {
        font-size: 13px;
        margin-bottom: 10px;
    }

    .facet-option {
        margin-bottom: 6px;
        padding: 3px;
    }

    .facet-option label {
        font-size: 13px;
    }

    .facet-count {
        font-size: 11px;
    }

    .clear-filters {
        padding: 8px;
        font-size: 12px;
    }
}

@media (max-width: 768px) {
    body {
        padding: 8px;
    }

    .container {
        padding: 0;
    }

    .guides-grid {
        gap: 15px;
    }

    .results-controls {
        width: 100%;
        justify-content: space-between;
    }

    .pagination {
        flex-wrap: wrap;
    }

    #back-to-top {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
    }

    #back-to-top svg {
        width: 20px;
        height: 20px;
    }

    header h1 {
        font-size: 2rem;
    }

    header p {
        font-size: 1rem;
    }

    .results-section {
        padding: 15px;
        border-radius: 8px;
    }

    .sticky-search-wrapper {
        padding: 10px 0;
    }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition-property: opacity, visibility, background-color, color, border-color, box-shadow !important;
    }

    .guides-card:hover,
    .tag:hover,
    #back-to-top:hover,
    .sticky-search-wrapper.scrolled {
        transform: none;
    }

    .filter-toggle:active,
    .clear-filters:active,
    .show-more-btn:active,
    .tag:active,
    #back-to-top:active {
        scale: none;
    }
}
