/* Public site theme — palette and typography follow the original mashrouteh.org identity. */
@font-face { font-family: IRANSans; font-weight: 300; src: url('../fonts/IRANSansWeb_Light.woff') format('woff'); font-display: swap; }
@font-face { font-family: IRANSans; font-weight: 400; src: url('../fonts/IRANSansWeb.woff') format('woff'); font-display: swap; }
@font-face { font-family: IRANSans; font-weight: 500; src: url('../fonts/IRANSansWeb_Medium.woff') format('woff'); font-display: swap; }
@font-face { font-family: IRANSans; font-weight: 700; src: url('../fonts/IRANSansWeb_Bold.woff') format('woff'); font-display: swap; }
@font-face { font-family: art; src: url('../fonts/art.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: Vazir; font-weight: 400; src: url('../fonts/Vazir-FD-WOL.woff') format('woff'); font-display: swap; }
@font-face { font-family: Vazir; font-weight: 700; src: url('../fonts/Vazir-Bold-FD-WOL.woff') format('woff'); font-display: swap; }

:root {
    --navy: #023849;
    --teal: #15526a;
    --teal-2: #306c83;
    --teal-3: #2f839d;
    --gold: #FFE601;
    --gold-2: #ffbe00;
    --card-1: #c5d1d6;
    --card-2: #8ba2ab;
    --card-3: #e0dfd1;
    --card-4: #eef5f8;
    --text: #1d2b31;
    --danger: #b3261e;
    --ok: #1b7a43;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: IRANSans, Vazir, Tahoma, sans-serif;
    color: var(--text);
    background: var(--card-4) url('../img/body-bg.jpg');
    background-size: 51px;
    background-attachment: fixed;
    line-height: 1.9;
    font-size: 14px;
}

a { color: var(--teal-3); text-decoration: none; }
a:hover { color: var(--teal); }

.container { width: min(1140px, 100% - 24px); margin-inline: auto; }

/* Top bar */
.topbar { background: var(--teal); color: #fff; font-size: 12px; }
.topbar .container { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding-block: 4px; }
.topbar a, .topbar button.link { color: #fff; background: none; border: 0; font: inherit; cursor: pointer; padding: 2px 8px; border-radius: 4px; }
.topbar a:hover, .topbar button.link:hover { background: var(--teal-2); color: var(--gold); }
.topbar .group { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.topbar form { display: inline; margin: 0; }
.topbar .active-locale { color: var(--gold); font-weight: 700; }

/* Header / brand */
.site-header { background: var(--navy); color: #fff; }
.site-header .container { display: flex; align-items: center; gap: 16px; padding-block: 12px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--gold); }
.brand img { height: 56px; width: auto; }
.brand-name { font-family: var(--header-font, art, IRANSans, sans-serif); font-size: 44px; line-height: 1.2; color: var(--gold); }

/* Top menu */
.top-menu { background: var(--navy); border-top: 1px solid var(--teal-2); }
.top-menu ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; }
.top-menu a { display: block; padding: 8px 18px; color: #fff; font-weight: 500; }
.top-menu a:hover { background: var(--teal-2); color: #fff; }
.top-menu a.active { color: var(--gold); border-bottom: 3px solid var(--gold-2); }

/* Layout */
main { padding-block: 24px; flex: 1 0 auto; width: 100%; }
.panel { background: #fff; border: 1px solid var(--card-1); border-radius: 6px; padding: 20px; }
.panel h1, .panel h2 { color: var(--navy); margin-top: 0; }

.welcome-box { background: var(--navy); color: #fff; border-radius: 6px; padding: 32px; margin-bottom: 24px; text-align: center; }
.welcome-box .welcome-box-title { font-family: var(--header-font, art, IRANSans, sans-serif); font-size: 56px; color: var(--gold); margin: 0; line-height: 1.3; }
.welcome-box p { margin: 0; font-weight: 300; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.card { background: #fff; border: 1px solid var(--card-2); border-radius: 6px; overflow: hidden; display: flex; flex-direction: column; }
.card-header { background: var(--teal-2); color: #fff; padding: 8px 14px; font-weight: 700; }
.card-header a { color: #fff; }
.card-header a:hover { color: var(--gold); }
.card-body { background: var(--card-4); padding: 12px 14px; flex: 1; }
.card-footer { background: var(--card-3); padding: 6px 14px; font-size: 12px; color: var(--teal); }

.page-carousel { display: flex; align-items: center; gap: 10px; }
.page-carousel-track { display: flex; flex: 1; gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth; padding: 4px; }
.page-carousel-track .card { flex: 0 0 min(360px, 85%); scroll-snap-align: start; }
.carousel-control { flex: 0 0 auto; border: 0; border-radius: 50%; background: var(--teal); color: #fff; width: 38px; height: 38px; font-size: 28px; line-height: 1; cursor: pointer; }
.carousel-control:hover { background: var(--teal-2); }

/* Rich page content (WYSIWYG output) */
.rich { overflow-wrap: anywhere; }
.rich img, .rich video { max-width: 100%; height: auto; }
.rich a { color: var(--teal-3); text-decoration: underline; }
.rich blockquote { border-inline-start: 4px solid var(--gold-2); margin-inline: 0; padding-inline-start: 14px; color: var(--teal); }

.media-list { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 8px; }
.media-list li { background: var(--card-4); border: 1px solid var(--card-1); border-radius: 6px; padding: 8px 12px; display: flex; justify-content: space-between; gap: 8px; align-items: center; flex-wrap: wrap; }
.media-embed { max-width: 100%; margin-block: 8px; }
/* Forms */
.form { display: grid; gap: 14px; max-width: 560px; }
.form.wide { max-width: none; }
.field label { display: block; font-weight: 500; margin-bottom: 4px; color: var(--navy); }
.field input[type=text], .field input[type=email], .field input[type=password], .field input[type=tel],
.field input[type=number], .field input[type=file], .field select, .field textarea {
    width: 100%; padding: 8px 10px; border: 1px solid var(--card-2); border-radius: 4px; background: #fff; font: inherit; color: inherit;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--teal-3); border-color: var(--teal-3); }
.field .hint { font-size: 12px; color: var(--teal-2); }
.field .error, .error { color: var(--danger); font-size: 13px; }
.checkbox { display: flex; gap: 8px; align-items: center; }

.btn { display: inline-block; background: var(--gold-2); color: var(--navy); border: 0; border-radius: 4px; padding: 8px 20px; font: inherit; font-weight: 700; cursor: pointer; }
.btn:hover { background: var(--gold); color: var(--navy); }
.btn.secondary { background: var(--teal-2); color: #fff; }
.btn.secondary:hover { background: var(--teal-3); color: #fff; }
.btn.danger { background: var(--danger); color: #fff; }
.btn.small { padding: 2px 10px; font-size: 12px; }

.alert { padding: 10px 14px; border-radius: 4px; margin-bottom: 16px; }
.alert.success { background: #e3f4ea; color: var(--ok); border: 1px solid #b6e0c6; }
.alert.error { background: #fbe7e5; color: var(--danger); border: 1px solid #f1bdb9; }

.auth-box { max-width: 560px; margin-inline: auto; }
.recovery-codes { background: var(--card-3); padding: 12px; border-radius: 4px; font-family: monospace; direction: ltr; text-align: start; }
.qr { background: #fff; display: inline-block; padding: 8px; direction: ltr; }

.pagination { display: flex; gap: 6px; list-style: none; padding: 0; margin-top: 16px; flex-wrap: wrap; }
.pagination a, .pagination span { display: inline-block; padding: 2px 10px; border: 1px solid var(--card-2); border-radius: 4px; background: #fff; }
.pagination .active span { background: var(--navy); color: var(--gold); }
nav[role="navigation"] svg { width: 20px; height: 20px; }

/* Footer */
.site-footer { flex-shrink: 0; background: var(--navy); color: #fff; padding-block: 18px; margin-top: 24px; text-align: center; font-size: 12px; }
.site-footer a { color: var(--gold); }
.footer-social { display: flex; justify-content: center; gap: 14px; margin-top: 10px; }
.footer-social a { display: inline-flex; color: #fff; }
.footer-social svg { width: 24px; height: 24px; fill: currentColor; }
.footer-social svg rect, .footer-social svg circle { fill: none; stroke: currentColor; stroke-width: 2; }
.footer-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; text-align: start; margin-top: 16px; }
.footer-column { padding: 8px 12px; }
.footer-links { display: flex; flex-direction: column; gap: 4px; }
.footer-copyright { border-top: 1px solid var(--teal-2); margin-top: 12px; padding-top: 10px; }

@media (max-width: 640px) {
    .brand-name { font-size: 32px; }
    .welcome-box .welcome-box-title { font-size: 38px; }
    .carousel-control { width: 32px; height: 32px; font-size: 24px; }
    .footer-columns { grid-template-columns: 1fr; gap: 4px; }
}

/* Page thumbnails and category descriptions */
.card-thumb { display: block; width: 100%; height: 160px; object-fit: cover; }
.page-thumb { display: block; max-height: 420px; border-radius: 6px; }
.category-description { margin-bottom: 16px; }

/* Authors and profile photos */
.avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; vertical-align: middle; }
.avatar-large { width: 150px; height: 150px; border-radius: 50%; object-fit: cover; }
.author-photo { width: 100%; max-width: 300px; aspect-ratio: 1; border-radius: 8px; object-fit: cover; }
.page-authors { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding-bottom: 12px; }
.author-chip { display: inline-flex; gap: 6px; align-items: center; }
.author-social { display: flex; flex-wrap: wrap; gap: 12px; list-style: none; padding: 0; }
.cropper-box { max-width: 480px; max-height: 480px; }
.cropper-box img { display: block; max-width: 100%; }
