/* ==========================================================================
   NelcByte Tools — main stylesheet
   No framework, no build step. Edit the variables below to rebrand the site.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design tokens
   -------------------------------------------------------------------------- */
:root {
  color-scheme: light;

  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --surface-3: #e2e8f0;
  --text: #0f172a;
  --text-soft: #334155;
  --muted: #5b6b80;
  --muted-2: #94a3b8;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #dbeafe;
  --primary-text: #1e40af;
  --accent: #0d9488;
  --accent-soft: #ccfbf1;
  --success: #047857;
  --success-soft: #d1fae5;
  --warning: #b45309;
  --warning-soft: #fef3c7;
  --danger: #b91c1c;
  --danger-soft: #fee2e2;
  --purple: #7c3aed;
  --purple-soft: #ede9fe;

  --code-bg: #0f172a;
  --code-text: #e2e8f0;
  --code-border: #1e293b;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 18px 40px -24px rgba(15, 23, 42, 0.35);

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;

  --font-sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Space Grotesk", var(--font-sans);
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;

  --container: 1120px;
  --header-h: 68px;
}

[data-theme="dark"] {
  color-scheme: dark;

  --bg: #080f1d;
  --surface: #0f172a;
  --surface-2: #152238;
  --surface-3: #1e2f4a;
  --text: #f1f5f9;
  --text-soft: #cbd5e1;
  --muted: #94a3b8;
  --muted-2: #64748b;
  --border: #1e293b;
  --border-strong: #334155;

  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --primary-soft: #172554;
  --primary-text: #93c5fd;
  --accent: #2dd4bf;
  --accent-soft: #042f2e;
  --success: #34d399;
  --success-soft: #052e22;
  --warning: #fbbf24;
  --warning-soft: #3b2a08;
  --danger: #f87171;
  --danger-soft: #3f1414;
  --purple: #a78bfa;
  --purple-soft: #241a44;

  --code-bg: #060b14;
  --code-text: #e2e8f0;
  --code-border: #1e293b;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 18px 40px -24px rgba(0, 0, 0, 0.85);
}

/* --------------------------------------------------------------------------
   2. Fonts
   -------------------------------------------------------------------------- */
@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/assets/fonts/space-grotesk-latin.woff2") format("woff2");
}

/* --------------------------------------------------------------------------
   3. Reset and base
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

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

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

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

p {
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

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

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

ul,
ol {
  margin: 0;
}

[hidden] {
  display: none !important;
}

::selection {
  background: var(--primary);
  color: #fff;
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   4. Layout helpers
   -------------------------------------------------------------------------- */
.border {
  border-width: 1px;
  border-style: solid;
  border-color: var(--border);
}
.border-dashed {
  border-style: dashed;
}
.border-slate-200 {
  border-color: var(--border);
}
.border-slate-300 {
  border-color: var(--border-strong);
}
.bg-slate-100\/40 {
  background-color: color-mix(in srgb, var(--surface-2) 40%, transparent);
}
.bg-slate-100\/60 {
  background-color: color-mix(in srgb, var(--surface-2) 60%, transparent);
}
.text-slate-400 {
  color: var(--muted-2);
}
.text-\[9px\] {
  font-size: 9px;
}
.text-\[10px\] {
  font-size: 10px;
}
.uppercase {
  text-transform: uppercase;
}
.tracking-widest {
  letter-spacing: 0.1em;
}
.block {
  display: block;
}
.mb-1 {
  margin-bottom: 0.25rem;
}
.p-3 {
  padding: 0.75rem;
}
.p-4 {
  padding: 1rem;
}
.py-6 {
  padding-top: 1.5rem;
  padding-bottom: 1.5rem;
}
.text-center {
  text-align: center;
}
.rounded-lg {
  border-radius: var(--radius);
}
.rounded-xl {
  border-radius: var(--radius-xl);
}
.min-h-\[90px\] {
  min-height: 90px;
}
.flex {
  display: flex;
}
.items-center {
  align-items: center;
}
.justify-center {
  justify-content: center;
}

.container {
  width: min(100% - 2rem, var(--container));
  margin-inline: auto;
}

.section {
  padding: 72px 0;
}

.section-sm {
  padding: 40px 0;
}

.section-tight {
  padding: 48px 0;
}

.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
}

.section-header h2 {
  font-size: clamp(1.55rem, 2.6vw, 2rem);
}

