/* =========================================================
   latelitte テーマ CSS
   色・文字サイズ・余白・幅などの基本設定は theme.json（＝「外観 → エディター → スタイル」）で変更する。
   ここには theme.json で表せない見た目（Liquid Glass、ヘッダー画像など）だけを書く。
   ========================================================= */

/* =========================================================
   ヘッダー（テンプレートパーツ「ヘッダー」）
   背景画像：外観 → エディター → パターン → ヘッダー → 外側のグループを選択 →
             スタイル → 背景 → 画像
   ========================================================= */
.av-hero {
  position: relative;
  min-height: 120px;                        /* ← ヘッダーの高さ（最低値。中身が大きいと自動で伸びる） */
  display: flex;
  flex-direction: column;
  justify-content: space-between;           /* 上：ロゴ＋タイトル / 下：メニュー */
  gap: 16px;
  padding: clamp(16px, 2vw, 28px) clamp(16px, 4vw, 72px) clamp(12px, 1.5vw, 20px);
  margin: 0;
  background-color: #1a2433;
  background-image: var(--wp--preset--gradient--hero); /* 画像未設定時 */
  background-size: cover;
  background-position: center;
  overflow: hidden;
  color: #fff;
}
/* 画像を少し暗くして文字を読みやすくする */
.av-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,.10) 0%, rgba(0,0,0,.40) 100%); /* ← 暗さ */
  pointer-events: none;
}
.av-hero > * { position: relative; z-index: 1; margin: 0 !important; }

.av-brand { gap: clamp(6px, 1vw, 12px); }   /* ← ロゴ（上）とサイト名（下）の間隔 */
.av-hero .wp-block-site-title,
.av-hero .wp-block-site-title a {
  color: #fff;
  text-decoration: none;
  text-shadow:
    0 1px 0 rgba(255,255,255,.35),
    0 3px 14px rgba(0,0,0,.55);
}
.av-hero .wp-block-site-logo img { filter: drop-shadow(0 3px 10px rgba(0,0,0,.45)); }

