/* The owner's wudu step pictures on the Wudu guide (/learn/how-to-make-wudu, Views/Purification/_WuduStepFigure.cshtml):
   one square frame style everywhere (the step-by-step player, the gallery and the reference card), the Women/Men
   switch above the learning modes, and the Right/Left switch of the arms and feet. The frames have a fixed shape,
   so nothing moves while pictures load or change. */

.pw-wudu {
    --wf-deep: #0d3b29;
    --wf-ring: rgba(13, 59, 41, .1);
    --wf-shadow: 0 22px 44px -28px rgba(13, 59, 41, .6), 0 4px 10px -6px rgba(13, 59, 41, .25);
}
:root[data-theme="dark"] .pw-wudu, body.dark .pw-wudu { --wf-ring: rgba(255, 255, 255, .1); --wf-shadow: 0 22px 44px -26px rgba(0, 0, 0, .8); }

/* ---- the frame ---- */
.wf {
    position: relative; width: 100%; aspect-ratio: 1 / 1; border-radius: 24px; overflow: hidden; isolation: isolate;
    background: radial-gradient(120% 90% at 50% 0%, var(--pw-water-pale, #e2f4f1), var(--pw-bg, #edf7f2) 72%);
    box-shadow: var(--wf-shadow), 0 0 0 1px var(--wf-ring);
}
.wf::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .55); pointer-events: none; z-index: 1; }
.wf picture:has(> .wf-pic) { position: absolute; inset: 0; }
.wf-pic { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }

/* One figure at a time: the reader's own until they choose (wudu-figures.js remembers the choice). */
.pw-wudu[data-figure="male"] .wf-pic-female, .pw-wudu[data-figure="male"] .wf picture:has(> .wf-pic-female),
.pw-wudu[data-figure="female"] .wf-pic-male, .pw-wudu[data-figure="female"] .wf picture:has(> .wf-pic-male) { display: none; }

