/* =============================================================
   1. Tokens (ToolSprout's own neutral green identity)
   ============================================================= */
:root {
  --bg: #f5f9f8;
  --bg-alt: #e9f2ef;
  --card: #ffffff;
  --text: #142420;
  --text-soft: #56706a;
  --border: #dbe8e3;

  --accent: #0f6f5c;
  --accent-bright: #14b892;
  --accent-dark: #0b5347;

  --error: #b5432f;

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);

  --sans: "Inter", system-ui, sans-serif;
  --display: "Sora", var(--sans);
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1613;
    --bg-alt: #131f1b;
    --card: #17231f;
    --text: #eaf5f1;
    --text-soft: #9fb6ae;
    --border: #223129;
  }
}

/* =============================================================
   2. Reset & base
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; tab-size: 2; scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
img, svg, video { display: block; max-width: 100%; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
p { text-wrap: pretty; }
h1, h2, h3, h4 { font-family: var(--display); font-weight: 700; text-wrap: balance; line-height: 1.15; color: var(--text); }
::selection { background: var(--accent-bright); color: #06231c; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.skip-link {
  position: fixed; top: -100px; left: 1rem;
  padding: .6rem 1rem; background: var(--card); color: var(--text);
  z-index: 9999; border-radius: 8px; font-weight: 600; box-shadow: 0 4px 16px rgba(0,0,0,.15);
}
.skip-link:focus { top: 1rem; }
.sr-only-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* =============================================================
   3. Utilities
   ============================================================= */
.container { width: 100%; max-width: 1080px; margin-inline: auto; padding-inline: 1.25rem; }

/* =============================================================
   4. Header (ToolSprout site-wide)
   ============================================================= */
.site-header { position: sticky; top: 0; z-index: 50; padding: .85rem 0; border-bottom: 1px solid var(--border); background: var(--card); }
.site-header .container { display: flex; align-items: center; justify-content: space-between; }
.header-inner { gap: 1rem; flex-wrap: wrap; }
.header-left { display: flex; align-items: center; gap: 1.1rem; }
.logo { font-family: var(--display); font-weight: 700; font-size: 1.1rem; display: flex; align-items: center; gap: .55rem; color: var(--text); }
.logo-mark {
  display: inline-grid; grid-template-columns: repeat(2, 1fr); grid-template-rows: repeat(2, 1fr);
  gap: 3px; width: 26px; height: 26px; padding: 5px; border-radius: 8px;
  background: var(--accent-dark); flex-shrink: 0;
}
.logo-mark span { background: var(--accent-bright); border-radius: 2px; }

.header-nav { position: relative; }
.dropdown-toggle {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .5rem .8rem; border-radius: var(--radius-sm); font-weight: 600; font-size: .92rem;
  color: var(--text); transition: background .15s var(--ease-out);
}
.dropdown-toggle:hover { background: var(--bg-alt); }
.dropdown-caret { transition: transform .18s var(--ease-out); }
.dropdown-toggle[aria-expanded="true"] .dropdown-caret { transform: rotate(180deg); }
.dropdown-menu {
  position: absolute; top: calc(100% + .5rem); left: 0; min-width: 190px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: 0 16px 40px -16px rgba(10, 30, 25, .25);
  padding: .4rem; opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity .16s var(--ease-out), transform .16s var(--ease-out), visibility .16s;
}
.dropdown-menu.is-open { opacity: 1; visibility: visible; transform: none; }
.dropdown-menu li a { display: block; padding: .55rem .7rem; border-radius: 8px; font-size: .92rem; font-weight: 500; color: var(--text); }
.dropdown-menu li a:hover { background: var(--bg-alt); text-decoration: none; }

