/* Issue 39 private sizing + front-box fix. Loaded last. Do not deploy to prod without Glenn's go.
   Palette: #FBF8F0 #F7F3E8 #0A1628 #7a1f2b #C9A44C
   Body ~23px, nothing under 17px. Front mast 54/100, inner 50/88 on desktop and print.
   Phone: fill the viewport, readable type, true phone PDF page size. */

/* ===== Vote now button + replacement bar (same footprint as old .con39) ===== */
a.vote-now{
  display:inline-block;
  background:#C9A44C;
  color:#0A1628 !important;
  font:800 18px/1.15 "Roboto Condensed","DejaVu Sans",sans-serif !important;
  letter-spacing:.06em;
  text-transform:uppercase;
  text-decoration:none !important;
  padding:7px 14px;
  margin:6px 0 0 8px;
  border:0;
  white-space:nowrap;
  box-sizing:border-box;
}
#front .mv39 p.mv39-d a.vote-now{margin:8px 0 0;display:inline-block}
.con39.bye39cta{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px 14px;
  flex-wrap:wrap;
  background:#0A1628;
  color:#FBF8F0;
  border-left:8px solid #C9A44C;
  padding:6px 12px;
  font-size:19px !important;
  line-height:1.3 !important;
  margin:8px 0;
  box-sizing:border-box;
}
.con39.bye39cta .bye39cta-text{flex:1 1 220px;min-width:0;color:#FBF8F0;font-size:19px !important;line-height:1.3 !important}
.con39.bye39cta .vote-now{margin:0;flex:0 0 auto}
@media print{
  .con39.bye39cta{margin:3px 0 2px !important;padding:6px 12px !important;flex-wrap:nowrap}
  #front .mv39 p.mv39-d a.vote-now{margin:4px 0 0 8px;padding:5px 12px;font-size:17px !important}
}

/* ===== Desktop / print masthead = Issue 38 ===== */
#front .fmast{
  display:grid !important;
  grid-template-columns:100px 1fr 100px !important;
  gap:16px !important;
  align-items:center !important;
  justify-items:center !important;
}
#front .fmast .nm{text-align:center !important;min-width:0 !important}
#front .fmast .nm h1,
#front .fmast .nm h1.paper{
  font-size:54px !important;
  letter-spacing:.022em !important;
  white-space:nowrap !important;
  overflow:visible !important;
  text-align:center !important;
  margin:0 !important;
}
#front .fmast img,
#front .fmast img.coin-left,
#front .fmast img.coin-right{
  width:100px !important;
  height:100px !important;
  flex:0 0 100px !important;
  object-fit:contain !important;
  display:block !important;
}
header.mast{
  display:flex !important;
  align-items:center !important;
  justify-content:space-between !important;
  gap:8px !important;
}
header.mast img.badge,
header.mast img.coin-left,
header.mast img.coin-right{
  width:88px !important;
  height:88px !important;
  flex:0 0 88px !important;
  object-fit:contain !important;
}
header.mast .names{flex:1;text-align:center;min-width:0}
header.mast h1.paper{
  font:700 50px/1 "DejaVu Serif",Georgia,serif !important;
  letter-spacing:.03em !important;
  white-space:nowrap !important;
  text-align:center !important;
  margin:0 !important;
}

/* ===== Screen typography: body 23px, floor 17px ===== */
@media screen{
  section.page .body p:not(.src):not(.cr39):not(.kick36):not(.kicker):not(.byline):not(.clayref39),
  section.page .body li:not(.src),
  section.page p.deck,
  #front .mv39 p.mv39-d,
  #front .mv39 p.q39,
  p.q39,
  .cols2-39 p:not(.src),
  .det39 p:not(.src),
  .dcard39 p:not(.src):not(.byline),
  .dlead39 p:not(.src):not(.byline),
  .fill39 p,
  .slots39 li, .slots39 li b,
  .flow-2col li, .flow-2col li a, .flow-2col td, .flow-2col th,
  .grid37 p,
  .wsplit38 p.li36{
    font-size:23px !important;
    line-height:1.45 !important;
  }
  section.page .src, section.page p.src, section.page figcaption,
  section.page .kicker, section.page .kick36, section.page .cr39,
  section.page .foot-toprow, section.page .engage, section.page .pn,
  section.page .adlabel, section.page .cont-line, section.page .byline,
  section.page .clayref39{
    font-size:17px !important;
    line-height:1.35 !important;
  }
  .con39.bye39cta, .con39.bye39cta .bye39cta-text{
    font-size:19px !important;
    line-height:1.3 !important;
  }
  a.vote-now{font-size:18px !important}
}

