/* Wijdan Gentle — the reading page (single posts).
   Loaded on single posts only. Colours and fonts come from the Editor presets (theme.json);
   this file lays out the title, cover, text, share line, prev/next and the progress line.
   Phone first; desktop from 900px. No motion inside the reading text. */

.wijdan-post-page {
  --wj-paper: var(--wp--preset--color--paper);
  --wj-surface: var(--wp--preset--color--surface);
  --wj-mint: var(--wp--preset--color--mint);
  --wj-mint-deep: var(--wp--preset--color--mint-deep);
  --wj-mint-ink: var(--wp--preset--color--mint-ink);
  --wj-ink: var(--wp--preset--color--ink);
  --wj-muted: var(--wp--preset--color--muted);
  --wj-line: var(--wp--preset--color--line);
  --wj-serif: var(--wp--preset--font-family--newsreader);
  --wj-arabic: var(--wp--preset--font-family--noto-naskh-arabic);
  padding-bottom: 40px;
}

/* ---------- back link, head ---------- */
.wijdan-article .wijdan-back { margin: 18px 0 0; font-size: 15px; font-style: italic; color: var(--wj-muted); }
.wijdan-article .wijdan-back a { color: inherit; display: inline-flex; align-items: center; gap: 8px; }
.wijdan-article .wijdan-back a:hover { color: var(--wj-mint-ink); }

.wijdan-article .wijdan-head { display: grid; gap: 12px; padding: 28px 0 22px; margin-top: 0; }
.wijdan-article .wijdan-head > * { margin: 0; min-width: 0; }
.wijdan-head .wijdan-byline--thumb { display: none; }

.wijdan-article .wijdan-title {
  margin: 0; font-size: clamp(32px, 8.4vw, 50px); font-weight: 400; line-height: 1.12; letter-spacing: -.01em;
  text-wrap: balance; overflow-wrap: anywhere;
}
.wijdan-article[lang="ar"] .wijdan-title { line-height: 1.45; letter-spacing: 0; }

/* ---------- cover: the whole picture, never cropped, kept short so the first line is near ---------- */
.wijdan-article .wijdan-cover { display: flex; justify-content: center; margin: 0 0 30px; }
.wijdan-article .wijdan-cover img {
  width: auto; max-width: 100%; height: auto; max-height: min(44vh, 420px); object-fit: contain;
  border-radius: 4px; box-shadow: 0 18px 40px -28px rgba(29, 38, 35, .45);
}

/* ---------- the text ---------- */
.wijdan-article .wp-block-post-content { font-size: 19px; line-height: 1.72; overflow-wrap: break-word; margin-top: 0; }
.wijdan-article .wp-block-post-content .has-text-align-center { text-align: center; }
.wijdan-article .wp-block-post-content strong { font-weight: 600; }
.wijdan-article .wp-block-post-content figure, .wijdan-article .wp-block-post-content .wp-block-uagb-image { margin-block: 2em; }
.wijdan-article .wp-block-post-content figure img { margin-inline: auto; }
.wijdan-article .wp-block-post-content figcaption, .wijdan-article .wp-block-post-content .wp-element-caption {
  margin-top: 10px; font-size: 15px; font-style: italic; color: var(--wj-muted); text-align: center;
}
.wijdan-article .wp-block-post-content hr { width: 56px; margin: 2.4em auto; border: 0; border-top: 1px solid var(--wj-ink); opacity: .4; }
.wijdan-article .wp-block-post-content blockquote, .wijdan-article .wp-block-post-content .wp-block-pullquote { font-size: 1.12em; line-height: 1.55; }
/* drop cap on English prose only (not poems, not Arabic) */
.wijdan-article:not([lang="ar"]) .wp-block-post-content:not(.poem) > p:first-child::first-letter {
  float: left; font-size: 3.4em; line-height: .9; padding: .06em .08em 0 0; color: var(--wj-mint-ink);
}

