/* =========================================================
   SmartFinance Chrome — reusable page framework
   Nav + decision hero for every tool page.

   Load after calc-shared.css. Apply markup from PAGE-FRAMEWORK.md.
   ========================================================= */

:root {
  --sf-nav-h: var(--nav-bar, 56px);
  --sf-chrome-max: var(--page-max, 1080px);
  --sf-question: clamp(1.55rem, 4.2vw, 2.15rem);
  --sf-insight: clamp(0.95rem, 2.2vw, 1.05rem);
  --sf-ease: 180ms ease;
}

/* ── Product nav (replaces pill strip) ── */
/* Works on calc-shared, home.css, and blog.css shells */
.sf-nav .top-nav-inner {
  gap: 20px;
}

.sf-nav .nav-logo {
  font-size: 20px;
  letter-spacing: -0.035em;
}

/* Hide legacy flat calc links when sf-nav-primary is present */
.sf-nav .nav-links-calc:not(.sf-nav-primary) {
  display: none;
}

.sf-nav-primary {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
  margin-right: 8px;
}

.sf-nav-cluster {
  position: relative;
}

.sf-nav-trigger {
  appearance: none;
  font: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 8px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-mute);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: color var(--sf-ease), background var(--sf-ease);
}

.sf-nav-trigger::after {
  content: "";
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4px solid currentColor;
  opacity: 0.45;
  translate: 0 1px;
}

.sf-nav-trigger:hover,
.sf-nav-cluster.is-open .sf-nav-trigger {
  color: var(--ink);
  background: var(--line-soft);
}

.sf-nav-cluster.is-active .sf-nav-trigger {
  position: relative;
  color: var(--brand-dark);
}

.sf-nav-cluster.is-active .sf-nav-trigger::before {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 4px;
  height: 2px;
  border-radius: 2px;
  background: var(--brand);
}

.sf-nav-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 280px;
  padding: 8px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.1), 0 2px 6px rgba(15, 23, 42, 0.04);
  z-index: 1100;
}

.sf-nav-panel[hidden] {
  display: none;
}

.sf-nav-panel a {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--ink);
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  min-height: 0 !important;
  transform: none !important;
}

.sf-nav-panel a:hover {
  background: var(--brand-tint) !important;
}

.sf-nav-panel a.is-current {
  background: var(--brand-tint) !important;
  color: var(--brand-dark) !important;
  pointer-events: none;
}

.sf-nav-item-label {
  font-size: 14px;
  font-weight: 650;
  letter-spacing: -0.015em;
  line-height: 1.25;
}

.sf-nav-item-q {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-mute);
  line-height: 1.35;
}

.sf-nav-guides {
  display: inline-flex !important;
  align-items: center;
  min-height: 36px !important;
  padding: 8px 12px !important;
  border: 0 !important;
  border-radius: 8px !important;
  background: transparent !important;
  box-shadow: none !important;
  color: var(--ink-mute) !important;
  font-size: 13.5px !important;
  font-weight: 600 !important;
  text-decoration: none;
}

.sf-nav-guides:hover,
.sf-nav-guides.is-current {
  color: var(--brand-dark) !important;
  background: var(--brand-tint) !important;
  transform: none !important;
}

.sf-nav-mobile-only {
  display: none;
}

/* Mobile drawer: categorized list */
@media (max-width: 768px) {
  .sf-nav-primary {
    position: fixed;
    top: calc(var(--sf-nav-h) + env(safe-area-inset-top, 0px));
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    margin: 0;
    padding: 12px 16px calc(20px + env(safe-area-inset-bottom, 0px));
    background: #fff;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.12);
    z-index: 1001;
    max-height: min(82vh, calc(100dvh - var(--sf-nav-h) - env(safe-area-inset-top, 0px)));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .sf-nav.is-open .sf-nav-primary {
    display: flex;
  }

  /* home.css / blog.css open drawers via .nav-links — keep sf-nav working */
  body.home-page .sf-nav.is-open .sf-nav-primary,
  .sf-nav.is-open .sf-nav-primary {
    display: flex !important;
  }

  .sf-nav-cluster {
    border-bottom: 1px solid var(--line-soft);
    padding: 4px 0 10px;
  }

  .sf-nav-cluster:last-of-type {
    border-bottom: 0;
  }

  .sf-nav-trigger {
    width: 100%;
    justify-content: space-between;
    min-height: 44px;
    padding: 10px 4px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-faint);
    pointer-events: none;
  }

  .sf-nav-trigger::after,
  .sf-nav-cluster.is-active .sf-nav-trigger::before {
    display: none;
  }

  .sf-nav-panel {
    position: static;
    min-width: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
    background: transparent;
  }

  .sf-nav-panel[hidden] {
    display: grid !important;
  }

  .sf-nav-panel a {
    padding: 12px 10px;
    min-height: 48px;
    align-content: center;
  }

  .sf-nav-item-label {
    font-size: 16px;
  }

  .sf-nav-guides {
    margin-top: 8px !important;
    min-height: 48px !important;
    padding: 12px 10px !important;
    font-size: 16px !important;
    justify-content: flex-start;
  }

  .sf-nav-mobile-only {
    display: block;
  }
}

.sf-nav .hamburger-btn {
  display: none;
}

@media (max-width: 768px) {
  .sf-nav .hamburger-btn {
    display: inline-flex;
  }
}

/* ── Decision hero system ── */
.sf-hero {
  margin: 0 0 8px;
  padding: 18px 4px 16px;
  border: 0;
  background: transparent;
}

