/* ==================================================
   1. Typography
   ================================================== */

.np-site {
    font-family: "Rubik", system-ui, -apple-system, "Segoe UI",
        Arial, sans-serif;
}

.np-site h1,
.np-site h2,
.np-site h3,
.np-site h4,
.np-site h5,
.np-site h6,
.np-site .navbar,
.np-site .btn,
.np-site .form-control {
    font-family: "Nunito Sans", system-ui, -apple-system,
        "Segoe UI", Arial, sans-serif;
}

.np-brand {
    font-size: 1.65rem;
    font-weight: 700;
    letter-spacing: -0.04em;
}


/* ==================================================
   2. Header search
   ================================================== */

.np-header-tools {
    display: flex;
    align-items: center;
    gap: 12px;
}

.np-header-tools > button {
    flex-shrink: 0;
    white-space: nowrap;
}

.np-header-search {
    width: 290px;
    min-width: 0;
    margin: 0;
}

.np-header-search .input-group {
    flex-wrap: nowrap;
}

.np-header-search .form-control {
    flex: 1 1 auto;
    width: 1%;
    min-width: 0;
    margin: 0;
    border-radius: 6px 0 0 6px;
}

.np-header-search .btn {
    flex-shrink: 0;
    border-radius: 0 6px 6px 0;
    white-space: nowrap;
}


/* ==================================================
   3. Homepage hero cards
   ================================================== */

.np-overlay-card {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    background-color: #191a1f;
    border: 0;
    border-radius: 0.5rem;
}

.np-overlay-card::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    background: linear-gradient(
        180deg,
        rgba(0, 0, 0, 0.05) 0%,
        rgba(0, 0, 0, 0.35) 35%,
        rgba(0, 0, 0, 0.88) 100%
    );
    pointer-events: none;
}

