/* ============================================================
   PAGE: ONLINE REFERRAL FORM (refer-radiology.html)
   Material-style OUTLINED fields on the site tokens: r-md (12)
   outlines, 48px control height, t-body text, the label floats
   from the placeholder position into a notch in the outline.
   ============================================================ */

/* hero → form: one continuous paper surface, the gap comes from .refer-band's padding-top */
.refer-hero{padding-bottom: 0; text-align: center}
.refer-hero .eyebrow{color: var(--c-purple)}   /* radiology-branded page */
.refer-hero-heart .eyebrow{color: var(--c-red)}   /* heartcare-branded page */
.refer-hero-book .eyebrow{color: var(--c-red)}   /* patient booking page — patient-brand red */
.refer-hero .lead{margin-inline: auto}   /* .hero .lead caps at 900px — keep it centred too */
.refer-band{background: var(--c-paper); padding: var(--s-8) var(--section-px) var(--section-pb)}
@media (min-width: 600px){ .refer-band{padding-top: var(--s-10)} }

.refer-form{max-width: 900px; margin: 0 auto; display: grid; gap: var(--gap-subblock)}   /* width = the hero lead cap (900); 24 between the section cards — sub-blocks of one form, not independent grid cards */

/* section card — phone keeps the tighter card padding */
.rf-block{
  background: var(--c-white);
  background-clip: padding-box;   /* translucent border composites over the warm band bg, not white (the .why-grid / .stat-strip rule) */
  border: 1px solid var(--c-rule);
  border-radius: var(--r-xl);
  padding: var(--card-pad);
  display: grid; gap: var(--gap-text);
}
@media (min-width: 600px){ .rf-block{padding: var(--card-pad-lg)} }
.rf-block[hidden], .rf-duo[hidden], .rf-ynrow[hidden], .rf-field[hidden]{display: none}

/* labelled sub-groups inside the examination card (heartcare) — an eyebrow
   caption over each cluster instead of the paper form's bare rules */
.rf-sub{display: grid; gap: var(--gap-eyebrow)}
.rf-sub-label{color: var(--c-navy-60)}
.rf-sub + .rf-sub{border-top: 1px solid var(--c-rule); padding-top: var(--gap-subblock)}

/* booking form — the Radiology/HeartCare switcher panels + the service-agnostic
   "something else" option under its own separator */
.rf-block .svc-tabs{justify-self: start}   /* the rf-block grid stretches children; the switcher hugs its tabs */
.rf-svc-panel[hidden]{display: none}
.rf-svc-other{border-top: 1px solid var(--c-rule); padding-top: var(--s-3)}

/* selected-services counter on each tab (booking form only — About tabs carry no badge) */
.rf-block .svc-count{
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 22px; padding: 0 6px; margin-left: 2px;
  border-radius: var(--r-pill);
  font-size: var(--fs-micro); font-weight: var(--fw-medium); line-height: 1;
}
.rf-block .svc-count[hidden]{display: none}
.rf-block .svc-tab.rad .svc-count{background: var(--c-purple); color: var(--c-white)}
.rf-block .svc-tab.heart .svc-count{background: var(--c-red); color: var(--c-white)}
.rf-block .svc-tab.is-active .svc-count{background: var(--c-white)}
.rf-block .svc-tab.rad.is-active .svc-count{color: var(--c-purple)}
.rf-block .svc-tab.heart.is-active .svc-count{color: var(--c-red)}

/* section head */
.rf-head h2{color: var(--c-navy)}             /* text style: .t-h3 */

/* ---- field grid ----
   phone: single column; portrait tablet: two columns (a 6-col grid squeezes
   the date fields under 160px); ≥905: the full 6-column layout */
