/* =============================================================
   CleanPrompt — styles.css
   Utilitarian, instant, zero third-party requests (system fonts).
   ============================================================= */

/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --bg: #f4f2ec;
  --surface: #ffffff;
  --surface-2: #f9f8f4;
  --ink: #17171a;
  --ink-2: #4a4a52;
  --ink-3: #7a7a83;
  --line: #e2dfd6;
  --line-strong: #cfcbc0;
  --accent: #e4572e;          /* signal orange: the "bridge" */
  --accent-ink: #ffffff;
  --accent-soft: #fde9e2;
  --ok: #1f8a4c;
  --ok-soft: #e3f4ea;
  --warn: #9a6400;
  --warn-soft: #fff3d6;
  --err: #b42318;
  --err-soft: #fde8e7;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(20, 20, 30, .04), 0 8px 24px -12px rgba(20, 20, 30, .12);
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Menlo, Consolas, monospace;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --gutter: 16px;
  --maxw: 1200px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111114;
    --surface: #18181c;
    --surface-2: #1e1e23;
    --ink: #ededf0;
    --ink-2: #b4b4bd;
    --ink-3: #85858f;
    --line: #2a2a31;
    --line-strong: #3a3a43;
    --accent: #ff6b3d;
    --accent-ink: #160a05;
    --accent-soft: #3a1d14;
    --ok: #4cc983;
    --ok-soft: #12291c;
    --warn: #f0b44c;
    --warn-soft: #2e2410;
    --err: #ff7b70;
    --err-soft: #34171555;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px -14px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}

/* =============================================================
   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);
  font-size: 16px;
  line-height: 1.6;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
img, svg { display: block; max-width: 100%; }
button, select, textarea, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: inherit; }
p { text-wrap: pretty; }
h1, h2, h3 { text-wrap: balance; line-height: 1.12; letter-spacing: -0.02em; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* =============================================================
   3. Utilities
   ============================================================= */
.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link {
  position: fixed; top: -100px; left: 1rem; z-index: 999;
  padding: .55rem 1rem; background: var(--ink); color: var(--bg); border-radius: 8px; text-decoration: none;
}
.skip-link:focus { top: 1rem; }
.mono { font-family: var(--mono); }

/* =============================================================
   4. Header & mode tabs
   ============================================================= */
.site-header { border-bottom: 1px solid var(--line); background: var(--bg); }
.site-header .container { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; }
.brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; font-weight: 700; letter-spacing: -0.01em; }
.brand svg { width: 26px; height: 26px; }
.brand small { font-weight: 500; color: var(--ink-3); font-size: .78rem; display: none; }
.header-badge { font-size: .78rem; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; }
.header-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }

.modes {
  display: flex; gap: 4px; padding: 4px; margin: 0 0 14px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px;
  overflow-x: auto; scrollbar-width: none;
}
.modes::-webkit-scrollbar { display: none; }
.modes a {
  flex: 1 0 auto; text-align: center; text-decoration: none; white-space: nowrap;
  padding: 8px 12px; border-radius: 9px; font-size: .9rem; font-weight: 600; color: var(--ink-2);
  transition: background .2s var(--ease-out), color .2s var(--ease-out);
}
.modes a:hover { color: var(--ink); background: var(--surface); }
.modes a[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.modes a span { margin-right: 4px; }
.modes .lbl-short { display: inline; }
.modes .lbl-long { display: none; }
@media (min-width: 540px) { .modes .lbl-short { display: none; } .modes .lbl-long { display: inline; } }

/* =============================================================
   5. Hero (H1 + tool)
   ============================================================= */
.hero { padding: 14px 0 8px; }
.hero h1 { font-size: clamp(1.45rem, 4.6vw, 2.35rem); margin-bottom: 4px; }
.hero .lede { color: var(--ink-2); font-size: clamp(.92rem, 2.2vw, 1.05rem); margin-bottom: 12px; max-width: 62ch; }

.layout { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); }
.sidebar { display: none; }

/* =============================================================
   6. Tool card
   ============================================================= */
