/* ======================================================================
   11_components_hero.css
   - Hero (common) + Topix (news-item風) + hero-title animation
======================================================================== */

/* =========================
   Hero
========================= */
.hero {
  position: relative;
  background: var(--white);
  overflow: hidden;
}

/* 左下→右上へ伸びるピンク面（向きを反転） */
.hero::before {
  content: "";
  position: absolute;
  bottom: -58%;
  left: 0%;
  width: 120%;
  height: 110%;
  background: var(--pink);
  z-index: 0;
  border-top-right-radius: 80% 70%;
}

.hero-inner {
  position: relative;
  z-index: 1;
}

.hero-image {
  position: relative;
}

.hero-image img {
  display: block;
}

.hero-deco {
  position: absolute;
  z-index: 3;
}

.hero-deco img {
  width: clamp(80px, 12vw, 160px);
  pointer-events: none;
}

.hero-deco--top-right {
  top: -190px;
  right: 3rem;
}

.hero-deco--bottom-left {
  right: -40px;
  bottom: 100px;
}

.hero-content {
  position: relative;
  text-align: center;
}

.hero-lead {
  font-size: clamp(0.9rem, 1.5vw, 1rem);
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}

.hero-title {
  font-size: clamp(1.375rem, 4vw, 2.125rem);
  margin-bottom: 16px;

  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;

  text-align: center;
}

/* 行コンテナ（1行分） */
.hero-title__line {
  display: inline-block;
  line-height: 1.25;
  white-space: nowrap; /* 好みで。改行させたいなら外してOK */
}

/* 旗アイコン（h1直下のimgだけ狙う） */
.hero-title > img {
  width: 170px;
  height: auto;
  vertical-align: middle;
  margin-right: 8px;
  display: inline-block; /* blockにしない */
}

/* 2行目の微調整 */
.hero-title__line2 {
  display: inline-block;
  margin-left: 1em;
}

.hero-text {
  font-size: clamp(1rem, 1.6vw, 1.125rem);
  line-height: 1.8;
}

/* =========================
   HERO TOPIX（news-item風・リンク化）
   - HTML想定
     <div class="hero-topix">
       <ul>
         <li class="topix-item">
           <a class="topix-link" href="">
             <span class="topix-title">お知らせ</span>
             <span class="topix-text">本文...</span>
             <span class="news-arrow" aria-hidden="true"></span>
           </a>
         </li>
       </ul>
     </div>
========================= */

/* 白背景・角丸の箱（hero内の小カード） */
.hero-topix {
  background: var(--white);
  border-radius: var(--radius-20);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  z-index: 6;
  box-sizing: border-box;
}

.hero-topix ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.hero-topix .topix-item {
  list-style: none;
}

/* 本体リンク：PCは3カラムでnews-item風 */
.hero-topix .topix-link {
  display: grid;
  grid-template-columns: 120px 1fr 28px; /* news-item準拠 */
  align-items: center;
  gap: 16px;

  padding: 14px 16px; /* クリック領域 */
  color: inherit;
  text-decoration: none !important;

  transition: background var(--trans-base) ease;
}

/* 左：ラベル */
.hero-topix .topix-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--turquoise);
  white-space: nowrap;
}

/* 中央：本文（長文対策込み） */
.hero-topix .topix-text {
  min-width: 0;
  line-height: 1.6;

  overflow-wrap: anywhere; /* 長い英数字/URLでも崩れにくい */
  word-break: break-word;

  /* PC：1行省略 */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 右：矢印は既存.news-arrowを流用（見た目はそちらで定義） */
.hero-topix .news-arrow {
  justify-self: end;
}

/* hover（news-item寄せ） */
.hero-topix .topix-link:hover {
  background: rgba(0, 0, 0, 0.04);
}

.hero-topix .topix-link:hover .news-arrow {
  background: var(--turquoise);
  transform: translateX(2px);
}

.hero-topix .topix-link:hover .topix-text {
  color: var(--turquoise);
}

/* スマホ：ラベルを上段 + 本文2行 + 矢印固定 */
@media (max-width: 767px) {
  .hero-topix .topix-link {
    grid-template-areas:
      "label arrow"
      "text  arrow";
    grid-template-columns: 1fr 28px;
    gap: 4px 10px;

    padding: 0px;
    min-height: 56px; /* 指で押しやすい */
  }

  .hero-topix .topix-title {
    grid-area: label;
  }

  .hero-topix .topix-text {
    grid-area: text;

    /* 2行まで（…で省略） */
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;

    white-space: normal;
    overflow: hidden;
    text-overflow: ellipsis;

    line-height: 1.5;
    max-height: calc(1.5em * 2);
  }

  .hero-topix .news-arrow {
    grid-area: arrow;
    align-self: center;
    justify-self: end;
  }
}

/* =========================
   hero-title animation（文字分割）
========================= */
.hero-title__char {
  display: inline-block;
  opacity: 0;
  transform: rotate(45deg) translateY(16px);
  transform-origin: 50% 70%;
  will-change: transform, opacity;

  animation: heroLetter 0.6s cubic-bezier(0.25, 1, 0.5, 1) forwards;
  animation-delay: var(--d, 0s);

  /* color lock */
  color: currentColor;
}

/* 発火前は止める */
.hero-title:not(.is-active) .hero-title__char {
  animation: none;
  opacity: 0;
  transform: rotate(45deg) translateY(16px);
  animation-play-state: paused;
}

@keyframes heroLetter {
  to {
    opacity: 1;
    transform: rotate(0) translateY(0);
  }
}

/* imgはそのまま横並びにしたい場合（必要なら） */
.hero-title img {
  vertical-align: middle;
  margin-right: 8px;
}

/* =========================
   hero-title color lock（ちらつき対策）
========================= */
.hero-title,
.hero-title * {
  color: inherit;
}
