/* WRC forms. Same face and palette as the club's What's On and tournament pages: Rubik, ink on white,
   one blue. Kept plain on purpose: staff use these on a phone between lessons. */
:root {
  --ink: #0c1721;
  --slate: #41546a;
  --slate-soft: #6b7c90;
  --blue: #0a6cc4;
  --blue-pale: #e7f1fb;
  --rust: #a8543a;
  --rust-pale: #fdece7;
  --gold-ink: #7a5712;
  --gold-pale: #fff7e6;
  --gold-line: #f0dcb6;
  --green: #17694a;
  --green-pale: #e4f4ec;
  --panel: #f4f7fa;
  --line: #dfe6ee;
  --line-strong: #c3cfdc;
  --r-lg: 22px;
  --r-sm: 12px;
  --ease: cubic-bezier(.22,.9,.28,1);
}

* { box-sizing: border-box; touch-action: manipulation; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--panel); color: var(--slate);
  font-family: Rubik, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-weight: 400; font-size: 16px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font-family: inherit; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
[hidden] { display: none !important; }

.wrap { max-width: 560px; margin: 0 auto; padding: 20px 14px 56px; }
.card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 26px 22px 28px;
  box-shadow: 0 1px 2px rgba(12,23,33,.05), 0 10px 28px rgba(12,23,33,.06);
}
@media (min-width: 600px) { .wrap { padding-top: 40px; } .card { padding: 34px 34px 36px; } }

.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.brand img { width: 46px; height: 46px; display: block; }
.brand span { font-size: 13px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--slate-soft); }

h1 { margin: 0 0 4px; font-size: 26px; line-height: 1.2; font-weight: 600; color: var(--ink); letter-spacing: -.01em; }
.sub { margin: 0 0 24px; color: var(--slate); }

.testbar {
  margin: 0 0 14px; padding: 11px 14px; border-radius: var(--r-sm);
  background: var(--gold-pale); border: 1px solid var(--gold-line); color: var(--gold-ink);
  font-size: 14px; line-height: 1.4;
}
.testbar b { font-weight: 600; }

.field { margin: 0 0 20px; }
.field > label, .legend {
  display: block; margin: 0 0 7px; font-size: 15px; font-weight: 500; color: var(--ink);
}
.hint { display: block; margin: -3px 0 8px; font-size: 14px; color: var(--slate-soft); }

input[type="text"], input[type="date"], input[type="time"], select, textarea {
  display: block; width: 100%; min-height: 52px; padding: 13px 14px;
  font-size: 17px; line-height: 1.3; color: var(--ink);
  background: #fff; border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  -webkit-appearance: none; appearance: none;
  transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 96px; resize: vertical; }
