:root {
    --bg: #f7f5f0;
    --surface: #fffdf8;
    --surface-strong: #ffffff;
    --ink: #20231f;
    --muted: #6c716a;
    --line: #ded8cc;
    --accent: #4b0a8a;
    --accent-strong: #330066;
    --accent-soft: #efe4fb;
    --accent-ink: #ffffff;
    --warn: #7a4aa3;
    --shadow: 0 16px 40px rgba(32, 35, 31, 0.08);
    --header-bg: rgba(255, 253, 248, 0.94);
    --chip-bg: #f4eef9;
    --danger: #8a2f22;
    --danger-line: #d3a8a0;
}

html[data-theme="dark"] {
    --bg: #110f16;
    --surface: #1b1722;
    --surface-strong: #241d2e;
    --ink: #f3f1ea;
    --muted: #b8b3a8;
    --line: #41364f;
    --accent: #b57cff;
    --accent-strong: #d6b6ff;
    --accent-soft: #2a163f;
    --accent-ink: #1f132b;
    --warn: #d1a6ff;
    --shadow: 0 16px 40px rgba(7, 3, 12, 0.34);
    --header-bg: rgba(31, 24, 40, 0.94);
    --chip-bg: #2d2238;
    --danger: #f0a196;
    --danger-line: #74453f;
}

html, body {
    margin: 0;
    min-height: 100%;
    background: var(--bg);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    overflow-x: hidden;
}

a {
    color: var(--accent-strong);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

button, input, select, textarea {
    font: inherit;
}

.app-shell {
    min-height: 100vh;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem clamp(1rem, 4vw, 3rem);
    border-bottom: 1px solid var(--line);
    background: var(--header-bg);
    backdrop-filter: blur(12px);
}

.app-shell[dir="rtl"] .site-header,
.app-shell[dir="rtl"] .section-heading,
.app-shell[dir="rtl"] .page-header.compact {
    direction: rtl;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    color: var(--ink);
    font-weight: 750;
}

.brand-mark {
    width: 2.25rem;
    height: 2.25rem;
    display: block;
    border-radius: 8px;
    object-fit: contain;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.site-nav a, .logout-form button, .nav-toggle-label, .theme-toggle-button, .topbar-toggle-group a {
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--ink);
    padding: 0.55rem 0.75rem;
    cursor: pointer;
}

.site-nav a.active, .topbar-toggle-group a.active {
    background: var(--accent-soft);
    color: var(--accent-strong);
}

.topbar-toggle-group {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
    padding: 0.1rem;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.topbar-toggle-group a {
    padding: 0.42rem 0.5rem;
    font-size: 0.78rem;
    font-weight: 760;
}

.theme-toggle-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    border: 1px solid var(--line);
    background: var(--surface-strong);
    font-size: 0.82rem;
    min-width: 5.25rem;
}

.theme-icon {
    width: 1.05rem;
    height: 1.05rem;
    display: inline-flex;
}

.theme-icon svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.moon-icon {
    display: none;
}

.theme-label::after {
    content: "Light";
}

html[data-theme="dark"] .sun-icon {
    display: none;
}

html[data-theme="dark"] .moon-icon {
    display: inline-flex;
}

html[data-theme="dark"] .theme-label::after {
    content: "Dark";
}

.logout-form {
    display: inline;
}

.link-button {
    border: 0;
    background: transparent;
    color: var(--accent-strong);
    padding: 0;
    cursor: pointer;
}

.danger-link {
    color: var(--danger);
}

.nav-toggle, .nav-toggle-label {
    display: none;
}

.main-content {
    width: min(1180px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 2rem 0 4rem;
}

.hero {
    min-height: 48vh;
    display: grid;
    align-items: center;
    padding: clamp(2rem, 6vw, 5rem) 0;
}

.hero h1, .page-header h1 {
    max-width: 860px;
    margin: 0;
    font-size: clamp(2.3rem, 6vw, 5.7rem);
    line-height: 0.97;
    letter-spacing: 0;
}

.lead, .page-header p {
    max-width: 720px;
    color: var(--muted);
    font-size: 1.1rem;
    line-height: 1.65;
}

.eyebrow {
    margin: 0 0 0.8rem;
    color: var(--accent-strong);
    font-size: 0.78rem;
    font-weight: 780;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.search-row, .filters, .form-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.search-row {
    margin-top: 1.75rem;
}

.search-input, .select-input, .admin-form input, .admin-form select, .admin-form textarea {
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface-strong);
    color: var(--ink);
    padding: 0.78rem 0.9rem;
}

.search-input {
    min-width: min(100%, 420px);
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.65rem;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 0.65rem 1rem;
    font-weight: 720;
    cursor: pointer;
}

.button.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-ink);
}

