/* --- AXIOSEARCH CORE PALETTE (Mockup Match) --- */
:root {
  /* Surface & Backgrounds */
  --axio-bg-base: #11151C;       /* Rich navy-slate background */
  --axio-bg-surface: #1A1F29;    /* Elevated cards/inputs/headers */
  --axio-bg-highlight: #232A35;  /* Hover states */

  /* Borders & Gridlines */
  --axio-border-dim: #323B4B;    /* Softer structural gridlines */
  --axio-border-focus: #5A6982;

  /* Typography */
  --axio-text-primary: #C9D1D9;
  --axio-text-muted: #8B949E;
  --axio-text-bright: #F0F6FC;

  /* Accents */
  --axio-accent-cyan: #00E5FF;
  --axio-accent-green: #3FB950;
}

/* 1. Force the CSS Box Model to include padding in width calculations */
*,
*::before,
*::after {
    box-sizing: border-box;
}

/* 2. Prevent the 100vw scrollbar bug and lock the viewport horizontally */
html,
body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden; /* Hard clip anything trying to bleed right */
    margin: 0;
    padding: 0;
}

/* 4. Prevent rogue images/icons from stretching containers */
img,
svg {
    max-width: 100%;
    height: auto;
}

/* Full-screen wrapper to guarantee dead-center layout geometry */
.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    pointer-events: none;
}

/* Updated Cyberpunk Spinner */
.loader {
    border: 3px solid var(--axio-bg-highlight);
    border-top: 3px solid var(--axio-accent-cyan);
    border-radius: 50%;
    width: 42px;
    height: 42px;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

body {
    background-color: var(--axio-bg-base);
    color: var(--axio-text-primary);
    /* Swapped Georgia for a crisp engineering system font */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    overflow-wrap: break-word;
    word-wrap: break-word;
}
a {
    color: var(--axio-text-bright);
    text-decoration: underline;
    text-decoration-color: var(--axio-border-dim);
    text-underline-offset: 3px;
    transition: all 0.2s ease;
}
a:hover {
    color: var(--axio-accent-cyan);
    text-decoration-color: var(--axio-accent-cyan);
}

/* Homepage Layout */
main.home {
    max-width: 700px;
    margin: 6rem auto 4rem auto;
    text-align: center;
    padding: 0 2rem;
    flex: 1;
}

/* Typography */
h1.logo {
    font-size: 5rem;
    font-weight: 700;
    letter-spacing: -2px;
    margin: 0 0 1rem 0;
    color: var(--axio-text-bright);
}
h2.tagline {
    font-size: 2.2rem;
    font-weight: 400;
    margin: 0 0 1.5rem 0;
    color: var(--axio-text-primary);
}
p.hero-text {
    font-size: 1.25rem;
    line-height: 1.5;
    margin: 0 auto 3rem auto;
    color: var(--axio-text-muted);
}

/* Search Input */
.search-container {
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--axio-border-dim);
    padding-bottom: 0.5rem;
    margin-bottom: 3rem;
    transition: border-color 0.2s;
}
.search-container:focus-within {
    border-bottom-color: var(--axio-accent-cyan);
}
.search-container input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    font-size: 1.2rem;
    font-family: inherit;
    color: var(--axio-text-bright);
}
.search-container svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: var(--axio-text-muted);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    cursor: pointer;
    transition: stroke 0.2s;
}
.search-container:focus-within svg {
    stroke: var(--axio-accent-cyan);
}

.search-submit-button {
    flex-shrink: 0;
    min-width: 44px;
    background: transparent;
    border: none;
}

.search-input-field {
    flex: 1 1 auto;
    min-width: 0;
}

.search-bar-wrapper {
    display: flex;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
    padding-right: 16px;
}

/* Curation Feed */
.feed h3 {
    font-size: 1.1rem;
    font-weight: 400;
    margin-bottom: 1rem;
    color: var(--axio-text-bright);
}
.feed ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.feed li {
    margin-bottom: 0.75rem;
    font-size: 1rem;
    color: var(--axio-text-primary);
}

/* Footer */
footer {
    background-color: var(--axio-bg-surface);
    border-top: 1px solid var(--axio-border-dim);
    padding: 2.5rem 2rem;
    text-align: center;
    font-size: 0.95rem;
    color: var(--axio-text-muted);
}
footer p {
    margin: 0.3rem 0;
}
footer strong {
    font-weight: 700;
    color: var(--axio-text-bright);
}

/* Top Navigation */
header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--axio-border-dim);
    background-color: var(--axio-bg-surface);
    display: flex;
    align-items: center;
    gap: 2rem;
}
.header-logo {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -1px;
    text-decoration: none;
    color: var(--axio-text-bright);
}
.header-search {
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--axio-border-dim);
    padding-bottom: 0.25rem;
    max-width: 500px;
    flex: 1;
    transition: border-color 0.2s;
}
.header-search:focus-within {
    border-bottom-color: var(--axio-accent-cyan);
}
.header-search input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    font-size: 1.1rem;
    color: var(--axio-text-bright);
    font-family: inherit;
}
.header-search svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: var(--axio-text-muted);
    stroke-width: 2;
}

