/* mtipsey.com — warm paper, whiskey amber, ledger lines.
   No external fonts, no trackers, no build step. */

:root {
  color-scheme: light dark;
  --paper: #faf6ef;
  --paper-deep: #f2ecdf;
  --ink: #211d18;
  --ink-soft: #5c554b;
  --ink-faint: #776e60;
  --amber: #9c5518;
  --amber-bright: #b4652a;
  --line: #ddd4c4;
  --card: #fffdf8;
  --serif: ui-serif, 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1a1713;
    --paper-deep: #221e18;
    --ink: #ece5d8;
    --ink-soft: #b3a894;
    --ink-faint: #8d8375;
    --amber: #d98c45;
    --amber-bright: #e69b52;
    --line: #38322a;
    --card: #211d17;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
  /* clip, not hidden: overflow-x:hidden turns body into a scroll container and
     silently breaks every position:sticky descendant. clip does not. */
  overflow-x: clip;
}

.wrap { max-width: 720px; margin: 0 auto; padding: 0 1.4rem; }

/* ── header / nav ─────────────────────────────── */
header.site {
  border-bottom: 1px solid var(--line);
  padding: 1.1rem 0;
}
header.site .wrap {
  display: flex; align-items: baseline; justify-content: space-between;
  flex-wrap: wrap; gap: .5rem 1.5rem;
}
nav.site { display: flex; flex-wrap: wrap; gap: .2rem 1.2rem; }
.brand {
  font-family: var(--serif);
  font-size: 1.15rem; font-weight: 700;
  color: var(--ink); text-decoration: none;
  letter-spacing: -0.01em;
  padding: .3rem 0;
}
.brand span { color: var(--amber); }
nav.site a {
  color: var(--ink-soft); text-decoration: none;
  font-size: .95rem;
  padding: .55rem 0;
}
nav.site a:hover, nav.site a[aria-current] { color: var(--amber); }
nav.site a[aria-current] {
  text-decoration: underline;
  text-underline-offset: 6px;
  text-decoration-thickness: 2px;
}

/* ── typography ───────────────────────────────── */
h1, h2, h3 { font-family: var(--serif); letter-spacing: -0.015em; line-height: 1.2; }
h1 { font-size: clamp(2rem, 6vw, 3.1rem); margin: 0 0 1rem; text-wrap: balance; line-height: 1.08; letter-spacing: -0.02em; }
h2 { font-size: 1.45rem; margin: 3.2rem 0 .8rem; }
h3 { font-size: 1.1rem; margin: 1.4rem 0 .4rem; }
p  { margin: .8rem 0; }
main > p, .principles li { max-width: 65ch; }
a  { color: var(--amber); }
a:hover { color: var(--amber-bright); }
.lede em, h1 em, h2 em { font-family: var(--serif); }
h1 .hl { color: var(--amber); }
.muted { color: var(--ink-soft); }
.small { font-size: .88rem; color: var(--ink-faint); }

/* ── focus ────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 3px;
  border-radius: 4px;
}
.btn:focus-visible { outline-offset: 2px; border-radius: 8px; }

/* ── hero ─────────────────────────────────────── */
.hero { padding: 3.2rem 0 1.6rem; }
.eyebrow {
  font: 600 .82rem var(--mono);
  letter-spacing: .01em;
  color: var(--ink-faint); margin: 0 0 1.2rem;
}
.hero .lede {
  font-size: 1.12rem; color: var(--ink-soft); max-width: 58ch;
}
.hero-grid {
  display: grid; grid-template-columns: 1fr 280px;
  gap: 2rem; align-items: start;
}
/* Spans both columns on its own row below the eyebrow/h1/portrait row,
   instead of being squeezed into the narrow text column beside the photo. */
.hero-grid .lede-wide { grid-column: 1 / -1; max-width: none; }
/* Head-and-shoulders crop, normal flow — short enough that it no longer
   needs the absolute-positioning/min-height workarounds the full-body
   portrait required to avoid overlapping the row below it. */
.portrait { margin: 0; }
.portrait img {
  display: block; width: 100%; height: auto;
  border-radius: 8px; border: 1px solid var(--line);
}
@media (prefers-color-scheme: dark) {
  .portrait img { filter: brightness(.92); }
  .project-visual img { filter: brightness(.85) saturate(.95); }
}
@media (max-width: 620px) {
  .hero-grid { grid-template-columns: 1fr; gap: 1rem; }
  /* The hero has to earn the offer before it earns a face — a photo here
     delays the proposition. His portrait appears lower, in "Why me". */
  .portrait { display: none; }
}