.header-search {
  display: flex; align-items: center; gap: .5rem;
  background: var(--bg-alt); border: 1px solid var(--border); border-radius: 999px;
  padding: .5rem .9rem; flex: 1; max-width: 260px; min-width: 140px;
}
.search-icon { color: var(--text-soft); flex-shrink: 0; }
.header-search input { border: 0; background: none; outline: none; color: var(--text); font: inherit; font-size: .92rem; width: 100%; }
.header-search input::placeholder { color: var(--text-soft); }
.search-kbd {
  font-family: var(--sans); font-size: .72rem; color: var(--text-soft);
  background: var(--card); border: 1px solid var(--border); border-radius: 6px;
  padding: .1rem .4rem; flex-shrink: 0; display: none;
}
@media (min-width: 540px) { .search-kbd { display: inline-block; } }

.breadcrumb { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; padding-block: .9rem; font-size: .85rem; color: var(--text-soft); }
.breadcrumb a { color: var(--text-soft); font-weight: 600; }
.breadcrumb a:hover { color: var(--accent-dark); }
.breadcrumb [aria-current="page"] { color: var(--text); font-weight: 600; }

/* =============================================================
   5. Hero
   ============================================================= */
.hero { padding: 2rem 0 1rem; text-align: center; }
.hero h1 { font-size: clamp(1.6rem, 5vw, 2.5rem); margin-bottom: .6rem; }
.hero .subtitle { color: var(--text-soft); max-width: 52ch; margin-inline: auto; font-size: 1.02rem; }

/* =============================================================
   6. Tool card
   ============================================================= */
.tool-section { padding-block: 1.25rem 1rem; }
.tool-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 1.25rem; box-shadow: 0 12px 40px -20px rgba(15, 60, 50, .25);
}
@media (min-width: 720px) { .tool-card { padding: 2rem; } }

.form-row { margin-bottom: 1rem; }
textarea {
  width: 100%; padding: 1rem; border-radius: var(--radius-sm); border: 1.5px solid var(--border);
  background: var(--bg); font-size: 1rem; color: var(--text); font-family: var(--sans);
  resize: vertical; line-height: 1.6; min-height: 160px;
}
textarea:focus { outline: none; border-color: var(--accent); }
textarea[readonly] { background: var(--bg-alt); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .7rem 1.2rem; border-radius: 999px; font-weight: 700; font-size: .9rem;
  transition: transform .15s var(--ease-bounce);
}
.btn-primary { background: linear-gradient(135deg, var(--accent-bright), var(--accent)); color: #fff; }
.btn-primary:hover { transform: translateY(-2px); }
.btn-secondary { background: var(--bg-alt); color: var(--text); border: 1.5px solid var(--border); }
.btn-secondary:hover { transform: translateY(-2px); text-decoration: none; }
.btn-sm { padding: .55rem 1rem; font-size: .85rem; }
.btn-xs { padding: .35rem .7rem; font-size: .78rem; flex-shrink: 0; }

.text-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .8rem; margin-bottom: 1.5rem; }

/* =============================================================
   7. Input/output grid + status
   ============================================================= */
.io-grid { display: grid; gap: 1rem; grid-template-columns: 1fr; margin-bottom: 1rem; }
@media (min-width: 780px) { .io-grid { grid-template-columns: 1fr 1fr; } }
.io-block { display: flex; flex-direction: column; gap: .4rem; }
.io-label { font-size: .8rem; font-weight: 800; color: var(--text-soft); text-transform: uppercase; letter-spacing: .04em; }
.io-block textarea { flex: 1; }

