/* 作品詳細ページ（works/〇〇/）。build.js が生成する。色と書体はトップと同じ。地には薄い6列の線（一覧のカタログと揃える） */
:root {
  --bg: #E6E6E6;
  --ink: #000F00;
  --ash: #7A857D;
  --line: rgba(0, 15, 0, .14);
  --jp: "游ゴシック体", YuGothic, "Yu Gothic Medium", "游ゴシック Medium", "Yu Gothic", "Hiragino Kaku Gothic ProN", sans-serif;
  --en: "Josefin Sans", "游ゴシック体", YuGothic, "Yu Gothic Medium", "Yu Gothic", sans-serif;
  --pad: clamp(16px, 2.2vw, 32px);
}
/* IKUSHINAI? など、背景を真っ黒にする作品（works.js の theme: "black"） */
body.is-black { --bg: #000; --ink: #E6E6E6; --line: rgba(230, 230, 230, .16); }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--jp); font-weight: 500; font-size: 13px; line-height: 1.75; -webkit-font-smoothing: antialiased; }
img, video { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
h1, p, dl, dd { margin: 0; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

/* 上部バー（トップと同じ並び。マークは左上） */
.bar { position: sticky; top: 0; z-index: 20; display: grid; grid-template-columns: auto 3fr 3fr 4fr 2fr; gap: 16px; align-items: center; padding: 14px var(--pad); background: var(--bg); font-family: var(--en); font-size: 10px; font-weight: 600; letter-spacing: .04em; line-height: 1.5; text-transform: uppercase; }
.bar ul { list-style: none; margin: 0; padding: 0; }
.bar nav { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.bar nav, .bar__ext { font-size: 12px; }
.bar nav a:hover, .bar__ext:hover { border-bottom: 1px solid currentColor; }
.bar__ext { justify-self: end; white-space: nowrap; }
.bar__mark img { height: 46px; width: auto; }
body.is-black .bar__mark img { filter: invert(1) brightness(1.6); }

/* 地の線：6列 */
.wk { position: relative; padding: 0 var(--pad) 64px; background-image: repeating-linear-gradient(to right, transparent 0 calc(100% / 6 - 1px), var(--line) calc(100% / 6 - 1px) calc(100% / 6)); }

.wk__head { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0 var(--pad); padding: clamp(40px, 7vw, 96px) 0 clamp(32px, 5vw, 64px); }
.wk__count { grid-column: 1 / -1; font-family: var(--en); font-weight: 600; font-size: 12px; letter-spacing: .04em; margin-bottom: 18px; }
.wk__title { grid-column: 1 / span 4; font-family: var(--jp); font-weight: 700; font-size: clamp(32px, 5vw, 84px); line-height: 1.12; letter-spacing: -.01em; overflow-wrap: anywhere; }
.wk__meta { grid-column: 5 / -1; align-self: end; font-size: 12px; line-height: 1.6; }
.wk__meta div { display: grid; grid-template-columns: 4.5em 1fr; gap: 8px; padding: 8px 0; border-top: 1px solid var(--ink); }
.wk__meta div:last-child { border-bottom: 1px solid var(--ink); }
.wk__meta dt { font-family: var(--en); font-weight: 600; letter-spacing: .03em; }
.wk__meta a { border-bottom: 1px solid currentColor; }
.wk__desc { grid-column: 1 / span 4; margin-top: 24px; max-width: 36em; font-size: 14px; }

/* 画像：縦長・正方形は2列、横長は全幅。どちらも切らずに全体を見せる */
.wk__media { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(16px, 2.4vw, 40px); }
.wk__media figure { margin: 0; display: grid; place-items: center; }
.wk__media .is-wide { grid-column: 1 / -1; }
.wk__media img, .wk__media video { max-height: 90vh; max-height: 90svh; width: auto; }
.wk__media .is-wide img { width: 100%; max-height: none; }

/* タイル（works.js で tile: true の作品）：正方形の枠に全体を収めて4列。横長は2列分。全部同じ比率の作品は build.js が --tile-ratio でその比率の枠にする */
.wk__media--tile { grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-flow: dense; gap: clamp(12px, 1.6vw, 24px); }
.wk__media--tile figure { position: relative; aspect-ratio: var(--tile-ratio, 1 / 1); min-width: 0; overflow: hidden; }
.wk__media--tile img { position: absolute; inset: 0; width: 100%; height: 100%; max-height: none; object-fit: contain; }
.wk__media--tile .is-wide { grid-column: span 2; aspect-ratio: 2 / 1; }
@media (max-width: 1100px) { .wk__media--tile { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.wk__cta { margin-top: 40px; font-family: var(--jp); font-weight: 700; font-size: clamp(20px, 2.4vw, 32px); }
.wk__cta a { border-bottom: 2px solid currentColor; }

/* 前後の作品 */
.wk__pager { display: grid; grid-template-columns: 1fr auto 1fr; gap: var(--pad); align-items: start; margin-top: clamp(56px, 8vw, 120px); padding-top: 14px; border-top: 1px solid var(--ink); }
.wk__pager a { display: block; }
.wk__pager small { display: block; font-family: var(--en); font-weight: 600; font-size: 11px; letter-spacing: .04em; }
.wk__pager b { display: block; font-size: clamp(14px, 1.4vw, 20px); line-height: 1.4; }
.wk__pager .next { text-align: right; }
.wk__pager .all { font-family: var(--en); font-weight: 600; font-size: 12px; letter-spacing: .04em; border-bottom: 1px solid currentColor; }
.wk__pager a:hover b { text-decoration: underline; text-underline-offset: 4px; }

.foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; padding: 24px var(--pad); border-top: 1px solid var(--ink); font-family: var(--en); font-size: 12px; font-weight: 600; letter-spacing: .04em; }
.foot nav { display: flex; gap: 18px; }

@media (max-width: 800px) {
  .bar { grid-template-columns: auto 1fr; row-gap: 8px; }
  .bar__ext { grid-row: 1; grid-column: 2; }
  .bar nav { grid-row: 2; grid-column: 1 / -1; }
  .bar nav { gap: 2px 14px; }
  .bar__col { display: none; }
  .bar__mark img { height: 36px; }
  .wk { background-image: repeating-linear-gradient(to right, transparent 0 calc(50% - 1px), var(--line) calc(50% - 1px) 50%); }
  .wk__title, .wk__meta, .wk__desc { grid-column: 1 / -1; }
  .wk__meta { margin-top: 24px; }
  .wk__media { grid-template-columns: 1fr; }
  .wk__media img, .wk__media video { width: 100%; max-height: none; }
  .wk__pager { grid-template-columns: 1fr 1fr; }
  .wk__pager .all { grid-column: 1 / -1; grid-row: 2; justify-self: center; }
}

/* 幅の狭いスマホ：メニューを1行に収める */
@media (max-width: 380px) {
  .bar nav { gap: 2px 10px; }
}

/* タイルはスマホで2列（上の 800px の1列指定より後に置く） */
@media (max-width: 800px) { .wk__media--tile { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
