/* ==========================================================================
   JIST — SHARED PRIMITIVES
   Global resets WordPress does not ship, plus the cross-section components
   (eyebrow annotation, buttons, icons, media frames).
   Every value references a theme.json token. No raw hex, size or timing.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Box-sizing — WP does NOT reset to border-box.
   Scoped to the project prefix so core and plugin styles are left alone.
   -------------------------------------------------------------------------- */
[class*="jist-"],
[class*="jist-"]::before,
[class*="jist-"]::after,
[class*="jist-"] * {
  box-sizing: border-box;
}

/* --------------------------------------------------------------------------
   2. Focus — keyboard only, on brand tokens.
   Neither core, themes, nor Global Styles ship any :focus styles.
   -------------------------------------------------------------------------- */
:focus:not(:focus-visible) {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--wp--preset--color--accent);
  outline-offset: 3px;
  border-radius: var(--wp--custom--radius-xs);
}

.jist-on-dark :focus-visible,
.jist-hero :focus-visible {
  outline-color: var(--wp--preset--color--accent-lit);
}

/* --------------------------------------------------------------------------
   3. blockGap white-stripe fix.
   The theme's blockGap puts a top margin on every root sibling and every
   top-level section, which shows as a white stripe between full-bleed
   backgrounds. Core applies it with zero-specificity :where() rules, so a
   plain class wins. Do NOT fix this by zeroing blockGap in theme.json — that
   collapses spacing inside normal flowing content.
   -------------------------------------------------------------------------- */
.wp-site-blocks > * {
  margin-block-start: 0;
}

.entry-content > [class*="jist-"] {
  margin-block-start: 0;
}

/* --------------------------------------------------------------------------
   4. Drawing-sheet annotation (eyebrow)
   Mono, tracked, preceded by a short brass rule. The signature device of the
   design — borrowed from the title blocks on JIST's own drawings.
   -------------------------------------------------------------------------- */
.jist-annotation {
  display: inline-flex;
  align-items: center;
  gap: var(--wp--preset--spacing--30);
  margin: 0;
  font-family: var(--wp--preset--font-family--mono);
  font-size: var(--wp--preset--font-size--label);
  font-weight: 500;
  letter-spacing: var(--wp--custom--tracking-label);
  text-transform: uppercase;
  color: var(--wp--preset--color--accent-ink);
  line-height: 1;
}

.jist-annotation::before {
  content: "";
  inline-size: var(--wp--preset--spacing--60);
  block-size: var(--wp--custom--rule-accent);
  background-color: var(--wp--preset--color--accent);
  flex: none;
}

.jist-annotation--on-dark {
  color: var(--wp--preset--color--accent-lit);
}

.jist-annotation--plain::before {
  content: none;
}

/* --------------------------------------------------------------------------
   5. Icons — one consistent 1.5px line set
   -------------------------------------------------------------------------- */
.jist-icon {
  inline-size: 24px;
  block-size: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
  display: block;
}

/* --------------------------------------------------------------------------
   6. Buttons
   Single class so they beat theme.json's :where()-wrapped link element styles.
   -------------------------------------------------------------------------- */
.jist-btn {
  --jist-btn-bg: transparent;
  --jist-btn-fg: var(--wp--preset--color--contrast);
  --jist-btn-border: transparent;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--wp--preset--spacing--30);
  padding: var(--wp--preset--spacing--40) var(--wp--preset--spacing--60);
  min-block-size: 52px;
  font-family: var(--wp--preset--font-family--heading);
  font-size: var(--wp--preset--font-size--sm);
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  background-color: var(--jist-btn-bg);
  color: var(--jist-btn-fg);
  border: var(--wp--custom--hairline) solid var(--jist-btn-border);
  border-radius: var(--wp--custom--radius-sm);
  transition:
    background-color var(--wp--custom--duration-fast) var(--wp--custom--ease-out),
    border-color var(--wp--custom--duration-fast) var(--wp--custom--ease-out),
    color var(--wp--custom--duration-fast) var(--wp--custom--ease-out),
    box-shadow var(--wp--custom--duration-base) var(--wp--custom--ease-out),
    transform var(--wp--custom--duration-fast) var(--wp--custom--ease-out);
}

.jist-btn:hover {
  transform: translateY(-1px);
  text-decoration: none;
}

.jist-btn:active {
  transform: translateY(0);
}

.jist-btn .jist-icon {
  inline-size: 18px;
  block-size: 18px;
}

/* Primary — the call button. Brass fill, ink label. */
.jist-btn--primary {
  --jist-btn-bg: var(--wp--preset--color--accent);
  --jist-btn-fg: var(--wp--preset--color--contrast);
  --jist-btn-border: var(--wp--preset--color--accent);
  box-shadow: var(--wp--custom--shadow-md);
}

.jist-btn--primary:hover {
  --jist-btn-bg: var(--wp--preset--color--accent-lit);
  --jist-btn-border: var(--wp--preset--color--accent-lit);
  box-shadow: var(--wp--custom--shadow-lg);
}

