@import url("https://fonts.googleapis.com/css2?family=Cinzel+Decorative&Raleway:wght@200&family=Noto+Serif+JP:wght@200;300;400;500;600;700;800;900&family=Raleway+Dots&display=swap");

:root {
  --wp-line-height: 1.4rem;
  font-size: 3.175mm;
  line-height: var(--wp-line-height);

  --wp-content-area-height: 65rem;
  --wp-extend-into-margin-dist: 2mm;

  --max-img-height: calc(var(--wp-line-height) * 14);
}

body {
  background-color: aliceblue;
  font-family: "Noto Serif JP", serif;
  font-size: 9pt;
  font-weight: 300;
  overflow-wrap: break-word;
}

@page {
  margin-top: 2.8rem; /* 2 * 1.4 */
  margin-bottom: 12.7mm; /* calc(
      var(--pagedjs-pagebox-height) - 
      var(--wp-top-margin-height) -
      var(--wp-content-area-height)
    ); */
  /* size: A5; */
  size: 6in 9in;
}

/* prettier-ignore */
@page:left{
    margin-right: 18mm;
    margin-left: 12mm;
  
    @bottom-left {
      content: counter(page);
    }
    @bottom-right {
      content: attr(data-article-title);
    }
  }
/* prettier-ignore */
@page:right {
    margin-right: 12mm;
    margin-left: 18mm;
  
    @bottom-right {
      content: counter(page);
    }
    @bottom-left {
      content: attr(data-article-title);
    }
  }

.pagedjs_margin-bottom-right,
.pagedjs_margin-bottom-left {
  /* move page number to the top of the margin box */
  align-items: flex-start !important;
}
* {
  margin-top: 0;
}

.not-ready {
  background-color: red !important;
}

.pagedjs_page {
  /* background: white; */
}

img {
  font-size: 80%;
  margin-bottom: -3px;
  max-height: var(--max-img-height);
  max-width: 40em;
  object-fit: contain;
  text-align: center;
  /* make photos print more punchy in B&W? */
  filter: saturate(0) contrast(1);
}
img,
.ril_caption {
  width: calc(100% + calc(var(--wp-extend-into-margin-dist) * 2));
  margin-left: calc(var(--wp-extend-into-margin-dist) * -1);
}

p,
div,
p strong,
p em {
  line-height: calc(var(--wp-line-height) * 1);
}
code {
  line-height: 1rem;
}
p {
  margin-bottom: calc(var(--wp-line-height) * 1);
  orphans: 3;
  widows: 3;
  transform: translateY(3px);
}

a {
  border-bottom: 1px #cacaca solid;
  color: black;
  text-decoration: none;
}
hr {
  --hr-height: 1px;
  border: 0;
  height: var(--hr-height);
  background-image: linear-gradient(
    to right,
    rgba(0, 0, 0, 0),
    rgba(0, 0, 0, 0.75),
    rgba(0, 0, 0, 0)
  );
  margin-bottom: calc(var(--wp-line-height) * 1 - var(--hr-height));
}
hr ~ hr {
  /* who puts in a double HR? lunatics! */
  display: none;
}
.star-break {
  width: 100%;
  display: block;
  text-align: center;
}

ol,
ul {
  padding-left: 1em;
  margin-bottom: calc(var(--wp-line-height) * 1);
}

pre {
  font-size: 70%;
  border-right: 2px dashed silver;
  /* display: block; */
  margin: 0;
}

pre code {
  overflow-wrap: initial;
}

p code {
  overflow-wrap: break-word;
}

ol.printOnly {
  border-top: 0.3mm solid silver;
  font-size: 80%;
  margin-left: -1em;
  /* margin-right: -1em; */
  margin-top: 1em;
  padding: 0;
}

li.printed-link {
  break-inside: avoid;
  line-height: calc(var(--wp-line-height) * 0.8);
  margin-bottom: calc(var(--wp-line-height) * 0.2);
  margin-left: 1.2em;
  max-height: calc(var(--wp-line-height) * 1);
  widows: 2;
  orphans: 2;
}
img.pond-icon {
  height: 1rem;
  width: 1rem;
  display: inline;
  margin: initial;
  transform: translateY(0.3rem) scale(1.9);
}

blockquote {
  border-left: 1px solid hsla(0, 0%, 0%, 0.2);
  font-family: "Raleway", sans-serif;
  font-size: 110%;
  margin-bottom: calc(var(--wp-line-height) * 1);
  margin-left: calc(var(--wp-extend-into-margin-dist) * -1);
  margin-right: 0;
  padding-left: 1mm;
  transform: translateY(4px);
  width: calc(100% + calc(var(--wp-extend-into-margin-dist) * 2));
}
blockquote p {
  transform: none;
}
blockquote cite {
  font-size: 80%;
  font-style: initial;
  font-weight: bold;
}

ul li {
  list-style-type: "— "; /* M dash as a bullet. ⁘ ⁕ ⁍ ⚊ are tempting too.*/
  transform: translateY(3px);
}
blockquote ul li {
  transform: translateY(0);
}

figure {
  width: 100%;
  margin: 0;
}

