/* ============================================================
   AHM Cost Calculator
   Relies on brand tokens defined in the theme's style.css.
   Falls back gracefully if tokens are absent.
============================================================ */

/* Layout */
.ahm-calc-wrap {
  --calc-gap: clamp(24px, 4vw, 48px);
}

.calc-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: var(--calc-gap);
  align-items: start;
}

/* ---- Form Card ---- */
.form-card {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e7ddcd);
  border-radius: var(--radius-xl, 28px);
  padding: clamp(28px, 4vw, 48px);
  box-shadow: var(--shadow-sm, 0 2px 8px rgba(46,40,36,.07));
}

/* ---- Steps ---- */
.calc-step {
  margin-bottom: 32px;
}
.calc-step:last-of-type {
  margin-bottom: 0;
}

.step-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-sans, 'Mulish', sans-serif);
  font-size: 15px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text, #2e2824);
  margin-bottom: 16px;
}
.step-label .n {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--green-400, #b8c42a);
  color: var(--ink-900, #211d19);
  font-size: 14px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ---- Chip buttons ---- */
.opt-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.opt-chip {
  cursor: pointer;
}
.opt-chip input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}
.opt-chip span {
  display: block;
  padding: 11px 20px;
  border-radius: var(--radius-pill, 999px);
  border: 2px solid var(--border, #e7ddcd);
  font-family: var(--font-sans, 'Mulish', sans-serif);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-soft, #5c5040);
  background: var(--surface, #fff);
  transition: all .15s ease;
  white-space: nowrap;
  user-select: none;
}
.opt-chip:hover span {
  border-color: var(--sand-400, #bcac90);
  color: var(--ink-900, #211d19);
}
.opt-chip input:checked + span {
  background: var(--ink-800, #2e2824);
  border-color: var(--ink-800, #2e2824);
  color: #fff;
}
.opt-chip input:focus-visible + span {
  outline: 2px solid var(--green-400, #b8c42a);
  outline-offset: 2px;
}

/* ---- Lead form fields ---- */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field label {
  font-family: var(--font-sans, 'Mulish', sans-serif);
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-700, #3e372f);
  text-transform: uppercase;
  letter-spacing: .08em;
}
.field .req {
  color: var(--clay-400, #cd744f);
}
.field input,
.field select {
  font-family: var(--font-sans, 'Mulish', sans-serif);
  font-size: 15px;
  color: var(--ink-900, #211d19);
  background: var(--surface, #fff);
  border: 1.5px solid var(--border, #e7ddcd);
  border-radius: var(--radius-md, 14px);
  padding: 12px 16px;
  outline: none;
  width: 100%;
  transition: border-color .15s ease, box-shadow .15s ease;
  appearance: none;
}
.field input::placeholder {
  color: var(--text-muted, #786a54);
}
.field input:focus,
.field select:focus {
  border-color: var(--green-400, #b8c42a);
  box-shadow: 0 0 0 3px rgba(184,196,42,.15);
}
.field input.ahm-error,
.field select.ahm-error {
  border-color: var(--clay-400, #cd744f);
}
/* Custom select arrow */
.field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235c5040' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
  cursor: pointer;
}

/* ---- Form actions ---- */
.form-actions {
  margin-top: 28px;
}
.form-actions .btn {
  width: 100%;
  justify-content: center;
}
.form-note {
  margin-top: 14px;
  font-size: 13px;
  color: var(--text-muted, #786a54);
  text-align: center;
  line-height: 1.5;
}
.form-note a {
  color: var(--accent-deep, #9a4d31);
  text-decoration: none;
  font-weight: 700;
}
.ahm-calc-error {
  margin-top: 12px;
  font-size: 14px;
  color: var(--danger, #b5462f);
  font-weight: 600;
  min-height: 0;
  text-align: center;
}

/* ---- Success state ---- */
.calc-success {
  display: none;
}
.calc-success.ahm-show {
  display: block;
}
.success-banner {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  background: var(--green-50, #f7f9e9);
  border: 1px solid var(--green-200, #dbe595);
  border-radius: var(--radius-lg, 20px);
  padding: 24px;
  margin-bottom: 24px;
}
.success-banner .ic {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--green-400, #b8c42a);
  color: var(--ink-900, #211d19);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.success-banner h3 {
  font-family: var(--font-display, 'Newsreader', serif);
  font-size: 22px;
  font-weight: 400;
  color: var(--green-800, #4a521a);
  margin-bottom: 6px;
}
.success-banner p {
  font-size: 15px;
  color: var(--green-700, #626c1c);
  line-height: 1.6;
}
.success-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* ---- Estimate sidebar ---- */
.estimate-card {
  background: var(--ink-800, #2e2824);
  color: rgba(250,247,241,.9);
  border-radius: var(--radius-xl, 28px);
  padding: 32px 28px;
  position: sticky;
  top: 104px; /* below sticky header */
}
.estimate-card .lab {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--green-300, #c9d75a);
  margin-bottom: 10px;
}
.estimate-card .amount {
  font-family: var(--font-display, 'Newsreader', serif);
  font-size: clamp(30px, 4vw, 40px);
  font-weight: 400;
  color: #fff;
  line-height: 1;
  margin-bottom: 8px;
}
.estimate-card .amount .sep {
  color: rgba(250,247,241,.4);
}
.estimate-card .est-sub {
  font-size: 13px;
  color: rgba(250,247,241,.6);
  margin-bottom: 20px;
}
.est-divider {
  height: 1px;
  background: rgba(255,255,255,.1);
  margin-bottom: 20px;
}
.est-lines {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}
.est-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: 14px;
}
.est-line span {
  color: rgba(250,247,241,.6);
  flex-shrink: 0;
}
.est-line b {
  color: #fff;
  font-weight: 700;
  text-align: right;
}
.lead-prompt {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 13px;
  font-weight: 700;
  color: var(--green-300, #c9d75a);
  line-height: 1.5;
  margin-bottom: 16px;
}
.lead-prompt svg {
  flex-shrink: 0;
  margin-top: 1px;
}
.disclaimer {
  font-size: 12px;
  color: rgba(250,247,241,.45);
  line-height: 1.6;
}

/* ============================================================
   BUTTONS (mirrors theme — defined here as fallback in case
   the shortcode is used outside the theme context)
============================================================ */
.ahm-calc-wrap .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--font-sans, 'Mulish', sans-serif);
  font-weight: 800;
  font-size: 16px;
  line-height: 1;
  padding: 17px 28px;
  border-radius: var(--radius-pill, 999px);
  border: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: transform .15s ease, box-shadow .2s ease, background .2s ease;
  white-space: nowrap;
}
.ahm-calc-wrap .btn.btn-lg {
  padding: 20px 34px;
  font-size: 17px;
}
.ahm-calc-wrap .btn-primary {
  background: var(--clay-400, #cd744f);
  color: #fff;
  box-shadow: var(--shadow-sm, 0 2px 8px rgba(46,40,36,.07));
}
.ahm-calc-wrap .btn-primary:hover {
  background: var(--clay-500, #b95e3b);
  transform: translateY(-2px);
  color: #fff;
}
.ahm-calc-wrap .btn-secondary {
  background: transparent;
  color: var(--ink-800, #2e2824);
  border-color: var(--sand-300, #d7c9b3);
}
.ahm-calc-wrap .btn-secondary:hover {
  border-color: var(--ink-800, #2e2824);
  background: var(--surface, #fff);
  transform: translateY(-2px);
}
.ahm-calc-wrap .btn .icon {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Submitting state */
.ahm-calc-wrap .btn[data-loading] {
  opacity: .7;
  pointer-events: none;
  cursor: wait;
}

/* ============================================================
   RESPONSIVE
============================================================ */
@media (max-width: 860px) {
  .calc-layout {
    grid-template-columns: 1fr;
  }
  .estimate-card {
    position: static;
    order: -1; /* show estimate above form on mobile */
  }
  .estimate-card .amount {
    font-size: 34px;
  }
}
@media (max-width: 540px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
  .opt-chips {
    gap: 8px;
  }
  .success-actions {
    flex-direction: column;
  }
  .success-actions .btn {
    width: 100%;
  }
}

/* ============================================================
   CALCULATOR WIDGET  [ahm_cost_calculator_widget]
   Compact interactive estimator — embeddable anywhere.
============================================================ */

.ahm-calc-widget {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: clamp(24px, 4vw, 48px);
  align-items: start;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e7ddcd);
  border-radius: var(--radius-xl, 28px);
  padding: clamp(28px, 4vw, 48px);
  box-shadow: var(--shadow-md, 0 8px 20px rgba(46,40,36,.09));
}

/* ---- Left column: form ---- */
.acw-head {
  margin-bottom: 24px;
}
.acw-head .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .15em;
  color: var(--brand-deep, #626c1c);
  margin-bottom: 10px;
}
.acw-head .eyebrow::before {
  content: "";
  width: 22px;
  height: 2px;
  background: var(--green-400, #b8c42a);
  border-radius: 2px;
}
.acw-title {
  font-family: var(--font-display, 'Newsreader', serif);
  font-weight: 400;
  font-size: clamp(22px, 2.4vw, 28px);
  line-height: 1.15;
  color: var(--ink-900, #211d19);
  margin-bottom: 8px;
}
.acw-sub {
  font-size: 15px;
  color: var(--text-soft, #5c5040);
  line-height: 1.55;
}

.acw-step {
  margin-bottom: 20px;
}
.acw-step-label {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-muted, #786a54);
  margin-bottom: 10px;
}

.acw-cta {
  width: 100%;
  justify-content: center;
  margin-top: 8px;
}
.acw-note {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted, #786a54);
  margin-top: 10px;
}

/* ---- Right column: live estimate ---- */
.acw-estimate {
  background: var(--ink-800, #2e2824);
  color: rgba(250,247,241,.9);
  border-radius: var(--radius-xl, 28px);
  padding: 28px 24px;
  position: sticky;
  top: 100px;
}
.acw-est-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--green-300, #c9d75a);
  margin-bottom: 8px;
}
.acw-est-amount {
  font-family: var(--font-display, 'Newsreader', serif);
  font-size: clamp(28px, 3.5vw, 38px);
  font-weight: 400;
  color: #fff;
  line-height: 1;
  margin-bottom: 6px;
}
.acw-est-sep {
  color: rgba(250,247,241,.4);
}
.acw-est-range {
  font-size: 12px;
  color: rgba(250,247,241,.55);
  margin-bottom: 18px;
}
.acw-est-divider {
  height: 1px;
  background: rgba(255,255,255,.1);
  margin-bottom: 16px;
}
.acw-est-lines {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}
.acw-est-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: 13px;
}
.acw-est-line span {
  color: rgba(250,247,241,.6);
  flex-shrink: 0;
}
.acw-est-line b {
  color: #fff;
  font-weight: 700;
  text-align: right;
}
.acw-disclaimer {
  font-size: 11px;
  color: rgba(250,247,241,.4);
  line-height: 1.55;
}

/* ---- Responsive ---- */
@media (max-width: 780px) {
  .ahm-calc-widget {
    grid-template-columns: 1fr;
  }
  .acw-estimate {
    position: static;
    order: -1;
  }
}