.rf-grid{display: grid; grid-template-columns: 1fr; gap: var(--s-4)}   /* phone: 16 — a single stacked column reads too airy at 24 */
@media (min-width: 600px){
  .rf-grid{gap: var(--gap-subblock)}   /* 24 — STYLEGUIDE §3: поле → поле в группе */
}
@media (min-width: 600px) and (max-width: 904.98px){
  .rf-grid{grid-template-columns: repeat(2, 1fr)}
  .rf-span4, .rf-span6{grid-column: 1 / -1}
  /* patient grid: pair the half-width fields (dob+sex, medicare+telephone) so the
     full-width name/address rows don't strand them next to empty cells */
  .rf-grid-patient > :nth-child(2){order: 1}   /* date of birth */
  .rf-grid-patient > :nth-child(4){order: 2}   /* sex */
  .rf-grid-patient > :nth-child(3){order: 3}   /* address */
  .rf-grid-patient > :nth-child(5){order: 4}   /* medicare */
  .rf-grid-patient > :nth-child(6){order: 5}   /* telephone */
}
@media (min-width: 905px){
  .rf-grid{grid-template-columns: repeat(6, 1fr)}
  .rf-span2{grid-column: span 2}
  .rf-span3{grid-column: span 3}
  .rf-span4{grid-column: span 4}
  .rf-span6{grid-column: span 6}
}
.rf-field{display: flex; flex-direction: column; gap: var(--gap-eyebrow)}   /* 8 — control → error */

