/* Base/reset */
:root {
    --text: #212529;
    --muted: #6c757d;
    --border: #e5e7eb;
    --link: #0077cc;
    --focus: #258cfb;
    --page-padding: 1rem;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    position: relative;
    min-height: 100%;
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    margin: 0 0 60px;
    color: var(--text);
    background: #fff;
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    line-height: 1.45;
    overflow-x: hidden;
}

a {
    color: var(--link);
    overflow-wrap: anywhere;
    text-decoration: none;
}

a:hover,
a:focus-visible {
    color: #005fa3;
}

:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}

.site-container {
    width: min(100% - 2rem, 1140px);
    margin-inline: auto;
}

/* Flexbox navigation */
.site-nav {
    border-bottom: 1px solid var(--border);
    box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, .05);
    margin-bottom: 1.5rem;
}

.nav-inner {
    min-height: 76px;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.brand {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
}

.brand img {
    display: block;
    width: 100px;
    height: auto;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-links a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    color: var(--text);
    text-decoration: none;
}

.nav-links a:hover,
.nav-links a:focus-visible {
    text-decoration: underline;
}

.page-content {
    padding-bottom: 1rem;
}

/* Content rows: provider | title date */
.content-container {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.content-title {
    margin: 0 0 0.35rem;
    font-size: 1.25rem;
}

.content-row {
    display: flex;
    align-items: flex-start;
    gap: 0.35rem;
    width: 100%;
    min-width: 0;
    flex-wrap: nowrap;
    padding-bottom: 0.7rem;
    border-bottom: 1px solid var(--border);
}

.content-row:last-child {
    border-bottom: 0;
}

.content-col-provider {
    flex: 0 0 30%;
    max-width: 30%;
    min-width: 30%;
    min-width: 0;
    padding-right: 0.5rem;
    white-space: normal;
    overflow-wrap: anywhere;
}

.content-col-title {
    flex: 1 1 0;
    min-width: 0;
}

.content-col-title a {
    display: block;
}

.content-col-date {
    flex: 0 0 7rem;
    width: 7rem;
    align-self: flex-start;
    margin-left: auto;
    color: var(--muted);
    white-space: nowrap;
    font-size: 0.9rem;
    text-align: right;
}

/* Provider list */
.provider-column-container {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.25rem 2rem;
}

.provider-card {
    flex: 1 1 calc(33.333% - 2rem);
    min-width: 12rem;
    overflow-wrap: anywhere;
}

.provider-card a {
    display: block;
    padding: 0.35rem 0;
}

/* Content detail/body safety */
.page-content img,
.page-content video,
.page-content iframe {
    max-width: 100%;
    height: auto;
}

.page-content pre,
.page-content table {
    max-width: 100%;
    overflow-x: auto;
}

.page-content pre {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* Back-to-top button */
@keyframes fab-fade-in {
    from { opacity: 0; transform: scale(.8); }
    to { opacity: 1; transform: scale(1); }
}

.fab {
    position: fixed;
    right: 24px;
    bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: rgba(255, 255, 255, .92);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
    z-index: 10;
    animation: fab-fade-in .2s ease-out;
}

.fab:not(.visible) {
    opacity: 0;
    pointer-events: none;
}

.arrow {
    width: 10px;
    height: 10px;
    border-top: 2px solid #374151;
    border-left: 2px solid #374151;
    transform: rotate(45deg) translate(2px, 2px);
}

@media (max-width: 767px) {
    :root { --page-padding: .75rem; }

    .site-container {
        width: min(100% - 1.5rem, 1140px);
    }

    .nav-inner {
        min-height: 64px;
        gap: 1rem;
    }

    .brand img {
        width: 72px;
    }

    .nav-links {
        gap: .5rem;
    }

    .nav-links a {
        min-height: 40px;
        padding: .25rem .35rem;
    }

    .content-row {
        align-items: flex-start;
        flex-wrap: nowrap;
        column-gap: .35rem;
        row-gap: .15rem;
        padding-bottom: .65rem;
    }

    .content-col-provider {
        flex: 0 0 30%;
        max-width: 30%;
        min-width: 30%;
        padding: 0;
        white-space: normal;
        color: var(--muted);
        font-size: .875rem;
    }

    .content-col-title {
        flex: 1 1 auto;
    }

    .content-col-date {
        flex: 0 0 6.5rem;
        width: 6.5rem;
        align-self: flex-start;
        margin-left: auto;
        font-size: .825rem;
    }

    .provider-card {
        flex: 1 1 calc(50% - 1rem);
        min-width: 9rem;
    }

    .fab {
        right: 16px;
        bottom: 16px;
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 420px) {
    .nav-inner {
        gap: .6rem;
    }

    .brand img {
        width: 64px;
    }

    .nav-links {
        gap: .15rem;
    }

    .nav-links a {
        padding-inline: .2rem;
        font-size: .9rem;
    }

    /* On narrow phones, use the stacked provider/title/date layout. */
    .content-col-provider {
        flex-basis: 100%;
        max-width: 100%;
        min-width: 100%;
    }

    .content-col-title,
    .content-col-date {
        flex-basis: 100%;
    }

    .content-row {
        flex-wrap: wrap;
    }

    .content-col-date {
        width: auto;
        margin-left: 0;
        text-align: left;
        color: var(--muted);
    }

    .provider-card {
        flex-basis: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
}

@media print {
    .site-nav,
    .fab { display: none; }

    body { margin: 0; }
}

/* Menu */

/* Header & Container */
.site-nav {
    width: 100%;
    border-bottom: 1px solid #e5e7eb;
    background-color: #ffffff;
    padding: 0.75rem 1.5rem;
}

.nav-inner {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
}

.brand {
    display: flex;
    align-items: center;
    text-decoration: none;
}

/* Left Navigation Links */
.nav-links {
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 1.5rem;
}

.nav-links a {
    text-decoration: none;
    color: #1f2937;
    font-weight: 500;
}

.nav-links a:hover {
    color: #2563eb;
}

/* Right Auth / Username Section */
.nav-auth {
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0 0 0 auto; /* Pushes to the far right on desktop */
    padding: 0;
    gap: 0.75rem;
}

.nav-auth form {
    margin: 0;
}

.nav-user span {
    color: #374151;
    font-size: 0.95rem;
    max-width: 200px;
    display: inline-block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}

/* Sign In / Sign Out Buttons */
.btn-signin {
    display: inline-block;
    padding: 0.4rem 0.9rem;
    background-color: #2563eb;
    color: #ffffff !important;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
}

.btn-signin:hover {
    background-color: #1d4ed8;
}

.btn-signout {
    padding: 0.35rem 0.85rem;
    background-color: transparent;
    color: #dc2626;
    border: 1px solid #dc2626;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
}

.btn-signout:hover {
    background-color: #dc2626;
    color: #ffffff;
}

/* Mobile Responsive Layout */
@media (max-width: 640px) {
    .site-nav {
        padding: 0.75rem 1rem;
    }

    .nav-inner {
        justify-content: space-between;
        gap: 0.75rem;
    }

    /* Moves Home & Providers cleanly onto a second row on small phones */
    .nav-links {
        order: 3;
        width: 100%;
        padding-top: 0.5rem;
        border-top: 1px solid #f3f4f6;
        gap: 1.25rem;
    }

    .nav-auth {
        order: 2;
        margin-left: auto;
    }

    .nav-user span {
        max-width: 130px;
    }
}

