/* ============================================================
   FirePath — App design system (signed-in pages)
   /css/app.css

   One set of tokens, one app shell (rail, tab bar, Ask pill) and
   the handful of components every signed-in page is built from.
   Page files only add what's unique to that page.
   ============================================================ */

:root {
  /* Brand */
  --ember:        #F4622A;
  --amber:        #F9A825;
  --ember-ink:    #C4480F;   /* orange for small text on light — passes AA */
  --ember-wash:   rgba(244, 98, 42, 0.08);

  /* Surfaces */
  --bg:           #FDF6EE;
  --surface:      #FFFFFF;
  --surface-2:    #F8F0E7;   /* sunken / secondary panels */
  --espresso:     #241910;   /* rail + the one dark "earned" surface */
  --espresso-2:   #3A2A1D;

  /* Ink — three levels, all tested against --bg and --surface */
  --ink:          #2B1D14;   /* primary text, figures */
  --ink-2:        #65544A;   /* secondary text — 6.3:1 on --bg */
  --ink-3:        #9A8A80;   /* labels at 11px+ uppercase, axis text, decoration only */

  /* Lines */
  --line:         #EDE3DA;
  --line-strong:  #E2D5C8;

  /* Status */
  --positive:     #2E7D32;
  --positive-wash: rgba(46, 125, 50, 0.1);
  --negative:     #C4480F;
  --negative-wash: rgba(196, 72, 15, 0.1);

  /* Accents for tool categories */
  --blue:   #3A6EA5;
  --purple: #7C5CA8;
  --green:  #3E8E5A;

  /* Type */
  --font-display: 'Playfair Display', Georgia, serif;
  --font-ui: 'DM Sans', system-ui, -apple-system, sans-serif;

  /* Radii */
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;

  /* Elevation — soft, warm, layered; never a single hard drop shadow */
  --shadow-1: 0 1px 2px rgba(43, 29, 20, 0.04), 0 1px 1px rgba(43, 29, 20, 0.02);
  --shadow-2: 0 1px 2px rgba(43, 29, 20, 0.04), 0 10px 28px -8px rgba(43, 29, 20, 0.10);
  --shadow-3: 0 2px 4px rgba(43, 29, 20, 0.04), 0 24px 48px -12px rgba(43, 29, 20, 0.16);

  /* Motion */
  --dur-fast: 140ms;
  --dur-base: 240ms;
  --dur-slow: 480ms;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);

  /* Shell */
  --rail-w: 240px;
  --nav-h: 64px;

  /* Legacy names used across older page CSS — point them at the tokens above so
     every page shares one palette. New code should use the names above. */
  --fire-orange: var(--ember);
  --fire-amber:  var(--amber);
  --warm-cream:  var(--bg);
  --warm-brown:  var(--ink);
  --soft-grey:   var(--ink-2);
  --mid-grey:    var(--ink-3);
  --card-bg:     var(--surface);
  --border:      var(--line);
  --border-soft: rgba(237, 227, 218, 0.6);
  --dark-bg:     var(--espresso);
  --icon-orange: var(--ember);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body.app, body.site {
  display: block; min-height: 100vh; padding: 0;
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'ss01';
  line-height: 1.5;
}
:where(.app, .site) a { color: inherit; }
body.app::before, body.site::before { display: none; }
.num { font-variant-numeric: tabular-nums lining-nums; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important; animation-delay: 0.01ms !important;
    transition-duration: 0.01ms !important; transition-delay: 0.01ms !important;
  }
}

/* ── Layout ─────────────────────────────────────────────── */
.app-main {
  max-width: 1200px; margin: 0 auto;
  padding: 24px 16px calc(150px + env(safe-area-inset-bottom));
}
@media (min-width: 768px) { .app-main { padding: 40px 32px 140px; } }
@media (min-width: 1024px) {
  body.app { padding-left: var(--rail-w); }
  .app-main { padding: 48px 48px 96px; }
}

/* ── Page header ────────────────────────────────────────── */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 28px; }
.page-head-title { font-family: var(--font-display); font-weight: 700; font-size: 26px; line-height: 1.2; letter-spacing: -0.01em; }
.page-head-sub { font-size: 13.5px; color: var(--ink-2); margin-top: 4px; }
.page-head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
@media (min-width: 1024px) { .page-head-title { font-size: 30px; } }

