/* ============================================
   tools.miehlav.ca — Master Stylesheet
   ============================================ */

/* --- Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* --- CSS Variables --- */
:root {
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --primary-light: #1e3a5f;
  --primary-50: #172554;
  --accent: #10b981;
  --accent-dark: #059669;
  --accent-light: #064e3b;
  --text: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-light: #64748b;
  --bg: #0b1120;
  --bg-alt: #111827;
  --bg-card: #1a2332;
  --border: #1e293b;
  --border-light: #1e293b;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4), 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.4), 0 4px 6px rgba(0, 0, 0, 0.3);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.5), 0 10px 10px rgba(0, 0, 0, 0.3);
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --transition: 0.2s ease;
  --max-width: 1200px;
}

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-dark); }
ul, ol { list-style: none; }

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

/* --- Header / Navigation --- */
.site-header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
}

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.navbar .logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text);
}

.navbar .logo svg {
  width: 28px;
  height: 28px;
}

.navbar .logo span {
  color: var(--primary);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav-links a {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 6px 0;
  position: relative;
  transition: color var(--transition);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--primary);
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--primary);
  transition: width var(--transition);
}

.nav-links a:hover::after,
.nav-links a.active::after {
  width: 100%;
}

/* Mobile menu button */
.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: var(--text);
}

.mobile-menu-btn svg {
  width: 24px;
  height: 24px;
}

/* --- Legal Pages --- */
.legal-page {
  padding: 48px 0 64px;
  max-width: 800px;
  margin: 0 auto;
}

.legal-page h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.legal-page .last-updated {
  color: var(--text-light);
  font-size: 0.85rem;
  margin-bottom: 32px;
}

.legal-page h2 {
  font-size: 1.3rem;
  font-weight: 600;
  margin-top: 32px;
  margin-bottom: 12px;
}

.legal-page h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-top: 24px;
  margin-bottom: 8px;
}

.legal-page p {
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 12px;
}

.legal-page ul, .legal-page ol {
  padding-left: 20px;
  margin-bottom: 12px;
}

.legal-page li {
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 6px;
}

.legal-page a {
  color: var(--primary);
}

/* --- Contact Page --- */
.contact-page {
  padding: 48px 0 64px;
  max-width: 650px;
  margin: 0 auto;
}

.contact-page h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.contact-page .subtitle {
  color: var(--text-secondary);
  margin-bottom: 32px;
}

.contact-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border-light);
}

.contact-item:last-child {
  border-bottom: none;
}

.contact-item .contact-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  background: var(--primary-50);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.contact-item .contact-label {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-bottom: 2px;
}

.contact-item .contact-value {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
  word-break: break-all;
}

.contact-item .contact-value a {
  color: var(--primary);
}

/* --- Footer --- */
.site-footer {
  margin-top: auto;
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  padding: 40px 0 24px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 32px;
  margin-bottom: 32px;
}

.footer-brand p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 8px;
  max-width: 320px;
}

.footer-col h4 {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text);
  margin-bottom: 12px;
}

.footer-col a {
  display: block;
  font-size: 0.9rem;
  color: var(--text-secondary);
  padding: 4px 0;
  transition: color var(--transition);
}

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

.footer-bottom {
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-light);
}

/* --- Hero Section --- */
.hero {
  text-align: center;
  padding: 64px 0 48px;
  background: linear-gradient(180deg, var(--primary-50) 0%, var(--bg) 100%);
}

.hero h1 {
  font-size: 2.75rem;
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 16px;
  color: var(--text);
}

.hero h1 span {
  color: var(--primary);
}

.hero p {
  font-size: 1.15rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 32px;
  line-height: 1.7;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 40px;
}

.hero-stat {
  text-align: center;
}

.hero-stat .number {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}

.hero-stat .label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* --- Tool Grid (Homepage) --- */
.tools-section {
  padding: 48px 0 64px;
}

.section-header {
  text-align: center;
  margin-bottom: 40px;
}