/* ── dominant offer card ──────────────────────── */
.offer { margin: 2.2rem 0 .6rem; }
.offer .k {
  font: 600 .82rem var(--mono); letter-spacing: .01em;
  color: var(--ink-faint); display: block; margin-bottom: .6rem;
}
.offer-head {
  font-family: var(--serif); font-size: 1.5rem; line-height: 1.3;
  display: block; margin-bottom: .7rem;
}
.offer p { color: var(--ink-soft); font-size: .98rem; }
.offer p:last-child { margin: 1.1rem 0 0; }

/* ── case studies (the running proof) ─────────── */
.project { display: grid; grid-template-columns: 1.1fr .9fr; gap: 2.2rem; align-items: center; margin: 2.6rem 0; }
.project.top { align-items: start; margin-top: 1.2rem; }
.project.top .project-visual { max-width: 300px; justify-self: end; }
.project.stack { display: block; }
.project-copy > :first-child { margin-top: 0; }
.project-copy .eyebrow { margin-bottom: .6rem; }
.project-copy h3 { font-size: 1.35rem; margin-top: 0; }
.project-copy p { color: var(--ink-soft); font-size: .95rem; }
.project-visual { margin: 0; }
.project-visual img {
  display: block; width: 100%; height: auto;
  border-radius: 12px; border: 1px solid var(--line);
}
.project-visual.phone { max-width: 250px; justify-self: center; }
.project-visual.phone img { border-radius: 22px; }
.project-visual figcaption { margin-top: .6rem; }
.breakout {
  width: min(880px, calc(100vw - 2.8rem));
  position: relative; left: 50%; transform: translateX(-50%);
  margin-top: 1.6rem;
}
@media (max-width: 620px) {
  .project { grid-template-columns: 1fr; gap: 1.4rem; }
  .project-visual.phone { max-width: 210px; justify-self: start; }
}

/* ── receipts (compact ledger) ────────────────── */
.receipts { border-top: 1px solid var(--line); }
.receipt {
  display: grid; grid-template-columns: minmax(11rem, 16rem) 1fr;
  gap: 1.2rem; padding: 1.05rem 0;
  border-bottom: 1px solid var(--line);
}
@media (max-width: 560px) { .receipt { grid-template-columns: 1fr; gap: .2rem; } }
.receipt .fig {
  font: 600 .92rem/1.5 var(--mono);
  color: var(--amber);
}
.receipt .what { color: var(--ink-soft); font-size: .95rem; align-self: center; }
.receipt .what strong { color: var(--ink); font-weight: 600; }

/* ── principles ───────────────────────────────── */
.principles { margin: 1rem 0; padding-left: 0; list-style: none; }
.principles li {
  padding: .9rem 0 .9rem 1.6rem; position: relative;
  border-bottom: 1px solid var(--line);
}
.principles li:last-child { border-bottom: none; }
.principles li::before {
  content: "—"; position: absolute; left: 0; color: var(--amber);
  font-family: var(--mono);
}
.principles strong { font-family: var(--serif); }

/* ── full-bleed band ──────────────────────────── */
.band {
  background: var(--paper-deep);
  box-shadow: 0 0 0 100vmax var(--paper-deep);
  clip-path: inset(0 -100vmax);
  padding: 2.2rem 0 2.6rem;
  margin: 3.2rem 0;
}
.band > :first-child { margin-top: 0; }
.band h2 { margin-top: 0; }

/* ── cards / sections ─────────────────────────── */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 8px; padding: 1.4rem 1.5rem; margin: 1.3rem 0;
}
.card.accent { border-left: 3px solid var(--amber); }
.card > :first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }

.callout {
  background: var(--paper-deep); border-radius: 8px;
  padding: 1.2rem 1.4rem; margin: 1.5rem 0;
  font-size: .95rem;
}
.callout > :first-child { margin-top: 0; }
.callout > :last-child { margin-bottom: 0; }

/* ── buttons ──────────────────────────────────── */
.btn {
  display: inline-block; background: var(--amber); color: var(--paper);
  text-decoration: none; font: 600 .95rem var(--sans);
  padding: .65rem 1.2rem; border-radius: 6px;
  transition: background .15s ease;
  border: none; cursor: pointer;
}
.btn:hover { background: var(--amber-bright); color: var(--paper); }
.btn.ghost {
  background: transparent; color: var(--amber);
  border: 1px solid var(--amber);
}
.btn.ghost:hover { background: var(--amber); color: var(--paper); }

