/*
 * Apply to teach the Quran (prefix tch-) and the form stepper (form-steps.js, prefix fs-).
 * Tokens only; logical properties; transform/opacity motion, none under reduced motion.
 */

.tch { padding-bottom: clamp(2.5rem, 6vw, 4rem); }
.tch-hero {
  position: relative;
  overflow: hidden;
  color: #f4ead2;
  background: var(--ip-jewel);
  background-size: 28px 28px, auto, auto, auto;
  padding-block: clamp(2rem, 5vw, 3.5rem) clamp(4.5rem, 8vw, 6rem);
}
.tch-hero-inner { position: relative; z-index: 1; max-width: 1200px; }
.tch-hero-art { position: absolute; inset-inline-end: max(2vw, 16px); bottom: 0; width: min(36vw, 360px); height: auto; opacity: .9; }
[dir="rtl"] .tch-hero-art { transform: scaleX(-1); }
.tch-book { animation: tch-float 6s ease-in-out infinite; }
@keyframes tch-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.tch-back { display: flex; width: fit-content; align-items: center; gap: .4rem; margin-bottom: 1rem; color: rgba(244, 234, 210, .85); font-size: .9rem; font-weight: 600; text-decoration: none; }
.tch-back:hover { color: #fff; }
.tch-kicker { display: inline-flex; align-items: center; gap: .45rem; margin: 0 0 .6rem; font-size: var(--ip-text-xs); font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #f4d48b; }
.tch-title { max-width: 18ch; margin: 0 0 .7rem; font-family: var(--ip-font-display); font-size: var(--ip-text-4xl); font-weight: 700; line-height: 1.06; letter-spacing: -.02em; color: #fff; text-wrap: balance; }
.tch-lead { max-width: 56ch; margin: 0; font-size: var(--ip-text-lg); line-height: 1.6; color: rgba(244, 234, 210, .88); }
[dir="rtl"] .tch-flip, [dir="rtl"] .fs-flip { display: inline-block; transform: scaleX(-1); }

.tch-body { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 1.25rem; align-items: start; margin-top: calc(clamp(4.5rem, 8vw, 6rem) * -1 + 1.5rem); position: relative; z-index: 2; }
.tch-aside, .tch-form, .tch-done { padding: clamp(1.25rem, 3vw, 2rem); border-radius: 24px; background: var(--ip-surface); border: 1px solid var(--ip-line); box-shadow: var(--ip-shadow-md); }
.tch-aside { position: sticky; top: calc(var(--ip-header-h) + 1rem); }
.tch-badge { display: inline-flex; padding: .25rem .7rem; border-radius: 999px; background: var(--ip-primary-soft); color: var(--ip-primary); font-size: .78rem; font-weight: 700; }
.tch-aside-title { margin: .75rem 0 .9rem; font-size: 1.25rem; font-weight: 700; color: var(--ip-ink); }
.tch-next { counter-reset: tch; display: grid; gap: .75rem; margin: 0 0 1rem; padding: 0; list-style: none; }
.tch-next li, .tch-next.guide-rich li { counter-increment: tch; position: relative; padding-inline-start: 2.6rem; color: var(--ip-ink-2); line-height: 1.5; list-style: none; }
.tch-next li::before { content: counter(tch); position: absolute; inset-inline-start: 0; top: -.1rem; display: grid; place-items: center; width: 1.9rem; height: 1.9rem; border-radius: 50%; background: linear-gradient(135deg, var(--ip-green-500), var(--ip-green-700)); color: #fff; font-size: .82rem; font-weight: 800; }
.tch-next.guide-rich ol { counter-reset: tch; display: grid; gap: .75rem; margin: 0; padding: 0; }
.tch-note { display: flex; gap: .5rem; margin: 0; padding: .75rem .9rem; border-radius: 14px; background: var(--ip-surface-2); color: var(--ip-muted); font-size: .85rem; line-height: 1.5; }

.tch-form-title { margin: 0 0 1rem; font-size: 1.3rem; font-weight: 700; color: var(--ip-ink); }
.tch-errors:empty, .tch-errors.validation-summary-valid { display: none; }
.tch-errors { margin-bottom: 1rem; padding: .75rem 1rem; border-radius: 14px; background: var(--ip-danger-soft); color: var(--ip-danger); }
.tch-errors ul { margin: 0; padding-inline-start: 1.2rem; }
.tch-step { margin: 0; padding: 0; border: 0; min-width: 0; }
.tch-step + .tch-step { margin-top: 1.5rem; }
.is-stepped .tch-step + .tch-step { margin-top: 0; }
.tch-step-title { float: inline-start; width: 100%; display: flex; align-items: center; gap: .6rem; margin: 0 0 .9rem; padding: 0; font-size: 1.05rem; font-weight: 700; color: var(--ip-ink); }
.tch-step-title + * { clear: both; }
.tch-step-num { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--ip-primary-soft); color: var(--ip-primary); font-size: .85rem; }
.is-stepped .tch-step-title { display: none; }
.tch-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.tch-field { display: grid; gap: .35rem; align-content: start; min-width: 0; }
.tch-field--wide { grid-column: 1 / -1; }
.tch-field label { font-size: .88rem; font-weight: 650; color: var(--ip-ink); }
.tch-field .form-control { min-height: 48px; border-radius: 14px; background-color: var(--ip-surface-2); border-color: var(--ip-line); }
.tch-field .form-control:focus { background-color: var(--ip-surface); border-color: var(--ip-primary); box-shadow: 0 0 0 4px var(--ip-primary-soft); }
.tch-field .input-validation-error { border-color: var(--ip-danger); }
.tch-help { font-size: .8rem; color: var(--ip-muted); }
.tch-privacy { margin: 1rem 0 0; font-size: .85rem; color: var(--ip-muted); }
.tch-submit { display: flex; justify-content: flex-end; margin-top: 1rem; }
.tch-submit[hidden] { display: none; }

.tch-btn, .fs-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 48px; padding: .6rem 1.4rem; border-radius: 14px; border: 1px solid transparent;
  font-weight: 700; font-size: .95rem; text-decoration: none; cursor: pointer;
  transition: transform .2s var(--ip-ease), box-shadow .2s;
}
.tch-btn:hover, .fs-btn:hover { transform: translateY(-1px); }
.tch-btn:focus-visible, .fs-btn:focus-visible, .tch-back:focus-visible { outline: 3px solid var(--ip-focus); outline-offset: 2px; }
.tch-btn--primary, .fs-btn--primary { background: linear-gradient(135deg, var(--ip-green-600), var(--ip-green-800)); color: #fff; box-shadow: var(--ip-shadow-glow); }
.tch-btn--primary:hover, .fs-btn--primary:hover { color: #fff; }
.fs-btn--ghost { background: var(--ip-surface); color: var(--ip-ink); border-color: var(--ip-line-strong); }
.fs-btn[hidden] { display: none; }

.tch-done { text-align: center; }
.tch-done-icon { display: inline-grid; place-items: center; width: 76px; height: 76px; border-radius: 50%; background: linear-gradient(135deg, var(--ip-green-500), var(--ip-green-700)); color: #fff; font-size: 2.2rem; box-shadow: var(--ip-shadow-glow); animation: tch-pop .6s var(--ip-spring); }
@keyframes tch-pop { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
.tch-done-title { margin: 1rem 0 .4rem; font-size: 1.5rem; font-weight: 700; color: var(--ip-ink); }
.tch-done p { max-width: 46ch; margin: 0 auto 1.25rem; color: var(--ip-muted); }

/* ---------- Form stepper ---------- */
.fs-rail { --fs-progress: 0; position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); margin: 0 0 1.4rem; padding: 0; list-style: none; }
.fs-rail::before, .fs-rail::after { content: ""; position: absolute; top: 20px; inset-inline: calc(100% / (2 * 3)); height: 3px; border-radius: 3px; background: var(--ip-surface-3); }
.fs-rail::after { background: var(--ip-grad-brand); transform: scaleX(var(--fs-progress)); transform-origin: left center; transition: transform .45s var(--ip-ease); }
[dir="rtl"] .fs-rail::after { transform-origin: right center; }
.fs-rail-step { position: relative; z-index: 1; display: grid; justify-items: center; gap: .35rem; color: var(--ip-muted); font-size: .8rem; font-weight: 650; text-align: center; }
.fs-rail-dot { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; border: 2px solid var(--ip-line-strong); background: var(--ip-surface); transition: transform .3s var(--ip-spring), background-color .3s, color .3s, border-color .3s; }
.fs-rail-step.is-done .fs-rail-dot { border-color: var(--ip-primary); color: var(--ip-primary); background: var(--ip-primary-soft); }
.fs-rail-step.is-current { color: var(--ip-ink); }
.fs-rail-step.is-current .fs-rail-dot { border-color: var(--ip-primary); background: var(--ip-primary); color: var(--ip-primary-ink); transform: scale(1.1); box-shadow: var(--ip-shadow-glow); }
.fs-nav { display: flex; align-items: center; gap: .75rem; margin-top: 1.25rem; }
.fs-count { margin-inline-start: auto; font-size: .82rem; font-weight: 700; color: var(--ip-muted); }
.fs-nav .fs-btn--primary { margin-inline-start: 0; }
.fs-in { animation: fs-in .35s var(--ip-ease); }
@keyframes fs-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

@media (max-width: 991.98px) {
  .tch-body { grid-template-columns: minmax(0, 1fr); }
  .tch-aside { position: static; order: 2; }
  .tch-hero-art { opacity: .35; }
}
@media (max-width: 575.98px) {
  .tch-grid { grid-template-columns: minmax(0, 1fr); }
  .fs-rail-label { font-size: .7rem; }
}
@media (prefers-reduced-motion: reduce) {
  .tch-book, .tch-done-icon, .fs-in { animation: none; }
  .fs-rail::after, .fs-rail-dot, .tch-btn, .fs-btn { transition: none; }
}
