/* ==========================================================================
   RaiDana - page shell for existing (legacy) document content
   Styles the HTML already stored in Documents.Content: .bg-article + typography.
   Loaded on document pages only (Pages/Index.cshtml), never on the home page
   and never on the article template page (see .rd-doc--modern).
   ========================================================================== */

:root {
    --rd-blue: #00349a;
    --rd-blue-dark: #0b1a44;
    --rd-orange: #ff8a00;
    --rd-cyan: #1bb1dc;
    --rd-line: #e4e9f2;
    --rd-text: #22304d;
    --rd-muted: #5b6b88;
    --rd-soft: #f5f8ff;
    --rd-radius: 18px;
    --rd-shadow: 0 2px 4px rgba(11, 26, 68, .04), 0 18px 40px rgba(11, 26, 68, .07);
}

.rd-doc--legacy {
    color: var(--rd-text);
}

/* ---- the article card ------------------------------------------------ */
.rd-doc--legacy .bg-article {
    background: #fff;
    border: 1px solid var(--rd-line);
    border-radius: var(--rd-radius);
    box-shadow: var(--rd-shadow);
    padding: 28px 26px 34px;
    /* matches the template page: its content container starts 14px under the breadcrumb */
    margin-top: 14px;
    margin-bottom: 56px;
    text-align: justify;
    font-size: 15px;
    line-height: 2.05;
    color: var(--rd-text);
}

@media (max-width: 767.98px) {
    .rd-doc--legacy .bg-article {
        padding: 20px 16px 24px;
        border-radius: 14px;
    }
}

/* ---- headings -------------------------------------------------------- */
.rd-doc--legacy .bg-article h1,
.rd-doc--legacy .bg-article h2,
.rd-doc--legacy .bg-article h3,
.rd-doc--legacy .bg-article h4 {
    font-weight: 800;
    color: var(--rd-blue-dark);
    line-height: 1.7;
    margin: 0 0 16px;
    padding: 0;
}

.rd-doc--legacy .bg-article > h1:first-child,
.rd-doc--legacy .bg-article > h2:first-child,
.rd-doc--legacy .bg-article > h3:first-child {
    padding-bottom: 14px;
    margin-bottom: 22px;
    border-bottom: 1px solid var(--rd-line);
    position: relative;
}

.rd-doc--legacy .bg-article > h1:first-child:after,
.rd-doc--legacy .bg-article > h2:first-child:after,
.rd-doc--legacy .bg-article > h3:first-child:after {
    content: "";
    position: absolute;
    inset-inline-start: 0;
    bottom: -1px;
    width: 72px;
    height: 3px;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--rd-blue) 70%, var(--rd-orange) 70%);
}

.rd-doc--legacy .bg-article h1 { font-size: 1.6rem; }

.rd-doc--legacy .bg-article h2 {
    font-size: 1.22rem;
    margin: 34px 0 14px;
    padding-inline-start: 13px;
    border-inline-start: 4px solid var(--rd-blue);
}

.rd-doc--legacy .bg-article h3 {
    font-size: 1.06rem;
    margin: 26px 0 12px;
    padding-inline-start: 13px;
    border-inline-start: 4px solid var(--rd-orange);
}

.rd-doc--legacy .bg-article h4 { font-size: 1rem; margin: 22px 0 10px; }

/* inline font-size spans inside old headings */
.rd-doc--legacy .bg-article h1 span,
.rd-doc--legacy .bg-article h2 span,
.rd-doc--legacy .bg-article h3 span { font-size: inherit !important; }

/* ---- text, lists, links --------------------------------------------- */
.rd-doc--legacy .bg-article p,
.rd-doc--legacy .bg-article li {
    font-size: 15px;
    line-height: 2.05;
    color: var(--rd-text);
}

.rd-doc--legacy .bg-article p { margin-bottom: 18px; }

.rd-doc--legacy .bg-article > p:last-child { margin-bottom: 0; }

.rd-doc--legacy .bg-article ul,
.rd-doc--legacy .bg-article ol {
    margin: 0 0 20px;
    padding-inline-start: 22px;
}

.rd-doc--legacy .bg-article li { margin-bottom: 8px; }

.rd-doc--legacy .bg-article li::marker { color: var(--rd-blue); }

.rd-doc--legacy .bg-article a {
    color: #0b5fbf;
    text-decoration: none;
    border-bottom: 1px solid rgba(11, 95, 191, .25);
    transition: color .2s, border-color .2s;
}

.rd-doc--legacy .bg-article a:hover {
    color: var(--rd-orange);
    border-bottom-color: rgba(255, 138, 0, .5);
}

