/* ============================================================
   SiteCalc — main.css
   Mobile-first. Three breakpoints: mobile / tablet / desktop
   ============================================================ */

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #ffffff;
  color: #1a1a1a;
  line-height: 1.6;
}

a { color: #1d6fd8; text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }

/* ===== TYPOGRAPHY ===== */
h1 { font-size: 1.75rem; font-weight: 800; line-height: 1.25; color: #0f172a; margin-bottom: 1rem; }
h2 { font-size: 1.25rem; font-weight: 700; color: #0f172a; margin-bottom: 0.75rem; }
h3 { font-size: 1.05rem; font-weight: 600; color: #0f172a; margin-bottom: 0.5rem; }
p  { margin-bottom: 1rem; color: #374151; }
p:last-child { margin-bottom: 0; }

@media (min-width: 768px)  { h1 { font-size: 2.1rem; } }
@media (min-width: 1200px) { h1 { font-size: 2.4rem; } h2 { font-size: 1.35rem; } }

/* ===== NAVIGATION ===== */
.site-nav {
  background: #0f172a;
  position: relative;
  z-index: 200;
}

.nav-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  height: 52px;
}

.nav-logo {
  color: #fff;
  font-size: 1.2rem;
  font-weight: 800;
  text-decoration: none;
  letter-spacing: -0.5px;
  flex-shrink: 0;
}
.nav-logo .accent { color: #f59e0b; }

/* ===== HAMBURGER BUTTON ===== */
.nav-hamburger {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.6rem;
  cursor: pointer;
  padding: 0.2rem 0.45rem;
  line-height: 1;
  flex-shrink: 0;
}

/* ===== MOBILE NAV (< 768px) ===== */
@media (max-width: 767px) {
  .nav-inner {
    height: auto;
    min-height: 52px;
    flex-wrap: wrap;
    align-items: center;
  }
  .nav-hamburger { display: block; }
  .nav-links { display: none; }
  .site-nav.open .nav-links {
    display: flex;
    flex-direction: column;
    gap: 0;
    flex-basis: 100%;
    padding: 0.2rem 0 0.8rem;
    border-top: 1px solid #1e293b;
  }
  .site-nav.open .nav-links li { border-bottom: 1px solid #1e293b; }
  .site-nav.open .nav-links a {
    display: block;
    padding: 0.75rem 0;
    font-size: 0.95rem;
    color: #e2e8f0;
    white-space: normal;
  }
  .site-nav.open .nav-links a.active { color: #fff; }
}

.nav-links {
  display: flex;
  gap: 1.1rem;
  list-style: none;
  flex-wrap: wrap;
}

.nav-links a {
  color: #94a3b8;
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  transition: color 0.15s;
}
.nav-links a:hover,
.nav-links a.active { color: #fff; text-decoration: none; }

/* ===== AD UNIT BASE ===== */
.ad-unit {
  background: #f5f5f5;
  border: 1px solid #e0e0e0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #c0c0c0;
  font-size: 10px;
  font-family: monospace;
  position: relative;
  overflow: hidden;
}

/* "Advertisement" label for gutter units on desktop */
.ad-gutter-label {
  display: none;
  font-size: 9px;
  color: #bbb;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 3px;
  text-align: center;
}

@media (min-width: 1200px) {
  .ad-gutter-label { display: block; }
}

/* ===== MOBILE ADS  (default — shown < 768px) ===== */
.ad-mobile-top-wrap {
  display: flex;
  justify-content: center;
  background: #efefef;
  padding: 4px 0;
}
.ad-mobile-top-wrap .ad-unit { width: 320px; height: 50px; }

.ad-mobile-mid {
  display: flex;
  justify-content: center;
  margin: 1rem 0 0.5rem;
}
.ad-mobile-mid .ad-unit { width: 320px; height: 50px; }

.ad-mobile-result {
  display: flex;
  justify-content: center;
  margin: 1.25rem 0;
}
.ad-mobile-result .ad-unit { width: 300px; height: 250px; }

.ad-mobile-faq {
  display: flex;
  justify-content: center;
  margin: 1.25rem 0;
}
.ad-mobile-faq .ad-unit { width: 320px; height: 50px; }

.ad-mobile-bottom-wrap {
  display: flex;
  justify-content: center;
  background: #efefef;
  padding: 6px 0;
}
.ad-mobile-bottom-wrap .ad-unit { width: 320px; height: 50px; }

/* ===== HIDE TABLET/DESKTOP ADS ON MOBILE ===== */
.ad-leaderboard-wrap,
.ad-leaderboard-mid,
.ad-gutter-left,
.ad-gutter-right,
.ad-inline-result { display: none; }

/* ===== TABLET  (768px – 1199px) ===== */
@media (min-width: 768px) {
  /* Hide mobile units */
  .ad-mobile-top-wrap,
  .ad-mobile-mid,
  .ad-mobile-result,
  .ad-mobile-faq,
  .ad-mobile-bottom-wrap { display: none; }

  /* Leaderboard wrapper — used for top and bottom placements */
  .ad-leaderboard-wrap {
    display: flex;
    justify-content: center;
    background: #f8f8f8;
    border-top: 1px solid #ebebeb;
    border-bottom: 1px solid #ebebeb;
    padding: 10px 0;
  }
  .ad-leaderboard-wrap .ad-unit { width: 728px; height: 90px; }

  /* Mid-page leaderboard — inside main content column */
  .ad-leaderboard-mid {
    display: flex;
    justify-content: center;
    background: #f8f8f8;
    border-top: 1px solid #ebebeb;
    border-bottom: 1px solid #ebebeb;
    padding: 10px 0;
    margin: 1.75rem 0;
  }
  .ad-leaderboard-mid .ad-unit { width: 728px; height: 90px; }

  /* Inline rect below result */
  .ad-inline-result {
    display: flex;
    justify-content: center;
    margin: 1.5rem 0;
  }
  .ad-inline-result .ad-unit { width: 300px; height: 250px; }
}

/* ===== DESKTOP  (1200px+) ===== */
@media (min-width: 1200px) {
  .ad-gutter-left,
  .ad-gutter-right {
    display: block;
    width: 320px;
    padding: 24px 10px;
    flex-shrink: 0;
  }

  .ad-gutter-sticky {
    position: sticky;
    top: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
  }

  .ad-gutter-item { display: flex; flex-direction: column; align-items: center; }
  .ad-gutter-item .ad-unit { width: 300px; height: 250px; }
}

/* ===== PAGE LAYOUT ===== */
.page-outer { width: 100%; }

@media (min-width: 1200px) {
  .page-outer {
    display: grid;
    grid-template-columns: 320px 1fr 320px;
    max-width: 1400px;
    margin: 0 auto;
    align-items: start;
  }
}

.main-content {
  width: 100%;
  padding: 1.5rem 1rem 2.5rem;
}

@media (min-width: 768px) {
  .main-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1.5rem 3rem;
  }
}

@media (min-width: 1200px) {
  .main-content {
    max-width: 760px;
    padding: 2rem 1.5rem 3rem;
  }
}

/* ===== BREADCRUMB ===== */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: #94a3b8;
  margin-bottom: 1.1rem;
}
.breadcrumb a { color: #1d6fd8; }
.breadcrumb-sep { color: #cbd5e1; }

/* ===== HOMEPAGE — HERO ===== */
.hero-intro {
  background: #eff6ff;
  border-left: 4px solid #2563eb;
  border-radius: 0 8px 8px 0;
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
}
.hero-intro p { color: #1e3a5f; font-size: 0.975rem; line-height: 1.75; margin: 0; }

/* ===== HOMEPAGE — CATEGORY GRID ===== */
.section-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #64748b;
  margin-bottom: 1rem;
}

.category-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.1rem;
  margin-bottom: 2.5rem;
}

@media (min-width: 500px) { .category-grid { grid-template-columns: 1fr 1fr; } }

.category-card {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 1.25rem;
  background: #fff;
  transition: box-shadow 0.2s, border-color 0.2s;
}
.category-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.08); border-color: #bfdbfe; }

.category-card h2 {
  font-size: 1rem;
  border-bottom: 2px solid #f59e0b;
  padding-bottom: 0.5rem;
  margin-bottom: 0.85rem;
}

.category-card ul { list-style: none; }

.category-card li {
  padding: 0.4rem 0;
  border-bottom: 1px solid #f1f5f9;
}
.category-card li:last-child { border-bottom: none; padding-bottom: 0; }

.category-card a {
  font-size: 0.875rem;
  color: #1d6fd8;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.category-card a::before { content: '→'; font-size: 0.8rem; color: #94a3b8; }
.category-card a:hover { color: #1e40af; text-decoration: none; }

/* ===== FAQ ===== */
.faq-section { margin: 2rem 0; }

.faq-item {
  border-bottom: 1px solid #e2e8f0;
  padding: 1rem 0;
}
.faq-item:first-of-type { border-top: 1px solid #e2e8f0; }

.faq-q { font-weight: 700; font-size: 0.95rem; color: #0f172a; margin-bottom: 0.4rem; }
.faq-a { font-size: 0.9rem; color: #4b5563; line-height: 1.7; }

/* ===== EXPLAINER ===== */
.explainer {
  background: #f8faff;
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  margin: 1.75rem 0;
  font-size: 0.925rem;
  color: #374151;
  line-height: 1.8;
}

/* ===== CALCULATOR CARD ===== */
.calc-card {
  background: #f8faff;
  border: 1px solid #dce7fb;
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.75rem;
}

.form-group { margin-bottom: 1.2rem; }

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 0.4rem;
}

.form-group input[type="number"],
.form-group input[type="text"],
.form-group select {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border: 1.5px solid #d1d5db;
  border-radius: 8px;
  font-size: 1rem;
  background: #fff;
  color: #0f172a;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-hint { font-size: 0.78rem; color: #9ca3af; margin-top: 0.3rem; }

.input-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.input-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.75rem; }

/* Enforce 150px clearance — button sits in its own padded section */
.calc-btn-wrap {
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid #dce7fb;
}

.calc-btn {
  width: 100%;
  padding: 0.9rem 1rem;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.calc-btn:hover  { background: #1d4ed8; }
.calc-btn:active { background: #1e40af; transform: translateY(1px); }

/* ===== RESULT OUTPUT ===== */
.result-wrap {
  display: none;
  background: #fff;
  border: 2px solid #2563eb;
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  animation: fadein 0.2s ease;
}
.result-wrap.visible { display: block; }

@keyframes fadein {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.result-tag {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #64748b;
  margin-bottom: 0.5rem;
}

.result-primary {
  font-size: 2.8rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.1;
}

.result-unit { font-size: 1rem; font-weight: 400; color: #64748b; margin-left: 0.2rem; }

.result-secondary { font-size: 0.95rem; color: #374151; margin-top: 0.4rem; margin-bottom: 1.25rem; }

.result-breakdown { border-top: 1px solid #e2e8f0; padding-top: 1rem; }

.result-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.42rem 0;
  font-size: 0.9rem;
  border-bottom: 1px solid #f1f5f9;
}
.result-row:last-child { border-bottom: none; }
.result-row-label { color: #6b7280; }
.result-row-value { font-weight: 700; color: #0f172a; }

/* ===== RELATED CALCULATORS ===== */
.related-section { margin: 2rem 0 1rem; }

.related-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 0.85rem;
}
@media (max-width: 380px) { .related-grid { grid-template-columns: 1fr; } }

.related-link {
  display: block;
  padding: 0.8rem 1rem;
  background: #f8faff;
  border: 1px solid #dce7fb;
  border-radius: 8px;
  color: #1d6fd8;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.4;
  transition: background 0.15s, border-color 0.15s;
}
.related-link:hover { background: #eff6ff; border-color: #93c5fd; text-decoration: none; }

/* ===== AU TOP BAR ===== */
.au-topbar {
  background: #1e3a5f;
  color: #bfdbfe;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.45rem 1rem;
  letter-spacing: 0.15px;
  line-height: 1.4;
}

/* ===== FOOTER ===== */
.site-footer {
  background: #0f172a;
  color: #64748b;
  padding: 2.5rem 1rem 1.5rem;
  margin-top: 2rem;
}

.footer-wide { max-width: 1200px; margin: 0 auto; }

.footer-top-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  padding-bottom: 1.5rem;
}
@media (min-width: 768px) {
  .footer-top-row { grid-template-columns: 190px 1fr; gap: 2.5rem; }
}

.footer-brand-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: #fff;
  font-size: 1.1rem;
  font-weight: 800;
  text-decoration: none;
  letter-spacing: -0.5px;
  margin-bottom: 0.75rem;
}
.footer-brand-link:hover { color: #f8fafc; text-decoration: none; }
.footer-accent { color: #f59e0b; }

.footer-tagline { font-size: 0.78rem; color: #475569; line-height: 1.55; margin-bottom: 0.6rem; }
.footer-copy { font-size: 0.72rem; color: #334155; margin: 0; }

.footer-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem 1rem;
}
@media (min-width: 640px) {
  .footer-nav { grid-template-columns: repeat(4, 1fr); }
}

.footer-col-head {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.9px;
  color: #94a3b8;
  margin: 0 0 0.5rem;
}
.footer-col ul { list-style: none; padding: 0; margin: 0; }
.footer-col ul li { margin-bottom: 0.25rem; }
.footer-col ul li a { font-size: 0.775rem; color: #64748b; transition: color 0.15s; text-decoration: none; }
.footer-col ul li a:hover { color: #cbd5e1; text-decoration: none; }

.footer-bottom {
  border-top: 1px solid #1e293b;
  padding-top: 1rem;
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}
.footer-bottom a { font-size: 0.75rem; color: #475569; transition: color 0.15s; text-decoration: none; }
.footer-bottom a:hover { color: #94a3b8; text-decoration: none; }
