/* Spearfish: the division page. Loads after security.css: the same page,
   with the mark assembling from dust in the hero (js/spearfish.js). */

/* ---------- The mark ---------- */

/* clear space of a quarter of the mark's width sits between it and the name */
.sf-page { --mark-w: min(520px, 76vw); }

.mark {
  position: relative;
  width: var(--mark-w);
  aspect-ratio: 812 / 335.46;
  margin: 0 auto;
}
.mark img { display: block; width: 100%; height: auto; }
.mark canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.mark.mounted img { visibility: hidden; }

/* ---------- The name and the line ---------- */

.sf-title {
  margin-top: calc(var(--mark-w) * 0.25);
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(44px, 6.4vw, 84px);
  line-height: 1;
  letter-spacing: -0.015em;
  color: var(--ink);
}
.sf-page .hero-sub { margin-top: clamp(16px, 2.4vh, 26px); }

/* the mark assembles first (about 1.5s); the name and the line follow it in.
   The long default delays are a fallback in case the script never runs. */
.sf-title { animation: rise 1.3s var(--ease-out-expo) 3s both; }
.is-ready .sf-title { animation-delay: 1.25s; }
.sf-page.is-ready .hero-sub { animation-delay: 1.55s; }
.sf-page.is-ready .scrolltip { animation-delay: 2.3s, 3.6s; }
.no-dust .sf-title { animation-delay: 0.1s; }

/* ---------- Spearfish Swarm ---------- */

.sf-lede {
  margin-bottom: clamp(22px, 3.2vh, 34px);
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(20px, 1.8vw, 25px);
  line-height: 1.4;
  color: color-mix(in oklch, var(--ink) 80%, var(--bg));
  max-width: 40ch;
}

/* ---------- The reality ---------- */

/* the stat: a large figure, the rest of the sentence as its label */
.sf-stat {
  margin: clamp(26px, 3.8vh, 42px) 0 0;
  padding-top: clamp(20px, 3vh, 28px);
  border-top: 1px solid var(--faint);
}
.sf-stat-fig {
  font-family: var(--serif);
  font-size: clamp(44px, 5.4vw, 72px);
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.sf-stat-label {
  margin-top: 12px;
  font-family: var(--grot);
  font-size: clamp(15px, 1.1vw, 16px);
  line-height: 1.55;
  color: color-mix(in oklch, var(--ink) 80%, var(--bg));
  max-width: 42ch;
}
/* the source, in the chart caption's style */
.sf-stat figcaption {
  margin-top: 18px;
  font-family: var(--grot);
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--muted);
  max-width: 70ch;
}

/* ---------- The swarm's closing pair ---------- */

.sf-page .sec-body > .sf-couplet { margin-top: clamp(22px, 3.2vh, 34px); }
/* two lines, not three, so the swarm and its six watches stay one screen */
.sf-page #swarm .prose p { max-width: 72ch; }
.sf-couplet p + p { margin-top: 0.15em; }

/* ---------- The services ---------- */

/* short entries under a hairline: what the swarm watches, the tests we run */
.sf-grid {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(16px, 2.6vh, 28px) clamp(20px, 2.6vw, 40px);
}
.sf-grid li {
  padding-top: clamp(10px, 1.6vh, 16px);
  border-top: 1px solid var(--faint);
}
.sf-page .sf-grid h3 {
  font-size: clamp(19px, 1.6vw, 23px);
  line-height: 1.2;
}
.sf-grid p {
  margin-top: 6px;
  font-family: var(--grot);
  font-size: clamp(14px, 1.02vw, 15.5px);
  line-height: 1.5;
  color: color-mix(in oklch, var(--ink) 76%, var(--bg));
  text-wrap: pretty;
}
/* the tests: two columns, closer together */
.sf-grid.sf-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  row-gap: clamp(10px, 1.8vh, 20px);
}

/* a ruled list, a small label against each line: governance, the service */
.sf-cadence { list-style: none; border-top: 1px solid var(--faint); }
.sf-cadence li {
  display: grid;
  grid-template-columns: minmax(0, 150px) minmax(0, 1fr);
  gap: clamp(14px, 2.4vw, 32px);
  align-items: baseline;
  padding: clamp(11px, 1.8vh, 17px) 0;
  border-bottom: 1px solid var(--faint);
}
.sf-cadence .when {
  font-family: var(--grot);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}