/* ===== Phone / tablet: fill the screen, keep type readable, fix candidate row ===== */
@media screen and (max-width:860px){
  html, body{
    width:100% !important;
    max-width:100% !important;
    margin:0 !important;
    overflow-x:hidden !important;
  }
  body{padding:0 0 12px !important}
  section.page, section.page#front, #front.page{
    width:100% !important;
    max-width:100% !important;
    height:auto !important;
    min-height:0 !important;
    margin:0 0 14px !important;
    padding:14px 14px 18px !important;
    overflow:visible !important;
    box-sizing:border-box !important;
  }
  /* Compact the site pin so the paper fills the phone */
  #tdw-current-issue-pin{
    padding:6px 10px !important;
    gap:6px 10px !important;
    font-size:15px !important;
    line-height:1.25 !important;
  }
  #tdw-current-issue-pin .tdw-pin-cover{width:28px !important;height:36px !important}

  /* Candidate row: 3-across grid so portraits aren't squeezed off the row */
  #front .mv39-row{
    display:grid !important;
    grid-template-columns:repeat(3,minmax(0,1fr)) !important;
    gap:8px !important;
    align-items:start !important;
  }
  #front .mv39-row .g,
  #front .mv39-row .g.r{
    display:contents !important;
  }
  #front .mv39-row .lg{
    grid-column:1 / -1 !important;
    flex:none !important;
    width:auto !important;
    margin:2px auto 4px !important;
  }
  #front .mv39-row .t{
    flex:none !important;
    width:auto !important;
    min-width:0 !important;
  }
  #front .mv39-row .t img{width:100% !important;height:auto !important;aspect-ratio:4/5;object-fit:cover !important}

  /* Phone masthead: same shrink Issue 38 uses, so the title fits; coins both sides, centred */
  #front .fmast{
    display:grid !important;
    grid-template-columns:48px 1fr 48px !important;
    gap:8px !important;
    padding:2px 0 !important;
  }
  #front .fmast img,
  #front .fmast img.coin-left,
  #front .fmast img.coin-right{
    width:48px !important;
    height:48px !important;
    flex:0 0 48px !important;
  }
  #front .fmast .nm h1,
  #front .fmast .nm h1.paper{
    font-size:28px !important;
    letter-spacing:.02em !important;
    white-space:normal !important;
    line-height:1.05 !important;
  }
  header.mast{
    display:grid !important;
    grid-template-columns:44px 1fr 44px !important;
    gap:6px !important;
  }
  header.mast img.badge,
  header.mast img.coin-left,
  header.mast img.coin-right{
    width:44px !important;
    height:44px !important;
    flex:0 0 44px !important;
  }
  header.mast h1.paper{
    font-size:22px !important;
    white-space:normal !important;
    line-height:1.1 !important;
  }
  .con39.bye39cta{flex-wrap:wrap}
  a.vote-now{font-size:18px !important;padding:8px 16px}
}

/* Slightly tighter mast only on the narrowest phones, still above the old 26/40 shrink */
@media screen and (max-width:340px){
  #front .fmast{grid-template-columns:40px 1fr 40px !important;gap:6px !important}
  #front .fmast img, #front .fmast img.coin-left, #front .fmast img.coin-right{
    width:40px !important;height:40px !important;flex:0 0 40px !important
  }
  #front .fmast .nm h1.paper{font-size:24px !important}
}

