/* =========================================================
   UPSIDER Header — corporate-site (Header.tsx) 準拠
   名前空間: .uh / .uh__*  （旧 #header とは分離）
   トークンは style.css(:root) を参照。素のCSS（SCSSコンパイル不要）。
   ブレークポイント: xl = 1280px（これ未満はハンバーガー表示）
   ========================================================= */

/* ---- ヘッダー本体（固定・全幅） ---- */
.uh {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  height: var(--header-height);
  background-color: var(--color-bg);
  transition: background-color 300ms var(--ease-smooth);
  font-family: var(--font-sans);
  /* Next（Tailwind preflight）と同じ行間。reset.css の body{line-height:1} を上書き。
     CTA / ナビのボタン高さがこれで一致する。 */
  line-height: 1.5;
}

.uh__inner {
  max-width: 120rem;
  height: 100%;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

/* ---- ロゴ ---- */
.uh__logo {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
}
.uh__logo img {
  display: block;
  width: 120px;
  height: auto;
}

/* ---- デスクトップ・ナビ ---- */
.uh__nav {
  display: none;
  align-items: center;
  gap: 0.25rem;
}
.uh__link {
  display: inline-block;
  padding: 0.5rem 0.75rem;
  font-size: var(--text-small);
  font-weight: 500;
  white-space: nowrap;
  border-radius: 0.375rem;
  color: color-mix(in srgb, var(--color-text-primary) 70%, transparent);
  text-decoration: none;
  transition: color 200ms var(--ease-smooth), background-color 200ms var(--ease-smooth);
}
.uh__link:hover {
  color: var(--color-text-primary);
}
.uh__link.is-active {
  color: var(--color-text-primary);
}

/* ---- 右側アクション（言語切替 + 採用CTA） ---- */
.uh__actions {
  display: none;
  align-items: center;
  gap: 1rem;
}

/* 言語切替（Next 同様 JP/EN は表示書体 Gotham） */
.uh__lang {
  position: relative;
  font-family: var(--font-display);
}
.uh__lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.375rem;
  background: none;
  border: none;
  cursor: pointer;
  /* button は font-family / line-height を既定で継承しないため明示（Next の preflight 相当） */
  font-family: inherit;
  line-height: 1.5;
  font-size: var(--text-small);
  font-weight: 500;
  color: var(--color-text-secondary);
  transition: color 200ms var(--ease-smooth);
}
.uh__lang-btn:hover { color: var(--color-text-primary); }
.uh__lang-btn svg { display: block; }
.uh__lang-globe { width: 18px; height: 18px; }
.uh__lang-caret { width: 10px; height: 6px; transition: transform 200ms var(--ease-smooth); }
.uh__lang.is-open .uh__lang-caret { transform: rotate(180deg); }

.uh__lang-menu {
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 0.5rem;
  min-width: 96px;
  background: #fff;
  border-radius: var(--radius-card);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
  padding: 0.5rem 0;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 180ms var(--ease-smooth), transform 180ms var(--ease-smooth), visibility 180ms;
}
.uh__lang.is-open .uh__lang-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.uh__lang-item {
  display: block;
  padding: 0.625rem 1rem;
  text-align: center;
  font-size: var(--text-small);
  font-weight: 500;
  color: var(--color-text-secondary);
  text-decoration: none;
  transition: color 200ms var(--ease-smooth), background-color 200ms var(--ease-smooth);
}
.uh__lang-item:hover { color: var(--color-text-primary); background-color: var(--color-bg-elevated); }
.uh__lang-item.is-current { color: var(--color-text-primary); }
.uh__lang-item.is-disabled { color: var(--color-text-tertiary); opacity: 0.4; cursor: not-allowed; }

