:root {
    --color-bg: #f4f7f5;
    --color-surface: #ffffff;
    --color-primary: #0d6b4f;
    --color-primary-dark: #094a37;
    --color-accent: #c9a227;
    --color-text: #1e2522;
    --color-muted: #5c6862;
    --shadow: 0 10px 28px rgba(13, 107, 79, 0.07);
    --radius: 14px;
    --font: "Tajawal", system-ui, sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1.65;
    color: var(--color-text);
    background: var(--color-bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--color-primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

.container {
    width: min(1120px, 100% - 2rem);
    margin-inline: auto;
}

.site-header {
    background: var(--color-surface);
    border-bottom: 1px solid rgba(13, 107, 79, 0.12);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding-block: 0.85rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--color-text);
    text-decoration: none;
    font-weight: 800;
    font-size: 1.15rem;
}

.logo:hover {
    text-decoration: none;
    color: var(--color-primary);
}

.logo-mark {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(145deg, var(--color-primary), var(--color-primary-dark));
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 1.25rem;
}

.nav-toggle {
    display: none;
    width: 44px;
    height: 44px;
    border: 1px solid rgba(13, 107, 79, 0.25);
    border-radius: 10px;
    background: var(--color-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='%230d6b4f'%3E%3Cpath d='M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h16v2H4v-2z'/%3E%3C/svg%3E") center/22px no-repeat;
    cursor: pointer;
}

.nav-toggle[aria-expanded="true"] {
    background-color: rgba(13, 107, 79, 0.08);
}

.main-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1rem;
    align-items: center;
}

.main-nav a {
    color: var(--color-muted);
    font-weight: 500;
    font-size: 0.92rem;
    text-decoration: none;
    padding: 0.35rem 0;
}

.main-nav a:hover {
    color: var(--color-primary);
}

.site-main {
    flex: 1;
}

.hero {
    background: linear-gradient(135deg, var(--color-primary-dark) 0%, var(--color-primary) 50%, #148a67 100%);
    color: #fff;
    padding: 2.5rem 0 2rem;
}

.hero-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.5rem;
}

.hero h1 {
    margin: 0 0 0.5rem;
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: 800;
}

.hero p {
    margin: 0;
    opacity: 0.94;
    max-width: 520px;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.65rem 1.25rem;
    border-radius: 12px;
    font-family: inherit;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover {
    text-decoration: none;
}

.btn-primary {
    background: #fff;
    color: var(--color-primary-dark);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
}

.btn-primary:hover {
    transform: translateY(-1px);
}

.btn-ghost {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.35);
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.25);
}

.notice-banner {
    background: rgba(201, 162, 39, 0.11);
    border: 1px solid rgba(201, 162, 39, 0.22);
    color: #5a4f20;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-top: 1.25rem;
    font-weight: 500;
    font-size: 0.95rem;
}

.section {
    padding: 2.5rem 0;
}

.section-head {
    text-align: center;
    margin-bottom: 1.75rem;
}

.section-head h2 {
    margin: 0 0 0.35rem;
    font-size: 1.5rem;
    font-weight: 800;
}

.section-head p {
    margin: 0;
    color: var(--color-muted);
}

.grades-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.25rem;
}

.grade-card {
    background: var(--color-surface);
    border-radius: var(--radius);
    padding: 1.35rem;
    box-shadow: var(--shadow);
    border: 1px solid rgba(13, 107, 79, 0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    text-decoration: none;
    color: inherit;
    display: block;
}

.grade-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 32px rgba(13, 107, 79, 0.12);
    text-decoration: none;
}

.grade-card .emoji {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.grade-card h3 {
    margin: 0 0 0.35rem;
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--color-primary-dark);
}

.grade-card span.sub {
    font-size: 0.88rem;
    color: var(--color-muted);
}

.subjects-wrap {
    background: var(--color-surface);
    border-radius: calc(var(--radius) + 4px);
    padding: 1.75rem;
    border: 1px solid rgba(13, 107, 79, 0.1);
    box-shadow: var(--shadow);
}

.subjects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.5rem;
}

.subject-block h3 {
    margin: 0 0 0.75rem;
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--color-primary);
    padding-bottom: 0.5rem;
    border-bottom: 2px solid rgba(13, 107, 79, 0.15);
}