/* ── Cards ──────────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-1); padding: 20px;
}
@media (min-width: 768px) { .card { padding: 24px; } }
.card-link { display: block; text-decoration: none; transition: border-color var(--dur-fast) ease, box-shadow var(--dur-base) var(--ease), transform var(--dur-base) var(--ease); }
.card-link:hover { border-color: var(--line-strong); box-shadow: var(--shadow-2); transform: translateY(-1px); }
.card-link:focus-visible, .btn:focus-visible, .chip:focus-visible, .section-link:focus-visible { outline: 2px solid var(--ember); outline-offset: 2px; }

/* Section header: label on the left, link to the hub that owns it on the right.
   This is how every Journey section says where it lives in the app. */
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-label { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); }
.section-label svg { color: var(--ink-3); flex-shrink: 0; }
.section-link { font-size: 13px; font-weight: 500; color: var(--ember-ink); text-decoration: none; white-space: nowrap; border-radius: 6px; }
.section-link:hover { text-decoration: underline; text-underline-offset: 3px; }

.eyebrow { font-size: 11.5px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }

/* ── Buttons & chips ────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: 999px; border: 1px solid transparent;
  font: 500 13.5px/1 var(--font-ui); text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background var(--dur-fast) ease, border-color var(--dur-fast) ease, transform var(--dur-fast) ease;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--ink); color: var(--bg); }
.btn-primary:hover { background: #3F2C1F; }
.btn-ember { background: linear-gradient(135deg, var(--ember), var(--amber)); color: #fff; }
.btn-ember:hover { filter: brightness(1.04); }
.btn-quiet { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn-quiet:hover { border-color: var(--line-strong); background: var(--surface-2); }

.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px;
  border-radius: 999px; font-size: 12.5px; font-weight: 500; white-space: nowrap;
  background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); text-decoration: none;
}
button.chip, a.chip { cursor: pointer; }
button.chip { font-family: var(--font-ui); }
.chip-positive { background: var(--positive-wash); color: var(--positive); border-color: transparent; }
.chip-negative { background: var(--negative-wash); color: var(--negative); border-color: transparent; }

.delta-up { color: var(--positive); }
.delta-down { color: var(--negative); }

/* ── Loading skeleton ───────────────────────────────────── */
.skeleton { position: relative; overflow: hidden; background: var(--surface-2); border-radius: 8px; color: transparent !important; }
.skeleton::after {
  content: ''; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.6), transparent);
  animation: fp-shimmer 1.4s ease-in-out infinite;
}
@keyframes fp-shimmer { to { transform: translateX(100%); } }

/* Quiet entrance used by cards — opacity + 6px rise, staggered by --i */
.rise { opacity: 0; transform: translateY(6px); animation: fp-rise var(--dur-slow) var(--ease) forwards; animation-delay: calc(var(--i, 0) * 70ms + 80ms); }
@keyframes fp-rise { to { opacity: 1; transform: none; } }

/* ── App shell: desktop rail ────────────────────────────── */
.desktop-rail { display: none; }
@media (min-width: 1024px) {
  .desktop-rail {
    display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; width: var(--rail-w);
    background: var(--espresso); padding: 26px 16px 20px; z-index: 40;
  }
}
.desktop-rail-logo {
  display: flex; align-items: center; gap: 8px; padding: 4px 10px; margin-bottom: 32px;
  font-family: var(--font-display); font-weight: 700; font-size: 19px; color: var(--bg); text-decoration: none; letter-spacing: -0.01em;
}
.desktop-rail-logo svg { color: var(--ember); }
.desktop-rail-nav { display: flex; flex-direction: column; gap: 2px; }
.desktop-rail-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  color: rgba(253, 246, 238, 0.62); text-decoration: none; font-size: 14px; font-weight: 500;
  transition: background var(--dur-fast) ease, color var(--dur-fast) ease;
}
.desktop-rail-item svg { flex-shrink: 0; opacity: 0.85; }
.desktop-rail-item:hover { background: rgba(253, 246, 238, 0.06); color: var(--bg); }
.desktop-rail-item.active { background: rgba(253, 246, 238, 0.08); color: var(--bg); box-shadow: inset 2px 0 0 var(--ember); }
.desktop-rail-item.active svg { color: var(--ember); opacity: 1; }
.desktop-rail-ask {
  margin-top: auto; display: flex; align-items: center; gap: 9px; padding: 12px 14px; border-radius: 12px;
  background: linear-gradient(135deg, var(--ember), var(--amber)); color: #fff; text-decoration: none; font-size: 13.5px; font-weight: 500;
  box-shadow: 0 8px 20px -8px rgba(244, 98, 42, 0.6);
}
.desktop-rail-footer { display: flex; flex-direction: column; gap: 1px; margin-top: 14px; padding-top: 14px; border-top: 1px solid rgba(253, 246, 238, 0.1); }
.desktop-rail-footer a { color: rgba(253, 246, 238, 0.5); text-decoration: none; font-size: 12.5px; padding: 7px 12px; border-radius: 8px; transition: color var(--dur-fast) ease, background var(--dur-fast) ease; }
.desktop-rail-footer a:hover { color: rgba(253, 246, 238, 0.9); background: rgba(253, 246, 238, 0.05); }

