/* Hadbah fullscreen interest flow — companion overlay */

:root {
  --if-green: #22372b;
  --if-green-mid: #33513f;
  --if-green-deep: #15241c;
  --if-gold: #c4a871;
  --if-gold-soft: #d4bc8a;
  --if-gold-dim: #9e7934;
  --if-cream: #faf3f0;
  --if-ink: #15241c;
  --if-ink-soft: rgba(21, 36, 28, 0.62);
  --if-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

#hadbah-if {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: grid;
  grid-template-rows: auto 1fr;
  background:
    radial-gradient(ellipse 70% 55% at 70% 0%, rgba(196, 168, 113, 0.18), transparent 55%),
    radial-gradient(ellipse 55% 45% at 10% 100%, rgba(51, 81, 63, 0.55), transparent 60%),
    linear-gradient(165deg, #33513f 0%, #22372b 48%, #15241c 100%);
  color: var(--if-cream);
  /* Visibility is toggled via [hidden] only — avoids stuck opacity:0 when WAAPI is paused */
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Content waits for the clip-path reveal, then rises in sequence */
#hadbah-if.is-entering {
  --if-base: 0.34s;
}

#hadbah-if.is-entering .if-top {
  animation: if-rise 0.6s var(--if-ease) var(--if-base) both;
}

#hadbah-if.is-leaving .if-top,
#hadbah-if.is-leaving .if-column {
  animation: if-sink 0.22s ease both;
}

@keyframes if-rise {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes if-sink {
  to {
    opacity: 0;
    transform: translateY(8px);
  }
}

#hadbah-if[hidden] {
  display: none !important;
}

.if-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem 0.75rem;
  max-width: 44rem;
  width: 100%;
  margin-inline: auto;
}

.if-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.if-brand img {
  width: 2.25rem;
  height: 2.25rem;
  object-fit: contain;
}

.if-brand span {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: rgba(250, 243, 240, 0.78);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.if-progress {
  flex: 1;
  max-width: 13rem;
  display: flex;
  gap: 0.3rem;
}

.if-progress > i {
  flex: 1;
  height: 3px;
  border-radius: 999px;
  background: rgba(250, 243, 240, 0.14);
  position: relative;
  overflow: hidden;
}

.if-progress > i::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--if-gold), var(--if-gold-soft));
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.5s var(--if-ease);
}

.if-progress > i.is-done::after {
  transform: scaleX(1);
}

.if-close {
  width: 2.5rem;
  height: 2.5rem;
  border: 0;
  border-radius: 999px;
  background: rgba(250, 243, 240, 0.1);
  color: var(--if-cream);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.2s ease, transform 0.2s ease;
}

.if-close:hover {
  background: rgba(250, 243, 240, 0.18);
}

.if-close:active {
  transform: scale(0.94);
}

.if-close svg {
  width: 1.15rem;
  height: 1.15rem;
}

.if-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 1.25rem 1.5rem;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.if-column {
  width: min(100%, 34rem);
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.if-card {
  position: relative;
}

.if-step {
  display: none;
  flex-direction: column;
  gap: 1.35rem;
}

/* RTL: forward slides in from the left edge, back from the right */
.if-step.is-active {
  display: flex;
}

.if-step.is-fwd {
  animation: if-slide 0.5s var(--if-ease) both;
}

.if-step.is-back {
  animation: if-slide-back 0.5s var(--if-ease) both;
}

.if-step.is-static > * {
  animation: none !important;
}

.if-step > *,
.if-nav {
  animation: if-rise 0.55s var(--if-ease) both;
  animation-delay: calc(var(--if-base, 0s) + var(--d, 0s));
}

.if-step > :nth-child(2) { --d: 0.05s; }
.if-step > :nth-child(3) { --d: 0.1s; }
.if-step > :nth-child(4) { --d: 0.15s; }
.if-step > :nth-child(5) { --d: 0.2s; }
.if-nav { --d: 0.22s; }

@keyframes if-slide {
  from {
    transform: translateX(-2rem);
  }
  to {
    transform: none;
  }
}

@keyframes if-slide-back {
  from {
    transform: translateX(2rem);
  }
  to {
    transform: none;
  }
}

.if-kicker {
  display: inline-flex;
  align-self: flex-start;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--if-gold);
}

.if-kicker::before {
  content: "";
  width: 1.5rem;
  height: 1px;
  background: currentColor;
  opacity: 0.6;
}

.if-kicker span {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
}

.if-kicker b {
  font-weight: 800;
  color: var(--if-gold-soft);
}

.if-question {
  margin: 0;
  font-family: Religath, Tajawal, "Segoe UI", sans-serif;
  font-size: clamp(1.55rem, 4.2vw, 2.15rem);
  font-weight: 800;
  line-height: 1.35;
  color: #fff;
}

