/*
 * Two-class selectors beat Divi's global input/p rules (input[type=text]:focus is 0,2,1).
 * Departs from the Figma: site fonts instead of Inter (Nunito 500 isn't loaded, so 600), and a
 * darker $ prefix because #94a3b8 failed AA contrast.
 */

/* Defaults; the settings page prints overrides after this file. Keep in step with settings.php. */
.hic {
  --hic-font-heading: 'Montserrat', Helvetica, Arial, Lucida, sans-serif;
  --hic-font: 'Nunito Sans', Helvetica, Arial, Lucida, sans-serif;
  --hic-accent: #ff9900;
  --hic-navy: #0c355a;
  --hic-sky: #92c5f2;
  --hic-ink: #0f172a;
  --hic-muted: #64748b;
  --hic-error: #b91c1c;
  --hic-border: #cbd5e1;
  --hic-border-soft: #e2e8f0;
  --hic-size-label: 13px;
  --hic-size-input: 15px;
  --hic-size-help: 11px;
  --hic-size-result-label: 11px;
  --hic-size-monthly: 34px;
  --hic-size-annual: 26px;
  --hic-size-summary: 12px;

  /* Derived, so one primary colour setting restyles the panel and focus ring. */
  --hic-navy-dark: color-mix(in srgb, var(--hic-navy) 82%, #000);
  --hic-focus: 0 0 0 3px color-mix(in srgb, var(--hic-navy) 25%, transparent);

  container-type: inline-size;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  max-width: 700px;
  margin: 0 auto;
  font-family: var(--hic-font);
  color: var(--hic-ink);
  text-align: left;
}

.hic *,
.hic *::before,
.hic *::after {
  box-sizing: border-box;
}

/* The hidden attribute must win over the display values below. */
.hic [hidden] {
  display: none !important;
}

.hic .hic__sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.hic.hic--hhis {
  --hic-accent: #0099ff;
}

.hic .hic__card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 28px 21px 21px;
  background: #fff;
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 16px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
}

.hic .hic__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.hic .hic__label {
  display: block;
  margin: 0;
  padding: 0;
  font-size: var(--hic-size-label);
  font-weight: 700;
  line-height: 1.5;
  color: var(--hic-navy);
}

.hic .hic__asof {
  font-weight: 400;
}

.hic .hic__control {
  position: relative;
  border-radius: 8px;
}

.hic .hic__prefix {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 14px;
  display: flex;
  align-items: center;
  font-size: calc(var(--hic-size-input) - 1px);
  font-weight: 600;
  color: var(--hic-muted);
  pointer-events: none;
}

.hic .hic__input,
.hic .hic__select {
  display: block;
  width: 100%;
  min-width: 0;
  height: auto;
  margin: 0;
  padding: 11px 15px;
  font-family: var(--hic-font);
  font-size: var(--hic-size-input);
  font-weight: 600;
  line-height: 1.6;
  color: var(--hic-ink);
  background-color: #fff;
  border: 1px solid var(--hic-border);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.hic .hic__control--prefixed .hic__input {
  padding-left: calc(18px + 1em);
}

.hic .hic__select {
  padding-right: 41px;
  font-size: calc(var(--hic-size-input) - 1px);
  font-weight: 600;
  text-overflow: ellipsis;
  cursor: pointer;
  background-image: url('chevron.svg');
  background-repeat: no-repeat;
  background-position: right 13px center;
  background-size: 17.5px 17.5px;
}

.hic .hic__input--readonly {
  background-color: rgba(240, 241, 242, 0.6);
  border-color: var(--hic-border-soft);
  cursor: default;
}

.hic .hic__input:focus,
.hic .hic__select:focus {
  color: var(--hic-ink);
  border-color: var(--hic-navy);
  box-shadow: var(--hic-focus);
}

.hic .hic__input[aria-invalid='true'] {
  border-color: var(--hic-error);
}

.hic .hic__input[aria-invalid='true']:focus {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--hic-error) 20%, transparent);
}

.hic .hic__help,
.hic .hic__error {
  margin: 0;
  padding: 0;
  font-size: var(--hic-size-help);
  line-height: 1.5;
  color: var(--hic-muted);
}

.hic .hic__error {
  font-size: calc(var(--hic-size-help) + 1px);
  font-weight: 600;
  color: var(--hic-error);
}

.hic .hic__reset {
  margin: 0 0 0 6px;
  padding: 0;
  font-family: var(--hic-font);
  font-size: var(--hic-size-help);
  font-weight: 600;
  line-height: 1.5;
  color: var(--hic-navy);
  background: none;
  border: 0;
  text-decoration: underline;
  cursor: pointer;
}

.hic .hic__reset:focus-visible {
  outline: 2px solid var(--hic-navy);
  outline-offset: 2px;
  border-radius: 2px;
}

.hic .hic__results {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
  overflow: hidden;
  background-image: linear-gradient(162deg, var(--hic-navy) 0%, var(--hic-navy-dark) 100%);
  border-radius: 16px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
}

.hic .hic__result {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.hic .hic__result--monthly {
  padding-bottom: 17px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.hic .hic__result--annual {
  padding-top: 4px;
}

.hic .hic__result-label {
  margin: 0;
  padding: 0;
  font-family: var(--hic-font-heading);
  font-size: var(--hic-size-result-label);
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--hic-sky);
}

.hic .hic__result-value {
  margin: 0;
  padding: 0;
  font-family: var(--hic-font-heading);
  font-weight: 700;
  color: #fff;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}

.hic .hic__result--monthly .hic__result-value {
  font-size: var(--hic-size-monthly);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.025em;
  color: var(--hic-accent);
}

.hic .hic__result--annual .hic__result-value {
  font-size: var(--hic-size-annual);
  line-height: 1;
  letter-spacing: -0.025em;
}

.hic .hic__summary {
  margin: 0;
  padding: 0;
  font-size: var(--hic-size-summary);
  font-weight: 600;
  line-height: 1.5;
  color: color-mix(in srgb, var(--hic-sky) 90%, transparent);
}


/* Container query, so a narrow desktop column gets the mobile spacing too. */

@container (max-width: 480px) {
  .hic .hic__card {
    gap: 15px;
    padding: 27px 20px 20px;
  }

  .hic .hic__results {
    gap: 12px;
    background-image: linear-gradient(149deg, var(--hic-navy) 0%, var(--hic-navy-dark) 100%);
  }

  .hic .hic__result {
    gap: 4px;
  }
}
