/* Margin Theory: fractional CFO for D2C brands.
   Concept: "what you keep from every order". Deep aubergine ink, one amber accent
   reserved for the money a brand keeps. Bricolage Grotesque for display,
   Hanken Grotesk for reading, tabular figures wherever numbers line up. */

/* Brand palette (owner-supplied): Palladian, Oatmeal, Blue Fantastic,
   Burning Flame, Truffle Trouble, Abyssal Anchorfish Blue. Flame is reserved
   for "what you keep" and primary actions. */
:root {
  --ink: #1B2632;        /* Abyssal Anchorfish Blue: text, dark bands */
  --ink-soft: #2C3B4D;   /* Blue Fantastic: raised surface on dark bands */
  --paper: #EEE9DF;      /* Palladian: page */
  --mist: #E4DDD0;       /* between Palladian and Oatmeal: quiet panels */
  --card: #F7F4EE;       /* lifted card on Palladian */
  --line: #D4CCBC;       /* rules */
  --muted: #4E5966;      /* secondary text, 6.4:1 on Palladian */
  --cost: #C9C1B1;       /* Oatmeal: cost bars */
  --amber: #FFB162;      /* Burning Flame: what you keep; primary action */
  --amber-deep: #A35139; /* Truffle Trouble: accent text on light ground */
  --on-dark: #EEE9DF;
  --on-dark-muted: #AEB6BF;

  --display: "Bricolage Grotesque", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --text: "Hanken Grotesk", "Helvetica Neue", Arial, system-ui, sans-serif;

  --max: 74rem;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--text); font-size: 1.0625rem; line-height: 1.6;
  font-feature-settings: "kern"; text-rendering: optimizeLegibility;
}
img, svg { max-width: 100%; }

h1, h2, h3 { font-family: var(--display); margin: 0; text-wrap: balance; color: inherit; }
h1 { font-size: clamp(2.5rem, 5.4vw, 4.1rem); line-height: 1.02; font-weight: 700; letter-spacing: -0.03em; }
h2 { font-size: clamp(1.85rem, 3.4vw, 2.6rem); line-height: 1.08; font-weight: 650; letter-spacing: -0.022em; }
h3 { font-size: 1.2rem; line-height: 1.3; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0 0 1em; max-width: 62ch; }
p:last-child { margin-bottom: 0; }
.lede { font-size: clamp(1.15rem, 1.6vw, 1.3rem); line-height: 1.55; color: var(--muted); }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums lining-nums; }

a { color: inherit; text-decoration-line: underline; text-decoration-thickness: 1px; text-underline-offset: 0.22em; }
a:hover { text-decoration-color: var(--amber); }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; border-radius: 2px; }

.skip { position: absolute; left: -999px; top: .5rem; background: var(--ink); color: var(--on-dark); padding: .5rem 1rem; z-index: 20; }
.skip:focus { left: .5rem; }

.wrap { max-width: var(--max); margin: 0 auto; padding-left: max(var(--gutter), env(safe-area-inset-left, 0px)); padding-right: max(var(--gutter), env(safe-area-inset-right, 0px)); }

.draft-bar { background: #F6E3CF; color: #7A3A27; font-size: .875rem; text-align: center; padding: .45rem 1rem; }

/* ---------- Header ---------- */
.site-header { border-bottom: 1px solid var(--line); background: var(--paper); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; padding-block: 1.1rem; }
.wordmark { display: inline-flex; align-items: center; gap: .6rem; font-family: var(--display); font-weight: 700; font-size: 1.25rem; letter-spacing: -0.02em; text-decoration: none; }
.wordmark svg { width: 1.6rem; height: 1.6rem; flex: none; }
.nav { list-style: none; display: flex; align-items: center; gap: 1.75rem; margin: 0; padding: 0; font-size: 1rem; }
.nav-link { text-decoration: none; color: var(--muted); }
.nav-link:hover { color: var(--ink); }
.nav-link[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--amber); }
.nav-cta { text-decoration: none; background: var(--ink); color: var(--on-dark); padding: .55rem 1rem; border-radius: 999px; font-weight: 500; }
.nav-cta:hover { background: var(--ink-soft); }

