/* ==========================================================================
   wp-override.css — 外部ベンダー提供の「About AlphaTheta」LP（our-story）を
   alphatheta.com の WordPress（テンプレート FREE_HTML）に組み込むための上書き CSS。

   読み込み順（build_fragments.py が生成する断片の先頭）:
     styles.min.css → components.min.css → pages/about.min.css → 本ファイル
   ※ ベンダーの base.min.css は読み込まない。body / h1〜h4 / img / svg / button
     などへ素のセレクタで効くため、サイト側ヘッダ・フッタまで崩してしまう。
     必要なルールだけを本ファイル §2 に「.atc-our-story 配下限定」で移植している。

   LP 本体は <div class="atc-our-story"> で包まれている前提。

   §1  WordPress の外枠（FREE_HTML テンプレート）を LP 用に開放
   §2  base.css の移植（.atc-our-story 配下限定・低詳細度）
   §3  .user_content（記事本文用スタイル）の打ち消し
   §4  rem の補正（サイトは html { font-size: 62.5% } で 1rem = 10px）
   §5  サイト側の固定ヘッダとの共存（sticky / fixed 要素のオフセット）
   §6  LP が <main> / <body> 直下構造を前提にしている箇所の付け替え
   §7  サイト側ヘッダとのクラス名衝突
   ========================================================================== */

/* サイト側ヘッダ（#header, position: fixed）の高さ。
   src/assets_src/_mixins.scss の $headerHeightPC / $headerHeightSP と
   ブレークポイント $breakpoint-headerSP-Max (809.99px) に合わせる。 */
:root {
  --atc-wp-header-h: 60px;
  /* LP の .page-nav（ページ内リンクの帯）の高さ: 44px のリンク + 上下 8px。 */
  --atc-page-nav-h: 60px;
}

@media screen and (max-width: 809.99px) {
  :root {
    --atc-wp-header-h: 55px;
  }
}

/* --------------------------------------------------------------------------
   §1 WordPress の外枠
   page-freehtml.php は main#content.free_html > .inner（幅 1011px 固定）
   > article > .inner_content の中に本文を出す。全幅レイアウトの LP なので
   幅制限と下余白（170px）を外す。#footer 内の .inner には触れないよう
   main 直下に限定する。
   -------------------------------------------------------------------------- */

#content.free_html:has(.atc-our-story) {
  padding-bottom: 0;
}

#content.free_html:has(.atc-our-story) > .inner {
  width: auto;
  max-width: none;
  margin: 0;
}

/* --------------------------------------------------------------------------
   §2 base.css の移植
   :where() で詳細度を元の base.css と同じ（要素 = 0,0,1 / クラス = 0,1,0）に
   保ち、about.css / components.css のクラス指定が従来どおり勝つようにする。
   -------------------------------------------------------------------------- */

html:has(.atc-our-story) {
  -webkit-text-size-adjust: 100%;
  /* スクロール連動アニメーションが多いのでスムーズスクロールにしない（元の base.css と同じ）。 */
  scroll-behavior: auto;
  /* アンカー移動先がページ内リンク帯に隠れないように（元の base.css と同じ 64px）。
     帯はサイト側ヘッダに重ねて画面最上端に出す（§5）ので、ヘッダの高さは足さない。 */
  scroll-padding-top: calc(var(--atc-page-nav-h) + 4px);
}

:where(.atc-our-story) *,
:where(.atc-our-story) *::before,
:where(.atc-our-story) *::after {
  box-sizing: border-box;
}

:where(.atc-our-story) :is(h1, h2, h3, h4, p, figure, blockquote, dl, dd) {
  margin: 0;
}

:where(.atc-our-story) :is(h1, h2, h3, h4) {
  font-weight: var(--font-weight-light);
}

:where(.atc-our-story) :is(ul, ol) {
  margin: 0;
  padding: 0;
  list-style: none;
}

:where(.atc-our-story) a {
  color: inherit;
  text-decoration: none;
}

:where(.atc-our-story) :is(img, video, svg) {
  display: block;
  max-width: 100%;
}

:where(.atc-our-story) button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

:where(.atc-our-story) :focus-visible {
  outline: var(--border-width-strong) solid currentColor;
  outline-offset: var(--space-1);
}