.rd-doc--legacy .bg-article strong { font-weight: 800; color: var(--rd-blue-dark); }

/* ---- media ----------------------------------------------------------- */
.rd-doc--legacy .bg-article img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
}

.rd-doc--legacy .bg-article .bg-article-img { margin: 26px 0; }

.rd-doc--legacy .bg-article iframe {
    max-width: 100%;
    border: 0;
    border-radius: 12px;
}

.rd-doc--legacy .bg-article figure { margin: 24px 0; }

.rd-doc--legacy .bg-article figcaption {
    font-size: 13px;
    color: var(--rd-muted);
    text-align: center;
    margin-top: 8px;
}

/* ---- tables ---------------------------------------------------------- */
.rd-doc--legacy .bg-article table {
    width: 100%;
    border-collapse: collapse;
    margin: 22px 0;
    font-size: 14px;
    background: #fff;
}

.rd-doc--legacy .bg-article table th,
.rd-doc--legacy .bg-article table td {
    border: 1px solid var(--rd-line);
    padding: 10px 12px;
    line-height: 1.9;
    vertical-align: middle;
}

.rd-doc--legacy .bg-article table th {
    background: var(--rd-soft);
    color: var(--rd-blue-dark);
    font-weight: 800;
}

.rd-doc--legacy .bg-article table tr:nth-child(even) td { background: #fbfcff; }

.rd-doc--legacy .bg-article .table-responsive { margin: 22px 0; }

/* ---- callouts / cards ------------------------------------------------ */
.rd-doc--legacy .bg-article .alert {
    border: 1px solid var(--rd-line);
    border-inline-start: 4px solid var(--rd-cyan);
    border-radius: 12px;
    background: var(--rd-soft);
    color: var(--rd-text);
    padding: 14px 18px;
    margin: 22px 0;
    font-size: 14.5px;
    line-height: 2;
}

.rd-doc--legacy .bg-article .alert a { border-bottom: 0; font-weight: 700; }

.rd-doc--legacy .bg-article blockquote {
    margin: 22px 0;
    padding: 16px 20px;
    background: #fff8ef;
    border-inline-start: 4px solid var(--rd-orange);
    border-radius: 12px;
    color: #6b4a1d;
}

.rd-doc--legacy .bg-article .card {
    border: 1px solid var(--rd-line);
    border-radius: 14px;
    box-shadow: none;
    margin-bottom: 20px;
}

.rd-doc--legacy .bg-article .card-body { padding: 18px 20px; }

.rd-doc--legacy .bg-article hr {
    border: 0;
    border-top: 1px solid var(--rd-line);
    margin: 26px 0;
}

.rd-doc--legacy .bg-article .btn {
    border-radius: 10px;
    padding: 9px 20px;
    font-weight: 700;
    border: 0;
}

.rd-doc--legacy .bg-article .btn.bg-darkish-blue,
.rd-doc--legacy .bg-article .btn.btn-primary {
    background: var(--rd-blue) !important;
}

.rd-doc--legacy .bg-article .btn.bg-darkish-blue:hover,
.rd-doc--legacy .bg-article .btn.btn-primary:hover {
    background: var(--rd-blue-dark) !important;
}

/* ==========================================================================
   Article layout
   The main column keeps the template width (1140px) and stays horizontally
   centered. Secondary blocks ("other articles", ...) move into the free left
   margin only when the viewport is wide enough; otherwise they stack under the
   article exactly like on mobile.
   The markup comes from Documents.Content, so the row is re-flowed with CSS.
   ========================================================================== */
@media (min-width: 992px) {
    /* 1140px of content + the container's own 15px gutters */
    .rd-doc--article > .container,
    .rd-breadcrumb--article,
    .rd-doc--article + .comments-section {
        max-width: 1170px;
    }

    .rd-doc--article > .container {
        position: relative;
    }

    /* main takes the whole column, secondary blocks leave the flow */
    .rd-doc--article > .container > .row {
        display: block;
        margin-left: 0;
        margin-right: 0;
    }

    .rd-doc--article > .container > .row > .col-lg-9 {
        width: 100%;
        max-width: 100%;
        padding-left: 0;
        padding-right: 0;
    }

    .rd-doc--article > .container > .row > .col-lg-3 {
        width: 100%;
        max-width: 420px;
        padding-left: 0;
        padding-right: 0;
        margin-top: 24px !important;
    }
}

/* Below 992px the side column is hidden by `.d-none d-lg-block` in the markup;
   show it stacked underneath so no content is lost on small screens. */
@media (max-width: 991.98px) {
    .rd-doc--article .col-lg-3.d-none.d-lg-block {
        display: block !important;
        margin-top: 24px !important;
    }

    .rd-doc--article .other-article {
        max-width: 420px;
    }
}

/* Wide screens only: the side column sits in the left margin beside the article.
   Needs 284px of free margin on each side: 1140 + 2 * 284. */
@media (min-width: 1740px) {
    .rd-doc--article > .container > .row > .col-lg-3 {
        position: absolute;
        top: 28px;
        /* in the left margin, but never closer than 24px to the viewport edge */
        left: max(-284px, calc((1170px - 100vw) / 2 + 24px));
        width: 260px;
        max-width: 260px;
        margin: 0 !important;
    }
}

/* ---- shared component wrapper --------------------------------------- */
/* The template page owns its own look; the wrapper must not add anything. */
.rd-doc--modern { display: block; }

/* ==========================================================================
   Content kit (phase 3)
   Scoped to the list grid (#document-list) ONLY, so the "latest articles"
   blocks (#latestdocuments / #random-category-documents) and horizontal cards
   keep their original layout.
   ========================================================================== */
.rd-doc--legacy #document-list .document-item {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    background: #fff;
    border: 1px solid var(--rd-line);
    border-radius: 16px;
    overflow: hidden;
    transition: box-shadow .2s, transform .2s, border-color .2s;
}

