/* ==========================================
   work.css 安全版
   目的：
   - works 一覧カードの競合を解消
   - パネル部分をシンプルな見た目に統一
   - works-detail / hero / 富士山パトロール を分離整理
   - 崩れやすい重複定義を削減

   一旦保留にした危険箇所：
   1) 旧 works-item / works-caption の複数デザイン案
      - 正方形案
      - 絶対配置キャプション案
      - 2段グリッド案
      → 今回は「シンプルな一覧カード」に一本化

   2) works-detail の過去レイアウト差分
      - max-width:520px 案
      - !important で全幅に戻す案
      → 今回はシンプルな2列/1列の標準構成に整理

   3) works-detail hero の複数アニメーション
      - tilt-diagonal
      - focus-pull
      → 今回は酔いにくい微ズームのみ採用
   ========================================== */


/* ===============================
   1) ページ変数
   =============================== */

/* 施工実績一覧 */
body.page-works {
  --hero-anim: hero-zoom-snap-safe;
  --hero-duration: 1.2s;
  --hero-scale-start: 1.08;
  --hero-gray-start: 0%;
  --hero-bright-start: 1;
  --cap-delay: 1s;
  --hero-pos-x: 50%;
  --hero-pos-y: 35%;
}

/* 施工実績詳細 */
body.page-works-detail {
  --hero-anim: hero-focus-pull-safe;
  --hero-duration: 1.2s;
  --hero-scale-start: 1.04;
  --hero-gray-start: 90%;
  --hero-bright-start: 1.1;
  --cap-delay: 1s;
}



/* ===============================
   2) ヒーロー共通
   =============================== */

body.page-works .top-img,
body.page-works-detail .top-img {
  position: relative;
  overflow: hidden;
}

body.page-works .top-img > img,
body.page-works-detail .top-img > img {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 100%;
  height: 100%;
  max-width: none;
  min-width: 100%;
  min-height: 100%;
  object-fit: cover;
  object-position: var(--hero-pos-x, 50%) var(--hero-pos-y, 35%);
  transform-origin: center center;
  filter: none;
  opacity: 0;
  backface-visibility: hidden;
  will-change: transform, opacity;
}

/* works 一覧：少し弾むズーム */
@keyframes hero-zoom-snap-safe {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(1.12); }
  70%  { opacity: 1; transform: translate(-50%, -50%) scale(0.995); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1.00); }
}

body.page-works .top-img > img {
  transform: translate(-50%, -50%) scale(1.08);
  animation: hero-zoom-snap-safe 1.2s ease-out 0s 1 forwards;
}

/* works 詳細：酔いにくい微ズーム */
@keyframes hero-focus-pull-safe {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(1.04); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1.00); }
}

body.page-works-detail .top-img > img {
  transform: translate(-50%, -50%) scale(1.04);
  animation: hero-focus-pull-safe 1.2s ease-out 0s 1 forwards;
}

/* SPのサブピクセル誤差対策 */
@media (max-width: 768px) {
  body.page-works .top-img > img,
  body.page-works-detail .top-img > img {
    width: 101.5%;
    height: 101.5%;
  }
}

/* モーション軽減 */
@media (prefers-reduced-motion: reduce) {
  body.page-works .top-img > img,
  body.page-works-detail .top-img > img {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
  }
}



/* ===============================
   3) works hero only
   =============================== */

body.page-works .top-img .cap {
  left: 20px;
  right: auto;
  bottom: 18px;
  padding: 0;
}

body.page-works .top-img .cap-bg {
  display: block;
  width: min(520px, calc(100vw - 40px));
  padding: 14px 16px 16px;
}

body.page-works .top-img .hero-eyebrow,
body.page-works .top-img .hero-title,
body.page-works .top-img .sub {
  text-align: left;
}

@media (max-width: 767px) {
  body.page-works .top-img .cap {
    left: 14px;
    bottom: 14px;
  }

  body.page-works .top-img .cap-bg {
    width: calc(100vw - 28px);
    padding: 12px 14px 14px;
  }
}



/* ===============================
   4) WORKS PAGE
   works.html 専用
   =============================== */

/* ---- intro ---- */
.page-works .works-intro {
  width: 100%;
  max-width: none;
  margin: 22px 0 28px;
  padding: 0;
}