:where(.atc-our-story) .visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* 表示サイズの段階切替（base.css より。typography.css の既定値を上書きする） */
:where(.atc-our-story) .ds-display-xl {
  font-size: var(--text-heading-xl);
  line-height: var(--leading-heading-xl);
}

:where(.atc-our-story) .ds-display-l {
  font-size: var(--text-heading-xl);
  line-height: var(--leading-heading-xl);
}

:where(.atc-our-story) .ds-display-s {
  font-size: var(--text-heading-l);
  line-height: var(--leading-heading-l);
}

:where(.atc-our-story) .ds-heading-xl {
  font-size: var(--text-heading-m);
  line-height: var(--leading-heading-m);
}

@media (min-width: 600px) {
  :where(.atc-our-story) .ds-display-xl {
    font-size: var(--text-display-m);
    line-height: var(--leading-display-m);
  }

  :where(.atc-our-story) .ds-display-l {
    font-size: var(--text-display-s);
    line-height: var(--leading-display-s);
  }
}

@media (min-width: 900px) {
  :where(.atc-our-story) .ds-display-xl {
    font-size: var(--text-display-l);
    line-height: var(--leading-display-l);
  }

  :where(.atc-our-story) .ds-display-l {
    font-size: var(--text-display-m);
    line-height: var(--leading-display-m);
  }

  :where(.atc-our-story) .ds-display-s {
    font-size: var(--text-display-s);
    line-height: var(--leading-display-s);
  }

  :where(.atc-our-story) .ds-heading-xl {
    font-size: var(--text-heading-xl);
    line-height: var(--leading-heading-xl);
  }
}

@media (min-width: 1200px) {
  :where(.atc-our-story) .ds-display-xl {
    font-size: var(--text-display-xl);
    line-height: var(--leading-display-xl);
  }

  :where(.atc-our-story) .ds-display-l {
    font-size: var(--text-display-l);
    line-height: var(--leading-display-l);
  }
}

@media (prefers-reduced-motion: reduce) {
  :where(.atc-our-story) *,
  :where(.atc-our-story) *::before,
  :where(.atc-our-story) *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* --------------------------------------------------------------------------
   §3 .user_content の打ち消し
   FREE_HTML の本文には記事用スタイル（.user_content を @extend した
   「#content.free_html article .inner_content h2」等、詳細度 1,2,2）が効き、
   見出しの太字化・サイズ変更・余白、段落の margin-top、リンク下線、
   リストのマーカー/インデントが LP に乗ってしまう。
   以下は「#content.free_html .inner_content .atc-our-story」（1,3,0）を起点に
   それらを LP 本来の値へ戻す。ここで戻した要素は LP 側のクラス指定より
   詳細度が上になるため、LP 側で同じプロパティを指定しているもの
   （見出しのタイプスケール、一部段落の余白、年表リストの左右余白）は
   ここで改めて指定し直している。
   -------------------------------------------------------------------------- */

/* ラッパー: base.css の body 相当（.inner_content の font-size 1.6rem と
   line-height 1.875em = 30px 固定値の継承を断つ）。>div の margin-top も消す。 */
#content.free_html .inner_content .atc-our-story {
  margin: 0;
  padding: 0;
  background-color: var(--surface-page);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: var(--text-body-m);
  font-weight: var(--font-weight-regular);
  line-height: var(--leading-body-m);
  -webkit-font-smoothing: antialiased;
}

/* 見出し: #content.free_html .inner h1（60px / bold / margin-top 84px）と
   .user_content h2〜h4（bold / em 指定のサイズ・余白）を打ち消す */
#content.free_html .inner_content .atc-our-story :is(h1, h2, h3, h4) {
  margin: 0;
  padding: 0;
  font-weight: var(--font-weight-light);
}

/* クラスの無い見出し（.visually-hidden 等）はブラウザ既定のサイズに戻す */
#content.free_html .inner_content .atc-our-story :is(h1, h2, h3, h4) {
  line-height: inherit;
}

#content.free_html .inner_content .atc-our-story h1 {
  font-size: 2em;
}

#content.free_html .inner_content .atc-our-story h2 {
  font-size: 1.5em;
}

#content.free_html .inner_content .atc-our-story h3 {
  font-size: 1.17em;
}

