/* ============================================================
   Toolbench — design system
   Direction: "engineered workbench". Indigo + cyan on cool
   graphite. Space Grotesk display / Inter body / JetBrains data.
   ============================================================ */

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #eef0f4;
  --ink: #10131a;
  --ink-soft: #363c49;
  --muted: #5a6373;
  --border: #e2e6ed;
  --border-strong: #cfd5df;
  --brand: #4f46e5;
  --brand-ink: #4038c7;
  --brand-wash: #edecfd;
  --accent: #0891b2;
  --ok: #0e9f6e;
  --warn: #b45309;
  --err: #dc2626;
  --ring: rgba(79, 70, 229, 0.4);
  --shadow: 0 1px 2px rgba(16, 19, 26, 0.04), 0 6px 20px -8px rgba(16, 19, 26, 0.12);
  --shadow-lg: 0 24px 60px -24px rgba(16, 19, 26, 0.28);
  --radius: 14px;
  --radius-sm: 9px;
  --maxw: 1180px;
  --font-display: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --font-body: "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

[data-theme="dark"] {
  --bg: #0b0d12;
  --surface: #14171e;
  --surface-2: #1b1f28;
  --ink: #eef1f6;
  --ink-soft: #c6ccd8;
  --muted: #949cab;
  --border: #262b36;
  --border-strong: #333a47;
  --brand: #8b84ff;
  --brand-ink: #a29bff;
  --brand-wash: #1c1b32;
  --accent: #22d3ee;
  --ok: #34d399;
  --warn: #fbbf24;
  --err: #f87171;
  --ring: rgba(139, 132, 255, 0.45);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px -10px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 30px 70px -30px rgba(0, 0, 0, 0.8);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

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

.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: 20px; }

a { color: var(--brand-ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }

h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; letter-spacing: -0.02em; color: var(--ink); }
h1 { font-size: clamp(2rem, 5vw, 3rem); font-weight: 600; margin: 0 0 0.4em; }
h2 { font-size: clamp(1.35rem, 3vw, 1.7rem); font-weight: 600; margin: 1.6em 0 0.5em; }
h3 { font-size: 1.15rem; font-weight: 600; margin: 1.4em 0 0.4em; }
p { margin: 0 0 1em; }
code {
  font-family: var(--font-mono); font-size: 0.86em;
  background: var(--surface-2); padding: 0.12em 0.42em; border-radius: 6px;
  border: 1px solid var(--border);
}

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

/* skip link */
.skip { position: absolute; left: -9999px; top: 0; background: var(--brand); color: #fff; padding: 10px 16px; z-index: 100; border-radius: 0 0 8px 0; }
.skip:focus { left: 0; }

/* ── Header ─────────────────────────────────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; gap: 18px; height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; color: var(--ink); letter-spacing: -0.02em; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px; flex: 0 0 auto;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  display: grid; place-items: center; color: #fff; box-shadow: var(--shadow);
}
.brand-mark svg { width: 17px; height: 17px; }

.nav { display: flex; align-items: center; gap: 4px; margin-left: 6px; }
.nav a { color: var(--ink-soft); padding: 7px 11px; border-radius: 8px; font-size: 0.9rem; font-weight: 500; }
.nav a:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }

.header-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; }

/* search */
.search { position: relative; }
.search input {
  width: 210px; height: 40px; padding: 0 12px 0 36px;
  border: 1px solid var(--border-strong); border-radius: 10px;
  background: var(--surface); color: var(--ink); font: inherit; font-size: 0.9rem;
  transition: width 0.18s ease, border-color 0.15s;
}
.search input:focus { width: 260px; border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--ring); }
.search .search-icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.search-results {
  position: absolute; top: calc(100% + 8px); right: 0; width: min(420px, 88vw);
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-lg); overflow: hidden; display: none; max-height: 60vh; overflow-y: auto;
}
.search-results.open { display: block; }
.search-results a { display: flex; flex-direction: column; gap: 1px; padding: 10px 14px; color: var(--ink); border-bottom: 1px solid var(--border); }
.search-results a:last-child { border-bottom: none; }
.search-results a:hover, .search-results a.active { background: var(--brand-wash); text-decoration: none; }
.search-results .sr-title { font-weight: 600; font-size: 0.92rem; }
.search-results .sr-cat { font-size: 0.76rem; color: var(--muted); }
.search-results .sr-empty { padding: 16px; color: var(--muted); font-size: 0.9rem; }

.icon-btn {
  width: 40px; height: 40px; display: grid; place-items: center; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; color: var(--ink-soft);
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; }
.theme-toggle .moon { display: none; }
[data-theme="dark"] .theme-toggle .sun { display: none; }
[data-theme="dark"] .theme-toggle .moon { display: block; }

.menu-btn { display: none; }

/* mobile nav drawer */
.mobile-nav { display: none; }

