/* =====================================================================
   IsKeenLab — clinic forms
   ---------------------------------------------------------------------
   Print-first. Each form is laid out to land on a single A4 page and to
   match the printed originals, so a PDF saved from the browser is the
   same document the clinic already uses.

   Nothing here talks to a server. Answers live in the page until it is
   printed, cleared or closed.
   ===================================================================== */

:root{
  --ink:#14262A; --white:#F8F6F2; --teal:#2E6E6A; --deep-teal:#1F5350;
  --champagne:#BFA37A; --mist:#DCE7E5; --slate:#5C6F72;
  --surface:#FCFBF9;
  --line:rgba(20,38,42,.26);
  --line-soft:rgba(20,38,42,.10);
  --display:"Jost",system-ui,sans-serif;
  --body:"Inter",system-ui,sans-serif;
  --ease:cubic-bezier(.22,.61,.36,1);
}

*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{margin:0;background:var(--white);color:var(--ink);
  font-family:var(--body);font-size:16px;line-height:1.5;
  -webkit-font-smoothing:antialiased}
h1,h2,h3,h4{margin:0;font-family:var(--display);font-weight:500;line-height:1.1}
p{margin:0}
img{display:block;max-width:100%}

/* ---- Screen chrome (never printed) --------------------------------- */
.bar{position:sticky;top:0;z-index:10;
  display:flex;align-items:center;gap:1rem;flex-wrap:wrap;
  padding:.85rem clamp(1rem,4vw,2.5rem);
  background:rgba(248,246,242,.92);backdrop-filter:blur(12px);
  border-bottom:1px solid var(--line-soft)}
.bar__logo{height:26px;width:auto;flex:none}
.bar__spacer{flex:1 1 auto}

.btn{display:inline-flex;align-items:center;gap:.6em;cursor:pointer;
  font-family:var(--display);font-weight:500;font-size:.82rem;
  letter-spacing:.06em;text-transform:uppercase;
  padding:.72em 1.2em;border-radius:3px;
  background:var(--ink);color:var(--white);border:1px solid var(--ink);
  transition:transform .4s var(--ease),background .3s var(--ease)}
.btn:hover{transform:translateY(-1px)}
.btn--ghost{background:transparent;color:var(--ink);border-color:var(--line)}
.btn--ghost:hover{border-color:var(--ink)}
.btn:focus-visible,.pick:focus-visible{outline:2px solid var(--teal);outline-offset:3px}

/* Form picker */
.picker{display:flex;gap:.4rem;flex-wrap:wrap;
  padding:0 clamp(1rem,4vw,2.5rem) 1rem}
.pick{cursor:pointer;background:none;border:1px solid var(--line-soft);
  border-radius:3px;padding:.5em .9em;
  font-family:var(--display);font-size:.8rem;letter-spacing:.04em;color:var(--slate);
  transition:border-color .3s var(--ease),color .3s var(--ease),background .3s var(--ease)}
.pick:hover{border-color:var(--line);color:var(--ink)}
.pick[aria-selected="true"]{background:var(--ink);border-color:var(--ink);color:var(--white)}

.hint{padding:0 clamp(1rem,4vw,2.5rem) 1.4rem;
  font-size:.82rem;color:var(--slate);max-width:72ch}
.hint strong{color:var(--ink);font-weight:500}

/* ---- The sheet ------------------------------------------------------ */
.sheet{display:none;background:#fff;color:var(--ink);
  width:210mm;max-width:100%;min-height:297mm;
  margin:0 auto 3rem;padding:14mm 15mm 12mm;
  box-shadow:0 10px 40px rgba(20,38,42,.13)}
.sheet.is-on{display:block}
@media (max-width:860px){
  .sheet{width:auto;min-height:0;padding:1.5rem 1.25rem 2rem;box-shadow:none}
}

.sheet__logo{height:30px;width:auto;margin-bottom:1.1rem}
.eyebrow{font-family:var(--display);font-size:8.5pt;font-weight:500;
  letter-spacing:.22em;text-transform:uppercase;color:var(--slate)}
.sheet h1{font-size:26pt;font-weight:400;letter-spacing:-.01em;margin:.15rem 0 .5rem}
.rule{height:1px;background:var(--champagne);margin-bottom:1rem}

