/* ============================================================
   Shared waiver chrome — used by waiver.html (members) and
   trial-signup.html (free trial). Screen layout is a three-step
   wizard; print collapses every step into one continuous document
   followed by the Certificate of Completion on its own page.
   ============================================================ */

/* ---- Step progress ---- */
.wz-progress {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 16px 30px 0;
}
.wz-progress-item {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}
.wz-progress-item:last-child { flex: 0 0 auto; }
.wz-dot {
    width: 26px; height: 26px;
    border-radius: 50%;
    background: #e0e0e0;
    color: #888;
    font-size: 0.78rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s, color 0.2s;
}
.wz-progress-item.active .wz-dot { background: #005cbb; color: #fff; }
.wz-progress-item.done   .wz-dot { background: #2e7d32; color: #fff; }
.wz-dot-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #888;
    white-space: nowrap;
}
.wz-progress-item.active .wz-dot-label { color: #005cbb; }
.wz-progress-item.done   .wz-dot-label { color: #2e7d32; }
.wz-bar {
    flex: 1;
    height: 2px;
    background: #e0e0e0;
    margin: 0 10px;
    min-width: 12px;
}
.wz-progress-item.done .wz-bar { background: #2e7d32; }

/* ---- Step panels ---- */
.wz-step { display: none; }
.wz-step.active { display: block; }

.step-label {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #F8991F;
    margin-bottom: 4px;
}
.step-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 4px;
}
.step-hint {
    font-size: 0.83rem;
    color: #666;
    margin-bottom: 18px;
    line-height: 1.5;
}
.wz-section { padding: 18px 30px; }

/* ---- Step 1: signing for ---- */
.signing-for-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    max-width: 520px;
}
.signing-for-card {
    border: 2px solid #ddd;
    border-radius: 12px;
    padding: 18px 16px;
    cursor: pointer;
    text-align: center;
    transition: border-color 0.15s, background 0.15s;
    background: #fff;
    /* Without this a tap has to wait to see whether a second one is coming
       (double-tap to zoom), which reads as a card that ignored the first one. */
    touch-action: manipulation;
}
/* Hover styling only where a pointer can actually hover. On a touch screen the
   first tap on an element with hover styles is spent applying them, and the
   user has to tap again to activate it — the classic "I had to press twice". */
@media (hover: hover) and (pointer: fine) {
    .signing-for-card:hover { border-color: #b0c8e0; }
}
.signing-for-card.selected {
    border-color: #005cbb;
    background: #f0f7ff;
}
.signing-for-card .material-symbols-rounded {
    font-size: 2.1rem;
    color: #005cbb;
}
.signing-for-card h4 {
    font-size: 0.95rem;
    font-weight: 700;
    margin: 6px 0 3px;
}
.signing-for-card p {
    font-size: 0.76rem;
    color: #777;
    line-height: 1.4;
}

/* ---- Step 2: document ---- */
.doc-title {
    font-size: 0.95rem;
    font-weight: 700;
    text-align: center;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
    color: #1a1a1a;
}
.waiver-text blockquote.statute {
    margin: 8px 0 8px 18px;
    padding-left: 12px;
    border-left: 3px solid #d0dde4;
    font-style: italic;
    color: #444;
}

/* E-signature consent */
.consent-block {
    background: #fffdf5;
    border: 1px solid #f0e0b0;
    border-radius: 10px;
    padding: 14px 16px;
    margin-top: 16px;
}
.consent-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.8rem;
    line-height: 1.5;
    cursor: pointer;
    touch-action: manipulation;
}
.consent-check input {
    width: 18px; height: 18px;
    flex-shrink: 0;
    margin-top: 1px;
    accent-color: #005cbb;
    cursor: pointer;
}
/* A finger is not a mouse pointer. An 18px box asks for an accuracy nobody has
   on a phone, and a near miss is indistinguishable from a tap that was
   ignored — so the box grows where the pointer is coarse. */
@media (pointer: coarse) {
    .consent-check input { width: 24px; height: 24px; }
}

/* Guardian signature block */
.guardian-block {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px dashed #ccc;
}
.guardian-block p {
    font-size: 0.8rem;
    color: #444;
    line-height: 1.55;
    margin-bottom: 12px;
}

/* ---- Step 3: questions ---- */
.q-block { margin-bottom: 18px; }
.q-label {
    display: block;
    font-size: 0.83rem;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 5px;
}
.q-label .req { color: red; }
.q-help {
    font-size: 0.73rem;
    color: #777;
    margin-bottom: 7px;
    line-height: 1.45;
}
.q-block input[type="text"],
.q-block input[type="tel"],
.q-block input[type="date"],
.q-block input[type="email"] {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid #d0dde4;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.88rem;
    background: #fff;
    color: #1a1a1a;
    outline: none;
}
.q-block input:focus { border-color: #005cbb; }
.q-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
    margin-top: 4px;
}
.q-options label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.85rem;
    cursor: pointer;
    touch-action: manipulation;
}
.q-options input {
    width: 17px; height: 17px;
    accent-color: #005cbb;
    cursor: pointer;
}
@media (pointer: coarse) {
    .q-options label { padding: 4px 0; }
    .q-options input { width: 22px; height: 22px; }
}

/* ---- Step 3: field-grid section headings ----
   Participant details and emergency contact used to run together in one block,
   which is how a parent's phone number ended up read as the player's. */
.grid-heading {
    font-size: 0.72rem;
    font-weight: 700;
    color: #005cbb;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    margin: 4px 0 8px;
    padding-bottom: 5px;
    border-bottom: 1px solid #e2eaf0;
}
.grid-heading + .form-grid { margin-top: 0; }

/* ---- Step 3: live photo capture ---- */
.photo-capture { margin-top: 4px; }

/* Camera on the left, instructions in the space to its right. Below 620px
   they stack, because at that width the stage already fills the row. */
.photo-layout {
    display: flex;
    gap: 18px;
    align-items: flex-start;
    flex-wrap: wrap;
}
.photo-col { flex: 0 0 auto; }
.photo-tips {
    flex: 1 1 240px;
    min-width: 220px;
    background: #f2f9fd;
    border: 1.5px solid #d0dde4;
    border-radius: 10px;
    padding: 12px 14px;
}
.photo-tips h5 {
    font-size: 0.68rem;
    font-weight: 700;
    color: #005cbb;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 7px;
}
.photo-tips ul { margin: 0; padding-left: 16px; }
.photo-tips li {
    font-size: 0.76rem;
    color: #40566b;
    line-height: 1.5;
    margin-bottom: 4px;
}
.photo-tips li:last-child { margin-bottom: 0; }

.photo-stage {
    position: relative;
    width: 220px; height: 220px;
    border-radius: 12px;
    overflow: hidden;
    background: #eef3f7;
    border: 1.5px solid #d0dde4;
}
.photo-stage video,
.photo-stage canvas.photo-live,
.photo-stage img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: none;
}
/* Mirrored preview only — people expect to see themselves the way a mirror
   shows them. Both the raw feed and the composited one are mirrored here; the
   frame that gets stored is drawn from the unmirrored source. */
