/* ==========================================================================
   スター精機 コーポレートサイト / 沿革ページ

   ★貼る場所に注意
     「外観 > カスタマイズ > 追加CSS」の
     いま入っているものは消さずに、その一番下に足してください。

     ページのタイトル・パンくずは star-company.css のものをそのまま使います。
     （HTMLの一番外側に class="st-cmp st-his" と書いてあるため）
   ========================================================================== */


/* 写真の指定は star-images.css にまとめています（2026-10-02）。写真台帳.md も参照 */

/* タイトルの大きな英字を HISTORY に差し替え（大きさ・位置は star-company.css の共通の指定。2026-10-14 から ::before の1か所だけ） */
body:has(.st-his) .page-header > *:first-child::before{
  content: "HISTORY";
}

/* 目次を押したときに、すーっと移動します。この沿革ページだけに効きます。
   動きが苦手な設定の人には、下の指定で自動的に切ります */
html:has(.st-his){ scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce){
  html:has(.st-his){ scroll-behavior: auto; }
}

/* ==========================================================================
   目次を画面に固定するための解除指定
   （Lightning側の overflow:hidden が効いていると、固定がまったく働きません）

   ※タイトル（.page-header）は .st-his の入れ物ではないので、
     ここでは対象になりません。
   ========================================================================== */
body:has(.st-his),
:where(div, main, section, article):has(.st-his){
  overflow: visible !important;
}


/* ---- 全体の骨組み（左に目次、右に年表） -----------------------------------
   ★このページだけ、テーマの枠（1180px）を突き破って広げています。
     幅を変えたいときは --his-max の数字ひとつだけ動かしてください。
   -------------------------------------------------------------------------- */
.st-his{ --his-max: 1320px; }

.st-his .his-layout{
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 56px;
  align-items: start;
  /* いったん画面いっぱいに広げてから、左右の余白で中央に寄せています */
  width: auto;
  max-width: none;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  padding: 62px max(24px, calc((100vw - var(--his-max)) / 2)) 90px;
}

/* ---- 左の目次。スクロールしても画面の左上に残ります -----------------------
   ★固定する役目は内側（.his-nav__inner）が持っています。
     外側（.his-nav）は年表と同じ高さまで伸ばしておかないと、
     固定して動ける範囲がなくなり、そのまま流れていってしまいます。

   いま見ている時代だけを濃く表示します。
   薄くする指定は [data-spy] が付いているときだけ効くようにしてあるので、
   JSが動かない環境では今までどおり全部黒のまま出ます。
   -------------------------------------------------------------------------- */
.st-his .his-nav{ align-self: stretch; }
.st-his .his-nav__inner{
  position: sticky;
  /* 画面の上からの距離。ヘッダーにぶつかるようなら、ここを増やしてください */
  top: 96px;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--line);
}
.st-his .his-nav__item{
  display: block;
  position: relative;
  padding: 12px 0 12px 20px;
  transition: color .2s ease;
}
.st-his .his-nav__item::before{
  content: "";
  position: absolute;
  left: -4px;
  top: 21px;
  width: 7px; height: 7px;
  background: #cfcfcf;
  transition: background .2s ease, transform .2s ease;
}
.st-his .his-nav__item:hover::before{ background: var(--red); }
.st-his .his-nav__years{
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .08em;
  color: #9a9a9a;
  margin-bottom: 2px;
  transition: color .2s ease;
}
.st-his .his-nav__ttl{
  display: block;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.55;
  color: var(--ink);
  transition: color .2s ease;
}
.st-his .his-nav__item:hover .his-nav__ttl{ color: var(--red); }

