/**
 * Haleulu front-page — meoto.jp 準拠 TOP 専用
 */

/* Header — fixed + blend（meoto） */
body.home header.site {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: transparent;
  pointer-events: none;
}
body.home header.site::before { opacity: 0; }
body.home header.site.is-scrolled::before { opacity: 1; }
body.home header.site > .wrap { pointer-events: auto; }
/* SP ドロワー展開時はヘッダー背景を出して本文と分離する */
body.home.is-nav-open header.site::before { opacity: 1; }
/* SP のヘッダーは透過でヒーロー動画に重なるため、未スクロール時のハンバーガーは
 * ヒーローコピーと同じ白にする。スクロール後・ドロワー展開時は既定の黒に戻る。 */
body.home header.site .menu-btn,
body.home header.site .menu-btn::before,
body.home header.site .menu-btn::after {
  transition: border-color 0.3s ease, background-color 0.3s ease, transform 0.25s ease, top 0.25s ease;
}
body.home:not(.is-nav-open) header.site:not(.is-scrolled) .menu-btn {
  border-color: var(--text-on-dark);
  color: var(--text-on-dark);
  /* 動画の明るいコマでも線が消えないよう、薄い影で縁取る */
  filter: drop-shadow(0 0 0.4rem rgba(0, 0, 0, 0.35));
}
body.home:not(.is-nav-open) header.site:not(.is-scrolled) .menu-btn::before,
body.home:not(.is-nav-open) header.site:not(.is-scrolled) .menu-btn::after {
  background: var(--text-on-dark);
}

/* SP（<600px）は下層ページと同じハンバーガー＋全画面ドロワーを使う。
 * 600px 以上のみ meoto.jp 準拠のインラインリンク表示に切り替える。 */
@media (min-width: 600px) {
  body.home header.site .brand {
    position: relative;
    z-index: 50;
    flex: 0 0 auto;
  }
  body.home header.site .nav-cta,
  body.home header.site .menu-btn {
    display: none;
  }

  /* ハンバーガーを廃止し、内部リンクを常時ヘッダーに表示 */
  body.home header.site .nav-drawer {
    position: static;
    inset: auto;
    max-width: none;
    width: auto;
    flex: 1;
    display: flex;
    justify-content: flex-start;
    transform: none;
    background: transparent;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    z-index: 50;
  }
  body.home header.site .nav-drawer::-webkit-scrollbar { display: none; }
  body.home header.site .nav-drawer > ul {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: clamp(1.6rem, 3.2vw, 2.8rem);
    max-width: none;
    margin: 0;
    padding: 0 0.2rem;
  }
  /* SP ドロワー用の li 区切り線はインライン表示帯では不要 */
  body.home header.site .nav-drawer > ul > li { border-bottom: none; }
  body.home header.site .nav-drawer > ul > li > a {
    display: inline-flex;
    align-items: center;
    min-height: 4rem;
    font-family: var(--font-body);
    font-size: 1.2rem;
    letter-spacing: 0.04em;
    text-transform: none;
    padding: 0 0.1rem;
    white-space: nowrap;
    color: var(--text-on-dark);
    transition: color 0.3s ease;
  }
  /* スクロールで背景が出たら本文色へ戻す */
  body.home header.site.is-scrolled .nav-drawer > ul > li > a {
    color: var(--primary);
  }
  body.home header.site .nav-drawer .has-mega { position: relative; }
  body.home header.site .nav-drawer .mega-panel {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 16rem;
    padding: 0.6rem 0;
    margin: 0;
    background: var(--bg);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
    transform: translateY(0.4rem);
    z-index: 60;
    mix-blend-mode: normal;
  }
  body.home header.site .nav-drawer .has-mega:hover .mega-panel,
  body.home header.site .nav-drawer .has-mega:focus-within .mega-panel {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
  }
  body.home header.site .nav-drawer .mega-panel a {
    display: block;
    min-height: auto;
    font-size: 1.2rem;
    color: var(--text-sub);
    padding: 0.9rem 1.4rem;
    white-space: nowrap;
    mix-blend-mode: normal;
  }
  body.home header.site .nav-drawer .mega-panel a:hover { color: var(--primary); }
  @media (min-width: 1024px) {
    body.home header.site .nav-drawer { justify-content: flex-end; }
  }
}