/* ===== True phone-sized PDF (html.phonepdf) ===== */
html.phonepdf, html.phonepdf body{
  background:#fff !important;
  margin:0 !important;
  padding:0 !important;
  width:auto !important;
}
html.phonepdf #tdw-current-issue-pin{display:none !important}
html.phonepdf section.page,
html.phonepdf section.page#front,
html.phonepdf #front.page{
  width:auto !important;
  max-width:none !important;
  height:auto !important;
  min-height:0 !important;
  margin:0 !important;
  padding:14px 16px 28px !important;
  overflow:visible !important;
  box-shadow:none !important;
  box-sizing:border-box !important;
  page-break-after:always;
  break-after:page;
}
html.phonepdf section.page .foot{
  position:static !important;
  left:auto !important;right:auto !important;bottom:auto !important;
  width:100% !important;
  margin-top:14px !important;
}
html.phonepdf #front .mv39-row{
  display:grid !important;
  grid-template-columns:repeat(3,minmax(0,1fr)) !important;
  gap:8px !important;
}
html.phonepdf #front .mv39-row .g,
html.phonepdf #front .mv39-row .g.r{display:contents !important}
html.phonepdf #front .mv39-row .lg{grid-column:1 / -1 !important;margin:2px auto 4px !important}
html.phonepdf #front .mv39-row .t{width:auto !important;min-width:0 !important}
html.phonepdf #front .fmast{
  display:grid !important;
  grid-template-columns:56px 1fr 56px !important;
  gap:8px !important;
  justify-items:center !important;
}
html.phonepdf #front .fmast img,
html.phonepdf #front .fmast img.coin-left,
html.phonepdf #front .fmast img.coin-right{
  width:56px !important;height:56px !important;
}
html.phonepdf #front .fmast .nm h1.paper{
  font-size:28px !important;
  white-space:normal !important;
  text-align:center !important;
}
html.phonepdf header.mast{
  display:grid !important;
  grid-template-columns:48px 1fr 48px !important;
  gap:6px !important;
}
html.phonepdf header.mast img.badge,
html.phonepdf header.mast img.coin-left,
html.phonepdf header.mast img.coin-right{width:48px !important;height:48px !important}
html.phonepdf header.mast h1.paper{font-size:24px !important;white-space:normal !important}
html.phonepdf section.page .body p:not(.src):not(.cr39):not(.kick36):not(.kicker):not(.byline),
html.phonepdf #front .mv39 p.mv39-d,
html.phonepdf #front .mv39 p.q39{
  font-size:23px !important;
  line-height:1.45 !important;
}
html.phonepdf section.page .src,
html.phonepdf section.page figcaption,
html.phonepdf section.page .kicker,
html.phonepdf section.page .cr39,
html.phonepdf section.page .foot-toprow,
html.phonepdf section.page .engage{
  font-size:17px !important;
}
html.phonepdf .wsplit38 .wcols{grid-template-columns:1fr !important}
html.phonepdf .wsplit38 .wl{border-right:0 !important;padding-right:0 !important}
html.phonepdf .cols2-39, html.phonepdf .claycols39, html.phonepdf .dlist39, html.phonepdf .more39 ul{column-count:1 !important}
html.phonepdf .dgrid39{grid-template-columns:1fr !important}
html.phonepdf figure, html.phonepdf img{max-width:100% !important;height:auto !important}

@media print{
  @page{margin:0}
  html.phonepdf @page{size:390px 844px;margin:0}
  html.phonepdf section.page,
  html.phonepdf section.page#front,
  html.phonepdf #front.page{
    width:390px !important;
    max-width:390px !important;
    height:auto !important;
    overflow:visible !important;
    margin:0 !important;
    padding:14px 16px 28px !important;
    box-shadow:none !important;
  }
}

