/*
Theme Name: AM Theme
Theme URI: https://example.com
Description: Modern multilingual theme for Analysis & Research Media Platform (AM). Supports English, Persian (Dari) and Swedish.
Version: 1.0.1
Author: AM
License: GPLv2 or later
Text Domain: am-theme
*/

:root {
    --am-primary: #1a365d;
    --am-accent: #2b6cb0;
    --am-light: #f7fafc;
    --am-text: #2d3748;
    --am-muted: #718096;
}

* { box-sizing: border-box; }

html {
    font-size: 18px;
}
body {
    font-family: Calibri, Carlito, "Segoe UI", Candara, "Century Gothic", Arial, sans-serif;
    margin: 0;
    background: var(--am-light);
    color: var(--am-text);
    font-size: 1rem; /* 18px via html */
    line-height: 1.7;
}

body.rtl {
    direction: rtl;
    font-family: Calibri, Carlito, "Segoe UI", Tahoma, Arial, sans-serif;
}

.am-header {
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

.am-header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.am-logo a {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--am-primary);
    text-decoration: none;
}

.am-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.am-nav a {
    display: block;
    padding: 8px 14px;
    color: var(--am-text);
    text-decoration: none;
    border-radius: 6px;
    font-weight: 500;
}

.am-nav a:hover,
.am-nav .current-menu-item a {
    background: var(--am-primary);
    color: #fff;
}

.am-header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.am-hero {
    background: linear-gradient(135deg, var(--am-primary) 0%, var(--am-accent) 100%);
    color: #fff;
    padding: 80px 20px;
    text-align: center;
}

.am-hero h1 {
    font-size: 2.6rem;
    margin: 0 0 16px;
    font-weight: 700;
}

.am-hero p {
    font-size: 1.2rem;
    max-width: 700px;
    margin: 0 auto 28px;
    opacity: .95;
}

.am-btn {
    display: inline-block;
    padding: 12px 28px;
    background: #fff;
    color: var(--am-primary);
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    border: 2px solid #fff;
    transition: background .2s ease, color .2s ease, border-color .2s ease, transform .15s ease, box-shadow .2s ease;
}

.am-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,.18);
}

/* Hero: Join Us (solid white) */
.am-hero .am-btn:not(.am-btn-outline) {
    background: #fff;
    color: var(--am-primary);
    border-color: #fff;
}
.am-hero .am-btn:not(.am-btn-outline):hover {
    background: var(--am-primary);
    color: #fff;
    border-color: #fff;
}

/* Hero: About Us (outline) */
.am-btn-outline {
    background: transparent;
    border: 2px solid #fff;
    color: #fff;
    margin-left: 12px;
}
.am-hero .am-btn-outline:hover {
    background: #fff;
    color: var(--am-primary);
    border-color: #fff;
}

body.rtl .am-btn-outline { margin-left: 0; margin-right: 12px; }

.am-section {
    max-width: 1200px;
    margin: 0 auto;
    padding: 60px 20px;
}

.am-section h2 {
    font-size: 1.9rem;
    color: var(--am-primary);
    margin: 0 0 12px;
    text-align: center;
}

.am-section .section-lead {
    text-align: center;
    color: var(--am-muted);
    max-width: 700px;
    margin: 0 auto 40px;
}

.am-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
}

.am-card {
    background: #fff;
    border-radius: 12px;
    padding: 28px;
    box-shadow: 0 4px 12px rgba(0,0,0,.05);
    border: 1px solid #edf2f7;
    transition: box-shadow .2s;
}

.am-card:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,.08);
}

.am-card h3 {
    margin: 0 0 10px;
    color: var(--am-primary);
    font-size: 1.2rem;
}

.am-card p {
    margin: 0;
    color: var(--am-muted);
    font-size: 0.95rem;
}

.am-membership-types {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

@media (max-width: 700px) {
    .am-membership-types { grid-template-columns: 1fr; }
}

.am-footer {
    background: var(--am-primary);
    color: #cbd5e0;
    padding: 40px 20px 20px;
    margin-top: 60px;
}

.am-footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
}

.am-footer h4 {
    color: #fff;
    margin: 0 0 12px;
}

.am-footer a {
    color: #a0aec0;
    text-decoration: none;
}

.am-footer a:hover { color: #fff; }

.am-footer-bottom {
    max-width: 1200px;
    margin: 30px auto 0;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,.15);
    text-align: center;
    font-size: 0.9rem;
}

.am-content {
    max-width: 900px;
    margin: 40px auto;
    padding: 0 20px;
    font-size: 1.05rem;
    line-height: 1.75;
}
.am-content p,
.am-content li,
.am-section p,
.am-section li,
.am-card p,
.am-membership-card p,
.am-membership-card li,
.am-register-lead,
.am-membership-form-section p,
.am-form label,
.am-form .description,
.am-register-form label,
.am-register-form .description {
    font-size: 1.05rem !important;
    line-height: 1.7;
}
.am-section .section-lead,
.am-archive-header .section-lead {
    font-size: 1.1rem !important;
}

