/* Health cover — referral layout using shared site tokens */

.page-health-insurance {
  --hc-shell: 1110px;
  --hc-selector: 760px;
  --hc-radius: var(--radius-md);
  --hc-radius-sm: var(--radius-sm);
  --hc-space: 8px;
  --hc-pad: 28px;
  --hc-pad-sm: 16px;
  --hc-border: var(--color-border);
  --hc-border-strong: var(--color-border-strong);
  --hc-soft: var(--color-bg-soft);
  --hc-card-bg: var(--color-surface);
  --hc-shadow: var(--shadow-sm);
  --hc-text: var(--color-text);
  --hc-muted: var(--color-text-muted);
  --hc-soft-text: var(--color-text-soft);
  --hc-heading: var(--color-brand-darker);
  --hc-selected-bg: color-mix(in srgb, var(--color-brand) 10%, var(--color-surface));
  --hc-selected-border: var(--color-brand);
  --hc-logo-plate: transparent;
  background: var(--color-bg);
  color: var(--hc-text);
}

html[data-theme="dark"] .page-health-insurance {
  --hc-soft: var(--color-bg-soft);
  --hc-card-bg: var(--color-surface);
  --hc-border: var(--color-border);
  --hc-border-strong: var(--color-border-strong);
  --hc-shadow: var(--shadow-sm);
  --hc-heading: var(--color-text);
  --hc-muted: var(--color-text-muted);
  --hc-soft-text: var(--color-text-soft);
  --hc-selected-bg: color-mix(in srgb, var(--color-brand) 16%, var(--color-surface));
  --hc-logo-plate: #ffffff;
  background: var(--color-bg);
}

/* Scope: undo sitewide main p max-width that skewed results summary/disclaimer */
.page-health-insurance main p,
.page-health-insurance .hc-results p,
.page-health-insurance .hc-card p,
.page-health-insurance .hc-example-note,
.page-health-insurance .hc-commission,
.page-health-insurance .hc-results__summary {
  max-width: none;
}

.page-health-insurance .visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.page-health-insurance .btn::after {
  display: none;
}

.hc-shell {
  width: min(100% - 2.5rem, var(--hc-shell));
  margin-inline: auto;
}

.hc-page {
  /* Extra bottom space so the site cookie banner does not cover Apply */
  padding: calc(var(--hc-space) * 3) 0 calc(var(--hc-space) * 6 + 4.5rem);
  background: transparent;
}

.hc-breadcrumb {
  width: min(100%, var(--hc-selector));
  margin: 0 auto calc(var(--hc-space) * 2);
}

.hc-breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--hc-muted);
  font-size: 0.875rem;
}

.hc-breadcrumb li:not(:last-child)::after {
  content: "/";
  margin-left: 0.5rem;
  color: var(--hc-soft-text);
}

.hc-breadcrumb a {
  color: var(--color-brand-deep);
  font-weight: 600;
  text-decoration: none;
}

