/* ─────────────────────────────────────────────────────────────────────────
   Bailey Design System v2

   White, black type, gold reserved. The feeling to hit is a quiet, expensive
   operations desk — not a dashboard, not SaaS. Everything here is shared by
   every page, which is the point: one file changes the whole product, and no
   page carries its own private copy of the truth.

   Gold (#C69C4D) is a status colour. It marks what is live, what is premium,
   what is progressing. It is never a large surface and never a big button.
   ───────────────────────────────────────────────────────────────────────── */

:root {
  /* Warm ground, white cards. The card lifts because the page is warmer than
     it is — not because of a shadow. Gold reads as metal against a warm white
     and as yellow against a pure one, which is the whole reason for the shift. */
  --bg: #FAF8F5;
  --card: #FFFFFF;
  --ink: #141414;
  --muted: #666666;
  --line: #ECE8E1;
  --line-soft: #F3F0EA;
  --gold: #C79B4A;
  --gold-wash: #FAF4E9;
  --ok: #2F8F68;
  --warn: #A8742A;
  --bad: #A5302F;
  --grid: rgba(20, 20, 20, .028);

  --sans: "SF Pro Display", -apple-system, BlinkMacSystemFont, "Geist", "Inter", system-ui, sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, monospace;

  /* 8px grid */
  --s1: 8px; --s2: 16px; --s3: 24px; --s4: 32px; --s5: 48px; --s6: 64px; --s7: 96px;
  --r: 22px; --r-sm: 14px; --r-xs: 10px;
  /* Barely there. A crisp border does the work a shadow used to. */
  --shadow: 0 1px 2px rgba(20, 16, 10, .03);
  --shadow-lift: 0 10px 30px rgba(20, 16, 10, .06);
  --ease: cubic-bezier(.22, .61, .36, 1);
  /* One motion vocabulary. Nothing in Bailey animates on its own timing. */
  --out: cubic-bezier(.16, 1, .3, 1);   /* ease-out, for anything arriving */
  --t-tap: 150ms;                        /* hover, press, small state */
  --t-page: 200ms;                       /* a view arriving */
  --t-slow: 420ms;                       /* a panel, a sheet */
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background-color: var(--bg);
  color: var(--ink);
  font: 400 17px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;

  /* A half-percent of grain. You are not meant to see it — you are meant to
     stop reading the page as a screen. Printed paper has it; screens don't. */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23g)' opacity='.045'/%3E%3C/svg%3E");
  background-repeat: repeat;
}

/* The blueprint: a survey grid under the pages where Bailey is working. Two
   or three percent — nobody reads it, everybody feels that this is about
   buildings and plans rather than rows in a database. */
body.blueprint {
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23g)' opacity='.045'/%3E%3C/svg%3E");
  background-size: 104px 104px, 104px 104px, 160px 160px;
  background-attachment: fixed, fixed, scroll;
}
::selection { background: var(--gold-wash); }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 var(--s3) var(--s7); }
@media (min-width: 941px) { body.railed .wrap { padding-left: var(--s5); padding-right: var(--s5); } }
.wrap.narrow { max-width: 720px; }

/* ── type ───────────────────────────────────────────────────────────────── */
h1 { font-size: clamp(38px, 6vw, 60px); font-weight: 600; line-height: 1.02; letter-spacing: -.03em; margin: 0; text-wrap: balance; }
h2 { font-size: clamp(24px, 3vw, 32px); font-weight: 600; line-height: 1.1; letter-spacing: -.02em; margin: 0; }
h3 { font-size: 19px; font-weight: 600; letter-spacing: -.015em; margin: 0; }
p  { margin: 0; }
.lede { font-size: 19px; line-height: 1.5; color: var(--muted); max-width: 58ch; }
.sub { font-size: 15px; color: var(--muted); }
.label { font: 500 12px var(--sans); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.gold { color: var(--gold); }
a { color: inherit; }

/* ── navigation ─────────────────────────────────────────────────────────── */
.topbar { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) 0; }
.brand { display: flex; align-items: center; gap: 2px; text-decoration: none; color: var(--ink); }
.brand img { width: 26px; height: 26px; align-self: center; }
.brand b { font-weight: 600; font-size: 17px; letter-spacing: .14em; text-transform: uppercase;
  padding-left: .14em; }
