:root,
.rr {
  --bg: #f1efe8;
  --sur: #fbfaf7;
  --card: #ffffff;
  --bd: #dcd8cf;
  --bd2: #e9e5db;
  --ink: #22211d;
  --mut: #6d685c;
  --fnt: #7a756a;
  --acc: #2f5d50;
  --accH: #264c41;
  --hl: #f4f1e8;
  --rowbd: #f0ede5;
  --amT: #8a6d1f;
  --amB: #f6edd4;
  --amD: #e8d9a8;
  --erT: #a13b2e;
  --erB: #f8e8e4;
  --erD: #ecc9c1;
  --okT: #2f5d50;
  --okB: #e8efe9;
  --okD: #c8d9cd;
  --dark: #22211d;
  --darkInk: #fbfaf7;
  --sh: 0 10px 30px rgba(50, 45, 35, 0.12);
  --card-sh: 0 1px 6px rgba(60, 55, 45, 0.06);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'IBM Plex Sans', sans-serif;
}

a {
  color: var(--acc);
  text-decoration: none;
}

a:hover {
  color: var(--accH);
}

/* Prevent orphaned single words on headings and card titles */
h1,
h2,
h3 {
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

/* Tabular figures for ledger/financial numerals wherever IBM Plex Mono is used */
.font-mono {
  font-variant-numeric: tabular-nums;
}

/* BP Bookkeeping Design Tokens */
.rr-card {
  border: 1px solid var(--bd2);
  border-radius: 10px;
  background: var(--card);
  box-shadow: var(--card-sh);
}

.btn-primary {
  background: var(--acc);
  color: #ffffff !important;
  border: none;
  border-radius: 8px;
  padding: 9px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background-color 0.15s ease, transform 0.1s ease;
}

.btn-primary:hover {
  background: var(--accH);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-ghost {
  border: 1px solid var(--bd);
  border-radius: 7px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background-color 0.15s ease;
}

.btn-ghost:hover {
  background: var(--hl);
}

/* Size modifiers: stack with .btn-primary / .btn-ghost; no modifier = default ("md") size */
.btn-sm {
  padding: 7px 14px;
  font-size: 12px;
}

.btn-lg {
  padding: 14px 32px;
  font-size: 14px;
}

/* Named urgent/amber variant, replaces ad hoc inline color overrides */
.btn-primary.btn-urgent {
  background: var(--amT);
}

.btn-primary.btn-urgent:hover {
  background: #6e5617;
}

/* Neutral solid variant: gives a "reject/secondary" choice equal visual weight to a primary one */
.btn-primary.btn-neutral {
  background: var(--ink);
}

.btn-primary.btn-neutral:hover {
  background: #33322c;
}

/* Shared tab component for grouped selector buttons (e.g. the ROI calculator) */
.tab {
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--bd);
  background: var(--hl);
  text-align: left;
  font-size: 12px;
  font-weight: 500;
  color: var(--mut);
  cursor: pointer;
  font-family: inherit;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.tab:hover {
  color: var(--ink);
}

.tab[aria-selected="true"] {
  border-color: var(--acc);
  background: var(--card);
  color: var(--acc);
  font-weight: 600;
  box-shadow: var(--card-sh);
}

/* Optional secondary label inside a .tab (e.g. model/volume tabs' title line),
   tracks selection state independently of the muted price/subtext line beneath it */
.tab .tab-title {
  color: var(--ink);
  font-weight: 600;
}

.tab[aria-selected="true"] .tab-title {
  color: var(--acc);
}

/* Shared modal close (X) button: consistent tap target + hover affordance */
.modal-close {
  padding: 8px;
  border-radius: 8px;
  color: var(--fnt);
  line-height: 1;
  cursor: pointer;
  background: transparent;
  border: none;
  font-family: inherit;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.modal-close:hover {
  color: var(--ink);
  background: var(--hl);
}

/* Desktop nav active-section indicator (paired with scroll-spy JS) */
.nav-link[aria-current="true"] {
  color: var(--ink);
  background: var(--hl);
}

/* Status Pills */
.pill-ok {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--okT);
  background: var(--okB);
  border: 1px solid var(--okD);
  padding: 3px 10px;
  border-radius: 99px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.pill-am {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--amT);
  background: var(--amB);
  border: 1px solid var(--amD);
  padding: 3px 10px;
  border-radius: 99px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.pill-er {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--erT);
  background: var(--erB);
  border: 1px solid var(--erD);
  padding: 3px 10px;
  border-radius: 99px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* Spectral page headings */
.spectral-title {
  font-family: 'Spectral', serif;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
}

/* Custom range slider with BP accent */
input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  background: var(--bd);
  height: 6px;
  border-radius: 99px;
  outline: none;
}

input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  height: 20px;
  width: 20px;
  border-radius: 50%;
  background: var(--acc);
  cursor: pointer;
  border: 2px solid var(--card);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s ease;
}

input[type=range]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

input[type=range]::-moz-range-thumb {
  height: 20px;
  width: 20px;
  border-radius: 50%;
  background: var(--acc);
  cursor: pointer;
  border: 2px solid var(--card);
}

/* Accessible focus rings */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--acc);
  outline-offset: 2px;
}

