/* =================================================================
   Pickleheart — Shared Components
   -----------------------------------------------------------------
   Reusable, page-agnostic building blocks for the custom PHP page
   templates. Everything here consumes SEMANTIC tokens from
   pickleheart-tokens.css — never raw hex values.

   All classes are namespaced `pkl-` and only apply inside a
   `.pkl-page` root, so nothing here can leak into Bricks-built
   pages, the header, or the footer.

   Page-specific layout (grids, sticky rails, one-off decoration)
   belongs in that page's own stylesheet — not here.
   ================================================================= */

/* -----------------------------------------------------------------
   PAGE ROOT — typography baseline for a custom template
   ----------------------------------------------------------------- */
.pkl-page {
  font-family: var(--font-body);
  font-size: var(--type-body-size);
  /* Explicit, not inherited. Bricks' global typography sets body to 300,
     which made every unstyled run of copy here a step lighter than the
     comps — and, less obviously, dragged <strong> down with it: the UA
     default is `font-weight: bolder`, which is computed RELATIVE to the
     inherited weight, so 300 resolves to 400 rather than 700. Pinning
     the base to 400 fixes the body copy and the bold runs together. */
  font-weight: 400;
  line-height: 1.535;
  letter-spacing: var(--tracking-body);
  color: var(--text-neutral-strong);
  background: var(--background-neutral);
  text-align: left;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
  max-width: 100%;
}
.pkl-page *,
.pkl-page *::before,
.pkl-page *::after { box-sizing: border-box; }

/* Element reset, deliberately weak.
   -----------------------------------------------------------------
   `:where()` drops the `.pkl-page` part to zero specificity, leaving
   these rules at (0,0,1) — enough to beat the parent theme's own bare
   element styles on source order, but weak enough that ANY single
   class below (or in a page stylesheet) overrides them without
   `!important` or a doubled-up selector. Written as `.pkl-page h2`
   these would be (0,1,1) and would silently outrank every
   `.pkl-h2`-style utility that tries to set a margin. */
:where(.pkl-page) h1,
:where(.pkl-page) h2,
:where(.pkl-page) h3,
:where(.pkl-page) h4 { margin: 0; letter-spacing: 0; }
:where(.pkl-page) p { margin: 0; }
/* An absolute weight, so bold runs stay bold no matter what weight the
   surrounding copy inherits — `bolder` is relative and drifts. */
:where(.pkl-page) strong,
:where(.pkl-page) b { font-weight: 700; }
:where(.pkl-page) a { color: inherit; text-decoration: none; }
:where(.pkl-page) img { display: block; max-width: 100%; }
:where(.pkl-page) ul { margin: 0; padding: 0; list-style: none; }
/* Blockquotes arrive from the parent theme dressed as pull-quotes —
   Georgia, a 4px rule down the left and a 30px indent. Inside these
   templates a quote is just copy in a card, and that indent also pushed
   the quote out of line with its own attribution. */
:where(.pkl-page) blockquote {
  margin: 0;
  padding: 0;
  border: 0;
  font: inherit;
  color: inherit;
  quotes: none;
}
:where(.pkl-page) dl,
:where(.pkl-page) dd,
:where(.pkl-page) figure { margin: 0; }

/* -----------------------------------------------------------------
   LAYOUT
   ----------------------------------------------------------------- */
.pkl-wrap {
  width: min(1320px, 100%);
  margin-inline: auto;
  padding-inline: 40px;
}
@media (max-width: 900px) { .pkl-wrap { padding-inline: 24px; } }
@media (max-width: 620px) { .pkl-wrap { padding-inline: 20px; } }

/* Column grids. Each step down collapses one breakpoint at a time so
   two-up stays two-up on tablet while four-up drops to two. */
