/*
 * global.css — Spoke Theme
 *
 * PURPOSE: WordPress-specific base fixes only.
 * Tailwind CDN (loaded via functions.php wp_enqueue_scripts) handles:
 *   - CSS reset (Preflight)
 *   - All layout / typography utilities
 *
 * LMS overrides    → lms-overrides.css
 * WooCommerce      → woocommerce-overrides.css
 */

/* ── Universal box model ──────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* ── Body base ────────────────────────────────────────────────── */
body {
  font-family: "Inter", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: #f8f9fa;
  color: #191c1d;
  margin: 0;
  padding: 0;
}

/* ── Smooth scroll ────────────────────────────────────────────── */
html {
  scroll-behavior: smooth;
}

/* ── CRITICAL: Remove block gap that causes header padding ─────── */
/*
 * WordPress FSE wraps <!-- wp:html --> blocks in <div class="wp-block-html">
 * These divs inherit the blockGap from theme.json (32px) which creates
 * unwanted space above the header and between template parts.
 */
.wp-site-blocks,
.wp-block-template-part,
.wp-block-group {
  --wp--style--block-gap: 0px;
}

/* Remove any default margin/gap between top-level site blocks */
.wp-site-blocks > * + * {
  margin-block-start: 0 !important;
}

/* Specifically target the wp-block-html wrapper inside template parts */
.wp-block-template-part .wp-block-html,
.wp-site-blocks > .wp-block-html {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  display: block;
}

/* The header itself must be flush to top */
#site-header {
  margin-top: 0 !important;
}

/* ── WordPress admin bar ──────────────────────────────────────── */
.admin-bar #site-header {
  top: 32px;
}
@media screen and (max-width: 782px) {
  .admin-bar #site-header {
    top: 46px;
  }
}

/* ── WordPress block defaults ─────────────────────────────────── */
.wp-block-group {
  margin-top: 0;
  margin-bottom: 0;
}

.wp-site-title {
  margin: 0;
}

.wp-block-navigation a:where(:not(.wp-element-button)) {
  color: inherit;
}

/* ── WooCommerce bare-minimum layout ─────────────────────────── */
.woocommerce,
.woocommerce-page {
  width: 100%;
}

/*
 * CRITICAL: Remove the padding/max-width WordPress adds via page.html
 * when WooCommerce pages load. Our spoke-woo-main div in functions.php
 * handles the correct container padding instead.
 */
.woocommerce-cart #main-content > .wp-block-post-content,
.woocommerce-checkout #main-content > .wp-block-post-content,
.woocommerce-account #main-content > .wp-block-post-content {
  padding: 0 !important;
  max-width: none !important;
}

/* ── Utility: screen-reader only ─────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Target WordPress's :root :where() specificity */
:root :where(.site-header.wp-block-group) {
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

:root :where(header .wp-block-group) {
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

.site-branding-smart {
  display: flex;
  align-items: center;
}

.site-branding-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.site-logo-img {
  max-height: 100px;
  width: auto;
}

.site-title-text {
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.05em;
  color: var(--wp--preset--color--primary);
}
/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 28px;
  border-radius: 8px;
  font-family: var(--wp--preset--font-family--inter);
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition:
    filter 150ms ease,
    transform 150ms ease;
  white-space: nowrap;
  line-height: 1;
}
.btn:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}
.btn-lg {
  height: 56px;
  padding: 0 36px;
  font-size: 17px;
}
.btn-sm {
  height: 38px;
  padding: 0 16px;
  font-size: 13px;
}

.btn-primary {
  background: var(--wp--preset--color--accent);
  color: var(--wp--preset--color--white);
}
.btn-secondary {
  background: transparent;
  color: var(--wp--preset--color--primary);
  border: 2px solid var(--wp--preset--color--primary);
}
.btn-secondary:hover {
  background: var(--wp--preset--color--primary);
  color: var(--wp--preset--color--white);
  filter: none;
}
.btn-ghost {
  background: transparent;
  color: #fff;
  border: 2px solid rgba(255, 255, 255, 0.35);
}
.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.1);
  filter: none;
}

