/* Manahel al-Huda: shared-PWA mobile app directory for page 17.
 * Desktop retains the original WordPress homepage and editorial H1.
 * Scoped design tokens and class names prevent collisions with Quran/readers.
 */
.manahel-pwa-home { display: none; }

@media (max-width: 1024px) {
  html:has(body.page-id-17.manahel-istikhara-app-mode) {
    background: #f4f7fb;
    overflow-x: clip;
  }
  body.page-id-17.manahel-istikhara-app-mode {
    padding-top: calc(4.35rem + env(safe-area-inset-top, 0px)) !important;
    padding-bottom: calc(5.75rem + env(safe-area-inset-bottom, 0px)) !important;
    background:
      radial-gradient(ellipse at 2% 8%, #e4edfa 0%, transparent 48%),
      radial-gradient(ellipse at 98% 56%, #eef2fb 0%, transparent 48%),
      #f4f7fb !important;
  }
  body.page-id-17 .wp-block-post-content > :not(.manahel-pwa-home) {
    display: none !important;
  }
  body.page-id-17 .wp-block-post-content {
    box-sizing: border-box !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  body.page-id-17.manahel-istikhara-app-mode .entry-content {
    box-sizing: border-box !important;
    width: min(calc(100% - 22px), 46rem) !important;
    max-width: 46rem !important;
    padding: 0 !important;
    margin: 0 auto !important;
  }
  body.page-id-17.manahel-istikhara-app-mode .wp-site-blocks,
  body.page-id-17.manahel-istikhara-app-mode .wp-site-blocks > main,
  body.page-id-17.manahel-istikhara-app-mode .wp-site-blocks > main > .wp-block-group {
    min-width: 0;
    max-width: none !important;
  }
  body.page-id-17.manahel-istikhara-app-mode .wp-site-blocks > main {
    padding: 0 !important;
    margin: 0 !important;
  }
  body.page-id-17.manahel-istikhara-app-mode .wp-block-post-title {
    display: none !important;
  }

  .manahel-pwa-home {
    --mh-ink: #16324f;
    --mh-deep: #10325d;
    --mh-soft: #64748b;
    display: block;
    position: relative;
    margin: 0 auto;
    width: 100%;
    padding: 0 0 1.1rem;
    box-sizing: border-box;
    direction: rtl;
    color: var(--mh-ink);
    font-family: var(--wp--preset--font-family--iransansx-fanum, inherit);
    isolation: isolate;
  }
  .manahel-pwa-home *,
  .manahel-pwa-home *::before,
  .manahel-pwa-home *::after { box-sizing: border-box; }
  .manahel-pwa-home :is(h2,h3,p) { margin: 0 !important; padding: 0; }
  .manahel-pwa-home a { text-decoration: none !important; }
  .manahel-pwa-home a:focus-visible,
  .manahel-pwa-home button:focus-visible { outline: 3px solid #b18d53; outline-offset: 3px; }
  .manahel-pwa-home svg { display: block; flex: 0 0 auto; }

  /* The opening brand identity is intentionally prominent before services. */
  .manahel-pwa-home__identity {
    position: relative;
    text-align: center;
    overflow: hidden;
    background:
      radial-gradient(circle at 95% 8%, rgba(233,204,149,.38), transparent 34%),
      radial-gradient(circle at 4% 100%, rgba(117,169,225,.17), transparent 48%),
      #fff;
    border: 1px solid #dae5f1;
    border-radius: 1.45rem;
    padding: 1.12rem .9rem 1.18rem;
    box-shadow: 0 8px 28px rgba(21,54,91,.055);
  }
  .manahel-pwa-home__identity::before,
  .manahel-pwa-home__identity::after {
    content: '';
    position: absolute;
    height: 104px;
    width: 104px;
    border: 1px solid rgba(191,162,99,.24);
    border-radius: 33px;
    transform: rotate(45deg);
    pointer-events: none;
  }
  .manahel-pwa-home__identity::before { top: -64px; left: -58px; }
  .manahel-pwa-home__identity::after { bottom: -69px; right: -62px; }
  .manahel-pwa-home__identity-glow {
    pointer-events: none;
    position: absolute;
    inset: 12px;
    border: 1px solid rgba(204,179,127,.12);
    border-radius: 1.1rem;
  }
  .manahel-pwa-home__logo {
    display: grid;
    place-items: center;
    margin: 0 auto .48rem;
    height: 64px;
    width: 64px;
    background: #fff;
    padding: 5px;
    border-radius: 20px;
    border: 1px solid #f1e6ca;
    box-shadow: 0 7px 20px rgba(16,50,93,.1);
  }
  .manahel-pwa-home__logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 14px;
  }
  .manahel-pwa-home__eyebrow {
    display: block;
    color: #8c713e;
    font-size: .73rem;
    letter-spacing: .005em;
    font-weight: 800;
  }
  .manahel-pwa-home__identity h2 {
    color: #113867;
    font-size: clamp(1.78rem, 7.5vw, 2.52rem);
    line-height: 1.42;
    font-weight: 950;
    letter-spacing: -.025em;
    margin: .1rem 0 .22rem !important;
  }
  .manahel-pwa-home__identity > p.manahel-pwa-home__slogan {
    display: block !important;
    box-sizing: border-box;
    width: min(100%, 34ch) !important;
    max-width: 100% !important;
    margin-right: auto !important;
    margin-left: auto !important;
    padding-inline: 0 !important;
    direction: rtl;
    text-align: center !important;
    text-align-last: center !important;
    font-size: clamp(.85rem, 3.3vw, 1.02rem) !important;
    line-height: 1.9 !important;
    font-weight: 750;
    color: #395779;
  }
  .manahel-pwa-home__identity-rule {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100px;
    height: 17px;
    margin: .34rem auto .35rem;
  }
  .manahel-pwa-home__identity-rule::before,
  .manahel-pwa-home__identity-rule::after {
    content: '';
    height: 1px;
    flex: 1;
    background: #d8c49e;
  }
  .manahel-pwa-home__identity-rule span {
    width: 7px;
    height: 7px;
    background: #b99555;
    margin: 0 7px;
    border-radius: 2px;
    transform: rotate(45deg);
  }
  .manahel-pwa-home__intro {
    font-size: .77rem !important;
    line-height: 1.8 !important;
    color: #667991;
  }

  /* Istikhara is the single unmistakable primary action. */
  .manahel-pwa-home__feature {
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    gap: .7rem;
    min-height: 194px;
    width: 100%;
    margin-top: .8rem;
    padding: 1.05rem 1.18rem 1.1rem;
    color: white !important;
    background: linear-gradient(115deg, #0e315a 0%, #194d87 58%, #24679e 100%);
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 1.32rem;
    box-shadow: 0 14px 31px rgba(17,58,109,.19);
    -webkit-tap-highlight-color: transparent;
  }
  .manahel-pwa-home__feature::before,
  .manahel-pwa-home__feature::after {
    content: '';
    position: absolute;
    pointer-events: none;
    border-radius: 50%;
  }
  .manahel-pwa-home__feature::before {
    width: 190px;
    height: 190px;
    top: -100px;
    left: -70px;
    border: 1px solid rgba(255,239,203,.2);
    box-shadow: 0 0 0 20px rgba(255,255,255,.025), 0 0 0 48px rgba(255,255,255,.025);
  }
  .manahel-pwa-home__feature::after {
    width: 230px;
    height: 230px;
    bottom: -175px;
    right: -55px;
    border: 1px solid rgba(255,255,255,.12);
    background: radial-gradient(circle,rgba(80,156,230,.22),transparent 72%);
  }
  .manahel-pwa-home__feature-top,
  .manahel-pwa-home__feature-bottom,
  .manahel-pwa-home__feature-copy { position: relative; z-index: 1; }
  .manahel-pwa-home__feature-top { display: flex; justify-content: space-between; align-items: flex-start; }
  .manahel-pwa-home__feature-badge {
    display: inline-flex;
    gap: .35rem;
    align-items: center;
    color: #fff4d9;
    border: 1px solid rgba(239,205,141,.4);
    background: rgba(230,186,106,.13);
    padding: .22rem .7rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 800;
  }
  .manahel-pwa-home__feature-badge > span { color: #f7d58d; }
  .manahel-pwa-home__feature-icon {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    color: #f4d8a0;
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.23);
    border-radius: 15px;
    box-shadow: 0 5px 14px rgba(0,0,0,.1);
  }
  .manahel-pwa-home__feature-icon svg { width: 28px; height: 28px; }
  .manahel-pwa-home__feature-copy { display: flex; flex-direction: column; gap: .17rem; text-align: right; }
  .manahel-pwa-home__feature-copy strong { color: #fff; font-size: clamp(1.65rem, 6.5vw, 2.1rem); font-weight: 900; line-height: 1.35; }
  .manahel-pwa-home__feature-copy > span { max-width: 36ch; color: #e2edfb; font-size: .89rem; line-height: 1.8; font-weight: 550; }
  .manahel-pwa-home__feature-bottom {
    display: flex;
    gap: .6rem;
    align-items: center;
    justify-content: space-between;
    color: #183f68;
    background: #fff;
    border-radius: .82rem;
    padding: .68rem .8rem;
    font-size: .9rem;
    line-height: 1.5;
    font-weight: 900;
    margin-top: .25rem;
  }
  .manahel-pwa-home__feature-arrow {
    display: grid;
    place-items: center;
    background: #e8f1fb;
    color: #174a80;
    border-radius: .57rem;
    width: 32px;
    height: 32px;
  }
  .manahel-pwa-home__feature-arrow svg { width: 19px; height: 19px; }

  .manahel-pwa-home__section-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem;
    padding: .15rem .2rem 0;
    margin: 1.25rem 0 .7rem;
  }
  .manahel-pwa-home__section-kicker { display: block; font-size: .7rem; font-weight: 750; color: #9b7b47; margin-bottom: .14rem; }
  .manahel-pwa-home__section-head h3 {
    font-size: clamp(1.15rem, 4.5vw, 1.45rem);
    font-weight: 950;
    line-height: 1.5;
    color: #123a67;
  }
  .manahel-pwa-home__section-mark { font-size: .7rem; color: #c7af82; letter-spacing: 2px; margin-bottom: .4rem; }

  /* Spacious native-app-style service tiles; always two columns on phones. */
  .manahel-pwa-home__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .7rem;
  }
  .manahel-pwa-home__card {
    --mh-accent: #215b9b;
    --mh-chip: #eaf2fc;
    display: flex;
    flex-direction: column;
    position: relative;
    align-items: flex-start;
    min-width: 0;
    min-height: 180px;
    gap: .42rem;
    padding: 1rem .85rem .78rem;
    border-radius: 1.16rem;
    border: 1px solid #e0e8f2;
    background: #fff;
    color: #163658 !important;
    box-shadow: 0 6px 16px rgba(18,57,96,.04);
    -webkit-tap-highlight-color: transparent;
  }
  .manahel-pwa-home__card-icon {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    margin-bottom: .18rem;
    flex: 0 0 auto;
    border-radius: 15px;
    background: var(--mh-chip);
    color: var(--mh-accent);
  }
  .manahel-pwa-home__card-icon svg { width: 25px; height: 25px; stroke-width: 1.65; }
  .manahel-pwa-home__card-icon img { width: 29px; height: 29px; object-fit: contain; border-radius: 6px; }
  .manahel-pwa-home__card strong {
    display: block;
    color: #16395c;
    font-size: clamp(.91rem, 3.5vw, 1.12rem);
    line-height: 1.55;
    font-weight: 900;
    text-align: right;
  }
  .manahel-pwa-home__card-description {
    display: block;
    min-height: 2.8em;
    color: #69798a;
    font-size: clamp(.72rem, 2.7vw, .81rem);
    line-height: 1.7;
    text-align: right;
  }
  .manahel-pwa-home__card-more {
    display: grid;
    place-items: center;
    position: absolute;
    bottom: .67rem;
    left: .72rem;
    width: 25px;
    height: 25px;
    border-radius: 8px;
    color: var(--mh-accent);
    background: var(--mh-chip);
  }
  .manahel-pwa-home__card-more svg { width: 16px; height: 16px; }
  .manahel-pwa-home__card--green { --mh-accent: #2f7765; --mh-chip: #e7f4ed; }
  .manahel-pwa-home__card--teal { --mh-accent: #207b7b; --mh-chip: #e4f5f4; }
  .manahel-pwa-home__card--amber { --mh-accent: #997031; --mh-chip: #fff4df; }
  .manahel-pwa-home__card--purple { --mh-accent: #6e5698; --mh-chip: #f1eafa; }
  .manahel-pwa-home__card--rose { --mh-accent: #a05873; --mh-chip: #fcecf2; }
  .manahel-pwa-home__card--slate { --mh-accent: #516d88; --mh-chip: #eaf0f6; }
  .manahel-pwa-home__card--channel { --mh-accent: #b17b25; --mh-chip: #fff6e8; }
  .manahel-pwa-home__card:active, .manahel-pwa-home__feature:active { transform: scale(.99); }
  @media (hover:hover) {
    .manahel-pwa-home__card, .manahel-pwa-home__feature { transition: transform .18s ease, box-shadow .18s ease; }
    .manahel-pwa-home__card:hover { transform: translateY(-2px); box-shadow: 0 9px 24px rgba(18,57,96,.10); }
    .manahel-pwa-home__feature:hover { transform: translateY(-2px); box-shadow: 0 18px 35px rgba(17,58,109,.26); }
  }

  .manahel-pwa-home__closing {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: .68rem .8rem;
    align-items: start;
    margin-top: 1rem;
    border: 1px solid #e8deca;
    background: linear-gradient(135deg, #fffdf8, #f9f5ec);
    border-radius: 1.1rem;
    padding: .98rem .93rem;
  }
  .manahel-pwa-home__closing-symbol {
    display: grid;
    place-items: center;
    width: 37px;
    height: 37px;
    background: #f3e7ce;
    border-radius: 12px;
    color: #9e7a3b;
    font-size: 19px;
  }
  .manahel-pwa-home__closing strong { display: block; font-size: .89rem; line-height: 1.6; color: #624d2d; }
  .manahel-pwa-home__closing p { font-size: .75rem !important; line-height: 1.85 !important; color: #736651; margin-top: .2rem !important; }
  .manahel-pwa-home__closing-actions { display: flex; gap: .48rem; grid-column: 1 / -1; }
  .manahel-pwa-home__closing-actions a,
  .manahel-pwa-home__closing-actions button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .3rem;
    flex: 1 1 0;
    min-width: 0;
    min-height: 44px;
    border-radius: .7rem;
    font-family: inherit;
    font-size: .78rem;
    font-weight: 850;
    line-height: 1.5;
    padding: .4rem .3rem;
    cursor: pointer;
  }
  .manahel-pwa-home__closing-actions a { color: #fff; background: #16477a; border: 1px solid #16477a; }
  .manahel-pwa-home__closing-actions button { color: #16477a; background: #fff; border: 1px solid #cad9e6; }
  .manahel-pwa-home__closing-actions button svg { height: 18px; width: 18px; }
  .manahel-pwa-home__closing-actions button small { font-size: inherit; font-weight: inherit; line-height: inherit; }
  .manahel-pwa-home__closing-actions button:disabled { opacity: .62; cursor: default; }
  .manahel-pwa-home__footnote { color: #8290a0; font-size: .72rem !important; text-align: center; margin: 1rem 0 0 !important; }

  /* The shared fixed dock sits above native OS navigation with safe-area room. */
  body.page-id-17.manahel-istikhara-app-mode .manahel-pwa-bottom-nav {
    z-index: 99980;
  }
}

@media (min-width: 630px) and (max-width: 1024px) {
  .manahel-pwa-home__grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .manahel-pwa-home__card { min-height: 180px; padding-inline: 1rem; }
  .manahel-pwa-home__identity { padding-block: 1.6rem; }
  .manahel-pwa-home__feature { min-height: 195px; }
}

@media (max-width: 359px) {
  body.page-id-17.manahel-istikhara-app-mode .entry-content {
    width: calc(100% - 14px) !important;
  }
  .manahel-pwa-home__identity { padding-inline: .55rem; }
  .manahel-pwa-home__card { min-height: 185px; padding-inline: .65rem; }
  .manahel-pwa-home__grid { gap: .46rem; }
  .manahel-pwa-home__card-description { font-size: .7rem; }
}


/* All home-page content remains in its card/section, but is centered within it.
   The app order, column structure, touch areas and overall card locations stay intact. */
@media (max-width: 1024px) {
  .manahel-pwa-home,
  .manahel-pwa-home__identity,
  .manahel-pwa-home__section-head,
  .manahel-pwa-home__feature,
  .manahel-pwa-home__card,
  .manahel-pwa-home__closing,
  .manahel-pwa-home__footnote { text-align: center !important; text-align-last: center !important; }

  .manahel-pwa-home__feature-top {
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: .7rem;
  }
  .manahel-pwa-home__feature-copy {
    align-items: center;
    text-align: center !important;
  }
  .manahel-pwa-home__feature-copy > span {
    margin-inline: auto;
    text-align: center !important;
  }
  .manahel-pwa-home__feature-bottom {
    justify-content: center;
    gap: .65rem;
    text-align: center !important;
  }
  .manahel-pwa-home__section-head {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
  }
  .manahel-pwa-home__section-head > div,
  .manahel-pwa-home__section-kicker { text-align: center !important; width: 100%; }
  .manahel-pwa-home__section-mark { margin: 0 auto .12rem; }
  .manahel-pwa-home__card {
    align-items: center;
    padding-bottom: 2.85rem;
  }
  .manahel-pwa-home__card-icon { margin-inline: auto; }
  .manahel-pwa-home__card strong,
  .manahel-pwa-home__card-description {
    width: 100%;
    text-align: center !important;
    text-align-last: center !important;
  }
  .manahel-pwa-home__card-more {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
  }
  .manahel-pwa-home__closing {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    align-items: center;
  }
  .manahel-pwa-home__closing-symbol { margin-inline: auto; }
  .manahel-pwa-home__closing > div:not(.manahel-pwa-home__closing-actions),
  .manahel-pwa-home__closing strong,
  .manahel-pwa-home__closing p { text-align: center !important; }
  .manahel-pwa-home__closing-actions {
    grid-column: 1;
    width: 100%;
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .manahel-pwa-home__card, .manahel-pwa-home__feature { transition: none !important; }
}
