/* ==========================================================================
   CLQA Tools — landing page
   Light / dark themes, tokens first. No external fonts, no CDN.
   ========================================================================== */

:root {
  --wrap: 1180px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 34, 42, .06), 0 8px 24px rgba(16, 34, 42, .06);
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Mono", Consolas, "SF Mono", "Roboto Mono", monospace;
  --header-h: 64px;
  --ease: cubic-bezier(.2, .7, .3, 1);
}

html[data-theme="light"] {
  --bg: #f4f7f8;
  --bg-alt: #eaf0f2;
  --surface: #ffffff;
  --surface-2: #f2f6f7;
  --border: #d7e1e5;
  --border-strong: #bccbd1;
  --text: #12242c;
  --text-muted: #55696f;
  --accent: #1c7c99;
  --accent-hover: #166a83;
  --accent-ink: #ffffff;
  --accent-soft: #e0eff4;
  --accent-line: #9ccfdd;
  --ok: #1f7a4d;
  --ok-soft: #e2f2ea;
  --warn: #8a5b00;
  --warn-soft: #fbf0da;
  --focus: #1c7c99;
}

html[data-theme="dark"] {
  --bg: #0c1418;
  --bg-alt: #101c22;
  --surface: #142127;
  --surface-2: #1a2a32;
  --border: #27383f;
  --border-strong: #38505a;
  --text: #e6eef1;
  --text-muted: #9ab1b9;
  --accent: #5bb8d4;
  --accent-hover: #78c9e0;
  --accent-ink: #05171d;
  --accent-soft: #13313a;
  --accent-line: #2d5c6b;
  --ok: #62c493;
  --ok-soft: #14302a;
  --warn: #e0b357;
  --warn-soft: #33280f;
  --focus: #5bb8d4;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -.015em; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
code { font-family: var(--mono); font-size: .88em; background: var(--surface-2); border: 1px solid var(--border); border-radius: 5px; padding: .1em .35em; }
a { color: var(--accent); }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }

.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute; left: 16px; top: -60px; z-index: 100;
  background: var(--accent); color: var(--accent-ink);
  padding: 10px 16px; border-radius: var(--radius-sm); font-weight: 600;
  transition: top .15s var(--ease);
}
.skip-link:focus { top: 12px; }

/* ------------------------------- HEADER ------------------------------- */

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  height: var(--header-h);
  display: flex; align-items: center; gap: 20px;
}

.brand {
  display: inline-flex; align-items: center; gap: 14px;
  text-decoration: none; color: var(--text); flex: none;
}
/* The logo art carries black type, so it always sits on a light chip. */
.brand img {
  height: 46px; width: auto; display: block;
  background: #fff; border-radius: 8px; padding: 4px 8px;
  border: 1px solid var(--border);
}
.brand-name { font-weight: 700; font-size: 1.12rem; letter-spacing: -.01em; }

.site-nav { display: flex; gap: 4px; margin-left: auto; }
.site-nav a {
  color: var(--text-muted); text-decoration: none; font-size: .93rem; font-weight: 500;
  padding: 8px 12px; border-radius: var(--radius-sm);
}
.site-nav a:hover { color: var(--text); background: var(--surface-2); }

.header-actions { display: flex; align-items: center; gap: 8px; }

.ghost-btn, .icon-btn {
  font: inherit; color: var(--text-muted); cursor: pointer;
  background: transparent; border: 1px solid var(--border); border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 10px; transition: background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}
.ghost-btn:hover, .icon-btn:hover { color: var(--text); background: var(--surface-2); border-color: var(--border-strong); }
.icon-btn { padding: 8px; }

.palette-label { font-size: .9rem; }
kbd {
  font-family: var(--mono); font-size: .72rem; line-height: 1;
  padding: 3px 5px; border-radius: 4px;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-muted);
}

