/* Base reset */
@layer str-reset, str-base, str-components, str-utilities, str-overrides;

/* Frontend foundation tokens */
:root {
  --str-frontend-font-family: var(--str-font-sans, "DM Sans", system-ui, sans-serif);
  --str-frontend-bg-color: var(--str-color-background, #f8fafc);
  --str-frontend-text-color: var(--str-color-text, #0f172a);
  --str-frontend-link-color: var(--str-color-primary, #1d4ed8);
  --str-frontend-link-hover-color: var(--str-color-primary-hover, #1e40af);
}

.str-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--str-space-2, 8px);
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: var(--str-radius-md, 8px);
  background-color: var(--str-color-primary, #1d4ed8);
  color: var(--str-color-text-inverse, #ffffff);
  padding: var(--str-space-2, 8px) var(--str-space-4, 16px);
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  transition:
    background-color var(--str-duration-fast, 100ms) var(--str-ease-out, cubic-bezier(0, 0, 0.2, 1)),
    box-shadow var(--str-duration-fast, 100ms) var(--str-ease-out, cubic-bezier(0, 0, 0.2, 1));
}

.str-btn:hover {
  background-color: var(--str-color-primary-hover, #1e40af);
  text-decoration: none;
}

.str-btn:disabled,
.str-btn[aria-disabled="true"],
.str-btn.is-disabled {
  cursor: not-allowed;
  opacity: 0.58;
  pointer-events: none;
}

.str-btn:focus-visible {
  outline: none;
  box-shadow: var(--str-focus-ring, 0 0 0 3px rgba(200, 224, 74, 0.36));
}

.str-btn--primary {
  border-color: var(--str-color-primary, #1d4ed8);
  background-color: var(--str-color-primary, #1d4ed8);
  color: var(--str-color-text-inverse, #ffffff) !important;
}

.str-btn--primary:hover {
  border-color: var(--str-color-primary-hover, #1e40af);
  background-color: var(--str-color-primary-hover, #1e40af);
  color: var(--str-color-text-inverse, #ffffff) !important;
}

.str-btn--secondary,
.str-btn--ghost,
.str-btn--light {
  border-color: var(--str-color-border, #cbd5e1);
  background-color: var(--str-color-surface, #ffffff);
  color: var(--str-color-text, #0f172a) !important;
}

.str-btn--secondary:hover,
.str-btn--ghost:hover,
.str-btn--light:hover {
  border-color: var(--str-color-court-700, var(--str-color-primary-hover, #1e40af));
  background-color: var(--str-color-surface-2, #f1f5f9);
  color: var(--str-color-court-900, var(--str-color-text, #0f172a)) !important;
}

.str-btn--danger {
  border-color: var(--str-color-error, #dc2626);
  background-color: var(--str-color-error, #dc2626);
  color: var(--str-color-text-inverse, #ffffff) !important;
}

.str-btn--danger:hover {
  border-color: var(--str-color-error-hover, #b91c1c);
  background-color: var(--str-color-error-hover, #b91c1c);
  color: var(--str-color-text-inverse, #ffffff) !important;
}

.str-btn--sm {
  min-height: 44px;
  padding: 0.48rem 0.9rem;
  font-size: 0.86rem;
}

.str-btn--xl {
  width: 100%;
  max-width: 320px;
  min-height: 48px;
  padding: 0.86rem 1.5rem;
  font-size: 1.02rem;
}

.str-btn--icon {
  width: 44px;
  min-width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--str-radius-md, 8px);
  line-height: 1;
}

.str-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--str-space-3, 12px);
  min-height: 220px;
  padding: var(--str-space-6, 24px);
  border: 1px solid var(--str-color-border, #cbd5e1);
  border-radius: var(--str-radius-lg, 12px);
  background: var(--str-color-surface, #ffffff);
  color: var(--str-color-text, #0f172a);
  text-align: center;
}

.str-empty-state__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--str-radius-md, 8px);
  background: var(--str-color-court-soft, #f0faf4);
  color: var(--str-color-court-700, #16624a);
}

.str-empty-state h3 {
  margin: 0;
  color: var(--str-color-text, #0f172a);
  font-family: var(--str-font-heading, var(--str-font-sans, inherit));
  font-size: var(--str-text-xl, 1.25rem);
  line-height: 1.25;
}

.str-empty-state p {
  max-width: 520px;
  margin: 0;
  color: var(--str-color-text-muted, #64748b);
  font-size: var(--str-text-base, 1rem);
  line-height: 1.55;
}

.str-skeleton {
  display: block;
  min-height: 1rem;
  border-radius: var(--str-radius-sm, 6px);
  background:
    linear-gradient(
      90deg,
      var(--str-color-surface-2, #f1f5f9) 0%,
      var(--str-color-surface-3, #e2e8f0) 42%,
      var(--str-color-surface-2, #f1f5f9) 84%
    );
  background-size: 220% 100%;
  animation: str-skeleton-shimmer 1.2s ease-in-out infinite;
}

.str-skeleton--text {
  height: 0.9rem;
}

.str-skeleton--title {
  height: 1.15rem;
}

.str-skeleton--pill {
  width: 96px;
  height: 28px;
  border-radius: 999px;
}

.str-skeleton--metric {
  height: 58px;
  border-radius: var(--str-radius-md, 8px);
}

.str-skeleton--w-md {
  width: min(46%, 260px);
}

.str-skeleton-stack {
  display: grid;
  gap: var(--str-space-3, 12px);
}

.str-skeleton-row {
  display: grid;
  grid-template-columns: minmax(120px, 1.4fr) repeat(3, minmax(72px, 1fr));
  gap: var(--str-space-3, 12px);
  align-items: center;
}

.str-skeleton-table {
  min-width: 100%;
  padding: var(--str-space-2, 8px) 0;
}

.str-skeleton-cell {
  padding: var(--str-space-3, 12px) var(--str-space-2, 8px) !important;
}

.str-skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--str-space-3, 12px);
}

@keyframes str-skeleton-shimmer {
  from {
    background-position: 120% 0;
  }

  to {
    background-position: -120% 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .str-skeleton {
    animation: none;
  }
}

.str-avatar {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--str-color-border, #cbd5e1);
  border-radius: 999px;
  background: var(--str-color-court-soft, #f0faf4);
  color: var(--str-color-court-900, #052e16);
  font-family: var(--str-font-heading, var(--str-font-sans, inherit));
  font-size: var(--str-text-base, 1rem);
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
}

.str-avatar--xs {
  width: 30px;
  height: 30px;
  flex-basis: 30px;
  font-size: var(--str-text-sm, 0.875rem);
}

.str-avatar--sm {
  width: 34px;
  height: 34px;
  flex-basis: 34px;
  font-size: var(--str-text-sm, 0.875rem);
}

.str-avatar--md {
  width: 42px;
  height: 42px;
  flex-basis: 42px;
  font-size: var(--str-text-lg, 1.125rem);
}

.str-avatar--lg {
  width: 52px;
  height: 52px;
  flex-basis: 52px;
  font-size: var(--str-text-xl, 1.25rem);
}

.str-avatar--xl {
  width: 72px;
  height: 72px;
  flex-basis: 72px;
  font-size: 1.45rem;
}

.str-avatar--accent {
  border-color: transparent;
  background: var(--str-color-accent, #c8e04a);
  color: var(--str-color-court-900, #052e16);
}

.str-avatar--solid {
  border-color: transparent;
  background: var(--str-color-court-700, #16624a);
  color: var(--str-color-paper, var(--str-color-text-inverse, #ffffff));
}

.str-avatar--inverse {
  border-color: transparent;
  background: rgba(255, 255, 255, 0.18);
  color: var(--str-color-text-inverse, #ffffff);
}

/* Base icon behavior for SVG sprite usage */
.str-icon {
  display: inline-block;
  width: 1em;
  height: 1em;
  vertical-align: middle;
  flex: 0 0 auto;
  color: currentColor;
  stroke: currentColor;
  stroke-width: 16;
}

/* Post-B utility helpers for migrated inline styles */
.str-u-mt-8 { margin-top: 8px; }
.str-u-p-10 { padding: 10px; }
.str-u-hidden { display: none; }

body.str-app-page,
body.str-saas-app-page {
  background: var(--str-color-background);
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  padding: 0;
}

body.str-saas-app-page #page,
body.str-saas-app-page .site,
body.str-saas-app-page main,
body.str-saas-app-page #main,
body.str-saas-app-page #content,
body.str-saas-app-page .site-content,
body.str-saas-app-page .wp-site-blocks,
body.str-saas-app-page .ast-global-container,
body.str-saas-app-page .entry-content {
  width: 100%;
  max-width: none;
  margin: 0;
  padding-top: 0;
  padding-left: 0;
  padding-right: 0;
  padding-bottom: 0;
  background: var(--str-color-background);
}

body.str-saas-app-page .entry-content > * {
  max-width: none;
}

body.str-saas-app-page .entry-content,
body.str-saas-app-page .wp-block-post-content {
  margin-top: 0;
  margin-bottom: 0;
}

body.str-saas-home-page .str-dashboard-shell {
  max-width: none;
  margin: 0;
  padding: 0;
}

body.str-saas-home-page .str-home-split {
  min-height: 100vh;
  margin: 0;
}

body.str-saas-app-page #header,
body.str-saas-app-page .site-header,
body.str-saas-app-page #masthead {
  display: none;
}

body.str-saas-app-page #footer,
body.str-saas-app-page .site-footer,
body.str-saas-app-page #colophon {
  width: 100%;
  margin: 0;
  padding: 18px clamp(18px, 3vw, 40px);
  background: var(--str-color-background);
  color: var(--str-color-text-muted);
  border-top: 1px solid var(--str-color-border);
}
