/* =============================================================================
   [COMPANY] drill & blast · css/sections/thread.css · the seismograph thread (site-wide brand motif)
   Markup (placed by the page between sections):
     <div class="thread" data-thread aria-hidden="true"></div>            optional style="--thread-x: 22%"
   js/sections/thread.js upgrades it (adds .seismo): a full-width 1px hairline (the band's --fg at 18%) carrying
   one live seismograph burst in --accent. Each half of the trace takes the colours of the band it overlaps
   (.seismo--split), so it reads on dark|dark, dark|bone and bone|bone seams. Without JS the rules at the end of
   section 1 draw the same trace at rest. The same drawing serves [data-seismo] instrument traces (safety band)
   and the static .box--thread content box (section 3).
   ============================================================================= */

:root {
  /* resting burst (6 px) and the small corner burst, as masks: painted with background: var(--accent) */
  --seismo-burst: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 140 16'%3E%3Cpath d='M0 8.5L1.5 8.35L2.9 8.50L4.4 8.65L5.8 8.66L7.3 8.52L8.8 8.36L10.2 8.33L11.7 8.46L13.1 8.63L14.6 8.68L16.0 8.56L17.5 8.39L19.0 8.32L20.4 8.42L21.9 8.59L23.3 8.68L24.8 8.60L26.3 8.42L27.7 8.32L29.2 8.39L30.6 8.56L32.1 8.68L33.5 8.63L35.0 8.46L36.5 8.33L37.9 8.36L39.4 8.52L40.8 8.66L42.3 8.65L43.8 8.50L45.2 8.35L46.7 8.34L48.1 8.48L49.6 8.64L51.0 8.67L52.5 8.54L54.0 8.37L55.4 8.32L56.9 8.44L58.3 8.61L59.8 8.38L61.3 8.74L62.7 8.15L64.2 9.22L65.6 12.73L67.1 10.86L68.5 8.66L70.0 4.16L71.5 4.86L72.9 9.70L74.4 9.95L75.8 9.63L77.3 9.54L78.8 9.68L80.2 8.37L81.7 5.76L83.1 6.93L84.6 8.63L86.0 9.85L87.5 10.36L89.0 8.43L90.4 8.34L91.9 8.26L93.3 7.20L94.8 7.95L96.3 8.46L97.7 9.29L99.2 9.84L100.6 8.65L102.1 7.89L103.5 7.76L105.0 8.24L106.5 8.51L107.9 8.37L109.4 9.04L110.8 9.14L112.3 8.64L113.8 8.15L115.2 7.74L116.7 8.43L118.1 8.80L119.6 8.51L121.0 8.72L122.5 8.73L124.0 8.55L125.4 8.31L126.9 8.15L128.3 8.44L129.8 8.63L131.3 8.64L132.7 8.57L134.2 8.49L135.6 8.51L137.1 8.46L138.5 8.47L140.0 8.50' fill='none' stroke='%23000' stroke-width='1' stroke-linejoin='round'/%3E%3C/svg%3E");
  --seismo-tick: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 44 14'%3E%3Cpath d='M0 7.5L1.0 7.52L2.0 7.60L3.0 7.35L4.0 7.57L5.0 7.56L6.0 7.35L7.0 7.61L8.0 7.52L9.0 7.37L10.0 7.64L11.0 7.47L12.0 7.40L13.0 7.65L14.0 7.42L15.0 7.44L16.0 7.65L17.0 7.38L18.0 7.49L19.0 7.36L20.0 7.60L21.0 9.68L22.0 3.88L23.0 8.48L24.0 8.84L25.0 8.24L26.0 5.43L27.0 8.61L28.0 7.38L29.0 7.06L30.0 7.09L31.0 8.82L32.0 7.02L33.0 7.28L34.0 7.37L35.0 7.96L36.0 6.95L37.0 7.71L38.0 7.69L39.0 7.54L40.0 7.26L41.0 7.58L42.0 7.52L43.0 7.47L44.0 7.50' fill='none' stroke='%23000' stroke-width='1' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* ---------- 1. the divider ---------- */
.thread {
  height: 0; pointer-events: none;
  --thr-bw: 140px;
  --tx: clamp(calc(var(--thr-bw) / 2 + 6px), var(--thread-x, 50%), calc(100% - var(--thr-bw) / 2 - 6px));
}
/* no-JS fallback: hairline with a gap + the resting burst (hidden once thread.js has upgraded the element) */
.thread:not(.seismo)::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 1px;
  --r: color-mix(in srgb, var(--fg) 18%, transparent);
  background: linear-gradient(90deg, var(--r) calc(var(--tx) - 70px), transparent 0 calc(var(--tx) + 70px), var(--r) 0);
}
.thread:not(.seismo)::after {
  content: ""; position: absolute; top: -8px; left: calc(var(--tx) - 70px); width: 140px; height: 16px;
  background: var(--accent);
  -webkit-mask: var(--seismo-burst) 0 0 / 100% 100% no-repeat; mask: var(--seismo-burst) 0 0 / 100% 100% no-repeat;
}

