/* =========================================================
   main.css  ― 子テーマ全体の共通スタイル（骨格テンプレ / v3）
   役割：
   - ベース整形（タイポ・リンク・画像・表）
   - レイアウト下地（.l-inner 同調、グリッド/ユーティリティ）
   - 共通パーツの“下地のみ”（パンくずなど）
   注意：
   - フォント読み込み（Google Fonts / IcoMoon）は functions.php / icon-font.css で実施
   - 個別テンプレやピンポイント上書きは late.css / croces-overrides.css へ
   ========================================================= */

/* ============ 0) 変数（色・余白・フォント） ============ */
:root {
  /* カラー */
  --color-text: #202020;
  --color-muted: rgba(0,0,0,.72);
  --color-link: #1d63a0;
  --color-link-hover: #0e4b7e;
  --color-border: #e5e5e5;
  --color-accent: #367963; /* UT系グリーン想定 */

  /* タイポ */
  --font-sans: "Noto Sans JP", "Hiragino Kaku Gothic ProN", Meiryo, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --font-serif: "Noto Serif JP", "Hiragino Mincho ProN", "MS PMincho", serif;
  --font-size-base: 16px;
  --line-base: 1.6;

  /* レイアウト */
  --inner-max: 1180px;   /* 親テーマ .l-inner に合わせる */
  --inner-pad: 20px;

  /* 余白（8pxグリッド） */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 40px;
  --space-8: 56px;

  /* グローバルメニュー高さ（PC用） */
  --gnav-h: 56px;
}

/* ============ 1) ベース整形 ============ */
*, *::before, *::after { box-sizing: border-box; }

html {
  font-size: 100%;
  letter-spacing: -0.01em;       /* 控えめに全体調整 */
  font-feature-settings: "palt"; /* 和文約物調整 */
}
body {
  margin: 0;
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  line-height: var(--line-base);
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
}

img, svg, video, canvas {
  max-width: 100%;
  height: auto;
  display: block;
}
figure { margin: 0; }

a {
  color: var(--color-link);
  text-decoration: none;
}
a:hover,
a:focus {
  color: var(--color-link-hover);
  text-decoration: underline;
}

:where(h1,h2,h3,h4,h5,h6) {
  color: inherit;
  margin: var(--space-5) 0 var(--space-3);
  line-height: 1.25;
  font-weight: 700;
}
h1 { font-size: clamp(22px, 3.6vw, 34px); }
h2 { font-size: clamp(20px, 2.8vw, 28px); }
h3 { font-size: clamp(18px, 2.2vw, 22px); }

p { margin: 0 0 var(--space-4); }
ul, ol {
  margin: 0 0 var(--space-4) var(--space-5);
  padding: 0;
}
li { margin: 0 0 var(--space-2); }

table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space-5) 0;
  font-size: 0.95rem;
}
th, td {
  border: 1px solid var(--color-border);
  padding: 10px;
  text-align: left;
}

input, select, textarea, button {
  font: inherit;
  color: inherit;
}

:where(a,button,[tabindex]):focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* ============ 2) レイアウト基礎 ============ */
.l-inner,
.u-inner {
  max-width: var(--inner-max);
  margin: 0 auto;
  padding-left: var(--inner-pad);
  padding-right: var(--inner-pad);
}

/* グリッド・フレックスの軽量ユーティリティ */
.u-grid { display: grid; gap: 20px; }
.u-grid-2 { grid-template-columns: repeat(2, 1fr); }
.u-grid-3 { grid-template-columns: repeat(3, 1fr); }
.u-grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) {
  .u-grid-3,
  .u-grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px)  {
  .u-grid-2,
  .u-grid-3,
  .u-grid-4 { grid-template-columns: 1fr; }
}

.u-flex { display: flex; }
.u-flex-between {
  display:flex;
  justify-content: space-between;
  align-items: center;
}
.u-center { display:grid; place-items:center; }