.copyrow { display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; }

/* ── leak math (diagnostic tools) ─────────────── */
.lm-tool .lm-paths { display: grid; gap: .55rem; margin-bottom: 1.4rem; }
.lm-tool .lm-paths .btn { width: 100%; text-align: left; }
.lm-tool .lm-panel { border-top: 1px solid var(--line); padding-top: .35rem; }
.lm-tool .lm-slider-row { margin: 1rem 0; }
.lm-tool label, .lm-tool legend { font-size: .88rem; color: var(--ink-soft); }
.lm-tool label strong { color: var(--ink); font-family: var(--mono); }
.lm-tool input[type="range"] {
  display: block; width: 100%; margin-top: .4rem; padding: 0;
  accent-color: var(--amber); cursor: pointer;
}
.lm-tool .lm-number-row { margin: 1.15rem 0; }
.lm-tool .lm-number-row label { display: block; margin-bottom: .35rem; }
.lm-tool .lm-number-row input {
  font: 600 1rem var(--mono); color: var(--ink);
  background: var(--paper); border: 1px solid var(--line); border-radius: 6px;
  padding: .5rem .7rem; width: min(100%, 12rem); text-align: right;
}
.lm-tool input:focus-visible { outline: 2px solid var(--amber); outline-offset: 0; border-color: var(--amber); }
.lm-tool .lm-recovery { border: 0; padding: 0; margin: 1.2rem 0; }
.lm-tool .lm-recovery legend {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: .6rem; width: 100%;
}
.lm-tool .lm-toggle { display: flex; gap: .5rem; margin-top: .45rem; }
.lm-tool .lm-toggle .btn { flex: 1; padding: .5rem .7rem; }

/* leak math — info tooltips */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.lm-tool .lm-row-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: .6rem;
}
.lm-tool .lm-row-head label { margin-bottom: 0; }
.lm-tool .lm-info {
  flex: 0 0 auto; width: 1.3rem; height: 1.3rem; margin: 0; padding: 0;
  border-radius: 50%; border: 1px solid var(--line); background: var(--card);
  color: var(--ink-faint); font: 600 .76rem var(--mono); line-height: 1;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.lm-tool .lm-info:hover, .lm-tool .lm-info[aria-expanded="true"] {
  border-color: var(--amber); color: var(--amber);
}
.lm-tool .lm-tip {
  margin: .4rem 0 0; padding: .55rem .75rem; background: var(--paper-deep);
  border-radius: 6px; font-size: .82rem; color: var(--ink-soft); line-height: 1.45;
}
.lm-out { margin-top: 1.4rem; border-top: 1px solid var(--line); }
.lm-out .receipt:last-of-type { border-bottom: none; }
.lm-cta { border-top: 1px solid var(--line); padding-top: 1.1rem; margin: 0; }

/* ── diagnostic pre-selector ───────────────────── */
.diag-preselect { margin: 1.6rem 0 2.2rem; }
.diag-preselect .lm-paths { margin-bottom: 0; }
.diag-section { margin-top: 1.8rem; }

/* ── footer ───────────────────────────────────── */
footer.site {
  margin-top: 4.5rem; border-top: 1px solid var(--line);
  padding: 1.6rem 0 2.4rem;
  font-size: .88rem; color: var(--ink-faint);
}
footer.site .wrap { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .6rem 1.5rem; }
footer.site .wrap + .wrap { margin-top: .5rem; }
footer.site a { color: var(--ink-soft); text-decoration: none; margin-right: 1.1rem; padding: .4rem 0; display: inline-block; }
footer.site a:hover { color: var(--amber); }

/* ── misc ─────────────────────────────────────── */
[hidden] { display: none !important; }
hr { border: none; border-top: 1px solid var(--line); margin: 2.5rem 0; }
::selection { background: var(--amber); color: var(--paper); }

/* ── blockquote (pull-quote treatment) ───────────── */
blockquote {
  margin: 2.6rem 0; padding: .2rem 0 .2rem 1.4rem;
  border-left: 3px solid var(--amber);
}
blockquote p {
  font-family: var(--serif); font-style: italic;
  font-size: 1.3rem; line-height: 1.5; color: var(--ink-soft);
  margin: 0;
}

/* ── flow diagrams ────────────────────────────── */
.flow { list-style: none; margin: 1.7rem 0; padding: 0; }
.flow b { display: block; font-family: var(--serif); font-size: 1.02rem; line-height: 1.35; }
.flow p { margin: .3rem 0 0; color: var(--ink-soft); font-size: .92rem; line-height: 1.5; }

/* level one — the glance */
.flow.simple { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.1rem; }
.flow.simple li {
  position: relative; background: var(--card);
  border: 1px solid var(--line); border-radius: 8px; padding: .95rem 1.05rem;
}
.flow.simple li + li::before {
  content: "\2192"; position: absolute; left: -.86rem; top: 50%;
  transform: translateY(-50%); color: var(--ink-faint); font-size: .95rem;
}
@media (max-width: 700px) {
  .flow.simple { grid-template-columns: 1fr; gap: 1.6rem; }
  .flow.simple li + li::before {
    content: "\2193"; left: 50%; top: -1.25rem; transform: translateX(-50%);
  }
}

/* level two — the mechanism */
.flow.deep { border-left: 2px solid var(--line); padding-left: 1.5rem; margin-left: .5rem; }
.flow.deep > li { position: relative; padding-bottom: var(--step-gap, 1.6rem); }
.flow.deep > li::before {
  content: ""; position: absolute; left: -1.87rem; top: .42rem;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--paper); border: 2px solid var(--line);
}
.flow.deep > li:last-child { padding-bottom: 0; }