/* メニューの Liquid Glass バー（右下） */
.av-hero-nav {
  align-self: flex-end;                     /* ← 横位置：右（左=flex-start / 中央=center） */
  width: min(600px, 100%);                  /* ← バーの幅 */
  padding: 4px 18px !important;             /* ← バーの内側余白（高さはこれで決まる） */
  border-radius: 999px !important;
}
.av-hero-nav .wp-block-navigation a,
.av-hero-nav .wp-block-navigation .wp-block-navigation-item__content { color: #fff; }
.av-hero-nav .wp-block-navigation a:hover,
.av-hero-nav .wp-block-navigation .current-menu-item > a { color: var(--wp--preset--color--highlight); }
.av-hero-nav .wp-block-navigation__responsive-container-open { color: #fff; }

/* =========================================================
   本文・フッター
   ========================================================= */
.av-main {
  padding-top: var(--wp--preset--spacing--40);  /* ← ヘッダーと本文の間（全ページ共通。0で詰める） */
  padding-bottom: var(--wp--preset--spacing--50);
  margin-top: 0 !important;
}
.av-footer {
  padding: var(--wp--preset--spacing--30) clamp(16px, 4vw, 72px);
  margin-top: 0 !important;
  border-top: 1px solid rgba(15, 30, 60, .10);
  font-size: var(--wp--preset--font-size--small);
  color: var(--wp--preset--color--muted);
}
.av-footer .wp-block-site-title { font-size: var(--wp--preset--font-size--medium); }
.av-footer .wp-block-site-title a { color: inherit; text-decoration: none; }
.av-post-date { color: var(--wp--preset--color--muted); font-size: var(--wp--preset--font-size--small); }
.av-rounded img { border-radius: 16px; }

/* =========================================================
   Liquid Glass（ブロックの「スタイル」で選択）
   - Liquid Glass        : 明るい背景の上で使う（文字は本文と同じ色）
   - Liquid Glass（暗）  : 画像や濃い色の上で使う（文字は白）
   対象：グループ、カラム、カバー
   ========================================================= */
.is-style-liquid-glass,
.is-style-liquid-glass-dark,
.av-glass-box {
  position: relative;
  isolation: isolate;
  padding: var(--wp--preset--spacing--40);  /* ← 枠内の余白（ブロック側で指定するとそちらが優先） */
  border-radius: 24px;                      /* ← 角丸 */
  -webkit-backdrop-filter: blur(18px) saturate(180%);
          backdrop-filter: blur(18px) saturate(180%);   /* ← ぼかしの強さ */
}
.is-style-liquid-glass,
.av-glass-box {
  background-color: rgba(255, 255, 255, .55);  /* ← ガラスの濃さ */
  border: 1px solid rgba(255, 255, 255, .80);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .90),
    inset 0 0 30px rgba(255, 255, 255, .25),
    0 18px 50px rgba(15, 30, 60, .12);      /* ← 浮き上がりの影 */
}
.is-style-liquid-glass-dark {
  color: #fff;
  background-color: rgba(255, 255, 255, .10);  /* ← ガラスの濃さ */
  border: 1px solid rgba(255, 255, 255, .30);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .60),
    inset 0 0 24px rgba(255, 255, 255, .08),
    0 12px 40px rgba(0, 0, 0, .35);
}
.is-style-liquid-glass-dark a { color: inherit; }
/* 斜めの光沢 */
.is-style-liquid-glass::before,
.is-style-liquid-glass-dark::before,
.av-glass-box::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(135deg,
    rgba(255, 255, 255, .35) 0%,
    rgba(255, 255, 255, 0)   35%,
    rgba(255, 255, 255, 0)   65%,
    rgba(255, 255, 255, .12) 100%);
  mix-blend-mode: overlay;
  z-index: -1;
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .is-style-liquid-glass, .av-glass-box { background-color: rgba(255, 255, 255, .90); }
  .is-style-liquid-glass-dark { background-color: rgba(20, 20, 60, .65); }
}
/* 中のブロックの上下余白 */
.is-style-liquid-glass > :first-child,
.is-style-liquid-glass-dark > :first-child,
.av-glass-box > :first-child { margin-top: 0; }
.is-style-liquid-glass > :last-child,
.is-style-liquid-glass-dark > :last-child,
.av-glass-box > :last-child { margin-bottom: 0; }

/* カラムの中に枠が1つだけの時、左右の高さを揃える */
.wp-block-column > .is-style-liquid-glass:only-child,
.wp-block-column > .is-style-liquid-glass-dark:only-child,
.wp-block-column > .av-glass-box:only-child { height: 100%; }

/* 枠の中の画像は角を丸める */
.is-style-liquid-glass .wp-block-image img,
.is-style-liquid-glass-dark .wp-block-image img,
.av-glass-box .wp-block-image img { border-radius: 16px; }

/* ---------- 枠の中の表：縞模様を消し、区切り線だけにする ---------- */
:is(.is-style-liquid-glass, .is-style-liquid-glass-dark, .av-glass-box) .wp-block-table { margin: 0; }
:is(.is-style-liquid-glass, .is-style-liquid-glass-dark, .av-glass-box) .wp-block-table table {
  width: 100%;
  border-collapse: collapse;
}
:is(.is-style-liquid-glass, .is-style-liquid-glass-dark, .av-glass-box) .wp-block-table :is(tr, td, th) {
  background: transparent !important;
}
:is(.is-style-liquid-glass, .is-style-liquid-glass-dark, .av-glass-box) .wp-block-table :is(td, th) {
  border: 0;
  border-bottom: 1px solid color-mix(in srgb, currentColor 15%, transparent);  /* ← 行の区切り線 */
  padding: 14px 10px;
  vertical-align: top;
  text-align: left;
  color: inherit;
}
:is(.is-style-liquid-glass, .is-style-liquid-glass-dark, .av-glass-box) .wp-block-table tr:last-child :is(td, th) { border-bottom: 0; }
:is(.is-style-liquid-glass, .is-style-liquid-glass-dark, .av-glass-box) .wp-block-table td:first-child {
  width: 9em;                               /* ← 項目名の列の幅 */
  font-weight: 700;
  white-space: nowrap;
}