/* 余白ユーティリティ（最小限） */
.u-m0  { margin: 0 !important; }
.u-mt0 { margin-top: 0 !important; }
.u-mb0 { margin-bottom: 0 !important; }
.u-mt2 { margin-top: var(--space-2) !important; }
.u-mb2 { margin-bottom: var(--space-2) !important; }
.u-mt4 { margin-top: var(--space-4) !important; }
.u-mb4 { margin-bottom: var(--space-4) !important; }
.u-pt0 { padding-top: 0 !important; }
.u-pb0 { padding-bottom: 0 !important; }

.u-text-center { text-align: center !important; }
.u-text-right  { text-align: right !important; }
.u-muted       { color: var(--color-muted); }

.hr,
.u-hr {
  border: 0;
  height: 1px;
  background: var(--color-border);
  margin: var(--space-6) 0;
}

/* ============ 3) 共通パーツの“下地のみ” ============ */
/* パンくず（固定高さは付けない。詳細は late.css 側でページ別に） */
:where(.p-breadcrumb, .c-breadcrumb) {
  font-size: 0.9rem;
  color: var(--color-muted);
}
:where(.p-breadcrumb, .c-breadcrumb) a {
  color: inherit;
  text-decoration: none;
}
:where(.p-breadcrumb, .c-breadcrumb) a:hover {
  text-decoration: underline;
}

/* アイコンフォント用の土台（実フォントは icon-font.css で定義） */
.icon {
  font-family: "icon", sans-serif;
  font-weight: normal;
  font-style: normal;
  line-height: 1;
}

/* ボタンの下地（親テーマと馴染ませる程度に） */
.btn {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:.5em;
  padding:.6em 1.0em;
  border:1px solid var(--color-accent);
  background: var(--color-accent);
  color:#fff;
  border-radius: 8px;
  text-decoration:none;
}
.btn--ghost {
  background:transparent;
  color:var(--color-accent);
}

/* ============ 3-2) グローバルメニュー（PC用・中央揃え） ============ */
/* ※スマホ帯は NANO テーマ標準のハンバーガーメニューに任せる */

@media (min-width: 1200px) {

  /* UL：行の高さを明示。子を全高に伸ばす */
  .p-global-nav {
    display:flex;
    align-items:stretch;         /* 子(li)をULの高さいっぱいに */
    justify-content:center;
    height: var(--gnav-h);       /* 行の高さ */
    line-height: 1;              /* 行高が余計な上下余白を作らないように */
    list-style:none;
    margin:0 auto;
    padding:0 var(--inner-pad);
    max-width:var(--inner-max);
    gap:0;                       /* 縦線と競合させない */
    width: 100%;
  }

  /* LI：全高ボックス＋縦ラインは border で“確実に最下端まで” */
  .p-global-nav > li{
    display:flex;
    align-items:stretch;
    height:100%;                 /* 親ULの高さを継承 */
    border-right:1px solid #D9D9D9;
  }
  .p-global-nav > li:first-child{
    border-left:1px solid #D9D9D9;
  }

  /* A：行全体クリック。文字は中央寄せ。 */
  .p-global-nav > li > a{
    display:flex;
    align-items:center;          /* 垂直中央 */
    justify-content:center;      /* 水平中央（左寄り解消） */
    height:100%;
    width:100%;
    padding:0 16px;
    color:var(--color-text);
    font-weight:600;
    text-decoration:none;
    white-space:nowrap;
  }

  /* 個別アイテム hover：行全体（= li）に背景を付けるので“最下端まで”必ず届く */
  .p-global-nav > li:hover{
    background:rgba(0,0,0,.05);
  }
  .p-global-nav > li:hover > a{
    color:var(--color-text);
    text-decoration:none;
  }
}

/* ============ 4) レスポンシブ微調整 ============ */
@media (max-width: 1024px) {
  :where(h1) { font-size: clamp(22px, 4.2vw, 30px); }
  :where(h2) { font-size: clamp(20px, 3.2vw, 26px); }
}
@media (max-width: 640px) {
  body { line-height: 1.7; }
  .l-inner,
  .u-inner {
    padding-left: 16px;
    padding-right: 16px;
  }
}

/* ============ 5) 印刷の最低限 ============ */
@media print {
  a { text-decoration: none; color: #000; }
  .no-print { display: none !important; }
  .l-inner,
  .u-inner {
    max-width: none;
    padding: 0;
  }
}

