/* ==========================================================================
   事業テーマ (/theme) — 建設業界の現状 / 解決すべき課題 / 何をやっているか を
   1ページに集約し、タブ(JS)で表示切替。slug 'theme' で自動読込。
   ========================================================================== */

.theme-page {
  background: var(--color-bg-surface);
  box-shadow: 0 0 0 100vmax var(--color-bg-surface);
  clip-path: inset(0 -100vmax);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-8);
  /* 40px */
  max-width: var(--canvas-width);
  margin-inline: auto;
  padding: 0 var(--space-24) var(--space-24);
  /* 120px */
}

/* 導入ヒーロー「主語は建設業界」(/career の career-lead と同じ: 全画面・中央・緑) */
.theme-page-lead {
  /* モバイルで FV をデバイス高に追従させる際の控除分(sticky ヘッダー高) */
  --theme-first-view-offset: 59px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 864px;
  padding: var(--space-8) var(--gutter);
  background: var(--color-bg-surface);
  box-shadow: 0 0 0 100vmax var(--color-bg-surface);
  clip-path: inset(0 -100vmax);
}

.theme-page-lead__text {
  margin: 0;
  font-family: var(--font-medium);
  font-weight: var(--fw-heading);
  font-size: 2em;
  line-height: 2.2;
  letter-spacing: 0.19em;
  color: var(--color-brand-primary);
  text-align: center;
}

/* --- Introduce(見出し+タブ+リード文) -------------------------------------- */
.theme-intro {
  display: flex;
  flex-direction: column;
  gap: 40px;
  /* Figma: 見出し行 → リード文 56px */
  width: 100%;
}

.theme-intro__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
}

.theme-intro__title {
  margin: 0;
  font-family: var(--font-heading);
  font-weight: 300;
  font-size: var(--fs-headline-md);
  /* 24px */
  line-height: 2.2;
  letter-spacing: 0.13em;
  /* 3.12px @24 */
  color: var(--color-text-default);
  white-space: nowrap;
}

/* チャプタータブ(右上) */
.theme-tabs {
  display: flex;
  gap: var(--space-2);
  /* 8px */
  align-items: flex-start;
}

.theme-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  /* 12 16 */
  /* button リセット(タブは button[data-target]) */
  appearance: none;
  background: none;
  border: 0;
  cursor: pointer;
  font-family: var(--font-medium);
  font-weight: 500;
  font-size: var(--fs-label-xs);
  line-height: 16px;
  letter-spacing: var(--tracking-wide);
  color: var(--color-text-muted);
  white-space: nowrap;
  transition: color var(--transition-hover);
  /* Figma: ディゾルブ / イーズインアウト / 80ms */
}

.theme-tab:hover {
  opacity: 1;
  color: var(--color-text-subtle);
}

.theme-tab.is-active {
  gap: var(--space-1);
  padding-bottom: 6px;
  color: var(--color-brand-primary);
}

.theme-tab.is-active .theme-tab__indicator {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--color-brand-primary);
}

.theme-tab__indicator {
  display: none;
}

/* リード文 */
.theme-intro__lead {
  margin: 0;
  font-family: var(--font-base);
  font-weight: var(--fw-normal);
  font-size: var(--fs-body-md);
  /* 16px */
  line-height: 28px;
  letter-spacing: var(--tracking-wide);
  color: var(--color-text-default);
}

.theme-intro__lead a {
  color: var(--color-brand-primary);
  text-decoration: underline;
  transition: color var(--transition-hover);
}

.theme-intro__lead a:hover {
  color: var(--color-brand-primary-hover);
}

/* --- MainContent(ServiceFeature の縦並び) -------------------------------- */
.theme-main {
  display: flex;
  flex-direction: column;
  gap: 56px;
  width: 100%;
}

/* 下部チャプタータブ(右寄せ・本文の後ろに再掲) */
.theme-chapter-nav {
  display: flex;
  justify-content: flex-end;
  width: 100%;
  padding-top: var(--space-4);
  /* Figma: pt-16 */
}

.theme-feature {
  display: flex;
  gap: var(--space-8);
  /* 40px */
  align-items: center;
  width: 100%;
}

.theme-feature__visual {
  flex: 0 0 364px;
  width: 364px;
  height: 244px;
  border-radius: 0;
  overflow: hidden;
}

