/* ============================================================
   PAPER PAGE STYLES - privacy-first-home-network.html
   Moved from inline <style> for CSP compliance
   ============================================================ */

/* Full-page background image (same as the research hub demo) */
body {
  background:
    linear-gradient(rgba(8,12,24,0.66), rgba(8,12,24,0.78)),
    url('../../images/research/background.webp') center center / cover no-repeat fixed,
    #07101f;
}
#paper { background: transparent !important; }

/* Paper (article) layout: article centered, TOC floats fixed on right */
.paper-layout {
  display: block;
  max-width: 68ch;
  margin: 0 auto;
}

.paper-crumb {
  font-family: var(--font-mono); font-size: 0.7rem;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 18px;
}
.paper-crumb a { color: var(--peach); text-decoration: none; }
.paper-crumb a:hover { color: var(--ink-strong); }
.paper-crumb .sep { margin: 0 8px; opacity: 0.4; }

.paper-title-block { margin-bottom: 32px; padding-bottom: 22px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.paper-h1 {
  font-size: clamp(1.7rem, 3.5vw, 2.6rem);
  font-weight: 800; color: var(--ink-strong); line-height: 1.12;
  letter-spacing: -0.015em;
  margin: 4px 0 14px;
}
.paper-lede {
  font-size: 1.125rem; color: var(--ink-soft);
  line-height: 1.55; max-width: 64ch; font-weight: 300;
  font-style: italic;
}
.paper-meta-row {
  display: flex; gap: 18px; align-items: center; flex-wrap: wrap;
  margin-top: 18px;
  font-family: var(--font-mono); font-size: 0.7rem;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-faint);
}
.paper-meta-row .dot { width: 4px; height: 4px; border-radius: 50%; background: currentColor; opacity: 0.4; }
/* iOS Safari sometimes auto-links dates/phone numbers in the meta row. Strip any link styling. */
.paper-meta-row a, .paper-meta-row a:visited,
.paper-meta-row span a, .paper-meta-row span a:visited {
  color: inherit !important;
  text-decoration: none !important;
  border: none !important;
  pointer-events: none;
}
.paper-tag-inline {
  padding: 3px 10px; border-radius: 999px;
  background: rgba(96,165,250,0.16); color: var(--info);
  font-weight: 700;
}
.paper-status-active {
  padding: 3px 10px; border-radius: 999px;
  background: rgba(110,231,183,0.16); color: var(--ok);
  font-weight: 700;
}

/* Body */
.paper-body { max-width: 68ch; min-width: 0; }
.paper-body p { color: var(--ink-soft); font-size: 1rem; line-height: 1.72; margin: 0 0 18px; }
.paper-body h2 {
  font-size: 1.45rem; font-weight: 700; color: var(--ink-strong);
  margin: 42px 0 14px; letter-spacing: -0.01em;
}
.paper-body h3 {
  font-size: 1.125rem; font-weight: 700; color: var(--ink-strong);
  margin: 28px 0 10px;
}
.paper-body ul, .paper-body ol { padding-left: 22px; margin: 0 0 18px; color: var(--ink-soft); }
.paper-body li { margin-bottom: 6px; line-height: 1.6; }
.paper-body code {
  font-family: var(--font-mono); font-size: 0.88em;
  padding: 1px 6px; background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 4px; color: var(--peach);
}
.paper-body pre {
  background: rgba(2,38,85,0.55);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 10px; padding: 16px 18px;
  overflow-x: auto; margin: 0 0 22px;
}
.paper-body pre code { background: none; border: none; padding: 0; color: var(--ink-soft); }
.paper-body blockquote {
  border-left: 3px solid var(--peach);
  padding: 6px 0 6px 18px; margin: 0 0 18px;
  color: var(--ink-soft); font-style: italic;
}
.paper-body a { color: var(--peach); text-decoration: none; border-bottom: 1px solid rgba(245,184,164,0.4); }
.paper-body a:hover { color: var(--ink-strong); border-color: var(--ink-strong); }

/* Tables: borders strong enough to read over the background image,
   and border-collapse:separate so the outer rounded border renders on iOS Safari. */
.paper-body table {
  width: 100%; border-collapse: separate; border-spacing: 0;
  margin: 4px 0 22px;
  font-size: 0.95rem;
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 10px; overflow: hidden;
  background: rgba(8,12,24,0.35);
}
.paper-body th, .paper-body td {
  padding: 10px 14px; text-align: left;
  border-bottom: 1px solid rgba(255,255,255,0.14);
  color: var(--ink-soft); line-height: 1.5;
  vertical-align: top;
}
.paper-body th + th, .paper-body td + td {
  border-left: 1px solid rgba(255,255,255,0.10);
}
.paper-body th {
  font-family: var(--font-mono); font-size: 0.7rem;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--peach); background: rgba(245,184,164,0.10);
  font-weight: 700;
}
.paper-body tr:last-child td { border-bottom: none; }
.paper-body td strong { color: var(--ink-strong); }

