/* ─────────────────────────────────────────────────────────────────────────
   NowSecure Labs — shared stylesheet.
   Served at https://labs.nowsecure.com/labs-kit.css
   Link from any post's <head>:  <link rel="stylesheet" href="/labs-kit.css" />
   See CONTRIBUTING.md for the required DOM structure.
   ───────────────────────────────────────────────────────────────────────── */

:root {
  --bg: #08090d;
  --bg-2: #0e1017;
  --surface: #12141d;
  --surface-2: #171a25;
  --border: #242838;
  --border-strong: #353a50;
  --text: #e8e9f1;
  --muted: #8b8fa3;
  --dim: #5f6379;
  --accent: #ff6a13;
  --accent-2: #ffb547;
  --danger: #ff3b5c;
  --ok: #42d392;
  --grid: rgba(255,255,255,0.04);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
::selection { background: var(--accent); color: #000; }
a { color: inherit; text-decoration: none; border-bottom: 1px solid var(--border-strong); transition: border-color .15s, color .15s; }
a:hover { border-color: var(--accent); color: var(--accent); }
code, .mono { font-family: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace; }

/* ── Backgrounds ─────────────────────────────────────────────────────── */
.bg-grid {
  position: fixed; inset: 0; z-index: -2;
  background:
    linear-gradient(var(--grid) 1px, transparent 1px) 0 0 / 48px 48px,
    linear-gradient(90deg, var(--grid) 1px, transparent 1px) 0 0 / 48px 48px,
    radial-gradient(ellipse at 15% 10%, rgba(255,106,19,.12), transparent 55%),
    radial-gradient(ellipse at 85% 20%, rgba(255,59,92,.10), transparent 55%),
    var(--bg);
  mask-image: radial-gradient(ellipse at 50% 10%, #000 50%, transparent 100%);
}
.bg-noise {
  position: fixed; inset: 0; z-index: -1; opacity: .4; pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .06 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 28px; }

/* ── Top nav / breadcrumb ────────────────────────────────────────────── */
.nav { padding: 22px 0; display: flex; align-items: center; justify-content: space-between; font-size: 13px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: .02em; }
.brand .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 16px var(--accent); animation: labs-pulse 2.4s infinite; }
@keyframes labs-pulse { 0%,100% { opacity: 1; transform: scale(1);} 50% { opacity: .4; transform: scale(.75);} }
.nav .meta { color: var(--muted); font-family: 'JetBrains Mono', monospace; font-size: 12px; }
.nav a { border: none; }
.brand .bc-sep { color: var(--dim); font-weight: 400; margin: 0 2px; }
.brand .bc-current { color: var(--muted); font-weight: 500; }

/* ── Hero ────────────────────────────────────────────────────────────── */
.hero { padding: 80px 0 60px; position: relative; }
.kicker {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 7px 14px; border: 1px solid var(--border-strong);
  border-radius: 999px; font-size: 12px; font-family: 'JetBrains Mono', monospace;
  letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
  background: rgba(255,255,255,0.02);
}
.kicker .live { width: 6px; height: 6px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 12px var(--danger); }
.headline {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: clamp(48px, 7vw, 104px);
  line-height: .98;
  margin: 28px 0 24px;
  letter-spacing: -.02em;
  font-weight: 400;
}
.headline em { font-style: italic; color: var(--accent); }
.headline .strike { position: relative; white-space: nowrap; }
.headline .strike::after {
  content: ''; position: absolute; left: -4%; right: -4%; top: 54%;
  height: 6px; background: var(--danger); transform: rotate(-1.5deg);
}
.deck { max-width: 720px; color: var(--muted); font-size: 19px; line-height: 1.5; }
.deck strong { color: var(--text); font-weight: 500; }
.byline {
  display: flex; align-items: center; gap: 14px; margin-top: 36px;
  font-size: 13px; color: var(--muted);
}
.byline .avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--danger));
  display: grid; place-items: center; font-weight: 700; color: #000; font-size: 14px;
}
.byline b { color: var(--text); font-weight: 600; }

/* ── Stats strip (up to 4 cells) ─────────────────────────────────────── */
.stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 0;
  border: 1px solid var(--border); border-radius: 16px; overflow: hidden;
  background: linear-gradient(180deg, rgba(255,255,255,0.02), transparent);
  margin-top: 56px;
}
.stat { padding: 28px 28px; border-right: 1px solid var(--border); position: relative; }
.stat:last-child { border-right: none; }
.stat .n { font-family: 'Instrument Serif', Georgia, serif; font-size: 56px; line-height: 1; color: var(--text); letter-spacing: -.02em; }
.stat .l { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .1em; margin-top: 10px; font-family: 'JetBrains Mono', monospace; }
@media (max-width: 780px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .stat:nth-child(2) { border-right: none; }
  .stat:nth-child(1), .stat:nth-child(2) { border-bottom: 1px solid var(--border); }
}