.tool-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 12px; position: relative;
}
.panes { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.pane { display: flex; flex-direction: column; min-width: 0; }
.pane-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; min-height: 28px; }
.pane-head label, .pane-head .label { font-size: .8rem; font-weight: 600; color: var(--ink-2); text-transform: uppercase; letter-spacing: .05em; }
.count { font-size: .76rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }

textarea.io {
  width: 100%; min-height: 150px; resize: vertical;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface-2); padding: 12px; line-height: 1.55; font-size: .95rem;
  transition: border-color .2s var(--ease-out), background .2s var(--ease-out);
}
textarea.io:focus { outline: none; border-color: var(--accent); background: var(--surface); }
textarea.io[readonly] { font-family: var(--mono); font-size: .84rem; background: var(--surface-2); }
textarea.io::placeholder { color: var(--ink-3); }

.controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.field { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; color: var(--ink-2); }
.field select, .field input[type="checkbox"] { accent-color: var(--accent); }
.field select {
  border: 1px solid var(--line); background: var(--surface-2); border-radius: 8px; padding: 6px 8px; font-size: .84rem; max-width: 100%;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 16px; border-radius: 10px; font-weight: 650; font-size: .93rem; line-height: 1.1;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  transition: transform .15s var(--ease-out), background .2s var(--ease-out), border-color .2s var(--ease-out);
}
.btn:hover { border-color: var(--ink-3); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn svg { width: 17px; height: 17px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { border-color: var(--accent); filter: brightness(1.06); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--ink-2); padding-inline: 10px; }
.btn-ghost:hover { color: var(--ink); background: var(--surface-2); border-color: transparent; }
.btn-sm { padding: 6px 10px; font-size: .82rem; border-radius: 8px; }
.btn.is-copied { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.kbd { font-family: var(--mono); font-size: .72rem; opacity: .7; font-weight: 500; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; min-height: 24px; }
.chip { font-size: .74rem; padding: 3px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.chip b { color: var(--ink); }
.chip.hot { background: var(--accent-soft); border-color: transparent; color: var(--ink); }

.note {
  font-size: .82rem; color: var(--ink-2); margin-top: 10px; padding: 8px 10px; border-radius: 9px;
  background: var(--surface-2); border: 1px solid var(--line);
}
.note.warn { background: var(--warn-soft); border-color: transparent; color: var(--ink); }
.note.err { background: var(--err-soft); border-color: transparent; color: var(--ink); }
.note.ok { background: var(--ok-soft); border-color: transparent; color: var(--ink); }

.privacy-badge {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 10px;
  font-size: .8rem; color: var(--ink-2);
}
.privacy-badge strong { color: var(--ink); }

/* State machine: one data-state on .tool-card drives visibility.
   !important + --d so component display rules (flex, grid…) can't leak through. */
.tool-card [data-show] { display: none !important; }
.tool-card[data-state="idle"] [data-show~="idle"],
.tool-card[data-state="done"] [data-show~="done"],
.tool-card[data-state="error"] [data-show~="error"],
.tool-card[data-state="listening"] [data-show~="listening"],
.tool-card[data-state="unsupported"] [data-show~="unsupported"] { display: var(--d, block) !important; }
.empty-out, .chips { --d: flex; }
.pane-head > span[data-show] { --d: inline-flex; gap: 6px; align-items: center; }
.tool-card[data-state="done"] .out-pane textarea { border-color: var(--ok); }

.empty-out {
  display: flex; align-items: center; justify-content: center; text-align: center;
  min-height: 150px; flex: 1; padding: 16px; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm);
  color: var(--ink-3); font-size: .88rem;
}

/* Voice */
.mic-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.mic {
  width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 20px -8px var(--accent);
  transition: transform .2s var(--ease-out);
}
.mic svg { width: 28px; height: 28px; }
.mic:hover { transform: scale(1.04); }
.mic[aria-pressed="true"] { animation: pulse 1.6s var(--ease-out) infinite; }
.mic[disabled] { background: var(--line-strong); box-shadow: none; cursor: not-allowed; }
.mic-status { font-size: .9rem; color: var(--ink-2); min-width: 0; }
.mic-status strong { color: var(--ink); display: block; }
.interim { color: var(--ink-3); font-style: italic; font-size: .88rem; min-height: 1.4em; margin-top: 6px; overflow-wrap: anywhere; }
.engine-tag { font-size: .72rem; padding: 2px 7px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); }
.engine-tag.local { background: var(--ok-soft); border-color: transparent; color: var(--ok); }

/* Scrubber presets */
.presets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.presets button {
  padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2);
  font-size: .84rem; font-weight: 600; color: var(--ink-2);
}
.presets button[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
details.adv { margin-top: 10px; font-size: .85rem; }
details.adv summary { cursor: pointer; color: var(--ink-2); font-weight: 600; }
.adv-grid { display: grid; gap: 8px 16px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); margin-top: 8px; }