/* ---------- Buttons ---------- */
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.5rem; }
.button { display: inline-block; font-family: var(--text); font-weight: 600; font-size: 1rem; text-decoration: none; background: var(--amber); color: var(--ink); padding: .85rem 1.4rem; border-radius: 999px; transition: background .15s; }
.button:hover { background: #FFC17F; }
.text-link { font-weight: 500; }

/* ---------- Sections ---------- */
.section { padding-block: clamp(4rem, 9vw, 7rem); }
.section-head { display: grid; gap: 1rem; margin-bottom: clamp(2rem, 4vw, 3rem); max-width: 46rem; }
.band { background: var(--ink); color: var(--on-dark); }
.band .lede, .band .muted { color: var(--on-dark-muted); }
.band a:hover { text-decoration-color: var(--amber); }
.panel { background: var(--mist); }

/* ---------- Hero ---------- */
.hero { padding-block: clamp(3.5rem, 8vw, 6.5rem) clamp(4rem, 8vw, 6rem); display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: clamp(2.5rem, 6vw, 5rem); align-items: center; }
.hero h1 { margin-bottom: 1.4rem; }
.hero .lede { margin-bottom: 2rem; }
.kicker { font-weight: 600; color: var(--amber-deep); margin-bottom: 1rem; }

/* The order: where $100 goes */
.order { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: clamp(1.25rem, 3vw, 1.9rem); box-shadow: 0 1px 0 var(--line), 0 24px 48px -32px rgba(27, 38, 50, .35); }
.order-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: 1.25rem; }
.order-head h2 { font-size: 1.15rem; letter-spacing: -0.01em; }
.order-head span { color: var(--muted); font-size: .875rem; }
.order-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; }
.order-row { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr) 3.4rem; gap: .9rem; align-items: center; font-size: .95rem; }
.order-row .label { color: var(--muted); }
.order-row .val { text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }
.track { position: relative; height: 1.05rem; }
.bar { position: absolute; top: 0; bottom: 0; left: var(--from); width: var(--w); background: var(--cost); border-radius: 3px; transform-origin: left; animation: grow .7s cubic-bezier(.2,.7,.2,1) both; animation-delay: calc(var(--i) * 90ms + 150ms); }
.order-row.total .bar { background: var(--ink-soft); }
.order-row.keep .bar { background: var(--amber); }
.order-row.total .label, .order-row.keep .label { color: var(--ink); font-weight: 600; }
.order-row.keep .val { color: var(--amber-deep); font-weight: 700; }
.order-row.keep { margin-top: .35rem; padding-top: .7rem; border-top: 1px dashed var(--line); }
.order-note { margin-top: 1.25rem; font-size: .875rem; color: var(--muted); }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@media (prefers-reduced-motion: reduce) { .bar { animation: none; } }

/* ---------- Problems ---------- */
.problems { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2.5rem clamp(2rem, 5vw, 4.5rem); }
.problem h3 { margin-bottom: .5rem; }
.problem p { color: var(--muted); }

/* ---------- Services ---------- */
.services { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: rgba(238, 233, 223, .12); border: 1px solid rgba(238, 233, 223, .12); border-radius: 14px; overflow: hidden; }
.service { background: var(--ink); padding: clamp(1.4rem, 3vw, 2rem); display: grid; align-content: start; gap: .6rem; }
.service h3 { color: var(--on-dark); }
.service p { color: var(--on-dark-muted); font-size: .98rem; }
.service.lead { background: var(--ink-soft); }
.service .tag { justify-self: start; font-size: .8rem; font-weight: 600; color: var(--ink); background: var(--amber); padding: .15rem .6rem; border-radius: 999px; }
.services-foot { margin-top: 1.75rem; }

/* ---------- Steps (a real sequence) ---------- */
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(1.5rem, 4vw, 3rem); counter-reset: step; }
.steps li { counter-increment: step; display: grid; gap: .55rem; align-content: start; padding-top: 1.25rem; border-top: 2px solid var(--ink); }
.steps li::before { content: counter(step); font-family: var(--display); font-weight: 700; font-size: 1rem; color: var(--amber-deep); }
.steps p { color: var(--muted); }

/* ---------- Data sources ---------- */
.sources { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: clamp(2rem, 6vw, 5rem); align-items: start; }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .6rem; }
.chips li { background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: .5rem 1rem; font-size: .95rem; }