.np-overlay-image {
    position: absolute;
    inset: 0;
    z-index: 0;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.np-overlay-card:hover .np-overlay-image {
    transform: scale(1.04);
}

.np-overlay-card > .card-img-overlay {
    z-index: 2;
}

.np-hero-large {
    height: 560px;
}

.np-hero-small {
    height: 268px;
}

.np-hero-title,
.np-overlay-title {
    margin-bottom: 0.8rem;
    overflow-wrap: anywhere;
}

.np-hero-title {
    font-size: clamp(1.65rem, 2.5vw, 2.5rem);
    line-height: 1.18;
}

.np-overlay-title {
    font-size: clamp(1.05rem, 1.4vw, 1.4rem);
    line-height: 1.25;
}

.np-overlay-title a {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
    line-clamp: 4;
    overflow: hidden;
}

.np-hero-excerpt {
    font-size: 0.9rem;
    line-height: 1.6;
}

.np-overlay-card .badge {
    position: relative;
    z-index: 3;
    max-width: 100%;
    white-space: normal;
    text-align: left;
    line-height: 1.4;
}

/* Small hero adjustments */

.np-hero-small .np-overlay-title {
    font-size: clamp(1rem, 1.25vw, 1.25rem);
}

.np-hero-small .np-overlay-title a {
    -webkit-line-clamp: 3;
    line-clamp: 3;
}

.np-hero-small .np-post-meta {
    margin-bottom: 0.45rem;
    font-size: 0.68rem;
}

.np-hero-small .np-read-full {
    font-size: 0.75rem;
}


/* ==================================================
   4. Article cards and thumbnails
   ================================================== */

.np-grid-card {
    border: 0;
    box-shadow: none;
}

.np-card-media {
    position: relative;
    display: block;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    background: var(--bs-tertiary-bg);
}

.np-card-media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.np-card-media:hover img {
    transform: scale(1.035);
}

.np-image-placeholder {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-size: 0.8rem;
    color: var(--bs-body-color);
}

.np-image-badge {
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: 16px;
    z-index: 3;
    pointer-events: none;
}

.np-image-badge .badge {
    white-space: normal;
    text-align: left;
    line-height: 1.4;
}

.np-image-badge a {
    pointer-events: auto;
}

.np-category-link,
.np-meta-link {
    position: relative;
    z-index: 3;
    pointer-events: auto;
    text-decoration: none;
}

.np-grid-card .card-title {
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.np-card-excerpt {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    overflow: hidden;
}

.np-sidebar-image {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}


/* ==================================================
   5. Metadata and read links
   ================================================== */

.np-post-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0;
    padding: 0;
    margin: 0 0 0.8rem;
    list-style: none;
    font-size: 0.75rem;
    line-height: 1.6;
    color: var(--bs-body-color);
}

.np-post-meta li + li::before {
    content: "•";
    display: inline-block;
    margin: 0 0.6rem;
    opacity: 0.65;
}

.np-meta-link {
    color: inherit;
}

.np-meta-link:hover {
    text-decoration: underline;
}

.np-post-meta--overlay,
.np-post-meta--overlay a {
    color: #fff;
}

.np-read-full {
    position: relative;
    z-index: 3;
    display: inline-block;
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: none;
}

.np-read-full--overlay {
    color: #fff;
}

.np-read-full--overlay:hover {
    color: #fff;
    text-decoration: underline;
}


/* ==================================================
   6. Latest / Trending — Tiny Slider
   ================================================== */

.np-trending-slider {
    flex: 1 1 auto;
    min-width: 0;
}

.np-trending-slider .tiny-slider-inner > div {
    padding-right: 4rem;
}

.np-trending-slider .tns-controls button svg {
    display: block;
    margin: auto;
}


/* ==================================================
   7. Article heading
   ================================================== */

.np-post-heading {
    padding: 0 0 24px;
    border-bottom: 1px solid var(--bs-border-color);
    text-align: left;
}

.np-post-title {
    margin: 0;
    color: var(--bs-heading-color);
    font-size: clamp(1.5rem, 2.2vw, 2rem);
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.02em;
    overflow-wrap: anywhere;
}

.np-post-heading .np-post-title {
    max-width: none;
}

.np-post-heading .np-post-meta {
    justify-content: flex-start;
}

.np-heading-related h4 {
    margin-top: 0;
    font-size: 1.1rem;
}

.np-heading-related .np-sidebar .card h5 {
    font-size: 0.85rem;
    line-height: 1.4;
}


/* ==================================================
   8. Article content
   ================================================== */

.post-document,
.post-prose,
.post-article-section {
    min-width: 0;
}

.post-prose {
    font-size: 1.03rem;
    line-height: 1.85;
    overflow-wrap: anywhere;
}

.post-prose p {
    margin-bottom: 1.2rem;
}

.post-prose h2,
.post-prose h3,
.post-prose h4 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    line-height: 1.3;
}

.post-toc-target {
    scroll-margin-top: 24px;
}

.post-prose img,
.post-prose video {
    max-width: 100%;
    height: auto;
}