/* Figures / diagrams */
.paper-figure { margin: 12px 0 22px; }
.paper-figure img {
  width: 100%; height: auto;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  display: block;
  background: rgba(255,255,255,0.02);
}
.paper-figure figcaption {
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 0.62rem; letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
  text-align: center;
}

/* Floating TOC (fixed on right side, anchored by a vertical fade line, no box) */
.paper-toc {
  position: fixed;
  top: 110px;
  right: clamp(20px, 3vw, 48px);
  width: 210px;
  max-height: calc(100vh - 160px);
  overflow-y: auto;
  padding: 4px 4px 4px 20px;
  background: transparent;
  border: none; border-radius: 0;
  backdrop-filter: none; -webkit-backdrop-filter: none;
  z-index: 50;
}
/* The "floating" guide line: thin vertical, fades to transparent at both ends */
.paper-toc::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 1px;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(245,184,164,0.08) 8%,
    rgba(245,184,164,0.45) 50%,
    rgba(245,184,164,0.08) 92%,
    transparent 100%
  );
  pointer-events: none;
}
.paper-toc h4 {
  font-family: var(--font-mono); font-size: 0.62rem;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--peach); margin: 0 0 12px;
}
.paper-toc ul { list-style: none; padding: 0; margin: 0; }
.paper-toc li { margin-bottom: 6px; }
.paper-toc a {
  color: var(--ink-muted);
  text-decoration: none; font-size: 0.85rem;
  line-height: 1.4; display: block;
  padding: 3px 0;
  transition: color 0.18s ease, padding-left 0.18s ease;
}
.paper-toc a:hover {
  color: var(--ink-strong);
  padding-left: 6px;
}

.paper-footer-nav {
  margin-top: 56px; padding-top: 26px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex; gap: 14px; justify-content: space-between; flex-wrap: wrap;
}
.paper-foot-link {
  color: var(--peach); text-decoration: none;
  font-family: var(--font-mono); font-size: 0.7rem;
  letter-spacing: 0.14em; text-transform: uppercase;
}
.paper-foot-link:hover { color: var(--ink-strong); }

/* Tablet (iPad portrait + landscape): smaller floating TOC, article shifts left so they don't overlap */
@media (max-width: 1180px) and (min-width: 760px) {
  .paper-toc {
    width: 168px;
    right: 14px;
    top: 100px;
    max-height: calc(100vh - 140px);
    padding: 4px 4px 4px 16px;
  }
  .paper-toc a { font-size: 0.78rem; padding: 2px 0; }
  .paper-toc h4 { font-size: 0.58rem; margin-bottom: 10px; }
  /* article no longer centered; left-anchored with right space reserved for the TOC */
  .paper-layout { margin: 0; max-width: none; }
  .paper-body { max-width: calc(100% - 200px); }
  /* title block, lede, and crumb live OUTSIDE paper-layout; constrain them too so they don't slide under the TOC */
  .paper-crumb,
  .paper-title-block { max-width: calc(100% - 200px); }
  .paper-lede { max-width: 100%; }
}

/* Phone: TOC inline below article (no room for a floating sidebar) */
@media (max-width: 759px) {
  .paper-toc {
    position: static; width: auto;
    max-height: none; overflow-y: visible;
    border: none; border-top: 1px solid rgba(255,255,255,0.08);
    padding: 22px 0 0; margin-top: 40px;
  }
  .paper-toc::before { display: none; }
}

@media (max-width: 980px) {
  .paper-body table { font-size: 0.85rem; }
  .paper-body th, .paper-body td { padding: 8px 10px; word-break: break-word; }
}

/* Phone (≤ 640px): tight padding, long words don't overflow, h1 doesn't break ugly,
   tables scroll horizontally if a row insists on being wider than the viewport. */
@media (max-width: 640px) {
  .paper-h1 { font-size: clamp(1.4rem, 6vw, 1.9rem); line-height: 1.18; word-break: break-word; }
  .paper-lede { font-size: 0.95rem; padding-left: 12px; }
  .paper-meta-row { gap: 8px; font-size: 0.58rem; }
  .paper-body p, .paper-body li { font-size: 0.95rem; line-height: 1.65; }
  .paper-body h2 { font-size: 1.2rem; margin-top: 32px; }
  .paper-body h3 { font-size: 1rem; margin-top: 22px; }
  .paper-body pre { padding: 12px 14px; font-size: 0.85rem; }
  .paper-figure figcaption { font-size: 0.62rem; }
  /* If a table absolutely must be wider than viewport, allow horizontal scroll for that table only */
  .paper-body { overflow-x: visible; }
  .paper-body table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  /* Touch targets ≥ 36px on the TOC + footer nav links when stacked on phone */
  .paper-toc a { padding: 8px 0 8px 12px; min-height: 36px; }
  .paper-foot-link { padding: 8px 4px; }
  body, html { overflow-x: hidden; }
}

/* Very narrow (≤ 360px): iPhone SE first-gen safety */
@media (max-width: 360px) {
  .paper-h1 { font-size: 1.35rem; }
  .paper-body h2 { font-size: 1.125rem; }
  .paper-body th, .paper-body td { padding: 6px 8px; font-size: 0.78rem; }
}