/* the human gate — the point of the whole thing */
.flow .gate { border-color: var(--amber); }
.flow.simple li.gate { border-left: 3px solid var(--amber); }
/* the gate reads amber, but stays hollow until active like every other dot —
   filling only on focus, so the row of markers behaves consistently */
.flow.deep > li.gate::before { border-color: var(--amber); }
.flow.deep > li.gate > b { color: var(--amber); }

.flow .split { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; margin-top: .7rem; }
@media (max-width: 620px) { .flow .split { grid-template-columns: 1fr; } }
.flow .split > div { background: var(--paper-deep); border-radius: 8px; padding: .8rem .95rem; }
.flow .split b { font-size: .95rem; }
.flow .split p { font-size: .88rem; }

.translate { border-left: 3px solid var(--line); padding-left: 1.2rem; margin: 1.8rem 0; }
.translate h3 { margin-top: 0; }

/* ── system map (inline SVG, vertical so it survives a phone) ── */
.sysmap { display: block; width: 100%; max-width: 420px; height: auto; margin: 1.6rem auto 2rem; }
.sysmap text { font-family: var(--sans); fill: var(--ink); }
.sysmap .t-sm { font-size: 13px; fill: var(--ink-soft); }
.sysmap .t-lb { font-size: 15px; font-weight: 600; }
.sysmap .box { fill: var(--card); stroke: var(--line); stroke-width: 1.5; }
.sysmap .zone { fill: var(--paper-deep); stroke: none; }
.sysmap .gate { fill: var(--card); stroke: var(--amber); stroke-width: 2.5; }
.sysmap .gate-t { fill: var(--amber); font-weight: 600; }
.sysmap .arw { stroke: var(--ink-faint); stroke-width: 1.5; fill: none; }
.sysmap .arw-head { fill: var(--ink-faint); }

/* ── scroll focus ──────────────────────────────────
   Emphasis is added to the active step, never taken away from the others.
   Dimming inactive text to .5 measured 2.25:1 against paper — a WCAG AA
   failure — so every step stays at full contrast, always readable. */
.flow.deep { isolation: isolate; }
/* scale, not font-size: font-size reflows (measured 2px of shift per step
   change, on every scroll transition). transform stays on the compositor. */
.flow.deep > li > b { transform-origin: left center; transition: transform .25s ease; }
.flow.deep > li::before { transition: transform .25s ease, background .25s ease, border-color .25s ease; }
.flow.deep > li::after {
  content: ""; position: absolute; z-index: -1;
  inset: -.45rem -.9rem calc(var(--step-gap, 1.6rem) - .45rem) -.9rem;
  background: var(--paper-deep); border-radius: 8px;
  opacity: 0; transition: opacity .25s ease;
}
.flow.deep.focusable > li.is-active::after { opacity: 1; }
.flow.deep.focusable > li.is-active > b { transform: scale(1.11); }
.flow.deep.focusable > li.is-active::before {
  transform: scale(1.5); background: var(--ink-faint); border-color: var(--ink-faint);
}
.flow.deep.focusable > li.gate.is-active::before { background: var(--amber); border-color: var(--amber); }
@media (prefers-reduced-motion: reduce) {
  .flow.deep > li > b, .flow.deep > li::before, .flow.deep > li::after { transition: none; }
  .flow.deep.focusable > li.is-active > b { transform: none; }
  .flow.deep.focusable > li.is-active::before { transform: none; }
}

