/* ============================================================
   WA UTILITY, GLOBAL DESIGN TOKENS + RESET + SHARED COMPONENTS
   Single source of truth. Do not redeclare :root or .card/.btn
   elsewhere, pages inherit these.
   ============================================================ */

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

input, button, textarea, select {
  font-family: inherit;
}
img { max-width: 100%; height: auto; }

:root {
  /* ---- Brand ---- */
  --wa-green: #10B981;
  --wa-green-rgb: 16, 185, 129;
  --wa-green-hover: #0e9f72;
  --wa-green-dark: #0b7d5a;
  --wa-mockup-green: #25D366;

  /* ---- Neutral ramp ---- */
  --gray-50:  #f6f8f7;
  --gray-100: #eef2f0;
  --gray-200: #e4e9e6;
  --gray-300: #d3dbd7;
  --gray-400: #a4b1ab;
  --gray-500: #7d8b85;
  --gray-600: #566862;
  --gray-700: #38504a;
  --gray-800: #21352f;
  --gray-900: #0e211c;

  /* ---- Semantic surface/text (light). Dark overrides below. ---- */
  --color-bg:         #ffffff;
  --color-surface:    #ffffff;
  --color-surface-2:  #f1f5f3;
  --color-text:       #24322d;
  --color-text-muted: #5c6b65;
  --color-heading:    #12241f;
  --color-border:     #e6ebe8;
  --color-border-strong: #d5ddd9;

  /* ---- Status ---- */
  --color-success: #12a150;
  --color-warning: #b68b1a;
  --color-danger:  #dc3b2e;
  --color-info:    #2f7fe4;

  /* ---- Back-compat aliases ---- */
  --wa-dark:     var(--color-heading);
  --wa-bg:       var(--color-bg);
  --white:       var(--color-surface);
  --gray-light:  var(--color-border);
  --gray-text:   var(--color-text-muted);

  /* ---- Typography ----
     Two families sitewide: Mulish (display + UI, matches the homepage) and
     Inter (long-form body prose). Plus Jakarta Sans retired. */
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'Mulish', 'Inter', system-ui, sans-serif;
  --font-ui: 'Mulish', 'Inter', system-ui, sans-serif;
  --font-mono: ui-monospace, 'SFMono-Regular', 'Cascadia Code', 'Consolas', monospace;

  --text-xs:   0.75rem;
  --text-sm:   0.875rem;
  --text-base: 1rem;
  --text-lg:   1.125rem;
  --text-xl:   1.25rem;
  --text-2xl:  1.5rem;
  --text-3xl:  1.875rem;
  --text-4xl:  2.25rem;

  /* ---- Spacing (4px base) ---- */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;

  /* ---- Radii (crafted, not pill) ---- */
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --radius-full: 999px;

  /* ---- Shadows: realistic, soft, neutral (no colored sticker offset) ---- */
  --shadow-xs: 0 1px 2px rgba(15, 32, 27, 0.06);
  --shadow-sm: 0 1px 3px rgba(15, 32, 27, 0.07), 0 1px 2px rgba(15, 32, 27, 0.04);
  --shadow-md: 0 6px 16px -6px rgba(15, 32, 27, 0.12), 0 2px 6px -2px rgba(15, 32, 27, 0.06);
  --shadow-lg: 0 16px 32px -12px rgba(15, 32, 27, 0.16), 0 6px 14px -8px rgba(15, 32, 27, 0.08);

  /* ---- Back-compat: old token names used by single-tool/blog/tool CSS ---- */
  --shadow-card:        var(--shadow-sm);
  --shadow-card-hover:  var(--shadow-md);
  --shadow-button:      var(--shadow-sm);
  --shadow-button-hover:var(--shadow-md);
  --shadow-search:      var(--shadow-sm);
  --text-display: clamp(2.2rem, 6vw, 3.4rem);
  --font-emoji: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;

  /* ---- Motion ---- */
  --ease: cubic-bezier(0.22, 0.7, 0.35, 1);
  --dur-fast: 130ms;
  --dur: 220ms;

  /* ---- Layout ---- */
  --nav-height: 58px;
  --container: 1370px;
  --gutter: 1.75rem;
}

