/* Sorellina Clinic — consent forms page.
   The forms are the clinic's printed consent sheets pinned to the wall:
   paper with a printed border, ruled lines to write on, tick boxes, a
   signing box and brass focus. The markup and every hook js/main.js reads
   (.consent-tab, .consent-panel, .field/.req, .med-check, .consent-declare
   .check-row, .sig-pad canvas, [data-sig-clear], [data-consent-submit],
   .consent-status, .consent-ok) are unchanged; this file only dresses them. */

.consent-wall .wall-inner { max-width: 980px; }

/* ------------------------------------------------------- the form chooser */
/* Pill tabs like the door-plate chooser: ink hairline, selected in fascia. */
.consent-tabs { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 clamp(26px, 3vw, 38px); }
.consent-tab {
  font: 500 .95rem/1 var(--sans); color: var(--ink);
  padding: 12px 18px; min-height: 44px;
  background: transparent; border: 1px solid rgba(27, 28, 30, .4); border-radius: 999px;
  cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease, transform 160ms var(--ease-out);
}
.consent-tab.active { background: var(--fascia); border-color: var(--fascia); color: var(--gold-light); }
.consent-tab:active { transform: scale(.97); }
.consent-tab:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
@media (hover: hover) and (pointer: fine) {
  .consent-tab:not(.active):hover { background: rgba(27, 28, 30, .08); border-color: rgba(27, 28, 30, .6); }
}

/* --------------------------------------------------- the printed sheet */
.consent-panel { display: none; }
.consent-panel.active { display: block; animation: sheet-in 260ms var(--ease-out) both; }
@keyframes sheet-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.consent-panel {
  position: relative;
  padding: clamp(34px, 5vw, 64px) clamp(24px, 5vw, 64px) clamp(30px, 4.4vw, 56px);
  background: var(--paper); color: var(--ink);
  box-shadow:
    inset 0 0 0 12px var(--paper), inset 0 0 0 13px rgba(27, 28, 30, .14),
    0 18px 40px rgba(27, 28, 30, .12), 0 2px 4px rgba(27, 28, 30, .1);
}
/* two brass pins holding the sheet to the wall */
.consent-panel::before, .consent-panel::after {
  content: ""; position: absolute; top: 16px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--brass);
  box-shadow: inset 0 0 0 1px var(--gold-shade), inset -2px -2px 3px rgba(110, 80, 23, .45), 0 2px 3px rgba(0, 0, 0, .3);
}
.consent-panel::before { left: 22px; }
.consent-panel::after { right: 22px; }

.consent-intro { padding-bottom: 22px; border-bottom: 2px solid var(--ink); }
.consent-intro h3 { font-size: clamp(1.7rem, 3vw, 2.4rem); line-height: 1.08; }
.consent-intro p { margin-top: 12px; max-width: 40rem; color: var(--ink-2); }
.consent-intro .req-key { margin-top: 14px; font-size: .9rem; }

/* section headings printed on the sheet */
.consent-panel .section-label {
  margin: clamp(30px, 3.6vw, 42px) 0 16px; padding-bottom: 8px;
  font: 500 1rem/1.3 var(--sans); color: var(--ink);
  border-bottom: 1px solid rgba(27, 28, 30, .2);
}
.consent-panel .consent-intro + .form-grid { margin-top: clamp(26px, 3vw, 34px); }

