/* 作品ページ：見出しの帯 → 札 → 中身を 1 列 → 相談のボタン → YouTube の赤いボタン → 次の作品 */

main[data-page="work"] {
  overflow-x: hidden;
  overflow-x: clip;
  padding-bottom: 1px;
  /* 地が青空になったので、白い文字が雲の上でも読めるように影を付ける */
  text-shadow: var(--shadow-text);
}
.work-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--work-bg);
}

/* ---- 見出しの帯（入る演出の最後の形と、位置・大きさ・切り抜きを同じにする） ---- */
.work-hero {
  position: relative;
  height: var(--hero-h);
  overflow: hidden;
  margin: 0;
}
.work-hero-inner {
  position: absolute;
  inset: 0;
  will-change: transform;
}
.work-hero-img {
  position: absolute;
  left: 50%;
  top: 50%;
  width: max(100%, calc(var(--hero-h) * 16 / 9));
  max-width: none;
  height: auto;
  aspect-ratio: 16 / 9;
  transform: translate(-50%, -50%);
}

/* ---- 帯の下の縁にかかる丸い札（曇りガラス） ---- */
.work-card {
  position: relative;
  z-index: 2;
  width: min(600px, 86vw);
  margin: -110px auto 0;
  padding: 32px 48px 36px;
  border-radius: 120px;
  text-align: center;
  background: rgba(255, 255, 255, 0.13);
  border: 1px solid rgba(255, 255, 255, 0.3);
  -webkit-backdrop-filter: blur(22px) saturate(1.3);
  backdrop-filter: blur(22px) saturate(1.3);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.25);
}
.work-meta { margin: 0; font-size: 14px; font-weight: 700; opacity: 0.92; }
.work-title { margin: 8px 0 0; font-size: 30px; line-height: 1.35; font-weight: 700; text-wrap: balance; }
.work-line { margin: 10px 0 0; font-size: 15px; line-height: 1.6; }
.work-line:empty { display: none; }

/* ---- 中身を 1 列（静止画と動画。並べ方は tools/make_work_pages.py が HTML に書き出す） ----
   横長は列の幅いっぱい、正方形は 66%、縦長は列の半分（縦長が続いたら .work-pair で 2 枚を横に並べる）。
   どれも --w（パソコン用の絵の幅・動画の幅。元の大きさより大きくない）を超えて引き伸ばさない。小さい素材は小さいまま真ん中に出る。
   絵は切り抜かず、元の比（--ar）のまま出す */
.work-body {
  width: min(1000px, 86vw);
  margin: 96px auto 0;
  display: grid;
  gap: 30px;
  justify-items: center;
}
.work-item {
  --fit: 100%;
  margin: 0;
  width: min(var(--fit), var(--w, 100%));
}
.work-item--square { --fit: 66%; }
.work-item--port { --fit: calc((100% - 30px) / 2); }
.work-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  width: 100%;
  justify-items: center;
}
.work-pair .work-item { --fit: 100%; }
.work-item-inner {
  border-radius: 16px;
  overflow: hidden;
  transform-origin: 50% 0;
  will-change: transform;
  background: rgba(255, 255, 255, 0.18);
}
.work-item img,
.work-item video {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: var(--ar, auto);
}
main[data-fill="sample"] .work-body { min-height: 62vh; align-content: start; }
.work-note {
  margin: 0;
  padding: 28px 24px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
  text-align: center;
  line-height: 1.8;
}

/* 本編を YouTube で見る：小さめで目立ちすぎない赤いボタン（パソコンとスマートフォンで同じ形）。住所の無い作品には置かない。
   その場で遊べる作品（今はコンビニと和菓子工場）は、横に黄色い「ゲームをプレイする」を並べる。狭い画面で入りきらなければ下へ折り返す */
.work-youtube { margin: 18px 0 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 14px; }
.work-youtube[hidden] { display: none; }
.work-youtube a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 20px 0 18px;
  border-radius: 999px;
  background: #e62117;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  text-shadow: none;
  box-shadow: 0 4px 14px rgba(21, 24, 30, 0.28);
}
.work-youtube svg { flex: none; }
.work-youtube a.work-play {
  padding: 0 22px;
  background: var(--yellow);
  color: var(--ink);
  box-shadow: 0 3px 0 var(--yellow-deep), 0 4px 14px rgba(21, 24, 30, 0.28);
}
.work-youtube a.work-play:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--yellow-deep), 0 3px 10px rgba(21, 24, 30, 0.26); }

/* この作品のような動画を相談する（13 作品すべて。住所は /contact/?work=<作品>。HTML は tools/make_work_pages.py が書く）。
   中身（.work-body）の最後の段に置き、YouTube の赤いボタンとゲームの黄色いボタンはこのすぐ下に並ぶ
   （YouTube に無い作品は、このすぐ下が次の作品）。白い板に --ink の字。赤・黄・緑はほかのボタンの色なので使わない */
