/*
 * Styles for the parts of the site rebuilt by hand: the review wizard, the
 * contact form, and the shared form controls. Everything below uses the
 * existing KHG design tokens so it sits inside the original design.
 */

/* ------------------------------------------------------------ forms */
.khg-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.khg-grid-2 {
  display: grid;
  gap: 1rem;
}

@media (min-width: 640px) {
  .khg-grid-2 { grid-template-columns: 1fr 1fr; }
}

.khg-field {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.khg-field > span {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--khg-navy-900);
}

.khg-field input,
.khg-field textarea,
.khg-field select {
  width: 100%;
  min-height: 52px;
  padding: 0.75rem 1rem;
  font: inherit;
  color: var(--khg-ink);
  background: var(--khg-card);
  border: 2px solid var(--khg-line);
  border-radius: var(--radius-md);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.khg-field textarea {
  min-height: 120px;
  resize: vertical;
}

.khg-field input:focus,
.khg-field textarea:focus,
.khg-field select:focus {
  outline: none;
  border-color: var(--khg-emerald-600);
  box-shadow: 0 0 0 3px var(--khg-emerald-100);
}

.khg-invalid input,
.khg-invalid textarea,
.khg-invalid select {
  border-color: var(--khg-error);
}

.khg-error {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--khg-error);
}

/* ---------------------------------------------------------- consent */
/*
 * The opt-in box. It is deliberately prominent and never pre-checked —
 * a pre-checked consent box is the fastest way to fail 10DLC review.
 */
.khg-consent {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 1rem 1.125rem;
  background: var(--khg-bone-soft);
  border: 1px solid var(--khg-line);
  border-radius: var(--radius-lg);
}

.khg-consent input[type="checkbox"] {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: var(--khg-emerald-600);
  cursor: pointer;
}

.khg-consent label {
  font-size: 0.8125rem;
  line-height: 1.6;
  color: var(--khg-ink-soft);
  cursor: pointer;
}

.khg-consent a {
  font-weight: 600;
  color: var(--khg-emerald-700);
  text-decoration: underline;
}

.khg-consent.khg-invalid {
  border-color: var(--khg-error);
  background: #fef3f2;
}

/* --------------------------------------------------------- buttons */
.khg-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 56px;
  padding: 0 1.75rem;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  text-decoration: none;
  background: var(--khg-emerald-600);
  border: 0;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.khg-btn-primary:hover:not(:disabled) {
  background: var(--khg-emerald-700);
  transform: translateY(-2px);
  box-shadow: var(--shadow-pop);
}

.khg-btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.khg-btn-primary:focus-visible {
  outline: 2px solid var(--khg-emerald-600);
  outline-offset: 2px;
}

/* ---------------------------------------------------- form status */
.khg-form-status {
  font-size: 0.875rem;
  line-height: 1.6;
}

.khg-form-status--error {
  font-weight: 600;
  color: var(--khg-error);
}

.khg-form-status a {
  font-weight: 700;
  text-decoration: underline;
}

.khg-success {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 1.5rem;
  background: var(--khg-emerald-100);
  border: 1px solid var(--khg-emerald-600);
  border-radius: var(--radius-lg);
}

.khg-success-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--khg-emerald-700);
}

.khg-empty {
  padding: 1.5rem 0;
  color: var(--khg-ink-soft);
}

/* ----------------------------------------------------- the wizard */
.khg-wiz {
  max-width: 42rem;
  margin: 0 auto;
  padding: 1.5rem 0 4rem;
}

.khg-wiz-head { margin-bottom: 2rem; }

.khg-wiz-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--khg-ink-soft);
}

.khg-wiz-meta a { color: var(--khg-emerald-700); }
.khg-wiz-meta a:hover { text-decoration: underline; }

.khg-wiz-bar {
  width: 100%;
  height: 8px;
  overflow: hidden;
  background: var(--khg-bone-soft);
  border-radius: 999px;
}

.khg-wiz-fill {
  height: 100%;
  background: var(--khg-emerald-600);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.khg-wiz-body {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.khg-wiz-title {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 600;
  line-height: 1.2;
  color: var(--khg-navy-900);
}

.khg-wiz-title:focus { outline: none; }

.khg-wiz-sub {
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--khg-ink-soft);
}

.khg-wiz-fine {
  font-size: 0.75rem;
  line-height: 1.6;
  color: var(--khg-ink-soft);
}

.khg-wiz-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.khg-wiz-option {
  width: 100%;
  min-height: 64px;
  padding: 1rem 1.5rem;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--khg-navy-900);
  text-align: left;
  background: #fff;
  border: 2px solid var(--khg-line);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.khg-wiz-option:hover,
.khg-wiz-option:focus-visible {
  border-color: var(--khg-emerald-600);
  box-shadow: var(--shadow-card);
  outline: none;
}

.khg-wiz-option.is-selected {
  background: var(--khg-emerald-100);
  border-color: var(--khg-emerald-600);
}

.khg-wiz-input {
  width: 100%;
  min-height: 64px;
  padding: 0 1.25rem;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--khg-navy-900);
  background: #fff;
  border: 2px solid var(--khg-line);
  border-radius: var(--radius-md);
}

