/* =========================================================
   top.css  — TOPページ専用スタイル
   ========================================================= */

/* ------------------------------
   MV（メインビジュアル）
------------------------------ */
.mv_area {
  width: 100%;
  max-width: 192rem;
  margin: 0 auto var(--section-space);
}

/* ------------------------------
   About Section
------------------------------ */

#about .flex_box {
  display: flex;
  max-width: var(--content-max);
  margin: var(--section-space) auto;
  justify-content: space-between;
}

#about .img_box {
  width: 41.67%;
  margin-right: 5.56%;
}

#about .txt_box {
  display: flex;
  flex-direction: column;
  width: 46.66%;
  color: #222;
  font-weight: 700;
  background-image: url(/assets/images/sakai_logo_bg.webp);
  background-size: contain;
  background-repeat: no-repeat;
  padding: 5.56% 0 5.56% 5.56%;
}

#about .section_tit {
  font-size: clamp(2rem, 2.64vw, 3.8rem);
  color: #fff;
  line-height: 1;
}

#about .section_tit span {
  display: inline-block;
  position: relative;
  padding: 1.33%;
  overflow: hidden;
}

/* 改行 */
#about .section_tit span+span {
  width: fit-content;
  margin-top: 3rem;
}

/* 赤背景（前に出す） */
#about .section_tit span::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--color-primary);
  transform: scaleX(0);
  transform-origin: left;
  z-index: -1;
}

/* テキストを上に */
#about .section_tit span {
  z-index: 2;
}

/* 初期状態 */
#about .section_tit span {
  opacity: 0;
  transform: translateX(-3rem);
}

/* GSAP制御用 */
#about .section_tit span::before {
  transform: scaleX(var(--scaleX, 0));
}

#about .section_txt {
  font-size: clamp(1.2rem, 1.25vw, 1.8rem);
  margin-top: 3.89%;
  line-height: 1.7;
  color: #000;
  letter-spacing: .05em;
}

/* アニメ用 */
.section_txt .line {
  display: block;
  opacity: 0;
  transform: translateX(-2rem);
}

#about .section_btn {
  justify-content: end;
}

/* ------------------------------
   Service Section
------------------------------ */

.section_tit {
  font-size: clamp(8rem, 26.67vw, 10rem);
  color: var(--color-primary);
  line-height: 1;
  font-weight: 900;
}

/* =========================
   レイアウト
========================= */
.service {
  padding: 4rem 0;
  background: #fff;
}

.service__grid {
  max-width: 128rem;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

/* =========================
   カード
========================= */
.service-card {
  position: relative;
  overflow: hidden;
}

/* 画像サイズ統一（重要） */
.service-card img {
  width: 100%;
  object-fit: cover;
  display: block;
}

/* =========================
   コンテンツ共通
========================= */
.service-card__content {
  position: absolute;
  left: 0;
  width: 100%;
  padding: 3.2rem 2.4rem 2.8rem;
  z-index: 2;
  color: #fff;
}

/* =========================
   中央配置（真ん中カード）
========================= */
.service-card__content--center {
  top: 50%;
  transform: translateY(-50%);
}

/* =========================
   タイトル
========================= */
.service-card__title {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.35;
  text-shadow: 0 .2rem 1rem rgba(0, 0, 0, 0.35);
  text-align: center;
}

/* 2行タイトル */
.service-card__title+.service-card__title {
  margin-top: .8rem;
}

/* =========================
   テキスト
========================= */
.service-card__text {
  margin: var(--section-space) 0 0;
  font-size: 1.6rem;
  font-weight: 400;
  line-height: 1.6;
  text-shadow: 0 .2rem .8rem rgba(0, 0, 0, 0.35);
}

/* =========================
   ホバー（おまけ）
========================= */
.service-card img {
  transition: transform 0.6s ease;
}

.service-card:hover img {
  transform: scale(1.05);
}

/* セクション */
.works-section {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  background: #fff;
}

/* タイル背景 */
.tile-bg {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  min-height: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(6rem, 1fr));
  grid-auto-rows: 6rem;
  perspective: 80rem;
  pointer-events: none;
  z-index: 0;
}

/* タイル */
.tile {
  background: var(--color-primary-bright);

  /* ▼ 超繊細ライン */
  border: .05rem solid rgba(255, 255, 255, 0.3);

  opacity: 0;
  transform: rotateY(90deg);
  transform-origin: left;
  backface-visibility: hidden;
  will-change: transform, opacity;
}

/* 中身 */
.inner {
  position: relative;
  z-index: 1;
  padding: 12rem;
  color: #fff;
}

