:root {
  --ink: #111418;
  --ink-2: #4a5361;
  --muted: #6b7482;
  --bg: #ffffff;
  --bg-alt: #f5f6f8;
  --graphite: #0e1116;
  --graphite-2: #171b22;
  --graphite-line: #2a303a;
  --on-dark: #e6e9ee;
  --on-dark-2: #a3acb9;
  --accent: #0f6cbd;
  --accent-dark: #0c5a9e;
  --accent-soft: #e8f1fa;
  --ok: #107c41;
  --fail: #c50f1f;
  --line: #e2e5ea;
  --radius: 6px;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { line-height: 1.2; letter-spacing: -0.015em; margin: 0 0 .6em; }
h1 { font-size: clamp(2.1rem, 4.6vw, 3.3rem); font-weight: 700; }
h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); font-weight: 700; }
h3 { font-size: 1.1rem; font-weight: 600; }
h4 { font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-top: 1.4em; }
p { margin: 0 0 1em; color: var(--ink-2); }
a { color: var(--accent); }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.wrap-wide { max-width: 1360px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 640px) { .wrap, .wrap-wide { padding: 0 28px; } }
.narrow { max-width: 760px; }
.center { text-align: center; }

.eyebrow {
  font-family: var(--mono); text-transform: uppercase; letter-spacing: .08em; font-size: .75rem;
  font-weight: 500; color: var(--accent); margin-bottom: .9em;
}
.lead { font-size: 1.12rem; }

/* Buttons */
.btn {
  display: inline-block; background: var(--accent); color: #fff; text-decoration: none;
  padding: .7em 1.25em; border-radius: var(--radius); border: 1px solid var(--accent);
  cursor: pointer; font: inherit; font-weight: 600; font-size: .95rem; transition: background .15s;
}
.btn:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-ghost { background: transparent; color: var(--accent); }
.btn-ghost:hover { background: var(--accent-soft); color: var(--accent-dark); }
.btn-sm { padding: .4em .9em; font-size: .88rem; }

/* Nav */
.nav {
  position: sticky; top: 0; z-index: 10; background: rgba(255,255,255,.94);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 60px; }
.logo { font-weight: 700; font-size: 1.2rem; color: var(--ink); text-decoration: none; letter-spacing: -0.02em; }
.logo span { font-family: var(--mono); font-weight: 600; color: var(--accent); margin-left: 1px; }
.nav-links { display: flex; gap: 22px; align-items: center; }
.nav-links a:not(.btn) { color: var(--ink-2); text-decoration: none; font-size: .92rem; font-weight: 500; }
.nav-links a:not(.btn):hover { color: var(--ink); }
@media (max-width: 800px) { .nav-links a:not(.btn) { display: none; } }

