/* ---------------------------------------------------------------------------
   Lingodive — public-pages polish layer.

   Loaded AFTER index.css/footer.css/utilities.css on the public site
   (index, articles list/detail, books, teacher list/detail). Pure visual
   refinement: nothing in here changes layout structure, only typography,
   shadows, gradients, hover transitions, and decorative accents.
--------------------------------------------------------------------------- */

:root {
    --polish-radius-sm: 12px;
    --polish-radius-md: 16px;
    --polish-radius-lg: 24px;

    --polish-shadow-sm: 0 2px 8px rgba(33, 51, 55, 0.06);
    --polish-shadow-md: 0 8px 24px rgba(33, 51, 55, 0.08),
                        0 2px 4px rgba(33, 51, 55, 0.04);
    --polish-shadow-lg: 0 20px 48px rgba(33, 51, 55, 0.12),
                        0 4px 8px rgba(33, 51, 55, 0.04);
    --polish-shadow-glow: 0 8px 32px rgba(32, 77, 72, 0.18);

    --polish-accent-soft: rgba(32, 77, 72, 0.08);
    --polish-accent-warm: linear-gradient(135deg, #d97c3a 0%, #955f30 100%);
    --polish-accent-teal: linear-gradient(135deg, #2d6a64 0%, #204d48 100%);
    --polish-hero-grad: linear-gradient(135deg,
        #1d4540 0%, #2d6a64 45%, #3d565d 100%);
}

[data-theme="dark"] {
    --polish-accent-soft: rgba(160, 200, 196, 0.12);
    --polish-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --polish-shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35),
                        0 2px 4px rgba(0, 0, 0, 0.2);
    --polish-shadow-lg: 0 20px 48px rgba(0, 0, 0, 0.45);
}

/* === Typography rhythm ================================================= */

body {
    font-feature-settings: "ss01", "cv01", "kern";
}

h1, h2, h3 {
    letter-spacing: -0.02em;
}

/* === Hero ============================================================== */

.hero {
    position: relative;
    overflow: hidden;
    padding: 7rem 0 8rem;
    background: var(--polish-hero-grad);
}

.hero::before,
.hero::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
    pointer-events: none;
}

.hero::before {
    width: 480px;
    height: 480px;
    background: radial-gradient(circle,
        rgba(217, 124, 58, 0.5), transparent 65%);
    top: -120px;
    left: -100px;
}

.hero::after {
    width: 520px;
    height: 520px;
    background: radial-gradient(circle,
        rgba(168, 220, 215, 0.35), transparent 65%);
    bottom: -160px;
    right: -120px;
}

.hero .container {
    position: relative;
    z-index: 1;
}

.hero-title {
    font-weight: 800;
    background: linear-gradient(180deg, #ffffff 0%, #d8eeec 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    margin-bottom: 1.5rem;
}

.hero-subtitle {
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
    color: rgba(255, 255, 255, 0.88);
    line-height: 1.65;
}

/* === Buttons =========================================================== */

.btn {
    letter-spacing: 0.01em;
    box-shadow: var(--polish-shadow-sm);
    transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1),
                box-shadow 0.25s ease, background 0.25s ease;
}

.btn-primary {
    background: var(--polish-accent-warm);
    box-shadow: 0 10px 24px rgba(149, 95, 48, 0.35);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 36px rgba(149, 95, 48, 0.5);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.btn-outline {
    background: var(--card-bg);
    box-shadow: var(--polish-shadow-sm);
}

.btn-outline:hover {
    transform: translateY(-2px);
    box-shadow: var(--polish-shadow-md);
}

/* === Section title ===================================================== */

.section-title {
    font-weight: 800;
    margin-bottom: 2.5rem;
}

.section-title::after {
    content: "";
    display: block;
    width: 64px;
    height: 4px;
    margin: 14px auto 0;
    border-radius: 999px;
    background: var(--polish-accent-warm);
}

/* === Page header (articles/books list) ================================ */

.page-header {
    position: relative;
    overflow: hidden;
    background: var(--polish-hero-grad);
    padding: 5rem 0 6rem;
}

.page-header::after {
    content: "";
    position: absolute;
    width: 380px;
    height: 380px;
    top: -50%;
    right: -8%;
    background: radial-gradient(circle,
        rgba(217, 124, 58, 0.35), transparent 65%);
    filter: blur(60px);
    pointer-events: none;
}

.page-header-content {
    position: relative;
    z-index: 1;
}

.page-header-content h1 {
    font-weight: 800;
}

.page-header-content p {
    line-height: 1.7;
}

/* === Filters / search ================================================== */

.blog-filters,
.library-filters {
    background: linear-gradient(180deg,
        var(--bg-secondary) 0%, var(--bg-primary) 100%);
    padding: 2.5rem 0 2rem;
}

.search-box input {
    border-radius: 999px;
    border-width: 1px;
    box-shadow: var(--polish-shadow-sm);
}

.search-box input:focus {
    box-shadow: var(--polish-shadow-md),
                0 0 0 4px rgba(32, 77, 72, 0.12);
}

.filter-btn {
    border-width: 1px;
    box-shadow: var(--polish-shadow-sm);
    font-weight: 600;
}

.filter-btn:hover {
    transform: translateY(-1px);
}

.filter-btn.active {
    box-shadow: var(--polish-shadow-glow);
}

/* === Article / book cards ============================================= */

.article-card {
    border-radius: var(--polish-radius-md);
    border: 1px solid rgba(33, 51, 55, 0.06);
    box-shadow: var(--polish-shadow-md);
    transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1),
                box-shadow 0.35s cubic-bezier(0.2, 0.8, 0.2, 1),
                border-color 0.35s ease;
}

[data-theme="dark"] .article-card {
    border-color: rgba(255, 255, 255, 0.06);
}

.article-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--polish-shadow-lg);
    border-color: rgba(32, 77, 72, 0.18);
}

.article-image {
    position: relative;
    overflow: hidden;
}

.article-image::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg,
        transparent 55%, rgba(33, 51, 55, 0.35) 100%);
    opacity: 0;
    transition: opacity 0.35s ease;
    pointer-events: none;
}

.article-card:hover .article-image::after {
    opacity: 1;
}

.article-content h3 {
    font-weight: 700;
}

.article-category span {
    background: var(--polish-accent-soft);
    color: var(--accent-primary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.35rem 0.75rem;
}

/* === Tags & badges ===================================================== */

.tag-item {
    background: var(--polish-accent-soft) !important;
    color: var(--accent-primary) !important;
    border: 1px solid rgba(32, 77, 72, 0.18);
    font-weight: 600;
    letter-spacing: 0.02em;
}

/* Fallback chip shown when an article has no tags. Visually distinct from
   real tag chips (dashed border, italic, muted ink, inline folder icon)
   so it reads as "category / placeholder" rather than masquerading as a
   real tag. Reserves the same vertical space as a tags row so cards
   without tags don't end up shorter than ones that have them. */
.tag-item.tag-item-fallback {
    background: transparent !important;
    color: var(--text-secondary, #6b7a7e) !important;
    border: 1px dashed rgba(32, 77, 72, 0.25);
    font-weight: 500;
    font-style: italic;
    text-transform: capitalize;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.32rem 0.75rem !important;
    transition: color 0.25s ease, border-color 0.25s ease, background 0.25s ease;
}

.tag-item.tag-item-fallback i {
    font-size: 0.85em;
    opacity: 0.85;
}

.article-card:hover .tag-item.tag-item-fallback {
    color: var(--accent-primary, #204d48) !important;
    border-color: rgba(32, 77, 72, 0.4);
    background: rgba(32, 77, 72, 0.04) !important;
}

[data-theme="dark"] .tag-item.tag-item-fallback {
    color: rgba(232, 238, 243, 0.6) !important;
    border-color: rgba(255, 255, 255, 0.14);
}

[data-theme="dark"] .article-card:hover .tag-item.tag-item-fallback {
    color: var(--accent-primary, #5fbfb4) !important;
    border-color: rgba(95, 191, 180, 0.35);
    background: rgba(95, 191, 180, 0.06) !important;
}

.level-badge {
    background: var(--polish-accent-warm) !important;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    padding: 0.3rem 0.7rem !important;
    box-shadow: 0 4px 10px rgba(149, 95, 48, 0.3);
}

.read-time-badge {
    background: var(--polish-accent-teal) !important;
    letter-spacing: 0.04em;
    box-shadow: 0 4px 10px rgba(32, 77, 72, 0.25);
}

.date-badge {
    background: linear-gradient(135deg, #36454f 0%, #213337 100%) !important;
    letter-spacing: 0.04em;
    box-shadow: 0 4px 10px rgba(33, 51, 55, 0.25);
}

.lang-badge {
    background: var(--polish-accent-teal) !important;
    font-weight: 600;
    letter-spacing: 0.02em;
    box-shadow: 0 2px 6px rgba(32, 77, 72, 0.2);
}

.author-avatar {
    border: 2px solid var(--card-bg);
    box-shadow: 0 2px 8px rgba(33, 51, 55, 0.15);
    width: 44px;
    height: 44px;
}

.author-name {
    letter-spacing: -0.005em;
}

.publish-date {
    letter-spacing: 0.02em;
}

/* === Teachers section on index ========================================
   Decorative blobs frame the section, cards have a warm accent stripe,
   glowing avatar ring, pill-shaped stats, and a CTA arrow that slides in
   on hover. Use the dedicated `.teachers-section` so styles never bleed
   into other `.articles-section` instances on the page.
--------------------------------------------------------------------------- */

.teachers-section {
    position: relative;
    overflow: hidden;
    padding: 6rem 0;
    background: linear-gradient(180deg,
        var(--bg-secondary) 0%,
        color-mix(in srgb, var(--bg-secondary) 85%, var(--accent-primary) 5%) 100%);
}

.teachers-section::before,
.teachers-section::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    filter: blur(70px);
    pointer-events: none;
    z-index: 0;
}

.teachers-section::before {
    width: 420px;
    height: 420px;
    top: -140px;
    left: -120px;
    background: radial-gradient(circle,
        rgba(217, 124, 58, 0.18), transparent 65%);
}

.teachers-section::after {
    width: 380px;
    height: 380px;
    bottom: -120px;
    right: -100px;
    background: radial-gradient(circle,
        rgba(32, 77, 72, 0.15), transparent 65%);
}

.teachers-section .container {
    position: relative;
    z-index: 1;
}

.teachers-grid {
    display: grid;
    gap: 1.5rem;
}

.teacher-card-row {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 32px;
    margin: 0;
    padding: 2rem 2.25rem 2rem 3rem;
    border-radius: var(--polish-radius-lg);
    background: var(--card-bg);
    border: 1px solid rgba(33, 51, 55, 0.06);
    box-shadow: var(--polish-shadow-md);
    text-decoration: none;
    color: inherit;
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1),
                box-shadow 0.4s cubic-bezier(0.2, 0.8, 0.2, 1),
                border-color 0.4s ease;
}

[data-theme="dark"] .teacher-card-row {
    border-color: rgba(255, 255, 255, 0.06);
}

.teacher-card-row::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 4px;
    background: var(--polish-accent-warm);
    transition: width 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.teacher-card-row::after {
    content: "";
    position: absolute;
    width: 240px;
    height: 240px;
    right: -70px;
    bottom: -90px;
    background: radial-gradient(circle,
        rgba(32, 77, 72, 0.06), transparent 60%);
    pointer-events: none;
}

.teacher-card-row:hover {
    transform: translateY(-6px);
    box-shadow:
        0 24px 56px rgba(33, 51, 55, 0.14),
        0 6px 14px rgba(33, 51, 55, 0.06);
    border-color: rgba(32, 77, 72, 0.18);
}

.teacher-card-row:hover::before {
    width: 8px;
}

.teacher-card-avatar-wrap {
    position: relative;
    flex-shrink: 0;
    padding: 4px;
    border-radius: 50%;
    background: var(--polish-accent-warm);
    box-shadow: 0 12px 30px rgba(149, 95, 48, 0.25);
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1),
                box-shadow 0.4s ease;
}

.teacher-card-row .teacher-card-avatar {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    border: 4px solid var(--card-bg);
    box-shadow: none;
}

.teacher-card-row:hover .teacher-card-avatar-wrap {
    transform: scale(1.04) rotate(-2deg);
    box-shadow: 0 18px 40px rgba(149, 95, 48, 0.4);
}

.teacher-card-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.teacher-card-name {
    margin: 0;
    font-size: 1.55rem;
    font-weight: 800;
    letter-spacing: -0.015em;
    color: var(--text-primary);
}

.teacher-card-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.teacher-card-stats > span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--polish-accent-soft);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 500;
}