.section-header p {
  max-width: 46ch;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.eyebrow {
  display: inline-block;
  margin-bottom: 10px;
  color: var(--primary);
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.lead {
  max-width: 68ch;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.7;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.82rem;
}

.center {
  text-align: center;
}

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

.skip-link {
  position: fixed;
  z-index: 100;
  top: 10px;
  left: 10px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  transform: translateY(-150%);
  transition: transform 0.15s ease;
}

.skip-link:focus {
  transform: translateY(0);
}

#main {
  scroll-margin-top: calc(var(--header-h) + 12px);
}

.icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.icon-lg {
  width: 22px;
  height: 22px;
}

.icon-xl {
  width: 28px;
  height: 28px;
}

/* --------------------------------------------------------------------------
   5. Header and navigation
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

@supports (backdrop-filter: blur(10px)) {
  .site-header {
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: blur(14px);
  }
}

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

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: #fff;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

.brand-name {
  font-family: var(--font-display);
  font-size: 1.06rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  white-space: nowrap;
}

.brand-name span {
  color: var(--primary);
  font-weight: 500;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
}

.site-nav a {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  font-size: 0.88rem;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
}

.site-nav a:hover {
  background: var(--surface-2);
  color: var(--text);
}

.site-nav a[aria-current="page"] {
  background: var(--primary-soft);
  color: var(--primary-text);
  font-weight: 600;
}

.theme-toggle,
.menu-toggle {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-soft);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.theme-toggle:hover,
.menu-toggle:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
}

.menu-toggle {
  display: none;
  margin-left: 0;
}

.menu-toggle .close-icon {
  display: none;
}

.menu-toggle[aria-expanded="true"] .menu-icon {
  display: none;
}

.menu-toggle[aria-expanded="true"] .close-icon {
  display: block;
}

.theme-toggle .icon-sun {
  display: none;
}

[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}

[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

/* --------------------------------------------------------------------------
   6. Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease,
    color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 8px 20px -12px color-mix(in srgb, var(--primary) 80%, transparent);
}

.btn-primary:hover {
  background: var(--primary-hover);
  color: #fff;
}

/* The dark theme uses a brighter blue, so dark ink keeps AA contrast. */
[data-theme="dark"] .btn.btn-primary {
  color: #07111f;
}

.btn-secondary {
  border-color: var(--border-strong);
  background: var(--surface);
  color: var(--text);
}

.btn-secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-ghost {
  color: var(--text-soft);
}

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

.btn-sm {
  padding: 7px 11px;
  font-size: 0.78rem;
}

.btn-block {
  width: 100%;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.btn.is-copied {
  border-color: var(--success);
  color: var(--success);
}

/* --------------------------------------------------------------------------
   7. Hero
   -------------------------------------------------------------------------- */
.hero {
  position: relative;
  overflow: hidden;
  padding: 68px 0 64px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 84% 30%, var(--primary-soft), transparent 34%),
    radial-gradient(circle at 6% 108%, var(--accent-soft), transparent 30%);
  opacity: 0.7;
  pointer-events: none;
}

.hero > .container {
  position: relative;
  z-index: 1;
}

.hero .eyebrow {
  margin-bottom: 18px;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 0.98fr);
  gap: 58px;
  align-items: center;
}

.hero-copy {
  min-width: 0;
}

.hero h1 {
  max-width: 15ch;
  font-size: clamp(2.55rem, 5vw, 4rem);
  font-weight: 700;
  letter-spacing: -0.05em;
  line-height: 0.98;
  text-wrap: balance;
}

.hero h1 span,
.hero h1 em {
  display: block;
}

.hero h1 em {
  color: var(--primary);
  font-style: normal;
}

.hero .lead {
  max-width: 46ch;
  margin: 24px 0 0;
  font-size: 1.08rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.hero-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 0.8rem;
}

.hero-note .icon {
  flex: none;
  margin-top: 2px;
  color: var(--success);
}

.hero-visual {
  min-width: 0;
}

.hero-demo {
  position: relative;
  max-width: 520px;
  margin-left: auto;
  padding: 12px 0 34px 24px;
}