/* =============================================================
   7. Ad slots (placeholders — owner pastes AdSense later)
   ============================================================= */
.ad-slot {
  display: flex; align-items: center; justify-content: center;
  border: 1px dashed var(--line-strong); border-radius: 10px; color: var(--ink-3);
  font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; background: transparent;
  margin: 18px auto; width: 100%;
}
.ad-slot--header { display: none; min-height: 90px; max-width: 728px; margin: 12px auto 0; }
.ad-slot--result { min-height: 100px; max-width: 728px; margin-top: 14px; margin-bottom: 0; }
.ad-slot--content { min-height: 250px; }
.ad-slot--sidebar { min-height: 600px; margin: 0; position: sticky; top: 16px; }
/* No manual unit pasted yet → no empty dashed box on the live site (Auto ads place themselves). */
.ad-slot:not(:has(ins.adsbygoogle)) { display: none !important; }
.ad-slot:has(ins.adsbygoogle) { border: 0; }
.ad-slot:has(ins.adsbygoogle) > span { display: none; }
.sidebar:not(:has(ins.adsbygoogle)) { display: none !important; }

/* =============================================================
   8. Content sections (SEO, FAQ, related)
   ============================================================= */
.content { padding: 28px 0 8px; }
.content section { margin-bottom: 34px; }
.content h2 { font-size: clamp(1.25rem, 3vw, 1.6rem); margin-bottom: 12px; }
.content h3 { font-size: 1.05rem; margin: 18px 0 6px; }
.content p, .content li { color: var(--ink-2); max-width: 72ch; }
.content p + p { margin-top: 10px; }
.content ul, .content ol { padding-left: 1.2rem; margin-top: 8px; }
.content code { font-family: var(--mono); font-size: .86em; background: var(--surface-2); border: 1px solid var(--line); border-radius: 5px; padding: 0 4px; }

.steps { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); padding: 0; list-style: none; counter-reset: s; }
.steps li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; counter-increment: s; max-width: none; }
.steps li::before { content: counter(s); display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: .85rem; margin-bottom: 6px; }
.steps li strong { display: block; color: var(--ink); }

.example { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); margin-top: 12px; }
.example pre {
  font-family: var(--mono); font-size: .8rem; white-space: pre-wrap; overflow-wrap: anywhere;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; color: var(--ink-2);
}
.example figcaption { font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin-bottom: 4px; }

.faq details { border-bottom: 1px solid var(--line); padding: 12px 0; }
.faq summary { cursor: pointer; font-weight: 650; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--accent); font-weight: 700; transition: transform .2s var(--ease-out); }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { margin-top: 8px; }

.related { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.related a {
  display: block; text-decoration: none; padding: 14px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); transition: border-color .2s var(--ease-out), transform .2s var(--ease-out);
}
.related a:hover { border-color: var(--accent); transform: translateY(-2px); }
.related strong { display: block; margin-bottom: 2px; }
.related span { color: var(--ink-2); font-size: .88rem; }

.site-footer { border-top: 1px solid var(--line); padding: 22px 0 28px; margin-top: 20px; font-size: .84rem; color: var(--ink-3); }
.site-footer .container { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 14px; }
.site-footer a { color: var(--ink-2); }