/* ------------------------------------------------------- written fields */
.consent-panel .form-grid { gap: 22px 32px; }
.consent-panel > .form-grid + .field, .consent-panel > .med-grid + .field, .consent-panel > .field + .field { margin-top: 22px; }
.consent-panel .field { display: grid; gap: 4px; align-content: start; min-width: 0; }
.consent-panel .field.full { grid-column: 1 / -1; }
.consent-panel .field label { font-size: .9rem; font-weight: 500; color: var(--ink); }
.consent-panel .req { color: #8e2b2b; font-weight: 500; }

/* each field is a ruled line on the paper; focus turns the rule to brass */
.consent-panel .field input,
.consent-panel .field select,
.consent-panel .field textarea {
  width: 100%; min-height: 44px; padding: 8px 2px 7px;
  font: 400 1.0625rem/1.4 var(--sans); color: var(--ink);
  background: transparent;
  border: 0; border-bottom: 1.5px solid rgba(27, 28, 30, .5); border-radius: 0;
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}
.consent-panel .field input::placeholder { color: #75787c; }
.consent-panel .field select {
  appearance: none; -webkit-appearance: none; padding-right: 28px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 13px) 55%, calc(100% - 8px) 55%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.consent-panel .field textarea {
  min-height: 112px; resize: vertical; padding-top: 4px; line-height: 32px;
  border: 0;
  background-image: repeating-linear-gradient(to bottom, transparent 0 31px, rgba(27, 28, 30, .32) 31px 32px);
  background-attachment: local;
}
.consent-panel .field input:focus,
.consent-panel .field select:focus,
.consent-panel .field textarea:focus {
  outline: none; border-bottom-color: var(--gold-shade);
  box-shadow: 0 2px 0 var(--gold);
  background-color: rgba(201, 161, 74, .08);
}
.consent-panel .field textarea:focus { box-shadow: inset 0 -2px 0 var(--gold); }
@media (hover: hover) and (pointer: fine) {
  .consent-panel .field input:hover:not(:focus),
  .consent-panel .field select:hover:not(:focus) { border-bottom-color: var(--ink); }
}
/* a mistyped email gets a word, not only a colour */
.consent-panel .field input:user-invalid { border-bottom-color: #8e2b2b; }
.consent-panel .field:has(input[type="email"]:user-invalid)::after {
  content: "Please check this email address."; font-size: .86rem; color: #8e2b2b; margin-top: 4px;
}

/* --------------------------------------------------------- tick boxes */
.med-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 32px; }
@media (max-width: 640px) { .med-grid { grid-template-columns: 1fr; } }
.med-check {
  display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 8px 4px;
  font-size: 1rem; color: var(--ink); cursor: pointer;
  border-bottom: 1px dotted rgba(27, 28, 30, .28);
  transition: background-color 160ms ease;
}
.med-check input, .check-row input {
  flex: none; width: 20px; height: 20px; margin: 0;
  accent-color: var(--charcoal); cursor: pointer;
}
.med-check:has(input:checked) { background: rgba(201, 161, 74, .12); }
.med-check:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 0; }
@media (hover: hover) and (pointer: fine) { .med-check:hover { background: rgba(27, 28, 30, .05); } }

.consent-declare { display: grid; gap: 4px; }
.check-row { display: flex; align-items: flex-start; gap: 14px; padding: 10px 4px; }
.check-row input { margin-top: 3px; }
.check-row label { font-size: 1rem; line-height: 1.55; color: var(--ink); cursor: pointer; }
.check-row:has(input:checked) label { color: var(--ink); }
@media (hover: hover) and (pointer: fine) { .check-row:hover { background: rgba(27, 28, 30, .04); } }

/* ------------------------------------------------------------ signing box */
.sig-pad {
  background: #fff;
  border: 1px solid rgba(27, 28, 30, .3);
  box-shadow: inset 0 1px 3px rgba(27, 28, 30, .08);
}
.sig-pad canvas {
  display: block; width: 100%; height: 160px; touch-action: none; cursor: crosshair;
  /* the line to sign on, printed in the box */
  background:
    linear-gradient(var(--ink-2), var(--ink-2)) 28px 118px / calc(100% - 56px) 1px no-repeat;
}
.sig-actions { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 16px; padding: 6px 12px 6px 6px; border-top: 1px solid rgba(27, 28, 30, .14); }
.sig-clear {
  min-height: 40px; padding: 8px 12px;
  font: 500 .92rem/1 var(--sans); color: var(--ink);
  background: transparent; border: 0; border-radius: 2px; cursor: pointer;
  text-decoration: underline; text-decoration-color: rgba(27, 28, 30, .35); text-underline-offset: .22em; text-decoration-thickness: 1px;
  transition: text-decoration-color 160ms ease, background-color 160ms ease, transform 160ms var(--ease-out);
}
.sig-clear:active { transform: scale(.97); }
@media (hover: hover) and (pointer: fine) { .sig-clear:hover { text-decoration-color: currentColor; background: rgba(27, 28, 30, .05); } }
.sig-hint { font-size: .86rem; color: var(--ink-2); }
.consent-panel .field.sig-name { margin-top: 22px; max-width: 460px; }

/* --------------------------------------------------------------- submit */
.consent-submit-bar {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px 24px;
  margin-top: clamp(30px, 3.6vw, 40px); padding-top: 22px; border-top: 2px solid var(--ink);
}
.consent-status { flex: 1 1 260px; font-size: .92rem; color: var(--ink-2); }
.consent-submit { font-size: 1rem; }

/* the success slip: a word and a tick, in the open-sign green */
.consent-ok { display: none; }
.consent-ok.show {
  display: flex; align-items: flex-start; gap: 14px;
  margin-top: 20px; padding: 16px 18px;
  background: rgba(31, 107, 71, .08); border: 1px solid rgba(31, 107, 71, .4); color: var(--ink);
  animation: sheet-in 260ms var(--ease-out) both;
}
.consent-ok svg { width: 1.4em; height: 1.4em; margin-top: 1px; color: #1f6b47; stroke-width: 2; }
.consent-ok strong { font-weight: 500; color: #1f6b47; }

@media (max-width: 640px) {
  .consent-tab { padding: 11px 14px; font-size: .9rem; }
  .consent-panel { padding: 40px 20px 28px; box-shadow: inset 0 0 0 8px var(--paper), inset 0 0 0 9px rgba(27, 28, 30, .14), 0 14px 30px rgba(27, 28, 30, .12), 0 2px 4px rgba(27, 28, 30, .1); }
  .consent-panel::before { left: 14px; top: 12px; }
  .consent-panel::after { right: 14px; top: 12px; }
  .consent-submit-bar .consent-submit { width: 100%; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  .consent-panel.active, .consent-ok.show { animation: fade 300ms ease both; }
}
