/* 南郷草舎 — 静的ページ共通
 * 注釈の 1pt=1.333px に対し、カンプ上の文字サイズに合わせて換算を調整（--pt） */

:root {
  /* カンプ（大きい方）に合わせた換算。まだ小さい場合は 1.85〜1.95 まで上げる */
  --pt: 2.3px;
  
  --fs-10: calc(10 * var(--pt));
  --fs-8-5: calc(8.5 * var(--pt));
  --fs-7-5: calc(7.5 * var(--pt));
  --fs-7: calc(7 * var(--pt));
  --fs-6: calc(6 * var(--pt));
  --fs-5-5: calc(5.5 * var(--pt));

  /* デザイン画像から抽出した近似色 */
  --color-bg: #949780;
  --color-text: #000;
  --color-footer-lang-inactive: #5d5955;
  --color-back: #f2f2f0;
  --color-link-service: #2e4eb5;

  --font-sans: "Yu Gothic UI", "Yu Gothic", YuGothic, "Hiragino Sans",
    "Hiragino Kaku Gothic ProN", "Noto Sans JP", Meiryo, system-ui,
    -apple-system, BlinkMacSystemFont, sans-serif;

  --footer-pad-x: 28px;
  --footer-pad-y: 23px;
  /**
   * フッター専用タイポ（カンプは左5.5pt相当・右7ptより大きく見えるため本文用変数より上げる）
   */
  --footer-fs-credit: calc(5.5 * var(--pt));
  --footer-fs-lang: calc(7.2 * var(--pt));
  --footer-inner-h: max(
    calc(var(--footer-fs-lang) * 1.22),
    calc(var(--footer-fs-credit) * 1.42)
  );
  /* 上パディング + 本文行 + 下パディング（ホームインジケータ分は max で吸収） */
  --footer-h: calc(
    var(--footer-pad-y) + var(--footer-inner-h) +
      max(var(--footer-pad-y), env(safe-area-inset-bottom, 0px))
  );
  --header-logo-pt: 45px;
  --header-logo-pb: 28px;
  --header-logo-w: 180px;
  /* ヘッダー全体のおよその高さ（ロゴ 176×68 に合わせた縦比） */
  --site-header-block-h: calc(
    var(--header-logo-pt) + var(--header-logo-pb) +
      (var(--header-logo-w) * 68 / 176)
  );
  /* activities 以外共通: ビューポート上端から .site-back 上端までの最小距離（index はもどるなしだが同一値で main 下限を揃える） */
  --site-back-min-from-top: 514px;
  /* 全ページ共通: main 上余白 */
  --main-padding-top: 44px;
  /* メニュー: カンプは行間がかなり空いている */
  --nav-main-gap: calc(14px + var(--fs-10) * 0.78);
  --back-mt: 12px;
  --back-mb: 12px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  height: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  font-family: var(--font-sans);
  font-size: var(--fs-7-5);
  font-weight: 500;
  color: var(--color-text);
  background-color: var(--color-bg);
  line-height: 1.45;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding-bottom: var(--footer-h);
}

img,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover,
a:focus,
a:active {
  text-decoration: none;
}

/* マウスオーバーでの視覚変化なし（フォーカスリングもデザイン優先で非表示） */
a:hover {
  opacity: 1;
  color: inherit;
}

:focus {
  outline: none;
}

:focus-visible {
  outline: none;
}

/* ----- レイアウト骨格 ----- */

.site-shell {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  width: 100%;
  max-width: 480px;
  margin-inline: auto;
  min-height: 0;
}

.site-header {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: var(--header-logo-pt);
  padding-bottom: var(--header-logo-pb);
}

.site-header__logo {
  display: block;
  line-height: 0;
}

.site-header__logo img {
  width: var(--header-logo-w);
  height: auto;
}

.site-main {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding-top: var(--main-padding-top);
  padding-inline: 20px;
  width: 100%;
}

.page--index .site-shell {
  flex: 1 1 auto;
  min-height: calc(100dvh - var(--footer-h));
}

.page--index .site-main {
  flex: 1 1 auto;
  justify-content: flex-start;
  padding-bottom: 36px;
}

.page--purpose .site-shell,
.page--about .site-shell,
.page--service .site-shell {
  min-height: calc(100dvh - var(--footer-h));
}

/* main を縦に伸ばさない →「← もどる」が本文直下に寄り、カンプに近い */
.page--purpose .site-main,
.page--about .site-main,
.page--service .site-main {
  flex: 0 0 auto;
  justify-content: flex-start;
}

/* activities 以外: main が短くても「← もどる」位置の下限に揃える（index も同一 main 下限） */
.page--index .site-main,
.page--purpose .site-main,
.page--about .site-main,
.page--service .site-main {
  min-height: max(
    0px,
    calc(
      var(--site-back-min-from-top) - var(--site-header-block-h) -
        var(--back-mt)
    )
  );
}

/* できごと: ページ全体はスクロールさせず、.activities-scroll 内（UL と「もどる」）がまとめてスクロール */
body.page--activities {
  box-sizing: border-box;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}