@media (max-width: 860px) {
  .nav { display: none; }
  .search input { width: 150px; }
  .search input:focus { width: 180px; }
  .menu-btn { display: grid; }
  .mobile-nav {
    display: block; position: fixed; inset: 64px 0 auto 0; z-index: 49;
    background: var(--surface); border-bottom: 1px solid var(--border);
    transform: translateY(-120%); transition: transform 0.22s ease; box-shadow: var(--shadow-lg);
  }
  .mobile-nav.open { transform: translateY(0); }
  .mobile-nav a { display: block; padding: 13px 20px; color: var(--ink); border-bottom: 1px solid var(--border); font-weight: 500; }
  .mobile-nav a:hover { background: var(--surface-2); text-decoration: none; }
}
@media (max-width: 480px) {
  .search input { width: 120px; }
  .brand span { display: none; }
}

/* ── Ad slots ───────────────────────────────────────────── */
.ad-slot { display: block; margin: 22px auto; text-align: center; min-height: 0; }
.ad-slot ins { display: block; }
.ad-label { font-size: 0.62rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.ad-placeholder {
  border: 1px dashed var(--border-strong); border-radius: 10px; color: var(--muted);
  font-size: 0.75rem; padding: 20px; background: var(--surface-2);
}

/* ── Hero ───────────────────────────────────────────────── */
.hero { padding: clamp(18px, 2.5vw, 34px) 0 40px; position: relative; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: 0.6;
  background:
    radial-gradient(560px 300px at 82% -8%, color-mix(in srgb, var(--brand) 22%, transparent), transparent 70%),
    radial-gradient(460px 260px at 6% 12%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%);
}
.hero .eyebrow {
  display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-mono);
  font-size: 0.74rem; letter-spacing: 0.08em; color: var(--brand-ink);
  background: var(--brand-wash); border: 1px solid color-mix(in srgb, var(--brand) 30%, transparent);
  padding: 5px 11px; border-radius: 999px; margin-bottom: 18px;
}
.hero .count { font-family: var(--font-mono); font-weight: 700; }
.hero h1 { max-width: 16ch; }
.hero-lede { font-size: clamp(1.05rem, 2.2vw, 1.28rem); color: var(--muted); max-width: 54ch; margin-bottom: 26px; }

.hero-search { position: relative; max-width: 560px; }
.hero-search input {
  width: 100%; height: 58px; padding: 0 18px 0 50px;
  border: 1px solid var(--border-strong); border-radius: 14px; background: var(--surface);
  color: var(--ink); font: inherit; font-size: 1.05rem; box-shadow: var(--shadow);
}
.hero-search input:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 4px var(--ring); }
.hero-search .search-icon { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; color: var(--muted); }
.hero-search .search-results { left: 0; right: auto; width: 100%; }
.hero-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.hero-chips a {
  font-size: 0.83rem; padding: 6px 12px; border-radius: 999px; background: var(--surface);
  border: 1px solid var(--border); color: var(--ink-soft);
}
.hero-chips a:hover { border-color: var(--brand); color: var(--brand-ink); text-decoration: none; }

/* ── Section heads ──────────────────────────────────────── */
.section { padding: 30px 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.section-head h2 { margin: 0; }
.section-head .see-all { font-size: 0.88rem; font-weight: 500; }

/* ── Category grid ──────────────────────────────────────── */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.cat-card {
  display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); transition: transform 0.16s ease, border-color 0.16s;
}
.cat-card:hover { transform: translateY(-3px); border-color: var(--brand); text-decoration: none; }
.cat-ico {
  width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; margin-bottom: 13px;
  background: var(--brand-wash); color: var(--brand-ink); border: 1px solid color-mix(in srgb, var(--brand) 22%, transparent);
}
.cat-ico svg { width: 21px; height: 21px; }
.cat-card h3 { margin: 0 0 4px; color: var(--ink); }
.cat-card p { margin: 0 0 12px; color: var(--muted); font-size: 0.9rem; }
.cat-count { font-family: var(--font-mono); font-size: 0.74rem; color: var(--brand-ink); font-weight: 600; }

/* ── Tool cards ─────────────────────────────────────────── */
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.tool-card {
  display: flex; flex-direction: column; gap: 5px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px 17px;
  transition: border-color 0.15s, transform 0.15s; box-shadow: var(--shadow);
}
.tool-card:hover { border-color: var(--brand); transform: translateY(-2px); text-decoration: none; }
.tool-card .tc-title { font-family: var(--font-display); font-weight: 600; color: var(--ink); font-size: 1.02rem; }
.tool-card .tc-desc { font-size: 0.85rem; color: var(--muted); margin: 0; }
.tool-card .tc-cat { font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--brand-ink); }

/* ── Breadcrumb ─────────────────────────────────────────── */
.crumbs { font-size: 0.82rem; color: var(--muted); padding: 22px 0 4px; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--brand-ink); }
.crumbs span { margin: 0 6px; opacity: 0.5; }