/* 採用CTA（黒ピル・モノクロ） */
.uh__cta {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1.25rem;
  font-size: var(--text-small);
  font-weight: 500;
  line-height: 1.5;
  border-radius: 9999px;
  white-space: nowrap;
  text-decoration: none;
  color: #fff;
  background-color: var(--color-bg-dark);
  transition: background-color 200ms var(--ease-smooth), color 200ms var(--ease-smooth);
}
.uh__cta:hover { background-color: #000; }
/* SPドロワー用の大きめCTA（Next mobile: px-6 py-3 text-body） */
.uh__cta--lg { padding: 0.75rem 1.5rem; font-size: var(--text-body); }

/* ---- ハンバーガー（xl 未満で表示） ---- */
.uh__burger {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 40px;
  height: 40px;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
.uh__burger-bar {
  display: block;
  width: 20px;
  height: 1px;
  background-color: var(--color-text-primary);
  transition: transform 300ms var(--ease-smooth), opacity 300ms var(--ease-smooth);
}
.uh__burger.is-open .uh__burger-bar:nth-child(1) { transform: translateY(3.5px) rotate(45deg); }
.uh__burger.is-open .uh__burger-bar:nth-child(2) { opacity: 0; }
.uh__burger.is-open .uh__burger-bar:nth-child(3) { transform: translateY(-3.5px) rotate(-45deg); }

/* ---- レスポンシブ切替（xl = 1280px） ---- */
@media (min-width: 1280px) {
  .uh__nav { display: flex; }
  .uh__actions { display: flex; }
  .uh__burger { display: none; }
}

/* body スクロールロック（SPメニュー展開時） */
body.uh-no-scroll { overflow: hidden; }

/* =========================================================
   メガメニュー（デスクトップ）
   ========================================================= */
.uh-mega {
  position: fixed;
  left: 0;
  right: 0;
  top: var(--header-height);
  z-index: 45;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-16px);
  filter: blur(8px);
  pointer-events: none;
  transition: opacity 0.5s var(--ease-smooth), transform 0.5s var(--ease-smooth),
    filter 0.5s var(--ease-smooth), visibility 0.5s;
}
.uh-mega.is-open {
  opacity: 1;
  visibility: visible;
  transform: none;
  filter: none;
  pointer-events: auto;
}
.uh-mega__inner {
  /* Next: メガパネルの中身はヘッダーバー(120rem)ではなく container 幅(90rem) */
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 3rem 2.5rem; /* py-12 px-10 */
}

/* 見出し / すべて見る / グループ見出し */
.uh-mega__title {
  font-family: var(--font-display);
  font-size: var(--text-section-title);
  font-weight: 500;
  letter-spacing: var(--tracking-tight);
  color: var(--color-text-primary);
}
.uh-mega__viewall {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.75rem;
  font-size: var(--text-small);
  font-weight: 500;
  color: var(--color-text-primary);
  text-decoration: none;
  white-space: nowrap;
}
.uh-mega__viewall span { transition: transform 0.2s var(--ease-smooth); }
.uh-mega__viewall:hover span { transform: translateX(3px); }
.uh-mega__grouplabel {
  font-family: var(--font-display); /* Next: .uppercase ラベルは Gotham */
  font-size: var(--text-caption);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--color-text-tertiary);
  margin-bottom: 0.5rem;
}

/* default パネル（タイトル左・グループ右） */
.uh-mega__cols {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 2rem 3rem;
}
.uh-mega__aside { grid-column: span 3; }
.uh-mega__groups {
  grid-column: span 9;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem 2rem;
}
.uh-mega__group { display: flex; flex-direction: column; }
.uh-mega__link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0;
  font-size: 1.25rem;
  line-height: 1.35;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--color-text-secondary);
  text-decoration: none;
  transition: color 0.2s var(--ease-smooth);
}
.uh-mega__link:hover { color: var(--color-text-primary); }
/* 外部リンクアイコン（Next ExternalLinkIcon 相当） */
.uh-ext-icon { flex-shrink: 0; opacity: 0.6; }

/* カード系パネル（Services / News / Stories）共通 head */
.uh-mega__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 2rem;
}
.uh-mega__headleft { display: flex; align-items: baseline; gap: 1.5rem; }
.uh-mega__head .uh-mega__viewall { margin-top: 0; }
.uh-mega__inline {
  font-size: var(--text-small);
  color: var(--color-text-secondary);
  text-decoration: none;
}
.uh-mega__inline:hover { color: var(--color-text-primary); }

.uh-mega__cards { display: grid; gap: 1.5rem; }
.uh-mega__cards--4 { grid-template-columns: repeat(4, 1fr); }

