/* Black Sheep Network — ink on paper. See docs/DESIGN.md */
/* Self-hosted type (SIL Open Font License; see fonts/LICENSE-*.txt) */
@font-face { font-family: "Archivo"; font-style: normal; font-display: swap; font-weight: 100 900; font-stretch: 62% 125%; src: url(/fonts/archivo-latin-wdth-normal.woff2) format("woff2-variations"); }
@font-face { font-family: "Source Serif 4"; font-style: normal; font-display: swap; font-weight: 200 900; src: url(/fonts/source-serif-4-latin-opsz-normal.woff2) format("woff2-variations"); }

:root {
  color-scheme: light;
  --paper: #F6F5F1;
  --paper-2: #EBE9E3;
  --line: #D3D0C8;
  --ink: #111111;
  --ink-2: #55524C;
  --ink-3: #6B675F;
  --signal: #B3261E;

  --display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --text: "Source Serif 4", "Iowan Old Style", "Palatino Linotype", Georgia, serif;

  --gutter: clamp(20px, 5vw, 64px);
  --max: 80rem;
  --measure: 36em;
  --space: clamp(56px, 8vw, 120px);
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--paper); -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--text);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
}
@media (min-width: 720px) { body { font-size: 1.125rem; } }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: var(--gutter); top: -100px; background: var(--ink); color: var(--paper); padding: 10px 14px; font-family: var(--display); z-index: 100; }
.skip:focus { top: 12px; }

.wrap { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }

/* Type roles */
.display {
  font-family: var(--display);
  font-variation-settings: "wdth" 72;
  font-weight: 800;
  text-transform: uppercase;
  line-height: 0.9;
  letter-spacing: -0.005em;
  text-wrap: balance;
  margin: 0;
}
.statement { font-size: clamp(3.5rem, 13.5vw, 10rem); }
.title { font-size: clamp(2.5rem, 6vw, 5rem); }
.h2 { font-size: clamp(2rem, 4.2vw, 3.25rem); }
.h3 { font-family: var(--display); font-variation-settings: "wdth" 88; font-weight: 700; font-size: clamp(1.375rem, 2vw, 1.75rem); line-height: 1.15; margin: 0; text-wrap: balance; }
.deck { font-size: clamp(1.25rem, 2.2vw, 1.625rem); line-height: 1.45; max-width: 30em; margin: 0; }
.ui { font-family: var(--display); font-variation-settings: "wdth" 100; font-weight: 500; }
.small { font-size: 0.9375rem; }
.muted { color: var(--ink-2); }
.measure { max-width: var(--measure); }
.measure p { margin: 0 0 1.1em; }
.measure p:last-child { margin-bottom: 0; }
.sub { margin: 18px 0 0; max-width: 22em; }
.eyebrow { font-family: var(--display); font-weight: 500; font-size: 0.9375rem; color: var(--ink-2); margin: 18px 0 0; }
.band .eyebrow { color: #B9B5AD; }
.h2-gap { margin-bottom: 32px; }
.two-gap { margin-bottom: 40px; }
.deck-sm { font-size: 1.125rem; }
[id] { scroll-margin-top: 96px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding-inline: 26px;
  font-family: var(--display); font-weight: 600; font-size: 1rem; letter-spacing: 0.01em;
  text-decoration: none; cursor: pointer; border-radius: 0;
  border: 1.5px solid var(--ink); background: var(--ink); color: var(--paper);
  transition: background-color .15s, color .15s;
}
.btn:hover { background: var(--paper); color: var(--ink); }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { background: var(--ink); color: var(--paper); }
.band .btn { border-color: var(--paper); background: var(--paper); color: var(--ink); }
.band .btn:hover { background: transparent; color: var(--paper); }
.band .btn.ghost { background: transparent; color: var(--paper); }
.band .btn.ghost:hover { background: var(--paper); color: var(--ink); }

/* Nav */
.nav { border-bottom: 1px solid var(--line); background: var(--paper); position: sticky; top: 0; z-index: 20; }
.nav .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 72px; }
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; }
.brand img { width: 40px; height: 40px; }
.brand span { font-family: var(--display); font-variation-settings: "wdth" 80; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; font-size: 1rem; line-height: 1; }
.nav ul { display: flex; align-items: center; gap: clamp(18px, 2.6vw, 36px); list-style: none; margin: 0; padding: 0; }
.nav li a { font-family: var(--display); font-weight: 500; font-size: 0.9375rem; text-decoration: none; padding-block: 6px; border-bottom: 1.5px solid transparent; }
.nav li a:hover { border-bottom-color: var(--ink); }
.nav li a[aria-current="page"] { border-bottom-color: var(--ink); }
.nav .btn { min-height: 40px; padding-inline: 18px; font-size: 0.9375rem; }
.nav-toggle { display: none; min-height: 44px; min-width: 44px; background: none; border: 1.5px solid var(--ink); font-family: var(--display); font-weight: 600; font-size: 0.9375rem; padding-inline: 14px; cursor: pointer; }
@media (max-width: 760px) {
  .nav-toggle { display: inline-flex; align-items: center; }
  .nav nav { display: none; position: absolute; left: 0; right: 0; top: 100%; background: var(--paper); border-bottom: 1px solid var(--line); }
  .nav nav.open { display: block; }
  .nav ul { flex-direction: column; align-items: stretch; gap: 0; padding-block: 8px; }
  .nav li a { display: block; padding: 14px var(--gutter); border: 0; font-size: 1.0625rem; }
  .nav li a[aria-current="page"] { background: var(--paper-2); }
  .nav li.cta { padding: 12px var(--gutter) 16px; }
  .nav li.cta .btn { width: 100%; }
}

