/* QueryClassifier.com — clean, simple design
 *
 * A pared-back take: keeps the niceties (rounded corners, theme toggle,
 * accessible tags, subtle hover animations) but loses heavy decoration —
 * plain backgrounds, system fonts, no grid texture, no glow gradients.
 */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

:root,
[data-theme="light"] {
  --bg:              #ffffff;
  --surface:         #fafafa;
  --surface-strong:  #ffffff;
  --surface-offset:  #f1f1ef;
  --text:            #1a1a1a;
  --muted:           #555555;
  --faint:           #888888;
  --border:          #e6e6e3;
  --border-strong:   #d4d4d0;
  --primary:         #2557d6;
  --primary-strong:  #1d46b3;
  --primary-soft:    #e6edfb;
  --green:           #1f6b29;
  --green-soft:      #dcebd8;
  --amber:           #7a4d09;
  --amber-soft:      #f1e4c7;
  --red:             #8c2a39;
  --red-soft:        #ecd6d8;
  --shadow:          0 4px 18px rgba(20, 20, 20, 0.06);
  --shadow-small:    0 2px 8px rgba(20, 20, 20, 0.05);
}

[data-theme="dark"] {
  --bg:              #131313;
  --surface:         #1a1a1a;
  --surface-strong:  #1f1f1f;
  --surface-offset:  #2a2a2a;
  --text:            #ededed;
  --muted:           #b9b9b9;
  --faint:           #888888;
  --border:          #2e2e2e;
  --border-strong:   #404040;
  --primary:         #7aa3f5;
  --primary-strong:  #a4c0f9;
  --primary-soft:    #1e2a44;
  --green:           #7fc66c;
  --green-soft:      #233a22;
  --amber:           #efc164;
  --amber-soft:      #40331d;
  --red:             #e07986;
  --red-soft:        #42252a;
  --shadow:          0 4px 18px rgba(0, 0, 0, 0.45);
  --shadow-small:    0 2px 8px rgba(0, 0, 0, 0.30);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:              #131313;
    --surface:         #1a1a1a;
    --surface-strong:  #1f1f1f;
    --surface-offset:  #2a2a2a;
    --text:            #ededed;
    --muted:           #b9b9b9;
    --faint:           #888888;
    --border:          #2e2e2e;
    --border-strong:   #404040;
    --primary:         #7aa3f5;
    --primary-strong:  #a4c0f9;
    --primary-soft:    #1e2a44;
    --green:           #7fc66c;
    --green-soft:      #233a22;
    --amber:           #efc164;
    --amber-soft:      #40331d;
    --red:             #e07986;
    --red-soft:        #42252a;
    --shadow:          0 4px 18px rgba(0, 0, 0, 0.45);
    --shadow-small:    0 2px 8px rgba(0, 0, 0, 0.30);
  }
}

:root {
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --ease-out:  cubic-bezier(0.16, 1, 0.3, 1);
}

/* ──────────────────────────────────────────────────────────────────────── */
/*  Reset                                                                   */
/* ──────────────────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }

.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;
}

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 15.5px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}

/* ──────────────────────────────────────────────────────────────────────── */
/*  Layout                                                                  */
/* ──────────────────────────────────────────────────────────────────────── */

.wrap {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ──────────────────────────────────────────────────────────────────────── */
/*  Header                                                                  */
/* ──────────────────────────────────────────────────────────────────────── */

.site-header {
  padding: 22px 0 8px;
  border-bottom: 1px solid transparent;
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.005em;
  transition: opacity 0.2s var(--ease-out);
}
.brand:hover { opacity: 0.75; }
.brand:focus-visible { outline: 2px solid var(--primary); outline-offset: 4px; border-radius: 6px; }

.brand-mark {
  width: 28px; height: 28px;
  border-radius: 7px;
  background: var(--primary-soft);
  display: grid; place-items: center;
  color: var(--primary);
}

.theme-toggle {
  width: 34px; height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-strong);
  color: var(--muted);
  display: grid; place-items: center;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.theme-toggle:hover { color: var(--text); border-color: var(--border-strong); }
.theme-toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}

/* ──────────────────────────────────────────────────────────────────────── */
/*  Hero (minimal)                                                          */
/* ──────────────────────────────────────────────────────────────────────── */

.hero {
  padding: 32px 0 16px;
}

.hero h1 {
  font-size: clamp(26px, 3.6vw, 32px);
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -0.015em;
  margin: 0 0 10px;
  color: var(--text);
}

.hero p.lede {
  font-size: 15.5px;
  line-height: 1.6;
  color: var(--muted);
  margin: 0;
  max-width: 68ch;
}

.hero p.lede a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
.hero p.lede a:hover { text-decoration-thickness: 2px; }
.hero p.lede a:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; border-radius: 3px; }

