:root {
  color-scheme: only light;
  --paper: #fff9ef;
  --ink: #302523;
  --hover-brown: #594944;
  --hover-tint: #eadfce;
  --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(--ink); outline-offset: 3px; }
.wrap { width: min(1112px, calc(100% - var(--edge) * 2)); margin-inline: auto; }

/* プロフィールと共通ボタン */
.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;
  gap: .45em;
  min-height: 44px;
  margin-top: 15px;
  padding: 8px 19px;
  border-radius: 9999px;
  background: var(--ink);
  color: var(--paper);
  font-weight: 700;
  text-decoration: none;
}
.action-button svg {
  flex: none;
  width: 1.125em;
  height: 1.125em;
  fill: currentColor;
}
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; }

.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%; }
.work-preview {
  height: clamp(32px, 6vw, 60px);
  aspect-ratio: auto;
  mask-image: linear-gradient(to bottom, rgb(0 0 0 / 80%) 0%, transparent 100%);
}
.work-preview img { height: auto; aspect-ratio: 1 / 1.14; }
.more-works { display: flex; width: fit-content; margin-inline: auto; border: 0; }

/* ブログとフッター */
.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; }

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));
  --controls-space: 0px;
  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: calc(100% - var(--controls-space));
  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-loading-icon { display: none; width: 24px; height: 24px; fill: currentColor; }
.reader-status.is-loading .reader-loading-icon { display: block; }
.reader-status.is-loading .reader-status-text {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.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) - var(--controls-space) - 24px);
  max-height: calc(100dvh - var(--top-space) - var(--bottom-space) - var(--controls-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; }
.reader-pointer-open .reader-icon.close:focus-visible { outline: none; }
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; }
  .books > h2, .blog h2, .works > h2 { font-size: 1.8rem; }
  .works { margin-top: 25px; }
  .reader {
    --arrow-size: 44px;
    --close-inset: max(4px, env(safe-area-inset-top));
    --controls-inset: max(4px, env(safe-area-inset-bottom));
    --controls-space: calc(var(--arrow-size) + var(--controls-inset) + 4px);
    --top-space: calc(var(--arrow-size) + var(--close-inset) + 4px);
    --side-space: max(8px, env(safe-area-inset-left), env(safe-area-inset-right));
    --bottom-space: 4px;
  }
  .reader-icon.close {
    top: var(--close-inset);
    width: var(--arrow-size);
    height: var(--arrow-size);
  }
  .reader-icon:is(.previous, .next) {
    top: auto;
    bottom: var(--controls-inset);
    width: var(--arrow-size);
    height: var(--arrow-size);
    border: 6px solid transparent;
    background-clip: padding-box;
    transform: none;
  }
  .reader-icon:is(.previous, .next) svg { width: 20px; height: 20px; }
  .reader-icon.previous { left: max(12px, env(safe-area-inset-left)); }
  .reader-icon.next { right: max(12px, env(safe-area-inset-right)); }
}

@media (max-width: 680px), (max-width: 1024px) and (max-height: 480px) and (pointer: coarse) {
  .work-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 500px) {
  .books-grid {
    /* Match the cover proportions so all three have the same height. */
    grid-template-columns: minmax(0, 359fr) minmax(0, 346fr) minmax(0, 313fr);
    max-width: none;
  }
  .book-cover { height: auto; }
  .book-cover img { width: 100%; max-height: none; }
}
