/* Text Tools category page — mobile-only first paint + search UI */
@media (max-width: 760px) {
  body.category-front-text-tools {
    --cat-rgb: 139, 92, 246;
    --cat-accent-2-rgb: 168, 85, 247;
    --cat-accent: #8b5cf6;
    --cat-accent-2: #a855f7;
    --cat-ink: #6d28d9;
  }
  body.category-front-text-tools .page-shell {
    padding-inline: 14px;
  }

  body.category-front-text-tools .category-hero {
    padding-top: 1.25rem;
    padding-bottom: 1.15rem;
  }

  body.category-front-text-tools .category-tools-section {
    padding-top: 0.35rem;
  }

  body.category-front-text-tools .category-tools-head {
    margin-bottom: 0.65rem;
    text-align: center;
  }

  body.category-front-text-tools .category-stat-row {
    gap: 0.45rem;
  }

  body.category-front-text-tools .category-stat-row span {
    min-height: 34px;
    padding: 0.42rem 0.62rem;
    font-size: 0.78rem;
  }

  /* Search — single-row sticky pill; filter runs on input (main.js) */
  body.category-front-text-tools .category-tool-search {
    position: sticky;
    top: 72px;
    z-index: 5;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    align-items: center;
    gap: 0;
    width: 100%;
    min-height: 52px;
    margin: 0 0 0.9rem;
    padding: 0.35rem 0.5rem 0.35rem 0.35rem;
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow:
      0 10px 26px rgba(15, 23, 42, 0.08),
      0 0 0 4px rgba(139, 92, 246, 0.04),
      inset 0 1px 0 rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }

  body.category-front-text-tools .category-tool-search:focus-within {
    border-color: rgba(139, 92, 246, 0.42);
    box-shadow:
      0 12px 28px rgba(15, 23, 42, 0.1),
      0 0 0 5px rgba(139, 92, 246, 0.1),
      inset 0 1px 0 rgba(255, 255, 255, 0.98);
  }

  body.category-front-text-tools .category-tool-search > i[data-lucide="search"] {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    color: #8b5cf6;
    flex-shrink: 0;
  }

  body.category-front-text-tools .category-tool-search > i[data-lucide="search"]:not(:has(svg))::before {
    content: "";
    width: 18px;
    height: 18px;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.2-3.2'/%3E%3C/svg%3E") center/contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.2-3.2'/%3E%3C/svg%3E") center/contain no-repeat;
  }

  body.category-front-text-tools .category-tool-search input {
    min-width: 0;
    min-height: 44px;
    border: 0;
    outline: 0;
    background: transparent;
    color: #16202b;
    font: 600 0.94rem/1.4 Inter, ui-sans-serif, system-ui, sans-serif;
  }

  body.category-front-text-tools .category-tool-search input::placeholder {
    color: #94a3b8;
  }

  body.category-front-text-tools .category-tool-search button {
    display: none;
  }

  /* Tool grid — styled before async style.min.css arrives */
  body.category-front-text-tools .category-tool-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
  }

  body.category-front-text-tools .category-tool-grid .tool-card {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
    grid-template-areas:
      "icon title"
      "icon badge"
      "desc desc"
      "action action";
    column-gap: 12px;
    row-gap: 4px;
    align-items: start;
    min-height: 0;
    padding: 14px;
    border: 1px solid rgba(139, 92, 246, 0.12);
    border-radius: 16px;
    background:
      radial-gradient(circle at 12% 0%, rgba(139, 92, 246, 0.1), transparent 38%),
      linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(248, 251, 255, 0.92));
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.88);
    text-decoration: none;
    color: inherit;
    content-visibility: auto;
    contain-intrinsic-size: 128px;
  }

  body.category-front-text-tools .category-tool-grid .tool-icon {
    grid-area: icon;
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    margin: 0;
    padding: 8px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.36);
    background: linear-gradient(
      135deg,
      var(--icon-a, var(--tool-icon-color, var(--cat-accent, #8b5cf6))),
      var(--icon-b, var(--cat-accent-2, #a855f7))
    );
    color: #fff;
    box-shadow:
      0 12px 26px rgba(var(--card-accent, var(--cat-rgb, 139, 92, 246)), 0.2),
      0 0 24px rgba(14, 165, 233, 0.1),
      inset 0 1px 0 rgba(255, 255, 255, 0.34);
    font-size: 0.82rem;
    font-weight: 900;
  }

  body.category-front-text-tools .category-tool-grid .tool-icon svg {
    width: 18px;
    height: 18px;
    color: #fff;
    stroke: #fff;
    stroke-width: 2.65;
    filter: drop-shadow(0 1px 1px rgba(15, 23, 42, 0.22));
  }

  body.category-front-text-tools .category-tool-grid .tool-icon svg + .icon-fallback {
    display: none;
  }

  body.category-front-text-tools .category-tool-grid .tool-icon:not(:has(svg)) .icon-fallback {
    display: block;
    line-height: 1;
    color: #fff;
  }

  body.category-front-text-tools .category-tool-grid .tool-card h3 {
    grid-area: title;
    margin: 0;
    color: #181d20;
    font-size: clamp(0.86rem, 3.8vw, 0.98rem);
    font-weight: 750;
    line-height: 1.32;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
    overflow-wrap: anywhere;
  }

  body.category-front-text-tools .category-tool-grid .tool-card p {
    grid-area: desc;
    display: -webkit-box !important;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    margin: 6px 0 0;
    color: #536273;
    font-size: 0.78rem;
    line-height: 1.45;
  }

  body.category-front-text-tools .category-tool-grid .tool-card .category-badge {
    grid-area: badge;
    justify-self: start;
    margin: 0;
    padding: 3px 7px;
    border-radius: 999px;
    border: 1px solid rgba(139, 92, 246, 0.18);
    background: rgba(139, 92, 246, 0.1);
    color: #6d28d9;
    font-size: 9px;
    font-weight: 850;
    letter-spacing: 0.08em;
    line-height: 1;
  }

  body.category-front-text-tools .category-tool-grid .tool-card .quick-action {
    grid-area: action;
    display: inline-flex !important;
    align-items: center;
    gap: 0.35rem;
    width: max-content !important;
    margin-top: 8px;
    padding: 0.42rem 0.72rem;
    border-radius: 999px;
    background: linear-gradient(135deg, #8b5cf6, #a855f7);
    color: #fff;
    font-size: 0.76rem;
    font-weight: 800;
  }

  html[data-theme="dark"] body.category-front-text-tools .category-tool-search {
    border-color: rgba(125, 211, 252, 0.18);
    background: rgba(19, 33, 43, 0.94);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  }

  html[data-theme="dark"] body.category-front-text-tools .category-tool-search input {
    color: #f8fafc;
  }

  html[data-theme="dark"] body.category-front-text-tools .category-tool-search input::placeholder {
    color: #64748b;
  }

  html[data-theme="dark"] body.category-front-text-tools .category-tool-grid .tool-card {
    border-color: rgba(125, 211, 252, 0.14);
    background:
      radial-gradient(circle at 12% 0%, rgba(139, 92, 246, 0.14), transparent 38%),
      linear-gradient(145deg, rgba(28, 45, 58, 0.95), rgba(18, 31, 42, 0.92));
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  }

  html[data-theme="dark"] body.category-front-text-tools .category-tool-grid .tool-card h3 {
    color: #f8fafc;
  }

  html[data-theme="dark"] body.category-front-text-tools .category-tool-grid .tool-card p {
    color: #b8c8d5;
  }
}

@media (max-width: 360px) {
  body.category-front-text-tools .category-tool-grid .tool-card {
    padding: 12px;
    grid-template-columns: 36px minmax(0, 1fr);
    column-gap: 10px;
  }

  body.category-front-text-tools .category-tool-grid .tool-icon {
    width: 36px;
    height: 36px;
  }

  body.category-front-text-tools .category-tool-grid .tool-card h3 {
    font-size: 0.84rem;
  }

  body.category-front-text-tools .category-tool-grid .tool-card p {
    font-size: 0.74rem;
  }
}
