/* Layout: an instrument-panel bento. Left rail (practices + agent), right deck
   (hero orrery, readouts, work), then the launch sequence and a call to action. */
:root {
  --ink: #0b0d12;        /* page ground, graphite with a blue bias */
  --panel: #12151c;      /* card */
  --panel-2: #191d27;    /* raised tile inside a card */
  --line: #252a36;       /* hairlines */
  --fg: #ece9e3;         /* primary text */
  --muted: #8b909d;      /* secondary text */
  --brass: #d6a457;      /* the one accent: orrery brass */
  --brass-ink: #1b1306;  /* text on brass */
  --glow: rgba(214, 164, 87, 0.16);
  --shade: rgba(0, 0, 0, 0.45);

  --display: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --body: "Geist", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "Geist Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --r-card: 22px;
  --r-tile: 14px;
  --gap: 12px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --ink: #e7e9ee; --panel: #f5f6f8; --panel-2: #ffffff; --line: #d6dae2;
    --fg: #11141b; --muted: #5d6371; --brass: #946318; --brass-ink: #fff8ec;
    --glow: rgba(148, 99, 24, 0.12); --shade: rgba(30, 36, 50, 0.14);
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --ink: #e7e9ee; --panel: #f5f6f8; --panel-2: #ffffff; --line: #d6dae2;
  --fg: #11141b; --muted: #5d6371; --brass: #946318; --brass-ink: #fff8ec;
  --glow: rgba(148, 99, 24, 0.12); --shade: rgba(30, 36, 50, 0.14);
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ink);
  color: var(--fg);
  font: 400 15px/1.5 var(--body);
  padding-inline: clamp(16px, 2.5vw, 36px);
  padding-block: 0 24px;
  min-height: 100%;
}
h1, h2, h3 { margin: 0; font-weight: 500; text-wrap: balance; }
p { margin: 0; }
a { color: inherit; }
button { font: inherit; color: inherit; }
svg { display: block; }
.mono { font-family: var(--mono); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.eyebrow { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--brass); }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 3px; border-radius: 6px; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding-block: 18px;
  background: linear-gradient(var(--ink) 70%, transparent);
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark { width: 38px; height: 38px; }
.m-orbit { fill: none; stroke: var(--fg); stroke-width: 2; opacity: 0.85; }
.m-arm { stroke: var(--brass); stroke-width: 2; }
.m-planet { fill: var(--brass); }
.m-moon { fill: var(--fg); }
.m-sun { fill: var(--fg); }
.m-check { fill: none; stroke: var(--brass); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.brand-word { font: italic 400 30px/1 var(--display); letter-spacing: -0.01em; }
.brand-word sup { font: 500 9px/1 var(--mono); letter-spacing: 0.2em; font-style: normal; margin-left: 4px; vertical-align: 14px; color: var(--muted); }

.top-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; flex: none;
  border-radius: 12px; border: 1px solid var(--line); background: var(--panel);
  cursor: pointer; transition: border-color .2s, background .2s;
}
.icon-btn svg { width: 18px; height: 18px; fill: var(--fg); }
.icon-btn:hover { border-color: var(--muted); }
.sheet-head .icon-btn svg, .nav-arrow svg { fill: none; stroke: var(--fg); stroke-width: 1.8; stroke-linecap: round; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: 44px; padding-inline: 18px; border-radius: 12px; border: 1px solid transparent;
  font-weight: 500; font-size: 14px; cursor: pointer; white-space: nowrap;
  transition: transform .15s, box-shadow .2s, background .2s, border-color .2s;
}
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.btn-brass { background: var(--brass); color: var(--brass-ink); box-shadow: 0 0 0 0 var(--glow); }
.btn-brass:hover { box-shadow: 0 0 0 6px var(--glow); }
.btn-ghost { background: var(--panel); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--muted); }
.btn:active { transform: translateY(1px); }