.pkl-grid { display: grid; gap: var(--space-6); }
.pkl-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pkl-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pkl-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-4); }
@media (max-width: 900px) {
  .pkl-grid--2 { grid-template-columns: minmax(0, 1fr); }
  .pkl-grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pkl-grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .pkl-grid--3 { grid-template-columns: minmax(0, 1fr); }
  .pkl-grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Container-relative refinement.
   -----------------------------------------------------------------
   The viewport rules above are the standalone behaviour — they are
   what a grid gets when nothing declares a container. But a grid
   sitting in a narrow column (next to a sidebar rail, or inside a
   padded panel) has far less room than the window suggests, and
   three cards in a 600px column read as a wall of hyphenation.

   Mark the column with `.pkl-container` and these rules measure that
   box instead. They come last so they win the tie against the
   viewport rules above whenever a container is actually present. */
.pkl-container { container-type: inline-size; }

/* 640, not 780: a three-up inside a padded panel in the content column
   measures ~700px on a normal desktop, and the comps keep that three-up.
   The threshold is here to catch genuinely narrow columns, not to second
   guess the design at full width. */
@container (max-width: 640px) {
  .pkl-grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container (max-width: 560px) {
  .pkl-grid--2 { grid-template-columns: minmax(0, 1fr); }
  .pkl-grid--3 { grid-template-columns: minmax(0, 1fr); }
  .pkl-grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container (max-width: 380px) {
  .pkl-grid--4 { grid-template-columns: minmax(0, 1fr); }
}

/* Vertical stack with a token-sized gap. */
.pkl-stack { display: flex; flex-direction: column; gap: var(--space-6); }
.pkl-stack--tight { gap: var(--space-3); }
.pkl-stack--loose { gap: var(--space-8); }

/* -----------------------------------------------------------------
   TYPOGRAPHY ROLES
   The `.type-*` classes in pickleheart-tokens.css are the raw scale;
   these are the editorial roles built on top of them.
   ----------------------------------------------------------------- */
/* Fixed steps rather than viewport-linked clamps: the designs specify
   exact sizes at desktop and at phone width, and a clamp lands between
   the two at every size in between — visibly smaller than the comp on a
   1200-1400px laptop, which is where most of this page is read. */
.pkl-display {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 64px;
  line-height: 1.08;
  color: var(--text-neutral-strong);
  text-wrap: pretty;
}
.pkl-h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 42px;
  line-height: 1.12;
  color: var(--text-neutral-strong);
  text-wrap: pretty;
}
/* The handful of headings that open a major movement of the page sit
   one step above the rest. */
.pkl-h2--lead { font-size: 46px; }
.pkl-h3 {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 26px;
  line-height: 1.25;
  color: var(--text-neutral-strong);
}
.pkl-h4 {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 20px;
  line-height: 1.3;
  color: var(--text-neutral-strong);
}
.pkl-lead {
  font-size: 20px;
  line-height: 1.535;
  color: var(--text-neutral-weak);
  text-wrap: pretty;
}
.pkl-lead--sm { font-size: 18px; }

.pkl-body { font-size: 16px; line-height: 1.535; }
.pkl-body--lg { font-size: 17px; }
.pkl-body--sm { font-size: 15px; }
.pkl-muted { color: var(--text-neutral-weak); }
.pkl-measure { max-width: 62ch; }

@media (max-width: 1100px) {
  .pkl-display { font-size: 52px; }
  .pkl-h2, .pkl-h2--lead { font-size: 38px; }
  .pkl-h3 { font-size: 23px; }
}
@media (max-width: 760px) {
  .pkl-display { font-size: 36px; line-height: 1.1; }
  .pkl-h2 { font-size: 30px; }
  .pkl-h2--lead { font-size: 32px; }
  .pkl-h3 { font-size: 21px; }
  .pkl-h4 { font-size: 18px; }
  .pkl-lead, .pkl-lead--sm { font-size: 16px; }
  .pkl-body, .pkl-body--lg { font-size: 15px; }
  .pkl-body--sm { font-size: 14.5px; }
}

/* Rich-text blocks: ACF wysiwyg output wraps copy in <p>. */
.pkl-rich > p + p { margin-top: var(--space-4); }

.pkl-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-brand-strong);
}
.pkl-eyebrow img { width: 18px; height: 18px; object-fit: contain; }
@media (max-width: 620px) {
  .pkl-eyebrow { font-size: 11px; }
  .pkl-eyebrow img { width: 15px; height: 15px; }
}

/* -----------------------------------------------------------------
   BUTTONS
   ----------------------------------------------------------------- */
.pkl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  border: 0;
  border-radius: var(--radius-button);
  box-shadow: var(--elevation-2);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: var(--tracking-button);
  line-height: 1.2;
  padding: 16px 34px;
  min-height: 54px;
  cursor: pointer;
  text-align: center;
  background: var(--foreground-primary);
  color: var(--text-on-primary);
  transition: transform 130ms ease, filter 130ms ease;
}
/* Pickleheart's buttons lighten on hover rather than darkening — the
   same brightness treatment the Insiders page uses, so the two pages
   feel like one product. */