/* Secondary on a light ground */
.jist-btn--outline {
  --jist-btn-bg: var(--wp--preset--color--base);
  --jist-btn-fg: var(--wp--preset--color--contrast);
  --jist-btn-border: var(--wp--preset--color--line-strong);
}

.jist-btn--outline:hover {
  --jist-btn-bg: var(--wp--preset--color--accent-soft);
  --jist-btn-border: var(--wp--preset--color--accent);
}

/* Secondary on a dark ground — the WhatsApp backup action */
.jist-btn--outline-light {
  --jist-btn-bg: transparent;
  --jist-btn-fg: var(--wp--preset--color--base);
  --jist-btn-border: var(--wp--custom--alpha-white-medium);
}

.jist-btn--outline-light:hover {
  --jist-btn-bg: var(--wp--custom--alpha-white-soft);
  --jist-btn-border: var(--wp--preset--color--accent);
}

.jist-btn--block {
  inline-size: 100%;
}

/* --------------------------------------------------------------------------
   7. Media frames
   -------------------------------------------------------------------------- */
.jist-media-frame {
  position: relative;
  border-radius: var(--wp--custom--radius-md);
  overflow: hidden;
  background-color: var(--wp--preset--color--slate);
}

.jist-media-frame img {
  inline-size: 100%;
  block-size: 100%;
  object-fit: cover;
  display: block;
}

.jist-media-frame--4-5 { aspect-ratio: 4 / 5; }
.jist-media-frame--3-2 { aspect-ratio: 3 / 2; }
.jist-media-frame--16-10 { aspect-ratio: 16 / 10; }

/* --------------------------------------------------------------------------
   8. Reduced motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .jist-btn {
    transition-duration: 0.01ms;
  }
  .jist-btn:hover,
  .jist-btn:active {
    transform: none;
  }
}

/* --------------------------------------------------------------------------
   9. Section shell
   Every section block is alignfull and paints its own ground, so the padding
   lives on the outer element and an inner rail re-establishes the 1200px
   container. padding-inline: 0 on the rail beats core's :where() rule that
   pads alignfull children.
   -------------------------------------------------------------------------- */
.jist-section {
  position: relative;
  padding-block: var(--wp--custom--section-space);
  padding-inline: var(--wp--custom--gutter);
}

.jist-section--white { background-color: var(--wp--preset--color--base); }
.jist-section--paper { background-color: var(--wp--preset--color--paper); }

.jist-section__inner {
  position: relative;
  z-index: 1;
  inline-size: 100%;
  max-inline-size: var(--wp--custom--container-width);
  margin-inline: auto;
  padding-inline: 0;
}

/* --------------------------------------------------------------------------
   10. Section headers
   -------------------------------------------------------------------------- */
.jist-section-head {
  display: grid;
  gap: var(--wp--preset--spacing--40);
  max-inline-size: var(--wp--custom--measure);
  margin-block-end: var(--wp--preset--spacing--90);
}

.jist-section-head h2 {
  margin: 0;
  font-family: var(--wp--preset--font-family--heading);
  font-size: var(--wp--preset--font-size--htwo);
  font-weight: 700;
  line-height: var(--wp--custom--leading-snug);
  letter-spacing: var(--wp--custom--tracking-display);
  color: var(--wp--preset--color--contrast);
  text-wrap: balance;
}

.jist-section-head__lead {
  margin: 0;
  font-size: var(--wp--preset--font-size--lead);
  color: var(--wp--preset--color--muted);
  line-height: var(--wp--custom--leading-relaxed);
  text-wrap: pretty;
}

/* Head with a trailing link sitting on the same baseline. */
.jist-section-head--split {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--wp--preset--spacing--60);
  max-inline-size: none;
}

.jist-section-head--split .jist-stack {
  max-inline-size: var(--wp--custom--measure);
}

.jist-stack {
  display: grid;
  gap: var(--wp--preset--spacing--40);
  justify-items: start;
}

/* --------------------------------------------------------------------------
   11. Drawing-sheet annotation set, continued
   -------------------------------------------------------------------------- */