/* Beat styles.css html:is(#i36h,html) 640px 40px/26px shrink */
@media screen and (max-width:860px){
  html:is(#i36h,html) section:is(#i36x,#front) .fmast,
  html:is(html) section:is(#front) .fmast{
    display:grid !important;
    grid-template-columns:48px 1fr 48px !important;
    gap:8px !important;
  }
  html:is(#i36h,html) section:is(#i36x,#front) .fmast img,
  html:is(#i36h,html) section:is(#i36x,#front) .fmast img.coin-left,
  html:is(#i36h,html) section:is(#i36x,#front) .fmast img.coin-right{
    width:48px !important;height:48px !important;flex:0 0 48px !important;position:static !important;
  }
  html:is(#i36h,html) section:is(#i36x,#front) .fmast .nm h1.paper,
  html:is(#i36h,html) section:is(#i36x,#front) .fmast .nm h1{
    font-size:28px !important;white-space:normal !important;letter-spacing:.02em !important;line-height:1.08 !important;
  }
  html:is(#i36h,html) section.page header.mast img.badge,
  html:is(#i36h,html) section.page header.mast img.coin-left,
  html:is(#i36h,html) section.page header.mast img.coin-right{
    width:44px !important;height:44px !important;flex:0 0 44px !important;
  }
  html:is(#i36h,html) section.page header.mast h1.paper{
    font-size:22px !important;white-space:normal !important;
  }
  /* Coin first, then a clean 3×3 of the nine candidates */
  html:is(html) section:is(#front) .mv39-row .lg,
  #front .mv39-row .lg{grid-column:1/-1 !important;grid-row:1 !important}
}

@media screen and (max-width:860px){
  html:is(#i36h,html) section:is(#i36x,#front) .fmast .nm .tag,
  html:is(#i36h,html) section:is(#i36x,#front) .fmast .nm .dt{
    white-space:normal !important;letter-spacing:0 !important;font-size:17px !important;
  }
  section.page .foot-toprow, #front .foot-toprow{
    white-space:normal !important;flex-wrap:wrap !important;
  }
  section.page .engage, section.page .founders39{white-space:normal !important;overflow-wrap:anywhere !important}
  #contents table.toc{width:100% !important;table-layout:fixed !important}
  #contents table.toc td, #contents table.toc td.sec, #contents table.toc td.sec a, #contents table.toc td.blurb{
    white-space:normal !important;overflow-wrap:anywhere !important;
  }
}

/* Paul baseline (LIVE, m390.json): ~1/3 of P/LI character count was 17–19px.
   On phone and tablet, bring all body paragraph and list text to 23px.
   Metadata stays at the 17px floor. Beats html:is(#z39…) 18/19px rules. */
@media screen and (max-width:860px){
  html:is(#z39,html) section.page p,
  html:is(#z39,html) section.page li,
  html:is(#i36h,html) section.page p,
  html:is(#i36h,html) section.page li,
  html:is(html) section.page p,
  html:is(html) section.page li,
  html section.page p,
  html section.page li{
    font-size:23px !important;
    line-height:1.45 !important;
  }
  html:is(#z39,html) section.page p.src,
  html:is(#z39,html) section.page p.src a,
  html:is(#z39,html) section.page p.cr39,
  html:is(#z39,html) section.page p.byline,
  html:is(#z39,html) section.page p.kicker,
  html:is(#z39,html) section.page p.kick36,
  html:is(#z39,html) section.page p.credit,
  html:is(#z39,html) section.page p.ph-credit,
  html:is(#z39,html) section.page p.cont-line,
  html:is(#z39,html) section.page p.clayref39,
  html:is(#i36h,html) section.page p.src,
  html:is(#i36h,html) section.page p.src a,
  html:is(#i36h,html) section.page p.cr39,
  html:is(#i36h,html) section.page p.byline,
  html:is(#i36h,html) section.page p.kicker,
  html:is(#i36h,html) section.page p.kick36,
  html:is(#i36h,html) section.page p.clayref39,
  html section.page p.src,
  html section.page p.src a,
  html section.page p.cr39,
  html section.page p.byline,
  html section.page p.kicker,
  html section.page p.kick36,
  html section.page p.credit,
  html section.page p.cont-line,
  html section.page p.clayref39,
  html section.page figcaption,
  html section.page figcaption *{
    font-size:17px !important;
    line-height:1.35 !important;
  }
}

/* Same 23px body paragraphs in the true phone PDF */
html.phonepdf section.page p,
html.phonepdf section.page li,
html.phonepdf:is(#z39,html) section.page p,
html.phonepdf:is(#z39,html) section.page li{
  font-size:23px !important;
  line-height:1.45 !important;
}
html.phonepdf section.page p.src,
html.phonepdf section.page p.src a,
html.phonepdf section.page p.cr39,
html.phonepdf section.page p.byline,
html.phonepdf section.page p.kicker,
html.phonepdf section.page p.kick36,
html.phonepdf section.page p.credit,
html.phonepdf section.page p.cont-line,
html.phonepdf section.page p.clayref39,
html.phonepdf section.page figcaption,
html.phonepdf section.page figcaption *{
  font-size:17px !important;
  line-height:1.35 !important;
}

/* Catch remaining article paragraphs/lists still stuck at 18–22px
   (detours, door leads, ward-box items, Burford column). Metadata classes excluded. */
@media screen and (max-width:860px){
  html:is(#z39,html) section.page .body p:not(.src):not(.srcin):not(.cr39):not(.byline):not(.kicker):not(.kick36):not(.clayref39):not(.wcm39):not(.wco39):not(.claysig39):not(.credit):not(.cont-line):not(.z1):not(.z2):not(.z3):not(.z4):not(.z5),
  html:is(#z39,html) section.page[id] .body p:not(.src):not(.srcin):not(.cr39):not(.byline):not(.kicker):not(.kick36):not(.clayref39):not(.wcm39):not(.wco39):not(.claysig39):not(.credit):not(.cont-line):not(.z1):not(.z2):not(.z3):not(.z4):not(.z5),
  html:is(#z39,html) section.page[id^="burford"] .body p:not(.src):not(.byline):not(.kick36):not(.claysig39):not(.clayref39):not(.z1):not(.z2):not(.z3):not(.z4):not(.z5),
  html:is(#z39,html) section.page:is(#detours,#detours2) .body .det39 p:not(.src):not(.z1):not(.z2):not(.z3):not(.z4):not(.z5),
  html:is(#z39,html) section.page .body .det39 p:not(.src):not(.z1):not(.z2):not(.z3):not(.z4):not(.z5),
  html:is(#z39,html) section.page .body .dlead39 p:not(.src):not(.byline):not(.z1):not(.z2):not(.z3):not(.z4),
  html:is(#z39,html) section.page .body .dcard39 p:not(.src):not(.byline):not(.z1):not(.z2):not(.z3):not(.z4),
  html:is(#z39,html) section.page .body li:not(.z1):not(.z2):not(.z3),
  html:is(#z39,html) section.page[id^="ward"] .wbx39 li,
  html:is(#z39,html) section.page .body .more39 li:not(.z1):not(.z2),
  html:is(#z39,html) section.page .cols2-39 p:not(.src),
  html:is(#z39,html) section.page p.deck{
    font-size:23px !important;
    line-height:1.45 !important;
  }
}
html.phonepdf:is(#z39,html) section.page .body p:not(.src):not(.srcin):not(.cr39):not(.byline):not(.kicker):not(.kick36):not(.clayref39):not(.wcm39):not(.wco39):not(.claysig39):not(.credit):not(.cont-line):not(.z1):not(.z2):not(.z3):not(.z4):not(.z5),
html.phonepdf:is(#z39,html) section.page .body li:not(.z1):not(.z2):not(.z3),
html.phonepdf:is(#z39,html) section.page:is(#detours,#detours2) .body .det39 p:not(.src):not(.z1):not(.z2):not(.z3):not(.z4):not(.z5),
html.phonepdf:is(#z39,html) section.page .body .dlead39 p:not(.src):not(.byline):not(.z1):not(.z2):not(.z3):not(.z4),
html.phonepdf:is(#z39,html) section.page .body .dcard39 p:not(.src):not(.byline):not(.z1):not(.z2):not(.z3):not(.z4),
html.phonepdf:is(#z39,html) section.page[id^="ward"] .wbx39 li{
  font-size:23px !important;
  line-height:1.45 !important;
}
@media screen and (max-width:860px){
  html:is(#z39,html) section.page[id^="ward"] ol.wi39 li:not(#q1):not(#q2):not(#q3),
  html:is(#z39,html) section.page[id^="ward"] .wmore39 li:not(#q1):not(#q2):not(#q3){
    font-size:23px !important;
    line-height:1.35 !important;
  }
}
html.phonepdf:is(#z39,html) section.page[id^="ward"] ol.wi39 li:not(#q1):not(#q2):not(#q3){
  font-size:23px !important;
  line-height:1.35 !important;
}

/* ===== Print letter: stretch last house box to close bottom gaps ===== */
@media print {
  html:not(.phonepdf) section.page{
    display:flex !important;
    flex-direction:column !important;
  }
  html:not(.phonepdf) section.page .body{
    flex:1 0 auto !important;
    display:flex !important;
    flex-direction:column !important;
  }
  html:not(.phonepdf) section.page > .fill39,
  html:not(.phonepdf) section.page .body > .fill39:last-child,
  html:not(.phonepdf) section.page .body > .signup36:last-child{
    flex:1 0 auto !important;
    display:flex !important;
    flex-direction:column !important;
    justify-content:center !important;
    box-sizing:border-box !important;
  }
}