/* poems: one column of lines, each stanza a breath apart */
.wijdan-article .wp-block-post-content.poem { width: fit-content; max-width: min(100%, 34rem); font-size: 20px; line-height: 1.72; margin-inline: auto; }
.wijdan-article .wp-block-post-content.poem > * + * { margin-top: 0; }
.wijdan-article .poem .stanza + .stanza, .wijdan-article .poem .stanza + p, .wijdan-article .poem p + .stanza { margin-top: 1.35em; }
.wijdan-article .poem .ln { display: block; padding-inline-start: 1.4em; text-indent: -1.4em; }
.wijdan-article .wp-block-post-content.poem > hr { margin: 2.2em auto; }
.wijdan-article .wp-block-post-content.poem > p { margin-block: 1.35em; }

/* Arabic text: the Arabic face, bigger, taller lines, no italics */
.wijdan-article[lang="ar"] .wp-block-post-title, .wijdan-article[lang="ar"] .wp-block-post-content { direction: rtl; font-family: var(--wj-arabic); }
.wijdan-article[lang="ar"] .wp-block-post-content { font-size: 21px; line-height: 2; }
.wijdan-article[lang="ar"] .wp-block-post-content.poem { font-size: 22px; line-height: 2.05; }
.wijdan-article[lang="ar"] .wp-block-post-content em, .wijdan-article[lang="ar"] .wp-block-post-content i { font-style: normal; color: var(--wj-muted); }

/* English UI inside an Arabic article stays left-to-right in the Latin face */
.wijdan-article[lang="ar"] .wijdan-back, .wijdan-article[lang="ar"] .wijdan-byline, .wijdan-article[lang="ar"] .wijdan-share,
.wijdan-article[lang="ar"] .wijdan-share__note, .wijdan-article[lang="ar"] .wijdan-writer-box, .wijdan-article[lang="ar"] .wijdan-prev-next,
.wijdan-article[lang="ar"] .wijdan-read-next, .wijdan-article[lang="ar"] .wijdan-end-mark { direction: ltr; font-family: var(--wj-serif); }

/* ---------- end of the piece ---------- */
.wijdan-article .wijdan-end-mark { display: flex; justify-content: center; margin: 40px 0 6px; }
.wijdan-article .wijdan-end-mark img { height: 22px; width: auto; opacity: .28; }

/* share line: two quiet text buttons and a note */
.wijdan-article .wijdan-share { margin: 6px 0 0; gap: 6px 12px; align-items: center; font-size: 15px; color: var(--wj-muted); }
.wijdan-article .wijdan-share > .wp-block-button { display: flex; align-items: center; gap: 12px; margin: 0; }
.wijdan-article .wijdan-share > .wp-block-button + .wp-block-button::before { content: "·"; color: var(--wj-muted); }
.wijdan-article .wijdan-share .wp-block-button .wp-block-button__link {
  background: none; border: 0; border-bottom: 1px solid transparent; border-radius: 0; padding: 2px 0;
  font-size: 15px; font-style: italic; line-height: 1.3; color: var(--wj-muted);
}
.wijdan-article .wijdan-share .wp-block-button .wp-block-button__link:hover,
.wijdan-article .wijdan-share .wp-block-button .wp-block-button__link:focus-visible { color: var(--wj-mint-ink); border-bottom-color: currentColor; background: none; }
.wijdan-article .wijdan-share__note { margin: 4px 0 0; min-height: 20px; text-align: center; font-size: 14px; color: var(--wj-mint-ink); opacity: 0; overflow-wrap: anywhere; }
.wijdan-article .wijdan-share__note.on { opacity: 1; }