/* Sheet reference tag: a small mono code chip */
.jist-sheet-ref {
  display: inline-block;
  margin: 0;
  padding: var(--wp--preset--spacing--10) var(--wp--preset--spacing--20);
  font-family: var(--wp--preset--font-family--mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: var(--wp--custom--tracking-label);
  text-transform: uppercase;
  color: var(--wp--preset--color--accent-ink);
  background-color: var(--wp--preset--color--accent-soft);
  border-radius: var(--wp--custom--radius-xs);
  line-height: 1.4;
}

.jist-sheet-ref--on-dark {
  color: var(--wp--preset--color--accent-lit);
  background-color: var(--wp--custom--alpha-brass-soft);
}

/* Registration marks: brass crop corners on a panel */
.jist-reg-mark {
  position: absolute;
  inline-size: 14px;
  block-size: 14px;
  border-color: var(--wp--preset--color--accent);
  border-style: solid;
  border-width: 0;
  pointer-events: none;
  z-index: 1;
}

.jist-reg-mark--tl {
  inset-block-start: -1px;
  inset-inline-start: -1px;
  border-block-start-width: var(--wp--custom--rule-accent);
  border-inline-start-width: var(--wp--custom--rule-accent);
}

.jist-reg-mark--br {
  inset-block-end: -1px;
  inset-inline-end: -1px;
  border-block-end-width: var(--wp--custom--rule-accent);
  border-inline-end-width: var(--wp--custom--rule-accent);
}

/* Dimension line: hairline with tick caps, as on a drawing */
.jist-dim-rule {
  position: relative;
  block-size: var(--wp--custom--hairline);
  background-color: var(--wp--preset--color--line-strong);
  border: 0;
  inline-size: 100%;
}

.jist-dim-rule::before,
.jist-dim-rule::after {
  content: "";
  position: absolute;
  inset-block-start: -4px;
  inline-size: var(--wp--custom--hairline);
  block-size: 9px;
  background-color: var(--wp--preset--color--accent);
}

.jist-dim-rule::before { inset-inline-start: 0; }
.jist-dim-rule::after  { inset-inline-end: 0; }

.jist-dim-rule--on-dark { background-color: var(--wp--custom--alpha-white-light); }

/* Faint blueprint grid, used behind dark panels */
.jist-blueprint-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--wp--custom--alpha-white-soft) var(--wp--custom--hairline), transparent var(--wp--custom--hairline)),
    linear-gradient(90deg, var(--wp--custom--alpha-white-soft) var(--wp--custom--hairline), transparent var(--wp--custom--hairline));
  background-size: 64px 64px;
  -webkit-mask-image: radial-gradient(120% 90% at 22% 12%, #000 0%, transparent 78%);
  mask-image: radial-gradient(120% 90% at 22% 12%, #000 0%, transparent 78%);
}

/* --------------------------------------------------------------------------
   12. Icon frame + arrow link
   -------------------------------------------------------------------------- */
.jist-icon-frame {
  display: grid;
  place-items: center;
  inline-size: 48px;
  block-size: 48px;
  border: var(--wp--custom--hairline) solid var(--wp--custom--alpha-brass-medium);
  border-radius: var(--wp--custom--radius-sm);
  color: var(--wp--preset--color--accent-ink);
  background-color: var(--wp--preset--color--accent-soft);
  flex: none;
}

.jist-link-arrow {
  display: inline-flex;
  align-items: center;
  gap: var(--wp--preset--spacing--20);
  font-family: var(--wp--preset--font-family--heading);
  font-size: var(--wp--preset--font-size--sm);
  font-weight: 600;
  color: var(--wp--preset--color--accent-ink);
  text-decoration: none;
  line-height: 1.2;
}

.jist-link-arrow .jist-icon {
  inline-size: 16px;
  block-size: 16px;
  transition: transform var(--wp--custom--duration-base) var(--wp--custom--ease-out);
}

.jist-link-arrow:hover { text-decoration: underline; }
.jist-link-arrow:hover .jist-icon { transform: translateX(4px); }

.jist-link-arrow--on-dark { color: var(--wp--preset--color--accent-lit); }

/* --------------------------------------------------------------------------
   13. Tick list — the check-marked deliverable lists used by several sections
   -------------------------------------------------------------------------- */
.jist-tick-list {
  display: grid;
  gap: var(--wp--preset--spacing--30);
  margin: 0;
  padding: 0;
  list-style: none;
}

.jist-tick-list li {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: var(--wp--preset--spacing--30);
  align-items: start;
  font-size: var(--wp--preset--font-size--sm);
  line-height: var(--wp--custom--leading-normal);
  color: var(--wp--preset--color--slate);
}

.jist-tick-list .jist-icon {
  inline-size: 18px;
  block-size: 18px;
  color: var(--wp--preset--color--accent-ink);
  margin-block-start: 3px;
}

/* --------------------------------------------------------------------------
   14. Scroll reveal — opt-in, disabled entirely under reduced motion
   -------------------------------------------------------------------------- */
.jist-reveal {
  opacity: 0;
  transform: translateY(var(--wp--custom--reveal-shift));
  transition:
    opacity var(--wp--custom--duration-slow) var(--wp--custom--ease-out),
    transform var(--wp--custom--duration-slow) var(--wp--custom--ease-out);
}

.jist-reveal.is-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .jist-reveal { opacity: 1; transform: none; }
}

/* The editor never runs the front-end script, so a reveal element would sit
   at opacity 0 and the block would look empty in the canvas. */
.editor-styles-wrapper .jist-reveal {
  opacity: 1;
  transform: none;
}

/* --------------------------------------------------------------------------
   15. Accessibility + document behaviour
   The static site got these from its own base reset; WordPress ships none of
   them, so they are ported here or they surface later as mystery bugs.
   -------------------------------------------------------------------------- */

/* Visually hidden but still announced. Used for the stats band heading and
   the slider control labels. */
.jist-visually-hidden {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* In-page anchors land under the fixed header without this. */
html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--wp--custom--header-height) + var(--wp--preset--spacing--50));
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* Core gives hr a horizontal margin; the dimension rule has to span its box. */
.jist-dim-rule { margin-inline: 0; }