/* Legal pages */
.legal { padding: 28px 0; }
.legal h1 { font-size: clamp(1.5rem, 4vw, 2rem); margin-bottom: 14px; }
.legal h2 { font-size: 1.15rem; margin: 22px 0 6px; }
.legal p, .legal li { color: var(--ink-2); max-width: 72ch; }
.legal ul { padding-left: 1.2rem; }
.todo { background: var(--warn-soft); color: var(--ink); padding: 0 4px; border-radius: 4px; }

/* =============================================================
   9. Effects
   ============================================================= */
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent); }
  70% { box-shadow: 0 0 0 16px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.flash { animation: flash .6s var(--ease-out); }
@keyframes flash { from { background: var(--accent-soft); } }

/* =============================================================
   10. Responsive (mobile-first)
   ============================================================= */
@media (min-width: 540px) {
  .brand small { display: inline; }
  .tool-card { padding: 16px; }
}
@media (min-width: 720px) {
  .steps, .related { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .example { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  textarea.io { min-height: 230px; }
  .empty-out { min-height: 230px; }
}
@media (min-width: 960px) {
  .ad-slot--header { display: flex; }
  .panes { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .hero { padding-top: 20px; }
  textarea.io { min-height: 300px; }
  .empty-out { min-height: 300px; }
}
@media (min-width: 1280px) {
  .layout:has(.sidebar ins.adsbygoogle) { grid-template-columns: minmax(0, 1fr) 300px; }
  .sidebar { display: block; }
}

/* =============================================================
   11. Reduced motion (intrusive effects only)
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  .mic[aria-pressed="true"] { animation: none; outline: 3px solid var(--accent); outline-offset: 4px; }
  html { scroll-behavior: auto; }
}

/* =============================================================
   12. Hidden-Unicode checker, char limit, landing-page extras
   ============================================================= */
.count.over { color: var(--err); font-weight: 700; }

.verdict { padding: 10px 12px; border-radius: var(--radius-sm); font-size: .88rem; font-weight: 600; margin-bottom: 8px; border: 1px solid transparent; }
.verdict.v-clean { background: var(--ok-soft); color: var(--ink); border-color: var(--ok); }
.verdict.v-review { background: var(--warn-soft); color: var(--ink); border-color: var(--warn); }
.verdict.v-suspicious { background: var(--err-soft); color: var(--ink); border-color: var(--err); }

.report { max-height: 210px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); margin-bottom: 8px; }
.tool-card[data-state] .report.is-empty[data-show] { display: none !important; }
.report table { width: 100%; border-collapse: collapse; font-size: .8rem; }
.report th { position: sticky; top: 0; background: var(--surface); text-align: left; padding: 6px 8px; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); border-bottom: 1px solid var(--line); }
.report td { padding: 5px 8px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.report tr:last-child td { border-bottom: 0; }
.report .sev { font-weight: 700; text-transform: uppercase; font-size: .7rem; letter-spacing: .04em; white-space: nowrap; }
.report .sev-high { color: var(--err); }
.report .sev-medium { color: var(--warn); }
.report .sev-low { color: var(--ink-3); }
.report .count { padding: 6px 8px; }

textarea.io--sm { min-height: 120px; }
@media (min-width: 960px) { textarea.io--sm { min-height: 150px; } }

.callout { background: var(--accent-soft); border-radius: var(--radius-sm); padding: 12px 14px; color: var(--ink); max-width: 72ch; margin-top: 10px; }
.content pre.code { font-family: var(--mono); font-size: .8rem; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; color: var(--ink-2); max-width: 72ch; margin-top: 8px; }
.content table.ref { border-collapse: collapse; margin-top: 10px; font-size: .88rem; max-width: 72ch; width: 100%; }
.content table.ref th, .content table.ref td { border-bottom: 1px solid var(--line); padding: 7px 8px; text-align: left; color: var(--ink-2); vertical-align: top; }
.content table.ref th { color: var(--ink); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; }
.content table.ref td:first-child { font-family: var(--mono); white-space: nowrap; color: var(--ink); }

/* 13. Reference tables never widen the page on small screens */
@media (max-width: 640px) {
  .content table.ref { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .content table.ref td:first-child { white-space: normal; }
}
