/* ==============================
   free-tools.css: /free-tools/ pages
   Builds on base.css tokens and tool-page.css. Same design policy:
   white theme, flat accent, no motion.
   ============================== */

.ft-wide {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Hero */
.ft-hero { padding: 2.75rem 0 1.5rem; }
.ft-hero--index { padding-bottom: 2rem; }

.ft-title {
  margin-bottom: 0.75rem;
  font-size: clamp(2rem, 4.5vw, 3rem);
  font-weight: 650;
  line-height: 1.1;
  letter-spacing: -0.035em;
}

.ft-lead {
  max-width: 760px;
  margin-bottom: 1.1rem;
  color: var(--text-2);
  font-size: 1.08rem;
}

.ft-lead code,
.ft-block code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--chip-bg);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

/* Workspace */
.ft-tool-section { padding-bottom: 1rem; }

.ft-workspace {
  background: var(--bg-alt);
  border: 1px solid #e4e4e7;
  border-radius: var(--radius-lg);
  padding: 1rem;
}

.ft-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  margin-bottom: 0.9rem;
}

.ft-opt {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-2);
}

.ft-opt--wide { flex: 1 1 340px; }
.ft-opt--wide input { flex: 1; min-width: 0; }

.ft-opt select,
.ft-opt input {
  height: 34px;
  padding: 0 0.6rem;
  border: 1px solid #d4d4d8;
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 0.88rem;
  color: var(--text);
}

.ft-opt input { font-family: var(--font-mono); }

.ft-panes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.ft-panes + .ft-panes { margin-top: 1rem; }
.ft-panes--single { grid-template-columns: 1fr; }

.ft-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--surface);
  border: 1px solid #e4e4e7;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.ft-pane-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 46px;
  padding: 0.4rem 0.6rem 0.4rem 0.9rem;
  border-bottom: 1px solid #e4e4e7;
}

.ft-pane-title { font-size: 0.85rem; font-weight: 600; }

.ft-pane-format {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-3);
  background: var(--chip-bg);
  padding: 0.12rem 0.45rem;
  border-radius: var(--radius-pill);
}

.ft-pane-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.35rem;
  margin-left: auto;
}

