/* ============================================================================
   GLOBAL — shared across every template
   Loaded site-wide. If a rule appears on more than one template, it belongs
   here and nowhere else.

   SCOPE: base typography is gated behind body.bc-type, which functions.php
   currently adds on blog templates only. Shop, checkout and homepage keep
   the Elessi look untouched. One line in bc_body_classes() switches the whole
   site over — the token values do not change.
   ============================================================================ */

/* ---------------------------------------------------------------------------
   1. BASE TYPOGRAPHY  (scoped — see note above)
   --------------------------------------------------------------------------- */
body.bc-type {
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.bc-type h1,
body.bc-type h2,
body.bc-type h3,
body.bc-type h4,
body.bc-type h5,
body.bc-type h6 {
  font-family: var(--font-display);
  color: var(--ink);
  letter-spacing: var(--tracking-tight);
  text-wrap: balance;
}

body.bc-type h1 { font-size: var(--fs-h1); font-weight: var(--fw-bold);  line-height: var(--lh-tight);   }
body.bc-type h2 { font-size: var(--fs-h2); font-weight: var(--fw-bold);  line-height: var(--lh-heading); }
body.bc-type h3 { font-size: var(--fs-h3); font-weight: var(--fw-black); line-height: 1.35;              }
body.bc-type h4 { font-size: var(--fs-h4); font-weight: var(--fw-bold);  line-height: 1.4;               }
body.bc-type h5 { font-size: var(--fs-sm); font-weight: var(--fw-bold);  line-height: 1.4;               }
body.bc-type h6 { font-size: var(--fs-xs); font-weight: var(--fw-bold);  line-height: 1.4;
                  letter-spacing: var(--tracking-wide); text-transform: uppercase; }

/* Anchor jumps land below the sticky header rather than underneath it. */
body.bc-type :where(h1, h2, h3, h4, h5, h6)[id] { scroll-margin-top: var(--sticky-top); }

html { scroll-padding-top: var(--sticky-top); }

/* ---------------------------------------------------------------------------
   2. FOCUS — one visible ring, everywhere, unscoped

   Deliberately site-wide even in this pass. Elessi's default focus handling
   is inconsistent, and an invisible focus ring is a keyboard-accessibility
   failure that has nothing to do with which font you are using.
   --------------------------------------------------------------------------- */
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 3px;
}

/* ---------------------------------------------------------------------------
   3. SHARED COMPONENTS
   Anything repeated across blog, pages and archives lives here.
   --------------------------------------------------------------------------- */

/* --- Breadcrumb ----------------------------------------------------------- */
.bc-breadcrumb ol {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: var(--space-2);
  list-style: none; padding: 0; margin: 0 0 var(--space-6);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--ink-faint);
}
.bc-breadcrumb a { color: var(--ink-muted); transition: color var(--dur-fast); }
.bc-breadcrumb a:hover { color: var(--ink); text-decoration: underline; }
.bc-breadcrumb li + li::before {
  content: "›"; margin-inline-end: var(--space-2); color: var(--border-strong);
}
.bc-breadcrumb [aria-current="page"] { color: var(--ink); font-weight: var(--fw-semi); }

/* --- Buttons -------------------------------------------------------------- */
.bc-btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--space-2);
  min-height: 48px;                       /* WCAG 2.5.8 target size */
  padding: var(--space-3) var(--space-8);
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  font-size: var(--fs-sm);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--dur), transform var(--dur), box-shadow var(--dur);
}
.bc-btn:hover { background: #333; transform: translateY(-2px); box-shadow: 0 8px 28px rgba(0,0,0,0.18); }

.bc-btn--ghost {
  background: var(--paper);
  color: var(--ink);
  border: 1.5px solid var(--border);
}
.bc-btn--ghost:hover { background: var(--paper-cream); box-shadow: none; transform: none; }

/* --- Pills ---------------------------------------------------------------- */
.bc-pill {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--paper);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  color: var(--ink-muted);
}

/* --- Forms ---------------------------------------------------------------- */
.bc-input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: var(--paper);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-size: var(--fs-sm);
}
.bc-input::placeholder { color: var(--ink-faint); }

/* --- Card ----------------------------------------------------------------- */
.bc-card {
  background: var(--paper);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-5);
  box-shadow: var(--shadow);
}

/* ---------------------------------------------------------------------------
   4. UTILITIES
   --------------------------------------------------------------------------- */
.u-visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; overflow: hidden; white-space: nowrap;
  clip: rect(0 0 0 0); clip-path: inset(50%); border: 0;
}

.u-skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 999;
  background: var(--paper); color: var(--ink);
  padding: var(--space-3) var(--space-4);
  border: 2px solid var(--accent);
  font-weight: var(--fw-semi);
}
.u-skip-link:focus { left: var(--space-2); top: var(--space-2); }

/* --- Scroll reveal ---------------------------------------------------------
   Default state is VISIBLE. JS adds .is-armed to hide, then .is-revealed to
   bring back. Without JS nothing ever disappears — a table of contents is
   navigation, not decoration. */
.u-reveal { transition: opacity var(--dur-slow) var(--ease), transform var(--dur-slow) var(--ease); }
.u-reveal.is-armed { opacity: 0; transform: translateY(16px); }
.u-reveal.is-revealed { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .u-reveal.is-armed { opacity: 1; transform: none; }
}
