/* ==========================================================================
   Editorial Journal, Archive Grid, Filters & Single Article Experience
   ========================================================================== */

/* Category Filter Pills */
.ao-cat-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-bottom: 2rem;
}

.ao-cat-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.48rem 1rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-medium);
  background: var(--bg-surface);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--ink-secondary);
  transition: all var(--t-fast) var(--ease-luxury);
}

.ao-cat-pill:hover,
.ao-cat-pill.is-active {
  background: var(--saudi-emerald);
  border-color: var(--saudi-emerald);
  color: #FFFFFF;
}

/* Blog Grid */
.ao-blog-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 720px) {
  .ao-blog-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .ao-blog-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Article Card */
.ao-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color var(--t-fast) var(--ease-luxury), transform var(--t-fast) var(--ease-luxury), box-shadow var(--t-fast) var(--ease-luxury);
}

.ao-card:hover {
  border-color: var(--bisht-gold);
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.ao-card-media {
  display: block;
  position: relative;
  aspect-ratio: 16 / 10;
  background: linear-gradient(135deg, var(--brand-navy-soft) 0%, var(--brand-navy) 100%);
  overflow: hidden;
}

.ao-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 480ms var(--ease-luxury);
}

.ao-card:hover .ao-card-media img {
  transform: scale(1.04);
}

.ao-card-fallback {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--brand-cobalt-light);
  padding: 1.5rem;
}

.ao-card-en-cover {
  position: absolute;
  inset: 0;
  background-color: var(--brand-navy);
  background-image:
    radial-gradient(circle at 80% 20%, rgba(29, 104, 255, 0.22), transparent 55%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='80' viewBox='0 0 160 80'%3E%3Cg fill='%231D68FF' fill-opacity='0.07'%3E%3Cpath d='M10 62V30L22 18L34 30V62H27V46H17V62H10ZM17 39H27V31L22 26L17 31V39Z'/%3E%3Crect x='50' y='32' width='4' height='16'/%3E%3Crect x='44' y='38' width='16' height='4'/%3E%3Cpath d='M70 62V30L82 18L94 30V62H87V46H77V62H70ZM77 39H87V31L82 26L77 31V39Z'/%3E%3Crect x='110' y='32' width='4' height='16'/%3E%3Crect x='104' y='38' width='16' height='4'/%3E%3Crect x='133' y='18' width='6' height='6'/%3E%3Crect x='133' y='30' width='6' height='32'/%3E%3C/g%3E%3C/svg%3E");
  display: grid;
  place-items: center;
  padding: 1.1rem;
}

.ao-card-en-cover-inner {
  width: 100%;
  height: 100%;
  border: 1px solid rgba(29, 104, 255, 0.36);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  text-align: center;
}

.ao-card-en-cover-inner svg {
  width: 48px;
  height: 48px;
}

.ao-card-en-cover-inner span {
  color: var(--brand-cobalt-light);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.ao-card-badge {
  position: absolute;
  top: 0.85rem;
  inset-inline-start: 0.85rem;
  background: rgba(255, 255, 255, 0.96);
  color: var(--brand-navy);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.28rem 0.72rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--brand-cobalt-border);
}

.ao-card-body {
  padding: 1.35rem 1.4rem 1.5rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.ao-card-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: var(--text-xs);
  color: var(--ink-muted);
  margin-bottom: 0.6rem;
}

.ao-card-title {
  font-family: var(--font-ar-serif);
  font-size: 1.15rem;
  line-height: 1.42;
  margin-bottom: 0.6rem;
}

.ao-card-title a:hover {
  color: var(--saudi-emerald);
}

.ao-card-excerpt {
  font-size: var(--text-sm);
  line-height: 1.68;
  color: var(--ink-secondary);
  margin-bottom: 1.25rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ao-card-footer {
  margin-top: auto;
  padding-top: 0.9rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--saudi-emerald);
}

/* Featured Top Post (Blog Archive & Home) */
.ao-featured-post {
  display: grid;
  grid-template-columns: 1fr;
  background: var(--bg-surface);
  border: 1px solid var(--bisht-gold-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: 2.25rem;
}

@media (min-width: 860px) {
  .ao-featured-post {
    grid-template-columns: 1.05fr 1fr;
  }
}

.ao-featured-media {
  min-height: 260px;
  background: var(--saudi-emerald-deep);
}

.ao-featured-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ao-featured-body {
  padding: clamp(1.75rem, 3.5vw, 2.75rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Search Bar in Journal */
.ao-search-bar {
  display: flex;
  gap: 0.6rem;
  max-width: 560px;
  margin-top: 1.35rem;
}

.ao-search-bar input {
  flex: 1;
  padding: 0.8rem 1.1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-medium);
  background: var(--bg-surface);
  font-family: inherit;
  font-size: var(--text-sm);
  color: var(--ink-primary);
}

/* Pagination */
.ao-pagination {
  display: flex;
  justify-content: center;
  gap: 0.45rem;
  margin-top: 3rem;
}

.ao-pagination .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding-inline: 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-medium);
  background: var(--bg-surface);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink-secondary);
}

.ao-pagination .page-numbers.current,
.ao-pagination a.page-numbers:hover {
  background: var(--saudi-emerald);
  border-color: var(--saudi-emerald);
  color: #FFFFFF;
}

/* ==========================================================================
   Single Article Reading Experience
   ========================================================================== */
