/* 共通のCSS（カラー変数・基本スタイル） */
/* @import はファイルの頭に置かないと効かない */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&family=Noto+Sans+JP:wght@400;600;700&display=swap');

:root {
  --color-bg: #FDFBF7;
  --color-text: #4A4E69;
  --color-accent: #5C6D8C;
  --color-peach: #F7E5D5;
  --color-mint: #D5E8D4;
}

body {
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: 'Inter', 'Noto Sans JP', sans-serif;
  font-size: 16px;
  line-height: 1.8;
  margin: 0;
  padding: 0;
}

/* Tokurabo Takeout シリーズの固定ヘッダー・ページのタブ・下のサイトマップ（中身は /assets/js/takeout-nav.js が入れる） */
/* 固定ヘッダー（中身は /assets/js/takeout-nav.js）。
   スマホ（600px 未満）：ブランドと Menu ボタン。押すとリンクが下に開く
   600px 以上：リンクを横に並べる */
html:has(body.has-site-header) {
  scroll-padding-top: 72px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--color-bg);
  border-bottom: 1px solid rgba(92, 109, 140, 0.2);
}

.site-header__inner {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 56px;
  padding: 0 16px;
}

.site-header__brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-right: auto;
  color: var(--color-text);
  text-decoration: none;
}

.site-header__brand strong {
  font-size: 1.125rem;
  letter-spacing: 0.02em;
}

.site-header__brand span {
  color: var(--color-accent);
}

.site-header__links {
  display: none;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-header__links a {
  display: block;
  padding: 4px 12px;
  color: var(--color-accent);
  text-decoration: none;
}

.site-header__links a:hover {
  background-color: rgba(92, 109, 140, 0.1);
}

.site-header__links a.is-active {
  color: var(--color-text);
  font-weight: 700;
  box-shadow: inset 0 -2px 0 var(--color-accent);
}

.site-header__btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  color: var(--color-text);
  background: none;
  border: 1px solid rgba(92, 109, 140, 0.3);
  border-radius: 4px;
  font: inherit;
  cursor: pointer;
}

.site-header__btn svg {
  width: 20px;
  height: 20px;
}

/* スマホ：開いたとき */
.site-header.is-open .site-header__links {
  display: block;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  padding: 8px 16px 16px;
  background-color: var(--color-bg);
  border-bottom: 1px solid rgba(92, 109, 140, 0.2);
}

.site-header.is-open .site-header__links a {
  padding: 8px 0;
  border-bottom: 1px solid rgba(92, 109, 140, 0.15);
}

.site-header.is-open .site-header__lang {
  display: flex;
  gap: 16px;
  padding-top: 8px;
}

.site-header.is-open .site-header__lang a {
  border-bottom: none;
}

@media (min-width: 600px) {
  .site-header__inner {
    min-width: 600px;
    max-width: 750px;
    margin: 0 auto;
    padding: 0 24px;
  }

  .site-header__links {
    display: flex;
    align-items: center;
    gap: 4px;
  }

  .site-header__lang {
    display: flex;
    margin-left: 8px;
    padding-left: 12px;
    border-left: 1px solid rgba(92, 109, 140, 0.2);
  }

  .site-header__lang a {
    padding: 4px 8px;
  }

  .site-header__btn {
    display: none;
  }
}

/* 600〜759px はヘッダーの幅がぎりぎりなので、折り返さないようにして、ブランドの「Tools」を省く */
.site-header__links a,
.site-header__brand {
  white-space: nowrap;
}

@media (min-width: 600px) and (max-width: 759px) {
  .site-header__brand span {
    display: none;
  }

  .site-header__inner {
    padding: 0 16px;
  }

  .site-header__links a {
    padding: 4px 8px;
  }
}

/* 1024px 以上は左のメニューがあるので、ヘッダーも左のメニューの列にそろえる */
@media (min-width: 1024px) {
  .site-header__inner {
    max-width: 1002px;
    padding: 0;
  }

  body.has-site-header .docs-side {
    top: 72px;
    max-height: calc(100vh - 88px);
  }
}

