/* ===========================================================
   NechVibes — shared stylesheet
   Direction: daylight instrument panel
   =========================================================== */

:root {
  --ink: #14161c;
  --ink-2: #5a6172;
  --ink-3: #858c9c;
  --paper: #f1f4f9;
  --surface: #ffffff;
  --line: #dce2ec;
  --line-soft: #e9edf4;

  --accent: #2b44ff;
  --accent-ink: #1b2ecc;
  --accent-tint: #e8ebff;

  --calc: #e08a00;
  --calc-tint: #fdf2df;
  --conv: #0e9c79;
  --conv-tint: #e2f5ef;
  --text: #7333ee;
  --text-tint: #efe7fd;

  --ok: #0e9c79;
  --warn: #c2410c;

  --r-card: 14px;
  --r-input: 10px;
  --r-pill: 999px;

  --shadow-hover: 0 8px 24px -12px rgba(20, 22, 28, .28);
  --measure: 68ch;

  --font-display: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Consolas, monospace;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--accent-ink); text-underline-offset: 3px; }
a:hover { color: var(--accent); }

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

h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: 1.18;
  letter-spacing: -.02em;
  margin: 0 0 .5em;
  font-weight: 600;
}
h1 { font-size: clamp(1.85rem, 1.3rem + 2.2vw, 2.75rem); }
h2 { font-size: clamp(1.35rem, 1.1rem + 1.1vw, 1.75rem); margin-top: 2.2rem; }
h3 { font-size: 1.15rem; margin-top: 1.6rem; }

p { margin: 0 0 1rem; max-width: var(--measure); }
ul, ol { max-width: var(--measure); padding-left: 1.15rem; }
li { margin-bottom: .4rem; }

code, kbd, samp { font-family: var(--font-mono); font-size: .92em; }
:not(pre) > code {
  background: var(--line-soft);
  padding: .12em .38em;
  border-radius: 5px;
}

.wrap { width: min(1160px, calc(100% - 2.5rem)); margin-inline: auto; }
.wrap-narrow { width: min(760px, calc(100% - 2.5rem)); margin-inline: auto; }
.skip {
  position: absolute; left: -9999px; top: 0; background: var(--ink); color: #fff;
  padding: .7rem 1.1rem; z-index: 100; border-radius: 0 0 8px 0;
}
.skip:focus { left: 0; }

/* ---------- Header ---------- */
.site-head {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 40;
}
.head-row {
  display: flex; align-items: center; gap: 1.5rem;
  min-height: 62px;
}
.logo {
  font-family: var(--font-display);
  font-weight: 700; font-size: 1.22rem; letter-spacing: -.03em;
  color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: .1rem;
}
.logo span { color: var(--accent); }

.nav { margin-left: auto; display: flex; align-items: center; gap: .3rem; }
.nav a {
  color: var(--ink-2); text-decoration: none;
  font-size: .95rem; font-weight: 500;
  padding: .65rem .8rem; border-radius: var(--r-pill);
  min-height: 44px; display: inline-flex; align-items: center;
}
.nav a:hover { background: var(--paper); color: var(--ink); }
.nav a[aria-current="page"] { color: var(--accent-ink); background: var(--accent-tint); }

.nav-toggle {
  margin-left: auto; display: none;
  min-width: 44px; min-height: 44px;
  background: none; border: 1px solid var(--line); border-radius: var(--r-input);
  font-size: 1.25rem; cursor: pointer; color: var(--ink);
}
@media (max-width: 760px) {
  .nav-toggle { display: block; }
  .nav {
    display: none; position: absolute; left: 0; right: 0; top: 100%;
    background: var(--surface); border-bottom: 1px solid var(--line);
    flex-direction: column; align-items: stretch; padding: .5rem 1.25rem 1rem;
  }
  .nav.open { display: flex; }
  .nav a { border-radius: var(--r-input); }
}

