/* Cain Connect site. One stylesheet, no build step, system fonts only. */

:root {
  --ink: #101b33;
  --ink-2: #1b2a4a;
  --paper: #f7f4ee;
  --paper-2: #efeadf;
  --white: #ffffff;
  --text: #1d2433;
  --muted: #5a6274;
  --line: #ddd6c8;
  --amber: #f59f00;
  --amber-dark: #b86e00;
  --wire: rgba(245, 159, 0, 0.75);
  --radius: 10px;
  --serif: Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

/* The hidden attribute always wins, even over a class that sets display. */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; scroll-padding-top: 76px; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--paper);
}

h1, h2, h3 { font-family: var(--serif); line-height: 1.15; margin: 0; color: var(--ink); text-wrap: balance; }
h1 { font-size: clamp(2.1rem, 4.6vw, 3.4rem); letter-spacing: -0.01em; }
h2 { font-size: clamp(1.6rem, 3vw, 2.3rem); margin-bottom: 1rem; }
h3 { font-size: 1.2rem; margin-bottom: 0.5rem; }
p { margin: 0 0 1rem; }
a { color: inherit; }
ul, ol { margin: 0; padding: 0; }

.wrap { width: min(1120px, 100% - 2.5rem); margin-inline: auto; }
.narrow { width: min(720px, 100% - 2.5rem); }

.skip { position: absolute; left: -9999px; top: 0; background: var(--amber); color: var(--ink); padding: 0.5rem 1rem; z-index: 20; }
.skip:focus { left: 0; }

:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }

/* Header */
.top { position: sticky; top: 0; z-index: 10; background: var(--ink); color: var(--paper); border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.top-row { display: flex; align-items: center; gap: 1.5rem; min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 0.6rem; font-family: var(--serif); font-size: 1.25rem; font-weight: 700; text-decoration: none; color: var(--white); }
.mark { width: 30px; height: 30px; color: var(--white); }
.nav { margin-left: auto; display: flex; gap: 1.5rem; font-size: 0.95rem; }
.nav a { text-decoration: none; color: rgba(255, 255, 255, 0.82); }
.nav a:hover { color: var(--white); text-decoration: underline; text-underline-offset: 4px; }

/* Buttons */
.btn {
  display: inline-block;
  background: var(--amber);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  padding: 0.8rem 1.3rem;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}
.btn:hover { background: #ffb21f; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.btn-small { padding: 0.5rem 0.95rem; font-size: 0.95rem; }
.link-light { color: var(--paper); text-underline-offset: 4px; }

/* Hero */
.hero { background: var(--ink); color: rgba(255, 255, 255, 0.86); padding: clamp(3rem, 7vw, 5.5rem) 0 clamp(3.5rem, 8vw, 6rem); }
.hero h1 { color: var(--white); margin-bottom: 1.25rem; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: clamp(2rem, 5vw, 4rem); align-items: center; }
.eyebrow { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--amber); margin-bottom: 0.9rem; }
.eyebrow.dark { color: var(--amber-dark); }
.lede { font-size: 1.15rem; max-width: 36rem; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1.25rem; margin-top: 1.75rem; }

/* Hero wiring diagram */
.flow { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; column-gap: 56px; font-size: 0.92rem; }
.flow-col { position: relative; display: grid; gap: 10px; list-style: none; }
.flow-col li {
  position: relative;
  padding: 0.5rem 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--white);
  white-space: nowrap;
}
.flow-col li::after { content: ""; position: absolute; top: 50%; width: 28px; height: 2px; background: var(--wire); }
.flow-in li::after { left: 100%; }
.flow-out li::after { right: 100%; }
.flow-col::after { content: ""; position: absolute; top: 20px; bottom: 20px; width: 2px; background: var(--wire); }
.flow-in::after { left: calc(100% + 27px); }
.flow-out::after { right: calc(100% + 27px); }
.flow-hub {
  position: relative;
  display: grid;
  place-content: center;
  text-align: center;
  width: 124px;
  height: 124px;
  border-radius: 50%;
  background: var(--amber);
  color: var(--ink);
  box-shadow: 0 0 0 10px rgba(245, 159, 0, 0.16);
}
.flow-hub::before, .flow-hub::after { content: ""; position: absolute; top: 50%; width: 28px; height: 2px; background: var(--wire); }
.flow-hub::before { right: 100%; }
.flow-hub::after { left: 100%; }
.flow-hub-label { font-family: var(--serif); font-weight: 700; font-size: 1.15rem; line-height: 1.1; }
.flow-hub-sub { font-size: 0.8rem; }

