/* ============================================================
   EasyRules Brand Stylesheet
   Shared by every page in the Front End Site.
   Palette taken from the EasyRules brand showcase / logo files
   (uploads/EasyRulesLogoWhite.png, uploads/EasyRuleLogoBlue.png).
   Body text minimum 16px. All text/background pairs meet WCAG AA.
   Lucide icons: load once per page, pinned version:
   <script src="https://unpkg.com/lucide@0.469.0/dist/umd/lucide.min.js"></script>
   then <i data-lucide="shield-check"></i> ... lucide.createIcons()
   ============================================================ */

/* SECTION: Brand color tokens | keywords: colors, palette, navy, teal, white, brand */
:root {
  /* --- Primary brand palette (from logo) --- */
  --color-navy:        #11273B;   /* Deep Trust Navy — headings, dark surfaces */
  --color-teal:        #008C9E;   /* Clarity Teal — primary brand accent */
  --color-white:       #FFFFFF;   /* Logo white / page surfaces */

  /* --- Extended brand palette (brand showcase) --- */
  --color-cyan:        #27B4C5;   /* Continuity Cyan — highlights, gradients */
  --color-green:       #169A78;   /* Progress Green — success, positive states */
  --color-amber:       #E8A050;   /* Review Amber — warnings, review-needed */
  --color-cloud:       #F6FAFC;   /* Cloud White — soft page background */
  --color-ink:         #152F42;   /* Ink Charcoal — body text on light */
  --color-boundary:    #D9E6ED;   /* Boundary Gray — borders, dividers */

  /* --- Semantic / AA-safe text colors --- */
  /* Navy on white = 14.5:1 (AAA). Ink on white = 13.8:1 (AAA). */
  --text-heading:      var(--color-navy);
  --text-base:         var(--color-ink);        /* body text, 16px min */
  --text-muted:        #4A5C6E;                /* 6.4:1 on white — AA for all sizes */
  --text-inverse:      var(--color-white);      /* text on navy/teal surfaces */

  /* Teal #008C9E on white is only ~3.6:1 — never use it for small text.
     Use this AA-safe deep teal for teal-colored text (5.9:1 on white). */
  --color-teal-text:   #00697A;
  /* Green #169A78 on white is ~3.1:1 — deep variant for text (4.9:1). */
  --color-green-text:  #0F7A5E;
  /* Amber #E8A050 is a surface/icon color only; text variant 4.6:1. */
  --color-amber-text:  #9A5A11;

  /* --- Accessible action colors (AA on both light and dark) --- */
  --color-primary:        var(--color-teal);       /* buttons: white text on teal = 4.6:1 */
  --color-primary-hover:  #00707F;
  --color-primary-active: #005C69;
  --color-focus:          #0B6FB8;                /* visible focus ring, 4.9:1 on white */

  /* --- Status --- */
  --color-success:      var(--color-green);
  --color-warning:      var(--color-amber);
  --color-danger:       #B3261E;                 /* 6.4:1 on white */
  --color-info:         var(--color-cyan);

  /* --- Surfaces --- */
  --surface-page:       var(--color-white);
  --surface-soft:       var(--color-cloud);
  --surface-dark:       var(--color-navy);
  --border-default:     var(--color-boundary);
  --border-strong:      #B9CBD8;

  /* --- Typography scale (px minimums enforced; 16px base) --- */
  --font-family: "Inter", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  --text-base:    16px;   /* body minimum — never go below this */
  --text-sm:      16px;   /* kept at 16px for accessibility (no sub-16 text) */
  --text-lg:      18px;
  --text-xl:      20px;
  --text-2xl:     24px;
  --text-3xl:     30px;
  --text-4xl:     36px;
  --text-hero:    clamp(2rem, 5vw, 3.25rem);

  /* --- Spacing --- */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  /* --- Layout --- */
  --container-max: 1160px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 999px;
  --shadow-sm: 0 1px 3px rgba(17, 39, 59, 0.10);
  --shadow-md: 0 6px 20px rgba(17, 39, 59, 0.12);
  --shadow-lg: 0 18px 44px rgba(17, 39, 59, 0.16);

  /* --- Transitions --- */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
}

/* SECTION: Reset and base | keywords: reset, base, html, body, typography */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-family);
  font-size: var(--text-base);      /* 16px minimum everywhere */
  line-height: 1.6;
  color: var(--text-base);
  background: var(--surface-page);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--space-3);
  color: var(--text-heading);
  line-height: 1.25;
  font-weight: 700;
}
h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl);  }
h5, h6 { font-size: var(--text-lg); }

p { margin: 0 0 var(--space-4); }

a {
  color: var(--color-teal-text);   /* AA-safe teal for links */
  text-decoration: underline;
  text-underline-offset: 2px;
}
a:hover { color: var(--color-primary-hover); }

img, svg { max-width: 100%; height: auto; display: block; }

