/* ==========================================================================
   Homepage donation simulation — "من البيت إلى المدرسة"
   Self-contained, fully namespaced under .afsim so generic class names
   (.panel/.icon/.actions/.figure/.window/.stage…) never collide with the
   theme or Bootstrap. Palette tokens live on .afsim (NOT :root) so they
   only cascade inside the section.
   ========================================================================== */

.afsim {
  --ink: #14201d;
  --muted: #62706b;
  --line: #d9e2dc;
  --paper: #fbfcf8;
  --mist: #eef6f0;
  --green: #18705b;
  --green-dark: #0e4f43;
  --mint: #59b88b;
  --gold: #d89b2b;
  --coral: #d9654c;
  --blue: #397da7;
  --violet: #775ca8;
  --white: #ffffff;
  --shadow: 0 18px 50px rgba(20, 32, 29, 0.12);
  color: var(--ink);
}

.afsim-section {
  /* Background comes from the .section-islamic class (green + najmah pattern). */
  padding: clamp(40px, 6vw, 72px) 0;
}
/* keep the simulation content above the .section-islamic ::before pattern */
.afsim { position: relative; z-index: 1; }

.afsim *,
.afsim *::before,
.afsim *::after { box-sizing: border-box; }

.afsim button,
.afsim input { font: inherit; }

.afsim .app {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 0;
}

.afsim .topbar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
  padding: 0 0 18px;
}

.afsim-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid rgba(24, 112, 91, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--green-dark);
  font-weight: 700;
  white-space: nowrap;
}

.afsim-badge svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.afsim .experience {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(320px, 0.88fr);
  gap: 22px;
  align-items: stretch;
}

.afsim .stage {
  position: relative;
  min-height: 600px;
  overflow: hidden;
  border: 1px solid rgba(24, 112, 91, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.64), rgba(255,255,255,0.18)),
    linear-gradient(180deg, #cae8ef 0%, #edf6ef 44%, #d9ead8 100%);
  box-shadow: var(--shadow);
  isolation: isolate;
}

.afsim .stage-copy {
  position: relative;
  z-index: 4;
  width: min(560px, calc(100% - 32px));
  padding: 34px 32px 0 0;
}

.afsim .afsim-title {
  margin: 0;
  max-width: 16ch;
  font-size: clamp(1.75rem, 4.2vw, 3.7rem);
  line-height: 1.05;
  color: var(--green-dark);
}

.afsim .lede {
  margin: 16px 0 0;
  max-width: 46ch;
  color: #314540;
  font-size: clamp(1rem, 1.55vw, 1.25rem);
  line-height: 1.85;
}

.afsim .impact-line {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  margin-top: 20px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(255,255,255,0.82);
  color: var(--green-dark);
  font-weight: 800;
  box-shadow: 0 8px 22px rgba(20, 32, 29, 0.09);
}

.afsim .impact-line svg {
  width: 20px; height: 20px;
  fill: none; stroke: var(--gold);
  stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round;
}

.afsim .sun {
  position: absolute; top: 72px; left: 62px;
  width: 122px; height: 122px; border-radius: 50%;
  background: #f5c85f;
  box-shadow: 0 0 0 18px rgba(245, 200, 95, 0.14), 0 0 70px rgba(245, 200, 95, 0.62);
  opacity: calc(0.52 + var(--progress, 0) * 0.45);
  transition: opacity 350ms ease;
}

.afsim .sky-path {
  position: absolute; left: -90px; right: -90px; bottom: 178px;
  height: 165px; background: rgba(255, 255, 255, 0.38);
  border-radius: 50% 50% 0 0; transform: rotate(-2deg);
}

/* Light path: a single overlay spanning the whole stage so the beam flows
   from the sun (upper area) down toward the neighborhood. Sits BEHIND the
   buildings (z-index 1) and behind the copy, so nothing floats or overlaps. */
.afsim .light-stream {
  position: absolute; z-index: 1; inset: 0; pointer-events: none;
}