/* Pain band */
.band { background: var(--ink-2); color: rgba(255, 255, 255, 0.9); padding: 2.5rem 0 2.75rem; }
.h-small { font-size: 1.2rem; color: var(--amber); margin-bottom: 1.1rem; }
.pains { list-style: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.5rem; }
.pains li { display: flex; align-items: center; gap: 0.8rem; font-size: 1rem; line-height: 1.35; font-weight: 600; }
.pains svg { flex: none; width: 34px; height: 34px; fill: none; stroke: var(--amber); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* Sections */
.section { padding: clamp(3rem, 7vw, 5rem) 0; }
.tint { background: var(--paper-2); }
.big { font-size: 1.2rem; line-height: 1.55; }
.fine { margin: 1rem 0 0; font-size: 0.85rem; color: var(--muted); }

/* What I build: four tiles, each a small sample screen with a caption */
.show { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.25rem; margin-top: 2rem; }
.tile h3 { margin: 1rem 0 0.25rem; }
.tile > p { margin: 0; color: var(--muted); }
.mock {
  height: 230px;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--ink);
  display: grid;
  align-items: center;
  font-size: 0.82rem;
  line-height: 1.35;
  overflow: hidden;
}
.mock > div { background: var(--white); border-radius: 8px; padding: 12px; color: var(--text); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25); }

