/**
 * madestool — Shared Theme & Design System
 * Used across all utility tools for consistent branding
 */

:root {
  /* ── COLOR PALETTE ── */
  --navy-950: #060d1a;
  --navy-900: #0f172a;
  --navy-800: #1e293b;
  --navy-700: #253347;
  --navy-600: #334155;
  --navy-500: #475569;

  --blue-600: #2563eb;
  --blue-500: #3b82f6;
  --blue-400: #60a5fa;
  --blue-300: #93c5fd;
  --blue-200: #bfdbfe;
  --blue-100: #dbeafe;

  --white: #f8fafc;
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --success: #10b981;
  --success-light: #6ee7b7;
  --warning: #f59e0b;
  --danger: #ef4444;
  --danger-light: #f87171;

  /* ── UTILITIES ── */
  --border: rgba(59, 130, 246, 0.15);
  --border-light: rgba(148, 163, 184, 0.1);
  --glow: rgba(59, 130, 246, 0.25);
  --card-bg: rgba(30, 41, 59, 0.7);
  --card-bg-light: rgba(51, 65, 85, 0.5);
  --overlay: rgba(9, 13, 26, 0.85);

  /* ── SPACING ── */
  --gap-xs: 4px;
  --gap-sm: 8px;
  --gap-md: 12px;
  --gap-lg: 16px;
  --gap-xl: 24px;
  --gap-2xl: 32px;
  --gap-3xl: 48px;

  /* ── TYPOGRAPHY ── */
  --font-sans: "Outfit", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --font-weight-extrabold: 800;

  /* ── SIZING ── */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 100px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.15);
  --shadow-2xl: 0 25px 50px rgba(0, 0, 0, 0.25);

  /* ── TRANSITIONS ── */
  --transition-fast: 0.15s ease;
  --transition-base: 0.2s ease;
  --transition-slow: 0.3s ease;
}

/* ── RESET & BASE ── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Prevent layout shift from scrollbar appearing */
  scrollbar-gutter: stable;
}

body {
  font-family: var(--font-sans);
  background-color: var(--navy-900);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  /* Improve text rendering */
  text-rendering: optimizeSpeed;
}

/* ── PERFORMANCE: font-display swap via CSS ── */
@font-face {
  font-display: swap;
}

/* ── PERFORMANCE: lazy render below-fold sections ── */
.lazy-section {
  content-visibility: auto;
  contain-intrinsic-size: 0 400px;
}

/* ── PERFORMANCE: reduce paint on heavy elements ── */
.tool-card,
.ad-slot,
.card,
[class*="panel"],
[class*="result"] {
  will-change: auto;
  contain: layout style;
}

/* ── PERFORMANCE: image defaults ── */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ── ACCESSIBILITY ── */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: 0.5rem 1rem;
  background: var(--blue-500);
  color: var(--navy-900);
  z-index: 100;
  font-weight: var(--font-weight-semibold);
}

.skip-link:focus {
  left: 0.5rem;
  top: 0.5rem;
}

/* ── TYPOGRAPHY ── */
h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-weight-bold);
  line-height: 1.2;
  color: var(--text-primary);
}

h1 { font-size: clamp(32px, 5vw, 64px); }
h2 { font-size: clamp(24px, 4vw, 48px); }
h3 { font-size: clamp(20px, 3vw, 32px); }
h4 { font-size: 24px; }
h5 { font-size: 20px; }
h6 { font-size: 16px; }

p {
  margin: 0;
  color: var(--text-secondary);
}

a {
  color: var(--blue-400);
  text-decoration: none;
  transition: color var(--transition-base);
}

a:hover {
  color: var(--blue-300);
}

code, pre {
  font-family: var(--font-mono);
}

/* ── LAYOUT ── */
.wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--gap-lg);
}

.relative {
  position: relative;
  z-index: 1;
}

/* ── GRID BACKGROUND ── */
.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(59, 130, 246, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(59, 130, 246, 0.04) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

.bg-radial {
  position: fixed;
  top: -20%;
  left: 50%;
  transform: translateX(-50%);
  width: 900px;
  height: 600px;
  background: radial-gradient(ellipse at center, rgba(59, 130, 246, 0.12) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--gap-md);
  padding: var(--gap-md) var(--gap-lg);
  border: none;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: var(--font-weight-semibold);
  font-family: var(--font-sans);
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-base);
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Primary Button */
.btn-primary {
  background-color: var(--blue-500);
  color: white;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--blue-400);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.4);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

/* Ghost Button */
.btn-ghost {
  background-color: transparent;
  color: var(--text-primary);
  border: 1px solid var(--navy-600);
}

.btn-ghost:hover:not(:disabled) {
  background-color: var(--navy-800);
  border-color: var(--blue-500);
  color: var(--blue-300);
}

/* Secondary Button */
.btn-secondary {
  background-color: var(--navy-700);
  color: var(--text-primary);
  border: 1px solid var(--navy-600);
}