#content.free_html .inner_content .atc-our-story h4 {
  font-size: 1em;
}

/* 見出しに付いているタイプスケールを改めて適用（typography.css + base.css 相当） */
#content.free_html .inner_content .atc-our-story :is(h2, h3).ds-display-s {
  font-size: var(--text-heading-l);
  line-height: var(--leading-heading-l);
}

#content.free_html .inner_content .atc-our-story :is(h2, h3).ds-heading-xl {
  font-size: var(--text-heading-m);
  line-height: var(--leading-heading-m);
}

@media (min-width: 900px) {
  #content.free_html .inner_content .atc-our-story :is(h2, h3).ds-display-s {
    font-size: var(--text-display-s);
    line-height: var(--leading-display-s);
  }

  #content.free_html .inner_content .atc-our-story :is(h2, h3).ds-heading-xl {
    font-size: var(--text-heading-xl);
    line-height: var(--leading-heading-xl);
  }
}

#content.free_html
  .inner_content
  .atc-our-story
  :is(h1, h2, h3, h4).visually-hidden {
  margin: -1px;
}

/* 段落: .user_content p { margin-top: 1.875em } と h2 + p { margin-top: .5em } */
#content.free_html .inner_content .atc-our-story p {
  margin-top: 0;
}

#content.free_html .inner_content .atc-our-story p.visually-hidden {
  margin-top: -1px;
}

/* LP 側で段落に margin-top を付けているもの（about.css / components.css） */
#content.free_html .inner_content .atc-our-story .hero__intro {
  margin-top: var(--space-6);
}

#content.free_html .inner_content .atc-our-story .ds-accordion__panel > p + p {
  margin-top: var(--space-4);
}

/* ja / zh の「リンク先は英語のページです」注記（Start DJing ボタンの直下に寄せる） */
#content.free_html .inner_content .atc-our-story .cta-words__note {
  margin-top: calc(-1 * var(--space-2));
}

/* リンク: .user_content a { text-decoration: underline } */
#content.free_html .inner_content .atc-our-story a {
  text-decoration: none;
}

/* リスト: .user_content ul / ol の disc・decimal と padding-inline-start: 1.5em */
#content.free_html .inner_content .atc-our-story :is(ul, ol) {
  padding-inline-start: 0;
  list-style: none;
}

/* 年表（ol.timeline__track）の左右余白は LP 側の指定に戻す（about.css 同様の条件分岐）。
   スクロール連動の有効判定は about.css の「Scroll motion switch」と同じく
   --scroll-motion のスタイルクエリで行う（scroll-driven animations 非対応の
   Safari 18 以前では main.js が html.is-scroll-scripted を付けて有効化する）。 */
#content.free_html .inner_content .atc-our-story .timeline__track {
  padding-inline-start: var(--container-pad);
}

@container style(--scroll-motion: on) {
  @media (prefers-reduced-motion: no-preference) {
    #content.free_html .inner_content .atc-our-story .timeline__track {
      padding-inline-start: 50vw;
    }
  }
}

/* --------------------------------------------------------------------------
   §4 rem の補正
   ベンダー CSS は 1rem = 16px（ブラウザ既定）前提。サイトは
   html { font-size: 62.5% }（1rem = 10px）なので、rem を使っている箇所を
   元の条件・同じ対象のまま px に置き換える。
   -------------------------------------------------------------------------- */

.atc-our-story .heritage__copy,
.atc-our-story .name__copy {
  max-width: 480px; /* 30rem */
}

.atc-our-story .carousel__copy {
  max-width: 480px; /* 30rem */
}

.atc-our-story .carousel__bar {
  width: 128px; /* 8rem */
}

.atc-our-story .cta-words {
  max-width: 480px; /* 30rem */
}

.atc-our-story .cta-band__orbs {
  width: max(100%, 1440px); /* 90rem */
}

.atc-our-story .cta-band__orb--warm {
  width: max(640px, 89%); /* 40rem */
}

.atc-our-story .cta-band__orb--cool {
  width: max(640px, 90%); /* 40rem */
}

@media (min-width: 900px) {
  .atc-our-story .cta-djing__art,
  .atc-our-story .cta-bridge__art {
    min-height: 544px; /* 34rem */
  }
}