.theme-feature__visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.theme-feature__body {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  /* 12px */
  align-items: flex-start;
}

.theme-feature__title {
  margin: 0;
  font-family: var(--font-medium);
  font-weight: 500;
  font-size: var(--fs-title-sm);
  /* PC: 24px(SP は 16px) */
  line-height: 2.2;
  letter-spacing: 0.06em;
  color: var(--color-text-default);
}

.theme-feature__text {
  margin: 0;
  font-family: var(--font-base);
  font-weight: var(--fw-normal);
  font-size: var(--fs-body-md);
  line-height: 28px;
  letter-spacing: var(--tracking-wide);
  color: var(--color-text-subtle);
}

.theme-feature__text+.theme-feature__text {
  margin-top: 0;
}

.theme-feature__text a {
  color: var(--color-brand-primary);
  text-decoration: underline;
  transition: color var(--transition-hover);
}

.theme-feature__text a:hover {
  color: var(--color-brand-primary-hover);
}

/* 出典・リンク行 */
.theme-source {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
  padding-top: var(--space-2);
  font-family: var(--font-base);
  font-weight: var(--fw-normal);
  font-size: var(--fs-body-sm);
  /* 14px */
  line-height: 24px;
  letter-spacing: var(--tracking-wide);
  color: var(--color-text-default);
}

.theme-source__label {
  white-space: nowrap;
}

.theme-source a {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  color: var(--color-brand-primary);
  text-decoration: underline;
  transition: color var(--transition-hover);
}

.theme-source a:hover {
  color: var(--color-brand-primary-hover);
}

.theme-source a .icon-external {
  flex: 0 0 auto;
}

/* --- Responsive ----------------------------------------------------------
   このページは ≤1240px で SP 表示に統一する(2段のモバイル指定を両方 1240px へ)。
   -------------------------------------------------------------------------- */
@media (max-width: 1240px) {
  .theme-page {
    padding: var(--space-10) var(--space-5);
    gap: var(--space-6);
  }

  .theme-page-lead {
    /* 他ページ(career/home)の FV と同様、デバイス高いっぱいに */
    min-height: calc(100dvh - var(--theme-first-view-offset));
    padding: var(--space-10) var(--gutter);
  }

  .theme-page-lead__text {
    font-size: var(--fs-title-sm);
    line-height: 2;
  }

  .theme-intro {
    gap: var(--space-5);
  }

  .theme-intro__header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-4);
  }

  .theme-intro__title {
    white-space: normal;
    font-size: var(--fs-body-md);
    /* SP: 16px */
  }

  .theme-intro__lead {
    font-size: var(--fs-label-md);
    /* SP: 12px */
  }

  .theme-tabs {
    flex-wrap: wrap;
    width: 100%;
    justify-content: space-between;
    gap: var(--space-1);
  }

  .theme-tab {
    flex: 1 1 0;
    padding: var(--space-2) var(--space-1);
  }

  .theme-main {
    gap: var(--space-8);
  }

  .theme-feature {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-4);
  }

  .theme-feature__title {
    font-size: var(--fs-body-md);
    /* SP: 16px */
  }

  .theme-feature__text {
    font-size: var(--fs-label-md);
    /* SP: 12px */
  }

  .theme-feature__visual {
    flex-basis: auto;
    width: 100%;
    height: auto;
    aspect-ratio: 364 / 244;
  }
}

/* --------------------------------------------------------------------------
   タブ切替(page-theme.js)— 章パネルの表示制御。
   - 既定(JS無効): 全パネルを縦に表示(全章が読める / SEOも全文)。
   - .js-tabs(JS有効時に付与): アクティブ章だけ表示し、タブで切替。
   -------------------------------------------------------------------------- */
/* 1章ぶん(intro + main + 下部タブ)の縦並び。.theme-page の子として配置。 */
.theme-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
  width: 100%;
  /* 下タブから切替時のスクロール先が sticky header(59px)に隠れないように */
  scroll-margin-top: 59px;
}

/* JS有効時のみ単一表示に切り替える */
.theme-page.js-tabs .theme-panel {
  display: none;
}

.theme-page.js-tabs .theme-panel.is-active {
  display: flex;
  animation: theme-fade 0.18s ease;
}

@keyframes theme-fade {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}