/* ── Section scaffolding ─────────────────────────────────────────────── */
section { padding: 80px 0; position: relative; }
.eyebrow {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace; font-size: 11px;
  color: var(--accent); letter-spacing: .15em; text-transform: uppercase;
  padding: 5px 10px; border: 1px solid rgba(255,106,19,.25); border-radius: 4px;
  background: rgba(255,106,19,.06);
}
h2 { font-family: 'Instrument Serif', serif; font-weight: 400; font-size: clamp(36px, 4.5vw, 56px); line-height: 1.05; letter-spacing: -.02em; margin: 20px 0 20px; }
.lede { color: var(--muted); font-size: 18px; max-width: 720px; }

/* ── Card grid (themes / findings) ───────────────────────────────────── */
.themes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 48px; }
@media (max-width: 900px) { .themes { grid-template-columns: 1fr; } }
.theme { padding: 28px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); display: flex; flex-direction: column; gap: 14px; position: relative; overflow: hidden; }
.theme::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); }
.theme.red::before   { background: var(--danger); }
.theme.amber::before { background: var(--accent-2); }
.theme.ok::before    { background: var(--ok); }
.theme .tag { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--muted); letter-spacing: .1em; text-transform: uppercase; }
.theme h3 { margin: 0; font-size: 20px; font-weight: 600; line-height: 1.25; }
.theme p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.55; }
.theme .pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pill {
  font-family: 'JetBrains Mono', monospace; font-size: 11px;
  padding: 3px 8px; border-radius: 4px; border: 1px solid var(--border-strong);
  background: var(--bg-2); color: var(--text);
}