.subject-block ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.subject-block li {
    margin-bottom: 0.5rem;
}

.subject-block a {
    font-weight: 500;
    display: inline-block;
    padding: 0.25rem 0;
}

.page-simple {
    padding: 2.5rem 0 3rem;
}

.page-simple h1 {
    margin-top: 0;
    font-size: 1.75rem;
}

.page-simple .box {
    background: var(--color-surface);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    max-width: 720px;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.modal-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--color-surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    width: min(400px, 100%);
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.2);
    transform: scale(0.96);
    transition: transform 0.2s ease;
}

.modal-overlay.is-open .modal {
    transform: scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.15rem;
}

.modal-close {
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(13, 107, 79, 0.1);
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
    color: var(--color-primary-dark);
}

.modal-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.modal-list a {
    display: block;
    padding: 0.85rem 1rem;
    border-radius: 10px;
    margin-bottom: 0.5rem;
    background: var(--color-bg);
    font-weight: 700;
    color: var(--color-text);
    text-decoration: none;
}

.modal-list a:hover {
    background: rgba(13, 107, 79, 0.12);
    color: var(--color-primary-dark);
}

.site-footer {
    background: var(--color-primary-dark);
    color: rgba(255, 255, 255, 0.88);
    margin-top: auto;
}

.footer-grid {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.5rem 0;
}

.footer-brand p {
    margin: 0.35rem 0 0;
    font-size: 0.9rem;
    opacity: 0.85;
}

.footer-links {
    font-size: 0.9rem;
}

.footer-links a {
    color: #fff;
    opacity: 0.9;
}

.footer-links a:hover {
    opacity: 1;
}

.footer-links .sep {
    margin: 0 0.5rem;
    opacity: 0.5;
}

.footer-copy {
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    padding: 0.85rem 0;
    text-align: center;
    font-size: 0.85rem;
    opacity: 0.8;
}

.footer-copy p {
    margin: 0;
}

@media (max-width: 900px) {
    .nav-toggle {
        display: block;
    }

    .main-nav {
        width: 100%;
        display: none;
        padding-bottom: 0.5rem;
    }

    .main-nav.is-open {
        display: block;
    }

    .main-nav ul {
        flex-direction: column;
        align-items: stretch;
    }
}

/* ——— إكمال الموقع: بحث، مسارات، جداول، نماذج ——— */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.hero-search {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 1.1rem;
    align-items: center;
    max-width: 520px;
}

.hero-search input[type="search"] {
    flex: 1;
    min-width: 200px;
    padding: 0.7rem 1.05rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.97);
    font-family: inherit;
    font-size: 0.95rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.hero-search input[type="search"]:focus {
    outline: none;
    border-color: rgba(201, 162, 39, 0.65);
    box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.2), 0 6px 24px rgba(0, 0, 0, 0.07);
}

.hero-search .btn-primary {
    flex-shrink: 0;
}

.empty-state {
    text-align: center;
    padding: 2rem;
    background: var(--color-surface);
    border-radius: var(--radius);
    border: 1px dashed rgba(13, 107, 79, 0.2);
}

.breadcrumbs {
    margin: 0 0 1rem;
    font-size: 0.88rem;
    color: var(--color-muted);
}

.breadcrumbs ol {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.5rem;
    align-items: center;
}

.breadcrumbs li:not(:last-child)::after {
    content: "›";
    margin-inline-start: 0.5rem;
    opacity: 0.45;
    font-size: 0.85em;
}

.breadcrumbs a {
    color: var(--color-primary);
    font-weight: 600;
}

.lead-muted {
    color: var(--color-muted);
    margin: 0 0 1.25rem;
    font-size: 1.05rem;
}

.h-section {
    font-size: 1.15rem;
    font-weight: 800;
    margin: 0 0 0.75rem;
    color: var(--color-primary-dark);
}

.hint {
    font-size: 0.9rem;
    color: var(--color-muted);
    margin: 0 0 1rem;
}

.container-wide {
    width: min(960px, 100% - 2rem);
    margin-inline: auto;
}

.layout-two {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 2rem;
    align-items: start;
}

@media (max-width: 820px) {
    .layout-two {
        grid-template-columns: 1fr;
    }
}

