/* HEAL Forms */
:root {
  color-scheme: light;
  --navy: #10294A;
  --navy-2: #1C3B63;
  --teal: #0B7A75;
  --teal-soft: #E2F1F0;
  --yellow: #F4B400;
  --yellow-soft: #FFF4D1;
  --green: #23855A;
  --green-soft: #E3F3EA;
  --red: #B3261E;
  --red-soft: #FBE9E7;
  --ink: #17202B;
  --muted: #566272;
  --line: #C6D0D9;
  --line-soft: #E3E8ED;
  --wash: #F2F5F8;
  --paper: #FFFFFF;
  --display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius-s: 6px;
  --radius-m: 10px;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--body);
  font-size: 1rem;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
}

img { max-width: 100%; height: auto; }

a { color: var(--teal); text-underline-offset: 0.18em; }
a:hover { color: var(--navy); }

:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }

h1, h2, h3 {
  font-family: var(--display);
  line-height: 1.15;
  color: var(--navy);
  margin: 0 0 0.5em;
}
h1 { font-size: clamp(1.9rem, 5vw, 2.75rem); font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 1.45rem; font-weight: 700; }
h3 { font-size: 1.12rem; font-weight: 700; }
p { margin: 0 0 1em; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}

.skip-link { position: absolute; left: 1rem; top: -4rem; background: var(--yellow); color: var(--navy); padding: 0.6rem 1rem; z-index: 10; }
.skip-link:focus { top: 0.5rem; }

/* Top bar */
.topbar { border-bottom: 1px solid var(--line-soft); background: var(--paper); }
.topbar-inner {
  max-width: 76rem; margin: 0 auto; padding: 0.85rem 1.25rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}
.wordmark { font-family: var(--display); font-weight: 700; font-size: 1.15rem; color: var(--navy); text-decoration: none; }
.wordmark span { color: var(--teal); font-weight: 600; }
.topnav { display: flex; gap: 1.1rem; align-items: center; flex-wrap: wrap; font-size: 0.95rem; }
.topnav a { color: var(--ink); text-decoration: none; }
.topnav a:hover, .topnav a[aria-current="page"] { color: var(--teal); text-decoration: underline; }

.wrap { max-width: 44rem; margin: 0 auto; padding: 2rem 1.25rem 4rem; }
.wrap-wide { max-width: 76rem; margin: 0 auto; padding: 1.75rem 1.25rem 4rem; }