.page-works .works-intro p {
  margin: 0;
  width: 100%;
  font-size: 17px;
  line-height: 2;
  text-align: justify;
  text-justify: inter-ideograph;
}


/* ---- works list ---- */
/* シンプル統一版：余計な演出を外して一覧性を優先 */
.page-works .works-list {
  background: #f1f5f9;
  padding: 16px;
  margin: 10px 0 0;
  border-radius: 14px;
}

.page-works .works-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 18px;
  justify-items: stretch;
  margin: 0;
  padding: 0;
}

.page-works .works-item {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  background: #fff;
  border: 1px solid #dbe3ea;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .05);
  overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.page-works .works-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(15, 23, 42, .08);
  border-color: #cfd8e3;
}

.page-works .works-item img,
.page-works .works-item > img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  height: auto;
  object-fit: contain;
  background: #f8fafc;
  padding: 18px;
  margin: 0;
  border: 0;
  vertical-align: bottom;
}

.page-works .works-caption {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin: 0;
  padding: 10px 12px;
  background: #dbeefe;
  color: #0f172a;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
  border-top: 1px solid #e5e7eb;
}

/* ---- works list responsive ---- */
@media (max-width: 1100px) {
  .page-works .works-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .page-works .works-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .page-works .works-intro {
    margin: 18px 0 24px;
  }

  .page-works .works-intro p {
    font-size: 16px;
    line-height: 1.9;
  }

  .page-works .works-list {
    padding: 12px;
  }

  .page-works .works-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .page-works .works-item img,
  .page-works .works-item > img {
    padding: 14px;
  }

  .page-works .works-caption {
    min-height: 40px;
    font-size: 13px;
    padding: 8px 10px;
  }
}



/* ===============================
   5) 富士山パトロール
   =============================== */

.page-works .initiatives-fuji {
  margin-top: 25px;
}

.page-works .initiatives-fuji p {
  font-size: 18px;
  line-height: 1.85;
  margin: 0 0 1.2em;
  color: #374151;
}

.page-works .initiatives-fuji .btn-wrap {
  margin-top: 16px;
}

.page-works .initiatives-fuji .btn-link {
  display: inline-block;
  padding: 12px 22px;
  font-size: 18px;
  font-weight: 600;
  color: #fff;
  background: #0ea5e9;
  border-radius: 9999px;
  text-decoration: none;
  transition: background .2s, transform .15s;
}

.page-works .initiatives-fuji .btn-link:hover {
  background: #0284c7;
  transform: translateY(-2px);
}

.page-works .initiatives-fuji .btn-link:active {
  transform: translateY(0);
}

.page-works .fuji-hero {
  position: relative;
  min-height: 300px;
  border-radius: 12px;
  overflow: hidden;
  background-size: cover;
  background-position: center 40%;
  background-repeat: no-repeat;
}

.page-works .fuji-hero__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .18);
}

.page-works .fuji-hero__title {
  position: absolute;
  top: 18px;
  left: 32px;
  z-index: 3;
  margin: 0;
  color: #fff;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  text-align: left;
  transform: none;
  text-shadow: 0 2px 8px rgba(0, 0, 0, .35);
}

.page-works .fuji-hero__cap {
  position: absolute;
  left: 32px;
  bottom: 28px;
  z-index: 2;
  width: 520px;
  max-width: calc(100% - 64px);
  margin: 0;
  padding: 20px 24px 18px;
  background: rgba(255, 255, 255, .86);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .14);
}

.page-works .fuji-lead {
  margin: 0;
  color: #334155;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.9;
}

.page-works .fuji-divider {
  display: none;
}

.page-works .fuji-cta {
  margin-top: 14px;
  text-align: center;
}