/* The arms and feet: right and left share the frame and cross-fade. */
.wf-pic-right, .wf-pic-left { transition: opacity .45s var(--ip-ease), transform .6s var(--ip-ease); }
.wf[data-side-view="0"] .wf-pic-left, .wf[data-side-view="1"] .wf-pic-right { opacity: 0; transform: scale(1.025); pointer-events: none; }
.wf-sides {
    position: absolute; z-index: 2; inset-block-end: .6rem; inset-inline-start: 50%; transform: translateX(-50%); display: inline-flex; gap: 2px; padding: 3px;
    border-radius: 999px; background: rgba(255, 255, 255, .85); border: 1px solid rgba(13, 59, 41, .12); box-shadow: 0 8px 20px -12px rgba(13, 59, 41, .65);
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
[dir="rtl"] .wf-sides { transform: translateX(50%); }
.wf-side {
    min-height: 32px; min-width: 44px; padding: .2rem .8rem; border: 0; border-radius: 999px; background: transparent; color: var(--wf-deep);
    font: inherit; font-weight: 800; font-size: .78rem; cursor: pointer; transition: background .2s, color .2s;
}
.wf-side[aria-pressed="true"] { background: var(--wf-deep); color: #fff; }
.wf-side:hover:not([aria-pressed="true"]) { background: rgba(13, 59, 41, .08); }
.wf-side:focus-visible { outline: 3px solid var(--ip-focus, #1f7a63); outline-offset: 1px; }

/* ---- the step-by-step player ---- */
.pw-slide-art.pw-slide-art-photo { padding: 0; background: none; max-width: 380px; border-radius: 24px; }
@media (min-width: 768px) { .pw-wudu .pw-slide:has(.pw-slide-art-photo) { grid-template-columns: minmax(260px, 380px) 1fr; } }
@media (max-width: 575px) { .pw-slide-art.pw-slide-art-photo { max-width: 320px; } }
.pw-slide-art-photo .wf { border-radius: 24px; }
.pw-slide-art-photo.is-replay .wf-pic { animation: wf-pop .6s var(--ip-ease); }
@keyframes wf-pop { from { transform: scale(1.04); filter: saturate(.8); } to { transform: none; filter: none; } }

/* ---- the gallery ---- */
.pw-tile .wf-tile { max-width: 220px; border-radius: 18px; margin-top: 1.4rem; }
.pw-tile .wf-tile .wf-side { min-height: 30px; padding: .15rem .65rem; font-size: .74rem; }
.pw-tile:has(.wf-tile) .pw-tile-num { z-index: 3; box-shadow: 0 6px 14px -8px rgba(0, 0, 0, .55); }
/* Phones: two pictures a row, so the whole wudu fits in a few swipes. */
@media (max-width: 575px) {
    .pw-wudu .pw-gallery:has(.wf-tile) { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
    .pw-wudu .pw-tile:has(.wf-tile) { padding: .55rem .55rem .7rem; }
    .pw-tile .wf-tile { margin-top: 0; border-radius: 14px; }
    .pw-tile:has(.wf-tile) .pw-tile-num { top: .9rem; inset-inline-start: .9rem; width: 26px; height: 26px; font-size: .78rem; }
    .pw-tile:has(.wf-tile) .pw-tile-title { font-size: .9rem; }
    .pw-tile:has(.wf-tile) .pw-tile-sub { font-size: .78rem; }
    .pw-tile .wf-tile .wf-side { min-height: 28px; min-width: 40px; padding: .1rem .5rem; font-size: .7rem; }
}

/* ---- the reference card ---- */
.wf-quick { width: 56px; flex: 0 0 56px; border-radius: 14px; box-shadow: 0 6px 14px -10px rgba(13, 59, 41, .6), 0 0 0 1px var(--wf-ring); }
.wf-quick::after { box-shadow: none; }

/* ---- Women / Men ---- */
.wf-switch { display: inline-flex; align-items: center; flex-wrap: wrap; gap: .5rem .75rem; margin-top: .9rem; }
.wf-switch-label { display: inline-flex; align-items: center; gap: .4rem; font-weight: 700; font-size: .88rem; color: var(--ip-muted); }
.wf-switch-group { display: inline-flex; padding: 4px; gap: 4px; border-radius: 999px; background: var(--ip-surface); border: 1px solid var(--ip-line); box-shadow: var(--ip-shadow-sm); }
.wf-gender {
    display: inline-flex; align-items: center; gap: .4rem; min-height: 40px; padding: .3rem 1rem; border: 0; border-radius: 999px; background: transparent;
    color: var(--ip-ink-2); font: inherit; font-weight: 800; font-size: .9rem; cursor: pointer; transition: background .2s, color .2s, box-shadow .2s;
}
.wf-gender[aria-pressed="true"] { background: linear-gradient(135deg, var(--ip-primary), var(--wf-deep)); color: #fff; box-shadow: 0 8px 18px -10px rgba(13, 59, 41, .8); }
.wf-gender:hover:not([aria-pressed="true"]) { background: var(--ip-surface-2); }
.wf-gender:focus-visible { outline: 3px solid var(--ip-focus, #1f7a63); outline-offset: 2px; }

/* Arabic and Urdu: no letter-spacing, room for the script. */
html[lang="ur"] :is(.wf-gender, .wf-side) { line-height: 1.9; }

@media print {
    .wf-sides, .wf-switch { display: none !important; }
    .wf { box-shadow: none; }
}

@media (prefers-reduced-motion: reduce) {
    .wf-pic-right, .wf-pic-left, .wf-side, .wf-gender { transition: none; }
    .pw-slide-art-photo.is-replay .wf-pic { animation: none; }
}

/* ---- the finish screen: the guide's closing words (order, continuity, the remembrance afterwards) ---- */
.pw-done-closing {
    max-width: 620px; margin: 1.1rem auto 1.25rem; padding: 1rem 1.15rem; border-radius: var(--ip-radius-lg); text-align: start;
    background: var(--ip-surface-2); border: 1px solid var(--ip-line);
}
.pw-done-closing .pw-h3 { margin: 0 0 .35rem; }
.pw-done-closing .pw-rich > :last-child { margin-bottom: 0; }
