/* ==========================================================
   Works
   ========================================================== */

.p-works {
  position: relative;
  padding: 140rem 0 120rem;
  background-color: #fff;
  overflow: hidden;
}

/* SVGフィルター（非表示） */
.p-works__svg-filters {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* 墨滲み（背景／PCのみ・コンテンツより背面）
   回転・反転は各 --works-tex-* を変更（例: 12deg / scaleY(-1)） */
.p-works__texture {
  position: absolute;
  pointer-events: none;
  z-index: 0;
  max-width: none;
  transform-origin: var(--works-tex-origin-x, center) var(--works-tex-origin-y, center);
  transform: rotate(var(--works-tex-rotate, 0deg))
    scaleX(var(--works-tex-scale-x, 1))
    scaleY(var(--works-tex-scale-y, 1))
    translate(var(--works-tex-translate-x, 0), var(--works-tex-translate-y, 0));
}

/* Works 中央墨（PCのみ・sumi4.png） */
.p-works__texture--center {
  display: none;
}

@media (min-width: 769px) {
  .p-works__texture--center {
    display: block;
    top: 21%;
    left: -5%;
    width: 110%;
    height: auto;
    transform: none;
  }
}

/* Works 最下部墨（PCのみ・sumi5.png） */
.p-works__texture--bottom {
  display: none;
}

@media (min-width: 769px) {
  .p-works__texture--bottom {
    display: block;
    bottom: -60rem;
    left: 0;
    width: 100%;
    height: auto;
    transform: none;
  }
}

.p-works__texture--bottom-left {
  --works-tex-origin-x: left;
  --works-tex-origin-y: bottom;
  --works-tex-rotate: 0deg;
  --works-tex-scale-x: 1;
  --works-tex-scale-y: 1;
  --works-tex-translate-x: 0;
  --works-tex-translate-y: 0;
  bottom: -520rem;
  left: -220rem;
  width: 2000rem;
}

.p-works__texture--bottom-right {
  --works-tex-origin-x: right;
  --works-tex-origin-y: bottom;
  --works-tex-rotate: 0deg;
  --works-tex-scale-x: 1;
  --works-tex-scale-y: 1;
  --works-tex-translate-x: 0;
  --works-tex-translate-y: 0;
  bottom: -861rem;
  right: -614rem;
  width: 2672rem;
}

.p-works__heading,
.p-works__list,
.p-works__item-link--section {
  position: relative;
  z-index: 1;
}

/* 見出し */
.p-works__heading {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10rem;
    padding-left: 160rem;
    margin-bottom: 60rem;
}

.p-works__heading-line {
    flex: 1;
    max-width: 300rem;
    height: 1rem;
    background-color: #333;
}

.p-works__heading-text {
    text-align: left;
}

.p-works__heading-en {
    display: block;
    font-family: var(--font-bask-old);
    font-size: var(--fs-40);
    letter-spacing: 0.3em;
    color: #333;
    font-weight: 600;
}

.p-works__heading-ja {
    display: none;
}

/* ブロックリスト */
.p-works__list {
  display: flex;
  flex-direction: column;
  gap: 200rem;
}

/* 各ブロック（セクション末尾にまとめて View more） */
.p-works__item {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 0 160rem;
}

.p-works__item-hit {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  text-decoration: none;
  color: inherit;
  outline: none;
}

.p-works__item-hit:focus-visible {
  outline: 2rem solid #333;
  outline-offset: 4rem;
}

/* 写真＋テキストを包む一枚のカード */
.p-works__card {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  box-sizing: border-box;
  min-height: 440rem;
  background-color: #fff;
  border: 1.5rem solid #e5e5e5;
  overflow: visible;
}

.p-works__item--reverse .p-works__card {
  flex-direction: row-reverse;
}

/* 写真エリア — 約 62%〜60% でテキストより広め（縮小時も比率維持） */
.p-works__item-photo {
  flex: 3 1 0%;
  min-width: 0;
  overflow: hidden;
  align-self: stretch;
}

.p-works__item-photo img {
  width: 100%;
  height: 100%;
  min-height: 100%;
  object-fit: cover;
  display: block;
}

/* テキストエリア — 残りおよそ 38〜40% */
.p-works__item-body {
  flex: 2 1 0%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-sizing: border-box;
  min-width: 0;
  padding: 48rem 40rem;
}

/* =====================================================================
   Hover.css — Page curls（Ian Lunn / MIT）、枠ごとめくれる挙動
   https://ianlunn.github.io/Hover/
   ------------------------------------------------------------------ */
.p-works__card.hvr-curl-top-left,
.p-works__card.hvr-curl-top-right {
  vertical-align: unset;
  position: relative;
  transform: perspective(1px) translateZ(0);
  box-shadow: 0 0 1px rgba(0, 0, 0, 0);
}

/* Curl Top Left */
.p-works__card.hvr-curl-top-left::before {
  pointer-events: none;
  position: absolute;
  content: '';
  height: 0;
  width: 0;
  top: 0;
  left: 0;
  background: linear-gradient(135deg, #fff 45%, #c8c8c8 50%, #ddd 56%, #fff 80%);
  z-index: 2;
  box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.15);
  transition-duration: 0.35s;
  transition-property: width, height;
}

.p-works__item-hit:hover .p-works__card.hvr-curl-top-left::before,
.p-works__item-hit:focus-within .p-works__card.hvr-curl-top-left::before {
  width: 120rem;
  height: 120rem;
}

/* Curl Top Right */
.p-works__card.hvr-curl-top-right::before {
  pointer-events: none;
  position: absolute;
  content: '';
  height: 0;
  width: 0;
  top: 0;
  right: 0;
  background: linear-gradient(225deg, #fff 45%, #c8c8c8 50%, #ddd 56%, #fff 80%);
  z-index: 2;
  box-shadow: -1px 1px 1px rgba(0, 0, 0, 0.15);
  transition-duration: 0.35s;
  transition-property: width, height;
}

.p-works__item-hit:hover .p-works__card.hvr-curl-top-right::before,
.p-works__item-hit:focus-within .p-works__card.hvr-curl-top-right::before {
  width: 120rem;
  height: 120rem;
}

@media (prefers-reduced-motion: reduce) {
  .p-works__card.hvr-curl-top-left::before,
  .p-works__card.hvr-curl-top-right::before {
    transition: none;
  }

  .p-works__item-hit:hover .p-works__card.hvr-curl-top-left::before,
  .p-works__item-hit:focus-within .p-works__card.hvr-curl-top-left::before,
  .p-works__item-hit:hover .p-works__card.hvr-curl-top-right::before,
  .p-works__item-hit:focus-within .p-works__card.hvr-curl-top-right::before {
    width: 0;
    height: 0;
  }
}

.p-works__item-text {
  display: flex;
  align-items: flex-start;
  flex-direction: row-reverse;
  justify-content: center;
  gap: 30rem;
}

.p-works__item-title {
  writing-mode: vertical-rl;
  font-family: var(--font-body);
  font-size: var(--fs-40);
  font-weight: 400;
  line-height: 1.4;
}

.p-works__item-desc {
  writing-mode: vertical-rl;
  font-size: var(--fs-20);
  line-height: 1.8;
  color: #333;
}

/* 各カード下（框外）：セクション末尾の View more と同じクラス・寸法・装飾 */
.p-works__card-more.p-works__item-link {
  align-self: flex-end;
  margin-top: 28rem;
  flex-shrink: 0;
  pointer-events: none;
}

/* View more（リスト末尾の共通リンク／旧カード下と同じ装飾） */
.p-works__item-link {
    position: relative;
    display: block;
    width: 325rem;
    height: 40rem;
}

.p-works__item-link--section {
    margin: 200rem auto 0;
    text-decoration: none;
    color: inherit;
    transition: opacity 0.3s ease;
}

.p-works__item-link--section:hover {
    opacity: 0.65;
}

.p-works__item-link--section:focus-visible {
    outline: 2rem solid #333;
    outline-offset: 4rem;
}

.p-works__item-link-circle {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 50rem;
    height: 50rem;
    border: 1rem solid #333;
    border-radius: 50%;
}

.p-works__item-link-line {
    position: absolute;
    left: 25rem;
    top: 50%;
    transform: translateY(-50%);
    width: 300rem;
    height: 1rem;
    background-color: #333;
}

.p-works__item-link-label {
    position: absolute;
    right: 30rem;
    bottom: 50%;
    font-family: var(--font-bask-old);
    font-weight: 700;
    font-size: var(--fs-18);
    color: #333;
    white-space: nowrap;
}

/* トップ Works：施工事例一覧カード（archive-work.css）は PC では非表示（SP のみ DOM を流用） */
@media (min-width: 769px) {
    .p-works .p-sekoujirei__card {
        display: none !important;
    }
}

/* トップページ PC：施工事例セクション背景を透過（墨テクスチャを表示） */
@media (min-width: 769px) {
  .p-top-fv-works .p-works {
    background-color: transparent;
  }
}

/* ==========================================================
   Responsive: 768px以下
   ========================================================== */
@media (max-width: 768px) {

    /* 墨滲みは PC のみ */
    .p-works__svg-filters,
    .p-works__texture {
        display: none !important;
    }

    .p-works {
        padding: 60rem 0 80rem;
        background-color: #e5e5e5;
    }

    /* 見出し（Column / News SP と統一） */
    .p-works__heading {
        display: flex;
        align-items: flex-start;
        gap: 6rem;
        padding: 0 30rem;
        margin-bottom: 50rem;
    }

    .p-works__heading-line {
        margin-left: auto;
        align-self: center;
    }

    .p-works__heading-text {
        display: contents;
    }

    .p-works__heading-ja {
        writing-mode: vertical-rl;
        font-size: var(--fs-18);
        color: #333;
        font-weight: 100;
        letter-spacing: 0.07em;
        order: -1;
    }

    .p-works__heading-en {
        font-size: var(--fs-18);
        align-self: center;
    }

    .p-works__heading-line {
        flex: none;
        max-width: none;
        width: 30rem;
    }

    /* ブロックリスト（施工事例一覧ページ SP と同じカード間隔） */
    .p-works__list {
        gap: 36rem;
    }

    .p-works__item {
        flex-direction: column;
        align-items: stretch;
        padding: 0 30rem;
    }

    /* PC 用ブロックを隠し、archive-work.css の .p-sekoujirei__card のみ表示 */
    .p-works .p-works__item-hit--pc {
        display: none !important;
    }

    .p-works .p-works__card-more {
        display: none !important;
    }

    /* View more（セクション末尾／SP でコンパクト） */
    .p-works__item-link--section {
        margin-top: 60rem;
        width: 130rem;
        height: 20rem;
    }

    .p-works__item-link--section .p-works__item-link-circle {
        width: 24rem;
        height: 24rem;
    }

    .p-works__item-link--section .p-works__item-link-line {
        left: 12rem;
        width: 118rem;
    }

    .p-works__item-link--section .p-works__item-link-label {
        font-size: var(--fs-10);
        right: 12rem;
    }
}