.section-header h2 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.section-header p {
  color: var(--text-secondary);
  font-size: 1rem;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}

.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  transition: all var(--transition);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

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

.tool-card .icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  font-size: 1.5rem;
}

.tool-card h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.tool-card p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.tool-card .card-arrow {
  position: absolute;
  top: 20px;
  right: 20px;
  color: var(--text-light);
  transition: all var(--transition);
  font-size: 1.2rem;
}

.tool-card:hover .card-arrow {
  color: var(--primary);
  transform: translateX(4px);
}

/* Tool card icon colors */
.tool-card .icon.blue { background: var(--primary-light); color: var(--primary); }
.tool-card .icon.green { background: var(--accent-light); color: var(--accent); }
.tool-card .icon.purple { background: #ede9fe; color: #7c3aed; }
.tool-card .icon.orange { background: #ffedd5; color: #ea580c; }
.tool-card .icon.pink { background: #fce7f3; color: #db2777; }
.tool-card .icon.teal { background: #ccfbf1; color: #0d9488; }
.tool-card .icon.indigo { background: #e0e7ff; color: #4f46e5; }
.tool-card .icon.yellow { background: #fef9c3; color: #ca8a04; }
.tool-card .icon.red { background: #fee2e2; color: #dc2626; }
.tool-card .icon.cyan { background: #cffafe; color: #0891b2; }

/* --- Individual Tool Page --- */
.tool-page {
  padding: 40px 0 64px;
}

.tool-page-header {
  margin-bottom: 32px;
}

.breadcrumb {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-bottom: 8px;
}

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

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

.tool-page-header h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.tool-page-header p {
  color: var(--text-secondary);
  font-size: 1.05rem;
  max-width: 650px;
}

/* --- Tool Card (the interactive tool interface) --- */
.tool-card-interactive {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 32px;
  box-shadow: var(--shadow);
}

.tool-card-interactive label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text);
}

.tool-card-interactive input[type="text"],
.tool-card-interactive input[type="number"],
.tool-card-interactive input[type="url"],
.tool-card-interactive textarea,
.tool-card-interactive select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.95rem;
  color: var(--text);
  background: var(--bg);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.tool-card-interactive input:focus,
.tool-card-interactive textarea:focus,
.tool-card-interactive select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.tool-card-interactive textarea {
  resize: vertical;
  min-height: 120px;
}

.tool-card-interactive .input-group {
  margin-bottom: 16px;
}

.tool-card-interactive .input-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.tool-card-interactive .result-box {
  background: var(--primary-50);
  border: 1px solid var(--primary-light);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-top: 16px;
}

.tool-card-interactive .result-box .result-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--primary);
}

.tool-card-interactive .result-box .result-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 500;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}

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

.btn-primary:hover {
  background: var(--primary-dark);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-alt);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--border-light);
  border-color: var(--text-light);
}

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

.btn-accent:hover {
  background: var(--accent-dark);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-sm {
  padding: 6px 16px;
  font-size: 0.85rem;
}

/* --- How-To Section --- */
.how-to-section {
  margin-bottom: 32px;
}

.how-to-section h2 {
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 16px;
}

.how-to-section ol {
  padding-left: 20px;
}

.how-to-section ol li {
  margin-bottom: 8px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* --- FAQ Section --- */
.faq-section {
  margin-bottom: 32px;
}

.faq-section h2 {
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 16px;
}

.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  overflow: hidden;
}

.faq-question {
  width: 100%;
  padding: 14px 20px;
  background: var(--bg);
  border: none;
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-align: left;
  transition: background var(--transition);
}

.faq-question:hover {
  background: var(--bg-alt);
}

.faq-question .faq-icon {
  font-size: 1.2rem;
  transition: transform var(--transition);
  color: var(--text-light);
}

.faq-item.open .faq-question .faq-icon {
  transform: rotate(180deg);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
  padding: 0 20px;
}

.faq-item.open .faq-answer {
  max-height: 300px;
  padding: 0 20px 16px;
}

.faq-answer p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.7;
}

/* --- Related Tools Section --- */
.related-tools {
  margin-bottom: 32px;
}

.related-tools h2 {
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 16px;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.related-tool-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition);
}