.sf-hero-tool {
  display: block;
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ink-mute);
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sf-hero-category,
.sf-hero-sep,
.sf-hero-lead {
  display: inline;
}

.sf-hero-category {
  color: var(--brand-dark);
}

.sf-hero-sep {
  color: var(--ink-faint);
  font-weight: 500;
  margin: 0 0.35em;
}

.sf-hero-lead {
  color: var(--ink-mute);
  font-weight: 550;
}

/* SEO keyword H1 — primary document heading */
.sf-hero-title {
  margin: 0;
  max-width: none;
  font-family: var(--display);
  font-size: var(--sf-question);
  font-weight: 650;
  letter-spacing: -0.035em;
  line-height: 1.2;
  color: var(--ink);
  text-wrap: balance;
}

/* Legacy class alias if any page still references it */
.sf-hero-question {
  margin: 0;
  max-width: none;
  font-family: var(--display);
  font-size: var(--sf-question);
  font-weight: 650;
  letter-spacing: -0.035em;
  line-height: 1.2;
  color: var(--ink);
}

.sf-hero-insight {
  margin: 10px 0 0;
  max-width: 42rem;
  font-size: var(--sf-insight);
  font-weight: 500;
  line-height: 1.5;
  color: var(--ink-mute);
  text-wrap: pretty;
}

.sf-hero-consequence {
  margin: 12px 0 0;
  max-width: 40ch;
  padding: 0;
  border: 0;
  background: none;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--brand-dark);
}

/* Theme accents — thin category signal only */
.sf-hero[data-theme="emi"] .sf-hero-category,
.sf-hero[data-theme="evt"] .sf-hero-category {
  color: #c2410c;
}

.sf-hero[data-theme="sip"] .sf-hero-category {
  color: #0f766e;
}

.sf-hero[data-theme="fd"] .sf-hero-category,
.sf-hero[data-theme="rd"] .sf-hero-category {
  color: #475569;
}

.sf-hero[data-theme="ppf"] .sf-hero-category {
  color: #047857;
}

.sf-hero[data-theme="ssy"] .sf-hero-category {
  color: #be185d;
}

/* When sf-hero is used, quiet the old breadcrumb (SEO still in JSON-LD) */
.page:has(> .calc-page-stack > .sf-hero) > .page-breadcrumb,
.page:has(.sf-hero) > .page-breadcrumb {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Stack: hero sits cleanly above white tool surface */
.calc-page-stack > .sf-hero {
  padding: 20px 16px 18px;
}

.calc-page-stack:has(> .sf-hero)::before {
  opacity: 0.85;
}

/* Mobile-first first screen: question → insight → inputs fast */
@media (max-width: 600px) {
  .sf-hero,
  .calc-page-stack > .sf-hero {
    padding: 14px 12px 14px;
  }

  .sf-hero-tool {
    margin-bottom: 8px;
    font-size: 12.5px;
  }

  .sf-hero-title,
  .sf-hero-question {
    max-width: none;
    font-size: clamp(1.4rem, 6vw, 1.7rem);
    line-height: 1.22;
  }

  .sf-hero-insight {
    margin-top: 8px;
    font-size: 0.9375rem;
    max-width: none;
  }

  .sf-hero-consequence {
    display: none; /* keep first screen lean; consequence lives in results */
  }

  .calc-page-stack > .sf-hero + .calc-shell {
    margin-top: 4px;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .sf-nav-trigger,
  .sf-nav-panel a,
  .sf-nav-guides {
    transition: none;
  }
}

/* =========================================================
   Signature pattern — Bank shows X / What matters Y
   Reuse on any page (home hero already uses these classes).

   Markup:
   <div class="sf-outcome-gap">
     <div class="sf-outcome-gap-stack">
       <div class="sf-outcome-gap-was">
         <span class="sf-outcome-gap-label">Bank shows</span>
         <strong class="sf-outcome-gap-num">₹7.01L</strong>
       </div>
       <div class="sf-outcome-gap-real">
         <span class="sf-outcome-gap-label">You may keep</span>
         <strong class="sf-outcome-gap-num">₹4.79L</strong>
       </div>
     </div>
     <p class="sf-outcome-gap-meta">Context line</p>
   </div>
   ========================================================= */

.sf-outcome-gap {
  min-width: 0;
}

.sf-outcome-gap-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sf-outcome-gap-label {
  display: block;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint, #94a3b8);
}

.sf-outcome-gap-real .sf-outcome-gap-label {
  color: var(--brand-dark, #0f7558);
}

.sf-outcome-gap-num {
  display: block;
  font-family: var(--display, "Fraunces", Georgia, serif);
  font-weight: 650;
  letter-spacing: -0.04em;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

.sf-outcome-gap-was .sf-outcome-gap-num {
  font-size: clamp(1.35rem, 2.4vw, 1.85rem);
  color: #94a3b8;
  text-decoration: line-through;
  text-decoration-thickness: 2px;
  text-decoration-color: rgba(148, 163, 184, 0.7);
}

.sf-outcome-gap-real .sf-outcome-gap-num {
  font-size: clamp(2rem, 3.6vw, 2.85rem);
  color: var(--brand-dark, #0f7558);
}

.sf-outcome-gap-meta {
  margin: 14px 0 0;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--ink-mute, #475569);
}

@media (max-width: 600px) {
  .sf-outcome-gap-stack {
    flex-direction: row;
    gap: 16px;
  }

  .sf-outcome-gap-was,
  .sf-outcome-gap-real {
    flex: 1 1 0;
    min-width: 0;
  }
}

