/* =====================================================================
   Insight Health Tech — overrides.css  (v1.0)
   The rules theme.json can't express on its own:
   button variants, mono numbers, the eyebrow-pill fix, card-button
   demotion, focus states, and logo-on-dark handling.
   Load AFTER the theme stylesheet (see insight-health-tech-snippets.php).
   Tokens come from design-tokens.css and are mirrored in theme.json.
   ===================================================================== */

/* stylelint-disable no-descending-specificity -- This file is a final cascade layer for block and child-theme overrides. */

/* ---------------------------------------------------------------------
   1. MONO TABULAR NUMBERS  (the "instrument" vibe)
   Add class "num" to any cell/element that is a number, price, or spec.
   The :is() block also auto-styles obvious numeric contexts.
   --------------------------------------------------------------------- */
[class~="num"],
.iht-num,
.iht-data,
.wp-block-table td[class~="num"],
[data-numeric] {
  font-family: var(--iht-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

/* Calculator result figures */
.iht-result__value,
.iht-result [class~="value"],
.iht-tool-result {
  font-family: var(--iht-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--iht-iris-ink, #4b45c6);
}

/* ---------------------------------------------------------------------
   2. BUTTON VARIANTS  (one primary per view; demote the rest)
   Registered as block styles in insight-health-tech-snippets.php:
   "Secondary (outline)"  ->  is-style-secondary
   "Ghost (text)"         ->  is-style-ghost
   --------------------------------------------------------------------- */
.wp-block-button.is-style-secondary > .wp-block-button__link {
  background: #fff;
  color: var(--iht-ink-800);
  border: 1px solid #cbd5e1;
  box-shadow: none;
}

.wp-block-button.is-style-secondary > .wp-block-button__link:hover {
  background: var(--iht-surface);
  border-color: #b8c2d0;
}

.wp-block-button.is-style-ghost > .wp-block-button__link {
  background: transparent;
  color: var(--iht-iris-ink);
  border: 1px solid transparent;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

.wp-block-button.is-style-ghost > .wp-block-button__link:hover {
  background: var(--iht-iris-50);
}

/* Gradient feature button (rare, hero only): is-style-gradient */
.wp-block-button.is-style-gradient > .wp-block-button__link {
  background: var(
    --iht-brand-gradient,
    linear-gradient(125deg, #0ea5e9, #5b5bd6 50%, #7c3aed)
  );
  color: #fff;
  border: 0;
}

/* ---------------------------------------------------------------------
   3. CARD-BUTTON DEMOTION  (kills the "wall of purple")
   Wrap each card's grid in a parent with class "iht-cards", OR add
   "is-style-secondary" to the card buttons. This rule auto-demotes any
   default button that lives inside a card so only the hero stays solid.
   --------------------------------------------------------------------- */
.iht-cards .wp-block-button:not(.is-style-gradient) > .wp-block-button__link {
  background: #fff;
  color: var(--iht-iris-ink);
  border: 1px solid var(--iht-iris-200);
  box-shadow: none;
  font-weight: 600;
}

.iht-cards .wp-block-button > .wp-block-button__link:hover {
  background: var(--iht-iris-50);
}

/* Even better: make the whole card clickable + use a text link.
   Give the card a class "iht-card" and the CTA a class "iht-cardlink". */
.iht-card {
  position: relative;
}

.iht-card .iht-cardlink {
  font-weight: 600;
  color: var(--iht-iris-ink);
  display: inline-flex;
  gap: 0.4rem;
  align-items: center;
}

.iht-card .iht-cardlink::after {
  content: "\2192";
}

.iht-card a.iht-stretch::after {
  content: "";
  position: absolute;
  inset: 0;
}

.iht-card .iht-card-cta a {
  background: #fff;
  color: var(--iht-iris-ink);
  border: 1px solid var(--iht-iris-200);
  box-shadow: none;
  font-weight: 600;
}

.iht-card .iht-card-cta a:hover,
.iht-card .iht-card-cta a:focus-visible {
  background: var(--iht-iris-50);
  color: var(--iht-iris-ink);
}

/* ---------------------------------------------------------------------
   4. EYEBROW PILL — must HUG its label (fixes full-width hero bar)
   Give the eyebrow element class "iht-eyebrow".
   --------------------------------------------------------------------- */
.iht-eyebrow {
  display: inline-flex !important;
  width: auto !important;
  max-width: max-content;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  background: var(--iht-iris-50);
  color: var(--iht-iris-ink);
  font-family: var(--iht-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  line-height: 1;
}

/* On the dark hero, tint the pill for contrast */
.iht-hero--homepage .iht-eyebrow,
.iht-eyebrow.is-on-dark {
  background: rgba(255, 255, 255, 0.08);
  color: #c7d2ff;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

/* ---------------------------------------------------------------------
   5. GRADIENT HEADLINE TEXT  utility (hero accent word)
   Wrap the accent words in <span class="iht-grad">…</span>
   --------------------------------------------------------------------- */
.iht-grad {
  background: var(
    --iht-brand-gradient,
    linear-gradient(125deg, #0ea5e9, #5b5bd6 50%, #7c3aed)
  );
  /* stylelint-disable-next-line property-no-vendor-prefix -- Needed for Safari gradient text. */
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

/* ---------------------------------------------------------------------
   6. LOGO ON DARK  (only needed if the logo is inlined as SVG)
   If you use the <img> file approach, just point the header Site Logo
   at iht-logo-horizontal-dark.svg and ignore this block.
   If the SVG is inlined, these classes recolor the wordmark per context.
   --------------------------------------------------------------------- */
.iht-logo [class~="wordmark-primary"] {
  fill: #0b1220;
}

.iht-logo [class~="wordmark-secondary"] {
  fill: #5b5bd6;
}

.iht-logo.is-on-dark [class~="wordmark-primary"] {
  fill: #ffffff;
}

.iht-logo.is-on-dark [class~="wordmark-secondary"] {
  fill: #aab6ff;
}

/* Safety: never let the site-logo sit in a visible box */
.wp-block-site-logo img {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

/* ---------------------------------------------------------------------
   7. ACCESSIBILITY — visible keyboard focus everywhere
   --------------------------------------------------------------------- */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
.wp-block-button__link:focus-visible {
  outline: 3px solid var(--iht-iris);
  outline-offset: 2px;
  border-radius: 8px;
}

/* ---------------------------------------------------------------------
   8. FORM FIELDS (calculators) — consistent, branded focus
   --------------------------------------------------------------------- */
.iht-field input,
.iht-field select {
  font-family: var(--iht-mono);
  border: 1px solid var(--iht-line);
  border-radius: 8px;
  padding: 0.65rem 0.8rem;
}

.iht-field input:focus,
.iht-field select:focus {
  outline: none;
  border-color: var(--iht-iris);
  box-shadow: 0 0 0 3px rgba(91, 91, 214, 0.18);
}

.iht-result,
.iht-tool-result {
  background: var(--iht-iris-50);
  border: 1px solid var(--iht-iris-200);
  border-radius: 12px;
  padding: 1rem 1.15rem;
}

/* ---------------------------------------------------------------------
   9. TABLE polish — left align, comfortable padding, header tint
   --------------------------------------------------------------------- */
.wp-block-table table {
  border-collapse: collapse;
}

.wp-block-table th,
.wp-block-table td {
  text-align: left;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--iht-line);
}

.wp-block-table thead th {
  background: var(--iht-surface);
  color: var(--iht-ink, #0b1220);
  font-weight: 600;
}

/* ---------------------------------------------------------------------
   10. SECTION RHYTHM — snap big sections to the spacing scale
   Add class "iht-section" to top-level content sections.
   --------------------------------------------------------------------- */
.iht-section {
  padding-block: var(--iht-space-9, 6rem);
}

@media (max-width: 782px) {
  .iht-section {
    padding-block: var(--iht-space-8, 4rem);
  }
}

/* Keep calculator fields legible over the later parent-theme dynamic CSS.
   Text inputs need a visible boundary against the white tool surface. */
.iht-calculator-template .iht-tool :is(input[type="text"], input[type="number"], select) {
  background-color: var(--iht-surface);
  color: var(--iht-ink);
  border-color: var(--iht-ink-soft);
}

/* The parent applies its focused select background with !important. */
.iht-calculator-template .iht-tool select:focus {
  background-color: var(--iht-surface) !important;
}

/* Preserve validation borders after the calculator field override. */
.iht-calculator-template .iht-tool input[aria-invalid="true"] {
  border-color: var(--iht-bad);
}

/* Soft ink does not meet text contrast on the featured gradient. */
.iht-route-card--featured .iht-route-card-copy {
  color: var(--iht-ink-600);
}

/* stylelint-enable no-descending-specificity */
