/* ===== テーマ ===== */
:root, [data-theme="dark"] {
  --ground: #151516;
  --ink: #ECE8E1;
  --muted: #A39F98;
  --rule: #3A3A3C;
  --tile-edge: rgba(255, 255, 255, 0.07);
  --tile-shadow: 0 14px 36px rgba(0, 0, 0, 0.55);
  color-scheme: dark;
}
[data-theme="light"] {
  --ground: #FAF9F7;
  --ink: #1F1E1C;
  --muted: #5E5A54;
  --rule: #D9D6D0;
  --tile-edge: rgba(0, 0, 0, 0.05);
  --tile-shadow: 0 10px 26px rgba(0, 0, 0, 0.14);
  color-scheme: light;
}

/* ===== 基本 ===== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: "Shippori Mincho", "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", serif;
  font-feature-settings: "palt" 0;
  line-height: 1.7;
}
a { color: var(--ink); }
a:hover { color: var(--muted); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
img { max-width: 100%; display: block; }
.latin { font-family: "EB Garamond", "Shippori Mincho", serif; }
.muted { color: var(--muted); }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.page {
  max-width: 1440px;
  margin: 0 auto;
  padding: 56px 72px 96px;
}
@media (max-width: 1023px) { .page { padding: 40px 32px 72px; } }
@media (max-width: 699px)  { .page { padding: 28px 20px 56px; } }

/* ===== ヘッダー ===== */
.site-header {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 24px;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 28px;
  margin-bottom: 40px;
}
.site-header .org { font-size: 17px; color: var(--muted); letter-spacing: 0.02em; margin: 0 0 10px; }
.site-header .org a { color: inherit; text-decoration: none; }
.site-header .org a:hover { color: var(--ink); }
.site-header h1 { margin: 0; font-size: 44px; font-weight: 600; letter-spacing: 0.08em; line-height: 1.2; }
.site-header nav { display: flex; gap: 32px; font-size: 16px; }
.site-header nav a { text-decoration: none; }
.header-tools { display: flex; align-items: center; gap: 32px; flex-shrink: 0; }
@media (max-width: 699px) {
  .site-header { margin-bottom: 24px; padding-bottom: 18px; }
  .site-header .org { font-size: 12px; margin-bottom: 8px; }
  .site-header h1 { font-size: 30px; }
  .site-header nav { display: none; }
}

/* ===== 絞り込み ===== */
.filters { display: flex; flex-direction: column; gap: 16px; margin-bottom: 40px; }
.filter-row { display: flex; align-items: center; gap: 20px; }
.filter-row .filter-label { width: 72px; flex-shrink: 0; font-size: 14px; color: var(--muted); }
.chips { display: flex; gap: 10px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 44px; padding: 0 18px;
  border: 1px solid var(--ink); border-radius: 999px;
  background: transparent; color: var(--ink);
  font: inherit; font-size: 15px; cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--ink); color: var(--ground); }
.swatch {
  position: relative; width: 20px; height: 20px; border-radius: 3px; flex-shrink: 0;
  background: var(--sw-bg);
}
.swatch::after {
  content: ""; position: absolute; left: 4px; top: 4px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--sw-fg);
}
@media (max-width: 699px) {
  .filters { gap: 12px; margin-bottom: 24px; }
  .filter-row { flex-direction: column; align-items: flex-start; gap: 8px; }
  .filter-row .filter-label { width: auto; font-size: 13px; }
  .chips { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; padding-bottom: 4px; }
  .chip { flex-shrink: 0; font-size: 14px; padding: 0 16px; }
}

/* ===== 一覧 ===== */
.browse { display: flex; gap: 64px; align-items: flex-start; }
.works { flex-grow: 1; min-width: 0; }
.count { font-size: 14px; color: var(--muted); margin: 0 0 20px; }
.count-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin: 0 0 20px; }
.count-row .count { margin: 0; }
.active-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.active-filters[hidden] { display: none; }
.active-filter {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 32px; padding: 0 12px;
  border: 1px solid var(--ink); border-radius: 999px;
  background: transparent; color: var(--ink);
  font: inherit; font-size: 13px; cursor: pointer;
}
.empty { padding: 80px 0; font-size: 18px; color: var(--muted); }
.grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 44px 32px;
  list-style: none; margin: 0; padding: 0;
}
@media (max-width: 1023px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 36px 24px; } }
@media (max-width: 699px)  { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px 18px; } }

