/* ===================================================================
   BasitBuilds — shared stylesheet (modern light theme)
   Mobile-first, responsive (320px–1920px), accessible (WCAG-aware).
   =================================================================== */

/* ---- Design tokens ---- */
:root {
  --bg: #f6f7fb;
  --bg-soft: #eef1f8;
  --surface: #ffffff;
  --surface-2: #f3f5fb;
  --border: #e4e7f0;
  --border-strong: #d3d8e6;

  --text: #111827;          /* slate-900 ~ contrast 16:1 on white */
  --text-muted: #5b6473;    /* ~ 5.4:1 on white */
  --text-dim: #8a93a3;

  --brand: #6366f1;         /* indigo-500 */
  --brand-2: #8b5cf6;       /* violet-500 */
  --brand-ink: #4338ca;     /* indigo-700, for text/links ~ 7:1 */
  --accent: #0ea5e9;        /* sky-500 */
  --on-brand: #ffffff;

  --ok: #047857;
  --error: #b91c1c;
  --focus: #4338ca;

  --grad: linear-gradient(135deg, #6366f1 0%, #8b5cf6 55%, #a855f7 100%);
  --grad-soft: linear-gradient(135deg, #eef2ff 0%, #f5f3ff 100%);

  --radius: 16px;
  --radius-sm: 10px;
  --radius-pill: 999px;
  --maxw: 1080px;
  --tap: 44px;
  --gap: 16px;
  --shadow-sm: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  --shadow: 0 4px 12px rgba(16,24,40,.08), 0 2px 4px rgba(16,24,40,.05);
  --shadow-lg: 0 12px 32px rgba(79,70,229,.12), 0 4px 12px rgba(16,24,40,.08);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ---- Reset / base ---- */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 100%; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
}
img, svg, canvas { max-width: 100%; height: auto; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -0.02em; font-weight: 800; }
h1 { font-size: clamp(1.75rem, 4.5vw, 2.6rem); }
h2 { font-size: clamp(1.25rem, 3vw, 1.6rem); }
h3 { font-size: 1.05rem; font-weight: 700; }
p { margin: 0 0 1em; }
a { color: var(--brand-ink); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Skip link ---- */
.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--brand); color: var(--on-brand);
  padding: 10px 16px; border-radius: 0 0 var(--radius-sm) 0; z-index: 1000;
}
.skip-link:focus { left: 0; }

/* ---- Focus ---- */
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: var(--radius-sm); }

/* ---- Layout ---- */
.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
main { padding: 28px 0 56px; }
.section { margin-bottom: 40px; }

/* ---- Header ---- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.82);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.site-header .container {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--gap); min-height: 64px;
}
.brand {
  font-weight: 900; font-size: 1.3rem; letter-spacing: -0.03em;
  color: var(--text); text-decoration: none; display: inline-flex; align-items: center; gap: 9px;
}
.brand:hover { text-decoration: none; }
.brand .logo-mark {
  width: 30px; height: 30px; border-radius: 9px; flex: 0 0 auto;
  background: var(--grad); box-shadow: var(--shadow-sm);
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1rem;
  -webkit-text-fill-color: #fff;
  -webkit-background-clip: border-box; background-clip: border-box;
}
.brand span {
  background: var(--grad); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: var(--brand-ink);
}

.nav-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: var(--tap); min-height: var(--tap);
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); color: var(--text); cursor: pointer; font-size: 1.2rem;
}
.nav-list { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; flex-wrap: wrap; }
.nav-list a {
  display: inline-flex; align-items: center; min-height: var(--tap);
  padding: 0 14px; color: var(--text); text-decoration: none;
  border-radius: var(--radius-sm); font-weight: 600; font-size: .95rem;
}
.nav-list a:hover { background: var(--surface-2); color: var(--brand-ink); text-decoration: none; }

@media (max-width: 640px) {
  .nav-toggle { display: inline-flex; }
  #primary-nav { display: none; width: 100%; order: 3; padding-bottom: 10px; }
  #primary-nav.open { display: block; }
  .nav-list { flex-direction: column; gap: 2px; }
  .nav-list a { width: 100%; }
}
@media (min-width: 641px) {
  .nav-toggle { display: none; }
  #primary-nav { display: block !important; }
}

/* ---- Hero ---- */
.hero {
  position: relative;
  background: var(--grad-soft);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: clamp(28px, 5vw, 56px);
  margin: 28px 0 40px;
  overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; right: -60px; top: -60px;
  width: 240px; height: 240px; border-radius: 50%;
  background: radial-gradient(circle at center, rgba(139,92,246,.25), transparent 70%);
  pointer-events: none;
}
.hero .eyebrow {
  display: inline-block; font-size: .78rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--brand-ink);
  background: #fff; border: 1px solid var(--border);
  padding: 6px 12px; border-radius: var(--radius-pill); margin-bottom: 16px;
}
.hero h1 { margin: 0 0 .35em; max-width: 16ch; }
.hero h1 .grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.hero .lead { font-size: clamp(1.05rem, 2.2vw, 1.3rem); color: var(--text-muted); max-width: 56ch; margin: 0 0 22px; }
.hero .cta-row { display: flex; flex-wrap: wrap; gap: 12px; }

