/*
 * Raqmana blog: app-specific parts. The design system itself (buttons, cards, fields, header,
 * footer, hero, admin shell, login, forms) is in rq-ui.css.
 */

/* ---------- Listing ---------- */
.listing { padding: 48px 0 80px; }
.listing__tools {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin-bottom: 24px; padding: 12px 12px 12px 16px;
}
.category-list { display: flex; gap: 8px; min-width: 0; overflow-x: auto; scrollbar-width: none; padding-block: 2px; }
.category-list::-webkit-scrollbar { display: none; }
.listing__search { display: flex; gap: 8px; flex: 0 0 340px; }
.listing__search .control { flex: 1; }
.listing__more { margin-top: 32px; text-align: center; }

.filter-summary {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: -4px 0 20px; font-size: 14px; color: var(--rq-text-muted);
}
.filter-summary span, .filter-summary a { display: inline-flex; align-items: center; gap: 6px; }
.filter-summary strong { font-family: var(--rq-font-display); color: var(--rq-text-number); }
.filter-summary a { font-family: var(--rq-font-display); font-size: 13px; color: var(--rq-text-link); }
.filter-summary a:hover { color: var(--rq-text-link-hover); }

/* Category label on cards: small blue display text */
.article-card__category {
  align-self: flex-start;
  font-family: var(--rq-font-display); font-size: 12px; font-weight: 500; color: var(--rq-text-eyebrow);
  transition: color var(--rq-dur) var(--rq-ease);
}
.article-card__category:hover { color: var(--rq-text-link-hover); }

.article-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; font-size: 12px; color: var(--rq-text-subtle); }
.article-meta > span { display: inline-flex; align-items: center; gap: 6px; }

/* Placeholder when a post has no cover: hairline grid on the tint, brand mark in a white tile */
.media-placeholder {
  position: relative; display: grid; place-items: center; width: 100%; height: 100%;
  background-color: var(--rq-surface-tint);
  background-image:
    linear-gradient(to right, var(--rq-line-soft) 1px, transparent 1px),
    linear-gradient(to top, var(--rq-line-soft) 1px, transparent 1px);
  background-size: 30px 30px; background-position: left bottom;
}
.media-placeholder__mark {
  display: grid; place-items: center; width: 64px; height: 64px;
  border-radius: var(--rq-radius-lg); background: var(--rq-surface); box-shadow: 0 0 0 1px var(--rq-line);
}
.media-placeholder__mark img { width: 38px; }
.media-placeholder--large .media-placeholder__mark { width: 96px; height: 96px; }
.media-placeholder--large .media-placeholder__mark img { width: 58px; }

/* Featured post: media | copy */
.featured {
  display: grid; grid-template-columns: 1.1fr .9fr; min-height: 320px; margin-bottom: 20px; overflow: hidden;
  background: var(--rq-surface); border: 1px solid var(--rq-line); border-radius: var(--rq-radius-card);
  transition: border-color var(--rq-dur) var(--rq-ease);
}
.featured:hover { border-color: var(--rq-line-strong); }
.featured__media { min-height: 320px; overflow: hidden; background: var(--rq-surface-tint); }
.featured__media > img { width: 100%; height: 100%; object-fit: cover; }
.featured__body { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 10px; padding: 36px 40px; }
.featured h3 { margin: 0; font-size: clamp(20px, 2.2vw, 28px); font-weight: 700; line-height: 1.4; color: var(--rq-text-heading); }
.featured h3 a:hover, .article-card h3 a:hover { color: var(--rq-text-link-hover); }
.featured p { margin: 0; font-size: 15px; line-height: 1.85; color: var(--rq-text-muted); }
.featured .button { margin-top: 8px; }

/* Article cards: flat, hairline; hover strengthens the border (no lift) */
.cards-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.article-card {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--rq-surface); border: 1px solid var(--rq-line); border-radius: var(--rq-radius-card);
  transition: border-color var(--rq-dur) var(--rq-ease);
}
.article-card:hover { border-color: var(--rq-line-strong); }
.article-card__media { display: block; height: 190px; overflow: hidden; background: var(--rq-surface-tint); }
.article-card__media > img { width: 100%; height: 100%; object-fit: cover; }
.article-card__body { display: flex; flex: 1; flex-direction: column; gap: 6px; padding: 18px 20px 20px; }
.article-card h3 { margin: 0; font-size: 16px; font-weight: 600; line-height: 1.5; color: var(--rq-text-heading); }
.article-card p {
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  margin: 0 0 12px; font-size: 14px; line-height: 1.75; color: var(--rq-text-muted);
}
.article-card .article-meta { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--rq-line-soft); }