/* =========================================================
   パターン用
   ========================================================= */
/* 左1・右2段：右カラムの枠を縦に積み、右下が残りの高さを埋める */
.av-stack { display: flex; flex-direction: column; gap: var(--wp--preset--spacing--30); }
.av-stack > * { margin: 0 !important; }
.av-stack > :last-child { flex: 1; }
.av-glass-media { padding: 10px !important; }  /* ← 画像の周りの余白 */
.av-glass-media .wp-block-image { margin: 0; }
.av-glass-media img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;                    /* ← 画像の縦横比（削除すると元画像の比率） */
  object-fit: cover;
}

/* 会社概要：丸い写真 */
.av-photo { text-align: center; margin: 0 auto var(--wp--preset--spacing--30); }
.av-photo img {
  width: min(240px, 60vw) !important;       /* ← 写真の大きさ */
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 50% !important;
  border: 4px solid #fff;
  box-shadow: 0 0 0 8px rgba(255,255,255,.6), 0 12px 30px rgba(15,30,60,.15);
}

/* 旧テーマのクラス名（av-full）も使えるようにしておく：画面の横幅いっぱい */
.av-full {
  width: 100vw;
  max-width: 100vw !important;
  margin-left: calc(50% - 50vw) !important;
  margin-right: calc(50% - 50vw) !important;
}
body:has(.av-full) { overflow-x: clip; }

/* ---------- スマホ ---------- */
@media (max-width: 781px) {
  .av-hero { min-height: 120px; }
  .av-hero-nav { width: auto; }
  :is(.is-style-liquid-glass, .is-style-liquid-glass-dark, .av-glass-box) .wp-block-table td:first-child { width: 6.5em; }
}

/* =========================================================
   トップページ（パターン「トップページ」）
   ========================================================= */
.av-front { padding-bottom: var(--wp--preset--spacing--50); }
.av-front > * + * { margin-top: var(--wp--preset--spacing--40) !important; }

