/* Diwan redesign (gulfcryptotrading.com): a centred magazine on a paper sheet with a light and a
   dark palette. Loaded after identities.css for this theme only; all other themes are untouched.
   Shared markup (cards, advertising places, SEO, services) keeps its contract. */
.theme-diwan {
  --paper: #fffdfd;
  --ink: #2a1f29;
  --muted: #6c5d6b;
  --line: #e5dce3;
  --wash: #f4eef3;
  --accent: #624159;
  --gold: #8a6520;
  --up: #1b7a4a;
  --down: #b8323a;
  --deskbg: #ebe5ea;
  --sans: "Manrope", "Noto Sans Arabic", Arial, sans-serif;
  --serif: "Newsreader", Georgia, serif;
  --display: var(--serif);
  --shell-width: 1240px;
  --shell-gutter: 28px;
  --thumb: 120px;
  background: var(--deskbg);
  color: var(--ink);
  font: 15px/1.6 var(--sans);
}
[lang="ar"] .theme-diwan {
  --sans: "Noto Sans Arabic", "Manrope", Arial, sans-serif;
  --serif: "Noto Naskh Arabic", "Noto Sans Arabic", serif;
  --display: var(--serif);
}
html[data-theme="dark"] .theme-diwan {
  --paper: #17121b;
  --ink: #f3ecf1;
  --muted: #ab9ca8;
  --line: #332a37;
  --wash: #221b27;
  --accent: #dcbdd2;
  --gold: #e7b95e;
  --up: #5fc58f;
  --down: #f08a90;
  --deskbg: #0e0b11;
  color-scheme: dark;
}
.theme-diwan a:hover { color: var(--accent); text-decoration: none; }
.theme-diwan .site-shell { background: var(--paper); min-height: 100vh; padding-bottom: 40px; }
.theme-diwan main { padding-top: 0; }
.theme-diwan .skip-link { color: var(--ink); }

/* Utility bar: tagline, date, service links and the palette switch. */
.diwan-topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.diwan-tagline { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.diwan-topbar-links { display: flex; align-items: center; gap: 16px; flex-shrink: 0; margin-inline-start: auto; }
.diwan-topbar-links a { color: var(--muted); }
.diwan-toggle { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--wash); color: var(--ink); border-radius: 999px; padding: 4px 10px; font: 600 11px/1.4 var(--sans); cursor: pointer; }
.diwan-toggle:hover { border-color: var(--accent); }
.diwan-toggle-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); display: inline-block; }

/* Masthead: badge and Naskh wordmark centred above a ruled navigation line. */
.theme-diwan .masthead { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 26px 0 0; text-align: center; }
.theme-diwan .masthead .brand-row { justify-content: center; padding: 0; gap: 16px; }
.theme-diwan .masthead .wordmark { display: inline-flex; align-items: center; justify-content: center; gap: 16px; max-width: 100%; font: 600 clamp(36px, 5vw, 60px)/1.2 var(--display); letter-spacing: 0; color: var(--ink); }
.theme-diwan .masthead .wordmark span { overflow-wrap: anywhere; }
.diwan-badge { flex: none; width: 48px; height: 48px; border-radius: 10px; object-fit: contain; }
.theme-diwan .masthead .main-nav { width: 100%; justify-content: safe center; flex-wrap: wrap; gap: 4px 28px; border: 0; border-block: 1px solid var(--line); padding: 2px 0; font: 600 14px/1 var(--sans); }
.theme-diwan .masthead .main-nav > a { min-height: 44px; padding: 0; background: none; color: var(--ink); }
.theme-diwan .masthead .main-nav a[aria-current] { background: none; padding-inline: 0; color: var(--ink); text-decoration: underline; text-decoration-color: var(--gold); text-decoration-thickness: 2px; text-underline-offset: 8px; }
.theme-diwan .masthead .main-nav a:hover { color: var(--accent); }
.theme-diwan .nav-sections { margin-inline-start: 0; }
.theme-diwan .nav-directory { border-top-color: var(--gold); }