.am-dashboard {
    max-width: 900px;
    margin: 40px auto;
    padding: 30px 20px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,.05);
}

.am-dashboard ul {
    list-style: none;
    padding: 0;
}

.am-dashboard li {
    padding: 12px 0;
    border-bottom: 1px solid #edf2f7;
}

.am-dashboard a {
    color: var(--am-accent);
    text-decoration: none;
    font-weight: 500;
}

/* ========== Navigation with dropdown submenus ========== */
.am-nav {
    position: relative;
}

.am-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 2px;
    flex-wrap: wrap;
    align-items: center;
}

.am-nav li {
    position: relative;
}

.am-nav a {
    display: block;
    padding: 10px 14px;
    color: var(--am-text);
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 1.05rem;
    white-space: nowrap;
}

.am-nav a:hover,
.am-nav .current-menu-item > a,
.am-nav .current-menu-ancestor > a {
    background: var(--am-primary);
    color: #fff;
}

/* Sub-menu (dropdown) */
.am-nav .sub-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 200px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,.12);
    padding: 8px 0;
    z-index: 200;
    flex-direction: column;
}

body.rtl .am-nav .sub-menu {
    left: auto;
    right: 0;
}

.am-nav li:hover > .sub-menu,
.am-nav li:focus-within > .sub-menu {
    display: block;
}

.am-nav .sub-menu a {
    padding: 10px 16px;
    border-radius: 0;
    white-space: normal;
}

.am-nav .sub-menu a:hover {
    background: #edf2f7;
    color: var(--am-primary);
}

.am-nav .menu-item-has-children > a::after {
    content: " ▾";
    font-size: 0.75em;
    opacity: 0.7;
}

/* Nested sub-menus */
.am-nav .sub-menu .sub-menu {
    top: 0;
    left: 100%;
}

body.rtl .am-nav .sub-menu .sub-menu {
    left: auto;
    right: 100%;
}

/* ========== Language switcher styles ========== */
.am-lang-switcher,
.am-lang-inline {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 6px;
    align-items: center;
}

.am-lang-switcher a,
.am-lang-inline a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.88rem;
    color: var(--am-text);
    border: 1px solid transparent;
}

.am-lang-switcher li.active a,
.am-lang-inline li.active a {
    background: var(--am-primary);
    color: #fff;
}

.am-lang-switcher a:hover,
.am-lang-inline a:hover {
    border-color: #cbd5e0;
}

.am-flag {
    font-size: 1.1em;
    line-height: 1;
}

/* Dropdown language menu */
.am-lang-dropdown {
    position: relative;
}

.am-lang-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--am-text);
}

.am-lang-toggle:hover {
    border-color: var(--am-accent);
}

.am-caret {
    font-size: 0.7em;
    opacity: 0.7;
}

.am-lang-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 140px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
    list-style: none;
    margin: 0;
    padding: 6px 0;
    z-index: 300;
}

body.rtl .am-lang-menu {
    right: auto;
    left: 0;
}

.am-lang-menu a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    text-decoration: none;
    color: var(--am-text);
    font-size: 0.9rem;
}

.am-lang-menu a:hover {
    background: #edf2f7;
}

/* ========== Members directory ========== */
.am-members-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    margin: 30px 0;
}

.am-member-card {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    border: 1px solid #edf2f7;
    box-shadow: 0 4px 12px rgba(0,0,0,.04);
    text-align: center;
    transition: box-shadow .2s;
}

.am-member-card:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,.08);
}

.am-member-photo img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 12px;
}

.am-member-info h3 {
    margin: 0 0 4px;
    font-size: 1.15rem;
}

.am-member-info h3 a {
    color: var(--am-primary);
    text-decoration: none;
}

.am-member-type {
    display: inline-block;
    font-size: 0.8rem;
    background: #ebf8ff;
    color: var(--am-accent);
    padding: 2px 10px;
    border-radius: 20px;
    margin-bottom: 8px;
}

.am-member-info .org,
.am-member-info .area {
    margin: 4px 0;
    font-size: 0.9rem;
    color: var(--am-muted);
}

.am-member-info .bio-excerpt {
    font-size: 0.9rem;
    color: #4a5568;
    margin: 10px 0;
}

.am-btn-sm {
    display: inline-block;
    margin-top: 8px;
    padding: 6px 14px;
    background: var(--am-primary);
    color: #fff !important;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.85rem;
}

.am-btn-sm:hover {
    background: var(--am-accent);
}

/* Public profile page */
.am-public-profile {
    max-width: 900px;
    margin: 0 auto;
}

.am-public-header {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 1px solid #e2e8f0;
}

.am-public-photo img {
    width: 180px;
    height: 180px;
    border-radius: 12px;
    object-fit: cover;
}

.am-public-meta h1 {
    margin: 0 0 8px;
    color: var(--am-primary);
}

.am-public-meta .type {
    display: inline-block;
    background: #ebf8ff;
    color: var(--am-accent);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    margin-bottom: 12px;
}

