/* ============================================================
   Tools chunk — latexdiff-online, latex-track-changes,
   latex-resubmission-changes.

   Reused from style.css (zero CSS here for these):
     - .hero, .hero-grid-bg, .hero-aurora, .hero-badge, .hero-tag,
       .hero-sub, .hero h1
     - .btn / .btn--primary / .btn--outline / .btn--lg / .btn--sm
     - .btn-group / .btn-group--center
     - .faq-item / .faq-question / .faq-answer
     - .cta-band + .code-card variants
     - .section, .divider, .site-corridor

   Tool-specific:
     - .hero--tool                  → hero shell adjustments for tool pages
     - .tool-widget                 → wrapper inside .hero
     - .tool-card / .tool-card__*   → code-card-style frame around each textarea
     - .tool-form__options          → <details> disclosure for advanced options
     - .tool-form__actions          → submit button + hint row
     - .tool-result                 → result panel below the form
     - .tool-result__cta            → inline accent-tint CTA card
     - .tool-section                → "What latexdiff does" section wrapper
       (the feature grid itself reuses the global .features-grid--2col)
     - .tool-tiers                  → stack of reused .delivery-tier cards
       (How it works / Options / Limitations)
     - FAQ reuses global .faq-section + .faq-section__layout + .spotlight-cta
   ============================================================ */

/* ---- Hero adjustments for tool pages ---- */
.hero--tool {
  padding: 100px 0 0;
}
.hero--tool .hero-tag {
  font-size: clamp(.95rem, 1.6vw, 1.15rem);
  font-weight: 500;
}
.hero--tool .hero-sub {
  max-width: 660px;
  margin-bottom: 0;
}

/* Aurora paint cost. The blobs are already soft radial gradients
   (transparent at 65%), so the global blur(100px) is largely redundant
   here — a much smaller blur is visually near-identical but far cheaper
   to paint. This is the most expensive paint in the above-fold hero, so
   trimming it is a real mobile win. Scoped to tool pages to leave the
   rest of the site untouched. */
.hero--tool .hero-aurora__blob { filter: blur(60px); }
@media (max-width: 768px) {
  .hero--tool .hero-aurora__blob { filter: blur(40px); }
}

/* ---- Widget wrapper (sits inside .hero, below the headline) ---- */
/* Wider than a normal .section: narrower side padding + larger cap so
   the two editors get more room. */
.tool-widget {
  position: relative;
  z-index: 1;
  padding: 48px 20px 96px;
  /* The widget lives inside .hero (text-align:center). Reset to left so
     the editors, diff output, and options read normally; the submit
     button + hint stay centered via their own flex/explicit rules. */
  text-align: left;
}
.tool-widget__inner {
  max-width: 1240px;
  margin: 0 auto;
}