/* Sections */
.section { padding-block: var(--space); }
.section + .section, .section + .band, .band + .section { border-top: 1px solid var(--line); }
.band { background: var(--ink); color: var(--paper); padding-block: var(--space); }
.band + .section { border-top: 0; }
.band .muted { color: #B9B5AD; }
.band :focus-visible { outline-color: var(--paper); }
.band a:hover { text-decoration-thickness: 2px; }

.two { display: grid; gap: clamp(28px, 4vw, 64px); align-items: start; }
@media (min-width: 900px) { .two { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); } }
.two > * { min-width: 0; }
.stack { display: grid; gap: 20px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }

/* Hero */
.hero { padding-block: clamp(48px, 9vw, 128px) clamp(40px, 7vw, 96px); }
.hero .statement { display: block; }
.hero .line { display: block; overflow: hidden; }
.hero .line > span { display: inline-block; transform: translateY(0); }
.hero .deck { margin-top: clamp(28px, 4vw, 48px); }
@media (prefers-reduced-motion: no-preference) {
  .reveal .line > span { animation: rise .62s cubic-bezier(.2,.7,.2,1) both; }
  .reveal .line:nth-child(2) > span { animation-delay: .08s; }
  .reveal .line:nth-child(3) > span { animation-delay: .16s; }
  .reveal .hero .deck, .reveal .hero .actions { animation: fade .6s ease .35s both; }
  @keyframes rise { from { transform: translateY(105%); } to { transform: translateY(0); } }
  @keyframes fade { from { opacity: 0; } to { opacity: 1; } }
}

/* Run-in definition list (what BSN does) */
.defs { display: grid; gap: 0; margin: 0; border-top: 1px solid var(--line); }
.defs > div { display: grid; gap: 6px 32px; padding-block: 22px; border-bottom: 1px solid var(--line); }
@media (min-width: 640px) { .defs > div { grid-template-columns: 11rem minmax(0, 1fr); } }
.defs dt { font-family: var(--display); font-variation-settings: "wdth" 88; font-weight: 700; font-size: 1.125rem; line-height: 1.3; }
.defs dd { margin: 0; color: var(--ink-2); }