/* Form hero: the program title on navy, with the yellow progress rule beneath */
.hero { background: var(--navy); color: #fff; }
.hero-inner { max-width: 44rem; margin: 0 auto; padding: 2.5rem 1.25rem 1.75rem; }
.hero .program { color: #9FD9D4; font-weight: 600; margin-bottom: 0.4rem; }
.hero h1 { color: #fff; max-width: 18ch; }
.hero .meta { color: #D5DEE8; margin: 0; }
.rule { height: 10px; background: var(--navy-2); }
.rule-fill { height: 100%; width: 0; background: var(--yellow); transition: width 420ms ease; }
@media (prefers-reduced-motion: reduce) { .rule-fill { transition: none; } }

.intro { white-space: pre-line; margin-bottom: 1.25rem; }

/* Steps */
.steps { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: 1.25rem; }
.steps .count { color: var(--muted); font-size: 0.95rem; }
.save-state { font-size: 0.9rem; color: var(--muted); }
.save-state[data-state="error"] { color: var(--red); }

/* Fields */
.field { margin-block-end: 1.75rem; }
.field > label, .field legend {
  display: block; font-weight: 650; margin-bottom: 0.3rem; color: var(--ink); padding: 0;
}
.field .req { color: var(--red); font-weight: 600; }
.field .hint { color: var(--muted); font-size: 0.94rem; margin: 0 0 0.5rem; white-space: pre-line; }
.field .error { color: var(--red); font-weight: 600; font-size: 0.94rem; margin: 0.45rem 0 0; }
.field .error:empty { display: none; }
.field .error::before { content: "! "; }
fieldset.field { border: 0; margin-inline: 0; padding: 0; min-width: 0; }

input[type="text"], input[type="email"], input[type="tel"], input[type="url"],
input[type="date"], input[type="datetime-local"], input[type="number"], input[type="search"],
select, textarea {
  width: 100%;
  font: inherit;
  font-size: max(1rem, 1em);
  padding: 0.7rem 0.8rem;
  min-height: 48px;
  border: 1.5px solid #8A97A6;
  border-radius: var(--radius-s);
  background: var(--paper);
  color: var(--ink);
}
textarea { min-height: 9rem; resize: vertical; line-height: 1.5; }
select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--navy) 50%), linear-gradient(135deg, var(--navy) 50%, transparent 50%);
  background-position: calc(100% - 20px) 55%, calc(100% - 14px) 55%;
  background-size: 6px 6px; background-repeat: no-repeat; padding-right: 2.5rem;
}
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--teal); }
input:user-invalid, select:user-invalid, textarea:user-invalid,
[aria-invalid="true"] { border-color: var(--red); background-color: #FFFBFA; }

.choices { display: grid; gap: 0.35rem; }
.choice {
  display: flex; gap: 0.7rem; align-items: flex-start;
  padding: 0.65rem 0.8rem; border: 1.5px solid var(--line); border-radius: var(--radius-s); cursor: pointer;
}
.choice:has(input:checked) { border-color: var(--teal); background: var(--teal-soft); }
.choice input { width: 1.2rem; height: 1.2rem; margin: 0.15rem 0 0; accent-color: var(--teal); flex: none; }
.choice label { cursor: pointer; flex: 1; }
.consent { border-style: dashed; }

.counter { font-size: 0.88rem; color: var(--muted); margin-top: 0.35rem; }
.counter[data-over="true"] { color: var(--red); font-weight: 600; }

.files { list-style: none; margin: 0 0 0.6rem; padding: 0; display: grid; gap: 0.4rem; }
.files li { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; padding: 0.5rem 0.75rem; background: var(--wash); border-radius: var(--radius-s); }
.files .name { overflow-wrap: anywhere; }
.upload-state { font-size: 0.9rem; color: var(--muted); margin-top: 0.35rem; }

.section-block { margin: 2.25rem 0 1.25rem; padding-top: 1.25rem; border-top: 3px solid var(--teal); }
.section-block:first-child { margin-top: 0; }
.section-block p { color: var(--muted); white-space: pre-line; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  font: inherit; font-weight: 650; min-height: 48px; padding: 0.65rem 1.25rem;
  border-radius: var(--radius-s); border: 2px solid var(--navy);
  background: var(--navy); color: #fff; cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--navy-2); color: #fff; }
.btn.secondary { background: var(--paper); color: var(--navy); }
.btn.secondary:hover { background: var(--wash); }
.btn.quiet { background: transparent; border-color: transparent; color: var(--teal); padding-inline: 0.5rem; text-decoration: underline; }
.btn.danger { background: var(--paper); color: var(--red); border-color: var(--red); }
.btn.small { min-height: 36px; padding: 0.3rem 0.75rem; font-size: 0.9rem; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.actions { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: center; margin-top: 2rem; }
.actions .push { margin-left: auto; }

/* Messages */
.notice { padding: 1rem 1.15rem; border-radius: var(--radius-m); border-left: 6px solid var(--teal); background: var(--teal-soft); margin-bottom: 1.5rem; }
.notice.warn { border-color: var(--yellow); background: var(--yellow-soft); }
.notice.error { border-color: var(--red); background: var(--red-soft); }
.notice.good { border-color: var(--green); background: var(--green-soft); }
.notice h2, .notice h3 { margin-top: 0; }
.notice > :last-child { margin-bottom: 0; }
.error-summary ul { margin: 0.25rem 0 0; padding-left: 1.2rem; }

.reference { font-family: var(--display); font-size: 2rem; font-weight: 700; color: var(--navy); letter-spacing: 0.02em; }

.toast {
  position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 0.75rem 1.1rem; border-radius: var(--radius-s);
  max-width: calc(100% - 2rem); z-index: 20;
}
.toast[data-kind="error"] { background: var(--red); }
.toast:empty { display: none; }

/* Summary of answers */
.summary { margin: 0 0 2rem; }
.summary-row { display: grid; grid-template-columns: 1fr; gap: 0.2rem; padding: 0.9rem 0; border-bottom: 1px solid var(--line-soft); }
.summary-row dt { font-weight: 650; }
.summary-row dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink); }
.summary-row dd.empty { color: var(--muted); font-style: italic; }
.summary-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-top: 1.5rem; }

/* Lists of forms and applications */
.listing { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line-soft); }
.listing > li { padding: 1.15rem 0; border-bottom: 1px solid var(--line-soft); display: flex; gap: 1rem; justify-content: space-between; align-items: center; flex-wrap: wrap; }
.listing h3 { margin: 0 0 0.2rem; }
.listing p { margin: 0; color: var(--muted); }