.am-public-bio,
.am-public-files,
.am-public-works {
    margin-top: 28px;
}

.am-public-files ul,
.am-public-works ul {
    padding-left: 20px;
}

body.rtl .am-public-files ul,
body.rtl .am-public-works ul {
    padding-left: 0;
    padding-right: 20px;
}

/* Mobile nav */
/* Mobile menu toggle (hamburger) – hidden on desktop */
.am-nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 42px;
    height: 42px;
    padding: 8px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    margin-left: auto;
}
.am-nav-toggle-bar {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--am-primary);
    border-radius: 1px;
    transition: transform 0.2s, opacity 0.2s;
}
.am-nav-toggle[aria-expanded="true"] .am-nav-toggle-bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.am-nav-toggle[aria-expanded="true"] .am-nav-toggle-bar:nth-child(2) {
    opacity: 0;
}
.am-nav-toggle[aria-expanded="true"] .am-nav-toggle-bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 768px) {
    .am-header-inner {
        flex-wrap: wrap;
        align-items: center;
        row-gap: 8px;
    }
    .am-nav-toggle {
        display: flex;
        order: 2;
    }
    .am-logo {
        order: 1;
        flex: 1;
    }
    .am-header-right {
        order: 3;
        width: 100%;
        justify-content: flex-end;
        flex-wrap: wrap;
        gap: 10px;
    }
    .am-nav {
        order: 4;
        width: 100%;
        display: none;
        max-height: none;
    }
    .am-nav.is-open {
        display: block;
    }
    .am-nav > ul,
    .am-nav ul.menu {
        flex-direction: column;
        width: 100%;
        gap: 0;
        border-top: 1px solid #edf2f7;
        padding-top: 8px;
    }
    .am-nav > ul > li,
    .am-nav ul.menu > li {
        width: 100%;
        border-bottom: 1px solid #f1f5f9;
    }
    .am-nav a {
        padding: 12px 10px;
    }
    .am-nav .sub-menu {
        position: static;
        box-shadow: none;
        border: none;
        border-radius: 0;
        padding: 0 0 0 14px;
        display: none;
        min-width: 0;
    }
    body.rtl .am-nav .sub-menu {
        padding: 0 14px 0 0;
    }
    .am-nav li.is-submenu-open > .sub-menu,
    .am-nav li:focus-within > .sub-menu {
        display: block;
    }
    /* disable hover-open on touch to avoid stuck open menus */
    .am-nav li:hover > .sub-menu {
        display: none;
    }
    .am-nav li.is-submenu-open:hover > .sub-menu {
        display: block;
    }
    .am-public-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
}

/* Organizational position under Full Member */
.am-member-position {
    margin: 4px 0 8px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--am-primary);
}
.am-public-meta .am-member-position {
    margin: 0 0 12px;
}
.am-author-info .am-member-position {
    margin: 0 0 6px;
    font-size: 0.9rem;
    color: var(--am-accent);
}

/* Membership page */
.am-membership-page {
    max-width: 1000px;
    margin: 0 auto;
}
.am-membership-intro {
    text-align: center;
    margin-bottom: 40px;
}
.am-membership-intro h2 {
    color: var(--am-primary);
    margin-bottom: 12px;
}
.am-membership-card h4 {
    margin: 16px 0 8px;
    font-size: 1rem;
    color: var(--am-text);
}
.am-membership-card ul {
    margin: 0 0 16px;
    padding-left: 20px;
    color: var(--am-muted);
    font-size: 0.95rem;
}
body.rtl .am-membership-card ul {
    padding-left: 0;
    padding-right: 20px;
}
.am-membership-cta {
    margin-top: 16px;
}
.am-membership-cta .am-btn {
    background: var(--am-primary);
    color: #fff;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    display: inline-block;
}
.am-membership-cta .am-btn-outline {
    background: transparent;
    border: 2px solid var(--am-primary);
    color: var(--am-primary);
}
.am-membership-form-section {
    margin-top: 50px;
    padding: 30px;
    background: #fff;
    border-radius: 12px;
    border: 1px solid #edf2f7;
    box-shadow: 0 4px 12px rgba(0,0,0,.04);
}
.am-membership-form-section h2 {
    margin-top: 0;
    color: var(--am-primary);
}

/* Archives */
.am-archive-header {
    text-align: center;
    margin-bottom: 36px;
}
.am-archive-header h1 {
    color: var(--am-primary);
    margin-bottom: 8px;
}
.am-archive-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.am-archive-item {
    background: #fff;
    border: 1px solid #edf2f7;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,.04);
}
.am-archive-item h2 {
    margin: 0 0 8px;
    font-size: 1.25rem;
}
.am-archive-item h2 a {
    color: var(--am-primary);
    text-decoration: none;
}
.am-archive-item h2 a:hover {
    color: var(--am-accent);
}
.am-archive-item .am-meta {
    font-size: 0.9rem;
    color: var(--am-muted);
    margin-bottom: 10px;
}
.am-archive-item .excerpt {
    color: #4a5568;
    margin-bottom: 12px;
    font-size: 0.95rem;
}
.am-empty-archive {
    text-align: center;
    padding: 40px 20px;
    background: #fff;
    border-radius: 12px;
    border: 1px dashed #cbd5e0;
    color: var(--am-muted);
}