.tool-status {
  border-radius: var(--radius-sm); padding: .7rem 1rem; font-size: .9rem; font-weight: 600;
  border: 1px solid transparent;
}
.tool-status--ok { background: #e7f6ef; color: #146c43; border-color: #bfe6d2; }
.tool-status--error { background: #fbeae6; color: var(--error); border-color: #f3cec5; }
.tool-status--idle { background: var(--bg-alt); color: var(--text-soft); }
@media (prefers-color-scheme: dark) {
  .tool-status--ok { background: #10261c; color: #6bd39c; border-color: #1c3a2b; }
  .tool-status--error { background: #2b1712; color: #ff9a82; border-color: #46251b; }
}

/* =============================================================
   8. Ad slots (placeholders only)
   ============================================================= */
.ad-slot {
  border: 2px dashed #cfe3dc; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-soft); font-weight: 700; letter-spacing: .06em; font-size: .85rem;
  background: repeating-linear-gradient(45deg, var(--bg-alt), var(--bg-alt) 10px, var(--bg) 10px, var(--bg) 20px);
}
.ad-slot--leaderboard { min-height: 90px; margin: 2rem auto; max-width: 960px; }
.ad-slot--incontent { min-height: 250px; margin: 2rem auto; max-width: 728px; }

.corner-ad {
  position: fixed; bottom: 1rem; right: 1rem; z-index: 40;
  background: var(--card); border: 2px dashed #cfe3dc; border-radius: var(--radius);
  padding: .7rem 2.2rem .7rem 1rem; max-width: 240px; font-size: .8rem; color: var(--text-soft);
  box-shadow: 0 12px 30px -12px rgba(0,0,0,.25);
  opacity: 0; transform: translateY(12px); pointer-events: none;
  transition: opacity .3s var(--ease-out), transform .3s var(--ease-out);
}
.corner-ad.is-visible { opacity: 1; transform: none; pointer-events: auto; }
.corner-ad strong { display: block; font-weight: 800; color: var(--text); margin-bottom: .15rem; }
.corner-ad-close { position: absolute; top: .4rem; right: .4rem; width: 22px; height: 22px; border-radius: 50%; background: var(--bg-alt); font-size: .85rem; line-height: 1; }

/* =============================================================
   9. Content sections
   ============================================================= */
.content-section { padding-block: 2rem; }
.content-section h2 { font-size: clamp(1.3rem, 3.5vw, 1.8rem); margin-bottom: 1rem; }
.content-section > p { color: var(--text-soft); max-width: 68ch; margin-bottom: 1rem; }
.content-section > p.center-text { max-width: none; margin-inline: 0; text-align: justify; text-align-last: left; }

.steps { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 720px) { .steps { grid-template-columns: repeat(3, 1fr); } }
.step { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; }
.step .step-num {
  width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--accent-bright), var(--accent)); color: #fff; font-weight: 800; margin-bottom: .75rem;
}
.step h3 { font-size: 1.05rem; margin-bottom: .35rem; }
.step p { color: var(--text-soft); font-size: .92rem; }

.usecases { display: grid; gap: .8rem; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 720px) { .usecases { grid-template-columns: repeat(5, 1fr); } }
.usecase { background: var(--bg-alt); border-radius: var(--radius); padding: 1rem .75rem; text-align: center; border: 1px solid var(--border); display: flex; flex-direction: column; align-items: center; }
.usecase-icon { display: block; margin-bottom: .4rem; color: var(--text); }
.usecase-icon svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.usecase h3 { font-size: .88rem; margin-top: auto; }

.faq { max-width: 68ch; }
.faq details { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .9rem 1.1rem; margin-bottom: .6rem; }
.faq summary { font-weight: 700; cursor: pointer; }
.faq p { color: var(--text-soft); margin-top: .6rem; font-size: .94rem; }

/* =============================================================
   10. Related tools (interlinking, when present)
   ============================================================= */
.related-tools-title { font-size: 1rem; margin-bottom: .75rem; color: var(--text-soft); }
.related-tools-list { display: flex; flex-wrap: wrap; gap: .6rem; }
.related-tools-list a {
  display: inline-flex; padding: .5rem 1rem; border-radius: 999px; border: 1.5px solid var(--border);
  background: var(--card); color: var(--text); font-weight: 600; font-size: .88rem;
}
.related-tools-list a:hover { border-color: var(--accent); color: var(--accent-dark); text-decoration: none; }

/* =============================================================
   11. Footer
   ============================================================= */
.site-footer { border-top: 1px solid var(--border); padding: 1.5rem 0; margin-top: 1rem; color: var(--text-soft); font-size: .85rem; }
.site-footer .container { display: flex; flex-wrap: wrap; gap: .8rem 1.2rem; justify-content: space-between; align-items: center; }
.footer-links { display: flex; gap: 1rem; flex-wrap: wrap; }

/* =============================================================
   12. Reduced motion
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .dropdown-menu, .dropdown-caret, .corner-ad, .btn { transition: none; }
}