.nav { display: flex; gap: var(--s3); margin-left: var(--s5); }
.nav a { text-decoration: none; color: var(--muted); font-size: 15px; font-weight: 450; padding: 4px 0; position: relative; }
.nav a:hover { color: var(--ink); }
.nav a.on { color: var(--ink); font-weight: 500; }
.nav a.on::after { content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 1.5px; background: var(--gold); }
.topbar .right { margin-left: auto; display: flex; align-items: center; gap: var(--s2); }
@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; gap: var(--s2); padding: var(--s2) 0; }
  .nav { margin-left: 0; width: 100%; gap: var(--s3); overflow-x: auto; padding-bottom: 2px; }
  .topbar .right { margin-left: auto; }
}


/* ── the rail: one menu, left of every page ─────────────────────────────── */
/* ── the shell: a rail on the left, always. Same shape on a desk and in
      the pocket — on a phone it slides over instead of taking the width. ── */
  .rail {
  position: fixed; inset: 0 auto 0 0; width: 262px; z-index: 40;
  background: var(--bg); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: var(--s3) 14px calc(var(--s2) + env(safe-area-inset-bottom));
  overflow-y: auto; overscroll-behavior: contain;
}
.rail .brand { padding: 0 10px var(--s3); }
.rail .brand img { width: 30px; height: 30px; }
.rail .brand b { font-size: 18px; letter-spacing: .22em; }
.railnav { display: grid; gap: 2px; }
.railnav a {
  display: flex; align-items: center; gap: 13px; padding: 11px 12px; border-radius: 12px;
  text-decoration: none; color: var(--muted); font-size: 15.5px; font-weight: 450;
  transition: background .22s var(--ease), color .22s var(--ease);
}
.railnav a svg { width: 19px; height: 19px; flex: none; stroke: currentColor; fill: none;
  stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.railnav a:hover { background: rgba(20,20,20,.035); color: var(--ink); }
.railnav a.on { background: var(--gold-wash); color: var(--ink); font-weight: 500; }
.railnav a.on svg { color: var(--gold); }
.railnav .soon { margin-left: auto; font: 500 10px var(--sans); letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted); opacity: .7; }
.railnav .badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--gold-wash); color: var(--warn); font: 500 11px/20px var(--sans); text-align: center; }
.railsep { height: 1px; background: var(--line); margin: var(--s2) 12px; }
.railfoot { margin-top: auto; padding-top: var(--s2); }
.me { display: flex; align-items: center; gap: 11px; width: 100%; padding: 10px 12px; border-radius: 12px;
  text-decoration: none; color: var(--ink);
  border: none; background: none; cursor: pointer; text-align: left; font: inherit; }
.me:hover { background: var(--line-soft); }
.me .av { width: 34px; height: 34px; border-radius: 50%; background: var(--ink); color: #fff; flex: none;
  display: grid; place-items: center; font: 500 14px var(--sans); }
.me .who { min-width: 0; }
.me .who b { display: block; font-size: 14.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me .who span { display: block; font-size: 12.5px; color: var(--muted); }
.me .cv { margin-left: auto; color: var(--muted); font-size: 12px; }

body.railed { padding-left: 262px; }
main { min-height: 100dvh; }
.topline { position: sticky; top: 0; z-index: 20; background: rgba(250,248,245,.82);
  backdrop-filter: saturate(180%) blur(14px); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: var(--s2); padding: 14px var(--s4); }
.topline .t { font-size: 16px; font-weight: 500; }
.topline .right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.burger { display: none; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); cursor: pointer; align-items: center; justify-content: center; }
.burger svg { width: 18px; height: 18px; stroke: var(--ink); stroke-width: 1.7; stroke-linecap: round; }
.range { display: inline-flex; align-items: center; gap: 9px; height: 38px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 10px; font-size: 14px; color: var(--muted); }
.page { padding: var(--s4) var(--s4) var(--s7); max-width: 1180px; }
.scrim { position: fixed; inset: 0; background: rgba(17,17,17,.32); z-index: 35; opacity: 0;
  pointer-events: none; transition: opacity .3s var(--ease); }

