/* ============================================================
   ChildCustodyPros — Article Shell (shared)
   Magazine treatment: hero, sticky TOC, scroll-spy, progress
   bar, drop-cap. Loaded by all flagship article pages so we
   can update look-and-feel in one place.
   ============================================================ */
:root{
  --as-navy:#0B1F3A;--as-navy-2:#14304F;--as-navy-deep:#071526;
  --as-orange:#E8700A;--as-gold:#D4A84B;--as-gold-soft:#E8C979;
  --as-teal:#0D5F5F;--as-red:#C0392B;--as-green:#2A6049;
  --as-cream:#FAF7F2;--as-cream-2:#F1ECE2;
  --as-text:#1A1A1A;--as-muted:#5B6472;--as-border:#E5E0D5;
  --as-display:'Playfair Display',Georgia,serif;
  --as-body:'IBM Plex Serif',Georgia,serif;
  --as-ui:'Inter',system-ui,-apple-system,sans-serif;
  --as-eye:'Barlow Condensed',sans-serif;
}

/* When shell is enabled, only adjust scroll behaviour — host page keeps its
   own background and typography. The shell is purely additive: progress bar,
   skip link, and sticky TOC overlay. Pages that opt-in to the magazine hero
   add `as-has-hero` and use .as-* / legacy class aliases below. */
html.as-shell{scroll-behavior:smooth;scroll-padding-top:24px}
@media(prefers-reduced-motion:reduce){
  html.as-shell{scroll-behavior:auto}
  html.as-shell .as-progress{transition:none}
}

