/* =========================================================
   COMPONENTS
   ========================================================= */

/* ---------- Buttons ---------- */
.st-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--st-space-2);
  padding: 0.65em 1.3em;
  font-size: var(--st-fs-sm);
  font-weight: 600;
  border-radius: var(--st-radius);
  border: var(--st-border-width) solid transparent;
  cursor: pointer;
  transition: background var(--st-transition), border-color var(--st-transition), color var(--st-transition), transform var(--st-transition);
  text-decoration: none;
  line-height: 1.2;
}
.st-btn:active { transform: translateY(1px); }

.st-btn--primary {
  background: var(--st-primary);
  color: #fff;
}
.st-btn--primary:hover { background: var(--st-primary-dark); color: #fff; }

.st-btn--secondary {
  background: transparent;
  border-color: var(--st-border-strong);
  color: var(--st-ink);
}
.st-btn--secondary:hover { border-color: var(--st-ink); background: var(--st-paper-raised); }

.st-btn--accent {
  background: var(--st-accent);
  color: #fff;
}
.st-btn--accent:hover { background: #B36E24; color: #fff; }

.st-btn--ghost {
  background: transparent;
  color: var(--st-primary);
  padding-inline: 0.5em;
}
.st-btn--ghost:hover { color: var(--st-primary-dark); }

.st-btn--sm { padding: 0.45em 0.9em; font-size: var(--st-fs-xs); }
.st-btn--block { width: 100%; }
.st-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- Header / Nav ---------- */
.st-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250, 250, 247, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: var(--st-border-width) solid var(--st-border);
}
.st-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--st-header-height);
  gap: var(--st-space-5);
}
.st-brand {
  display: flex;
  align-items: center;
  gap: var(--st-space-2);
  text-decoration: none;
  color: var(--st-ink);
  font-family: var(--st-font-display);
  font-weight: 600;
  font-size: var(--st-fs-lg);
  flex-shrink: 0;
}
.st-brand:hover { color: var(--st-ink); }
.st-brand-logo {
  height: 30px;
  width: auto;
  display: block;
}
.st-footer-brand-link {
  margin-bottom: var(--st-space-3);
}

.st-nav {
  display: flex;
  align-items: center;
  gap: var(--st-space-6);
}
.st-nav-links {
  display: flex;
  align-items: center;
  gap: var(--st-space-5);
  list-style: none;
  margin: 0; padding: 0;
}
.st-nav-links a {
  color: var(--st-ink-soft);
  text-decoration: none;
  font-size: var(--st-fs-sm);
  font-weight: 500;
  padding: var(--st-space-2) 0;
  border-bottom: 2px solid transparent;
  transition: color var(--st-transition), border-color var(--st-transition);
}
.st-nav-links a:hover,
.st-nav-links a[aria-current="page"] {
  color: var(--st-ink);
  border-color: var(--st-accent);
}

