/**
 * LCUS Combined Styles
 * Cri-One nav | Blog Tweaks | Masonry Article | Scroll Menu | Cite This | Article Stats
 * One file for all LCUS layout and component styles.
 */

/* ========== Cri-One: header and primary nav menu ========== */

.cri-one-header {
    position: relative;
    z-index: 100;
    padding: 1.5rem 0;
    border-bottom: 2px dotted #ddd;
    margin-bottom: 1.5rem;
    background: #fff;
    width: 100%;
}
.cri-one-header .container {
    position: relative;
    z-index: 1;
}
.cri-one-header .d-flex {
    flex-wrap: wrap;
    min-width: 0;
}
.cri-one-header .site-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}
.cri-one-header .site-description {
    font-size: 0.95rem;
    color: #555;
    margin: 0.25rem 0 0;
}
.cri-one-header .nav {
    min-width: 0;
    flex-shrink: 1;
}
.cri-one-header .navbar-nav {
    flex-wrap: nowrap;
    white-space: nowrap;
}
.admin-bar .cri-one-header {
    top: 0;
}

/* ========== Blog Tweaks: single post containment, featured images, typography ========== */

/* Single post: layout containment (no floating/overlap) */
.single article,
.single-post article {
    position: relative;
    overflow-x: clip;
}
.single .entry-content,
.single-post .entry-content,
.single .wp-block-post-content,
.single-post .wp-block-post-content {
    overflow-x: clip;
}

/* Featured image: cap size */
.single-post .post-thumbnail img,
.single .post-thumbnail img,
.single-post .wp-block-post-featured-image img,
.single .wp-block-post-featured-image img,
.single-post .entry-header img,
.single .entry-header img,
.single-post .featured-image img,
.single .featured-image img,
.single-post article .wp-block-post-featured-image img,
.single article .wp-block-post-featured-image img,
.single-post .entry-content > .wp-block-post-featured-image img,
.single .entry-content > .wp-block-post-featured-image img {
    max-width: 480px;
    max-height: 320px;
    width: auto;
    height: auto;
    object-fit: contain;
}
.single-post .post-thumbnail,
.single .post-thumbnail,
.single-post .wp-block-post-featured-image,
.single .wp-block-post-featured-image {
    max-width: 480px;
}

/* Article body: typography and line length */
body.single-post .entry-content,
body.single .entry-content,
body.single-post .post-content,
body.single .post-content,
body.single-post .content,
body.single .content,
.single-post .entry-content,
.single .entry-content,
.single-post .post-content,
.single .post-content,
.single-post .content,
.single .content {
    font-size: 1rem !important;
    line-height: 1.6 !important;
    max-width: 65ch;
}
body.single-post .entry-content:has(.lcus-masonry-article),
body.single .entry-content:has(.lcus-masonry-article),
.single-post .entry-content:has(.lcus-masonry-article),
.single .entry-content:has(.lcus-masonry-article),
.single-post .post-content:has(.lcus-masonry-article),
.single .post-content:has(.lcus-masonry-article),
.single-post .content:has(.lcus-masonry-article),
.single .content:has(.lcus-masonry-article),
.single .wp-block-post-content:has(.lcus-masonry-article),
.single-post .wp-block-post-content:has(.lcus-masonry-article) {
    max-width: none !important;
    width: 100%;
    font-size: 1rem !important;
    line-height: 1.6 !important;
}
.single-post .entry-content p,
.single .entry-content p,
.single-post .post-content p,
.single .post-content p {
    font-size: 1rem !important;
}
.single-post .entry-content h1,
.single .entry-content h1,
.single-post .post-content h1,
.single .post-content h1 {
    font-size: 1.5rem;
}
.single-post .entry-content h2,
.single .entry-content h2,
.single-post .post-content h2,
.single .post-content h2 {
    font-size: 1.25rem;
}
.single-post .entry-content h3,
.single .entry-content h3,
.single-post .post-content h3,
.single .post-content h3 {
    font-size: 1.125rem;
}
.single .wp-block-post-content,
.single-post .wp-block-post-content {
    font-size: 1rem;
    line-height: 1.6;
    max-width: 65ch;
}
.single .wp-block-post-content p,
.single-post .wp-block-post-content p {
    font-size: 1rem;
}

/* ========== Masonry Article: grid, tiles, controls, tables ========== */

.lcus-masonry-article {
    margin: 2rem 0;
    width: 100vw;
    max-width: 100vw;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    padding-left: 1rem;
    padding-right: 1rem;
    box-sizing: border-box;
    isolation: isolate;
    z-index: 0;
}
.has-sidebar .lcus-masonry-article,
.col-lg-9 .lcus-masonry-article {
    width: 100%;
    max-width: 100%;
    left: auto;
    right: auto;
    margin-left: 0;
    margin-right: 0;
}

