/* Step-by-step A4 posters (/printables/{slug}): ghusl, tayammum, sajdah sahw and the Eid prayer. Standalone (no site layout). */
@page {
  size: A4 portrait;
  margin: 0;
}

* {
  box-sizing: border-box;
}

body.sp {
  --sp-ink: #1d4b40;
  --sp-accent: #1f7a63;
  --sp-soft: #e4f1ec;
  --sp-paper: #fbfdfc;
  --sp-glow: rgba(31, 122, 99, .16);
  --sp-must: #1f7a63;
  --sp-must-soft: #e6f3ee;
  --sp-watch: #a7741d;
  --sp-watch-soft: #fbf1dc;
  --sp-stop: #b03a4a;
  --sp-stop-soft: #fbe9ec;
  margin: 0;
  background: #e6e2d8;
  color: #17221e;
  font-family: "Inter", system-ui, sans-serif;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

body.sp--water {
  --sp-ink: #0e4558;
  --sp-accent: #1f86ad;
  --sp-soft: #e2f2f8;
  --sp-paper: #fafdfe;
  --sp-glow: rgba(42, 155, 196, .18);
}

body.sp--earth {
  --sp-ink: #5b3a16;
  --sp-accent: #b07a35;
  --sp-soft: #f6ead6;
  --sp-paper: #fffcf6;
  --sp-glow: rgba(201, 154, 91, .22);
}

body.sp--night {
  --sp-ink: #27265f;
  --sp-accent: #5b54c0;
  --sp-soft: #ebeafb;
  --sp-paper: #fcfcff;
  --sp-glow: rgba(91, 84, 192, .16);
}

body.sp--gold {
  --sp-ink: #553a0a;
  --sp-accent: #b5862c;
  --sp-soft: #f8edd3;
  --sp-paper: #fffcf4;
  --sp-glow: rgba(201, 160, 80, .22);
}

/* ---- The tools above the sheet (never printed) ---- */
.sp-tools {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: .6rem;
  padding: 1rem;
}

.sp-btn,
.sp-switch a {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .55rem 1.15rem;
  border-radius: 999px;
  border: 0;
  background: #1f7a63;
  color: #fff;
  font: 600 .92rem "Inter", sans-serif;
  text-decoration: none;
  cursor: pointer;
}

.sp-btn--ghost {
  background: transparent;
  border: 1px solid #1f7a63;
  color: #16624f;
}

.sp-switch {
  display: inline-flex;
  padding: .2rem;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #cfd8d3;
}

.sp-switch a {
  background: transparent;
  color: #3b4a44;
  padding: .4rem .9rem;
}

.sp-switch a[aria-current="true"] {
  background: #1f7a63;
  color: #fff;
}

/* ---- The sheet: one A4 page ---- */
.sp-sheet {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4.2mm;
  width: 210mm;
  height: 297mm;
  margin: 0 auto 2rem;
  padding: 11mm 11mm 8mm;
  overflow: hidden;
  background:
    radial-gradient(130mm 70mm at 100% 0%, var(--sp-glow), transparent 70%),
    radial-gradient(90mm 60mm at 0% 100%, var(--sp-glow), transparent 70%),
    var(--sp-paper);
  box-shadow: 0 20px 50px -20px rgba(0, 0, 0, .35);
}

.sp-sheet::before {
  content: "";
  position: absolute;
  inset: 5mm;
  border: .5mm solid var(--sp-accent);
  border-radius: 5mm;
  opacity: .35;
  pointer-events: none;
}

/* ---- The heading: English first, the Arabic word beside it ---- */
.sp-head {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 6mm;
  padding-bottom: 3.5mm;
  border-bottom: .35mm dashed color-mix(in srgb, var(--sp-accent) 45%, transparent);
}

.sp-eyebrow {
  margin: 0 0 1.2mm;
  color: var(--sp-accent);
  font-size: 7.6pt;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.sp-title {
  margin: 0;
  color: var(--sp-ink);
  font: 700 25pt/1.04 "Fraunces", Georgia, serif;
  letter-spacing: -.01em;
}

.sp-term {
  display: inline-block;
  margin: 2mm 0 0;
  padding: .8mm 3.2mm;
  border-radius: 999px;
  background: var(--sp-accent);
  color: #fff;
  font-size: 12pt;
  font-weight: 700;
  letter-spacing: .02em;
}

.sp-lead {
  margin: 2.2mm 0 0;
  max-width: 128mm;
  color: #3a4842;
  font-size: 10pt;
  line-height: 1.4;
}

.sp-arabic {
  margin: 0;
  min-width: 44mm;
  padding: 2mm 5mm 4mm;
  border-radius: 6mm;
  background: var(--sp-soft);
  color: var(--sp-ink);
  font: 700 30pt/1.5 "Amiri", serif;
  text-align: center;
}

/* ---- Small headings ---- */
.sp-label {
  display: flex;
  align-items: center;
  gap: 2.5mm;
  margin: 0 0 2mm;
  color: var(--sp-ink);
  font-size: 8.4pt;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.sp-label::after {
  content: "";
  flex: 1;
  height: .3mm;
  background: color-mix(in srgb, var(--sp-accent) 35%, transparent);
}

/* ---- "When" chips ---- */
.sp-facts ul {
  display: flex;
  flex-wrap: wrap;
  gap: 1.8mm;
  margin: 0;
  padding: 0;
  list-style: none;
}

.sp-facts li {
  display: flex;
  align-items: center;
  gap: 1.6mm;
  padding: 1.4mm 3mm;
  border-radius: 999px;
  background: #fff;
  border: .3mm solid color-mix(in srgb, var(--sp-accent) 40%, transparent);
  color: #26332e;
  font-size: 8.4pt;
  font-weight: 500;
}

.sp-facts li::before {
  content: "";
  width: 2mm;
  height: 2mm;
  border-radius: 50%;
  background: var(--sp-accent);
  flex: none;
}

/* ---- "What did you miss?" chart ---- */
.sp-decide ul {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2mm;
  margin: 0;
  padding: 0;
  list-style: none;
}

.sp-decide__row {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1.4mm;
  padding: 2mm 3mm 2.4mm;
  border-radius: 3mm;
  background: #fff;
  border-left: 1.6mm solid var(--tone);
  font-size: 8.6pt;
}

.sp-decide__row--fix {
  --tone: var(--sp-must);
  --tone-soft: var(--sp-must-soft);
}

.sp-decide__row--stop {
  --tone: var(--sp-stop);
  --tone-soft: var(--sp-stop-soft);
}

.sp-decide__row--fine {
  --tone: #6b7f78;
  --tone-soft: #eef2f0;
}

.sp-decide__missed b {
  display: block;
  color: #1d2924;
  font-size: 9.2pt;
}

.sp-decide__missed small {
  color: #5a6862;
  font-size: 7.8pt;
}

.sp-decide__row > .bi {
  display: none;
}

.sp-decide__fix {
  align-self: flex-start;
  padding: 1.2mm 2.6mm;
  border-radius: 2.4mm;
  background: var(--tone-soft);
  color: var(--tone);
  font-weight: 700;
  line-height: 1.25;
}

/* ---- The steps ---- */
.sp-steps {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.sp-lane {
  margin: 1mm 0 1.6mm;
  color: var(--sp-accent);
  font-size: 9pt;
  font-weight: 700;
}

.sp-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(var(--cols), 1fr);
  grid-auto-rows: minmax(0, 1fr);
  gap: 2.6mm;
  margin: 0 0 2mm;
  padding: 0;
  list-style: none;
}

.sp-step {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2.4mm 2.4mm 2.6mm;
  border-radius: 4mm;
  background: #fff;
  border: .3mm solid color-mix(in srgb, var(--sp-accent) 25%, transparent);
  box-shadow: 0 1.2mm 3mm -2mm rgba(20, 40, 30, .25);
  text-align: center;
  min-height: 0;
  overflow: hidden;
}

.sp-step__num {
  position: absolute;
  top: 2mm;
  left: 2mm;
  display: grid;
  place-items: center;
  width: 7mm;
  height: 7mm;
  border-radius: 50%;
  background: var(--sp-accent);
  color: #fff;
  font: 700 11pt "Fraunces", Georgia, serif;
  z-index: 1;
}

.sp-step__pic {
  position: relative;
  flex: 1 1 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 0;
  margin: 0 0 1.2mm;
}

.sp-step__pic img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.sp-step--art .sp-step__pic img {
  width: 30mm;
  height: 100%;
  max-height: 30mm;
}

.sp-step--posture .sp-step__pic {
  border-radius: 3mm;
}

.sp-step--posture .sp-step__pic img {
  height: 100%;
  width: auto;
}

.sp-step__pic img.is-mirrored {
  transform: scaleX(-1);
}

.sp-step__repeat {
  position: absolute;
  right: 1mm;
  bottom: 1mm;
  padding: .6mm 2.2mm;
  border-radius: 999px;
  background: var(--sp-ink);
  color: #fff;
  font: 700 11pt "Fraunces", Georgia, serif;
}

.sp-badge {
  position: absolute;
  top: 2.4mm;
  right: 2mm;
  z-index: 1;
  padding: .4mm 2.2mm;
  border-radius: 999px;
  font-size: 6.6pt;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.sp-badge--fard {
  background: var(--sp-must-soft);
  color: var(--sp-must);
}

.sp-badge--wajib {
  background: var(--sp-watch-soft);
  color: var(--sp-watch);
}

.sp-badge--sunnah {
  background: #eef1f6;
  color: #4b5a72;
}

/* The same height in every card of a row, so the pictures and the titles line up. */
.sp-step__words {
  flex: none;
  min-height: 17mm;
}

.sp-step__title {
  margin: 0;
  color: var(--sp-ink);
  font-size: 10pt;
  font-weight: 700;
  line-height: 1.2;
}

.sp-step__term {
  margin: .4mm 0 0;
  color: var(--sp-accent);
  font-size: 8.4pt;
  font-style: italic;
  font-weight: 600;
}

.sp-step__text {
  margin: .9mm 0 0;
  color: #3a4842;
  font-size: 8.2pt;
  line-height: 1.32;
}

.sp-saw {
  font-family: "Amiri", serif;
  font-size: 1.15em;
  line-height: 1;
}

.sp-step--done {
  justify-content: center;
  gap: 2.5mm;
  background: var(--sp-accent);
  border-color: var(--sp-accent);
  color: #fff;
}

.sp-done__mark {
  display: grid;
  place-items: center;
  width: 16mm;
  height: 16mm;
  border-radius: 50%;
  background: rgba(255, 255, 255, .18);
  border: .5mm solid rgba(255, 255, 255, .6);
  font-size: 26pt;
}

.sp-done__text {
  margin: 0;
  font: 700 11.5pt/1.3 "Fraunces", Georgia, serif;
}

/* ---- The panels at the foot ---- */
.sp-boxes {
  display: grid;
  grid-template-columns: repeat(var(--boxes), 1fr);
  gap: 2.6mm;
}

.sp-box {
  padding: 2.6mm 3.2mm 3mm;
  border-radius: 4mm;
  background: var(--tone-soft);
  border-top: 1.2mm solid var(--tone);
}

.sp-box--must {
  --tone: var(--sp-must);
  --tone-soft: var(--sp-must-soft);
}

.sp-box--watch {
  --tone: var(--sp-watch);
  --tone-soft: var(--sp-watch-soft);
}

.sp-box--stop {
  --tone: var(--sp-stop);
  --tone-soft: var(--sp-stop-soft);
}

.sp-box__title {
  display: flex;
  align-items: center;
  gap: 1.6mm;
  margin: 0 0 1.6mm;
  color: var(--tone);
  font-size: 10pt;
  font-weight: 700;
}

.sp-box__term {
  font-weight: 600;
  font-style: italic;
}

.sp-box ul {
  display: grid;
  gap: 1.2mm;
  margin: 0;
  padding: 0;
  list-style: none;
}

.sp-box li {
  position: relative;
  padding-left: 3.4mm;
  color: #2c3833;
  font-size: 8.2pt;
  line-height: 1.32;
}

.sp-box li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 1.5mm;
  width: 1.5mm;
  height: 1.5mm;
  border-radius: 50%;
  background: var(--tone);
}

/* A single panel spreads its points over two columns. */
.sp-boxes--one .sp-box ul {
  grid-template-columns: 1fr 1fr;
  column-gap: 6mm;
}

.sp-box li.has-art {
  display: grid;
  grid-template-columns: 9mm 1fr;
  align-items: center;
  gap: 2mm;
  padding-left: 0;
}

.sp-box li.has-art::before {
  display: none;
}

.sp-box li.has-art img {
  width: 9mm;
  height: 9mm;
}

.sp-note {
  margin: 0;
  color: #4a5852;
  font-size: 8.4pt;
  text-align: center;
}

.sp-note .bi {
  color: var(--sp-accent);
}

/* ---- The foot: logo and where to learn more ---- */
.sp-foot {
  display: flex;
  align-items: center;
  gap: 2.4mm;
  padding-top: 2.4mm;
  border-top: .3mm solid color-mix(in srgb, var(--sp-accent) 30%, transparent);
  color: #4a5852;
  font-size: 8pt;
}

.sp-foot img {
  width: 7mm;
  height: 7mm;
  object-fit: contain;
}

.sp-foot__name {
  color: var(--sp-ink);
  font: 700 10pt "Fraunces", Georgia, serif;
}

.sp-foot__more {
  margin-left: auto;
}

.sp-foot__more b {
  color: var(--sp-ink);
}

/* ---- On a smaller screen, the whole sheet scales down to fit ---- */
@media screen and (max-width: 840px) {
  .sp-sheet {
    zoom: .86;
  }
}

@media screen and (max-width: 720px) {
  .sp-sheet {
    zoom: .72;
  }
}

@media screen and (max-width: 600px) {
  .sp-sheet {
    zoom: .58;
  }
}

@media screen and (max-width: 480px) {
  .sp-sheet {
    zoom: .46;
  }
}

@media screen and (max-width: 390px) {
  .sp-sheet {
    zoom: .42;
  }
}

@media print {
  body.sp {
    background: #fff;
  }

  .sp-tools {
    display: none;
  }

  .sp-sheet {
    margin: 0;
    box-shadow: none;
  }
}