/* ── the tab bar ──────────────────────────────────────────────────────────
   On a phone the app's four destinations sit under the thumb, always. A
   drawer is one tap too many for a product whose whole promise is that you
   open it, see that nothing needs you, and close it again. The website keeps
   its drawer; only the signed-in app gets tabs. */
.tabbar { display: none; }

@media (max-width: 940px) {
  .rail { transform: translateX(-100%); transition: transform .32s var(--ease); box-shadow: var(--shadow-lift); }
  body.menu .rail { transform: none; }
  body.menu .scrim { opacity: 1; pointer-events: auto; }
  body.railed { padding-left: 0; }
  .burger { display: inline-flex; }
  .topline { padding: 12px var(--s3); }
  .page { padding: var(--s3) var(--s3) var(--s7); }

  body.blueprint { background-size: 64px 64px, 64px 64px, 160px 160px; }
  :root { --grid: rgba(20, 20, 20, .016); }

  body.tabbed .rail, body.tabbed .scrim, body.tabbed .burger { display: none; }
  body.tabbed main { padding-bottom: 88px; }
  body.tabbed .wrap { padding-bottom: var(--s5); }
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
    background: rgba(250, 248, 245, .93); backdrop-filter: saturate(180%) blur(16px);
    border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar a {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px;
    padding: 11px 0 9px; text-decoration: none; color: var(--muted);
    font: 500 10.5px var(--sans);
    transition: color var(--t-tap) var(--out);
  }
  .tabbar a svg { width: 22px; height: 22px; stroke: currentColor; fill: none;
    stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
  .tabbar a.on { color: var(--gold); }
  .tabbar a:active { opacity: .55; }
}

/* A white panel on the warm ground. Use it to alternate sections so a long
   page breathes instead of running as one unbroken sheet. */
.panel-white {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: var(--s6); margin: var(--s5) 0;
}
@media (max-width: 620px) { .panel-white { padding: var(--s4) var(--s3); border-radius: var(--r-sm); } }

/* ── buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  height: 48px; padding: 0 var(--s3); border-radius: 999px;
  font: 500 15px var(--sans); text-decoration: none; cursor: pointer;
  background: var(--ink); color: #fff; border: 1px solid var(--ink);
  transition: transform var(--t-tap) var(--out), opacity var(--t-tap) var(--out);
}
.btn:hover { opacity: .86; }
.btn:active { transform: scale(.98); }
/* A working button keeps its label and its width; a spinner joins it. */
.btn.busy { pointer-events: none; }
.btn.busy::before {
  content: ""; width: 14px; height: 14px; flex: none; border-radius: 50%;
  border: 1.6px solid currentColor; border-top-color: transparent;
  animation: spin .7s linear infinite; opacity: .8;
}
@keyframes spin { to { transform: rotate(360deg); } }
.btn .done { display: none; }
.btn.done::before { content: "✓"; border: none; width: auto; height: auto; animation: none; font-size: 14px; }
.btn.ghost { background: var(--card); color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: #D8D8D8; opacity: 1; }
.btn.sm { height: 38px; padding: 0 var(--s2); font-size: 14px; }
.btn:disabled { opacity: .45; cursor: default; }

/* ── cards ──────────────────────────────────────────────────────────────── */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow); overflow: hidden;
}
.card.pad { padding: var(--s4); }
.card.tap { cursor: pointer; transition: transform var(--t-tap) var(--out), box-shadow var(--t-tap) var(--out); }
.card.tap:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.card.tap:active { transform: translateY(-1px); }
/* the image inside a card breathes a single percent on hover */
.card.tap img.shot { transition: transform var(--t-slow) var(--out); }
.card.tap:hover img.shot { transform: scale(1.01); }