.rd-doc--legacy #document-list .document-item:hover {
    transform: translateY(-3px);
    border-color: #d6e0f2;
    box-shadow: 0 16px 34px rgba(11, 26, 68, .1);
}

.rd-doc--legacy #document-list .document-item .desc-img {
    width: 100%;
    max-width: none;
    height: auto;
    aspect-ratio: 16 / 9;
    background-color: #eef2f9;
}

.rd-doc--legacy #document-list .desc-document,
.rd-doc--legacy #document-list .desc-article {
    flex: 1;
    max-width: none;
    height: auto;
    min-height: 0;
    margin: 0;
    padding: 16px 18px 18px;
    border: 0;
    border-radius: 0;
    box-shadow: none !important;
    z-index: auto;
}

.rd-doc--legacy #document-list .desc-document h3,
.rd-doc--legacy #document-list .desc-article h3 {
    height: auto;
    min-height: 0;
    font-size: 15.5px;
    font-weight: 800;
    line-height: 1.8;
    margin: 0 0 8px;
}

.rd-doc--legacy #document-list .desc-document h3 a,
.rd-doc--legacy #document-list .desc-article h3 a {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.rd-doc--legacy #document-list .desc-document p,
.rd-doc--legacy #document-list .desc-article p {
    font-size: 13.5px;
    line-height: 1.95;
    color: #4a5a78;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.rd-doc--legacy #document-list .desc-hover:hover .desc-img:after { display: none; }

.rd-doc--legacy #document-list .desc-hover hr {
    width: 100%;
    margin: 10px 0 12px;
    opacity: .45;
}

.rd-doc--legacy #document-list .document-item .auther-icon,
.rd-doc--legacy #document-list .document-item .datetime-icon {
    width: 11px;
    height: 11px;
    opacity: .7;
}

.rd-doc--legacy .cover-articles {
    position: relative;
    background-color: #0b1a44;
}

.rd-doc--legacy .last-article {
    border-radius: 16px;
    overflow: hidden;
    background-position: center;
    background-size: cover;
}

.rd-doc--legacy .cover-articles:after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(11, 26, 68, .15) 0%, rgba(11, 26, 68, .65) 100%);
    pointer-events: none;
}

.rd-doc--legacy .cover-articles h1,
.rd-doc--legacy .cover-articles h2,
.rd-doc--legacy .cover-articles h3 {
    position: relative;
    z-index: 1;
    font-weight: 800;
    letter-spacing: -.3px;
    text-shadow: 0 2px 14px rgba(0, 0, 0, .35);
}

.rd-doc--legacy .other-article {
    height: auto;
    min-height: 52px;
    align-items: center;
    margin-bottom: 6px;
    border-radius: 10px;
    background: #f5f8ff;
    border: 1px solid transparent;
    transition: background .2s, border-color .2s;
}

.rd-doc--legacy .other-article:hover {
    background: #fff;
    border-color: var(--rd-line);
}

.rd-doc--legacy .other-article .title-other {
    line-height: 1.7;
    padding: 8px 6px;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.rd-doc--legacy .other-article .img-other {
    width: 40px;
    height: 40px;
    margin: 6px 0;
    object-fit: contain;
}

.rd-doc--legacy #document-list { padding-top: 26px; }

.rd-doc--legacy .cover-articles { max-height: 300px; overflow: hidden; }