/* ---------- 2. the live trace (thread.js), shared by .thread and [data-seismo] ---------- */
.seismo {
  position: relative;
  --thr-alpha: 18%;
  --tx: clamp(calc(var(--thr-bw, 140px) / 2 + 6px), var(--thread-x, 50%), calc(100% - var(--thr-bw, 140px) / 2 - 6px));
}
.seismo__layer {
  /* the trace band: --thr-h tall (set by thread.js), centred on the baseline (--seismo-base inside the host) */
  position: absolute; left: 0; right: 0; display: block; pointer-events: none;
  top: calc(var(--seismo-base, 0px) - var(--thr-h, 120px) / 2); height: var(--thr-h, 120px);
  --_fg: var(--thr-fg, var(--fg));
  --_acc: var(--thr-acc, var(--accent));
  --_rule: color-mix(in srgb, var(--_fg) var(--thr-alpha), transparent);
}
.seismo__layer--top { display: none; }
.seismo--split > .seismo__layer--top { display: block; clip-path: inset(0 0 50% 0); }
.seismo--split > .seismo__layer:not(.seismo__layer--top) { clip-path: inset(50% 0 0 0); }

/* the hairline: an HTML box (pixel-snapped, always crisp), open where the burst is, warming to the accent at its edges */
.seismo__line {
  position: absolute; left: 0; right: 0; top: 50%; height: 1px;
  --x0: calc(var(--tx) - var(--thr-bw, 140px) / 2);
  --x1: calc(var(--tx) + var(--thr-bw, 140px) / 2);
  background: linear-gradient(90deg,
    var(--_rule) 0, var(--_rule) calc(var(--x0) - var(--thr-fade, 72px)),
    var(--_acc) var(--x0), transparent var(--x0), transparent var(--x1), var(--_acc) var(--x1),
    var(--_rule) calc(var(--x1) + var(--thr-fade, 72px)), var(--_rule) 100%);
}
/* the burst: SVG in CSS px (viewBox = box), baseline on a half pixel, 1px non-scaling stroke */
.seismo__svg {
  position: absolute; top: 0; left: calc(var(--tx) - var(--thr-bw, 140px) / 2);
  width: var(--thr-bw, 140px); height: 100%; overflow: visible;
}
.seismo__path {
  fill: none; stroke: var(--_acc); stroke-width: 1px; stroke-linejoin: round; stroke-linecap: butt;
  vector-effect: non-scaling-stroke; shape-rendering: geometricPrecision;
}

/* ---------- 3. .box--thread: a content box whose top edge is the thread (static, small burst at the left corner) ----------
   Use on an element WITHOUT clip-path/overflow clipping (the burst rises 7px above the box). Uses ::before + ::after.
   Knobs: --bt-x (burst offset from the corner, default 0), --bt-pad (space above the content). */
.box--thread { position: relative; padding-top: var(--bt-pad, clamp(22px, 2.2vw, 30px)); --bt-x: 0px; --bt-w: 44px; }
.box--thread::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 1px; pointer-events: none;
  --_rule: color-mix(in srgb, var(--fg) 18%, transparent);
  background: linear-gradient(90deg,
    var(--_rule) 0, var(--_rule) var(--bt-x), transparent var(--bt-x), transparent calc(var(--bt-x) + var(--bt-w)),
    var(--accent) calc(var(--bt-x) + var(--bt-w)), var(--_rule) calc(var(--bt-x) + var(--bt-w) + 44px), var(--_rule) 100%);
}
.box--thread::after {
  content: ""; position: absolute; top: -7px; left: var(--bt-x); width: var(--bt-w); height: 14px; pointer-events: none;
  background: var(--accent);
  -webkit-mask: var(--seismo-tick) 0 0 / 100% 100% no-repeat; mask: var(--seismo-tick) 0 0 / 100% 100% no-repeat;
}

@media print { .seismo__layer { display: none; } }