/* ── Tool page layout ───────────────────────────────────── */
.tool-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 34px; align-items: start; padding-bottom: 40px; }
.tool-main { min-width: 0; }
.tool-side { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 18px; }
@media (max-width: 940px) {
  .tool-layout { grid-template-columns: 1fr; }
  .tool-side { position: static; }
}
.tool-head h1 { margin-bottom: 6px; }
.tool-sub { color: var(--muted); font-size: 1.05rem; margin-bottom: 22px; }
.tool-updated { font-family: var(--font-mono); font-size: 0.72rem; color: var(--muted); }

.prose { max-width: 68ch; }
.prose ul, .prose ol { margin: 0 0 1em; padding-left: 1.3em; }
.prose li { margin-bottom: 0.4em; }
.prose li::marker { color: var(--brand); }

/* ── Related / side cards ───────────────────────────────── */
.side-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.side-card h3 { margin: 0 0 12px; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); font-family: var(--font-body); }
.side-links { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.side-links li { border-bottom: 1px solid var(--border); }
.side-links li:last-child { border-bottom: none; }
.side-links a { display: block; padding: 9px 0; color: var(--ink); font-size: 0.92rem; font-weight: 500; }
.side-links a:hover { color: var(--brand-ink); text-decoration: none; padding-left: 4px; transition: padding 0.12s; }

/* ── FAQ ────────────────────────────────────────────────── */
.faq { margin-top: 8px; }
.faq details { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 10px; background: var(--surface); overflow: hidden; }
.faq summary { cursor: pointer; padding: 15px 18px; font-weight: 600; font-family: var(--font-display); list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-family: var(--font-mono); font-size: 1.3rem; color: var(--brand); transition: transform 0.18s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq .faq-a { padding: 0 18px 16px; color: var(--ink-soft); }
.faq .faq-a p { margin: 0; }

/* ── Tool panel (interactive widgets) ───────────────────── */
.tool-panel {
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow); margin-bottom: 26px;
}
.tp-tabs { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 4px; gap: 4px; margin-bottom: 18px; flex-wrap: wrap; }
.tp-tab { border: none; background: transparent; color: var(--muted); font: inherit; font-weight: 500; font-size: 0.88rem; padding: 7px 14px; border-radius: 7px; cursor: pointer; }
.tp-tab.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

.field-row { display: flex; flex-wrap: wrap; gap: 14px; }
.field-stack { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 0.82rem; font-weight: 600; color: var(--ink-soft); flex: 1 1 160px; }
.field input[type="number"], .field input[type="text"], .field input[type="date"], .select {
  height: 46px; padding: 0 13px; border: 1px solid var(--border-strong); border-radius: 10px;
  background: var(--bg); color: var(--ink); font: inherit; font-weight: 500; font-size: 1rem; width: 100%;
}
.field input:focus, .select:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--ring); }
.field input[type="range"] { accent-color: var(--brand); height: 46px; }
.checkline { display: inline-flex; align-items: center; gap: 8px; font-size: 0.9rem; font-weight: 500; color: var(--ink-soft); cursor: pointer; }
.checkline input { width: 17px; height: 17px; accent-color: var(--brand); }

.tp-toolbar { display: flex; gap: 8px; margin: 14px 0; align-items: center; flex-wrap: wrap; }
.tp-toolbar.wrap { flex-wrap: wrap; }
.btn {
  font: inherit; font-weight: 600; font-size: 0.9rem; cursor: pointer;
  padding: 10px 16px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--ink); transition: background 0.12s, border-color 0.12s;
}
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-ink); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.tp-result {
  display: block; margin-top: 16px; padding: 20px; border-radius: 12px;
  background: var(--brand-wash); border: 1px solid color-mix(in srgb, var(--brand) 24%, transparent);
  font-family: var(--font-mono); font-size: clamp(1.3rem, 3.4vw, 1.9rem); font-weight: 700; color: var(--brand-ink);
  word-break: break-word; text-align: center; line-height: 1.3;
}
.tp-result.mono { font-size: 1.15rem; }
.tp-result small { display: block; font-family: var(--font-body); font-size: 0.8rem; font-weight: 500; color: var(--muted); margin-top: 6px; }

.tp-breakdown { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-top: 14px; }
.tp-breakdown .bd-item { background: var(--surface-2); border-radius: 10px; padding: 12px 14px; }
.tp-breakdown .bd-label { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.tp-breakdown .bd-value { font-family: var(--font-mono); font-weight: 700; font-size: 1.1rem; color: var(--ink); }

.tp-status { display: block; font-size: 0.85rem; margin: 8px 0; min-height: 1.2em; font-weight: 500; }
.tp-status.ok { color: var(--ok); }
.tp-status.err { color: var(--err); }
.tp-note { font-size: 0.85rem; color: var(--muted); margin-top: 12px; }

.code-area {
  width: 100%; min-height: 120px; resize: vertical; padding: 14px; border-radius: 10px;
  border: 1px solid var(--border-strong); background: var(--bg); color: var(--ink);
  font-family: var(--font-mono); font-size: 0.88rem; line-height: 1.5;
}
.code-area:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--ring); }
.code-area.tall { min-height: 200px; }
div.code-area { white-space: pre-wrap; overflow-y: auto; }