.teacher-card-stats > span i {
    color: var(--accent-primary);
}

.teacher-card-langs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}

.teacher-card-langs .lang-badge {
    background: var(--polish-accent-warm) !important;
    padding: 5px 14px !important;
    font-size: 0.74rem !important;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    box-shadow: 0 6px 14px rgba(149, 95, 48, 0.28);
}

.teacher-card-cta {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--polish-accent-soft);
    color: var(--accent-primary);
    font-size: 1rem;
    transform: translateX(-12px);
    opacity: 0;
    transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1),
                opacity 0.35s ease,
                background 0.35s ease,
                color 0.35s ease;
}

.teacher-card-row:hover .teacher-card-cta {
    transform: translateX(0);
    opacity: 1;
    background: var(--polish-accent-warm);
    color: #fff;
    box-shadow: 0 10px 22px rgba(149, 95, 48, 0.4);
}

[dir="rtl"] .teacher-card-row {
    padding: 2rem 3rem 2rem 2.25rem;
}

[dir="rtl"] .teacher-card-row::before {
    left: auto;
    right: 0;
}

[dir="rtl"] .teacher-card-row::after {
    right: auto;
    left: -70px;
}

[dir="rtl"] .teacher-card-cta {
    transform: translateX(12px);
}

[dir="rtl"] .teacher-card-cta i {
    transform: scaleX(-1);
}

@media (max-width: 768px) {
    .teachers-section {
        padding: 4rem 0;
    }

    .teacher-card-row {
        flex-direction: column;
        text-align: center;
        gap: 20px;
        padding: 2rem 1.5rem;
    }

    .teacher-card-row::before {
        top: 0;
        left: 0;
        right: 0;
        bottom: auto;
        width: 100%;
        height: 4px;
    }

    .teacher-card-row:hover::before {
        width: 100%;
        height: 6px;
    }

    .teacher-card-info {
        align-items: center;
    }

    .teacher-card-stats,
    .teacher-card-langs {
        justify-content: center;
    }

    .teacher-card-row .teacher-card-avatar {
        width: 110px;
        height: 110px;
    }

    .teacher-card-cta {
        opacity: 1;
        transform: none;
        width: 42px;
        height: 42px;
    }
}

/* === Article detail hero ============================================== */

.teacher-header-wrapper {
    border-radius: var(--polish-radius-lg);
    box-shadow: var(--polish-shadow-lg);
    overflow: hidden;
}

.teacher-header-wrapper::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg,
        rgba(33, 51, 55, 0.55) 0%,
        rgba(32, 77, 72, 0.2) 60%,
        transparent 100%);
    z-index: 0;
}

.teacher-header-wrapper > * {
    position: relative;
    z-index: 1;
}

.author-photo {
    border: 4px solid var(--card-bg);
    box-shadow: 0 14px 32px rgba(33, 51, 55, 0.3);
}

.article-detail-content {
    background: var(--card-bg);
    border: 1px solid rgba(33, 51, 55, 0.06);
    border-radius: var(--polish-radius-lg);
    box-shadow: var(--polish-shadow-md);
}

[data-theme="dark"] .article-detail-content {
    border-color: rgba(255, 255, 255, 0.06);
}

.article-detail-content p,
.article-body,
.justified-text {
    color: var(--text-primary);
    font-size: 1.05rem;
    line-height: 1.85;
}

.article-body {
    overflow-wrap: anywhere;
}

.article-body > *:first-child {
    margin-top: 0;
}

.article-body > *:last-child {
    margin-bottom: 0;
}

.article-body p,
.article-body ul,
.article-body ol,
.article-body blockquote,
.article-body pre {
    margin: 1rem 0;
}

.article-body h1,
.article-body h2,
.article-body h3,
.article-body h4,
.article-body h5 {
    color: var(--text-primary);
    font-weight: 800;
    line-height: 1.25;
    margin: 1.6em 0 0.55em;
}

.article-body h1 { font-size: clamp(2rem, 3vw, 2.8rem); }
.article-body h2 { font-size: clamp(1.7rem, 2.4vw, 2.25rem); }
.article-body h3 { font-size: clamp(1.4rem, 2vw, 1.85rem); }
.article-body h4 { font-size: 1.25rem; }
.article-body h5 { font-size: 1.1rem; }

.article-body strong {
    font-weight: 800;
}

.article-body em {
    font-style: italic;
}

.article-body a {
    color: var(--primary-color);
    font-weight: 700;
    text-decoration: underline;
    text-decoration-thickness: 0.08em;
    text-underline-offset: 0.18em;
}

.article-body ul,
.article-body ol {
    padding-left: 1.6rem;
}

.article-body li {
    margin: 0.35rem 0;
    padding-left: 0.25rem;
}

.article-body blockquote {
    border-left: 4px solid rgba(32, 77, 72, 0.45);
    background: rgba(32, 77, 72, 0.06);
    border-radius: 10px;
    color: rgba(33, 51, 55, 0.86);
    padding: 0.9rem 1.15rem;
}

.article-body pre,
.article-body pre.ql-syntax {
    background: #0f1720;
    border-radius: 12px;
    color: #e8eef3;
    direction: ltr;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.94rem;
    line-height: 1.65;
    overflow-x: auto;
    padding: 1rem 1.15rem;
    text-align: left;
    white-space: pre-wrap;
}

.article-body code {
    background: rgba(32, 77, 72, 0.10);
    border-radius: 6px;
    color: #204d48;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.92em;
    padding: 0.15em 0.35em;
}

.article-body pre code {
    background: transparent;
    border-radius: 0;
    color: inherit;
    padding: 0;
}

.article-body img {
    border-radius: 12px;
    display: block;
    height: auto;
    margin: 1.25rem auto;
    max-width: 100%;
}

.article-body .ql-video,
.article-body iframe {
    aspect-ratio: 16 / 9;
    border: 0;
    border-radius: 12px;
    display: block;
    height: auto;
    margin: 1.25rem auto;
    max-width: 100%;
    width: min(100%, 760px);
}

.article-body .ql-align-center { text-align: center; }
.article-body .ql-align-right { text-align: right; }
.article-body .ql-align-justify { text-align: justify; }
.article-body .ql-direction-rtl {
    direction: rtl;
    text-align: inherit;
}

.article-body .ql-size-small { font-size: 0.85em; }
.article-body .ql-size-large { font-size: 1.35em; }
.article-body .ql-size-huge { font-size: 1.75em; }
.article-body .ql-font-serif { font-family: Georgia, "Times New Roman", serif; }
.article-body .ql-font-monospace {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

.article-body .ql-indent-1 { padding-left: 3em; }
.article-body .ql-indent-2 { padding-left: 6em; }
.article-body .ql-indent-3 { padding-left: 9em; }
.article-body .ql-indent-4 { padding-left: 12em; }
.article-body .ql-indent-5 { padding-left: 15em; }
.article-body .ql-indent-6 { padding-left: 18em; }
.article-body .ql-indent-7 { padding-left: 21em; }
.article-body .ql-indent-8 { padding-left: 24em; }

[dir="rtl"] .article-body .ql-indent-1,
.article-body .ql-direction-rtl.ql-indent-1 { padding-left: 0; padding-right: 3em; }
[dir="rtl"] .article-body .ql-indent-2,
.article-body .ql-direction-rtl.ql-indent-2 { padding-left: 0; padding-right: 6em; }
[dir="rtl"] .article-body .ql-indent-3,
.article-body .ql-direction-rtl.ql-indent-3 { padding-left: 0; padding-right: 9em; }
[dir="rtl"] .article-body .ql-indent-4,
.article-body .ql-direction-rtl.ql-indent-4 { padding-left: 0; padding-right: 12em; }
[dir="rtl"] .article-body .ql-indent-5,
.article-body .ql-direction-rtl.ql-indent-5 { padding-left: 0; padding-right: 15em; }
[dir="rtl"] .article-body .ql-indent-6,
.article-body .ql-direction-rtl.ql-indent-6 { padding-left: 0; padding-right: 18em; }
[dir="rtl"] .article-body .ql-indent-7,
.article-body .ql-direction-rtl.ql-indent-7 { padding-left: 0; padding-right: 21em; }
[dir="rtl"] .article-body .ql-indent-8,
.article-body .ql-direction-rtl.ql-indent-8 { padding-left: 0; padding-right: 24em; }

[data-theme="dark"] .article-body blockquote {
    background: rgba(95, 191, 180, 0.10);
    border-left-color: rgba(95, 191, 180, 0.58);
    color: rgba(232, 238, 243, 0.86);
}

[data-theme="dark"] .article-body a {
    color: #8ddad1;
}

[data-theme="dark"] .article-body code {
    background: rgba(95, 191, 180, 0.14);
    color: #b3e6df;
}

[data-theme="dark"] .article-body pre,
[data-theme="dark"] .article-body pre.ql-syntax {
    background: #101820;
    color: #e8eef3;
}

.article-detail-title {
    font-weight: 700;
}

/* === Community section ================================================ */

.community-section {
    position: relative;
    overflow: hidden;
}

.community-section::after {
    content: "";
    position: absolute;
    width: 380px;
    height: 380px;
    bottom: -120px;
    right: -100px;
    background: radial-gradient(circle,
        rgba(217, 124, 58, 0.3), transparent 65%);
    filter: blur(80px);
    pointer-events: none;
}

.community-section .container {
    position: relative;
    z-index: 1;
}

.community-section .section-title::after {
    background: rgba(255, 255, 255, 0.85);
}

.telegram-btn {
    background: rgba(255, 255, 255, 0.08) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--polish-radius-md);
    transition: transform 0.3s, box-shadow 0.3s, background 0.3s;
}