.button.secondary {
    background: var(--surface-strong);
    color: var(--ink);
}

.button.danger {
    border-color: var(--danger-line);
    color: var(--danger);
}

.section-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0 2.5rem;
}

.feature-link, .text-card, .detail-shell, .form-panel, .table-shell {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.feature-link {
    display: grid;
    gap: 0.55rem;
    padding: 1.25rem;
}

.feature-link span {
    color: var(--accent-strong);
    font-weight: 780;
}

.feature-link strong {
    color: var(--ink);
    font-size: 1.05rem;
    line-height: 1.45;
}

.content-section, .page-header {
    margin: 2rem 0;
}

.page-header.compact {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1rem;
}

.page-header.compact h1 {
    font-size: clamp(2rem, 4vw, 3.3rem);
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.text-card {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding: 1.25rem;
    min-width: 0;
}

.text-card h2, .text-card h3 {
    margin: 0.75rem 0 0;
    line-height: 1.2;
}

.muted-text {
    color: var(--muted);
}

.meta-row, .tag-row {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.meta-row span, .tag-row span, .tag-row a, .status, .language-switch a {
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--chip-bg);
    color: var(--muted);
    padding: 0.25rem 0.55rem;
    font-size: 0.82rem;
}

.language-switch {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 1rem;
}

.language-switch a.active {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-weight: 760;
}

.arabic-snippet, .arabic-text, .arabic-input {
    font-family: "Amiri", "Noto Naskh Arabic", "Segoe UI", serif;
}

.arabic-snippet {
    font-size: 1.45rem;
    line-height: 1.9;
    overflow-wrap: anywhere;
}

.arabic-text {
    font-size: clamp(2rem, 5vw, 3.6rem);
    line-height: 1.85;
    overflow-wrap: anywhere;
}

.detail-shell {
    padding: clamp(1.25rem, 4vw, 3rem);
}

.detail-shell h1 {
    font-size: clamp(2.2rem, 5vw, 4.2rem);
    line-height: 1.05;
}

.text-block {
    margin: 2rem 0;
    padding-top: 1.25rem;
    border-top: 1px solid var(--line);
}

.text-block h2 {
    color: var(--muted);
    font-size: 0.95rem;
    text-transform: uppercase;
}

.source-link {
    display: inline-flex;
    margin-top: 0.25rem;
    color: var(--accent-strong);
    font-weight: 700;
}

.filters {
    margin-bottom: 1.2rem;
}

.empty-state, .notice {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    padding: 1rem;
}

.toast-banner {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 40;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    max-width: min(92vw, 28rem);
    padding: 0.95rem 1rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-strong);
    box-shadow: var(--shadow);
}

.toast-banner.success {
    border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
}

.toast-banner.error {
    border-color: color-mix(in srgb, var(--danger) 45%, var(--line));
}

.toast-dismiss {
    border: 0;
    background: transparent;
    color: var(--accent-strong);
    cursor: pointer;
    font-weight: 720;
    padding: 0;
    white-space: nowrap;
}

.feedback-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: grid;
    place-items: center;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.36);
}

.feedback-modal {
    width: min(100%, 26rem);
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-strong);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.24);
    padding: 1.35rem;
}

.feedback-modal.success {
    border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
}

.feedback-modal.error {
    border-color: color-mix(in srgb, var(--danger) 55%, var(--line));
}