.afsim .light-stream svg { width: 100%; height: 100%; overflow: visible; }

.afsim .beam {
  fill: none; stroke: var(--gold); stroke-width: 4;
  stroke-linecap: round; stroke-dasharray: 10 16;
  opacity: calc(0.18 + var(--progress, 0) * 0.5);
  animation: afsim-dash 1.8s linear infinite;
  filter: drop-shadow(0 0 7px rgba(216, 155, 43, 0.4));
}

@keyframes afsim-dash { to { stroke-dashoffset: -56; } }

.afsim .neighborhood {
  position: absolute; z-index: 2; right: 0; left: 0; bottom: 0; height: 360px;
}

.afsim .ground {
  position: absolute; inset: auto -4% 0; height: 190px;
  background: linear-gradient(180deg, #b8d7ab 0%, #83b274 100%);
  border-radius: 52% 48% 0 0 / 24% 24% 0 0;
}

/* Horizontal street running the full width — from the first building to the
   last — with a dashed lane line across it. */
.afsim .road {
  position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 100px;
  background: linear-gradient(180deg, #97a8a2 0%, #74897f 100%);
  opacity: 0.95;
}

.afsim .road::before {
  content: ""; position: absolute; left: 5%; right: 5%; top: calc(50% - 2px);
  height: 4px;
  background: repeating-linear-gradient(90deg, rgba(255,255,255,0.82) 0 24px, transparent 24px 44px);
}

.afsim .building {
  position: absolute; bottom: 124px; width: 118px;
  border: 2px solid rgba(20, 32, 29, 0.16);
  border-radius: 8px 8px 3px 3px;
  background: rgba(255,255,255,0.82);
  box-shadow: 0 18px 32px rgba(20, 32, 29, 0.12);
}

.afsim .building::after {
  content: ""; position: absolute; inset: auto 38px -2px; height: 42px;
  border-radius: 6px 6px 0 0; background: #61766f;
}

.afsim .building.home { right: 8%; height: 138px; background: #fff7df; }
.afsim .building.market { right: 36%; height: 132px; width: 142px; background: #fff5e8; }
.afsim .building.school { right: 65%; height: 170px; width: 150px; background: #f5fbff; }

.afsim .roof {
  position: absolute; right: -12px; left: -12px; top: -36px; height: 46px;
  clip-path: polygon(50% 0, 100% 100%, 0 100%); background: #b84f42;
}

.afsim .market .roof {
  top: -24px; height: 34px; clip-path: none; border-radius: 8px 8px 0 0;
  background: repeating-linear-gradient(90deg, var(--coral) 0 18px, #fff3e3 18px 36px);
  border: 2px solid rgba(20, 32, 29, 0.12);
}

.afsim .school .roof {
  top: -27px; height: 30px; clip-path: none; border-radius: 8px 8px 0 0; background: var(--blue);
}

.afsim .windows {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; padding: 28px 18px 0;
}
.afsim .school .windows { grid-template-columns: repeat(3, 1fr); padding-top: 20px; }
.afsim .market .windows { grid-template-columns: repeat(3, 1fr); gap: 9px; padding-top: 21px; }
.afsim .home .windows { padding-top: 14px; }

.afsim .window {
  height: 28px; border-radius: 5px; background: #6f8682;
  border: 1px solid rgba(20, 32, 29, 0.14); transition: 350ms ease;
}
.afsim .window.on { background: #ffd668; box-shadow: 0 0 18px rgba(255, 214, 104, 0.86); }

.afsim .sign {
  position: absolute; right: 14px; left: 14px; bottom: 48px;
  display: grid; place-items: center; min-height: 28px; border-radius: 5px;
  background: rgba(24, 112, 91, 0.9); color: white; font-size: 0.82rem; font-weight: 800;
}
.afsim .market .sign { background: rgba(216, 155, 43, 0.96); color: #3f2b0c; }

.afsim .tree {
  position: absolute; bottom: 118px; width: 20px; height: 74px;
  border-radius: 12px; background: #78563f;
}
.afsim .tree::before {
  content: ""; position: absolute; right: -27px; top: -52px; width: 76px; height: 76px;
  border-radius: 50%; background: #3b9869;
  box-shadow: 18px 18px 0 #2d7f5b, -12px 18px 0 #59b88b;
}
.afsim .tree.one { right: 31%; }
.afsim .tree.two { right: 93%; transform: scale(0.86); }

.afsim .figure {
  position: absolute; z-index: 3;
  right: calc(12% + var(--progress, 0) * 60%); bottom: 26px;
  width: 34px; height: 72px; transition: right 420ms ease;
}
.afsim .figure::before {
  content: ""; position: absolute; right: 6px; top: 0; width: 22px; height: 22px;
  border-radius: 50%; background: #7d5945;
}
.afsim .figure::after {
  content: ""; position: absolute; right: 2px; top: 25px; width: 30px; height: 42px;
  border-radius: 14px 14px 6px 6px; background: var(--violet); box-shadow: 0 7px 0 #314540;
}

.afsim .bag {
  position: absolute; right: -12px; top: 33px; width: 17px; height: 24px;
  border-radius: 5px; background: var(--gold);
  opacity: calc(0.25 + var(--education-progress, 0) * 0.75); transition: opacity 350ms ease;
}

.afsim .stars { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.afsim .star {
  position: absolute; width: 8px; height: 8px; border-radius: 50%; background: var(--gold);
  opacity: 0; transform: scale(0.4); transition: 320ms ease;
  box-shadow: 0 0 16px rgba(216, 155, 43, 0.62);
}
.afsim .star.on { opacity: 1; transform: scale(1); }
.afsim .star:nth-child(1) { right: 22%; top: 13%; }
.afsim .star:nth-child(2) { right: 40%; top: 9%; }
.afsim .star:nth-child(3) { right: 56%; top: 15%; }
.afsim .star:nth-child(4) { right: 72%; top: 10%; }
.afsim .star:nth-child(5) { right: 32%; top: 21%; }
.afsim .star:nth-child(6) { right: 64%; top: 23%; }

.afsim .panel {
  border: 1px solid rgba(24, 112, 91, 0.18); border-radius: 8px;
  background: rgba(255, 255, 255, 0.88); box-shadow: var(--shadow);
  padding: 22px; backdrop-filter: blur(14px);
}
.afsim .panel-title {
  margin: 0; font-size: clamp(1.45rem, 3vw, 2.1rem); color: var(--green-dark); line-height: 1.2;
}
.afsim .panel-subtitle { margin: 9px 0 18px; color: var(--muted); line-height: 1.75; }

.afsim .amount-box {
  display: flex; align-items: baseline; justify-content: space-between; gap: 14px;
  padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper);
}
.afsim .amount-box span:first-child { color: var(--muted); font-weight: 700; }
.afsim .amount {
  font-size: clamp(2rem, 5vw, 3.8rem); line-height: 1; color: var(--green);
  font-weight: 900; white-space: nowrap;
}
.afsim .currency { font-size: 1rem; color: var(--green-dark); }

.afsim .slider-wrap { margin: 18px 0; }
.afsim input[type="range"] { width: 100%; accent-color: var(--green); cursor: pointer; }
.afsim .ticks {
  display: flex; justify-content: space-between; color: var(--muted); font-size: 0.85rem; margin-top: 6px;
}

/* amounts: six presets + custom input, all on ONE row */
.afsim .afsim-amounts { display: flex; gap: 6px; margin: 18px 0; }
.afsim .quick {
  flex: 1 1 0; min-width: 0; min-height: 44px; padding: 0;
  border: 1px solid var(--line); border-radius: 8px; background: white;
  color: var(--green-dark); font-weight: 800; cursor: pointer; transition: 180ms ease; font-family: inherit;
}
.afsim .quick:hover, .afsim .quick:focus-visible, .afsim .quick.active {
  border-color: var(--green); background: var(--green); color: white; outline: none;
}
.afsim .afsim-custom-inline {
  flex: 2.4 1 0; min-width: 0; min-height: 44px; border: 1.5px solid var(--line); border-radius: 8px;
  background: #fff; padding: 0 8px; text-align: center; font-weight: 700; color: var(--ink);
  font-family: inherit; font-size: 0.95rem; -moz-appearance: textfield; appearance: textfield;
}
.afsim .afsim-custom-inline::-webkit-outer-spin-button,
.afsim .afsim-custom-inline::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.afsim .afsim-custom-inline::placeholder { color: var(--muted); font-weight: 600; }
.afsim .afsim-custom-inline:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 1px var(--green); }

.afsim .impact-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 0 0 18px; }
.afsim .impact-item {
  display: grid; grid-template-columns: 40px minmax(0, 1fr); align-items: center; gap: 10px;
  min-height: 58px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: white;
}
.afsim .icon {
  width: 42px; height: 42px; display: grid; place-items: center; border-radius: 8px;
  color: white; flex: 0 0 auto;
}
.afsim .icon svg {
  width: 23px; height: 23px; fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.afsim .food { background: var(--coral); }
.afsim .edu { background: var(--blue); }
.afsim .supplies { background: var(--gold); color: #3f2b0c; }
.afsim .care { background: var(--violet); }
.afsim .impact-title { display: block; font-weight: 900; color: var(--ink); line-height: 1.35; }
.afsim .impact-caption { display: block; color: var(--muted); font-size: 0.88rem; line-height: 1.45; }
.afsim .impact-value { color: var(--green); font-weight: 800; white-space: nowrap; font-size: 0.95em; }
.afsim .impact-value::before { content: "("; }
.afsim .impact-value::after { content: ")"; }

.afsim .actions { display: grid; grid-template-columns: 1fr; gap: 10px; align-items: center; }
.afsim .donate {
  display: grid; place-items: center; min-height: 52px; border: 0; border-radius: 8px;
  background: var(--green); color: white; font-weight: 900; cursor: pointer; text-decoration: none;
  box-shadow: 0 15px 28px rgba(24, 112, 91, 0.2); transition: 180ms ease;
}
.afsim .donate:hover, .afsim .donate:focus-visible {
  background: var(--green-dark); outline: none; transform: translateY(-1px); color: #fff;
}

.afsim .status {
  margin-top: 14px; min-height: 44px; display: grid; align-items: center; padding: 0 12px;
  border-radius: 8px; background: var(--mist); color: var(--green-dark); font-weight: 800; line-height: 1.45;
}

/* ===== 3-step donation wizard (حصّتك / بياناتك / تأكيد) ===== */
.afsim .afsim-steps {
  list-style: none; display: flex; gap: 6px; padding: 0; margin: 4px 0 18px;
}
.afsim .afsim-steps li {
  flex: 1; display: flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: var(--muted); font-weight: 700;
}
.afsim .afsim-steps li span {
  width: 24px; height: 24px; flex: 0 0 auto; border-radius: 50%;
  display: grid; place-items: center; font-size: 12.5px; background: var(--line); color: #fff;
  transition: background .2s ease;
}
.afsim .afsim-steps li.is-active { color: var(--green-dark); }
.afsim .afsim-steps li.is-active span { background: var(--green); }
.afsim .afsim-steps li.is-done span { background: var(--gold); }

.afsim .afsim-step { display: flex; flex-direction: column; }
.afsim .afsim-step[hidden] { display: none; }

.afsim .afsim-freq { display: flex; gap: 8px; margin: 0 0 18px; }
.afsim .afsim-freq__opt {
  flex: 1; min-height: 44px; border: 1.5px solid var(--line); background: #fff; border-radius: 8px;
  font-weight: 800; font-size: 0.95rem; color: var(--green-dark); cursor: pointer; transition: .2s; font-family: inherit;
}
.afsim .afsim-freq__opt.is-active { border-color: var(--green); background: var(--green); color: #fff; }

.afsim .afsim-field { margin-bottom: 12px; }
.afsim .afsim-field label { display: block; font-size: 0.88rem; font-weight: 700; color: var(--green-dark); margin-bottom: 5px; }
.afsim .afsim-field input, .afsim .afsim-field textarea {
  width: 100%; border: 1.5px solid var(--line); border-radius: 8px; background: #fff;
  padding: 11px 12px; font-size: 1rem; color: var(--ink); font-family: inherit;
}
.afsim .afsim-field input:focus, .afsim .afsim-field textarea:focus {
  outline: none; border-color: var(--green); box-shadow: 0 0 0 1px var(--green);
}
.afsim .afsim-field input.is-invalid, .afsim .afsim-field textarea.is-invalid {
  border-color: #b3261e; box-shadow: 0 0 0 1px #b3261e;
}
.afsim .afsim-err { display: block; color: #b3261e; font-size: 0.8rem; margin-top: 4px; }

.afsim .afsim-confirm { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin-bottom: 14px; }
.afsim .afsim-confirm__row {
  display: flex; justify-content: space-between; padding: 11px 14px; font-size: 0.95rem;
  color: var(--muted); border-bottom: 1px solid var(--line);
}
.afsim .afsim-confirm__row:last-child { border-bottom: none; }
.afsim .afsim-confirm__row b { color: var(--green-dark); font-weight: 900; }

.afsim .afsim-terms {
  display: flex; align-items: flex-start; gap: 8px; font-size: 0.85rem; color: var(--muted);
  line-height: 1.6; cursor: pointer; margin-bottom: 12px;
}
.afsim .afsim-terms input { margin-top: 3px; accent-color: var(--green); flex: 0 0 auto; }
.afsim .afsim-terms a { color: var(--green); font-weight: 700; text-decoration: underline; }
.afsim .afsim-terms a:hover { color: var(--green-dark); }

.afsim .afsim-feedback { font-size: 0.9rem; min-height: 1.2em; margin-bottom: 10px; }
.afsim .afsim-feedback.is-error { color: #b3261e; }
.afsim .afsim-feedback.is-info { color: var(--green-dark); }

.afsim .afsim-nav { display: flex; gap: 10px; align-items: center; }
.afsim .afsim-nav .donate { flex: 1; }
.afsim .afsim-back {
  min-height: 52px; padding: 0 18px; border: 1.5px solid var(--line); background: #fff; border-radius: 8px;
  color: var(--green-dark); font-weight: 800; cursor: pointer; font-family: inherit; transition: .18s;
}
.afsim .afsim-back:hover { border-color: var(--green); }

.afsim .afsim-secure-note { font-size: 0.8rem; color: var(--muted); margin: 10px 0 0; text-align: center; }

@media (max-width: 920px) {
  .afsim .experience { grid-template-columns: 1fr; }
  .afsim .stage { min-height: 610px; }
}

@media (max-width: 620px) {
  .afsim .app { width: min(100% - 20px, 1180px); }
  .afsim .stage { min-height: 560px; }
  .afsim .stage-copy { width: calc(100% - 22px); padding: 24px 18px 0 0; }
  .afsim .afsim-title { font-size: clamp(1.65rem, 9vw, 2.7rem); }
  .afsim .sun { width: 84px; height: 84px; left: 28px; top: 66px; }
  .afsim .neighborhood { transform: scale(0.82); transform-origin: bottom center; right: -72px; left: -72px; }
  .afsim .panel { padding: 16px; }
  /* keep all amounts on one row on phones too */
  .afsim .afsim-amounts { gap: 4px; }
  .afsim .quick { font-size: 0.9rem; }
  .afsim .afsim-custom-inline { font-size: 0.82rem; padding: 0 4px; }
}
