/* Back navigation is only part of the app's mobile reading view. */
.manahel-pwa-blog-return { display: none; }

/* Manahel Blog PWA · editorial surfaces only.
   Shared app bar, dock, dialog and SW are provided by istikhara-pwa.
   Never affect desktop, Quran, Mafatih or the primary istikhara page. */
@media (max-width: 1024px) {
  body.manahel-istikhara-app-mode.manahel-istikhara-app-blog {
    box-sizing: border-box;
    padding-top: calc(4.6rem + env(safe-area-inset-top, 0px)) !important;
    padding-bottom: calc(6rem + env(safe-area-inset-bottom, 0px)) !important;
    background:
      radial-gradient(ellipse at 15% 5%, rgba(222,236,250,.75),transparent 36%),
      #f5f8fc !important;
    color: #233b55;
  }
  html:has(body.manahel-istikhara-app-mode.manahel-istikhara-app-blog) {
    scroll-padding-top: calc(5.35rem + env(safe-area-inset-top, 0px));
  }
  body.manahel-istikhara-app-mode.manahel-istikhara-app-blog main#wp--skip-link--target {
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 auto !important;
    padding: 0 0 1rem !important;
    min-width: 0;
  }
  body.manahel-istikhara-app-mode.manahel-istikhara-app-blog
    main#wp--skip-link--target > .wp-block-group {
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: none !important;
    padding: 0 !important;
    margin: 0 auto !important;
  }
  /* Images are central to editorial pages. Override the istikhara-only
     default that intentionally hides featured images in random results. */
  body.manahel-istikhara-app-mode.manahel-istikhara-app-blog
    main .wp-block-post-featured-image {
    display: block !important;
    max-width: 100%;
  }
  body.manahel-istikhara-app-mode.manahel-istikhara-app-blog
    main :is(img, video, iframe, table) {
    max-width: 100%;
  }
  body.manahel-istikhara-app-mode.manahel-istikhara-app-blog
    main :is(pre, .wp-block-table, .wp-block-embed, .wp-block-code) {
    max-width: 100%;
    overflow-x: auto;
  }

  /* Magazine home and category/tag archives retain their original H1,
     published excerpts, post ordering, pagination and links. */
  body.manahel-istikhara-app-mode.manahel-istikhara-app-blog-archive
    main#wp--skip-link--target {
    width: min(calc(100% - 18px), 48rem) !important;
  }
  body.manahel-istikhara-app-mode.manahel-istikhara-app-blog-archive
    main#wp--skip-link--target > .wp-block-group.alignwide:first-child {
    box-sizing: border-box;
    margin: .3rem auto 1rem !important;
    padding: 1.15rem 1rem !important;
    max-width: none !important;
    border: 1px solid #dbe5f1 !important;
    border-radius: 1.25rem !important;
    background: radial-gradient(circle at 94% 0%,#f4eadd,transparent 43%),#fff !important;
    box-shadow: 0 6px 24px rgba(20,64,127,.055);
    text-align: center;
  }
  body.manahel-istikhara-app-mode.manahel-istikhara-app-blog-archive
    main#wp--skip-link--target > .wp-block-group.alignwide:first-child :is(h1,p) {
    text-align: center !important;
    text-align-last: center !important;
    margin-inline: auto !important;
  }
  body.manahel-istikhara-app-mode.manahel-istikhara-app-blog-archive
    main#wp--skip-link--target > .wp-block-group.alignwide:first-child h1 {
    color: #123d71 !important;
    font-size: clamp(1.45rem,5.7vw,1.95rem) !important;
    line-height: 1.48 !important;
    margin-block: .3rem !important;
  }
  body.manahel-istikhara-app-mode.manahel-istikhara-app-blog-archive
    main#wp--skip-link--target > .wp-block-group.alignwide:first-child p {
    color: #54677c;
    font-size: .88rem !important;
    line-height: 1.85 !important;
  }
  body.manahel-istikhara-app-mode.manahel-istikhara-app-blog-archive
    main#wp--skip-link--target > .wp-block-group:not(.alignwide) {
    margin-top: .9rem !important;
    margin-bottom: .75rem !important;
    padding-inline: .25rem !important;
  }
  body.manahel-istikhara-app-mode.manahel-istikhara-app-blog-archive
    .wp-block-post-template {
    display: grid !important;
    grid-template-columns: minmax(0,1fr) !important;
    gap: .72rem !important;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
  }
  body.manahel-istikhara-app-mode.manahel-istikhara-app-blog-archive
    .wp-block-post-template > li {
    box-sizing: border-box;
    min-width: 0;
    margin: 0 !important;
    padding: 0 !important;
  }
  body.manahel-istikhara-app-mode.manahel-istikhara-app-blog-archive
    .wp-block-post-template > li > .wp-block-group {
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    min-width: 0;
    height: 100%;
    margin: 0 !important;
    padding: .75rem .8rem .85rem !important;
    gap: .42rem;
    border: 1px solid #dce6f1 !important;
    border-radius: 1.1rem !important;
    background: #fff !important;
    box-shadow: 0 4px 16px rgba(20,64,127,.055);
  }
  body.manahel-istikhara-app-mode.manahel-istikhara-app-blog-archive
    .wp-block-post-template .wp-block-post-featured-image {
    margin: 0 0 .35rem !important;
  }
  body.manahel-istikhara-app-mode.manahel-istikhara-app-blog-archive
    .wp-block-post-template .wp-block-post-featured-image img {
    display: block;
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: .8rem !important;
  }
  body.manahel-istikhara-app-mode.manahel-istikhara-app-blog-archive
    .wp-block-post-template .taxonomy-category {
    margin: .05rem 0 .15rem;
    font-size: .75rem !important;
    color: #6b7890 !important;
  }
  body.manahel-istikhara-app-mode.manahel-istikhara-app-blog-archive
    .wp-block-post-template .wp-block-post-title {
    margin: 0 !important;
    font-size: 1.04rem !important;
    font-weight: 900;
    line-height: 1.7 !important;
    text-align: right;
  }
  body.manahel-istikhara-app-mode.manahel-istikhara-app-blog-archive
    .wp-block-post-template .wp-block-post-title a {
    color: #13457e !important;
    text-decoration: none;
  }
  body.manahel-istikhara-app-mode.manahel-istikhara-app-blog-archive
    .wp-block-post-template .wp-block-post-excerpt,
  body.manahel-istikhara-app-mode.manahel-istikhara-app-blog-archive
    .wp-block-post-template .wp-block-post-excerpt p {
    margin: 0 !important;
    font-size: .86rem !important;
    line-height: 1.85 !important;
    color: #54677b !important;
    text-align: right !important;
  }
  body.manahel-istikhara-app-mode.manahel-istikhara-app-blog-archive
    .wp-block-post-template .wp-block-read-more {
    display: inline-flex;
    align-self: flex-start;
    align-items: center;
    min-height: 42px;
    margin-top: auto;
    padding: .4rem .82rem;
    background: #edf4fd;
    color: #14407f !important;
    border-radius: .7rem;
    font-weight: 850;
    text-decoration: none !important;
  }
  body.manahel-istikhara-app-mode.manahel-istikhara-app-blog-archive
    .wp-block-query-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    margin: 1rem 0;
    padding: .75rem .5rem;
    border-radius: .9rem;
    background: #fff;
    border: 1px solid #e0e7f1;
  }
  body.manahel-istikhara-app-mode.manahel-istikhara-app-blog-archive
    .wp-block-query-pagination a,
  body.manahel-istikhara-app-mode.manahel-istikhara-app-blog-archive
    .wp-block-query-pagination .page-numbers.current {
    min-width: 40px;
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: .55rem;
    padding-inline: .3rem;
    text-decoration: none;
  }
  body.manahel-istikhara-app-mode.manahel-istikhara-app-blog-archive
    .wp-block-query-pagination [aria-current="page"] {
    background: #14407f;
    color: #fff;
  }

  /* Reading mode: preserve original text, headings, tables, images, references,
     quotes, comments, author metadata and canonical. No content is hidden. */
  body.manahel-istikhara-app-mode.manahel-istikhara-app-blog-article
    main#wp--skip-link--target {
    width: min(calc(100% - 18px), 49rem) !important;
  }
  body.manahel-istikhara-app-mode.manahel-istikhara-app-blog-article
    main#wp--skip-link--target > .wp-block-group,
  body.manahel-istikhara-app-mode.manahel-istikhara-app-blog-article
    main#wp--skip-link--target > .wp-block-group.alignfull {
    box-sizing: border-box;
    width: 100% !important;
    max-width: 100% !important;
    padding: .85rem !important;
    margin: .45rem auto .8rem !important;
    border: 1px solid #dce6f0;
    background: #fff;
    border-radius: 1.05rem;
  }
  body.manahel-istikhara-app-mode.manahel-istikhara-app-blog-article
    main .wp-block-post-title {
    font-size: clamp(1.35rem,5.3vw,1.9rem) !important;
    font-weight: 850 !important;
    line-height: 1.75 !important;
    color: #123a6b !important;
    margin: .5rem 0 .75rem !important;
  }
  body.manahel-istikhara-app-mode.manahel-istikhara-app-blog-article
    main .wp-block-post-featured-image {
    margin: .6rem auto !important;
  }
  body.manahel-istikhara-app-mode.manahel-istikhara-app-blog-article
    main .wp-block-post-featured-image img {
    width: 100% !important;
    max-width: 100%;
    height: auto !important;
    border-radius: .8rem !important;
  }
  body.manahel-istikhara-app-mode.manahel-istikhara-app-blog-article .entry-content {
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    padding: 0 !important;
    overflow-wrap: anywhere;
    font-size: clamp(.94rem,3.65vw,1.05rem);
    line-height: 2.05;
  }
  body.manahel-istikhara-app-mode.manahel-istikhara-app-blog-article .entry-content :is(p,li,blockquote) {
    line-height: 2.05;
  }
  body.manahel-istikhara-app-mode.manahel-istikhara-app-blog-article
    .wp-block-breadcrumbs {
    overflow-wrap: anywhere;
    font-size: .79rem !important;
    line-height: 1.8;
  }
  .manahel-pwa-blog-return {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: .45rem .83rem;
    margin: .1rem 0 .7rem;
    background: #e8f1fb;
    border: 1px solid #cedeed;
    border-radius: .75rem;
    color: #14407f !important;
    font-size: .82rem;
    font-weight: 850;
    text-decoration: none !important;
  }
  body.manahel-istikhara-app-mode.manahel-istikhara-app-blog
    main a:focus-visible,
  body.manahel-istikhara-app-mode.manahel-istikhara-app-blog
    .manahel-pwa-blog-return:focus-visible {
    outline: 3px solid #b48b48;
    outline-offset: 3px;
  }
}
@media (min-width: 610px) and (max-width: 1024px) {
  body.manahel-istikhara-app-mode.manahel-istikhara-app-blog-archive .wp-block-post-template {
    grid-template-columns: repeat(2,minmax(0,1fr)) !important;
  }
}
@media (prefers-reduced-motion: reduce) {
  .manahel-pwa-blog-return { scroll-behavior: auto; }
}