.ft-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  height: 30px;
  padding: 0 0.7rem;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.ft-btn:hover { background: #dbeafe; }
.ft-btn svg { width: 14px; height: 14px; }

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

.ft-btn--primary {
  height: 36px;
  padding: 0 1.2rem;
  background: var(--accent);
  color: #fff;
  font-size: 0.9rem;
}

.ft-btn--primary:hover { background: var(--accent-hover); }

.ft-code {
  flex: 1;
  width: 100%;
  min-height: 360px;
  padding: 0.85rem 0.95rem;
  border: 0;
  resize: vertical;
  background: transparent;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.84rem;
  line-height: 1.55;
  tab-size: 2;
  white-space: pre;
  overflow: auto;
}

.ft-code:focus { outline: none; }
.ft-pane:focus-within { border-color: var(--accent-border); }

.ft-code--status { white-space: pre-wrap; font-size: 0.95rem; }

.ft-gen-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.ft-gen-bar .ft-options { margin: 0; }

.ft-status {
  min-height: 1.4em;
  margin-top: 0.6rem;
  font-size: 0.85rem;
  color: var(--text-3);
}

.ft-status[data-kind="error"] { color: #b91c1c; }
.ft-status[data-kind="ok"] { color: #15803d; }

.ft-render {
  flex: 1;
  min-height: 360px;
  max-height: 640px;
  padding: 0.85rem 0.95rem;
  overflow: auto;
  font-size: 0.88rem;
}

.ft-frame {
  flex: 1;
  width: 100%;
  min-height: 360px;
  border: 0;
  background: #fff;
}

.ft-swatch {
  height: 56px;
  border-bottom: 1px solid #e4e4e7;
  background-image: linear-gradient(45deg, #eee 25%, transparent 25%), linear-gradient(-45deg, #eee 25%, transparent 25%);
}

.ft-hint { color: var(--text-3); font-size: 0.82rem; margin-top: 0.5rem; }

/* Tree view */
.ft-render .tl,
.ft-render summary { font-family: var(--font-mono); font-size: 0.82rem; line-height: 1.7; }
.ft-render details { padding-left: 1.1rem; }
.ft-render > details { padding-left: 0; }
.ft-render .tl { padding-left: 1.1rem; }
.ft-render summary { cursor: pointer; margin-left: -1.1rem; padding-left: 0.1rem; }
.ft-render > details > summary { margin-left: 0; }
.tk { color: #7c3aed; }
.ts { color: #047857; }
.tnum { color: #1d4ed8; }
.tb { color: #b45309; }
.tn { color: var(--text-3); }
.tsum { color: var(--text-3); }

/* Tables (viewer, regex) */
.ft-table-wrap { overflow: auto; border: 1px solid #e4e4e7; border-radius: var(--radius-sm); }
.ft-table { border-collapse: collapse; width: 100%; font-size: 0.82rem; }
.ft-table th,
.ft-table td { padding: 0.4rem 0.65rem; border-bottom: 1px solid #eee; text-align: left; white-space: nowrap; }
.ft-table th { background: var(--bg-alt); font-weight: 600; position: sticky; top: 0; }
.ft-table td.num { color: var(--text-3); font-variant-numeric: tabular-nums; }
.ft-table code { font-family: var(--font-mono); font-size: 0.8rem; }

/* Diff + regex */
.ft-diff-stats { font-size: 0.85rem; margin-bottom: 0.5rem; color: var(--text-2); }
.ft-diff-stats .add { color: #15803d; font-weight: 600; }
.ft-diff-stats .del { color: #b91c1c; font-weight: 600; }
.ft-diff,
.ft-regex {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 0.75rem;
}
.ft-diff .add { background: #dcfce7; color: #14532d; }
.ft-diff .del { background: #fee2e2; color: #7f1d1d; text-decoration: line-through; }
.ft-regex mark { background: #fde68a; color: inherit; border-radius: 2px; }

.ft-qr { display: flex; justify-content: center; align-items: center; min-height: 330px; }
.ft-qr img { max-width: 100%; height: auto; image-rendering: pixelated; }

/* Promo strip under the tool */
.ft-strip {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
  padding: 0.9rem 1.1rem;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-md);
}

.ft-strip--inline { margin: 0 0 2.5rem; }

.ft-strip-icon { width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0; }

.ft-strip-copy { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.ft-strip-copy strong { font-size: 0.95rem; }
.ft-strip-copy span { font-size: 0.85rem; color: var(--text-2); }

.ft-strip-cta { margin-left: auto; flex-shrink: 0; }

/* Platform-aware download button: one per platform, the visitor's shows. */
.ft-dl {
  display: none;
  align-items: center;
  justify-content: center;
  height: 38px;
  padding: 0 1.1rem;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
}

.ft-dl:hover { background: var(--accent-hover); }
.ft-dl[data-p="mac"] { display: inline-flex; }
html[data-platform="windows"] .ft-dl[data-p="mac"],
html[data-platform="ipad"] .ft-dl[data-p="mac"],
html[data-platform="linux"] .ft-dl[data-p="mac"] { display: none; }
html[data-platform="windows"] .ft-dl[data-p="windows"],
html[data-platform="ipad"] .ft-dl[data-p="ipad"],
html[data-platform="linux"] .ft-dl[data-p="linux"] { display: inline-flex; }

/* Page shell: main column + full-height sticky app rail */
.ft-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  padding-top: 60px;
}

.ft-shell .tool-main { padding-top: 0; min-width: 0; }

.ft-content { min-width: 0; max-width: 820px; padding-top: 2.5rem; padding-bottom: 1rem; }
.ft-content--wide { max-width: none; }

.ft-block { margin-bottom: 2.5rem; }
.ft-block h2 { font-size: 1.4rem; margin-bottom: 0.75rem; }
.ft-block p { color: var(--text-2); }
.ft-block p a,
.ft-all a { color: var(--accent); }
.ft-block p a:hover { text-decoration: underline; }

.ft-steps { padding-left: 1.3rem; color: var(--text-2); }
.ft-steps li { margin-bottom: 0.4rem; padding-left: 0.25rem; }
.ft-steps li::marker { color: var(--accent); font-weight: 600; }

.ft-related {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 0.75rem;
}

.ft-related-item,
.ft-tool-card {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.85rem 1rem;
  background: var(--surface);
  border: 1px solid #e4e4e7;
  border-radius: var(--radius-md);
}

.ft-related-item:hover,
.ft-tool-card:hover { border-color: var(--accent-border); box-shadow: var(--shadow-card-hover); }

.ft-related-name,
.ft-tool-name { font-weight: 600; font-size: 0.93rem; }

.ft-related-desc,
.ft-tool-desc { font-size: 0.82rem; color: var(--text-3); line-height: 1.45; }

.ft-all { margin-top: 1rem; font-size: 0.9rem; font-weight: 600; }
.ft-all a { display: inline-flex; align-items: center; gap: 0.3rem; }
.ft-all svg { width: 15px; height: 15px; }

/* Right rail ad */
.ft-rail {
  position: sticky;
  top: 60px;
  align-self: start;
  height: calc(100vh - 60px);
  overflow-y: auto;
  scrollbar-width: thin;
  background: var(--bg-alt);
  border-left: 1px solid #e4e4e7;
}

.ft-rail-inner { padding: 1.5rem 1.5rem 2rem; }

.ft-rail-head { display: flex; align-items: center; gap: 0.8rem; margin-bottom: 0.9rem; }
.ft-rail-icon { width: 52px; height: 52px; border-radius: 13px; }
.ft-rail-eyebrow { font-size: 0.7rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-3); }
.ft-rail-name { font-size: 1.35rem; font-weight: 650; letter-spacing: -0.02em; line-height: 1.2; }

.ft-rail-pitch { font-size: 0.92rem; color: var(--text-2); margin-bottom: 1rem; }
.ft-rail-pitch strong { color: var(--text); }

.ft-rail-cta .ft-dl[data-p] { width: 100%; height: 42px; font-size: 0.95rem; }
.ft-rail-cta--bottom { margin-top: 1.5rem; }
.ft-rail-price { margin-top: 0.55rem; text-align: center; font-size: 0.8rem; color: var(--text-3); }
.ft-rail-price strong { color: var(--text); }

.ft-rail-figure { margin: 1.25rem 0; }
.ft-rail-shot {
  display: none;
  width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  border: 1px solid #e4e4e7;
  box-shadow: var(--shadow-card);
}
.ft-rail-shot[data-p="mac"] { display: block; }
html[data-platform="windows"] .ft-rail-shot[data-p="mac"],
html[data-platform="ipad"] .ft-rail-shot[data-p="mac"] { display: none; }
html[data-platform="windows"] .ft-rail-shot[data-p="windows"],
html[data-platform="ipad"] .ft-rail-shot[data-p="ipad"] { display: block; }

.ft-rail-note {
  display: flex;
  gap: 0.6rem;
  padding: 0.8rem 0.9rem;
  margin-bottom: 1.25rem;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  color: var(--text-2);
}
.ft-rail-note svg { width: 18px; height: 18px; color: var(--accent); flex-shrink: 0; margin-top: 2px; }
.ft-rail-note strong { color: var(--text); }

.ft-rail-h { font-size: 0.78rem; font-weight: 650; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-3); margin: 1.25rem 0 0.7rem; }

.ft-rail-feats { list-style: none; display: grid; gap: 0.7rem; }
.ft-rail-feats li { display: flex; gap: 0.6rem; font-size: 0.85rem; color: var(--text-2); line-height: 1.45; }
.ft-rail-feats strong { color: var(--text); font-weight: 600; }
.ft-rail-feats svg { width: 17px; height: 17px; color: var(--accent); flex-shrink: 0; margin-top: 1px; }

.ft-rail-cats { list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem; }
.ft-rail-cats li {
  white-space: nowrap;
  display: flex;
  justify-content: space-between;
  gap: 0.4rem;
  padding: 0.4rem 0.6rem;
  background: var(--surface);
  border: 1px solid #e4e4e7;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  color: var(--text-2);
}
.ft-rail-cats span { color: var(--accent); font-weight: 600; }

.ft-rail-link { display: inline-flex; align-items: center; gap: 0.3rem; margin-top: 0.9rem; font-size: 0.85rem; font-weight: 600; color: var(--accent); }
.ft-rail-link svg { width: 14px; height: 14px; }
.ft-rail-stores { margin-top: 0.5rem; font-size: 0.72rem; color: var(--text-3); }

/* Monaco editors replace the textareas once loaded */
.ft-monaco { flex: 1; min-height: 360px; height: 420px; }
.ft-panes--single .ft-monaco { height: 360px; }

/* Index page */
.ft-search {
  position: relative;
  max-width: 560px;
  margin: 0.5rem 0 1.25rem;
}

.ft-search svg {
  position: absolute;
  left: 0.9rem;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  color: var(--text-3);
}

.ft-search input {
  width: 100%;
  height: 48px;
  padding: 0 1rem 0 2.6rem;
  border: 1px solid #d4d4d8;
  border-radius: var(--radius-md);
  background: var(--surface);
  font-size: 1rem;
}

.ft-search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.ft-cats { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.ft-cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-pill);
  background: var(--chip-bg);
  font-size: 0.82rem;
  color: var(--text-2);
}

.ft-cat-chip span { color: var(--text-3); font-size: 0.75rem; }
.ft-cat-chip:hover { color: var(--accent); }

.ft-group { margin-bottom: 2.5rem; scroll-margin-top: 80px; }
.ft-group-head { margin-bottom: 1rem; }
.ft-group-head h2 { font-size: 1.35rem; }
.ft-group-head p { font-size: 0.9rem; color: var(--text-3); }

.ft-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
}

.ft-empty { color: var(--text-3); padding: 2rem 0; }

/* Toast */
.ft-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  padding: 0.55rem 1rem;
  border-radius: var(--radius-pill);
  background: var(--text);
  color: #fff;
  font-size: 0.85rem;
  z-index: 50;
}

[hidden] { display: none !important; }

/* Responsive */
/* The rail replaces the inline strip on wide screens; below that the
   strip and the bottom CTA carry the app pitch. */
@media (min-width: 1200px) {
  .ft-strip { display: none; }
}

@media (max-width: 1199px) {
  .ft-shell { grid-template-columns: 1fr; }
  .ft-rail { display: none; }
}

@media (max-width: 760px) {
  .ft-wide { padding: 0 1rem; }
  .ft-hero { padding-top: 1.75rem; }
  .ft-workspace { padding: 0.6rem; border-radius: var(--radius-md); }
  .ft-panes { grid-template-columns: 1fr; }
  .ft-code,
  .ft-render,
  .ft-frame,
  .ft-monaco { min-height: 240px; height: 300px; }
  .ft-strip { flex-wrap: wrap; }
  .ft-strip-cta { margin-left: 0; width: 100%; }
  .ft-strip-cta .ft-dl { width: 100%; }
  .ft-opt { flex: 1 1 100%; }
  .ft-opt select,
  .ft-opt input { flex: 1; min-width: 0; }
}

.ft-status:empty { display: none; }
.ft-shell ~ .footer .footer-links { flex-wrap: wrap; justify-content: center; }

/* base.css sets overflow-x: hidden on html and body, which turns body into
   a scroll container and breaks the sticky rail. clip hides overflow the
   same way without creating one. */
html,
body { overflow-x: clip; }

.ft-group-head h2 a:hover { color: var(--accent); }
.ft-group-more { color: var(--accent); font-weight: 600; white-space: nowrap; }
.ft-group-more:hover { text-decoration: underline; }
.footer-links--cats { margin-top: -0.25rem; font-size: 0.82rem; }
.ft-lead a { color: var(--accent); }
.ft-lead a:hover { text-decoration: underline; }
