/* BudgetVision: single-page site.
   All brand values live in the tokens below so they can be swapped in one place.
   Palette and type follow the original holding page (ink, teal-free navy, gold; Barlow Condensed + DM Sans),
   with text-safe variants where the original colours fail AA contrast. */

/* ---------- Fonts (self-hosted; files go in /assets/fonts/) ---------- */
@font-face {
  font-family: "Barlow Condensed";
  src: url("../fonts/barlow-condensed-latin-300-normal.woff2") format("woff2");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Barlow Condensed";
  src: url("../fonts/barlow-condensed-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "DM Sans";
  src: url("../fonts/dm-sans-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 1000;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  --navy: #101b26; /* ink: dark sections, headings, body text on light */
  --accent: #142841; /* brand navy: wordmark "VISION", spending bars, illustration */
  --gold: #d4a23c; /* accents, buttons and fills on dark */
  --gold-ink: #8a6414; /* gold used as text on light (contrast-safe) */
  --paper: #f4f6f8; /* main light background */
  --slate: #4a5a68; /* secondary text on light */
  --mist: #adbac7; /* secondary text on dark, hairlines */

  --font-serif: "Barlow Condensed", "Arial Narrow", Arial, sans-serif; /* headlines */
  --font-sans: "DM Sans", "Helvetica Neue", Arial, sans-serif; /* body and UI */

  --gutter: 1.25rem;
  --max: 70rem;
  --header-h: 3.75rem;
}

/* ---------- Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 100%;
  scroll-padding-top: calc(var(--header-h) + 1rem);
  -webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--navy);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  /* 17px */
  line-height: 1.6;
}

@media (min-width: 720px) {
  body {
    font-size: 1.125rem;
  }

  /* 18px */
}

h1,
h2,
h3 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 1rem;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.75rem, 7.5vw, 4.25rem);
  letter-spacing: 0.005em;
}

h2 {
  font-size: clamp(2.1rem, 5vw, 2.9rem);
}

h3 {
  font-size: 1.6rem;
  line-height: 1.25;
}

p {
  margin: 0 0 1rem;
  max-width: 66ch;
}

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

a {
  color: var(--navy);
  text-underline-offset: 0.18em;
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 3px solid var(--gold-ink);
  outline-offset: 3px;
  border-radius: 2px;
}

.on-navy :focus-visible {
  outline-color: var(--gold);
}

.wrap {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -4rem;
  background: var(--navy);
  color: var(--paper);
  padding: 0.6rem 1rem;
  z-index: 100;
}

.skip-link:focus {
  top: 0.5rem;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--paper);
  border-bottom: 1px solid var(--mist);
}

.site-header .wrap {
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
}

/* Lockup: the wordmark's baseline sits on the mark's bottom edge (plus --nudge) and the cap
   height is --fit x the mark's height (1 = exactly full height). Barlow Condensed metrics:
   cap height 0.719em; with line-height 1 the baseline sits 0.9em below the line top.
   Re-measure those two numbers if the wordmark font changes. */
.brand {
  --h: 1rem;
  /* mark height */
  --fit: 0.92;
  /* B height as a share of the mark height */
  display: inline-flex;
  align-items: flex-start;
  gap: -0.25rem;
  /* the mark's SVG has built-in empty space on its right, so the visible gap is larger */
  height: var(--h);
  margin-block: 0.45rem;
  text-decoration: none;
  color: var(--navy);
}

@media (min-width: 600px) {
  .brand {
    --h: 1.5rem;
  }
}

.brand img {
  display: block;
  height: var(--h);
  width: auto;
}

.brand__text {
  font-family: var(--font-serif);
  font-weight: 300;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: calc(var(--h) * var(--fit) / 0.719);
  line-height: 1;
  /* --nudge moves the wordmark down a touch; 0 puts its baseline exactly on the mark's bottom edge */
  margin-top: calc(var(--h) - 0.9em + var(--nudge, 0.05rem));
  white-space: nowrap;
  margin-left: -0.25rem;
}

.brand__text span {
  color: var(--accent);
  font-weight: 600;
}

.site-nav {
  display: flex;
  gap: 0.25rem 1.5rem;
}

.site-nav a {
  display: inline-block;
  padding: 0.5rem 0;
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
}

