/* Nadia Pienaar Optometrists: online patient information sheet.
   Colours and type follow the practice style guide. This file stands on its own. */

@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("assets/fonts/AtkinsonHyperlegibleNext-Regular.woff2") format("woff2");
  font-weight: 400; font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("assets/fonts/AtkinsonHyperlegibleNext-SemiBold.woff2") format("woff2");
  font-weight: 600; font-display: swap;
}

:root {
  --white: #FFFFFF; --grey: #F2F2F2; --charcoal: #252525; --text-2: #4D4D4D;
  --mauve: #633F50;   /* readable mauve: headings, links, panels */
  --floral: #A17C89;  /* decoration only, never text */
  --focus: #42243A; --error: #A32020; --border: #6B6B6B;
}

*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0; font-family: "Atkinson Hyperlegible Next", Verdana, Arial, sans-serif;
  font-size: 1.125rem; line-height: 1.6; color: var(--charcoal); background: var(--white);
}
.wrap { width: min(100% - 2.5rem, 46rem); margin-inline: auto; }
.site-header { padding: 2rem 0 0; }
.site-header img { width: min(75vw, 320px); height: auto; display: block; }
main { padding: 2rem 0 3rem; }
.rule { width: 3.5rem; height: 0.375rem; background: var(--floral); border: 0; margin: 0 0 1.25rem; }
h1 { font-size: clamp(1.8rem, 1.3rem + 2vw, 2.6rem); line-height: 1.2; font-weight: 600; margin: 0 0 0.75rem; }
h2 { font-size: 1.25rem; font-weight: 600; color: var(--mauve); margin: 1.5rem 0 0.5rem; }
p { margin: 0 0 1em; }
.lead { font-size: 1.25rem; color: var(--text-2); }
a { color: var(--mauve); text-underline-offset: 0.15em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

/* Sections of the form */
fieldset { border: 0; border-top: 0.375rem solid var(--floral); background: var(--grey); padding: 1.25rem 1.25rem 0.5rem; margin: 2rem 0 0; min-width: 0; }
legend { float: left; width: 100%; padding: 0; margin: 0 0 1rem; font-size: 1.375rem; font-weight: 600; color: var(--mauve); }
legend + * { clear: both; }

.row { display: grid; gap: 0 1.25rem; }
@media (min-width: 40em) {
  .row { grid-template-columns: 1fr 1fr; }
  .row:has(.field--s:first-child) { grid-template-columns: 9rem 1fr; }
  .row--3 { grid-template-columns: 1fr 1fr 1fr; }
  .row--addr { grid-template-columns: 1fr 9rem !important; }
}
.field { margin: 0 0 1.25rem; }
label, .label { display: block; font-weight: 600; margin: 0 0 0.3rem; }
.req { font-weight: 400; font-size: 0.95rem; color: var(--text-2); }
.hint { font-size: 1rem; color: var(--text-2); margin: 0.3rem 0 0; }
fieldset > .hint { margin: 0 0 1rem; }
input[type=text], input[type=tel], input[type=email], input[type=date], select {
  width: 100%; min-height: 48px; padding: 0.5rem 0.75rem;
  font: inherit; color: var(--charcoal); background: var(--white);
  border: 2px solid var(--border); border-radius: 2px;
}
.check { display: grid; grid-template-columns: 1.75rem 1fr; gap: 0 0.75rem; align-items: start; margin: 0 0 1.25rem; }
.check input { width: 1.75rem; height: 1.75rem; margin: 0.1rem 0 0; accent-color: var(--mauve); }
.check label { font-weight: 400; margin: 0; }
.check .error { grid-column: 2; }
[hidden] { display: none !important; }
.hp { position: absolute; left: -9999px; }

/* Written errors next to the field */
.error { display: none; margin: 0.35rem 0 0; color: var(--error); font-weight: 600; font-size: 1rem; }
.field--error .error { display: block; }
.field--error input, .field--error select, .field--error canvas { border-color: var(--error); }
.notice { border-left: 0.375rem solid var(--mauve); background: var(--grey); padding: 1rem 1.25rem; margin: 1rem 0; }
.notice--error { border-left-color: var(--error); }
.notice strong { display: block; }
.notice p { margin: 0; }

/* Terms */
.terms { margin: 2rem 0 0; }
.terms ol, .terms ul { padding-left: 1.4rem; margin: 0 0 1rem; }
.terms li { margin: 0 0 0.5rem; }

/* Signature box */
#sig-pad { display: block; width: 100%; max-width: 640px; height: auto; aspect-ratio: 640 / 220;
  background: var(--white); border: 2px solid var(--border); border-radius: 2px; margin: 0.5rem 0;
  touch-action: none; cursor: crosshair; }
.signed-on { margin: 0 0 1.25rem; }
.privacy { margin: 1.5rem 0; color: var(--text-2); font-size: 1rem; }

/* Buttons */
.btn { display: inline-flex; align-items: center; min-height: 48px; padding: 0.75rem 1.75rem; font: inherit; font-weight: 600;
  text-decoration: none; border-radius: 2px; border: 2px solid var(--charcoal); cursor: pointer; }
.btn--primary { background: var(--charcoal); color: var(--white); }
.btn--primary:hover { background: #111111; }
.btn--secondary { background: var(--white); color: var(--charcoal); }
.btn--secondary:hover { background: var(--grey); }
.btn--small { min-height: 44px; padding: 0.4rem 1rem; font-size: 1rem; }
.btn[disabled] { opacity: 0.6; cursor: default; }

.site-footer { background: var(--charcoal); color: var(--white); padding: 1.5rem 0; font-size: 1rem; }
.site-footer p { margin: 0; }
.site-footer a { color: var(--white); }