.telegram-btn:hover {
    background: rgba(255, 255, 255, 0.16) !important;
    transform: translateY(-4px);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.2);
}

/* === About / index banner ============================================= */

.about-wrapper {
    align-items: center;
    text-align: center;
}

.about-banner-desktop,
.about-banner-mobile {
    border-radius: var(--polish-radius-lg);
    box-shadow: var(--polish-shadow-md);
}

/*
   Pin the banner to a comfortable letterbox height regardless of which
   `<picture>` source the browser picks; without this the mobile-cropped
   variant can render unexpectedly tall on a desktop viewport.
*/
.about-banner-desktop {
    width: 100%;
    height: clamp(180px, 18vw, 240px);
    object-fit: cover;
    object-position: center;
}

@media (max-width: 768px) {
    .about-banner-desktop {
        height: clamp(140px, 32vw, 180px);
    }
}

.about-text {
    max-width: 880px;
    margin: 0 auto;
    line-height: 1.85;
    color: var(--text-secondary);
    font-size: 1.05rem;
}

/* === Entrance animation =============================================== */

.article-card,
.teacher-card-row,
.book-card-tall,
.telegram-btn {
    animation: polishFadeUp 0.55s cubic-bezier(0.2, 0.8, 0.2, 1) backwards;
}

@keyframes polishFadeUp {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* === Reduced motion =================================================== */

@media (prefers-reduced-motion: reduce) {
    .article-card,
    .article-card:hover,
    .teacher-card-row,
    .teacher-card-row:hover,
    .telegram-btn,
    .telegram-btn:hover,
    .btn,
    .btn:hover,
    .filter-btn:hover {
        animation: none !important;
        transition: none !important;
        transform: none !important;
    }
}

/* === Mobile tightening (matches utilities.css breakpoint) ============= */

@media (max-width: 768px) {
    .hero {
        padding: 5rem 0 6rem;
    }

    .hero::before,
    .hero::after {
        opacity: 0.35;
    }

    .page-header {
        padding: 4rem 0 5rem;
    }

    .section-title::after {
        width: 48px;
        height: 3px;
    }
}

/* =======================================================================
   v2 — Quiet refinements: hero eyebrow, section divider, reading progress
   bar, floating back-to-top, nav underline, selection / scrollbar polish.
   Layered on top of the existing styles; nothing rearranges layout.
   ======================================================================= */

/* --- Hero eyebrow pill --------------------------------------------------- */

.hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.4rem 1rem;
    margin-bottom: 1.5rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: rgba(255, 255, 255, 0.95);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}

.hero-eyebrow-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ffd6a8;
    box-shadow: 0 0 0 4px rgba(255, 214, 168, 0.18);
    animation: heroEyebrowPulse 2.4s ease-in-out infinite;
}

@keyframes heroEyebrowPulse {
    0%, 100% { box-shadow: 0 0 0 4px rgba(255, 214, 168, 0.18); }
    50%      { box-shadow: 0 0 0 7px rgba(255, 214, 168, 0.05); }
}

/* --- Section divider SVG (used at the bottom of the hero) -------------- */

.section-divider {
    position: absolute;
    left: 0;
    width: 100%;
    height: 80px;
    display: block;
    pointer-events: none;
    z-index: 1;
}

.section-divider-bottom {
    bottom: -1px;
}

.section-divider path {
    fill: var(--bg-primary);
}

@media (max-width: 768px) {
    .section-divider {
        height: 48px;
    }
}

/* --- Reading progress bar (article detail page) ------------------------ */

.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: transparent;
    z-index: 1100;
    pointer-events: none;
}

.reading-progress-bar {
    height: 100%;
    width: 0;
    background: var(--polish-accent-warm);
    box-shadow: 0 0 12px rgba(217, 124, 58, 0.65);
    transition: width 0.1s linear;
}

/* --- Floating back-to-top button --------------------------------------- */

.back-to-top {
    position: fixed;
    right: 1.5rem;
    bottom: 1.5rem;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: none;
    background: var(--polish-accent-teal);
    color: #fff;
    font-size: 0.95rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 14px 32px rgba(32, 77, 72, 0.38);
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: opacity 0.3s ease, transform 0.3s ease,
                visibility 0.3s ease, box-shadow 0.3s ease;
    z-index: 1090;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    transform: translateY(-3px);
    box-shadow: 0 18px 38px rgba(32, 77, 72, 0.55);
}

.back-to-top:focus-visible {
    outline: 3px solid rgba(255, 214, 168, 0.55);
    outline-offset: 3px;
}

[dir="rtl"] .back-to-top {
    right: auto;
    left: 1.5rem;
}

@media (max-width: 768px) {
    .back-to-top {
        right: 1rem;
        bottom: 1rem;
        width: 42px;
        height: 42px;
    }

    [dir="rtl"] .back-to-top {
        left: 1rem;
    }
}

/* --- Nav link hover / active underline indicator ------------------------ */

.nav-menu a {
    position: relative;
}

.nav-menu a::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -6px;
    width: 0;
    height: 2px;
    border-radius: 2px;
    background: var(--polish-accent-warm);
    transform: translateX(-50%);
    transition: width 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.nav-menu a:hover::after,
.nav-menu a.active::after {
    width: 22px;
}

/* --- Selection + scrollbar + focus polish ------------------------------- */

::selection {
    background: rgba(217, 124, 58, 0.28);
    color: var(--text-primary);
}

[data-theme="dark"] ::selection {
    background: rgba(255, 214, 168, 0.32);
    color: #fff;
}

@media (pointer: fine) {
    html {
        scrollbar-width: thin;
        scrollbar-color: var(--accent-primary) transparent;
    }

    ::-webkit-scrollbar {
        width: 10px;
        height: 10px;
    }

    ::-webkit-scrollbar-track {
        background: transparent;
    }

    ::-webkit-scrollbar-thumb {
        background: color-mix(in srgb, var(--accent-primary) 60%, transparent);
        border-radius: 999px;
        border: 2px solid transparent;
        background-clip: padding-box;
    }

    ::-webkit-scrollbar-thumb:hover {
        background: var(--accent-primary);
        background-clip: padding-box;
    }
}

a:focus-visible,
button:focus-visible,
.btn:focus-visible {
    outline: 3px solid rgba(217, 124, 58, 0.5);
    outline-offset: 2px;
    border-radius: 6px;
}

@media (prefers-reduced-motion: reduce) {
    .hero-eyebrow-dot {
        animation: none !important;
    }
}

/* =======================================================================
   v3 — Refined card styling for articles, books, and Telegram cards.
   Layered on top of the existing .article-card / .telegram-btn rules.
   ======================================================================= */

/* --- Article cards: image zoom, hover tint, accent on title ----------- */

.article-image img {
    transition: transform 0.55s cubic-bezier(0.2, 0.8, 0.2, 1);
    will-change: transform;
}

.article-card:hover .article-image img {
    transform: scale(1.07);
}

.article-image::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg,
        rgba(217, 124, 58, 0.18) 0%,
        rgba(32, 77, 72, 0.12) 60%,
        transparent 100%);
    opacity: 0;
    mix-blend-mode: multiply;
    transition: opacity 0.4s ease;
    pointer-events: none;
    z-index: 1;
}

.article-card:hover .article-image::before {
    opacity: 1;
}

.article-card .article-content h3,
.article-card .article-card-title-tall {
    transition: color 0.3s ease;
}

.article-card:hover .article-content h3,
.article-card:hover .article-card-title-tall {
    color: var(--accent-primary);
}

.article-card .article-card-title-tall i {
    color: var(--accent-primary);
    transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.article-card:hover .article-card-title-tall i {
    transform: translateX(2px) rotate(-6deg);
}

.article-card .summary-tall {
    color: var(--text-secondary);
    line-height: 1.65;
}

.article-card .author-avatar {
    transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.article-card:hover .author-avatar {
    transform: scale(1.08);
}

/* --- Book cards: image zoom, level badge floats over image ------------ */

.book-card-tall .article-image::after {
    content: "";
    position: absolute;
    inset: auto;
    top: 0.85rem;
    left: 0.85rem;
    right: auto;
    bottom: auto;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--accent-primary);
    box-shadow: 0 4px 12px rgba(33, 51, 55, 0.15);
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23204d48'><path d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8l-6-6zM6 4h7v5h5v11H6V4zm2 9h8v2H8v-2zm0 4h5v2H8v-2z'/></svg>");
    background-size: 16px 16px;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 0.35s ease, transform 0.35s ease;
    z-index: 2;
}

.book-card-tall:hover .article-image::after {
    opacity: 1;
    transform: translateY(0);
}

[dir="rtl"] .book-card-tall .article-image::after {
    left: auto;
    right: 0.85rem;
}

[data-theme="dark"] .book-card-tall .article-image::after {
    background-color: rgba(33, 51, 55, 0.92);
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23a8dcd7'><path d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8l-6-6zM6 4h7v5h5v11H6V4zm2 9h8v2H8v-2zm0 4h5v2H8v-2z'/></svg>");
}

.book-card-tall:hover .article-image img {
    transform: scale(1.05);
}

.book-card-tall .article-content h3 {
    font-size: 1.1rem;
    line-height: 1.35;
    transition: color 0.3s ease;
}

.book-card-tall:hover .article-content h3 {
    color: var(--accent-primary);
}

/* --- Telegram cards: distinct gradients, glow ring icon, sliding CTA --- */

.community-section .community-buttons {
    align-items: stretch;
}

.telegram-btn {
    position: relative;
    overflow: hidden;
    padding: 1.75rem 1.85rem !important;
    gap: 1.25rem !important;
    border-radius: var(--polish-radius-lg) !important;
    border: 1px solid rgba(255, 255, 255, 0.18) !important;
    background: rgba(255, 255, 255, 0.06) !important;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.18);
    transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1),
                box-shadow 0.35s ease,
                background 0.35s ease,
                border-color 0.35s ease !important;
}

