/* Blog post pages (/blog/<slug>): sticky sub-nav with % read, reading progress, silver hero frame,
   outlined date title block, body, Filed under chips, bottom nav with Find, Back to Top. Class prefix bp2-.
   Extends the Interface Portfolio project pages (css/jb-interface-detail.css). */

/* Tokens: values match the --ip2-* tokens in css/jb-interface-detail.css.
   Pink and blue are the site's own --pink and --blue page variables; mono kickers use --jb-cyan. */
[data-theme="dark"] {
  --bp2-text:    #ECECF0;
  --bp2-body:    #C4C4CC;
  --bp2-text-2:  #9A9AA3;
  --bp2-muted:   #7C7C85;
  --bp2-faint:   #4A4A52;
  --bp2-track:   #16161A;
  --bp2-line:    #1D1D21;
  --bp2-row:     #18181C;
  --bp2-field:   #141418;
  --bp2-field-b: #2A2A30;
  --bp2-panel:   #0C0C0F;
  --bp2-hover:   #111115;
  --bp2-hover-2: #18181D;
  --bp2-pink-a:  rgba(255,32,96,.7);
  --bp2-blue-a:  rgba(0,207,255,.7);
}
[data-theme="light"] {
  --bp2-text:    #0d0d0d;
  --bp2-body:    #3a3f47;
  --bp2-text-2:  #5e6b7c;
  --bp2-muted:   #6b7d93;
  --bp2-faint:   #8fa0b0;
  --bp2-track:   #e4e8ee;
  --bp2-line:    #d5dae1;
  --bp2-row:     #e6e9ee;
  --bp2-field:   #ffffff;
  --bp2-field-b: #d5dae1;
  --bp2-panel:   #eef0f3;
  --bp2-hover:   #f8f9fb;
  --bp2-hover-2: #eef0f3;
  --bp2-pink-a:  rgba(255,32,96,.7);
  --bp2-blue-a:  rgba(0,119,187,.7);
}

/* ── Sticky sub-nav (extends .jb-sub from jb-header.css) ── */
.jb-sub.bp2-sub { height: 52px; gap: 14px; }
.bp2-sub .jb-crumb > .jb-p { color: var(--pink); }
.bp2-sub .jb-crumb-current { font-weight: 500; }
.bp2-sub .jb-theme { margin-left: 0; }

.bp2-pct { width: 72px; flex: none; text-align: right; white-space: nowrap; font-family: var(--font-mono); font-size: 12px; color: var(--bp2-muted); font-variant-numeric: tabular-nums; }

.bp2-all { display: flex; align-items: center; gap: 6px; flex: none; padding: 6px 10px; border-radius: 8px; font-size: 14px; font-weight: 500; color: var(--jb-text); white-space: nowrap; }
.bp2-all i { color: var(--blue); font-size: 16px; }
.bp2-all:hover { background: var(--jb-hover); color: var(--jb-text); }

.bp2-step { display: flex; align-items: center; flex: none; height: 34px; border: 1px solid var(--jb-border); border-radius: 8px; overflow: hidden; }
.bp2-arrow { width: 34px; height: 100%; display: grid; place-items: center; color: var(--jb-text); }
.bp2-arrow + .bp2-arrow { border-left: 1px solid var(--jb-border); }
a.bp2-arrow:hover { background: var(--bp2-track); color: var(--jb-text); }
.bp2-arrow.is-off { opacity: .3; }

/* 2px reading progress track directly under the bar's bottom border */
.bp2-progress { position: absolute; left: 0; right: 0; bottom: -3px; height: 2px; background: var(--bp2-track); pointer-events: none; }
.bp2-progress span { display: block; width: 0; height: 100%; background: linear-gradient(90deg, var(--pink), var(--blue)); }

/* ── Content column ──────────────────────────────────────── */
.bp2-main { max-width: 1008px; margin: 0 auto; padding: 48px 24px 72px; }
.bp2-main a { text-decoration: none; }
.bp2-main :focus-visible { outline: 2px solid var(--jb-cyan); outline-offset: 2px; }

