/* =====================================================================
   CalcAny – Shared Stylesheet
   ===================================================================== */

/* RESET */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

/* BASE */
body {
  font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
  background: #fff;
  color: #0F172A;
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }

/* TYPOGRAPHY */
.serif { font-family: 'Playfair Display', Georgia, 'Times New Roman', serif; }

/* ── NAV ── */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: #fff;
  border-bottom: 1px solid #F3F4F6;
  height: 60px; padding: 0 32px;
  display: flex; align-items: center; justify-content: space-between;
}
.nav-logo { font-size: 19px; font-weight: 700; letter-spacing: -0.02em; }
.nav-logo .blue { color: #2563EB; }
.nav-logo .dark { color: #0F172A; }
.nav-links { display: flex; gap: 28px; }
.nav-links a { font-size: 14px; color: #4B5563; transition: color .15s; }
.nav-links a:hover { color: #0F172A; }

/* ── HERO ── */
.hero {
  text-align: center;
  padding: 80px 24px 56px;
  max-width: 640px;
  margin: 0 auto;
}
.hero h1 {
  font-size: clamp(38px, 6vw, 58px);
  font-weight: 800;
  color: #0F172A;
  line-height: 1.12;
  letter-spacing: -0.03em;
  margin-bottom: 20px;
}
.hero p { font-size: 18px; color: #6B7280; line-height: 1.65; }

/* ── HOME GRID ── */
.calc-section { max-width: 1020px; margin: 0 auto; padding: 0 24px 80px; }
.calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
  gap: 12px;
}
.calc-card {
  background: #F9FAFB;
  border-radius: 14px;
  padding: 24px 22px;
  display: block;
  transition: background .15s;
}
.calc-card:hover { background: #F1F5F9; }
.calc-card .card-icon {
  width: 28px; height: 28px;
  margin-bottom: 18px;
  display: block;
  color: #0F172A;
}
.calc-card h3 {
  font-size: 15px; font-weight: 700; color: #0F172A;
  margin-bottom: 22px; line-height: 1.35;
}
.calc-card .cta {
  font-size: 11px; font-weight: 700; color: #2563EB;
  letter-spacing: 0.08em;
  display: flex; align-items: center; gap: 4px;
}
.cta-arrow { font-size: 13px; }

/* ── WELCOME ── */
.welcome { max-width: 720px; margin: 0 auto 72px; padding: 0 32px; }
.welcome h2 { font-size: 30px; color: #0F172A; margin-bottom: 20px; }
.welcome p { font-size: 15px; color: #374151; line-height: 1.85; margin-bottom: 16px; }
.welcome strong { font-weight: 600; }
.welcome em { font-style: italic; }

/* ── FOOTER ── */
footer {
  border-top: 1px solid #F3F4F6;
  padding: 22px 32px;
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 12px;
}
.copy { font-size: 13px; color: #9CA3AF; }
.footer-links { display: flex; gap: 24px; }
.footer-links a { font-size: 13px; color: #6B7280; transition: color .15s; }
.footer-links a:hover { color: #0F172A; }

/* ── CALC PAGE HEADER ── */
.calc-page-header { max-width: 1080px; margin: 0 auto; padding: 28px 24px 0; }
.back-btn {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 13px; color: #6B7280;
  margin-bottom: 22px;
  transition: color .15s;
}
.back-btn:hover { color: #0F172A; }
.calc-page-header .category {
  font-size: 12px; font-weight: 600; color: #2563EB;
  letter-spacing: 0.06em; text-transform: uppercase;
}
.calc-page-header h1 {
  font-size: clamp(24px, 4vw, 34px); font-weight: 800; color: #0F172A;
  margin-top: 6px; margin-bottom: 8px; letter-spacing: -0.02em;
}
.calc-page-header .desc {
  font-size: 16px; color: #6B7280; margin-bottom: 36px;
}

/* ── TWO-COL LAYOUT ── */
.calc-layout {
  max-width: 1080px; margin: 0 auto; padding: 0 24px 80px;
  display: grid; grid-template-columns: 2fr 3fr;
  gap: 48px; align-items: start;
}

/* ── TOOL PANEL ── */
.tool-panel {
  background: #F9FAFB; border-radius: 16px; padding: 28px 24px;
}
.tool-panel > h2 { font-size: 15px; font-weight: 700; color: #0F172A; margin-bottom: 22px; }

/* Fields */
.field { margin-bottom: 16px; }
.field label {
  display: block; font-size: 13px; font-weight: 500; color: #374151; margin-bottom: 6px;
}
.field input,
.field select {
  width: 100%; padding: 10px 14px;
  border: 1.5px solid #E5E7EB; border-radius: 8px;
  font-size: 15px; background: #F9FAFB; color: #0F172A;
  font-family: inherit; transition: border-color .15s;
  -webkit-appearance: none; appearance: none;
}
.field input:focus,
.field select:focus {
  outline: none; border-color: #2563EB;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.field select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }

/* Toggle buttons */
.mode-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mode-col { display: flex; flex-direction: column; gap: 6px; }
.mode-btn {
  padding: 9px 14px; border: 1.5px solid #E5E7EB; border-radius: 8px;
  background: #F9FAFB; color: #374151;
  font-family: inherit; font-size: 14px; font-weight: 500;
  cursor: pointer; transition: all .15s; text-align: left;
}
.mode-btn.active { background: #0F172A; color: #fff; border-color: #0F172A; }

/* Calculate button */
.calc-btn {
  width: 100%; padding: 13px; margin-top: 4px;
  background: #0F172A; color: #fff;
  border: none; border-radius: 10px;
  font-size: 15px; font-weight: 600;
  cursor: pointer; font-family: inherit;
  letter-spacing: 0.01em; transition: opacity .15s;
}
.calc-btn:hover { opacity: 0.87; }

/* ── RESULTS ── */
.result-box {
  margin-top: 20px; background: #EFF6FF; border-radius: 12px; padding: 20px;
  display: none;
}
.result-box.show { display: block; }
.result-label {
  font-size: 11px; font-weight: 600; color: #6B7280;
  text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 14px;
}
.result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.result-grid.thirds { grid-template-columns: 1fr 1fr 1fr; }
.result-card { background: #fff; border-radius: 8px; padding: 11px 14px; }
.result-card.accent { border: 2px solid #2563EB; }
.rc-label { font-size: 11px; color: #6B7280; margin: 0 0 4px; font-weight: 500; }
.rc-value { font-size: 16px; font-weight: 700; color: #0F172A; margin: 0; }
.result-card.accent .rc-value { color: #1D4ED8; }

.result-highlight { background: #fff; border-radius: 10px; padding: 16px 20px; margin-bottom: 12px; }
.rh-label { font-size: 13px; color: #6B7280; margin: 0 0 4px; }
.rh-value { font-size: 20px; font-weight: 700; color: #0F172A; margin: 0; }

.result-big { text-align: center; background: #fff; border-radius: 10px; padding: 20px; margin-bottom: 10px; }
.rb-num { font-size: 52px; font-weight: 800; color: #0F172A; line-height: 1; display: block; }
.rb-sub { font-size: 13px; color: #6B7280; margin-top: 6px; display: block; }
.rb-badge {
  display: inline-block; margin-top: 10px; padding: 4px 16px;
  border-radius: 20px; font-weight: 600; font-size: 14px;
}
.result-single { background: #fff; border-radius: 10px; padding: 16px 20px; }
.rs-label { font-size: 13px; color: #6B7280; margin: 0 0 6px; }
.rs-value { font-size: 30px; font-weight: 800; color: #1D4ED8; margin: 0; }

.result-note { font-size: 13px; color: #6B7280; text-align: center; margin-top: 10px; }

/* ── GUIDE ── */
.guide > h2 { font-size: 27px; color: #0F172A; margin-bottom: 28px; line-height: 1.2; }
.guide-section { margin-bottom: 28px; }
.guide-section h3 { font-size: 16px; font-weight: 700; color: #0F172A; margin-bottom: 10px; }
.guide-section p { font-size: 15px; color: #374151; line-height: 1.8; }

/* ── FAQ ACCORDION ── */
.faq > h3 { font-size: 16px; font-weight: 700; color: #0F172A; margin-bottom: 18px; }
.faq-item { border-bottom: 1px solid #F3F4F6; }
.faq-btn {
  width: 100%; display: flex; justify-content: space-between; align-items: center;
  padding: 15px 0; background: none; border: none;
  cursor: pointer; font-family: inherit; text-align: left;
}
.faq-question { font-size: 15px; font-weight: 500; color: #0F172A; padding-right: 16px; line-height: 1.4; }
.faq-chevron {
  width: 18px; height: 18px; flex-shrink: 0; position: relative;
}
.faq-chevron::before {
  content: '';
  position: absolute; top: 50%; left: 50%;
  width: 8px; height: 8px;
  border-right: 2px solid #9CA3AF;
  border-bottom: 2px solid #9CA3AF;
  transform: translate(-50%, -65%) rotate(45deg);
  transition: transform .2s;
}
.faq-item.open .faq-chevron::before {
  transform: translate(-50%, -35%) rotate(-135deg);
}
.faq-answer {
  font-size: 14px; color: #4B5563; line-height: 1.75;
  padding-bottom: 16px; display: none;
}
.faq-item.open .faq-answer { display: block; }

/* ── LEGAL PAGES ── */
.legal-page { max-width: 760px; margin: 0 auto; padding: 56px 32px 80px; }
.legal-page h1 { font-size: 32px; font-weight: 800; color: #0F172A; margin-bottom: 8px; }
.legal-page .updated { font-size: 14px; color: #9CA3AF; margin-bottom: 40px; }
.legal-page h2 { font-size: 18px; font-weight: 700; color: #0F172A; margin: 32px 0 12px; }
.legal-page p { font-size: 15px; color: #374151; line-height: 1.8; margin-bottom: 14px; }
.legal-page ul { padding-left: 20px; margin-bottom: 14px; }
.legal-page ul li { font-size: 15px; color: #374151; line-height: 1.8; margin-bottom: 6px; }
.legal-page a { color: #2563EB; text-decoration: underline; }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .calc-layout { grid-template-columns: 1fr; }
  .calc-grid { grid-template-columns: 1fr 1fr; }
  .hero h1 { font-size: 36px; }
  .result-grid.thirds { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .nav { padding: 0 16px; }
  .calc-grid { grid-template-columns: 1fr; }
  .welcome { padding: 0 16px; }
  footer { padding: 20px 16px; }
  .calc-page-header { padding: 20px 16px 0; }
  .calc-layout { padding: 0 16px 60px; gap: 32px; }
  .legal-page { padding: 40px 20px 60px; }
}


/* =====================================================================
   DROPDOWN NAVIGATION
   ===================================================================== */

/* Override base gap for dropdown layout */
.nav-links { gap: 4px; align-items: center; }

.nav-dd { position: relative; }
.nav-cat {
  display: flex; align-items: center; gap: 5px;
  background: none; border: none; cursor: pointer;
  font-family: inherit; font-size: 14px; color: #4B5563;
  padding: 6px 8px; border-radius: 6px;
  transition: background .12s, color .12s; white-space: nowrap;
}
.nav-cat:hover,
.nav-dd.open .nav-cat { background: #F3F4F6; color: #0F172A; }

.dd-chevron {
  width: 14px; height: 14px; flex-shrink: 0;
  display: inline-block; position: relative;
}
.dd-chevron::before {
  content: ''; position: absolute; top: 50%; left: 50%;
  width: 5px; height: 5px;
  border-right: 1.5px solid #6B7280; border-bottom: 1.5px solid #6B7280;
  transform: translate(-50%, -65%) rotate(45deg);
  transition: transform .18s;
}
.nav-dd.open .dd-chevron::before { transform: translate(-50%, -35%) rotate(-135deg); }

.nav-dd-menu {
  position: absolute; top: calc(100% + 8px); left: 50%;
  transform: translateX(-50%) translateY(-4px);
  background: #fff; border: 1px solid #E5E7EB;
  border-radius: 10px; padding: 6px; min-width: 220px;
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .15s, transform .15s, visibility 0s linear .15s;
  box-shadow: 0 8px 24px rgba(0,0,0,0.09);
  z-index: 200;
}
.nav-dd.open .nav-dd-menu {
  opacity: 1; visibility: visible; pointer-events: auto;
  transform: translateX(-50%) translateY(0);
  transition: opacity .15s, transform .15s;
}
.nav-dd-menu a {
  display: block; padding: 9px 12px;
  font-size: 14px; color: #374151;
  border-radius: 6px; transition: background .1s;
}
.nav-dd-menu a:hover { background: #F9FAFB; color: #0F172A; }

.nav-link-plain {
  font-size: 14px; color: #4B5563; padding: 6px 8px; border-radius: 6px;
  transition: background .12s, color .12s; white-space: nowrap;
}
.nav-link-plain:hover { background: #F3F4F6; color: #0F172A; }

/* Hamburger button */
.nav-burger {
  display: none; flex-direction: column;
  justify-content: center; gap: 5px;
  background: none; border: none; cursor: pointer;
  padding: 6px; width: 36px; height: 36px; flex-shrink: 0;
}
.nav-burger span {
  display: block; width: 22px; height: 2px;
  background: #0F172A; border-radius: 2px; transition: all .22s;
}
.nav-burger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-burger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.nav-burger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile nav override */
@media (max-width: 768px) {
  .nav-links {
    display: none;
    position: fixed; top: 60px; left: 0; right: 0; bottom: 0;
    background: #fff; flex-direction: column;
    align-items: stretch; justify-content: flex-start;
    padding: 8px 20px 32px; gap: 0;
    overflow-y: auto; border-top: 1px solid #F3F4F6; z-index: 99;
  }
  .nav-links.open { display: flex; }
  .nav-burger { display: flex; }

  .nav-dd { border-bottom: 1px solid #F3F4F6; }
  .nav-cat {
    padding: 13px 0; font-size: 15px; font-weight: 500;
    color: #0F172A; border-radius: 0; width: 100%; justify-content: space-between;
  }
  .nav-cat:hover, .nav-dd.open .nav-cat { background: none; }
  .nav-dd-menu {
    position: static; transform: none;
    opacity: 1; visibility: visible; pointer-events: auto;
    border: none; box-shadow: none;
    background: #F9FAFB; border-radius: 8px;
    padding: 4px 8px; margin: 0 0 12px; min-width: unset;
    display: none; transition: none;
  }
  .nav-dd.open .nav-dd-menu { display: block; }
  .nav-dd-menu a { font-size: 14px; padding: 9px 10px; }
  .nav-link-plain {
    padding: 13px 0; font-size: 15px; font-weight: 500;
    color: #0F172A; border-top: 1px solid #F3F4F6;
    border-radius: 0; display: block; margin-top: 4px;
  }
  .nav-link-plain:hover { background: none; color: #2563EB; }
}

/* =====================================================================
   GUIDE LISTING PAGE
   ===================================================================== */
.guide-hero {
  text-align: center; padding: 72px 24px 48px;
  max-width: 640px; margin: 0 auto;
}
.guide-hero h1 {
  font-size: clamp(32px,5vw,48px); font-weight: 800; color: #0F172A;
  letter-spacing: -0.03em; margin-bottom: 16px;
}
.guide-hero p { font-size: 18px; color: #6B7280; line-height: 1.65; }

.post-grid-wrap { max-width: 1020px; margin: 0 auto; padding: 0 24px 80px; }
.post-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(290px,1fr)); gap: 24px; }
.post-card {
  background: #F9FAFB; border-radius: 16px; padding: 28px;
  display: flex; flex-direction: column; gap: 14px; transition: background .15s;
}
.post-card:hover { background: #F1F5F9; }
.post-tag {
  display: inline-block; font-size: 11px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 20px;
}
.tag-health  { background: #DCFCE7; color: #15803D; }
.tag-finance { background: #DBEAFE; color: #1D4ED8; }
.tag-math    { background: #F3E8FF; color: #7C3AED; }
.post-card h2 { font-size: 19px; font-weight: 700; color: #0F172A; line-height: 1.35; }
.post-card h2 a { color: inherit; }
.post-card > p { font-size: 14px; color: #6B7280; line-height: 1.7; flex: 1; }
.post-card-footer { display: flex; justify-content: space-between; align-items: center; }
.read-time { font-size: 12px; color: #9CA3AF; }
.read-link { font-size: 13px; font-weight: 600; color: #2563EB; }
.read-link:hover { text-decoration: underline; }

/* =====================================================================
   BLOG POST PAGE
   ===================================================================== */
.blog-post { max-width: 720px; margin: 0 auto; padding: 40px 24px 80px; }
.post-header { margin-bottom: 40px; }
.post-header .back-btn { margin-bottom: 20px; }
.post-header .post-tag { margin-bottom: 16px; display: inline-block; }
.post-header h1 {
  font-size: clamp(26px,4vw,40px); font-weight: 800; color: #0F172A;
  line-height: 1.15; letter-spacing: -0.025em; margin-bottom: 16px;
}
.post-intro { font-size: 18px; color: #4B5563; line-height: 1.7; margin-bottom: 16px; }
.post-meta { font-size: 13px; color: #9CA3AF; display: flex; gap: 8px; align-items: center; }
.post-divider { border: none; border-top: 1px solid #F3F4F6; margin: 40px 0; }

.post-body h2 { font-size: 22px; font-weight: 700; color: #0F172A; margin: 40px 0 14px; line-height: 1.3; }
.post-body h3 { font-size: 17px; font-weight: 700; color: #0F172A; margin: 28px 0 10px; }
.post-body p { font-size: 16px; color: #374151; line-height: 1.85; margin-bottom: 20px; }
.post-body ul, .post-body ol { padding-left: 22px; margin-bottom: 20px; }
.post-body li { font-size: 16px; color: #374151; line-height: 1.75; margin-bottom: 8px; }
.post-body strong { font-weight: 600; color: #0F172A; }
.post-body em { font-style: italic; }
.post-body table { width: 100%; border-collapse: collapse; margin: 8px 0 24px; }
.post-body th {
  background: #F9FAFB; padding: 10px 14px; text-align: left;
  font-size: 13px; font-weight: 600; color: #374151;
  border-bottom: 2px solid #E5E7EB;
}
.post-body td {
  padding: 10px 14px; font-size: 15px; color: #374151;
  border-bottom: 1px solid #F3F4F6;
}
.post-body tr:last-child td { border-bottom: none; }
.post-cta {
  background: #EFF6FF; border-radius: 12px; padding: 24px;
  margin: 40px 0; border-left: 4px solid #2563EB;
}
.post-cta p { font-size: 15px; color: #1E40AF; line-height: 1.7; margin: 0; }
.post-cta a { font-weight: 600; color: #2563EB; text-decoration: underline; }
.post-related { margin-top: 60px; padding-top: 40px; border-top: 1px solid #F3F4F6; }
.post-related h3 { font-size: 15px; font-weight: 700; color: #0F172A; margin-bottom: 14px; }
.post-related-links { display: flex; flex-wrap: wrap; gap: 10px; }
.post-related-links a {
  padding: 7px 16px; background: #F9FAFB; border-radius: 20px;
  font-size: 13px; font-weight: 500; color: #374151; transition: background .15s;
}
.post-related-links a:hover { background: #E2E8F0; color: #0F172A; }
@media (max-width: 480px) { .post-grid { grid-template-columns: 1fr; } }