.hc-breadcrumb a:hover,
.hc-breadcrumb a:focus-visible {
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.hc-page__intro {
  width: min(100%, var(--hc-selector));
  margin: 0 auto calc(var(--hc-space) * 3);
  text-align: center;
}

.hc-page__intro h1 {
  margin: 0 0 calc(var(--hc-space) * 1.5);
  color: var(--hc-heading);
  font-family: Montserrat, "Open Sans", sans-serif;
  font-size: clamp(1.75rem, 3.2vw, 2.625rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.hc-page__intro p {
  margin: 0 auto;
  max-width: 38rem;
  color: var(--hc-muted);
  font-size: clamp(0.98rem, 1.4vw, 1.05rem);
  line-height: 1.55;
}

.hc-panel {
  width: min(100%, var(--hc-selector));
  margin: 0 auto;
  padding: clamp(1.25rem, 2.5vw, 1.75rem);
  border: 1px solid var(--hc-border);
  border-radius: var(--hc-radius);
  background: var(--hc-card-bg);
  box-shadow: var(--hc-shadow);
}

.hc-step {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.hc-step + .hc-step {
  margin-top: calc(var(--hc-space) * 2.5);
  padding-top: calc(var(--hc-space) * 2.5);
  border-top: 1px solid var(--hc-border);
}

.hc-step[hidden] {
  display: none !important;
}

.hc-step__legend {
  margin: 0 0 calc(var(--hc-space) * 1.5);
  padding: 0;
  color: var(--hc-text);
  font-family: Montserrat, "Open Sans", sans-serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.hc-tiles {
  display: grid;
  gap: calc(var(--hc-space) * 1.25);
}

.hc-tiles--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.hc-tiles--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.hc-tile {
  position: relative;
  display: block;
  margin: 0;
  cursor: pointer;
}

.hc-tile input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}

.hc-tile__face {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 5.5rem;
  padding: 0.85rem 0.75rem;
  border: 1.5px solid var(--hc-border-strong);
  border-radius: var(--hc-radius-sm);
  background: var(--color-bg);
  color: var(--hc-text);
  text-align: center;
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    box-shadow 0.15s ease;
}

html[data-theme="dark"] .hc-tile__face {
  background: var(--color-bg-soft);
}

.hc-tile__icon {
  display: inline-flex;
  color: var(--color-brand-deep);
}

.hc-tile__label {
  font-family: Montserrat, "Open Sans", sans-serif;
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.hc-tile__check {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 999px;
  border: 1.5px solid var(--hc-border-strong);
  background: var(--hc-card-bg);
}

.hc-tile:hover .hc-tile__face {
  border-color: var(--color-brand);
}

.hc-tile:has(input:focus-visible) .hc-tile__face {
  border-color: var(--color-brand);
  box-shadow: 0 0 0 3px var(--color-focus);
}

.hc-tile:has(input:checked) .hc-tile__face {
  border-color: var(--hc-selected-border);
  background: var(--hc-selected-bg);
  color: var(--hc-text);
  box-shadow: none;
}

.hc-tile:has(input:checked) .hc-tile__icon {
  color: var(--color-brand-deep);
}

.hc-tile:has(input:checked) .hc-tile__check {
  border-color: var(--color-brand);
  background: var(--color-brand);
}

.hc-tile:has(input:checked) .hc-tile__check::before {
  content: "";
  position: absolute;
  left: 0.28rem;
  top: 0.28rem;
  width: 0.38rem;
  height: 0.22rem;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg);
}

html[data-theme="dark"] .hc-tile:has(input:checked) .hc-tile__icon {
  color: var(--color-brand);
}

.hc-live {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.hc-results {
  width: 100%;
  margin: calc(var(--hc-space) * 4) 0 0;
  padding-top: calc(var(--hc-space) * 0.5);
}

.hc-results[hidden] {
  display: none !important;
}

.hc-results__head {
  width: 100%;
  margin: 0 0 calc(var(--hc-space) * 2);
  text-align: left;
}

.hc-results__head h2 {
  margin: 0 0 calc(var(--hc-space) * 1);
  color: var(--hc-heading);
  font-family: Montserrat, "Open Sans", sans-serif;
  font-size: clamp(1.25rem, 2vw, 1.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.hc-results__summary {
  margin: 0;
  color: var(--hc-muted);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.4;
}

.hc-example-note {
  width: 100%;
  margin: 0 0 calc(var(--hc-space) * 2.5);
  padding: calc(var(--hc-space) * 1.5) calc(var(--hc-space) * 2);
  border: 1px solid var(--hc-border);
  border-radius: var(--hc-radius-sm);
  background: var(--hc-soft);
  color: var(--hc-muted);
  font-size: 0.9rem;
  line-height: 1.5;
  text-align: left;
}

.hc-example-note[hidden] {
  display: none !important;
}

.hc-cards {
  display: grid;
  gap: calc(var(--hc-space) * 2);
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: auto auto auto 1fr auto;
  align-items: stretch;
}

.hc-cards[data-card-count="1"] {
  grid-template-columns: minmax(0, 22rem);
  justify-content: center;
}

.hc-cards[data-card-count="2"] {
  grid-template-columns: repeat(2, minmax(0, 22rem));
  justify-content: center;
}

.hc-card {
  display: grid;
  grid-template-rows: subgrid;
  grid-row: span 5;
  gap: calc(var(--hc-space) * 2);
  min-width: 0;
  padding: var(--hc-pad);
  border: 1px solid var(--hc-border);
  border-radius: var(--hc-radius);
  background: var(--hc-card-bg);
  box-shadow: var(--hc-shadow);
}

@supports not (grid-template-rows: subgrid) {
  .hc-cards {
    grid-template-rows: none;
  }

  .hc-card {
    grid-template-rows: auto auto auto 1fr auto;
    grid-row: auto;
  }
}

.hc-card__logo {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  height: 52px;
  min-height: 52px;
}

.hc-card__logo img {
  display: block;
  max-height: 44px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  object-position: left center;
}

.hc-card__logo-plate {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 0.65rem;
  border-radius: 8px;
  background: var(--hc-logo-plate);
}

.hc-card__logo-text {
  margin: 0;
  font-family: Montserrat, "Open Sans", sans-serif;
  font-size: 1.35rem;
  font-weight: 750;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--hc-heading);
}

.hc-card__logo-text--aia { color: #c8102e; }
.hc-card__logo-text--nib { color: #009fd4; }
.hc-card__logo-text--bupa { color: #0079c8; }

html[data-theme="dark"] .hc-card__logo-text--aia,
html[data-theme="dark"] .hc-card__logo-text--nib,
html[data-theme="dark"] .hc-card__logo-text--bupa {
  color: #0b1220;
}

.hc-card__product {
  margin: 0;
  color: var(--hc-text);
  font-family: Montserrat, "Open Sans", sans-serif;
  font-size: clamp(1.05rem, 1.5vw, 1.2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
  min-height: 2.6em;
}

.hc-card__price {
  display: flex;
  flex-direction: column;
  gap: calc(var(--hc-space) * 1);
  margin: 0;
  padding: calc(var(--hc-space) * 2);
  border: 1px solid var(--hc-border);
  border-radius: var(--hc-radius-sm);
  background: var(--hc-soft);
}

.hc-card__price-label {
  margin: 0;
  color: var(--hc-soft-text);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hc-card__price-amount {
  margin: 0;
  color: var(--hc-text);
  font-variant-numeric: tabular-nums;
  font-size: clamp(1.85rem, 2.4vw, 2.35rem);
  font-weight: 750;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.hc-card__price-amount--fallback {
  font-size: clamp(1.25rem, 1.8vw, 1.45rem);
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.hc-card__currency,
.hc-card__per {
  font-size: 0.92rem;
  font-weight: 650;
  color: var(--hc-muted);
  letter-spacing: 0;
}

.hc-card__price-meta,
.hc-card__excess {
  margin: 0;
  color: var(--hc-muted);
  font-size: 0.875rem;
  line-height: 1.45;
}

.hc-card__excess {
  font-weight: 650;
  color: var(--hc-text);
}

.hc-card__assumptions {
  margin-top: calc(var(--hc-space) * 0.5);
}

.hc-card__assumptions summary {
  cursor: pointer;
  color: var(--color-brand-deep);
  font-size: 0.875rem;
  font-weight: 650;
  text-underline-offset: 0.12em;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.hc-card__assumptions summary:hover,
.hc-card__assumptions summary:focus-visible {
  text-decoration: underline;
}

.hc-card__assumptions summary:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 2px;
  border-radius: 4px;
}

.hc-card__assumptions ul {
  margin: calc(var(--hc-space) * 1) 0 0;
  padding: calc(var(--hc-space) * 1.5) calc(var(--hc-space) * 1.5) calc(var(--hc-space) * 1.5) 1.25rem;
  border: 1px solid var(--hc-border);
  border-radius: var(--hc-radius-sm);
  background: var(--hc-card-bg);
  color: var(--hc-muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

.hc-card__assumptions li + li {
  margin-top: 0.3rem;
}

.hc-card__covers {
  margin: 0;
  padding: 0;
  list-style: none;
}

.hc-card__covers li {
  position: relative;
  padding: 0.4rem 0 0.4rem 1.4rem;
  color: var(--hc-muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.hc-card__covers li::before {
  content: "";
  position: absolute;
  left: 0.1rem;
  top: 0.85rem;
  width: 0.5rem;
  height: 0.28rem;
  border-left: 2px solid var(--color-success);
  border-bottom: 2px solid var(--color-success);
  transform: rotate(-45deg);
}

.hc-card__actions {
  display: grid;
  gap: calc(var(--hc-space) * 1);
  margin-top: auto;
  padding-top: calc(var(--hc-space) * 0.5);
}

.hc-card__actions .btn {
  width: 100%;
  justify-content: center;
  min-height: 2.85rem;
  border-radius: var(--hc-radius-sm);
  font-weight: 700;
}

.hc-card__actions .btn:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 3px;
}

.hc-card__doc {
  color: var(--hc-muted);
  font-size: 0.875rem;
  font-weight: 600;
  text-align: center;
  text-underline-offset: 0.15em;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.hc-card__doc:hover,
.hc-card__doc:focus-visible {
  color: var(--color-brand-deep);
  text-decoration: underline;
}

.hc-commission {
  width: 100%;
  margin: calc(var(--hc-space) * 3) 0 0;
  color: var(--hc-muted);
  font-size: 0.875rem;
  line-height: 1.5;
  text-align: left;
}

.hc-commission[hidden] {
  display: none !important;
}

.hc-empty {
  margin: 0;
  padding: 1rem;
  border: 1px dashed var(--hc-border-strong);
  border-radius: var(--hc-radius-sm);
  color: var(--hc-muted);
  text-align: center;
}

html[data-theme="dark"] .hc-breadcrumb a {
  color: var(--color-brand);
}

html[data-theme="dark"] .hc-card__assumptions summary,
html[data-theme="dark"] .hc-card__doc:hover,
html[data-theme="dark"] .hc-card__doc:focus-visible {
  color: var(--color-brand);
}

@media (max-width: 1100px) {
  .hc-cards[data-card-count="3"] {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: none;
  }

  .hc-cards[data-card-count="3"] .hc-card {
    grid-template-rows: auto auto auto 1fr auto;
    grid-row: auto;
  }
}

@media (max-width: 900px) {
  .hc-cards,
  .hc-cards[data-card-count="2"],
  .hc-cards[data-card-count="3"] {
    grid-template-columns: 1fr;
    grid-template-rows: none;
    max-width: none;
    margin-inline: 0;
  }

  .hc-card {
    /* Natural height — do not stretch AIA price panel to match priced cards */
    display: flex;
    flex-direction: column;
    grid-template-rows: none;
    grid-row: auto;
    gap: calc(var(--hc-space) * 1.75);
    padding: 20px;
  }

  .hc-card__product {
    min-height: 0;
  }

  .hc-card__price {
    flex: 0 0 auto;
  }

  .hc-card__covers {
    flex: 0 0 auto;
  }

  .hc-card__actions {
    margin-top: calc(var(--hc-space) * 0.5);
  }

  .hc-card__price-amount {
    font-size: clamp(1.75rem, 7vw, 2rem);
  }

  .hc-card__price-amount--fallback {
    font-size: clamp(1.15rem, 5vw, 1.35rem);
  }
}

@media (max-width: 640px) {
  .hc-shell {
    width: min(100% - 2rem, var(--hc-shell));
  }

  .hc-page {
    padding-top: calc(var(--hc-space) * 2);
    padding-bottom: calc(var(--hc-space) * 5 + 4.25rem);
  }

  .hc-page__intro {
    margin-bottom: calc(var(--hc-space) * 2);
  }

  .hc-page__intro h1 {
    font-size: clamp(1.55rem, 7vw, 1.9rem);
  }

  .hc-page__intro p {
    font-size: 0.95rem;
  }

  .hc-panel {
    padding: 1rem;
  }

  .hc-step + .hc-step {
    margin-top: calc(var(--hc-space) * 2);
    padding-top: calc(var(--hc-space) * 2);
  }

  .hc-tiles--3 {
    grid-template-columns: 1fr;
  }

  .hc-tile__face {
    min-height: 3.5rem;
    flex-direction: row;
    justify-content: flex-start;
    gap: 0.7rem;
    padding: 0.7rem 2.5rem 0.7rem 0.85rem;
    text-align: left;
  }

  .hc-tile__icon svg {
    width: 24px;
    height: 24px;
  }

  .hc-tile__check {
    top: 50%;
    transform: translateY(-50%);
  }

  .hc-tile:has(input:checked) .hc-tile__check::before {
    top: 0.3rem;
  }

  .hc-results {
    margin-top: calc(var(--hc-space) * 3);
  }

  .hc-card {
    padding: var(--hc-pad-sm);
  }

  .hc-example-note {
    font-size: 0.85rem;
    padding: 0.7rem 0.85rem;
  }
}

@media (max-width: 420px) {
  .hc-shell {
    width: min(100% - 2rem, var(--hc-shell));
  }

  .hc-tiles--2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 360px) {
  .hc-shell {
    width: min(100% - 1.5rem, var(--hc-shell));
  }
}

@media (max-width: 320px) {
  .hc-shell {
    width: min(100% - 1.25rem, var(--hc-shell));
  }

  .hc-panel {
    padding: 0.85rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hc-tile__face {
    transition: none;
  }
}