.theme-btn .i-moon { display: none; }
html[data-theme="dark"] .theme-btn .i-sun { display: none; }
html[data-theme="dark"] .theme-btn .i-moon { display: block; }

/* ------------------------------- HERO ------------------------------- */

.hero {
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(1100px 420px at 12% -10%, var(--accent-soft), transparent 62%),
    linear-gradient(180deg, var(--bg-alt), var(--bg));
}

.hero-inner { padding: 64px 24px 56px; max-width: var(--wrap); }

.hero-logo {
  display: inline-block; background: #fff; border: 1px solid var(--border);
  border-radius: 14px; padding: 14px 20px; margin-bottom: 26px;
  box-shadow: var(--shadow);
}
.hero-logo img { display: block; width: auto; height: 104px; }

.eyebrow {
  font-size: .78rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 14px;
}

.hero h1 {
  font-size: clamp(2rem, 5.2vw, 3.35rem);
  font-weight: 800;
  max-width: 18ch;
  margin-bottom: 18px;
}

.lede {
  font-size: clamp(1rem, 1.5vw, 1.12rem);
  color: var(--text-muted);
  max-width: 62ch;
}

/* ------------------------------- SECTIONS ------------------------------- */

.section { padding: 66px 0; }
.section-alt { background: var(--bg-alt); border-block: 1px solid var(--border); }

.section-head { margin-bottom: 30px; }
.section-head h2 { font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 750; }
.section-sub { color: var(--text-muted); margin-top: 8px; max-width: 72ch; }

/* ------------------------------- TOOL CARDS ------------------------------- */

.tool-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(248px, 1fr));
}

.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex; flex-direction: column; gap: 12px;
  box-shadow: var(--shadow);
  transition: border-color .15s var(--ease), transform .15s var(--ease);
}
.tool-card:hover { border-color: var(--accent-line); transform: translateY(-2px); }
.card-local { background: var(--surface); border-style: dashed; }

/* --- card screenshot --- */

.tc-shot {
  position: relative; display: block; width: 100%; padding: 0;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  overflow: hidden; cursor: zoom-in; background: var(--surface-2);
  aspect-ratio: 16 / 10;
}
.tc-shot img {
  width: 100%; height: 100%; object-fit: cover; object-position: top center;
  display: block;
}
.tc-shot:hover { border-color: var(--accent); }
.shot-zoom {
  position: absolute; right: 8px; bottom: 8px;
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(8, 18, 22, .72); color: #fff;
  opacity: 0; transition: opacity .15s var(--ease);
}
.tc-shot:hover .shot-zoom, .tc-shot:focus-visible .shot-zoom { opacity: 1; }

/* --- lightbox --- */