/* Hero: graphite with a faint lattice grid */
.hero {
  position: relative; background-color: var(--graphite); color: var(--on-dark); padding: 88px 0 96px;
  background-image:
    linear-gradient(var(--graphite-2) 1px, transparent 1px),
    linear-gradient(90deg, var(--graphite-2) 1px, transparent 1px);
  background-size: 48px 48px;
}
.hero h1 { max-width: 860px; color: #fff; }
.hero .lead { color: var(--on-dark-2); max-width: 700px; }
.hero .eyebrow { color: #6cb4f5; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin: 28px 0 36px; }
.hero .btn-ghost { color: #fff; border-color: var(--graphite-line); }
.hero .btn-ghost:hover { background: var(--graphite-2); }
.hero-sm { padding: 52px 0 64px; }
.triplet-hero {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-family: var(--mono); font-size: .95rem;
}
.triplet-hero .t-node { border: 1px solid #3b82c4; color: #fff; padding: .45em .8em; border-radius: 4px; background: rgba(15,108,189,.12); }
.triplet-hero .t-edge { color: #6cb4f5; }
.triplet-hero .t-arrow { color: var(--on-dark-2); }

/* Sections */
.section { padding: 84px 0; }
.alt { background: var(--bg-alt); }
.grid-2, .grid-3, .grid-4 { display: grid; gap: 16px; margin-top: 32px; }
@media (min-width: 720px) { .grid-2, .grid-4 { grid-template-columns: 1fr 1fr; } }
@media (min-width: 900px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1000px) { .grid-4 { grid-template-columns: repeat(4, 1fr); } }

.card, .service, .offer {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 24px;
}
.card h3 { font-size: 1.02rem; }
.card p, .service p { margin: 0; }
.service .num, .card .num { font-family: var(--mono); color: var(--accent); font-size: .8rem; margin-bottom: 10px; }
.service h3 a { color: var(--ink); text-decoration: none; }
.service h3 a:hover { color: var(--accent); }

.offer { display: flex; flex-direction: column; position: relative; }
.offer ul { padding-left: 1.1em; margin: 0 0 24px; color: var(--ink-2); flex: 1; }
.offer li { margin-bottom: .4em; }
.offer .btn { align-self: flex-start; }
.offer .dur { font-family: var(--mono); font-size: .82rem; color: var(--muted); }
.offer.featured { border-color: var(--accent); box-shadow: inset 0 3px 0 var(--accent); }

/* Principles */
.principles { list-style: none; padding: 0; margin: 32px 0 0; display: grid; gap: 0; border-top: 1px solid var(--line); }
@media (min-width: 800px) { .principles { grid-template-columns: 1fr 1fr; column-gap: 48px; } }
.principles li { padding: 18px 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 44px 1fr; }
.principles .num { font-family: var(--mono); color: var(--accent); font-size: .8rem; padding-top: 3px; }
.principles strong { display: block; }
.principles span { color: var(--ink-2); font-size: .95rem; }

/* Architecture diagram */
.arch { display: grid; gap: 12px; margin-top: 32px; font-size: .92rem; }
.arch-row { display: grid; gap: 12px; }
@media (min-width: 800px) {
  .arch-2 { grid-template-columns: repeat(2, 1fr); }
  .arch-3 { grid-template-columns: repeat(3, 1fr); }
  .arch-4 { grid-template-columns: repeat(4, 1fr); }
}
.demo-note { margin-top: 16px; font-size: .85rem; }
.arch-box { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; background: #fff; }
.arch-box strong { display: block; font-size: .95rem; }
.arch-box span { color: var(--ink-2); font-size: .86rem; }
.arch-box .tag-mono { font-family: var(--mono); font-size: .72rem; color: var(--accent); text-transform: uppercase; letter-spacing: .06em; }
.arch-box.gate { border-color: var(--accent); background: var(--accent-soft); }
.arch-flow { font-family: var(--mono); font-size: .75rem; color: var(--muted); text-align: center; }

/* Personas */
.persona-grid .card h3 { font-family: var(--mono); font-size: .9rem; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); }

/* Lattice */
.lattice-frame { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.lattice-scroll { overflow-x: auto; }
.lattice-svg { display: block; width: 100%; min-width: 900px; height: auto; font-family: var(--mono); }
.lattice-svg .node rect { fill: #fff; stroke: #c3cad4; stroke-width: 1.2; }
.lattice-svg .node .node-label { font-size: 13px; font-weight: 600; fill: var(--ink); }
.lattice-svg .node .node-type { font-size: 9px; letter-spacing: .08em; fill: var(--muted); }
.lattice-svg .node { cursor: pointer; transition: opacity .2s; }
.lattice-svg .node:hover rect, .lattice-svg .node:focus-visible rect { stroke: var(--accent); }
.lattice-svg .node.selected rect { stroke: var(--accent); stroke-width: 2.2; fill: var(--accent-soft); }
.lattice-svg .node:focus { outline: none; }
.lattice-svg .edge line { stroke: #8a94a3; stroke-width: 1.3; }
.lattice-svg .edge line.hit { stroke: transparent; stroke-width: 14; }
.lattice-svg .edge text { font-size: 10px; fill: var(--ink-2); letter-spacing: .04em; }
.lattice-svg .edge { cursor: pointer; transition: opacity .2s; }
.lattice-svg .edge:focus { outline: none; }
.lattice-svg .edge:hover line:not(.hit), .lattice-svg .edge:focus-visible line:not(.hit), .lattice-svg .edge.selected line:not(.hit) { stroke: var(--accent); stroke-width: 2; }
.lattice-svg .edge.selected text { fill: var(--accent); font-weight: 600; }
.lattice-svg .arrowhead { fill: #8a94a3; }
.lattice-svg .hidden { display: none; }
.lattice-svg .out-of-scope { opacity: .22; }
.lattice-svg .node.out-of-scope rect { stroke-dasharray: 4 3; }

.lattice-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 16px 0; }
.lattice-controls .step { font-family: var(--mono); font-size: .8rem; color: var(--muted); margin-left: auto; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; flex-wrap: wrap; }
.seg button {
  font: inherit; font-size: .85rem; border: 0; background: #fff; padding: .45em .9em; cursor: pointer; color: var(--ink-2);
  border-right: 1px solid var(--line);
}
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }

.panel { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; background: #fff; }
.panel h3 { font-size: 1rem; }
.panel p { font-size: .92rem; }
.insp-kind { font-family: var(--mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); margin-bottom: .5em; }
.insp-sub { font-size: .8rem !important; color: var(--muted); margin-bottom: .4em; }
.triplet { font-size: .88rem; line-height: 1.5; }
.prov { margin: 0; display: grid; gap: 6px; font-size: .82rem; }
.prov div { display: grid; grid-template-columns: 96px 1fr; gap: 8px; }
.prov dt { color: var(--muted); }
.prov dd { margin: 0; font-family: var(--mono); font-size: .78rem; word-break: break-word; }
.cites { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.cite {
  font-family: var(--mono); font-size: .74rem; border: 1px solid var(--line); background: var(--bg-alt);
  border-radius: 4px; padding: .3em .55em; cursor: pointer; color: var(--ink);
}
.cite span { color: var(--muted); }
.cite:hover { border-color: var(--accent); }
.prov-details { font-size: .85rem; }
.prov-details summary { cursor: pointer; color: var(--ink-2); margin-bottom: 8px; }

.status {
  display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; font-family: var(--mono); font-size: .78rem;
  padding: 10px 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--bg-alt); color: var(--ink-2);
}
.status strong { color: var(--ink); }
.status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.status-fail { display: block; border-color: var(--fail); background: #fdf3f4; color: var(--fail); }
.status-fail ul { margin: 8px 0 0; padding-left: 1.2em; }

.lattice-demo { display: grid; gap: 16px; }
@media (min-width: 1240px) { .lattice-demo .demo-grid { display: grid; grid-template-columns: 1fr 320px; gap: 16px; align-items: start; } }
.demo-grid .side { display: grid; gap: 16px; margin-top: 16px; }
@media (min-width: 720px) and (max-width: 1239px) { .demo-grid .side { grid-template-columns: 1fr 1fr; align-items: start; } }
@media (min-width: 1240px) { .demo-grid .side { margin-top: 0; } }

/* About & track record */
.about { display: grid; gap: 40px; }
@media (min-width: 900px) { .about { grid-template-columns: 1.4fr 1fr; align-items: start; } }
.facts { list-style: none; padding: 0; margin: 0; display: grid; gap: 0; border-top: 1px solid var(--line); }
.facts li { border-bottom: 1px solid var(--line); padding: 12px 0; }
.facts strong { display: block; }
.facts span { color: var(--ink-2); font-size: .9rem; }
.stats { list-style: none; padding: 0; margin: 32px 0 0; display: grid; gap: 24px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.stats strong { display: block; font-family: var(--mono); font-size: 1.9rem; font-weight: 600; color: var(--ink); letter-spacing: -0.02em; }
.stats span { color: var(--ink-2); font-size: .9rem; }

/* FAQ */
details { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 8px; }
summary { font-weight: 600; cursor: pointer; }
details p { margin: 12px 0 0; }

/* Contact */
.contact { background: var(--graphite); color: var(--on-dark); }
.contact h2 { color: #fff; }
.contact .lead { color: var(--on-dark-2); }
.contact-form { text-align: left; display: grid; gap: 14px; margin-top: 28px; }
.contact-form .row { display: grid; gap: 14px; }
@media (min-width: 640px) { .contact-form .row { grid-template-columns: 1fr 1fr; } }
.contact-form label { display: grid; gap: 6px; font-size: .88rem; font-weight: 500; color: var(--on-dark-2); }
.contact-form input, .contact-form select, .contact-form textarea {
  font: inherit; padding: 11px 13px; border-radius: var(--radius); border: 1px solid var(--graphite-line);
  background: var(--graphite-2); color: #fff; width: 100%;
}
.contact-form select option { color: var(--ink); background: #fff; }
.contact-form input:focus, .contact-form select:focus, .contact-form textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }
.contact-form .btn { justify-self: start; }
.contact .direct { font-family: var(--mono); font-size: .85rem; color: var(--on-dark-2); margin-top: 18px; }
.contact .direct a { color: #6cb4f5; }

/* Footer */
.footer { background: #080a0d; color: #7d8794; font-size: .8rem; padding: 24px 0; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; }
.footer a { color: #a3acb9; }

/* Landing pages */
.crumbs { font-family: var(--mono); font-size: .78rem; color: #7d8794; margin-bottom: 28px; }
.crumbs a { color: var(--on-dark-2); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.meta { display: flex; flex-wrap: wrap; gap: 12px 40px; margin: 8px 0 0; padding-top: 22px; border-top: 1px solid var(--graphite-line); }
.meta dt { font-family: var(--mono); font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: #6cb4f5; }
.meta dd { margin: 2px 0 0; font-weight: 600; }
.related { display: grid; gap: 32px; }
@media (min-width: 720px) { .related { grid-template-columns: 1fr 1fr; } }
.links { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.links a { text-decoration: none; font-weight: 500; }
.links a:hover { text-decoration: underline; }
.links.cols { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); margin-top: 24px; }

/* App */
.app-body { background: var(--bg-alt); }
.app-nav .nav-inner { height: auto; min-height: 60px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tabs a { text-decoration: none; color: var(--ink-2); font-size: .9rem; font-weight: 500; padding: .4em .8em; border-radius: var(--radius); }
.tabs a[aria-current="page"] { background: var(--ink); color: #fff; }
.app-controls { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; font-size: .85rem; }
.persona { display: flex; align-items: center; gap: 8px; color: var(--muted); font-family: var(--mono); font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; }
.persona select { font: inherit; font-family: Inter, sans-serif; text-transform: none; letter-spacing: 0; font-size: .88rem; padding: .35em .5em; border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); background: #fff; }
.auth { color: var(--muted); }
.app-main { padding-top: 20px; padding-bottom: 48px; display: grid; gap: 16px; }
.app-grid { display: grid; gap: 16px; }
@media (min-width: 1280px) { .app-grid { grid-template-columns: 1fr 340px; align-items: start; } }
@media (min-width: 720px) and (max-width: 1279px) { .app-grid .side { grid-template-columns: 1fr 1fr; align-items: start; } }
.app-grid .side { display: grid; gap: 16px; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.register { width: 100%; border-collapse: collapse; font-size: .84rem; }
.register th { text-align: left; font-family: var(--mono); font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: var(--bg-alt); }
.register th, .register td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.register td.mono { font-size: .78rem; white-space: nowrap; }
.register tr.row-out td { color: #a0a7b2; }
.code { background: var(--graphite); color: var(--on-dark); font-family: var(--mono); font-size: .78rem; padding: 18px; border-radius: var(--radius); overflow-x: auto; max-height: 70vh; }
.lattice-demo > *, .demo-grid > *, .app-grid > *, .app-main > * { min-width: 0; }

/* fractional CIO homepage */
.grid-2.grid-tight { margin-top: 16px; }
.card-list { margin: 10px 0 0 1.1em; padding: 0; color: var(--ink-2); }
.card-list li { margin-bottom: .35em; }