/* ---------- 投稿スライダー（1段目・2段目） ---------- */
.av-post-slider {
  position: relative;
  padding: var(--wp--preset--spacing--40) clamp(16px, 4vw, 72px) var(--wp--preset--spacing--30);
  background: var(--wp--preset--gradient--slider);  /* ← 1段目の背景（外観→エディター→スタイル→色→パレット→グラデーション「新着スライダーの背景」） */
}
.av-post-slider--small {
  padding-top: var(--wp--preset--spacing--30);
  background: var(--wp--preset--gradient--banner);  /* ← 2段目の背景（グラデーション「固定表示の背景」） */
}
.av-post-slider .wp-block-post-template {
  display: flex !important;
  gap: clamp(16px, 2.4vw, 32px);           /* ← カードの間隔 */
  margin: 0;
  padding: 4px 0 12px;
  list-style: none;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.av-post-slider .wp-block-post-template::-webkit-scrollbar { display: none; }
.av-post-slider .wp-block-post-template > li {
  flex: 0 0 calc((100% - 3 * clamp(16px, 2.4vw, 32px)) / 4);  /* ← 1段目：4枚表示（3枚なら 2 * … / 3） */
  margin: 0 !important;
  scroll-snap-align: start;
}
.av-post-slider--small .wp-block-post-template > li {
  flex-basis: calc((100% - 4 * clamp(16px, 2.4vw, 32px)) / 5);  /* ← 2段目：5枚表示 */
}

/* 1段目のカード：画像の下にタイトル（ガラス） */
.av-slide-card { padding: 0 !important; overflow: hidden; height: 100%; }
.av-slide-card .wp-block-post-featured-image { margin: 0; }
.av-slide-card .wp-block-post-featured-image img { border-radius: 0; }
.av-slide-card .av-card-title { padding: 14px 18px; margin: 0; }

.av-card-title {
  font-size: var(--wp--preset--font-size--medium);
  font-weight: 700;
  line-height: 1.5;
}
.av-card-title a { color: var(--wp--preset--color--contrast); text-decoration: none; }
.av-card-title a:hover { color: var(--wp--preset--color--highlight); }

/* 2段目のカード：バナー風 */
.av-banner-card .wp-block-post-featured-image { margin: 0; }
.av-banner-card .wp-block-post-featured-image img {
  border-radius: 12px;
  border: 3px solid #fff;
  box-shadow: 0 8px 20px rgba(15, 30, 60, .18);
}
.av-banner-title {
  margin: 8px 2px 0;
  font-size: var(--wp--preset--font-size--small);
  line-height: 1.4;
}
.av-banner-title a { color: var(--wp--preset--color--contrast); text-decoration: none; }
.av-note { color: var(--wp--preset--color--muted); font-size: var(--wp--preset--font-size--small); }

/* 矢印・ドット（JavaScript で追加） */
.av-slider-btn {
  position: absolute;
  top: 45%;
  z-index: 2;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, .6);
  border-radius: 50%;
  background: rgba(255, 255, 255, .25);
  -webkit-backdrop-filter: blur(10px);
          backdrop-filter: blur(10px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .2);
  cursor: pointer;
  transform: translateY(-50%);
}
.av-slider-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 11px;
  height: 11px;
  border-top: 2px solid #fff;
  border-right: 2px solid #fff;
}
.av-slider-btn--prev { left: clamp(4px, 1.2vw, 20px); }
.av-slider-btn--prev::before { transform: translateX(2px) rotate(-135deg); }
.av-slider-btn--next { right: clamp(4px, 1.2vw, 20px); }
.av-slider-btn--next::before { transform: translateX(-2px) rotate(45deg); }
.av-post-slider--small .av-slider-btn { border-color: rgba(15, 30, 60, .2); background: rgba(255, 255, 255, .7); }
.av-post-slider--small .av-slider-btn::before { border-color: var(--wp--preset--color--contrast); }

.av-slider-dots { display: flex; justify-content: center; gap: 10px; margin-top: 8px; }
.av-slider-dots button {
  width: 10px;
  height: 10px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .8);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}
