/* ==========================================================================
   DHARMIKAM — FORM KIT
   The shared surface and controls every lead form on the site is built from:
   the cream sheet a Bootstrap modal wears, and the fields inside it.

   Nothing here is tied to one form. A sheet sets its own width, and its own
   band lives in its own file — .plan-visit and .talk-doc both draw from here,
   so a field, a focus ring or an error message is written once.

   The controls are the contact page's own: the same pill, the same hairline,
   the same gold focus ring, so a form in a popup and a form on a page read as
   one family.

   Loaded before the sheets that use it.
   ========================================================================== */

/* ==========================================================================
   1. THE SHEET
   Bootstrap's modal carries the behaviour — focus, Escape, the backdrop click
   and the scroll lock — exactly as it does for the film band's lightbox. Only
   the surface is the site's own.
   ========================================================================== */
.dh-sheet{backdrop-filter:blur(5px);-webkit-backdrop-filter:blur(5px)}

.dh-sheet .modal-content{
  position:relative;overflow:hidden;isolation:isolate;
  padding:clamp(2rem,3.4vw,3rem) clamp(1.35rem,3vw,3rem) clamp(1.7rem,2.8vw,2.5rem);
  color:var(--body);
  background:linear-gradient(180deg,#FFFDF8 0%,var(--cream) 58%,#F7EFE0 100%);
  border:1px solid rgba(226,200,138,.55);
  border-radius:var(--r-lg);
  box-shadow:var(--sh-lg);
}
/* a warmth gathered at the top of the sheet, behind the heading */
.dh-sheet .modal-content::before{
  content:"";position:absolute;z-index:-1;pointer-events:none;
  top:-38%;left:50%;width:min(120%,760px);aspect-ratio:1;
  transform:translateX(-50%);
  background:radial-gradient(circle,rgba(192,153,63,.16),transparent 64%);
}

/* The sheet never grows past the screen. Bootstrap already lays .modal-content
   out as a column, so the heading and the close button stay put and the form
   scrolls inside them — a long form on a short laptop never pushes the question
   at the top out of sight. */
.dh-sheet .modal-content{
  max-height:calc(100vh - 2rem);
  max-height:calc(100dvh - 2rem);
}
.dh-sheet .dh-form,
.dh-sheet .dh-sent{
  min-height:0;
  overflow-y:auto;overflow-x:hidden;
  /* room either side for the focus rings, which the edge would clip */
  padding-inline:.4rem;margin-inline:-.4rem;
  scrollbar-width:thin;
  scrollbar-color:rgba(192,153,63,.45) transparent;
}
.dh-sheet .dh-form::-webkit-scrollbar{width:8px}
.dh-sheet .dh-form::-webkit-scrollbar-thumb{
  background:rgba(192,153,63,.4);
  border-radius:var(--r-pill);
}

/* a gentler rise than Bootstrap's own drop */
.dh-sheet.fade .modal-dialog{
  transform:translateY(28px) scale(.986);
  transition:transform .6s var(--ease-out),opacity .45s var(--ease);
}
.dh-sheet.show .modal-dialog{transform:none}

.dh-sheet .btn-close{
  position:absolute;top:clamp(.85rem,1.6vw,1.3rem);right:clamp(.85rem,1.6vw,1.3rem);
  z-index:2;
  width:2.3rem;height:2.3rem;
  padding:0;opacity:.75;border-radius:50%;
  background-color:rgba(15,46,30,.05);
  border:1px solid var(--line);
  transition:background-color .35s var(--ease),transform .45s var(--ease-out),opacity .35s var(--ease);
}
.dh-sheet .btn-close:hover{opacity:1;background-color:rgba(15,46,30,.09);transform:rotate(90deg)}

/* --- the heading --------------------------------------------------------- */
.dh-sheet__head{
  text-align:center;
  margin-bottom:clamp(1.4rem,2.2vw,2rem);
}
.dh-sheet__mark{
  display:block;width:30px;height:30px;
  margin:0 auto .75rem;
  color:var(--gold);
}
.dh-sheet__mark svg{width:100%;height:100%;display:block}

.dh-sheet__title{
  margin:0;
  font-size:clamp(1.55rem,2.4vw,2.15rem);
  line-height:1.14;
  color:var(--deep);
}
.dh-sheet__rule{
  display:block;width:clamp(52px,6vw,78px);height:1px;
  margin:clamp(.8rem,1.3vw,1.05rem) auto 0;
  background:linear-gradient(90deg,transparent,var(--gold),transparent);
}
.dh-sheet__intro{
  max-width:52ch;
  margin:clamp(.9rem,1.5vw,1.2rem) auto 0;
  font-size:clamp(.94rem,.3vw + .88rem,1.02rem);
  line-height:1.7;
  color:var(--body);
}

/* ==========================================================================
   2. THE FIELDS
   Two columns on a desk, one on a phone; --full spans both.
   ========================================================================== */
.dh-grid{
  display:grid;
  grid-template-columns:repeat(2,1fr);
  gap:clamp(.85rem,1.6vw,1.3rem);
  align-items:start;
}
.dh-field--full{grid-column:1 / -1}

/* each field rises in turn once the sheet is open */
.dh-sheet.show .dh-field{animation:fadeUp .65s var(--ease-out) backwards}
.dh-sheet.show .dh-field:nth-child(1){animation-delay:.08s}
.dh-sheet.show .dh-field:nth-child(2){animation-delay:.13s}
.dh-sheet.show .dh-field:nth-child(3){animation-delay:.18s}
.dh-sheet.show .dh-field:nth-child(4){animation-delay:.23s}
.dh-sheet.show .dh-field:nth-child(5){animation-delay:.28s}
.dh-sheet.show .dh-field:nth-child(6){animation-delay:.33s}
.dh-sheet.show .dh-field:nth-child(n+7){animation-delay:.38s}

.dh-field > label,
.dh-field__legend{
  display:block;
  font-size:.72rem;font-weight:600;
  letter-spacing:.19em;text-transform:uppercase;
  color:var(--herb);
  margin-bottom:.55rem;
}
.dh-field .req{color:var(--gold);margin-left:.15rem}
.dh-field .opt{
  margin-left:.4rem;
  font-size:.66rem;letter-spacing:.14em;text-transform:none;
  color:var(--muted);
}

/* a fieldset is only ever a grouping here; it carries none of its own chrome */
.dh-field fieldset{margin:0;padding:0;border:0;min-width:0}
.dh-field legend{padding:0;float:left;width:100%}   /* float: the only way a legend takes a plain block box */
.dh-field legend + *{clear:both}

.dh-input{
  display:block;width:100%;
  padding:.95rem 1.25rem;
  font-family:var(--font-body);
  font-size:1rem;line-height:1.5;
  color:var(--ink);
  background:#fff;
  border:1px solid var(--line);
  border-radius:var(--r-pill);
  box-shadow:var(--sh-xs);
  transition:border-color .35s var(--ease),box-shadow .35s var(--ease),
             background-color .35s var(--ease);
  appearance:none;-webkit-appearance:none;
}
.dh-input::placeholder{color:var(--muted);opacity:1}
.dh-input:hover{border-color:rgba(45,106,79,.3)}
.dh-input:focus{
  outline:0;
  border-color:var(--gold);
  box-shadow:0 0 0 3px rgba(226,200,138,.34);
}

/* The date box: the same pill, with the browser's own picker tinted to match
   and given room of its own at the right-hand end. */
input.dh-input[type="date"]{
  padding-right:1rem;
  color:var(--ink);
  min-height:calc(1.5em + 1.9rem + 2px);   /* matches the text fields exactly */
}
input.dh-input[type="date"]::-webkit-calendar-picker-indicator{
  width:1.1rem;height:1.1rem;
  margin-left:.35rem;
  cursor:pointer;opacity:.55;
  transition:opacity .3s var(--ease);
}
input.dh-input[type="date"]::-webkit-calendar-picker-indicator:hover{opacity:1}
/* An empty date box reads as a placeholder rather than as a filled value.
   The class is kept by js/lead-forms.js, since :placeholder-shown never
   matches a date field. */
input.dh-input[type="date"].is-empty{color:var(--muted)}

/* The dropdowns: the site's own chevron, drawn in the gold the rest of the
   form marks things with, so no browser arrow is ever shown. */
select.dh-input{
  padding-right:2.9rem;
  cursor:pointer;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23C0993F' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat:no-repeat;
  background-position:right 1.15rem center;
  background-size:1.05rem 1.05rem;
}
/* an unchosen dropdown reads as a hint rather than as an answer, whether it
   has to be answered or not */
select.dh-input:invalid,
select.dh-input:has(option[value=""]:checked){color:var(--muted)}
select.dh-input option{color:var(--ink)}

/* The message box is the one field that is not a pill. */
textarea.dh-input{
  border-radius:var(--r-md);
  min-height:112px;resize:vertical;
}

/* --- selectable options -------------------------------------------------- */
.dh-choice{
  display:flex;flex-wrap:wrap;
  gap:.55rem;
}
.dh-choice input{
  position:absolute;width:1px;height:1px;
  margin:-1px;padding:0;border:0;
  clip:rect(0 0 0 0);clip-path:inset(50%);
  overflow:hidden;white-space:nowrap;
}
.dh-choice label{
  display:inline-flex;align-items:center;gap:.5rem;
  margin:0;padding:.62rem 1.15rem;
  font-family:var(--font-body);
  font-size:.86rem;font-weight:500;letter-spacing:0;text-transform:none;
  line-height:1.2;
  color:var(--body);
  background:#fff;
  border:1px solid var(--line);
  border-radius:var(--r-pill);
  box-shadow:var(--sh-xs);
  cursor:pointer;
  transition:border-color .35s var(--ease),color .35s var(--ease),
             background-color .35s var(--ease),box-shadow .35s var(--ease),
             transform .45s var(--ease-out);
}
/* the small ring that fills in when the option is the chosen one */
.dh-choice label::before{
  content:"";flex:none;
  width:.72rem;height:.72rem;
  border-radius:50%;
  border:1.5px solid rgba(45,106,79,.35);
  transition:border-color .35s var(--ease),box-shadow .35s var(--ease);
}
.dh-choice label:hover{border-color:rgba(45,106,79,.34);transform:translateY(-1px)}
.dh-choice input:checked + label{
  color:var(--deep);font-weight:600;
  background:rgba(226,200,138,.2);
  border-color:var(--gold);
  box-shadow:0 0 0 3px rgba(226,200,138,.24);
}
.dh-choice input:checked + label::before{
  border-color:var(--gold);
  box-shadow:inset 0 0 0 3px var(--gold);
}
.dh-choice input:focus-visible + label{
  outline:2.5px solid var(--gold);outline-offset:3px;
}

/* ==========================================================================
   3. VALIDATION
   Shown only once a first attempt has been made, so nothing is red before
   anybody has typed.
   ========================================================================== */
.dh-form.was-validated .dh-input:invalid{
  border-color:#B3543F;
  box-shadow:0 0 0 3px rgba(179,84,63,.16);
}
.dh-form.was-validated .dh-choice:has(input:invalid) label{border-color:#B3543F}

.dh-error{
  display:none;
  margin:.45rem 0 0 1.25rem;
  font-size:.82rem;font-weight:500;color:#B3543F;
}
.dh-form.was-validated .dh-input:invalid ~ .dh-error,
.dh-form.was-validated .dh-choice:has(input:invalid) ~ .dh-error,
.dh-form.was-validated fieldset:has(input:invalid) ~ .dh-error{display:block}

/* ==========================================================================
   4. THE FOOT
   ========================================================================== */
.dh-actions{
  margin-top:clamp(1.4rem,2.2vw,1.9rem);
  text-align:center;
}
.dh-actions .btn-ayur{padding-inline:clamp(1.9rem,3.4vw,2.8rem)}

.dh-note{
  margin:1rem 0 0;
  font-size:.88rem;font-weight:500;line-height:1.55;
  min-height:1.4em;
  color:var(--herb);
}
.dh-note.is-error{color:#B3543F}

/* ==========================================================================
   5. THE ANSWER
   What the sheet shows in place of the form once it has been sent.
   ========================================================================== */
.dh-sent{
  text-align:center;
  padding:clamp(.5rem,1.6vw,1.4rem) 0 clamp(.25rem,1vw,.6rem);
  animation:fadeUp .7s var(--ease-out) both;
}
.dh-sent__mark{
  display:grid;place-items:center;
  width:clamp(58px,6vw,70px);aspect-ratio:1;
  margin:0 auto clamp(1.1rem,1.8vw,1.5rem);
  border-radius:50%;
  color:var(--herb);
  background:rgba(45,106,79,.08);
  border:1px solid rgba(45,106,79,.2);
}
.dh-sent__mark i{font-size:1.7rem}
.dh-sent__title{
  margin:0 0 .6rem;
  font-size:clamp(1.4rem,2.2vw,1.85rem);
  line-height:1.2;
  color:var(--deep);
}
.dh-sent__body{
  max-width:44ch;margin:0 auto;
  font-size:clamp(.96rem,.3vw + .9rem,1.05rem);
  line-height:1.7;
}
.dh-sent .btn-ayur{margin-top:clamp(1.4rem,2.2vw,1.9rem)}

/* once the answer is showing, the sheet keeps its name but drops the
   invitation — it has been taken up */
.dh-sheet .modal-content:has(.dh-sent:not([hidden])) .dh-sheet__intro{display:none}

/* ==========================================================================
   6. RESPONSIVE
   ========================================================================== */
@media (max-width:767.98px){
  .dh-sheet .modal-dialog{max-width:100%;margin:.75rem}
  .dh-sheet .modal-content{
    padding:clamp(2.4rem,7vw,2.8rem) 1.25rem 1.6rem;
    max-height:calc(100dvh - 1.5rem);
  }
  .dh-sheet__mark{width:26px;height:26px}
  .dh-grid{grid-template-columns:1fr}
  .dh-actions .btn-ayur{width:100%}
  textarea.dh-input{min-height:96px}
}

@media (max-width:575.98px){
  .dh-input{padding:.85rem 1.1rem}
  select.dh-input{padding-right:2.6rem;background-position:right 1rem center}
  .dh-error{margin-left:1.1rem}
  .dh-choice{gap:.45rem}
  .dh-choice label{padding:.55rem .95rem;font-size:.82rem}
}
