@font-face {
  font-family: Ehon;
  src: url("assets/maru-medium.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: Ehon;
  src: url("assets/maru-bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: Ehon;
  src: url("assets/maru-black.woff2") format("woff2");
  font-weight: 900;
  font-display: swap;
}
:root {
  color-scheme: light;
  font-family: Ehon, "Hiragino Maru Gothic ProN", "Hiragino Sans", sans-serif;
  font-weight: 500;
  color: #382f29;
  background: #d9d3c4;
  --paper: #fcf7e9;
  --green: #294b45;
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
a { color: inherit; }
a:focus-visible { outline: 3px solid #eca963; outline-offset: 3px; }
.viewer {
  margin: auto;
  max-width: 1550px;
  background: var(--paper);
}
.ready .viewer {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
#book { flex: 1; display: grid; min-width: 0; }
.spread {
  display: grid;
  grid-template-columns: 57% minmax(0, 1fr);
  min-width: 0;
  min-height: 69vh;
  background: var(--paper);
}
.ready .spread { min-height: 0; }
.art-leaf, .word-leaf { display: flex; align-items: center; min-width: 0; }
.art-leaf {
  padding: 21px max(3.55%, 12px);
  justify-content: center;
  background: var(--mat);
}
.art-leaf img {
  display: block;
  width: 100%;
  height: auto;
  outline: 4px solid #fdf7e7;
}
.word-leaf {
  padding: 30px clamp(18px, 2.7vw, 42px) 30px clamp(20px, 3.9vw, 61px);
  background: linear-gradient(90deg, #e9e1d1 0, var(--paper) 9px);
}
.passage { width: 100%; }
.passage h1, .passage h2, .passage p { margin: 0; }
.passage h1, .passage h2 { color: var(--ink); line-height: 1.35; }
.passage h1 { font-weight: 900; font-size: clamp(2rem, 5.6vw, 5.2rem); letter-spacing: -.035em; }
.passage h2 { font-size: clamp(1.4rem, 3.15vw, 2.9rem); font-weight: 700; }
.passage p {
  font-size: clamp(1.08rem, 2.34vw, 2.15rem);
  line-height: 1.52;
  line-break: strict;
  overflow-wrap: break-word;
}
.passage h2 + p { margin-top: .9em; }
.passage p + p { margin-top: .55em; }
.passage p span { display: block; }
.passage .subtitle {
  margin-top: 1.16em;
  font-size: clamp(1.14rem, 2.5vw, 2.3rem);
  line-height: 1.65;
  font-weight: 700;
}
.passage :focus { outline: 0; }
.toolbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 9px max(env(safe-area-inset-right), 3vw) max(env(safe-area-inset-bottom), 9px) max(env(safe-area-inset-left), 3vw);
  background: var(--green);
  color: #f9f1dc;
}
.toolbar nav { display: flex; justify-content: flex-end; align-items: center; gap: 14px; }
.toolbar a { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; }
.pdf-link { white-space: nowrap; font-weight: 700; font-size: 15px; text-underline-offset: .23em; }
.turn {
  min-width: 88px;
  padding: 7px 19px;
  border: 1px solid #829b8e;
  border-radius: 99px;
  text-decoration: none;
  font-weight: 700;
  line-height: 1.2;
}
.turn.primary { color: #24473e; background: #fbf1d9; border-color: #fbf1d9; }
.turn:hover { border-color: #f3dfaa; }
.turn.primary:hover { background: #fff8e8; }
#position { text-align: center; min-width: 57px; font-size: 14px; font-variant-numeric: tabular-nums; }
@media (orientation: landscape) and (max-height: 500px) {
  .art-leaf { padding-block: 10px; }
  .art-leaf img { max-height: calc(100svh - 87px); width: auto; max-width: 100%; object-fit: contain; }
  .word-leaf { padding-block: 14px; }
  .passage p { font-size: clamp(16px, min(2.34vw, 4.9vh), 24px); line-height: 1.36; }
  .passage h2 { font-size: clamp(21px, 3.1vw, 30px); }
  .passage p + p { margin-top: .32em; }
  .toolbar { padding-block: 5px; }
}
@media (orientation: portrait) {
  .spread { display: block; }
  .art-leaf { padding: 14px 6vw; }
  .art-leaf img { max-height: 40svh; width: auto; max-width: 100%; object-fit: contain; }
  .word-leaf { background: var(--paper); padding: 26px 8vw 32px; }
  .passage h1 { font-size: clamp(38px, 8vw, 68px); }
  .passage h2 { font-size: clamp(24px, 5.2vw, 36px); }
  .passage p, .passage .subtitle { font-size: clamp(19px, 3.9vw, 27px); }
  .toolbar { position: sticky; bottom: 0; gap: 7px; padding-inline: max(env(safe-area-inset-left), 12px) max(env(safe-area-inset-right), 12px); }
  .toolbar nav { gap: 7px; }
  .turn { min-width: 62px; padding-inline: 12px; }
  .pdf-link, #position { font-size: 13px; }
  #position { min-width: 44px; }
}