.lightbox {
  position: fixed; inset: 0; z-index: 95;
  background: rgba(6, 14, 18, .86);
  display: flex; align-items: center; justify-content: center;
  padding: 32px 20px;
}
.lightbox[hidden] { display: none; }
.lightbox-inner {
  position: relative; max-width: 1400px; width: 100%;
  display: flex; flex-direction: column; gap: 10px;
}
.lightbox-inner img {
  width: 100%; max-height: 78vh; object-fit: contain;
  background: transparent; border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.lightbox-cap { color: #d7e4e8; font-size: .9rem; text-align: center; }
.lightbox-close {
  position: absolute; top: -34px; right: 0;
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255, 255, 255, .14); color: #fff;
  border: 1px solid rgba(255, 255, 255, .3);
  font-size: 1.3rem; line-height: 1; cursor: pointer;
}
.lightbox-close:hover { background: rgba(255, 255, 255, .26); }

.tc-top { display: flex; align-items: center; justify-content: space-between; }
.tc-index { font-family: var(--mono); font-size: .8rem; color: var(--text-muted); }

.badge {
  font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 999px; white-space: nowrap;
}
.badge-online { color: var(--ok); background: var(--ok-soft); }
.badge-local { color: var(--warn); background: var(--warn-soft); }

.tc-title { font-size: 1.22rem; font-weight: 700; }
.tc-desc { color: var(--text-muted); font-size: .93rem; }

.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-list li {
  font-size: .76rem; color: var(--text-muted);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 999px; padding: 3px 9px;
}

.tc-actions { display: flex; align-items: center; gap: 12px; margin-top: auto; padding-top: 6px; flex-wrap: wrap; }
.tc-url { font-family: var(--mono); font-size: .8rem; color: var(--text-muted); }

.local-note { font-size: .84rem; color: var(--text-muted); border-top: 1px dashed var(--border); padding-top: 10px; }

/* ------------------------------- BUTTONS ------------------------------- */

.btn {
  font: inherit; font-weight: 600; font-size: .92rem;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: var(--radius-sm);
  border: 1px solid transparent; cursor: pointer;
  text-decoration: none; white-space: nowrap;
  transition: background .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease);
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { border-color: var(--accent-line); color: var(--accent); }
.btn[disabled] { opacity: .6; cursor: not-allowed; }

/* ------------------------------- FEEDBACK ------------------------------- */

.feedback-grid {
  display: grid; gap: 24px;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  align-items: start;
}
@media (max-width: 900px) { .feedback-grid { grid-template-columns: 1fr; } }

.fb-form {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; display: flex; flex-direction: column; gap: 16px; box-shadow: var(--shadow);
}
.fb-row { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; }
@media (max-width: 640px) { .fb-row { grid-template-columns: 1fr; } }

.fb-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.fb-field label { font-size: .85rem; font-weight: 600; color: var(--text); }
.req { color: var(--accent); }
.opt { font-weight: 400; color: var(--text-muted); font-size: .8rem; }

.fb-field input, .fb-field select, .fb-field textarea {
  font: inherit; font-size: .93rem; color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 9px 11px; width: 100%;
}
.fb-field textarea { resize: vertical; min-height: 110px; line-height: 1.55; }
.fb-field input:focus, .fb-field select:focus, .fb-field textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.fb-field input[aria-invalid="true"], .fb-field select[aria-invalid="true"] {
  border-color: #c0483f;
}

.fb-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.fb-status { font-size: .88rem; color: var(--text-muted); }
.fb-status.ok { color: var(--ok); font-weight: 600; }
.fb-status.err { color: #c0483f; font-weight: 600; }

.fb-aside {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px;
}
.fb-aside h3 { font-size: 1rem; font-weight: 700; margin-bottom: 12px; }
.fb-aside li {
  position: relative; padding-left: 18px; margin-bottom: 10px;
  font-size: .88rem; color: var(--text-muted);
}
.fb-aside li::before {
  content: ""; position: absolute; left: 0; top: .62em;
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
}

/* ------------------------------- FEEDBACK LOG ------------------------------- */

.log-bar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.log-counts { display: flex; gap: 8px; }
.pill {
  font-size: .82rem; font-weight: 600;
  border-radius: 999px; padding: 5px 12px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-muted);
}
.pill strong { color: var(--text); font-variant-numeric: tabular-nums; }
.pill-open { color: var(--accent); background: var(--accent-soft); border-color: var(--accent-line); }
.pill-closed { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
.pill-closed strong { color: var(--ok); }
.log-actions { display: flex; gap: 8px; margin-left: auto; }
.log-actions .btn { font-size: .86rem; padding: 8px 14px; }
.log-actions .btn[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }

.log-table-wrap {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow-x: auto; box-shadow: var(--shadow);
}
.log-table {
  width: 100%; border-collapse: collapse; font-size: .9rem;
}
.log-table th, .log-table td {
  text-align: left; padding: 11px 14px; vertical-align: top;
  border-bottom: 1px solid var(--border);
}
.log-table th {
  font-size: .76rem; text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-muted); font-weight: 700; white-space: nowrap;
  background: var(--surface-2);
}
.log-table tbody tr:last-child td { border-bottom: 0; }
.log-table tbody tr:hover { background: var(--surface-2); }
.log-date { font-family: var(--mono); font-size: .82rem; color: var(--text-muted); white-space: nowrap; }
.log-tool { font-weight: 600; white-space: nowrap; }
.log-summary { color: var(--text); }
.log-details { display: block; margin-top: 4px; color: var(--text-muted); font-size: .84rem; }
.log-status {
  font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 999px; white-space: nowrap;
}
.log-status-open { color: var(--accent); background: var(--accent-soft); }
.log-status-closed { color: var(--ok); background: var(--ok-soft); }
.log-type { color: var(--text-muted); white-space: nowrap; }

/* Hide resolved — the button hides every closed row. */
.log-table-wrap.hide-closed tr.is-closed { display: none; }
.log-empty { padding: 26px; text-align: center; color: var(--text-muted); font-size: .92rem; }
.log-table-wrap.is-hidden { display: none; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ------------------------------- LEGAL ------------------------------- */

.legal-grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.legal-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px;
}
.legal-card h3 { font-size: 1.02rem; font-weight: 700; margin-bottom: 10px; }
.legal-card p { font-size: .9rem; color: var(--text-muted); }

/* ------------------------------- FOOTER ------------------------------- */

.site-footer { border-top: 1px solid var(--border); background: var(--bg-alt); padding: 34px 0 44px; }
.footer-inner { display: grid; gap: 18px; }
.foot-brand img { height: 38px; width: auto; background: #fff; border-radius: 8px; padding: 5px 9px; border: 1px solid var(--border); }
.foot-brand p { font-size: .87rem; color: var(--text-muted); margin-top: 10px; max-width: 52ch; }
.foot-nav { display: flex; gap: 18px; }
.foot-nav a { font-size: .87rem; color: var(--text-muted); text-decoration: none; }
.foot-nav a:hover { color: var(--accent); }
.foot-note { font-size: .82rem; color: var(--text-muted); }

/* ------------------------------- COMMAND PALETTE ------------------------------- */

.palette-backdrop {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(6, 14, 18, .5);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 12vh 20px 20px;
  backdrop-filter: blur(2px);
}
.palette-backdrop[hidden] { display: none; }

.palette {
  width: min(560px, 100%);
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius); box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
  overflow: hidden;
}
.palette-input {
  width: 100%; font: inherit; font-size: 1rem; color: var(--text);
  background: transparent; border: 0; border-bottom: 1px solid var(--border);
  padding: 16px 18px;
}
.palette-input:focus { outline: none; }
.palette-list { max-height: 320px; overflow-y: auto; padding: 6px; }
.palette-list li {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius-sm); cursor: pointer;
}
.palette-list li[aria-selected="true"] { background: var(--accent-soft); }
.pl-kind {
  font-size: .68rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--text-muted); border: 1px solid var(--border); border-radius: 5px; padding: 2px 6px; flex: none;
}
.pl-name { font-size: .93rem; font-weight: 600; color: var(--text); }
.pl-meta { font-size: .78rem; color: var(--text-muted); margin-left: auto; }
.palette-empty { padding: 18px; color: var(--text-muted); font-size: .9rem; }
.palette-foot {
  display: flex; gap: 16px; padding: 9px 14px;
  border-top: 1px solid var(--border); background: var(--surface-2);
  font-size: .76rem; color: var(--text-muted);
}
.palette-foot span { display: inline-flex; align-items: center; gap: 4px; }

/* ------------------------------- RESPONSIVE ------------------------------- */

@media (max-width: 720px) {
  .site-nav { display: none; }
  .palette-label, .palette-btn kbd { display: none; }
  .hero-inner { padding: 48px 24px 40px; }
  .section { padding: 48px 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}

@media print {
  .site-header, .hero-launch, .palette-backdrop, .site-footer, .fb-form, .fb-aside { display: none !important; }
  body { background: #fff; color: #000; }
}
