/**
 * @theme Savannah — Flamingo Magazine
 * @version 2.0
 * @description Layer 3 of 6 · Kit file. Bare element styling, the system
 *              band and width classes, the container rule and motion
 *              preferences.
 *
 * No component classes. Tokens only — no hex values, no font names.
 */


/* ==========================================================================
   # 01. REGISTERED CUSTOM PROPERTIES
   ========================================================================== */

/**
 * Must precede every rule that consumes them.
 *
 * A plain custom property holding a malformed value is invalid at
 * computed-value time. The consuming declaration does NOT fall back —
 * it becomes unset. For `outline` that is `outline-style: none`, so a
 * single typo in _tokens.css removes every focus ring on the site with
 * no error anywhere. For `color`, which inherits, button labels silently
 * take the colour of whatever row they sit in.
 *
 * Registering a property gives it a syntax descriptor. A value that
 * fails to parse is rejected and the property computes to its inherited
 * value, or to initial-value at the root — the malformed value can no
 * longer poison the declaration.
 *
 * inherits: true is REQUIRED, not stylistic. The .jcd_ui_on_ink and
 * .jcd_ui_inverse blocks work by re-declaring these properties on an
 * ancestor; with inherits: false, descendants would read initial-value
 * instead and the flip would do nothing.
 *
 * THE TRADE-OFF, STATED: registration means a MISSING token no longer
 * drops the rule. It resolves to initial-value instead. Registering
 * therefore removes the fail-loudly behaviour that bare var() was
 * adopted for — which is why initial-value is magenta rather than a
 * plausible colour, and why tools/check-tokens.sh is the real defence.
 * Magenta is not a fallback. It is an alarm.
 */

@property --jcd-color-focus {
  syntax: "<color>";
  inherits: true;
  initial-value: #FF00FF;
}

@property --jcd-color-cta-fg {
  syntax: "<color>";
  inherits: true;
  initial-value: #FF00FF;
}

@property --jcd-color-accent-text {
  syntax: "<color>";
  inherits: true;
  initial-value: #FF00FF;
}

@property --jcd-color-placeholder {
  syntax: "<color>";
  inherits: true;
  initial-value: #FF00FF;
}

/**
 * Not a colour, and not magenta-able. 400 is the value every project
 * built before this token effectively rendered, because the heading rule
 * previously read --jcd-weight-light, which most projects never declared
 * and which therefore inherited 400 from body. Declaring 400 here keeps
 * those projects pixel-identical.
 */
@property --jcd-weight-display {
  syntax: "<number>";
  inherits: true;
  initial-value: 400;
}

/**
 * No default focus outline, by design — keep this rule. A component's own
 * :focus-visible ring still draws where its selector outweighs this one,
 * (0,3,0), or matches it and loads later.
 */
:where(.fl-builder-content, .fl-page) :is(a[href], button, input, select, textarea, [tabindex]:not([tabindex="-1"])):focus {
    outline-style: none;
}


/* ==========================================================================
   # 02. ROOT
   ========================================================================== */

/**
 * 16px root. The type scale in _tokens.css is fixed px and assumes it;
 * 112.5% would scale every value by 12.5%.
 */
html {
  font-size: 100%;
}

body {
  font-family: var(--jcd-font-sans);
  font-weight: var(--jcd-weight-regular);
  font-size: var(--jcd-text-body);
  font-optical-sizing: auto;
  line-height: 1.6;
  color: var(--jcd-color-ink);
  background: var(--jcd-color-paper);
}

/**
 * THE KIT OWNS LINK AND HEADING COLOUR, NOT THE BB SKIN.
 * The Beaver Builder Theme skin always writes a colour for bare links
 * (the Customizer link colour) and a dark grey for h1–h6, and BB's
 * Bootstrap base recolours links on hover. All load BEFORE the child
 * theme at equal specificity, so declaring the same selectors here wins
 * by source order. Components set their own link colours on top; dark
 * rows flip headings via .jcd_ui_inverse at higher specificity.
 */
a,
a:hover,
a:focus {
  color: var(--jcd-color-accent-text);
}

/**
 * Removes the outline when a link is clicked. The rule above already covers
 * links inside .fl-page; this one still reaches links outside it.
 */
a:focus:not(:focus-visible) {
  outline: none;
}


/* ==========================================================================
   # 03. HEADINGS
   ========================================================================== */

h1, h2, h3, h4, h5, h6,
.entry-content h1, .entry-content h2, .entry-content h3,
.entry-content h4, .entry-content h5, .entry-content h6 {
  font-family: var(--jcd-font-heading);
  font-weight: var(--jcd-weight-display);
  color: var(--jcd-color-ink);
  line-height: 1.15;
  margin-bottom: var(--jcd-space-md);
}

/**
 * No !important — Beaver Builder heading modules must be able to
 * override these via the responsive device toggle.
 */
h1, .entry-content h1 { font-size: var(--jcd-text-h1); }
h2, .entry-content h2 { font-size: var(--jcd-text-h2); }
h3, .entry-content h3 { font-size: var(--jcd-text-h3); }
h4, .entry-content h4 { font-size: var(--jcd-text-h4); }
h5, .entry-content h5 { font-size: var(--jcd-text-lead); }
h6, .entry-content h6 { font-size: var(--jcd-text-body); }