/* ---- Tool card (code-card-style frame for each textarea) ---- */
.tool-form__panes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.tool-card {
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.tool-card__filebar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--color-bg-sand);
  border-bottom: 1px solid var(--color-border-subtle);
}
.tool-card__lights {
  display: inline-flex;
  gap: 6px;
  flex-shrink: 0;
}
.tool-card__light {
  width: 11px; height: 11px;
  border-radius: 50%;
  display: inline-block;
}
.tool-card__light--r { background: #FF5F57; }
.tool-card__light--y { background: #FEBC2E; }
.tool-card__light--g { background: #28C840; }
.tool-card__filename {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .82rem; font-weight: 600;
  color: var(--color-text);
  flex: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tool-card__badge {
  font-size: .7rem; font-weight: 600;
  letter-spacing: .04em; text-transform: uppercase;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  flex-shrink: 0;
}
.tool-card__badge--neutral {
  background: var(--color-bg-warm);
  color: var(--color-text-muted);
}
.tool-card__badge--accent {
  background: var(--color-accent-tint);
  color: var(--color-accent-strong);
}

.tool-card__textarea {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .92rem; line-height: 1.65;
  width: 100%;
  border: 0;
  resize: vertical;
  min-height: 440px;
  padding: 20px 22px;
  background: var(--color-bg);
  color: var(--color-text);
  display: block;
}
.tool-card__textarea::placeholder {
  color: var(--color-text-on-dark-muted);
  opacity: .85;
}
.tool-card__textarea:focus {
  outline: none;
  background: var(--color-bg-subtle);
}
.tool-card:focus-within {
  border-color: var(--color-accent);
  box-shadow: var(--shadow-card), 0 0 0 3px rgba(191, 100, 56, .12);
}

/* ---- Advanced options disclosure ---- */
.tool-form__options {
  margin-top: 24px;
  background: var(--color-bg);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
}
.tool-form__options summary {
  cursor: pointer; user-select: none;
  padding: 14px 18px;
  font-weight: 600; font-size: .92rem;
  color: var(--color-text);
  list-style: none;
  position: relative;
}
.tool-form__options summary::-webkit-details-marker { display: none; }
.tool-form__options summary::after {
  content: "+";
  position: absolute; right: 18px; top: 50%; transform: translateY(-50%);
  font-size: 1.2rem; color: var(--color-text-muted); font-weight: 400;
}
.tool-form__options[open] summary::after { content: "−"; }
.tool-form__options-grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  padding: 4px 18px 18px;
  border-top: 1px solid var(--color-border-subtle);
}
.tool-form__option { display: flex; flex-direction: column; gap: 6px; font-size: .85rem; }
.tool-form__option span { color: var(--color-text-muted); font-weight: 500; }
.tool-form__option select {
  font: inherit;
  padding: 8px 10px;
  background: var(--color-bg);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  cursor: pointer;
}
.tool-form__option select:focus {
  outline: none; border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(191, 100, 56, .12);
}

/* ---- Submit row (button centered) ---- */
.tool-form__actions {
  margin-top: 28px;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
}
.tool-form__actions .btn { min-width: 240px; }
.tool-form__hint {
  font-size: .82rem; color: var(--color-text-muted);
  margin: 0; text-align: center; max-width: 440px;
}

/* ---- Result panel ---- */
.tool-result { margin-top: 40px; }
.tool-card--result .tool-card__filebar { gap: 16px; }
.tool-card__status {
  font-size: .82rem; font-weight: 500;
  color: var(--color-text-muted);
  flex: 1;
}
.tool-card__status--success { color: var(--color-green-strong); }
.tool-card__status--error { color: var(--color-error); }
.tool-card__actions { display: inline-flex; gap: 8px; }
.tool-card__action-btn {
  font: inherit;
  font-size: .8rem; font-weight: 500;
  padding: 5px 12px;
  background: var(--color-bg);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.tool-card__action-btn:hover {
  border-color: var(--color-text-muted);
}
.tool-card__output {
  margin: 0;
  padding: 18px 20px;
  background: var(--color-bg-dark);
  color: var(--color-text-on-dark);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .8rem; line-height: 1.6;
  max-height: 480px; overflow: auto;
  white-space: pre;
}
.tool-card__output code { font: inherit; color: inherit; background: none; padding: 0; }

/* ---- Inline lead-gen card (after a successful diff) ----
   Sits inside .hero (text-align:center), so reset to the left-aligned,
   text-left / actions-right shape used by the theme's CTA bands. */
.tool-result__cta {
  margin-top: 24px;
  padding: 36px 28px;
  background: #FAFAFA;
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  text-align: left;
  display: flex; align-items: center; justify-content: space-between;
  gap: 28px; flex-wrap: wrap;
}
.tool-result__cta-text {
  margin: 0;
  flex: 1; min-width: 240px;
  font-family: var(--font-display);
  font-weight: 700; font-size: 1.05rem; line-height: 1.35;
  color: var(--color-text);
}
.tool-result__cta-accent { color: var(--color-accent-strong); }
.tool-result__cta .btn-group { flex-shrink: 0; }

/* ============================================================
   Body sections — full corridor-width, left-aligned.
   Card sections (How it works / Options / Limitations) reuse the
   global .delivery-tier component from the pricing page, wrapped in
   .delivery-section. Prose sections (explainer, FAQ) use .tool-section.
   ============================================================ */
.tool-section { padding: 96px 0; }
.tool-section__head { margin-bottom: 40px; }
.tool-section h2 {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 1.889rem);
  font-weight: 600; line-height: 1.2; letter-spacing: -.02em;
  margin: 0 0 12px; color: var(--color-text);
}
.tool-section code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .88em; padding: 2px 6px;
  background: var(--color-bg-sand);
  border: 1px solid var(--color-border-subtle);
  border-radius: 4px; color: var(--color-accent-strong);
}

/* The "What latexdiff does" feature grid reuses the GLOBAL .features-grid
   (+ .features-grid--2col) from style.css — no tool-specific grid here. */

/* card sections (How it works / Options / Limitations): three reused
   .delivery-tier cards stacked, each titled by its head label (an h2).
   (.delivery-tier__value--purple lives in style.css beside --green/--accent.) */
.tool-tiers { display: flex; flex-direction: column; gap: 24px; }
.delivery-tier__head h2.delivery-tier__head-label {
  margin: 0; font-family: inherit;
  font-size: 1.05rem; line-height: 1.2;
}
.delivery-tier__name code,
.delivery-tier__value code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .9em; font-weight: 700;
  color: var(--color-accent-strong);
}

/* ---- screen-reader-text utility (if not already global) ---- */
.screen-reader-text {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0,0,0,0); clip-path: inset(50%);
  border: 0; white-space: nowrap;
}

/* ---- Mobile ---- */
@media (max-width: 900px) {
  .tool-form__panes { grid-template-columns: 1fr; gap: 16px; }
  .tool-form__options-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .hero--tool { padding-top: 80px; }
  .tool-widget { padding-top: 32px; padding-bottom: 60px; }
  .tool-card__textarea { min-height: 320px; }
  .tool-form__actions .btn { width: 100%; }
  .tool-card--result .tool-card__filebar { flex-wrap: wrap; }
  .tool-card__actions { width: 100%; justify-content: flex-end; }
  .tool-section { padding: 64px 0; }
}

/* When the tier rows stack on mobile (global rule kicks in at 640px),
   lift the value column above the title/desc on the How it works card
   only, so "Step 1/2/3" reads as a label on top. Options/Limitations
   keep the default order (value below). */
@media (max-width: 640px) {
  .tool-tier--steps .delivery-tier__col--right { order: -1; }
}