/* カード */
.cards {
  display: flex;
  gap: 3rem;
  margin-top: 3.89%;
}

.card {
  background: #eee;
  border-radius: 1.6rem;
  overflow: hidden;
  flex: 1;
  transform: translateY(4rem);
  opacity: 0;
}

.card img {
  width: 100%;
}

.card-body {
  padding: 2rem;
  color: #000;
}

.card-body span {
  color: var(--color-primary);
  margin-bottom: 1rem;
  display: block;
}

#works .section_sub_tit,
#works .section_tit {
  color: #fff;

}

.mv {
  --mv-slide-offset: 7rem;
  --mv-overlay-opacity: .22;
  --mv-zoom-start: 1.06;
  position: relative;
  height: 100vh;
  overflow: hidden;
  background: #fff;
  isolation: isolate;
}

.mv::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, var(--mv-overlay-opacity));
  opacity: 0;
  transform: translate3d(var(--mv-slide-offset), 0, 0);
  will-change: transform, opacity;
  pointer-events: none;
  z-index: 1;
}

/* 動画 */
.mv-media {
  position: absolute;
  inset: 0;
  overflow: hidden;
  opacity: 0;
  transform: translate3d(var(--mv-slide-offset), 0, 0);
  will-change: transform, opacity;
  contain: paint;
  backface-visibility: hidden;
  z-index: 0;
}

.mv-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: translate3d(0, 0, 0) scale(var(--mv-zoom-start));
  transform-origin: center;
  will-change: transform;
  backface-visibility: hidden;
}

.mv.is-animated .mv-media {
  animation: mvVideoSlideIn 1.2s cubic-bezier(.22, 1, .36, 1) forwards;
}

.mv.is-animated .mv-video {
  animation: mvVideoZoomOut 6s ease-out 1.02s forwards;
}

.mv.is-animated::after {
  animation: mvVideoOverlayIn 1.2s cubic-bezier(.22, 1, .36, 1) forwards;
}

/* ノイズ */
.noise {
  position: absolute;
  inset: 0;
  background: none;
  opacity: 0.15;
  pointer-events: none;
  z-index: 1;
}

@media screen and (min-width: 769px) {
  .noise {
    background: url("https://grainy-gradients.vercel.app/noise.svg");
  }
}

/* コンテンツ */
.mv-content {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 0 4rem;
  z-index: 2;
}

/* ===== MVロゴ ===== */
.mv-brand {
  position: relative;
  width: min(56rem, 44vw);
  max-width: 100%;
}

.mv-brand__logo-wrap {
  position: relative;
  width: 100%;
  overflow: hidden;
  -webkit-clip-path: inset(32% 0 32% 0);
  clip-path: inset(32% 0 32% 0);
}

.mv-brand__logo {
  display: block;
  width: 100%;
  height: auto;
  -webkit-clip-path: inset(0 100% 0 0);
  clip-path: inset(0 100% 0 0);
  transform: translateY(1.8rem) scale(.975);
  transform-origin: center;
  filter: blur(.35rem);
}

.mv-brand.is-animated .mv-brand__logo-wrap {
  animation: mvBrandMask 1.05s cubic-bezier(.22, 1, .36, 1) forwards;
}

.mv-brand.is-animated .mv-brand__logo {
  animation: mvBrandReveal 1.05s cubic-bezier(.22, 1, .36, 1) forwards;
}

@keyframes mvBrandMask {
  0% {
    -webkit-clip-path: inset(32% 0 32% 0);
    clip-path: inset(32% 0 32% 0);
  }

  55% {
    -webkit-clip-path: inset(0 0 0 0);
    clip-path: inset(0 0 0 0);
  }

  100% {
    -webkit-clip-path: inset(0 0 0 0);
    clip-path: inset(0 0 0 0);
  }
}

