/* Keyword Density Checker — tool styles on the shared design (site/assets/site.css, Docs/DESIGN_SYSTEM.md v2).
   The tokens below repeat the shared values (tests/site checks they are identical) because tests/markup.test.js
   measures the WCAG contrast of every colour pair from this file. Layout rules are unchanged from the original tool. */
:root {
  --bg: #F7F8FF;
  --surface: #FFFFFF;
  --tint: #EAF0FF;
  --ink: #0F172A;
  --muted: #475569;
  --primary: #3155D9;
  --primary-hover: #2443B8;
  --violet: #8057D9;
  --violet-ink: #6A3FC8;
  --violet-soft: #F1ECFC;
  --teal: #27B9B1;
  --teal-ink: #0B6964;
  --teal-soft: #E3F7F6;
  --line: #E2E8F0;
  --field-line: #64748B;
  --focus: #8057D9;
  --success-ink: #166534;
  --error-ink: #B42318;
  --error-bg: #FEF3F2;
  --radius: 12px;
}
h1, h2 { line-height: 1.25; text-wrap: balance; }

.skip-link { color: var(--primary); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.page-header { width: 100%; max-width: 1120px; margin: 0 auto 20px; padding: 32px 16px 0; text-align: center; } /* Stage 7: centred like the other tools */
.eyebrow { margin: 0; font-size: .78rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; display: inline-block; padding: 6px 12px; border-radius: 999px; background: var(--violet-soft); color: var(--violet-ink); } /* Stage 7: the shared pill label */
h1 { margin: 6px 0 8px; font-size: clamp(1.8rem, 4.5vw, 2.6rem); }
.intro { margin: 0 auto; max-width: 70ch; color: var(--muted); }
.noscript { max-width: 1120px; margin: 0 auto 16px; padding: 12px 14px; background: var(--error-bg); color: var(--error-ink); border-radius: var(--radius); }

.layout { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.column { display: grid; gap: 16px; align-content: start; min-width: 0; }
@media (min-width: 960px) { .layout { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); align-items: start; } }

.panel { position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 22px 20px 20px; min-width: 0; box-shadow: 0 8px 28px rgba(49, 85, 217, .08); }
.panel::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: linear-gradient(90deg, var(--primary), var(--violet) 55%, var(--teal)); }
.panel > h2 { margin: 0 0 12px; font-size: 1.2rem; display: flex; align-items: center; gap: 10px; }
.step { display: inline-grid; place-items: center; width: 1.7em; height: 1.7em; border-radius: 50%; background: var(--violet); color: #FFFFFF; font-size: .85rem; font-weight: 750; flex: none; }

label { display: block; margin-bottom: 4px; font-weight: 650; font-size: .92rem; }
input[type="text"], textarea {
  width: 100%; min-height: 44px; border: 1px solid var(--field-line); border-radius: var(--radius); padding: 9px 12px;
  font: inherit; color: var(--ink); background: var(--surface);
}
textarea { resize: vertical; min-height: 220px; overflow-wrap: anywhere; }
.hint { margin: 6px 0 0; color: var(--muted); font-size: .86rem; }

.results-note { margin: 0 0 10px; }
.results-note:empty { display: none; }
.results { margin: 0; display: grid; gap: 8px; }
/* Flex with wrapping, not a two-column grid: at narrow widths the value and its formula move below the label
   instead of overlapping it (found at 320 px in Stage 2). */
.result { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 12px; padding: 10px 12px; background: var(--teal-soft); border-radius: 10px; border-left: 4px solid var(--teal); }
.result dt { font-weight: 650; flex: 1 1 auto; }
.result dd { margin: 0 0 0 auto; min-width: 0; max-width: 100%; text-align: right; font-weight: 750; font-size: 1.1rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.formula { display: block; font-weight: 400; font-size: .82rem; color: var(--muted); }

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
button { font: inherit; cursor: pointer; }
.button-primary, .button-secondary { min-height: 44px; padding: 9px 16px; border-radius: var(--radius); font-weight: 650; }
.button-primary { background: var(--primary); color: #FFFFFF; border: 1px solid var(--primary); }
.button-secondary { background: var(--surface); color: var(--violet); border: 1px solid var(--violet); }
.button-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.button-secondary:hover { background: var(--violet-soft); color: var(--violet-ink); }

.status { min-height: 1.5em; margin: 10px 0 0; color: var(--success-ink); font-weight: 600; }
.notice { margin: 12px 0 0; color: var(--ink); background: var(--teal-soft); padding: 8px 12px; border-radius: 10px; border-left: 4px solid var(--teal); font-size: .9rem; }

.page-footer { width: 100%; max-width: 1120px; margin: 24px auto 0; padding: 0 16px; color: var(--muted); font-size: .86rem; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
@media (forced-colors: active) { .step { border: 1px solid CanvasText; } .result { border: 1px solid CanvasText; } .panel::before { background: CanvasText; } }