/* Hero — 現行動画 100svh */
.home .hero {
  height: 100svh;
  min-height: 56rem;
  align-items: stretch;
  background: var(--surface-dark);
}
.home .hero .bg::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  background: rgba(68, 61, 62, 0.22);
  pointer-events: none;
}
.home .hero .bg::after {
  z-index: 3;
  background: none;
}
.home .hero .bg .hero-fv-img,
.home .hero .bg .hero-fv-video,
.home .hero .bg img,
.home .hero .bg video {
  width: 100%;
  max-width: none;
  height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 0;
  transform: scale(1.02);
  transition: opacity 1.2s ease, transform 4s ease-out;
}
.home .hero .bg .hero-fv-video,
.home .hero .bg video {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}
.home .hero .bg .hero-fv-fallback {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.home .hero.is-loaded .bg .hero-fv-img,
.home .hero.is-loaded .bg .hero-fv-video,
.home .hero.is-loaded .bg img,
.home .hero.is-loaded .bg video {
  opacity: 1;
  transform: scale(1);
}
.home .hero__copy {
  position: absolute;
  z-index: 4;
  top: clamp(10rem, 18vh, 14rem);
  right: clamp(2rem, 8vw, 12rem);
  transform: none;
  writing-mode: vertical-rl;
  font-family: var(--font-head);
  font-size: clamp(1.6rem, 2.4vw, 2rem);
  letter-spacing: 0.24em;
  color: var(--text-on-dark);
  line-height: 2;
  margin: 0;
  opacity: 0;
  transition: opacity 1.2s ease 0.4s;
  pointer-events: none;
}
.home .hero.is-loaded .hero__copy { opacity: 1; }

/* TopValue — meoto.jp #sec-value 準拠（About / id="about" も同構造で共用） */
.home .topvalue {
  position: relative;
  isolation: isolate;
  overflow: clip;
  background: var(--surface-dark);
  color: var(--text-on-dark);
}
.home .topvalue__cover {
  position: sticky;
  top: 0;
  left: 0;
  z-index: 1;
  width: 100%;
  height: 0.1rem;
}
.home .topvalue__bg {
  position: relative;
  width: 100%;
  height: calc(100svh + 10rem);
  overflow: hidden;
  background: var(--surface-dark);
}
.home .topvalue__bg::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(180deg, rgba(68, 61, 62, 0.35), rgba(68, 61, 62, 0.78));
  pointer-events: none;
}
.home .topvalue__bg img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.55;
  filter: saturate(0.55) contrast(0.95);
}
.home .topvalue__content {
  position: relative;
  z-index: 2;
  width: calc(100% - 4.4rem);
  max-width: none;
  margin-inline: auto;
  padding: 6.4rem 0 13rem;
}
.home .topvalue__item-pic { margin: 0; overflow: hidden; }
.home .topvalue__item-pic img { display: block; width: 100%; height: 100%; object-fit: cover; }
.home .topvalue__item-pic--1 { aspect-ratio: 522 / 626; }
.home .topvalue__item-pic--2 { aspect-ratio: 414 / 654; }
.home .topvalue__item-pic--3 { aspect-ratio: 526 / 798; }

.home .topvalue__body { margin-top: 4rem; }
.home .topvalue__list { padding: 0; margin: 0; }
.home .topvalue__item {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  border-top: none;
}
.home .topvalue__item:not(:first-child) { margin-top: 6rem; }
.home .topvalue__item-pic { width: 100%; }
.home .topvalue__item-copy {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-content: flex-start;
}
.home .topvalue__index {
  font-family: var(--font-en);
  font-style: italic;
  font-size: 1.1rem;
  letter-spacing: 0.08em;
  opacity: 0.65;
  flex: 0 0 auto;
  white-space: nowrap;
  padding-right: 1.2rem;
}
.home .topvalue__item-title {
  font-family: var(--font-head);
  flex: 1 1 0%;
  min-width: 0;
  font-size: 2rem;
  line-height: 1.4;
  margin-top: -0.32em;
}
/* 02 は和語見出しではなく英字（Pay Forward）。明朝のラテン字はトラッキングを少し開く */
.home .topvalue__item-title--en {
  letter-spacing: 0.02em;
}
.home .topvalue__text {
  font-size: 1.3rem;
  line-height: 1.9;
  letter-spacing: 0.08em;
  opacity: 0.85;
  width: 100%;
  margin: 2rem 0 0;
  /* 和文を両端揃えにして右端を画像と揃え、行末の letter-spacing 分を相殺する */
  text-align: justify;
  margin-right: -0.08em;
}

/* Tablet: 画像とテキストの対等2カラム */
@media (min-width: 600px) and (max-width: 1023px) {
  .home .topvalue__content {
    display: block;
    width: 84%;
    max-width: 108rem;
    margin-inline: auto;
    padding: 11.7302052786vw 0 11.7302052786vw;
  }
  .home .topvalue__body { width: 100%; padding-right: 0; margin-top: 0; }
  .home .topvalue__list { margin-top: 0; }
  .home .topvalue__item {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 4vw;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    border-top: none;
  }
  .home .topvalue__item:not(:first-child) { margin-top: 10vw; }
  .home .topvalue__item-pic { flex: 0 0 45%; width: 45%; max-width: none; }
  .home .topvalue__item-copy {
    flex: 1 1 0%;
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-content: flex-start;
  }
  .home .topvalue__index { flex-basis: 100%; padding-right: 0; margin-bottom: 1.4vw; }
  .home .topvalue__item-title { flex-basis: 100%; font-size: 2.6vw; }
  .home .topvalue__text { font-size: 1.6vw; margin-top: 2.4vw; }
}

@media (min-width: 1024px) {
  .home .topvalue__content {
    width: 75%;
    max-width: 108rem;
    margin-inline: auto;
    padding: clamp(8.5rem, 8.3333vw, 12rem) 0 clamp(8rem, 7.8vw, 11rem);
    display: block;
  }
  .home .topvalue__body { width: 100%; padding-right: 0; margin-top: 0; }
  .home .topvalue__list { margin-top: 0; }
  .home .topvalue__item {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: clamp(3rem, 4vw, 6rem);
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    border-top: none;
  }
  .home .topvalue__item:not(:first-child) { margin-top: clamp(8rem, 7.4vw, 10.6rem); }
  .home .topvalue__item-pic { flex: 0 0 45%; width: 45%; max-width: none; }
  .home .topvalue__item-copy {
    flex: 1 1 0%;
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-content: flex-start;
  }
  .home .topvalue__index { font-size: clamp(0.9rem, 0.88vw, 1.1rem); padding-right: clamp(0.8rem, 0.83vw, 1.2rem); }
  .home .topvalue__item-title { font-size: clamp(2.2rem, 2.5vw, 3.4rem); line-height: 1.45; margin-top: -0.3em; }
  .home .topvalue__text { font-size: clamp(1.3rem, 1.25vw, 1.7rem); line-height: 2; margin-top: clamp(2.9rem, 2.7778vw, 4rem); }
}

/* 600px+（2カラム）: 画像の高さをテキスト列に合わせる。img を absolute にして行高を決めさせない */
@media (min-width: 600px) {
  .home .topvalue__item-pic { position: relative; aspect-ratio: auto; }
  .home .topvalue__item-pic img { position: absolute; inset: 0; }
}

/* Company moving image board */
.home #company {
  overflow: hidden;
  /* ストリップ下端を区切り線へ寄せる。共通の section.block（corp-base.css）の
     padding-bottom = var(--section-y) は TOP では広すぎるため上書き。 */
  padding-bottom: clamp(6rem, 8vw, 10rem);
}
.home .company-board {
  position: relative;
  width: 100%;
  margin-top: clamp(8rem, 12vw, 16rem);
}
.home .company-board__track {
  display: flex;
  width: max-content;
  will-change: transform;
  animation: haleulu-board-loop 180s linear infinite;
  animation-play-state: paused;
}
.js-motion-ready .home .company-board__track { animation-play-state: running; }
.home .company-board__group {
  display: flex;
  flex: none;
  gap: 1.6rem;
  padding-right: 1.6rem;
}
/* 動画をトリミングせず流すため、高さを揃えて幅は素材の比率に追従させる。
   --board-ratio は story.php が素材の width/height から渡す。 */
.home .company-board__item {
  flex: none;
  height: clamp(33rem, 48vw, 64rem);
  width: auto;
  aspect-ratio: var(--board-ratio, 3 / 4);
  margin: 0;
  overflow: hidden;
  background-color: var(--surface);
}
.home .company-board__item img,
.home .company-board__item video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* 動画枠の静止画フォールバック。prefers-reduced-motion 時だけ出す。 */
.home .company-board__item .company-board__poster { display: none; }
@keyframes haleulu-board-loop {
  to { transform: translateX(-50%); }
}

/* Contact */
body.home #contact {
  /* ストリップ直下のため上余白は section-y より詰める。下はフッターとの間隔を維持。 */
  padding: clamp(8rem, 10vw, 12rem) 0 var(--section-y);
  background: var(--bg);
}
body.home #contact .section-label {
  margin-bottom: clamp(3.2rem, 5vw, 5.6rem);
}

body.home {
  overflow-x: clip;
}
html:has(body.home) {
  overflow-x: clip;
}

/* Content remains readable until motion JS owns initial states. */
.home [data-inview],
.home .reveal {
  opacity: 1;
  transform: none;
  filter: none;
}

@media (prefers-reduced-motion: reduce) {
  .home .hero .bg .hero-fv-img,
  .home .hero .bg .hero-fv-video,
  .home .hero .bg img,
  .home .hero .bg video {
    transition: none;
    opacity: 1;
    transform: none;
  }
  .home .hero .hero__copy {
    transition: none;
    opacity: 1;
    transform: none;
  }
  .home .hero .bg .hero-fv-video,
  .home .hero .bg video { display: none; }
  .home .hero .bg .hero-fv-fallback { opacity: 1; visibility: visible; }
  .home .value__picture img { transform: none; }
  .home .company-board__track {
    width: 100%;
    animation: none;
  }
  .home .company-board__group {
    width: 100%;
    padding: 0 var(--pad-x);
    overflow-x: auto;
  }
  .home .company-board__group[aria-hidden="true"] { display: none; }
  .home .company-board__item video { display: none; }
  .home .company-board__item .company-board__poster { display: block; }
}