/* Modal Backdrop */
.modal-backdrop {
  background: rgba(34, 33, 29, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* Ambient section tints: replace flat, identical --bg panels with a subtle accent-tinted glow so
   sections read as distinct panels rather than one uniform flat plane */
.hero-glow {
  background: radial-gradient(1100px 480px at 12% -15%, color-mix(in srgb, var(--acc) 9%, transparent), transparent 60%),
    radial-gradient(700px 420px at 100% 0%, color-mix(in srgb, var(--acc) 5%, transparent), transparent 60%);
}

.section-glow-a {
  background: radial-gradient(900px 420px at 88% 0%, color-mix(in srgb, var(--acc) 6%, transparent), transparent 65%);
}

.section-glow-b {
  background: radial-gradient(900px 460px at 8% 100%, color-mix(in srgb, var(--acc) 6%, transparent), transparent 65%);
}

/* Tinted shadow carrying the ink/accent hue, for elements that need extra lift over a flat card shadow */
.shadow-lift {
  box-shadow: 0 18px 40px -12px color-mix(in srgb, var(--acc) 22%, rgba(34, 33, 29, 0.18));
}

/* Scroll-in reveal: staggered fade + rise, applied via IntersectionObserver */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Month rail: line draws and nodes light in sequence once the section enters view (order of events) */
.rail-fill-x { transform: scaleX(0); transform-origin: left; transition: transform 1.4s cubic-bezier(0.16, 1, 0.3, 1); }
.rail-fill-y { transform: scaleY(0); transform-origin: top; transition: transform 1.4s cubic-bezier(0.16, 1, 0.3, 1); }
.rail-node { transition: background-color 0.4s ease, border-color 0.4s ease; transition-delay: calc(var(--i) * 0.38s); }
.month-rail.is-visible .rail-fill-x { transform: scaleX(1); }
.month-rail.is-visible .rail-fill-y { transform: scaleY(1); }
.month-rail.is-visible .rail-node { background-color: var(--acc); border-color: var(--acc); }

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .reveal {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  .rail-fill-x { transform: scaleX(1) !important; }
  .rail-fill-y { transform: scaleY(1) !important; }
  .rail-node { background-color: var(--acc) !important; border-color: var(--acc) !important; }
}

/* Mobile Touch & iOS Form Zoom Prevention */
@media (max-width: 640px) {

  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
  select,
  textarea {
    font-size: 16px !important;
  }

  input[type=range] {
    height: 8px;
  }

  input[type=range]::-webkit-slider-thumb {
    height: 26px;
    width: 26px;
  }

  input[type=range]::-moz-range-thumb {
    height: 26px;
    width: 26px;
  }
}