.telegram-btn::after {
    content: "";
    position: absolute;
    width: 220px;
    height: 220px;
    bottom: -90px;
    right: -80px;
    border-radius: 50%;
    background: radial-gradient(circle,
        rgba(255, 255, 255, 0.22), transparent 65%);
    pointer-events: none;
    opacity: 0.7;
    transition: transform 0.5s ease, opacity 0.4s ease;
}

.telegram-btn:hover {
    transform: translateY(-6px);
    background: rgba(255, 255, 255, 0.12) !important;
    border-color: rgba(255, 255, 255, 0.32) !important;
    box-shadow: 0 24px 50px rgba(0, 0, 0, 0.28),
                0 0 0 1px rgba(255, 255, 255, 0.06) inset !important;
}

.telegram-btn:hover::after {
    transform: translate(-20px, -20px) scale(1.05);
    opacity: 1;
}

.telegram-btn > i {
    flex-shrink: 0;
    width: 64px;
    height: 64px;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    border-radius: 18px;
    color: #fff !important;
    font-size: 1.65rem !important;
    opacity: 1 !important;
    box-shadow: 0 12px 26px rgba(0, 0, 0, 0.3),
                0 0 0 1px rgba(255, 255, 255, 0.15) inset;
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1),
                box-shadow 0.4s ease;
}

.telegram-btn.telegram-channel > i {
    background: linear-gradient(135deg, #2aabee 0%, #229ed9 100%);
    box-shadow: 0 12px 26px rgba(34, 158, 217, 0.5),
                0 0 0 1px rgba(255, 255, 255, 0.18) inset;
}

.telegram-btn.telegram-bot > i {
    background: var(--polish-accent-warm);
    box-shadow: 0 12px 26px rgba(149, 95, 48, 0.5),
                0 0 0 1px rgba(255, 255, 255, 0.18) inset;
}

.telegram-btn:hover > i {
    transform: scale(1.06) rotate(-4deg);
}

.telegram-btn .telegram-info {
    flex: 1;
    min-width: 0;
    color: #fff;
}

.telegram-btn .telegram-info h3 {
    margin: 0 0 0.35rem;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: #fff;
}

.telegram-btn .telegram-info p {
    margin: 0 0 0.85rem;
    color: rgba(255, 255, 255, 0.82);
    line-height: 1.55;
    font-size: 0.95rem;
}

.telegram-btn .member-count {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.22);
    color: rgba(255, 255, 255, 0.95);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.telegram-btn.telegram-channel .member-count::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #57e389;
    box-shadow: 0 0 0 3px rgba(87, 227, 137, 0.22);
}

.telegram-btn.telegram-bot .member-count::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ffd76e;
    box-shadow: 0 0 0 3px rgba(255, 215, 110, 0.22);
}

/* Sliding arrow CTA hint */
.telegram-btn::before {
    content: "\f061"; /* fa-arrow-right */
    font-family: "Font Awesome 6 Free", "Font Awesome 5 Free";
    font-weight: 900;
    position: absolute;
    top: 50%;
    right: 1.5rem;
    transform: translateY(-50%) translateX(8px);
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 0.9rem;
    opacity: 0;
    transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1),
                opacity 0.35s ease;
    z-index: 1;
}

.telegram-btn:hover::before {
    transform: translateY(-50%) translateX(0);
    opacity: 1;
}

[dir="rtl"] .telegram-btn::before {
    right: auto;
    left: 1.5rem;
    content: "\f060"; /* fa-arrow-left */
    transform: translateY(-50%) translateX(-8px);
}

[dir="rtl"] .telegram-btn:hover::before {
    transform: translateY(-50%) translateX(0);
}

@media (max-width: 640px) {
    .telegram-btn {
        padding: 1.5rem !important;
        flex-direction: row !important;
        gap: 1rem !important;
    }

    .telegram-btn > i {
        width: 54px;
        height: 54px;
        font-size: 1.4rem !important;
        border-radius: 14px;
    }

    .telegram-btn::before {
        display: none; /* hide sliding arrow on phones */
    }

    .telegram-btn .telegram-info h3 {
        font-size: 1.1rem;
    }

    .telegram-btn .telegram-info p {
        font-size: 0.9rem;
        margin-bottom: 0.65rem;
    }
}

/* =======================================================================
   v3 — Editorial article cards & 3D library book covers
   Distinct, more-special treatment for the two card families using only
   pseudo-elements (no HTML changes). Layered on top of v2.
   ======================================================================= */

/* Both families need a positioning context for their decorative pseudos.
   .article-card already has overflow: hidden from index.css, so any
   pseudo-element decoration we add will be clipped to the card bounds. */
.article-card {
    position: relative;
    isolation: isolate;
}

/* --- Article cards: editorial polish ---------------------------------- */