@keyframes mvBrandReveal {
  0% {
    -webkit-clip-path: inset(0 100% 0 0);
    clip-path: inset(0 100% 0 0);
    transform: translateY(1.8rem) scale(.975);
    filter: blur(.35rem);
  }

  62% {
    -webkit-clip-path: inset(0 0 0 0);
    clip-path: inset(0 0 0 0);
    transform: translateY(0) scale(1);
    filter: blur(0);
  }

  100% {
    -webkit-clip-path: inset(0 0 0 0);
    clip-path: inset(0 0 0 0);
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@keyframes mvVideoSlideIn {
  0% {
    opacity: 0;
    transform: translate3d(var(--mv-slide-offset), 0, 0);
  }

  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes mvVideoZoomOut {
  0% {
    transform: translate3d(0, 0, 0) scale(var(--mv-zoom-start));
  }

  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
}

@keyframes mvVideoOverlayIn {
  0% {
    opacity: 0;
    transform: translate3d(var(--mv-slide-offset), 0, 0);
  }

  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .mv-media,
  .mv-brand__logo-wrap,
  .mv-brand__logo {
    animation: none;
  }

  .mv.is-animated .mv-media {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }

  .mv.is-animated .mv-video {
    transform: translate3d(0, 0, 0) scale(1);
  }

  .mv::after,
  .mv.is-animated::after {
    animation: none;
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }

  .mv-brand.is-animated .mv-brand__logo {
    -webkit-clip-path: inset(0 0 0 0);
    clip-path: inset(0 0 0 0);
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

/* ===============================
   ▼ レスポンシブ（スマホ）
=============================== */
@media screen and (max-width: 1024px) {
  #about .flex_box {
    align-items: center;
    gap: 4rem;
    padding: 0 var(--content-padding);
  }

  #about .txt_box {
    padding-left: 3.2rem;
  }

  .service-card__content {
    padding: 2.4rem 1.8rem;
  }

  .service-card__text {
    margin-top: 4rem;
    font-size: 1.4rem;
  }

  .inner {
    padding: 9rem 4rem;
  }

  .cards {
    gap: 2rem;
  }
}

@media screen and (max-width: 768px) {
  .mv {
    --mv-slide-offset: 4rem;
    --mv-overlay-opacity: .25;
    --mv-zoom-start: 1.03;
    height: 100svh;
    min-height: 58rem;
  }

  .mv.is-animated .mv-video {
    animation-duration: 3.2s;
  }

  .mv-video {
    filter: none;
    object-position: center;
    transform: translate3d(0, 0, 0) scale(var(--mv-zoom-start));
    will-change: transform;
  }

  .noise {
    display: none;
  }

  .grid {
    background-size: 4rem 4rem;
  }

  .mv-content {
    padding: 0 var(--content-padding);
  }

  .mv-brand {
    width: min(40rem, 72vw);
  }

  #about .flex_box {
    flex-direction: column;
    gap: 2.4rem;
    margin: var(--section-space) auto;
    padding: 0 var(--content-padding);
  }

  #about .img_box,
  #about .txt_box {
    width: 100%;
    margin: 0;
  }

  #about .txt_box {
    padding: 3rem 0 0;
    background-position: center top;
    background-size: min(72vw, 30rem) auto;
  }

  #about .section_tit {
    font-size: clamp(2rem, 6vw, 2.8rem);
    line-height: 1.55;
  }

  #about .section_tit span {
    padding: .4rem .8rem;
  }

  #about .section_tit span+span {
    margin-top: 1.2rem;
  }

  #about .section_txt {
    margin-top: 2.4rem;
    font-size: 1.4rem;
    line-height: 1.9;
  }

  #about .section_btn {
    justify-content: center;
  }

  .section_tit {
    font-size: clamp(4.8rem, 18vw, 6.8rem);
    line-height: .95;
    word-break: break-word;
  }

  .section_sub_tit {
    margin-bottom: 1.2rem;
  }

  .service {
    padding: 2.8rem 0 0;
  }

  .service__grid {
    grid-template-columns: 1fr;
    gap: 1.6rem;
  }

  .service-card {
    min-height: 32rem;
    border-radius: 1.2rem;
  }

  .service-card img {
    height: 32rem;
  }

  .service-card__content {
    padding: 2.4rem 2rem;
  }

  .service-card__title {
    font-size: 2rem;
  }

  .service-card__text {
    margin-top: 2rem;
    font-size: 1.4rem;
    line-height: 1.75;
  }

  .works-section {
    min-height: auto;
  }

  .tile-bg {
    grid-template-columns: repeat(auto-fill, minmax(4rem, 1fr));
    grid-auto-rows: 4rem;
  }

  .inner {
    padding: 7rem var(--content-padding);
  }

  .cards {
    flex-direction: column;
    gap: 2rem;
    margin-top: 3.2rem;
  }

  .card {
    flex: none;
    border-radius: 1.2rem;
    transform: translateY(3rem);
  }

  .card-body {
    padding: 1.6rem;
  }

  .card-body h3 {
    font-size: 1.6rem;
    line-height: 1.6;
  }
}

@media screen and (max-width: 430px) {
  .mv {
    min-height: 54rem;
  }

  .mv-brand {
    width: min(30rem, 72vw);
  }

  .section_tit {
    font-size: clamp(4rem, 17vw, 5.8rem);
  }

  .service-card,
  .service-card img {
    height: 34rem;
  }
}