@media (prefers-reduced-motion: no-preference) {
  .hero-demo-window {
    animation: heroWindowIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
  }

  .hero-demo-badge {
    animation: heroBadgeIn 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.15s both;
  }

  .hero-demo-bar-fill.is-full {
    animation: heroBarFill 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.2s both;
  }

  .hero-demo-bar-fill:not(.is-full) {
    animation: heroBarFill 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.35s both;
  }

  .hero-demo-local {
    animation: heroPulse 2.4s ease-in-out infinite;
  }

  .hero-demo-file-icon {
    animation: heroIconFloat 3.2s ease-in-out infinite;
  }

  .hero-demo-check {
    animation: heroCheckPop 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.5s both;
  }
}

@keyframes heroWindowIn {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes heroBadgeIn {
  from { opacity: 0; transform: translateX(-12px) translateY(8px); }
  to { opacity: 1; transform: translateX(0) translateY(0); }
}

@keyframes heroBarFill {
  from { width: 0; }
  to { width: var(--hero-bar-width, 58%); }
}

@keyframes heroPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(4, 120, 87, 0.35); }
  50% { box-shadow: 0 0 0 6px rgba(4, 120, 87, 0); }
}

@keyframes heroIconFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

@keyframes heroCheckPop {
  from { opacity: 0; transform: scale(0.6); }
  to { opacity: 1; transform: scale(1); }
}

.hero-demo::before {
  content: "";
  position: absolute;
  inset: -12px -10px 8px 0;
  background-image: radial-gradient(circle, var(--border-strong) 1px, transparent 1.2px);
  background-size: 20px 20px;
  opacity: 0.38;
  pointer-events: none;
}

.hero-demo::after {
  content: "";
  position: absolute;
  top: 8%;
  right: -8%;
  width: 78%;
  height: 72%;
  border-radius: 50%;
  background: var(--primary-soft);
  filter: blur(48px);
  opacity: 0.55;
  pointer-events: none;
}

.hero-demo-window {
  position: relative;
  z-index: 1;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: 0 30px 70px -42px rgba(0, 0, 0, 0.7);
}

.hero-demo-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.hero-demo-dots {
  display: flex;
  flex: none;
  gap: 4px;
}

.hero-demo-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border-strong);
}

.hero-demo-address {
  flex: 1;
  min-width: 0;
  padding: 3px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.56rem;
  line-height: 1.4;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hero-demo-tabs {
  display: flex;
  gap: 4px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.hero-demo-tab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 8px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}

.hero-demo-tab .icon {
  width: 13px;
  height: 13px;
}

.hero-demo-tab.is-active {
  background: var(--primary-soft);
  color: var(--primary-text);
}

.hero-demo-body {
  padding: 18px;
}

.hero-demo-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.hero-demo-head > span:first-child {
  min-width: 0;
}

.hero-demo-head small {
  display: block;
  color: var(--muted);
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.4;
  text-transform: uppercase;
}

.hero-demo-head strong {
  display: block;
  margin-top: 3px;
  font-family: var(--font-display);
  font-size: 1.08rem;
  line-height: 1.2;
}

.hero-demo-local {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: none;
  padding: 4px 7px;
  border-radius: 999px;
  background: var(--success-soft);
  color: var(--success);
  font-size: 0.58rem;
  font-weight: 700;
  line-height: 1.2;
}

.hero-demo-local .icon {
  width: 11px;
  height: 11px;
}

.hero-demo-file {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
}

.hero-demo-file-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--primary-soft);
  color: var(--primary);
}

.hero-demo-file-icon .icon {
  width: 16px;
  height: 16px;
}

.hero-demo-file-copy {
  min-width: 0;
}

.hero-demo-file-copy strong,
.hero-demo-file-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hero-demo-file-copy strong {
  font-size: 0.75rem;
  line-height: 1.35;
}

.hero-demo-file-copy small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.6rem;
}

.hero-demo-check {
  display: grid;
  place-items: center;
  flex: none;
  width: 20px;
  height: 20px;
  margin-left: auto;
  border-radius: 50%;
  background: var(--success-soft);
  color: var(--success);
}

.hero-demo-check .icon {
  width: 11px;
  height: 11px;
}

.hero-demo-meter {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.hero-demo-meter-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 600;
  line-height: 1.3;
}

.hero-demo-bar-track {
  display: block;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-3);
}

.hero-demo-bar-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.hero-demo-bar-fill.is-full {
  --hero-bar-width: 100%;
  width: 100%;
  background: var(--primary);
}

.hero-demo-bar-fill:not(.is-full) {
  --hero-bar-width: 58%;
}