.tile { display: flex; flex-direction: column; gap: 14px; text-decoration: none; color: var(--ink); }
.tile:hover { color: var(--ink); }
.tile-art-link, .tile-art-link > .tile-art { display: block; }
.tile-art-link, .tile-title { color: var(--ink); text-decoration: none; }
.tile-art-link:hover, .tile-title:hover { color: var(--ink); }
.meta-link { color: inherit; text-decoration: none; }
.meta-link:hover { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.tile-art {
  position: relative; width: 100%; aspect-ratio: 1 / 1; overflow: hidden;
  border-radius: 6px;
  background: var(--t-bg);
  box-shadow: inset 0 0 0 1px var(--tile-edge), var(--tile-shadow);
}
.tile-art::after {
  content: ""; position: absolute; left: 11%; top: 11%; width: 78%; height: 78%;
  border-radius: 50%; background: var(--t-fg);
}
.tile[aria-current="true"] .tile-art { outline: 2px solid var(--ink); outline-offset: 5px; }
@media (max-width: 1023px) { .tile[aria-current="true"] .tile-art { outline: none; } }
.tile-cap { display: flex; flex-direction: column; gap: 4px; }
.tile-title { font-size: 18px; font-weight: 600; letter-spacing: 0.04em; line-height: 1.4; }
.tile-meta { font-size: 13px; color: var(--muted); }
@media (max-width: 699px) {
  .tile { gap: 10px; }
  .tile-title { font-size: 16px; }
  .tile-meta { font-size: 12px; }
}

/* ===== 選択中の作品（デスクトップのみ） ===== */
.preview {
  width: 380px; flex-shrink: 0;
  position: sticky; top: 40px;
  display: flex; flex-direction: column; gap: 28px;
}
@media (max-width: 1023px) { .preview { display: none; } }
.preview-issue { display: flex; gap: 20px; align-items: flex-end; }
.preview-issue img { width: 176px; height: auto; box-shadow: var(--tile-shadow); }
.issue-meta { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); padding-bottom: 4px; }
.issue-meta strong { font-size: 16px; color: var(--ink); font-weight: 600; }
.preview-body { display: flex; flex-direction: column; gap: 14px; border-top: 1px solid var(--rule); padding-top: 24px; }
.preview-body h2 { margin: 0; font-size: 32px; font-weight: 600; letter-spacing: 0.06em; line-height: 1.35; }
.facts { display: grid; grid-template-columns: 64px minmax(0, 1fr); row-gap: 8px; font-size: 15px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.synopsis { margin: 8px 0 0; font-size: 15px; line-height: 1.9; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 22px;
  border: 1px solid var(--ink);
  text-decoration: none; font-size: 15px; letter-spacing: 0.06em;
}
.btn-primary { background: var(--ink); color: var(--ground); }
.btn-primary:hover { color: var(--ground); opacity: 0.85; }

/* ===== 収録誌一覧 ===== */
.issues { margin-top: 96px; border-top: 1px solid var(--rule); padding-top: 40px; }
.issues h2 { margin: 0 0 32px; font-size: 28px; font-weight: 600; letter-spacing: 0.08em; }
.issue-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 40px 48px; list-style: none; margin: 0; padding: 0; }
.issue-card { display: flex; gap: 20px; align-items: flex-end; }
.issue-card img { width: 140px; height: auto; box-shadow: var(--tile-shadow); }
.issue-card .issue-meta a { color: var(--ink); min-height: 32px; display: inline-flex; align-items: center; }

/* ===== 作品ページ ===== */
.work-top { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 40px; }
.back { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; text-decoration: none; font-size: 15px; }
.back svg { width: 16px; height: 16px; }
.work-hero { display: grid; grid-template-columns: minmax(0, 420px) minmax(0, 1fr); gap: 56px; align-items: end; margin-bottom: 56px; }
.work-hero .tile-art { border-radius: 8px; }
.work-head { display: flex; flex-direction: column; gap: 16px; }
.work-head h1 { margin: 0; font-size: 44px; font-weight: 600; letter-spacing: 0.06em; line-height: 1.3; }
@media (max-width: 699px) {
  .work-top { margin-bottom: 20px; }
  .work-hero { grid-template-columns: 1fr; gap: 28px; margin-bottom: 40px; }
  .work-head h1 { font-size: 30px; }
}

.reader-bar { display: flex; justify-content: space-between; align-items: center; gap: 16px; border-top: 1px solid var(--rule); padding-top: 24px; margin-bottom: 32px; }
.reader-bar h2 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: 0.08em; }
.toggle { display: inline-flex; border: 1px solid var(--ink); border-radius: 999px; overflow: hidden; }
.toggle button {
  min-height: 40px; padding: 0 16px; border: 0; background: transparent; color: var(--ink);
  font: inherit; font-size: 14px; cursor: pointer;
}
.toggle button[aria-pressed="true"] { background: var(--ink); color: var(--ground); }

.text { font-size: 18px; line-height: 2; letter-spacing: 0.02em; }
.text p { margin: 0; }
/* 空行：全角スペース1字の「中身のある1行」として描くので、横書き・縦書きとも本文1行分の空きになる。
   連続していればその数だけ空く */
.text p.blank::before { content: "\3000"; }
.text ruby rt { font-size: 0.5em; }
.text.vertical .tcy { text-combine-upright: all; -webkit-text-combine: horizontal; }
.text.horizontal { max-width: 36em; margin: 0 auto; }
.text.horizontal .text-head { display: none; }
/* 縦書き：本文欄の幅にきっちり収め、欄の中だけを横にスクロールする */
.text-frame { position: relative; }
.text.vertical {
  writing-mode: vertical-rl;
  width: 100%; max-width: 100%;
  height: min(75vh, 44em);
  overflow-x: auto; overflow-y: hidden;
  line-height: 1.9;
  padding: 16px 20px 20px;
}
.text-head { margin-block-end: 1.9em; }
.text-head p { margin: 0; }
.text-title { font-size: 1.4em; font-weight: 600; letter-spacing: 0.08em; }
.text-author { font-size: 0.95em; text-align: end; }
.text-frame::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 40px;
  background: linear-gradient(to right, var(--ground), transparent);
  pointer-events: none; opacity: 0; transition: opacity 0.2s;
}
.text-frame.has-more::after { opacity: 1; }
@media (max-width: 699px) { .text { font-size: 17px; } }
.text-note { max-width: 36em; margin: 40px auto 0; color: var(--muted); font-size: 15px; }

.work-issue { margin-top: 80px; border-top: 1px solid var(--rule); padding-top: 32px; display: flex; flex-direction: column; gap: 40px; }
.siblings h2 { margin: 0 0 16px; font-size: 16px; font-weight: 400; color: var(--muted); }
.siblings .grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 32px 20px; }
@media (max-width: 1023px) { .siblings .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 699px)  { .siblings .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px 12px; } .siblings .tile-title { font-size: 13px; } .siblings .tile-meta { display: none; } }

.notice { padding: 80px 0; font-size: 18px; }

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