:root[data-theme="dark"] {
  --color-bg:         #0e1512;
  --color-surface:    #16211c;
  --color-surface-2:  #1e2a24;
  --color-text:       #e6efe9;
  --color-text-muted: #9fb4aa;
  --color-heading:    #f2f7f4;
  --color-border:     #26332c;
  --color-border-strong: #33463d;
}

/* ========== BASE ========== */
body {
  background: var(--color-bg);
  font-family: var(--font-body);
  color: var(--color-text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.55;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5 { color: var(--color-heading); font-family: var(--font-display); }
a { color: var(--wa-green-dark); }

/* ========== ACCESSIBILITY ========== */
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--wa-green);
  outline-offset: 2px;
  border-radius: 6px;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ========== PAGE CONTAINER ==========
   Scoped to div: WordPress also puts a "page" CLASS ON <body> for static
   pages (incl. the front page), and an unscoped .page rule would squeeze
   the entire body to 1180px. */
div.page {
  max-width: var(--container);
  width: 100%;
  margin: 0 auto;
  padding: 0 1.5rem;
  position: relative;
  z-index: 1;
}
/* Tool templates are full-bleed like the homepage; their own containers
   (.tool-wrap, .tools-page-container) handle the 1370px + gutter. */
body.single-tools div.page,
body.post-type-archive-tools div.page,
body.tax-tool_category div.page {
  max-width: none;
  padding: 0;
}

/* ========== BUTTONS (solid, proper, no pill, no sticker shadow) ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.68rem 1.25rem;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--text-sm);
  letter-spacing: -0.1px;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease), transform var(--dur-fast) var(--ease), color var(--dur) var(--ease);
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--wa-green);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
  background: var(--wa-green-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-outline {
  background: var(--color-surface);
  color: var(--color-heading);
  border-color: var(--color-border-strong);
  box-shadow: var(--shadow-xs);
}
.btn-outline:hover {
  border-color: var(--wa-green);
  color: var(--wa-green-dark);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
}

.btn-ghost {
  background: transparent;
  color: var(--color-heading);
}
.btn-ghost:hover { background: var(--color-surface-2); }

.btn-lg { padding: 0.9rem 1.6rem; font-size: var(--text-base); border-radius: var(--radius-md); }
.btn-block { width: 100%; }

/* ========== SECTION HEADINGS ========== */
.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin: var(--space-8) 0 var(--space-5);
  flex-wrap: wrap;
}
.section-head .section-title { margin: 0; }
.section-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-3xl);
  letter-spacing: -0.6px;
  color: var(--color-heading);
  line-height: 1.15;
}
.section-sub {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  margin-top: 0.5rem;
  max-width: 60ch;
}
.section-link {
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--wa-green-dark);
  text-decoration: none;
  white-space: nowrap;
}
.section-link:hover { text-decoration: underline; }

/* ========== TOOL GRID, exactly 5 per row on desktop, everywhere ========== */
.grid,
.tool-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1.25rem;
}
@media (max-width: 1180px) { .grid, .tool-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 900px)  { .grid, .tool-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; } }
@media (max-width: 620px)  { .grid, .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.85rem; } }
@media (max-width: 430px)  { .grid, .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.7rem; } }

/* ========== TOOL CARD, one component sitewide (illustrated icon) ========== */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  padding: 1.6rem 1.4rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.6rem;
  min-height: 218px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-xs);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur-fast) var(--ease);
}
.card:hover {
  border-color: var(--color-border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-4px);
}
.card:focus-visible { outline: 2px solid var(--wa-green); outline-offset: 3px; }

.card-ico {
  width: 46px;
  height: 46px;
  display: block;
  flex-shrink: 0;
  margin-bottom: 0.35rem;
}
.card-ico svg { width: 100%; height: 100%; display: block; }
.card:hover .card-ico svg { transform: scale(1.06); transition: transform var(--dur) var(--ease); }

.card-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.02rem;
  letter-spacing: -0.2px;
  color: var(--color-heading);
  line-height: 1.3;
}
.card-desc {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.55;
  /* No flex-grow: a stretched box + line-clamp crops text mid-line. */
  flex: none;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}


