/*
 * Himalayan Echoes blocks — front end AND editor.
 *
 * HAND-WRITTEN. Registered against the blocks themselves in inc/blocks.php, so
 * WordPress loads it wherever a strip appears and inside the editor, rather
 * than on one page's bundle. That is what makes these blocks portable — the
 * case study page's own `.cs-*` rules ship only in its Astro bundle and would
 * leave a strip unstyled anywhere else.
 *
 * Values are the site's, not new ones: the card is the same border, radius,
 * ground and shadow as the case study's At-a-glance strip, and the eyebrow is
 * the same 0.75rem / 0.12em / uppercase used across the theme. A block that
 * sets its own scale is a block that stops matching the site the first time
 * the site changes.
 */

/* ---------------------------------------------------------------------------
 * The strip
 * ------------------------------------------------------------------------- */

.he-facts {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem 2rem;
  /* `margin-block`, NOT the `margin` shorthand.
   *
   * A <dl> carries a browser default top and bottom margin that has to go, but
   * zeroing all four also zeroes the LEFT and RIGHT — and in the case study
   * body every direct child is centred with `margin-inline: auto`. The two
   * rules have equal specificity and this stylesheet loads later, so the
   * shorthand won and the strip sat flush left while every paragraph around it
   * stayed centred: 167px out of line at 1440px, which is what the client
   * reported on 2026-11-25.
   *
   * Touching only the block axis leaves the host layout's horizontal
   * positioning alone, wherever the block is used. */
  margin-block: 0;
}

@media (min-width: 640px) {
  .he-facts { grid-template-columns: repeat(2, 1fr); }
}
/* `auto-fit` rather than a fixed four, so three items make three columns and
   five make five — the author decides the count, not this file. `minmax` keeps
   a long value from collapsing its column to nothing. */
@media (min-width: 1024px) {
  .he-facts { grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); }
}

.he-fact { min-width: 0; }

.he-fact-label {
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-ink-mute);
  margin: 0;
}

.he-fact-value {
  font-family: var(--font-body);
  font-size: 0.9375rem;
  line-height: 1.4;
  color: var(--color-ink);
  margin: 0.375rem 0 0;
}

/* ---------------------------------------------------------------------------
 * Style: Card — the default. The brief at a glance.
 * ------------------------------------------------------------------------- */

.he-facts.is-style-card,
/* Unstyled too: a strip inserted before the author picks a style should look
   like the default rather than like nothing. Gutenberg only adds the
   `is-style-*` class once a style is chosen. */
.he-facts:not([class*="is-style-"]) {
  border: 1px solid var(--color-line);
  border-radius: 1rem;
  background: var(--color-paper);
  padding: 1.5rem;
  box-shadow: 0 24px 50px -36px rgba(19, 27, 112, 0.4);
}

@media (min-width: 1024px) {
  .he-facts.is-style-card,
  .he-facts:not([class*="is-style-"]) { padding: 1.75rem 2rem; }

  /* Hairlines BETWEEN cells only — a rule after the last one reads as the card
     being cut off. */
  .he-facts.is-style-card .he-fact + .he-fact,
  .he-facts:not([class*="is-style-"]) .he-fact + .he-fact {
    border-left: 1px solid var(--color-line);
    padding-left: 2rem;
  }
}

/* ---------------------------------------------------------------------------
 * Style: Figures — the big-number row after a budget table.
 *
 * No card: these sit in the flow of the writing as a pause, not as a panel.
 * The value leads and the label sits under it, which is the reverse of the
 * card — a number is the thing being read, and the caption explains it.
 * ------------------------------------------------------------------------- */

.he-facts.is-style-figures {
  gap: 2rem;
  padding: 1.75rem 0;
  border-top: 1px solid var(--color-line);
  border-bottom: 1px solid var(--color-line);
}

.he-facts.is-style-figures .he-fact {
  display: flex;
  flex-direction: column-reverse; /* value above label, in DOM order dt → dd */
  gap: 0.5rem;
}

.he-facts.is-style-figures .he-fact-value {
  font-size: clamp(1.6rem, 3vw, 2.3rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  font-weight: 500;
  color: var(--color-brand-orange);
  margin: 0;
}

.he-facts.is-style-figures .he-fact-label {
  color: var(--color-ink-soft);
}

/* ---------------------------------------------------------------------------
 * Editor only
 *
 * The editor shows an approximation that is comfortable to type into: empty
 * cells need a visible outline, because an empty RichText has no height and a
 * brand-new strip would otherwise be four invisible targets.
 * ------------------------------------------------------------------------- */

.he-facts--editing .he-fact--editing {
  min-height: 3.5rem;
}

.he-facts--editing .he-fact-label:empty::before,
.he-facts--editing .he-fact-value:empty::before {
  content: "";
  display: block;
  min-height: 1em;
}

.he-facts--editing .wp-block-he-fact {
  outline: 1px dashed color-mix(in srgb, var(--color-ink, #131b70) 20%, transparent);
  outline-offset: 0.35rem;
  border-radius: 0.25rem;
}