/* ──────────────────────────────────────────────────────────────────────── */
/*  Classes grid                                                            */
/* ──────────────────────────────────────────────────────────────────────── */

.classes { margin: 22px 0 12px; }

.classes h2,
.tool h2 {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 12px;
  color: var(--text);
}

.class-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
@media (max-width: 720px) { .class-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 460px) { .class-grid { grid-template-columns: 1fr; } }

.class-grid li {
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  color: var(--muted);
  transition: border-color 0.18s var(--ease-out), background 0.18s;
}
.class-grid li:hover {
  border-color: var(--border-strong);
  background: var(--surface);
}

/* ──────────────────────────────────────────────────────────────────────── */
/*  Tool / input                                                            */
/* ──────────────────────────────────────────────────────────────────────── */

.tool { margin: 24px 0 32px; }

.tool h2 { font-size: 16px; }

.tool .hint {
  font-size: 13.5px;
  color: var(--muted);
  margin: 0 0 14px;
}
.tool .hint strong { color: var(--text); }

textarea#kw {
  width: 100%;
  min-height: 200px;
  resize: vertical;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text);
  transition: border-color 0.18s, box-shadow 0.18s;
}
textarea#kw::placeholder { color: var(--faint); }
textarea#kw:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.input-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 10px 2px 14px;
  font-size: 13px;
  color: var(--muted);
}
.input-meta .muted { color: var(--faint); }
.input-meta #kw-count.over { color: var(--red); font-weight: 600; }

.controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--border);
  background: var(--surface-strong);
  color: var(--text);
  font: 500 13.5px/1 var(--font-body);
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  transition:
    border-color 0.18s var(--ease-out),
    background 0.18s,
    box-shadow 0.18s var(--ease-out),
    transform 0.12s var(--ease-out),
    opacity 0.2s;
}
.btn:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-small);
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: none; }

.btn.primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn.primary:hover {
  background: var(--primary-strong);
  border-color: var(--primary-strong);
}
[data-theme="dark"] .btn.primary {
  background: var(--primary);
  color: #0c1428;
  border-color: var(--primary);
}
[data-theme="dark"] .btn.primary:hover {
  background: var(--primary-strong);
  border-color: var(--primary-strong);
  color: #0c1428;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn.primary {
    background: var(--primary);
    color: #0c1428;
    border-color: var(--primary);
  }
  :root:not([data-theme="light"]) .btn.primary:hover {
    background: var(--primary-strong);
    border-color: var(--primary-strong);
    color: #0c1428;
  }
}

.btn.ghost { background: transparent; }

.btn svg { width: 14px; height: 14px; }

/* File upload + tooltip */
.upload-wrap { position: relative; display: inline-flex; align-items: center; gap: 6px; }

.btn-file {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--border);
  background: var(--surface-strong);
  color: var(--text);
  font: 500 13.5px/1 var(--font-body);
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.18s var(--ease-out), box-shadow 0.18s var(--ease-out);
}
.btn-file:hover { border-color: var(--border-strong); box-shadow: var(--shadow-small); }
.btn-file:focus-within { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn-file svg { width: 14px; height: 14px; }

.help-trigger {
  display: inline-grid;
  place-items: center;
  width: 20px; height: 20px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface-strong);
  color: var(--muted);
  font: 600 11.5px/1 var(--font-body);
  cursor: help;
  transition: color 0.18s, border-color 0.18s;
}
.help-trigger:hover, .help-trigger:focus { color: var(--text); border-color: var(--text); }
.help-trigger:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--text);
  color: var(--bg);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  line-height: 1.45;
  width: max-content;
  max-width: 260px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s var(--ease-out), transform 0.22s var(--ease-out);
  z-index: 10;
}
.tooltip::after {
  content: "";
  position: absolute;
  top: 100%; left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--text);
}
.upload-wrap:hover .tooltip,
.upload-wrap:focus-within .tooltip,
.help-trigger:hover + .tooltip,
.help-trigger:focus + .tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.turnstile-box { margin-top: 14px; min-height: 65px; }

#status {
  margin-top: 12px;
  font-size: 13.5px;
  min-height: 20px;
  color: var(--muted);
}
#status.error   { color: var(--red); }
#status.success { color: var(--green); }

/* ──────────────────────────────────────────────────────────────────────── */
/*  Results                                                                 */
/* ──────────────────────────────────────────────────────────────────────── */

.summary {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.summary h3 {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--faint);
  margin: 0 0 12px;
}
.summary-bars { display: grid; gap: 8px; }
.summary-bar {
  display: grid;
  grid-template-columns: 120px 1fr 90px;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}
.summary-bar .bar {
  height: 8px;
  background: var(--surface-offset);
  border-radius: 999px;
  overflow: hidden;
}
.summary-bar .bar-fill {
  height: 100%;
  border-radius: 999px;
  width: 0;
  transition: width 0.7s var(--ease-out);
}
.summary-bar .count { color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }

.table-wrap {
  margin-top: 18px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-strong);
}

table#results {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
table#results th,
table#results td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
table#results th {
  font-weight: 600;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--faint);
  background: var(--surface);
}
table#results tr:last-child td { border-bottom: none; }
table#results td.confidence { color: var(--muted); font-variant-numeric: tabular-nums; }
table#results tbody tr { transition: background 0.15s; }
table#results tbody tr:hover { background: var(--surface); }

/* ──────────────────────────────────────────────────────────────────────── */
/*  Tags                                                                    */
/* ──────────────────────────────────────────────────────────────────────── */

.tag {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  background: var(--primary-soft);
  color: var(--primary);
}

.tag-BOOL        { background: #dcebd8; color: #1f6b29; }
.tag-INSTRUCTION { background: #f1e4c7; color: #7a4d09; }
.tag-SHORT_FACT  { background: #d6e4f5; color: #1e4d8b; }
.tag-DEFINITION  { background: #e6daf2; color: #5b3786; }
.tag-COMPARISON  { background: #f2dcdc; color: #8c2a39; }
.tag-REASON      { background: #f5ecc5; color: #76601a; }
.tag-CONSEQUENCE { background: #d8eee6; color: #1f6b53; }
.tag-OTHER       { background: var(--surface-offset); color: var(--faint); }

[data-theme="dark"] .tag-BOOL        { background: #233a22; color: #7fc66c; }
[data-theme="dark"] .tag-INSTRUCTION { background: #40331d; color: #efc164; }
[data-theme="dark"] .tag-SHORT_FACT  { background: #1c2c45; color: #8ab8e0; }
[data-theme="dark"] .tag-DEFINITION  { background: #2a1f4a; color: #b8a8e8; }
[data-theme="dark"] .tag-COMPARISON  { background: #401d24; color: #e07986; }
[data-theme="dark"] .tag-REASON      { background: #3d3520; color: #e0d188; }
[data-theme="dark"] .tag-CONSEQUENCE { background: #1f3a32; color: #88d4b8; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tag-BOOL        { background: #233a22; color: #7fc66c; }
  :root:not([data-theme="light"]) .tag-INSTRUCTION { background: #40331d; color: #efc164; }
  :root:not([data-theme="light"]) .tag-SHORT_FACT  { background: #1c2c45; color: #8ab8e0; }
  :root:not([data-theme="light"]) .tag-DEFINITION  { background: #2a1f4a; color: #b8a8e8; }
  :root:not([data-theme="light"]) .tag-COMPARISON  { background: #401d24; color: #e07986; }
  :root:not([data-theme="light"]) .tag-REASON      { background: #3d3520; color: #e0d188; }
  :root:not([data-theme="light"]) .tag-CONSEQUENCE { background: #1f3a32; color: #88d4b8; }
}

.bar-fill[data-class="BOOL"]        { background: #4a9c54; }
.bar-fill[data-class="INSTRUCTION"] { background: #c89224; }
.bar-fill[data-class="SHORT_FACT"]  { background: #3a78c2; }
.bar-fill[data-class="DEFINITION"]  { background: #8a5fd1; }
.bar-fill[data-class="COMPARISON"]  { background: #c84a5a; }
.bar-fill[data-class="REASON"]      { background: #b8a13a; }
.bar-fill[data-class="CONSEQUENCE"] { background: #3aa080; }
.bar-fill[data-class="OTHER"]       { background: var(--faint); }

/* ──────────────────────────────────────────────────────────────────────── */
/*  Footer                                                                  */
/* ──────────────────────────────────────────────────────────────────────── */

.site-footer {
  padding: 24px 0 36px;
  margin-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 13.5px;
  color: var(--muted);
}
.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.site-footer a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--border-strong);
  transition: text-decoration-color 0.2s;
}
.site-footer a:hover { text-decoration-color: var(--primary); }
.site-footer a:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; border-radius: 3px; }

.footer-credits { margin: 0; }
.footer-links { display: inline-flex; align-items: center; gap: 14px; }
.footer-links a { display: inline-flex; align-items: center; gap: 5px; }
.footer-links svg { width: 13px; height: 13px; }

/* ──────────────────────────────────────────────────────────────────────── */
/*  Animations                                                              */
/* ──────────────────────────────────────────────────────────────────────── */

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.anim-rise {
  opacity: 0;
  animation: rise 0.5s var(--ease-out) forwards;
}

.reveal {
  opacity: 0;
  transform: translateY(10px);
  transition:
    opacity 0.5s var(--ease-out),
    transform 0.5s var(--ease-out);
  will-change: opacity, transform;
}
.reveal.in-view {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .reveal { opacity: 1 !important; transform: none !important; }
}