.page--activities .site-shell {
  flex: 1 1 auto;
  min-height: 0;
  /* body が border-box + padding-bottom のとき % が効かない環境向けの保険 */
  max-height: min(100%, calc(100dvh - var(--footer-h)));
  overflow: hidden;
}

.page--activities .site-main {
  flex: 1 1 auto;
  flex-shrink: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  align-items: stretch;
  padding-bottom: 0;
}

.page--activities .page-title {
  flex-shrink: 0;
}

.page--activities .activities-scroll {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  padding-bottom: 8px;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.page--activities .activities-scroll .activities-archive {
  /* 高さは中身任せ。スクロールは親 .activities-scroll 一箇所 */
  overflow: visible;
}

/* activities のみ: shell 直下の site-back（共通テンプレの残骸）を隠す */
.page--activities .site-shell > .site-back {
  display: none;
}

/* UL の直後に通常フローで続く（flex で下端固定しない） */
.page--activities .activities-scroll .site-back {
  position: static;
  width: 100%;
  max-width: none;
  margin-inline: 0;
  margin-top: 2em;
}

/* ----- メインメニュー ----- */

.site-nav-main {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--nav-main-gap);
}

.site-nav-main a {
  font-size: var(--fs-10);
  font-weight: 600;
  letter-spacing: 0.1em;
  line-height: 1.9;
  padding: 0;
}

/* ----- 見出し・本文 ----- */

.page-title {
  margin: .29em 0 2em;
  font-size: var(--fs-10);
  font-weight: 600;
  letter-spacing: 0.1em;
  line-height: 1.38;
}

.page-lead {
  margin: 0;
  font-size: var(--fs-8-5);
  font-weight: 500;
}

.about-block {
  margin: -4px 0 0 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.58em;
  font-size: var(--fs-7-5);
  font-weight: 500;
  line-height: 1.8;
  letter-spacing: 0.02em;
}

.about-block p {
  margin: 0;
}

/* ----- とりくみ ----- */

.service-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: calc(10px + var(--fs-7-5) * 0.3);
}

/* カンプ: 黒・下線（ホバーで装飾は変えない） */
.service-links a {
  font-size: var(--fs-7-5);
  font-weight: 500;
  line-height: 1.5;
  color: var(--color-text);
  text-decoration: underline;
  text-decoration-thickness: 1.4px;
}

.service-links a:hover,
.service-links a:focus,
.service-links a:active {
  text-decoration: underline;
  color: var(--color-text);
  opacity: 1;
}

/* ----- できごと（WPループ想定） ----- */

.activities-archive {
  list-style: none;
  margin: -2px 0 0 0;
  padding: 0 4px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: calc(12px + var(--fs-6) * 0.49);
}

.activities-archive__item {
  width: 82%;
  max-width: 320px;
  text-align: left;
}

.activities-archive__item a {
  font-size: var(--fs-6);
  font-weight: 500;
  line-height: 1.55;
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1.4px;
}

.activities-archive__item a:hover,
.activities-archive__item a:focus,
.activities-archive__item a:active {
  text-decoration: underline;
  color: inherit;
  opacity: 1;
}

/* ----- もどる ----- */

.site-back {
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
  width: 100%;
  max-width: 480px;
  margin-inline: auto;
  margin-top: var(--back-mt);
  margin-bottom: var(--back-mb);
  padding-inline: 20px;
}

.site-back a {
  font-size: var(--fs-7-5);
  font-weight: 500;
  line-height: 1.45;
  color: var(--color-back);
  letter-spacing: 0.06em;
}

/* ----- フッター（全ページ下端固定） ----- */

.site-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  background-color: var(--color-bg);
  padding: var(--footer-pad-y) var(--footer-pad-x)
    max(var(--footer-pad-y), env(safe-area-inset-bottom));
}

.site-footer__inner {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 8px 14px;
  max-width: 480px;
  margin-inline: auto;
}

.site-footer__credit {
  margin: 0;
  font-size: var(--footer-fs-credit);
  font-weight: 600;
  line-height: 1.42;
  color: var(--color-text);
  letter-spacing: 0.01em;
}

.site-footer__built a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 0.12em;
  text-decoration-thickness: 1px;
}

.site-footer__built a:hover,
.site-footer__built a:focus,
.site-footer__built a:active {
  text-decoration: underline;
  color: inherit;
  opacity: 1;
}

.site-footer__lang {
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: var(--footer-fs-lang);
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.site-footer__lang a,
.site-footer__lang span {
  color: var(--color-text);
  font-weight: inherit;
}

.site-footer__lang-item--en {
  letter-spacing: 0.1em;
}

.site-footer__lang-item--ja {
  letter-spacing: 0.06em;
}

.site-footer__lang-item:not(.site-footer__lang-item--active) {
  color: var(--color-footer-lang-inactive);
}

.site-footer__lang-item--active {
  font-weight: 800;
  color: var(--color-text);
}