/* Market and service strip: one quiet tabular line, attribution underneath. */
.diwan-strip { padding: 10px 0 8px; border-bottom: 1px solid var(--line); font: 500 12px/1.2 var(--sans); font-variant-numeric: tabular-nums; }
.diwan-strip-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 20px; white-space: nowrap; }
.diwan-strip .crypto-strip { display: contents; }
.diwan-strip-kicker { font: 700 11px/1.2 var(--sans); color: var(--muted); flex-shrink: 0; }
.diwan-coin, .diwan-service { display: inline-flex; gap: 8px; align-items: baseline; flex-shrink: 0; }
.diwan-coin { font-family: "Manrope", var(--sans); }
.diwan-coin b, .diwan-service b { color: var(--ink); font-weight: 700; }
.diwan-coin .crypto-price { font: inherit; font-weight: 500; justify-self: auto; }
.diwan-coin .crypto-change { font: inherit; font-weight: 700; grid-column: auto; }
.theme-diwan .crypto-up { color: var(--up); }
.theme-diwan .crypto-down { color: var(--down); }
.theme-diwan .crypto-flat { color: var(--muted); }
.diwan-service [dir="ltr"] { font-family: "Manrope", var(--sans); }
.diwan-rates { gap: 14px; }
.diwan-strip-rule { width: 1px; height: 18px; background: var(--line); flex-shrink: 0; }
.diwan-strip-note { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 2px 10px; margin: 6px 0 0; font: 500 10px/1.5 var(--sans); color: var(--muted); }
.diwan-strip-note a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }

/* Advertising places keep the shared markup; only the frame and label change. */
.theme-diwan .ad-slot { margin: 20px auto 0; }
.theme-diwan .ad-label { display: block; height: 18px; color: var(--muted); font: 600 10px/18px var(--sans); letter-spacing: .08em; text-align: start; }
.theme-diwan .ad-slot img, .theme-diwan .ad-placeholder { background: var(--wash); }
.theme-diwan .ad-placeholder { border-color: var(--line); color: var(--muted); }

/* Shared card vocabulary. */
.theme-diwan .story-kicker { font: 700 11px/1.4 var(--sans); color: var(--gold); margin-bottom: 4px; }
.theme-diwan .story-card h2 { font: 600 17px/1.6 var(--display); letter-spacing: 0; }
.theme-diwan .story-card h2 a:hover { color: var(--accent); }
.theme-diwan .story-image { margin-bottom: 0; background: var(--wash); }
.theme-diwan .story-description { font: 400 13px/1.75 var(--sans); color: var(--muted); margin-top: 5px; -webkit-line-clamp: 2; text-wrap: pretty; }
.theme-diwan .section-title { font: 600 22px/1.4 var(--display); color: var(--accent); margin: 0 0 18px; gap: 14px; }
.theme-diwan .section-title::after { background: var(--line); }
.theme-diwan .breadcrumbs { margin: 14px 0 0; font: 500 12px/1.4 var(--sans); color: var(--muted); }
.theme-diwan .breadcrumbs li:not(:last-child)::after { content: "›"; }
.theme-diwan .breadcrumbs a { color: var(--muted); }
.theme-diwan .breadcrumbs [aria-current] { color: var(--ink); }

/* Front: lead | briefs | side column. */
.diwan-front { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr) 300px; gap: 32px; padding: 24px 0 28px; border-bottom: 1px solid var(--line); }
.diwan-front > * { min-width: 0; }
.diwan-front:not(:has(> .diwan-side)) { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); }
.diwan-front:not(:has(> .diwan-briefs)) { grid-template-columns: minmax(0, 1fr) 300px; }
.diwan-front:not(:has(> :nth-child(2))) { grid-template-columns: minmax(0, 1fr); }
.diwan-lead .lead { display: block; }
.diwan-lead .lead .story-image { aspect-ratio: 16 / 9; margin-bottom: 14px; }
.theme-diwan .diwan-lead .lead h2 { font: 600 clamp(24px, 3vw, 36px)/1.5 var(--display); margin-top: 6px; }
.diwan-lead .lead .story-description { font-size: 15px; line-height: 1.85; margin-top: 10px; -webkit-line-clamp: 4; }
.diwan-briefs { border-inline-start: 1px solid var(--line); padding-inline-start: 28px; }
.diwan-briefs .section-title { font-size: 18px; margin-bottom: 4px; }
.diwan-briefs .brief { padding: 12px 0; margin: 0; border: 0; border-bottom: 1px solid var(--line); }
.diwan-briefs .brief:last-child { border-bottom: 0; }
.diwan-side { display: grid; gap: 22px; align-content: start; }
.diwan-side .ad-container { order: -1; }
.diwan-side .ad-slot { margin: 0 auto; }
.diwan-side .thumb + .thumb { padding-top: 18px; border-top: 1px solid var(--line); }