/* ---------- Hero ---------- */
.hero {
  padding: clamp(2.5rem, 6vw, 4.5rem) 0 2.5rem;
  background:
    radial-gradient(circle at 1px 1px, #cfd7e6 1px, transparent 0) 0 0 / 26px 26px,
    var(--paper);
  border-bottom: 1px solid var(--line);
}
.hero-inner { text-align: center; }
.hero h1 { margin-bottom: .55rem; }
.hero .lede {
  color: var(--ink-2); font-size: 1.08rem;
  margin-inline: auto; max-width: 56ch;
}

/* ---------- Quick answer bar (signature) ---------- */
.qa {
  margin: 1.9rem auto 0;
  max-width: 660px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 10px 30px -20px rgba(20, 22, 28, .5);
  overflow: hidden;
  text-align: left;
}
.qa-row { display: flex; align-items: center; gap: .5rem; padding: .45rem .5rem .45rem 1rem; }
.qa-row svg { flex: none; color: var(--ink-3); }
#qa-input {
  flex: 1; border: 0; background: none; outline: none;
  font-family: var(--font-body); font-size: 1.05rem; color: var(--ink);
  padding: .75rem 0; min-width: 0;
}
#qa-input::placeholder { color: var(--ink-3); }
.qa-clear {
  border: 0; background: var(--paper); color: var(--ink-2);
  width: 34px; height: 34px; border-radius: 50%; cursor: pointer;
  font-size: 1rem; line-height: 1; display: none;
}
.qa-clear.show { display: block; }
.qa-out { border-top: 1px solid var(--line-soft); padding: .9rem 1rem; display: none; }
.qa-out.show { display: block; }
.qa-answer {
  font-family: var(--font-mono); font-size: 1.4rem; font-weight: 500;
  color: var(--ink); word-break: break-word;
}
.qa-note { font-size: .86rem; color: var(--ink-2); margin: .3rem 0 0; }
.qa-hits { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .1rem; }
.qa-hits a {
  font-size: .88rem; text-decoration: none; color: var(--ink);
  background: var(--paper); border: 1px solid var(--line);
  padding: .4rem .7rem; border-radius: var(--r-pill);
}
.qa-hits a:hover { border-color: var(--accent); color: var(--accent-ink); }
.qa-hint { font-size: .84rem; color: var(--ink-3); margin: .8rem 0 0; text-align: center; }
.qa-hint b { font-family: var(--font-mono); font-weight: 400; color: var(--ink-2); }

/* ---------- Category tabs ---------- */
.tabs {
  display: flex; gap: .4rem; flex-wrap: wrap; justify-content: center;
  margin: 2.4rem 0 1.6rem;
}
.tab {
  font-family: var(--font-body); font-size: .95rem; font-weight: 500;
  background: var(--surface); color: var(--ink-2);
  border: 1px solid var(--line); border-radius: var(--r-pill);
  padding: .6rem 1.1rem; min-height: 44px; cursor: pointer;
}
.tab:hover { color: var(--ink); border-color: var(--ink-3); }
.tab[aria-selected="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }

/* ---------- Tool grid ---------- */
.grid {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(255px, 1fr));
  padding: 0; margin: 0 0 3rem; list-style: none;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 1.15rem 1.15rem 1.25rem;
  text-decoration: none; color: inherit;
  display: flex; flex-direction: column;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); border-color: var(--ink-3); color: inherit; }
.card .ic {
  width: 38px; height: 38px; border-radius: 10px;
  display: grid; place-items: center; margin-bottom: .8rem;
  font-family: var(--font-mono); font-size: .92rem; font-weight: 600;
}
.card h3 { font-size: 1.03rem; margin: 0 0 .3rem; }
.card p { font-size: .9rem; color: var(--ink-2); margin: 0; line-height: 1.5; }

