/* ================================================================
 * Tool Content CMS — modern presentation layer
 * ----------------------------------------------------------------
 * Scoped entirely under .tcms (only present on CMS-rendered tool
 * pages — see app/tool_content.php). Never touches:
 *   - legacy static tool pages (they don't have this class),
 *   - the widget's own internals (#tool-widget/#ut-widget/#tool-root
 *     children keep whatever markup tn-runtime/ut-runtime/engine.js
 *     generate, styled by their own tn/ts/ut stylesheets — this file
 *     only styles the editorial chrome AROUND the widget).
 * Reuses the design tokens already defined by whichever engine
 * stylesheet (tn or ts) is loaded for this tool, so it adapts to the
 * site's configured brand colors automatically.
 * ================================================================ */

.tcms { --tcms-accent: var(--brand-600, var(--sx-accent, #2743e3));
        --tcms-accent-2: var(--accent-500, #14b8a6); }

/* ---------- hero ---------- */
.tcms .tool-hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--tcms-accent) 0%, color-mix(in srgb, var(--tcms-accent) 55%, var(--tcms-accent-2)) 100%);
  border-radius: 0 0 28px 28px;
  padding: 8px 0 6px;
}
.tcms .tool-hero::before {
  content: ""; position: absolute; inset: -60% -10% auto auto; width: 360px; height: 360px;
  background: radial-gradient(circle, rgba(255,255,255,.18) 0%, rgba(255,255,255,0) 70%);
  border-radius: 50%; pointer-events: none;
}
.tcms .tool-hero .container { position: relative; padding-top: 14px; padding-bottom: 30px; }
.tcms .tool-hero h1 { color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.08); }
.tcms .tool-hero .lead { color: rgba(255,255,255,.92); max-width: 62ch; }

/* ---------- table of contents ---------- */
.tcms .page-toc { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0 22px; }
.tcms .page-toc a {
  font-size: .82rem; font-weight: 600; padding: 7px 14px; border-radius: 999px;
  background: var(--surface, #fff); border: 1px solid var(--border, #e2e8f0);
  color: var(--text, #1e293b); text-decoration: none; transition: all .15s ease;
}
.tcms .page-toc a:hover { border-color: var(--tcms-accent); color: var(--tcms-accent); transform: translateY(-1px); box-shadow: var(--shadow, 0 4px 12px rgba(0,0,0,.06)); }

/* ---------- widget card (outer wrapper only — inner fields untouched) ---------- */
.tcms .widget {
  border-radius: 18px;
  box-shadow: var(--shadow-lg, 0 20px 45px -15px rgba(15,23,42,.25));
  border: 1px solid var(--border, #e2e8f0);
  position: relative;
}
.tcms .widget::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px;
  border-radius: 18px 18px 0 0;
  background: linear-gradient(90deg, var(--tcms-accent), var(--tcms-accent-2));
}

/* ---------- article content ---------- */
.tcms .article h2 {
  position: relative; padding-left: 16px; margin-top: 2.4em;
}
.tcms .article h2::before {
  content: ""; position: absolute; left: 0; top: .15em; bottom: .15em; width: 4px;
  border-radius: 4px; background: linear-gradient(180deg, var(--tcms-accent), var(--tcms-accent-2));
}
.tcms .feature-list, .tcms .steps-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.tcms .feature-list li, .tcms .steps-list li {
  position: relative; padding: 10px 14px 10px 40px; background: var(--bg-alt, #f6f8fb);
  border-radius: 10px; border: 1px solid var(--border, #e2e8f0);
}
.tcms .feature-list li::before {
  content: "✓"; position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 20px; height: 20px; border-radius: 50%; background: var(--tcms-accent-2); color: #fff;
  font-size: .7rem; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.tcms .steps-list { counter-reset: tcms-step; }
.tcms .steps-list li::before {
  counter-increment: tcms-step; content: counter(tcms-step);
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  width: 20px; height: 20px; border-radius: 50%; background: var(--tcms-accent); color: #fff;
  font-size: .72rem; font-weight: 700; display: flex; align-items: center; justify-content: center;
}

/* ---------- FAQ ---------- */
.tcms .faq-list { display: grid; gap: 10px; }
.tcms .faq-item {
  border: 1px solid var(--border, #e2e8f0); border-radius: 12px; padding: 4px 16px;
  background: var(--surface, #fff); transition: border-color .15s ease;
}
.tcms .faq-item[open] { border-color: var(--tcms-accent); }
.tcms .faq-item summary {
  cursor: pointer; padding: 12px 28px 12px 0; font-weight: 600; list-style: none; position: relative;
}
.tcms .faq-item summary::-webkit-details-marker { display: none; }
.tcms .faq-item summary::after {
  content: "+"; position: absolute; right: 0; top: 50%; transform: translateY(-50%);
  font-size: 1.2rem; color: var(--tcms-accent); transition: transform .2s ease;
}
.tcms .faq-item[open] summary::after { transform: translateY(-50%) rotate(45deg); }

/* ---------- tool cards (Related tools / Explore More) ---------- */
.tcms .tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.tcms .tool-card {
  position: relative; overflow: hidden; border-radius: 12px;
  border: 1px solid var(--border, #e2e8f0); background: var(--surface, #fff);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.tcms .tool-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; transform: scaleX(0);
  transform-origin: left; transition: transform .2s ease;
  background: linear-gradient(90deg, var(--tcms-accent), var(--tcms-accent-2));
}
.tcms .tool-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg, 0 20px 45px -15px rgba(15,23,42,.25)); border-color: transparent; }
.tcms .tool-card:hover::before { transform: scaleX(1); }
.tcms .tool-card .sub { color: var(--tcms-accent); }
.tcms .see-all {
  font-weight: 600; font-size: .85rem; padding: 6px 14px; border-radius: 999px;
  background: color-mix(in srgb, var(--tcms-accent) 12%, transparent); color: var(--tcms-accent);
  text-decoration: none; transition: background .15s ease;
}
.tcms .see-all:hover { background: color-mix(in srgb, var(--tcms-accent) 20%, transparent); }

/* ---------- CTA box ---------- */
.tcms section > .container > .widget[style*="text-align:center"] {
  background: linear-gradient(135deg, var(--tcms-accent) 0%, color-mix(in srgb, var(--tcms-accent) 55%, var(--tcms-accent-2)) 100%);
  color: #fff; border: none;
}
.tcms section > .container > .widget[style*="text-align:center"]::before { display: none; }
.tcms section > .container > .widget[style*="text-align:center"] h2 { color: #fff; }
.tcms section > .container > .widget[style*="text-align:center"] .btn-primary,
.tcms section > .container > .widget[style*="text-align:center"] .btn.btn-primary {
  background: #fff; color: var(--tcms-accent); border: none; font-weight: 700;
}

@media (max-width: 640px) {
  .tcms .tool-hero { border-radius: 0 0 20px 20px; }
  .tcms .tool-grid { grid-template-columns: 1fr 1fr; }
}