.post-prose table {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    margin: 1.5rem 0;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.post-prose th,
.post-prose td {
    padding: 0.7rem;
    border: 1px solid var(--bs-border-color);
    vertical-align: top;
}

.post-prose pre {
    max-width: 100%;
    overflow-x: auto;
    padding: 1rem;
    background: var(--bs-tertiary-bg);
    border-radius: 0.5rem;
}

.post-prose blockquote {
    margin: 1.5rem 0;
    padding: 1rem 1.5rem;
    border-left: 4px solid var(--bs-primary);
    background: var(--bs-tertiary-bg);
}


/* ==================================================
   9. Table of contents
   ================================================== */

.np-toc {
    padding: 24px;
    border: 1px solid var(--bs-border-color);
    border-left: 4px solid var(--bs-primary);
    border-radius: 0.5rem;
    background: var(--bs-tertiary-bg);
}

.np-toc[hidden],
.post-inline-ad[hidden] {
    display: none !important;
}

.np-toc ol {
    padding-left: 1.4rem;
}

.np-toc li {
    margin: 0.55rem 0;
    font-size: 0.9rem;
    line-height: 1.5;
}

.np-toc-h3 {
    margin-left: 1rem !important;
}

.np-toc-h4 {
    margin-left: 2rem !important;
}

.np-toc a {
    color: var(--bs-body-color);
    text-decoration: none;
}

.np-toc a:hover,
.np-toc a.is-active {
    color: var(--bs-primary);
}

/* Sticky sidebar variant */

.np-toc-sticky {
    margin-top: 1.5rem;
}

.np-toc-sticky .np-toc {
    margin-bottom: 0;
    padding: 20px;
    border: 1px solid var(--bs-border-color);
    background: var(--bs-body-bg);
}

.np-post-sidebar-column .np-toc-sticky {
    margin-top: 0;
}


/* ==================================================
   10. Advertisement containers
   ================================================== */

.post-inline-ad {
    clear: both;
    max-width: 100%;
    overflow-x: auto;
    margin: 28px 0;
    padding: 12px 0;
}

.np-ad-label {
    margin-bottom: 8px;
    color: var(--bs-body-color);
    font-size: 0.65rem;
    letter-spacing: 0.1em;
    text-align: center;
    text-transform: uppercase;
}

.np-ad-container {
    display: flex;
    justify-content: center;
    min-width: 0;
}

.np-ad-container iframe {
    max-width: none;
}


/* ==================================================
   11. Archive article rows
   ================================================== */

.np-archive-list {
    display: grid;
    gap: 28px;
}

.np-row-card {
    display: grid;
    grid-template-columns: minmax(0, 280px) minmax(0, 1fr);
    gap: 24px;
    padding-bottom: 28px;
    border: 0;
    border-bottom: 1px solid var(--bs-border-color);
    border-radius: 0;
}

.np-row-card .np-card-visual,
.np-row-card .card-body {
    min-width: 0;
}

.np-row-card .card-body {
    padding-top: 0 !important;
}

.np-row-card .np-card-media {
    aspect-ratio: 4 / 3;
}


/* ==================================================
   12. Category / topic / author directories
   ================================================== */

.np-directory-card {
    background: var(--bs-body-bg);
    transition:
        border-color 0.2s ease,
        background-color 0.2s ease;
}

.np-directory-card:hover {
    border-color: var(--bs-primary) !important;
    background: var(--bs-tertiary-bg);
}

.np-profile-avatar {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 88px;
    height: 88px;
    border-radius: 50%;
    background: var(--bs-primary);
    color: #fff;
    font-size: 1.8rem;
    font-weight: 700;
}

.np-404-intro {
    max-width: 720px;
}


/* ==================================================
   13. Back to top
   ================================================== */

.np-back-top {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 20;
    margin: 0;
}


/* ==================================================
   14. Responsive
   ================================================== */

/* Smaller desktop */
@media (min-width: 992px) and (max-width: 1199.98px) {
    .np-header-search {
        width: 230px;
    }
}

/* Desktop sticky TOC */
@media (min-width: 992px) {
    .np-post-sidebar-column {
        position: relative;
        align-self: stretch;
    }

    .np-toc-sticky {
        position: sticky;
        top: 24px;
    }

    .np-toc-sticky .np-toc {
        max-height: calc(100vh - 48px);
        overflow-y: auto;
    }
}

/* Tablet and mobile navigation */
@media (max-width: 991.98px) {
    .np-header-tools {
        width: 100%;
        padding: 12px 0 18px;
    }

    .np-header-search {
        flex: 1;
        width: auto;
        min-width: 0;
    }

    .np-hero-large {
        height: 440px;
    }
}

/* Tablet archive */
@media (max-width: 767.98px) {
    .np-row-card {
        grid-template-columns: minmax(0, 180px) minmax(0, 1fr);
        gap: 18px;
    }
}

/* Mobile */
@media (max-width: 575.98px) {
    .np-brand {
        font-size: 1.3rem;
    }

    .np-hero-small {
        height: 280px;
    }

    .np-hero-excerpt {
        display: none;
    }

    .np-toc {
        padding: 18px;
    }

    .np-toc-sticky .np-toc {
        padding: 18px;
    }

    .np-row-card {
        grid-template-columns: 1fr;
    }
}


/* ==================================================
   15. Reduced motion
   ================================================== */

@media (prefers-reduced-motion: reduce) {
    .np-overlay-image,
    .np-card-media img,
    .np-directory-card {
        transition: none;
    }
}