.subject-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.subject-card {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 1.1rem;
    background: var(--color-surface);
    border-radius: var(--radius);
    border: 1px solid rgba(13, 107, 79, 0.12);
    box-shadow: var(--shadow);
    text-decoration: none;
    color: inherit;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.subject-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 28px rgba(13, 107, 79, 0.1);
    text-decoration: none;
}

.subject-card-title {
    font-weight: 800;
    color: var(--color-primary-dark);
}

.subject-card-meta {
    font-size: 0.85rem;
    color: var(--color-muted);
}

.side-card {
    background: var(--color-surface);
    padding: 1.25rem;
    border-radius: var(--radius);
    border: 1px solid rgba(13, 107, 79, 0.12);
    box-shadow: var(--shadow);
}

.side-links {
    list-style: none;
    margin: 0 0 1.25rem;
    padding: 0;
}

.side-links.compact {
    margin-bottom: 0;
}

.side-links li {
    margin-bottom: 0.45rem;
}

.side-links a {
    font-weight: 600;
}

.side-note {
    margin: 0;
    font-size: 0.9rem;
}

.page-grade h1,
.page-subject h1 {
    margin-bottom: 0.35rem;
}

.units-stack {
    min-width: 0;
}

.unit-block {
    background: var(--color-surface);
    border: 1px solid rgba(13, 107, 79, 0.12);
    border-radius: var(--radius);
    margin-bottom: 0.85rem;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.unit-block summary {
    padding: 1rem 1.1rem;
    font-weight: 800;
    cursor: pointer;
    list-style: none;
    background: rgba(13, 107, 79, 0.06);
}

.unit-block summary::-webkit-details-marker {
    display: none;
}

.lesson-list {
    margin: 0;
    padding: 0.75rem 1.25rem 1rem;
}

.lesson-list li {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.5rem;
    align-items: baseline;
    padding: 0.45rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.lesson-list li:last-child {
    border-bottom: none;
}

.lesson-actions {
    font-size: 0.85rem;
    white-space: nowrap;
}

.link-quiet {
    color: var(--color-muted);
    font-weight: 600;
}

.is-placeholder {
    color: var(--color-muted);
    font-style: italic;
    font-size: 0.92rem;
}

.lesson-actions .is-placeholder {
    font-style: normal;
    opacity: 0.85;
}

.lesson-actions .dot {
    margin: 0 0.25rem;
    opacity: 0.4;
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    align-items: center;
}

.chip {
    display: inline-block;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    background: var(--color-surface);
    border: 1px solid rgba(13, 107, 79, 0.2);
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--color-text);
}

.chip:hover {
    background: rgba(13, 107, 79, 0.1);
    text-decoration: none;
}

.chip-all {
    border-color: var(--color-primary);
    color: var(--color-primary-dark);
}

.resource-table-wrap {
    overflow-x: auto;
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid rgba(13, 107, 79, 0.1);
}

.resource-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.resource-table th,
.resource-table td {
    padding: 0.75rem 1rem;
    text-align: right;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.resource-table th {
    background: rgba(13, 107, 79, 0.08);
    font-weight: 800;
    color: var(--color-primary-dark);
}

.curriculum-block {
    margin-bottom: 2rem;
}

.curriculum-mini td:first-child {
    white-space: nowrap;
    font-weight: 700;
    color: var(--color-muted);
}

.card-grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.25rem;
}

.info-card {
    background: var(--color-surface);
    padding: 1.25rem;
    border-radius: var(--radius);
    border: 1px solid rgba(13, 107, 79, 0.1);
    box-shadow: var(--shadow);
}

.info-card h3 {
    margin: 0 0 0.75rem;
    font-size: 1.05rem;
    color: var(--color-primary-dark);
}

.clean-list {
    margin: 0;
    padding-inline-start: 1.15rem;
    color: var(--color-muted);
}

.card-foot {
    margin: 1rem 0 0;
    font-size: 0.9rem;
}

.test-list {
    display: grid;
    gap: 1rem;
}

.test-card {
    background: var(--color-surface);
    border-radius: var(--radius);
    padding: 1.25rem;
    border: 1px solid rgba(13, 107, 79, 0.1);
    box-shadow: var(--shadow);
}

.test-card-head {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.test-card-head h3 {
    margin: 0;
    font-size: 1.05rem;
}

.badge {
    font-size: 0.75rem;
    font-weight: 800;
    padding: 0.2rem 0.5rem;
    border-radius: 8px;
    background: rgba(13, 107, 79, 0.15);
    color: var(--color-primary-dark);
}

.test-meta {
    margin: 0 0 1rem;
    color: var(--color-muted);
    font-size: 0.92rem;
}

.test-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn-outline {
    background: transparent;
    color: var(--color-primary);
    border: 2px solid var(--color-primary);
    padding: 0.5rem 1.1rem;
    border-radius: 12px;
    font-family: inherit;
    font-weight: 700;
    cursor: not-allowed;
    opacity: 0.75;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.25rem;
}

.game-tile {
    background: var(--color-surface);
    padding: 1.35rem;
    border-radius: var(--radius);
    border: 1px solid rgba(13, 107, 79, 0.1);
    box-shadow: var(--shadow);
}

.game-tile h3 {
    margin: 0.35rem 0;
    font-size: 1.05rem;
}

.game-tile p {
    margin: 0 0 0.75rem;
    color: var(--color-muted);
    font-size: 0.92rem;
}

.game-icon {
    font-size: 2rem;
}

.game-placeholder {
    display: inline-block;
    margin-top: 0.25rem;
}

.form-foot {
    margin: 1rem 0 0;
    font-size: 0.9rem;
}

.box-form {
    max-width: 480px;
}

.contact-form .field {
    margin-bottom: 1rem;
}

.contact-form label {
    display: block;
    font-weight: 700;
    margin-bottom: 0.35rem;
    font-size: 0.92rem;
}

.contact-form input,
.contact-form textarea {
    width: 100%;
    padding: 0.6rem 0.85rem;
    border-radius: 10px;
    border: 1px solid rgba(13, 107, 79, 0.2);
    font-family: inherit;
    font-size: 1rem;
}

.contact-form textarea {
    resize: vertical;
    min-height: 120px;
}

.alert {
    padding: 0.85rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-weight: 600;
}

.alert-success {
    background: rgba(13, 107, 79, 0.12);
    color: var(--color-primary-dark);
    border: 1px solid rgba(13, 107, 79, 0.25);
}

.alert-error {
    background: rgba(180, 50, 50, 0.1);
    color: #8b2222;
    border: 1px solid rgba(180, 50, 50, 0.25);
}

.page-simple .box .btn-primary {
    margin-top: 0.5rem;
}

.filter-label {
    font-weight: 700;
    color: var(--color-muted);
    margin-inline-end: 0.35rem;
}

.chip.is-active {
    background: rgba(13, 107, 79, 0.2);
    border-color: var(--color-primary);
    color: var(--color-primary-dark);
}

.admin-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--color-surface);
    border: 1px solid rgba(13, 107, 79, 0.15);
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow);
}