.photo-stage video,
.photo-stage canvas.photo-live { transform: scaleX(-1); }
.photo-idle {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    color: #90a4b4; cursor: pointer;
}
.photo-idle .material-symbols-rounded { font-size: 3rem; }

/* Head-and-shoulders outline to line the face up against. Only while the
   camera is live — over a taken photo it would read as part of the picture. */
.photo-outline {
    position: absolute; inset: 0;
    display: none;
    align-items: center; justify-content: center;
    pointer-events: none;
}
/* Same silhouette, same weight as the player enrolment screen, so the two
   camera steps in the app ask people to stand the same way. */
.photo-outline img { width: 100%; height: 100%; object-fit: contain; opacity: 0.5; }

.photo-busy {
    position: absolute; inset: 0;
    display: none;
    align-items: center; justify-content: center;
    background: rgba(255,255,255,0.85);
    font-size: 0.78rem; font-weight: 600; color: #005cbb;
    text-align: center; padding: 0 12px;
}

/* The raw feed carries the preview only until the model returns its first
   frame; from then on `cut` swaps in the composited canvas, so what the person
   lines up against the outline is the picture that will be stored. */
.photo-capture[data-state="live"] video,
.photo-capture[data-state="busy"] video { display: block; }
.photo-capture.cut[data-state="live"] video,
.photo-capture.cut[data-state="busy"] video { display: none; }
.photo-capture.cut[data-state="live"] .photo-live,
.photo-capture.cut[data-state="busy"] .photo-live { display: block; }
.photo-capture[data-state="live"] .photo-idle { display: none; }
.photo-capture[data-state="live"] .photo-outline,
.photo-capture[data-state="busy"] .photo-outline { display: flex; }
.photo-capture[data-state="busy"] .photo-idle { display: none; }
.photo-capture[data-state="busy"] .photo-busy { display: flex; }
.photo-capture[data-state="taken"] img { display: block; }
.photo-capture[data-state="taken"] .photo-idle { display: none; }
.photo-capture[data-state="opening"] .photo-idle .material-symbols-rounded { opacity: 0.4; }