/* いま見ていない時代は、一段うすく */
.st-his .his-nav[data-spy] .his-nav__item::before{ background: #dedede; }
.st-his .his-nav[data-spy] .his-nav__years{ color: #bdbdbd; }
.st-his .his-nav[data-spy] .his-nav__ttl{ color: #949494; }

/* いま見ている時代 */
.st-his .his-nav[data-spy] .his-nav__item[aria-current="true"]::before{ background: var(--red); }
.st-his .his-nav[data-spy] .his-nav__item[aria-current="true"] .his-nav__years{ color: var(--red); }
.st-his .his-nav[data-spy] .his-nav__item[aria-current="true"] .his-nav__ttl{ color: var(--ink); }


/* ==========================================================================
   年表の骨格（★ここだけで全部が決まります）

   時代で区切らず、1本につなげています。
   薄い面に載せることで、左の目次と役割を分けています。

     --his-pad      面の内側の余白
     --his-col      年の列の幅。縦線と赤い横線の位置もこれで決まります
     --his-yr-size  西暦の文字サイズ
     --his-yr-mid   西暦の数字の「高さの中心」が、文字サイズの何割の位置に
                    来るか。本文と赤い横線は、この位置にそろえています。
                    書体によって少しずれるため、下の nudge で微調整します
     --his-yr-nudge 上下の微調整。本文と赤い横線が一緒に動きます。
                    下げたいときはプラス、上げたいときはマイナス（例 -3px）

   ※西暦を大きくしたら --his-col も広げること。目安は「文字サイズ × 2.5」。
     文字がはみ出すと赤い横線に重なります。
   ========================================================================== */
.st-his .his-table{
  --his-pad: 48px;
  --his-col: 132px;
  --his-yr-size: clamp(32px, 4.2vw, 52px);
  --his-yr-mid: .65;
  --his-yr-nudge: 0px;

  /* 西暦の中心の位置（行の上からの距離）。本文と赤い横線の物差しです。
     ここは触らず、上の4つで調整してください */
  --his-align: calc(var(--his-yr-size) * var(--his-yr-mid) + var(--his-yr-nudge));

  position: relative;
  background: #f6f7f7;
  padding: 34px var(--his-pad) 40px;
}
/* 縦に1本だけ通る線。時間の流れを表します。
   赤い横線（幅34px）のまん中を通るよう、17pxぶん右にずらしています */
.st-his .his-table::before{
  content: "";
  position: absolute;
  left: calc(var(--his-pad) + var(--his-col) + 17px);
  top: 34px;
  bottom: 40px;
  width: 1px;
  background: #dcdedf;
}

/* WordPressが差し込む余計な要素でレイアウトが崩れないように。
   ★時代ラベル（.his-mark）を消してしまわないよう、必ず除外しておくこと */
.st-his .his-table > :not(.his-row):not(.his-mark){ display: none !important; }


/* ---- 時代の切れ目に置くラベル ---------------------------------------------
   左の目次から飛んできたときの着地点です。
   年表の流れを切らないよう、線は引かず余白だけで間をあけています

   ※止まる位置はJS側（OFFSET）で決めています。
     ここに scroll-margin-top を足すと二重にずれるので、足さないこと
   -------------------------------------------------------------------------- */
.st-his .his-mark{
  display: grid;
  grid-template-columns: var(--his-col) 1fr;
  gap: 44px;
  align-items: baseline;
  padding: 58px 0 14px;
}
.st-his .his-mark:first-child{ padding-top: 0; }
.st-his .his-mark__yrs{
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .14em;
  color: var(--red);
}
.st-his .his-mark__box{ display: block; }
.st-his .his-mark__ttl{
  display: block;
  font-size: 17px;
  font-weight: 900;
  line-height: 1.5;
  color: var(--ink);
}
.st-his .his-mark__en{
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .06em;
  color: #9a9a9a;
  margin-top: 1px;
}


/* ---- 年の行 --------------------------------------------------------------- */
.st-his .his-row{
  display: grid;
  grid-template-columns: var(--his-col) 1fr;
  gap: 44px;
  align-items: start;
  padding: 28px 0;
}

/* 年
   ★グレーにして、時代ラベル（黒）より一段下げています。
     濃さを変えたいときは color の値だけ差し替えてください。
     濃いめ #9a9a9a ／ いま #b0b0b0 ／ 薄め #c8c8c8 */
.st-his .his-yr{
  font-size: var(--his-yr-size);
  font-weight: 900;
  line-height: 1.15;
  color: #b0b0b0;
  letter-spacing: .01em;
  position: relative;
}
/* 和暦。西暦の下に小さく添えます */
.st-his .his-yr__wa{
  display: block;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: .02em;
  color: #9a9a9a;
  margin-top: 4px;
}
/* 縦線と交差する横線。直交のかたちになります。
   縦線と同じ色・同じ太さ。高さは西暦の中心にそろえています */
.st-his .his-yr::after{
  content: "";
  position: absolute;
  left: var(--his-col);
  top: calc(var(--his-align) - .5px);
  width: 34px; height: 1px;
  background: #dcdedf;
}

/* 出来事
   1行目の文字の中心が、西暦の中心とそろうように上の余白を計算しています。
   15.5px は「本文1行のうち、上から文字の中心までの距離」です。
   本文の文字サイズ・行の高さを変えたときは、この数字も見直してください */
.st-his .his-body{
  padding-top: max(0px, calc(var(--his-align) - 15.5px));
}
.st-his .his-item{
  font-size: 15px;
  line-height: 1.95;
  font-weight: 500;
  color: #2b2b2b;
}
.st-his .his-item + .his-item{ margin-top: 8px; }

/* 出来事の写真（2026-10-09）。写真を添えたい出来事の <p> のすぐ後ろに <figure class="his-ph"> を置きます。
   写真のある年だけ、出来事の文を左、写真を右の2列にして、文と写真を横に並べます。
   写真の幅は --his-ph-w の1か所。せまい画面では文の下に写真が入ります */
.st-his .his-table{ --his-ph-w: 240px; }
.st-his .his-body:has(.his-ph){
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--his-ph-w);
  column-gap: 32px;
  row-gap: 0;
  align-items: start;
}
.st-his .his-body:has(.his-ph) > .his-item{ grid-column: 1; margin-top: 0; }
.st-his .his-body:has(.his-ph) > .his-item + .his-item{ margin-top: 0; }
.st-his .his-body:has(.his-ph) > *{ padding-bottom: 14px; }
.st-his .his-ph{
  grid-column: 2;
  margin: 0;
  width: var(--his-ph-w);
}
.st-his .his-ph img{
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #e4e6e6;
}
.st-his .his-ph--item img{ object-fit: contain; background: #fff; }
.st-his .his-ph figcaption{
  margin-top: 6px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.6;
  color: #8a8a8a;
}


/* ---- 下部の導線 -----------------------------------------------------------
   画面いっぱいに広がる薄い帯。中身は年表と同じ幅にそろえています */
.st-his .his-links{
  background: #f6f7f7;
  width: auto;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  padding: 54px max(24px, calc((100vw - var(--his-max)) / 2)) 58px;
}
.st-his .his-links__inner{
  width: auto;
  max-width: none;
  display: flex;
  align-items: center;
  /* 2026-10-14：左右に分けず、文とボタンの組ごと中央に */
  justify-content: center;
  gap: 24px 56px;
  flex-wrap: wrap;
}
.st-his .his-links__lead{
  font-size: 15px;
  line-height: 2;
  font-weight: 600;
  color: var(--ink);
}
.st-his .his-links__btn{
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 40px;
  min-width: 250px;
  padding: 17px 24px;
  border: 1px solid var(--ink);
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  flex: none;
  transition: background .22s ease, color .22s ease;
}
/* 乗せたとき：黒の塗りつぶしは強いので、薄いグレーの面に。矢印が少し右へ（2026-10-14） */
.st-his .his-links__btn:hover{ background: #f1f2f3; }
.st-his .his-links__btn .ar{ transition: transform .22s ease; }
.st-his .his-links__btn:hover .ar{ transform: translateX(4px); }
.st-his .his-links__btn .ar{ color: var(--red); font-size: 16px; }


/* ---- スマホ・タブレット --------------------------------------------------- */
@media (max-width: 1000px){
  .st-his .his-layout{ grid-template-columns: 1fr; gap: 28px; }
  /* 目次は横1列のタブにして、指で横に送る。固定はやめます。
     いまの時代は赤い下線。右端を薄く消して、続きがあると分かるようにしています。
     2026-10-14：枠で囲んだ箱を折り返して並べていたのをやめた（段がそろわず、もたついて見えたため。わただ） */
  /* グリッドの中の要素は中身の幅まで広がるので、画面の幅で止める（止めないとページが横にはみ出す） */
  .st-his .his-nav{ align-self: auto; min-width: 0; max-width: 100%; }
  .st-his .his-nav__inner{
    position: static;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 0;
    border-left: 0;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent);
            mask-image: linear-gradient(90deg, #000 88%, transparent);
  }
  .st-his .his-nav__inner::-webkit-scrollbar{ display: none; }
  .st-his .his-nav__item{
    flex: none;
    scroll-snap-align: start;
    padding: 10px 18px 12px 0;
    margin-right: 18px;
    margin-bottom: -1px;
    border-bottom: 2px solid transparent;
    transition: border-color .2s ease, color .2s ease;
  }
  .st-his .his-nav__item::before{ display: none; }
  .st-his .his-nav__years{ font-size: 10.5px; }
  .st-his .his-nav__ttl{ font-size: 12.5px; white-space: nowrap; }
  .st-his .his-nav[data-spy] .his-nav__item[aria-current="true"]{ border-bottom-color: var(--red); }
  .st-his .his-table{ --his-pad: 28px; --his-col: 112px; }
  .st-his .his-row,
  .st-his .his-mark{ gap: 32px; }
}

@media (max-width: 620px){
  .st-his .his-layout{
    padding: 28px max(16px, calc((100vw - var(--his-max)) / 2)) 64px;
  }

  .st-his .his-table{
    --his-pad: 18px;
    --his-yr-size: 30px;
    padding: 20px var(--his-pad) 24px;
  }
  /* せまい画面では年を上に、出来事を下に。
     上下に並ぶので、中心をそろえる計算は使いません */
  .st-his .his-table::before{ display: none; }
  .st-his .his-body{ padding-top: 0; }

  .st-his .his-mark{
    grid-template-columns: 1fr;
    gap: 2px;
    padding: 34px 0 8px;
  }
  .st-his .his-mark__ttl{ font-size: 15px; }

  .st-his .his-row{
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 18px 0;
  }
  .st-his .his-yr__wa{
    /* せまい画面では、西暦の右にそのまま続けます */
    display: inline;
    font-size: 11.5px;
    margin-top: 0;
    margin-left: 8px;
  }
  .st-his .his-yr::after{ display: none; }
  .st-his .his-item{ font-size: 14px; }
  /* せまい画面では写真を文の下に */
  .st-his .his-body:has(.his-ph){ display: block; }
  .st-his .his-body:has(.his-ph) > .his-item + .his-item{ margin-top: 8px; }
  .st-his .his-body:has(.his-ph) > *{ padding-bottom: 0; }
  .st-his .his-ph{ width: min(100%, 300px); margin: 10px 0 14px; }

  .st-his .his-links{
    padding: 40px max(16px, calc((100vw - var(--his-max)) / 2)) 44px;
  }
  .st-his .his-links__inner{ flex-direction: column; align-items: stretch; gap: 22px; }
  .st-his .his-links__lead{ text-align: center; }
  .st-his .his-links__btn{ width: 100%; }
}