.lcus-masonry-article__controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
    align-items: center;
}
.lcus-masonry-article__btn {
    display: inline-block;
    padding: 0.4rem 0.85rem;
    font-size: 0.9rem;
    font-weight: 600;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: #fff;
    color: #333;
    cursor: pointer;
    text-decoration: none;
    font-family: inherit;
}
.lcus-masonry-article__btn:hover {
    background: #f0f0f0;
    border-color: #999;
}
.lcus-masonry-article__btn.is-active {
    background: #002a8b;
    border-color: #002a8b;
    color: #fff;
}
.lcus-masonry-article__btn--cite:hover {
    background: #e8e8e8;
}
.lcus-masonry-article__btn.is-active:hover {
    background: #05f;
    border-color: #05f;
}
.lcus-masonry-original-back {
    margin-top: 2rem;
}
.lcus-masonry-original-back .lcus-masonry-article__btn {
    display: inline-block;
}

.lcus-masonry-article__grid--single {
    column-count: 1 !important;
    max-width: 65ch;
    margin-left: auto;
    margin-right: auto;
}
.lcus-masonry-article__grid {
    column-count: 2;
    column-gap: 1.25rem;
    max-width: 100%;
    column-fill: balance;
}
.lcus-masonry-article__grid--cols-2 {
    column-count: 2 !important;
}
.lcus-masonry-article__grid--cols-3 {
    column-count: 3 !important;
}
@media (min-width: 768px) {
    .lcus-masonry-article {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}
@media (min-width: 900px) {
    .lcus-masonry-article__grid {
        column-count: 3;
    }
}
@media (min-width: 1200px) {
    .lcus-masonry-article__grid {
        column-count: 4;
    }
    .lcus-masonry-article {
        padding-left: 2rem;
        padding-right: 2rem;
    }
}

.lcus-masonry-article__tile {
    break-inside: avoid;
    page-break-inside: avoid;
    margin-bottom: 1.25rem;
    padding: 0.85rem 1rem;
    background: #fafafa;
    border: 1px solid #eee;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    contain: layout;
    min-height: 0;
}
.lcus-masonry-article__tile--part {
    background: #f0f0f0;
    border-color: #ddd;
    font-weight: 600;
}
.lcus-masonry-article__label {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #555;
    margin-bottom: 0.35rem;
}
.lcus-masonry-article__tile--part .lcus-masonry-article__label {
    color: #333;
    font-size: 0.75rem;
}
.lcus-masonry-article__label--link {
    color: inherit;
    text-decoration: none;
}
.lcus-masonry-article__label--link:hover {
    text-decoration: underline;
}
.lcus-masonry-article__label--link:focus {
    outline: 1px dotted currentColor;
}

.lcus-masonry-article__content {
    display: block;
    font-size: 1rem;
    line-height: 1.6;
    min-width: 0;
    overflow-x: auto;
}
.lcus-masonry-article__content p:first-child,
.lcus-masonry-article__content h2:first-child {
    margin-top: 0;
}
.lcus-masonry-article__content p:last-child,
.lcus-masonry-article__content h2:last-child {
    margin-bottom: 0;
}
.lcus-masonry-article__content h2 {
    font-size: 1.2rem;
    margin: 0;
}
.lcus-masonry-article__content p {
    font-size: 1rem;
    max-width: 65ch;
}
.single-post .lcus-masonry-article__content,
.single .lcus-masonry-article__content {
    max-width: none;
}
.lcus-masonry-article__content table {
    width: 100%;
    max-width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}
.lcus-masonry-article__content table th,
.lcus-masonry-article__content table td {
    border: 1px solid #ddd;
    padding: 0.4rem 0.6rem;
    text-align: left;
}
.lcus-masonry-article__content table th {
    background: #f0f0f0;
    font-weight: 600;
}
.lcus-masonry-article__content ul,
.lcus-masonry-article__content ol {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}
.lcus-masonry-article__content blockquote {
    margin: 0.5rem 0;
    padding-left: 1rem;
    border-left: 4px solid #ddd;
    color: #555;
}
.lcus-masonry-article__content div {
    max-width: 100%;
    min-width: 0;
}

/* ========== Scroll Menu ========== */

.lcus-scroll-menu-wrap {
    --lcus-scroll-speed: 8;
    position: relative;
    max-width: 100%;
    overflow: hidden;
    isolation: isolate;
    z-index: 0;
}
.lcus-scroll-menu-track {
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    min-height: 1px;
}
.lcus-scroll-menu-track::-webkit-scrollbar {
    display: none;
}
.lcus-scroll-menu-wrap,
.lcus-scroll-menu-track {
    white-space: nowrap;
}
.lcus-scroll-menu {
    list-style: none;
    margin: 0;
    padding: 0.5rem 0;
    display: inline-flex;
    flex-wrap: nowrap;
    gap: 0.25rem;
    white-space: nowrap;
    min-width: min-content;
}
.lcus-scroll-menu li {
    margin: 0;
    flex-shrink: 0;
    white-space: nowrap;
}
.lcus-scroll-menu a {
    display: inline-block;
    padding: 0.5rem 1rem;
    text-decoration: none;
    color: inherit;
    white-space: nowrap;
}
.lcus-scroll-menu a:hover {
    text-decoration: underline;
}
/* Arrow buttons: scroll on click or hover */
.lcus-scroll-menu-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid #ccc;
    border-radius: 50%;
    background: #fff;
    color: #333;
    font-size: 0.85rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s, background 0.2s;
    -webkit-appearance: none;
    appearance: none;
}
.lcus-scroll-menu-arrow:hover {
    background: #f0f0f0;
    border-color: #999;
}
.lcus-scroll-menu-arrow:focus {
    outline: 2px solid #002a8b;
    outline-offset: 2px;
}
.lcus-scroll-menu-arrow--left {
    left: 4px;
}
.lcus-scroll-menu-arrow--right {
    right: 4px;
}
.lcus-scroll-menu-arrow--hidden {
    opacity: 0;
    pointer-events: none;
}
.lcus-scroll-menu-wrap::before,
.lcus-scroll-menu-wrap::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    width: 24px;
    pointer-events: none;
    z-index: 1;
    transition: opacity 0.2s;
}
.lcus-scroll-menu-wrap::before {
    left: 0;
    background: linear-gradient(to right, rgba(255,255,255,0.9), transparent);
}
.lcus-scroll-menu-wrap::after {
    right: 0;
    background: linear-gradient(to left, rgba(255,255,255,0.9), transparent);
}
.lcus-scroll-menu-wrap.lcus-scroll-at-start::before {
    opacity: 0;
}
.lcus-scroll-menu-wrap.lcus-scroll-at-end::after {
    opacity: 0;
}
@media (prefers-color-scheme: dark) {
    .lcus-scroll-menu-wrap::before {
        background: linear-gradient(to right, rgba(0,0,0,0.9), transparent);
    }
    .lcus-scroll-menu-wrap::after {
        background: linear-gradient(to left, rgba(0,0,0,0.9), transparent);
    }
}