.photo-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.photo-btn {
    padding: 8px 18px;
    border: 1.5px solid #d0dde4;
    border-radius: 100px;
    background: #fff;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    color: #005cbb;
    cursor: pointer;
    touch-action: manipulation;
    display: none;
}
.photo-btn.primary { background: #005cbb; border-color: #005cbb; color: #fff; }
.photo-capture[data-state="idle"] .photo-btn[id$="_start"],
.photo-capture[data-state="opening"] .photo-btn[id$="_start"],
.photo-capture[data-state="live"] .photo-btn[id$="_shoot"],
.photo-capture[data-state="taken"] .photo-btn[id$="_retake"] { display: block; }
/* A stored photo shown read-only: nothing left to aim or explain. */
.photo-capture.locked .photo-actions,
.photo-capture.locked .photo-outline,
.photo-capture.locked .photo-tips { display: none; }

.photo-error {
    font-size: 0.76rem;
    color: #b71c1c;
    margin-top: 7px;
    line-height: 1.45;
}
.photo-error:empty { display: none; }

/* ---- Notice at Collection ---- */
.privacy-notice {
    border: 1.5px solid #d0dde4;
    border-radius: 10px;
    background: #f7fbfd;
    margin: 16px 0 10px;
    overflow: hidden;
}
.privacy-notice > summary {
    list-style: none;
    cursor: pointer;
    padding: 11px 14px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    touch-action: manipulation;
}
.privacy-notice > summary::-webkit-details-marker { display: none; }
.privacy-notice > summary::after {
    content: '＋';
    position: absolute;
    right: 14px;
    color: #005cbb;
    font-size: 1rem;
}
.privacy-notice[open] > summary::after { content: '−'; }
.privacy-notice > summary { position: relative; padding-right: 34px; }
.pn-title {
    font-size: 0.74rem;
    font-weight: 700;
    color: #005cbb;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}
.pn-hint { font-size: 0.73rem; color: #6b8296; }

.pn-body {
    padding: 0 14px 14px;
    font-size: 0.76rem;
    color: #333;
    line-height: 1.55;
    max-height: 320px;
    overflow-y: auto;
    border-top: 1px solid #e2eaf0;
    padding-top: 12px;
}
.pn-body h4 {
    font-size: 0.76rem;
    font-weight: 700;
    color: #0d2b4e;
    margin: 12px 0 4px;
}
.pn-body h4:first-child { margin-top: 0; }
.pn-body p { margin-bottom: 7px; }
.pn-body ul { margin: 0 0 8px 18px; }
.pn-body li { margin-bottom: 3px; }

/* ---- Wizard navigation ---- */
.wz-nav {
    display: flex;
    gap: 12px;
    justify-content: space-between;
    padding: 8px 30px 30px;
}
.wz-nav-right { display: flex; gap: 12px; margin-left: auto; }

/* ---- Signature pad, touch screens ----
   The pad only takes the finger away from the page once it has been tapped
   awake (see createSignaturePad in waiver-form.js). While it is awake the
   border says so, because that is also when a swipe over it draws instead of
   scrolling. */
.sig-canvas-wrapper.pad-armed {
    border-color: #005cbb;
    box-shadow: 0 0 0 3px rgba(0, 92, 187, 0.12);
}
.sig-done {
    margin-top: 8px;
    padding: 7px 18px;
    border: none;
    border-radius: 100px;
    background: #005cbb;
    color: #fff;
    font-family: inherit;
    font-size: 0.76rem;
    font-weight: 700;
    cursor: pointer;
    touch-action: manipulation;
}
@media print { .sig-done { display: none !important; } }

/* ---- Inline error ---- */
.wz-error {
    margin: 0 30px 14px;
    padding: 10px 14px;
    border-radius: 8px;
    background: #ffebee;
    color: #b71c1c;
    font-size: 0.83rem;
    font-weight: 500;
    display: none;
}
.wz-error.show { display: block; }

/* ============================================================
   Certificate of Completion
   Evidence page that travels with the document: who signed, that
   they intended to, when, from where, and a hash proving the record
   has not changed since. Hidden on screen for signers, shown to
   admins, and always printed as its own page.
   ============================================================ */
.cert-page { display: none; }
.cert-page.visible { display: block; }

.cert-inner { padding: 20px 30px 30px; }
.cert-header {
    border-bottom: 2px solid #1a1a1a;
    padding-bottom: 8px;
    margin-bottom: 14px;
}
.cert-header h2 {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}
.cert-header p {
    font-size: 0.75rem;
    color: #666;
    margin-top: 2px;
}
.cert-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 24px;
    margin-bottom: 16px;
}
.cert-field { border-bottom: 1px solid #eee; padding-bottom: 5px; }
.cert-field .k {
    display: block;
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #777;
}
.cert-field .v {
    font-size: 0.82rem;
    color: #1a1a1a;
    word-break: break-word;
}
.cert-field.span-2 { grid-column: span 2; }
.cert-hash {
    font-family: 'Courier New', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.2px;
    word-break: break-all;
}
.cert-section-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #005cbb;
    margin: 16px 0 7px;
}
.cert-events { width: 100%; border-collapse: collapse; }
.cert-events th, .cert-events td {
    text-align: left;
    font-size: 0.73rem;
    padding: 5px 8px;
    border-bottom: 1px solid #eee;
}
.cert-events th {
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #777;
}
.cert-note {
    font-size: 0.7rem;
    color: #666;
    line-height: 1.5;
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

/* ============================================================
   Print
   ============================================================ */
@media print {
    /* Every step prints — the wizard only exists on screen. */
    .wz-step { display: block !important; }
    .wz-progress, .wz-nav, .wz-error, .consent-block .consent-check input,
    .signing-for-options { display: none !important; }
    .step-label, .step-title, .step-hint { display: none !important; }
    .wz-section { padding: 0 !important; }

    .doc-title {
        font-size: 8pt !important;
        margin-bottom: 4pt !important;
    }
    .waiver-text blockquote.statute {
        margin: 2pt 0 2pt 8pt !important;
        padding-left: 6pt !important;
        border-left-width: 1pt !important;
    }

    .consent-block {
        background: none !important;
        border: none !important;
        border-top: 0.5pt solid #999 !important;
        border-radius: 0 !important;
        padding: 3pt 0 0 !important;
        margin-top: 4pt !important;
    }
    .consent-check { font-size: 5.8pt !important; line-height: 1.3 !important; }

    /* The signed copy carries the notice in full, open, whatever the signer
       left it as on screen. A collapsed panel on paper would be a blank space
       where the disclosure is supposed to be. */
    .privacy-notice {
        border: none !important; background: none !important;
        border-top: 0.5pt solid #999 !important;
        border-radius: 0 !important; margin: 4pt 0 2pt !important;
    }
    .privacy-notice > summary { padding: 2pt 0 0 !important; }
    .privacy-notice > summary::after { display: none !important; }
    .pn-title { font-size: 5.8pt !important; }
    .pn-hint { display: none !important; }
    .pn-body {
        display: block !important;
        max-height: none !important; overflow: visible !important;
        border: none !important; padding: 1.5pt 0 0 !important;
        font-size: 5.4pt !important; line-height: 1.25 !important;
        column-count: 2; column-gap: 12pt;
    }
    .pn-body h4 { font-size: 5.4pt !important; margin: 3pt 0 0.5pt !important; }
    .pn-body p { margin-bottom: 1.5pt !important; }
    .pn-body ul { margin: 0 0 2pt 8pt !important; }

    .guardian-block {
        margin-top: 6pt !important;
        padding-top: 4pt !important;
        break-inside: avoid; page-break-inside: avoid;
    }
    .guardian-block p { font-size: 6pt !important; line-height: 1.3 !important; margin-bottom: 3pt !important; }

    /* Step 3 answers print as a compact labelled grid, not as inputs */
    .q-block { margin-bottom: 3pt !important; break-inside: avoid; page-break-inside: avoid; }
    .q-label { font-size: 5.5pt !important; margin-bottom: 0 !important; text-transform: uppercase; color: #444 !important; }
    .q-label .req { display: none; }
    .q-help { display: none !important; }
    .q-block input[type="text"],
    .q-block input[type="tel"],
    .q-block input[type="date"],
    .q-block input[type="email"] {
        border: none !important;
        border-bottom: 0.5pt solid #bbb !important;
        border-radius: 0 !important;
        padding: 0 !important;
        font-size: 7pt !important;
        font-weight: 600;
        background: none !important;
    }
    .q-options { gap: 1pt 10pt !important; }
    .q-options label { font-size: 6pt !important; gap: 3pt !important; }
    .q-options input { width: 6pt !important; height: 6pt !important; }

    .grid-heading {
        font-size: 5.5pt !important;
        margin: 3pt 0 1.5pt !important;
        padding-bottom: 1pt !important;
        border-bottom: 0.4pt solid #bbb !important;
        color: #444 !important;
    }

    /* The photo prints as part of the record; the camera controls, the
       framing outline and the how-to column do not. */
    .photo-actions, .photo-error, .photo-idle,
    .photo-outline, .photo-busy, .photo-tips,
    .photo-stage video { display: none !important; }
    .photo-layout { display: block !important; gap: 0 !important; }
    .photo-stage {
        width: 52pt !important; height: 52pt !important;
        border: 0.5pt solid #999 !important; border-radius: 3pt !important;
        break-inside: avoid; page-break-inside: avoid;
    }
    .photo-capture[data-state="taken"] img { display: block !important; }

    /* The certificate is always its own final page. */
    .cert-page {
        display: block !important;
        page-break-before: always;
        break-before: page;
    }
    .cert-inner { padding: 0 !important; }
    .cert-header { margin-bottom: 8pt !important; padding-bottom: 4pt !important; }
    .cert-header h2 { font-size: 11pt !important; }
    .cert-header p  { font-size: 6.5pt !important; }
    .cert-grid { gap: 4pt 16pt !important; margin-bottom: 8pt !important; }
    .cert-field .k { font-size: 5.5pt !important; }
    .cert-field .v { font-size: 7.5pt !important; }
    .cert-hash { font-size: 6.5pt !important; }
    .cert-section-title { font-size: 6.5pt !important; margin: 8pt 0 4pt !important; }
    .cert-events th, .cert-events td { font-size: 6.5pt !important; padding: 2pt 4pt !important; }
    .cert-note { font-size: 6pt !important; }
}

/* ---- Mobile ---- */
@media (max-width: 600px) {
    .wz-section, .wz-nav, .wz-error, .cert-inner { padding-left: 15px; padding-right: 15px; }
    .wz-progress { padding: 14px 15px 0; }
    .wz-dot-label { display: none; }
    .signing-for-options { grid-template-columns: 1fr; }
    .cert-grid { grid-template-columns: 1fr; }
    .cert-field.span-2 { grid-column: span 1; }
}
