/*
Theme Name: Trove
Theme URI: https://cms.trove.wearesavvy.com.au
Author: We Are Savvy
Author URI: https://wearesavvy.com.au
Description: Design system theme for Trove content pages. Provides the Trove brand color palette, typography and block element styling (buttons, headings, links, inputs) for the block editor. No page content or blocks are bundled with this theme - it is a styling foundation only. Rendered pages are consumed by WeAreSavvy.Trove.CoreApi's WordpressContentController via the entry-content/wp-block-post-content markup produced by the core Post Content block.
Version: 1.0.3
Requires at least: 6.6
Tested up to: 7.1
Requires PHP: 8.0
License: Proprietary
Text Domain: trove
*/

/* Card - mirrors Trove's .plan-card */
.wp-block-group.is-style-savvy-card {
  background: var(--wp--preset--color--surface-raised);
  border: 1px solid var(--wp--preset--color--border);
  border-radius: 1rem;
  padding: 1.5rem;
}

.wp-block-group.is-style-savvy-card,
.wp-block-group.is-style-trove-teal,
.wp-block-group.is-style-trove-gold,
.wp-block-group.is-style-trove-red,
.wp-block-group.is-style-trove-blue,
.wp-block-group.is-style-trove-black {
  box-shadow: var(--wp-card-shadow, 0 4px 10px rgba(0, 0, 0, 0.15), 0 10px 30px rgba(0, 0, 0, 0.18));
}

/* Coloured cards - text is fixed per card colour (black on teal/gold, white on
   red/blue/black) regardless of theme text colour, per-block has-*-color
   classes, link colour or dark mode. black/white presets are never overridden
   by dark-mode.css, so both colour modes render identically. Highlight chips
   and buttons keep their own colours. */
.wp-block-group.is-style-trove-teal,
.wp-block-group.is-style-trove-gold {
  --card-ink: var(--wp--preset--color--black);
}

.wp-block-group.is-style-trove-red,
.wp-block-group.is-style-trove-blue,
.wp-block-group.is-style-trove-black {
  --card-ink: var(--wp--preset--color--white);
}

.wp-block-group[class*='is-style-trove-'] :is(h1, h2, h3, h4, h5, h6, p, li, span, a, strong, em):not(.savvy-highlight, .wp-block-button__link) {
  color: var(--card-ink);
}

.wp-block-group.is-style-savvy-card.is-current {
  border-color: var(--wp--preset--color--red);
}

/* Feature list - mirrors Trove's .plan-features checkmark list */
.wp-block-list.is-style-savvy-features {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  color: var(--wp--preset--color--ink-muted);
  font-size: var(--wp--preset--font-size--small);
}

.wp-block-list.is-style-savvy-features li::before {
  content: '\2713\0020';
  color: var(--wp--preset--color--red);
}

/* Outline button - mirrors the disabled/outlined "Current Plan" button */
.wp-block-button.is-style-savvy-outline .wp-block-button__link {
  background: transparent;
  color: var(--wp--preset--color--red);
  border: 1px solid var(--wp--preset--color--red);
}

/* Badge - mirrors the "Current Plan" p-tag */
.savvy-badge {
  display: inline-block;
  background: var(--wp--preset--color--success);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
}

/* Highlight chip - inline emphasis within headings/paragraphs, mirrors
   Trove's .savvy-highlight (apps/trove/src/styles.scss). Wrap the text in a
   plain <span class="savvy-highlight savvy-highlight--{modifier}"> inside a
   heading or paragraph block's content; no dedicated block variation exists
   for inline spans, so this is applied by hand in the block HTML.
   The bare class is colour-neutral (structural only - padding/radius) - it
   is never used on its own. Every usage names an explicit modifier, since
   the Canva source pairs the same background with different text colours
   in different places (see home-page.html's per-instance inline overrides),
   so there is no single sensible "default" colour to bake in here. */
.savvy-highlight {
  padding: 0.05em 0.35em;
  border-radius: 0.2em;
  background: transparent;
}

.savvy-highlight--teal {
  background: var(--wp--preset--color--teal);
  color: var(--wp--preset--color--black);
}