.work-consult { margin: 42px 0 0; max-width: 100%; }      /* 中身の段の間（30px）と合わせて、絵から 72px 空ける */
.work-consult-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  min-height: 52px;
  padding: 10px 30px;
  border-radius: 999px;
  background: var(--white);
  color: var(--ink);
  font-size: 16px;
  font-weight: 800;
  line-height: 1.4;
  letter-spacing: 0.04em;
  text-align: center;
  text-decoration: none;
  text-shadow: none;
  word-break: auto-phrase;
  box-shadow: 0 3px 0 rgba(21, 24, 30, 0.2), 0 6px 18px rgba(21, 24, 30, 0.28);
}
.work-consult-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(21, 24, 30, 0.2), 0 3px 10px rgba(21, 24, 30, 0.26); }

/* ---- 次の作品 ---- */
.work-next { padding: 120px 0 110px; text-align: center; }
.work-next-label { margin: 0; font-size: 14px; letter-spacing: 0.12em; opacity: 0.85; }
.work-next-disc {
  position: relative;
  width: 340px;
  height: 340px;
  margin: 34px auto 0;
}
.work-next-body {
  position: absolute;
  inset: 0;
  display: block;
  clip-path: circle(50% at 50% 50%);
  background: rgba(255, 255, 255, 0.18);
}
.work-next-body img { width: 100%; height: 100%; object-fit: cover; }
.work-next-ring {
  position: absolute;
  inset: -10px;
  border: 1.5px solid var(--white);
  border-radius: 50%;
  pointer-events: none;
}
.work-next-push {
  position: absolute;
  width: 76px;
  height: 76px;
  left: calc(85.36% - 38px);
  top: calc(85.36% - 38px);
  font-size: 24px;
}
.work-next-meta { margin: 30px 0 0; font-size: 13px; font-weight: 700; opacity: 0.9; }
.work-next-title { margin: 6px 0 0; font-size: 26px; font-weight: 700; }

.work-foot {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  padding: 0 30px 16px;
  font-size: 12px;
}
.work-foot a, .work-foot span { display: block; padding: 0 10px; line-height: 44px; text-decoration: none; }

/* ---- 戻るボタン（黄色い丸） ---- */
.work-back {
  position: fixed;
  left: 40px;
  bottom: 40px;
  z-index: 30;
  width: 72px;
  height: 72px;
  transition: opacity var(--back-hide) ease, transform var(--back-hide) ease;
}
.work-back.is-hidden { opacity: 0; transform: scale(0.6); pointer-events: none; }

/* ---- 次の作品へ入るとき：まわりが先に引いて消える ---- */
main.is-leaving .work-hero,
main.is-leaving .work-card,
main.is-leaving .work-body,
main.is-leaving .work-youtube,
main.is-leaving .work-next-label,
main.is-leaving .work-next-meta,
main.is-leaving .work-next-title,
main.is-leaving .work-next-push,
main.is-leaving .work-next-ring,
main.is-leaving .work-back,
main.is-leaving .work-foot {
  opacity: 0;
  transition: opacity var(--retreat) ease;
}

@media (max-width: 767px) {
  .work-card {
    width: 86%;
    margin-top: -64px;
    padding: 20px 22px 24px;
    border-radius: 56px;
  }
  .work-meta { font-size: 12px; }
  .work-title { font-size: 20px; margin-top: 6px; }
  .work-line { font-size: 13px; margin-top: 6px; }
  .work-body { width: 87%; margin-top: 48px; gap: 15px; }
  /* スマートフォンは縦長を並べず 1 枚ずつ（正方形 80%・縦長 70%） */
  .work-item--square { --fit: 80%; }
  .work-pair { display: contents; }
  .work-item--port,
  .work-pair .work-item { --fit: 70%; }
  .work-item-inner { border-radius: 8px; }
  .work-note { border-radius: 8px; }
  .work-consult { margin-top: 29px; }      /* 中身の段の間（15px）と合わせて 44px */
  .work-consult-btn { min-height: 50px; padding: 10px 22px; font-size: 15px; letter-spacing: 0.02em; }
  .work-youtube { margin-top: 14px; }
  .work-next { padding: 80px 0 90px; }
  .work-next-disc { width: 220px; height: 220px; margin-top: 26px; }
  .work-next-ring { inset: -8px; }
  .work-next-push { width: 60px; height: 60px; left: calc(85.36% - 30px); top: calc(85.36% - 30px); font-size: 19px; }
  .work-next-title { font-size: 20px; }
  .work-foot { justify-content: center; padding: 0 10px 8px; font-size: 11px; }
  .work-back { left: 16px; bottom: 16px; width: 56px; height: 56px; }
}