.khg-wiz-input:focus {
  outline: none;
  border-color: var(--khg-emerald-600);
  box-shadow: 0 0 0 3px var(--khg-emerald-100);
}

.khg-wiz-cta { align-self: flex-start; }

.khg-wiz-back {
  align-self: flex-start;
  padding: 0.5rem 0;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--khg-ink-soft);
  background: none;
  border: 0;
  cursor: pointer;
}

.khg-wiz-back:hover { color: var(--khg-navy-900); text-decoration: underline; }

.khg-wiz-form { gap: 1.25rem; }

/* ------------------------------------------------- compare cards */
.khg-compare {
  display: grid;
  gap: 1rem;
}

@media (min-width: 640px) {
  .khg-compare { grid-template-columns: 1fr 1fr; }
}

.khg-compare-card {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  padding: 1.5rem;
  background: #fff;
  border: 2px solid var(--khg-line);
  border-radius: var(--radius-lg);
}

.khg-compare-tag {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--khg-emerald-700);
}

.khg-compare-head {
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 600;
  color: var(--khg-navy-900);
}

.khg-compare-note {
  font-size: 0.9375rem;
  color: var(--khg-ink-soft);
}

/* -------------------------------------------------- plan pickers */
.khg-plan-legend {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--khg-ink-soft);
}

.khg-plan-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.khg-plan {
  display: flex;
  gap: 0.875rem;
  align-items: flex-start;
  padding: 1rem 1.125rem;
  background: #fff;
  border: 2px solid var(--khg-line);
  border-radius: var(--radius-md);
  transition: border-color 0.15s ease;
}

.khg-plan:has(input:checked) {
  background: color-mix(in srgb, var(--khg-emerald-100) 45%, #fff);
  border-color: var(--khg-emerald-600);
}

.khg-plan input[type="checkbox"] {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: var(--khg-emerald-600);
  cursor: pointer;
}

.khg-plan label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  cursor: pointer;
}

.khg-plan-name {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--khg-navy-900);
}

.khg-plan-desc {
  font-size: 0.8125rem;
  line-height: 1.6;
  color: var(--khg-ink-soft);
}

/* ------------------------------------------------ confirmation */
.khg-done-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  font-size: 2rem;
  color: #fff;
  background: var(--khg-emerald-600);
  border-radius: 999px;
}

.khg-done-label {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  opacity: 0.85;
}

.khg-btn-primary .khg-done-label + span { font-size: 1.125rem; }

.khg-btn-primary:has(.khg-done-label) {
  flex-direction: column;
  gap: 0;
  min-height: 68px;
}

/* ------------------------------------------------- motion safety */
@media (prefers-reduced-motion: reduce) {
  .khg-wiz-fill,
  .khg-btn-primary,
  .khg-wiz-option { transition: none; }
  .khg-btn-primary:hover:not(:disabled) { transform: none; }
}

/* ------------------------------------------------ legal definition list */
/*
 * Used by the SMS Terms "Program at a glance" table. Own classes on purpose:
 * styles.css is a compiled bundle holding only the utilities the old build
 * emitted, so utilities it never used (md:w-56, last:border-0) are absent.
 */
.khg-dl {
  margin-top: 0.25rem;
}

.khg-dl-row {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--khg-line);
}

.khg-dl-row:last-child {
  border-bottom: 0;
}

.khg-dl-row dt {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--khg-navy-900);
}

.khg-dl-row dd {
  color: var(--khg-ink-soft);
  line-height: 1.65;
}

@media (min-width: 768px) {
  .khg-dl-row {
    flex-direction: row;
    gap: 1.5rem;
  }
  .khg-dl-row dt {
    flex: 0 0 14rem;
  }
}

/* --------------------------------------------------- scroll reveal */
/*
 * styles.css starts .khg-reveal sections at opacity 0 and only paints them
 * once .khg-visible is added by script. If the script is blocked or throws,
 * that would leave 86 sections across the site permanently invisible — so the
 * hidden state only applies when JS has announced itself on <html>.
 */
html:not(.khg-js) .khg-reveal {
  opacity: 1;
  transform: none;
  transition: none;
}

@media (prefers-reduced-motion: reduce) {
  .khg-reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