.av-slider-dots button.is-active { background: #fff; }

/* ---------- 3段目：検索・並び替え ---------- */
.av-sortbar-wrap { padding: 14px 20px !important; }
.av-sortbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}
.av-sortbar__search { flex: 1 1 260px; }
.av-sortbar input[type="search"],
.av-sortbar select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid rgba(15, 30, 60, .15);
  border-radius: 999px;
  background: rgba(255, 255, 255, .8);
  font: inherit;
  color: inherit;
}
.av-sortbar__sort { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.av-sortbar__sort select { width: auto; }
.av-sortbar button {
  padding: 10px 22px;
  border: 0;
  border-radius: 999px;
  background: var(--wp--preset--color--accent-strong);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.av-sortbar__reset { font-size: var(--wp--preset--font-size--small); }

/* ---------- 4段目：記事一覧 ---------- */
.av-post-grid .wp-block-post-template { gap: clamp(16px, 2vw, 28px); }
.av-card { padding: 12px !important; height: 100%; }
.av-card .wp-block-post-featured-image { margin: 0 0 10px; }
.av-card .av-card-title { margin: 0 0 6px; }
.av-post-grid .wp-block-query-pagination { margin-top: var(--wp--preset--spacing--40); }

/* ---------- スマホ・タブレット ---------- */
@media (max-width: 1024px) {
  .av-post-slider .wp-block-post-template > li { flex-basis: 70%; }
  .av-post-slider--small .wp-block-post-template > li { flex-basis: 40%; }
}
@media (max-width: 600px) {
  .av-post-slider .wp-block-post-template > li { flex-basis: 85%; }
  .av-post-slider--small .wp-block-post-template > li { flex-basis: 60%; }
  .av-slider-btn { display: none; }
  .av-sortbar__sort { flex: 1 1 100%; }
  .av-sortbar__sort select { flex: 1; }
}

/* =========================================================
   カード（スライダー・記事一覧 共通）
   ========================================================= */
.av-slide-card,
.av-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 0 !important;
  overflow: hidden;
  background-color: rgba(255, 255, 255, .85) !important;  /* ← カードの白さ */
  transition: transform .25s ease, box-shadow .25s ease;
}
.av-slide-card:hover,
.av-card:hover {
  transform: translateY(-4px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9), 0 24px 50px rgba(15, 30, 60, .18);
}
.av-slide-card > .wp-block-post-featured-image,
.av-card > .wp-block-post-featured-image { margin: 0 !important; }
.av-slide-card .wp-block-post-featured-image img,
.av-card .wp-block-post-featured-image img {
  border-radius: 0 !important;
  transition: transform .4s ease;
}
.av-slide-card:hover .wp-block-post-featured-image img,
.av-card:hover .wp-block-post-featured-image img { transform: scale(1.04); }
.av-slide-card .wp-block-post-featured-image,
.av-card .wp-block-post-featured-image { overflow: hidden; }

/* 本文部分 */
.av-card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 18px 16px;                  /* ← カード内の余白 */
  margin: 0 !important;
}
.av-card-body > * { margin: 0 !important; }
.av-card-body .av-card-title { padding: 0; }
/* 旧パターン（av-card-body なし）のカードでも、タイトルが端で切れないよう余白を付ける */
.av-slide-card > .av-card-title,
.av-card > .av-card-title,
.av-card > .av-post-date {
  margin: 0 !important;
  padding: 12px 16px 0 !important;
}
.av-slide-card > .av-card-title:last-child,
.av-card > :last-child { padding-bottom: 14px !important; }
.av-card-excerpt {
  font-size: var(--wp--preset--font-size--small);
  color: var(--wp--preset--color--muted);
  line-height: 1.6;
}
.av-card-excerpt .wp-block-post-excerpt__excerpt { margin: 0; }
.av-card .av-post-date { margin-top: auto !important; }

/* カテゴリーのラベル */
.av-card-cat { font-size: 12px; line-height: 1; }
.av-card-cat a {
  display: inline-block;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--wp--preset--color--accent-strong);  /* ← ラベルの色 */
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}
.av-card-cat .wp-block-post-terms__separator { display: none; }
.av-card-cat a + a { margin-left: 4px; }

/* アイキャッチ画像が無い時の代わりの画像 */
.av-noimage { margin: 0; aspect-ratio: 16 / 9; overflow: hidden; }
.av-noimage a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(circle at 20% 25%, rgba(255,255,255,.35) 0, transparent 40%),
    linear-gradient(135deg, #2b1055 0%, #4a7a8c 100%);  /* ← 代わりの画像の色 */
  color: #fff;
  font-size: clamp(16px, 1.6vw, 22px);
  font-weight: 700;
  letter-spacing: .05em;
  text-decoration: none;
  text-shadow: 0 2px 10px rgba(0,0,0,.35);
}

/* 2段目（バナー）にも代わりの画像を角丸で */
.av-banner-card .av-noimage { border-radius: 12px; border: 3px solid #fff; box-shadow: 0 8px 20px rgba(15, 30, 60, .18); }

/* カードのタイトル：2行まで表示し、はみ出す分は「…」で省略 */
.av-card-title {
  font-size: clamp(14px, 1.1vw, 16px);     /* ← カードのタイトル文字サイズ */
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;                   /* ← 表示する行数 */
}