.admin-bar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-weight: 600;
}

.admin-upload-box select,
.admin-upload-box input[type="file"] {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border-radius: 10px;
    border: 1px solid rgba(13, 107, 79, 0.2);
    font-family: inherit;
    font-size: 1rem;
}

.inline-form {
    display: inline;
    margin: 0;
}

.btn-text {
    background: none;
    border: none;
    padding: 0;
    font-family: inherit;
    font-weight: 700;
    cursor: pointer;
    color: var(--color-primary);
    text-decoration: underline;
}

.btn-text.danger {
    color: #a32a2a;
}

.admin-page code {
    font-size: 0.88em;
    background: rgba(0, 0, 0, 0.06);
    padding: 0.12em 0.35em;
    border-radius: 6px;
}

/* ——— أيقونة المشرف + مكتبة الكتب + تعليقات ——— */

.header-admin-link {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 1rem;
    border-radius: 12px;
    font-weight: 800;
    font-size: 0.9rem;
    color: #fff;
    background: linear-gradient(145deg, #1a3a2e, var(--color-primary-dark));
    border: 1px solid rgba(255, 255, 255, 0.2);
    text-decoration: none;
    box-shadow: 0 4px 16px rgba(13, 107, 79, 0.28);
    flex-shrink: 0;
}

.header-admin-link:hover {
    text-decoration: none;
    filter: brightness(1.07);
    box-shadow: 0 6px 20px rgba(13, 107, 79, 0.35);
}

.header-admin-icon {
    flex-shrink: 0;
    opacity: 1;
}

@media (max-width: 420px) {
    .header-admin-text {
        display: inline;
        font-size: 0.8rem;
    }

    .header-admin-link {
        padding: 0.45rem 0.7rem;
    }
}

@media (min-width: 901px) {
    .main-nav {
        margin-inline-start: auto;
    }
}

.hero-ghost-link {
    font-size: 0.88rem;
}

.section-home-books {
    background: linear-gradient(180deg, #e9f2ec 0%, #eef4f0 42%, var(--color-bg) 100%);
    padding-top: 2.5rem;
    padding-bottom: 3rem;
}

.home-books-panel {
    background: var(--color-surface);
    border-radius: 20px;
    padding: 2rem clamp(1rem, 3vw, 2.25rem);
    box-shadow:
        0 4px 6px rgba(13, 107, 79, 0.04),
        0 22px 48px rgba(13, 107, 79, 0.1);
    border: 1px solid rgba(13, 107, 79, 0.1);
}

.home-books-panel--page {
    margin-top: 1rem;
}

.home-books-head {
    text-align: center;
    max-width: 640px;
    margin: 0 auto 2rem;
}

.home-books-head--comments {
    margin-bottom: 1.5rem;
}

.home-books-eyebrow {
    margin: 0 0 0.35rem;
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-primary);
    opacity: 0.78;
}

.home-books-title {
    margin: 0 0 0.65rem;
    font-size: clamp(1.35rem, 3vw, 1.75rem);
    font-weight: 900;
    color: var(--color-text);
    line-height: 1.3;
}

.home-books-title::after {
    content: "";
    display: block;
    width: 56px;
    height: 4px;
    margin: 0.75rem auto 0;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--color-accent), var(--color-primary));
}

