/* ============================================================
   Health Declaration page — uses the studio's design system
   (variables, fonts, button styles come from style.css)
   ============================================================ */

.health-body {
  background:
    radial-gradient(ellipse 70% 50% at 50% 0%, rgba(185, 196, 175, 0.28), transparent 70%),
    var(--off-white);
  min-height: 100vh;
}

/* ===================== HEADER ===================== */
.health-header {
  position: relative;
  padding: 2.5rem var(--pad) 2rem;
  text-align: center;
}

.health-header__back {
  position: absolute;
  top: 1.4rem;
  right: 1.4rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--sage-deep);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.55rem 1rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.health-header__back:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.health-header__inner { max-width: 640px; margin: 0 auto; }

.health-header__logo {
  width: 110px;
  height: 110px;
  margin: 0 auto 1rem;
}
@media (min-width: 760px) {
  .health-header__logo { width: 130px; height: 130px; }
}

.health-header__title {
  font-family: var(--serif);
  font-size: clamp(1.7rem, 4.5vw, 2.4rem);
  color: var(--ink);
  line-height: 1.25;
  margin-bottom: 0.4rem;
}

.health-header__subtitle {
  color: var(--ink-soft);
  font-size: clamp(1rem, 2.3vw, 1.1rem);
  letter-spacing: 0.05em;
}

/* ===================== MAIN LAYOUT ===================== */
.health-main {
  padding: 1rem var(--pad) 4rem;
}

.health-card {
  max-width: 720px;
  margin: 0 auto 2rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: clamp(1.8rem, 5vw, 3rem);
  box-shadow: var(--shadow-lg);
  animation: fadeUp 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.health-card__intro {
  text-align: center;
  margin-bottom: 2rem;
}

.health-card__icon {
  font-size: 2.4rem;
  color: var(--sage);
  margin-bottom: 0.8rem;
  display: inline-block;
}

.health-card__eyebrow {
  display: inline-block;
  font-size: 0.85rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--terracotta);
  background: rgba(192, 119, 90, 0.1);
  padding: 0.35rem 0.9rem;
  border-radius: var(--radius-pill);
  margin-bottom: 0.9rem;
  font-weight: 600;
}

.health-card__title {
  font-family: var(--serif);
  font-size: clamp(1.5rem, 3.8vw, 2rem);
  color: var(--ink);
  margin-bottom: 0.6rem;
}

.health-card__lead {
  color: var(--ink-soft);
  font-size: clamp(0.98rem, 2.2vw, 1.08rem);
  line-height: 1.65;
  max-width: 520px;
  margin: 0 auto;
}

/* ===================== FORM ===================== */
.health-form { gap: 2rem; }

.field__hint {
  font-size: 0.88rem;
  color: var(--ink-soft);
  margin-top: 0.25rem;
  line-height: 1.5;
}

.req { color: var(--terracotta); font-weight: 700; }
.req-optional {
  color: var(--ink-soft);
  font-weight: 500;
  font-size: 0.85em;
  margin-inline-start: 0.3rem;
}

/* ===================== SECTIONS (fieldsets) ===================== */
.health-section {
  border: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.health-section__legend {
  font-family: var(--serif);
  font-size: clamp(1.25rem, 3vw, 1.55rem);
  color: var(--ink);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding-bottom: 0.6rem;
  border-bottom: 2px solid var(--line);
  margin-bottom: 0.4rem;
  width: 100%;
}

.health-section__num {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  background: var(--sage);
  color: #fff;
  border-radius: 50%;
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0;
}

.health-section__note {
  color: var(--ink-soft);
  font-size: 0.96rem;
  background: var(--cream);
  border-radius: var(--radius);
  padding: 0.85rem 1.1rem;
  line-height: 1.6;
}

/* ===================== QUESTIONS ===================== */
.questions { display: flex; flex-direction: column; gap: 1.2rem; }

.question {
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  transition: border-color 0.25s ease, background 0.25s ease;
}
.question.is-yes {
  background: #fff;
  border-color: var(--sage-soft);
}

.question__text {
  font-size: clamp(0.98rem, 2.2vw, 1.05rem);
  line-height: 1.6;
  color: var(--ink);
  margin-bottom: 0.85rem;
  font-weight: 500;
}

.question__radios {
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.radio-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1.1rem;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-pill);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.98rem;
  color: var(--ink-soft);
  transition: all 0.2s ease;
  min-width: 80px;
  justify-content: center;
}
.radio-pill input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.radio-pill:hover { border-color: var(--sage-soft); }
.radio-pill.is-checked {
  background: var(--sage);
  color: #fff;
  border-color: var(--sage);
  box-shadow: 0 4px 12px rgba(122, 147, 163, 0.3);
}
.radio-pill.is-checked.radio-pill--yes {
  background: var(--terracotta);
  border-color: var(--terracotta);
  box-shadow: 0 4px 12px rgba(192, 119, 90, 0.3);
}