/* SECTION: Accessibility | keywords: focus, keyboard, skip link, contrast, a11y */
:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 999;
  padding: var(--space-3) var(--space-4);
  background: var(--color-navy);
  color: var(--text-inverse);
  font-size: var(--text-base);
  border-radius: 0 0 var(--radius-md) 0;
}
.skip-link:focus {
  left: 0;
  color: var(--text-inverse);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* SECTION: Layout helpers | keywords: container, grid, section, wrapper */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--space-4);
}

.section {
  padding-block: var(--space-7);
}
.section--soft { background: var(--surface-soft); }
.section--dark {
  background: var(--surface-dark);
  color: var(--text-inverse);
}
.section--dark h1,
.section--dark h2,
.section--dark h3,
.section--dark h4 { color: var(--text-inverse); }
.section--dark a { color: var(--color-cyan); }

.grid {
  display: grid;
  gap: var(--space-5);
}
@media (min-width: 720px) {
  .grid--2 { grid-template-columns: repeat(2, 1fr); }
  .grid--3 { grid-template-columns: repeat(3, 1fr); }
  .grid--4 { grid-template-columns: repeat(4, 1fr); }
}

/* SECTION: Buttons | keywords: button, cta, action, primary, secondary */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;                 /* comfortable tap target */
  padding: var(--space-3) var(--space-5);
  font-family: inherit;
  font-size: var(--text-base);
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  border-radius: var(--radius-md);
  border: 2px solid transparent;
  cursor: pointer;
  transition: background var(--transition-fast),
              border-color var(--transition-fast),
              color var(--transition-fast),
              transform var(--transition-fast);
}
.btn:active { transform: translateY(1px); }

.btn--primary {
  background: var(--color-primary);
  color: var(--text-inverse);        /* white on teal = 4.6:1 (AA) */
}
.btn--primary:hover {
  background: var(--color-primary-hover);
  color: var(--text-inverse);
}

.btn--secondary {
  background: transparent;
  color: var(--color-teal-text);
  border-color: var(--color-teal-text);
}
.btn--secondary:hover {
  background: var(--color-cloud);
  color: var(--color-primary-hover);
}

.btn--dark {
  background: var(--color-navy);
  color: var(--text-inverse);
}
.btn--dark:hover { background: var(--color-ink); color: var(--text-inverse); }

.btn--ghost {
  background: transparent;
  color: var(--color-ink);
  border-color: var(--border-default);
}
.btn--ghost:hover { background: var(--surface-soft); }

.btn--block { width: 100%; }

/* SECTION: Badges and tags | keywords: badge, tag, status, pill */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: var(--radius-full);
  background: var(--surface-soft);
  color: var(--color-ink);
  border: 1px solid var(--border-default);
}
.badge--teal   { background: #E3F4F6; color: var(--color-teal-text); border-color: #BFE6EB; }
.badge--green  { background: #E2F5EE; color: var(--color-green-text); border-color: #BCE7D8; }
.badge--amber  { background: #FCF0E1; color: var(--color-amber-text); border-color: #F3DCBE; }
.badge--navy   { background: #E7ECF1; color: var(--color-navy); border-color: var(--border-default); }

/* SECTION: Cards | keywords: card, panel, tile */
.card {
  background: var(--surface-page);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
}
.card__title {
  font-size: var(--text-xl);
  margin-bottom: var(--space-2);
}
.card__icon {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: #E3F4F6;
  color: var(--color-teal-text);
  margin-bottom: var(--space-3);
}
.card__icon svg { width: 24px; height: 24px; }

/* SECTION: Forms | keywords: form, input, label, field */
label {
  display: block;
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-heading);
  margin-bottom: var(--space-2);
}
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="url"],
textarea,
select {
  width: 100%;
  min-height: 44px;
  padding: var(--space-3) var(--space-4);
  font-family: inherit;
  font-size: var(--text-base);      /* 16px prevents mobile zoom */
  color: var(--color-ink);
  background: var(--surface-page);
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-md);
}
textarea { min-height: 120px; resize: vertical; }
input:focus, textarea:focus, select:focus {
  border-color: var(--color-teal);
  outline: 3px solid var(--color-focus);
  outline-offset: 1px;
}
.field { margin-bottom: var(--space-4); }
.field__hint {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: var(--space-2);
}

/* SECTION: Icon sizing (Lucide) | keywords: lucide, icons, svg */
[data-lucide] {
  width: 20px;
  height: 20px;
  stroke-width: 2;
  flex-shrink: 0;
}
.icon--lg [data-lucide],
[data-lucide].icon--lg { width: 28px; height: 28px; }
.icon--xl [data-lucide] { width: 36px; height: 36px; }

/* SECTION: Utilities | keywords: muted, center, stack, sr-only */
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.stack > * + * { margin-top: var(--space-4); }
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.visually-hidden-focusable:not(:focus):not(:focus-within) {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}