.st-nav-toggle {
  display: none;
  background: none;
  border: var(--st-border-width) solid var(--st-border-strong);
  border-radius: var(--st-radius-sm);
  width: 40px; height: 40px;
  align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.st-nav-toggle svg { width: 20px; height: 20px; }

/* ---------- Breadcrumbs ---------- */
.st-breadcrumbs {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: var(--st-space-2);
  padding: 0; margin: 0 0 var(--st-space-5);
  font-size: var(--st-fs-xs);
  color: var(--st-secondary);
}
.st-breadcrumbs li { display: flex; align-items: center; gap: var(--st-space-2); }
.st-breadcrumbs li:not(:last-child)::after {
  content: "/";
  color: var(--st-border-strong);
}
.st-breadcrumbs a { color: var(--st-secondary); text-decoration: none; }
.st-breadcrumbs a:hover { color: var(--st-primary); }
.st-breadcrumbs [aria-current="page"] { color: var(--st-ink-soft); }

/* ---------- Cards ---------- */
.st-card {
  background: var(--st-paper-raised);
  border: var(--st-border-width) solid var(--st-border);
  border-radius: var(--st-radius);
  padding: var(--st-space-5);
  transition: border-color var(--st-transition);
}
.st-card:hover { border-color: var(--st-border-strong); }

.st-calc-card {
  display: flex;
  flex-direction: column;
  gap: var(--st-space-2);
  background: var(--st-paper-raised);
  border: var(--st-border-width) solid var(--st-border);
  border-radius: var(--st-radius);
  padding: var(--st-space-4) var(--st-space-5);
  text-decoration: none;
  color: inherit;
  transition: border-color var(--st-transition), box-shadow var(--st-transition);
}
.st-calc-card:hover {
  border-color: var(--st-primary);
  box-shadow: var(--st-shadow-sm);
  color: inherit;
}
.st-calc-card__name {
  font-weight: 600;
  font-size: var(--st-fs-sm);
  color: var(--st-ink);
}
.st-calc-card__cat {
  font-size: var(--st-fs-xs);
  color: var(--st-secondary);
}

.st-category-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--st-space-4);
  padding: var(--st-space-5);
  border: var(--st-border-width) solid var(--st-border);
  border-radius: var(--st-radius);
  text-decoration: none;
  color: inherit;
  background: var(--st-paper-raised);
  transition: border-color var(--st-transition);
}
.st-category-row:hover { border-color: var(--st-primary); color: inherit; }
.st-category-row__title {
  font-family: var(--st-font-display);
  font-size: var(--st-fs-lg);
  margin: 0 0 var(--st-space-1);
}
.st-category-row__desc {
  color: var(--st-ink-soft);
  font-size: var(--st-fs-sm);
  margin: 0;
}
.st-category-row__count {
  flex-shrink: 0;
  font-size: var(--st-fs-xs);
  color: var(--st-secondary);
  border: var(--st-border-width) solid var(--st-border-strong);
  border-radius: 999px;
  padding: var(--st-space-1) var(--st-space-3);
  white-space: nowrap;
}

/* ---------- Forms / inputs ---------- */
.st-field { margin-bottom: var(--st-space-4); }
.st-label {
  display: block;
  font-size: var(--st-fs-sm);
  font-weight: 600;
  margin-bottom: var(--st-space-2);
  color: var(--st-ink);
}
.st-input, .st-select, .st-textarea {
  width: 100%;
  padding: 0.7em 0.9em;
  border: var(--st-border-width) solid var(--st-border-strong);
  border-radius: var(--st-radius);
  background: var(--st-paper-raised);
  color: var(--st-ink);
  transition: border-color var(--st-transition), box-shadow var(--st-transition);
}
.st-input:focus, .st-select:focus, .st-textarea:focus {
  border-color: var(--st-primary);
  box-shadow: 0 0 0 3px var(--st-primary-tint);
  outline: none;
}
.st-help { font-size: var(--st-fs-xs); color: var(--st-secondary); margin-top: var(--st-space-1); }

/* ---------- Search ---------- */
.st-search {
  position: relative;
}
.st-search-input {
  width: 100%;
  padding: 0.85em 1em 0.85em 2.75em;
  border: var(--st-border-width) solid var(--st-border-strong);
  border-radius: var(--st-radius);
  background: var(--st-paper-raised);
  font-size: var(--st-fs-md);
}
.st-search-input:focus {
  border-color: var(--st-primary);
  box-shadow: 0 0 0 3px var(--st-primary-tint);
  outline: none;
}
.st-search-icon {
  position: absolute;
  left: 0.9em;
  top: 50%;
  transform: translateY(-50%);
  width: 20px; height: 20px;
  color: var(--st-secondary);
  pointer-events: none;
}
.st-search-results {
  margin-top: var(--st-space-5);
}
.st-search-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--st-space-3);
}
.st-search-empty {
  text-align: left;
  padding: var(--st-space-7) 0;
  color: var(--st-secondary);
}
.st-search-empty h3 { color: var(--st-ink-soft); margin-bottom: var(--st-space-2); }
mark.st-highlight {
  background: var(--st-accent-tint);
  color: var(--st-ink);
  border-radius: 2px;
  padding: 0 2px;
}

/* ---------- Filter chips ---------- */
.st-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--st-space-2);
}
.st-chip {
  border: var(--st-border-width) solid var(--st-border-strong);
  background: var(--st-paper-raised);
  border-radius: 999px;
  padding: 0.4em 1em;
  font-size: var(--st-fs-xs);
  font-weight: 600;
  cursor: pointer;
  color: var(--st-ink-soft);
  transition: all var(--st-transition);
}
.st-chip:hover { border-color: var(--st-primary); }
.st-chip[aria-pressed="true"] {
  background: var(--st-primary);
  border-color: var(--st-primary);
  color: #fff;
}