/* ---------- Article page ---------- */
.story__header { padding: 40px 0 32px; background: var(--rq-surface); border-bottom: 1px solid var(--rq-line-soft); }
.story__header-inner > * { max-width: 860px; }
.story__header h1 { margin: 16px 0 12px; font-size: clamp(28px, 3.6vw, 44px); font-weight: 700; line-height: 1.35; color: var(--rq-text-heading); }
.story__lead { margin: 0; font-size: 17px; line-height: 1.9; color: var(--rq-text-muted); }
.story__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; margin-top: 20px; }
.story__byline { display: inline-flex; align-items: center; gap: 8px; font-family: var(--rq-font-display); font-size: 13px; color: var(--rq-text-body); }

.avatar {
  display: grid; place-items: center; flex: none; width: 52px; height: 52px; border-radius: 50%;
  background: var(--rq-icon-tile); color: var(--rq-action-primary);
  font-family: var(--rq-font-display); font-size: 22px; font-weight: 700;
}
html[data-theme="dark"] .avatar { color: var(--rq-text-link); }
.avatar--sm { width: 28px; height: 28px; font-size: 13px; }

.story__cover { height: min(480px, 46vw); margin: 32px 0 0; overflow: hidden; border-radius: var(--rq-radius-card); background: var(--rq-surface-tint); }
.story__cover img { width: 100%; height: 100%; object-fit: cover; }

.story__layout { display: grid; grid-template-columns: minmax(0, 760px) 260px; justify-content: space-between; gap: 48px; padding: 40px 0 72px; }
.story__aside { position: sticky; top: calc(var(--rq-topbar-height) + 20px); align-self: start; display: flex; flex-direction: column; gap: 16px; }
.share-links { display: flex; flex-wrap: wrap; gap: 8px; }
.share-links button.chip { background: transparent; cursor: pointer; font-family: var(--rq-font-body); }
.aside-back { align-self: flex-start; }

.author-card { display: flex; align-items: flex-start; gap: 16px; margin-top: 40px; padding: 20px 24px; }
.author-card h2 { margin: 2px 0 4px; font-size: 17px; font-weight: 600; color: var(--rq-text-heading); }
.author-card p { margin: 0; font-size: 14px; line-height: 1.8; color: var(--rq-text-muted); }
.author-card .eyebrow { font-size: 12px; }

.related { padding-bottom: 80px; }

/* Reading text */
.prose { font-size: 17px; line-height: 2; color: var(--rq-text-body); }
.prose > :first-child { margin-top: 0; }
.prose p { margin: 0 0 24px; }
.prose h2, .prose h3, .prose h4 { margin: 36px 0 12px; line-height: 1.45; color: var(--rq-text-heading); }
.prose h2 { font-size: 26px; }
.prose h3 { font-size: 21px; }
.prose h4 { font-size: 18px; }
.prose a { color: var(--rq-text-link); text-decoration: underline; text-underline-offset: 3px; }
.prose a:hover { color: var(--rq-text-link-hover); }
.prose ol, .prose ul { padding-inline-start: 28px; margin: 0 0 24px; }
.prose li { margin-bottom: 8px; }
.prose ol:has(> li[data-list="bullet"]) { list-style: disc; }
.prose ol:has(> li[data-list="ordered"]) { list-style: decimal; }
.prose blockquote {
  margin: 28px 0; padding: 16px 20px;
  border-inline-start: 3px solid var(--rq-rule-accent); border-radius: 0 var(--rq-radius-sm) var(--rq-radius-sm) 0;
  background: var(--rq-surface-hover); color: var(--rq-text-heading);
}
.prose pre { margin: 0 0 24px; padding: 16px; overflow-wrap: anywhere; white-space: pre-wrap; border-radius: var(--rq-radius-md); background: var(--rq-surface-chrome); font-size: 14px; }
.prose img { max-width: 100%; height: auto; margin: 28px auto; border-radius: var(--rq-radius-md); }
.prose .ql-align-center { text-align: center; }
.prose .ql-align-left { text-align: left; }
.prose .ql-align-right { text-align: right; }
.prose .ql-align-justify { text-align: justify; }
.prose .ql-direction-rtl { direction: rtl; text-align: right; }