/* Teal-tinted section bar, as on the printed originals */
.band{display:flex;align-items:center;gap:.6em;
  background:var(--mist);padding:.5em .9em;margin:1.1rem 0 .7rem;
  font-family:var(--display);font-size:8.5pt;font-weight:500;
  letter-spacing:.18em;text-transform:uppercase;color:var(--deep-teal)}
.band::before{content:"";width:5px;height:5px;border-radius:50%;
  background:var(--teal);flex:none}

h2.sub{font-family:var(--display);font-size:11.5pt;font-weight:500;
  color:var(--deep-teal);margin:.95rem 0 .35rem}

.sheet p,.sheet li{font-size:9.5pt;line-height:1.45}
.sheet p + p{margin-top:.45rem}

/* ---- Fields --------------------------------------------------------- */
.row{display:grid;gap:0 1.6rem;grid-template-columns:1fr}
.row--2{grid-template-columns:1fr 1fr}
@media (max-width:560px){.row--2{grid-template-columns:1fr}}

.f{position:relative;padding-top:.75rem;margin-bottom:.1rem}
.f > label{position:absolute;top:.72rem;left:0;pointer-events:none;
  font-size:9.5pt;color:var(--slate);transition:none}
.f > input{width:100%;border:0;border-bottom:1px solid var(--line-soft);
  background:none;font-family:var(--body);font-size:9.5pt;color:var(--ink);
  padding:.72rem 0 .22rem;line-height:1.3}
.f > input:focus{outline:none;border-bottom-color:var(--teal)}
/* The label sits where the text will be typed, so it has to clear out as
   soon as there is content — :placeholder-shown is what detects that. */
.f > input:focus + label,
.f > input:not(:placeholder-shown) + label{opacity:0}

/* Title radios (Ms / Mrs / Mr) */
.titles{display:flex;align-items:center;gap:1.4rem;flex-wrap:wrap;
  font-size:9.5pt;margin:.3rem 0 .2rem}