/* Editorial Content Layout */
main.editorial {
    max-width: 680px;
    margin: 4rem auto 6rem auto;
    padding: 0 2rem;
}
main.editorial h1 {
    font-size: 2.8rem;
    font-weight: 400;
    margin-bottom: 0.5rem;
    color: var(--axio-text-bright);
}
.meta {
    font-size: 0.95rem;
    color: var(--axio-text-muted);
    margin-bottom: 3rem;
    font-style: italic;
}
main.editorial h2 {
    font-size: 1.6rem;
    font-weight: 400;
    margin: 2.5rem 0 1rem 0;
    color: var(--axio-text-bright);
}
main.editorial p {
    font-size: 1.15rem;
    line-height: 1.7;
    margin-bottom: 1.5rem;
    color: var(--axio-text-primary);
}
main.editorial ul {
    font-size: 1.15rem;
    line-height: 1.7;
    color: var(--axio-text-primary);
    margin-bottom: 1.5rem;
}

/* Plain English Blockquotes -> Terminal Output style */
blockquote {
    background-color: var(--axio-bg-surface);
    border-left: 4px solid var(--axio-accent-cyan);
    margin: 1.5rem 0 3rem 0;
    padding: 1rem 1.5rem;
    font-size: 1.05rem;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    color: var(--axio-text-primary);
}
blockquote strong {
    color: var(--axio-text-bright);
    font-weight: 600;
}

/* Results Layout */
main.results {
    max-width: 750px;
    margin: 3rem auto 5rem auto;
    padding: 0 2rem;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}
.metrics {
    font-size: 0.9rem;
    color: var(--axio-text-muted);
    margin-bottom: 2.5rem;
    font-style: italic;
}

/* Individual Result */
.result-item {
    margin-bottom: 2.5rem;
}
.result-title {
    font-size: 1.4rem;
    margin: 0 0 0.2rem 0;
    font-weight: 400;
}
.result-title a {
    text-decoration: none;
    color: var(--axio-text-bright);
}
.result-title a:hover {
    text-decoration: underline;
    color: var(--axio-accent-cyan);
}
.result-url {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.85rem;
    color: var(--axio-text-muted);
    margin: 0 0 0.5rem 0;
    display: block;
    overflow-wrap: break-word;
    word-break: break-all;
}
.result-snippet {
    font-size: 1.05rem;
    line-height: 1.6;
    color: var(--axio-text-primary);
    margin: 0;
}
/* Header Layout */
.results-header {
    display: flex;
    align-items: center;
    gap: 2rem;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--axio-border-dim);
    background-color: var(--axio-bg-surface);
}

/* --- Search Container Small (Mobile Fix) --- */
.search-container-small {
    display: flex;
    flex-direction: row;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

/* 1. The Input */
.search-container-small input[type="text"],
.search-container-small .search-input-field {
    flex: 1 1 auto;
    min-width: 0;
    background: transparent;
    color: var(--axio-text-bright);
}

/* 2. The Dropdown */
.search-container-small select {
    flex-shrink: 0;
    margin-right: 4px;
    background-color: var(--axio-bg-surface);
    color: var(--axio-text-primary);
    border: 1px solid var(--axio-border-dim);
    border-radius: 4px;
    padding: 0.2rem;
}

/* 3. The Button */
.search-container-small button,
.search-container-small .search-submit-button {
    flex-shrink: 0;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
}

/* Mobile Responsiveness */
@media (max-width: 600px) {
    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        padding: 1.5rem;
    }
    .header-search {
        max-width: 100%;
        width: 100%;
    }
    main.results {
        margin: 2rem auto 4rem auto;
        padding: 0 1.5rem;
    }
    .result-title {
        font-size: 1.3rem;
    }
    .results-header {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 1rem !important;
    }
    .search-container-small {
        width: 100% !important;
        max-width: 100% !important;
    }
}

/* --- Horizontal Pagination Styling --- */

/* Container that bounds the horizontal scroll area */
#client-paginator {
    margin: 4rem auto 2rem auto;
    padding: 1rem 0;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    white-space: nowrap;
    display: block;
    border-top: 1px solid var(--axio-border-dim);
    -webkit-overflow-scrolling: touch;
}

/* Ensure the inner list acts as a single long row */
#client-paginator .pagination {
    display: inline-flex;
    list-style: none;
    padding: 0;
    margin: 0;
    gap: 0.25rem;
}

/* Individual page items */
#client-paginator .page-item {
    display: inline-block;
}

/* The clickable links */
#client-paginator .page-link {
    display: block;
    padding: 0.5rem 0.75rem;
    text-decoration: none;
    color: var(--axio-text-primary);
    border: 1px solid transparent;
    border-radius: 4px;
    transition: all 0.2s ease;
}