/* A thumb row: text with a small square picture on the inline end. */
.theme-diwan .thumb { display: grid; grid-template-columns: minmax(0, 1fr) 96px; gap: 12px; align-items: start; margin: 0; }
.theme-diwan .thumb .story-image { grid-column: 2; grid-row: 1; aspect-ratio: 1; border-radius: 3px; margin: 0; }
.theme-diwan .thumb .story-copy { grid-column: 1; grid-row: 1; }
.theme-diwan .thumb.text-only { grid-template-columns: minmax(0, 1fr); }
.theme-diwan .thumb h2 { font-size: 16px; }
.theme-diwan .thumb .story-description { display: none; }

/* Latest: four tiles. */
.diwan-latest { padding: 26px 0 28px; border-bottom: 1px solid var(--line); }
.diwan-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 28px; }
.diwan-tiles .tile .story-image { aspect-ratio: 3 / 2; margin-bottom: 10px; }
.theme-diwan .diwan-tiles h2 { font-size: 18px; }
.diwan-tiles .story-description { font-size: 13.5px; line-height: 1.8; margin-top: 6px; }

/* More: ruled rows beside a sticky advertising rail. */
.diwan-more { padding: 26px 0 0; }
.diwan-more .section-title { margin-bottom: 6px; }
.diwan-more-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 32px; align-items: start; }
.diwan-more-grid:not(:has(> .diwan-rail)) { grid-template-columns: minmax(0, 1fr); }
.diwan-more-grid > * { min-width: 0; }
.diwan-rows { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 0 32px; }
.diwan-rows .row { grid-template-columns: minmax(0, 1fr) var(--thumb); gap: 14px; padding: 16px 0; margin: 0; border-bottom: 1px solid var(--line); align-items: start; }
.diwan-rows .row .story-image { grid-column: 2; grid-row: 1; aspect-ratio: 1; border-radius: 3px; margin: 0; }
.diwan-rows .row .story-copy { grid-column: 1; grid-row: 1; }
.diwan-rows .row.text-only { grid-template-columns: minmax(0, 1fr); }
.diwan-rows .row .story-description { display: -webkit-box; }
.diwan-rail { position: sticky; top: 16px; display: grid; gap: 6px; }
.diwan-rail .ad-slot { margin: 16px auto 0; }
.theme-diwan .ad-container-home_lower .ad-slot, .theme-diwan .ad-container-home_mid .ad-slot { margin-top: 28px; }

/* Category page: the title in the magazine voice, then tiles and rows. */
.diwan-topic { padding-top: 10px; }
.theme-diwan .diwan-title { font: 600 clamp(26px, 3vw, 34px)/1.4 var(--display); color: var(--accent); margin: 22px 0 18px; }
.theme-diwan .category-intro { max-width: 760px; margin: 0 0 24px; color: var(--muted); font-size: 15px; line-height: 1.85; }
.diwan-topic ~ .diwan-more { margin-top: 28px; border-top: 1px solid var(--line); }

/* Pagination and the article's closing link share one pill. */
.theme-diwan .pagination, .diwan-end { display: flex; justify-content: center; gap: 12px; padding: 28px 0 8px; margin: 0; font: 600 14px/1.4 var(--sans); }
.diwan-end { margin-top: 30px; padding-top: 22px; border-top: 1px solid var(--line); }
.theme-diwan .pagination a, .diwan-end a, .theme-diwan .empty-state a { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); border: 1px solid var(--line); border-radius: 999px; padding: 10px 22px; text-decoration: none; }
.theme-diwan .pagination a:hover, .diwan-end a:hover, .theme-diwan .empty-state a:hover { background: var(--wash); color: var(--ink); }
[dir="rtl"] .theme-diwan .pagination a[rel="next"]::after, [dir="rtl"] .diwan-end a::after, [dir="ltr"] .theme-diwan .pagination a[rel="prev"]::before { content: "←"; }
[dir="ltr"] .theme-diwan .pagination a[rel="next"]::after, [dir="ltr"] .diwan-end a::after, [dir="rtl"] .theme-diwan .pagination a[rel="prev"]::before { content: "→"; }
.theme-diwan .empty-state { padding: 80px 0; text-align: center; color: var(--muted); font: 400 17px/1.8 var(--serif); }
.theme-diwan .empty-state h1 { font: 700 72px/1 "Manrope", var(--sans); color: var(--accent); margin-bottom: 12px; }
.theme-diwan .empty-state a { margin-top: 20px; font: 600 14px/1.4 var(--sans); }