/* Top accent stripe that fills left -> right when the card is hovered. */
.article-card:not(.book-card-tall)::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    height: 3px;
    width: 0;
    background: linear-gradient(90deg,
        var(--accent-primary, #204d48) 0%,
        #2a665e 50%,
        #c97f3a 100%);
    border-radius: 0 3px 3px 0;
    transition: width 0.55s cubic-bezier(0.2, 0.8, 0.2, 1);
    pointer-events: none;
    z-index: 4;
}

.article-card:not(.book-card-tall):hover::before {
    width: 100%;
}

[dir="rtl"] .article-card:not(.book-card-tall)::before {
    left: auto;
    right: 0;
    background: linear-gradient(270deg,
        var(--accent-primary, #204d48) 0%,
        #2a665e 50%,
        #c97f3a 100%);
    border-radius: 3px 0 0 3px;
}

/* Floating "go to article" chip in the top-right corner of the card.
   Sits inside the cover image area; appears on hover. */
.article-card:not(.book-card-tall)::after {
    content: "\2197"; /* ↗ north-east arrow */
    position: absolute;
    top: 0.85rem;
    right: 0.85rem;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg,
        var(--accent-primary, #204d48) 0%,
        #2a665e 100%);
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    line-height: 38px;
    text-align: center;
    box-shadow: 0 10px 22px rgba(32, 77, 72, 0.35),
                0 0 0 4px rgba(255, 255, 255, 0.12);
    opacity: 0;
    transform: translate(8px, -8px) scale(0.85) rotate(-12deg);
    transition: opacity 0.35s ease,
                transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
    pointer-events: none;
    z-index: 4;
}

.article-card:not(.book-card-tall):hover::after {
    opacity: 1;
    transform: translate(0, 0) scale(1) rotate(0);
}

[dir="rtl"] .article-card:not(.book-card-tall)::after {
    content: "\2196"; /* ↖ north-west arrow for RTL */
    right: auto;
    left: 0.85rem;
    transform: translate(-8px, -8px) scale(0.85) rotate(12deg);
}

[dir="rtl"] .article-card:not(.book-card-tall):hover::after {
    transform: translate(0, 0) scale(1) rotate(0);
}

/* Warm-tinted hover glow for article cards; overrides the v1 .article-card:hover
   shadow with a richer, editorial colour mix. */
.article-card:not(.book-card-tall):hover {
    box-shadow:
        0 22px 44px -16px rgba(149, 95, 48, 0.32),
        0 10px 24px -10px rgba(32, 77, 72, 0.22),
        0 0 0 1px rgba(32, 77, 72, 0.08);
}

[data-theme="dark"] .article-card:not(.book-card-tall):hover {
    box-shadow:
        0 22px 44px -16px rgba(217, 124, 58, 0.28),
        0 10px 24px -10px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.06);
}

/* Title icon ("fa-book") gets a soft circular badge background on hover. */
.article-card .article-card-title-tall i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.9em;
    height: 1.9em;
    border-radius: 50%;
    background: transparent;
    color: var(--accent-primary, #204d48);
    font-size: 0.72em;
    margin-inline-end: 0.45em;
    vertical-align: 0.05em;
    box-shadow: 0 0 0 0 rgba(32, 77, 72, 0);
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1),
                background 0.3s ease,
                box-shadow 0.3s ease,
                color 0.3s ease;
}

.article-card:hover .article-card-title-tall i {
    background: var(--polish-accent-soft, rgba(32, 77, 72, 0.1));
    box-shadow: 0 0 0 4px rgba(32, 77, 72, 0.08);
    transform: rotate(-8deg) scale(1.06);
}

/* --- Book cards: 3D library polish ------------------------------------ */

/* Override the warm tint pseudo for books: turn it into a glossy shimmer
   that sweeps across the cover on hover. */
.book-card-tall .article-image::before {
    background: linear-gradient(115deg,
        transparent 30%,
        rgba(255, 255, 255, 0.25) 45%,
        rgba(255, 255, 255, 0.55) 50%,
        rgba(255, 255, 255, 0.25) 55%,
        transparent 70%);
    mix-blend-mode: normal;
    opacity: 0;
    transform: translateX(-110%);
    transition: transform 0.95s cubic-bezier(0.2, 0.8, 0.2, 1),
                opacity 0.3s ease;
    z-index: 2;
}

.book-card-tall:hover .article-image::before {
    opacity: 1;
    transform: translateX(110%);
}

/* Vertical "book spine" stripe on the left edge of the cover.
   Multi-stop gradient simulates layered page edges. */
.book-card-tall::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 9px;
    height: 200px; /* matches .article-image height in index.css/teacher.css */
    background: linear-gradient(90deg,
        rgba(0, 0, 0, 0.28) 0%,
        rgba(255, 255, 255, 0.55) 22%,
        rgba(0, 0, 0, 0.18) 38%,
        rgba(255, 255, 255, 0.5) 60%,
        rgba(0, 0, 0, 0.22) 78%,
        rgba(0, 0, 0, 0.45) 100%);
    box-shadow: 2px 0 6px rgba(0, 0, 0, 0.18);
    pointer-events: none;
    z-index: 3;
    transition: width 0.4s cubic-bezier(0.2, 0.8, 0.2, 1),
                box-shadow 0.4s ease;
}

.book-card-tall:hover::before {
    width: 12px;
    box-shadow: 3px 0 10px rgba(0, 0, 0, 0.25);
}

[dir="rtl"] .book-card-tall::before {
    left: auto;
    right: 0;
    background: linear-gradient(270deg,
        rgba(0, 0, 0, 0.28) 0%,
        rgba(255, 255, 255, 0.55) 22%,
        rgba(0, 0, 0, 0.18) 38%,
        rgba(255, 255, 255, 0.5) 60%,
        rgba(0, 0, 0, 0.22) 78%,
        rgba(0, 0, 0, 0.45) 100%);
    box-shadow: -2px 0 6px rgba(0, 0, 0, 0.18);
}

[dir="rtl"] .book-card-tall:hover::before {
    box-shadow: -3px 0 10px rgba(0, 0, 0, 0.25);
}

[data-theme="dark"] .book-card-tall::before {
    background: linear-gradient(90deg,
        rgba(0, 0, 0, 0.55) 0%,
        rgba(255, 255, 255, 0.18) 22%,
        rgba(0, 0, 0, 0.4) 38%,
        rgba(255, 255, 255, 0.16) 60%,
        rgba(0, 0, 0, 0.42) 78%,
        rgba(0, 0, 0, 0.7) 100%);
}

/* Stronger, warmer hover shadow for books — feels like the cover is
   lifting off a wooden shelf. */
.book-card-tall:hover {
    box-shadow:
        0 26px 50px -18px rgba(149, 95, 48, 0.4),
        0 14px 28px -12px rgba(33, 51, 55, 0.28),
        0 0 0 1px rgba(149, 95, 48, 0.18);
}

[data-theme="dark"] .book-card-tall:hover {
    box-shadow:
        0 26px 50px -18px rgba(217, 124, 58, 0.4),
        0 14px 28px -12px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(217, 124, 58, 0.22);
}

/* Cover image gets a subtle inset frame so it reads as a separate object
   sitting inside the card surface. */
.book-card-tall .article-image {
    box-shadow:
        inset 0 -1px 0 0 rgba(0, 0, 0, 0.08),
        inset 0 1px 0 0 rgba(255, 255, 255, 0.4);
}

[data-theme="dark"] .book-card-tall .article-image {
    box-shadow:
        inset 0 -1px 0 0 rgba(0, 0, 0, 0.4),
        inset 0 1px 0 0 rgba(255, 255, 255, 0.06);
}

/* Slightly stronger image scale + tiny y-rotation feel via skew on the inner
   image — keeps the cover feeling like a 3D object opening just a hair. */
.book-card-tall:hover .article-image img {
    transform: scale(1.06) translateX(2px);
}

[dir="rtl"] .book-card-tall:hover .article-image img {
    transform: scale(1.06) translateX(-2px);
}

/* --- Responsive tweaks for v3 ----------------------------------------- */

@media (max-width: 768px) {
    .article-card:not(.book-card-tall)::after {
        width: 32px;
        height: 32px;
        line-height: 32px;
        top: 0.6rem;
        right: 0.6rem;
        font-size: 0.9rem;
    }

    [dir="rtl"] .article-card:not(.book-card-tall)::after {
        right: auto;
        left: 0.6rem;
    }

    .book-card-tall::before {
        width: 6px;
    }

    .book-card-tall:hover::before {
        width: 8px;
    }
}

/* =======================================================================
   v4 — Icon rendering polish (Font Awesome 7)
   Crisper glyph rendering, consistent alignment, tinted small icons,
   and thoughtful hover transitions for social / control buttons.
   ======================================================================= */

/* Crisper glyph rendering everywhere FA is used. Subpixel hinting on
   FA's icon font tends to look heavy on macOS/Linux Chromium without
   antialiasing hints. */
.fa,
.fas,
.far,
.fab,
.fa-solid,
.fa-regular,
.fa-brands {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Inline stat icons (clock, eye, hashtag, graduation cap, etc.) look
   better when slightly muted and fixed-width — keeps numbers/labels in
   tidy columns even when icon glyph widths differ. */
.article-stats i,
.article-meta i,
.teacher-card-stats i,
.teacher-credentials i,
.tag-icon {
    color: var(--text-secondary, #6b7a7e);
    opacity: 0.85;
    width: 1.1em;
    text-align: center;
    transition: color 0.25s ease, opacity 0.25s ease, transform 0.25s ease;
}

.article-card:hover .article-stats i,
.article-card:hover .tag-icon {
    opacity: 1;
    color: var(--accent-primary, #204d48);
}

[data-theme="dark"] .article-stats i,
[data-theme="dark"] .article-meta i,
[data-theme="dark"] .teacher-card-stats i,
[data-theme="dark"] .teacher-credentials i,
[data-theme="dark"] .tag-icon {
    color: rgba(255, 255, 255, 0.65);
}

/* Hashtag marker for tag rows: a touch smaller and shifted up a hair
   so it sits visually centered with the chip baseline. */
.tag-icon.fa-hashtag {
    font-size: 0.85em;
    transform: translateY(-1px);
}

/* Search-box magnifier reads better at the regular weight inside an
   input — a hair lighter and centered. */
.search-box .fa-magnifying-glass {
    color: var(--text-secondary, #6b7a7e);
    opacity: 0.7;
}

/* Footer social icons: consistent circular targets that read on both light
   and dark footers, with a brand-tinted hover. */
.footer {
    background: #e8e9eb;
    color: #36454f;
    border-top: 1px solid #d3d3d3;
}

.footer-brand .logo {
    color: #204d48;
}

.footer-brand p,
.footer-section a,
.footer-bottom {
    color: #708090;
}

.footer-section h4 {
    color: #36454f;
}

.footer-section a:hover {
    color: #204d48;
}

.social-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--card-bg, #ffffff) !important;
    border: 1px solid var(--border-color, rgba(33, 51, 55, 0.12));
    color: var(--text-primary, #213337) !important;
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1),
                background 0.25s ease,
                color 0.25s ease,
                border-color 0.25s ease,
                box-shadow 0.25s ease;
}

.social-links a:hover {
    transform: translateY(-3px) scale(1.05);
    border-color: var(--accent-primary, #204d48);
    box-shadow: 0 8px 18px rgba(33, 51, 55, 0.15);
}

[data-theme="dark"] .social-links a {
    background: rgba(255, 255, 255, 0.06) !important;
    border-color: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.9) !important;
}

[data-theme="dark"] .social-links a:hover {
    background: rgba(255, 255, 255, 0.14) !important;
    border-color: rgba(255, 255, 255, 0.28);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.4);
}

.social-links a > i {
    font-size: 1.05rem;
    line-height: 1;
}

/* Per-platform brand tints on hover. */
.social-links a[title="Telegram"]:hover   { color: #229ed9 !important; }
.social-links a[title="LinkedIn"]:hover   { color: #0a66c2 !important; }
.social-links a[title="Instagram"]:hover  { color: #e1306c !important; }

[data-theme="dark"] .social-links a[title="Telegram"]:hover   { color: #6db8ff !important; }
[data-theme="dark"] .social-links a[title="LinkedIn"]:hover   { color: #6db8ff !important; }
[data-theme="dark"] .social-links a[title="Instagram"]:hover  { color: #ffb86b !important; }

/* Theme/menu toggle buttons in the header: consistent size, subtle
   rotate when interacting. */
.theme-toggle i,
.mobile-menu-toggle i {
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.theme-toggle:hover i {
    transform: rotate(-12deg) scale(1.08);
}

.mobile-menu-toggle:hover i {
    transform: scale(1.1);
}

/* Calendar prev/next chevrons: nicer hover state. */
.calendar-nav-btn i {
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.calendar-nav-btn:hover i {
    transform: scale(1.15);
}

[dir="rtl"] .calendar-nav-btn:hover i {
    transform: scale(1.15) rotate(0deg);
}

/* Back-to-top chevron: gentle bounce on hover. */
.back-to-top i {
    transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.back-to-top:hover i {
    transform: translateY(-2px);
}

/* Title-row icons (article detail, summary cards, "see more"). They were
   pretty large bordered boxes; refine to a softer rounded square with
   accent ink and subtle gradient. */
.icon-row > i,
.article-detail-icon > i {
    color: var(--accent-primary, #204d48);
}

/* Bookmark glyph on article cards reads as a more "editorial" mark
   than the old book glyph; nudge it down a hair to align with caps. */
.article-card-title-tall .fa-bookmark {
    font-size: 0.78em;
    transform: translateY(-1px);
}

/* Telegram + bot iconography sits inside a coloured chip already (v2).
   Make sure the new fa-brands fa-telegram glyph stays optically centered. */
.telegram-btn > .fa-telegram,
.telegram-btn > .fa-robot {
    line-height: 1;
}

/* CTA arrows ("→" inside teacher-card-cta and similar): a faint slide
   on hover sells the affordance. */
.teacher-card-cta .fa-arrow-right-long {
    transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.teacher-card:hover .teacher-card-cta .fa-arrow-right-long {
    transform: translateX(4px);
}

[dir="rtl"] .teacher-card-cta .fa-arrow-right-long {
    transform: scaleX(-1);
}

[dir="rtl"] .teacher-card:hover .teacher-card-cta .fa-arrow-right-long {
    transform: scaleX(-1) translateX(4px);
}

/* =======================================================================
   v5 — Dark mode refinements
   The dark palette in index.css is the source of truth (--bg-primary,
   --card-bg, etc.). This block layers premium-feeling refinements on top:
   richer hero gradient, elevated card surfaces, refined inputs, custom
   scrollbar, subtle borders, and brand-correct accents.
   ======================================================================= */

/* --- Body / smooth transitions ---------------------------------------- */

[data-theme="dark"] {
    color-scheme: dark;
}

[data-theme="dark"] body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

/* Soften theme-flip flicker on elements that change color/background. */
body,
.header,
.article-card,
.teacher-card,
.telegram-btn,
.footer,
.btn,
input, select, textarea {
    transition: background-color 0.35s ease,
                color 0.35s ease,
                border-color 0.35s ease,
                box-shadow 0.35s ease;
}

/* --- Hero in dark mode ------------------------------------------------- */

[data-theme="dark"] .hero {
    background:
        radial-gradient(ellipse at top left,
            rgba(95, 191, 180, 0.15) 0%, transparent 55%),
        radial-gradient(ellipse at bottom right,
            rgba(217, 124, 58, 0.12) 0%, transparent 55%),
        linear-gradient(135deg, #0c1722 0%, #112433 50%, #0e1c28 100%);
}

[data-theme="dark"] .hero::before,
[data-theme="dark"] .hero::after {
    opacity: 0.55;
}

[data-theme="dark"] .hero-eyebrow {
    background: rgba(95, 191, 180, 0.12);
    border-color: rgba(95, 191, 180, 0.28);
    color: #d8eef0;
}

[data-theme="dark"] .hero-eyebrow-dot {
    background: var(--accent-primary, #5fbfb4);
    box-shadow: 0 0 0 4px rgba(95, 191, 180, 0.2);
}

[data-theme="dark"] .section-divider path {
    fill: var(--bg-primary, #0e1620);
}

/* --- Section bands ----------------------------------------------------- */

[data-theme="dark"] .section-bg-light {
    background-color: var(--bg-secondary, #15212e);
}

[data-theme="dark"] .section-bg-grey {
    background-color: #111b26;
}

[data-theme="dark"] .section-title {
    color: var(--text-primary, #e8eef3);
}

/* --- Cards (article, book, teacher) get elevation + 1px highlight ---- */

[data-theme="dark"] .article-card,
[data-theme="dark"] .teacher-card {
    background-color: var(--card-bg, #1a2532);
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow:
        0 1px 0 0 rgba(255, 255, 255, 0.04) inset,
        0 6px 18px rgba(0, 0, 0, 0.45),
        0 1px 4px rgba(0, 0, 0, 0.35);
}

[data-theme="dark"] .article-card:hover {
    border-color: rgba(95, 191, 180, 0.25);
    box-shadow:
        0 1px 0 0 rgba(255, 255, 255, 0.08) inset,
        0 22px 44px -12px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(95, 191, 180, 0.2);
}

[data-theme="dark"] .book-card-tall:hover {
    box-shadow:
        0 1px 0 0 rgba(255, 255, 255, 0.08) inset,
        0 26px 50px -16px rgba(217, 124, 58, 0.3),
        0 14px 28px -10px rgba(0, 0, 0, 0.55),
        0 0 0 1px rgba(217, 124, 58, 0.25);
}

[data-theme="dark"] .article-card .article-content,
[data-theme="dark"] .teacher-card .teacher-card-info {
    color: var(--text-primary, #e8eef3);
}

[data-theme="dark"] .article-card h3,
[data-theme="dark"] .article-card .article-card-title,
[data-theme="dark"] .article-card .article-card-title-tall,
[data-theme="dark"] .teacher-card h3 {
    color: var(--text-primary, #e8eef3);
}

[data-theme="dark"] .article-card .summary-tall,
[data-theme="dark"] .article-card .article-card-summary,
[data-theme="dark"] .article-card p {
    color: var(--text-secondary, #99adbe);
}

/* --- Author / publish meta -------------------------------------------- */

[data-theme="dark"] .author-name {
    color: var(--text-primary, #e8eef3);
}

[data-theme="dark"] .publish-date {
    color: var(--text-secondary, #99adbe);
}

[data-theme="dark"] .author-avatar {
    border-color: var(--card-bg, #1a2532);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

/* --- Tags / badges ----------------------------------------------------- */

[data-theme="dark"] .tag-item {
    background: rgba(95, 191, 180, 0.12) !important;
    color: #a8e0d8 !important;
    border-color: rgba(95, 191, 180, 0.28);
}

[data-theme="dark"] .level-badge {
    box-shadow: 0 4px 14px rgba(217, 124, 58, 0.45);
}

[data-theme="dark"] .read-time-badge,
[data-theme="dark"] .lang-badge {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

/* --- Forms / inputs ---------------------------------------------------- */

[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="search"],
[data-theme="dark"] input[type="email"],
[data-theme="dark"] input[type="password"],
[data-theme="dark"] textarea,
[data-theme="dark"] select {
    background-color: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary, #e8eef3);
}

[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
    color: rgba(232, 238, 243, 0.45);
}

[data-theme="dark"] input:focus,
[data-theme="dark"] textarea:focus,
[data-theme="dark"] select:focus {
    border-color: var(--accent-primary, #5fbfb4);
    box-shadow: 0 0 0 3px rgba(95, 191, 180, 0.18);
    background-color: rgba(255, 255, 255, 0.06);
    outline: none;
}

/* The .search-box wrapper is just a positioning container — its border
   is the input's own border. Don't add an extra one in dark mode. */
[data-theme="dark"] .search-box {
    background: transparent;
    border: 0;
}

[data-theme="dark"] .search-box input {
    background-color: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary, #e8eef3);
}

[data-theme="dark"] .search-box input:focus {
    border-color: var(--accent-primary, #5fbfb4);
    box-shadow: 0 0 0 3px rgba(95, 191, 180, 0.18);
    background-color: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .search-box i {
    color: rgba(232, 238, 243, 0.55);
}

/* --- Filters / category buttons --------------------------------------- */

[data-theme="dark"] .filter-btn {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary, #99adbe);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .filter-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary, #e8eef3);
}

[data-theme="dark"] .filter-btn.active {
    background: var(--accent-primary, #5fbfb4);
    color: #0e1620;
    border-color: var(--accent-primary, #5fbfb4);
}

/* --- Buttons (primary / secondary / outline) -------------------------- */

[data-theme="dark"] .btn-primary {
    background: var(--accent-primary, #5fbfb4);
    color: #0e1620;
    box-shadow: 0 6px 16px rgba(95, 191, 180, 0.3);
}

[data-theme="dark"] .btn-primary:hover {
    background: #74cfc4;
    box-shadow: 0 10px 24px rgba(95, 191, 180, 0.45);
}

[data-theme="dark"] .btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary, #e8eef3);
    border: 1px solid rgba(255, 255, 255, 0.14);
}

[data-theme="dark"] .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent-primary, #5fbfb4);
}

[data-theme="dark"] .btn-outline {
    color: var(--accent-primary, #5fbfb4);
    border-color: var(--accent-primary, #5fbfb4);
}

[data-theme="dark"] .btn-outline:hover {
    background: var(--accent-primary, #5fbfb4);
    color: #0e1620;
}

/* --- Header / navigation ---------------------------------------------- */

[data-theme="dark"] .header {
    background: rgba(14, 22, 32, 0.78);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .header.scrolled {
    background: rgba(14, 22, 32, 0.92);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .nav-menu a {
    color: var(--text-secondary, #99adbe);
}

[data-theme="dark"] .nav-menu a:hover,
[data-theme="dark"] .nav-menu a.active {
    color: var(--accent-primary, #5fbfb4);
}

[data-theme="dark"] .nav-menu a::after {
    background: var(--accent-primary, #5fbfb4);
}

[data-theme="dark"] .lang-toggle,
[data-theme="dark"] .theme-toggle,
[data-theme="dark"] .mobile-menu-toggle {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary, #e8eef3);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .lang-toggle:hover,
[data-theme="dark"] .theme-toggle:hover,
[data-theme="dark"] .mobile-menu-toggle:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(95, 191, 180, 0.3);
}

/* --- Footer ----------------------------------------------------------- */

[data-theme="dark"] .footer {
    background: #15212e;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    color: #e8eef3;
}

[data-theme="dark"] .footer-section h4 {
    color: #e8eef3;
}

[data-theme="dark"] .footer-brand p,
[data-theme="dark"] .footer-section a,
[data-theme="dark"] .footer-bottom {
    color: #99adbe;
}

[data-theme="dark"] .footer-brand .logo,
[data-theme="dark"] .footer-section a:hover {
    color: #5fbfb4;
}

/* --- Reading progress / back-to-top in dark mode --------------------- */

[data-theme="dark"] .reading-progress-bar {
    background: linear-gradient(90deg,
        var(--accent-primary, #5fbfb4) 0%,
        #d97c3a 100%);
}

[data-theme="dark"] .back-to-top {
    background: var(--card-bg, #1a2532);
    color: var(--accent-primary, #5fbfb4);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.6),
                0 0 0 1px rgba(95, 191, 180, 0.25);
}

[data-theme="dark"] .back-to-top:hover {
    background: var(--accent-primary, #5fbfb4);
    color: #0e1620;
}

/* --- Telegram cards in dark mode -------------------------------------- */

[data-theme="dark"] .telegram-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-primary, #e8eef3);
}

[data-theme="dark"] .telegram-btn:hover {
    border-color: rgba(95, 191, 180, 0.3);
    box-shadow: 0 22px 50px -12px rgba(0, 0, 0, 0.6),
                0 0 0 1px rgba(95, 191, 180, 0.25);
}

[data-theme="dark"] .telegram-btn .telegram-info p {
    color: var(--text-secondary, #99adbe);
}

[data-theme="dark"] .telegram-btn .member-count {
    background: rgba(95, 191, 180, 0.12);
    color: #a8e0d8;
}

/* --- Custom selection + scrollbar in dark mode ----------------------- */

[data-theme="dark"] ::selection {
    background: rgba(95, 191, 180, 0.45);
    color: #ffffff;
}

[data-theme="dark"] ::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

[data-theme="dark"] ::-webkit-scrollbar-track {
    background: #0e1620;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    border: 3px solid #0e1620;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: rgba(95, 191, 180, 0.4);
}

[data-theme="dark"] {
    scrollbar-color: rgba(255, 255, 255, 0.12) #0e1620;
}

/* --- Dividers / hairlines --------------------------------------------- */

[data-theme="dark"] hr,
[data-theme="dark"] .article-tags-row,
[data-theme="dark"] .article-meta-floating {
    border-color: rgba(255, 255, 255, 0.06) !important;
}

/* --- About banner: theme-aware swap ----------------------------------- */
/* Two <picture> elements live in the markup (one light, one dark). We
   show the one matching the current theme. Using display: none on the
   <picture> wrapper avoids loading both images visually while letting
   the swap be instant when the theme toggles. */

.about-banner-dark {
    display: none;
}

[data-theme="dark"] .about-banner-light {
    display: none;
}

[data-theme="dark"] .about-banner-dark {
    display: block;
}

@media (prefers-reduced-motion: reduce) {
    .article-image img,
    .article-card:hover .article-image img,
    .book-card-tall:hover .article-image img,
    .article-card:not(.book-card-tall)::before,
    .article-card:not(.book-card-tall):hover::before,
    .article-card:not(.book-card-tall)::after,
    .article-card:not(.book-card-tall):hover::after,
    .article-card .article-card-title-tall i,
    .article-card:hover .article-card-title-tall i,
    .book-card-tall .article-image::before,
    .book-card-tall:hover .article-image::before,
    .book-card-tall::before,
    .book-card-tall:hover::before,
    .telegram-btn,
    .telegram-btn:hover,
    .telegram-btn > i,
    .telegram-btn:hover > i,
    .telegram-btn::before,
    .telegram-btn::after,
    .social-links a,
    .social-links a:hover,
    .theme-toggle i,
    .theme-toggle:hover i,
    .mobile-menu-toggle i,
    .mobile-menu-toggle:hover i,
    .calendar-nav-btn i,
    .calendar-nav-btn:hover i,
    .back-to-top i,
    .back-to-top:hover i,
    .teacher-card-cta .fa-arrow-right-long,
    .teacher-card:hover .teacher-card-cta .fa-arrow-right-long {
        animation: none !important;
        transition: none !important;
        transform: none !important;
    }
}

/* === Availability calendar (public teacher page) =====================
   The flat green/gray block grid in teacher.css is replaced with a
   modern Calendly-style table: subtle hatched closed cells, soft mint
   "open" pills with a gentle glow, gradient header strip, pill week
   nav, full dark-mode coverage. DOM is unchanged.
======================================================================= */

.calendar-section {
    border-radius: var(--polish-radius-lg);
    padding: 2rem;
    border: 1px solid rgba(33, 51, 55, 0.06);
    box-shadow: var(--polish-shadow-md);
}

[data-theme="dark"] .calendar-section {
    border-color: rgba(255, 255, 255, 0.06);
}

.calendar-header {
    margin-bottom: 1.5rem;
}

.calendar-header h2 {
    font-weight: 700;
    letter-spacing: -0.02em;
}

.calendar-nav-btn {
    background: var(--polish-accent-soft);
    color: var(--accent-primary);
    width: 38px;
    height: 38px;
    box-shadow: none;
    transition: transform 0.25s ease,
                background 0.25s ease,
                color 0.25s ease,
                box-shadow 0.25s ease;
}

.calendar-nav-btn:hover {
    background: var(--accent-primary);
    color: #fff;
    transform: scale(1.06);
    box-shadow: 0 8px 18px rgba(32, 77, 72, 0.28);
}

[data-theme="dark"] .calendar-nav-btn:hover {
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.45);
}

.current-week {
    min-width: auto;
    padding: 8px 18px;
    border-radius: 999px;
    background: var(--polish-accent-soft);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* Legend: pill chips that match the rest of the polish layer ---------- */
.calendar-legend {
    margin-bottom: 1.5rem;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--polish-accent-soft);
    color: var(--text-primary);
    font-size: 0.82rem;
    font-weight: 500;
}

.legend-color {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    border: none;
}

.legend-color.unavailable {
    background:
        repeating-linear-gradient(
            135deg,
            transparent 0 3px,
            rgba(33, 51, 55, 0.18) 3px 4px
        ),
        rgba(33, 51, 55, 0.06);
}

[data-theme="dark"] .legend-color.unavailable {
    background:
        repeating-linear-gradient(
            135deg,
            transparent 0 3px,
            rgba(255, 255, 255, 0.16) 3px 4px
        ),
        rgba(255, 255, 255, 0.06);
}

.legend-color.available {
    background: linear-gradient(135deg, #4ec79a 0%, #2d9b73 100%);
    box-shadow: 0 0 0 3px rgba(78, 199, 154, 0.18);
}

/* Grid surface ------------------------------------------------------- */
.calendar-container {
    margin-bottom: 1.5rem;
}

.calendar-grid {
    background: rgba(33, 51, 55, 0.06);
    border: 1px solid rgba(33, 51, 55, 0.06);
    border-radius: var(--polish-radius-md);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6);
}

[data-theme="dark"] .calendar-grid {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.06);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

/* Top row: Time + day headers as a single brand gradient strip ------- */
.time-header,
.day-header {
    background: linear-gradient(135deg, #2d6a64 0%, #204d48 100%);
    color: #fff;
    height: 56px;
    border: none;
}

.time-header {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    opacity: 0.92;
}

.day-header .day-name {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.day-header .day-date {
    margin-top: 2px;
    font-size: 0.7rem;
    font-weight: 500;
    opacity: 0.78;
    font-variant-numeric: tabular-nums;
}

/* Time column: tinted, tabular numerics, no hard borders ------------- */
.time-slot {
    background: color-mix(in srgb, var(--card-bg) 96%, var(--accent-primary) 4%);
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    border: none;
}

[data-theme="dark"] .time-slot {
    background: color-mix(in srgb, var(--card-bg) 88%, #ffffff 6%);
    color: var(--text-secondary);
}

/* Closed slots: barely-there hatch on the card surface --------------- */
.calendar-slot {
    background: var(--card-bg);
    border: none;
    transition: background 0.2s ease,
                transform 0.2s ease,
                box-shadow 0.2s ease;
}

.calendar-slot.unavailable {
    background-color: var(--card-bg);
    background-image: repeating-linear-gradient(
        135deg,
        transparent 0 7px,
        rgba(33, 51, 55, 0.025) 7px 8px
    );
    cursor: default;
}

[data-theme="dark"] .calendar-slot.unavailable {
    background-image: repeating-linear-gradient(
        135deg,
        transparent 0 7px,
        rgba(255, 255, 255, 0.035) 7px 8px
    );
}

.calendar-slot.unavailable:hover {
    background-color: var(--card-bg);
    transform: none;
    box-shadow: none;
}

/* Open slots: soft mint pill, gentle inner highlight, scale on hover  */
.calendar-slot.available {
    background: linear-gradient(135deg, #4ec79a 0%, #2d9b73 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.25),
        inset 0 -2px 0 rgba(45, 155, 115, 0.45);
    cursor: pointer;
}

[data-theme="dark"] .calendar-slot.available {
    background: linear-gradient(135deg, #5fbfb4 0%, #3c9182 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.18),
        inset 0 -2px 0 rgba(0, 0, 0, 0.25);
}

.calendar-slot.available:hover {
    transform: scale(1.06);
    z-index: 2;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.35),
        0 8px 18px rgba(45, 155, 115, 0.4);
}

/* Booked slot: warm but softer than the legacy solid orange ---------- */
.calendar-slot.booked {
    background: linear-gradient(135deg, #d97c3a 0%, #955f30 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
    cursor: not-allowed;
}

@media (max-width: 768px) {
    .calendar-section {
        padding: 1.25rem;
    }
}

/* === Teacher detail page redesign =====================================
   Replaces the flat teacher.css hero/cards with a layered, modern design.
   teacher.css loads first; rules here win without !important.
   Touch points:
     - .teacher-info-section : page-level gradient background
     - .teacher-header       : hero card with decorative blobs
     - .teacher-image*       : double-ring portrait + floating online pill
     - .teacher-name*        : refined typography + tagline
     - .credential-item      : glass pill chips
     - .linkedin-link / .book-lesson-btn : harmonised CTA pair
     - .teacher-summary-card / .teacher-bio-card / .teacher-reviews-card
                             : refined card surfaces; old emoji ::before removed
     - .icon-row             : square brand-tinted icon tile + heading
     - reviews summary/list  : modern stat block + quote bubble entries
   Dark-mode parity is included throughout.
======================================================================= */

.teacher-info-section {
    position: relative;
    padding: 3rem 0 5rem;
    background:
        radial-gradient(ellipse 80% 60% at 50% 0%,
            color-mix(in srgb, var(--accent-primary) 14%, transparent) 0%,
            transparent 60%),
        var(--bg-primary);
}

[data-theme="dark"] .teacher-info-section {
    background:
        radial-gradient(ellipse 80% 60% at 50% 0%,
            rgba(95, 191, 180, 0.08) 0%,
            transparent 60%),
        var(--bg-primary);
}

/* ---- Hero card ---------------------------------------------------- */

.teacher-header {
    position: relative;
    overflow: hidden;
    grid-template-columns: 240px 1fr;
    gap: 2.5rem;
    padding: 2.5rem 2.75rem;
    border-radius: var(--polish-radius-lg);
    background:
        linear-gradient(135deg,
            color-mix(in srgb, var(--card-bg) 88%, var(--accent-primary) 8%) 0%,
            var(--card-bg) 60%),
        var(--card-bg);
    border: 1px solid rgba(33, 51, 55, 0.06);
    box-shadow: var(--polish-shadow-md);
    align-items: center;
    margin-bottom: 2.25rem;
}

[data-theme="dark"] .teacher-header {
    background:
        linear-gradient(135deg,
            color-mix(in srgb, var(--card-bg) 80%, #5fbfb4 4%) 0%,
            var(--card-bg) 65%),
        var(--card-bg);
    border-color: rgba(255, 255, 255, 0.06);
}

/* Soft blobs add depth without distraction */
.teacher-header .hero-blob {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    filter: blur(60px);
    z-index: 0;
}

.teacher-header .hero-blob-a {
    width: 380px;
    height: 380px;
    top: -160px;
    right: -120px;
    background: radial-gradient(circle,
        rgba(217, 124, 58, 0.18), transparent 65%);
}

.teacher-header .hero-blob-b {
    width: 320px;
    height: 320px;
    bottom: -140px;
    left: -100px;
    background: radial-gradient(circle,
        rgba(32, 77, 72, 0.15), transparent 65%);
}

[data-theme="dark"] .teacher-header .hero-blob-a {
    background: radial-gradient(circle,
        rgba(217, 124, 58, 0.22), transparent 65%);
}

[data-theme="dark"] .teacher-header .hero-blob-b {
    background: radial-gradient(circle,
        rgba(95, 191, 180, 0.18), transparent 65%);
}

.teacher-header .teacher-image-container,
.teacher-header .teacher-basic-info {
    position: relative;
    z-index: 1;
}

/* ---- Avatar ------------------------------------------------------- */

.teacher-image-container {
    display: flex;
    justify-content: center;
}

.teacher-image {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--card-bg);
    box-shadow:
        0 0 0 4px transparent,
        0 18px 38px rgba(33, 51, 55, 0.18);
    background:
        linear-gradient(var(--card-bg), var(--card-bg)) padding-box,
        linear-gradient(135deg, #d97c3a 0%, #2d6a64 100%) border-box;
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1),
                box-shadow 0.4s ease;
}

.teacher-image:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow:
        0 0 0 6px rgba(217, 124, 58, 0.18),
        0 24px 48px rgba(33, 51, 55, 0.22);
}

[data-theme="dark"] .teacher-image {
    box-shadow:
        0 0 0 4px transparent,
        0 18px 38px rgba(0, 0, 0, 0.5);
}

/* ---- Online status chip ------------------------------------------ */

.teacher-status {
    bottom: -6px;
    right: 50%;
    transform: translateX(50%);
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--card-bg);
    border: 1px solid rgba(33, 51, 55, 0.08);
    box-shadow: 0 6px 16px rgba(33, 51, 55, 0.12);
}

[data-theme="dark"] .teacher-status {
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.status-indicator {
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.status-indicator.online::before {
    width: 7px;
    height: 7px;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.22);
}

/* ---- Name + tagline ---------------------------------------------- */

.teacher-basic-info {
    gap: 1.25rem;
}

.teacher-name {
    font-size: clamp(2rem, 4vw, 2.75rem);
    font-weight: 800;
    letter-spacing: -0.025em;
    line-height: 1.1;
    background: linear-gradient(135deg,
        var(--text-primary) 0%,
        color-mix(in srgb, var(--accent-primary) 70%, var(--text-primary)) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

.teacher-tagline {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.5;
    color: var(--text-secondary);
    max-width: 60ch;
    font-weight: 500;
}

/* ---- Credential pills -------------------------------------------- */

.teacher-credentials {
    gap: 0.6rem;
    align-items: center;
}

.credential-item {
    padding: 8px 16px;
    border-radius: 999px;
    background: var(--polish-accent-soft);
    border: 1px solid rgba(33, 51, 55, 0.06);
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-primary);
}

[data-theme="dark"] .credential-item {
    border-color: rgba(255, 255, 255, 0.06);
}

.credential-item i {
    color: var(--accent-primary);
    font-size: 0.95rem;
}

.credential-item .credential-value {
    font-weight: 700;
    margin-right: 4px;
    color: var(--text-primary);
}

[dir="rtl"] .credential-item .credential-value {
    margin-right: 0;
    margin-left: 4px;
}

.credential-item.credential-rating i {
    color: #f4b942;
}

.credential-item .credential-meta {
    color: var(--text-secondary);
    font-weight: 500;
}

/* ---- Action buttons ---------------------------------------------- */

.teacher-links {
    margin-top: 0.5rem;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.linkedin-link {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.85rem 1.4rem;
    border-radius: 999px;
    background: var(--card-bg);
    border: 1.5px solid rgba(0, 119, 181, 0.25);
    color: #0077b5;
    font-weight: 600;
    font-size: 0.95rem;
    transition: transform 0.25s ease,
                background 0.25s ease,
                border-color 0.25s ease,
                box-shadow 0.25s ease;
}

.linkedin-link:hover {
    background: #0077b5;
    border-color: #0077b5;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 10px 22px rgba(0, 119, 181, 0.28);
}

[data-theme="dark"] .linkedin-link {
    background: rgba(0, 119, 181, 0.12);
    border-color: rgba(0, 119, 181, 0.4);
    color: #6cb4d8;
}

.book-lesson-btn,
.teacher-links .btn.btn-primary {
    background: linear-gradient(135deg, #2d6a64 0%, #204d48 100%);
    color: #fff;
    border: none;
    padding: 0.85rem 1.6rem;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.01em;
    box-shadow:
        0 10px 24px rgba(32, 77, 72, 0.32),
        inset 0 1px 0 rgba(255, 255, 255, 0.18);
    transition: transform 0.25s ease, box-shadow 0.25s ease, filter 0.25s ease;
}

.book-lesson-btn:hover,
.teacher-links .btn.btn-primary:hover {
    transform: translateY(-2px);
    filter: brightness(1.08);
    box-shadow:
        0 14px 32px rgba(32, 77, 72, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

[data-theme="dark"] .book-lesson-btn,
[data-theme="dark"] .teacher-links .btn.btn-primary {
    background: linear-gradient(135deg, #5fbfb4 0%, #3c9182 100%);
    box-shadow:
        0 10px 24px rgba(0, 0, 0, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

/* ---- Detail cards (About + Introduction) ------------------------- */

.teacher-summary-card,
.teacher-bio-card,
.teacher-languages-card,
.teacher-reviews-card {
    border-radius: var(--polish-radius-lg);
    padding: 2rem 2.25rem;
    border: 1px solid rgba(33, 51, 55, 0.06);
    box-shadow: var(--polish-shadow-md);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

[data-theme="dark"] .teacher-summary-card,
[data-theme="dark"] .teacher-bio-card,
[data-theme="dark"] .teacher-languages-card,
[data-theme="dark"] .teacher-reviews-card {
    border-color: rgba(255, 255, 255, 0.06);
}

/* Drop the legacy emoji bullet before card titles — the .icon-row icon
   already serves that purpose. */
.teacher-summary-card h2::before,
.teacher-bio-card h2::before,
.teacher-languages-card h2::before,
.teacher-reviews-card h2::before {
    content: none;
}

/* Modern card heading row: square icon tile + heading */
.icon-row {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin-bottom: 1.5rem;
}

.icon-row > i,
.icon-row > .fa,
.icon-row > .fas,
.icon-row > .fa-solid,
.icon-row > .fa-regular,
.icon-row > .fa-brands {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: linear-gradient(135deg,
        color-mix(in srgb, var(--accent-primary) 14%, var(--card-bg)) 0%,
        color-mix(in srgb, var(--accent-primary) 22%, var(--card-bg)) 100%);
    color: var(--accent-primary);
    font-size: 1.15rem;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.55),
        0 4px 10px rgba(33, 51, 55, 0.06);
}

[data-theme="dark"] .icon-row > i,
[data-theme="dark"] .icon-row > .fa,
[data-theme="dark"] .icon-row > .fas,
[data-theme="dark"] .icon-row > .fa-solid,
[data-theme="dark"] .icon-row > .fa-regular,
[data-theme="dark"] .icon-row > .fa-brands {
    background: linear-gradient(135deg,
        rgba(95, 191, 180, 0.16) 0%,
        rgba(95, 191, 180, 0.28) 100%);
    color: #5fbfb4;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.06),
        0 4px 10px rgba(0, 0, 0, 0.35);
}

.icon-row h1,
.icon-row h2 {
    margin: 0;
    font-size: 1.45rem;
    font-weight: 700;
    letter-spacing: -0.015em;
    color: var(--text-primary);
}

/* Bio body: refined blockquote feel without the heavy bg slab */
.summary-content {
    font-size: 1.02rem;
    line-height: 1.75;
    color: var(--text-secondary);
    background: transparent;
    padding: 0 0 0 1.25rem;
    border-radius: 0;
    border-left: 3px solid;
    border-image: linear-gradient(180deg,
        var(--accent-primary) 0%,
        color-mix(in srgb, var(--accent-primary) 30%, transparent) 100%) 1;
}

[dir="rtl"] .summary-content {
    padding: 0 1.25rem 0 0;
    border-left: none;
    border-right: 3px solid;
}

/* Introduction video: rounded frame with soft glow */
.intro-video {
    width: 100%;
    max-width: 100%;
    height: auto;
    border-radius: var(--polish-radius-md);
    box-shadow:
        0 14px 32px rgba(33, 51, 55, 0.16),
        0 0 0 1px rgba(33, 51, 55, 0.06);
    background: #000;
    display: block;
}

[data-theme="dark"] .intro-video {
    box-shadow:
        0 14px 32px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.06);
}

.teacher-bio-card {
    display: flex;
    flex-direction: column;
}

.teacher-bio-card .icon-row {
    margin-bottom: 1.25rem;
}

/* ---- Reviews ------------------------------------------------------ */

.reviews-summary {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 2rem;
    align-items: center;
    padding: 1.5rem;
    margin-bottom: 1.75rem;
    border-radius: var(--polish-radius-md);
    background:
        linear-gradient(135deg,
            color-mix(in srgb, var(--accent-primary) 6%, var(--card-bg)) 0%,
            var(--card-bg) 100%);
    border: 1px solid rgba(33, 51, 55, 0.05);
}

[data-theme="dark"] .reviews-summary {
    border-color: rgba(255, 255, 255, 0.05);
    background:
        linear-gradient(135deg,
            color-mix(in srgb, #5fbfb4 6%, var(--card-bg)) 0%,
            var(--card-bg) 100%);
}

.rating-overview {
    text-align: center;
}

.rating-score {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, #f4b942 0%, #d97c3a 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

.rating-stars {
    margin: 0.5rem 0 0.25rem;
    color: #f4b942;
    letter-spacing: 0.1em;
    font-size: 1rem;
}

.rating-count {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.review-item {
    padding: 1.5rem 1.75rem;
    margin-bottom: 1rem;
    border-radius: var(--polish-radius-md);
    background: var(--card-bg);
    border: 1px solid rgba(33, 51, 55, 0.06);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

[data-theme="dark"] .review-item {
    border-color: rgba(255, 255, 255, 0.06);
}

.review-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--polish-shadow-sm);
}

.review-header {
    margin-bottom: 0.75rem;
}

.reviewer-avatar {
    border: 2px solid var(--card-bg);
    box-shadow: 0 4px 10px rgba(33, 51, 55, 0.12);
}

.reviewer-name {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
}

.review-date {
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.review-rating {
    color: #f4b942;
    letter-spacing: 0.08em;
}

.review-content p {
    font-size: 0.98rem;
    line-height: 1.7;
    color: var(--text-secondary);
    margin: 0;
}

/* ---- Mobile -------------------------------------------------------- */

@media (max-width: 1024px) {
    .teacher-header {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 1.75rem;
        padding: 2rem;
    }

    .teacher-tagline {
        margin-left: auto;
        margin-right: auto;
    }

    .teacher-credentials {
        justify-content: center;
    }

    .teacher-links {
        justify-content: center;
    }

    .reviews-summary {
        grid-template-columns: 1fr;
        text-align: center;
    }
}

@media (max-width: 768px) {
    .teacher-info-section {
        padding: 1.5rem 0 3rem;
    }

    .teacher-header {
        padding: 2rem 1.5rem;
    }

    .teacher-image {
        width: 160px;
        height: 160px;
    }

    .teacher-summary-card,
    .teacher-bio-card,
    .teacher-languages-card,
    .teacher-reviews-card {
        padding: 1.5rem;
    }

    .review-item {
        padding: 1.25rem;
    }

    .icon-row > i,
    .icon-row > .fa,
    .icon-row > .fas,
    .icon-row > .fa-solid,
    .icon-row > .fa-regular,
    .icon-row > .fa-brands {
        width: 38px;
        height: 38px;
        font-size: 1rem;
    }

    .icon-row h1,
    .icon-row h2 {
        font-size: 1.2rem;
    }
}