/* ---------- Deck grid ---------- */
.deck {
  display: grid; gap: var(--gap);
  grid-template-columns: minmax(280px, 340px) minmax(0, 1.15fr) minmax(0, 1fr);
  grid-template-areas:
    "svc   hero   stats"
    "svc   work   work"
    "agent work   work"
    "launch launch cta";
  align-items: stretch;
}
.card {
  position: relative; min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 22px;
  overflow: hidden;
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h2 { font-size: 17px; font-weight: 600; }
.count { font-size: 11px; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; }

/* Services */
.services { grid-area: svc; padding: 18px; display: flex; flex-direction: column; }
.svc-note { margin-top: auto; padding: 16px 4px 2px; display: grid; gap: 4px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); }
.svc-note b { font: 400 22px/1.1 var(--display); color: var(--fg); }
.svc-list { margin-bottom: 16px !important; }
.services .card-head { padding: 4px 4px 0; }
.svc-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.svc {
  border: 1px solid var(--line); border-radius: var(--r-tile);
  background: var(--panel-2);
  transition: border-color .2s;
}
.svc:hover, .svc.open { border-color: color-mix(in srgb, var(--brass) 45%, var(--line)); }
.svc button {
  width: 100%; display: grid; grid-template-columns: 22px 1fr 14px; align-items: center; gap: 12px;
  padding: 15px 14px; background: none; border: 0; text-align: left; cursor: pointer;
  font-size: 14.5px; font-weight: 500; line-height: 1.3;
}
.svc-ico { width: 20px; height: 20px; fill: none; stroke: var(--muted); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; transition: stroke .2s; }
.svc.open .svc-ico, .svc button:hover .svc-ico { stroke: var(--brass); }
.svc-plus { width: 14px; height: 14px; stroke: var(--muted); stroke-width: 1.8; transition: transform .25s; }
.svc.open .svc-plus { transform: rotate(45deg); }
.svc-detail { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .3s ease; }
.svc.open .svc-detail { grid-template-rows: 1fr; }
.svc-detail > p { overflow: hidden; padding: 0 14px 0 48px; color: var(--muted); font-size: 13.5px; }
.svc.open .svc-detail > p { padding-bottom: 15px; }

/* Agent */
.agent {
  grid-area: agent; text-align: left; cursor: pointer; padding: 0; min-height: 200px;
  display: flex; align-items: flex-end;
  transition: border-color .2s;
}
.agent:hover { border-color: color-mix(in srgb, var(--brass) 50%, var(--line)); }
#agent-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.agent-copy { position: relative; display: grid; gap: 4px; padding: 20px 22px; width: 100%;
  background: linear-gradient(transparent, var(--panel) 60%); }
.agent-copy .eyebrow::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--brass); margin-right: 8px; vertical-align: 1px; box-shadow: 0 0 0 4px var(--glow); }
.agent-title { font: 400 26px/1.1 var(--display); }
.agent-sub { color: var(--muted); font-size: 13.5px; }

/* Hero */
.hero {
  grid-area: hero; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  padding: 0; min-height: 340px;
  background:
    radial-gradient(120% 90% at 85% 40%, var(--glow), transparent 60%),
    var(--panel);
}
.hero-copy { position: relative; z-index: 1; display: flex; flex-direction: column; justify-content: center; gap: 14px; padding: 28px 0 28px 28px; }
.hero h1 { font: 400 clamp(34px, 3.4vw, 50px)/1.02 var(--display); letter-spacing: -0.015em; }
.hero h1 em { color: var(--brass); }
.hero-sub { color: var(--muted); font-size: 14.5px; max-width: 38ch; }
.text-link { display: inline-flex; gap: 6px; align-items: center; font-weight: 500; text-decoration: none; font-size: 14px; width: fit-content; border-bottom: 1px solid var(--line); padding-bottom: 2px; }
.text-link:hover { border-color: var(--brass); }
.hero-stage { position: relative; min-height: 260px; }
#orrery { position: absolute; inset: -10% -6% -14% -6%; width: 112%; height: 124%; cursor: grab; touch-action: pan-y; }
#orrery:active { cursor: grabbing; }
.stage-hint { position: absolute; right: 18px; bottom: 14px; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); pointer-events: none; }

/* Stats */
.stats { grid-area: stats; display: grid; grid-template-columns: 1fr 1fr; padding: 0; }
.stat { display: grid; grid-template-columns: 40px 1fr; grid-template-rows: auto auto; column-gap: 14px; align-content: center; padding: 22px; border-color: var(--line); border-style: solid; border-width: 0; }
.stat:nth-child(odd) { border-right-width: 1px; }
.stat:nth-child(-n+2) { border-bottom-width: 1px; }
.stat-ico { grid-row: span 2; width: 40px; height: 40px; border-radius: 11px; border: 1px solid var(--line); background: var(--panel-2); display: grid; place-items: center; }
.stat-ico svg { width: 19px; height: 19px; fill: none; stroke: var(--fg); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.stat-num { font: 500 clamp(24px, 2.1vw, 30px)/1.05 var(--body); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--muted); font-size: 13px; line-height: 1.3; margin-top: 3px; }