.hero-demo-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.hero-demo-footer small {
  display: block;
  color: var(--muted);
  font-size: 0.54rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.4;
  text-transform: uppercase;
}

.hero-demo-footer strong {
  display: block;
  margin-top: 2px;
  font-size: 0.78rem;
  line-height: 1.3;
}

.hero-demo-download {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: none;
  padding: 6px 9px;
  border-radius: 7px;
  background: var(--primary);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1.2;
}

.hero-demo-download .icon {
  width: 11px;
  height: 11px;
}

[data-theme="dark"] .hero-demo-download {
  color: #07111f;
}

.hero-demo-badge {
  position: absolute;
  z-index: 2;
  left: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.hero-demo-badge-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--success-soft);
  color: var(--success);
}

.hero-demo-badge-icon .icon {
  width: 14px;
  height: 14px;
}

.hero-demo-badge strong,
.hero-demo-badge small {
  display: block;
  line-height: 1.35;
}

.hero-demo-badge strong {
  font-size: 0.7rem;
}

.hero-demo-badge small {
  margin-top: 1px;
  color: var(--muted);
  font-size: 0.6rem;
}

/* --------------------------------------------------------------------------
   9. Tool cards
   -------------------------------------------------------------------------- */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
}

.tone-blue {
  --tone: #2563eb;
  --tone-soft: #dbeafe;
}

.tone-emerald {
  --tone: #059669;
  --tone-soft: #d1fae5;
}

.tone-purple {
  --tone: #7c3aed;
  --tone-soft: #ede9fe;
}

.tone-amber {
  --tone: #d97706;
  --tone-soft: #fef3c7;
}

.tone-teal {
  --tone: #0d9488;
  --tone-soft: #ccfbf1;
}

[data-theme="dark"] .tone-blue {
  --tone: #60a5fa;
  --tone-soft: #172554;
}

[data-theme="dark"] .tone-emerald {
  --tone: #34d399;
  --tone-soft: #052e22;
}

[data-theme="dark"] .tone-purple {
  --tone: #a78bfa;
  --tone-soft: #241a44;
}

[data-theme="dark"] .tone-amber {
  --tone: #fbbf24;
  --tone-soft: #3b2a08;
}

[data-theme="dark"] .tone-teal {
  --tone: #2dd4bf;
  --tone-soft: #042f2e;
}

.tool-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.tool-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.tool-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 16px;
  border-radius: 12px;
  background: var(--tone-soft);
  color: var(--tone);
}

.tool-icon .icon {
  width: 22px;
  height: 22px;
}

.tool-card h3 {
  font-size: 1.08rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.tool-card p {
  flex: 1;
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.6;
}

.card-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 18px;
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 600;
}

.card-link .icon {
  width: 15px;
  height: 15px;
  transition: transform 0.15s ease;
}

.tool-card:hover .card-link .icon,
.post-card:hover .card-link .icon {
  transform: translateX(3px);
}

.category-block + .category-block {
  margin-top: 44px;
}

.category-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.category-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* --------------------------------------------------------------------------
   10. Steps, callouts, FAQ
   -------------------------------------------------------------------------- */
.steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  counter-reset: step;
}

.step {
  position: relative;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.step-number {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin-bottom: 14px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary-text);
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 700;
}

.step h3 {
  font-size: 1rem;
}

.step p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.84rem;
}

.callout {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 24px;
  border: 1px solid color-mix(in srgb, var(--primary) 26%, var(--border));
  border-radius: var(--radius);
  background: var(--primary-soft);
}

.callout .icon-box {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 12px;
  background: var(--surface);
  color: var(--primary);
}

.callout h2,
.callout h3 {
  font-size: 1.1rem;
}

.callout p {
  margin-top: 5px;
  color: var(--text-soft);
  font-size: 0.86rem;
}