.select { max-width: 100%; }

/* stat grid (counters) */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 12px; margin-top: 16px; }
.stat { background: var(--surface-2); border-radius: 11px; padding: 14px; text-align: center; }
.stat .s-val { font-family: var(--font-mono); font-size: 1.5rem; font-weight: 700; color: var(--brand-ink); }
.stat .s-lab { font-size: 0.74rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 2px; }

/* dropzone */
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  padding: 34px 20px; border: 2px dashed var(--border-strong); border-radius: 12px; text-align: center;
  cursor: pointer; background: var(--bg); transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--brand); background: var(--brand-wash); }
.dz-title { font-weight: 600; color: var(--ink); }
.dz-sub { font-size: 0.82rem; color: var(--muted); }

/* file list */
.file-list { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.file-list li {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 10px; font-size: 0.88rem;
}
.file-list li .fl-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.file-list li .fl-size { font-family: var(--font-mono); font-size: 0.76rem; color: var(--muted); }
.file-list li .fl-drag { cursor: grab; color: var(--muted); font-family: var(--font-mono); }
.file-list li .fl-x { cursor: pointer; border: none; background: transparent; color: var(--muted); font-size: 1.1rem; padding: 0 4px; }
.file-list li .fl-x:hover { color: var(--err); }
.file-list li.dragging { opacity: 0.5; }

/* preview */
.preview-compare { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 16px; align-items: flex-start; }
.preview-compare figure { margin: 0; flex: 1 1 200px; }
.preview-compare img { max-width: 100%; border-radius: 10px; border: 1px solid var(--border); display: block; }
.preview-compare figcaption { font-size: 0.78rem; color: var(--muted); margin-top: 6px; font-family: var(--font-mono); }

.tp-results { display: flex; flex-direction: column; gap: 10px; margin: 8px 0; }
.hash-row { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; background: var(--surface-2); border-radius: 10px; }
.hash-row .hr-label { font-size: 0.72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.hash-row .hr-val { font-family: var(--font-mono); font-size: 0.8rem; word-break: break-all; color: var(--ink); }

/* toast */
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: var(--bg); padding: 11px 20px; border-radius: 10px; font-size: 0.88rem;
  font-weight: 600; box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; z-index: 100;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Static content page ────────────────────────────────── */
.page-body { max-width: 72ch; padding: 12px 0 48px; }
.page-body h1 { margin-bottom: 0.6em; }

/* ── Footer ─────────────────────────────────────────────── */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); margin-top: 40px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 30px; padding: 44px 0 30px; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr 1fr; gap: 24px; } }
@media (max-width: 460px) { .footer-grid { grid-template-columns: 1fr; } }
.footer-grid h4 { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 0 0 12px; font-family: var(--font-body); }
.footer-grid ul { list-style: none; margin: 0; padding: 0; }
.footer-grid li { margin-bottom: 8px; }
.footer-grid a { color: var(--ink-soft); font-size: 0.9rem; }
.footer-brand p { color: var(--muted); font-size: 0.9rem; max-width: 30ch; }
.footer-bottom { border-top: 1px solid var(--border); padding: 18px 0; display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; font-size: 0.82rem; color: var(--muted); }
.footer-disclosure { font-size: 0.78rem; color: var(--muted); max-width: 60ch; }

/* utility */
.center { text-align: center; }
.mt-0 { margin-top: 0; }
.muted { color: var(--muted); }

/* ═══════════════════════════════════════════════════════════
   PREMIUM PHASE 1 — command palette, favorites, value, polish
   ═══════════════════════════════════════════════════════════ */

/* ── ⌘K header trigger ── */
.cmdk-trigger {
  display: inline-flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 10px 0 11px;
  background: var(--surface-2); color: var(--muted);
  border: 1px solid var(--border); border-radius: 10px;
  font: inherit; font-size: 0.86rem; cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.cmdk-trigger:hover { border-color: var(--border-strong); color: var(--ink-soft); }
.cmdk-trigger .search-icon { display: inline-flex; }
.cmdk-trigger .search-icon svg { width: 16px; height: 16px; }
.cmdk-trigger-label { white-space: nowrap; }
.cmdk-trigger-kbd {
  display: inline-flex; align-items: center; gap: 1px;
  font-family: var(--font-mono); font-size: 0.72rem; line-height: 1;
  padding: 3px 6px; border-radius: 6px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--muted);
}
.cmdk-trigger-kbd .k-mod { font-size: 0.85em; }
@media (max-width: 760px) {
  .cmdk-trigger-label, .cmdk-trigger-kbd { display: none; }
  .cmdk-trigger { width: 38px; padding: 0; justify-content: center; }
}

/* ── Command palette overlay ── */
body.cmdk-open { overflow: hidden; }
.cmdk[hidden] { display: none; }
.cmdk {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 12vh 16px 16px;
}
.cmdk-backdrop {
  position: absolute; inset: 0;
  background: rgba(8, 10, 15, 0.55);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  animation: cmdk-fade .12s ease;
}
.cmdk-panel {
  position: relative; width: 100%; max-width: 580px;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 16px; box-shadow: var(--shadow-lg);
  overflow: hidden; animation: cmdk-pop .14s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes cmdk-fade { from { opacity: 0; } }
@keyframes cmdk-pop { from { opacity: 0; transform: translateY(-8px) scale(.98); } }
.cmdk-input {
  display: flex; align-items: center; gap: 10px;
  padding: 15px 16px; border-bottom: 1px solid var(--border);
}
.cmdk-input svg { width: 19px; height: 19px; color: var(--muted); flex: none; }
.cmdk-input input {
  flex: 1; border: 0; background: transparent; outline: none;
  font: inherit; font-size: 1.02rem; color: var(--ink);
}
.cmdk-input kbd {
  font-family: var(--font-mono); font-size: 0.7rem; color: var(--muted);
  padding: 3px 7px; border: 1px solid var(--border); border-radius: 6px;
}
.cmdk-list { max-height: 52vh; overflow-y: auto; padding: 8px; }
.cmdk-group {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); padding: 10px 10px 6px; font-weight: 600;
}
.cmdk-list a {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px; border-radius: 10px; text-decoration: none;
  color: var(--ink-soft);
}
.cmdk-list a.active { background: var(--brand-wash); color: var(--brand-ink); }
.cmdk-t { font-weight: 500; }
.cmdk-c { font-size: 0.8rem; color: var(--muted); flex: none; }
.cmdk-list a.active .cmdk-c { color: var(--brand-ink); }
.cmdk-empty { padding: 26px 12px; text-align: center; color: var(--muted); }
.cmdk-foot {
  display: flex; gap: 16px; align-items: center;
  padding: 9px 14px; border-top: 1px solid var(--border);
  font-size: 0.74rem; color: var(--muted);
}
.cmdk-foot kbd {
  font-family: var(--font-mono); font-size: 0.68rem;
  padding: 1px 5px; border: 1px solid var(--border); border-radius: 5px; margin-right: 2px;
}
.cmdk-foot span:last-child { margin-left: auto; }

/* ── Favorite / save button on tool pages ── */
.tool-head-row {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
}
.fav-btn {
  display: inline-flex; align-items: center; gap: 7px; flex: none;
  margin-top: 4px; padding: 8px 13px;
  background: var(--surface); color: var(--muted);
  border: 1px solid var(--border); border-radius: 10px;
  font: inherit; font-size: 0.85rem; font-weight: 500; cursor: pointer;
  transition: all .15s;
}
.fav-btn:hover { border-color: var(--border-strong); color: var(--ink-soft); }
.fav-btn .fav-star { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.fav-btn.is-fav { color: var(--brand-ink); border-color: var(--brand); background: var(--brand-wash); }
.fav-btn.is-fav .fav-star { fill: var(--brand); stroke: var(--brand); }

/* ── Value proposition section ── */
.value { padding: 20px 20px 40px; }
.value-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px;
}
.value-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px;
}
.value-ico {
  display: inline-flex; padding: 9px; border-radius: 10px;
  background: var(--brand-wash); color: var(--brand-ink); margin-bottom: 12px;
}
.value-ico svg { width: 20px; height: 20px; }
.value-item h3 { font-size: 1.02rem; margin: 0 0 6px; }
.value-item p { color: var(--muted); font-size: 0.92rem; line-height: 1.6; margin: 0; }
@media (max-width: 860px) { .value-grid { grid-template-columns: 1fr; } }

/* ── Polish: smoother interactions ── */
.tool-card, .cat-card { transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease; }
.tool-card:hover, .cat-card:hover { transform: translateY(-2px); }
.category-intro { margin: 4px 0 8px; }
.category-body { margin-top: 26px; }
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ═══════════ PHASE 2 — new tool UIs ═══════════ */
.tp-note { font-size: .82rem; color: var(--muted); margin: 4px 0 2px; font-weight: 500; }
input[type="range"] { width: 100%; accent-color: var(--brand); height: 6px; }

/* Tip quick buttons active */
#tipQuick .btn { flex: 1; }

/* GPA */
.gpa-head, .gpa-row { display: grid; grid-template-columns: 1fr 90px 80px 34px; gap: 8px; align-items: center; }
.gpa-head { font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 0 2px 4px; }
.gpa-row { margin-bottom: 8px; }
.gpa-row input, .gpa-row select { width: 100%; }
.gpa-x { border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); border-radius: 8px; height: 36px; cursor: pointer; font-size: 1.1rem; }
.gpa-x:hover { color: var(--err); border-color: var(--err); }