/* ---------- Badges ---------- */
.st-badge {
  display: inline-flex;
  align-items: center;
  font-size: var(--st-fs-xs);
  font-weight: 600;
  padding: 0.25em 0.7em;
  border-radius: 999px;
  background: var(--st-primary-tint);
  color: var(--st-primary);
}

/* ---------- Alerts ---------- */
.st-alert {
  display: flex;
  gap: var(--st-space-3);
  padding: var(--st-space-4);
  border-radius: var(--st-radius);
  border: var(--st-border-width) solid var(--st-border);
  font-size: var(--st-fs-sm);
}
.st-alert--info { background: var(--st-primary-tint); border-color: transparent; color: var(--st-primary-dark); }
.st-alert--success { background: var(--st-valid-tint); border-color: transparent; color: #3E5B3B; }
.st-alert--error { background: var(--st-error-tint); border-color: transparent; color: var(--st-error); }

/* ---------- FAQ / accordion ---------- */
.st-faq-item {
  border-bottom: var(--st-border-width) solid var(--st-border);
}
.st-faq-item:first-child { border-top: var(--st-border-width) solid var(--st-border); }
.st-faq-q {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--st-space-4);
  padding: var(--st-space-5) 0;
  background: none;
  border: none;
  text-align: left;
  font-weight: 600;
  font-size: var(--st-fs-md);
  color: var(--st-ink);
  cursor: pointer;
}
.st-faq-q svg {
  flex-shrink: 0;
  width: 18px; height: 18px;
  transition: transform var(--st-transition);
}
.st-faq-item[data-open="true"] .st-faq-q svg { transform: rotate(45deg); }
.st-faq-a {
  overflow: hidden;
  max-height: 0;
  transition: max-height var(--st-transition-slow);
  color: var(--st-ink-soft);
}
.st-faq-item[data-open="true"] .st-faq-a {
  max-height: 800px;
}
.st-faq-a-inner { padding-bottom: var(--st-space-5); }

/* ---------- Footer ---------- */
.st-footer {
  border-top: var(--st-border-width) solid var(--st-border);
  background: var(--st-paper-raised);
  padding-block: var(--st-space-8) var(--st-space-6);
  margin-top: var(--st-space-9);
}
.st-footer-grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(4, 1fr);
  gap: var(--st-space-6);
}
.st-footer-brand p {
  color: var(--st-secondary);
  font-size: var(--st-fs-sm);
  max-width: 32ch;
}
.st-footer-heading {
  font-size: var(--st-fs-xs);
  font-weight: 700;
  color: var(--st-ink);
  margin-bottom: var(--st-space-3);
}
.st-footer-links { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: var(--st-space-2); }
.st-footer-links a { color: var(--st-secondary); text-decoration: none; font-size: var(--st-fs-sm); }
.st-footer-links a:hover { color: var(--st-primary); }
.st-footer-bottom {
  margin-top: var(--st-space-7);
  padding-top: var(--st-space-5);
  border-top: var(--st-border-width) solid var(--st-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--st-space-3);
  font-size: var(--st-fs-xs);
  color: var(--st-secondary);
}

/* ---------- 404 / empty states ---------- */
.st-empty-state {
  text-align: left;
  padding: var(--st-space-9) 0;
}
.st-empty-state .st-num-display {
  font-family: var(--st-font-display);
  font-size: 6rem;
  color: var(--st-border-strong);
  line-height: 1;
  margin-bottom: var(--st-space-4);
}

/* ---------- Utility ---------- */
.st-flex { display: flex; }
.st-flex-wrap { flex-wrap: wrap; }
.st-items-center { align-items: center; }
.st-gap-2 { gap: var(--st-space-2); }
.st-gap-3 { gap: var(--st-space-3); }
.st-gap-4 { gap: var(--st-space-4); }
.st-mt-6 { margin-top: var(--st-space-6); }
.st-mb-0 { margin-bottom: 0 !important; }