/* ========== SEARCH RESULTS DROPDOWN (header + archive) ========== */
.wa-sr {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 1200;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  max-height: 60vh;
  overflow-y: auto;
}
.wa-sr-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.6rem 0.9rem;
  text-decoration: none;
  border-bottom: 1px solid var(--color-border);
}
.wa-sr-item:last-child { border-bottom: none; }
.wa-sr-item:hover,
.wa-sr-item[aria-selected="true"] { background: var(--color-surface-2); }
.wa-sr-name { font-family: var(--font-ui); font-weight: 700; font-size: 0.9rem; color: var(--color-heading); }
.wa-sr-name mark { background: rgba(var(--wa-green-rgb), 0.22); color: inherit; padding: 0 1px; border-radius: 2px; }
.wa-sr-cat { font-size: 0.72rem; color: var(--color-text-muted); white-space: nowrap; flex-shrink: 0; }
.wa-sr-none { padding: 0.9rem; font-size: 0.85rem; color: var(--color-text-muted); }
.wa-sr-none a { color: var(--wa-green-dark); font-weight: 700; }
/* archive search wrapper needs positioning context for the dropdown */
.search-wrap { position: relative; }

/* ========== SEARCH (clean, proper) ========== */
.wa-search {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 560px;
  background: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  overflow: hidden;
  padding: 0.3rem 0.3rem 0.3rem 0.9rem;
  gap: 0.5rem;
}
.wa-search:focus-within {
  border-color: var(--wa-green);
  box-shadow: 0 0 0 3px rgba(var(--wa-green-rgb), 0.12), var(--shadow-sm);
}
.wa-search .search-ico { flex-shrink: 0; color: var(--gray-500); display: flex; }
.wa-search input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: var(--text-base);
  color: var(--color-heading);
  padding: 0.55rem 0;
  min-width: 0;
}
.wa-search input::placeholder { color: var(--gray-400); }
.wa-search .search-btn {
  background: var(--wa-green);
  color: #fff;
  border: none;
  padding: 0.6rem 1.3rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: var(--text-sm);
  cursor: pointer;
  transition: background var(--dur) var(--ease);
  white-space: nowrap;
}
.wa-search .search-btn:hover { background: var(--wa-green-hover); }

/* ========== A11Y UTILITIES (also injected inline, kept here for parity) ========== */
.sr-only {
  position: absolute !important; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 1000;
  background: var(--wa-green); color: #fff; padding: 0.6rem 1rem; border-radius: 0 0 8px 0; font-weight: 700;
}
.skip-link:focus { left: 0; }

/* ========== RESPONSIVE ========== */
@media (max-width: 860px) {
  div.page { padding: 0 15px; }
  .section-title { font-size: var(--text-2xl); }
  .section-head { margin: var(--space-7) 0 var(--space-4); }
}
@media (max-width: 560px) {
  .grid { grid-template-columns: 1fr 1fr; gap: 0.7rem; }
  .card { padding: 1rem; border-radius: var(--radius-md); }
  .tool-mono { width: 38px; height: 38px; font-size: 0.9rem; }
  .card-title { font-size: 0.9rem; }
  .card-desc { font-size: var(--text-xs); }
  .section-title { font-size: var(--text-xl); }
}

/* Long URLs and code must wrap on small screens (no horizontal scroll) */
.tool-body, .article-content, .faq-answer, .tsec-privacy p { overflow-wrap: break-word; }
.tool-body a, .article-content a, .faq-answer a,
.tool-body code, .article-content code {
  overflow-wrap: anywhere;
  word-break: break-word;
}
.tool-body table, .article-content table { display: block; overflow-x: auto; max-width: 100%; }
.wb-install{position:fixed;left:12px;right:12px;bottom:12px;z-index:9999;display:flex;align-items:center;gap:10px;background:#fff;border:1px solid rgba(16,185,129,.25);border-radius:16px;padding:10px 12px;box-shadow:0 18px 40px -18px rgba(15,32,27,.35);opacity:0;transform:translateY(12px);transition:all .25s ease;max-width:430px;margin:0 auto}
.wb-install.show{opacity:1;transform:none}.wb-install img{border-radius:10px}.wb-install-txt{flex:1;font-size:.85rem;color:#24322d;line-height:1.35}.wb-install-go{background:#10B981;color:#fff;border:none;border-radius:999px;padding:8px 16px;font-weight:800;font-size:.82rem;cursor:pointer}.wb-install-x{background:none;border:none;font-size:1.3rem;color:#8a8f99;cursor:pointer;line-height:1;padding:2px 6px}