/* ---------- Detail pages ---------- */
.page-head { padding-block: clamp(3.5rem, 8vw, 6rem) clamp(2rem, 4vw, 3rem); display: grid; gap: 1.25rem; max-width: 50rem; }
.detail { display: grid; grid-template-columns: minmax(0, 18rem) minmax(0, 1fr); gap: clamp(1.5rem, 5vw, 4rem); padding-block: clamp(2.25rem, 4vw, 3rem); border-top: 1px solid var(--line); }
.detail h2 { font-size: clamp(1.5rem, 2.4vw, 1.85rem); }
.detail ul { margin: .75rem 0 0; padding-left: 1.1rem; }
.detail li { margin-bottom: .4rem; }
.detail li::marker { color: var(--amber-deep); }
.detail .for { font-size: .95rem; color: var(--muted); margin-top: 1rem; }

.principles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(1.5rem, 4vw, 3rem); }
.principles h3 { margin-bottom: .5rem; }
.principles p { color: var(--muted); }

.plain-list { margin: 0; padding-left: 1.1rem; }
.plain-list li { margin-bottom: .4rem; }

/* Placeholders: unmistakable, never confused with real content. */
.placeholder { border: 1.5px dashed #B3A894; background: rgba(247,244,238,.7); border-radius: 10px; padding: 1rem 1.2rem; color: var(--muted); font-style: italic; }
.band .placeholder { background: transparent; border-color: #5A6878; color: var(--on-dark-muted); }
.placeholder-inline { border-bottom: 1.5px dashed #B3A894; font-style: italic; }

/* ---------- CTA ---------- */
.cta { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2rem; align-items: end; }
.cta p { color: var(--on-dark-muted); }
.email-line { font-size: .95rem; color: var(--on-dark-muted); }
.email-line strong { color: var(--on-dark); font-weight: 500; user-select: all; }

/* ---------- Legal ---------- */
.legal { max-width: 46rem; padding-bottom: clamp(4rem, 8vw, 6rem); }
.legal h2 { font-size: 1.4rem; margin: 2.25rem 0 .6rem; }
.legal ul { padding-left: 1.1rem; }

/* ---------- Footer ---------- */
.site-footer { background: var(--ink); color: var(--on-dark-muted); font-size: .95rem; border-top: 1px solid rgba(238,233,223,.1); }
.site-footer a { color: var(--on-dark); }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2rem; padding-block: 3rem 2rem; }
.footer-mark { font-family: var(--display); font-weight: 700; font-size: 1.25rem; color: var(--on-dark); margin-bottom: .25rem; letter-spacing: -0.02em; }
.footer-links { list-style: none; padding: 0; margin: .6rem 0 0; display: flex; flex-wrap: wrap; gap: .4rem 1.25rem; }
.footer-legal { border-top: 1px solid rgba(238,233,223,.12); padding-block: 1.1rem 1.6rem; font-size: .85rem; }
.site-footer .placeholder-inline { border-color: #5A6878; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .hero { grid-template-columns: minmax(0, 1fr); }
  .services { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sources { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .problems, .steps, .principles, .services { grid-template-columns: minmax(0, 1fr); }
  .detail { grid-template-columns: minmax(0, 1fr); }
  .cta { grid-template-columns: minmax(0, 1fr); align-items: start; }
  .nav { gap: 1.1rem; }
  .nav .nav-link-hide { display: none; }
  .order-row { grid-template-columns: 7.6rem minmax(0, 1fr) 3rem; gap: .6rem; font-size: .875rem; }
}
.space-top { margin-top: 1.5rem; }

/* Waterfall positions for the illustrative order */
.o0 { --from: 0%; --w: 100%; --i: 0; }
.o1 { --from: 92%; --w: 8%; --i: 1; }
.o2 { --from: 62%; --w: 30%; --i: 2; }
.o3 { --from: 50%; --w: 12%; --i: 3; }
.o4 { --from: 46%; --w: 4%; --i: 4; }
.o5 { --from: 40%; --w: 6%; --i: 5; }
.o6 { --from: 14%; --w: 26%; --i: 6; }
.o7 { --from: 0%; --w: 14%; --i: 7; }
.wordmark, .nav-cta, .nav-link { white-space: nowrap; }
@media (max-width: 420px) {
  .wordmark { font-size: 1.1rem; gap: .45rem; }
  .wordmark svg { width: 1.35rem; height: 1.35rem; }
  .nav { gap: .85rem; font-size: .95rem; }
  .nav-cta { padding: .45rem .8rem; }
  .header-inner { gap: .75rem; }
}