.m-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-bottom: 12px; }
.m-stats div { background: var(--paper); border-radius: 6px; padding: 6px 7px; }
.m-stats b { display: block; font-family: var(--serif); font-size: 1.1rem; color: var(--ink); }
.m-stats span { display: block; font-size: 0.68rem; line-height: 1.2; color: var(--muted); }
.m-stats .warn b { color: #b3261e; }
.m-bars { display: block; width: 100%; height: 70px; }
.m-bars rect { fill: #c9d2e3; }
.m-bars .now { fill: var(--amber); }

.m-mail-top { display: flex; justify-content: space-between; font-size: 0.72rem; color: var(--muted); margin-bottom: 4px; }
.m-mail strong { display: block; font-family: var(--serif); font-size: 1.02rem; color: var(--ink); margin-bottom: 6px; }
.m-mail ul { list-style: none; margin-bottom: 9px; }
.m-mail li { display: flex; justify-content: space-between; padding: 3px 0; border-bottom: 1px solid var(--line); }
.m-mail li b { color: var(--ink); }
.m-pdf { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px 3px 3px; border: 1px solid var(--line); border-radius: 6px; font-size: 0.74rem; }
.m-pdf i { font-style: normal; font-weight: 700; font-size: 0.62rem; background: #b3261e; color: var(--white); border-radius: 4px; padding: 2px 4px; }

.mock > .m-chat { background: transparent; box-shadow: none; padding: 0; display: grid; gap: 8px; }
.b { margin: 0; max-width: 88%; padding: 8px 11px; border-radius: 14px; }
.b.in { justify-self: start; background: var(--white); color: var(--text); border-bottom-left-radius: 4px; }
.b.out { justify-self: end; background: var(--amber); color: var(--ink); font-weight: 600; border-bottom-right-radius: 4px; }
.m-note { margin: 0; justify-self: center; font-size: 0.72rem; color: rgba(255, 255, 255, 0.75); }
.m-note::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: #4cc38a; }

/* Chips */
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.chips li { padding: 0.25rem 0.65rem; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); font-size: 0.85rem; color: var(--text); white-space: nowrap; }
.chips.out li { background: var(--ink); border-color: var(--ink); color: var(--white); }
.chips-label { margin: 1.5rem 0 0.6rem; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.cta-row { margin: 1.75rem 0 0; }

/* Examples */
.work { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem; margin-top: 2rem; }
.case { display: flex; flex-direction: column; background: var(--white); border: 1px solid var(--line); border-top: 4px solid var(--amber); border-radius: var(--radius); padding: 1.5rem; }
.case-kind { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--amber-dark); margin-bottom: 0.6rem; }
.case h3 { margin-bottom: 1rem; }
.chain { display: grid; gap: 0.5rem; margin-bottom: 1.25rem; }
.arrow { justify-self: start; margin-left: 1rem; width: 2px; height: 16px; background: var(--amber-dark); position: relative; }
.arrow::after { content: ""; position: absolute; left: -4px; bottom: -1px; width: 10px; height: 10px; border-right: 2px solid var(--amber-dark); border-bottom: 2px solid var(--amber-dark); transform: rotate(45deg); transform-origin: center; }
.case .case-fact { margin: auto 0 0; padding-top: 0.9rem; border-top: 1px solid var(--line); color: var(--ink); font-weight: 700; }

.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(2rem, 5vw, 4rem); align-items: start; }
.ladder { list-style: none; counter-reset: rung; display: grid; gap: 0.75rem; }
.ladder li { counter-increment: rung; position: relative; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.25rem 1rem 3.75rem; }
.ladder li::before {
  content: counter(rung);
  position: absolute; left: 1.1rem; top: 1rem;
  width: 1.8rem; height: 1.8rem; border-radius: 50%;
  display: grid; place-content: center;
  border: 2px solid var(--amber-dark); color: var(--amber-dark); font-weight: 700; font-size: 0.95rem;
}
.ladder li:last-child { border-color: var(--amber); box-shadow: 0 0 0 3px rgba(245, 159, 0, 0.18); }
.ladder strong { display: block; color: var(--ink); }
.ladder span { color: var(--muted); }

.steps { list-style: none; counter-reset: step; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.5rem; margin-top: 2rem; }
.steps li { counter-increment: step; border-top: 2px solid var(--ink); padding-top: 1rem; }
.steps li::before { content: "0" counter(step); display: block; font-family: var(--serif); font-size: 1.6rem; font-weight: 700; color: var(--amber-dark); margin-bottom: 0.4rem; }
.steps p { color: var(--muted); margin: 0; }

/* Contact */
.contact { background: var(--ink); color: rgba(255, 255, 255, 0.86); }
.contact h2 { color: var(--white); }
.contact-grid { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: clamp(2rem, 5vw, 4rem); align-items: start; }
.form { background: var(--white); color: var(--text); border-radius: var(--radius); padding: 1.5rem; display: grid; gap: 1rem; }
.field { display: grid; gap: 0.35rem; }
.field label { font-weight: 700; font-size: 0.95rem; color: var(--ink); }
.field input, .field textarea {
  font: inherit; color: inherit;
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid #b9b2a3;
  border-radius: 8px;
  background: var(--white);
}
.field textarea { resize: vertical; min-height: 7rem; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.turnstile:empty { display: none; }
.form .btn { justify-self: start; }
.fallback p { margin: 0; font-size: 1.1rem; color: var(--ink); }
.status { margin: 0; min-height: 1.5rem; font-size: 0.95rem; color: var(--muted); }
.status.ok { color: #1a6b3c; font-weight: 700; }
.status.err { color: #a12622; font-weight: 700; }

/* Footer */
.foot { background: var(--ink); color: rgba(255, 255, 255, 0.7); border-top: 1px solid rgba(255, 255, 255, 0.1); padding: 1.5rem 0; font-size: 0.9rem; }
.foot-row { display: flex; justify-content: space-between; gap: 1rem; }

/* Plain pages (404) */
.plain { min-height: 60vh; display: grid; place-content: center; text-align: center; padding: 4rem 1.25rem; }
.plain p { color: var(--muted); }

/* Narrower screens */
@media (max-width: 960px) {
  .hero-grid, .split, .contact-grid { grid-template-columns: minmax(0, 1fr); }
  .pains { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .show { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .work { grid-template-columns: minmax(0, 1fr); }
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .flow { max-width: 560px; }
}

@media (max-width: 720px) {
  .nav { display: none; }
  .top-row { justify-content: space-between; }
}

@media (max-width: 560px) {
  body { font-size: 1rem; }
  .pains, .steps, .show { grid-template-columns: minmax(0, 1fr); }
  .pains { gap: 1rem; }
  /* The diagram turns on its side: systems on top, hub in the middle, results underneath. */
  .flow { grid-template-columns: minmax(0, 1fr); row-gap: 28px; justify-items: center; }
  .flow-col { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
  .flow-col li::after, .flow-col::after { display: none; }
  .flow-hub { width: 108px; height: 108px; }
  .flow-hub::before, .flow-hub::after { left: 50%; right: auto; width: 2px; height: 28px; }
  .flow-hub::before { top: auto; bottom: 100%; }
  .flow-hub::after { top: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