/* Password generator */
.pg-out-row { display: flex; gap: 8px; }
.pg-out { flex: 1; font-family: var(--font-mono); font-size: 1.05rem; letter-spacing: .02em;
  padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); color: var(--ink); }
.pg-strength { height: 6px; background: var(--surface-2); border-radius: 4px; overflow: hidden; margin: 10px 0 4px; }
.pg-strength-bar { height: 100%; width: 0; background: var(--muted); transition: width .2s, background .2s; }

/* QR */
.qr-stage { display: flex; justify-content: center; padding: 20px; background: var(--surface-2); border-radius: var(--radius); margin-top: 12px; min-height: 80px; }
.qr-stage img, .qr-stage canvas { border-radius: 8px; background: #fff; padding: 8px; }

/* Color converter */
.cc-row { display: flex; gap: 12px; align-items: flex-end; }
.cc-picker { width: 52px; height: 46px; border: 1px solid var(--border); border-radius: 10px; background: none; cursor: pointer; padding: 3px; }
.cc-swatch { height: 64px; border-radius: var(--radius); border: 1px solid var(--border); margin: 12px 0; }
.cc-line { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.cc-line:last-child { border-bottom: 0; }
.cc-label { width: 44px; font-size: .8rem; color: var(--muted); font-weight: 600; }
.cc-val { flex: 1; font-family: var(--font-mono); font-size: .95rem; color: var(--ink); }

/* Text diff */
.diff-inputs textarea { width: 100%; font-family: var(--font-mono); font-size: .88rem; }
.diff-out { margin-top: 12px; font-family: var(--font-mono); font-size: .85rem; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.diff-out > div { padding: 2px 10px; white-space: pre-wrap; word-break: break-word; }
.d-eq { color: var(--ink-soft); }
.d-add { background: rgba(14,159,110,.12); color: var(--ok); }
.d-del { background: rgba(220,38,38,.1); color: var(--err); }
.d-sign { display: inline-block; width: 14px; opacity: .7; user-select: none; }
.d-summary { display: flex; gap: 16px; padding: 8px 10px !important; background: var(--surface-2); font-weight: 600; }
.d-add-c { color: var(--ok); } .d-del-c { color: var(--err); }

/* Character limit bars */
.limit-bars { margin-top: 14px; display: grid; gap: 12px; }
.limit-bar .lb-head { display: flex; justify-content: space-between; font-size: .82rem; color: var(--muted); margin-bottom: 4px; }
.lb-track { height: 7px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.lb-fill { height: 100%; background: var(--brand); transition: width .15s; }
.limit-bar.over .lb-fill { background: var(--err); }
.limit-bar.over .lb-head { color: var(--err); }

/* Image cropper */
.crop-stage { position: relative; display: inline-block; max-width: 100%; margin: 12px 0; line-height: 0; touch-action: none; }
.crop-stage img { max-width: 100%; max-height: 460px; display: block; user-select: none; -webkit-user-drag: none; }
.crop-box { position: absolute; border: 2px solid var(--brand); box-shadow: 0 0 0 9999px rgba(8,10,15,.45); cursor: move; touch-action: none; }
.crop-handle { position: absolute; right: -8px; bottom: -8px; width: 16px; height: 16px; background: var(--brand); border: 2px solid #fff; border-radius: 50%; cursor: nwse-resize; touch-action: none; }

/* Format converter preview */
.fmt-preview { margin-top: 12px; }
.fmt-preview figure { margin: 0; text-align: center; }
.fmt-preview img { max-width: 100%; max-height: 360px; border-radius: 10px; border: 1px solid var(--border); }
.fmt-preview figcaption { color: var(--muted); font-size: .85rem; margin-top: 8px; }

@media (max-width: 560px) {
  .gpa-head, .gpa-row { grid-template-columns: 1fr 76px 60px 32px; }
  .cc-row { flex-wrap: wrap; }
}

/* ═══════════════════════════════════════════════════════════
   PREMIUM PHASE 3 — Guides / blog
   ═══════════════════════════════════════════════════════════ */

/* ── Guides hero ── */
.guides-hero { padding: 40px 20px 8px; }
.guides-hero .eyebrow { display: inline-flex; align-items: center; gap: 6px; }
.guides-hero .eyebrow svg { width: 15px; height: 15px; }
.guides-hero h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin: 12px 0 10px; }

/* ── Guide card grid ── */
.guide-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px;
}
@media (max-width: 900px) { .guide-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .guide-grid { grid-template-columns: 1fr; } }
.guide-card {
  display: flex; flex-direction: column; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; text-decoration: none;
  color: var(--ink); transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.guide-card:hover { transform: translateY(-2px); border-color: var(--brand); box-shadow: var(--shadow); }
.gc-cat {
  align-self: flex-start; font-size: 0.72rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em;
  color: var(--brand-ink); background: var(--brand-wash);
  padding: 3px 9px; border-radius: 999px;
}
.gc-title { font-size: 1.08rem; line-height: 1.3; margin: 2px 0 0; }
.gc-excerpt { color: var(--muted); font-size: 0.9rem; line-height: 1.55; margin: 0; flex: 1; }
.gc-meta { font-size: 0.8rem; color: var(--muted); margin-top: 4px; }

/* ── Guide article ── */
.guide-article { max-width: 760px; }
.guide-head { padding: 8px 0 6px; }
.guide-head h1 { font-size: clamp(1.6rem, 3.6vw, 2.3rem); line-height: 1.2; margin: 12px 0 8px; }
.guide-byline { color: var(--muted); font-size: 0.9rem; margin: 0; }
.guide-article .prose { margin-top: 20px; }
.guide-article .prose h2 { margin-top: 34px; }
.guide-article .prose code {
  font-family: var(--font-mono); font-size: 0.9em;
  background: var(--surface-2); padding: 2px 6px; border-radius: 6px;
}
.guide-article .prose p code { white-space: nowrap; }

/* ── Tools CTA inside a guide ── */
.guide-cta {
  margin: 34px 0 8px; padding: 22px;
  background: var(--brand-wash); border: 1px solid var(--border);
  border-radius: var(--radius);
}
.guide-cta h2 { margin: 0 0 4px; font-size: 1.15rem; }
.guide-cta > p { color: var(--ink-soft); margin: 0 0 14px; font-size: 0.94rem; }
.cta-tools { display: grid; gap: 10px; }
.cta-tool {
  display: flex; flex-direction: column; gap: 2px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 14px; text-decoration: none;
  transition: border-color .15s, transform .15s;
}
.cta-tool:hover { border-color: var(--brand); transform: translateX(2px); }
.ct-title { font-weight: 600; color: var(--brand-ink); }
.ct-desc { font-size: 0.85rem; color: var(--muted); }

.related-guides { margin-top: 20px; }

/* ═══════════════════════════════════════════════════════════
   TOP BANNER — Amcon Ceylon attribution
   ═══════════════════════════════════════════════════════════ */
.topbar {
  background: linear-gradient(90deg, var(--brand), var(--brand-ink));
  color: #fff;
  font-size: 0.82rem;
}
.topbar-inner {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  padding: 7px 20px; flex-wrap: wrap;
}
.topbar-text { opacity: 0.96; }
.topbar-text a { color: #fff; text-decoration: none; }
.topbar-text a:hover { text-decoration: underline; }
.topbar-text strong { font-weight: 600; }
.topbar-link {
  color: #fff; text-decoration: none; font-weight: 500;
  padding: 2px 10px; border: 1px solid rgba(255,255,255,.45);
  border-radius: 999px; white-space: nowrap; transition: background .15s;
}
.topbar-link:hover { background: rgba(255,255,255,.15); }
@media (max-width: 560px) { .topbar-link { display: none; } }

.footer-parent { margin-top: 8px; font-size: 0.85rem; color: var(--muted); }
.footer-parent a { color: var(--brand-ink); text-decoration: none; font-weight: 500; }
.footer-parent a:hover { text-decoration: underline; }

/* ═══════════════════════════════════════════════════════════
   HOMEPAGE REDESIGN — hero visual, category explorer, promo
   ═══════════════════════════════════════════════════════════ */

/* ── Hero two-column ── */
.hero-grid {
  display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 40px; align-items: center;
}
.hero-copy h1 { margin-top: 10px; }
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; gap: 8px; }
  .hero-visual { display: none; }
}

/* ── Animated hero visual (floating tool tiles) ── */
.hero-visual {
  position: relative; min-height: 320px;
  display: grid; place-items: center;
}
.hv-ring {
  position: absolute; border-radius: 50%; border: 1.5px dashed var(--border-strong);
  opacity: 0.55;
}
.hv-ring-1 { width: 300px; height: 300px; animation: hvSpin 40s linear infinite; }
.hv-ring-2 { width: 210px; height: 210px; border-style: dotted; animation: hvSpin 28s linear infinite reverse; }
@keyframes hvSpin { to { transform: rotate(360deg); } }

.hv-grid {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
}
.hv-tile {
  display: grid; place-items: center;
  width: 74px; height: 74px; border-radius: 18px;
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow);
  color: var(--brand-ink);
  animation: hvFloat 3.6s ease-in-out infinite;
  animation-delay: var(--d);
}
.hv-tile svg { width: 30px; height: 30px; }
.hv-tile:nth-child(even) { color: var(--accent); }
@keyframes hvFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-9px); }
}
.hv-spark {
  position: absolute; z-index: 2; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  display: grid; place-items: center;
  width: 56px; height: 56px; border-radius: 16px;
  background: linear-gradient(135deg, var(--brand), var(--brand-ink));
  color: #fff; box-shadow: var(--shadow-lg);
  animation: hvPulse 3s ease-in-out infinite;
}
.hv-spark svg { width: 26px; height: 26px; }
@keyframes hvPulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.08); }
}

