:root {
  color-scheme: only light;
  --paper: #fff9ef;
  --ink: #302523;
  --hover-brown: #594944;
  --hover-tint: #eadfce;
  --sand: #f5eee0;
  --accent: #e00078;
  --edge: clamp(16px, 5vw, 65px);
  --gallery-gap: clamp(7px, 1.2vw, 14px);
  font-family: "Zen Kaku Gothic New", "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  color: var(--ink);
  background-color: var(--paper);
  line-height: 1.65;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background-color: var(--paper); color: var(--ink); }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
img { display: block; max-width: 100%; }
h1, h2, p { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.wrap { width: min(1112px, calc(100% - var(--edge) * 2)); margin-inline: auto; }
.skip { position: absolute; z-index: 3; left: 10px; top: 10px; background: var(--paper); padding: 8px; translate: 0 -160%; }
.skip:focus { translate: 0; }

.masthead { display: flex; align-items: end; padding-block: clamp(24px, 5vw, 56px) 9px; }
.brand { display: flex; align-items: center; gap: 7px; font-size: clamp(1.6rem, 3.5vw, 2.45rem); letter-spacing: -.045em; line-height: 1.15; }
.brand img { flex: 0 0 auto; object-fit: contain; mix-blend-mode: multiply; }
.about { padding-block: 4px clamp(23px, 3.7vw, 38px); }
.about p { max-width: 46rem; font-size: 1rem; line-height: 1.8; }
.social { display: flex; align-items: center; gap: 2px; margin-top: 6px; margin-left: -10px; }
.icon-link, .reader-icon {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  padding: 0;
  color: var(--ink);
  background: transparent;
  text-decoration: none;
}
.icon-link { border-radius: 50%; }
.icon-link svg { width: 20px; height: 20px; fill: currentColor; }
.action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin-top: 15px;
  padding: 8px 19px;
  border-radius: 6px;
  background: var(--ink);
  color: var(--paper);
  font-weight: 700;
  text-decoration: none;
}
section { scroll-margin-block: 18px; }

.books > h2, .blog h2, .works > h2 { margin-bottom: 14px; font-family: "Abril Fatface", Georgia, serif; font-size: clamp(1.3rem, 2.4vw, 1.85rem); font-weight: 400; line-height: 1.25; letter-spacing: .025em; }
.books-grid { --book-gap: calc(var(--gallery-gap) * 3); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--book-gap); max-width: calc(3 * 137px + 2 * var(--book-gap)); }
.book { display: grid; align-content: start; gap: 5px; text-decoration: none; }
.book-cover { display: flex; align-items: end; height: clamp(106px, 30vw, 190px); margin-bottom: 2px; }
.book-cover img { width: auto; height: auto; max-width: 100%; max-height: 100%; }
.book h3 { margin: 0; font-size: clamp(.85rem, 2.1vw, 1.03rem); line-height: 1.35; }
.book span { font-size: .79rem; }

.blog { max-width: 720px; margin-bottom: clamp(30px, 5vw, 54px); }
.blog-posts { padding: 0; margin: 0; list-style: none; }
.blog-posts a { display: flex; align-items: baseline; gap: .75rem; min-height: 44px; padding: 10px 0; font-weight: 700; text-decoration: none; }
.blog-post-date { flex: 0 0 auto; font-size: .75rem; font-weight: 400; font-variant-numeric: tabular-nums; }
.blog-status { font-size: .88rem; }

.works { margin-block: 37px clamp(48px, 7vw, 82px); }
.work-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gallery-gap); }
.work { display: block; width: 100%; aspect-ratio: 1 / 1.14; position: relative; border: 0; padding: 0; overflow: hidden; background-color: #fff; }
.work img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 20%; }

footer { font-family: inherit; font-size: .875rem; padding-block: 14px 26px; text-align: right; }

.reader {
  --side-space: 72px;
  --top-space: max(56px, env(safe-area-inset-top));
  --bottom-space: max(12px, env(safe-area-inset-bottom));
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  color: var(--ink);
  background: transparent;
}
.reader::backdrop { background: rgb(255 249 239 / 88%); }
.reader-stage {
  width: 100%;
  height: 100%;
  padding: var(--top-space) var(--side-space) var(--bottom-space);
  overflow: hidden;
  touch-action: pan-y pinch-zoom;
}
.reader-status { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); max-width: 80%; padding: 8px 12px; background: var(--paper); border-radius: 6px; font-size: .88rem; text-align: center; pointer-events: none; }
.reader-stage:focus-visible { outline-offset: -3px; }
.reader-pages { display: grid; place-items: center; grid-template: minmax(0, 1fr) / minmax(0, 1fr); height: 100%; }
.reader-pages img { width: auto; height: auto; max-width: 100%; max-height: 100%; min-width: 0; min-height: 0; object-fit: contain; background: #fff; }
.reader-multiple .reader-stage {
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}
.reader-multiple .reader-stage::-webkit-scrollbar { display: none; }
.reader-multiple .reader-pages { height: auto; grid-template-rows: none; gap: 13px; }
.reader-multiple .reader-pages img {
  width: auto;
  height: auto;
  max-width: min(100%, 760px);
  max-height: calc(100vh - var(--top-space) - var(--bottom-space) - 24px);
  max-height: calc(100dvh - var(--top-space) - var(--bottom-space) - 24px);
}

.reader-icon { position: absolute; width: 56px; height: 56px; border-radius: 50%; }
.reader-icon:active { background: #e9e1d4; }
.reader-icon svg { width: 28px; height: 28px; fill: currentColor; }
.reader-icon.close { top: max(6px, env(safe-area-inset-top)); right: max(10px, env(safe-area-inset-right)); }
.reader-icon.previous, .reader-icon.next { top: var(--image-center, 50%); transform: translateY(-50%); }
.reader-icon.previous { left: max(6px, env(safe-area-inset-left), calc(var(--image-left, 66px) - 60px)); }
.reader-icon.next { right: max(6px, env(safe-area-inset-right), calc(var(--image-right, 66px) - 60px)); }
.reader-icon.on-image { background-color: #fff9efe8; }
body:has(.reader[open]) { overflow: hidden; }

@media (hover: hover) {
  :is(.book:hover h3, .blog-posts a:hover span) { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .18em; }
  :is(.icon-link, .reader-icon):hover { background-color: var(--hover-tint); }
  .action-button:hover { background-color: var(--hover-brown); }
  :is(.book:hover .book-cover img, .work:not(:disabled):hover img) { opacity: .8; }
}
.action-button:active { background-color: #080403; }

@media (max-width: 680px) {
  .masthead { padding-bottom: 6px; }
  .brand img { width: 43px; height: 30px; }
  .work-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .works { margin-top: 25px; }
  .reader { --side-space: max(9px, env(safe-area-inset-left), env(safe-area-inset-right)); }
}