.if-hint {
  margin: -0.55rem 0 0;
  font-size: 0.92rem;
  line-height: 1.7;
  color: rgba(250, 243, 240, 0.62);
}

.if-field {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.if-input,
.if-textarea {
  width: 100%;
  border: 1px solid rgba(196, 168, 113, 0.28);
  border-radius: 1rem;
  background: rgba(250, 243, 240, 0.96);
  color: var(--if-ink);
  font: inherit;
  font-size: 1.05rem;
  font-weight: 600;
  padding: 1rem 1.15rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.if-input:focus,
.if-textarea:focus {
  border-color: var(--if-gold);
  box-shadow: 0 0 0 3px rgba(196, 168, 113, 0.28);
}

.if-input.is-error,
.if-textarea.is-error {
  border-color: #c45a3e;
  box-shadow: 0 0 0 3px rgba(196, 90, 62, 0.2);
}

.if-input[dir="ltr"] {
  text-align: left;
  unicode-bidi: isolate;
}

.if-textarea {
  min-height: 7.5rem;
  resize: vertical;
  font-weight: 500;
  line-height: 1.7;
}

.if-error {
  min-height: 1.25rem;
  margin: 0;
  font-size: 0.8rem;
  font-weight: 700;
  color: #ffb4a2;
}

.if-choices {
  display: grid;
  gap: 0.7rem;
}

.if-choice {
  appearance: none;
  border: 1px solid rgba(196, 168, 113, 0.35);
  border-radius: 1rem;
  background: rgba(250, 243, 240, 0.08);
  color: var(--if-cream);
  font: inherit;
  font-size: 1.02rem;
  font-weight: 700;
  text-align: right;
  padding: 1rem 1.15rem;
  cursor: pointer;
  transition:
    background 0.22s ease,
    border-color 0.22s ease,
    transform 0.18s var(--if-ease),
    box-shadow 0.22s ease;
}

.if-choice:hover {
  background: rgba(196, 168, 113, 0.16);
  border-color: rgba(196, 168, 113, 0.7);
}

.if-choice:active {
  transform: scale(0.985);
}

.if-choice.is-on {
  background: linear-gradient(135deg, rgba(196, 168, 113, 0.95), rgba(212, 188, 138, 0.92));
  border-color: transparent;
  color: var(--if-green-deep);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
}

.if-choice-grid {
  grid-template-columns: 1fr 1fr;
}

.if-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.if-nav[hidden] {
  display: none;
}

.if-enter-hint {
  margin-inline-start: auto;
  font-size: 0.78rem;
  color: rgba(250, 243, 240, 0.42);
}

.if-enter-hint kbd {
  font: inherit;
  font-weight: 800;
  padding: 0.1rem 0.4rem;
  border-radius: 0.35rem;
  border: 1px solid rgba(250, 243, 240, 0.18);
  color: rgba(250, 243, 240, 0.7);
}

.if-btn {
  appearance: none;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 3rem;
  padding: 0.75rem 1.35rem;
  line-height: 1;
  transition:
    transform 0.18s var(--if-ease),
    background 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    opacity 0.2s ease,
    color 0.2s ease;
}

.if-btn:active {
  transform: scale(0.97);
}

.if-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.if-btn-ghost {
  background: transparent;
  color: rgba(250, 243, 240, 0.78);
  padding-inline: 0.85rem;
}

.if-btn-ghost:hover:not(:disabled) {
  color: #fff;
}

.if-btn-back {
  width: 3.25rem;
  min-width: 3.25rem;
  height: 3.25rem;
  padding: 0;
  background: transparent;
  color: rgba(250, 243, 240, 0.85);
  border: 1px solid rgba(250, 243, 240, 0.2);
}

.if-btn-back:hover:not(:disabled) {
  background: rgba(250, 243, 240, 0.08);
  border-color: var(--if-gold);
  color: #fff;
}

.if-btn-back[hidden] {
  display: none;
}

.if-btn-back svg {
  width: 1.2rem;
  height: 1.2rem;
}

.if-btn-primary {
  background: linear-gradient(135deg, var(--if-gold) 0%, var(--if-gold-soft) 55%, #e2c892 100%);
  color: var(--if-green-deep);
  min-height: 3.25rem;
  min-width: 10rem;
  padding-inline: 1.6rem 1.3rem;
  font-size: 1rem;
  box-shadow:
    0 12px 28px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.if-btn-primary:hover:not(:disabled) {
  filter: brightness(1.06);
  box-shadow:
    0 16px 34px rgba(0, 0, 0, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.34);
}

.if-btn svg {
  width: 1.05rem;
  height: 1.05rem;
  flex: 0 0 auto;
}

.if-success {
  text-align: center;
  align-items: center;
  gap: 1.1rem;
  padding-block: 0.5rem;
}

.if-success-mark {
  width: 4.25rem;
  height: 4.25rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(196, 168, 113, 0.18);
  color: var(--if-gold);
  animation: if-pop 0.55s var(--if-ease) both;
}

.if-success-mark svg {
  width: 2.1rem;
  height: 2.1rem;
}

@keyframes if-pop {
  from {
    opacity: 0;
    transform: scale(0.7);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.if-code {
  display: inline-flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.85rem 1.35rem;
  border-radius: 1rem;
  background: rgba(250, 243, 240, 0.08);
  border: 1px dashed rgba(196, 168, 113, 0.45);
}

.if-code small {
  font-size: 0.72rem;
  color: rgba(250, 243, 240, 0.55);
}

.if-code strong {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.45rem;
  letter-spacing: 0.06em;
  color: var(--if-gold-soft);
}

.if-success-actions {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  width: min(100%, 20rem);
  margin-top: 0.35rem;
}

.if-success-actions .if-btn {
  width: 100%;
  border-radius: 1rem;
}

.if-btn-wa {
  background: #128c7e;
  color: #fff;
}

.if-btn-secondary {
  background: rgba(250, 243, 240, 0.1);
  color: var(--if-cream);
  border: 1px solid rgba(250, 243, 240, 0.16);
}

/* Teaser lives inside the Najdi house cream card */
#hadbah-if-teaser {
  position: relative;
  z-index: 2;
  margin: 0.35rem auto 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.7rem;
  max-width: 26rem;
  padding: 0.25rem 0 0.35rem;
}

#hadbah-if-teaser .if-teaser-eyebrow {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--if-gold-dim);
}

#hadbah-if-teaser .if-teaser-title {
  margin: 0;
  font-family: Religath, Tajawal, "Segoe UI", sans-serif;
  font-size: clamp(1.35rem, 3vw, 1.7rem);
  font-weight: 800;
  line-height: 1.35;
  color: #22372b;
}

#hadbah-if-teaser .if-teaser-lead {
  margin: 0;
  max-width: 22rem;
  font-size: 0.92rem;
  line-height: 1.85;
  color: rgba(34, 55, 43, 0.62);
}

#hadbah-if-teaser .if-teaser-btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  margin-top: 0.55rem;
  width: min(100%, 17.5rem);
  min-height: 3.2rem;
  padding: 0.9rem 1.5rem;
  border-radius: 999px;
  font: inherit;
  font-size: 1rem;
  font-weight: 800;
  color: var(--if-green-deep);
  background: linear-gradient(135deg, var(--if-gold) 0%, var(--if-gold-soft) 55%, #e2c892 100%);
  box-shadow:
    0 14px 28px rgba(34, 55, 43, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s var(--if-ease), filter 0.2s ease, box-shadow 0.2s ease;
}

#hadbah-if-teaser .if-teaser-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.38) 48%, transparent 66%);
  transform: translateX(120%);
  animation: if-shimmer 2.8s ease-in-out infinite;
}

#hadbah-if-teaser .if-teaser-btn svg {
  width: 1.05rem;
  height: 1.05rem;
  position: relative;
  z-index: 1;
}

#hadbah-if-teaser .if-teaser-btn:hover {
  filter: brightness(1.04);
  box-shadow:
    0 18px 34px rgba(34, 55, 43, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

#hadbah-if-teaser .if-teaser-btn:active {
  transform: scale(0.97);
}

@keyframes if-shimmer {
  0%,
  55% {
    transform: translateX(120%);
  }
  100% {
    transform: translateX(-120%);
  }
}

body.hadbah-if-form-hidden #register form,
body.hadbah-if-form-hidden #register fieldset,
body.hadbah-if-form-hidden #register .reg-toggle,
body.hadbah-if-form-hidden #register [role="radiogroup"],
body.hadbah-if-form-hidden #register input,
body.hadbah-if-form-hidden #register textarea,
body.hadbah-if-form-hidden #register button:not(.if-teaser-btn) {
  display: none !important;
}

body.hadbah-if-lock {
  overflow: hidden;
}

@media (max-width: 640px) {
  .if-choice-grid {
    grid-template-columns: 1fr;
  }

  .if-top {
    padding-inline: 1rem;
  }

  .if-brand span {
    display: none;
  }
}

.if-btn-primary svg {
  transition: transform 0.25s var(--if-ease);
}

.if-btn-primary:hover:not(:disabled) svg {
  transform: translateX(-3px);
}

@media (max-width: 640px) {
  .if-enter-hint {
    display: none;
  }

  .if-nav .if-btn-primary {
    flex: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  #hadbah-if,
  #hadbah-if *,
  .if-step.is-active,
  .if-step.is-exit,
  .if-progress > i,
  .if-success-mark,
  .if-choice,
  .if-btn,
  #hadbah-if-teaser .if-teaser-btn::after {
    animation: none !important;
    transition: none !important;
  }

  .if-step {
    transform: none;
  }
}