/* Skip link */
.as-skip{position:absolute;left:-9999px;top:8px;background:var(--as-navy);color:#fff;padding:10px 18px;font-family:var(--as-ui);font-size:14px;font-weight:600;border-radius:6px;z-index:10000;text-decoration:none}
.as-skip:focus{left:24px}

/* Reading progress */
.as-progress{position:fixed;top:0;left:0;height:3px;background:linear-gradient(90deg,var(--as-orange),var(--as-gold));width:0;z-index:9999;transition:width .08s linear;box-shadow:0 0 8px rgba(232,112,10,.45)}

/* Focus ring */
html.as-shell a:focus-visible,
html.as-shell button:focus-visible{outline:2px solid var(--as-orange);outline-offset:3px;border-radius:3px}

/* ===== HERO ===== */
.as-hero,
html.as-shell.as-has-hero .page-header{position:relative;background:linear-gradient(135deg,var(--as-navy-deep) 0%,var(--as-navy) 55%,var(--as-navy-2) 100%);padding:72px 24px 80px;text-align:center;overflow:hidden;border-bottom:3px solid var(--as-gold);color:#fff}
.as-hero::before,
html.as-shell.as-has-hero .page-header::before{content:"";position:absolute;inset:0;background-image:radial-gradient(circle at 18% 22%,rgba(212,168,75,.10),transparent 42%),radial-gradient(circle at 82% 78%,rgba(232,112,10,.10),transparent 45%);pointer-events:none}
.as-hero[data-watermark]::after,
html.as-shell.as-has-hero .page-header[data-watermark]::after{content:attr(data-watermark);position:absolute;right:-30px;bottom:-60px;font-family:var(--as-display);font-size:280px;font-weight:800;color:rgba(212,168,75,.06);letter-spacing:-10px;line-height:1;pointer-events:none;user-select:none}
.as-crumb,
html.as-shell.as-has-hero .crumb{position:relative;font-family:var(--as-ui);font-size:12px;font-weight:500;color:rgba(232,201,121,.85);margin-bottom:18px;letter-spacing:.4px}
.as-crumb a,
html.as-shell.as-has-hero .crumb a{color:rgba(232,201,121,.85);text-decoration:none;transition:color .2s}
.as-crumb a:hover,
html.as-shell.as-has-hero .crumb a:hover{color:var(--as-gold-soft)}
.as-crumb .sep,
html.as-shell.as-has-hero .crumb .sep{margin:0 8px;color:rgba(255,255,255,.25)}
.as-tag,
html.as-shell.as-has-hero .page-header .tag{position:relative;display:inline-block;font-family:var(--as-eye);font-size:12px;letter-spacing:3px;text-transform:uppercase;color:var(--as-gold);margin-bottom:18px;padding:6px 14px;border:1px solid rgba(212,168,75,.35);border-radius:2px;background:rgba(212,168,75,.05)}
.as-hero h1,
html.as-shell.as-has-hero .page-header h1{position:relative;font-family:var(--as-display);font-size:clamp(28px,5vw,52px);font-weight:700;line-height:1.12;color:#fff;margin:0 auto 20px;letter-spacing:-.5px;max-width:880px}
.as-hero h1 em,.as-hero h1 .em,
html.as-shell.as-has-hero .page-header h1 span{color:var(--as-gold-soft);font-style:italic;font-weight:600}
.as-sub,
html.as-shell.as-has-hero .page-header .header-sub{position:relative;font-family:var(--as-body);font-size:18px;color:#CBD5E1;max-width:660px;margin:0 auto;line-height:1.7}
.as-meta,
html.as-shell.as-has-hero .page-header .meta-strip{position:relative;display:flex;justify-content:center;gap:28px;margin-top:28px;flex-wrap:wrap;font-family:var(--as-ui);font-size:12px;color:rgba(255,255,255,.55);letter-spacing:.5px;text-transform:uppercase}
.as-meta span,
html.as-shell.as-has-hero .page-header .meta-strip span{display:flex;align-items:center;gap:6px}
.as-meta .dot,
html.as-shell.as-has-hero .page-header .meta-strip .dot{width:4px;height:4px;border-radius:50%;background:var(--as-gold);display:inline-block}

/* ===== LAYOUT ===== */
.as-wrap,
html.as-shell.as-has-hero .wrap{max-width:1180px;margin:0 auto;padding:0 24px 64px;display:grid;grid-template-columns:minmax(0,1fr) 260px;gap:48px;align-items:start}
@media(max-width:980px){
  .as-wrap,html.as-shell.as-has-hero .wrap{grid-template-columns:1fr;max-width:780px;gap:0}
}

/* ===== TOC ===== */
.as-toc,html.as-shell .toc{position:sticky;top:24px;background:#fff;border:1px solid var(--as-border);border-radius:10px;padding:22px 22px 18px;box-shadow:0 4px 18px rgba(11,31,58,.06);margin-top:36px}
.as-toc-title,html.as-shell .toc .toc-title{font-family:var(--as-eye);font-size:11px;font-weight:700;letter-spacing:2.5px;text-transform:uppercase;color:var(--as-orange);margin-bottom:14px;padding-bottom:10px;border-bottom:1px solid var(--as-border)}
.as-toc ol,html.as-shell .toc ol{list-style:none;counter-reset:toc;margin:0;padding:0}
.as-toc li,html.as-shell .toc li{counter-increment:toc;margin:0;border-bottom:1px solid #F1ECE2}
.as-toc li:last-child,html.as-shell .toc li:last-child{border-bottom:none}
.as-toc a,html.as-shell .toc a{display:block;font-family:var(--as-ui);font-size:13.5px;font-weight:500;color:var(--as-navy);text-decoration:none;padding:10px 0 10px 30px;line-height:1.4;position:relative;transition:color .2s,padding .2s,background .2s;border-left:2px solid transparent;margin-left:-2px;border-radius:0 4px 4px 0}
.as-toc a::before,html.as-shell .toc a::before{content:counter(toc,decimal-leading-zero);position:absolute;left:8px;top:10px;font-family:var(--as-display);font-size:11px;font-weight:700;color:var(--as-gold);transition:color .2s}
.as-toc a:hover,html.as-shell .toc a:hover{color:var(--as-orange);padding-left:34px}
.as-toc a.active,html.as-shell .toc a.active{color:var(--as-orange);border-left-color:var(--as-orange);background:linear-gradient(90deg,rgba(232,112,10,.07),transparent)}
.as-toc a.active::before,html.as-shell .toc a.active::before{color:var(--as-orange)}
@media(max-width:980px){
  .as-toc,html.as-shell .toc{position:static;margin:24px 0 0;order:-1}
}

/* ===== ARTICLE BODY (only when host opts in) ===== */
html.as-shell.as-has-hero .article-body{background:#fff;border-radius:12px;padding:52px 56px;margin:36px 0;box-shadow:0 6px 28px rgba(11,31,58,.07);border:1px solid var(--as-border)}
html.as-shell.as-has-hero .article-body p{font-family:var(--as-body);font-size:17.5px;line-height:1.82;color:#262626;margin-bottom:22px}
html.as-shell.as-has-hero .article-body h2{font-family:var(--as-display);font-size:clamp(24px,3vw,32px);font-weight:700;color:var(--as-navy);margin:48px 0 18px;border-bottom:none;line-height:1.25;letter-spacing:-.3px;position:relative;padding-left:18px;padding-bottom:0}
html.as-shell.as-has-hero .article-body h2::before{content:"";position:absolute;left:0;top:8px;bottom:8px;width:4px;background:linear-gradient(180deg,var(--as-orange),var(--as-gold));border-radius:2px}
html.as-shell.as-has-hero .article-body h2:first-of-type{margin-top:8px}
html.as-shell.as-has-hero .article-body h3{font-family:var(--as-display);font-size:21px;font-weight:600;color:var(--as-navy);margin:32px 0 12px;font-style:italic}
html.as-shell.as-has-hero .article-body strong{color:var(--as-navy);font-weight:600}

/* Drop-cap on first text paragraph after .lead */
html.as-shell.as-has-hero .article-body .lead + p:not(:has(> strong:first-child))::first-letter{font-family:var(--as-display);float:left;font-size:62px;font-weight:700;line-height:.95;color:var(--as-orange);padding:6px 12px 0 0;margin-top:4px}

/* Lead */
html.as-shell.as-has-hero .article-body .lead{font-family:var(--as-display);font-size:21px;line-height:1.55;color:var(--as-navy);font-weight:500;font-style:italic;border:none;padding:24px 0 24px 28px;background:transparent;margin-bottom:36px;position:relative;border-left:3px solid var(--as-gold);border-radius:0}
html.as-shell.as-has-hero .article-body .lead::before{content:"\201C";position:absolute;left:14px;top:-4px;font-family:var(--as-display);font-size:72px;color:var(--as-gold);line-height:1;opacity:.22}

/* Disable host-side .page-header + .tag duplicates when shell hero is rendered */
html.as-shell.as-has-hero .page-header,
html.as-shell.as-has-hero .topbar,
html.as-shell.as-has-hero .hd,
html.as-shell.as-has-hero .bc,
html.as-shell.as-has-hero .hero{display:none!important}

/* Mobile */
@media(max-width:600px){
  .as-hero{padding:48px 20px 56px}
  html.as-shell .article-body{padding:28px 22px}
  html.as-shell .article-body .lead + p::first-letter{font-size:48px;padding:4px 8px 0 0}
  html.as-shell .article-body .lead{font-size:18px;padding-left:20px}
  .as-meta{gap:14px;font-size:11px}
}

/* ============================================================
   MOBILE OPTIMIZATIONS (≤768px)
   - Collapsible TOC (saves above-the-fold real estate)
   - 48px tap targets
   - Tighter hero, clipped watermark, smaller gutters
   ============================================================ */
@media(max-width:768px){
  /* Wrap: tighter gutters, no double padding */
  .as-wrap,html.as-shell.as-has-hero .wrap{padding:0 16px 48px;gap:0}

  /* Hero: shorter, no overflow */
  .as-hero,html.as-shell.as-has-hero .page-header{padding:40px 18px 44px}
  .as-hero[data-watermark]::after,
  html.as-shell.as-has-hero .page-header[data-watermark]::after{font-size:180px;right:-20px;bottom:-40px}
  .as-hero h1,html.as-shell.as-has-hero .page-header h1{font-size:clamp(26px,7vw,34px);line-height:1.18;margin-bottom:14px}
  .as-sub,html.as-shell.as-has-hero .page-header .header-sub{font-size:16px;line-height:1.6}
  .as-tag,html.as-shell.as-has-hero .page-header .tag{font-size:11px;letter-spacing:2px;padding:5px 10px;margin-bottom:14px}
  .as-crumb,html.as-shell.as-has-hero .crumb{font-size:11px;margin-bottom:14px}
  .as-meta,html.as-shell.as-has-hero .page-header .meta-strip{margin-top:20px;gap:12px;font-size:10.5px}

  /* TOC: collapsible, 48px tap targets, no sticky */
  .as-toc,html.as-shell .toc{position:static;margin:18px 0 8px;padding:0;border-radius:8px;box-shadow:0 2px 10px rgba(11,31,58,.06);order:-1;overflow:hidden}
  .as-toc-title,html.as-shell .toc .toc-title{display:flex;align-items:center;justify-content:space-between;margin:0;padding:16px 18px;border-bottom:none;font-size:12px;cursor:pointer;min-height:52px;user-select:none}
  .as-toc-title::after,html.as-shell .toc .toc-title::after{content:"▾";font-family:var(--as-ui);font-size:14px;color:var(--as-navy);transition:transform .2s;margin-left:8px}
  .as-toc.as-collapsed .as-toc-title::after,
  html.as-shell .toc.as-collapsed .toc-title::after{transform:rotate(-90deg)}
  .as-toc.as-collapsed ol,
  html.as-shell .toc.as-collapsed ol{display:none}
  .as-toc ol,html.as-shell .toc ol{padding:0 18px 8px;border-top:1px solid var(--as-border)}
  .as-toc a,html.as-shell .toc a{font-size:14.5px;padding:14px 0 14px 32px;min-height:48px;display:flex;align-items:center}
  .as-toc a::before,html.as-shell .toc a::before{top:50%;transform:translateY(-50%);font-size:12px}

  /* Article body: comfortable mobile reading */
  html.as-shell.as-has-hero .article-body{padding:24px 18px;border-radius:8px;margin:18px 0}
  html.as-shell.as-has-hero .article-body p{font-size:16.5px;line-height:1.78;margin-bottom:18px}
  html.as-shell.as-has-hero .article-body h2{font-size:22px;margin:36px 0 14px;padding-left:14px}
  html.as-shell.as-has-hero .article-body h2::before{width:3px}
  html.as-shell.as-has-hero .article-body h3{font-size:18px;margin:24px 0 10px}
  html.as-shell.as-has-hero .article-body .lead{font-size:17px;padding:18px 0 18px 18px;margin-bottom:24px;line-height:1.5}
  html.as-shell.as-has-hero .article-body .lead::before{font-size:54px;left:8px;top:0}
  html.as-shell.as-has-hero .article-body .lead + p::first-letter{font-size:44px;padding:4px 8px 0 0}

  /* Skip link: usable on mobile */
  .as-skip:focus{left:12px;top:12px;font-size:13px;padding:12px 16px}
}

/* Very small phones (≤375px) */
@media(max-width:375px){
  .as-wrap,html.as-shell.as-has-hero .wrap{padding:0 14px 40px}
  .as-hero h1,html.as-shell.as-has-hero .page-header h1{font-size:24px}
  html.as-shell.as-has-hero .article-body{padding:20px 16px}
  .as-meta,html.as-shell.as-has-hero .page-header .meta-strip{font-size:10px;gap:10px}
}

@media print{
  .as-progress,.as-hero,.as-toc,.as-skip{display:none!important}
  .as-wrap{display:block;max-width:780px}
}
/* ---------- Related guides strip (auto-injected on cluster pages) ---------- */
.as-related{
  max-width:1180px;margin:48px auto 64px;padding:0 24px;
  font-family:'Inter','IBM Plex Serif',Georgia,serif;
}
.as-related-title{
  font-family:'Playfair Display',Georgia,serif;
  font-size:28px;font-weight:700;color:#0B1B2B;margin:0 0 20px;
  letter-spacing:-.01em;
}
.as-related-grid{
  list-style:none;padding:0;margin:0;
  display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:16px;
}
.as-related-grid a{
  display:flex;flex-direction:column;gap:10px;
  padding:20px;border:1px solid rgba(11,27,43,.12);border-radius:12px;
  background:#fff;text-decoration:none;color:#0B1B2B;
  transition:transform .15s ease, box-shadow .15s ease, border-color .15s ease;
  min-height:140px;
}
.as-related-grid a:hover,.as-related-grid a:focus-visible{
  transform:translateY(-2px);
  box-shadow:0 12px 28px -16px rgba(11,27,43,.25);
  border-color:#D4A84B;
  outline:none;
}
.as-related-cat{
  font-family:'Barlow Condensed',Inter,sans-serif;
  text-transform:uppercase;letter-spacing:.12em;font-size:11px;font-weight:700;
  color:#D4A84B;
}
.as-related-headline{
  font-family:'Playfair Display',Georgia,serif;font-size:18px;line-height:1.3;font-weight:600;
  color:#0B1B2B;flex:1;
}
.as-related-cta{
  font-family:'Inter',sans-serif;font-size:13px;font-weight:600;color:#D4A84B;
}
@media(max-width:768px){
  .as-related{margin:32px auto 48px;padding:0 16px}
  .as-related-title{font-size:22px;margin-bottom:14px}
  .as-related-grid{grid-template-columns:1fr;gap:12px}
  .as-related-grid a{min-height:0;padding:16px}
  .as-related-headline{font-size:16px}
}

/* ===== Floating "Next Article" CTA (Substack-style) ===== */
.as-next-cta{
  position:fixed;right:20px;bottom:20px;z-index:9998;
  display:flex;align-items:center;gap:12px;
  max-width:340px;padding:12px 16px;
  background:#0B1F3A;color:#fff;text-decoration:none;
  border:1px solid rgba(212,168,75,.45);
  border-radius:12px;
  box-shadow:0 12px 32px rgba(7,21,38,.35),0 2px 6px rgba(0,0,0,.18);
  font-family:'Inter',system-ui,sans-serif;
  transition:transform .18s ease, box-shadow .18s ease, opacity .25s ease;
  opacity:1;
}
.as-next-cta:hover,.as-next-cta:focus-visible{
  transform:translateY(-2px);
  box-shadow:0 16px 40px rgba(7,21,38,.45),0 4px 10px rgba(0,0,0,.22);
  outline:none;
  border-color:#E8700A;
}
.as-next-eye{
  font-family:'Barlow Condensed',sans-serif;
  font-size:11px;font-weight:700;letter-spacing:.18em;text-transform:uppercase;
  color:#D4A84B;display:block;
}
.as-next-title{
  font-family:'Playfair Display',Georgia,serif;
  font-size:14px;line-height:1.25;font-weight:600;color:#fff;
  display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;
}
.as-next-cta > span:not(.as-next-arrow){display:flex;flex-direction:column;gap:2px;flex:1;min-width:0;}
.as-next-arrow{
  font-size:20px;color:#E8700A;font-weight:700;flex-shrink:0;
  transition:transform .18s ease;
}
.as-next-cta:hover .as-next-arrow{transform:translateX(3px)}
.as-next-hidden{opacity:0;pointer-events:none;transform:translateY(8px)}
.as-next-dismiss{
  position:absolute;top:-8px;right:-8px;
  width:24px;height:24px;border-radius:50%;
  background:#0B1F3A;color:#fff;border:1px solid rgba(212,168,75,.55);
  font-size:14px;line-height:1;font-weight:700;
  display:flex;align-items:center;justify-content:center;
  cursor:pointer;padding:0;
  box-shadow:0 4px 10px rgba(0,0,0,.3);
  transition:transform .15s ease, background .15s ease;
}
.as-next-dismiss:hover,.as-next-dismiss:focus-visible{
  background:#E8700A;transform:scale(1.08);outline:none;
}
.as-next-cta{position:fixed}
@media(max-width:768px){
  .as-next-cta{right:12px;bottom:12px;left:12px;max-width:none;padding:10px 14px}
  .as-next-title{font-size:13px;-webkit-line-clamp:1}
  .as-next-dismiss{top:-10px;right:-2px;width:28px;height:28px;font-size:16px}
}
@media print{ .as-next-cta{display:none!important} }

/* ===== Reading time badge ===== */
.as-read-time--standalone{
  position:relative;display:inline-block;
  font-family:'Barlow Condensed',sans-serif;
  font-size:12px;letter-spacing:.18em;text-transform:uppercase;
  color:#D4A84B;margin:0 0 14px;
  padding:4px 12px;border:1px solid rgba(212,168,75,.35);border-radius:2px;
  background:rgba(212,168,75,.05);
}

/* ===== "Was this helpful?" feedback widget ===== */
.as-feedback{
  max-width:1180px;margin:24px auto 56px;padding:0 24px;
  font-family:'Inter',system-ui,sans-serif;
}
.as-feedback-inner{
  background:#FAF7F2;border:1px solid #E5E0D5;border-radius:12px;
  padding:24px 28px;text-align:center;
}
.as-feedback-q{
  font-family:'Playfair Display',Georgia,serif;
  font-size:20px;font-weight:600;color:#0B1F3A;margin:0 0 16px;
}
.as-feedback-btns{display:flex;justify-content:center;gap:12px;flex-wrap:wrap}
.as-feedback-btn{
  font-family:'Inter',sans-serif;font-size:15px;font-weight:600;
  background:#fff;color:#0B1F3A;border:1.5px solid #0B1F3A;
  padding:12px 24px;border-radius:8px;cursor:pointer;
  min-height:48px;min-width:120px;
  transition:transform .15s ease, background .15s ease, color .15s ease;
}
.as-feedback-btn:hover,.as-feedback-btn:focus-visible{
  background:#0B1F3A;color:#fff;transform:translateY(-1px);outline:none;
}
.as-feedback-thanks{
  font-family:'IBM Plex Serif',Georgia,serif;font-size:15px;
  color:#2A6049;margin:0;font-style:italic;
}
@media(max-width:768px){
  .as-feedback{margin:16px auto 40px;padding:0 16px}
  .as-feedback-inner{padding:20px 18px}
  .as-feedback-q{font-size:17px}
  .as-feedback-btn{flex:1;min-width:0;padding:14px 18px;font-size:14px}
}
@media print{ .as-feedback{display:none!important} }

/* 👎 reason capture */
.as-feedback-reason{margin-top:14px;text-align:left}
.as-feedback-reason-label{display:block;font-family:var(--as-ui);font-size:13px;font-weight:600;color:var(--as-muted);margin-bottom:6px}
.as-feedback-reason-row{display:flex;gap:8px;align-items:stretch}
.as-feedback-reason-input{flex:1;min-width:0;padding:12px 14px;font-family:var(--as-ui);font-size:15px;color:var(--as-text);background:#fff;border:1.5px solid var(--as-border);border-radius:8px;outline:none}
.as-feedback-reason-input:focus{border-color:var(--as-orange);box-shadow:0 0 0 3px rgba(232,112,10,.18)}
.as-feedback-reason-btn{flex:0 0 auto;padding:12px 18px;font-family:var(--as-ui);font-size:14px;font-weight:700;color:#fff;background:var(--as-navy);border:0;border-radius:8px;cursor:pointer;transition:background .15s}
.as-feedback-reason-btn:hover,.as-feedback-reason-btn:focus-visible{background:var(--as-orange)}
.as-feedback-reason-thanks{margin:10px 0 0;font-family:var(--as-ui);font-size:14px;color:var(--as-green);font-weight:600}
@media (max-width:520px){
  .as-feedback-reason-row{flex-direction:column}
  .as-feedback-reason-btn{padding:14px 18px;min-height:48px}
  .as-feedback-reason-input{min-height:48px}
}