.page-works .fuji-cta .btn-link,
.page-works .fuji-cta .btn-link:link,
.page-works .fuji-cta .btn-link:visited,
.page-works .fuji-cta .btn-fuji-zigzag,
.page-works .fuji-cta .btn-fuji-zigzag:link,
.page-works .fuji-cta .btn-fuji-zigzag:visited {
  display: inline-block;
  padding: 10px 24px;
  border-radius: 999px;
  background: linear-gradient(180deg, #33a9ef, #1f87d4);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 4px 10px rgba(0, 0, 0, .15);
  transition: color .2s ease;
}

.page-works .fuji-cta .btn-link:hover,
.page-works .fuji-cta .btn-fuji-zigzag:hover {
  color: #000;
}

/* CTA ギザギザ白 */
.page-works .fuji-cta .btn-link.btn-link--lg {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

.page-works .fuji-cta .btn-link.btn-link--lg::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 40%;
  background: #fff;
  z-index: 1;
  clip-path: polygon(
    0% 0%, 100% 0%,
    100% 72%, 95% 62%, 90% 72%, 85% 62%, 80% 72%, 75% 62%,
    70% 72%, 65% 62%, 60% 72%, 55% 62%, 50% 72%,
    45% 62%, 40% 72%, 35% 62%, 30% 72%, 25% 62%,
    20% 72%, 15% 62%, 10% 72%, 5% 62%, 0% 72%
  );
  transform: translateY(-100%);
  transition: transform .45s ease;
  pointer-events: none;
}

.page-works .fuji-cta .btn-link.btn-link--lg:is(:hover, :focus-visible)::after {
  transform: translateY(0);
}

.page-works .fuji-cta .btn-link.btn-link--lg:is(:hover, :focus-visible) {
  color: #111;
}

/* 富士山パトロール responsive */
@media (max-width: 1100px) {
  .page-works .fuji-hero {
    min-height: 300px;
  }

  .page-works .fuji-hero__title {
    top: 18px;
    left: 22px;
    font-size: 24px;
  }

  .page-works .fuji-hero__cap {
    left: 18px;
    right: 18px;
    bottom: 18px;
    width: auto;
    max-width: none;
  }
}

@media (max-width: 640px) {
  .page-works .fuji-hero__title {
    top: 8px;
    left: 50%;
    z-index: 3;
    margin: 0;
    transform: translateX(-50%);
    text-align: center;
    white-space: nowrap;
    color: #fff;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.15;
    text-shadow: 0 2px 8px rgba(0, 0, 0, .35);
  }

  .page-works .fuji-hero__cap {
    left: 14px;
    right: 14px;
    bottom: 14px;
    width: auto;
    max-width: none;
    margin: 0;
    padding: 16px 14px 14px;
  }

  .page-works .fuji-lead {
    font-size: 14px;
    line-height: 1.75;
  }

  .page-works .fuji-cta {
    margin-top: 12px;
    text-align: center;
  }

  .page-works .fuji-cta .btn-link,
  .page-works .fuji-cta .btn-link:link,
  .page-works .fuji-cta .btn-link:visited,
  .page-works .fuji-cta .btn-fuji-zigzag,
  .page-works .fuji-cta .btn-fuji-zigzag:link,
  .page-works .fuji-cta .btn-fuji-zigzag:visited {
    width: 100%;
    max-width: none;
    padding: 12px 16px;
    font-size: 14px;
  }
}



/* ===============================
   6) WORKS DETAIL
   works/*.html 共通
   =============================== */

.page-works-detail .works-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px;
  margin: 24px auto 40px;
}

.page-works-detail .work {
  margin: 0;
}

.page-works-detail figure,
.page-works-detail .work-figure {
  margin: 0;
  padding: 0;
}

.page-works-detail .work-figure {
  width: 100%;
  background: #fff;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(15, 23, 42, .08);
  display: flex;
  flex-direction: column;
}

.page-works-detail .work-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #eef2f7;
}

.page-works-detail .work-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.page-works-detail .work-cap {
  padding: 14px 16px;
  text-align: center;
  background: #f4f7ff;
  width: 100%;
  line-height: 1.6;
}

.page-works-detail .work-cap .title {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.5;
  margin-bottom: 4px;
}

.page-works-detail .work-cap .client {
  margin-top: 0;
  font-size: 14px;
  color: #64748b;
}

@media (max-width: 1000px) {
  .page-works-detail .works-detail-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}

@media (max-width: 640px) {
  .page-works-detail .work-cap .title {
    font-size: 16px;
  }
}



/* ===============================
   7) 戻るボタン
   =============================== */

.page-works-detail .back {
  margin: 34px auto 52px;
  text-align: center;
}

.page-works-detail .btn-back {
  display: inline-block;
  padding: 10px 22px;
  border: 1px solid #2563eb;
  border-radius: 999px;
  color: #2563eb;
  text-decoration: none;
  font-weight: 600;
  transition: background .2s, transform .15s;
}

.page-works-detail .btn-back:hover {
  background: #eff6ff;
  transform: translateY(-1px);
}