/* プラグインごとのページの一覧（下に開く） */
.site-header__sub {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* スマホ（開いたメニューの中）：プラグインの下にページを字下げして並べる */
.site-header.is-open .site-header__sub {
  padding-left: 16px;
}

.site-header.is-open .site-header__sub a {
  font-size: 0.9375em;
}

@media (min-width: 600px) {
  .site-header__item {
    position: relative;
  }

  .site-header__sub {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1;
    min-width: 100%;
    padding: 4px 0;
    background-color: var(--color-bg);
    border: 1px solid rgba(92, 109, 140, 0.2);
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(74, 78, 105, 0.12);
  }

  .site-header__item:hover > .site-header__sub,
  .site-header__item:focus-within > .site-header__sub {
    display: block;
  }

  .site-header__sub a {
    white-space: nowrap;
  }

  .site-header__sub a.is-active {
    box-shadow: none;
  }
}

/* 言語の切り替えは固定ヘッダーにあるので、青い帯のほうは消す */
body.has-site-header header.lp-header .lang-switcher {
  display: none;
}

/* ページのタブ（青い帯の下。紹介・ガイド・マニュアル） */
.site-pagetabs {
  border-bottom: 1px solid rgba(92, 109, 140, 0.2);
}

.site-pagetabs__list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
  margin: 0;
  padding: 0 16px;
  list-style: none;
}

.site-pagetabs__list a {
  display: block;
  padding: 8px 0;
  color: var(--color-accent);
  text-decoration: none;
  border-bottom: 2px solid transparent;
}

.site-pagetabs__list a:hover {
  border-bottom-color: var(--color-mint);
}

.site-pagetabs__list a.is-active {
  color: var(--color-text);
  font-weight: 700;
  border-bottom-color: var(--color-accent);
}

@media (min-width: 600px) {
  .site-pagetabs__list {
    min-width: 600px;
    max-width: 750px;
    margin: 0 auto;
    padding: 0 24px;
  }
}

/* 左のメニューがある幅では、左のメニューにページが出るのでタブは要らない */
@media (min-width: 1024px) {
  .site-pagetabs {
    display: none;
  }
}

/* footer の中に入るので、横の余白は footer のものを使う。
   スマホ表示：プラグインごとに1つの段にして、ページは押しやすい丸い札で横に並べる
   PC 表示：プラグインごとに1列、ページは縦の一覧 */
.takeout-sitemap {
  max-width: 718px;
  margin: 0 auto 16px;
  padding: 16px;
  background-color: rgba(92, 109, 140, 0.06);
  border-radius: 8px;
  text-align: left;
}

.takeout-sitemap__grid {
  display: grid;
  grid-template-columns: 1fr;
}

.takeout-sitemap__col {
  padding: 12px 0;
  border-bottom: 1px solid rgba(92, 109, 140, 0.15);
}

.takeout-sitemap__col:first-child {
  padding-top: 0;
}

.takeout-sitemap__title {
  margin: 0 0 8px;
  color: var(--color-text);
  font-weight: 700;
}

.takeout-sitemap ul {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.takeout-sitemap ul a {
  display: block;
  padding: 4px 16px;
  color: var(--color-accent);
  background-color: var(--color-bg);
  border: 1px solid rgba(92, 109, 140, 0.3);
  border-radius: 999px;
  text-decoration: none;
}

.takeout-sitemap ul a:hover {
  background-color: var(--color-mint);
}

.takeout-sitemap ul a.is-active {
  color: var(--color-bg);
  background-color: var(--color-accent);
  border-color: var(--color-accent);
  font-weight: 700;
}

@media (min-width: 600px) {
  .takeout-sitemap {
    padding: 24px;
  }

  .takeout-sitemap__grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
  }

  .takeout-sitemap__col {
    padding: 0;
    border-bottom: none;
  }

  .takeout-sitemap ul {
    flex-direction: column;
    gap: 4px;
  }

  .takeout-sitemap ul a {
    display: inline;
    padding: 0;
    background: none;
    border: none;
    border-radius: 0;
  }

  .takeout-sitemap ul a:hover {
    background: none;
    text-decoration: underline;
  }

  .takeout-sitemap ul a.is-active {
    color: var(--color-text);
    background: none;
  }
}