/* Service カード */
.uh-svc {
  position: relative;
  display: block;
  height: 12rem;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  text-decoration: none;
  transition: box-shadow 0.3s var(--ease-smooth), border-color 0.3s var(--ease-smooth);
}
.uh-svc:hover { box-shadow: 0 10px 30px rgba(0, 0, 0, 0.10); border-color: var(--color-border-hover); }
.uh-svc__photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.3s var(--ease-smooth);
}
.uh-svc.has-photo:hover .uh-svc__photo { opacity: 1; }
.uh-svc__scrim {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  opacity: 0;
  transition: opacity 0.3s var(--ease-smooth);
}
.uh-svc.has-photo:hover .uh-svc__scrim { opacity: 1; }
.uh-svc__body {
  position: absolute;
  inset: 0;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
}
.uh-svc__logo {
  position: relative;
  display: inline-block;
  height: calc(1.5rem * var(--logo-scale, 1));
}
.uh-svc__logo img {
  display: block;
  height: 100%;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  object-position: left;
}
.uh-svc__logo-color { transition: opacity 0.3s var(--ease-smooth), filter 0.3s var(--ease-smooth); }
.uh-svc__logo-white { position: absolute; left: 0; top: 0; opacity: 0; transition: opacity 0.3s var(--ease-smooth); }
/* logoWhite あり: hover で白ロゴへ差し替え */
.uh-svc.has-photo:hover .uh-svc__logo.has-white .uh-svc__logo-color { opacity: 0; }
.uh-svc.has-photo:hover .uh-svc__logo.has-white .uh-svc__logo-white { opacity: 1; }
/* logoWhite なし: hover で色ロゴを白へ反転 */
.uh-svc.has-photo:hover .uh-svc__logo:not(.has-white) .uh-svc__logo-color { filter: brightness(0) invert(1); }
.uh-svc__name {
  font-size: var(--text-body);
  font-weight: 700;
  line-height: 1.35;
  color: var(--color-text-primary);
  transition: color 0.3s var(--ease-smooth);
}
.uh-svc.has-photo:hover .uh-svc__name { color: #fff; }
.uh-svc__desc {
  margin-top: 0.75rem;
  font-size: var(--text-small);
  line-height: 1.6;
  color: var(--color-text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color 0.3s var(--ease-smooth);
}
.uh-svc.has-photo:hover .uh-svc__desc { color: rgba(255, 255, 255, 0.85); }

/* News / Stories カード（サムネ上・テキスト下） */
.uh-news, .uh-story { display: block; text-decoration: none; }
.uh-news__thumb, .uh-story__thumb {
  display: block;
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-card);
  overflow: hidden;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
}
.uh-news__thumb img, .uh-story__thumb img { width: 100%; height: 100%; object-fit: cover; }
.uh-news__date, .uh-story__company {
  display: block;
  margin-top: 0.75rem;
  font-size: var(--text-caption);
  color: var(--color-text-tertiary);
}
.uh-news__date { font-family: var(--font-display); }
.uh-news__title, .uh-story__title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 0.25rem;
  font-size: var(--text-small);
  line-height: 1.4;
  color: var(--color-text-secondary);
  transition: color 0.2s var(--ease-smooth);
}
.uh-news:hover .uh-news__title, .uh-story:hover .uh-story__title { color: var(--color-text-primary); }

/* サムネ右下のコーナー矢印バッジ（ThumbArrow 相当） */
.uh-thumb-arrow {
  pointer-events: none;
  position: absolute;
  bottom: 0.75rem;
  right: 0.75rem;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 9999px;
  background: #fff;
  color: #000;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06), 0 2px 10px rgba(0, 0, 0, 0.18);
  opacity: 0;
  transform: translateY(0.375rem) scale(0.9);
  transition: opacity 450ms var(--ease-smooth), transform 450ms var(--ease-smooth);
}
.uh-news:hover .uh-thumb-arrow,
.uh-story:hover .uh-thumb-arrow {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.uh-thumb-arrow__clip {
  position: relative;
  display: inline-block;
  width: 13px;
  height: 13px;
  overflow: hidden;
}
.uh-thumb-arrow__i {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 450ms var(--ease-smooth);
}
.uh-thumb-arrow__i--2 { transform: translate(-130%, 130%); }
.uh-news:hover .uh-thumb-arrow__i--1,
.uh-story:hover .uh-thumb-arrow__i--1 { transform: translate(130%, -130%); }
.uh-news:hover .uh-thumb-arrow__i--2,
.uh-story:hover .uh-thumb-arrow__i--2 { transform: translate(0, 0); }

/* 背景ブラー */
.uh-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s var(--ease-smooth), visibility 0.3s;
}
.uh-backdrop.is-open { opacity: 1; visibility: visible; }

/* メガメニューはデスクトップ(xl)のみ */
@media (max-width: 1279.98px) {
  .uh-mega, .uh-backdrop { display: none; }
}

/* =========================================================
   SPメニュー（ハンバーガー・ドロワー）
   ========================================================= */
.uh-drawer {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: var(--color-bg);
  /* Next のドロワーは announcement の ON/OFF に関わらず chrome-height 固定 */
  padding-top: var(--chrome-height);
  overflow-y: auto;
  /* reset.css の body{line-height:1} を上書き（Next は 1.5 を継承） */
  font-family: var(--font-sans);
  line-height: 1.5;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 0.3s var(--ease-smooth), transform 0.3s var(--ease-smooth), visibility 0.3s;
}
.uh-drawer.is-open { opacity: 1; visibility: visible; transform: none; }
.uh-drawer__inner {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 2rem 1.5rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 2.25rem;
}
.uh-drawer__label {
  font-family: var(--font-display); /* Next: .uppercase ラベルは Gotham */
  font-size: var(--text-caption);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--color-text-tertiary);
  margin-bottom: 0.5rem;
}
.uh-drawer__links { display: flex; flex-direction: column; }
.uh-drawer__link {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.625rem 0;
  font-size: var(--text-body);
  color: var(--color-text-secondary);
  text-decoration: none;
  transition: color 0.2s var(--ease-smooth);
}
.uh-drawer__link:hover { color: var(--color-text-primary); }
.uh-drawer__link.is-muted {
  padding: 0.5rem 0;
  font-size: var(--text-small);
  color: var(--color-text-tertiary);
}
.uh-drawer__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border);
}
.uh-drawer__privacy { display: flex; flex-direction: column; }

/* ドロワーはデスクトップ(xl)では非表示（PCはメガメニュー） */
@media (min-width: 1280px) { .uh-drawer { display: none; } }