/* ========== Cite This Article ========== */

.lcus-cite-this {
    margin: 1.5rem 0;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
}
.lcus-cite-this-toggle {
    width: 100%;
    padding: 0.6rem 1rem;
    font-size: 0.95rem;
    font-weight: 600;
    text-align: left;
    background: #f5f5f5;
    border: none;
    cursor: pointer;
}
.lcus-cite-this-toggle:hover {
    background: #eee;
}
.lcus-cite-this-toggle[aria-expanded="true"] {
    background: #e8e8e8;
}
.lcus-cite-this-panel {
    padding: 1rem 1rem 1.25rem;
    background: #fff;
}
.lcus-cite-this-intro {
    margin: 0 0 0.75rem;
    font-size: 0.9rem;
    color: #555;
}
.lcus-cite-this-row {
    margin-bottom: 0.75rem;
}
.lcus-cite-this-row:last-child {
    margin-bottom: 0;
}
.lcus-cite-this-label {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #444;
    margin-bottom: 0.25rem;
}
.lcus-cite-this-text-wrap {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
    min-width: 0;
}
.lcus-cite-this-text {
    flex: 1;
    min-width: 0;
    font-size: 0.9rem;
    line-height: 1.5;
    padding: 0.5rem 0.6rem;
    background: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 4px;
    font-family: inherit;
    word-break: break-word;
}
.lcus-cite-this-copy {
    flex-shrink: 0;
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
    background: #333;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}
.lcus-cite-this-copy:hover {
    background: #555;
}
.lcus-cite-this-copy.copied {
    background: #0a7;
}

/* ========== Article Statistics ========== */

.lcus-article-stats {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.5rem;
    font-size: 0.85rem;
    color: #555;
    margin-bottom: 1rem;
    min-width: 0;
}
.lcus-article-stats__item {
    white-space: nowrap;
}
.lcus-article-stats__sep {
    color: #bbb;
    user-select: none;
}
.lcus-article-stats__words,
.lcus-article-stats__time {
    font-weight: 600;
    color: #333;
}
.lcus-article-stats__blocks {
    color: #555;
}
