:root {
  color-scheme: light;
  --paper: #def1f3;
  --surface: #f6fbfb;
  --blue: #173d8e;
  --ink: #172b53;
  --muted: #3d5069;
  --aqua: #9fe1e9;
  --line: #839bab;
  --soft-line: #acc6d2;
  --heading-font: Fraunces, Georgia, 'Times New Roman', serif;
  --body-font: Manrope, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 1rem/1.6 var(--body-font);
}

a {
  color: var(--blue);
  text-underline-offset: .2em;
}

:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 4px;
}

h1, h2, h3, p, ul {
  margin-top: 0;
}

h1, h2 {
  color: var(--blue);
  font-family: var(--heading-font);
  font-weight: 570;
  line-height: 1.02;
  letter-spacing: -.045em;
}

h1 {
  max-width: 18ch;
  margin-bottom: 1.2rem;
  font-size: clamp(2.45rem, 7vw, 4.25rem);
}

h2 {
  margin-bottom: 1.55rem;
  font-size: clamp(1.65rem, 4vw, 2.25rem);
}

h3 {
  margin-bottom: .5rem;
  color: var(--blue);
  font-size: 1.05rem;
  line-height: 1.4;
}

p {
  margin-bottom: .85rem;
}

.shell {
  width: min(100% - 2rem, 54rem);
  margin-inline: auto;
}

.topbar {
  border-bottom: 1px solid var(--soft-line);
  background: var(--blue);
  font-size: .925rem;
  font-weight: 650;
}

.topbar .shell {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0 1.25rem;
  padding-block: .25rem;
}

.topbar a {
  color: #fff;
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
}

.topbar a:focus-visible {
  outline-color: #ffdf93;
}

.top-phone {
  white-space: nowrap;
}

.intro {
  max-width: 41rem;
  padding-block: clamp(2rem, 6vw, 4rem) 2rem;
}

.clinic-name {
  margin-bottom: .6rem;
  color: var(--muted);
  font-weight: 650;
}

.print-details {
  display: none;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
  margin-top: 1.35rem;
}

.button {
  display: inline-flex;
  min-height: 2.9rem;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--blue);
  border-radius: .4rem;
  padding: .55rem .95rem;
  background: var(--surface);
  color: var(--blue);
  font: 650 .95rem/1.3 var(--body-font);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.button[hidden] {
  display: none;
}

.button.primary {
  background: var(--blue);
  color: var(--surface);
}

.button:hover {
  background: var(--aqua);
  color: var(--blue);
}

.questionnaire {
  display: grid;
  gap: 1rem;
}

.panel {
  border: 1px solid var(--soft-line);
  border-radius: .9rem;
  padding: clamp(1rem, 4vw, 2rem);
  background: var(--surface);
}

.fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.15rem 1.2rem;
}

.span-all {
  grid-column: 1 / -1;
}

.field {
  min-width: 0;
}

.field > label, .signature > span:first-child, legend, .group-label {
  display: block;
  margin-bottom: .35rem;
  color: var(--blue);
  font-weight: 650;
  line-height: 1.4;
}

.field input, textarea {
  display: block;
  width: 100%;
  min-height: 2.85rem;
  border: 1px solid var(--line);
  border-radius: .35rem;
  padding: .55rem .65rem;
  background: #fff;
  color: var(--ink);
  font: inherit;
  line-height: 1.35;
}

textarea {
  min-height: 4.15rem;
  resize: vertical;
}

.print-value, .print-legend {
  display: none;
}

.options {
  min-width: 0;
  margin: 0;
  border: 0;
  padding: 0;
}

.options legend {
  padding: 0;
}

.option-list {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}

.option {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  min-height: 2.75rem;
  border: 1px solid var(--soft-line);
  border-radius: .35rem;
  padding: .25rem .65rem;
  cursor: pointer;
}

.option:hover, .option:has(input:checked) {
  border-color: var(--line);
  background: var(--aqua);
}