/* Latest news on homepage */
.am-news-card h3 {
    margin: 8px 0;
    font-size: 1.1rem;
}
.am-news-card h3 a {
    color: var(--am-primary);
    text-decoration: none;
}
.am-news-card h3 a:hover {
    color: var(--am-accent);
}
.am-news-type {
    display: inline-block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    background: #ebf8ff;
    color: var(--am-accent);
    padding: 2px 8px;
    border-radius: 12px;
}
.am-news-card .am-meta {
    font-size: 0.85rem;
    color: var(--am-muted);
    margin: 0 0 8px;
}

/* ===== Scroll reveal ===== */
.am-reveal {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.7s ease, transform 0.7s ease;
    will-change: opacity, transform;
}
.am-reveal-fade {
    transform: translateY(12px);
}
.am-reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}
.am-reveal-up.is-visible {
    transform: translateY(0);
}

/* Stagger children inside visible sections */
.am-reveal.is-visible .am-card {
    animation: amFadeUp 0.55s ease both;
}
.am-reveal.is-visible .am-card:nth-child(2) { animation-delay: 0.08s; }
.am-reveal.is-visible .am-card:nth-child(3) { animation-delay: 0.16s; }
.am-reveal.is-visible .am-card:nth-child(4) { animation-delay: 0.24s; }

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

@media (prefers-reduced-motion: reduce) {
    .am-reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }
    .am-reveal.is-visible .am-card {
        animation: none;
    }
}

/* Hero parallax (driven by --am-parallax) */
.am-hero {
    position: relative;
    overflow: hidden;
}
.am-hero h1,
.am-hero p,
.am-hero .am-btn,
.am-hero .am-btn-outline {
    transform: translateY(var(--am-parallax, 0px));
    transition: transform 0.1s linear;
}

/* ===== News slider ===== */
.am-news-slider {
    position: relative;
    max-width: 960px;
    margin: 0 auto;
    padding: 0 48px;
}
.am-slider-viewport {
    overflow: hidden;
    border-radius: 16px;
    box-shadow: 0 8px 28px rgba(0,0,0,.08);
    background: #fff;
    border: 1px solid #edf2f7;
}
.am-slider-track {
    display: flex;
    transition: transform 0.45s ease;
    will-change: transform;
}
.am-slide {
    flex: 0 0 100%;
    min-width: 100%;
    box-sizing: border-box;
}
.am-slide-inner {
    display: grid;
    grid-template-columns: 1.1fr 1.2fr;
    min-height: 280px;
}
.am-slide-media {
    background-size: cover;
    background-position: center;
    min-height: 220px;
}
.am-slide-media-placeholder {
    background: linear-gradient(135deg, var(--am-primary) 0%, var(--am-accent) 100%);
    opacity: 0.9;
}
.am-slide-body {
    padding: 28px 28px 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.am-slide-body h3 {
    margin: 10px 0 8px;
    font-size: 1.35rem;
    line-height: 1.3;
}
.am-slide-body h3 a {
    color: var(--am-primary);
    text-decoration: none;
}
.am-slide-body h3 a:hover {
    color: var(--am-accent);
}
.am-slider-prev,
.am-slider-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: var(--am-primary);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.am-slider-prev { left: 0; }
.am-slider-next { right: 0; }
.am-slider-prev:hover,
.am-slider-next:hover {
    background: var(--am-primary);
    color: #fff;
    border-color: var(--am-primary);
}
.am-slider-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
}
.am-slider-dots button {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: none;
    background: #cbd5e0;
    cursor: pointer;
    padding: 0;
}
.am-slider-dots button.is-active {
    background: var(--am-primary);
    transform: scale(1.15);
}

@media (max-width: 700px) {
    .am-news-slider {
        padding: 0 36px;
    }
    .am-slide-inner {
        grid-template-columns: 1fr;
    }
    .am-slide-media {
        min-height: 160px;
    }
}

body.rtl .am-slider-prev { left: auto; right: 0; }
body.rtl .am-slider-next { right: auto; left: 0; }


/* Larger titles site-wide */
.am-hero h1 {
    font-size: 2.85rem;
}
.am-section h2 {
    font-size: 2.05rem;
}
.am-card h3,
.am-slide-body h3 {
    font-size: 1.25rem;
}
.am-logo a {
    font-size: 1.55rem;
}

/* Hero with optional background image */
.am-hero.am-hero-has-image {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
}
.am-hero.am-hero-has-image::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(26,54,93,0.72) 0%, rgba(43,108,176,0.65) 100%);
    z-index: 0;
}
.am-hero.am-hero-has-image > * {
    position: relative;
    z-index: 1;
}

/* Hide WordPress logo in frontend admin bar (logged-in users) */
#wpadminbar #wp-admin-bar-wp-logo {
    display: none;
}