.home-books-lead {
    margin: 0.5rem 0 0;
    font-size: 0.98rem;
    color: var(--color-muted);
    line-height: 1.65;
    font-weight: 500;
}

.home-books-empty {
    max-width: 520px;
    margin-inline: auto;
}

.home-books-more {
    text-align: center;
    margin: 2rem 0 0;
}

.home-books-more-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.65rem 1.35rem;
    font-weight: 800;
    font-size: 0.95rem;
    color: #fff;
    background: linear-gradient(145deg, var(--color-primary), var(--color-primary-dark));
    border-radius: 12px;
    text-decoration: none;
    box-shadow: 0 8px 24px rgba(13, 107, 79, 0.25);
}

.home-books-more-link:hover {
    text-decoration: none;
    filter: brightness(1.05);
}

.comments-panel {
    background: var(--color-surface);
    border-radius: 20px;
    padding: 2rem clamp(1rem, 3vw, 2.25rem);
    box-shadow:
        0 4px 6px rgba(13, 107, 79, 0.04),
        0 22px 48px rgba(13, 107, 79, 0.08);
    border: 1px solid rgba(13, 107, 79, 0.09);
}

.section-guest-comments {
    padding-bottom: 3rem;
}

/* بطاقات غلاف — شبكة مرنة، ألوان متوافقة مع الهوية */
.book-cover-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(228px, 1fr));
    gap: 1.5rem;
}

