/* ===== /posts page ===== */
.plist-area {
    --pl-bg: #f6f5fa;
    --pl-surface: #ffffff;
    --pl-surface-2: #f3f2f8;
    --pl-border: rgba(16, 12, 40, 0.08);
    --pl-text: #1f1d2b;
    --pl-muted: #6b6880;
    --pl-accent: var(--color-primary, #49108b);
    --pl-accent-soft: rgba(73, 16, 139, 0.1);
    padding: 32px 0 72px;
    background: var(--pl-bg);
    color: var(--pl-text);
}

body.active-dark-mode .plist-area {
    --pl-bg: #111116;
    --pl-surface: #1d1d24;
    --pl-surface-2: #26262f;
    --pl-border: rgba(255, 255, 255, 0.08);
    --pl-text: #f3f3f6;
    --pl-muted: #a3a1b3;
    --pl-accent: #a98bf5;
    --pl-accent-soft: rgba(169, 139, 245, 0.14);
}

.plist-area a:focus-visible,
.plist-area button:focus-visible,
.plist-area input:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--pl-accent) 45%, transparent);
    outline-offset: 2px;
}

/* Digits in Persian: the theme's heading font has Latin ones */
.plist-count,
.plist-meta,
.plist-meta *:not(i), /* not the <i> icons: they need the Font Awesome font */
.plist-rank,
.plist-popular-meta,
.plist-pagination {
    font-family: Dana, Dana-fallback, Tahoma, sans-serif;
}

/* ----- Header ----- */
.plist-head {
    margin-bottom: 18px;
}

.plist-breadcrumb {
    display: flex;
    gap: 8px;
    margin-bottom: 6px;
    color: var(--pl-muted);
    font-size: 13px;
}

.plist-area .plist-breadcrumb a {
    color: var(--pl-muted);
}

.plist-area .plist-breadcrumb a:hover {
    color: var(--pl-accent);
}

.plist-title {
    margin: 0 0 6px;
    color: var(--pl-text);
    font-size: 32px;
    font-weight: 800;
}

.plist-subtitle {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    margin: 0;
    color: var(--pl-muted);
    font-size: 15px;
}

.plist-count {
    padding: 2px 12px;
    border-radius: 999px;
    background: var(--pl-accent-soft);
    color: var(--pl-accent);
    font-size: 13px;
    font-weight: 700;
}

/* ----- Section tabs ----- */
.plist-sections {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    padding-bottom: 4px;
    overflow-x: auto;
    scrollbar-width: none;
}

.plist-sections::-webkit-scrollbar {
    display: none;
}

.plist-sections a {
    display: inline-flex;
    flex: none;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    border: 1px solid var(--pl-border);
    border-radius: 12px;
    background: var(--pl-surface);
    color: var(--pl-text);
    font-size: 14px;
    font-weight: 700;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.plist-sections a:hover {
    border-color: var(--pl-accent);
    color: var(--pl-text);
}

.plist-area .plist-sections a.is-active {
    border-color: var(--pl-accent);
    background: var(--pl-accent);
    color: #fff;
}

body.active-dark-mode .plist-area .plist-sections a.is-active {
    background: #6d3fd1;
    border-color: #6d3fd1;
}

/* ----- Layout ----- */
.plist-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
}

/* Grid items default to min-width: auto, so the unwrapped sort row would
   stretch the column past the screen on phones */
.plist-main,
.plist-side {
    min-width: 0;
}

@media (min-width: 992px) {
    .plist-layout {
        grid-template-columns: minmax(0, 1fr) 340px;
        align-items: start;
    }

    .plist-side {
        position: sticky;
        top: 96px; /* below the sticky header */
    }
}

/* ----- Toolbar (sort) ----- */
.plist-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.plist-toolbar-label {
    flex: none;
    color: var(--pl-muted);
    font-size: 14px;
}

.plist-sorts {
    display: flex;
    gap: 6px;
    padding-bottom: 2px;
    overflow-x: auto;
    scrollbar-width: none;
}