.pkl-btn:hover { color: var(--text-on-primary); filter: brightness(1.1); }
.pkl-btn:active { transform: translateY(1px); filter: brightness(0.94); }
.pkl-btn:focus-visible { outline: 3px solid var(--border-focus); outline-offset: 2px; }

.pkl-btn--outline {
  background: var(--background-neutral);
  color: var(--foreground-primary);
  border: 2px solid var(--foreground-primary);
  padding: 14px 32px;
}
.pkl-btn--outline:hover { color: var(--foreground-primary); filter: brightness(1.04); }

/* Fully rounded variant. The community beta design draws every CTA as
   a lozenge rather than the kit's 10px default, and pairs it with the
   lighter of the two 4px drops. Both are here rather than in that page's
   stylesheet because a pill button is a shape the brand reuses, not a
   one-page exception. */
.pkl-btn--pill {
  border-radius: var(--radius-full);
  box-shadow: var(--elevation-2-soft);
}

.pkl-btn--block { width: 100%; }
.pkl-btn[disabled] {
  background: var(--foreground-disabled);
  color: var(--text-neutral-weak);
  box-shadow: none;
  cursor: not-allowed;
}
@media (max-width: 620px) {
  .pkl-btn { font-size: 17px; padding: 15px 24px; min-height: 50px; }
  .pkl-btn--outline { padding: 13px 22px; }
}

/* -----------------------------------------------------------------
   CARDS — the Pickleheart signature is the hard 4px shadow
   ----------------------------------------------------------------- */
.pkl-card {
  background: var(--background-neutral-weak);
  border-radius: var(--radius-pill);
  box-shadow: var(--elevation-2);
  padding: var(--space-6);
}
.pkl-card--white { background: var(--background-neutral); }
.pkl-card--panel { border-radius: var(--radius-card); padding: 44px 46px; }
@media (max-width: 900px) { .pkl-card--panel { padding: var(--space-6) 22px; border-radius: 24px; } }

/* Shadowless variant. Some comps set cards as flat tint blocks — the
   fill alone carries the separation, and the signature drop would fight
   it. Slightly larger radius to match, softening on phones the way
   `--panel` does. */
.pkl-card--flat {
  box-shadow: none;
  border-radius: 24px;
}
@media (max-width: 620px) { .pkl-card--flat { border-radius: 22px; } }

.pkl-card__icon { width: 36px; height: 36px; object-fit: contain; margin-bottom: 14px; }

/* -----------------------------------------------------------------
   TAGS / BADGES
   ----------------------------------------------------------------- */
.pkl-tag {
  display: inline-flex;
  align-items: center;
  background: var(--foreground-neutral-weak);
  color: var(--text-neutral-strong);
  border-radius: var(--radius-tag);
  padding: 4px 12px;
  font-size: 13px;
  line-height: 1.5;
  font-weight: 500;
  letter-spacing: var(--tracking-body);
}
.pkl-badge {
  display: inline-flex;
  align-items: center;
  background: var(--foreground-positive);
  color: var(--text-inverse-strong);
  border-radius: var(--radius-tag);
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* -----------------------------------------------------------------
   STAT TILE — big number over a label
   ----------------------------------------------------------------- */
.pkl-stat__value {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 26px;
  line-height: 1.15;
  color: var(--text-neutral-strong);
  margin-bottom: var(--space-1);
}
@media (max-width: 760px) { .pkl-stat__value { font-size: 22px; } }
.pkl-stat__label {
  font-size: 14px;
  letter-spacing: var(--tracking-body);
  color: var(--text-neutral-weak);
}

/* -----------------------------------------------------------------
   PROGRESS BAR
   ----------------------------------------------------------------- */
.pkl-progress {
  height: 10px;
  border-radius: var(--radius-full);
  background: var(--background-neutral-weak);
  overflow: hidden;
}
.pkl-progress__bar {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--foreground-brand-strong);
  transition: width 400ms ease;
}
/* On a cream card the track needs to be the lighter surface instead. */
.pkl-card .pkl-progress { background: var(--background-neutral); }

/* -----------------------------------------------------------------
   HEART METER — Pickleheart's own fundraising tracker
   -----------------------------------------------------------------
   A row of hearts that fill up as a campaign progresses, with a
   label under the right-hand end naming the goal.

   Both heart states are the SAME image: the empty ones are the brand
   heart run through grayscale + opacity. One request instead of two,
   and the two states can never drift apart artistically.
   ----------------------------------------------------------------- */