select {
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2341546a' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 15px center;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-pale); }
[aria-invalid="true"] { border-color: var(--rust) !important; box-shadow: 0 0 0 3px var(--rust-pale) !important; }

.err { display: block; margin: 7px 0 0; font-size: 14px; font-weight: 500; color: var(--rust); }
.formmsg {
  margin: 0 0 18px; padding: 12px 14px; border-radius: var(--r-sm);
  background: var(--rust-pale); color: #7c3320; font-size: 15px; font-weight: 500;
}

.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* hour types: one row each, the hours box appears on the row once it is ticked */
.types { border: 1px solid var(--line-strong); border-radius: var(--r-sm); overflow: hidden; background: #fff; }
.types.bad { border-color: var(--rust); box-shadow: 0 0 0 3px var(--rust-pale); }
.typerow { display: grid; grid-template-columns: 1fr auto; align-items: center; min-height: 60px; border-top: 1px solid var(--line); }
.typerow:first-child { border-top: 0; }
.typerow.on { background: #f8fbfe; }
.typerow label { display: flex; align-items: center; gap: 12px; padding: 14px; margin: 0; font-size: 16px; font-weight: 400; color: var(--ink); cursor: pointer; }
.typerow input[type="checkbox"] {
  -webkit-appearance: none; appearance: none; flex: none; width: 24px; height: 24px; margin: 0;
  border: 1.5px solid var(--line-strong); border-radius: 7px; background: #fff; cursor: pointer;
  display: grid; place-content: center;
}
.typerow input[type="checkbox"]::after {
  content: ""; width: 12px; height: 7px; margin-top: -2px;
  border-left: 2.5px solid #fff; border-bottom: 2.5px solid #fff; transform: rotate(-45deg); opacity: 0;
}
.typerow input[type="checkbox"]:checked { background: var(--blue); border-color: var(--blue); }
.typerow input[type="checkbox"]:checked::after { opacity: 1; }
.typerow .amt { padding: 6px 10px 6px 0; }
.typerow .amt select { width: 112px; min-height: 46px; padding-top: 9px; padding-bottom: 9px; }
.typerow .err { grid-column: 1 / -1; margin: -4px 14px 12px; }
.fade { animation: fade .22s var(--ease) both; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.btn {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
  min-height: 54px; padding: 14px 26px; margin-top: 6px;
  font-size: 17px; font-weight: 500; color: #fff; background: var(--ink);
  border: 1px solid var(--ink); border-radius: 999px; cursor: pointer;
  transition: background .2s var(--ease);
}
.btn:hover:not(:disabled) { background: #000; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.ghost { color: var(--ink); background: #fff; border-color: var(--line-strong); }
.btn.ghost:hover:not(:disabled) { background: var(--panel); }
.spin { width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* the one flourish: the tick draws itself when the hours are in */
.done { text-align: center; }
.done .tick { width: 68px; height: 68px; margin: 6px auto 14px; display: block; }
.done .tick circle { fill: var(--green-pale); }
.done .tick path { fill: none; stroke: var(--green); stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 30; stroke-dashoffset: 30; animation: draw .5s .12s var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.done h2 { margin: 0 0 16px; font-size: 22px; font-weight: 600; color: var(--ink); }
.done h2:focus { outline: none; }
.summary { margin: 0 0 22px; padding: 0; text-align: left; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.summary div { display: flex; justify-content: space-between; gap: 16px; padding: 12px 14px; border-top: 1px solid var(--line); }
.summary div:first-child { border-top: 0; }
.summary dt { color: var(--slate-soft); }
.summary dd { margin: 0; color: var(--ink); font-weight: 500; text-align: right; overflow-wrap: anywhere; }

.loaderr { text-align: center; padding: 8px 0; }
.loaderr p { margin: 0 0 16px; color: var(--ink); }
.skeleton { height: 220px; border-radius: var(--r-sm); background: linear-gradient(90deg, #f1f4f8 0%, #f8fafc 50%, #f1f4f8 100%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* yes / no */
.yn { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
/* (sibling selectors only, no :has(), so the chosen state also shows on older iPhones) */
.yn label { position: relative; display: block; margin: 0; cursor: pointer; }
.yn span {
  display: flex; align-items: center; justify-content: center; min-height: 52px; padding: 12px;
  font-size: 16px; font-weight: 500; color: var(--ink); background: #fff;
  border: 1px solid var(--line-strong); border-radius: var(--r-sm); transition: background .15s, border-color .15s, color .15s;
}
.yn input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.yn input:checked + span { background: var(--blue); border-color: var(--blue); color: #fff; }
.yn input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }
.yn.bad span { border-color: var(--rust); }

/* files */
.filebox {
  display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 60px; padding: 14px;
  font-size: 16px; font-weight: 500; color: var(--blue); background: var(--blue-pale); cursor: pointer;
  border: 1.5px dashed #9cc3ea; border-radius: var(--r-sm);
}
/* the picker is itself a <label> inside .field, so it must out-rank the plain field-label rule above */
.field > label.filebox { display: flex; margin: 0; font-size: 16px; font-weight: 500; color: var(--blue); }
.field > label.filebox.bad { color: #7c3320; }
.filebox:focus-within { outline: 2px solid var(--blue); outline-offset: 2px; }
.filebox.bad { border-color: var(--rust); background: var(--rust-pale); color: #7c3320; }
.filebox input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.filelist { list-style: none; margin: 10px 0 0; padding: 0; }
.filelist li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; margin-top: 6px; background: var(--panel); border-radius: 10px; font-size: 15px; color: var(--ink); }
.filelist .fname { overflow-wrap: anywhere; }
.filelist .fsize { color: var(--slate-soft); white-space: nowrap; font-size: 14px; }
.filelist button { flex: none; min-width: 44px; min-height: 36px; padding: 6px 10px; font-size: 14px; font-weight: 500; color: var(--rust); background: #fff; border: 1px solid var(--line-strong); border-radius: 8px; cursor: pointer; }
.done p.msg { margin: -6px 0 6px; color: var(--slate); font-size: 17px; }
.q { font-weight: 500; color: var(--ink); }

/* longer forms: section headings, a country code beside a phone number, three short boxes in a row */
.sect { margin: 30px 0 16px; padding-top: 22px; border-top: 1px solid var(--line); font-size: 18px; font-weight: 600; color: var(--ink); }
.phone { display: grid; grid-template-columns: 84px 1fr; gap: 10px; }
.trio { display: grid; grid-template-columns: 1fr; gap: 0; }
@media (min-width: 520px) { .trio { grid-template-columns: 1fr 1fr 1.4fr; gap: 12px; } }
a.btn { text-decoration: none; }

.hp { display: none; }

@media (prefers-reduced-motion: reduce) {
  .fade, .done .tick path, .skeleton, .spin { animation: none; }
  .done .tick path { stroke-dashoffset: 0; }
}

/* Embedded on a mywrc.ca page (Jay 2026-11-19: "no grey ... white, with a bit of a border and maybe a bit of
   shadowing behind it, so it is defined off the page"). The page behind shows through (white); the card keeps a
   fine border and gets a soft shadow. The padding leaves room for the shadow inside the frame. */
html.embedded, html.embedded body { background: transparent; }
html.embedded .wrap { padding: 8px 14px 34px; }
html.embedded .card {
  border-color: #d3dce7;
  box-shadow: 0 1px 2px rgba(12,23,33,.06), 0 8px 22px rgba(12,23,33,.09);
}
@media (min-width: 600px) { html.embedded .wrap { padding-top: 12px; } }

/* ── Computer layout (Jay 2026-11-19: "use the space better, making them a bit wider ... things can then sit side
   by side"). 760px and wider only, so phones never see any of it. Fields marked "half" sit two to a row; everything
   else (section headings, long questions, file boxes, the bank trio) keeps the full row. DOM order is unchanged, so
   the Tab key still walks the fields in reading order.
   APPROVED by Jay 2026-11-19 ("They look better") and the STANDARD for every form from now on. The pages add the class
   "wide" themselves; ?layout=narrow turns it off, to compare with the old single column. */
@media (min-width: 760px) {
  html.wide .wrap { max-width: 900px; }
  html.wide .card { padding: 40px 44px 44px; }
  html.wide #form { display: grid; grid-template-columns: 1fr 1fr; column-gap: 28px; align-items: start; }
  html.wide #form > * { grid-column: 1 / -1; }
  html.wide #form > .field.half { grid-column: auto; }
  /* a group that opens up later (onboarding's ID block) joins the same two columns: its box steps aside */
  html.wide #form > #idblock { display: contents; }
  html.wide #form > #idblock > * { grid-column: 1 / -1; }
  html.wide #form > #idblock > .field.half { grid-column: auto; }
  html.wide #form > .btn { width: auto; min-width: 240px; justify-self: start; }
  /* yes/no questions: the question on the left, Yes and No on the right */
  html.wide #form > .field[data-yn] { display: grid; grid-template-columns: 1fr 280px; column-gap: 28px; align-items: center; }
  html.wide #form > .field[data-yn] > .legend { margin: 0; }
  html.wide #form > .field[data-yn] > .err { grid-column: 1 / -1; }
  /* coach hour types: two columns, so each amount box sits next to its label instead of far across the card */
  html.wide .types { display: grid; grid-template-columns: 1fr 1fr; }
  html.wide .typerow { border-top: 1px solid var(--line); }
  html.wide .typerow:nth-child(-n+2) { border-top: 0; }
  html.wide .typerow:nth-child(odd) { border-right: 1px solid var(--line); }
  /* the "submitted" view stays a readable width */
  html.wide .done { max-width: 560px; margin: 0 auto; }
}

/* Bank details: the three labels, boxes and messages each line up across the row, even when one label wraps onto
   two lines ("Institutional Number" did, pushing its box lower than the other two). */
@supports (grid-template-rows: subgrid) {
  @media (min-width: 520px) {
    .trio { grid-template-rows: auto auto auto; row-gap: 0; }
    .trio > .field { display: grid; grid-row: span 3; grid-template-rows: subgrid; align-items: end; }
    .trio > .field > .err { align-self: start; }
  }
}
