/*
 * J&S design system base: scope, text styles, layout helpers.
 *
 * Everything is opt-in. Nothing here styles bare elements, so existing Divi
 * and plugin pages are unaffected until markup uses the jsds- classes.
 * Text styles mirror the Figma text style names (Display/Hero 84 ->
 * .jsds-t-display-hero). They are fixed sizes, as in Figma; components choose
 * the mobile style explicitly instead of the scale shrinking automatically.
 */

/* ---------- Scope ---------- */

.jsds {
  font-family: var(--jsds-font-body);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--jsds-ink-700);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.jsds,
.jsds *,
.jsds *::before,
.jsds *::after {
  box-sizing: border-box;
}

.jsds :where(h1, h2, h3, h4, h5, h6, p, ul, ol, figure, blockquote) {
  margin: 0;
  padding: 0;
}

.jsds :where(h1, h2, h3, h4, h5, h6) {
  color: var(--jsds-ink-900);
}

.jsds img {
  display: block;
  max-width: 100%;
  height: auto;
}

/* ---------- Text styles (Figma names) ---------- */

.jsds .jsds-t-display-hero { font: 700 84px/1.02 var(--jsds-font-display); }
.jsds .jsds-t-display-l    { font: 700 44px/1.02 var(--jsds-font-display); }
.jsds .jsds-t-display-m    { font: 700 40px/1.02 var(--jsds-font-display); }
.jsds .jsds-t-display-s    { font: 700 32px/1.04 var(--jsds-font-display); }
.jsds .jsds-t-display-xs   { font: 700 26px/1.06 var(--jsds-font-display); }
.jsds .jsds-t-heading-l    { font: 700 24px/1.08 var(--jsds-font-display); }
.jsds .jsds-t-heading-m    { font: 600 21px/1.1 var(--jsds-font-display); }
.jsds .jsds-t-heading-s    { font: 600 19px/1.15 var(--jsds-font-display); }

.jsds .jsds-t-body-xl { font: 400 21px/1.45 var(--jsds-font-body); }
.jsds .jsds-t-body-l  { font: 400 20px/1.5 var(--jsds-font-body); }
.jsds .jsds-t-body-m  { font: 400 17px/1.5 var(--jsds-font-body); }
.jsds .jsds-t-body-s  { font: 400 15px/1.5 var(--jsds-font-body); }
.jsds .jsds-t-body-xs { font: 400 13px/1.45 var(--jsds-font-body); }

.jsds .jsds-t-label-16 { font: 600 16px/1.3 var(--jsds-font-body); }
.jsds .jsds-t-label-14 { font: 600 14px/1.3 var(--jsds-font-body); }

.jsds .jsds-t-button-l { font: 600 22px/1 var(--jsds-font-display); }
.jsds .jsds-t-button-m { font: 600 21px/1 var(--jsds-font-display); }

/* Section eyebrows on page 05 use Label/14 SemiBold in ink/500, not the
   Foundations Eyebrow/12 Mono style (open question in the Figma cache).
   The copy is typed in capitals in Figma; uppercase here keeps editors'
   mixed-case input consistent (text case is not visible on a View seat). */
.jsds .jsds-t-eyebrow-label {
  font: 600 14px/1.3 var(--jsds-font-body);
  color: var(--jsds-ink-500);
  text-transform: uppercase;
}

.jsds .jsds-t-mono-m { font: 400 13px/1.4 var(--jsds-font-mono); }

.jsds .jsds-t-eyebrow {
  font: 500 12px/1.4 var(--jsds-font-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--jsds-ink-500);
}

/* ---------- Colour helpers ---------- */

.jsds .jsds-c-ink-900 { color: var(--jsds-ink-900); }
.jsds .jsds-c-ink-700 { color: var(--jsds-ink-700); }
.jsds .jsds-c-ink-500 { color: var(--jsds-ink-500); }
.jsds .jsds-c-white   { color: var(--jsds-surface-white); }
.jsds .jsds-c-yellow  { color: var(--jsds-brand-yellow); } /* dark grounds only */

/* ---------- Layout ---------- */

.jsds-container {
  width: 100%;
  max-width: calc(var(--jsds-container) + 2 * var(--jsds-gutter));
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--jsds-gutter);
  padding-right: var(--jsds-gutter);
}

.jsds-section {
  padding-top: var(--jsds-section-pad);
  padding-bottom: var(--jsds-section-pad);
}

.jsds-section--page  { background: var(--jsds-surface-page); }
.jsds-section--white { background: var(--jsds-surface-white); }
.jsds-section--dark  { background: var(--jsds-ink-900); color: var(--jsds-surface-white); }

@media (max-width: 767px) {
  .jsds-section {
    padding-top: var(--jsds-section-pad-mobile);
    padding-bottom: var(--jsds-section-pad-mobile);
  }
}

/* ---------- Legacy theme isolation ---------- */

/* The legacy child-theme style.css underlines `#main-content a` (ID
   specificity), which reaches every jsds section placed on a page. The
   :not(#jsds-id-guard) adds one ID of specificity so this reset wins;
   underline-on-hover rules in the components carry the same guard. */
.jsds a:not(#jsds-id-guard) {
  text-decoration: none;
}

/* ---------- Utilities ---------- */

/* One screen only (two IDs of specificity, so it beats guarded section rules):
   for pages whose Figma mobile frame has other content
   than desktop (Ship on a J&S Truck). Mobile = up to 767px. */
@media (min-width: 768px) {
  .jsds-only-mobile:not(#jsds-id-guard):not(#jsds-id-guard-2) {
    display: none;
  }
}

@media (max-width: 767px) {
  .jsds-only-desktop:not(#jsds-id-guard):not(#jsds-id-guard-2) {
    display: none;
  }
}

/* Stacked shortcodes in one Text module get <br>/<p> from wpautop between
   them; hide those so sections butt together as in Figma. */
:is(header, section, footer, div).jsds + br,
:is(header, section, footer, div).jsds + p:empty {
  display: none;
}

.jsds-visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Divi Code modules that hold a jsds section. Divi gives every module but
   the last in a column `margin-bottom: 2.75%`; the Task 8 pages stack their
   sections as modules in one column, which left a white strip between
   sections. Pages with one module per row are unaffected. */
.et_pb_code:has(> .et_pb_code_inner > .jsds):not(#jsds-id-guard) {
  margin-bottom: 0;
}