.savvy-highlight--white {
  background: var(--wp--preset--color--white);
  color: var(--wp--preset--color--red);
}

.savvy-highlight--blue {
  background: var(--wp--preset--color--blue);
  color: var(--wp--preset--color--white);
}

.savvy-highlight--gold {
  background: var(--wp--preset--color--gold);
  color: var(--wp--preset--color--black);
}

.savvy-highlight--black {
  background: var(--wp--preset--color--black);
  color: var(--wp--preset--color--white);
}

/* Equal-height cards for a "heading, then card, then button" column pair
   (e.g. "How Trove works" / "Join today") - each column is heading + card +
   button stacked; making the column a flex column and letting the card grow
   to fill the leftover space means both cards match the taller column's
   height regardless of how much text either one has. Add className
   "equal-card-row" to the wp:columns block and "equal-card" to each card's
   wp:group block (alongside its is-style-trove-* class) to opt in. */
.equal-card-row > .wp-block-column {
  display: flex;
  flex-direction: column;
}

.equal-card-row > .wp-block-column > .equal-card {
  flex: 1 1 auto;
}

/* CSS-only two-tab toggle (e.g. Monthly / Annual on a pricing card). No JS: WP
   content is injected into a shadow root via innerHTML by the Trove app, so
   <script> never runs. State lives in two radio inputs; the general-sibling
   combinator reaches the panels because they are siblings of the inputs, even
   though they are separate blocks in the editor.
   Structure, all as direct siblings inside one parent (e.g. a wp:column):
     1. a wp:html block holding the two radio inputs and a .trove-tabs__nav
        of two labels (radio ids/names must be unique per toggle)
     2. a block with class "trove-tabs__panel trove-tabs__panel--first"
     3. a block with class "trove-tabs__panel trove-tabs__panel--second"
   Add .trove-tabs__nav--{teal|red|gold} to pick the pill colours. The radios
   are visually hidden rather than display:none so keyboard focus and
   arrow-key switching keep working. */
.trove-tabs__input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.trove-tabs__nav {
  --tab-active: var(--wp--preset--color--teal);
  --tab-inactive: var(--wp--preset--color--teal-shade);
  --tab-text: var(--wp--preset--color--black);
  display: flex;
  justify-content: center;
  gap: 0.5rem;
}

.trove-tabs__nav--teal {
  --tab-active: var(--wp--preset--color--teal);
  --tab-inactive: var(--wp--preset--color--teal-shade);
  --tab-text: var(--wp--preset--color--black);
}

.trove-tabs__nav--red {
  --tab-active: var(--wp--preset--color--red);
  --tab-inactive: var(--wp--preset--color--red-shade);
  --tab-text: var(--wp--preset--color--white);
}

.trove-tabs__nav--gold {
  --tab-active: var(--wp--preset--color--gold);
  --tab-inactive: var(--wp--preset--color--gold-shade);
  --tab-text: var(--wp--preset--color--black);
}

.trove-tabs__nav label {
  background: var(--tab-inactive);
  color: var(--tab-text);
  border-radius: 999px;
  padding: 0.4rem 1rem;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.5;
  cursor: pointer;
  user-select: none;
}

/* Scoped to panels that follow the radios: in the block editor the wp:html block
   previews in a sandboxed iframe, so the inputs are not siblings there and every
   panel stays visible and editable. */
.trove-tabs__input ~ .trove-tabs__panel {
  display: none;
}

.trove-tabs__input:nth-of-type(1):checked ~ .trove-tabs__nav label:nth-child(1),
.trove-tabs__input:nth-of-type(2):checked ~ .trove-tabs__nav label:nth-child(2) {
  background: var(--tab-active);
}

.trove-tabs__input:nth-of-type(1):checked ~ .trove-tabs__panel--first,
.trove-tabs__input:nth-of-type(2):checked ~ .trove-tabs__panel--second {
  display: block;
}

.trove-tabs__input:nth-of-type(1):focus-visible ~ .trove-tabs__nav label:nth-child(1),
.trove-tabs__input:nth-of-type(2):focus-visible ~ .trove-tabs__nav label:nth-child(2) {
  outline: 2px solid var(--wp--preset--color--ink);
  outline-offset: 2px;
}