.option:has(:focus-visible) {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

.option input {
  flex: none;
  width: 1.05rem;
  height: 1.05rem;
  margin: 0;
  accent-color: var(--blue);
}

.option input:focus-visible {
  outline-offset: 1px;
}

.group-label {
  margin: .2rem 0 -.4rem;
}

.policy-rates {
  margin: 1.3rem 0;
  border-left: .25rem solid var(--aqua);
  padding: .65rem 1rem;
  background: var(--paper);
}

.policy-rates ul {
  margin-bottom: .6rem;
  padding-left: 1.2rem;
}

.policy-rates p {
  margin-bottom: 0;
}

.signature-fields {
  margin-top: 1rem;
}

.signature {
  display: flex;
  flex-direction: column;
}

.signature-line {
  flex: 1;
  min-height: 2.75rem;
  border-bottom: 1px solid var(--line);
}

.bottom-actions {
  margin-bottom: 3rem;
}

@media (max-width: 39rem) {
  .fields {
    grid-template-columns: minmax(0, 1fr);
  }

  .actions .button {
    width: 100%;
  }
}

@page {
  size: letter;
  margin: 11mm 12mm;
}

@media print {
  :root {
    --paper: #fff;
    --surface: #fff;
    --ink: #000;
    --blue: #000;
    --muted: #000;
    --line: #555;
    --soft-line: #aaa;
  }

  body {
    background: #fff;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 9.5pt;
    line-height: 1.22;
  }

  .shell {
    width: auto;
  }

  .topbar, .actions, .intro > p:not(.clinic-name, .print-details) {
    display: none;
  }

  .intro {
    max-width: none;
    padding: 0 0 4pt;
  }

  .clinic-name {
    margin-bottom: 2pt;
  }

  h1 {
    max-width: none;
    margin: 0 0 3pt;
    font-size: 20pt;
  }

  h2 {
    margin-bottom: 3pt;
    border-bottom: 1px solid var(--soft-line);
    padding-bottom: 1pt;
    font-size: 13pt;
    break-after: avoid;
  }

  h3 {
    margin-bottom: 4pt;
    font-size: 10pt;
    break-after: avoid;
  }

  .print-details {
    display: block;
    margin-bottom: 3pt;
  }

  .questionnaire {
    display: block;
  }

  .panel {
    margin-bottom: 5pt;
    border: 0;
    border-radius: 0;
    padding: 0;
  }

  .print-sheet-start {
    break-before: page;
  }

  .fields {
    display: block;
  }

  .field, .options, .group-label, .signature {
    clear: both;
    margin: 0 0 2pt;
    break-inside: avoid;
  }

  .field:not(.span-all), .signature, .options:not(.span-all) {
    display: inline-block;
    width: 48%;
    margin-right: 1%;
    vertical-align: top;
  }

  .field > label, .signature > span:first-child, .options legend, .group-label {
    margin-bottom: 0;
    line-height: 1.22;
  }

  .field > label {
    break-after: avoid;
  }

  .field:has(textarea), .fields .field.print-expanded {
    display: block;
    width: auto;
    margin-right: 0;
    break-inside: auto;
  }

  .field:not(:has(textarea)) > label {
    display: inline;
  }

  .has-print-values .field input, .has-print-values .field textarea {
    display: none;
  }

  .field input, .field textarea {
    min-height: 11pt;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    padding: 0;
  }

  .print-value {
    display: block;
    min-height: 12pt;
    border-bottom: 1px solid var(--line);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    orphans: 2;
    widows: 2;
  }

  .field:not(:has(textarea)) > .print-value {
    display: inline;
    border: 0;
  }

  .field:not(:has(textarea)) > .print-value:empty::before {
    display: inline-block;
    width: min(35%, 15em);
    height: .8em;
    border-bottom: 1px solid var(--line);
    content: "";
  }

  .field:has(#nom, #adresse, #courriel) > .print-value:empty::before {
    width: min(60%, 24em);
  }

  .field:has(#antecedents-personnels) .print-value:empty {
    min-height: 21pt;
  }

  .option-list {
    display: block;
  }

  .has-print-values .options legend {
    display: none;
  }

  .print-legend {
    display: inline;
    margin-right: .5em;
    font-weight: 650;
  }

  .options:not(.span-all) .print-legend {
    display: block;
    margin-right: 0;
  }

  .option, .option:has(input:checked) {
    display: inline-block;
    min-height: 0;
    margin-right: 8pt;
    border: 0;
    padding: 0;
    background: #fff;
  }

  .option input {
    display: none;
  }

  .option span::before {
    display: inline-flex;
    width: 8pt;
    height: 8pt;
    align-items: center;
    justify-content: center;
    margin-right: 3pt;
    border: 1px solid #222;
    content: "";
    vertical-align: -.04em;
  }

  .option input[type="radio"] + span::before {
    border-radius: 50%;
  }

  .option input:checked + span::before {
    content: "×";
    font: bold 8pt/1 var(--body-font);
  }

  .policies p, .policies li {
    orphans: 2;
    widows: 2;
  }

  .policies p {
    margin-bottom: 4pt;
  }

  .policy-rates {
    margin-block: 4pt;
    border: 1px solid var(--soft-line);
    padding: 3pt 6pt;
    break-inside: avoid;
  }

  .policy-rates p {
    margin-bottom: 0;
  }

  .policy-rates ul {
    margin-bottom: 3pt;
  }

  .signature-fields {
    margin-top: 4pt;
  }

  .signature {
    margin-top: 2pt;
  }

  .signature-line {
    display: block;
    min-height: 20pt;
  }
}