@media (min-width: 1280px) {
    .book-cover-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

.book-cover-card {
    display: flex;
    flex-direction: column;
    border-radius: 16px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    background: #fff;
    border: 1px solid rgba(13, 107, 79, 0.14);
    box-shadow:
        0 2px 6px rgba(0, 0, 0, 0.04),
        0 16px 40px rgba(13, 107, 79, 0.1);
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.2s ease;
}

.book-cover-card:hover {
    transform: translateY(-5px);
    border-color: rgba(201, 162, 39, 0.4);
    box-shadow:
        0 10px 24px rgba(0, 0, 0, 0.05),
        0 28px 56px rgba(13, 107, 79, 0.11);
    text-decoration: none;
}

.book-cover-card:focus-visible {
    outline: 3px solid rgba(201, 162, 39, 0.65);
    outline-offset: 3px;
}

.book-cover-card__top {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    direction: ltr;
    flex: 1;
    height: clamp(216px, 24vw, 272px);
    border-bottom: 1px solid rgba(13, 107, 79, 0.1);
}

.book-cover-card__ornament {
    flex: 0 0 20%;
    max-width: 56px;
    min-width: 44px;
    background-color: #8b6914;
    background-image:
        linear-gradient(165deg, rgba(255, 255, 255, 0.25) 0%, transparent 40%),
        linear-gradient(90deg, #6b4f0e 0%, #c9a227 40%, #f0d060 50%, #c9a227 60%, #6b4f0e 100%);
    box-shadow: inset -2px 0 10px rgba(0, 0, 0, 0.12);
}

.book-cover-card--photo .book-cover-card__ornament {
    flex-basis: 14%;
    max-width: 44px;
    min-width: 36px;
}

.book-cover-card__face {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1rem 0.85rem;
    direction: rtl;
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.5) 0%, transparent 55%),
        linear-gradient(165deg, #f2f8f5 0%, #e2efe8 44%, #f0f7f4 100%);
    position: relative;
    overflow: hidden;
}

.book-cover-card__face::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.42) 0%, rgba(226, 239, 232, 0.4) 100%);
    pointer-events: none;
}

.book-cover-card__face--has-img {
    padding: 0;
}

.book-cover-card__face--has-img::before {
    display: none;
}

.book-cover-card__img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
}

.book-cover-card__title--face {
    position: relative;
    z-index: 1;
    margin: 0;
    font-size: clamp(0.95rem, 2.2vw, 1.15rem);
    font-weight: 900;
    line-height: 1.4;
    color: #1a1a1a;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-cover-card__title--footer {
    display: block;
    font-size: 0.88rem;
    font-weight: 900;
    color: var(--color-text);
    line-height: 1.35;
    margin-bottom: 0.35rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-cover-card__footer {
    flex: 0 0 auto;
    background: linear-gradient(180deg, #fff 0%, #fafcfb 100%);
    padding: 1rem 0.85rem 1.1rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.book-cover-card__sub {
    font-size: 0.78rem;
    font-weight: 700;
    color: #455a64;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-cover-card__meta-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
}

.book-cover-card__pill {
    font-size: 0.7rem;
    font-weight: 800;
    padding: 0.22rem 0.5rem;
    border-radius: 999px;
    background: rgba(13, 107, 79, 0.1);
    color: var(--color-primary-dark);
}

.book-cover-card__pill--muted {
    background: rgba(0, 0, 0, 0.06);
    color: var(--color-muted);
    font-weight: 700;
}

.book-cover-card__cta {
    width: 100%;
    margin-top: 0.25rem;
    padding-top: 0.4rem;
    border-top: 1px solid rgba(13, 107, 79, 0.08);
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--color-primary);
    letter-spacing: 0.02em;
}

.section-guest-comments {
    padding-top: 2rem;
}

.guest-comments-layout {
    display: grid;
    grid-template-columns: minmax(260px, 360px) 1fr;
    gap: 2rem;
    align-items: start;
}

@media (max-width: 800px) {
    .guest-comments-layout {
        grid-template-columns: 1fr;
    }
}

.guest-comment-form {
    max-width: none;
}

.guest-comment-form textarea {
    width: 100%;
    padding: 0.6rem 0.85rem;
    border-radius: 10px;
    border: 1px solid rgba(13, 107, 79, 0.2);
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
}

.guest-comments-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.guest-comment-item {
    background: linear-gradient(180deg, #fff, #fafcfb);
    border: 1px solid rgba(13, 107, 79, 0.1);
    border-radius: 14px;
    padding: 1.15rem 1.2rem;
    margin-bottom: 0.85rem;
    box-shadow: 0 6px 20px rgba(13, 107, 79, 0.06);
}

.guest-comment-item__head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.guest-comment-item__author {
    color: var(--color-primary-dark);
}

.guest-comment-item__time {
    font-size: 0.82rem;
    color: var(--color-muted);
    font-weight: 600;
}

.guest-comment-item__body {
    margin: 0;
    line-height: 1.65;
    color: var(--color-text);
    font-size: 0.98rem;
}

.guest-comments-empty {
    margin: 0;
    padding: 1rem;
    background: var(--color-surface);
    border-radius: var(--radius);
    border: 1px dashed rgba(13, 107, 79, 0.2);
}