/* ── sticky map beside the steps ───────────────── */
.flowlab { margin: 1.6rem 0 0; }
.flowlab-map .sysmap { margin: 0 auto 2.2rem; }
@media (min-width: 1000px) {
  .flowlab {
    width: min(1060px, calc(100vw - 3rem));
    position: relative; left: 50%; transform: translateX(-50%);
    display: grid; grid-template-columns: 400px 1fr; gap: 2.8rem; align-items: start;
  }
  /* clears the sticky heading above it */
  .flowlab-map { position: sticky; top: 4.4rem; }
  .flowlab-map .sysmap { margin: 0; max-width: 400px; }
}

/* Give each step its own band of scroll so all eight get a turn in the
   focus line. Without this the list is shorter than the viewport and the
   highlight has to skip items — there is simply nowhere to travel.
   Scroll speed and direction are untouched; the section is just taller. */
@media (min-width: 1000px) and (prefers-reduced-motion: no-preference) {
  /* The list must be taller than the viewport or the focus line cannot reach
     every step. Content is ~950px, so 8vh of gap covers viewports up to
     ~2639px tall — every real screen — while 17vh was twice what was needed. */
  .flowlab-steps { --step-gap: 8vh; }
  .flowlab-steps .flow.deep > li:last-child { padding-bottom: 8vh; }
}
/* No scroll-snap. Tried `y proximity` with centred step targets: it captured
   the top of the page — scrolling to y=60 landed at y=411 — so you could not
   rest at the top. Snapping the root document is not worth that. */
.sysmap .box, .sysmap .gate { transition: stroke .25s ease, stroke-width .25s ease, fill .25s ease; }
.sysmap g.lit .box { stroke: var(--ink); stroke-width: 2.5; fill: var(--paper-deep); }
.sysmap g.lit .gate { stroke-width: 4.5; }
@media (prefers-reduced-motion: reduce) {
  .sysmap .box, .sysmap .gate { transition: none; }
}

/* heading with an inline subtitle — one line on desktop so the section
   opens across the full width instead of stacking to the left */
.with-sub .sub {
  display: block; font-family: var(--sans); font-size: 1rem; font-weight: 400;
  color: var(--ink-soft); letter-spacing: 0; margin-top: .35rem;
}
@media (min-width: 1000px) {
  .with-sub { margin-bottom: 1rem; }
  .with-sub .sub { display: inline; margin: 0 0 0 .5rem; }
  .with-sub .sub::before { content: "— "; }
  /* heading rides inside the breakout so it shares a left edge with the map,
     instead of the diagram hanging out to the left of everything else — and
     sticks to the top for the whole section, so the reader always has a fixed
     datum telling them what they are looking at */
  .flowlab > .with-sub {
    grid-column: 1 / -1; margin: 3.2rem 0 0;
    position: sticky; top: 0; z-index: 2;
    background: var(--paper);
    padding: .75rem 0 .65rem;
    border-bottom: 1px solid var(--line);
  }
}

/* ── real posts strip ─────────────────────────── */
.postgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.4rem; margin: 1.5rem 0 2.2rem; }
.postgrid figure { margin: 0; display: flex; flex-direction: column; }
.postgrid img {
  display: block; width: 100%; height: auto;
  border-radius: 10px; border: 1px solid var(--line);
}
.postgrid figcaption { padding-top: .7rem; }
.postgrid figcaption p {
  margin: 0 0 .5rem; font-family: var(--serif);
  font-size: .95rem; line-height: 1.45; color: var(--ink);
}
.postgrid .meta {
  font: 600 .78rem var(--mono); letter-spacing: .01em; color: var(--ink-faint);
}
@media (prefers-color-scheme: dark) { .postgrid img { filter: brightness(.9) saturate(.96); } }
@media (max-width: 700px) {
  .postgrid { grid-template-columns: 1fr; gap: 1.8rem; max-width: 26rem; }
}