.titles > span:first-child{color:var(--ink)}
.opt{display:inline-flex;align-items:center;gap:.4em;cursor:pointer}
.opt input{appearance:none;-webkit-appearance:none;margin:0;
  width:11px;height:11px;border:1px solid var(--line);border-radius:50%;
  background:#fff;flex:none;cursor:pointer}
.opt input[type="checkbox"]{border-radius:2px}
.opt input:checked{background:var(--teal);box-shadow:inset 0 0 0 2px #fff;
  border-color:var(--teal)}
.opt input:focus-visible{outline:2px solid var(--teal);outline-offset:2px}

/* Checklist lines (acknowledgements, initial boxes) */
.checks{list-style:none;margin:.45rem 0 0;padding:0;display:grid;gap:.42rem}
.checks li{display:grid;grid-template-columns:auto 1fr;gap:.6em;
  align-items:start;font-size:9.5pt;line-height:1.45}
.checks input{margin-top:.22em}
.initial{width:62px;border:0;border-bottom:1px solid var(--line);
  background:none;font-family:var(--body);font-size:9.5pt;
  text-align:center;padding:0 0 .1rem}
.initial:focus{outline:none;border-bottom-color:var(--teal)}

/* Bulleted information, matching the printed dot styles */
ul.dots,ul.rings{list-style:none;margin:.3rem 0 0;padding:0;display:grid;gap:.26rem}
ul.dots > li,ul.rings > li{position:relative;padding-left:1rem}
ul.dots > li::before{content:"";position:absolute;left:.1rem;top:.52em;
  width:4px;height:4px;border-radius:50%;background:var(--teal)}
ul.rings{margin-left:1rem;margin-top:.22rem}
ul.rings > li::before{content:"";position:absolute;left:.1rem;top:.46em;
  width:4px;height:4px;border-radius:50%;border:1px solid var(--slate)}

/* ---- Medical history table (Client Info Sheet) ---------------------- */
table.hx{width:100%;border-collapse:collapse;margin-top:.5rem;
  font-size:8.6pt;table-layout:fixed}
table.hx th{background:var(--mist);color:var(--deep-teal);text-align:left;
  font-family:var(--display);font-weight:500;font-size:8.6pt;
  padding:.42em .6em;border:1px solid rgba(20,38,42,.1)}
table.hx td{padding:.3em .6em;border:1px solid rgba(20,38,42,.1);
  vertical-align:middle}
table.hx tbody tr:nth-child(odd){background:#F6F8F8}
table.hx col.c-q{width:auto}
table.hx col.c-yn{width:34px}
table.hx col.c-note{width:30%}
table.hx .q small{display:block;color:var(--slate);font-size:7.8pt;line-height:1.3}
table.hx td.yn{text-align:center}
table.hx td.yn input{appearance:none;-webkit-appearance:none;margin:0;
  width:11px;height:11px;border:1px solid var(--line);border-radius:2px;
  background:#fff;cursor:pointer;vertical-align:middle}
table.hx td.yn input:checked{background:var(--teal);border-color:var(--teal);
  box-shadow:inset 0 0 0 2px #fff}
table.hx td.note input{width:100%;border:0;background:none;
  font-family:var(--body);font-size:8.4pt;padding:.1em 0}
table.hx td.note input:focus{outline:none;border-bottom:1px solid var(--teal)}

/* ---- Declaration + signature --------------------------------------- */
.declare{margin-top:.9rem;font-size:8.6pt;line-height:1.45;color:var(--ink)}
.sign{display:flex;align-items:flex-end;gap:1.6rem;flex-wrap:wrap;
  margin-top:1.4rem;padding-top:.8rem;border-top:1px solid var(--line-soft)}
.sign__policy{font-family:var(--display);font-size:8pt;letter-spacing:.14em;
  text-transform:uppercase;color:var(--ink);flex:1 1 auto}
.sign__f{flex:0 0 auto;min-width:150px;text-align:center}
.sign__f input{width:100%;border:0;border-bottom:1px solid var(--line);
  background:none;font-family:var(--body);font-size:9.5pt;padding:.2rem 0 .18rem;
  text-align:center}
.sign__f input:focus{outline:none;border-bottom-color:var(--teal)}
.sign__f span{display:block;margin-top:.28rem;
  font-family:var(--display);font-size:7.6pt;letter-spacing:.16em;
  text-transform:uppercase;color:var(--slate)}

/* =====================================================================
   Print
   One form per sheet. Everything that is not the open form is removed
   from the page entirely so the PDF has no blank trailing pages.
   ===================================================================== */
@page{size:A4;margin:11mm}

@media print{
  html,body{background:#fff}
  .bar,.picker,.hint,.noprint{display:none!important}

  .sheet{display:none!important}
  .sheet.is-on{display:block!important;
    width:auto;min-height:0;margin:0;padding:0;box-shadow:none}

  /* Tints and rules are part of the document, not decoration — keep them. */
  *{-webkit-print-color-adjust:exact;print-color-adjust:exact}

  /* Never split a signature block or a table row across pages. */
  .sign,table.hx tr,.checks li,.f{break-inside:avoid;page-break-inside:avoid}
  h2.sub,.band{break-after:avoid;page-break-after:avoid}

  /* An empty field must still print as a writable line. */
  .f > input,.initial,.sign__f input,table.hx td.note input{
    border-bottom:1px solid #9AA6A8}
  .f > input:not(:placeholder-shown) + label{display:none}

  /* Unticked boxes print as empty outlines, ticked ones solid. */
  .opt input,table.hx td.yn input{border-color:#5C6F72!important}

  /* ---- Compaction -------------------------------------------------
     Screen sizing is comfortable to read and to tap; at A4 it ran four
     of the six forms onto a second, near-empty page. The printed
     originals are all single-sheet, so print tightens type and rhythm
     to match. Measured: the longest form (Botox) lands at ~267mm of the
     275mm printable height. If copy is added to a form, re-measure. */
  .sheet__logo{height:22px;margin-bottom:.5rem}
  .eyebrow{font-size:7.5pt;letter-spacing:.2em}
  .sheet h1{font-size:19pt;margin:.05rem 0 .3rem}
  .rule{margin-bottom:.55rem}

  .band{padding:.34em .7em;margin:.62rem 0 .4rem;font-size:7.6pt}
  h2.sub{font-size:10pt;margin:.5rem 0 .2rem}

  .sheet p,.sheet li{font-size:8.5pt;line-height:1.34}
  .sheet p + p{margin-top:.28rem}

  .f{padding-top:.52rem;margin-bottom:0}
  .f > label{top:.5rem;font-size:8.5pt}
  .f > input{font-size:8.5pt;padding:.5rem 0 .14rem}
  .titles{font-size:8.5pt;margin:.18rem 0 .1rem}

  ul.dots,ul.rings{gap:.14rem}
  ul.rings{margin-top:.14rem}
  .checks{gap:.26rem;margin-top:.3rem}
  .checks li{font-size:8.5pt;line-height:1.34}

  table.hx{font-size:7.6pt;margin-top:.32rem}
  table.hx th{font-size:7.6pt;padding:.26em .5em}
  table.hx td{padding:.14em .5em}
  table.hx .q small{font-size:6.9pt}
  table.hx td.note input{font-size:7.4pt}

  .declare{font-size:7.8pt;line-height:1.34;margin-top:.5rem}
  .sign{margin-top:.7rem;padding-top:.5rem}
  .sign__policy{font-size:7.4pt}
  .sign__f span{font-size:7pt;margin-top:.18rem}
}

/* =====================================================================
   Public intake page (intake.html)
   The consent forms are a clinic tool; this one a visitor meets cold,
   so it opens by explaining itself and what does NOT happen to the data.
   ===================================================================== */
.intro{max-width:46rem;margin:0 auto;padding:clamp(1.5rem,5vw,3rem) clamp(1rem,4vw,2.5rem) 2rem}
.intro__eyebrow{font-family:var(--display);font-size:.78rem;font-weight:500;
  letter-spacing:.22em;text-transform:uppercase;color:var(--deep-teal);
  display:inline-flex;align-items:center;gap:.7em}
.intro__eyebrow::before{content:"";width:6px;height:6px;border-radius:50%;
  background:var(--teal);flex:none}
.intro__h{font-size:clamp(1.7rem,1.2rem+2.2vw,2.7rem);font-weight:400;
  letter-spacing:-.015em;margin:.6rem 0 .9rem;max-width:18ch}
.intro__p{font-size:1rem;line-height:1.6;color:var(--slate);max-width:56ch}
.intro__p--quiet{margin-top:1rem;font-size:.9rem}
.intro__p a,.intro__privacy a{color:var(--deep-teal);text-decoration:underline;
  text-underline-offset:2px}

.steps{list-style:none;margin:1.6rem 0 0;padding:0;display:grid;gap:.75rem;counter-reset:s}
.steps li{display:grid;grid-template-columns:auto 1fr;gap:.9em;align-items:baseline;
  font-size:.95rem;line-height:1.5}
.steps li > span:first-child{font-family:var(--display);font-size:.8rem;font-weight:500;
  width:1.55rem;height:1.55rem;border-radius:50%;flex:none;
  display:inline-flex;align-items:center;justify-content:center;
  background:var(--mist);color:var(--deep-teal)}
.steps strong{font-weight:500;color:var(--ink)}

.intro__privacy{margin-top:1.6rem;padding:1rem 1.15rem;background:var(--mist);
  border-radius:3px;font-size:.9rem;line-height:1.6;color:var(--ink);max-width:60ch}
.intro__privacy strong{font-weight:500}

.outro{max-width:46rem;margin:0 auto;padding:1rem clamp(1rem,4vw,2.5rem) 4rem}
.outro__h{font-size:1.4rem;font-weight:400;margin-bottom:.5rem}
.outro__row{display:flex;gap:.7rem;flex-wrap:wrap;margin-top:1.2rem}

/* A tab that leaves the page rather than switching sheets */
.pick--out{text-decoration:none;display:inline-flex;align-items:center}

/* ---- Quiz results carried onto the sheet --------------------------- */
.qcarry{margin-bottom:.2rem}
.qcarry__lede{font-size:8.8pt;color:var(--slate);line-height:1.45;margin-bottom:.4rem}
.qcarry__list{list-style:none;margin:.1rem 0 0;padding:0;
  display:flex;flex-wrap:wrap;gap:.4rem .5rem}
.qcarry__list li{font-family:var(--display);font-size:9pt;letter-spacing:.02em;
  padding:.3em .75em;border:1px solid var(--champagne);border-radius:2px;
  color:var(--ink)}
.qcarry__note{margin-top:.45rem;font-size:8.2pt;color:var(--slate)}

@media print{
  .intro,.outro{display:none!important}
  .qcarry__lede{font-size:7.8pt}
  .qcarry__list li{font-size:8pt;padding:.22em .6em}
  .qcarry__note{font-size:7.4pt}
}

/* =====================================================================
   Date fields
   A date input has no placeholder state, so the floating-label trick used
   on the text fields cannot detect emptiness and the label would sit on
   top of the value. These fields put the label above instead:
   column-reverse keeps the DOM order (input, then label) that the rest of
   the stylesheet relies on, while rendering the label first.
   ===================================================================== */
.f--date{display:flex;flex-direction:column-reverse;padding-top:0;
  margin-bottom:.1rem}
.f--date > label{position:static;opacity:1!important;pointer-events:auto;
  font-size:8.6pt;color:var(--slate);margin-bottom:.1rem}
.f--date > input{width:100%;border:0;border-bottom:1px solid var(--line-soft);
  background:none;font-family:var(--body);font-size:9.5pt;color:var(--ink);
  padding:.18rem 0 .22rem;line-height:1.3}
.f--date > input:focus{outline:none;border-bottom-color:var(--teal)}
/* Date inputs ignore width:100% in some engines without this. */
.f--date > input[type="date"]{min-width:0;-webkit-appearance:none;appearance:none}
.f--date > input::-webkit-calendar-picker-indicator{opacity:.45;cursor:pointer}
.f--date > input:focus::-webkit-calendar-picker-indicator{opacity:1}

.sign__f input[type="date"]{text-align:center}
.sign__f input[type="date"]::-webkit-calendar-picker-indicator{opacity:.4}

/* =====================================================================
   Signature pad
   Drawn on a canvas with a fixed 900x200 backing store, so it prints
   sharp whatever width it renders at. The ruled baseline stays visible
   underneath, so an unsigned form still prints as a line to sign by hand.
   ===================================================================== */
.sign__f--pad{min-width:200px;flex:1 1 220px;max-width:300px}
.sigpad{position:relative;border-bottom:1px solid var(--line)}
.sigpad__c{display:block;width:100%;height:62px;touch-action:none;cursor:crosshair}
.sigpad__clear{position:absolute;top:-1.45rem;right:0;
  background:none;border:0;cursor:pointer;padding:.1rem .2rem;
  font-family:var(--display);font-size:7.6pt;letter-spacing:.12em;
  text-transform:uppercase;color:var(--slate);
  transition:color var(--dur-1,.3s) ease}
.sigpad__clear:hover{color:var(--ink)}
.sigpad__clear:focus-visible{outline:2px solid var(--teal);outline-offset:2px}

@media print{
  .sigpad__clear{display:none!important}
  .sigpad{border-bottom:1px solid #9AA6A8}
  .sigpad__c{height:52px}
  .f--date > label{font-size:7.6pt}
  .f--date > input{font-size:8.5pt;border-bottom:1px solid #9AA6A8}
  /* The native picker arrow is screen furniture, not part of the document. */
  input[type="date"]::-webkit-calendar-picker-indicator{display:none!important}
}

@media print{
  /* The signature pad is generous on screen for drawing; in print it only
     has to hold the mark, so it gives a few millimetres back everywhere. */
  .sigpad__c{height:44px}

  /* The imagery consent carries far more text than the treatment forms and
     landed 6mm over a single A4 page once the pad was added. These tighten
     only that sheet. Re-measure if its wording grows. */
  #form-imagery .checks{gap:.2rem;margin-top:.24rem}
  #form-imagery ul.dots{gap:.1rem}
  #form-imagery .sheet p + p,
  #form-imagery p{line-height:1.3}
  #form-imagery h2.sub{margin:.38rem 0 .14rem}
  #form-imagery .band{margin:.5rem 0 .32rem}
  #form-imagery .declare{line-height:1.28;margin-top:.4rem}
  #form-imagery .sign{margin-top:.5rem;padding-top:.4rem}
}

/* =====================================================================
   INTAKE — screen furniture. The printed sheet is untouched by all of
   this; every block here is .noprint or inside a print media query.
   ===================================================================== */

/* ---- top bar links --------------------------------------------------- */
.bar__nav{display:flex;align-items:center;gap:1.2rem;flex-wrap:wrap}
.bar__nav a{font-family:var(--display);font-size:.86rem;letter-spacing:.03em;
  color:var(--ink);text-decoration:none;padding-bottom:2px;
  border-bottom:1px solid transparent}
.bar__nav a:hover,.bar__nav a:focus-visible{border-bottom-color:var(--champagne)}

/* ---- the welcome dialog ----------------------------------------------
   Read once, dismissed, and the form is then the whole page. Starts
   hidden and is opened by script, so with JS off the form is simply
   available rather than sitting behind a dialog that cannot be closed. */
.welcome{position:fixed;inset:0;z-index:100;display:grid;place-items:center;
  padding:1rem;background:rgba(20,38,42,.62);overflow-y:auto}
.welcome[hidden]{display:none!important}
.welcome__box{background:#fff;border-radius:4px;padding:clamp(1.4rem,4vw,2.4rem);
  width:min(36rem,100%);box-shadow:0 30px 70px rgba(20,38,42,.34);
  max-height:calc(100vh - 2rem);overflow-y:auto}
.welcome__box .intro__h{margin:.3rem 0 .8rem}
.welcome__ok{display:grid;grid-template-columns:auto 1fr;gap:.6rem;
  align-items:center;margin:1.2rem 0 1rem;font-size:.92rem;cursor:pointer}
.welcome__ok input{width:18px;height:18px;accent-color:var(--teal)}
.welcome__box .btn:disabled{opacity:.45;cursor:not-allowed}

/* ---- the action bar --------------------------------------------------- */
.actions{max-width:46rem;margin:2rem auto 3rem;padding:1.4rem;
  border:1px solid var(--line-soft);border-radius:4px;background:#fff}
.actions__row{display:flex;gap:.7rem;flex-wrap:wrap;align-items:center}
.actions__row .btn{flex:0 1 auto}
.send__consent{display:grid;grid-template-columns:auto 1fr;gap:.6rem;
  align-items:start;margin-bottom:1.1rem;font-size:.86rem;line-height:1.55;
  color:var(--slate)}
.send__consent input{width:17px;height:17px;margin-top:.15rem;accent-color:var(--teal)}
.send__consent em{font-style:normal;color:var(--ink)}
.send__msg{margin-top:.9rem;font-size:.88rem;min-height:1.2em}
.send__msg--ok{color:var(--teal)}
.send__msg--bad{color:#C0392B}
.send__fine{margin-top:1rem;font-size:.78rem;line-height:1.5;color:var(--slate)}

/* ---- "if yes, please clarify" is required ----------------------------
   A ticked Yes with nothing beside it is the one answer on this sheet
   that is worse than no answer: it says something applies but not what.
   The row is marked as soon as Yes is ticked, and flagged red only once
   it has actually been left empty at the point of sending or printing. */
.hx tr.is-required td.note input{border-bottom-color:var(--teal)}
.hx tr.is-required td.note input::placeholder{color:var(--teal);opacity:.75}
.hx tr.is-missing td.note input{
  border-bottom-color:#C0392B;background:rgba(192,57,43,.06)}
.hx tr.is-missing td.q{color:#C0392B}

/* ---- the free-text box on the sheet ----------------------------------- */
.f--area textarea{width:100%;font:inherit;color:inherit;background:none;
  border:0;border-bottom:1px solid var(--line);padding:.5rem 0;resize:vertical}

@media print{
  .welcome,.actions{display:none!important}
  .hx tr.is-missing td.note input,.hx tr.is-required td.note input{
    border-bottom-color:var(--line);background:none}
  .hx tr.is-missing td.q{color:inherit}
}
