@font-face {
  font-family: "Looseleaf Pencil";
  src: url(fonts/notebook.ttf) format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Cedarville";
  src: url(fonts/cursive.ttf) format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

/* Each letter can take three shapes as its neighbors change. Keep the pen
   genuinely single-weight instead of asking the browser to manufacture bold. */
html[data-edition=pencil] {
  --hand: "Looseleaf Pencil", "Bradley Hand", cursive;
  --body: var(--hand);
  --her-hand: "Cedarville", "Snell Roundhand", cursive;
  font-synthesis: none;
  font-variant-ligatures: common-ligatures contextual;
}

[data-edition=pencil] .brand {
  font: 400 42px/.9 var(--hand);
  letter-spacing: -.045em;
}

[data-edition=pencil] .edition {
  font: 400 24px/.9 var(--hand);
}

[data-edition=pencil] .dateline {
  font: 400 clamp(22px, 1.8vw, 27px)/1 var(--hand);
  letter-spacing: 0;
  transform: rotate(-1.25deg);
  transform-origin: 0 50%;
}

[data-edition=pencil] .cover .dateline {
  font: 400 clamp(35px, 3.2vw, 49px)/.85 var(--hand);
  margin-bottom: .48em;
  transform: rotate(-4deg);
}

html[data-edition=pencil] .volume h1,
html[data-edition=pencil] .volume:not(.cover) h1 {
  font: 400 clamp(46px, 5vw, 74px)/.88 var(--hand);
  letter-spacing: -.032em;
  margin-bottom: .3em;
  transform: rotate(-1deg);
  transform-origin: left bottom;
  filter: url(#written-ink);
}

html[data-edition=pencil] .cover h1 {
  font-size: clamp(84px, 8.5vw, 121px);
  line-height: .83;
}

[data-edition=pencil] .cover h1 em {
  transform: rotate(-2deg);
}

[data-edition=pencil] .cover h1 em:after {
  transform: rotate(-1.2deg);
  border-width: 1.6px;
}

html[data-edition=pencil] .volume :is(#copy, #excerpt) > p,
html[data-edition=pencil] .volume :is(#copy, #excerpt) .shaurya-words > p,
html[data-edition=pencil] .volume:not(.cover) :is(#copy, #excerpt) .shaurya-words > p {
  font: 400 clamp(28px, 2.2vw, 33px)/1.05 var(--body);
  letter-spacing: -.012em;
  word-spacing: -.035em;
  color: #37372f;
  margin: 0 0 .49em;
  overflow-wrap: break-word;
}

[data-edition=pencil] .cover #copy { max-width: 405px; }
[data-edition=pencil] .words #copy > p:first-child { transform: rotate(-.35deg); }
[data-edition=pencil] .signature { font: 400 39px/1 var(--hand); }
[data-edition=pencil] figcaption { font: 400 clamp(25px, 2.3vw, 34px)/1 var(--hand); }
[data-edition=pencil] .next { font: 400 29px/.95 var(--hand); }
[data-edition=pencil] :is(.back, .quiet) { font: 400 25px/1 var(--hand); }
[data-edition=pencil] #page-list strong { font: 400 27px/.92 var(--hand); }
[data-edition=pencil] .dialog-head h2 { font: 400 43px/1 var(--hand); }

/* The return hand has joined strokes, a higher shoulder on the h, and a
   darker blue ink. Preserve the same contrast in graphite and on small screens. */
[data-edition=pencil] .ishika-words { color: #344e68; }
html[data-edition=pencil] .volume:not(.cover) :is(#copy, #excerpt) .ishika-words .quote-text {
  font: 400 clamp(21px, 1.52vw, 25px)/1.28 var(--her-hand);
  color: #344e68;
  letter-spacing: -.018em;
  overflow-wrap: break-word;
}
[data-edition=pencil] .shaurya-words .speaker {
  font: 400 26px/.97 var(--hand);
  color: #704236;
  letter-spacing: -.02em;
  transform: rotate(-1deg);
  transform-origin: left bottom;
}
[data-edition=pencil] .ishika-words .speaker {
  font: 400 20px/1.2 var(--her-hand);
  color: #344e68;
  letter-spacing: 0;
  text-transform: none;
}

@media(max-width:640px) {
  [data-edition=pencil] .brand { font-size: 36px; }
  [data-edition=pencil] .edition { font-size: 22px; }
  [data-edition=pencil] .cover .dateline { font-size: 32px; margin-bottom: 10px; }
  html[data-edition=pencil] .volume:not(.cover) h1 { font-size: clamp(42px, 11vw, 59px); }
  html[data-edition=pencil] .cover h1 { font-size: clamp(62px, 16vw, 80px); }
  html[data-edition=pencil] .volume :is(#copy, #excerpt) > p,
  html[data-edition=pencil] .volume :is(#copy, #excerpt) .shaurya-words > p,
  html[data-edition=pencil] .volume:not(.cover) :is(#copy, #excerpt) .shaurya-words > p {
    font-size: 28px;
    line-height: 1.025;
  }
  [data-edition=pencil] .signature { font-size: 32px; }
  [data-edition=pencil] .next { font-size: 25px; }
  [data-edition=pencil] :is(.back, .quiet) { font-size: 22px; }
}