/* Ledger (portfolio) */
.ledger { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.ledger li { display: grid; gap: 10px 32px; padding-block: 28px; border-bottom: 1px solid var(--line); min-width: 0; }
@media (min-width: 780px) { .ledger li { grid-template-columns: 11rem minmax(0, 1fr) auto; align-items: baseline; } }
.ledger .tag { font-family: var(--display); font-weight: 500; font-size: 0.875rem; color: var(--ink-2); line-height: 1.4; }
.ledger .tag b { display: block; font-weight: 600; color: var(--ink); }
.ledger .name { font-family: var(--display); font-variation-settings: "wdth" 84; font-weight: 700; font-size: clamp(1.5rem, 2.6vw, 2rem); line-height: 1.1; margin: 0 0 8px; }
.ledger .name a { text-decoration: underline; text-decoration-color: var(--line); text-decoration-thickness: 2px; text-underline-offset: 0.12em; }
.ledger .name a:hover { text-decoration-color: currentColor; }
.ledger .years { display: block; margin-top: 4px; color: var(--ink-3); font-weight: 500; }
.ledger p { margin: 0; color: var(--ink-2); max-width: 36em; }
.ledger .note { margin-top: 8px; font-size: 0.9375rem; color: var(--ink-3); font-family: var(--display); }
.ledger .go { font-family: var(--display); font-weight: 600; font-size: 0.9375rem; white-space: nowrap; }
.band .ledger, .band .ledger li { border-color: #3A3833; }
.band .ledger .tag, .band .ledger p { color: #B9B5AD; }
.band .ledger .tag b { color: var(--paper); }
.band .ledger .note { color: #9A968E; }

/* Principles */
.principles { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; border-top: 1px solid var(--line); }
.principles li { display: grid; gap: 10px 32px; padding-block: 26px; border-bottom: 1px solid var(--line); }
@media (min-width: 780px) { .principles li { grid-template-columns: 16rem minmax(0, 1fr); } }
.principles .h3 { font-size: 1.25rem; }
.principles p { margin: 0; color: var(--ink-2); max-width: 36em; }
.band .principles, .band .principles li { border-color: #3A3833; }
.band .principles p { color: #B9B5AD; }

/* Plain bullet lists in copy */
.list { margin: 0; padding-left: 1.2em; color: var(--ink-2); display: grid; gap: 8px; max-width: 34em; }
.band .list { color: #B9B5AD; }

/* Founder */
.founder { display: grid; gap: 28px; align-items: start; }
.founder .measure > .h2-gap { margin-bottom: 24px; }
@media (min-width: 900px) { .founder { grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); } }
.mark-large { width: min(100%, 420px); margin: 0; }
.mark-large img { width: 100%; }
.founder-head { display: flex; align-items: center; gap: clamp(16px, 3vw, 36px); margin-bottom: 8px; }
.portrait { flex: 0 0 auto; width: clamp(88px, 14vw, 176px); aspect-ratio: 1; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 5px var(--paper), 0 0 0 6.5px var(--ink); margin: 6px; }
.founder-head > div { min-width: 0; }
.founder-role { margin-top: 10px; }
.mark-large figcaption { font-family: var(--display); font-size: 0.875rem; color: var(--ink-3); margin-top: 12px; }

/* Notes (status callouts, kept plain) */
.note-block { border-left: 2px solid var(--ink); padding-left: 18px; color: var(--ink-2); font-size: 1rem; max-width: 36em; }
.band .note-block { border-color: var(--paper); color: #B9B5AD; }

/* Form */
form { display: grid; gap: 22px; min-width: 0; }
.row { display: grid; gap: 22px; }
@media (min-width: 640px) { .row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.field { display: grid; gap: 8px; min-width: 0; }
.field label { font-family: var(--display); font-weight: 500; font-size: 0.9375rem; }
.field .hint { font-family: var(--display); font-size: 0.875rem; color: var(--ink-3); }
.field input, .field select, .field textarea {
  width: 100%; min-height: 52px; padding: 12px 14px;
  background: #FFFFFF; color: var(--ink);
  border: 1.5px solid var(--ink-3); border-radius: 0;
  font-family: var(--display); font-size: 1rem; line-height: 1.4;
}
.field textarea { min-height: 170px; resize: vertical; }
.field select { appearance: none; -webkit-appearance: none; padding-right: 44px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23111111' stroke-width='1.6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 16px center; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--ink); outline: 2px solid var(--ink); outline-offset: 1px; }
.field.invalid input, .field.invalid textarea { border-color: var(--signal); }
.field .error { font-family: var(--display); font-size: 0.875rem; color: var(--signal); }
.field .error:empty { display: none; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.contact-grid { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .contact-grid { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); } .contact-aside { order: 0; } }
.contact-aside { order: 1; }
.contact-form { order: 0; min-width: 0; }
.contact-form > .hint, form > .hint { font-family: var(--display); font-size: 0.9375rem; color: var(--ink-2); margin: 0; }
.form-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px; }
.status { margin: 0; font-family: var(--display); font-size: 0.9375rem; min-height: 1.5em; flex: 1 1 18rem; }
.status.err { color: var(--signal); }
.btn[disabled] { opacity: .55; cursor: progress; }
.consent { font-family: var(--display); font-size: 0.875rem; color: var(--ink-3); max-width: 36em; margin: 0; }

/* Footer */
.footer { border-top: 1px solid var(--line); padding-block: 44px; font-family: var(--display); font-size: 0.9375rem; color: var(--ink-2); }
.footer .wrap { display: grid; gap: 28px; }
@media (min-width: 780px) { .footer .wrap { grid-template-columns: minmax(0, 1fr) auto; align-items: start; } }
.footer .brand span { font-size: 0.9375rem; }
.footer .legal { margin: 14px 0 0; max-width: 34em; }
.footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.footer a { text-decoration: underline; text-decoration-color: var(--line); }
.footer a:hover { text-decoration-color: currentColor; }
.footer .cols { display: flex; flex-wrap: wrap; gap: 24px 56px; }
.footer h2 { font-size: 0.875rem; font-weight: 600; margin: 0 0 12px; color: var(--ink-3); }

/* Live chat (src/chat.js). Fixed bottom-right bubble; full-screen sheet on phones; no third-party code. */
.chat { position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); z-index: 60; font-family: var(--display); }
.chat-launch { position: relative; width: 60px; height: 60px; border-radius: 50%; border: 1.5px solid var(--ink); background: var(--ink); color: var(--paper); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 8px 28px rgba(17,17,17,.24); transition: transform .15s ease, background-color .15s, color .15s; }
.chat-launch:hover { background: var(--paper); color: var(--ink); }
.chat-launch:active { transform: scale(.96); }
.chat-icon { display: block; }
.chat-launch-dot { position: absolute; right: 2px; bottom: 2px; width: 13px; height: 13px; border-radius: 50%; background: #B9B5AD; border: 2.5px solid var(--paper); }
.is-available .chat-launch-dot { background: #2E9E5B; }
.chat-badge { position: absolute; top: -4px; left: -4px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--signal); color: #fff; font-size: 0.75rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; border: 2px solid var(--paper); }
.chat-badge[hidden] { display: none; }
.has-unread { animation: chat-nudge .5s ease 1; }
@keyframes chat-nudge { 0%,100% { transform: translateY(0); } 40% { transform: translateY(-6px); } }
@media (prefers-reduced-motion: reduce) { .has-unread { animation: none; } .chat-launch { transition: none; } }
.is-open .chat-launch { display: none; }
.chat-panel { width: min(400px, calc(100vw - 32px)); max-height: min(680px, calc(100vh - 32px)); max-height: min(680px, calc(100dvh - 32px)); background: var(--paper); color: var(--ink); border: 1.5px solid var(--ink); border-radius: 18px; box-shadow: 0 16px 48px rgba(17,17,17,.22); display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto auto; overflow: hidden; }
.chat-panel[hidden] { display: none; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 14px 10px 12px 16px; background: var(--ink); color: var(--paper); }
.chat-head img { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; }
.chat-head > div { min-width: 0; flex: 1 1 auto; }
.chat-name { margin: 0; font-weight: 700; font-size: 1rem; line-height: 1.2; }
.chat-status { margin: 3px 0 0; font-size: 0.8125rem; color: #B9B5AD; display: flex; align-items: center; gap: 6px; }
.chat-status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #8A867E; flex: 0 0 auto; }
.chat-status.on { color: #8FD6A8; }
.chat-status.on::before { background: #2E9E5B; }
.chat-close { min-width: 44px; min-height: 44px; border: 0; border-radius: 50%; background: transparent; color: var(--paper); font-size: 1.6rem; line-height: 1; cursor: pointer; flex: 0 0 auto; }
.chat-close:hover { background: rgba(255,255,255,.12); }
.chat-head :focus-visible, .chat-close:focus-visible { outline-color: var(--paper); }
.chat-intro { margin: 0; padding: 14px 16px 0; font-family: var(--text); font-size: 0.9375rem; color: var(--ink-2); }
.chat-intro[hidden] { display: none; }
.chat-log { list-style: none; margin: 0; padding: 12px 16px 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; display: grid; gap: 10px; align-content: start; font-family: var(--text); }
.chat-log:empty { padding: 0; }
.chat-msg { max-width: 86%; display: grid; gap: 3px; }
.chat-msg p { margin: 0; padding: 10px 13px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.9375rem; line-height: 1.45; border-radius: 16px; }
.chat-who { font-family: var(--display); font-size: 0.75rem; font-weight: 600; color: var(--ink-3); }
.chat-msg.from-visitor { justify-self: end; text-align: right; }
.chat-msg.from-visitor p { background: var(--ink); color: var(--paper); text-align: left; border-bottom-right-radius: 4px; }
.chat-msg.from-joseph p { background: var(--paper-2); border-bottom-left-radius: 4px; }
.chat-msg.from-system { max-width: 100%; justify-self: stretch; }
.chat-msg.from-system p { padding: 0; font-family: var(--display); font-size: 0.8125rem; color: var(--ink-3); text-align: center; background: none; }
.chat-form { display: grid; gap: 10px; padding: 12px 16px 0; }
.chat-form[hidden] { display: none; }
.chat-fields { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.chat-form label { display: grid; gap: 5px; min-width: 0; }
.chat-form label > span { font-size: 0.8125rem; font-weight: 500; }
.chat-form label small { font-weight: 400; color: var(--ink-3); }
.chat-form input, .chat-form textarea { width: 100%; min-height: 44px; padding: 10px 12px; background: #FFFFFF; color: var(--ink); border: 1.5px solid var(--ink-3); border-radius: 12px; font: inherit; font-size: 1rem; line-height: 1.4; }
.chat-form textarea { resize: none; min-height: 64px; }
.chat-reply { grid-template-columns: minmax(0, 1fr) 48px; align-items: end; }
.chat-reply textarea { min-height: 48px; max-height: 140px; border-radius: 24px; padding: 12px 16px; overflow-y: auto; }
.chat-reply .chat-err { grid-column: 1 / -1; }
.chat-send { width: 48px; height: 48px; padding: 0; border-radius: 50%; border: 1.5px solid var(--ink); background: var(--ink); color: var(--paper); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.chat-send:hover { background: var(--paper); color: var(--ink); }
.chat-send[disabled] { opacity: .55; cursor: progress; }
.chat-form input:focus, .chat-form textarea:focus { border-color: var(--ink); outline: 2px solid var(--ink); outline-offset: 1px; }
.chat-hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.chat-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.chat-foot .btn { min-height: 44px; padding-inline: 22px; font-size: 0.9375rem; border-radius: 999px; }
.chat-err { margin: 0; font-size: 0.8125rem; color: var(--signal); flex: 1 1 auto; }
.chat-err:empty { display: none; }
.chat-note { margin: 0; padding: 10px 16px 14px; font-size: 0.75rem; line-height: 1.45; color: var(--ink-3); }
@media (max-width: 600px) {
  .chat { right: 14px; bottom: 14px; }
  .chat-launch { width: 56px; height: 56px; }
  .chat.is-open { inset: 0; right: 0; bottom: 0; }
  .chat-panel { position: fixed; inset: 0; width: 100%; max-width: none; max-height: none; height: 100%; height: 100dvh; border: 0; border-radius: 0; box-shadow: none; grid-template-rows: auto auto minmax(0, 1fr) auto auto; }
  .chat-head { padding-top: max(14px, env(safe-area-inset-top)); }
  .chat-note { padding-bottom: max(14px, env(safe-area-inset-bottom)); }
  .chat-fields { grid-template-columns: 1fr; }
  html.chat-open, html.chat-open body { overflow: hidden; }
}
@media print { .chat { display: none; } }