.the-articles > article {
  column-count: 2;
  column-gap: 5mm;
  column-fill: auto;
  /* height: 782.389px; */
  height: calc(
    (
        var(--pagedjs-pagebox-height) - var(--pagedjs-margin-top) -
          var(--pagedjs-margin-bottom)
      ) * 0.999
  );
  margin-bottom: calc(
    (var(--wp-line-height) * 2) - 3px
  ); /* This doesn't always do what it's supposed to, but it leaves the 
        following article internally consistent, so it's fine for now. 
        It leaves the text in the columns matching across the columns, but it 
        breaks the vertical rythm.  
        It'll probably need some JS to snap to a gridline eventually, in the 
        very distant future.*/
}

/* article:first-of-type {
  break-before: always;
} */

article.has-code {
  column-count: 1;
}

span.time-to-read {
  display: inline-block;
}

.name-title {
  border-bottom: 0.5mm solid black;
  column-span: all;
  font-family: "Raleway Dots", cursive;
  font-size: calc(var(--wp-line-height) * 7);
  line-height: calc(var(--wp-line-height) * 8);
  padding-bottom: calc(var(--wp-line-height) * 1);
  padding-top: calc(var(--wp-line-height) * 1);
}
/* .owner {
  display: none;
} */

h1,
h2,
h3,
h4,
h5 {
  break-inside: avoid;
  font-family: "Raleway", sans-serif;
  page-break-inside: avoid;
  margin-bottom: calc(var(--wp-line-height) * 1);
}

h1 {
  font-size: 200%;
  transform: translateY(7px);
}
h2 {
  font-size: 165%;
}
h1,
h2 {
  line-height: calc(var(--wp-line-height) * 2);
}
h3,
h4,
h5 {
  line-height: var(--wp-line-height);
  transform: translateY(3px);
}

h1,
h2,
h3,
h4 {
  break-after: avoid;
}

h1 + p {
  break-before: avoid;
}

h1.article-title {
  column-span: all;
  display: block;
  font-family: "Cinzel Decorative";
  font-size: calc(var(--wp-line-height) * 2);
  margin-bottom: -0.3rem;
  margin-top: 0.5rem;
  page-break-inside: avoid;
  transform: none;
}
h1.article-title.mega-wordy-title {
  font-size: 165%;
  border-left: 1px solid black;
  border-right: 1px solid black;
  padding-left: 1rem;
  transform: translateY(2px);
}
h2 {
  line-height: var(--wp-line-height);
  margin-bottom: var(--wp-line-height);
  transform: translateY(1px);
}
h2 + p,
h3 + p,
h4 + p,
h5 + p {
  orphans: 3;
}

.break-before {
  page-break-before: always;
  break-before: column;
  background: antiquewhite;
}

.excerpt {
  border-bottom: 1px solid;
  border-top: 1px solid;
  font-size: 1.25em;
  margin-bottom: 1em;
  margin: 0.8em 0;
  padding: 0.5em 0;
}

.top-meta {
  column-span: all;
  display: block;
  font-size: 80%;
  line-height: var(--wp-line-height);
  margin-bottom: 14px;
}
.top-meta span {
  display: inline-block;
}

.tail-meta {
  font-size: 80%;
  line-height: var(--wp-line-height);
  min-height: 5rem;
  word-wrap: break-word;
}

/* .date {} */
span.url {
  display: inline-block;
  width: 13rem;
  vertical-align: top;
  orphans: 3;
  widows: 3;
}

.ril_caption,
figcaption {
  display: block;
  font-size: 70%;
}

#paper-story table {
  max-width: 50%;
}

table {
  border-bottom: 1px solid silver;
  border-top: 1px solid silver;
  column-span: all;
  margin-bottom: calc(var(--wp-line-height) * 0.5);
  margin-left: calc(-1 * var(--wp-extend-into-margin-dist));
  margin-right: 0;
  margin-top: calc(var(--wp-line-height) * 0.5);
  padding-bottom: calc(var(--wp-line-height) * 0.5);
  padding-top: calc(var(--wp-line-height) * 0.5);
  width: calc(100% + (var(--wp-extend-into-margin-dist) * 2));
}

td {
  padding-bottom: 1mm;
}

thead,
tfoot {
  break-inside: avoid;
  display: table-header-group;
}

.RIL_IMG {
  break-inside: avoid;
}

/* typography */
sup,
sub {
  font-size: 70%;
  position: relative;
  vertical-align: baseline;
  line-height: 0;
}
sup {
  top: -0.8em;
}
sub {
  top: 0.4em;
}

/* Ban list */
a:empty,
nav,
input[type="checkbox"],
p:empty {
  display: none;
}

@media screen {
  .pagedjs_page_content:before {
    background-image: url(../scale_bar.png);
    background-size: cover;
    content: " ";
    height: inherit;
    left: -20mm;
    opacity: 0.2;
    position: absolute;
    width: 20mm;
  }

  h1:before,
  h2:before,
  h3:before,
  h4:before,
  h5:before {
    background-color: hsla(180, 100%, 25%, 0.7);
    border-radius: 1rem;
    color: hotpink;
    content: attr(data-percentage-position);
    display: block;
    font-size: 1.5rem;
    font-weight: bolder;
    padding: 1rem;
    position: absolute;
    right: -4rem;
  }
  h1:after,
  h2:after,
  h3:after,
  h4:after,
  h5:after {
    content: " ";
    display: block;
    height: 0.1px;
    left: -32rem;
    outline: 1px solid hotpink;
    position: absolute;
    width: 600px;
  }
  .shim-div {
    outline: 3px solid orange;
    background-color: aqua;
  }
}