/* ── status ─────────────────────────────────────────────────────────────── */
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  font: 500 12px var(--sans); letter-spacing: .08em; text-transform: uppercase;
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--muted);
}
.chip.live { color: var(--gold); border-color: rgba(198, 156, 77, .35); background: var(--gold-wash); }
.chip.ok { color: var(--ok); border-color: rgba(47, 143, 104, .28); }
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.live .dot { animation: breathe 2.6s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .3; } }

/* the timeline — outcomes, not features */
.timeline { display: grid; gap: 2px; }
.tl { display: flex; align-items: baseline; gap: var(--s2); padding: 14px 0; border-bottom: 1px solid var(--line-soft); }
.tl:last-child { border-bottom: none; }
.tl .tick { color: var(--ok); font-size: 14px; flex: none; width: 16px; }
.tl .tick.pending { color: #C9C9C9; }
.tl .what { flex: 1; font-size: 16px; }
.tl .when { font: 400 13px var(--sans); color: var(--muted); flex: none; }

/* figures — big, quiet numbers */
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--s2); }
.fig { padding: var(--s3); border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--card); }
.fig b { display: block; font-size: 30px; font-weight: 600; letter-spacing: -.03em; line-height: 1.1; }
.fig span { display: block; margin-top: 6px; font: 500 12px var(--sans); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }

/* forms */
label.field { display: block; font: 500 13px var(--sans); color: var(--ink); margin: var(--s3) 0 8px; }
label.field em { font-style: normal; color: var(--muted); font-weight: 400; }
input, textarea, select {
  width: 100%; font: 400 16px var(--sans); color: var(--ink);
  padding: 14px 16px; border-radius: var(--r-xs); border: 1px solid var(--line); background: var(--card);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
input:focus, textarea:focus { outline: none; border-color: #CFCFCF; box-shadow: 0 0 0 4px rgba(17,17,17,.04); }
textarea { min-height: 96px; resize: vertical; font: 400 14px/1.7 var(--mono); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); }
@media (max-width: 560px) { .two { grid-template-columns: 1fr; } }

/* ── motion ──────────────────────────────────────────────────────────────
   Everything that arrives does the same thing: fades and rises 8px, ease-out.
   Nothing bounces, nothing overshoots, nothing announces itself. */
.rise { animation: rise var(--t-page) var(--out) both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.fade { animation: fade var(--t-page) var(--out) both; }
@keyframes fade { from { opacity: 0; } }
.stagger > * { animation: rise var(--t-page) var(--out) both; }
.stagger > *:nth-child(2) { animation-delay: 40ms; }
.stagger > *:nth-child(3) { animation-delay: 80ms; }
.stagger > *:nth-child(4) { animation-delay: 120ms; }
.stagger > *:nth-child(5) { animation-delay: 160ms; }
.stagger > *:nth-child(6) { animation-delay: 200ms; }
.stagger > *:nth-child(7) { animation-delay: 240ms; }
.stagger > *:nth-child(8) { animation-delay: 280ms; }

/* An image never pops in. It fades and settles from 102% to 100%. */
img.lift { opacity: 0; transform: scale(1.02); transition: opacity var(--t-slow) var(--out), transform var(--t-slow) var(--out); }
img.lift.in { opacity: 1; transform: none; }

/* Skeletons, never spinners: the shape of the answer while it loads. */
.skel { background: linear-gradient(90deg, var(--line-soft) 25%, #EFEBE4 37%, var(--line-soft) 63%);
  background-size: 400% 100%; animation: shimmer 1.4s ease-in-out infinite; border-radius: 8px; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
.skel.line { height: 13px; margin: 10px 0; }
.skel.line.w70 { width: 70%; } .skel.line.w45 { width: 45%; } .skel.line.w30 { width: 30%; }
.skel.shot { aspect-ratio: 4/3; border-radius: 0; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
  img.lift { opacity: 1; transform: none; }
}

footer.site { margin-top: var(--s7); padding-top: var(--s4); border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
footer.site a { color: var(--ink); text-decoration: none; font-weight: 500; }