.takeout-sitemap__kofi {
  margin: 16px 0 0;
}

.takeout-sitemap__kofi a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--color-accent);
  text-decoration: none;
}

.takeout-sitemap__kofi a:hover {
  text-decoration: underline;
}

.takeout-sitemap__kofi svg {
  width: 1.2em;
  height: 1.2em;
  flex-shrink: 0;
}

/* ===== ドキュメント型（デザイン指示書 2.）=====
   1024px 以上でページのタブを消し、左にメニュー（220px）、右に本文（750px）。
   左のメニューと外側の箱（.docs-layout）は /assets/js/takeout-nav.js が作る。
   ツールごとの CSS（main・.guide-toc）より後から効くよう、クラスを重ねて書く */
.docs-side {
  display: none;
}

/* スマホ表示：目次はたたんでおき、見出しを押すと開く */
@media (max-width: 599px) {
  main .guide-toc.is-foldable > p {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0;
    cursor: pointer;
  }
  main .guide-toc.is-foldable > p::after {
    content: '';
    width: 8px;
    height: 8px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform 0.15s ease;
  }
  main .guide-toc.is-foldable.is-open > p {
    margin-bottom: 8px;
  }
  main .guide-toc.is-foldable.is-open > p::after {
    transform: rotate(-135deg);
  }
  main .guide-toc.is-foldable:not(.is-open) > ol {
    display: none;
  }
}

@media (min-width: 1024px) {
  /* 見出しの帯の中身も、本文の列の真ん中にそろえる */
  header.lp-header .header-container {
    max-width: 1002px;
    padding-left: 252px;
  }

  .docs-layout {
    display: grid;
    grid-template-columns: 220px 750px;
    gap: 32px;
    max-width: 1002px;
    margin: 0 auto;
  }

  .docs-layout > main {
    width: 750px;
    max-width: none;
    margin-left: 0;
    margin-right: 0;
  }

  .docs-side {
    display: block;
    position: sticky;
    top: 16px;
    align-self: start;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    margin-top: 24px;
    padding-bottom: 16px;
    font-size: 0.9375em;
  }

  .docs-side__brand {
    display: block;
    margin-bottom: 8px;
    color: var(--color-text);
    font-weight: 700;
    text-decoration: none;
  }

  .docs-side__plugins {
    margin: 0 0 24px;
    padding: 0;
    list-style: none;
  }

  .docs-side__plugins > li {
    margin-bottom: 8px;
  }

  .docs-side__plugins > li > a {
    display: block;
    color: var(--color-accent);
    font-weight: 600;
    text-decoration: none;
  }

  .docs-side__plugins > li.is-current > a {
    color: var(--color-text);
  }

  .docs-side ul ul,
  .docs-side .guide-toc ol {
    margin: 4px 0 0;
    padding: 0 0 0 16px;
    list-style: none;
    border-left: 1px solid rgba(92, 109, 140, 0.2);
  }

  .docs-side ul ul a,
  .docs-side .guide-toc a {
    display: block;
    padding: 4px 0;
    color: var(--color-accent);
    line-height: 1.5;
    text-decoration: none;
  }

  .docs-side ul ul a:hover,
  .docs-side .guide-toc a:hover {
    text-decoration: underline;
  }

  /* いま見ているページ・いま読んでいる見出し */
  .docs-side ul ul a.is-active,
  .docs-side .guide-toc a.is-active {
    margin-left: -17px;
    padding-left: 16px;
    border-left: 2px solid var(--color-accent);
    color: var(--color-text);
    font-weight: 600;
  }

  .docs-side .guide-toc {
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 0;
    background: none;
  }

  .docs-side .guide-toc > p {
    margin: 0;
    font-weight: 700;
  }
}