.question__details {
  margin-top: 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s cubic-bezier(0.22, 1, 0.36, 1), margin-top 0.3s ease, opacity 0.3s ease;
  opacity: 0;
}
.question.is-yes .question__details {
  max-height: 260px;
  margin-top: 0.9rem;
  opacity: 1;
}

.question__details textarea {
  width: 100%;
  min-height: 90px;
  font-family: var(--sans);
  font-size: 1rem;
  color: var(--ink);
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  resize: vertical;
  line-height: 1.6;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.question__details textarea:focus {
  outline: none;
  border-color: var(--sage);
  box-shadow: 0 0 0 4px rgba(138, 154, 130, 0.18);
}

/* Female-only questions get a small flag */
.question__flag {
  display: inline-block;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  background: rgba(192, 119, 90, 0.12);
  color: var(--terracotta-d);
  border-radius: var(--radius-pill);
  padding: 0.15rem 0.65rem;
  margin-left: 0.4rem;
  font-weight: 600;
  vertical-align: middle;
}

/* ===================== LEGAL BLOCK ===================== */
.legal-block {
  display: flex;
  gap: 1rem;
  background: var(--cream);
  border-right: 4px solid var(--terracotta);
  border-radius: var(--radius);
  padding: 1.3rem 1.4rem;
  align-items: flex-start;
  margin-bottom: 0.4rem;
}
.legal-block__icon {
  font-size: 1.7rem;
  color: var(--terracotta);
  flex-shrink: 0;
  margin-top: 0.2rem;
}
.legal-block__text {
  font-size: 0.97rem;
  line-height: 1.75;
  color: var(--ink);
}

/* ===================== SIGNATURE PAD ===================== */
.signature {
  position: relative;
  background: #fff;
  border: 1.5px dashed var(--sage-soft);
  border-radius: var(--radius);
  overflow: hidden;
  user-select: none;
}
.signature__canvas {
  display: block;
  width: 100%;
  height: 200px;
  background: #fff;
  cursor: crosshair;
  /* prevent the page from scrolling while the finger draws */
  touch-action: none;
  /* ensure the canvas sits on top of decorative overlays */
  position: relative;
  z-index: 1;
}
@media (min-width: 760px) {
  .signature__canvas { height: 220px; }
}

.signature__placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  color: var(--ink-soft);
  font-size: 0.98rem;
  /* NEVER intercept pointer/touch events — must let the canvas receive them */
  pointer-events: none;
  gap: 0.4rem;
  transition: opacity 0.3s ease;
  z-index: 0;
}
.signature__placeholder * { pointer-events: none; }
.signature__placeholder i {
  font-size: 1.4rem;
  color: var(--sage);
  display: block;
  margin-bottom: 0.3rem;
}
.signature.is-drawn .signature__placeholder { opacity: 0; }

.signature__clear {
  position: absolute;
  bottom: 0.6rem;
  left: 0.6rem;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink-soft);
  border-radius: var(--radius-pill);
  padding: 0.4rem 0.9rem;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
  z-index: 2;
}
.signature__clear:hover {
  background: var(--cream);
  color: var(--terracotta);
  border-color: var(--terracotta);
}

/* ===================== ERROR HIGHLIGHTS ===================== */
.field.has-error input,
.field.has-error select,
.field.has-error textarea {
  border-color: #b03a2e;
  background: #fbeae8;
}
.question.has-error {
  border-color: #b03a2e;
  background: #fbeae8;
}
.signature.has-error { border-color: #b03a2e; }

/* ===================== SUCCESS (green) ===================== */
.health-success {
  text-align: center;
  background: #fff;
}
.health-success__icon {
  width: 90px;
  height: 90px;
  margin: 0 auto 1.4rem;
  display: grid;
  place-items: center;
  font-size: 2.8rem;
  color: #fff;
  background: #4caf80;
  border-radius: 50%;
  box-shadow: 0 12px 30px rgba(76, 175, 128, 0.35);
  animation: pop 0.5s cubic-bezier(0.22, 1.6, 0.4, 1) 0.1s both;
}
.health-success .success__title {
  color: #2e7d57;
}

/* ===================== "new-only" sections hidden in renewal flow ===================== */
.health-form.is-renewal .new-only {
  display: none !important;
}

/* ===================== מספר שאלה דינמי ===================== */
.question__num {
  display: inline-block;
  min-width: 1.6em;
  color: var(--terracotta, #c0775a);
  font-weight: 700;
  margin-inline-end: 0.35em;
}

/* ===================== שדה לא תקין (טלפון / מייל) ===================== */
input.is-invalid,
input.is-invalid:focus {
  border-color: #b03a2e !important;
  box-shadow: 0 0 0 3px rgba(176, 58, 46, 0.15) !important;
  background: #fdf3f1;
}