/* Default post icon / missing avatar: softer placeholder, no WP branding */
.avatar-default,
img.avatar[src*="gravatar.com/avatar"] {
    border-radius: 50%;
}

.am-logo .custom-logo-link { display: inline-block; line-height: 0; }
.am-logo .custom-logo,
.am-logo img {
    max-height: 48px;
    width: auto;
}

/* ========== Single story (full post) ========== */
.am-single-header {
    margin-bottom: 1.25rem;
}
.am-single-title {
    margin: 0 0 0.6rem;
    color: var(--am-primary);
    line-height: 1.3;
}
.am-single-meta {
    color: var(--am-muted);
    font-size: 0.98rem;
    margin-bottom: 1.25rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.5rem;
    align-items: baseline;
}
.am-single-meta .am-meta-sep {
    opacity: 0.6;
}
.am-single-featured {
    margin: 0 0 1.5rem;
    padding: 0;
    max-width: 100%;
}
.am-single-featured .am-featured-image,
.am-single-featured img,
.am-single-content img {
    max-width: 100%;
    width: auto;
    height: auto;
    display: block;
    margin: 0 auto 1rem;
    border-radius: 8px;
}
.am-single-content,
.am-single-content p,
.am-single-content li,
.entry-content.am-single-content {
    text-align: justify;
    text-justify: inter-word;
    hyphens: auto;
    line-height: 1.75;
}
.am-single-content h2,
.am-single-content h3,
.am-single-content h4 {
    text-align: start;
}

/* ========== Related posts ========== */
.am-related-posts {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e2e8f0;
}
.am-related-heading {
    margin: 0 0 1rem;
    color: var(--am-primary);
    font-size: 1.25rem;
}
.am-related-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}
@media (max-width: 900px) {
    .am-related-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 520px) {
    .am-related-grid { grid-template-columns: 1fr; }
}
.am-related-card {
    background: #fff;
    border: 1px solid #edf2f7;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow .15s;
}
.am-related-card:hover {
    box-shadow: 0 6px 18px rgba(0,0,0,.08);
}
.am-related-media {
    display: block;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: #edf2f7;
}
.am-related-media img,
.am-related-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.am-related-placeholder {
    display: block;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #e2e8f0, #cbd5e0);
}
.am-related-body {
    padding: 12px 14px 14px;
}
.am-related-title {
    margin: 0 0 6px;
    font-size: 0.98rem;
    line-height: 1.35;
}
.am-related-title a {
    color: var(--am-primary);
    text-decoration: none;
}
.am-related-title a:hover {
    text-decoration: underline;
}
.am-related-date {
    margin: 0;
    font-size: 0.85rem;
    color: var(--am-muted);
}
.am-single-meta a {
    color: var(--am-accent);
    text-decoration: none;
}
.am-single-meta a:hover {
    text-decoration: underline;
}
.am-author-box h4 a {
    color: var(--am-primary);
    text-decoration: none;
}
.am-author-box h4 a:hover {
    text-decoration: underline;
}

/* Author bio box RTL (Dari) — direction only, no row-reverse */
body.rtl .am-author-box,
.am-author-box[dir="rtl"] {
    display: flex;
    flex-direction: row;
    direction: rtl;
    text-align: right;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}
body.rtl .am-author-photo,
.am-author-box[dir="rtl"] .am-author-photo {
    flex: 0 0 80px;
}
body.rtl .am-author-info,
.am-author-box[dir="rtl"] .am-author-info,
body.rtl .am-author-box .bio,
.am-author-box[dir="rtl"] .bio {
    text-align: right;
    min-width: 0;
    overflow-wrap: anywhere;
}
body.rtl .am-author-works ul,
.am-author-box[dir="rtl"] .am-author-works ul {
    padding-left: 0;
    padding-right: 18px;
}
/* Prevent single content from expanding page */
/* Full story: slightly narrower than general pages (900px), still room for related cards */
.am-content.am-single {
    max-width: 840px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 24px;
    padding-right: 24px;
    box-sizing: border-box;
}
.am-single-article,
.am-single-content {
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}
/* Related posts: stay horizontal (4 across when possible, never a single tall stack on desktop) */
.am-content.am-single .am-related-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}
@media (max-width: 900px) {
    .am-content.am-single .am-related-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
@media (max-width: 480px) {
    .am-content.am-single .am-related-grid {
        grid-template-columns: 1fr 1fr;
    }
}
@media (max-width: 600px) {
    .am-content.am-single {
        max-width: 100%;
        padding-left: 16px;
        padding-right: 16px;
    }
}

/* ========== Dynamic homepage portal ========== */
.am-hero-portal {
    padding: 72px 20px 56px;
}
.am-hero-inner {
    max-width: 960px;
    margin: 0 auto;
}
.am-hero-lead {
    font-size: 1.2rem;
    max-width: 640px;
    margin: 0 auto 24px;
    opacity: .95;
}
.am-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-bottom: 36px;
}
.am-hero-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    max-width: 720px;
    margin: 0 auto;
}
.am-stat {
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.2);
    border-radius: 12px;
    padding: 14px 10px;
    backdrop-filter: blur(6px);
}
.am-stat-num {
    display: block;
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.2;
}
.am-stat-label {
    display: block;
    font-size: 0.85rem;
    opacity: .9;
    margin-top: 4px;
}
@media (max-width: 640px) {
    .am-hero-stats { grid-template-columns: repeat(2, 1fr); }
}