.sf-cadence p {
  font-family: var(--serif);
  font-size: clamp(18px, 1.5vw, 21px);
  line-height: 1.35;
  letter-spacing: -0.005em;
  color: var(--ink);
  max-width: 58ch;
  text-wrap: pretty;
}

@media (max-width: 1080px) {
  .sf-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 780px) {
  .sf-grid, .sf-grid.sf-list { grid-template-columns: 1fr; }
  .sf-cadence li { grid-template-columns: 1fr; gap: 4px; }
}

/* the closing line: two sentences, each on its own lines */
.sf-page .closer-line span { display: block; text-wrap: balance; }


/* ---------- One section per screen (the /companions flow) ---------- */

.sf-page .sec {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(68px, 10vh, 110px) 0 clamp(24px, 4vh, 48px);
}
.sf-page .sec + .sec { padding-top: clamp(68px, 10vh, 110px); }

/* each screen fits a laptop viewport: wider measures, so headlines, ledger
   titles and paragraphs take fewer lines, and tighter gaps between items */
.sf-page .sec-title { max-width: 22ch; }
.sf-page .ledger b { max-width: 52ch; }
.sf-page .ledger p { max-width: 78ch; }
.sf-page .sf-stat { margin-top: clamp(18px, 2.6vh, 30px); padding-top: clamp(14px, 2vh, 22px); }
.sf-page #reality .sec-title { margin-bottom: clamp(16px, 2.4vh, 32px); }

/* the eyebrow sits clear of the spine; the rail's hairline still meets it */
@media (min-width: 781px) {
  .sf-page .sec-rail { padding-left: 18px; }
}

/* headlines in dust: the mount sizes the box, the type sizes stay as they were */
.sf-page .sec-title.dtext { line-height: 1.08; }
.sf-page .sec-title.dtext.mounted { line-height: 0; }
/* a headline that breaks where the markup says */
.sf-page .sec-title.sf-break { white-space: pre-line; }

/* a little tighter inside the ledger, so the timeline is one screen */
.sf-page .ledger li { padding: clamp(14px, 2.2vh, 22px) 0; }

/* the spine: one line down the run, inked as far as the reader has come */
.sf-page .run { position: relative; }
.sf-page .spine {
  position: absolute;
  top: 0;
  bottom: 0;
  left: max(5vw, calc(50% - 560px));   /* the left edge of the measure */
  width: 1px;
}
.sf-page .spine::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--faint);
}
.sf-page .spine-ink {
  position: absolute;
  inset: 0;
  background: var(--ink);
  transform-origin: top;
  transform: scaleY(var(--p, 0));
  will-change: transform;
}
.sf-page .spine-ember {
  position: absolute;
  left: 50%;
  top: calc(var(--p, 0) * 100%);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ink);
  transform: translate(-50%, -50%);
}

/* snap: hard when every screen fits, soft when one does not (set by the page) */
@media (prefers-reduced-motion: no-preference) {
  html.sf-snap-proximity { scroll-snap-type: y proximity; }
  html.sf-snap-mandatory { scroll-snap-type: y mandatory; }
  .sf-page .hero, .sf-page .sec { scroll-snap-align: start; }
  html.sf-snap-mandatory .sf-page .hero,
  html.sf-snap-mandatory .sf-page .sec { scroll-snap-stop: always; }
  .sf-page .closer { scroll-snap-align: end; }
}

@media (max-width: 780px) {
  /* room between the spine and the text */
  .sf-page .sec .wrap { padding-left: 26px; }
}

/* ---------- Reduced motion, print ---------- */

@media (prefers-reduced-motion: reduce) {
  .sf-title { animation: none !important; }
  .sf-page .spine-ink { transform: none; }
  .sf-page .spine-ember { display: none; }
}
@media print {
  .sf-title { animation: none !important; }
  .sf-page .spine { display: none; }
  .sf-page .sec { min-height: 0; }
  .sf-grid li, .sf-cadence li { break-inside: avoid; }
  .mark canvas { display: none; }
  .mark.mounted img { visibility: visible; }
}