.pkl-heart-meter__hearts {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--background-neutral);
  border: 1px solid var(--border-neutral-weak);
  border-radius: var(--radius-full);
  box-shadow: var(--elevation-1);
  padding: 8px 14px;
}
.pkl-heart-meter__heart {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  justify-content: center;
}
.pkl-heart-meter__heart img {
  width: 22px;
  height: auto;
  max-width: 100%;
  object-fit: contain;
  /* Not-yet-reached hearts: same artwork, drained of colour. */
  filter: grayscale(1) opacity(0.32);
  transition: filter 300ms ease;
}
.pkl-heart-meter__heart.is-filled img { filter: none; }

.pkl-heart-meter__labels {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: var(--space-3);
  margin-top: 10px;
  font-size: 13px;
  line-height: 1.4;
  letter-spacing: var(--tracking-body);
  color: var(--text-neutral-weak);
}

@media (max-width: 620px) {
  .pkl-heart-meter__hearts { gap: 4px; padding: 7px 10px; }
  .pkl-heart-meter__heart img { width: 20px; }
  .pkl-heart-meter__labels { font-size: 12px; }
}

/* -----------------------------------------------------------------
   FORM CONTROLS
   ----------------------------------------------------------------- */
.pkl-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-neutral-strong);
  margin-bottom: var(--space-2);
}
.pkl-input {
  width: 100%;
  border: 1px solid var(--border-neutral);
  border-radius: var(--radius-input);
  padding: 12px 15px;
  font-family: var(--font-body);
  font-size: 16px;
  letter-spacing: var(--tracking-body);
  color: var(--text-neutral-strong);
  background: var(--background-neutral);
  outline: 0;
  min-height: 48px;
  transition: border-color 130ms ease, box-shadow 130ms ease;
}
.pkl-input::placeholder { color: var(--text-neutral-weaker); }
.pkl-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(235, 141, 138, 0.22);
}
.pkl-field + .pkl-field { margin-top: var(--space-3); }

/* -----------------------------------------------------------------
   DISCLOSURE — a heading button that expands a panel (FAQ, terms)
   Driven by [aria-expanded] so the accessible state and the visual
   state can never disagree.
   ----------------------------------------------------------------- */
.pkl-disclosure__btn {
  width: 100%;
  background: none;
  border: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  text-align: left;
  cursor: pointer;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 20px;
  line-height: 1.3;
  color: var(--text-neutral-strong);
}
@media (max-width: 760px) { .pkl-disclosure__btn { font-size: 17px; } }
.pkl-disclosure__btn:focus-visible { outline: 3px solid var(--border-focus); outline-offset: 4px; }
/* The glyph is ▼ (U+25BC), not ▾ (U+25BE) — the "small" variant renders
   roughly half the size at the same font-size, which is what made these
   read as specks next to the comp. */
.pkl-disclosure__caret {
  flex: 0 0 auto;
  font-size: 15px;
  line-height: 1;
  color: var(--pkl-black-50);
  transition: transform 160ms ease;
}
.pkl-disclosure__btn[aria-expanded="true"] .pkl-disclosure__caret { transform: rotate(180deg); }
.pkl-disclosure__panel { margin-top: var(--space-4); }

/* Collapsed state comes from the button's own [aria-expanded], so the
   accessible state and the visual state can never disagree — and the
   panel is closed before any script runs.
   Two selectors because the button is a direct sibling of the panel in
   a plain disclosure, but is wrapped in a heading when the trigger is
   also a document heading (an FAQ question). Without the `:has()` form
   every answer in an FAQ renders open. */
.pkl-disclosure__btn[aria-expanded="false"] + .pkl-disclosure__panel,
:has(> .pkl-disclosure__btn[aria-expanded="false"]) + .pkl-disclosure__panel { display: none; }

/* -----------------------------------------------------------------
   RULE-SEPARATED LIST — hairline above each row
   ----------------------------------------------------------------- */
.pkl-ruled > * {
  border-top: 1px solid var(--pkl-black-12);
  padding-top: var(--space-8);
}
.pkl-ruled--tight > * { padding-top: var(--space-4); padding-bottom: var(--space-4); }

/* -----------------------------------------------------------------
   VISIBILITY HELPERS
   ----------------------------------------------------------------- */
.pkl-sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