.am-section-head { text-align: center; margin-bottom: 28px; }
.am-home-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 28px;
    align-items: start;
    max-width: 1100px;
    margin: 0 auto;
}
@media (max-width: 860px) {
    .am-home-grid { grid-template-columns: 1fr; }
}
.am-home-featured {
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid #edf2f7;
    box-shadow: 0 8px 28px rgba(0,0,0,.06);
}
.am-home-featured-media {
    display: block;
    position: relative;
    aspect-ratio: 16 / 10;
    background: #e2e8f0;
    overflow: hidden;
}
.am-home-featured-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.am-home-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: var(--am-primary);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: .03em;
}
body.rtl .am-home-badge { left: auto; right: 12px; }
.am-home-featured-body { padding: 20px 22px 24px; }
.am-home-featured-body h3 {
    margin: 0 0 10px;
    font-size: 1.45rem;
    line-height: 1.3;
}
.am-home-featured-body h3 a {
    color: var(--am-primary);
    text-decoration: none;
}
.am-home-meta {
    margin: 0 0 8px;
    font-size: 0.88rem;
    color: var(--am-muted);
}
.am-home-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.am-home-list-item {
    display: grid;
    grid-template-columns: 96px 1fr;
    gap: 14px;
    background: #fff;
    border: 1px solid #edf2f7;
    border-radius: 12px;
    padding: 10px;
    transition: box-shadow .15s;
}
.am-home-list-item:hover {
    box-shadow: 0 6px 18px rgba(0,0,0,.06);
}
.am-home-list-thumb {
    display: block;
    width: 96px;
    height: 72px;
    border-radius: 8px;
    overflow: hidden;
    background: #e2e8f0;
}
.am-home-list-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.am-home-list-item h4 {
    margin: 0;
    font-size: 1.02rem;
    line-height: 1.35;
}
.am-home-list-item h4 a {
    color: var(--am-primary);
    text-decoration: none;
}
.am-home-media-ph {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 72px;
    background: linear-gradient(135deg, #e2e8f0, #cbd5e0);
}
.am-home-links {
    text-align: center;
    margin-top: 28px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}
.am-home-empty {
    text-align: center;
    color: var(--am-muted);
    padding: 24px;
}
.am-home-cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
    max-width: 1100px;
    margin: 0 auto;
}
@media (max-width: 800px) {
    .am-home-cards { grid-template-columns: 1fr; }
}
.am-home-card-media {
    display: block;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 8px;
    margin: -8px -8px 12px;
}
.am-home-card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.am-home-cta {
    padding-top: 20px;
}
.am-home-cta-inner {
    max-width: 720px;
    margin: 0 auto;
    text-align: center;
    background: linear-gradient(135deg, var(--am-primary), var(--am-accent));
    color: #fff;
    border-radius: 16px;
    padding: 40px 28px;
}
.am-home-cta-inner h2 { color: #fff; margin-top: 0; }
.am-home-cta-inner .am-btn {
    background: #fff;
    color: var(--am-primary);
    border-color: #fff;
}
.am-home-cta-inner .am-btn:hover {
    background: var(--am-primary);
    color: #fff;
    border-color: #fff;
}
.am-home-members .am-members-grid {
    max-width: 1100px;
    margin: 0 auto;
}

/* ========== Top utility bar ========== */
.am-topbar {
    background: #0f172a;
    color: #cbd5e1;
    font-size: 0.8rem;
    line-height: 1.4;
    border-bottom: 1px solid rgba(255,255,255,.06);
}
.am-topbar-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 6px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.am-topbar-left,
.am-topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.am-topbar-tagline {
    opacity: 0.85;
    font-weight: 500;
}
.am-topbar-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 10px;
}
.am-topbar-menu a,
.am-topbar-link {
    color: #e2e8f0;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
}
.am-topbar-menu a:hover,
.am-topbar-link:hover {
    color: #fff;
}
.am-topbar-register {
    background: rgba(255,255,255,.1);
    padding: 3px 10px;
    border-radius: 4px;
}
.am-topbar-lang .am-lang-switcher a,
.am-topbar-lang .am-lang-inline a {
    color: #e2e8f0;
    border-color: transparent;
    font-size: 0.78rem;
    padding: 3px 8px;
}
.am-topbar-lang .am-lang-switcher li.active a,
.am-topbar-lang .am-lang-inline li.active a {
    background: rgba(255,255,255,.15);
    color: #fff;
}
.am-topbar-lang .am-lang-toggle {
    background: transparent;
    border-color: rgba(255,255,255,.2);
    color: #e2e8f0;
    font-size: 0.78rem;
    padding: 3px 8px;
}
.am-topbar-extra {
    font-size: 0.78rem;
}

