:root {
  --primary: #3b82f6;
  /* Blue 500 */
  --primary-hover: #2563eb;
  /* Blue 600 */
  --bg: #ffffff;
  --surface: #ffffff;
  --text: #334155;
  /* Slate 700 */
  --text-heading: #0f172a;
  /* Slate 900 */
  --border: #e2e8f0;
  /* Slate 200 */
  --shadow: 0 10px 15px -3px rgb(0 0 0 / 0.05), 0 4px 6px -2px rgb(0 0 0 / 0.05);
}

/* 1. Reset & Base */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

header,
main,
footer {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

header {
  padding-top: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
  text-align: center;
}

h1 {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--text-heading);
  margin-bottom: 0.5rem;
}

.description {
  font-size: 1.125rem;
  color: #64748b;
  /* Slate 500 */
  max-width: 60ch;
  margin: 0 auto;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s;
}

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

/* 2. Calculator Tool Card */
.calculator-interface {
  max-width: 600px;
  margin: 0 auto 3rem auto;
}

#calc-container {
  background: var(--surface);
  padding: 2.5rem;
  border-radius: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.input-group {
  margin-bottom: 1.5rem;
}

label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-heading);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

input[type="number"] {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1.125rem;
  color: var(--text-heading);
  background: #f8fafc;
  transition: all 0.2s;
  box-sizing: border-box;
  /* Critical for padding */
}

input[type="number"]:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

#result-box {
  margin-top: 2rem;
  padding: 1.5rem;
  background: #eff6ff;
  border-radius: 8px;
  color: var(--primary-hover);
  font-weight: 700;
  font-size: 1.5rem;
  text-align: center;
  border: 1px solid #bfdbfe;
}

.result-hidden {
  display: none;
}

.result-visible {
  display: block;
  animation: fadeIn 0.3s ease-out;
}

/* 3. Ads */
.ad-container {
  margin: 2rem auto;
  text-align: center;
  clear: both;
}

.ad-label {
  display: block;
  font-size: 0.7rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.25rem;
}

.ad-slot {
  background: #f1f5f9;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #cbd5e1;
  border-radius: 4px;
  overflow: hidden;
}

/* 4. Content Body */
.content-body {
  max-width: 65ch;
  margin: 0 auto;
  font-size: 1.05rem;
}

.content-body h2 {
  margin-top: 2.5rem;
  color: var(--text-heading);
}

.content-body p {
  margin-bottom: 1.5rem;
}

/* Components */
.affiliate-cta {
  background: #ffffff;
  border: 2px solid #fcd34d;
  padding: 2rem;
  border-radius: 12px;
  text-align: center;
  margin: 3rem auto;
  max-width: 500px;
  box-shadow: 0 4px 6px -1px rgba(251, 191, 36, 0.1);
}

.affiliate-cta h3 {
  margin-top: 0;
  color: #92400e;
}

.button {
  display: inline-block;
  background: var(--primary);
  color: white;
  padding: 0.875rem 2rem;
  border-radius: 999px;
  margin-top: 1rem;
  font-weight: 600;
  box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.3);
}

.button:hover {
  background: var(--primary-hover);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 6px 8px -1px rgba(59, 130, 246, 0.4);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =========================================
   PREMIUM APP-STYLE HOMEPAGE
   ========================================= */

/* Premium Hero */
.premium-hero {
  background: white;
  /* Clean look */
  color: var(--text-heading);
  padding: 3rem 1.5rem;
  border-bottom: 1px solid var(--border);
  text-align: center;
  box-shadow: none;
  /* Removed heavy shadow */
  margin-bottom: 1rem;
}

.premium-hero h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  letter-spacing: -0.05em;
  color: #1e293b;
}

.highlight {
  color: var(--primary);
}

.hero-sub {
  font-size: 1.1rem;
  color: #64748b;
  margin-bottom: 2rem;
}

/* Search Bar */
.search-container {
  max-width: 400px;
  margin: 0 auto;
  position: relative;
}

#toolSearch {
  width: 100%;
  padding: 1rem 1.5rem;
  font-size: 1rem;
  border: 2px solid #e2e8f0;
  border-radius: 99px;
  background: #f8fafc;
  transition: all 0.2s;
  text-align: center;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

#toolSearch:focus {
  outline: none;
  border-color: var(--primary);
  background: white;
  box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.15);
}

/* App Grid (The Core Change) */
.app-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  /* Mobile: 2 Columns */
  gap: 1rem;
  padding: 1rem 0;
}

/* Desktop override */
@media (min-width: 640px) {
  .app-grid {
    grid-template-columns: repeat(4, 1fr);
    /* Desktop: 4 Columns */
    gap: 1.5rem;
  }
}

.tool-tile {
  background: white;
  border: 1px solid var(--border);
  border-radius: 16px;
  /* App icon feel */
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  aspect-ratio: 1/1;
  /* Square tiles */
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.tool-tile:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  border-color: var(--primary);
}

.tile-icon {
  color: var(--primary);
  width: 48px;
  height: 48px;
  margin-bottom: 1rem;
}

.tile-icon svg {
  width: 100%;
  height: 100%;
}

.tile-title {
  font-weight: 600;
  color: var(--text-heading);
  font-size: 0.95rem;
  line-height: 1.2;
}

/* Ad Slots */
.ad-slot-leaderboard {
  margin: 1rem 0;
  text-align: center;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1rem;
}

/* SEO Block */
.seo-content-block {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  color: #64748b;
}

.seo-text h2 {
  font-size: 1.5rem;
  color: var(--text-heading);
}

.seo-text h3 {
  font-size: 1.25rem;
  margin-top: 1.5rem;
  color: var(--text-heading);
}