/* Article: centred heading, wide figure, a 680px reading measure and a sticky side column. */
.theme-diwan .article-layout { grid-template-columns: minmax(0, 1fr) 300px; gap: 48px; padding-top: 20px; align-items: start; }
.theme-diwan .article-layout:not(:has(> .article-related > *)) { grid-template-columns: minmax(0, 1fr); }
.theme-diwan .article-heading { max-width: 760px; margin: 0 auto; text-align: center; }
.theme-diwan .article-heading .back-link { display: none; }
.theme-diwan .article-heading .story-kicker { font-size: 12px; margin: 0; }
.theme-diwan .article-heading h1 { font: 600 clamp(28px, 4vw, 48px)/1.5 var(--display); letter-spacing: 0; margin: 10px 0 0; text-wrap: pretty; }
.theme-diwan .article-deck { max-width: none; margin: 16px auto 0; font: 400 clamp(16px, 1.7vw, 20px)/1.8 var(--serif); color: var(--muted); text-wrap: pretty; }
.theme-diwan .article-byline { justify-content: center; gap: 8px; border: 0; margin: 18px 0 0; padding: 0; }
.theme-diwan .article-byline > span { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px; font: 600 11px/1.4 var(--sans); color: var(--muted); }
.theme-diwan .article-byline > span::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--gold); flex: none; }
.theme-diwan .article-byline a { color: var(--ink); }
.theme-diwan .article-heading .source-note { margin: 14px auto 0; border: 0; padding: 0; font: 400 12px/1.7 var(--sans); color: var(--muted); }
.theme-diwan .article-heading .source-note a { text-decoration: underline; text-underline-offset: 3px; }
.theme-diwan .article-figure { margin: 28px 0 0; }
.theme-diwan .article-figure img { aspect-ratio: 16 / 9; height: auto; max-height: 560px; object-fit: cover; object-position: center; background: var(--wash); }
.theme-diwan .article-figure figcaption { font: 400 11px/1.6 var(--sans); color: var(--muted); padding-top: 8px; }
.theme-diwan .article-body { max-width: 680px; margin: 28px auto 0; font: 400 clamp(18px, 1.8vw, 21px)/1.95 var(--serif); text-wrap: pretty; }
.theme-diwan .article-body p { margin-bottom: 1.2em; }
.theme-diwan .ad-container-article_inline .ad-slot { margin: 10px auto 30px; }
.theme-diwan .ad-container-article_after .ad-slot { margin: 32px auto 0; }
.theme-diwan .ad-container-article_after .ad-label { text-align: center; }
.theme-diwan .article-related { position: sticky; top: 16px; display: grid; gap: 22px; align-content: start; border: 0; padding: 0; }
.theme-diwan .article-related .ad-slot { margin: 0 auto; }
.theme-diwan .article-related .section-title { font-size: 18px; margin: 0; }
.theme-diwan .article-related .compact { display: grid; grid-template-columns: minmax(0, 1fr) 84px; gap: 12px; align-items: start; margin: 0; }
.theme-diwan .article-related .compact + .compact { padding-top: 16px; border-top: 1px solid var(--line); }
.theme-diwan .article-related .compact .story-image { grid-column: 2; grid-row: 1; aspect-ratio: 1; border-radius: 3px; margin: 0; }
.theme-diwan .article-related .compact .story-copy { grid-column: 1; grid-row: 1; }
.theme-diwan .article-related .compact.text-only { grid-template-columns: minmax(0, 1fr); }
.theme-diwan .article-related .compact h2 { font-size: 16px; }

/* About page in the reading measure. */
.theme-diwan .about-page { max-width: 680px; margin: 24px auto 60px; font: 400 17px/1.9 var(--serif); }
.theme-diwan .about-page h1 { font: 600 clamp(28px, 4vw, 40px)/1.4 var(--display); text-align: center; margin-bottom: 8px; }
.theme-diwan .about-page h2 { font: 600 22px/1.4 var(--display); color: var(--accent); margin: 28px 0 10px; }
.theme-diwan .about-page a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.theme-diwan .about-page ul { padding-inline-start: 20px; }