/* Silver frame, same as the Interface Portfolio screenshots */
.bp2-frame {
  position: relative; margin: 0; padding: 10px 10px 0; border-radius: 14px;
  background: linear-gradient(160deg, #24262c, #131418 55%, #1c1d22);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 0 0 1px #2a2c33, 0 30px 60px -36px rgba(0,0,0,.9);
}
.bp2-frame::before {
  content: ""; position: absolute; left: 24px; right: 24px; top: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--bp2-pink-a), var(--bp2-blue-a), transparent);
}
.bp2-hero-img { aspect-ratio: 2 / 1; border-radius: 6px; overflow: hidden; background: #141826; }
.bp2-hero-img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.bp2-cap { display: flex; justify-content: space-between; gap: 12px; padding: 10px 4px; font-family: var(--font-mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: #7C7C85; }
.bp2-cap span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bp2-cap span:last-child { margin-left: auto; flex: none; }

/* Title block: kicker, H1, byline on the left; outlined day + MON YYYY bottom right */
.bp2-head {
  margin-top: 44px; display: grid; column-gap: 28px;
  grid-template-columns: minmax(0,1fr) auto;
  grid-template-rows: 1fr auto auto;
  grid-template-areas: "k d" "t d" "b d";
}
.bp2-kicker { grid-area: k; align-self: end; font-family: var(--font-mono); font-size: 13px; letter-spacing: .2em; text-transform: uppercase; color: var(--jb-cyan); }
.bp2-h1 {
  grid-area: t; margin: 14px 0;
  font-family: var(--font-display); font-weight: 700; font-size: 60px; line-height: 1.0; letter-spacing: 0.03em;
  text-transform: uppercase; color: var(--bp2-text); text-wrap: balance; overflow-wrap: anywhere;
}
.bp2-byline { grid-area: b; font-family: var(--font-mono); font-size: 13px; color: var(--bp2-text-2); }
.bp2-byline a { color: var(--bp2-text-2); }
.bp2-byline a:hover { color: var(--bp2-text); }
.bp2-date { grid-area: d; align-self: end; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.bp2-day { font-family: var(--font-display); font-size: 128px; line-height: .85; color: transparent; -webkit-text-stroke: 1px var(--pink); }
.bp2-mon { font-family: var(--font-mono); font-size: 12px; letter-spacing: .2em; text-transform: uppercase; color: var(--blue); white-space: nowrap; }

.bp2-rule { height: 1px; margin-top: 28px; background: linear-gradient(90deg, var(--pink), var(--blue) 60%, transparent); }

/* Body */
.bp2-body { margin-top: 36px; }
.bp2-body > * { margin: 0; }
.bp2-body > * + * { margin-top: 24px; }
.bp2-body p { font-size: 18px; line-height: 1.8; color: var(--bp2-body); text-wrap: pretty; overflow-wrap: break-word; }
.bp2-body p:empty { display: none; }
.bp2-body p.bp2-lede { font-size: 21px; line-height: 1.6; color: var(--bp2-text); }
.bp2-body h2, .bp2-body h3 { font-family: var(--font-display); font-weight: 400; font-size: 36px; line-height: 1.1; letter-spacing: .01em; text-transform: uppercase; color: var(--bp2-text); }
.bp2-body > h2, .bp2-body > h3 { margin-top: 48px; }
.bp2-body > h2:first-child, .bp2-body > h3:first-child { margin-top: 0; }
.bp2-body strong { color: var(--bp2-text); }
.bp2-body ul, .bp2-body ol { padding-left: 22px; font-size: 18px; line-height: 1.8; color: var(--bp2-body); }
.bp2-body li + li { margin-top: 8px; }
.bp2-body li::marker { color: var(--blue); }
.bp2-body a { color: var(--blue); border-bottom: 1px solid color-mix(in srgb, var(--blue) 50%, transparent); overflow-wrap: anywhere; }
.bp2-body a:hover { color: var(--blue); border-color: var(--blue); }
.bp2-body hr { height: 1px; border: 0; background: var(--bp2-line); }
/* Inline body images: 5px frame variant, sized to the image (small images are not stretched) */
.bp2-body .bp2-frame { width: fit-content; max-width: 100%; margin-left: auto; margin-right: auto; padding: 5px; border-radius: 11px; }
.bp2-body .bp2-frame::before { left: 20px; right: 20px; }
.bp2-body .bp2-frame img { display: block; max-width: 100%; height: auto; border-radius: 7px; }

/* Filed under */
.bp2-tags { margin-top: 40px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-family: var(--font-mono); font-size: 12px; text-transform: uppercase; color: var(--bp2-muted); }
.bp2-chip { display: flex; align-items: center; gap: 6px; padding: 4px 12px; border: 1px solid var(--bp2-field-b); border-radius: 999px; font-family: var(--font-body); font-size: 13px; text-transform: none; color: var(--bp2-text); white-space: nowrap; }
.bp2-chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--blue); }
.bp2-chip:hover { border-color: var(--blue); color: var(--bp2-text); }

/* Bottom nav: Older | Newer, then Find + All posts */
.bp2-bnav { margin-top: 28px; display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); border: 1px solid var(--bp2-line); border-radius: 12px; }
.bp2-side { display: flex; flex-direction: column; gap: 6px; padding: 22px 24px; color: var(--bp2-text); }
a.bp2-side:hover { background: var(--bp2-hover); color: var(--bp2-text); }
.bp2-side.is-off { opacity: .3; }
.bp2-older { border-top: 2px solid var(--pink); border-right: 1px solid var(--bp2-line); border-top-left-radius: 12px; }
.bp2-newer { border-top: 2px solid var(--blue); border-top-right-radius: 12px; text-align: right; }
.bp2-dir { font-family: var(--font-mono); font-size: 11px; letter-spacing: .2em; text-transform: uppercase; white-space: nowrap; }
.bp2-older .bp2-dir { color: var(--pink); }
.bp2-newer .bp2-dir { color: var(--blue); }
.bp2-title { font-size: 16px; font-weight: 600; line-height: 1.35; }

.bp2-tools { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 24px; border-top: 1px solid var(--bp2-line); background: var(--bp2-panel); border-radius: 0 0 12px 12px; }
.bp2-find { position: relative; display: flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: 13px; color: var(--bp2-muted); }
.bp2-find input {
  width: 220px; height: 30px; padding: 0 10px;
  background: var(--bp2-field); border: 1px solid var(--bp2-field-b); border-radius: 6px;
  color: var(--bp2-text); font: inherit; outline: none;
}
.bp2-find input::placeholder { color: var(--bp2-muted); opacity: 1; }
.bp2-find input:focus { border-color: var(--pink); }
.bp2-main .bp2-find input:focus-visible { outline: none; }
.bp2-find > i { color: var(--blue); font-size: 16px; }

/* Results open above the input */
.bp2-results {
  position: absolute; left: 42px; bottom: 40px; z-index: 5; width: 340px; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain;
  background: var(--bp2-hover); border: 1px solid var(--bp2-field-b); border-radius: 10px;
  box-shadow: 0 20px 40px -20px rgba(0,0,0,.9); font-family: var(--font-body);
}
.bp2-results[hidden] { display: none; }
.bp2-res-head { position: sticky; top: 0; z-index: 1; background: var(--bp2-hover); padding: 8px 12px; border-bottom: 1px solid var(--bp2-line); font-family: var(--font-mono); font-size: 10px; letter-spacing: .2em; text-transform: uppercase; color: var(--bp2-faint); }
.bp2-res { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; color: var(--bp2-text); }
.bp2-res + .bp2-res { border-top: 1px solid var(--bp2-row); }
.bp2-res:hover, .bp2-res.is-active { background: var(--bp2-hover-2); color: var(--bp2-text); }
.bp2-res-t { font-size: 14px; font-weight: 500; line-height: 1.35; }
.bp2-res-tag { font-family: var(--font-mono); font-size: 11px; color: var(--bp2-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } /* one line: some posts have 13 tags */
.bp2-res-none { display: block; padding: 12px; font-size: 13px; color: var(--bp2-text-2); }
.bp2-res-none:hover { color: var(--bp2-text); }

.bp2-all-sm { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--bp2-text-2); white-space: nowrap; }
.bp2-all-sm:hover { color: var(--bp2-text); }

/* ── Sub-nav at the header's mobile breakpoint ─────────────
   jb-header.css hides .jb-sub-item .jb-crumbs and .jb-sub-div at 1100px and below.
   All posts takes the left side; the ‹ › control gets 44px targets. */
@media (max-width: 1100px) {
  .jb-sub.bp2-sub { gap: 10px; padding: 0 10px 0 8px; }
  .bp2-all { order: -1; flex: 1; min-width: 0; min-height: 44px; padding: 0 8px; }
  .bp2-pct { width: auto; }
  .bp2-step { height: 46px; } /* buttons inside the 1px border stay at the 44px tap minimum */
  .bp2-arrow { width: 44px; font-size: 18px; }
}

/* ── Mobile content (3a) ─────────────────────────────────── */
@media (max-width: 767px) {
  .bp2-main { padding: 20px 16px 40px; }

  .bp2-frame { padding: 6px 6px 0; border-radius: 10px; box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 0 0 1px #2a2c33, 0 20px 40px -26px rgba(0,0,0,.9); }
  .bp2-frame::before { left: 16px; right: 16px; }
  .bp2-hero-img { aspect-ratio: 16 / 10; border-radius: 5px; }
  .bp2-cap { gap: 8px; padding: 8px 2px; font-size: 10px; }

  .bp2-head { margin-top: 28px; column-gap: 12px; grid-template-rows: auto auto auto; grid-template-areas: "k d" "t t" "b b"; }
  .bp2-kicker { font-size: 11px; }
  .bp2-h1 { font-size: 38px; margin: 14px 0 12px; }
  .bp2-byline { font-size: 12px; }
  .bp2-date { flex-direction: row; align-items: baseline; gap: 8px; }
  .bp2-day { font-size: 56px; }
  .bp2-mon { font-size: 11px; }

  .bp2-rule { margin-top: 20px; }
  .bp2-body { margin-top: 24px; }
  .bp2-body > * + * { margin-top: 18px; }
  .bp2-body p, .bp2-body ul, .bp2-body ol { font-size: 16px; line-height: 1.75; }
  .bp2-body p.bp2-lede { font-size: 18px; line-height: 1.6; }
  .bp2-body h2, .bp2-body h3 { font-size: 28px; }
  .bp2-body > h2, .bp2-body > h3 { margin-top: 36px; }
  .bp2-body .bp2-frame { padding: 4px; border-radius: 9px; }

  .bp2-tags { margin-top: 32px; font-size: 11px; }
  .bp2-chip { padding: 8px 14px; min-height: 44px; }

  .bp2-bnav { margin-top: 24px; }
  .bp2-side { padding: 16px; min-height: 84px; }
  .bp2-dir { font-size: 10px; }
  .bp2-title { font-size: 14px; line-height: 1.3; }

  .bp2-tools { flex-direction: column; align-items: stretch; gap: 12px; padding: 12px 16px 14px; }
  .bp2-find { gap: 8px; }
  .bp2-find input { flex: 1; min-width: 0; width: auto; height: 40px; font-size: 16px; } /* 16px stops iOS zooming on focus */
  .bp2-find > i { font-size: 18px; }
  .bp2-results { left: 0; right: 0; bottom: 48px; width: auto; }
  .bp2-res { min-height: 44px; padding: 12px; }
  .bp2-all-sm { align-self: center; min-height: 44px; font-size: 14px; }
}

/* ── Back to top (same as index.html) ───────────────────── */
#back-to-top {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 950;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-card);
  transition: all var(--transition);
  font-size: 1.2rem;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
}
#back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
}
#back-to-top:hover {
  border-color: var(--blue);
  color: var(--blue);
  box-shadow: 0 0 16px var(--blue-glow);
}
/* Would sit over the open drawer's bottom rows */
body.jb-lock #back-to-top { opacity: 0; pointer-events: none; }