/* Hover state for pages */
#client-paginator .page-link:hover {
    background-color: var(--axio-bg-highlight);
    color: var(--axio-text-bright);
    border-color: var(--axio-border-dim);
}

/* Active page highlighting */
#client-paginator .page-item.active .page-link {
    background-color: var(--axio-border-dim);
    color: var(--axio-accent-cyan);
    border-color: var(--axio-border-focus);
    font-weight: 600;
}

/* Container Logic */
.results-content {
    max-width: 800px;
    margin: 3rem auto;
    padding: 0 2rem;
    width: 100%;
    min-width: 0;
}

/* Force native dropdowns into the dark theme */
select {
    background-color: var(--axio-bg-surface);
    color: var(--axio-text-primary);
    border: 1px solid var(--axio-border-dim);
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    outline: none;
    font-family: inherit;
    font-size: 0.95rem;
    color-scheme: dark; /* This is the magic property for the native UI popup */
    transition: border-color 0.2s;
}

select:focus {
    border-color: var(--axio-accent-cyan);
}

/* --- AXIOSEARCH BRAND COMPONENT (PNG Version) --- */
.axio-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    user-select: none;
}

.axio-brand:hover {
    text-decoration: none;
}

/* The PNG scales automatically based on the font-size of the container */
.axio-brand .axio-mark {
    height: 1.25em;
    width: auto;
    display: block;
    object-fit: contain;
}

/* Typography matching the mockup */
.axio-brand .axio-text {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 1em;
    letter-spacing: -0.02em;
    line-height: 1;
}

.axio-brand .axio-prefix {
    color: var(--axio-text-bright);
    font-weight: 600;
}

.axio-brand .axio-suffix {
    color: #9DB0C6; /* The pale icy blue from the original mockup */
    font-weight: 400;
}

/* --- CONTEXTUAL SIZING --- */
main.home .axio-brand {
    font-size: 4.5rem;
    justify-content: center;
    margin: 0 0 1.5rem 0;
    width: 100%;
}

header .axio-brand {
    font-size: 2.1rem;
    transition: opacity 0.2s;
}

header .axio-brand:hover {
    opacity: 0.8;
}

/* --- 1. Favicon Contrast & Alignment Fix --- */
.result-url img,
.result-item img {
    /* Create a bright, rounded plate behind the transparent icons */
    background-color: #F0F6FC;
    padding: 2px;
    border-radius: 3px;
    box-sizing: content-box; /* Keeps the icon exactly 16x16 inside the new padding */

    /* Perfect vertical alignment */
    vertical-align: middle;
    margin-right: 8px;
    position: relative;
    top: -2px; /* Pulls the icon down optically to center with lowercase text */
}

/* --- 2. Header Search Input Fix --- */
.search-container-small input[type="text"],
.search-container-small .search-input-field,
.header-search input {
    /* Strip the native browser white background */
    background-color: transparent !important;
    color: var(--axio-text-bright) !important;
    -webkit-appearance: none; /* Kills Safari/Chrome native input rendering */
    appearance: none;
    box-shadow: none;
}

/* --- Aggressive Header Search Container Fix --- */
header form,
header .header-search,
header .search-container-small,
header .search-bar-wrapper {
    background: transparent !important;
    background-color: transparent !important;
}

header input[type="text"],
header input#q {
    background: transparent !important;
    background-color: transparent !important;
    color: var(--axio-text-bright) !important;
    border: none !important;
    box-shadow: none !important;
    -webkit-appearance: none;
    appearance: none;
}

/* --- Header Dropdown Text Color Fix --- */
header select,
.search-container-small select {
    color: var(--axio-text-bright) !important;
}

/* --- Solr Search Result Highlight Color --- */
.result-item p strong {
    color: #00FBFF !important;
    font-weight: normal; /* Drop the bold, let the neon stand on its own */
    opacity: 0.9; /* Takes the harsh edge off the brightness */
}

@media screen and (max-width: 768px) {
    body, main, .home-container {
        overflow-x: hidden;
        width: 100%;
        max-width: 100vw;
        box-sizing: border-box;
    }
}

@media screen and (max-width: 768px) {
    /* Stack the SVG above the text container */
    main.home .axio-brand {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }

    /* Keep the text strictly on one line and scale fluidly */
    main.home .axio-text {
        font-size: clamp(2rem, 11vw, 3.5rem) !important;
        white-space: nowrap !important;
        display: block;
    }

    /* Size the glowing SVG */
    main.home .axio-brand svg {
        width: 54px !important;
        height: auto;
    }

    /* Scale down the tagline and description */
    h1, h2, .tagline {
        font-size: 1.5rem !important;
        padding: 0 15px;
    }

    p, .description {
        font-size: 1rem !important;
        padding: 0 20px;
    }
}

@media screen and (max-width: 768px) {
    .search-container, .home-search, form {
        width: 100% !important;
        max-width: 90vw !important;
        margin: 0 auto;
        box-sizing: border-box;
    }
}
