*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Helvetica Neue', Arial, 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', Meiryo, sans-serif; font-feature-settings: "palt" 1; font-kerning: normal; text-rendering: optimizeLegibility; color: #333; }
a { text-decoration: none; color: inherit; }

/* Header */
header { position: fixed; top: 0; left: 0; width: 100%; z-index: 100; display: flex; justify-content: flex-end; align-items: center; padding: 35px clamp(20px, 5vw, 80px); transition: background .3s, box-shadow .3s, transform .4s ease; }
header.hidden { transform: translateY(-100%); }
.header-logo { display: block; height: 65px; position: fixed; top: 10px; left: clamp(20px, 5vw, 80px); z-index: 101; transition: opacity .4s ease; }
.header-logo.is-hidden { opacity: 0; pointer-events: none; }
header nav ul { display: flex; list-style: none; gap: 32px; }
header nav ul li a { font-size: 12px; font-weight: 700; letter-spacing: .12em; color: #333; transition: opacity .2s; }
header nav ul li a:hover { opacity: .6; }

/* Bottom Nav */
#bottom-nav { position: fixed; bottom: 20px; left: 0; right: 0; margin: 0 auto; width: min(80vw, 900px); z-index: 200; background: rgba(255,255,255,.95); box-shadow: 0 8px 32px rgba(0,0,0,.18); border-radius: 16px; opacity: 0; transform: translateY(30px); transition: opacity .4s ease, transform .4s ease; display: flex; align-items: center; justify-content: space-between; padding: 16px; cursor: pointer; user-select: none; }
#bottom-nav.is-visible { opacity: 1; transform: translateY(0); }
#bottom-nav * { pointer-events: none; }
#bottom-nav-label { font-size: 14px; letter-spacing: .15em; color: #333; font-weight: 700; }
#nav-modal-open { background: none; border: none; cursor: pointer; padding: 4px; display: flex; align-items: center; justify-content: center; opacity: .6; transition: opacity .2s; }
#nav-modal-open:hover { opacity: 1; }
#nav-modal-open img { width: 6px; height: auto; transform: rotate(-90deg); filter: brightness(0); }

/* Nav Modal - Bottom Sheet */
#nav-modal { position: fixed; inset: 0; z-index: 198; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0); visibility: hidden; pointer-events: none; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); transition: background-color .3s ease, visibility .3s; }
#nav-modal.is-open { background: rgba(0,0,0,.3); visibility: visible; pointer-events: auto; }
#nav-modal-inner { background: #fff; border-radius: 16px; padding: 40px 32px; width: 80vw; max-width: 900px; overflow-y: auto; position: relative; transform: translateY(40px) scaleY(.85); opacity: 0; transform-origin: center bottom; transition: transform .35s ease, opacity .35s ease; }
#nav-modal.is-open #nav-modal-inner { transform: translateY(0) scaleY(1); opacity: 1; }
#nav-modal-close { position: absolute; top: 16px; right: 16px; background: none; border: 1px solid #ccc; border-radius: 50%; width: 36px; height: 36px; font-size: 14px; cursor: pointer; color: #333; display: flex; align-items: center; justify-content: center; transition: background .2s; }
#nav-modal-close:hover { background: #f5f5f5; }
.nav-modal-title { font-size: 11px; font-weight: 700; letter-spacing: .2em; text-align: center; margin-bottom: 20px; color: #333; }
.nav-modal-grid { display: grid; grid-template-columns: repeat(2, 1fr); grid-template-rows: repeat(2, 1fr); gap: 12px; height: 380px; }
.nav-modal-card { border-radius: 10px; overflow: hidden; background: #fff; box-shadow: 0 2px 12px rgba(0,0,0,.1); display: flex; align-items: center; text-decoration: none; transition: opacity .2s; }
.nav-modal-card:hover { opacity: .85; }
.nav-modal-card img { height: 45%; width: auto; margin-left: 24px; flex-shrink: 0; }
.nav-modal-card-label { flex: 1; text-align: center; }
.nav-modal-card-label .ja { display: block; font-size: 20px; font-weight: 700; letter-spacing: .05em; color: #333; }
.nav-modal-card-label .en { display: block; font-size: 11px; letter-spacing: .15em; margin-top: 6px; color: #999; }

@media (max-width: 768px) {
  #bottom-nav { width: 80%; }
  #nav-modal-inner { width: 90vw; padding: 32px 20px; }
}

/* Footer */
#footer { background: #fff; padding: 60px clamp(20px, 5vw, 80px) 30px; text-align: center; }
.footer-inner { max-width: 1440px; margin: 0 auto; }
.footer-logo { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 30px; }
.footer-nav { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 30px; list-style: none; margin-bottom: 20px; }
.footer-nav a { font-size: 10px; letter-spacing: .12em; color: #333; transition: opacity .2s; }
.footer-nav a:hover { opacity: .6; }
.footer-social { display: flex; justify-content: center; align-items: center; gap: 20px; margin-bottom: 10px; }
.footer-social a { color: #333; transition: opacity .2s; }
.footer-social a:hover { opacity: .6; }
.footer-privacy { margin-bottom: 12px; }
.footer-privacy a { font-size: 10px; letter-spacing: .12em; color: #333; transition: opacity .2s; }
.footer-privacy a:hover { opacity: .6; }
.footer-copy { font-size: 10px; color: #aaa; letter-spacing: .05em; }

@media (max-width: 768px) {
  header { padding: 14px 20px; justify-content: space-between; align-items: center; }
  .header-logo { height: 60px; top: 14px; }
  .nav-modal-card img,
  .nav-modal-card-label { display: none; }
  .nav-modal-card { background-size: cover; background-position: center; }
  .nav-modal-card--news { background-image: url('../image/sp_card01.png'); }
  .nav-modal-card--company { background-image: url('../image/sp_card02.png'); }
  .nav-modal-card--recruit { background-image: url('../image/sp_card03.png'); }
  .nav-modal-card--contact { background-image: url('../image/sp_card04.png'); }
  header nav {
    position: fixed; top: 0; right: 0; width: 240px; height: 100vh;
    background: rgba(255,255,255,.98); box-shadow: -4px 0 20px rgba(0,0,0,.1);
    padding: 80px 32px 40px; z-index: 150;
    opacity: 0; visibility: hidden; transform: translateX(24px);
    transition: opacity .35s ease, transform .35s ease, visibility .35s;
  }
  header nav.open { opacity: 1; visibility: visible; transform: translateX(0); }
  header nav ul { flex-direction: column; gap: 24px; }
  header nav ul li a { font-size: 13px; }
  #footer { padding: 40px 20px 24px; }
  .footer-nav { display: grid; grid-template-columns: repeat(3, 1fr); justify-items: center; gap: 14px 16px; }
  .footer-copy { font-size: 9px; }
}

/* ===== 一覧 (archive-works.php) ===== */
body.post-type-archive-works main { padding: 120px 0 80px; max-width: 1440px; margin: 0 auto; }
.section-heading { text-align: center; margin: 60px 0 30px; }
main > .section-heading:first-child { margin-top: 50px; }
.section-heading h2 { font-size: 22px; font-weight: 700; letter-spacing: .05em; }
.section-heading .en { display: block; font-size: 10px; letter-spacing: .2em; color: #999; margin-top: 4px; }

/* カード間の余白は margin ではなく gap で作る。
   カード幅(226px)×4＋gap(40px)×3＝1024pxで幅を固定し、常に4列で並べ、5作品目以降は改行させる。 */
.works-grid { width: 1024px; max-width: 100%; margin: 0 auto; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 56px 40px; }
/* カードの幅を画像（サムネイル）幅に固定し、タイトルもその幅に合わせて折り返す。
   min-width:0 がないと、タイトルの長い英数字が縮まずに折り返しが崩れることがある */
.works-card { display: block; cursor: pointer; min-width: 0; width: 226px; }
.works-card .card-thumb {
  width: 226px;
  height: 320px;
  aspect-ratio: 3549 / 5016;
  background: rgba(92, 194, 207, 0.2);
  object-fit: cover;
  object-position: center;
  display: block;
  border-radius: 10px;
  transition: opacity .2s;
}
.works-card .card-thumb--wide { object-fit: contain; }
.works-card .card-thumb--placeholder { display: flex; align-items: center; justify-content: center; }
.works-card .card-thumb--placeholder img { width: 50%; height: 50%; object-fit: contain; display: block; }
.works-card:hover .card-thumb { opacity: .8; }
/* タイトルが1行に収まる時は中央寄せ、2行になる時は左詰め（.is-multiline はcommon.jsで判定して付与） */
.works-card .card-title { font-size: 13px; font-weight: 700; line-height: 1.6; margin-top: 14px; text-align: center; overflow-wrap: break-word; }
.works-card .card-title.is-multiline { text-align: left; }
.back-link { display: inline-flex; align-items: center; gap: 6px; margin-top: 60px; font-size: 12px; letter-spacing: .05em; color: #333; transition: opacity .2s; }
.back-link:hover { opacity: .6; }
.back-link img { height: 10px; width: auto; }

@media (max-width: 768px) {
  body.post-type-archive-works main { padding-top: 90px; padding-left: clamp(20px, 5vw, 80px); padding-right: clamp(20px, 5vw, 80px); }
  .works-grid { width: 100%; gap: 40px 16px; }
  .works-card { flex: 0 1 calc(50% - 8px); }
  .works-card .card-thumb { width: 100%; height: auto; }
  .works-card .card-title { font-size: 12px; }
}
@media (max-width: 480px) {
  body.post-type-archive-works main { padding-left: 20px; padding-right: 20px; }
}

/* ===== 詳細 (single-works.php) ===== */
body.single-works main { padding: 120px clamp(20px, 5vw, 80px) 0; max-width: 1000px; margin: 0 auto; }
.article-title { width: 100%; margin: 0 auto 28px; font-size: clamp(18px, 4.5vw, 24px); font-weight: 700; line-height: 1.4; text-align: center; }
.article-thumb-row { display: flex; gap: 16px; width: 80%; margin: 0 auto 32px; }
/* article-thumb は画像そのものではなく「枠」。aspect-ratioはこの枠(span)にだけ効かせ、
   中のimgはwidth/height 100%で枠いっぱいに敷き詰める（本番と同じ比率を維持しつつ、
   WordPressのimg width/height属性とaspect-ratioの相性問題を回避するため）。 */
.article-thumb {
  width: 80%;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  display: block;
  margin: 0 auto 32px;
}
.article-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.article-thumb--wide { aspect-ratio: 16 / 9; }
.article-thumb-row .article-thumb { width: 50%; margin: 0; }
.article-body { font-size: clamp(12px, 3.2vw, 14px); line-height: 2; color: #555; text-align: center; }
.article-body h2 { font-size: clamp(13px, 3.5vw, 15px); font-weight: 700; letter-spacing: .05em; margin: 30px 0 0; padding: 10px; text-align: center; color: #5cc2cf; }
.article-copyright { font-size: clamp(10px, 2.6vw, 11px); color: #999; margin-top: 30px; text-align: center; }

/* CAST/STAFF のような中央寄せの短い行を並べる場合（h2の見出しの下に行が並ぶ。背景・枠線なし） */
.credit-lines { text-align: center; }
.credit-lines p { margin: 0; padding: 12px 16px; font-size: 13px; }

/* クレジット表（編集画面でテーブルを挿入した場合、汎用的に整形） */
.article-body table { width: 100%; border-collapse: collapse; margin-bottom: 10px; }
.article-body table td { padding: 2px 16px 2px 0; vertical-align: top; font-size: inherit; }
.article-body table td:first-child { width: 50%; color: #555; text-align: right; }
.article-body table td:last-child { text-align: left; padding-right: 0; }

.btn-view-more { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 260px; min-height: 61px; padding: 12px; border: 1px solid #333; font-size: 10px; line-height: 1.6; letter-spacing: .05em; text-align: center; transition: background .2s, color .2s; margin: 0 auto; }
.btn-view-more:hover { background: #333; color: #fff; }
.btn-view-more img { height: 10px; width: auto; flex-shrink: 0; }
.btn-view-more:hover img { filter: brightness(0) invert(1); }

/* ec/button ブロックの余白（1つ目は28px、2つ目以降は16pxで自動的に揃う） */
.btn-wrap { text-align: center; margin-top: 28px; }
.btn-wrap + .btn-wrap { margin-top: 16px; }

body.single-works .back-link { margin-top: 48px; }

@media (min-width: 769px) {
  .article-thumb { width: 30%; }
  .article-thumb--wide { width: 56%; }
  .article-thumb img { object-fit: contain; }
  .article-thumb-row { width: 56%; }
}
@media (max-width: 768px) {
  body.single-works main { padding-top: 90px; }
  .article-title { text-align: left; }
  .article-thumb { width: 100%; aspect-ratio: auto; height: auto; }
  .article-thumb img { position: static; height: auto; }
  .article-thumb-row { width: 100%; }
}
@media (max-width: 480px) {
  body.single-works main { padding: 90px 20px 0; }
  .credit-lines p { font-size: 11px; }
}