/**
 * Every level must stay visually distinct at EVERY breakpoint. Stepping
 * h1 down without also stepping h2 collapses the hierarchy at the
 * narrower size — a real and easily-missed bug.
 */
@media (max-width: 992px) {
  h1, .entry-content h1 { font-size: var(--jcd-text-h2); }
  h2, .entry-content h2 { font-size: var(--jcd-text-h3); }
  h3, .entry-content h3 { font-size: var(--jcd-text-h4); }
}

@media (max-width: 768px) {
  h1, .entry-content h1 { font-size: var(--jcd-text-h3); }
  h2, .entry-content h2 { font-size: var(--jcd-text-h4); }
  h3, .entry-content h3 { font-size: var(--jcd-text-lead); }
}

p     { margin-bottom: var(--jcd-space-md); }
small { font-size: var(--jcd-text-caption); }


/* ==========================================================================
   # 04. UTILITY TYPE SCALE
   ========================================================================== */

.jcd_text_h1      { font-size: var(--jcd-text-h1); }
.jcd_text_h2      { font-size: var(--jcd-text-h2); }
.jcd_text_h3      { font-size: var(--jcd-text-h3); }
.jcd_text_h4      { font-size: var(--jcd-text-h4); }
.jcd_text_lead    { font-size: var(--jcd-text-lead); }
.jcd_text_body    { font-size: var(--jcd-text-body); }
.jcd_text_caption { font-size: var(--jcd-text-caption); }
.jcd_text_kicker  { font-size: var(--jcd-text-kicker); }


/* ==========================================================================
   # 05. CONTAINER
   ========================================================================== */

/**
 * The inset is applied to .fl-row-content rather than .fl-row-content-wrap
 * deliberately. Beaver Builder's Auto Spacing generates .fl-row[data-node]
 * .fl-row-content-wrap { padding-left: 0 } below 768px at specificity 0,3,0 —
 * any rule restoring padding there must beat it. Auto Spacing does not touch
 * .fl-row-content, so the inset applies cleanly at every width.
 *
 * max-width includes the padding (border-box), so it is content width plus
 * both insets.
 */

.fl-row-content.fl-row-fixed-width {
  max-width: calc(var(--jcd-content-max) + (var(--jcd-page-inset) * 2));
  padding-left: var(--jcd-page-inset);
  padding-right: var(--jcd-page-inset);
  box-sizing: border-box;
  margin-left: auto;
  margin-right: auto;
}


/* ==========================================================================
   # 06. SYSTEM — VERTICAL RHYTHM
   ========================================================================== */

/**
 * Applied to a ROW. These are the ONLY classes carrying row padding.
 * The row's own padding fields stay at the Global Settings default —
 * setting both creates a specificity tie decided by stylesheet load
 * order, which changes when a caching plugin is configured.
 */

.jcd_band_sm > .fl-row-content-wrap { padding-top: var(--jcd-band-sm); padding-bottom: var(--jcd-band-sm); }
.jcd_band_md > .fl-row-content-wrap { padding-top: var(--jcd-band-md); padding-bottom: var(--jcd-band-md); }
.jcd_band_lg > .fl-row-content-wrap { padding-top: var(--jcd-band-lg); padding-bottom: var(--jcd-band-lg); }
.jcd_band_xl > .fl-row-content-wrap { padding-top: var(--jcd-band-xl); padding-bottom: var(--jcd-band-xl); }

/**
 * For stacked rows sharing a background: the first carries top padding,
 * the last carries bottom, the middle neither. Without these, adjacent
 * bands double their gap.
 */
.jcd_band_top_only > .fl-row-content-wrap    { padding-bottom: 0; }
.jcd_band_bottom_only > .fl-row-content-wrap { padding-top: 0; }
.jcd_band_flush > .fl-row-content-wrap       { padding-top: 0; padding-bottom: 0; }


/* ==========================================================================
   # 07. SYSTEM — CONTENT WIDTH
   ========================================================================== */

.jcd_width_narrow > .fl-row-content-wrap > .fl-row-content {
  max-width: calc(var(--jcd-width-narrow) + (var(--jcd-page-inset) * 2));
}

.jcd_width_default > .fl-row-content-wrap > .fl-row-content {
  max-width: calc(var(--jcd-content-max) + (var(--jcd-page-inset) * 2));
}

.jcd_width_wide > .fl-row-content-wrap > .fl-row-content {
  max-width: calc(var(--jcd-width-wide) + (var(--jcd-page-inset) * 2));
}

.jcd_bleed > .fl-row-content-wrap > .fl-row-content {
  max-width: none;
  padding-left: 0;
  padding-right: 0;
}


/* ==========================================================================
   # 08. MOTION
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}


/* ==========================================================================
   # 09. LINE BREAK HELPERS
   ========================================================================== */

@media (max-width: 1200px) {
  br.jcd_break_lg_none { display: none; }
}

@media (max-width: 992px) {
  br.jcd_break_md_none { display: none; }
}

@media (max-width: 768px) {
  br.jcd_break_sm_none { display: none; }
}
