/* =========================================================
   DPC Bookkeeper — shared styles
   Two themes: .safe (cream + ink) and .bold (dark + brass)
   ========================================================= */

@font-face {
  font-family: 'Poppins';
  src: url('fonts/Poppins-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Poppins';
  src: url('fonts/Poppins-ExtraBold.ttf') format('truetype');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300..700;1,9..144,300..600&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* ---- SAFE (cream & ink) ---- */
  --safe-bg:        #F4EFE6;
  --safe-bg-alt:    #EBE4D6;
  --safe-paper:     #FBF8F2;
  --safe-ink:       #14181F;
  --safe-ink-2:     #2D3440;
  --safe-ink-3:     #5B6472;
  --safe-ink-4:     #8A93A1;
  --safe-rule:      #D9D1BF;
  --safe-brass:     #9C7A3C;
  --safe-brass-dk:  #7B5E2A;
  --safe-blue:      #1D4DA0;   /* logo blue, used sparingly */

  /* ---- BOLD (dark ink + brass) ---- */
  --bold-bg:        #0E1117;
  --bold-bg-alt:    #161A22;
  --bold-paper:     #1C212B;
  --bold-fg:        #EDE8DC;
  --bold-fg-2:      #B9B2A0;
  --bold-fg-3:      #7A7568;
  --bold-fg-4:      #4A4739;
  --bold-rule:      #2A2F3A;
  --bold-brass:     #C9A961;
  --bold-brass-br:  #E0C989;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 14px;

  --shadow-sm: 0 2px 8px rgba(20, 24, 31, 0.06);
  --shadow-md: 0 8px 24px rgba(20, 24, 31, 0.08);
  --shadow-lg: 0 20px 60px rgba(20, 24, 31, 0.12);

  --ease: cubic-bezier(.22, .61, .36, 1);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Poppins', ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
a { color: inherit; text-decoration: none; }

/* ---------- Themes ---------- */
body.safe { background: var(--safe-bg); color: var(--safe-ink); }
.safe .bg-paper { background: var(--safe-paper); }
.safe .bg-alt   { background: var(--safe-bg-alt); }
.safe .bg-ink   { background: var(--safe-ink); color: var(--safe-paper); }
.safe .fg-muted { color: var(--safe-ink-3); }
.safe .fg-faint { color: var(--safe-ink-4); }
.safe .fg-brass { color: var(--safe-brass); }
.safe .fg-blue  { color: var(--safe-blue); }
.safe .rule { border-color: var(--safe-rule); }
.safe hr { border: none; border-top: 1px solid var(--safe-rule); margin: 0; }

body.bold { background: var(--bold-bg); color: var(--bold-fg); }
.bold .bg-paper { background: var(--bold-paper); }
.bold .bg-alt   { background: var(--bold-bg-alt); }
.bold .bg-ink   { background: var(--bold-fg); color: var(--bold-bg); }
.bold .fg-muted { color: var(--bold-fg-2); }
.bold .fg-faint { color: var(--bold-fg-3); }
.bold .fg-brass { color: var(--bold-brass); }
.bold .rule { border-color: var(--bold-rule); }
.bold hr { border: none; border-top: 1px solid var(--bold-rule); margin: 0; }

/* ---------- Typography ---------- */
.display {
  font-family: 'Poppins', sans-serif;
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 0.98;
}
.serif-accent {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 300;
  font-style: italic;
  letter-spacing: -0.02em;
}
.mono {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.eyebrow {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1, h2, h3, h4, h5 { margin: 0; font-family: 'Poppins', sans-serif; font-weight: 800; letter-spacing: -0.035em; }
h1 { font-size: clamp(48px, 6.4vw, 96px); line-height: 0.95; }
h2 { font-size: clamp(34px, 4vw, 60px); line-height: 1; letter-spacing: -0.03em; }
h3 { font-size: clamp(22px, 2.2vw, 32px); line-height: 1.1; letter-spacing: -0.025em; }
h4 { font-size: 18px; font-weight: 800; letter-spacing: -0.02em; }
h5 { font-size: 14px; font-weight: 800; letter-spacing: -0.01em; text-transform: uppercase; }
p  { margin: 0; }

.italic-accent {
  font-family: 'Fraunces', Georgia, serif;
  font-style: italic;
  font-weight: 300;
  letter-spacing: -0.02em;
}

/* ---------- Layout ---------- */
.container { width: 100%; max-width: 1280px; margin: 0 auto; padding: 0 32px; }
.container-wide { width: 100%; max-width: 1440px; margin: 0 auto; padding: 0 40px; }
.container-narrow { width: 100%; max-width: 800px; margin: 0 auto; padding: 0 32px; }
@media (max-width: 720px) {
  .container, .container-wide, .container-narrow { padding: 0 20px; }
}

/* ---------- Nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  transition: background .3s var(--ease), border-color .3s var(--ease);
}
.safe .nav { background: rgba(244, 239, 230, 0.85); }
.bold .nav { background: rgba(14, 17, 23, 0.78); }
.nav.scrolled { border-bottom-color: var(--safe-rule); }
.bold .nav.scrolled { border-bottom-color: var(--bold-rule); }
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0;
  gap: 48px;
}
.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Poppins', sans-serif;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.03em;
  white-space: nowrap;
  flex-shrink: 0;
}
.nav-logo img { width: 48px; height: 48px; object-fit: contain; flex-shrink: 0; }
.nav-links {
  display: flex;
  align-items: center;
  gap: 36px;
  font-size: 14px;
  font-weight: 400;
}
.nav-links a { opacity: 0.78; transition: opacity .2s var(--ease), color .2s var(--ease); }
.nav-links a:hover { opacity: 1; color: var(--safe-brass); }
.nav-links a.active { opacity: 1; }
.bold .nav-links a:hover { color: var(--bold-brass); }
@media (max-width: 860px) {
  .nav-links { display: none; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  border-radius: 999px;
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: -0.005em;
  transition: transform .15s var(--ease), background .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease);
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn .arrow { transition: transform .25s var(--ease); display: inline-block; }
.btn:hover .arrow { transform: translateX(4px); }

.safe .btn-primary { background: var(--safe-ink); color: var(--safe-paper); }
.safe .btn-primary:hover { background: var(--safe-ink-2); }
.safe .btn-secondary { border-color: var(--safe-ink); color: var(--safe-ink); }
.safe .btn-secondary:hover { background: var(--safe-ink); color: var(--safe-paper); }
.safe .btn-ghost { color: var(--safe-ink); }
.safe .btn-ghost:hover { background: var(--safe-bg-alt); }
.safe .btn-brass { background: var(--safe-brass); color: var(--safe-paper); }
.safe .btn-brass:hover { background: var(--safe-brass-dk); }

.bold .btn-primary { background: var(--bold-brass); color: var(--bold-bg); }
.bold .btn-primary:hover { background: var(--bold-brass-br); }
.bold .btn-secondary { border-color: var(--bold-fg-2); color: var(--bold-fg); }
.bold .btn-secondary:hover { border-color: var(--bold-brass); color: var(--bold-brass); }
.bold .btn-ghost { color: var(--bold-fg); }
.bold .btn-ghost:hover { background: var(--bold-bg-alt); }

/* ---------- Headshot (founder portrait component) ---------- */
.headshot {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--safe-ink);
  box-shadow: inset 0 0 0 1px rgba(26, 25, 21, 0.08), 0 1px 2px rgba(26, 25, 21, 0.04);
}
.headshot.is-compact { border-radius: var(--radius-sm); }
.headshot__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 22%;
  filter: sepia(14%) saturate(92%) contrast(104%) brightness(0.97);
  transition: filter 0.4s var(--ease);
  z-index: 2;
}
.headshot:hover .headshot__img {
  filter: sepia(4%) saturate(100%) contrast(102%) brightness(1);
}
.headshot__fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(120% 90% at 30% 20%, rgba(198, 156, 90, 0.12) 0%, rgba(198, 156, 90, 0) 55%),
    linear-gradient(160deg, #1F2733 0%, #121821 100%);
  color: var(--safe-paper);
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 400;
  font-size: clamp(48px, 8vw, 96px);
  letter-spacing: -0.04em;
  z-index: 1;
  user-select: none;
}
.headshot.is-compact .headshot__fallback { font-size: 72px; }
.headshot__img[data-loaded="false"] { display: none; }

/* ---------- Utility ---------- */
.stack { display: flex; flex-direction: column; }
.row   { display: flex; flex-direction: row; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.gap-24 { gap: 24px; }
.gap-32 { gap: 32px; }
.gap-48 { gap: 48px; }
.gap-64 { gap: 64px; }

.section { padding: 120px 0; }
.section-sm { padding: 72px 0; }
@media (max-width: 720px) {
  .section { padding: 72px 0; }
  .section-sm { padding: 48px 0; }
}

.divider-dot::before {
  content: '·';
  margin: 0 10px;
  opacity: .5;
}

/* ---------- Cards ---------- */
.card {
  border-radius: var(--radius-md);
  padding: 28px;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.safe .card { background: var(--safe-paper); border: 1px solid var(--safe-rule); }
.safe .card:hover { box-shadow: var(--shadow-md); }
.bold .card { background: var(--bold-bg-alt); border: 1px solid var(--bold-rule); }
.bold .card:hover { border-color: var(--bold-brass); }

/* ---------- Marquee ---------- */
.marquee {
  overflow: hidden;
  mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
}
.marquee-track {
  display: flex;
  gap: 64px;
  align-items: center;
  animation: marquee 40s linear infinite;
  width: max-content;
}
@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* ---------- Footer ---------- */
.footer {
  padding: 72px 0 40px;
  border-top: 1px solid;
}
.safe .footer { border-color: var(--safe-rule); background: var(--safe-bg); }
.bold .footer { border-color: var(--bold-rule); background: var(--bold-bg); }

/* ---------- Forms ---------- */
.input {
  width: 100%;
  padding: 14px 16px;
  font: inherit;
  font-family: 'Poppins', sans-serif;
  font-size: 15px;
  font-weight: 400;
  border-radius: var(--radius-sm);
  border: 1px solid;
  background: transparent;
  transition: border-color .2s var(--ease);
}
.safe .input { border-color: var(--safe-rule); color: var(--safe-ink); }
.safe .input:focus { outline: none; border-color: var(--safe-ink); }
.bold .input { border-color: var(--bold-rule); color: var(--bold-fg); }
.bold .input:focus { outline: none; border-color: var(--bold-brass); }

/* ---------- Scroll progress ---------- */
.scroll-progress {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  background: var(--safe-brass);
  width: 0;
  z-index: 100;
}
.bold .scroll-progress { background: var(--bold-brass); }

/* ============================================================
   RESPONSIVE
   Inline grid/column styles throughout the HTML need to collapse
   gracefully at tablet and mobile. Attribute selectors + !important
   override the inline style= values from here.
   ============================================================ */

/* Tablet (≤ 980px) — mostly collapse 3+ col grids to 2 col, loosen gaps */
@media (max-width: 980px) {
  /* Two-column content splits (sidebar + body patterns) → stack */
  .section [style*="grid-template-columns"][style*="1.1fr"],
  .section [style*="grid-template-columns"][style*="1.2fr"],
  .section [style*="grid-template-columns"][style*="1.3fr"],
  .section [style*="grid-template-columns"][style*="1.4fr"],
  .section [style*="grid-template-columns"][style*="1.6fr"],
  .section [style*="grid-template-columns"][style*="2fr"],
  .section [style*="grid-template-columns: 1fr 1.2fr"],
  .section [style*="grid-template-columns: 220px"] {
    grid-template-columns: 1fr !important;
    gap: 48px !important;
  }

  /* 3-col card/case grids → 2 col */
  .section [style*="repeat(3, 1fr)"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* 4-col metric grids → 2 col */
  .section [style*="repeat(4, 1fr)"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* Footer 4-col → 2 col */
  .footer [style*="grid-template-columns: 2fr 1fr 1fr 1fr"] {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 40px !important;
  }

  /* Large display headings scale down */
  .display {
    letter-spacing: -0.02em;
  }
}

/* Mobile (≤ 720px) — collapse everything to single column */
@media (max-width: 720px) {
  /* Any inline grid with multiple columns → single column */
  [style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
    gap: 24px !important;
  }

  /* Footer links row → 2 col so labels don't get huge blank space */
  .footer [style*="grid-template-columns: 2fr 1fr 1fr 1fr"] {
    grid-template-columns: 1fr 1fr !important;
    gap: 32px 24px !important;
  }

  /* Borders that were column-dividers should become row-dividers */
  .section [style*="border-right"][style*="border-bottom"] {
    border-right: 0 !important;
  }

  /* Hero/display text must reflow, not shrink to illegibility.
     Inline font-size: clamp(...) already handles this; enforce readable floor. */
  .display { letter-spacing: -0.015em; }

  /* Inline "display" font-sizes that were fixed (e.g. font-size: 72px) — scale */
  [class*="display"][style*="font-size: 72px"],
  [class*="display"][style*="font-size: 64px"] {
    font-size: 48px !important;
    line-height: 1.05 !important;
  }
  [class*="display"][style*="font-size: 48px"] {
    font-size: 36px !important;
  }
  [class*="display"][style*="font-size: 40px"] {
    font-size: 30px !important;
  }

  /* Large decorative quote glyphs shrink */
  [style*="font-size: 400px"] { font-size: 200px !important; }

  /* Section padding already handled above (72px 0). Big inline section
     paddings (style="padding: 140px 0") need to yield too. */
  section[style*="padding: 140px 0"],
  section[style*="padding: 120px 0"] {
    padding: 72px 0 !important;
  }

  /* Big inline card paddings */
  [style*="padding: 72px 64px"] { padding: 48px 28px !important; }
  [style*="padding: 48px"] { padding: 32px 24px !important; }
  [style*="padding: 44px 40px"] { padding: 32px 24px !important; }
  [style*="padding: 40px 36px"] { padding: 28px 22px !important; }

  /* Nav icon — current 48px is fine, but make sure nav padding is comfortable */
  .nav-inner { padding: 14px 0; gap: 16px; }
  .nav-logo img { width: 40px; height: 40px; }
  .nav-logo span { font-size: 16px !important; }

  /* CTAs wrap */
  .row[class*="gap"] { flex-wrap: wrap; }

  /* Email subscribe / lead-magnet forms: input + button stack on narrow */
  form[style*="display: flex"][style*="gap: 12px"] {
    flex-direction: column;
    align-items: stretch;
  }
  form[style*="display: flex"][style*="gap: 12px"] .btn,
  form[style*="display: flex"][style*="gap: 12px"] button {
    width: 100%;
    justify-content: center;
  }

  /* Marquee — slightly slower/smaller on mobile */
  .marquee-track { animation-duration: 55s; gap: 40px; }

  /* Headshot compact card: was 220px fixed column inside a card,
     now stacks — cap its width so it doesn't go full-bleed */
  .headshot.is-compact { max-width: 220px; margin: 0 auto; }
}

/* Very narrow phones (≤ 420px) — final safety net */
@media (max-width: 420px) {
  .nav-logo span { display: none; } /* drop wordmark on tiny phones to save space */
  .display { letter-spacing: -0.01em; }
  /* Buttons full-width when they'd otherwise crowd */
  .row .btn { flex: 1 1 auto; }
}

/* ---------- Tiny fade-up (CSS-driven, no JS) ---------- */
.fade-up {
  animation: fadeUp .9s var(--ease) both;
}
.fade-up.d1 { animation-delay: .08s; }
.fade-up.d2 { animation-delay: .16s; }
.fade-up.d3 { animation-delay: .24s; }
.fade-up.d4 { animation-delay: .32s; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- Pills ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0;
}
.safe .pill { background: var(--safe-bg-alt); color: var(--safe-ink-2); }
.bold .pill { background: var(--bold-bg-alt); color: var(--bold-fg-2); border: 1px solid var(--bold-rule); }
