@font-face { font-family: "Mishpacha Display"; src: url("./FrankRuhlHofshi-Regular.otf") format("opentype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Mishpacha Display"; src: url("./FrankRuhlHofshi-Bold.otf") format("opentype"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Mishpacha Sans"; src: url("./NotoSansHebrew-Regular.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Mishpacha Sans"; src: url("./NotoSansHebrew-Bold.ttf") format("truetype"); font-weight: 700 900; font-style: normal; font-display: swap; }

:root {
  --navy-950: #0d1b35;
  --navy-900: #132544;
  --navy-800: #1c365f;
  --navy-700: #294d7c;
  --blue-100: #eaf1f9;
  --blue-50: #f5f8fc;
  --gold-600: #9b7621;
  --gold-500: #bd9638;
  --gold-300: #dfca89;
  --ink: #19263a;
  --muted: #69758a;
  --line: #dce3ed;
  --danger: #aa3e38;
  --shadow: 0 22px 55px rgba(19, 37, 68, 0.12);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { min-height: 100%; background: #edf2f8; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 5%, rgba(189, 150, 56, 0.13), transparent 24rem),
    linear-gradient(150deg, #f8fafc 0%, #edf2f8 62%, #e6edf6 100%);
  font-family: "Mishpacha Sans", Arial, ui-sans-serif, system-ui, sans-serif;
  direction: rtl;
}

button, input, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.site-header {
  min-height: 86px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px clamp(20px, 5vw, 70px);
  border-bottom: 1px solid rgba(28, 54, 95, 0.12);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(14px);
}

.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark { width: 48px; height: 48px; display: block; flex: 0 0 auto; filter: drop-shadow(0 4px 9px rgba(13, 27, 53, 0.12)); }
.brand small { display: block; margin-bottom: 2px; color: var(--gold-600); font-size: 0.7rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.brand strong { color: var(--navy-950); font-family: "Mishpacha Display", serif; font-size: 1.28rem; }
.header-hebrew { color: var(--navy-700); font: 700 1.06rem "Mishpacha Sans", Arial, sans-serif; }

.workspace {
  width: min(1120px, calc(100% - 36px));
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 28px;
  margin: 0 auto;
  padding: 44px 0 70px;
  align-items: start;
}

.progress-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 12px; }
.progress-head p { margin: 0 0 3px; color: var(--gold-600); font-size: 0.76rem; font-weight: 850; letter-spacing: 0.09em; text-transform: uppercase; }
.progress-head span { color: var(--muted); font-size: 0.82rem; }
.clear-button { padding: 6px 0; border: 0; cursor: pointer; color: var(--muted); background: transparent; font-size: 0.8rem; font-weight: 700; }
.clear-button:hover { color: var(--danger); }

.progress-track { height: 6px; overflow: hidden; margin-bottom: 18px; border-radius: 99px; background: #dce4ef; }
.progress-track span { width: 0; height: 100%; display: block; border-radius: inherit; background: linear-gradient(90deg, var(--gold-500), #d6b85e); transition: width 240ms ease; }

.question-card {
  position: relative;
  min-height: 480px;
  padding: clamp(26px, 5vw, 48px);
  overflow: hidden;
  border: 1px solid rgba(19, 37, 68, 0.1);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.question-card::after { content: ""; position: absolute; right: -70px; bottom: -80px; width: 210px; height: 210px; border: 1px solid rgba(189, 150, 56, 0.16); border-radius: 50%; pointer-events: none; }
.question-number { width: 42px; height: 42px; display: grid; place-items: center; margin-bottom: 25px; border: 1px solid var(--gold-300); border-radius: 50%; color: var(--gold-600); background: #fffcf2; font: 700 0.86rem Georgia, serif; letter-spacing: 0.06em; }
.question-copy { max-width: 660px; }
.question-copy h1 { margin: 0; color: var(--navy-950); font-family: "Mishpacha Display", serif; font-size: clamp(1.85rem, 4vw, 2.65rem); font-weight: 700; line-height: 1.25; }
.question-copy p { min-height: 24px; margin: 12px 0 0; color: var(--muted); font-size: 0.96rem; line-height: 1.55; }
.question-copy p:empty { display: none; }
.question-body { max-width: 660px; margin-top: 32px; }

.answer-label { display: grid; gap: 9px; color: #465268; font-size: 0.87rem; font-weight: 750; }
.answer-input, .answer-select {
  width: 100%;
  height: 58px;
  padding: 0 17px;
  border: 1px solid #c9d3e1;
  border-radius: 13px;
  outline: none;
  color: var(--ink);
  background: white;
  font-size: 1.12rem;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
.answer-input[dir="rtl"] { font-family: "Mishpacha Sans", Arial, sans-serif; font-size: 1.2rem; }
.answer-input:focus, .answer-select:focus { border-color: var(--navy-700); box-shadow: 0 0 0 4px rgba(41, 77, 124, 0.13); }
.answer-input::placeholder { color: #a0a9b7; }

.person-answer { display: grid; grid-template-columns: minmax(0, 1fr) 100px; gap: 11px; }
.person-answer .answer-select { direction: rtl; font-family: Arial, sans-serif; }
.spouse-details-fields { display: grid; gap: 11px; }
.spouse-details-fields .parent-names-fields { direction: rtl; }
.people-list { max-height: 50vh; overflow-y: auto; border: 1px solid #d6dfeb; border-radius: 15px; direction: rtl; background: white; box-shadow: 0 7px 20px rgba(21, 44, 78, 0.06); }
.people-list-header, .people-list-row { display: grid; grid-template-columns: minmax(0, 1fr) 72px 54px 54px; gap: 6px; align-items: center; }
.people-list.simple .people-list-header, .people-list.simple .people-list-row { grid-template-columns: minmax(0, 1fr) 72px; }
.people-list-header { position: sticky; top: 0; z-index: 1; min-height: 42px; padding: 0 10px; border-bottom: 1px solid #d6dfeb; color: #68758a; background: #f5f7fb; font-size: 0.73rem; font-weight: 850; text-align: center; }
.people-list-header span:first-child { padding-right: 8px; text-align: right; }
.people-list-row { min-height: 61px; padding: 6px 10px; border-bottom: 1px solid #e4e9f1; }
.people-list-row:last-child { border-bottom: 0; }
.people-list-row:focus-within { background: var(--blue-50); }
.people-list-row .answer-input, .people-list-row .answer-select { height: 47px; border-color: transparent; border-radius: 9px; background: transparent; box-shadow: none; }
.people-list-row .answer-input { padding: 0 8px; }
.people-list-row .answer-select { padding: 0 7px; font-size: 1rem; }
.people-list-row .answer-input:focus, .people-list-row .answer-select:focus { border-color: #b9c7da; background: white; box-shadow: 0 0 0 3px rgba(41, 77, 124, 0.1); }
.people-check { height: 47px; display: grid; place-items: center; cursor: pointer; }
.people-check input { width: 22px; height: 22px; margin: 0; accent-color: var(--navy-700); }
.parent-names-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.parent-names-fields.single { grid-template-columns: 1fr; }
.skip-button { margin-top: 12px; padding: 7px 0; border: 0; cursor: pointer; color: #66748a; background: transparent; font-size: 0.84rem; font-weight: 750; text-decoration: underline; text-underline-offset: 3px; }
.skip-button:hover { color: var(--navy-800); }

.grandparent-stack { display: grid; gap: 16px; }
.grandparent-entry { display: grid; gap: 10px; padding: 12px; border: 1px solid #d8e0ea; border-radius: 15px; background: var(--blue-50); }
.grandparent-main { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; }
.main-living { min-width: 92px; height: 58px; display: flex; align-items: center; justify-content: center; gap: 7px; padding: 0 10px; border: 1px solid #c9d3e1; border-radius: 13px; cursor: pointer; color: #526076; background: white; font-size: 0.76rem; font-weight: 800; }
.main-living input, .mini-living input { width: 18px; height: 18px; margin: 0; accent-color: var(--navy-700); }
.grandparent-parents { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.mini-parent { display: grid; grid-template-columns: minmax(0, 1fr) 42px; gap: 6px; }
.mini-input { width: 100%; min-width: 0; height: 50px; padding: 0 12px; border: 1px solid #c9d3e1; border-radius: 11px; outline: none; color: var(--ink); background: white; font-family: "Mishpacha Sans", Arial, sans-serif; font-size: 0.96rem; }
.mini-input:focus { border-color: var(--navy-700); box-shadow: 0 0 0 3px rgba(41, 77, 124, 0.12); }
.mini-input::placeholder { color: #929eae; }
.mini-living { height: 50px; display: grid; place-items: center; border: 1px solid #c9d3e1; border-radius: 11px; cursor: pointer; background: white; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.choice-button { min-height: 68px; padding: 12px 18px; border: 1px solid #ccd6e3; border-radius: 13px; cursor: pointer; color: var(--navy-800); background: white; font-size: 1rem; font-weight: 800; text-align: center; }
.choice-button:hover, .choice-button.selected { border-color: var(--navy-700); background: var(--blue-50); box-shadow: 0 0 0 3px rgba(41, 77, 124, 0.1); }

.count-answer { display: flex; align-items: center; gap: 12px; }
.count-button { width: 54px; height: 54px; border: 1px solid #ccd6e3; border-radius: 13px; cursor: pointer; color: var(--navy-800); background: var(--blue-50); font-size: 1.5rem; }
.count-input { width: 100px; height: 58px; border: 1px solid #c5d0df; border-radius: 13px; outline: none; color: var(--navy-950); background: white; font-size: 1.25rem; font-weight: 800; text-align: center; }
.count-input:focus { border-color: var(--navy-700); box-shadow: 0 0 0 4px rgba(41, 77, 124, 0.13); }

.error-message { min-height: 22px; margin: 14px 0 0; color: var(--danger); font-size: 0.84rem; font-weight: 700; }
.wizard-actions { max-width: 660px; display: flex; justify-content: space-between; gap: 12px; margin-top: 22px; }
.button { min-height: 48px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; padding: 0 22px; border: 1px solid transparent; border-radius: 12px; cursor: pointer; font-weight: 800; }
.button:focus-visible, .choice-button:focus-visible, .clear-button:focus-visible { outline: 3px solid rgba(41, 77, 124, 0.25); outline-offset: 2px; }
.button-back { border-color: #cbd5e2; color: #526076; background: white; }
.button-next { margin-right: auto; color: white; background: var(--navy-950); box-shadow: 0 8px 18px rgba(13, 27, 53, 0.18); }
.button-danger { color: white; background: var(--danger); }
.button-print { color: white; background: var(--navy-950); }

.journey { position: sticky; top: 24px; padding: 28px; border: 1px solid rgba(19, 37, 68, 0.09); border-radius: 20px; background: rgba(255, 255, 255, 0.72); }
.journey-kicker { margin: 0 0 5px; color: var(--gold-600); font-size: 0.72rem; font-weight: 850; letter-spacing: 0.09em; text-transform: uppercase; }
.journey h2 { margin: 0 0 24px; color: var(--navy-950); font: 700 1.4rem "Mishpacha Display", serif; }
.journey ol { display: grid; gap: 5px; margin: 0; padding: 0; list-style: none; }
.journey li { display: grid; grid-template-columns: 34px 1fr; gap: 11px; align-items: center; padding: 10px; border-radius: 11px; color: #8490a1; }
.journey li > span { width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid #d4dce7; border-radius: 50%; font-size: 0.72rem; font-weight: 850; }
.journey li strong, .journey li small { display: block; }
.journey li strong { font-size: 0.84rem; }
.journey li small { margin-top: 2px; font-size: 0.7rem; }
.journey li.active { color: var(--navy-900); background: white; box-shadow: 0 5px 14px rgba(19, 37, 68, 0.08); }
.journey li.active > span { border-color: var(--gold-300); color: var(--gold-600); background: #fffcf2; }
.journey li.complete { color: #526681; }
.journey li.complete > span { border-color: var(--navy-700); color: white; background: var(--navy-700); }

.review-intro { margin: -7px 0 18px; color: var(--muted); line-height: 1.5; }
.review-groups { display: grid; gap: 12px; }
.review-group { padding: 15px 16px; border: 1px solid var(--line); border-radius: 13px; background: #fbfcfe; }
.review-group-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.review-group h3 { margin: 0; color: var(--navy-800); font-size: 0.82rem; font-weight: 850; }
.edit-link { padding: 4px; border: 0; cursor: pointer; color: var(--gold-600); background: transparent; font-size: 0.75rem; font-weight: 800; }
.review-group ul { display: grid; gap: 5px; margin: 0; padding: 0; list-style: none; font-family: "Mishpacha Sans", Arial, sans-serif; font-size: 1rem; text-align: right; }
.review-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.review-empty { padding: 18px; border: 1px dashed #cad4e1; border-radius: 12px; color: var(--muted); text-align: center; }

.review-items,
.print-items { display: grid; gap: 7px; font-family: "Mishpacha Sans", Arial, sans-serif; }
.name-line,
.family-adults,
.family-children,
.family-child { margin: 0; }
.family-unit { padding: 9px 11px; border-right: 3px solid var(--gold-500); border-radius: 8px; background: white; }
.family-adults { font-size: 1rem; line-height: 1.45; }
.family-adults span { color: #3e4d65; }
.family-children { margin-top: 5px; color: #56647a; font-size: 0.92rem; line-height: 1.5; }
.family-descendants { display: grid; gap: 6px; margin-top: 7px; padding-right: 12px; }
.family-descendants .family-unit { border-right-width: 2px; background: #f8f9fc; }
.standalone-child { padding-right: 12px; color: #46556c; }

.print-sheet { display: none; }

dialog { width: min(430px, calc(100% - 30px)); padding: 0; border: 0; border-radius: 18px; box-shadow: 0 24px 70px rgba(13, 27, 53, 0.28); }
dialog::backdrop { background: rgba(13, 27, 53, 0.52); backdrop-filter: blur(3px); }
dialog form { padding: 28px; text-align: center; }
.dialog-mark { width: 42px; height: 42px; display: grid; place-items: center; margin: 0 auto 14px; border-radius: 50%; color: var(--danger); background: #fff0ef; font-size: 1.4rem; }
dialog h2 { margin: 0; color: var(--navy-950); font-family: "Mishpacha Display", serif; }
dialog p { color: var(--muted); }
dialog form > div:last-child { display: flex; justify-content: center; gap: 10px; margin-top: 20px; }

@media (max-width: 860px) {
  .workspace { grid-template-columns: 1fr; width: min(720px, calc(100% - 28px)); padding-top: 28px; }
  .journey { position: static; order: -1; padding: 15px; }
  .journey-kicker, .journey h2, .journey li div { display: none; }
  .journey ol { grid-template-columns: repeat(7, 1fr); gap: 5px; }
  .journey li { display: grid; grid-template-columns: 1fr; padding: 3px; place-items: center; }
}

@media (max-width: 560px) {
  .site-header { min-height: 74px; padding: 12px 16px; }
  .brand-mark { width: 42px; height: 42px; }
  .brand small, .header-hebrew { display: none; }
  .brand strong { font-family: inherit; font-size: 1rem; }
  .workspace { width: calc(100% - 22px); padding: 18px 0 42px; }
  .question-card { min-height: 450px; padding: 24px 19px; border-radius: 19px; }
  .question-number { margin-bottom: 20px; }
  .question-copy h1 { font-size: 1.72rem; }
  .question-body { margin-top: 25px; }
  .choice-grid { grid-template-columns: 1fr; }
  .person-answer { grid-template-columns: minmax(0, 1fr) 86px; }
  .people-list-header, .people-list-row { grid-template-columns: minmax(0, 1fr) 67px 48px 48px; gap: 4px; }
  .people-list.simple .people-list-header, .people-list.simple .people-list-row { grid-template-columns: minmax(0, 1fr) 67px; }
  .people-list-header { padding: 0 7px; font-size: 0.68rem; }
  .people-list-row { padding: 5px 7px; }
  .answer-input, .answer-select { height: 54px; padding: 0 12px; }
  .button { min-height: 46px; padding: 0 18px; }
  .journey ol { gap: 1px; }
  .journey li > span { width: 26px; height: 26px; }
}

@media print {
  @page { size: letter; margin: 0.34in; }
  html, body { width: 100%; margin: 0; background: white; }
  .site-header, .workspace, dialog { display: none !important; }
  .print-sheet { width: 100%; height: 10.28in; display: block; position: relative; box-sizing: border-box; padding: 0.14in 0.22in 0.3in; border: 1.5px solid #b99843; outline: 4px double #e2d7b7; outline-offset: -7px; color: #111d31; background: white; font-family: "Mishpacha Sans", Arial, sans-serif; overflow: hidden; }
  .bsd { margin: 0; padding-left: 2px; font-size: 8pt; text-align: right; }
  .print-sheet header { margin: -2px 0 0.1in; text-align: center; }
  .print-sheet header > p { margin: 0 0 2px; color: #82651e; font-size: 8.5pt; font-weight: 750; }
  .print-sheet header h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 20pt; font-weight: 500; letter-spacing: 0.01em; }
  #print-family:empty { display: none; }
  .print-rule { display: flex; align-items: center; gap: 8px; margin: 6px auto 0; color: #a47d20; }
  .print-rule::before, .print-rule::after { content: ""; height: 1px; flex: 1; background: linear-gradient(90deg, transparent, #b99843, transparent); }
  #print-groups { height: 8.92in; columns: 2; column-gap: 0.25in; column-rule: 1px solid #e7dfca; column-fill: auto; }
  .print-group { break-inside: auto; margin: 0 0 6px; padding: 0 0 6px; border-bottom: 1px solid #e9e3d3; }
  .print-group + .print-group { padding-top: 2px; }
  .print-items { gap: 3px; font-size: 9.7pt; line-height: 1.22; }
  .print-items .family-unit { break-inside: avoid; padding: 3px 6px; border-right: 2px solid #b48d32; border-radius: 3px; background: #fbfaf6; }
  .print-items .family-adults { font-size: 9.7pt; line-height: 1.25; }
  .print-items .family-children { margin-top: 1px; font-size: 8.7pt; line-height: 1.25; }
  .print-items .family-descendants { gap: 2px; margin-top: 2px; padding-right: 6px; }
  .print-items .family-descendants .family-unit { padding: 2px 4px; background: white; }
  .print-items .standalone-child { padding: 1px 6px 1px 0; }
  .print-items .name-line { break-inside: avoid; margin: 0; padding: 1px 4px; font-size: 9.7pt; }
  .print-sheet[data-density="compact"] #print-groups, .print-sheet[data-density="tight"] #print-groups { columns: 3; column-gap: 0.18in; }
  .print-sheet[data-density="compact"] .print-items { font-size: 8.7pt; }
  .print-sheet[data-density="compact"] .print-items .family-adults, .print-sheet[data-density="compact"] .print-items .name-line { font-size: 8.7pt; }
  .print-sheet[data-density="compact"] .print-items .family-children { font-size: 7.9pt; }
  .print-sheet[data-density="tight"] .print-items { gap: 2px; font-size: 7.7pt; line-height: 1.12; }
  .print-sheet[data-density="tight"] .print-items .family-unit { padding: 2px 4px; }
  .print-sheet[data-density="tight"] .print-items .family-adults, .print-sheet[data-density="tight"] .print-items .name-line { font-size: 7.7pt; line-height: 1.15; }
  .print-sheet[data-density="tight"] .print-items .family-children { font-size: 7.1pt; line-height: 1.15; }
  .print-sheet footer { position: absolute; right: 0.24in; bottom: 0.13in; left: 0.24in; display: flex; align-items: center; gap: 8px; color: #80631c; font-size: 7.5pt; }
  .print-sheet footer span { height: 1px; flex: 1; background: #d5c695; }
  .print-sheet footer p { margin: 0; }
}

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