/* ── Category explorer (hover to reveal tools) ── */
.cat-hint { color: var(--muted); font-size: 0.9rem; margin: -6px 0 16px; }
.cat-explore {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px;
}
.cat-widget {
  position: relative;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  transition: border-color .16s, box-shadow .16s, transform .16s;
}
.cat-widget:hover, .cat-widget:focus-within {
  border-color: var(--brand); box-shadow: var(--shadow-lg); z-index: 20;
}
.cw-head {
  display: flex; align-items: center; gap: 12px;
  padding: 18px; text-decoration: none; color: var(--ink);
}
.cw-head .cat-ico {
  display: grid; place-items: center; flex: none;
  width: 42px; height: 42px; border-radius: 11px;
  background: var(--brand-wash); color: var(--brand-ink);
}
.cw-head .cat-ico svg { width: 22px; height: 22px; }
.cw-meta { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.cw-name { font-family: var(--font-display); font-weight: 600; font-size: 1.02rem; }
.cat-count { font-size: 0.8rem; color: var(--muted); }
.cw-chev {
  font-size: 1.4rem; color: var(--muted); line-height: 1;
  transition: transform .18s;
}
.cat-widget:hover .cw-chev, .cat-widget:focus-within .cw-chev { transform: rotate(90deg); color: var(--brand); }

/* the reveal panel — overlay so it doesn't push the grid around */
.cw-panel {
  position: absolute; left: 0; right: 0; top: 100%;
  background: var(--surface); border: 1px solid var(--brand);
  border-top: none; border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 6px 8px 12px;
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity .16s, transform .16s, visibility .16s;
  max-height: 320px; overflow-y: auto;
}
.cat-widget:hover .cw-panel, .cat-widget:focus-within .cw-panel {
  opacity: 1; visibility: visible; transform: translateY(0);
}
.cw-tools { list-style: none; margin: 0; padding: 0; }
.cw-tools li a {
  display: block; padding: 8px 12px; border-radius: 8px;
  text-decoration: none; color: var(--ink-soft); font-size: 0.9rem;
  transition: background .12s, color .12s;
}
.cw-tools li a:hover { background: var(--brand-wash); color: var(--brand-ink); }
.cw-all {
  display: block; margin: 6px 12px 2px; padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 0.85rem; font-weight: 600; color: var(--brand-ink); text-decoration: none;
}
.cw-all:hover { text-decoration: underline; }

/* touch / small screens: no hover — show tools inline, single column */
@media (max-width: 720px) {
  .cat-explore { grid-template-columns: 1fr; }
  .cw-panel {
    position: static; opacity: 1; visibility: visible; transform: none;
    border: none; border-top: 1px solid var(--border); border-radius: 0;
    box-shadow: none; max-height: none;
  }
  .cw-chev { display: none; }
  .cat-widget:hover, .cat-widget:focus-within { box-shadow: var(--shadow); }
}

/* ── Amcon Ceylon promo banner ── */
.promo-amcon { margin: 30px auto; }
.promo-card {
  display: flex; align-items: center; gap: 28px;
  padding: 30px 34px; border-radius: var(--radius);
  background: linear-gradient(115deg, #4f46e5 0%, #4038c7 55%, #0891b2 130%);
  color: #fff; text-decoration: none; overflow: hidden; position: relative;
  box-shadow: var(--shadow-lg);
  transition: transform .18s ease;
}
.promo-card:hover { transform: translateY(-2px); }
.promo-body { flex: 1; }
.promo-eyebrow {
  display: inline-block; font-size: 0.75rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .08em;
  padding: 4px 10px; border-radius: 999px;
  background: rgba(255,255,255,.16); margin-bottom: 12px;
}
.promo-body h2 { color: #fff; font-size: clamp(1.2rem, 2.4vw, 1.6rem); margin: 0 0 8px; }
.promo-body p { color: rgba(255,255,255,.9); margin: 0 0 16px; max-width: 62ch; line-height: 1.6; }
.promo-body p strong { color: #fff; }
.promo-cta {
  display: inline-block; font-weight: 600;
  padding: 10px 20px; border-radius: 10px;
  background: #fff; color: var(--brand-ink);
}
.promo-visual { flex: none; }
.promo-mark {
  display: grid; place-items: center;
  width: 92px; height: 92px; border-radius: 22px;
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.28);
}
.promo-mark svg { width: 46px; height: 46px; color: #fff; }
@media (max-width: 680px) {
  .promo-card { flex-direction: column-reverse; text-align: center; align-items: center; padding: 26px 22px; }
  .promo-body p { margin-left: auto; margin-right: auto; }
}