/* Header no longer holds lang/login on the right */
.am-header-main .am-header-inner {
    justify-content: space-between;
}
.am-header-main .am-nav {
    flex: 1;
    display: flex;
    justify-content: center;
}

/* ========== Sahifa-style main menu ========== */
.am-nav-sahifa {
    background: transparent;
}
.am-header-main {
    background: #fff;
    border-bottom: 3px solid var(--am-primary);
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.am-nav-sahifa > ul,
.am-nav-sahifa ul.menu {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    margin: 0;
    padding: 0;
    list-style: none;
    align-items: stretch;
}
.am-nav-sahifa > ul > li,
.am-nav-sahifa ul.menu > li {
    position: relative;
    border-left: 1px solid #edf2f7;
}
.am-nav-sahifa > ul > li:first-child,
.am-nav-sahifa ul.menu > li:first-child {
    border-left: none;
}
.am-nav-sahifa > ul > li > a,
.am-nav-sahifa ul.menu > li > a {
    display: flex;
    align-items: center;
    padding: 14px 18px;
    font-size: 0.98rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: #1a202c;
    border-radius: 0;
    border-bottom: 3px solid transparent;
    margin-bottom: -3px;
    transition: color .15s, background .15s, border-color .15s;
}
.am-nav-sahifa > ul > li > a:hover,
.am-nav-sahifa > ul > li.current-menu-item > a,
.am-nav-sahifa > ul > li.current-menu-ancestor > a,
.am-nav-sahifa ul.menu > li > a:hover,
.am-nav-sahifa ul.menu > li.current-menu-item > a,
.am-nav-sahifa ul.menu > li.current-menu-ancestor > a {
    background: var(--am-primary);
    color: #fff;
    border-bottom-color: var(--am-accent);
}
.am-nav-sahifa .menu-item-has-children > a::after {
    content: " ▾";
    font-size: 0.7em;
    opacity: 0.75;
    font-weight: 400;
}
.am-nav-sahifa .sub-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    background: #1a365d;
    border: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 12px 28px rgba(0,0,0,.18);
    padding: 6px 0;
    z-index: 250;
}
body.rtl .am-nav-sahifa .sub-menu {
    left: auto;
    right: 0;
}
.am-nav-sahifa li:hover > .sub-menu,
.am-nav-sahifa li:focus-within > .sub-menu {
    display: block;
}
.am-nav-sahifa .sub-menu a {
    color: #e2e8f0;
    padding: 11px 18px;
    font-size: 0.92rem;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
    border-radius: 0;
}
.am-nav-sahifa .sub-menu a:hover {
    background: rgba(255,255,255,.12);
    color: #fff;
}
.am-nav-sahifa .sub-menu .sub-menu {
    top: 0;
    left: 100%;
    border-radius: 0 8px 8px 0;
}
body.rtl .am-nav-sahifa .sub-menu .sub-menu {
    left: auto;
    right: 100%;
}