/* ---- Section heading ---- */
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.section-head h2 { margin: 0; }
.section-head .muted { color: var(--text-muted); font-size: .95rem; }

/* ---- Tool grid + cards ---- */
.tool-grid { display: grid; gap: 18px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .tool-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .tool-grid { grid-template-columns: repeat(3, 1fr); } }

.tool-card {
  position: relative; display: flex; flex-direction: column; gap: 10px;
  padding: 22px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); text-decoration: none; box-shadow: var(--shadow-sm);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
  min-height: var(--tap); overflow: hidden;
}
.tool-card::before {
  content: ""; position: absolute; left: 0; top: 0; height: 4px; width: 100%;
  background: var(--card-accent, var(--grad)); opacity: 0; transition: opacity .16s ease;
}
.tool-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: transparent; text-decoration: none; }
.tool-card:hover::before { opacity: 1; }
.tool-card .ico {
  width: 46px; height: 46px; border-radius: 12px; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center; font-size: 1.4rem;
  background: var(--ico-bg, var(--surface-2)); color: var(--ico-fg, var(--brand-ink));
}
.tool-card h3 { margin: 0; }
.tool-card p { margin: 0; color: var(--text-muted); font-size: .92rem; line-height: 1.55; }
.tool-card .badge {
  align-self: flex-start; font-size: .68rem; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--text-muted);
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 3px 9px; border-radius: var(--radius-pill);
}

/* ---- Tool UI ---- */
.tool {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: clamp(18px, 3vw, 28px); box-shadow: var(--shadow-sm);
}
.field { margin-bottom: var(--gap); }
.field label { display: block; font-weight: 700; margin-bottom: 7px; }
.field .hint { color: var(--text-muted); font-size: .9rem; font-weight: 400; }

input, select, textarea, button { font: inherit; color: var(--text); }
input[type="text"], input[type="number"], input[type="date"], input[type="url"],
select, textarea {
  width: 100%; min-height: var(--tap); padding: 11px 14px;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); transition: border-color .12s ease, box-shadow .12s ease;
}
input[type="range"] { width: 100%; accent-color: var(--brand); }
textarea { min-height: 140px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(99,102,241,.15);
}

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); min-width: var(--tap); padding: 0 22px;
  background: var(--grad); color: var(--on-brand); border: 1px solid transparent;
  border-radius: var(--radius-sm); cursor: pointer; font-weight: 700; text-decoration: none;
  box-shadow: var(--shadow-sm); transition: transform .12s ease, box-shadow .12s ease, opacity .12s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); text-decoration: none; opacity: .96; }
.btn-secondary { background: var(--surface); color: var(--brand-ink); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }

/* result */
.result {
  margin-top: var(--gap); padding: 18px 20px;
  background: var(--grad-soft); border: 1px solid var(--border);
  border-radius: var(--radius-sm); min-height: 72px;
}
.result .value { font-size: 1.5rem; font-weight: 800; color: var(--text); letter-spacing: -0.01em; }
.result .muted, .muted { color: var(--text-muted); }

/* validation */
.error-msg { color: var(--error); font-size: .9rem; margin-top: 6px; min-height: 1.2em; font-weight: 600; }
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--error); box-shadow: 0 0 0 4px rgba(185,28,28,.1); }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: var(--text); color: #fff; padding: 12px 20px; border-radius: var(--radius-sm);
  opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; z-index: 1000;
  box-shadow: var(--shadow-lg); font-weight: 600;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* about content */
.about { margin-top: 40px; max-width: 70ch; }
.about h2 { margin-top: 28px; }
.about p { color: var(--text-muted); }

/* related */
.related ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.related a {
  display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 16px;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill); text-decoration: none; color: var(--text); font-weight: 600;
  transition: border-color .12s ease, color .12s ease, transform .12s ease;
}
.related a:hover { border-color: var(--brand); color: var(--brand-ink); transform: translateY(-1px); text-decoration: none; }

/* breadcrumb */
.crumbs { font-size: .9rem; color: var(--text-muted); margin: 4px 0 4px; }
.crumbs a { color: var(--text-muted); }
.crumbs a:hover { color: var(--brand-ink); }

/* format toggle */
.format-toggle { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: var(--gap); font-size: .95rem; }
.format-toggle label { font-weight: 700; }
.format-toggle select { width: auto; min-width: 130px; }

/* checkbox row (password tool) */
.check-row { display: flex; flex-wrap: wrap; gap: 16px 22px; margin-bottom: 16px; }
.check-row label { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.check-row input { width: auto; min-height: auto; accent-color: var(--brand); }

/* qr canvas */
#qr-canvas { image-rendering: pixelated; max-width: 280px; height: auto; margin-top: 14px; border: 1px solid var(--border); border-radius: 12px; background: #fff; padding: 8px; }

/* footer */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); padding: 28px 0; color: var(--text-muted); font-size: .92rem; }
.site-footer a { color: var(--brand-ink); }

/* consent */
.consent { position: fixed; left: 16px; right: 16px; bottom: 16px; background: var(--text); color: #fff; padding: 16px 18px; border-radius: var(--radius); display: none; z-index: 1100; box-shadow: var(--shadow-lg); }
.consent.show { display: block; }
.consent .container { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; padding: 0; }
.consent p { margin: 0; flex: 1 1 280px; }
.consent .btn-secondary { background: transparent; color: #fff; border-color: rgba(255,255,255,.5); }

/* utility */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; }
.lead { font-size: 1.1rem; color: var(--text-muted); }

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

/* ---- FAQ (SEO) ---- */
.faq { margin-top: 40px; max-width: 70ch; }
.faq h2 { margin-bottom: 14px; }
.faq-item {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); margin-bottom: 10px; overflow: hidden;
}
.faq-item summary {
  cursor: pointer; padding: 14px 18px; font-weight: 700; list-style: none;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; color: var(--brand-ink); font-size: 1.2rem; font-weight: 800; }
.faq-item[open] summary::after { content: "–"; }
.faq-item .faq-body { padding: 0 18px 16px; color: var(--text-muted); }

/* ---- Homepage search filter ---- */
.tool-search { margin: 0 0 22px; }
.tool-search input {
  width: 100%; max-width: 460px; min-height: var(--tap);
  padding: 12px 16px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill); background: var(--surface);
}
.tool-search input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(99,102,241,.15); }
.tool-card[hidden] { display: none; }
.no-results { color: var(--text-muted); padding: 12px 0; }

/* ---- Breadcrumb spacing ---- */
.crumbs { margin-top: 8px; }