.card[data-cat="calculators"] .ic { background: var(--calc-tint); color: #8a5400; }
.card[data-cat="converters"] .ic { background: var(--conv-tint); color: #06614a; }
.card[data-cat="text-tools"] .ic { background: var(--text-tint); color: #4b1aa5; }

.grid-empty {
  grid-column: 1 / -1; text-align: center; color: var(--ink-2);
  padding: 2.5rem 1rem; border: 1px dashed var(--line); border-radius: var(--r-card);
}

/* ---------- Page shell (tool + article pages) ---------- */
.page { padding: 1.6rem 0 3.5rem; }
.crumbs { font-size: .88rem; color: var(--ink-2); margin-bottom: 1.1rem; }
.crumbs a { color: var(--ink-2); text-decoration: none; }
.crumbs a:hover { color: var(--accent-ink); text-decoration: underline; }
.crumbs span { color: var(--ink-3); margin: 0 .35rem; }

.eyebrow {
  display: inline-block; font-family: var(--font-mono);
  font-size: .78rem; letter-spacing: .08em; text-transform: uppercase;
  padding: .3rem .6rem; border-radius: 6px; margin-bottom: .7rem;
}
.eyebrow.calculators { background: var(--calc-tint); color: #8a5400; }
.eyebrow.converters { background: var(--conv-tint); color: #06614a; }
.eyebrow.text-tools { background: var(--text-tint); color: #4b1aa5; }

.summary {
  font-size: 1.08rem; color: var(--ink-2);
  max-width: var(--measure); margin-bottom: 1.8rem;
}

/* ---------- Tool panel ---------- */
.tool {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.4rem;
  margin-bottom: 2.2rem;
}
@media (min-width: 720px) { .tool { padding: 1.75rem; } }

.field { margin-bottom: 1rem; }
.field label, .lbl {
  display: block; font-size: .9rem; font-weight: 600;
  color: var(--ink); margin-bottom: .35rem;
}
.hint { font-size: .84rem; color: var(--ink-2); margin: .3rem 0 0; }

input[type="text"], input[type="number"], input[type="date"], input[type="time"],
select, textarea {
  width: 100%; font-family: var(--font-body); font-size: 1rem;
  color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-input);
  padding: .7rem .85rem; min-height: 46px;
}
input[type="number"], input.mono, .mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
textarea { min-height: 190px; resize: vertical; line-height: 1.55; font-family: var(--font-mono); font-size: .95rem; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint);
}
input[aria-invalid="true"] { border-color: var(--warn); }

.row { display: grid; gap: 1rem; }
@media (min-width: 620px) {
  .row-2 { grid-template-columns: 1fr 1fr; }
  .row-3 { grid-template-columns: repeat(3, 1fr); }
}

.btns { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .3rem; }
.btn {
  font-family: var(--font-body); font-size: .97rem; font-weight: 600;
  border-radius: var(--r-pill); padding: .7rem 1.35rem;
  min-height: 46px; cursor: pointer; border: 1px solid transparent;
  display: inline-flex; align-items: center; gap: .4rem;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-ink); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--ink-3); }

.err { color: var(--warn); font-size: .9rem; margin: .5rem 0 0; min-height: 1.2em; }

/* ---------- Results ---------- */
.result {
  margin-top: 1.3rem; padding: 1.15rem;
  background: var(--paper); border: 1px solid var(--line-soft);
  border-radius: 12px;
}
.result .lbl { color: var(--ink-2); font-weight: 500; font-size: .84rem; letter-spacing: .04em; text-transform: uppercase; }
.result .big {
  font-family: var(--font-mono); font-variant-numeric: tabular-nums;
  font-size: clamp(1.6rem, 1.2rem + 2vw, 2.3rem); font-weight: 600;
  color: var(--ink); word-break: break-word; line-height: 1.2;
}
.result .sub { font-size: .95rem; color: var(--ink-2); margin: .5rem 0 0; }

.stats { display: grid; gap: .7rem; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.stat {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: .8rem .9rem;
}
.stat b {
  display: block; font-family: var(--font-mono); font-variant-numeric: tabular-nums;
  font-size: 1.45rem; font-weight: 600; line-height: 1.15;
}
.stat span { font-size: .82rem; color: var(--ink-2); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; margin: 1.2rem 0 1.6rem; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; font-size: .95rem; min-width: 420px; }
caption { text-align: left; font-size: .88rem; color: var(--ink-2); padding-bottom: .55rem; }
th, td { text-align: left; padding: .62rem .8rem; border-bottom: 1px solid var(--line); }
th { font-family: var(--font-display); font-weight: 600; font-size: .9rem; background: var(--surface); }
tbody tr:nth-child(odd) { background: var(--surface); }
td.num, th.num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ---------- Callout ---------- */
.note {
  border-left: 3px solid var(--accent); background: var(--surface);
  padding: .95rem 1.1rem; border-radius: 0 10px 10px 0; margin: 1.3rem 0;
}
.note p:last-child { margin-bottom: 0; }
.note.warn { border-left-color: var(--warn); }

/* ---------- FAQ ---------- */
.faq { border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
  cursor: pointer; padding: .95rem 0; font-weight: 600;
  font-family: var(--font-display); font-size: 1.02rem; list-style: none;
  display: flex; justify-content: space-between; gap: 1rem; align-items: center;
  min-height: 44px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-family: var(--font-mono); color: var(--accent); font-size: 1.3rem; }
.faq details[open] summary::after { content: "\2013"; }
.faq details > *:not(summary) { margin-bottom: 1rem; }

/* ---------- Related ---------- */
.related { margin-top: 2.6rem; padding-top: 1.6rem; border-top: 1px solid var(--line); }
.related ul { list-style: none; padding: 0; display: grid; gap: .6rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); max-width: none; }
.related a {
  display: block; background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: .8rem .95rem; text-decoration: none; color: var(--ink);
  font-size: .95rem; font-weight: 500;
}
.related a:hover { border-color: var(--accent); color: var(--accent-ink); }

/* ---------- CTA band ---------- */
.cta-band {
  background: var(--accent-tint); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  padding: 1.8rem 0;
}
.cta-inner {
  display: flex; flex-wrap: wrap; gap: 1rem 1.6rem; align-items: center; justify-content: space-between;
}
.cta-inner h2 { margin: 0 0 .2rem; font-size: 1.15rem; }
.cta-inner p { margin: 0; color: var(--ink-2); font-size: .95rem; }
.cta-copy { max-width: 46ch; }

/* ---------- Footer ---------- */
.site-foot {
  background: var(--surface); border-top: 1px solid var(--line);
  padding: 2.4rem 0 1.4rem; margin-top: auto;
  font-size: .9rem; color: var(--ink-2);
}
.foot-grid {
  display: grid; gap: 1.8rem;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  padding-bottom: 1.8rem; border-bottom: 1px solid var(--line-soft);
}
@media (max-width: 760px) { .foot-grid { grid-template-columns: 1fr 1fr; } }
.foot-col h4 {
  font-family: var(--font-display); font-size: .82rem; letter-spacing: .04em; text-transform: uppercase;
  color: var(--ink); margin: 0 0 .8rem;
}
.foot-col ul { list-style: none; padding: 0; margin: 0; max-width: none; }
.foot-col li { margin-bottom: .55rem; }
.foot-col a { color: var(--ink-2); text-decoration: none; }
.foot-col a:hover { color: var(--accent-ink); text-decoration: underline; }
.foot-brand .logo { margin-bottom: .6rem; }
.foot-brand p { font-size: .88rem; max-width: 34ch; }
.foot-row { display: flex; flex-wrap: wrap; gap: .8rem 1.4rem; align-items: center; justify-content: space-between; padding-top: 1.4rem; }
.foot-links { display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; }
.foot-links a { color: var(--ink-2); text-decoration: none; }
.foot-links a:hover { color: var(--accent-ink); text-decoration: underline; }
.foot-links button.linklike {
  font: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer;
  color: var(--ink-2); text-decoration: none;
}
.foot-links button.linklike:hover { color: var(--accent-ink); text-decoration: underline; }

/* ---------- Cookie consent ---------- */
.cookie-banner {
  position: fixed; right: 1.2rem; bottom: 1.2rem; z-index: 200;
  width: min(360px, calc(100% - 2.4rem));
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card);
  box-shadow: var(--shadow-hover); padding: 1.2rem 1.3rem;
}
.cookie-banner[hidden] { display: none; }
.cookie-banner h2 { font-size: 1rem; margin: 0 0 .45rem; }
.cookie-banner p { font-size: .88rem; color: var(--ink-2); margin: 0 0 1rem; }
.cookie-banner p a { color: var(--ink-2); text-decoration: underline; }
.cookie-banner .btns { margin: 0; flex-wrap: wrap; }
.cookie-banner .btn { padding: .6rem 1.05rem; min-height: 40px; font-size: .9rem; }
@media (max-width: 480px) {
  .cookie-banner { left: .6rem; right: .6rem; bottom: .6rem; width: auto; }
}

body { display: flex; flex-direction: column; min-height: 100vh; }
main { flex: 1; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 14px);
  background: var(--ink); color: #fff; font-size: .92rem;
  padding: .65rem 1.1rem; border-radius: var(--r-pill);
  opacity: 0; pointer-events: none; transition: opacity .18s ease, transform .18s ease;
  z-index: 90;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