.pill { display: inline-block; font-size: 0.82rem; font-weight: 650; padding: 0.15rem 0.6rem; border-radius: 999px; background: var(--wash); color: var(--ink); white-space: nowrap; }
.pill.teal { background: var(--teal-soft); color: #075753; }
.pill.yellow { background: var(--yellow-soft); color: #6B4E00; }
.pill.green { background: var(--green-soft); color: #145536; }
.pill.red { background: var(--red-soft); color: var(--red); }
.pill.navy { background: var(--navy); color: #fff; }

.footer { color: var(--muted); font-size: 0.9rem; border-top: 1px solid var(--line-soft); }
.footer .wrap { padding-block: 1.5rem; }

/* Dialog */
dialog { border: 0; border-radius: var(--radius-m); padding: 0; width: min(36rem, calc(100% - 2rem)); max-height: calc(100dvh - 2rem); box-shadow: 0 20px 60px rgba(16, 41, 74, 0.25); }
dialog::backdrop { background: rgba(16, 41, 74, 0.45); }
dialog .dialog-body { padding: 1.5rem; overflow: auto; }
dialog.wide { width: min(48rem, calc(100% - 2rem)); }

/* Admin */
.admin-bar { background: var(--navy); }
.admin-bar .wordmark, .admin-bar .topnav a { color: #fff; }
.admin-bar .wordmark span { color: #9FD9D4; }
.admin-bar .topnav a:hover, .admin-bar .topnav a[aria-current="page"] { color: var(--yellow); }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.page-head h1 { font-size: clamp(1.6rem, 3.5vw, 2.2rem); margin: 0; }
.page-head p { margin: 0.25rem 0 0; color: var(--muted); }

.panel { border: 1px solid var(--line); border-radius: var(--radius-m); padding: 1.25rem; margin-bottom: 1.5rem; background: var(--paper); }
.panel > h2 { font-size: 1.2rem; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.panel-head h2 { margin: 0; font-size: 1.2rem; }

.grid-2 { display: grid; gap: 1rem 1.25rem; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }
.grid-2 .field { margin-block-end: 0.5rem; }
.span-all { grid-column: 1 / -1; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-m); }
table { border-collapse: collapse; width: 100%; font-size: 0.94rem; }
th, td { text-align: left; padding: 0.65rem 0.75rem; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
th { background: var(--wash); font-weight: 650; color: var(--navy); white-space: nowrap; position: sticky; top: 0; }
tbody tr:hover { background: #F8FAFB; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td .sub { color: var(--muted); font-size: 0.86rem; }

.toolbar { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: flex-end; margin-bottom: 1rem; }
.toolbar .field { margin: 0; min-width: 11rem; }
.toolbar .grow { flex: 1 1 16rem; }
.bulk { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; padding: 0.75rem 1rem; background: var(--yellow-soft); border-radius: var(--radius-m); margin-bottom: 1rem; }
.bulk[hidden] { display: none; }
.bulk select { width: auto; min-height: 40px; padding-block: 0.4rem; }

.q-list { list-style: none; margin: 0; padding: 0; }
.q-list > li { display: grid; grid-template-columns: 1fr auto; gap: 0.75rem; align-items: center; padding: 0.75rem 0; border-bottom: 1px solid var(--line-soft); }
.q-list .q-label { font-weight: 650; }
.q-list .q-meta { color: var(--muted); font-size: 0.88rem; }
.q-list .q-tools { display: flex; gap: 0.25rem; flex-wrap: wrap; justify-content: flex-end; }
.page-label { font-family: var(--display); font-weight: 700; color: var(--teal); margin: 1.25rem 0 0.25rem; }

.review-layout { display: grid; gap: 1.5rem; grid-template-columns: 1fr; }
@media (min-width: 62rem) {
  .review-layout { grid-template-columns: minmax(0, 1fr) 23rem; align-items: start; }
  .review-side { position: sticky; top: 1rem; }
}
.timeline { list-style: none; margin: 0; padding: 0; font-size: 0.9rem; }
.timeline li { padding: 0.45rem 0; border-bottom: 1px dashed var(--line-soft); }
.timeline time { color: var(--muted); display: block; font-size: 0.82rem; }

.score-row { display: grid; grid-template-columns: 1fr 5.5rem; gap: 0.75rem; align-items: center; padding: 0.4rem 0; }
.score-row label { font-weight: 600; }
.score-row .hint { grid-column: 1 / -1; margin: -0.2rem 0 0.2rem; color: var(--muted); font-size: 0.86rem; }

.muted { color: var(--muted); }
.stack > * + * { margin-top: 0.75rem; }
.mono-ish { font-variant-numeric: tabular-nums; }

@media (max-width: 40rem) {
  .wrap, .wrap-wide { padding-top: 1.25rem; }
  .actions .btn { flex: 1 1 auto; }
  .q-list > li { grid-template-columns: 1fr; }
  .q-list .q-tools { justify-content: flex-start; }
}

/* apply.html shown inside an iframe on another website */
.in-frame .topbar, .in-frame .footer, .in-frame .skip-link { display: none; }
.in-frame body { background: transparent; }
.in-frame .hero { border-radius: var(--radius-m) var(--radius-m) 0 0; }
.in-frame .hero-inner, .in-frame .wrap { max-width: none; }
.in-frame .wrap { padding: 1.75rem 1.25rem 2.5rem; border: 1px solid var(--line-soft); border-top: 0; border-radius: 0 0 var(--radius-m) var(--radius-m); }
.in-frame body { margin: 0; overflow-anchor: none; }

/* Timed case */
.case-bar { position: sticky; top: 0; z-index: 5; display: flex; justify-content: flex-end; align-items: baseline; gap: 0.4rem; padding: 0.6rem 0.9rem; margin: 0 0 1rem; background: var(--navy); color: #fff; border-radius: var(--radius-s); }
.case-clock { font-family: var(--display); font-size: 1.5rem; font-variant-numeric: tabular-nums; color: #fff; }
.case-clock[data-low="true"] { color: var(--yellow); }
.case-scenario { padding: 1rem 1.15rem; background: var(--wash); border-radius: var(--radius-m); border-left: 6px solid var(--teal); }
fieldset.referee { padding: 1rem 1rem 0.25rem; border: 1px solid var(--line); border-radius: var(--radius-m); }