/* ---------- Hero visual: animated bar chart + pie ---------- */
.st-hero-section {
  padding-top: var(--st-space-8);
}
.st-hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: var(--st-space-8);
  align-items: center;
}
.st-hero-search-form {
  margin-top: var(--st-space-6);
}
.st-hero-try-row {
  margin-top: var(--st-space-5);
}
.st-hero-visual {
  height: 340px;
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: var(--st-space-6);
  padding: var(--st-space-6);
  background: var(--st-paper-raised);
  border: var(--st-border-width) solid var(--st-border);
  border-radius: var(--st-radius-lg);
}
.st-hero-bars {
  display: flex;
  align-items: flex-end;
  gap: var(--st-space-3);
  height: 100%;
  flex: 1;
}
.st-hero-bar-track {
  flex: 1;
  height: 100%;
  display: flex;
  align-items: flex-end;
  background: transparent;
}
.st-hero-bar {
  width: 100%;
  height: 20%;
  border-radius: 4px 4px 0 0;
  background: var(--st-primary);
  transition: height 1.1s cubic-bezier(0.65, 0, 0.35, 1);
}
.st-hero-bar-track:nth-child(2n) .st-hero-bar { background: var(--st-accent); }
.st-hero-bar-track:nth-child(3n) .st-hero-bar { background: var(--st-valid); }
.st-hero-pie {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-bottom: var(--st-space-2);
  transition: background 1.1s ease;
}

/* Hero visual is decorative/non-essential on small screens: hide to save
   layout space and keep the hero content-focused and center-aligned. */
@media (max-width: 880px) {
  .st-hero-visual { display: none; }
  .st-hero-grid {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .st-hero-grid > div:first-child {
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  .st-hero-try-row {
    justify-content: center;
    flex-wrap: wrap;
  }
}

/* ---------- Homepage category grid ---------- */
.st-home-categories-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--st-space-3);
}
@media (max-width: 1024px) {
  .st-home-categories-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .st-home-categories-grid { grid-template-columns: minmax(0, 1fr); }
}

/* .st-category-row as used on the homepage: stack content, keep the count
   chip from stretching, and make hover/focus feel more purposeful. */
.st-category-row {
  align-items: start;
  flex-direction: column;
  gap: var(--st-space-2);
}
.st-category-row:hover,
.st-category-row:focus-visible {
  border-color: var(--st-primary);
  box-shadow: var(--st-shadow-sm);
  transform: translateY(-1px);
}
.st-category-row__count {
  align-self: flex-start;
}

/* ---------- Homepage "Why use sahajTools" grid ---------- */
.st-why-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--st-space-6);
}
@media (max-width: 900px) {
  .st-why-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .st-why-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Homepage CTA band ---------- */
.st-cta-band {
  text-align: left;
  background: var(--st-primary);
  color: #fff;
  border-radius: var(--st-radius-lg);
  padding: var(--st-space-7);
}
.st-cta-band h2 {
  color: #fff;
  max-width: 30ch;
}
.st-cta-band p {
  color: rgba(255, 255, 255, 0.82);
  max-width: 50ch;
}
.st-cta-band .st-btn {
  margin-top: var(--st-space-4);
}
@media (max-width: 640px) {
  .st-cta-band {
    padding: var(--st-space-5);
    margin-inline: var(--st-space-1);
  }
}

/* ---------- Scroll-to-top button ---------- */
.st-scroll-top {
  position: fixed;
  right: var(--st-space-5);
  bottom: var(--st-space-5);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--st-primary);
  color: #fff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--st-shadow-md);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity var(--st-transition), transform var(--st-transition), visibility var(--st-transition), background var(--st-transition);
  z-index: 90;
}
.st-scroll-top[data-visible="true"] {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.st-scroll-top:hover { background: var(--st-primary-dark); }
.st-scroll-top svg { width: 20px; height: 20px; }

/* ---------- Small homepage helper classes (formerly inline styles) ---------- */
.st-hero-lede {
  font-size: var(--st-fs-md);
  color: var(--st-ink-soft);
  max-width: 48ch;
}
.st-section-head--split {
  justify-content: space-between;
}
.st-section--raised {
  background: var(--st-paper-raised);
  border-block: var(--st-border-width) solid var(--st-border);
}