.ao-read-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  width: 0%;
  transform-origin: left center;
  background: linear-gradient(90deg, var(--brand-navy), var(--brand-cobalt));
  z-index: 350;
  pointer-events: none;
  transition: width 60ms linear;
}

[dir="rtl"] .ao-read-progress {
  transform-origin: right center;
  background: linear-gradient(270deg, var(--brand-navy), var(--brand-cobalt));
}

@media (prefers-reduced-motion: reduce) {
  .ao-read-progress {
    transition: none;
  }
}

.ao-article-hero {
  padding-block: clamp(2.25rem, 4vw, 3.75rem) 2rem;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

.ao-article-title {
  font-family: var(--font-ar-serif);
  font-size: clamp(1.85rem, 3.2vw, 2.75rem);
  line-height: 1.3;
  max-width: 24ch;
  margin-bottom: 1.2rem;
}

.ao-article-meta-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.25rem;
  font-size: var(--text-sm);
  color: var(--ink-muted);
}

.ao-article-author-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--ink-primary);
  font-weight: 600;
}

.ao-article-author-chip img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  object-position: top;
  border: 1px solid var(--bisht-gold);
}

.ao-article-cover {
  margin-top: 2rem;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--bisht-gold-border);
  max-height: 460px;
}

.ao-article-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ao-article-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
  padding-block: clamp(2.5rem, 4.5vw, 4rem);
  align-items: start;
}

@media (min-width: 992px) {
  .ao-article-layout {
    grid-template-columns: 280px 1fr;
  }
}

.ao-article-sidebar {
  position: sticky;
  top: calc(var(--header-h) + 1.5rem);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.ao-toc-box,
.ao-share-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.ao-toc-box {
  max-height: 52vh;
  overflow-y: auto;
}

.ao-toc-title {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--saudi-emerald);
  margin-bottom: 0.85rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--bisht-gold-border);
}

.ao-toc-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ao-toc-list a {
  display: block;
  font-size: var(--text-xs);
  color: var(--ink-secondary);
  padding-inline-start: 0.65rem;
  border-inline-start: 2px solid transparent;
}

.ao-toc-list a.is-h3 {
  padding-inline-start: 1.25rem;
  color: var(--ink-muted);
}

.ao-toc-list a.is-active,
.ao-toc-list a:hover {
  color: var(--saudi-emerald);
  border-inline-start-color: var(--bisht-gold);
  font-weight: 600;
}

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

.ao-share-btn {
  padding: 0.45rem 0.78rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-medium);
  background: var(--bg-canvas);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--ink-primary);
}

.ao-share-btn:hover {
  background: var(--saudi-emerald);
  border-color: var(--saudi-emerald);
  color: #FFFFFF;
}

/* Article Prose */
.ao-prose,
.ao-article-content {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: clamp(1.5rem, 4vw, 3rem);
  font-family: var(--font-serif-text);
  font-size: 1.07rem;
  line-height: 1.92;
  color: var(--ink-primary);
}

.ao-prose > *:first-child {
  margin-top: 0;
}

.ao-prose p,
.ao-article-content p {
  max-width: 68ch;
  color: var(--ink-secondary);
  margin-bottom: 1.35em;
}

.ao-prose a {
  color: var(--saudi-emerald);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--bisht-gold);
  text-underline-offset: 4px;
}

.ao-prose a:hover {
  color: var(--bisht-gold-hover);
}

.ao-prose h2 {
  font-size: 1.55rem;
  margin-top: 2.1em;
  margin-bottom: 0.7em;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--bisht-gold-border);
  scroll-margin-top: calc(var(--header-h) + 1.5rem);
}

.ao-prose h3 {
  font-size: 1.25rem;
  color: var(--saudi-emerald);
  margin-top: 1.65em;
  margin-bottom: 0.55em;
  scroll-margin-top: calc(var(--header-h) + 1.5rem);
}

.ao-prose ul,
.ao-prose ol {
  padding-inline-start: 1.5rem;
  margin-bottom: 1.4em;
  color: var(--ink-secondary);
}

.ao-prose li {
  margin-bottom: 0.5em;
}

.ao-prose blockquote {
  margin: 1.75em 0;
  padding: 1.25rem 1.5rem;
  background: var(--bg-canvas);
  border-inline-start: 4px solid var(--brand-cobalt);
  border-radius: var(--radius-sm);
  font-family: var(--font-serif-text);
  font-size: 1.22rem;
  color: var(--ink-primary);
}

.ao-prose table {
  width: 100%;
  border-collapse: collapse;
  margin-block: 1.5rem;
  font-family: var(--font-ar-sans);
  font-size: var(--text-sm);
}

.ao-prose th,
.ao-prose td {
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-subtle);
  text-align: start;
}

.ao-prose th {
  background: var(--brand-navy);
  color: #FFFFFF;
}

/* Branded Author Signature Box */
.ao-author-box {
  margin-top: 2.25rem;
  background: var(--bg-subtle);
  border: 1px solid var(--bisht-gold-border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

@media (min-width: 640px) {
  .ao-author-box {
    flex-direction: row;
    align-items: center;
  }
}

.ao-author-avatar {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--bisht-gold);
  flex-shrink: 0;
}

.ao-author-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}

.ao-author-role {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--saudi-emerald);
  background: var(--bg-surface);
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--bisht-gold-border);
  margin-bottom: 0.45rem;
}