/* Footer: brand and tagline, section links, then service links on one ruled line. */
.theme-diwan .site-footer { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px 40px; align-items: start; margin-top: 40px; padding: 24px 0 0; border: 0; border-top: 2px solid var(--ink); text-align: start; font-size: 13px; background: none; }
.theme-diwan .footer-brand { font: 600 26px/1.3 var(--display); letter-spacing: 0; }
.theme-diwan .site-footer .footer-identity p { margin: 6px 0 0; color: var(--muted); max-width: 40ch; font-size: 13px; line-height: 1.7; }
.theme-diwan .footer-topics { display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 10px 22px; max-width: none; margin: 0; font-weight: 600; }
.theme-diwan .footer-links { grid-column: 1 / -1; display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 10px 22px; padding: 16px 0 0; border: 0; border-top: 1px solid var(--line); color: var(--muted); }
.theme-diwan .footer-links a { min-height: 0; color: var(--muted); }
.theme-diwan .footer-links a:hover, .theme-diwan .footer-topics a:hover { color: var(--accent); }
.theme-diwan .back-top { margin-inline-start: auto; }

@media (max-width: 1100px) {
  .diwan-front { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 28px; }
  .diwan-front:has(> .diwan-side) > .diwan-side { grid-column: 1 / -1; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; padding-top: 24px; border-top: 1px solid var(--line); }
  .diwan-side .thumb + .thumb { padding-top: 0; border-top: 0; }
  .diwan-front:not(:has(> .diwan-briefs)) { grid-template-columns: minmax(0, 1fr); }
  .diwan-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 26px; }
  .theme-diwan .article-layout { gap: 30px; }
}
@media (max-width: 900px) {
  .diwan-more-grid { grid-template-columns: minmax(0, 1fr); }
  .diwan-rail { position: static; display: flex; flex-wrap: wrap; justify-content: center; gap: 22px; }
  .diwan-rail .ad-container { flex: 0 1 300px; }
  .diwan-rail .ad-slot { margin: 16px auto 0; }
  .theme-diwan .article-layout { grid-template-columns: minmax(0, 1fr); }
  .theme-diwan .article-related { position: static; }
}
@media (max-width: 767px) {
  .theme-diwan .article-layout:has(.ad-container-article_side) { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .theme-diwan { --shell-gutter: 16px; --thumb: 96px; }
  .diwan-topbar { padding: 8px 0; }
  .diwan-topbar-links > :not(.diwan-toggle) { display: none; }
  .theme-diwan .masthead { padding-top: 20px; gap: 12px; }
  .theme-diwan .masthead .wordmark { font-size: 36px; gap: 12px; }
  .diwan-badge { width: 40px; height: 40px; border-radius: 9px; }
  .theme-diwan .masthead .main-nav { gap: 0 22px; font-size: 13px; justify-content: safe center; }
  .diwan-strip-row { flex-wrap: nowrap; gap: 0 18px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .diwan-strip-row::-webkit-scrollbar { display: none; }
  .diwan-strip-note { justify-content: flex-start; }
  .diwan-front { grid-template-columns: minmax(0, 1fr); gap: 22px; padding: 18px 0 22px; }
  .diwan-front:has(> .diwan-side) > .diwan-side { grid-template-columns: minmax(0, 1fr); gap: 18px; padding-top: 22px; }
  .diwan-side .thumb + .thumb { padding-top: 18px; border-top: 1px solid var(--line); }
  .diwan-briefs { border: 0; padding: 0; }
  .diwan-briefs .section-title { margin-top: 2px; }
  .diwan-latest { padding: 22px 0 24px; }
  .diwan-tiles { grid-template-columns: minmax(0, 1fr); gap: 22px; }
  .theme-diwan .section-title { font-size: 20px; }
  .diwan-rows { gap: 0; }
  .theme-diwan .article-layout { padding-top: 14px; }
  .theme-diwan .article-related { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; margin: 0; padding: 0; border: 0; }
  .theme-diwan .article-related > .section-title { grid-column: auto; margin: 0; }
  .theme-diwan .article-related .compact { grid-template-columns: minmax(0, 1fr) 84px; margin: 0; }
  .theme-diwan .article-related .compact.text-only { grid-template-columns: minmax(0, 1fr); }
  .theme-diwan .article-related .compact .story-image { margin: 0; }
  .theme-diwan .article-figure { margin-top: 22px; }
  .theme-diwan .article-body { margin-top: 22px; }
  .theme-diwan .site-footer { grid-template-columns: minmax(0, 1fr); gap: 16px; margin-top: 36px; padding: 22px 0 0; }
  .theme-diwan .footer-topics, .theme-diwan .footer-links { gap: 10px 18px; }
  .theme-diwan .pagination a, .diwan-end a { padding: 9px 18px; font-size: 13px; }
  .theme-diwan .empty-state h1 { font-size: 56px; }
}