/* ── Section backgrounds ─────────────────────────────────────── */
.bg-hero-gradient {
  background: linear-gradient(
    135deg,
    var(--wp--preset--color--primary) 0%,
    var(--wp--preset--color--dark) 100%
  );
}
.bg-section-light {
  background: var(--wp--preset--color--light);
}
.bg-section-primary {
  background: var(--wp--preset--color--primary);
}
.bg-section-surface {
  background: var(--wp--preset--color--surface);
}

/* ── Text colours ────────────────────────────────────────────── */
.text-primary {
  color: var(--wp--preset--color--primary);
}
.text-accent {
  color: var(--wp--preset--color--accent);
}
.text-muted {
  color: var(--wp--preset--color--on-surface-variant);
}
.text-white {
  color: #fff;
}

/* ── Accent underline divider ────────────────────────────────── */
.accent-divider {
  width: 80px;
  height: 4px;
  border-radius: 9999px;
  background: var(--wp--preset--color--accent);
}

/* ── Card ────────────────────────────────────────────────────── */
.card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.card:hover {
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  transform: translateY(-3px);
}

/* ── Icon box ────────────────────────────────────────────────── */
.icon-box {
  background: var(--wp--preset--color--surface);
  border-radius: 8px;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.icon-box svg {
  color: var(--wp--preset--color--primary);
}

/* ── Badge / pill ────────────────────────────────────────────── */
.badge-accent {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 4px 14px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: var(--wp--preset--color--accent);
}

/* ── Trust badge strip ───────────────────────────────────────── */
.trust-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: rgba(255, 255, 255, 0.5);
}

/* ── Section heading ─────────────────────────────────────────── */
.section-heading {
  color: var(--wp--preset--color--primary);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

/* ── Star rating ─────────────────────────────────────────────── */
.star {
  fill: var(--wp--preset--color--accent);
}

/* ── Navigation underline hover/focus/current ───────────────── */
/* ── Navigation spacing ───────────────────────────── */

.wp-block-navigation__container.wp-block-navigation {
    gap: 0 !important;
}

/* ── Navigation link styling ─────────────────────── */

.wp-block-navigation .wp-block-navigation-item__content {
    margin:0 0px 0px 10px;
    padding: 0 8px 4px 8px; /* top right bottom left */
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
    text-decoration: none;
}

/* Hover + Focus */

.wp-block-navigation .wp-block-navigation-item__content:hover,
.wp-block-navigation .wp-block-navigation-item__content:focus {
    font-weight: 800;
    border-bottom-color: var(--wp--preset--color--accent);
    padding: 0 8px 8px 8px; /* top right bottom left */
}

/* Current page */

.wp-block-navigation .wp-block-navigation-item__content[aria-current="page"],
.wp-block-navigation .wp-block-navigation-item__content[aria-current="ancestor"] {
    font-weight: 800;
    border-bottom-color: var(--wp--preset--color--accent);
}


@keyframes spokeSpin { to { transform: rotate(360deg); } }
.spoke-btn-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spokeSpin 0.6s linear infinite;
    flex-shrink: 0;
}
.spoke-btn-spinner-dark {
    border-color: rgba(0,0,0,0.15);
    border-top-color: rgba(0,0,0,0.6);
}

/* Add to cart button states — matches WC's own class additions */
.ajax_add_to_cart.loading {
    opacity: 0.6;
    cursor: wait;
    pointer-events: none;
    position: relative;
}
.ajax_add_to_cart.loading::after {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-left: 8px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spoke-btn-spin 0.6s linear infinite;
    vertical-align: middle;
}
@keyframes spoke-btn-spin {
    to { transform: rotate(360deg); }
}
.ajax_add_to_cart.added {
    opacity: 1;
    pointer-events: auto;
}
/* ── Inter font via Google Fonts fallback ─────────────────────── */
/* Self-hosted Inter is preferred (theme.json fontFace).
   This is a safety net if the woff2 files haven't been installed. */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap");