/* ── App shell: mobile tab bar + Ask pill ───────────────── */
.mobile-tabbar {
  position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 150;
  display: flex; gap: 2px; padding: 6px;
  background: rgba(253, 246, 238, 0.9); backdrop-filter: saturate(1.4) blur(18px); -webkit-backdrop-filter: saturate(1.4) blur(18px);
  border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow-3);
}
.mobile-tabbar-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 4px 7px; border-radius: 16px;
  color: var(--ink-3); font-size: 10.5px; font-weight: 600; text-decoration: none;
  transition: color var(--dur-base) var(--ease), background var(--dur-base) var(--ease);
}
.mobile-tabbar-item.active { color: var(--ember-ink); background: var(--ember-wash); }
.ask-pill {
  position: fixed; right: 12px; bottom: calc(88px + env(safe-area-inset-bottom)); z-index: 149;
  display: inline-flex; align-items: center; gap: 6px; padding: 10px 16px; border-radius: 999px;
  background: var(--ink); color: var(--bg); font-size: 13px; font-weight: 500; text-decoration: none; box-shadow: var(--shadow-3);
}
@media (min-width: 1024px) { .mobile-tabbar, .ask-pill { display: none !important; } }

/* ── Footer ─────────────────────────────────────────────── */
.app-footer { margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; font-size: 12px; color: var(--ink-3); }
.app-footer nav { display: flex; gap: 18px; flex-wrap: wrap; }
.app-footer a { color: var(--ink-2); text-decoration: none; }
.app-footer a:hover { color: var(--ink); }

/* ============================================================
   Public site shell — top nav + footer (rendered by js/shell.js)
   ============================================================ */
.site-nav {
  position: sticky; top: 0; z-index: 100; height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 16px;
  background: rgba(253, 246, 238, 0.86); backdrop-filter: saturate(1.4) blur(16px); -webkit-backdrop-filter: saturate(1.4) blur(16px);
  border-bottom: 1px solid transparent; transition: border-color var(--dur-base) ease;
}
.site-nav.scrolled { border-bottom-color: var(--line); }
@media (min-width: 768px) { .site-nav { padding: 0 32px; } }
.site-logo { display: inline-flex; align-items: center; gap: 7px; font-family: var(--font-display); font-weight: 700; font-size: 20px; color: var(--ink); text-decoration: none; letter-spacing: -0.01em; }
.site-logo svg { color: var(--ember); }
.site-logo em { font-style: normal; color: var(--ember); }
.site-links { display: none; align-items: center; gap: 28px; }
.site-link { font-size: 14px; font-weight: 500; color: var(--ink-2); text-decoration: none; transition: color var(--dur-fast) ease; }
.site-link:hover, .site-link[aria-current="page"] { color: var(--ink); }
.site-actions { display: flex; align-items: center; gap: 8px; }
.site-signin { display: none; }
.site-menu-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border: none; background: none; color: var(--ink); border-radius: 50%; cursor: pointer; }
.site-menu-btn:hover { background: rgba(43, 29, 20, 0.05); }
@media (min-width: 900px) {
  .site-links, .site-signin { display: flex; }
  .site-menu-btn { display: none; }
}
.site-drawer { position: fixed; inset: var(--nav-h) 0 0 0; z-index: 99; background: var(--bg); padding: 24px 16px 40px; display: none; flex-direction: column; gap: 4px; overflow-y: auto; }
.site-drawer.open { display: flex; }
.site-drawer a { padding: 14px 4px; font-family: var(--font-display); font-weight: 700; font-size: 22px; color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line); }
.site-drawer .btn { margin-top: 20px; height: 48px; font-family: var(--font-ui); font-size: 15px; border-bottom: none; padding: 0 20px; }
@media (min-width: 900px) { .site-drawer { display: none !important; } }