/* Work */
.work { grid-area: work; padding: 14px; display: grid; gap: 14px; align-content: start; }
.clients { display: grid; grid-template-columns: 36px minmax(0, 1fr) 36px; align-items: center; gap: 8px; }
.nav-arrow { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel-2); display: grid; place-items: center; cursor: pointer; }
.nav-arrow svg { width: 16px; height: 16px; }
.nav-arrow:hover { border-color: var(--muted); }
.client-rail { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; padding-block: 2px; }
.client-rail::-webkit-scrollbar { display: none; }
.client {
  flex: 0 0 auto; scroll-snap-align: start;
  height: 96px; min-width: 150px; padding-inline: 18px;
  display: grid; place-items: center;
  border-radius: var(--r-tile); border: 1px solid var(--line); background: var(--panel-2);
  color: var(--muted); cursor: pointer;
  transition: color .2s, border-color .2s, background .2s;
}
.client:hover { color: var(--fg); }
.client[aria-selected="true"] { color: var(--fg); border-color: color-mix(in srgb, var(--brass) 60%, var(--line)); background: radial-gradient(90% 120% at 50% 100%, var(--glow), var(--panel-2)); }
.wm { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.wm svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.wm-lumen { font: 600 17px var(--body); letter-spacing: 0.22em; text-transform: uppercase; }
.wm-moonmoth { font: italic 400 27px var(--display); }
.wm-kestrel { font: 500 19px var(--mono); letter-spacing: -0.04em; }
.wm-halo { font: 600 21px var(--body); letter-spacing: -0.04em; }
.wm-vantor { font: 600 15px var(--body); letter-spacing: 0.34em; text-transform: uppercase; }
.wm-pallas { font: 400 24px var(--display); letter-spacing: 0.06em; }

.case { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 14px; }
.case-chart { border: 1px solid var(--line); border-radius: var(--r-tile); background: var(--panel-2); padding: 16px 16px 0; display: grid; align-content: start; min-width: 0; }
.chart-head { display: flex; justify-content: space-between; gap: 12px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; margin-bottom: 8px; }
.chart-title { color: var(--fg); }
.chart-range { color: var(--muted); }
#chart { width: 100%; height: 220px; overflow: visible; }
#chart .grid { stroke: var(--line); stroke-width: 1; }
#chart .tick { fill: var(--muted); font: 10.5px var(--mono); }
#chart .area { fill: url(#chartFill); }
#chart .line { fill: none; stroke: var(--brass); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
#chart .end { fill: var(--brass); stroke: var(--panel-2); stroke-width: 3; }
#chart .end-label { fill: var(--fg); font: 500 12px var(--mono); }
.case-metrics { display: grid; grid-template-columns: 1fr 1fr; margin-inline: -16px; border-top: 1px solid var(--line); margin-top: 10px; }
.metric { padding: 14px 16px 16px; display: grid; gap: 2px; }
.metric + .metric { border-left: 1px solid var(--line); }
.metric b { font: 400 30px/1.05 var(--display); font-variant-numeric: tabular-nums; }
.metric span { color: var(--muted); font-size: 12.5px; }
.case-copy { padding: 10px 10px 10px 6px; display: grid; align-content: start; gap: 12px; min-width: 0; }
.case-copy h3 { font: 400 34px/1.05 var(--display); }
#case-body { display: grid; gap: 10px; color: var(--muted); font-size: 14px; max-width: 60ch; }
.tags { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tags li { font: 11px var(--mono); letter-spacing: .05em; text-transform: uppercase; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.case.swap .case-copy, .case.swap .case-metrics { animation: rise .45s ease both; }
@keyframes rise { from { opacity: .2; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Launch sequence */
.launch { grid-area: launch; }
.sequence { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; position: relative; }
.sequence li { position: relative; padding: 16px; border-radius: var(--r-tile); background: var(--panel-2); border: 1px solid var(--line); display: grid; align-content: start; gap: 6px; }
.sequence .t { font-size: 12px; color: var(--muted); letter-spacing: .04em; }
.sequence h3 { font: 400 23px/1.1 var(--display); }
.sequence p { color: var(--muted); font-size: 13px; }
.sequence .is-tge { border-color: color-mix(in srgb, var(--brass) 60%, var(--line)); background: radial-gradient(120% 90% at 50% 0%, var(--glow), var(--panel-2)); }
.sequence .is-tge .t { color: var(--brass); }

/* CTA */
.cta { grid-area: cta; display: grid; align-content: center; gap: 12px; background: radial-gradient(100% 120% at 100% 0%, var(--glow), transparent 55%), var(--panel); }
.cta h2 { font: 400 clamp(28px, 2.6vw, 38px)/1.05 var(--display); }
.cta p { color: var(--muted); max-width: 46ch; font-size: 14px; }
.cta-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.copy-mail .mono { font-size: 13px; }
.copy-mail.copied { border-color: var(--brass); }

/* Footer */
.foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 24px; padding-block: 22px 4px; color: var(--muted); font-size: 12.5px; }
.foot nav { display: flex; gap: 20px; }
.foot a { text-decoration: none; }
.foot a:hover { color: var(--fg); }

/* ---------- Dialog + chat ---------- */
.sheet {
  width: min(460px, calc(100vw - 32px)); max-height: calc(100dvh - 48px);
  padding: 0; border: 1px solid var(--line); border-radius: var(--r-card);
  background: var(--panel); color: var(--fg); box-shadow: 0 30px 80px var(--shade);
}
.sheet::backdrop { background: rgba(5, 7, 10, 0.6); backdrop-filter: blur(4px); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 18px 14px 22px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { font: 400 28px/1 var(--display); }
.form-body { display: grid; gap: 6px; padding: 18px 22px; }
.form-body > label, legend { font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.form-body > label:first-child { margin-top: 0; }
input, select {
  width: 100%; height: 44px; padding-inline: 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--fg); font: inherit; font-size: 14px;
}
input::placeholder { color: var(--muted); opacity: .7; }
input:focus, select:focus { outline: none; border-color: var(--brass); box-shadow: 0 0 0 3px var(--glow); }
fieldset { border: 0; padding: 0; margin: 4px 0 0; }
legend { padding: 0; margin-bottom: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip span { display: inline-block; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); font-size: 13px; cursor: pointer; color: var(--muted); }
.chip input:checked + span { border-color: var(--brass); color: var(--fg); background: var(--glow); }
.chip input:focus-visible + span { outline: 2px solid var(--brass); outline-offset: 2px; }
.form-error { color: var(--brass); font-size: 13px; margin-top: 8px; }
.sheet-foot { padding: 0 22px 22px; }
.sheet-foot .btn { width: 100%; }
.book-done { display: grid; justify-items: center; text-align: center; gap: 10px; padding: 40px 28px 30px; }
.book-done svg { width: 64px; height: 64px; }
.book-done h2 { font: 400 32px/1 var(--display); }
.book-done p { color: var(--muted); max-width: 32ch; margin-bottom: 8px; }

.chat {
  position: fixed; z-index: 40; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  width: min(400px, calc(100vw - 32px)); height: min(600px, calc(100dvh - 120px));
  display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-card);
  box-shadow: 0 30px 80px var(--shade);
  animation: rise .3s ease both;
}
.chat[hidden] { display: none !important; }
.chat-status { font-size: 11px; color: var(--muted); letter-spacing: .04em; }
.chat-log { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 85%; padding: 10px 14px; border-radius: 16px; font-size: 14px; line-height: 1.45; }
.msg.bot { background: var(--panel-2); border: 1px solid var(--line); border-bottom-left-radius: 5px; }
.msg.me { align-self: flex-end; background: var(--brass); color: var(--brass-ink); border-bottom-right-radius: 5px; }
.msg.typing { color: var(--muted); font-family: var(--mono); letter-spacing: .2em; }
.chat-suggest { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 18px 12px; }
.chat-suggest button { padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); background: none; font-size: 12.5px; color: var(--muted); cursor: pointer; }
.chat-suggest button:hover { color: var(--fg); border-color: var(--brass); }
.chat-input { display: grid; grid-template-columns: 1fr 44px; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.chat-input .btn { padding: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .deck {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas:
      "hero  hero"
      "stats stats"
      "work  work"
      "svc   agent"
      "launch launch"
      "cta   cta";
  }
  .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .stat { border-width: 0 !important; }
  .stat + .stat { border-left-width: 1px !important; }
  .sequence { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .deck { grid-template-columns: minmax(0, 1fr); grid-template-areas: "hero" "stats" "work" "svc" "agent" "launch" "cta"; }
  .hero { grid-template-columns: minmax(0, 1fr); }
  .hero-copy { padding: 26px 22px 0; }
  .hero-stage { min-height: 300px; order: -1; }
  #orrery { inset: -6% -10% -10%; width: 120%; height: 116%; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat { border-width: 0 !important; padding: 18px; }
  .stat:nth-child(odd) { border-right-width: 1px !important; }
  .stat:nth-child(-n+2) { border-bottom-width: 1px !important; }
  .stat + .stat { border-left-width: 0 !important; }
  .case { grid-template-columns: minmax(0, 1fr); }
  .case-copy { padding: 4px; }
  .sequence { grid-template-columns: minmax(0, 1fr); }
  .sequence li { grid-template-columns: 56px minmax(0, 1fr); column-gap: 12px; }
  .sequence .t { grid-row: span 2; padding-top: 5px; }
}
@media (max-width: 480px) {
  .brand-word { font-size: 25px; }
  .brand-mark { width: 32px; height: 32px; }
  .top-actions .icon-btn { display: none; }
  .stat { grid-template-columns: minmax(0, 1fr); }
  .stat-ico { display: none; }
  .client { min-width: 128px; height: 80px; }
  .metric b { font-size: 26px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