.plist-sorts::-webkit-scrollbar {
    display: none;
}

.plist-sorts a {
    display: inline-flex;
    flex: none;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 999px;
    color: var(--pl-muted);
    font-size: 13px;
    font-weight: 600;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.plist-sorts a:hover {
    background: var(--pl-surface);
    color: var(--pl-text);
}

.plist-area .plist-sorts a.is-active {
    background: var(--pl-accent-soft);
    color: var(--pl-accent);
}

/* ----- Post cards ----- */
.plist-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.plist-card {
    position: relative;
    display: grid;
    grid-template-columns: 1fr;
    overflow: hidden;
    border: 1px solid var(--pl-border);
    border-radius: 18px;
    background: var(--pl-surface);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.plist-card:hover,
.plist-card:focus-within {
    border-color: color-mix(in srgb, var(--pl-accent) 30%, transparent);
    box-shadow: 0 16px 32px rgba(16, 12, 40, 0.08);
    transform: translateY(-2px);
}

.plist-thumb {
    position: relative;
    display: block;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--pl-border);
}

.plist-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.plist-card:hover .plist-thumb img {
    transform: scale(1.04);
}

.plist-type {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    color: #1f1d2b;
    font-size: 12px;
    font-weight: 700;
}

.plist-type--news { color: #c2410c; }
.plist-type--tutorial { color: #1d4ed8; }
.plist-type--package { color: #7e22ce; }
.plist-type--video { color: #be123c; }

.plist-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    padding: 16px 18px 18px;
}

.plist-cats {
    position: relative;
    z-index: 2;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.plist-cats a {
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--pl-accent-soft);
    font-size: 12px;
    font-weight: 700;
    direction: ltr;
}

.plist-area .plist-cats a {
    color: var(--pl-accent);
}

.plist-name {
    display: -webkit-box;
    margin: 0;
    overflow: hidden;
    font-size: 18px;
    font-weight: 800;
    line-height: 1.7;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.plist-area .plist-name a {
    color: var(--pl-text);
}

/* The whole card opens the post */
.plist-name a::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
}

.plist-area .plist-card:hover .plist-name a {
    color: var(--pl-accent);
}

.plist-name a:focus-visible {
    outline: none;
}

.plist-card:has(.plist-name a:focus-visible) {
    outline: 3px solid color-mix(in srgb, var(--pl-accent) 45%, transparent);
    outline-offset: 2px;
}

.plist-excerpt {
    display: -webkit-box;
    margin: 0;
    overflow: hidden;
    color: var(--pl-muted);
    font-size: 14px;
    line-height: 1.9;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.plist-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
    margin-top: auto;
    padding-top: 6px;
    color: var(--pl-muted);
    font-size: 13px;
}

.plist-author {
    position: relative;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
}

.plist-area .plist-author {
    color: var(--pl-text);
}

.plist-area .plist-author:hover {
    color: var(--pl-accent);
}

.plist-author img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}

.plist-meta-items {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px 14px;
}

.plist-meta-items i {
    margin-left: 2px;
}

/* Tablet and up: image beside the text */
@media (min-width: 640px) {
    .plist-card {
        grid-template-columns: 260px minmax(0, 1fr);
        align-items: center;
        padding: 12px;
    }

    /* Stay 16:9: thumbnails carry their own title text, so never crop them */
    .plist-thumb {
        border-radius: 12px;
    }

    .plist-body {
        padding: 6px 18px 6px 6px;
    }
}

@media (min-width: 1200px) {
    .plist-card {
        grid-template-columns: 300px minmax(0, 1fr);
    }
}

.plist-empty {
    padding: 48px 16px;
    border: 2px dashed var(--pl-border);
    border-radius: 18px;
    color: var(--pl-muted);
    text-align: center;
}

.plist-empty span {
    font-size: 40px;
}

.plist-pagination {
    margin-top: 28px;
}

/* ----- Sidebar ----- */
.plist-side {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.plist-widget {
    padding: 18px;
    border: 1px solid var(--pl-border);
    border-radius: 18px;
    background: var(--pl-surface);
}

.plist-widget-title {
    margin: 0 0 14px;
    color: var(--pl-text);
    font-size: 16px;
    font-weight: 800;
}

.plist-search {
    display: flex;
    align-items: center;
    padding: 4px;
    border: 1px solid var(--pl-border);
    border-radius: 12px;
    background: var(--pl-surface-2);
}

.plist-search:focus-within {
    border-color: var(--pl-accent);
    box-shadow: 0 0 0 4px var(--pl-accent-soft);
}

.plist-search input {
    flex: 1;
    min-width: 0;
    height: 40px;
    padding: 0 10px;
    border: 0;
    background: transparent;
    color: var(--pl-text);
    font-size: 14px;
}

.plist-search input:focus {
    outline: none;
}

.plist-search button {
    width: 40px;
    min-width: 40px;
    height: 40px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: var(--pl-accent);
    color: #fff;
}

body.active-dark-mode .plist-search button {
    background: #6d3fd1;
}

/* The themed pages keep their own colour in dark mode (light accent, dark icon) */
body.active-dark-mode .plist-area--tutorial .plist-search button,
body.active-dark-mode .plist-area--package .plist-search button,
body.active-dark-mode .plist-area--news .plist-search button {
    background: var(--pl-accent);
    color: #111116;
}

.plist-popular {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.plist-popular li {
    margin: 0;
}

.plist-popular a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 12px;
    transition: background-color 0.15s ease;
}

.plist-popular a:hover {
    background: var(--pl-surface-2);
}

.plist-rank {
    flex: none;
    width: 22px;
    color: var(--pl-accent);
    font-size: 18px;
    font-weight: 800;
    text-align: center;
}

.plist-popular li:nth-child(n + 4) .plist-rank {
    color: var(--pl-muted);
}

.plist-popular-thumb {
    flex: none;
    width: 76px;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 8px;
    background: var(--pl-border);
}

.plist-popular-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.plist-popular-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.plist-popular-title {
    display: -webkit-box;
    overflow: hidden;
    color: var(--pl-text);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.7;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.plist-popular a:hover .plist-popular-title {
    color: var(--pl-accent);
}

.plist-popular-meta {
    color: var(--pl-muted);
    font-size: 12px;
}

.plist-socials {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.plist-socials li {
    margin: 0;
}

.plist-socials a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border: 1px solid var(--pl-border);
    border-radius: 12px;
    background: var(--pl-surface-2);
    font-size: 16px;
    transition: border-color 0.15s ease, color 0.15s ease;
}

.plist-area .plist-socials a {
    color: var(--pl-muted);
}

.plist-area .plist-socials a:hover {
    border-color: var(--pl-accent);
    color: var(--pl-accent);
}

.plist-ads {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.plist-ads-label {
    color: var(--pl-muted);
    font-size: 11px;
}

.plist-ads img {
    display: block;
    width: 100%;
    border-radius: 12px;
}

@media (max-width: 575px) {
    .plist-area {
        padding-top: 20px;
    }

    .plist-title {
        font-size: 26px;
    }

    .plist-name {
        font-size: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .plist-card,
    .plist-thumb img,
    .plist-sections a,
    .plist-sorts a,
    .plist-popular a {
        transition: none;
    }

    .plist-card:hover,
    .plist-card:focus-within,
    .plist-card:hover .plist-thumb img {
        transform: none;
    }
}

/* =====================================================================
   Page variants: /tutorials (learning grid) and /packages (registry list)
   ===================================================================== */
.plist-area--tutorial {
    --pl-accent: #0f766e;
    --pl-accent-soft: rgba(15, 118, 110, 0.1);
}

body.active-dark-mode .plist-area--tutorial {
    --pl-accent: #2dd4bf;
    --pl-accent-soft: rgba(45, 212, 191, 0.13);
}

.plist-area--package {
    --pl-accent: #b45309;
    --pl-accent-soft: rgba(180, 83, 9, 0.1);
}

body.active-dark-mode .plist-area--package {
    --pl-accent: #fbbf24;
    --pl-accent-soft: rgba(251, 191, 36, 0.13);
}

/* Header becomes a tinted banner with a soft pattern */
.plist-area--tutorial .plist-head,
.plist-area--package .plist-head,
.plist-area--news .plist-head {
    position: relative;
    overflow: hidden;
    padding: 28px 28px 26px;
    border: 1px solid color-mix(in srgb, var(--pl-accent) 18%, transparent);
    border-radius: 22px;
    background:
        radial-gradient(circle at 12% 20%, color-mix(in srgb, var(--pl-accent) 16%, transparent) 0, transparent 45%),
        linear-gradient(135deg, color-mix(in srgb, var(--pl-accent) 9%, var(--pl-surface)), var(--pl-surface));
}

.plist-area--tutorial .plist-head::after,
.plist-area--package .plist-head::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(color-mix(in srgb, var(--pl-accent) 22%, transparent) 1px, transparent 1px);
    background-size: 18px 18px;
    -webkit-mask-image: linear-gradient(to left, transparent 35%, #000);
    mask-image: linear-gradient(to left, transparent 35%, #000);
    pointer-events: none;
}

.plist-area--package .plist-head::after {
    /* Packages: a grid of little "boxes" instead of dots */
    background-image:
        linear-gradient(color-mix(in srgb, var(--pl-accent) 14%, transparent) 1px, transparent 1px),
        linear-gradient(90deg, color-mix(in srgb, var(--pl-accent) 14%, transparent) 1px, transparent 1px);
    background-size: 22px 22px;
}

.plist-area--tutorial .plist-head > *,
.plist-area--package .plist-head > *,
.plist-area--news .plist-head > * {
    position: relative;
    z-index: 1;
}

.plist-area--tutorial .plist-sorts a.is-active,
.plist-area--package .plist-sorts a.is-active,
.plist-area--news .plist-sorts a.is-active {
    background: var(--pl-accent-soft);
    color: var(--pl-accent);
}

/* ----- Tutorials: two-column grid of lesson tiles ----- */
.plist-list--tutorial {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
}

@media (min-width: 640px) {
    .plist-list--tutorial {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.tcard {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--pl-border);
    border-radius: 18px;
    background: var(--pl-surface);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.tcard:hover,
.tcard:focus-within {
    border-color: color-mix(in srgb, var(--pl-accent) 40%, transparent);
    box-shadow: 0 18px 36px color-mix(in srgb, var(--pl-accent) 14%, transparent);
    transform: translateY(-3px);
}

.tcard-thumb {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--pl-surface-2);
}

.tcard-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.tcard:hover .tcard-thumb img {
    transform: scale(1.04);
}

.tcard-time {
    position: absolute;
    right: 12px;
    bottom: 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.94);
    color: #0f766e;
    font-family: Dana, Dana-fallback, Tahoma, sans-serif;
    font-size: 12px;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.tcard-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 8px;
    padding: 16px 18px 18px;
}

.tcard-cats {
    position: relative;
    z-index: 2;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tcard-cats a {
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--pl-accent-soft);
    font-size: 12px;
    font-weight: 600;
}

.plist-area .tcard-cats a {
    color: var(--pl-accent);
}

.tcard-name {
    margin: 0;
    font-size: 17px;
    font-weight: 800;
    line-height: 1.75;
}

.plist-area .tcard-name a {
    color: var(--pl-text);
}

.tcard-name a::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
}

.plist-area .tcard:hover .tcard-name a {
    color: var(--pl-accent);
}

.tcard-name a:focus-visible {
    outline: none;
}

.tcard:has(.tcard-name a:focus-visible) {
    outline: 3px solid color-mix(in srgb, var(--pl-accent) 45%, transparent);
    outline-offset: 2px;
}

.tcard-excerpt {
    display: -webkit-box;
    margin: 0;
    overflow: hidden;
    color: var(--pl-muted);
    font-size: 14px;
    line-height: 1.9;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.tcard-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px dashed var(--pl-border);
}

.tcard-author {
    position: relative;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    font-size: 13px;
    font-weight: 700;
}

.plist-area .tcard-author {
    color: var(--pl-text);
}

.tcard-author img {
    flex: none;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    object-fit: cover;
}

.tcard-author span {
    display: flex;
    flex-direction: column;
    line-height: 1.5;
}

.tcard-author small {
    color: var(--pl-muted);
    font-family: Dana, Dana-fallback, Tahoma, sans-serif;
    font-size: 11px;
    font-weight: 500;
}

.tcard-cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--pl-accent);
    font-size: 13px;
    font-weight: 800;
}

.tcard-cta i {
    transition: transform 0.2s ease;
}

.tcard:hover .tcard-cta i {
    transform: translateX(-4px);
}

/* ----- Packages: compact registry rows ----- */
.plist-list--package {
    gap: 12px;
}

.kcard {
    position: relative;
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 16px 18px;
    border: 1px solid var(--pl-border);
    border-right: 4px solid var(--pl-accent);
    border-radius: 14px;
    background: var(--pl-surface);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.kcard:hover,
.kcard:focus-within {
    border-color: color-mix(in srgb, var(--pl-accent) 45%, transparent);
    border-right-color: var(--pl-accent);
    background: color-mix(in srgb, var(--pl-accent) 4%, var(--pl-surface));
    box-shadow: 0 10px 24px rgba(16, 12, 40, 0.06);
}

.kcard-icon {
    flex: none;
    width: 72px;
    height: 72px;
    overflow: hidden;
    border: 1px solid var(--pl-border);
    border-radius: 16px;
    background: var(--pl-surface-2);
}

.kcard-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.kcard-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.kcard-name {
    margin: 0;
    font-size: 16px;
    font-weight: 800;
    line-height: 1.7;
}

.plist-area .kcard-name a {
    color: var(--pl-text);
}

.kcard-name a::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
}

.plist-area .kcard:hover .kcard-name a {
    color: var(--pl-accent);
}

.kcard-name a:focus-visible {
    outline: none;
}

.kcard:has(.kcard-name a:focus-visible) {
    outline: 3px solid color-mix(in srgb, var(--pl-accent) 45%, transparent);
    outline-offset: 2px;
}

.kcard-desc {
    display: -webkit-box;
    margin: 0;
    overflow: hidden;
    color: var(--pl-muted);
    font-size: 14px;
    line-height: 1.8;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.kcard-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 16px;
    margin-top: 2px;
}

.kcard-tags {
    position: relative;
    z-index: 2;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* Language-style badges: a coloured dot + name, like a package registry */
.kcard-tags a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 9px;
    border: 1px solid var(--pl-border);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    direction: ltr;
}

.plist-area .kcard-tags a {
    color: var(--pl-text);
}

.plist-area .kcard-tags a:hover {
    border-color: var(--pl-accent);
    color: var(--pl-accent);
}

.kcard-tags a span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--pl-accent);
}

.kcard-tags a:nth-child(2) span { background: #2563eb; }
.kcard-tags a:nth-child(3) span { background: #16a34a; }

.kcard-meta {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px 14px;
    color: var(--pl-muted);
    font-size: 12px;
}

.kcard-meta,
.kcard-meta *:not(i) {
    font-family: Dana, Dana-fallback, Tahoma, sans-serif;
}

.kcard-meta i {
    margin-left: 3px;
}

.kcard-author {
    position: relative;
    z-index: 2;
}

.plist-area .kcard-author {
    color: var(--pl-muted);
}

.plist-area .kcard-author:hover {
    color: var(--pl-accent);
}

.kcard-go {
    display: inline-flex;
    flex: none;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid color-mix(in srgb, var(--pl-accent) 35%, transparent);
    border-radius: 10px;
    color: var(--pl-accent);
    font-size: 13px;
    font-weight: 800;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.kcard:hover .kcard-go {
    background: var(--pl-accent);
    color: #fff;
}

body.active-dark-mode .kcard:hover .kcard-go {
    color: #1a1206;
}

@media (max-width: 767px) {
    .kcard {
        align-items: flex-start;
        gap: 14px;
        padding: 14px;
    }

    .kcard-icon {
        width: 56px;
        height: 56px;
        border-radius: 12px;
    }

    .kcard-go {
        display: none;
    }
}

@media (max-width: 575px) {
    .plist-area--tutorial .plist-head,
    .plist-area--package .plist-head,
    .plist-area--news .plist-head {
        padding: 20px 18px;
        border-radius: 18px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tcard,
    .tcard-thumb img,
    .tcard-cta i,
    .kcard,
    .kcard-go {
        transition: none;
    }

    .tcard:hover,
    .tcard:focus-within,
    .tcard:hover .tcard-thumb img {
        transform: none;
    }
}

/* ----- News: a magazine front page (red accent, newspaper rules) ----- */
.plist-area--news {
    --pl-accent: #be123c;
    --pl-accent-soft: rgba(190, 18, 60, 0.09);
}

body.active-dark-mode .plist-area--news {
    --pl-accent: #fb7185;
    --pl-accent-soft: rgba(251, 113, 133, 0.13);
}

/* Banner: the same tinted banner as tutorials/packages, with faint newspaper lines */
.plist-area--news .plist-head::after {
    background-image: repeating-linear-gradient(0deg, color-mix(in srgb, var(--pl-text) 6%, transparent) 0 1px, transparent 1px 9px);
    -webkit-mask-image: linear-gradient(to left, transparent 45%, #000);
    mask-image: linear-gradient(to left, transparent 45%, #000);
}

.plist-list--news {
    gap: 0;
    overflow: hidden;
    border: 1px solid var(--pl-border);
    border-radius: 18px;
    background: var(--pl-surface);
}

.ncard {
    position: relative;
    display: flex;
    gap: 18px;
    padding: 18px 20px;
    transition: background-color 0.2s ease;
}

.ncard + .ncard {
    border-top: 1px solid var(--pl-border);
}

.ncard:hover,
.ncard:focus-within {
    background: color-mix(in srgb, var(--pl-accent) 4%, var(--pl-surface));
}

/* Small rows: the picture sits at the end, the headline leads */
.ncard:not(.ncard--lead) .ncard-thumb {
    order: 2;
    flex: none;
    width: 200px;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    border-radius: 10px;
    background: var(--pl-surface-2);
}

.ncard-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.ncard:hover .ncard-thumb img {
    transform: scale(1.04);
}

.ncard-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.ncard-kicker {
    position: relative;
    z-index: 2;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    color: var(--pl-muted);
    font-family: Dana, Dana-fallback, Tahoma, sans-serif;
    font-size: 12px;
}

.plist-area .ncard-kicker a {
    color: var(--pl-accent);
    font-weight: 800;
    letter-spacing: 0.02em;
}

.plist-area .ncard-kicker a:hover {
    text-decoration: underline;
}

.ncard-name {
    margin: 0;
    font-size: 18px;
    font-weight: 800;
    line-height: 1.7;
}

.plist-area .ncard-name a {
    color: var(--pl-text);
}

.ncard-name a::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
}

.plist-area .ncard:hover .ncard-name a {
    color: var(--pl-accent);
}

.ncard-name a:focus-visible {
    outline: none;
}

.ncard:has(.ncard-name a:focus-visible) {
    outline: 3px solid color-mix(in srgb, var(--pl-accent) 45%, transparent);
    outline-offset: -3px;
}

.ncard-excerpt {
    display: -webkit-box;
    margin: 0;
    overflow: hidden;
    color: var(--pl-muted);
    font-size: 14px;
    line-height: 1.9;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.ncard-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 14px;
    margin-top: auto;
    padding-top: 4px;
    color: var(--pl-muted);
    font-size: 12px;
}

.ncard-meta,
.ncard-meta *:not(i) {
    font-family: Dana, Dana-fallback, Tahoma, sans-serif;
}

.ncard-meta i {
    margin-left: 3px;
}

.ncard-author {
    position: relative;
    z-index: 2;
    font-weight: 700;
}

.plist-area .ncard-author {
    color: var(--pl-text);
}

.plist-area .ncard-author:hover {
    color: var(--pl-accent);
}

/* Lead story: big picture on top, large headline */
.ncard--lead {
    flex-direction: column;
    gap: 0;
    padding: 0;
    border-bottom: 3px solid var(--pl-text);
}

.ncard--lead .ncard-thumb {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--pl-surface-2);
}

.ncard--lead .ncard-body {
    gap: 8px;
    padding: 18px 22px 22px;
}

.ncard--lead .ncard-name {
    font-size: 26px;
    line-height: 1.6;
}

.ncard--lead .ncard-excerpt {
    font-size: 15px;
    -webkit-line-clamp: 3;
}

.ncard-flag {
    position: absolute;
    top: 14px;
    right: 14px;
    padding: 4px 12px;
    border-radius: 4px;
    background: var(--pl-accent);
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.03em;
}

body.active-dark-mode .ncard-flag {
    color: #2a0610;
}

@media (max-width: 575px) {
    .ncard {
        gap: 12px;
        padding: 14px;
    }

    .ncard:not(.ncard--lead) .ncard-thumb {
        width: 96px;
        aspect-ratio: 1;
    }

    .ncard-name {
        font-size: 15px;
    }

    .ncard:not(.ncard--lead) .ncard-excerpt {
        display: none;
    }

    .ncard--lead .ncard-body {
        padding: 14px 16px 18px;
    }

    .ncard--lead .ncard-name {
        font-size: 20px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ncard,
    .ncard-thumb img {
        transition: none;
    }

    .ncard:hover .ncard-thumb img {
        transform: none;
    }
}

/* =====================================================================
   Sponsored (native ad) card inside the listings: same shape as the
   cards around it, with a clear "تبلیغ" label and a faint tint
   ===================================================================== */
.is-sponsored {
    --pl-sponsor: #b45309;
}

body.active-dark-mode .is-sponsored {
    --pl-sponsor: #fbbf24;
}

.plist-card.is-sponsored,
.tcard.is-sponsored,
.kcard.is-sponsored,
.ncard.is-sponsored {
    background: color-mix(in srgb, var(--pl-sponsor) 5%, var(--pl-surface));
}

.kcard.is-sponsored {
    border-right-color: var(--pl-sponsor);
}

/* The ad title is a <p> (ads stay out of the heading outline); look like the post titles */
.is-sponsored :is(.plist-name, .tcard-name, .kcard-name, .ncard-name) {
    margin: 0;
    font-family: inherit;
}

.sponsored-badge {
    align-self: flex-start;
    padding: 1px 9px;
    border: 1px solid color-mix(in srgb, var(--pl-sponsor) 40%, transparent);
    border-radius: 999px;
    background: color-mix(in srgb, var(--pl-sponsor) 12%, transparent);
    color: var(--pl-sponsor);
    font-family: Dana, Dana-fallback, Tahoma, sans-serif;
    font-size: 11px;
    font-weight: 800;
    line-height: 1.8;
}

.sponsored-by {
    color: var(--pl-muted);
    font-family: Dana, Dana-fallback, Tahoma, sans-serif;
    font-size: 12px;
}

.kcard.is-sponsored .kcard-foot {
    align-items: center;
    gap: 10px;
}