.site-nav a:hover {
  text-decoration: underline;
  text-decoration-thickness: 2px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  padding: 0.8rem 1.4rem;
  border: 2px solid transparent;
  border-radius: 2px;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

/* on light backgrounds: navy fill, paper text */
.btn--primary {
  background: var(--navy);
  color: var(--paper);
  border-color: var(--navy);
}

.btn--primary:hover {
  background: #070d12;
  border-color: #070d12;
  text-decoration: none;
}

/* on navy: gold fill, navy text */
.on-navy .btn--primary {
  background: var(--gold);
  color: var(--navy);
  border-color: var(--gold);
}

.on-navy .btn--primary:hover {
  background: #e0b258;
  border-color: #e0b258;
}

.on-navy .btn--secondary {
  background: transparent;
  color: var(--paper);
  border-color: var(--mist);
}

.on-navy .btn--secondary:hover {
  border-color: var(--paper);
  text-decoration: none;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  background: var(--navy);
  color: var(--paper);
  padding-block: clamp(3rem, 8vw, 6rem) clamp(3.5rem, 9vw, 6.5rem);
}

.hero__inner {
  display: grid;
  gap: 2.5rem;
  align-items: center;
}

@media (min-width: 900px) {
  .hero__inner {
    grid-template-columns: 1.05fr 1fr;
    gap: 4rem;
  }
}

.hero h1 {
  color: var(--paper);
}

.hero__sub {
  color: var(--mist);
  font-size: 1.1875rem;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.75rem;
}

/* Secondary motif: thin gold band of angled blocks (use 1 of 2) */
.band {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0.75rem;
  background: var(--gold);
  clip-path: polygon(0 100%, 0 40%, 14% 0, 22% 100%, 30% 30%, 44% 0, 52% 100%, 60% 20%, 74% 0, 82% 100%, 100% 0, 100% 100%);
}

@media (max-width: 600px) {
  .band {
    height: 0.5rem;
  }
}

/* ---------- The re-map ---------- */
/* Three separate department files come together into one clean view with a
   spending bar per line. Default (no JS, reduced motion) is the finished view. */
.remap {
  width: 100%;
  max-width: 30rem;
  justify-self: end;
}

@media (max-width: 899px) {
  .remap {
    justify-self: start;
  }
}

.remap__sheet {
  position: relative;
  height: 21.2rem;
  background: var(--paper);
  color: var(--navy);
  border-radius: 2px;
  padding: 0.75rem 0.9rem 0.9rem;
  font-size: 0.8125rem;
  line-height: 1.2;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(185, 195, 209, 0.25);
}

/* finished view */
.remap__head,
.remap__top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.remap__head {
  height: 1.9rem;
  margin-bottom: 0.15rem;
  color: var(--slate);
  font-weight: 600;
  border-bottom: 2px solid var(--navy);
}

.remap__row {
  height: 2.9rem;
  border-bottom: 1px solid var(--mist);
  padding-top: 0.5rem;
}

.remap__top {
  height: 1.2rem;
}

.remap__head> :nth-child(1),
.remap__top> :nth-child(1) {
  flex: 0 0 3.75rem;
}

.remap__head> :nth-child(2),
.remap__top> :nth-child(2) {
  flex: 1 1 auto;
  min-width: 0;
}

.remap__head> :nth-child(3),
.remap__top> :nth-child(3) {
  flex: 0 0 5rem;
  text-align: right;
}

.remap__top> :nth-child(1) {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.remap__top> :nth-child(3) {
  color: var(--slate);
}

.remap__top span,
.remap__head span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.remap__bar {
  height: 0.4rem;
  margin-top: 0.4rem;
  background: #dfe4eb;
  border-radius: 1px;
  overflow: hidden;
}

.remap__bar i {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--accent);
  transform-origin: left center;
  transform: scaleX(var(--w));
}

/* a line close to its budget turns gold */
.remap__row--near .remap__bar i {
  background: var(--gold);
}

/* the three separate files (only shown while the script runs) */
.remap__files {
  display: none;
  position: absolute;
  inset: 0;
}

.is-files .remap__files,
.is-merge .remap__files {
  display: block;
}

.file {
  position: absolute;
  width: 70%;
  background: #fff;
  border: 1px solid var(--mist);
  box-shadow: 0 2px 6px rgba(20, 40, 65, 0.12);
  font-size: 0.6875rem;
  transform: rotate(var(--rot, 0deg));
  transition: transform 0.6s ease, opacity 0.5s ease;
}

.file:nth-child(1) {
  top: 0.8rem;
  left: 0.8rem;
  --rot: -1.4deg;
  --tx: 2.5rem;
  --ty: 3rem;
}

.file:nth-child(2) {
  top: 7.3rem;
  right: 0.8rem;
  --rot: 1.2deg;
  --tx: -2.5rem;
  --ty: 0rem;
}

.file:nth-child(3) {
  top: 13.6rem;
  left: 1.4rem;
  --rot: -0.7deg;
  --tx: 1rem;
  --ty: -3rem;
}

.file__name {
  padding: 0.25rem 0.5rem;
  background: #e4e9f0;
  color: var(--slate);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file__row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  height: 1.55rem;
  padding: 0 0.5rem;
  border-top: 1px solid #e3e7ed;
}

.file__row>span {
  flex: 1 1 0;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file__row--head {
  color: var(--slate);
  font-weight: 600;
  background: #f1f4f8;
}

.file[data-look="a"] {
  font-style: italic;
}

.file[data-look="b"] {
  font-family: "Courier New", ui-monospace, monospace;
  font-size: 0.65rem;
}

.file[data-look="c"] {
  font-family: var(--font-serif);
}

.file[data-look="c"] .file__row:nth-child(3)>span:first-child {
  background: #fff3cf;
}

/* states: the files sit directly on the navy; the paper sheet fades in as they merge */
.is-files {
  background-color: transparent;
  box-shadow: none;
}

.is-merge {
  transition: background-color 0.4s ease 0.3s, box-shadow 0.4s ease 0.3s;
}

.is-files .remap__final {
  opacity: 0;
}

.is-files .remap__row {
  opacity: 0;
  transform: translateY(4px);
}

.is-files .remap__bar i {
  transform: scaleX(0);
}

.is-files .file {
  opacity: 0;
}

.is-files .file.is-in {
  opacity: 1;
}

.is-merge .remap__final {
  opacity: 1;
  transition: opacity 0.3s ease 0.35s;
}

.is-merge .remap__row {
  opacity: 1;
  transform: none;
  transition: opacity 0.35s ease, transform 0.35s ease;
  transition-delay: calc(0.4s + var(--i) * 90ms);
}

.is-merge .remap__bar i {
  transform: scaleX(var(--w));
  transition: transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
  transition-delay: calc(0.85s + var(--i) * 70ms);
}

.is-merge .file {
  opacity: 0;
  transform: translate(var(--tx), var(--ty)) rotate(0deg) scale(0.92);
}

.is-done .remap__files {
  display: none;
}

/* before the script starts, keep the sheet invisible so there's no flash of the
   finished view; a failsafe reveals it if the script never runs */
.remap-pending .remap__sheet {
  opacity: 0;
  animation: failsafe 0s 1.5s forwards;
}

@keyframes failsafe {
  to {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .remap__files {
    display: none !important;
  }

  .remap__final,
  .remap__row,
  .remap__bar i {
    transition: none !important;
    opacity: 1 !important;
    transform: none;
  }

  .remap__bar i {
    transform: scaleX(var(--w)) !important;
  }
}

/* ---------- Sections ---------- */
.section {
  padding-block: clamp(3rem, 7vw, 5.5rem);
}

.section--tight-top {
  padding-top: 0;
}

.problem p {
  font-size: 1.1875rem;
}

/* Intro: text beside a quiet static illustration (ragged lines becoming tidy lines) */
.intro { display: grid; gap: 2rem; align-items: center; }
.intro__text p:last-child { margin-bottom: 0; }
.intro__art { margin: 0; }
.intro__art svg { display: block; width: 100%; max-width: 22rem; height: auto; }
.ill-rag rect { fill: var(--mist); }
.ill-tidy rect { fill: var(--accent); }
.ill-tidy rect.code { fill: var(--gold); }
.ill-arrow path { fill: var(--gold); }
@media (min-width: 800px) {
  .intro { grid-template-columns: 1.25fr 1fr; gap: 4rem; }
  .intro__art svg { max-width: 24rem; margin-left: auto; }
}

/* How it helps: two-sided split, no cards */
.split {
  display: grid;
  gap: 2.5rem;
  margin-top: clamp(2.5rem, 6vw, 4rem);
}

@media (min-width: 800px) {
  .split {
    grid-template-columns: 1fr 1fr;
    gap: 0;
  }

  .split__side {
    padding-inline: 0 2.5rem;
  }

  .split__side+.split__side {
    padding-inline: 2.5rem 0;
    border-left: 1px solid var(--mist);
  }
}

@media (max-width: 799px) {
  .split__side+.split__side {
    border-top: 1px solid var(--mist);
    padding-top: 2.5rem;
  }
}

.split__title {
  margin-bottom: 1.25rem;
}

.split h3 {
  color: var(--navy);
}

.points li {
  position: relative;
  padding-left: 1.5rem;
  margin-bottom: 1rem;
  max-width: 34rem;
}

.points strong {
  font-weight: 600;
}

.points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 0.7rem;
  height: 0.45rem;
  background: var(--gold-ink);
  clip-path: polygon(0 100%, 0 40%, 100% 0, 100% 100%);
}

/* Who's building it */
.people {
  margin-top: 1.75rem;
  display: grid;
  gap: 2rem;
}
@media (min-width: 720px) {
  .people { grid-template-columns: 1fr 1fr; gap: 3rem; }
}
.person { border-top: 2px solid var(--navy); padding-top: 1rem; }
.person h3 { margin: 0 0 0.15rem; }
.person p { max-width: 36rem; margin: 0 0 0.75rem; }
.person .person__role { color: var(--slate); font-size: 0.9375rem; }

.location {
  color: var(--slate);
  margin-top: 1.5rem;
}

.photo {
  margin: 2.5rem 0 0;
}

.photo img {
  display: block;
  width: 100%;
  height: auto;
}

/* Get involved */
.involve {
  position: relative;
  background: var(--navy);
  color: var(--paper);
  overflow: hidden;
}

.involve h2 {
  color: var(--paper);
}

/* Secondary motif: single corner detail (use 2 of 2) */
.involve::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: clamp(4rem, 14vw, 9rem);
  height: clamp(1.25rem, 3vw, 2rem);
  background: var(--gold);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 22% 100%);
}