.site-main { max-width: 1120px; margin: 0 auto; padding: 32px 16px 64px; }
@media (min-width: 768px) { .site-main { padding: 56px 32px 96px; } }
.site-main.narrow { max-width: 760px; }

.site-footer { border-top: 1px solid var(--line); background: var(--surface-2); }
.site-footer-inner { max-width: 1120px; margin: 0 auto; padding: 40px 16px calc(40px + env(safe-area-inset-bottom)); display: grid; gap: 28px; }
@media (min-width: 768px) { .site-footer-inner { grid-template-columns: 1.4fr repeat(3, 1fr); padding: 56px 32px; } }
.site-footer-brand p { margin-top: 10px; font-size: 13px; color: var(--ink-2); max-width: 32ch; }
.site-footer h4 { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 10px; }
.site-footer ul { list-style: none; display: grid; gap: 8px; }
.site-footer ul a { font-size: 14px; color: var(--ink-2); text-decoration: none; }
.site-footer ul a:hover { color: var(--ink); }
.site-footer-legal { grid-column: 1 / -1; padding-top: 20px; border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-3); line-height: 1.6; }

/* ============================================================
   Shared content components (both shells)
   ============================================================ */
/* Display type */
.display-xl { font-family: var(--font-display); font-weight: 700; font-size: clamp(40px, 7vw, 72px); line-height: 1.04; letter-spacing: -0.025em; color: var(--ink); }
.display-lg { font-family: var(--font-display); font-weight: 700; font-size: clamp(30px, 4.6vw, 48px); line-height: 1.1; letter-spacing: -0.02em; color: var(--ink); }
.display-md { font-family: var(--font-display); font-weight: 700; font-size: clamp(22px, 3vw, 30px); line-height: 1.2; letter-spacing: -0.01em; color: var(--ink); }
.lead { font-size: clamp(16px, 1.6vw, 19px); line-height: 1.6; color: var(--ink-2); max-width: 60ch; }
.accent { color: var(--ember); font-style: italic; }

/* Forms */
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field-label { font-size: 13.5px; font-weight: 500; color: var(--ink); }
.field-hint { font-size: 12.5px; color: var(--ink-2); }
.input {
  width: 100%; height: 48px; padding: 0 14px; border-radius: var(--r-sm); border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); font: 400 15px var(--font-ui);
  transition: border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}
.input:focus { outline: none; border-color: var(--ember); box-shadow: 0 0 0 3px var(--ember-wash); }
.btn-lg { height: 50px; padding: 0 24px; font-size: 15px; }
.btn-block { width: 100%; }

/* Segmented control (pay cycle, tabs) */
.segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); }
.segmented > * { border: none; background: none; padding: 7px 14px; border-radius: 999px; font: 500 13px var(--font-ui); color: var(--ink-2); cursor: pointer; }
.segmented > .active, .segmented > [aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }

/* Stat block */
.stat-label { font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.stat-value { font-size: clamp(22px, 4vw, 30px); font-weight: 600; letter-spacing: -0.02em; color: var(--ink); font-variant-numeric: tabular-nums lining-nums; }

/* Callouts */
.callout { padding: 14px 16px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line); font-size: 13.5px; color: var(--ink-2); line-height: 1.6; }
.callout strong { color: var(--ink); }
.callout-ember { background: #FFF7F2; border-color: rgba(244, 98, 42, 0.22); }

/* Long-form reading (articles, legal, FAQ) */
.prose { font-size: 17px; line-height: 1.75; color: var(--ink-2); }
.prose > * + * { margin-top: 1.1em; }
.prose h1 { font-family: var(--font-display); font-weight: 700; font-size: clamp(32px, 5vw, 46px); line-height: 1.12; letter-spacing: -0.02em; color: var(--ink); }
.prose h2 { font-family: var(--font-display); font-weight: 700; font-size: clamp(24px, 3vw, 30px); line-height: 1.25; color: var(--ink); margin-top: 2em; }
.prose h3 { font-size: 19px; font-weight: 600; color: var(--ink); margin-top: 1.6em; }
.prose strong { color: var(--ink); font-weight: 600; }
.prose a { color: var(--ember-ink); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: 0.4em; }
.prose blockquote { border-left: 3px solid var(--ember); padding: 4px 0 4px 18px; color: var(--ink); font-style: italic; }
.prose table { width: 100%; border-collapse: collapse; font-size: 15px; }
.prose th, .prose td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.prose th { color: var(--ink); font-weight: 600; background: var(--surface-2); }