.related-tool-link:hover {
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* --- Newsletter / CTA --- */
.cta-section {
  background: var(--primary-50);
  border: 1px solid var(--primary-light);
  border-radius: var(--radius-lg);
  padding: 32px;
  text-align: center;
  margin-bottom: 32px;
}

.cta-section h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.cta-section p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 16px;
}

.cta-form {
  display: flex;
  gap: 8px;
  max-width: 400px;
  margin: 0 auto;
}

.cta-form input[type="email"] {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.9rem;
  outline: none;
  transition: border-color var(--transition);
}

.cta-form input[type="email"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* --- Ad Placeholders --- */
.ad-container {
  width: 100%;
  min-height: 90px;
  background: var(--bg-alt);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 24px 0;
  color: var(--text-light);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ad-container.ad-sidebar {
  min-height: 250px;
}

.ad-container.ad-leaderboard {
  min-height: 90px;
}

/* --- 404 Page --- */
.page-404 {
  text-align: center;
  padding: 120px 20px;
}

.page-404 h1 {
  font-size: 6rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
  margin-bottom: 8px;
}

.page-404 h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.page-404 p {
  color: var(--text-secondary);
  margin-bottom: 24px;
}

/* --- Responsive --- */
@media (max-width: 900px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }

  .hero h1 {
    font-size: 2.25rem;
  }
}

@media (max-width: 768px) {
  .nav-links {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 16px 20px;
    gap: 0;
    box-shadow: var(--shadow-lg);
  }

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

  .nav-links a {
    padding: 12px 0;
    width: 100%;
    border-bottom: 1px solid var(--border-light);
  }

  .nav-links a:last-child {
    border-bottom: none;
  }

  .mobile-menu-btn {
    display: block;
  }

  .hero h1 {
    font-size: 1.75rem;
  }

  .hero p {
    font-size: 1rem;
  }

  .hero-stats {
    gap: 24px;
    flex-wrap: wrap;
  }

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

  .tool-card-interactive .input-row {
    grid-template-columns: 1fr;
  }

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

  .footer-bottom {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }

  .cta-form {
    flex-direction: column;
  }

  .tool-page-header h1 {
    font-size: 1.5rem;
  }

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

@media (max-width: 480px) {
  .container {
    padding: 0 16px;
  }

  .hero {
    padding: 40px 0 32px;
  }

  .hero h1 {
    font-size: 1.5rem;
  }

  .tool-card {
    padding: 20px;
  }

  .tool-card-interactive {
    padding: 20px;
  }

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

/* --- Utilities --- */
.text-center { text-align: center; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mb-32 { margin-bottom: 32px; }

/* --- SEO Content Section --- */
.seo-content {
  margin-bottom: 32px;
}

.seo-content h2 {
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 12px;
  margin-top: 24px;
}

.seo-content h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 8px;
  margin-top: 20px;
}

.seo-content p {
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 12px;
}

.seo-content ul, .seo-content ol {
  padding-left: 20px;
  margin-bottom: 12px;
}

.seo-content li {
  color: var(--text-secondary);
  margin-bottom: 6px;
  line-height: 1.6;
}

/* --- Copy button --- */
.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 12px;
  font-size: 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition);
  font-family: var(--font);
}

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

.copy-btn.copied {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* --- Tool output display --- */
.output-display {
  position: relative;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  font-family: 'Courier New', monospace;
  font-size: 0.9rem;
  word-break: break-all;
  margin-top: 12px;
  min-height: 48px;
}

/* --- Range slider --- */
input[type="range"] {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border);
  border-radius: 3px;
  outline: none;
  margin: 8px 0;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: none;
}

/* --- Checkbox / Toggle styling --- */
.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 12px 0;
}

.checkbox-group label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 400;
  cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}