.options {
  display: grid;
  gap: 2.5rem;
  margin-top: 2.25rem;
}

@media (min-width: 800px) {
  .options {
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
  }
}

.option h3 {
  color: var(--paper);
}

.option p {
  color: var(--mist);
}

.option .btn {
  margin-top: 0.5rem;
}

/* ---------- Footer ---------- */
.site-footer {
  padding-block: 2.5rem;
  font-size: 0.9375rem;
  color: var(--slate);
}

.site-footer .wrap {
  display: grid;
  gap: 0.5rem;
}

.site-footer img {
  width: 1.75rem;
  height: auto;
  display: block;
  margin-bottom: 0.5rem;
}

.site-footer p {
  margin: 0;
  max-width: none;
}

.site-footer a {
  color: var(--navy);
}

/* ---------- Privacy page ---------- */
.doc {
  padding-block: clamp(2.5rem, 6vw, 4.5rem);
}

.doc h1 {
  font-size: clamp(2rem, 5vw, 2.75rem);
}

.doc h2 {
  font-size: 1.5rem;
  margin-top: 2.25rem;
}

.doc ul {
  list-style: disc;
  padding-left: 1.25rem;
  max-width: 66ch;
}

.doc li {
  margin-bottom: 0.5rem;
}

.placeholder {
  background: #fff3cf;
  padding: 0.1rem 0.35rem;
  border-radius: 2px;
}
/* ---------- Ledger grid texture on the navy sections ----------
   Static and purely decorative: faint spreadsheet lines that fade out toward the text.
   Pure CSS, so no extra requests. */
.hero::before,
.involve::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(185, 195, 209, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(185, 195, 209, 0.12) 1px, transparent 1px);
  background-size: 2.5rem 2.5rem;
  background-position: -1px -1px;
}
.hero::before {
  -webkit-mask-image: linear-gradient(100deg, transparent 20%, #000 75%);
          mask-image: linear-gradient(100deg, transparent 20%, #000 75%);
}
.involve::before {
  -webkit-mask-image: linear-gradient(260deg, transparent 15%, #000 80%);
          mask-image: linear-gradient(260deg, transparent 15%, #000 80%);
}
@media (max-width: 899px) {
  .hero::before { -webkit-mask-image: linear-gradient(180deg, transparent 35%, #000 90%); mask-image: linear-gradient(180deg, transparent 35%, #000 90%); }
}
.hero > .wrap, .involve > .wrap { position: relative; z-index: 1; }
