.d5-page {
    padding-bottom: 48px;
}

/* cover: post image with the title over it */
.d5-cover {
    position: relative;
    height: 480px;
    margin: 0 -4px;
    overflow: hidden;
    border-radius: 0 0 20px 20px;
    background-color: var(--v5-sky-900, #0c4a6e);
}

.d5-cover-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.d5-cover-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: flex-end;
    padding: 40px 24px;
    background: linear-gradient(to top, rgba(8, 47, 73, 0.95) 0%, rgba(8, 47, 73, 0.55) 45%, rgba(8, 47, 73, 0.1) 100%);
    color: #fff;
}

.d5-cover-inner {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    width: 100%;
    max-width: 1100px;
    margin-inline: auto;
}

.d5-badge {
    padding: 4px 14px;
    border-radius: 999px;
    background-color: var(--v5-accent, #a5b4fc);
    color: var(--v5-sky-900, #0c4a6e);
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: none;
}

.d5-title {
    margin: 0;
    max-width: 900px;
    font-size: clamp(1.7rem, 4vw, 2.8rem);
    font-weight: 800;
    line-height: 1.45;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

.d5-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    color: #fff;
    font-size: 0.95rem;
}

/* author, date and reads as glass pills over the cover image */
.d5-author,
.d5-meta-item {
    padding: 5px 14px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 999px;
    background-color: rgba(255, 255, 255, 0.14);
    backdrop-filter: blur(6px);
}

.d5-author {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding-inline-start: 5px;
    font-weight: 700;
    color: #fff;
}

.d5-author-initial {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: var(--v5-sky-500, #38bdf8);
    color: #fff;
    font-weight: 800;
}

.d5-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* article and side panel */
.d5-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 28px;
    max-width: 1100px;
    margin: 32px auto 0;
    padding: 0 12px;
    align-items: start;
}

.d5-article {
    min-width: 0;
    padding: 40px 44px;
    border-radius: 18px;
    background-color: var(--mud-palette-surface);
    box-shadow: 0 6px 24px rgba(12, 74, 110, 0.08);
}

.d5-lead {
    margin: 0 0 28px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--mud-palette-lines-default);
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.9;
    color: var(--v5-sky-800, #075985);
}

/* Content comes from the CKEditor, so style its HTML for comfortable reading */
.d5-body {
    font-size: 1.1rem;
    line-height: 2.1;
    overflow-wrap: break-word;
}

    .d5-body p {
        margin: 0 0 1.2em;
    }

    .d5-body h2,
    .d5-body h3,
    .d5-body h4 {
        margin: 1.6em 0 0.6em;
        line-height: 1.5;
    }

    .d5-body h2 {
        font-size: 1.5rem;
    }

    .d5-body h3 {
        font-size: 1.25rem;
    }

    .d5-body ul,
    .d5-body ol {
        margin: 0 0 1.2em;
        padding-inline-start: 1.5em;
    }

    .d5-body img {
        display: block;
        max-width: 100%;
        height: auto;
        margin: 1.5em auto;
        border-radius: 12px;
    }

    .d5-body blockquote {
        margin: 1.6em 0;
        padding: 18px 24px;
        border-inline-start: 5px solid var(--v5-accent, #a5b4fc);
        border-radius: 10px;
        background-color: var(--mud-palette-background-gray);
        font-size: 1.15rem;
        font-style: italic;
    }

    .d5-body a {
        color: var(--v5-sky-700, #0284c7);
        text-decoration: underline;
    }

/* side panel */
.d5-aside {
    position: sticky;
    top: 84px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.d5-card {
    padding: 20px;
    border-radius: 16px;
    background-color: var(--mud-palette-surface);
    box-shadow: 0 6px 24px rgba(12, 74, 110, 0.08);
}

.d5-card-title {
    margin: 0 0 14px;
    font-size: 1rem;
    font-weight: 700;
}

.d5-share {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

    .d5-share a {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 42px;
        height: 42px;
        border-radius: 50%;
        background-color: var(--mud-palette-background-gray);
        color: var(--v5-sky-800, #075985);
        transition: background-color 0.2s ease, color 0.2s ease;
    }

        .d5-share a:hover,
        .d5-share a:focus-visible {
            background-color: var(--v5-sky-700, #0284c7);
            color: #fff;
        }

.d5-related {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.d5-related-item {
    display: grid;
    grid-template-columns: 84px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    padding: 6px;
    border-radius: 10px;
    color: inherit;
    text-decoration: none;
    transition: background-color 0.2s ease;
}

    .d5-related-item:hover,
    .d5-related-item:focus-visible {
        background-color: var(--mud-palette-background-gray);
    }

    .d5-related-item img {
        width: 84px;
        aspect-ratio: 4 / 3;
        object-fit: cover;
        border-radius: 8px;
    }

    .d5-related-item > span {
        display: flex;
        flex-direction: column;
        gap: 2px;
        min-width: 0;
    }

.d5-related-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.5;
}

.d5-related-date {
    font-size: 0.8rem;
    color: var(--mud-palette-text-secondary);
}

/* comments */
.d5-comments {
    max-width: 1100px;
    margin: 40px auto 0;
    padding: 0 12px;
}

.d5-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 18px;
    font-size: 1.4rem;
    font-weight: 800;
}

.d5-count {
    padding: 2px 12px;
    border-radius: 999px;
    background-color: var(--v5-sky-700, #0284c7);
    color: #fff;
    font-size: 0.85rem;
}

.d5-no-comments {
    margin: 0 0 20px;
    color: var(--mud-palette-text-secondary);
}

.d5-comment-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 0 0 24px;
    padding: 0;
    list-style: none;
}

.d5-comment {
    display: flex;
    gap: 14px;
    padding: 16px 18px;
    border-radius: 14px;
    background-color: var(--mud-palette-surface);
}

.d5-comment-avatar {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--v5-sky-700, #0284c7), var(--v5-sky-500, #38bdf8));
    color: #fff;
    font-weight: 800;
}

.d5-comment-body {
    min-width: 0;
}

    .d5-comment-body p {
        margin: 4px 0 0;
        line-height: 1.8;
        overflow-wrap: break-word;
    }

.d5-comment-head {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 4px 12px;
}

    .d5-comment-head span {
        font-size: 0.8rem;
        color: var(--mud-palette-text-secondary);
    }

.d5-form {
    padding: 28px;
    border-radius: 18px;
    background-color: var(--mud-palette-surface);
    box-shadow: 0 6px 24px rgba(12, 74, 110, 0.08);
}

.d5-form-title {
    margin: 0 0 16px;
    font-size: 1.15rem;
    font-weight: 700;
}

.d5-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 16px;
}

.d5-form .mud-input-control {
    margin-bottom: 10px;
}

/* An email address reads left-to-right even on Kurdish and Farsi pages */
.d5-ltr-field input {
    direction: ltr;
}

/* buttons */
.d5-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 26px;
    border: none;
    border-radius: 999px;
    background: var(--v5-button, #0284c7);
    color: #fff;
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: filter 0.2s ease;
}

    .d5-button:hover,
    .d5-button:focus-visible {
        filter: brightness(1.15);
    }

    .d5-button:disabled {
        opacity: 0.6;
        cursor: default;
    }

.d5-submit {
    align-self: flex-start;
    margin-top: 8px;
}

/* loading and not found */
.d5-loading {
    display: flex;
    justify-content: center;
    padding: 80px 0;
}

.d5-notfound {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 80px 16px;
    text-align: center;
    color: var(--mud-palette-text-secondary);
}

    .d5-notfound h1 {
        margin: 0;
        color: var(--mud-palette-text-primary);
        font-size: 1.8rem;
    }

/* side panel moves under the article */
@media (max-width: 960px) {
    .d5-layout {
        grid-template-columns: 1fr;
    }

    .d5-aside {
        position: static;
    }
}

@media (max-width: 600px) {
    .d5-cover {
        height: 380px;
        border-radius: 0 0 14px 14px;
    }

    .d5-cover-overlay {
        padding: 24px 16px;
    }

    .d5-article {
        padding: 24px 18px;
    }

    .d5-form {
        padding: 20px 16px;
    }

    .d5-form-row {
        grid-template-columns: 1fr;
    }

    .d5-submit {
        width: 100%;
    }
}