/* ── Inputs + chips ──────────────────────────────────────────────────── */
.input {
  flex: 1; min-width: 240px;
  padding: 12px 14px; background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  font-family: 'JetBrains Mono', monospace; font-size: 13px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255,106,19,.15); }
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 8px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; font-size: 12px; cursor: pointer; color: var(--muted); transition: all .15s; font-family: 'JetBrains Mono', monospace; }
.chip:hover { color: var(--text); border-color: var(--border-strong); }
.chip.active { background: var(--accent); color: #000; border-color: var(--accent); font-weight: 600; }

/* ── Horizontal bar chart (top-N) ────────────────────────────────────── */
/* DOM:
     <div class="hbars">
       <div class="hbar-row">
         <div class="hbar-name">label</div>
         <div class="hbar-track"><div class="hbar-fill" style="width:80%"></div></div>
         <div class="hbar-count">42</div>
       </div>
       …
     </div>
*/
.hbars { margin-top: 40px; display: grid; gap: 10px; }
.hbar-row { display: grid; grid-template-columns: minmax(160px, 32%) 1fr 60px; gap: 16px; align-items: center; font-family: 'JetBrains Mono', monospace; font-size: 13px; }
.hbar-name { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { height: 24px; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; overflow: hidden; position: relative; }
.hbar-fill  { height: 100%; background: linear-gradient(90deg, var(--accent), var(--danger)); border-radius: 5px; transition: width .8s cubic-bezier(.22,.61,.36,1); }
.hbar-count { color: var(--muted); text-align: right; }
@media (max-width: 640px) {
  .hbar-row { grid-template-columns: 1fr 50px; }
  .hbar-name { grid-column: 1 / -1; margin-bottom: -4px; }
  .hbar-track { grid-column: 1; }
}

/* ── Filterable table ────────────────────────────────────────────────── */
/* DOM:
     <div class="table-tools">
       <input class="input" placeholder="Search…" />
       <div class="chip-row">…chips…</div>
     </div>
     <div class="table-card">
       <div class="table-head"><div>Col 1</div>…</div>
       <div class="table-body">
         <div class="table-row"><div>…</div>…</div>
       </div>
       <div class="table-more"><button class="show-more">…</button></div>
     </div>
     <div class="count-line"><span>N rows</span><span>source · date</span></div>

   Set --cols on .table-head and .table-row to match your column count:
     style="grid-template-columns: 1.4fr 1.3fr 2fr 0.6fr 1.3fr"
*/
.table-tools { display: flex; gap: 12px; margin-top: 36px; margin-bottom: 16px; flex-wrap: wrap; }
.table-card { border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: var(--surface); }
.table-head, .table-row {
  display: grid; grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr)); gap: 16px;
  padding: 12px 18px; align-items: center; font-size: 13px;
}
.table-head { background: var(--bg-2); color: var(--muted); font-family: 'JetBrains Mono', monospace; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; position: sticky; top: 0; z-index: 2; border-bottom: 1px solid var(--border); }
.table-row { border-top: 1px solid var(--border); font-family: 'JetBrains Mono', monospace; }
.table-row:first-child { border-top: none; }
.table-row:hover { background: var(--bg-2); }
.table-row .primary  { font-family: 'Inter', sans-serif; font-weight: 600; font-size: 14px; }
.table-row .accent   { color: var(--accent-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table-row .muted    { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.table-row .dim      { color: var(--dim); }
.table-row .tags     { display: flex; flex-wrap: wrap; gap: 4px; }
.tag-chip            { font-size: 10px; padding: 2px 6px; border-radius: 3px; background: rgba(255,106,19,.1); color: var(--accent);  border: 1px solid rgba(255,106,19,.25); }
.tag-chip.red        { background: rgba(255,59,92,.1);  color: var(--danger);   border-color: rgba(255,59,92,.3); }
.tag-chip.amber      { background: rgba(255,181,71,.1); color: var(--accent-2); border-color: rgba(255,181,71,.3); }
.tag-chip.ok         { background: rgba(66,211,146,.1); color: var(--ok);       border-color: rgba(66,211,146,.3); }
.empty { padding: 40px; text-align: center; color: var(--muted); font-family: 'JetBrains Mono', monospace; font-size: 13px; }
.table-more { border-top: 1px solid var(--border); }
.table-more:empty { display: none; }
.show-more { width: 100%; padding: 14px 20px; background: transparent; border: none; color: var(--muted); font-family: 'JetBrains Mono', monospace; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; cursor: pointer; transition: background .15s, color .15s; }
.show-more:hover { background: var(--bg-2); color: var(--text); }
.show-more .remaining { color: var(--dim); margin-left: 8px; }
.count-line { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--muted); }
@media (max-width: 780px) {
  .table-head, .table-row { grid-template-columns: 1fr 1fr; }
  .table-head > *:nth-child(n+3), .table-row > *:nth-child(n+3) { display: none; }
}

/* ── Action cards ────────────────────────────────────────────────────── */
.actions-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 40px; }
@media (max-width: 900px) { .actions-grid { grid-template-columns: 1fr; } }
.action-card { padding: 28px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); position: relative; }
.action-card .num { font-family: 'Instrument Serif', serif; font-size: 48px; color: var(--accent); line-height: 1; margin-bottom: 14px; }
.action-card h3 { font-size: 18px; margin: 0 0 10px; font-weight: 600; }
.action-card p { color: var(--muted); font-size: 14px; line-height: 1.55; margin: 0; }

/* ── CTA + buttons ───────────────────────────────────────────────────── */
.cta {
  margin: 80px 0 40px;
  padding: 60px 48px; border-radius: 20px;
  background:
    radial-gradient(ellipse at top left, rgba(255,106,19,.25), transparent 50%),
    radial-gradient(ellipse at bottom right, rgba(255,59,92,.20), transparent 50%),
    var(--surface);
  border: 1px solid var(--border-strong);
  text-align: center;
}
.cta h2 { margin: 0 0 14px; }
.cta p { color: var(--muted); max-width: 620px; margin: 0 auto 28px; }
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 22px; background: var(--accent); color: #000;
  font-weight: 600; border: none; border-radius: 10px;
  text-decoration: none; transition: transform .15s, box-shadow .15s;
  font-size: 15px;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(255,106,19,.3); color: #000; border: none; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--border-strong); margin-left: 10px; }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); box-shadow: none; }

/* ── Footer ──────────────────────────────────────────────────────────── */
footer.labs-footer {
  padding: 40px 0 60px;
  font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--muted);
  display: flex; flex-wrap: wrap; gap: 14px; justify-content: space-between;
  border-top: 1px solid var(--border);
}

/* ── Scrollbar ───────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ── Animation ───────────────────────────────────────────────────────── */
@keyframes labs-rise-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
.rise { animation: labs-rise-in .7s cubic-bezier(.22,.61,.36,1) both; }
@media (prefers-reduced-motion: reduce) { .rise { animation: none; } }