/* ストーリー（#together-we-move）背後の紫の楕円: 30rem / 40rem（900px 以上） */
#together-we-move > .ds-container::before {
  height: max(480px, 100% + 2 * var(--space-25));
}

@media (min-width: 900px) {
  #together-we-move > .ds-container::before {
    height: max(640px, 100% + 2 * var(--space-25));
  }
}

@container style(--scroll-motion: on) {
  @media (prefers-reduced-motion: no-preference) {
    .atc-our-story .timeline__intro .heritage__content {
      max-width: 480px; /* 30rem */
    }

    @media (min-width: 900px) {
      .atc-our-story .timeline__sticky {
        --timeline-year-size: min(
          36svh,
          (
              min(100vw, var(--container-max)) - 2 * var(--container-pad) -
                480px - var(--space-10)
            ) /
            2.15
        );
      }
    }
  }
}

/* --------------------------------------------------------------------------
   §5 サイト側の固定ヘッダとの共存
   ベンダー版は自前ヘッダが「スクロールで流れ去る」split モード前提。
   サイトのヘッダは常に画面上端に fixed（z-index: 4, 高さ 60px / 55px）。
   -------------------------------------------------------------------------- */

/* ヒーローのフィルム背景（.hero-film）は「画面の高さ − ベンダー版ヘッダの高さ」
   （--site-header-h）で画面を埋めるので、サイト側ヘッダの高さに差し替える。 */
.atc-our-story {
  --site-header-h: var(--atc-wp-header-h);
}

/* ページ内リンク帯: ベンダー版と同じく画面最上端に出し、サイト側ヘッダ（z-index: 4）
   より上の層に重ねる（帯が出ている間はヘッダを覆う） */
.atc-our-story .page-nav.is-floating {
  /*top: var(--atc-wp-header-h);*/
  /*z-index: 3;*/
  top: 0;
  z-index: 5;
}

/* 年表のステージの上余白（ページ内リンク帯 60px + 24px）は about.css のまま。
   帯がヘッダに重なるので、ヘッダ分を足す必要はない。 */

/* --------------------------------------------------------------------------
   §6 <main> / <body> 直下構造の前提を付け替え
   ベンダー版の LP 本体は <body> 直下の <main id="main">。WP 側では
   body > #wrapper > #container > main#content > .inner > article >
   .inner_content > .atc-our-story（id="main"）の入れ子になる。
   -------------------------------------------------------------------------- */

/* ページ内リンクで飛ぶ瞬間のフェード（main.js initNavJump, html.is-jumping）:
   about.css の「main > :not(.page-nav)」は WP 側では .inner 全体（＝固定表示の
   ページ内リンク帯ごと）を消してしまうので、LP 直下の子に付け替える。 */
.atc-our-story > * {
  transition: opacity var(--dur-fast) var(--ease-standard);
}

html.is-jumping #content.free_html > .inner {
  opacity: 1;
}

html.is-jumping .atc-our-story > :not(.page-nav) {
  opacity: 0;
}

/* 「Watch」で開く全画面プレーヤー（dialog.film-player, html.is-player-open）:
   about.css の「body > :not(.film-player)」は WP 側では #wrapper ごと隠すため、
   その中にあるプレーヤーも見えなくなる。プレーヤーだけ見える状態に戻す
   （他は #wrapper から hidden を継承）。 */
html.is-player-open .atc-our-story .film-player {
  visibility: visible;
}

/* --------------------------------------------------------------------------
   §7 サイト側ヘッダとのクラス名衝突
   about.css の「.name」（900px 以上で 12 カラムの grid）が、ログイン中に
   ヘッダに出るアカウント名（#logged_in_menu .name）にも当たってしまう。
   サイト側に .name の指定は無いので既定の block に戻す。
   -------------------------------------------------------------------------- */

:where(#header, #footer) .name {
  display: block;
  grid-template-columns: none;
  align-items: normal;
}

/* --------------------------------------------------------------------------
   手動のスタイル調整
   -------------------------------------------------------------------------- */
.ds-eyebrow.hero__kicker {
  text-transform: unset !important;
}

body[data-lang='ja'] #content,
body[data-lang='zh-cn'] #content {
  --font-weight-light: 400;
}

body[data-lang='ja'] .ds-body-s.stats__caption {
  letter-spacing: -0.109em;
}