/* ---- outlined controls ---- */
.rf-control{position: relative}
.rf-input, .rf-area{
  width: 100%;
  font-family: var(--ff-primary); font-size: var(--fs-body); line-height: var(--lh-body);
  color: var(--c-navy);
  background: var(--c-white);
  border: 1px solid var(--c-navy-a18);
  border-radius: var(--r-md);
  height: 48px; padding: 0 var(--s-4);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.rf-area{height: auto; min-height: 180px; padding: var(--s-3) var(--s-4); resize: vertical; display: block}
.rf-input:focus-visible, .rf-area:focus-visible{
  outline: none;
  border-color: var(--c-navy);
  box-shadow: 0 0 0 3px var(--c-navy-a10);
}
/* native date fields: keep the navy text (WebKit greys them out) and swap the
   grey UA calendar glyph for a navy one */
.rf-input::-webkit-datetime-edit{color: var(--c-navy)}
.rf-input::-webkit-calendar-picker-indicator{
  width: 20px; height: 20px; cursor: pointer;
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23020344' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='3'/%3E%3Cpath d='M16 3v4M8 3v4M3 11h18'/%3E%3C/svg%3E") center / 20px 20px no-repeat;
}

/* the floating label: starts where a placeholder sits, floats up into a notch
   cut into the outline (its white background masks the border line) */
.rf-label{
  position: absolute; left: calc(var(--s-4) - 4px); top: 50%;
  transform: translateY(-50%);
  max-width: calc(100% - var(--s-4)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: 0 4px;
  background: var(--c-white);
  color: var(--c-navy-60);
  font-size: var(--fs-body); line-height: var(--lh-eyebrow);
  pointer-events: none;
  transition: top .15s ease, font-size .15s ease, color .15s ease;
}
.rf-control-area .rf-label{top: 24px}   /* textarea: centred on the first text line */
.rf-input:focus ~ .rf-label,
.rf-input:not(:placeholder-shown) ~ .rf-label,
.rf-area:focus ~ .rf-label,
.rf-area:not(:placeholder-shown) ~ .rf-label,
.rf-static .rf-label{
  top: 0;
  font-size: var(--fs-micro); font-weight: var(--fw-medium);
}
.rf-input:focus ~ .rf-label,
.rf-area:focus ~ .rf-label{color: var(--c-navy)}
.rf-label .req{color: var(--c-warn)}

/* small static label for radio/checkbox groups (matches the floated label size) */
.rf-group-label{display: block; font-size: var(--fs-micro); font-weight: var(--fw-medium); line-height: var(--lh-micro); color: var(--c-navy-60)}

/* segmented control (Sex) — an outlined 48px control like the inputs; the two
   options split the track, the picked one fills navy */
.rf-seg{
  display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-1);
  height: 48px; padding: var(--s-1);
  background: var(--c-white);
  border: 1px solid var(--c-navy-a18);
  border-radius: var(--r-pill);   /* fully rounded, like the Patient/Referrer toggle */
}
.rf-seg-opt{position: relative; display: grid}
.rf-seg-opt input{position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: pointer}
.rf-seg-opt span{
  display: grid; place-items: center;
  border-radius: var(--r-pill);
  font-size: var(--fs-small); font-weight: var(--fw-medium); color: var(--c-navy);
  transition: background .15s ease, color .15s ease;
}
.rf-seg-opt input:checked + span{background: var(--c-navy); color: var(--c-white)}
/* Sex options: blue / pink pulled to the radiology purple's hue neighbours */
.rf-seg-opt input[value="Male"]:checked + span{background: #3d56b2}     /* clearly blue, still tinted toward --c-purple */
.rf-seg-opt input[value="Female"]:checked + span{background: #b5459b}   /* magenta-pink neighbour of --c-purple */
.rf-seg-opt input:focus-visible + span{box-shadow: 0 0 0 3px var(--c-navy-a10)}

/* ---- checkboxes & radios — 24px squares (r-sm), 44px touch rows ---- */
.rf-check{
  display: inline-flex; align-items: flex-start; gap: var(--gap-icon);
  padding: var(--s-3) 0;                /* symmetric breathing whatever the line count; 12+24+12 = 48px tap height */
  cursor: pointer; color: var(--c-navy);
  font-size: var(--fs-body); line-height: var(--lh-eyebrow);
}
.rf-check span{line-height: var(--lh-h4)}   /* 1.3 — wrapped two-line labels don't glue together */
.rf-check .rf-box{margin-top: -2px}   /* the 24px box sits centred on the FIRST text line (20.8px), not on the whole wrapped label */
.rf-box{
  appearance: none; -webkit-appearance: none;
  width: 24px; height: 24px; flex-shrink: 0; margin: 0;
  background: var(--c-white);
  border: 1px solid var(--c-navy-a18);
  border-radius: var(--r-sm);
  cursor: pointer;
  display: grid; place-items: center;
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.rf-box:focus-visible{outline: none; border-color: var(--c-navy); box-shadow: 0 0 0 3px var(--c-navy-a10)}
.rf-box:checked{background: var(--c-navy); border-color: var(--c-navy)}
/* the tick is a stroked path at the SAME visual weight as the button arrow
   (1.5 units on a 24 box rendered at 24px = 1.5px; here 14/14 = 1.5px too) */
.rf-box:checked::after{
  content: "";
  width: 14px; height: 14px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14' fill='none' stroke='white' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.5 7.8l3 3L11.5 4.2'/%3E%3C/svg%3E") center / contain no-repeat;
}
/* semantic Yes / No: green / red fills (only the Y/N radios carry these values) */
.rf-box[value="Yes"]:checked{background-color: var(--c-success); border-color: var(--c-success)}
.rf-box[value="No"]:checked{background-color: var(--c-warn); border-color: var(--c-warn)}
.rf-inline{display: flex; align-items: center; gap: var(--s-6)}

/* the examination checklist — natural chip-like flow: items keep their own width,
   long labels ("Body Composition Analysis") never wrap mid-name */
.rf-checks{display: flex; flex-wrap: wrap; column-gap: var(--s-7)}
@media (max-width: 599.98px){ .rf-checks{flex-direction: column; column-gap: 0} }
/* two-column variant (heartcare exam card — mirrors the paper form's columns) */
@media (min-width: 600px){
  .rf-checks-2{display: grid; grid-template-columns: 1fr 1fr; column-gap: var(--grid-gap)}
  .rf-checks-2 .rf-check-wide{grid-column: 1 / -1}   /* long item takes the full row instead of wrapping in a half column */
}

/* Y/N safety items — question on top (medium, reads as the item's own label),
   Yes/No row under it; 24 between items so each pair stays visually grouped */
.rf-ynlist{display: grid; gap: var(--gap-text) var(--grid-gap)}
.rf-yn-q{display: block; color: var(--c-navy); font-size: var(--fs-body); font-weight: var(--fw-medium); line-height: var(--lh-body)}
/* single-question variant (CT metformin): question and Yes/No on ONE line;
   wraps naturally on narrow screens, the error message takes its own row */
.rf-ynrow{display: flex; flex-wrap: wrap; align-items: center; column-gap: var(--s-6)}
.rf-ynrow .rf-error{flex-basis: 100%}

/* MRI safety / CT scan appear only when requested. They stack under each other like
   every other section card (--gap-subblock, same as the form stack) and use two inner
   columns for their fields on desktop instead of narrowing the whole card. */
.rf-duo{display: grid; grid-template-columns: 1fr; gap: var(--gap-subblock)}
@media (min-width: 905px){
  .rf-ynlist{grid-template-columns: 1fr 1fr; column-gap: var(--grid-gap)}
}

/* ---- invalid state — --c-warn outline, label and message ---- */
.rf-error{display: none; color: var(--c-warn)}   /* text style: .t-small */
.invalid > .rf-error, .invalid .rf-error{display: block}
.rf-field.invalid .rf-input,
.rf-field.invalid .rf-area{border-color: var(--c-warn)}
.rf-field.invalid .rf-label{color: var(--c-warn)}
.rf-field.invalid .rf-input:focus-visible,
.rf-field.invalid .rf-area:focus-visible{box-shadow: 0 0 0 3px var(--c-red-a10)}
.rf-group.invalid .rf-box{border-color: var(--c-warn)}
/* when the invalid group is a whole CARD (the examination checklist), outline the card
   itself and leave its checkboxes alone */
.rf-block.rf-group.invalid{border-color: var(--c-warn)}
.rf-block.rf-group.invalid .rf-box{border-color: var(--c-navy-a18)}

/* Off-screen spam trap: visible to simple bots, inaccessible to people. */
.form-honeypot{
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---- submit row — button on the right under the form ---- */
/* ---- file upload — outlined drop-style control (contact + booking forms) ---- */
.rf-upload{
  display: flex; align-items: center; gap: var(--gap-icon);
  min-height: 48px; padding: 0 var(--s-4);
  border: 1px dashed var(--c-navy-a30);
  border-radius: var(--r-md);
  color: var(--c-navy-60);
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.rf-upload input{position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none}
.rf-upload .icon{width: 20px; height: 20px; transform: rotate(180deg); flex-shrink: 0}   /* the download arrow, pointing up = upload */
.rf-upload-text{font-size: var(--fs-body); line-height: var(--lh-eyebrow); overflow: hidden; text-overflow: ellipsis; white-space: nowrap}
.rf-upload:hover{border-color: var(--c-navy); color: var(--c-navy)}
.rf-upload:focus-within{border-color: var(--c-navy); color: var(--c-navy); box-shadow: 0 0 0 3px var(--c-navy-a10)}
.rf-upload.has-file{border-style: solid; border-color: var(--c-navy-a30); color: var(--c-navy)}
.rf-hint{color: var(--c-navy-60)}
.rf-field.invalid .rf-upload{border-color: var(--c-warn); color: var(--c-warn)}
.rf-field.invalid .rf-hint{display: none}   /* the error message replaces the hint */

/* APP 5 collection notice shown next to every online form's submit action */
.rf-privacy{color: var(--c-navy-60)}
.rf-privacy a{color: inherit; text-decoration: underline; text-underline-offset: 3px}

/* notice left, button right; on phone the notice takes the full row and the button drops below */
.rf-actions{display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; column-gap: var(--gap-block); row-gap: var(--gap-text)}
.rf-actions .rf-privacy{flex: 1; min-width: 300px; max-width: 640px}
.rf-submit-error{flex-basis: 100%; color: var(--c-warn)}
.rf-submit-error a{color: inherit; font-weight: 700; text-decoration: underline}
.rf-actions .btn:disabled{opacity: .65; cursor: wait}
@media (max-width: 599.98px){
  .rf-actions .btn{width: 100%; justify-content: center}   /* full-width primary on phone */
}

/* ============================================================
   SUCCESS PAGE (referral-sent.html)
   ============================================================ */
.sent-hero{padding-top: var(--section-pb)}   /* top gap = the inter-section space (80/120), not a 60vh hero centring */
.sent-icon{
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--c-success); color: var(--c-white);
  display: grid; place-items: center;
  margin-bottom: var(--s-7);
}
.sent-icon .icon{width: 28px; height: 28px}