/* ========== Hero post slider ========== */
.am-hero-slider {
    position: relative;
    width: 100%;
    min-height: 480px;
    height: clamp(420px, 58vh, 640px);
    overflow: hidden;
    background: #1a0a0a;
}
.am-hero-slider-track {
    position: relative;
    width: 100%;
    height: 100%;
}
.am-hero-slide {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-color: #2d0a0a;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.85s ease, visibility 0.85s ease;
    display: flex;
    align-items: flex-end;
}
.am-hero-slide.is-active {
    opacity: 1;
    visibility: visible;
    z-index: 1;
}
.am-hero-slide-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(120, 10, 20, 0.25) 0%,
        rgba(90, 8, 18, 0.45) 40%,
        rgba(40, 4, 10, 0.72) 100%
    );
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 1;
}
.am-hero-slide-content {
    position: relative;
    z-index: 2;
    max-width: 900px;
    margin: 0 auto;
    padding: 48px 28px 56px;
    width: 100%;
    color: #fff;
    text-shadow: 0 1px 8px rgba(0,0,0,.35);
}
.am-hero-slide-type {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: rgba(220, 38, 38, 0.55);
    backdrop-filter: blur(6px);
    padding: 4px 12px;
    border-radius: 999px;
    margin-bottom: 12px;
    border: 1px solid rgba(255,255,255,.2);
}
.am-hero-slide-title {
    margin: 0 0 10px;
    font-size: clamp(1.6rem, 3.5vw, 2.75rem);
    line-height: 1.2;
    font-weight: 800;
}
.am-hero-slide-title a {
    color: #fff;
    text-decoration: none;
}
.am-hero-slide-title a:hover {
    text-decoration: underline;
}
.am-hero-slide-meta {
    margin: 0 0 12px;
    font-size: 0.95rem;
    opacity: 0.92;
}
.am-hero-slide-excerpt {
    margin: 0 0 18px;
    font-size: 1.05rem;
    max-width: 640px;
    line-height: 1.55;
    opacity: 0.95;
}
.am-hero-slide-btn {
    display: inline-block;
    padding: 10px 22px;
    background: rgba(220, 38, 38, 0.75);
    backdrop-filter: blur(8px);
    color: #fff;
    font-weight: 700;
    border-radius: 8px;
    text-decoration: none;
    border: 1px solid rgba(255,255,255,.25);
    transition: background .2s, transform .15s;
}
.am-hero-slide-btn:hover {
    background: rgba(185, 28, 28, 0.95);
    transform: translateY(-2px);
}
.am-hero-slider-prev,
.am-hero-slider-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,.35);
    background: rgba(0,0,0,.35);
    backdrop-filter: blur(8px);
    color: #fff;
    font-size: 1.75rem;
    line-height: 1;
    cursor: pointer;
    transition: background .2s;
}
.am-hero-slider-prev:hover,
.am-hero-slider-next:hover {
    background: rgba(220, 38, 38, 0.7);
}
.am-hero-slider-prev { left: 16px; }
.am-hero-slider-next { right: 16px; }
body.rtl .am-hero-slider-prev { left: auto; right: 16px; }
body.rtl .am-hero-slider-next { right: auto; left: 16px; }
.am-hero-slider-dots {
    position: absolute;
    bottom: 16px;
    left: 0;
    right: 0;
    z-index: 5;
    display: flex;
    justify-content: center;
    gap: 8px;
}
.am-hero-slider-dots button {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,.5);
    background: rgba(255,255,255,.35);
    padding: 0;
    cursor: pointer;
}
.am-hero-slider-dots button.is-active {
    background: #dc2626;
    border-color: #fecaca;
    transform: scale(1.2);
}
.am-hero-slider-empty .am-hero-slide {
    background: linear-gradient(135deg, #7f1d1d, #1a365d);
}
@media (max-width: 640px) {
    .am-hero-slider {
        min-height: 360px;
        height: 70vh;
    }
    .am-hero-slide-content {
        padding: 32px 18px 48px;
    }
    .am-hero-slider-prev,
    .am-hero-slider-next {
        width: 40px;
        height: 40px;
        font-size: 1.4rem;
    }
}

/* Stats bar under slider */
.am-home-stats-bar {
    padding-top: 28px;
    padding-bottom: 8px;
}
.am-stats-inline {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    max-width: 900px;
    margin: 0 auto;
}
.am-stats-inline .am-stat {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px 12px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,.04);
}
.am-stats-inline .am-stat-num {
    color: var(--am-primary);
    font-size: 1.5rem;
    font-weight: 800;
}
.am-stats-inline .am-stat-label {
    color: var(--am-muted);
    font-size: 0.85rem;
}
@media (max-width: 640px) {
    .am-stats-inline { grid-template-columns: repeat(2, 1fr); }
}

/* ========== Dark blurred footer ========== */
.am-footer-dark {
    position: relative;
    background: #0a0a0a;
    color: #a1a1aa;
    padding: 36px 20px 20px;
    margin-top: 60px;
    overflow: hidden;
}
.am-footer-blur {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 0%, rgba(80,20,30,0.45), transparent 55%),
        radial-gradient(ellipse at 80% 100%, rgba(30,40,80,0.35), transparent 50%),
        rgba(0,0,0,0.55);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    pointer-events: none;
}
.am-footer-dark .am-footer-inner,
.am-footer-dark .am-footer-bottom {
    position: relative;
    z-index: 1;
}
.am-footer-dark .am-footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: block;
}
.am-footer-custom {
    margin-bottom: 20px;
    color: #d4d4d8;
}
.am-footer-nav {
    margin-bottom: 16px;
}
.am-footer-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
    justify-content: center;
}
.am-footer-menu a {
    color: #d4d4d8;
    text-decoration: none;
    font-size: 0.92rem;
}
.am-footer-menu a:hover {
    color: #fff;
}
.am-footer-dark .am-footer-bottom {
    max-width: 1200px;
    margin: 16px auto 0;
    padding-top: 16px;
    border-top: 1px solid rgba(255,255,255,.1);
    text-align: center;
    font-size: 0.88rem;
    color: #71717a;
}
.am-footer-meta p {
    margin: 0.25em 0;
}

/* About CTA at end (was welcome hero) */
.am-home-about-end .am-home-cta-inner {
    background: linear-gradient(135deg, #1a365d, #2b6cb0);
}

/* Mobile: topbar + sahifa nav adjustments */
@media (max-width: 768px) {
    .am-topbar-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    .am-nav-sahifa > ul > li,
    .am-nav-sahifa ul.menu > li {
        border-left: none;
        width: 100%;
    }
    .am-nav-sahifa > ul > li > a,
    .am-nav-sahifa ul.menu > li > a {
        border-bottom: 1px solid #edf2f7;
        margin-bottom: 0;
        text-transform: none;
        padding: 12px 10px;
    }
    .am-header-main {
        border-bottom-width: 2px;
    }
}