/* ---------- About ---------- */
.about-points { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; padding: 48px 0 80px; }
.about-point { display: flex; align-items: flex-start; gap: 14px; padding: 20px; }
.about-point h2 { margin: 0 0 4px; font-size: 15px; font-weight: 600; color: var(--rq-text-heading); }
.about-point p { margin: 0; font-size: 14px; line-height: 1.75; color: var(--rq-text-muted); }

/* ---------- Admin ---------- */
.row-thumb {
  display: grid; place-items: center; flex: none; width: 56px; height: 42px; overflow: hidden;
  border-radius: var(--rq-radius-md); background: var(--rq-icon-tile); color: var(--rq-action-primary);
}
.row-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* Writing surface: toolbar + Quill editor framed like a field */
.writing-toolbar {
  margin-bottom: -8px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 6px;
  border: 1px solid var(--rq-line-strong); border-bottom: 0; border-radius: var(--rq-radius-sm) var(--rq-radius-sm) 0 0;
  background: var(--rq-surface-chrome);
}
.writing-toolbar button {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px;
  border: 0; border-radius: var(--rq-radius-sm); background: transparent;
  font-family: var(--rq-font-display); font-size: 12px; color: var(--rq-text-body);
  transition: background-color var(--rq-dur) var(--rq-ease), color var(--rq-dur) var(--rq-ease);
}
.writing-toolbar button .icon { color: var(--rq-text-muted); }
.writing-toolbar button:hover { background: var(--rq-surface); color: var(--rq-action-primary); box-shadow: 0 0 0 1px var(--rq-line); }
.writing-toolbar__divider { width: 1px; height: 20px; margin-inline: 4px; background: var(--rq-line-strong); }
.writing-toolbar:not([hidden]) + .rich-editor { border-radius: 0 0 var(--rq-radius-sm) var(--rq-radius-sm); }
.rich-editor { border: 1px solid var(--rq-line-strong); border-radius: var(--rq-radius-sm); background: var(--rq-surface); transition: border-color var(--rq-dur) var(--rq-ease); }
.rich-editor:focus-within { border-color: var(--rq-action-primary); }
.rich-editor .ql-editor { min-height: 460px; padding: 20px 22px; direction: rtl; text-align: right; font: 400 17px/2 var(--rq-font-body); color: var(--rq-text-body); }
.rich-editor .ql-editor.ql-blank::before { right: 22px; left: auto; font-style: normal; text-align: right; color: var(--rq-text-subtle); }
.rich-editor .ql-editor h2 { margin: 18px 0 10px; font-family: var(--rq-font-display); font-size: 24px; color: var(--rq-text-heading); }
.rich-editor .ql-editor img { max-width: 100%; height: auto; margin: 24px auto; border-radius: var(--rq-radius-md); }
.rich-editor .ql-editor blockquote { padding-left: 0; padding-right: 16px; border-left: 0; border-right: 3px solid var(--rq-rule-accent); }
.rich-editor .ql-tooltip { z-index: 10; direction: ltr; }
.field--editor .control textarea { min-height: 420px; }
.editor-status { display: block; color: var(--rq-success) !important; }
.editor-status--error { color: var(--rq-danger) !important; }

/* ---------- Responsive ---------- */
@media (max-width: 1050px) {
  .cards-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .listing__tools { flex-direction: column; align-items: stretch; }
  .listing__search { flex-basis: auto; }
  .story__layout { grid-template-columns: minmax(0, 1fr) 220px; gap: 28px; }
}

@media (max-width: 860px) {
  .featured { grid-template-columns: 1fr; }
  .featured__media { min-height: 220px; height: 220px; }
  .featured__body { padding: 24px; }
  .story__layout { grid-template-columns: 1fr; }
  .story__aside { position: static; }
  .about-points { grid-template-columns: 1fr; }
}

@media (max-width: 780px) {
  .header-site-link { display: none; }
}

@media (max-width: 599.98px) {
  .listing { padding: 32px 0 56px; }
  .cards-grid { grid-template-columns: 1fr; gap: 16px; }
  .listing__tools { padding: 12px; }
  .story__header { padding: 28px 0 24px; }
  .story__cover { height: 240px; margin-top: 20px; }
  .story__layout { padding: 28px 0 48px; }
  .prose { font-size: 16px; }
  .author-card { padding: 16px; gap: 12px; }
  .author-card .avatar { width: 44px; height: 44px; font-size: 19px; }
}