.callout a {
  color: var(--primary-text);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.faq-list {
  display: grid;
  gap: 10px;
}

.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.faq-item summary {
  position: relative;
  padding: 16px 46px 16px 18px;
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 0.94rem;
  font-weight: 600;
  list-style: none;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "+";
  position: absolute;
  top: 50%;
  right: 18px;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 1.25rem;
  font-weight: 400;
  line-height: 1;
  transform: translateY(-50%);
  transition: transform 0.15s ease;
}

.faq-item[open] summary::after {
  transform: translateY(-50%) rotate(45deg);
}

.faq-item .faq-answer {
  padding: 0 18px 18px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.7;
}

/* --------------------------------------------------------------------------
   11. Blog cards and articles
   -------------------------------------------------------------------------- */
.post-card {
  display: flex;
  flex-direction: column;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.post-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.post-card .post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 500;
}

.post-card .post-tag {
  color: var(--primary);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.post-card h3 {
  font-size: 1.05rem;
  line-height: 1.3;
}

.post-card p {
  flex: 1;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.6;
}

.article-header {
  max-width: 76ch;
  padding: 28px 0 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}

.article-header h1 {
  margin-top: 10px;
  font-size: clamp(2rem, 4.2vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.04em;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 0.8rem;
}

.article-meta span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.article-body {
  max-width: 74ch;
}

.article-body .article-lead {
  font-size: 1.08rem;
  color: var(--text-soft);
}

.article-body .tool-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 28px 0;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.article-body .tool-cta p {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.86rem;
}

.article-body .tool-cta strong {
  display: block;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 0.95rem;
}

/* --------------------------------------------------------------------------
   12. Page head and breadcrumbs
   -------------------------------------------------------------------------- */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  padding-top: 24px;
  color: var(--muted);
  font-size: 0.78rem;
}

.breadcrumb a {
  color: var(--muted);
}

.breadcrumb a:hover {
  color: var(--primary);
}

.breadcrumb .sep {
  color: var(--muted-2);
}

.breadcrumb [aria-current="page"] {
  color: var(--text-soft);
  font-weight: 500;
}

.page-head {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  padding: 26px 0 8px;
  max-width: 900px;
}

.page-head .page-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  flex: 0 0 auto;
  border-radius: 16px;
  background: var(--tone-soft);
  color: var(--tone);
}

.page-head .page-icon .icon {
  width: 28px;
  height: 28px;
}

.page-head h1 {
  font-size: clamp(1.9rem, 3.8vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.04em;
}

.page-head .lead {
  margin-top: 8px;
  font-size: 0.98rem;
}

/* --------------------------------------------------------------------------
   13. Tool panels and forms
   -------------------------------------------------------------------------- */
.tool-panel {
  margin-top: 26px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.tool-grid-wide {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
}

.panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.panel-title {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field + .field {
  margin-top: 14px;
}

.field label,
.field-label {
  color: var(--text-soft);
  font-size: 0.78rem;
  font-weight: 600;
}

.field .hint {
  color: var(--muted);
  font-size: 0.72rem;
}

.input,
.select,
.textarea {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.88rem;
  line-height: 1.5;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input,
.select {
  min-height: 42px;
  padding: 9px 12px;
}

.textarea {
  padding: 12px;
  min-height: 260px;
  resize: vertical;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.6;
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.input[aria-invalid="true"],
.textarea[aria-invalid="true"] {
  border-color: var(--danger);
}

.output {
  background: var(--code-bg);
  color: #a7f3d0;
  border-color: var(--code-border);
}

.output::placeholder {
  color: #64748b;
}

.output:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.editor {
  height: 320px;
  min-height: 220px;
}

.tool-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
}

.tool-actions.center {
  justify-content: center;
}

.tool-actions .spacer {
  flex: 1;
}

.range-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.range-row input[type="range"] {
  flex: 1;
  accent-color: var(--primary);
}

.range-value {
  min-width: 3ch;
  color: var(--primary);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 700;
  text-align: right;
}

/* DNS checker */
.dns-privacy {
  margin: 18px 0 0;
  line-height: 1.55;
}

.dns-status {
  min-height: 1.5em;
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.5;
}

.dns-status.is-success {
  color: var(--success);
}

.dns-status.is-warning {
  color: var(--warning);
}

.dns-results {
  min-height: 280px;
  max-height: 440px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overscroll-behavior: contain;
}

.dns-results:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.dns-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 278px;
  margin: 0;
  padding: 26px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
  text-align: center;
}

.dns-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.dns-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-align: left;
  text-transform: uppercase;
}

@media (min-width: 681px) {
  .dns-table th:first-child,
  .dns-table td:first-child {
    width: 24%;
  }

  .dns-table th:nth-child(2),
  .dns-table td:nth-child(2) {
    width: 20%;
  }

  .dns-table th:nth-child(3),
  .dns-table td:nth-child(3) {
    width: 17%;
  }

  .dns-table th:nth-child(4),
  .dns-table td:nth-child(4) {
    width: 39%;
  }
}

.dns-table td {
  padding: 12px;
  border-top: 1px solid var(--border);
  vertical-align: top;
  overflow-wrap: anywhere;
}

.dns-table tbody tr:first-child td {
  border-top: 0;
}

.dns-cell-label {
  display: none;
}

.dns-record-name,
.dns-record-ttl,
.dns-record-value {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  line-height: 1.55;
}

.dns-record-name {
  color: var(--text-soft);
}

.dns-record-ttl {
  color: var(--muted);
  white-space: nowrap;
}

.dns-record-value {
  color: var(--text);
}

.dns-record-type {
  display: inline-flex;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

/* Image compressor */
.image-controls {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 18px;
  align-items: start;
}

.image-controls .field + .field {
  margin-top: 0;
}

.image-cap {
  grid-column: 1 / -1;
  margin-top: -4px;
}

.file-input {
  padding: 7px 10px;
  color: var(--muted);
  font-size: 0.8rem;
  cursor: pointer;
}

.file-input::file-selector-button {
  margin-right: 12px;
  padding: 7px 11px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.file-input::file-selector-button:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.file-input:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.image-compare {
  margin-top: 18px;
}

.image-stage {
  display: grid;
  place-items: center;
  min-height: 220px;
  max-height: 360px;
  padding: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}

.image-stage img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 330px;
  object-fit: contain;
}

.image-empty {
  max-width: 30ch;
  padding: 18px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.55;
  text-align: center;
}

.image-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.75rem;
}

.image-facts strong {
  color: var(--text);
  font-weight: 600;
}

.image-download-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin-top: 12px;
}

.image-download-row .hint {
  margin: 0;
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.check {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text-soft);
  font-size: 0.8rem;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.check:hover {
  border-color: var(--border-strong);
}

.check input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.check:has(input:checked) {
  border-color: color-mix(in srgb, var(--primary) 48%, var(--border));
  background: color-mix(in srgb, var(--primary-soft) 54%, var(--surface));
}

.segmented {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}

.segmented button {
  padding: 7px 14px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.segmented button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.alert {
  margin-top: 14px;
  padding: 11px 13px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 0.8rem;
  line-height: 1.55;
}

.alert-error {
  border-color: color-mix(in srgb, var(--danger) 30%, var(--border));
  background: var(--danger-soft);
  color: var(--danger);
}

.alert-info {
  border-color: color-mix(in srgb, var(--primary) 28%, var(--border));
  background: var(--primary-soft);
  color: var(--primary-text);
}

.alert-success {
  border-color: color-mix(in srgb, var(--success) 30%, var(--border));
  background: var(--success-soft);
  color: var(--success);
}

.no-script {
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--warning) 35%, var(--border));
  border-radius: 10px;
  background: var(--warning-soft);
  color: var(--warning);
  font-size: 0.82rem;
}

/* --------------------------------------------------------------------------
   14. Stats, results and badges
   -------------------------------------------------------------------------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.stat {
  padding: 14px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  text-align: center;
}

.stat-value {
  display: block;
  color: var(--primary);
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1.15;
}

.stat-label {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.result-panel {
  margin-top: 18px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.result-card {
  padding: 16px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  text-align: center;
}

.result-value {
  display: block;
  color: var(--primary);
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
}

.result-label {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.meta-item {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.meta-item span {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.meta-item strong {
  display: block;
  margin-top: 3px;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.badge-info {
  background: var(--primary-soft);
  color: var(--primary-text);
}

.badge-success {
  background: var(--success-soft);
  color: var(--success);
}

.badge-warning {
  background: var(--warning-soft);
  color: var(--warning);
}

.badge-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.strength {
  margin-top: 12px;
}

.strength-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-3);
}

.strength-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--danger);
  transition: width 0.25s ease, background 0.25s ease;
}

.strength-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.72rem;
}

.strength-meta strong {
  color: var(--text-soft);
}

.qr-preview {
  display: grid;
  place-items: center;
  min-height: 260px;
  padding: 18px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.qr-preview canvas {
  width: min(100%, 260px);
  height: auto;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.qr-placeholder {
  max-width: 30ch;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}

/* --------------------------------------------------------------------------
   15. Tools index filters
   -------------------------------------------------------------------------- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 24px 0 28px;
}

.search-wrap {
  position: relative;
  flex: 1 1 260px;
}

.search-wrap .icon {
  position: absolute;
  top: 50%;
  left: 12px;
  color: var(--muted);
  transform: translateY(-50%);
  pointer-events: none;
}

.search-wrap .input {
  padding-left: 38px;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 600;
}

.chip:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.chip[aria-pressed="true"] {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-text);
}

.filter-count {
  color: var(--muted);
  font-size: 0.76rem;
}

.empty-state {
  padding: 48px 20px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

/* --------------------------------------------------------------------------
   16. Prose (articles, legal pages)
   -------------------------------------------------------------------------- */
.prose {
  max-width: 74ch;
  color: var(--text-soft);
  font-size: 0.98rem;
  line-height: 1.8;
}

.prose > * + * {
  margin-top: 1.15em;
}

.prose h2 {
  margin-top: 2.1em;
  color: var(--text);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.prose h3 {
  margin-top: 1.7em;
  color: var(--text);
  font-size: 1.15rem;
  font-weight: 600;
}

.prose p {
  margin: 0;
}

.prose a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.prose a:hover {
  color: var(--primary-hover);
}

/* Prose link styles must not override buttons placed inside articles. */
.prose .btn {
  color: var(--text);
  text-decoration: none;
}

.prose .btn-primary,
.prose .btn-primary:hover {
  color: #fff;
}

.prose .btn-secondary,
.prose .btn-secondary:hover,
.prose .btn-ghost,
.prose .btn-ghost:hover {
  color: var(--text);
}

.prose ul,
.prose ol {
  padding-left: 1.35em;
}

.prose li + li {
  margin-top: 0.4em;
}

.prose code {
  padding: 0.12em 0.35em;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 0.86em;
}

.prose pre {
  padding: 18px;
  overflow-x: auto;
  border: 1px solid var(--code-border);
  border-radius: var(--radius);
  background: var(--code-bg);
  color: var(--code-text);
  font-size: 0.82rem;
  line-height: 1.7;
}

.prose pre code {
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: inherit;
}

.prose blockquote {
  margin: 1.4em 0;
  padding: 2px 0 2px 18px;
  border-left: 3px solid var(--primary);
  color: var(--muted);
  font-style: italic;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.prose th,
.prose td {
  padding: 9px 11px;
  border: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.prose th {
  background: var(--surface-2);
  color: var(--text);
  font-weight: 600;
}

.prose hr {
  border: 0;
  border-top: 1px solid var(--border);
}

.prose .note {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--surface-2);
  color: var(--text-soft);
  font-size: 0.88rem;
}

.legal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.78rem;
}

.legal-page .prose h2 {
  font-size: 1.25rem;
}

/* --------------------------------------------------------------------------
   17. Footer
   -------------------------------------------------------------------------- */
.site-footer {
  margin-top: 72px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2.1fr 1fr 1fr 1fr;
  gap: 32px;
  padding: 48px 0 34px;
}

.footer-brand p {
  max-width: 36ch;
  margin: 14px 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.7;
}

.footer-parent {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 600;
}

.footer-parent .icon {
  width: 13px;
  height: 13px;
}

.footer-col h2 {
  margin-bottom: 12px;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.footer-col ul {
  display: grid;
  gap: 8px;
  padding: 0;
  list-style: none;
}

.footer-col a {
  color: var(--muted);
  font-size: 0.8rem;
}

.footer-col a:hover {
  color: var(--primary);
}

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 18px 0 26px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.72rem;
}

/* --------------------------------------------------------------------------
   18. 404
   -------------------------------------------------------------------------- */
.error-page {
  display: grid;
  place-items: center;
  min-height: 62vh;
  padding: 72px 0;
  text-align: center;
}

.error-code {
  color: var(--primary);
  font-family: var(--font-display);
  font-size: clamp(5rem, 15vw, 9rem);
  font-weight: 700;
  letter-spacing: -0.06em;
  line-height: 1;
}

.error-page h1 {
  margin-top: 10px;
  font-size: clamp(1.5rem, 3vw, 2rem);
}

.error-page p {
  max-width: 46ch;
  margin: 10px auto 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.error-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 24px;
}

/* --------------------------------------------------------------------------
   19. Ad slot (reserved for later; no ad code at launch)
   -------------------------------------------------------------------------- */
.ad-slot {
  display: grid;
  place-items: center;
  min-height: 100px;
  margin: 32px 0;
  overflow: hidden;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 0.7rem;
  text-align: center;
}

/* --------------------------------------------------------------------------
   20. Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 980px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 34px;
    align-items: start;
  }

  .hero h1 {
    max-width: 18ch;
  }

  .hero-visual {
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
  }

  .hero-demo {
    margin: 0 auto;
  }

  .grid-3,
  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .footer-grid {
    grid-template-columns: 1.6fr 1fr 1fr;
  }

  .footer-brand {
    grid-column: 1 / -1;
  }
}

@media (max-width: 860px) {
  :root {
    --header-h: 64px;
  }

  .site-header {
    position: sticky;
  }

  .menu-toggle {
    display: inline-grid;
  }

  .theme-toggle {
    margin-left: auto;
  }

  .site-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 3px;
    margin: 0;
    padding: 10px 16px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-md);
  }

  .site-nav.is-open {
    display: flex;
  }

  .site-nav a {
    padding: 11px 12px;
    font-size: 0.92rem;
  }

  .hero {
    padding: 54px 0 48px;
  }

  .section {
    padding: 56px 0;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .tool-grid {
    grid-template-columns: 1fr;
  }

  .image-controls {
    grid-template-columns: 1fr;
  }

  .image-cap {
    margin-top: 0;
  }

  .editor {
    height: 240px;
  }

  .page-head {
    gap: 14px;
  }

  .page-head .page-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
  }

  .page-head .page-icon .icon {
    width: 24px;
    height: 24px;
  }

  .footer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 26px;
  }

  .footer-brand {
    grid-column: 1 / -1;
  }
}

@media (max-width: 680px) {
  .hero {
    padding: 40px 0 32px;
  }

  .hero-grid {
    gap: 24px;
  }

  .hero h1 {
    font-size: clamp(2.35rem, 11vw, 3.05rem);
  }

  .hero .lead {
    margin-top: 18px;
    font-size: 1rem;
  }

  .hero-actions {
    gap: 8px;
    margin-top: 22px;
  }

  .hero-actions .btn.btn-ghost {
    width: auto;
    padding: 8px 0;
  }

  .hero-demo {
    max-width: 390px;
    padding: 6px 0 0;
  }

  .hero-demo::before {
    opacity: 0.26;
  }

  .hero-demo-window {
    border-radius: 18px;
  }

  .hero-demo-tabs,
  .hero-demo-meter,
  .hero-demo-badge {
    display: none;
  }

  .steps,
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  .stat-grid,
  .meta-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .result-grid {
    grid-template-columns: 1fr;
  }

  .check-grid {
    grid-template-columns: 1fr;
  }

  .hero-actions .btn {
    width: 100%;
  }

  .tool-panel {
    padding: 18px;
  }

  .dns-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
  }

  .dns-table,
  .dns-table tbody,
  .dns-table tr,
  .dns-table td {
    display: block;
    width: 100%;
  }

  .dns-table tr {
    padding: 12px;
    border-top: 1px solid var(--border);
  }

  .dns-table tbody tr:first-child {
    border-top: 0;
  }

  .dns-table td {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr);
    gap: 8px;
    padding: 3px 0;
    border: 0;
  }

  .dns-cell-label {
    display: block;
    padding-top: 2px;
    color: var(--muted);
    font-family: var(--font-sans);
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }

  .dns-record-name,
  .dns-record-ttl,
  .dns-record-value {
    font-size: 0.72rem;
  }

  .dns-record-type {
    padding: 2px 5px;
    font-size: 0.58rem;
  }

  .dns-empty {
    padding: 20px 16px;
  }

  .image-stage {
    min-height: 180px;
    max-height: 280px;
  }

  .image-stage img {
    max-height: 250px;
  }

  .image-download-row .btn {
    width: 100%;
  }

  .tool-actions .btn {
    flex: 1 1 auto;
  }

  .article-body .tool-cta {
    flex-direction: column;
    align-items: flex-start;
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }

  .footer-brand {
    grid-column: 1 / -1;
  }
}

@media (max-width: 420px) {
  .container {
    width: calc(100% - 1.5rem);
  }

  .brand-name {
    font-size: 0.98rem;
  }

  .footer-grid {
    grid-template-columns: 1fr;
  }

  .footer-brand {
    grid-column: auto;
  }

  .stat-grid,
  .meta-grid {
    grid-template-columns: 1fr;
  }
}

/* --------------------------------------------------------------------------
   21. Motion preferences
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