/* previous / next */
.wijdan-article .wijdan-prev-next { margin-top: 0; padding: 18px 0; border-bottom: 1px solid var(--wj-line); gap: 16px; }
.wijdan-article .wijdan-prev-next > * { flex: 1 1 0; min-width: 0; }
.wijdan-article .wijdan-prev-next .wp-block-post-navigation-link { display: flex; align-items: first baseline; gap: 8px; font-size: 17px; line-height: 1.3; }
.wijdan-article .wijdan-prev-next .wijdan-next { justify-content: flex-end; text-align: end; }
.wijdan-article .wijdan-prev-next .wp-block-post-navigation-link__arrow-previous,
.wijdan-article .wijdan-prev-next .wp-block-post-navigation-link__arrow-next { margin: 0; color: var(--wj-mint-ink); }
.wijdan-article .wijdan-prev-next a { min-width: 0; }
.wijdan-article .wijdan-prev-next .post-navigation-link__label { display: block; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--wj-mint-ink); }
.wijdan-article .wijdan-prev-next .post-navigation-link__title { display: block; }
.wijdan-article .wijdan-prev-next [lang="ar"] { font-family: var(--wj-arabic); line-height: 1.6; }

/* ---------- reading progress line under the sticky header ---------- */
.wijdan-header .wijdan-read-bar {
  position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; max-width: none; margin: 0;
  background: var(--wp--preset--color--mint-ink); transform: scaleX(0); transform-origin: left center; pointer-events: none;
}
.wijdan-header .wijdan-read-bar.rtl { transform-origin: right center; }
.wijdan-header .wijdan-read-bar.done { opacity: .35; }

/* ---------- Deck: the small cover beside the title, the full cover after the text.
   body.wijdan-deck-ready is added by reading.js once it has moved the cover, so without
   JavaScript (or with the Read next block removed) the page keeps the standard layout. ---------- */
body.wijdan-deck-ready .wijdan-article .wijdan-head {
  grid-template-columns: 96px 1fr; gap: 8px 18px; align-items: center;
  padding: 26px 0 28px; border-bottom: 1px solid var(--wj-line); margin-bottom: 30px;
}
body.wijdan-deck-ready .wijdan-head .wijdan-byline--thumb { display: block; grid-row: 1 / span 3; grid-column: 1; }
body.wijdan-deck-ready .wijdan-head > :not(.wijdan-byline--thumb) { grid-column: 2; }
body.wijdan-deck-ready .wijdan-article .wijdan-title { font-size: clamp(26px, 6.6vw, 44px); }
body.wijdan-deck-ready .wijdan-article .wijdan-cover:not(.wijdan-cover--after) { display: none; }
body.wijdan-deck-ready .wijdan-article .wijdan-cover--after { margin: 44px 0 0; justify-content: center; }
body.wijdan-deck-ready .wijdan-article .wijdan-cover--after img { max-height: 520px; }

/* ---------- motion (none for readers who asked for less) ---------- */
@media (prefers-reduced-motion: no-preference) {
  .wijdan-header .wijdan-read-bar { transition: transform .12s linear, opacity .6s ease .4s; }
  .wijdan-article .wijdan-share__note { transition: opacity .25s; }
  .wijdan-article .wijdan-share .wp-block-button .wp-block-button__link { transition: color .2s, border-color .2s; }
}

/* ---------- desktop ---------- */
@media (min-width: 900px) {
  .wijdan-article .wijdan-back { margin-top: 32px; }
  .wijdan-article .wijdan-head { padding: 40px 0 28px; }
  .wijdan-article .wijdan-cover img { max-height: 480px; }
  body.wijdan-deck-ready .wijdan-article .wijdan-head { grid-template-columns: 170px 1fr; gap: 10px 32px; padding: 40px 0 34px; }
  body.wijdan-deck-ready .wijdan-article .wijdan-title { font-size: 46px; }

  /* Companion: the article and its side rail (the rail itself is styled by the read-next block) */
  body.has-wijdan-rail .wijdan-post-page {
    display: grid; grid-template-columns: minmax(0, 680px) 300px; gap: 64px; align-items: start;
    max-width: 1060px; margin-inline: auto; padding-inline: var(--wijdan-gutter);
  }
  body.has-wijdan-rail .wijdan-post-page > .wijdan-article { min-width: 0; padding-inline: 0; margin: 0; }
}