.feedback-modal h2 {
    margin: 0 0 0.6rem;
    font-size: 1.5rem;
}

.feedback-modal p:not(.eyebrow) {
    color: var(--muted);
    line-height: 1.55;
}

.admin-form {
    display: grid;
    gap: 1rem;
}

.form-panel {
    display: grid;
    gap: 1rem;
    padding: 1.2rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.form-grid .wide, .form-panel label, .admin-form label {
    display: grid;
    gap: 0.35rem;
}

.form-grid .wide {
    grid-column: 1 / -1;
}

.admin-form textarea {
    min-height: 8rem;
}

.review-form {
    margin: 1rem 0;
}

.review-source {
    margin: 1rem 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    padding: 0.85rem 0;
}

.review-source summary {
    color: var(--accent-strong);
    cursor: pointer;
    font-weight: 760;
}

.table-shell {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th, .data-table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

.data-table th {
    color: var(--muted);
    font-size: 0.85rem;
    text-transform: uppercase;
}

.table-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.account-layout {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 1.25rem;
}

.account-panel {
    max-width: 520px;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#blazor-error-ui {
    display: none;
}

@media (max-width: 760px) {
    .site-header {
        align-items: flex-start;
        gap: 0.65rem;
        padding: 0.75rem 1rem;
    }

    .nav-toggle-label {
        display: inline-flex;
        border: 1px solid var(--line);
        background: var(--surface-strong);
        min-height: 2.35rem;
        align-items: center;
    }

    .site-nav {
        display: none;
        width: 100%;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: stretch;
        order: 3;
        gap: 0.45rem;
        padding-top: 0.5rem;
    }

    .nav-toggle:checked ~ .site-nav {
        display: grid;
    }

    .site-header {
        flex-wrap: wrap;
    }

    .brand {
        min-width: 0;
        max-width: calc(100% - 6rem);
    }

    .brand span:last-child {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .site-nav a, .logout-form button, .theme-toggle-button {
        width: 100%;
        justify-content: center;
        text-align: center;
        border: 1px solid var(--line);
        background: var(--surface-strong);
    }

    .topbar-toggle-group {
        grid-column: 1 / -1;
        justify-content: center;
        background: var(--surface);
    }

    .topbar-toggle-group a {
        width: auto;
        min-width: 4rem;
        border: 0;
        background: transparent;
    }

    .search-row > *, .filters > *, .form-actions > * {
        width: 100%;
    }

    .main-content {
        width: min(100% - 1.25rem, 720px);
        padding: 1.1rem 0 2.5rem;
    }

    .hero {
        min-height: auto;
        padding: 2rem 0 1.25rem;
    }

    .hero h1, .page-header h1 {
        font-size: clamp(2rem, 11vw, 3rem);
        line-height: 1.04;
    }

    .lead, .page-header p {
        font-size: 1rem;
        line-height: 1.55;
    }

    .section-grid, .cards-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .feature-link, .text-card, .detail-shell, .form-panel {
        border-radius: 7px;
        padding: 1rem;
    }

    .detail-shell h1 {
        font-size: clamp(1.9rem, 10vw, 2.75rem);
        line-height: 1.08;
    }

    .arabic-snippet {
        font-size: 1.25rem;
        line-height: 1.75;
    }

    .arabic-text {
        font-size: clamp(1.65rem, 8vw, 2.35rem);
        line-height: 1.75;
    }

    .meta-row, .tag-row, .language-switch {
        gap: 0.35rem;
    }

    .filters {
        align-items: stretch;
        gap: 0.55rem;
    }

    .page-header.compact {
        display: block;
    }

    .account-layout {
        grid-template-columns: 1fr;
    }

    .toast-banner {
        left: 0.75rem;
        right: 0.75rem;
        bottom: 0.75rem;
        max-width: none;
    }

    .footer-inner {
        flex-direction: column;
        text-align: center;
    }

    .footer-nav {
        justify-content: center;
    }

    .footer-lang {
        justify-content: center;
    }

    .detail-actions {
        flex-direction: column;
    }

    .detail-actions .button {
        width: 100%;
    }
}

/* Footer */
.site-footer {
    margin-top: 3rem;
    border-top: 1px solid var(--line);
    background: var(--surface);
}

.footer-inner {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 2rem;
    width: min(1180px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 2.5rem 0 1.5rem;
}

.footer-brand strong {
    font-size: 1.1rem;
}

.footer-brand p {
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0.4rem 0 0;
    max-width: 320px;
}

.footer-nav {
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
}

.footer-nav a {
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 600;
}

.footer-nav a:hover {
    color: var(--accent-strong);
}

.footer-lang {
    display: flex;
    gap: 0.5rem;
}

.footer-lang a {
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--chip-bg);
    color: var(--muted);
    padding: 0.3rem 0.7rem;
    font-size: 0.82rem;
}

.footer-lang a.active {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-weight: 760;
}

.footer-bottom {
    border-top: 1px solid var(--line);
    padding: 1rem 0;
    text-align: center;
    color: var(--muted);
    font-size: 0.82rem;
}

/* Detail page action buttons */
.detail-actions {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
    margin-top: 1.5rem;
}

.detail-actions .button {
    gap: 0.4rem;
}

.detail-actions .button.success {
    border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
    background: var(--accent-soft);
    color: var(--accent-strong);
}

.detail-actions .button svg {
    width: 1rem;
    height: 1rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}

/* Public purple visual system */
.header-art {
    display: none;
}

.public-shell {
    --bg: #08050f;
    --surface: rgba(24, 11, 38, 0.82);
    --surface-strong: rgba(39, 18, 61, 0.9);
    --ink: #fff9ff;
    --muted: #d8c7e8;
    --line: rgba(185, 83, 255, 0.42);
    --accent: #8f2cff;
    --accent-strong: #e0b7ff;
    --accent-soft: rgba(136, 41, 255, 0.22);
    --accent-ink: #ffffff;
    --warn: #dcb6ff;
    --shadow: 0 0 24px rgba(153, 47, 255, 0.32), 0 18px 48px rgba(0, 0, 0, 0.38);
    --header-bg: rgba(13, 8, 21, 0.88);
    --chip-bg: rgba(70, 30, 101, 0.68);
    min-height: 100vh;
    background:
        radial-gradient(circle at 50% 7rem, rgba(138, 58, 220, 0.58), transparent 17rem),
        radial-gradient(circle at 10% 22rem, rgba(126, 35, 255, 0.22), transparent 20rem),
        linear-gradient(180deg, #07040d 0%, #150821 42%, #08050f 100%);
    color: var(--ink);
}

.public-shell a {
    color: var(--accent-strong);
}

.public-shell .site-header {
    min-height: 4.75rem;
    border-bottom-color: rgba(210, 155, 255, 0.18);
    background:
        radial-gradient(circle at 45% 0%, rgba(135, 53, 220, 0.5), transparent 14rem),
        var(--header-bg);
    box-shadow: 0 10px 34px rgba(0, 0, 0, 0.28);
}

.public-shell .brand {
    color: #ffffff;
    font-size: 1.08rem;
    font-weight: 800;
}

.public-shell .brand-mark {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 22px rgba(159, 58, 255, 0.38);
}

.public-shell .header-art {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(0.3rem, 2vw, 1rem);
    flex: 1;
    min-width: 6rem;
    pointer-events: none;
}

.public-shell .header-art img {
    width: clamp(2.2rem, 8vw, 4rem);
    height: clamp(2.2rem, 8vw, 4rem);
    object-fit: contain;
    opacity: 0.72;
    filter: drop-shadow(0 0 18px rgba(194, 108, 255, 0.38));
}

.public-shell .site-nav a,
.public-shell .logout-form button,
.public-shell .theme-toggle-button,
.public-shell .nav-toggle-label {
    color: var(--ink);
}

.public-shell .site-nav a.active,
.public-shell .topbar-toggle-group a.active {
    border-color: rgba(190, 93, 255, 0.72);
    background: rgba(132, 38, 224, 0.32);
    color: #ffffff;
}

.public-shell .main-content {
    width: min(1180px, calc(100% - 2rem));
    padding-top: 0;
}

.public-shell .home-hero {
    position: relative;
    isolation: isolate;
    min-height: min(34rem, calc(100svh - 5rem));
    align-items: end;
    margin-inline: calc(50% - 50vw);
    padding: clamp(8rem, 22vw, 13rem) max(1rem, calc(50vw - 590px)) 1.2rem;
    overflow: hidden;
    border-bottom: 1px solid rgba(210, 155, 255, 0.18);
    background:
        radial-gradient(circle at 50% 38%, rgba(179, 87, 255, 0.55), transparent 16rem),
        radial-gradient(circle at 50% 55%, rgba(80, 25, 125, 0.92), transparent 24rem),
        linear-gradient(180deg, rgba(20, 7, 32, 0.96), rgba(8, 4, 14, 0.98));
}

.public-shell .hero-art {
    position: absolute;
    inset: 0;
    z-index: -1;
    display: grid;
    place-items: start center;
    pointer-events: none;
}

.public-shell .hero-butterfly {
    width: min(88vw, 38rem);
    max-height: 31rem;
    margin-top: clamp(2rem, 8vw, 4.5rem);
    object-fit: contain;
    opacity: 0.88;
    filter: drop-shadow(0 0 30px rgba(196, 102, 255, 0.42));
}

.public-shell .hero-copy {
    position: relative;
    width: min(100%, 58rem);
    margin-inline: auto;
    text-align: center;
    text-shadow: 0 2px 14px rgba(0, 0, 0, 0.84);
}

.public-shell .hero h1 {
    max-width: none;
    outline: none;
    color: #ffffff;
    font-size: clamp(3rem, 11vw, 6.4rem);
    font-weight: 850;
    letter-spacing: 0;
}

.public-shell .hero .lead {
    max-width: 48rem;
    margin: 0.9rem auto 0;
    color: rgba(244, 235, 255, 0.9);
    font-size: clamp(1.02rem, 2.2vw, 1.35rem);
    font-weight: 640;
    line-height: 1.55;
}

.public-shell .eyebrow {
    color: #f0d9ff;
    text-transform: none;
    letter-spacing: 0;
    font-size: clamp(1rem, 2.5vw, 1.35rem);
    font-weight: 760;
}

.public-shell .search-row,
.public-shell .filters {
    border: 1px solid rgba(207, 143, 255, 0.52);
    border-radius: 10px;
    background: rgba(17, 8, 28, 0.72);
    box-shadow: 0 0 24px rgba(153, 47, 255, 0.28);
    backdrop-filter: blur(14px);
}

.public-shell .search-row {
    width: min(100%, 46rem);
    margin: 1.6rem auto 0;
    padding: 0.35rem;
    flex-wrap: nowrap;
    gap: 0.4rem;
}

.public-shell .filters {
    padding: 0.65rem;
}

.public-shell .search-input,
.public-shell .select-input {
    border-color: rgba(218, 169, 255, 0.26);
    background: rgba(7, 3, 13, 0.48);
    color: #fff;
}

.public-shell .select-input option {
    background: #170821;
    color: #fff;
}

.public-shell .select-input option:checked,
.public-shell .select-input option:hover {
    background: #64209b;
    color: #fff;
}

.public-shell .search-row .search-input {
    flex: 1 1 auto;
    min-width: 0;
    border-color: transparent;
    background: transparent;
}

.public-shell .search-input::placeholder {
    color: rgba(234, 214, 250, 0.68);
}

.public-shell .button {
    border-radius: 9px;
}

.public-shell .button.primary {
    border-color: rgba(187, 99, 255, 0.9);
    background: linear-gradient(180deg, #a746ff, #8126e8);
    color: #ffffff;
    box-shadow: 0 0 22px rgba(145, 40, 255, 0.35);
}

.public-shell .button.secondary {
    border-color: rgba(199, 122, 255, 0.38);
    background: rgba(26, 12, 41, 0.84);
    color: #ffffff;
}

.public-shell .section-grid,
.public-shell .cards-grid,
.public-shell .home-teaser-grid {
    position: relative;
}

.public-shell .home-feature-grid {
    margin-top: 1rem;
}

.public-shell .feature-link,
.public-shell .text-card,
.public-shell .detail-shell,
.public-shell .empty-state,
.public-shell .notice {
    border-color: rgba(189, 77, 255, 0.62);
    background:
        linear-gradient(180deg, rgba(33, 13, 52, 0.88), rgba(17, 7, 29, 0.9));
    box-shadow: 0 0 16px rgba(158, 45, 255, 0.42), inset 0 0 0 1px rgba(255, 255, 255, 0.035);
}

.public-shell .feature-link:hover,
.public-shell .text-card:hover,
.public-shell .visual-teaser:hover {
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 0 24px rgba(180, 73, 255, 0.58), 0 16px 42px rgba(0, 0, 0, 0.38);
}

.public-shell .feature-link,
.public-shell .text-card,
.public-shell .visual-teaser {
    transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.public-shell .feature-link span,
.public-shell .meta-row span,
.public-shell .tag-row span,
.public-shell .tag-row a,
.public-shell .language-switch a,
.public-shell .status {
    border-color: rgba(209, 142, 255, 0.34);
    background: rgba(101, 42, 145, 0.36);
    color: #dcc3ef;
}

.public-shell .feature-link span {
    justify-self: start;
    border: 0;
    border-radius: 0;
    background: transparent;
    padding: 0;
    color: #d9b7f4;
}

.public-shell .feature-link strong,
.public-shell .text-card h2 a,
.public-shell .text-card h3 a,
.public-shell .section-heading h2,
.public-shell .page-header h1,
.public-shell .detail-shell h1,
.public-shell .footer-brand strong {
    color: #ffffff;
}

.public-shell .text-card p,
.public-shell .detail-shell p,
.public-shell .page-header p,
.public-shell .footer-brand p,
.public-shell .muted-text {
    color: var(--muted);
}

.public-shell .card-excerpt {
    display: -webkit-box;
    margin: 1rem 0 0;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    font-size: 1rem;
    line-height: 1.55;
}

.public-shell .cards-grid > .text-card h2 {
    min-height: 8.9rem;
}

.public-shell .page-header {
    position: relative;
    margin: 1.25rem 0 1.5rem;
    padding: clamp(1.4rem, 5vw, 3rem);
    overflow: hidden;
    border: 1px solid rgba(189, 77, 255, 0.46);
    border-radius: 12px;
    background:
        radial-gradient(circle at 76% 20%, rgba(158, 53, 255, 0.35), transparent 18rem),
        linear-gradient(180deg, rgba(31, 12, 50, 0.88), rgba(14, 6, 23, 0.92));
    box-shadow: var(--shadow);
}

.public-shell .page-header h1 {
    outline: none;
    font-size: clamp(2.4rem, 7vw, 5rem);
}

.public-shell .language-switch a.active {
    border-color: rgba(211, 147, 255, 0.82);
    background: rgba(141, 44, 255, 0.38);
    color: #ffffff;
}

.public-shell .home-teaser-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin: -0.5rem 0 2.25rem;
}

.public-shell .visual-teaser {
    position: relative;
    min-height: 13rem;
    overflow: hidden;
    display: grid;
    align-content: end;
    gap: 0.45rem;
    padding: 1.25rem;
    border: 1px solid rgba(189, 77, 255, 0.62);
    border-radius: 10px;
    background:
        radial-gradient(circle at 20% 25%, rgba(166, 66, 255, 0.28), transparent 12rem),
        linear-gradient(180deg, rgba(34, 13, 54, 0.9), rgba(14, 6, 23, 0.93));
    box-shadow: var(--shadow);
}

.public-shell .visual-teaser img {
    position: absolute;
    left: 0.7rem;
    bottom: 0.5rem;
    width: min(42%, 10rem);
    max-height: 11rem;
    object-fit: contain;
    opacity: 0.72;
    filter: drop-shadow(0 0 16px rgba(202, 138, 255, 0.36));
}

.public-shell .visual-teaser span,
.public-shell .visual-teaser strong {
    position: relative;
    margin-left: min(8rem, 36%);
}

.public-shell .visual-teaser span {
    color: #ffffff;
    font-size: clamp(1.15rem, 2.5vw, 1.45rem);
    font-weight: 820;
    line-height: 1.2;
}

.public-shell .visual-teaser strong {
    color: var(--muted);
    font-size: 0.98rem;
    line-height: 1.55;
}

.public-shell .detail-shell {
    margin-top: 1.25rem;
}

.public-shell .suggestion-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.public-shell .suggestion-card {
    display: grid;
    align-content: center;
    gap: 0.65rem;
    min-height: 8rem;
}

.public-shell .suggestion-card h3 {
    margin: 0;
    font-size: clamp(1.25rem, 2.2vw, 1.7rem);
    line-height: 1.22;
}

.public-shell .suggestion-card p {
    margin: 0;
    color: rgba(226, 205, 243, 0.78);
    font-size: 0.98rem;
    line-height: 1.45;
}

.public-shell .text-block {
    border-top-color: rgba(210, 155, 255, 0.22);
}

.public-shell .text-block h2 {
    color: #e8ccff;
    letter-spacing: 0;
}

.public-shell .text-block .arabic-text {
    position: relative;
    margin: 1.15rem 0 0;
    padding: clamp(1rem, 2vw, 1.35rem);
    border: 1px solid rgba(215, 156, 255, 0.2);
    border-radius: 12px;
    background:
        radial-gradient(circle at 100% 0%, rgba(171, 73, 255, 0.18), transparent 18rem),
        rgba(12, 5, 21, 0.42);
    color: #f6eaff;
    font-family: "Amiri", "Noto Naskh Arabic", "Scheherazade New", "Segoe UI", serif;
    font-size: clamp(1.45rem, 1.15vw + 1rem, 2.15rem);
    font-weight: 500;
    line-height: 1.85;
    text-align: right;
    text-shadow: 0 0 14px rgba(198, 129, 255, 0.14);
    letter-spacing: 0;
    box-shadow: inset 0 0 28px rgba(150, 45, 255, 0.08);
}

.public-shell .rich-text {
    display: grid;
    gap: 0.85rem;
    color: var(--muted);
    line-height: 1.85;
    overflow-wrap: anywhere;
}

.public-shell .rich-text p {
    margin: 0;
}

.public-shell .rich-text a {
    color: #f2d9ff;
    font-weight: 760;
    text-decoration: underline;
    text-underline-offset: 0.18em;
    word-break: break-word;
}

.public-shell .source-link {
    color: #f2d9ff;
}

.public-shell .site-footer {
    border-top-color: rgba(210, 155, 255, 0.18);
    background: rgba(8, 4, 14, 0.94);
}

.public-shell .footer-bottom {
    border-top-color: rgba(210, 155, 255, 0.14);
}

.public-shell .footer-nav a,
.public-shell .footer-lang a {
    color: var(--muted);
}

.public-shell .detail-actions .button.success {
    border-color: rgba(211, 147, 255, 0.82);
    background: rgba(141, 44, 255, 0.38);
    color: #ffffff;
}

.public-shell[dir="rtl"] .hero-copy,
.public-shell[dir="rtl"] .page-header,
.public-shell[dir="rtl"] .feature-link,
.public-shell[dir="rtl"] .text-card,
.public-shell[dir="rtl"] .visual-teaser,
.public-shell[dir="rtl"] .detail-shell {
    direction: rtl;
}

.public-shell[dir="rtl"] .search-row {
    direction: ltr;
}

.public-shell[dir="rtl"] .search-row .search-input {
    direction: rtl;
    text-align: right;
}

.public-shell[dir="rtl"] .visual-teaser {
    text-align: right;
}

@media (max-width: 760px) {
    .public-shell .site-header {
        min-height: 4.35rem;
        align-items: center;
        gap: 0.5rem;
        padding: 0.7rem 1rem;
    }

    .public-shell .brand {
        gap: 0.55rem;
        max-width: 42%;
    }

    .public-shell .brand-mark {
        width: 2.4rem;
        height: 2.4rem;
        border-radius: 11px;
    }

    .public-shell .header-art {
        order: 1;
        flex: 1 1 auto;
        min-width: 5rem;
    }

    .public-shell .header-art img {
        width: 2.55rem;
        height: 2.55rem;
    }

    .public-shell .nav-toggle-label {
        order: 2;
        min-height: 2.4rem;
        border-color: rgba(181, 75, 255, 0.78);
        background: rgba(94, 31, 142, 0.46);
        box-shadow: 0 0 16px rgba(153, 47, 255, 0.35);
    }

    .public-shell .site-nav {
        order: 4;
        padding-top: 0.7rem;
    }

    .public-shell .site-nav a,
    .public-shell .logout-form button,
    .public-shell .theme-toggle-button {
        border-color: rgba(190, 93, 255, 0.42);
        background: rgba(20, 8, 34, 0.86);
    }

    .public-shell .topbar-toggle-group {
        border-color: rgba(190, 93, 255, 0.42);
        background: rgba(20, 8, 34, 0.86);
    }

    .public-shell .main-content {
        width: min(100% - 1.25rem, 720px);
        padding-bottom: 2.5rem;
    }

    .public-shell .home-hero {
        min-height: min(35rem, calc(100svh - 4.35rem));
        padding: 8.4rem 1rem 1rem;
    }

    .public-shell .hero-butterfly {
        width: min(94vw, 31rem);
        margin-top: 1rem;
        opacity: 0.86;
    }

    .public-shell .hero h1 {
        font-size: clamp(3.05rem, 14.5vw, 4.25rem);
        line-height: 0.98;
    }

    .public-shell .hero .lead {
        display: -webkit-box;
        overflow: hidden;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 3;
        font-size: 1rem;
        line-height: 1.5;
    }

    .public-shell .eyebrow {
        font-size: 1.02rem;
        line-height: 1.45;
    }

    .public-shell .search-row {
        min-height: 4.3rem;
        padding: 0.35rem;
    }

    .public-shell .search-row > * {
        width: auto;
    }

    .public-shell .search-row .button {
        flex: 0 0 auto;
        min-width: 5.5rem;
        min-height: 3.45rem;
        padding-inline: 1rem;
    }

    .public-shell .section-grid,
    .public-shell .cards-grid,
    .public-shell .home-teaser-grid {
        grid-template-columns: 1fr;
        gap: 0.85rem;
    }

    .public-shell .home-feature-grid {
        margin-bottom: 1.35rem;
    }

    .public-shell .feature-link,
    .public-shell .text-card,
    .public-shell .detail-shell,
    .public-shell .visual-teaser {
        border-radius: 10px;
        padding: 1.05rem;
    }

    .public-shell .visual-teaser {
        min-height: 12rem;
    }

    .public-shell .page-header {
        margin-top: 0.9rem;
        padding: 1.2rem;
        border-radius: 10px;
    }

    .public-shell .page-header h1,
    .public-shell .detail-shell h1 {
        font-size: clamp(2rem, 10.5vw, 3.15rem);
        line-height: 1.05;
    }

    .public-shell .filters {
        gap: 0.55rem;
        padding: 0.6rem;
    }

    .public-shell .filters > * {
        width: 100%;
    }

    .public-shell .arabic-snippet {
        font-size: 1.35rem;
    }

    .public-shell .arabic-text {
        font-size: clamp(1.8rem, 8.5vw, 2.5rem);
    }

    .public-shell .text-block .arabic-text {
        padding: 0.95rem;
        border-radius: 10px;
        font-size: clamp(1.35rem, 5.5vw, 1.8rem);
        line-height: 1.8;
    }
}

@media (min-width: 761px) {
    .public-shell .home-feature-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .public-shell .home-feature-grid .feature-link:nth-last-child(-n + 2) {
        grid-column: span 1;
    }
}
