/* ==========================================================================
   NSZ Toolkit — shared design system
   Used by the home page and by every tool page.
   ========================================================================== */

:root {
  --bg: #f6f7fb;
  --bg-soft: #eef0f8;
  --surface: #ffffff;
  --surface-2: #f8f9fd;
  --surface-glass: rgba(255, 255, 255, 0.72);
  --border: #e3e6f0;
  --border-strong: #cfd4e4;
  --text: #141726;
  --text-soft: #4b5168;
  --text-mute: #7a8098;

  --brand-1: #5b5bf6;
  --brand-2: #9b4dff;
  --brand-3: #ff5fa2;
  --accent: #10b9a6;
  --warn: #f59e0b;
  --danger: #ef4444;
  --success: #16a34a;
  --link: #4f46e5;

  --gradient: linear-gradient(120deg, var(--brand-1) 0%, var(--brand-2) 55%, var(--brand-3) 100%);
  --gradient-soft: linear-gradient(120deg, rgba(91, 91, 246, .12), rgba(155, 77, 255, .12) 55%, rgba(255, 95, 162, .12));

  --shadow-sm: 0 1px 2px rgba(20, 23, 38, .06), 0 1px 3px rgba(20, 23, 38, .05);
  --shadow: 0 10px 30px -12px rgba(40, 44, 90, .25), 0 2px 6px rgba(20, 23, 38, .05);
  --shadow-lg: 0 30px 60px -20px rgba(60, 50, 140, .35);

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;

  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --header-h: 68px;
  --container: 1160px;

  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0a0c16;
  --bg-soft: #10132200;
  --surface: #121527;
  --surface-2: #171a2f;
  --surface-glass: rgba(18, 21, 39, 0.72);
  --border: #23284a;
  --border-strong: #323866;
  --text: #eef0ff;
  --text-soft: #b4b9d6;
  --text-mute: #8087ab;
  --link: #a5a8ff;

  --gradient-soft: linear-gradient(120deg, rgba(91, 91, 246, .18), rgba(155, 77, 255, .16) 55%, rgba(255, 95, 162, .14));
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 12px 34px -12px rgba(0, 0, 0, .6);
  --shadow-lg: 0 30px 70px -20px rgba(0, 0, 0, .75);

  color-scheme: dark;
}

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

[hidden] { display: none !important; }

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  transition: background-color .3s ease, color .3s ease;
}

main { flex: 1; }

img, svg { max-width: 100%; }

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { line-height: 1.15; margin: 0 0 .5em; letter-spacing: -0.02em; }

p { margin: 0 0 1em; }

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

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

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--brand-1) 55%, transparent);
  outline-offset: 2px;
  border-radius: 6px;
}

.gradient-text {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- Decorative background ---------- */

.bg-decor {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}
.bg-decor .grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, color-mix(in srgb, var(--border) 60%, transparent) 1px, transparent 1px),
    linear-gradient(to bottom, color-mix(in srgb, var(--border) 60%, transparent) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 80% 55% at 50% 0%, #000 40%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 80% 55% at 50% 0%, #000 40%, transparent 100%);
}
.bg-decor .blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: .45;
  animation: float 18s ease-in-out infinite;
}
.bg-decor .blob.b1 { width: 460px; height: 460px; background: #7c7cff; top: -140px; left: -120px; }
.bg-decor .blob.b2 { width: 380px; height: 380px; background: #d27bff; top: -60px; right: -120px; animation-delay: -6s; }
.bg-decor .blob.b3 { width: 320px; height: 320px; background: #ff8cc0; top: 360px; left: 40%; opacity: .25; animation-delay: -12s; }
:root[data-theme="dark"] .bg-decor .blob { opacity: .28; }

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(40px, 30px) scale(1.06); }
  66% { transform: translate(-30px, 20px) scale(.96); }
}

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

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  border-bottom: 1px solid transparent;
  transition: border-color .2s ease, background-color .3s ease;
}
.site-header.scrolled { border-bottom-color: var(--border); }
.site-header .container {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.12rem;
  color: var(--text) !important;
  letter-spacing: -0.02em;
  text-decoration: none !important;
}
.brand-mark {
  width: 36px; height: 36px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: var(--gradient);
  color: #fff;
  box-shadow: 0 6px 18px -6px rgba(124, 77, 255, .7);
}
.brand-mark svg { width: 20px; height: 20px; }
.brand small {
  display: block;
  font-size: .68rem;
  font-weight: 600;
  color: var(--text-mute);
  letter-spacing: .02em;
  margin-top: -3px;
}

.nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
}
.nav a {
  color: var(--text-soft);
  font-weight: 600;
  font-size: .94rem;
  padding: 8px 12px;
  border-radius: 10px;
  text-decoration: none;
}
.nav a:hover { color: var(--text); background: var(--surface-2); }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px; height: 40px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-soft);
  cursor: pointer;
  transition: transform .15s ease, color .15s ease, border-color .15s ease;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); transform: translateY(-1px); }
.icon-btn svg { width: 19px; height: 19px; }
.theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: block; }
:root[data-theme="dark"] .theme-toggle .moon { display: none; }

@media (max-width: 640px) {
  .nav a.hide-sm { display: none; }
  .brand small { display: none; }
}

/* ---------- Buttons ---------- */

.btn {
  --btn-bg: var(--surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  font: inherit;
  font-weight: 700;
  font-size: .95rem;
  line-height: 1.2;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--btn-bg);
  color: var(--text);
  cursor: pointer;
  text-decoration: none !important;
  transition: transform .15s ease, box-shadow .2s ease, border-color .15s ease, background-color .15s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(0); }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-primary {
  border: 0;
  color: #fff !important;
  background: var(--gradient);
  background-size: 160% 100%;
  box-shadow: 0 10px 24px -10px rgba(124, 77, 255, .75);
}
.btn-primary:hover { background-position: 100% 0; box-shadow: 0 14px 30px -10px rgba(124, 77, 255, .85); }

.btn-ghost { background: transparent; border-color: transparent; color: var(--text-soft); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.btn-sm { padding: 7px 12px; font-size: .85rem; border-radius: 10px; }
@media (max-width: 560px) {
  /* Long button labels must wrap on phones, or they push the page wider than the screen. */
  .btn { white-space: normal; text-align: center; }
}
.btn-lg { padding: 14px 24px; font-size: 1.02rem; border-radius: 14px; }

/* ---------- Chips / badges ---------- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: .82rem;
  font-weight: 600;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-glass);
  color: var(--text-soft);
}
.chip svg { width: 15px; height: 15px; }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }

.badge {
  display: inline-block;
  padding: 3px 9px;
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  border-radius: 999px;
  color: #fff;
  background: var(--gradient);
}
.badge.soon { background: var(--surface-2); color: var(--text-mute); border: 1px solid var(--border); }

.tag {
  display: inline-block;
  padding: 3px 9px;
  font-size: .74rem;
  font-weight: 600;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text-mute);
  border: 1px solid var(--border);
}

/* ---------- Cards ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

/* ---------- Page heading (tool pages) ---------- */

.page-hero { padding: 42px 0 10px; }
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: .88rem;
  color: var(--text-mute);
  margin-bottom: 18px;
}
.breadcrumb a { color: var(--text-soft); font-weight: 600; }
.breadcrumb svg { width: 14px; height: 14px; }

.tool-title {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.tool-title h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin: 0; }
.tool-icon {
  width: 58px; height: 58px;
  flex: none;
  border-radius: 18px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--gradient);
  box-shadow: 0 14px 30px -12px rgba(124, 77, 255, .8);
}
.tool-icon svg { width: 30px; height: 30px; }
.page-hero .lead {
  margin: 14px 0 0;
  max-width: 760px;
  color: var(--text-soft);
  font-size: 1.06rem;
}

/* ---------- Footer ---------- */

.site-footer {
  margin-top: 80px;
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 60%, transparent);
}
.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  gap: 18px 40px;
  justify-content: space-between;
  align-items: center;
  padding-top: 28px;
  padding-bottom: 28px;
  font-size: .9rem;
  color: var(--text-mute);
}
.site-footer strong { color: var(--text-soft); }
.site-footer .heart { color: var(--brand-3); }

/* ---------- Notice (warnings inside pages) ---------- */

.notice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 16px;
  margin-bottom: 8px;
  border-radius: 14px;
  font-size: .92rem;
  color: var(--text);
  background: color-mix(in srgb, var(--warn) 14%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent);
}
.notice svg { width: 20px; height: 20px; color: var(--warn); flex: none; margin-top: 1px; }

/* ---------- Toast ---------- */

.toast-wrap {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 100;
  display: grid;
  gap: 8px;
  width: min(92vw, 420px);
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 14px;
  background: var(--text);
  color: var(--bg);
  font-weight: 600;
  font-size: .92rem;
  box-shadow: var(--shadow-lg);
  animation: toast-in .25s ease;
}
.toast.error { background: var(--danger); color: #fff; }
.toast svg { width: 18px; height: 18px; flex: none; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- Reveal-on-scroll ---------- */

.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }
