/* ==========================================================================
   Kaldrin Developments — components
   Buttons, links and form controls for the inner pages.
   (The header, mobile menu and footer live in css/chrome.css.)
   ========================================================================== */

/* ---------- Buttons ---------- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 28px;
  font-size: var(--fs-label);
  font-weight: 500;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  white-space: nowrap;
  border: 1px solid transparent;
  overflow: hidden;
  isolation: isolate;
  touch-action: manipulation;
  transition: color var(--dur-base) var(--ease-out), border-color var(--dur-base) var(--ease-out), background-color var(--dur-base) var(--ease-out);
}
.btn--sm { min-height: 42px; padding: 0 22px; }
/* Very narrow screens: long labels may wrap rather than push the layout wider */
@media (max-width: 380px) {
  .btn { max-width: 100%; padding-inline: 18px; white-space: normal; text-align: center; line-height: 1.5; }
}
.btn--block { width: 100%; }
/* Label left, drawn arrow right (care plan CTAs) */
.btn--split { justify-content: space-between; gap: 16px; }
.btn .arrow { transition: width var(--dur-base) var(--ease-out); }

.btn--solid { background: var(--btn-fill); color: var(--btn-ink); }

.btn--outline { border-color: var(--line-3); color: var(--text); }
/* Fill wipes up from the bottom edge on hover */
.btn--outline::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--iron-100);
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform 420ms var(--ease-out);
}
/* Hover effects only where a real pointer exists, so taps never leave them stuck on */
@media (hover: hover) {
  .btn--solid:hover { background: var(--btn-fill-hover); }
  .btn--outline:hover { color: var(--btn-ink); border-color: var(--iron-100); }
  .btn--outline:hover::before { transform: scaleY(1); }
  .text-link:hover { color: var(--text-strong); }
  .text-link:hover .arrow { width: 30px; }
  .btn:hover .arrow { width: 30px; }
}

.btn:active { transform: translateY(1px); }
/* Touch: brief pressed state instead of hover */
@media (hover: none) {
  .btn--solid:active { background: var(--btn-fill-hover); }
  .btn--outline:active { border-color: var(--iron-200); background: var(--surface-3); }
  .text-link:active { color: var(--text-strong); }
}
.btn[disabled] { opacity: 0.5; cursor: progress; }

.btn-row { display: flex; flex-wrap: wrap; gap: 14px; }

/* ---------- Text link with drawn arrow ---------- */
.text-link {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  min-height: 44px;
  font-size: var(--fs-label);
  font-weight: 500;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--text);
  transition: color var(--dur-base) var(--ease-out);
}
.arrow {
  position: relative;
  width: 18px;
  height: 1px;
  background: currentColor;
  transition: width var(--dur-base) var(--ease-out);
}
.arrow::after {
  content: "";
  position: absolute;
  right: 0;
  top: -3px;
  width: 7px;
  height: 7px;
  border-top: 1px solid currentColor;
  border-right: 1px solid currentColor;
  transform: rotate(45deg);
  transform-origin: center;
}

/* ---------- Form controls ---------- */
.field { display: grid; gap: 10px; }
.field label {
  font-size: var(--fs-label);
  font-weight: 500;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--text-muted);
}
.req { color: var(--text); }

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 50px;
  padding: 13px 16px;
  font-size: 1rem; /* 16px avoids iOS zoom */
  line-height: 1.5;
  color: var(--text-strong);
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: 0;
  appearance: none;
  transition: border-color var(--dur-base) var(--ease-out), background-color var(--dur-base) var(--ease-out);
}
.field textarea { resize: vertical; min-height: 140px; }
.field input:hover,
.field select:hover,
.field textarea:hover { border-color: var(--line-3); }
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--iron-300);
  background: var(--surface-2);
}
.field [aria-invalid="true"] { border-color: var(--error); }

.select { position: relative; }
.select::after {
  content: "";
  position: absolute;
  right: 18px;
  top: 50%;
  width: 7px;
  height: 7px;
  margin-top: -6px;
  border-right: 1px solid var(--text-muted);
  border-bottom: 1px solid var(--text-muted);
  transform: rotate(45deg);
  pointer-events: none;
}
.select select { padding-right: 44px; cursor: pointer; }
.select select option { background: var(--surface); color: var(--text-strong); }

.field__hint { font-size: var(--fs-small); color: var(--text-muted); line-height: 1.5; }
.field__error { font-size: var(--fs-small); color: var(--error); line-height: 1.5; min-height: 0; }
.field__error:empty { display: none; }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
