/* ========================================
   ベース
======================================== */
body {
  font-family: "ＭＳ Ｐゴシック", sans-serif;
  line-height: 1.5;
  color: #102a43;
  background: #f5f8fc;
}

img {
  max-width: 100%;
}

/* ========================================
   ヘッダー
======================================== */
.page-header {
  background: linear-gradient(120deg, #0f4c81 0%, #1f6fb2 48%, #4895d9 100%);
  color: #f9fbff;
  padding: 20px;
}

.page-header__kicker {
  margin: 0 0 8px;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.page-header__title {
  margin: 0 0 8px;
  line-height: 1.2;
}

.page-header__lead {
  margin: 0;
}

/* ========================================
   2カラムレイアウト（目次 + 本文）
======================================== */
.layout {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  align-items: flex-start;
}

.local-nav {
  width: 256px;
  margin-right: 16px;
  border: 1px solid #d8e0ea;
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  position: relative;
}

.local-nav__title {
  margin: 0 0 8px;
  font-size: 1rem;
}

.local-nav__list {
  margin: 0;
  padding-left: 20px;
}

.local-nav__list li + li {
  margin-top: 4px;
}

.local-nav__list a {
  color: #0f4c81;
}

.content {
  flex: 1;
  min-width: 0;
}

/* ========================================
   セクション共通パネル
======================================== */
.panel {
  border: 1px solid #d8e0ea;
  border-radius: 12px;
  background: #fff;
  padding: 20px;
  margin-bottom: 16px;
}

.panel h2 {
  margin: 0 0 8px;
}

.panel h3 {
  margin: 0 0 8px;
}

.panel p {
  margin: 0 0 12px;
}

.panel p:last-child {
  margin-bottom: 0;
}

/* ========================================
   1) Flexbox / min-width: 0
======================================== */
.cards {
  list-style: none;
  margin: 12px -4px 8px;
  padding: 0;
  display: -ms-flexbox;
  display: flex;
  -ms-flex-wrap: wrap;
  flex-wrap: wrap;
}

.cards__item {
  box-sizing: border-box;
  width: calc(33.333% - 8px);
  margin: 0 4px 8px;
  -ms-flex: 0 0 calc(33.333% - 8px);
  flex: 0 0 calc(33.333% - 8px);
  max-width: calc(33.333% - 8px);
  border: 1px solid #d8e0ea;
  border-radius: 8px;
  background: #f2f8ff;
  text-align: center;
  font-weight: bold;
  padding: 8px;
}

.media {
  display: -ms-flexbox;
  display: flex;
  border: 1px solid #d8e0ea;
  border-radius: 8px;
  overflow: hidden;
  margin-top: 12px;
}

.media__thumb {
  width: 180px;
  -ms-flex: 0 0 180px;
  flex: 0 0 180px;
}

.media__body {
  -ms-flex: 1 1 auto;
  flex: 1 1 auto;
  width: 1%;
  min-width: 0;
  padding: 12px;
}

.media__title {
  display: block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ========================================
   2) object-fit 代替 + 3) 比率ボックス
======================================== */
.fit-grid,
.ratio-grid {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.lazy-grid {
  margin: 12px -4px 0;
  display: -ms-flexbox;
  display: flex;
  -ms-flex-wrap: wrap;
  flex-wrap: wrap;
}

.fit-card,
.ratio-card {
  margin: 0;
  flex: 1 1 256px;
}

.fit-card figcaption {
  margin: 0 0 8px;
}

.fit__frame {
  height: 190px;
  border: 1px solid #d8e0ea;
  border-radius: 8px;
  overflow: hidden;
  background: #eaf1fa;
}

/* IE11前提: object-fit の代わりに背景画像で cover を再現 */
.fit__frame--fallback {
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

.fit__frame--wide {
  background-image: url("./images/photo-wide.png");
}

.fit__frame--tall {
  background-image: url("./images/photo-tall.png");
}

.ratio-legacy {
  border: 1px solid #d8e0ea;
  border-radius: 8px;
  background: #ffe8b6;
}

.ratio-legacy {
  position: relative;
  padding-top: 56.25%;
}

/* ========================================
   4) 手動 lazy load
======================================== */
.lazy {
  box-sizing: border-box;
  width: calc(33.333% - 8px);
  margin: 0 4px 8px;
  -ms-flex: 0 0 calc(33.333% - 8px);
  flex: 0 0 calc(33.333% - 8px);
  max-width: calc(33.333% - 8px);
  height: 160px;
  display: block;
  border: 1px solid #d8e0ea;
  border-radius: 8px;
  object-fit: cover;
  background: #ecf3fb;
}

/* ========================================
   5) toggle + 6) XHR + 7) アコーディオン
======================================== */
.btn {
  border: 0;
  border-radius: 999px;
  background: #ed6a1f;
  color: #fff;
  font-weight: bold;
  padding: 8px 14px;
  cursor: pointer;
}

.toggle-panel {
  border: 1px solid #d8e0ea;
  border-radius: 8px;
  background: #f8fbff;
  max-height: 0;
  overflow: hidden;
  margin-top: 8px;
  padding: 0 12px;
  transition: all 0.2s ease;
}

.toggle-panel.is-open {
  max-height: 144px;
  padding: 8px 12px;
}

.output,
.code {
  border: 1px solid #d8e0ea;
  border-radius: 8px;
  background: #f4f8fd;
  margin-top: 12px;
  padding: 12px;
  overflow: auto;
  font-family: monospace;
}

.accordion {
  margin-top: 16px;
  padding: 12px;
  border: 1px solid #d8e0ea;
  border-radius: 8px;
  background: #f4f8fd;
}

.accordion__trigger {
  box-sizing: border-box;
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: 8px;
  background: #e7f0fb;
  color: #11395f;
  font-weight: bold;
  padding: 10px 36px 10px 12px;
  cursor: pointer;
  position: relative;
}

/* 開閉できることを示す記号 */
.accordion__trigger::after {
  content: ">";
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  transition: all 0.2s ease;
}

.accordion__trigger.is-open::after {
  transform: translateY(-50%) rotate(90deg);
}

.accordion__trigger + .accordion__trigger {
  margin-top: 8px;
}

.accordion__panel + .accordion__trigger {
  margin-top: 10px;
}

.accordion__panel {
  border-left: 3px solid #8eb8de;
  background: #f7fbff;
  margin-top: 6px;
  margin-bottom: 10px;
  padding: 8px 12px;
}

.is-hidden {
  display: none;
}

/* IE11前提: JSで .is-fixed を付与して追従させる */
.local-nav.is-fixed {
  position: fixed;
  top: 16px;
}

/* ========================================
   レスポンシブ
======================================== */
@media (max-width: 900px) {
  .layout {
    display: block;
  }

  .local-nav {
    margin-right: 0;
    margin-bottom: 16px;
    width: auto;
    position: relative;
    top: auto;
  }

  .cards__item {
    width: calc(50% - 8px);
    -ms-flex: 0 0 calc(50% - 8px);
    flex: 0 0 calc(50% - 8px);
    max-width: calc(50% - 8px);
  }

  .lazy {
    width: calc(50% - 8px);
    -ms-flex: 0 0 calc(50% - 8px);
    flex: 0 0 calc(50% - 8px);
    max-width: calc(50% - 8px);
  }
}

@media (max-width: 600px) {
  .fit-card,
  .ratio-card,
  .cards__item {
    flex-basis: 100%;
  }

  .cards__item {
    width: calc(100% - 8px);
    -ms-flex: 0 0 calc(100% - 8px);
    flex: 0 0 calc(100% - 8px);
    max-width: calc(100% - 8px);
  }

  .lazy {
    width: calc(100% - 8px);
    -ms-flex: 0 0 calc(100% - 8px);
    flex: 0 0 calc(100% - 8px);
    max-width: calc(100% - 8px);
  }

  .media {
    display: block;
  }

  .media__thumb {
    width: 100%;
  }
}