.btn-secondary:hover:not(:disabled) {
  background-color: var(--navy-600);
  border-color: var(--blue-400);
}

/* Danger Button */
.btn-danger {
  background-color: var(--danger);
  color: white;
}

.btn-danger:hover:not(:disabled) {
  background-color: var(--danger-light);
  transform: translateY(-2px);
}

/* ── CARDS & CONTAINERS ── */
.card {
  display: flex;
  flex-direction: column;
  gap: var(--gap-lg);
  padding: var(--gap-xl);
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(8px);
  transition: all var(--transition-base);
}

.card:hover {
  border-color: rgba(59, 130, 246, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.card.elevated {
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

/* ── INPUT FIELDS ── */
input,
textarea,
select {
  font-family: var(--font-sans);
  font-size: 14px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
textarea,
select {
  width: 100%;
  padding: var(--gap-md) var(--gap-lg);
  background-color: var(--navy-800);
  border: 1px solid var(--navy-600);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

input[type="text"]::placeholder,
input[type="email"]::placeholder,
input[type="password"]::placeholder,
input[type="number"]::placeholder,
textarea::placeholder {
  color: var(--text-dim);
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* ── BADGES & TAGS ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--gap-sm);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: var(--font-weight-semibold);
  white-space: nowrap;
}

.badge-blue {
  background: rgba(59, 130, 246, 0.15);
  color: var(--blue-400);
}

.badge-green {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success-light);
}

.badge-amber {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
}

.badge-red {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger-light);
}

/* ── TABLES ── */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  padding: var(--gap-md) var(--gap-lg);
  text-align: left;
  border-bottom: 1px solid var(--border-light);
}

th {
  background-color: var(--navy-800);
  font-weight: var(--font-weight-semibold);
  color: var(--text-muted);
  white-space: nowrap;
}

tr:hover {
  background-color: rgba(59, 130, 246, 0.05);
}

/* ── LOADING & STATES ── */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid var(--navy-600);
  border-top-color: var(--blue-500);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.fade-in {
  animation: fade-in 0.3s ease-out;
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .hide-mobile {
    display: none;
  }

  .wrap {
    padding: 0 var(--gap-md);
  }

  h1 { font-size: clamp(24px, 5vw, 48px); }
  h2 { font-size: clamp(18px, 4vw, 36px); }
  h3 { font-size: clamp(16px, 3vw, 24px); }
}

@media (min-width: 769px) {
  .hide-desktop {
    display: none;
  }
}

/* ── PRINT ── */
@media print {
  .bg-grid,
  .bg-radial,
  .no-print {
    display: none;
  }

  body {
    background-color: white;
    color: black;
  }
}

/* �������������������������������������������������
   mdt-nav  �  global site navigation (all tools)
������������������������������������������������� */
.mdt-nav {
  position: sticky;
  top: 0;
  z-index: 200;
  background: rgba(6, 13, 26, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(59, 130, 246, 0.15);
}

.mdt-nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

/* logo */
.mdt-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: #f8fafc;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.4px;
  flex-shrink: 0;
  font-family: "Outfit", system-ui, sans-serif;
}

.mdt-logo b { color: #60a5fa; font-weight: 700; }

.mdt-logo-img {
  width: 30px;
  height: 30px;
  object-fit: contain;
  flex-shrink: 0;
}

/* links list */
.mdt-links {
  display: flex;
  align-items: center;
  gap: 2px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.mdt-links a {
  display: block;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  color: #94a3b8;
  text-decoration: none;
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
  font-family: "Outfit", system-ui, sans-serif;
}

.mdt-links a:hover {
  color: #f8fafc;
  background: rgba(59, 130, 246, 0.1);
}

.mdt-links .mdt-home-btn {
  color: #60a5fa;
  border: 1px solid rgba(96, 165, 250, 0.3);
  margin-left: 6px;
}

.mdt-links .mdt-home-btn:hover {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(96, 165, 250, 0.5);
  color: #93c5fd;
}

/* hamburger */
.mdt-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: #f8fafc;
  border-radius: 6px;
  line-height: 0;
  flex-shrink: 0;
}

.mdt-toggle:hover { background: rgba(59, 130, 246, 0.1); }

/* mobile */
@media (max-width: 640px) {
  .mdt-toggle { display: flex; align-items: center; }

  .mdt-links {
    display: none;
    flex-direction: column;
    align-items: stretch;
    position: absolute;
    top: 56px;
    left: 0;
    right: 0;
    background: #0f172a;
    border-bottom: 1px solid rgba(59, 130, 246, 0.15);
    padding: 8px 12px 12px;
    gap: 2px;
    z-index: 199;
  }

  .mdt-links.open { display: flex; }

  .mdt-links a { padding: 10px 14px; font-size: 14px; }

  .mdt-links .mdt-home-btn { margin-left: 0; margin-top: 4px; text-align: center; }
}
