/* ============================================================
   安房のママ図鑑 共通スタイル
   色やフォントは、すぐ下の変数で決まる。
   色を変えたいときは、ここの値だけ書き換えればよい。
   ============================================================ */

/* ---------- 色と書体:水彩色鉛筆のえほん ---------- */
/* public/images/main-visual.webp のイラストから色をひろっている。いまのサイトはこれを使う。 */
:root {
  --bg: #fbf5e4; /* アイボリー・生成り(ページ全体) */
  --paper: #fffdf4; /* カードの紙 */
  --ink: #5a3d28; /* あたたかいブラウン(文字・輪郭線) */
  --ink-soft: #7b5f48; /* うすい文字 */
  --main: #8fb37a; /* セージグリーン・若草色 */
  --main-deep: #4c6f3c; /* 文字やリンクに使う濃い緑 */
  --accent: #f3c63f; /* ミモザイエロー */
  --sub: #9fcbe3; /* 淡いブルー(海と空) */
  --pink: #eeb4b8; /* くすみピンク */
  --lavender: #c3b1e0; /* ラベンダー */
  --soft: #f5ebcd; /* うすい背景 */
  --line: #dcc8a2; /* 線 */
  --sun: #f3c63f;
  --font-head: 'Klee One', 'Zen Maru Gothic', sans-serif;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg);
  /* 紙のようなざらっとした点々 */
  background-image: radial-gradient(
    color-mix(in srgb, var(--line) 45%, transparent) 1px,
    transparent 1.4px
  );
  background-size: 22px 22px;
  color: var(--ink);
  font-family: 'Zen Maru Gothic', 'Hiragino Maru Gothic ProN', 'Yu Gothic', sans-serif;
  font-size: 16px;
  line-height: 1.95;
  letter-spacing: 0.04em;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

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

a {
  color: var(--main-deep);
  text-underline-offset: 0.25em;
}

a:hover {
  text-decoration-style: wavy;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

h1,
h2,
h3 {
  font-family: var(--font-head);
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: 0.06em;
  margin: 0;
}

p {
  margin: 0 0 1.1em;
}

.wrap {
  width: min(100% - 32px, 1040px);
  margin-inline: auto;
}

.wrap-narrow {
  width: min(100% - 32px, 720px);
  margin-inline: auto;
}

.section {
  padding: 56px 0;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- 手描きふうの形 ---------- */
/* 少しゆがんだ角丸。定規で引いていない線に見せる */
.sketch {
  border: 2px solid var(--ink);
  border-radius: 255px 18px 225px 18px / 18px 225px 18px 255px;
}

.sketch-soft {
  border: 2px solid var(--line);
  border-radius: 28px 240px 26px 220px / 230px 24px 250px 22px;
}

/* ---------- おためし版のお知らせ帯 ---------- */
.notice-bar {
  background: var(--ink);
  color: var(--bg);
  font-size: 13px;
  line-height: 1.6;
  padding: 8px 16px;
  text-align: center;
}

/* ---------- ヘッダー ---------- */
.site-header {
  padding: 18px 0 10px;
}

.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
}

.site-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 22px;
  letter-spacing: 0.1em;
}

.site-logo svg {
  width: 40px;
  height: 40px;
  flex: none;
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 18px;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 14px;
}

.site-nav a {
  display: inline-block;
  padding: 6px 2px;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 2px dashed transparent;
}

.site-nav a:hover,
.site-nav a[aria-current='page'] {
  border-bottom-color: var(--main);
}

/* ---------- フッター ---------- */
.site-footer {
  margin-top: 72px;
  color: var(--ink);
}

.site-footer .wave {
  display: block;
  width: 100%;
  height: 46px;
  color: var(--soft);
}

.site-footer .inner {
  background: var(--soft);
  padding: 24px 0 36px;
  font-size: 14px;
}

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

.site-footer a {
  color: var(--ink);
}

.site-footer small {
  color: var(--ink-soft);
  font-size: 12px;
}

/* ---------- ボタン ---------- */
.btn {
  display: inline-block;
  padding: 12px 28px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 16px;
  text-decoration: none;
  border: 2px solid var(--ink);
  border-radius: 255px 18px 225px 18px / 18px 225px 18px 255px;
  box-shadow: 3px 4px 0 var(--main);
  transition: transform 0.15s, box-shadow 0.15s;
  cursor: pointer;
}

.btn:hover {
  transform: translate(2px, 2px);
  box-shadow: 1px 2px 0 var(--main);
  text-decoration: none;
}

.btn-accent {
  box-shadow: 3px 4px 0 var(--accent);
}

/* ---------- 見出し ---------- */
.heading {
  text-align: center;
  margin-bottom: 32px;
}

.heading .small {
  display: block;
  font-family: 'Zen Maru Gothic', sans-serif;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.2em;
  color: var(--main-deep);
  margin-bottom: 4px;
}

.heading h1,
.heading h2 {
  font-size: clamp(24px, 5vw, 32px);
}

.heading .squiggle {
  display: block;
  width: 96px;
  height: 12px;
  margin: 10px auto 0;
  color: var(--accent);
}

.lead {
  text-align: center;
  color: var(--ink-soft);
  max-width: 34em;
  margin: 0 auto 32px;
}

/* ---------- トップの大きな絵 ---------- */
.hero {
  padding: 16px 0 8px;
}

.hero .wrap {
  display: grid;
  gap: 16px;
  align-items: center;
}

.hero-copy {
  text-align: center;
}

.hero-copy .kicker {
  display: inline-block;
  font-size: 13px;
  letter-spacing: 0.18em;
  color: var(--main-deep);
  background: var(--paper);
  border: 1.5px dashed var(--main);
  border-radius: 999px;
  padding: 2px 16px;
  margin-bottom: 14px;
}

.hero-copy h1 {
  font-size: clamp(28px, 7vw, 46px);
  line-height: 1.55;
}

.hero-copy h1 em {
  font-style: normal;
  background: linear-gradient(transparent 62%, color-mix(in srgb, var(--accent) 55%, transparent) 62%);
}

.hero-copy p {
  margin: 18px auto 24px;
  max-width: 28em;
  color: var(--ink-soft);
}

.hero-art svg {
  display: block;
  width: 100%;
}

@media (min-width: 820px) {
  .hero .wrap {
    grid-template-columns: 1fr 1.1fr;
    gap: 40px;
  }

  .hero-copy {
    text-align: left;
  }

  .hero-copy p {
    margin-left: 0;
  }
}

/* ---------- カテゴリ ---------- */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  list-style: none;
  margin: 0;
  padding: 0;
}

@media (min-width: 720px) {
  .cat-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
  }
}

.cat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  height: 100%;
  padding: 18px 12px 16px;
  background: var(--paper);
  color: var(--ink);
  text-align: center;
  text-decoration: none;
  border: 2px solid var(--line);
  border-radius: 28px 240px 26px 220px / 230px 24px 250px 22px;
  transition: transform 0.15s, border-color 0.15s;
}

.cat-grid li:nth-child(even) .cat-card {
  border-radius: 240px 26px 220px 28px / 24px 250px 22px 230px;
}

.cat-card:hover {
  transform: rotate(-1deg) translateY(-2px);
  border-color: var(--main);
  text-decoration: none;
}

.cat-card svg {
  width: 56px;
  height: 56px;
  color: var(--main-deep);
}

.cat-card .name {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 15px;
  line-height: 1.5;
}

.cat-card .count {
  font-size: 12px;
  color: var(--ink-soft);
}

.cat-card .desc {
  display: none;
  font-size: 13px;
  line-height: 1.7;
  color: var(--ink-soft);
}

@media (min-width: 720px) {
  .cat-card .desc {
    display: block;
  }
}

/* ---------- 掲載者カード ---------- */
.mama-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
  list-style: none;
  margin: 0;
  padding: 0;
}

@media (min-width: 600px) {
  .mama-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 920px) {
  .mama-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.mama-card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 14px 14px 20px;
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
  border: 2px solid var(--ink);
  border-radius: 18px 22px 16px 24px / 22px 16px 24px 18px;
  box-shadow: 4px 5px 0 var(--soft);
  transition: transform 0.2s;
}

.mama-grid li:nth-child(3n + 1) .mama-card {
  transform: rotate(-0.6deg);
}

.mama-grid li:nth-child(3n) .mama-card {
  transform: rotate(0.5deg);
}

.mama-grid li .mama-card:hover {
  transform: rotate(0) translateY(-4px);
  text-decoration: none;
}

.mama-card .photo {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 12px 16px 10px 14px / 14px 10px 16px 12px;
  background: var(--soft);
}

.mama-card .photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mama-card .area {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--ink-soft);
}

.mama-card .name {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 20px;
  line-height: 1.5;
  margin: 0;
}

.mama-card .catch {
  margin: 6px 0 10px;
  font-size: 14px;
  line-height: 1.8;
}

.mama-card .tags {
  margin-top: auto;
}

/* 札(タグ) */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.tag {
  display: inline-block;
  padding: 1px 12px;
  font-size: 12px;
  line-height: 1.8;
  color: var(--ink);
  background: var(--soft);
  border-radius: 999px;
  text-decoration: none;
}

a.tag:hover {
  background: var(--accent);
  text-decoration: none;
}

/* 「架空の見本」「下書き」の札 */
.ribbon {
  position: absolute;
  top: -10px;
  right: 12px;
  z-index: 1;
  padding: 2px 12px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.7;
  color: var(--ink);
  background: var(--accent);
  border: 1.5px solid var(--ink);
  border-radius: 4px 10px 4px 10px;
  transform: rotate(3deg);
}

.ribbon.is-draft {
  right: auto;
  left: 12px;
  background: var(--paper);
  transform: rotate(-3deg);
}

/* ---------- 絞り込みボタン ---------- */
.filter {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 0 0 14px;
}

.filter-label {
  width: 100%;
  text-align: center;
  font-size: 13px;
  color: var(--ink-soft);
  margin: 0;
}

.chip {
  display: inline-block;
  padding: 5px 16px;
  font: inherit;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  text-decoration: none;
  cursor: pointer;
}

.chip:hover {
  border-color: var(--main);
  text-decoration: none;
}

.chip[aria-pressed='true'],
.chip[aria-current='page'] {
  background: var(--main);
  border-color: var(--ink);
  color: var(--ink);
  font-weight: 700;
}

.empty {
  text-align: center;
  color: var(--ink-soft);
  padding: 32px 0;
}

/* ---------- 個別プロフィール ---------- */
.profile-head {
  position: relative;
  text-align: center;
  padding: 28px 0 8px;
}

.profile-photo {
  width: min(62vw, 260px);
  aspect-ratio: 1;
  margin: 0 auto 20px;
  overflow: hidden;
  background: var(--soft);
  border: 3px solid var(--ink);
  /* まるに近い、いびつな形 */
  border-radius: 47% 53% 52% 48% / 51% 46% 54% 49%;
  box-shadow: 8px 8px 0 var(--soft);
}

.profile-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-head .kana {
  font-size: 13px;
  letter-spacing: 0.2em;
  color: var(--ink-soft);
  margin: 0;
}

.profile-head h1 {
  font-size: clamp(26px, 6vw, 36px);
}

.profile-head .catch {
  font-family: var(--font-head);
  font-size: 17px;
  margin: 14px auto 16px;
  max-width: 26em;
}

.profile-head .tags {
  justify-content: center;
}

.sample-box {
  margin: 20px auto 0;
  padding: 10px 18px;
  max-width: 34em;
  font-size: 13px;
  line-height: 1.8;
  background: var(--paper);
  border: 2px dashed var(--accent);
  border-radius: 14px;
}

.story {
  padding: 28px 0 0;
}

.story-block {
  margin: 0 0 40px;
}

.story-block h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  margin-bottom: 12px;
}

.story-block h2::before {
  content: '';
  flex: none;
  width: 14px;
  height: 14px;
  background: var(--accent);
  border: 2px solid var(--ink);
  border-radius: 50% 45% 55% 48%;
}

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

/* 手紙ふうの枠(地域のママへのメッセージ) */
.letter {
  position: relative;
  padding: 26px 22px 22px;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 14px 22px 12px 26px / 24px 12px 26px 14px;
  box-shadow: 5px 6px 0 var(--soft);
  /* 便せんの線 */
  background-image: repeating-linear-gradient(
    transparent 0 calc(1.95em - 1px),
    color-mix(in srgb, var(--line) 60%, transparent) calc(1.95em - 1px) 1.95em
  );
  background-position: 0 24px;
}

.letter h2 {
  font-size: 18px;
}

.letter .from {
  text-align: right;
  font-family: var(--font-head);
  margin: 12px 0 0;
}

/* 一問一答 */
.qa {
  margin: 0;
}

.qa dt {
  font-family: var(--font-head);
  font-weight: 600;
  color: var(--main-deep);
}

.qa dt::before {
  content: 'Q. ';
}

.qa dd {
  margin: 0 0 14px;
  padding: 0 0 14px;
  border-bottom: 2px dotted var(--line);
}

.qa dd:last-child {
  border-bottom: 0;
  margin-bottom: 0;
}

/* 子どもを歓迎する工夫 */
.welcome-list {
  list-style: none;
  margin: 0;
  padding: 16px 18px;
  background: var(--soft);
  border-radius: 20px 26px 18px 28px / 26px 18px 28px 20px;
}

.welcome-list li {
  position: relative;
  padding-left: 1.7em;
}

.welcome-list li::before {
  content: '';
  position: absolute;
  left: 0.2em;
  top: 0.72em;
  width: 0.75em;
  height: 0.42em;
  border-left: 3px solid var(--main-deep);
  border-bottom: 3px solid var(--main-deep);
  transform: rotate(-48deg);
  border-radius: 2px;
}

/* 編集部のひとこと */
.editor-note {
  padding: 16px 20px;
  background: var(--paper);
  border-left: 6px solid var(--sub);
  border-radius: 4px 18px 18px 4px;
  font-size: 15px;
}

.editor-note .who {
  display: block;
  font-size: 12px;
  letter-spacing: 0.15em;
  color: var(--ink-soft);
}

/* 活動写真 */
.gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.gallery figure {
  margin: 0;
  padding: 8px 8px 10px;
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 6px;
  box-shadow: 2px 3px 0 var(--soft);
}

.gallery li:nth-child(odd) figure {
  transform: rotate(-1.2deg);
}

.gallery li:nth-child(even) figure {
  transform: rotate(1deg);
}

.gallery img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 3px;
}

.gallery figcaption {
  font-size: 12px;
  line-height: 1.6;
  color: var(--ink-soft);
  margin-top: 6px;
  text-align: center;
}

/* 基本情報とリンク */
.info-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

.info-table th,
.info-table td {
  padding: 10px 4px;
  text-align: left;
  vertical-align: top;
  border-bottom: 2px dotted var(--line);
}

.info-table th {
  width: 6.5em;
  font-weight: 500;
  color: var(--ink-soft);
  white-space: nowrap;
}

.link-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.link-list .btn {
  padding: 8px 20px;
  font-size: 14px;
}

.back-link {
  text-align: center;
  margin: 48px 0 0;
}

/* ---------- 文章ページ(この図鑑について など) ---------- */
.prose h2 {
  font-size: 21px;
  margin: 2.2em 0 0.7em;
  padding-bottom: 6px;
  border-bottom: 2px dashed var(--line);
}

.prose h3 {
  font-size: 17px;
  margin: 1.8em 0 0.5em;
}

.prose ul,
.prose ol {
  padding-left: 1.4em;
  margin: 0 0 1.1em;
}

.prose li {
  margin-bottom: 0.3em;
}

.prose blockquote {
  margin: 1.4em 0;
  padding: 12px 18px;
  background: var(--paper);
  border: 2px dashed var(--accent);
  border-radius: 14px;
  font-size: 14px;
}

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

.page-art {
  display: block;
  width: 120px;
  margin: 0 auto 8px;
  color: var(--main-deep);
}

.cta-box {
  margin-top: 40px;
  padding: 26px 20px;
  text-align: center;
  background: var(--soft);
  border-radius: 30px 240px 28px 220px / 220px 26px 240px 24px;
}

.cta-box p {
  margin-bottom: 14px;
}

/* ============================================================
   水彩色鉛筆のえほんの質感
   ここから下は、上の基本の形に「紙・色鉛筆・水彩」の質感を重ねる指定。
   色鉛筆のゆれる線は、base.njk の中の #pencil-line と #crayon という効果を使っている。
   ============================================================ */

/* ---- 紙:こまかい粒と、水彩のにじみ ---- */
body {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .42 0 0 0 0 .3 0 0 0 0 .18 0 0 0 .2 0'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)'/%3E%3C/svg%3E"),
    radial-gradient(60vw 420px at -8% 4%, color-mix(in srgb, var(--sub) 38%, transparent), transparent 70%),
    radial-gradient(50vw 380px at 108% 0%, color-mix(in srgb, var(--accent) 26%, transparent), transparent 70%),
    radial-gradient(70vw 520px at 100% 62%, color-mix(in srgb, var(--pink) 20%, transparent), transparent 70%),
    radial-gradient(60vw 480px at 0% 88%, color-mix(in srgb, var(--main) 20%, transparent), transparent 70%);
  background-size: 240px 240px, auto, auto, auto, auto;
  background-repeat: repeat, no-repeat, no-repeat, no-repeat, no-repeat;
}

/* ---- 色鉛筆の輪郭線 ----
   まっすぐな枠線のかわりに、少しゆれる線を重ねる。使うところに pencil の指定を足していく。 */
.btn,
.mama-card,
.cat-card,
.letter,
.hero-art,
.profile-photo,
.gallery figure,
.welcome-list,
.cta-box {
  position: relative;
  border-color: transparent;
}

.btn::after,
.mama-card::after,
.cat-card::after,
.letter::after,
.hero-art::after,
.profile-photo::after,
.gallery figure::after,
.welcome-list::after,
.cta-box::after {
  content: '';
  position: absolute;
  inset: -1px;
  border: 2.5px solid var(--ink);
  border-radius: inherit;
  filter: url(#pencil-line);
  pointer-events: none;
}

.cat-card::after,
.gallery figure::after,
.welcome-list::after,
.cta-box::after {
  border-width: 2px;
  border-color: color-mix(in srgb, var(--ink) 62%, transparent);
}

/* ---- 水彩でぬった面 ---- */
.btn {
  background:
    radial-gradient(120% 90% at 20% 10%, color-mix(in srgb, #fff 55%, transparent), transparent 60%),
    color-mix(in srgb, var(--accent) 62%, var(--paper));
  box-shadow: none;
  border-radius: 26px 30px 24px 32px / 30px 24px 32px 26px;
}

.btn:hover {
  transform: translateY(-2px) rotate(-1deg);
  box-shadow: none;
}

.btn-accent {
  background:
    radial-gradient(120% 90% at 20% 10%, color-mix(in srgb, #fff 55%, transparent), transparent 60%),
    color-mix(in srgb, var(--main) 55%, var(--paper));
}

.link-list .btn {
  background:
    radial-gradient(120% 90% at 20% 10%, color-mix(in srgb, #fff 55%, transparent), transparent 60%),
    color-mix(in srgb, var(--sub) 55%, var(--paper));
}

.cta-box {
  background:
    radial-gradient(90% 120% at 12% 20%, color-mix(in srgb, var(--accent) 28%, transparent), transparent 62%),
    radial-gradient(80% 120% at 92% 80%, color-mix(in srgb, var(--pink) 30%, transparent), transparent 62%),
    var(--paper);
}

.welcome-list {
  background:
    radial-gradient(90% 120% at 8% 10%, color-mix(in srgb, var(--main) 26%, transparent), transparent 62%),
    radial-gradient(80% 120% at 96% 90%, color-mix(in srgb, var(--sub) 30%, transparent), transparent 62%),
    var(--paper);
}

/* 札は、色鉛筆でぬったように色を順番に変える */
.tag {
  background: color-mix(in srgb, var(--accent) 42%, var(--paper));
  border: 1.5px solid color-mix(in srgb, var(--ink) 45%, transparent);
  border-radius: 14px 18px 12px 16px / 16px 12px 18px 14px;
}

.tags li:nth-child(5n + 2) .tag,
.tags li.tag:nth-child(5n + 2) {
  background: color-mix(in srgb, var(--pink) 50%, var(--paper));
}

.tags li:nth-child(5n + 3) .tag,
.tags li.tag:nth-child(5n + 3) {
  background: color-mix(in srgb, var(--sub) 50%, var(--paper));
}

.tags li:nth-child(5n + 4) .tag,
.tags li.tag:nth-child(5n + 4) {
  background: color-mix(in srgb, var(--main) 42%, var(--paper));
}

.tags li:nth-child(5n + 5) .tag,
.tags li.tag:nth-child(5n + 5) {
  background: color-mix(in srgb, var(--lavender) 48%, var(--paper));
}

a.tag:hover {
  background: var(--accent);
}

.chip {
  border: 1.5px solid color-mix(in srgb, var(--ink) 45%, transparent);
  border-radius: 16px 20px 14px 18px / 18px 14px 20px 16px;
}

.chip[aria-pressed='true'],
.chip[aria-current='page'] {
  background: color-mix(in srgb, var(--main) 70%, var(--paper));
  border-color: var(--ink);
}

/* マーカーは、色鉛筆でななめにぬったように */
.hero-copy h1 em {
  background: linear-gradient(
    transparent 58%,
    color-mix(in srgb, var(--accent) 70%, transparent) 58%,
    color-mix(in srgb, var(--accent) 45%, transparent) 92%,
    transparent 92%
  );
  border-radius: 2px 8px 3px 6px;
}

/* ---- ヘッダー:左右の旗かざり ---- */
.site-header {
  position: relative;
  /* 旗かざりとロゴが重ならないよう、上をあける */
  padding-top: clamp(44px, 8vw, 70px);
}

.bunting {
  position: absolute;
  top: 0;
  width: clamp(110px, 20vw, 230px);
  pointer-events: none;
}

.bunting.is-left {
  left: 0;
}

.bunting.is-right {
  right: 0;
  transform: scaleX(-1);
}

.site-header .wrap {
  position: relative;
}

.site-logo {
  font-size: 24px;
}

.site-nav a {
  font-family: var(--font-head);
  font-size: 15px;
  border-bottom: 0;
  background: linear-gradient(transparent 68%, transparent 68%);
  border-radius: 2px 8px 3px 6px;
}

.site-nav a:hover,
.site-nav a[aria-current='page'] {
  background: linear-gradient(transparent 62%, color-mix(in srgb, var(--accent) 65%, transparent) 62%);
}

/* ---- 見出しの下の、小さな枝 ---- */
.heading .sprig {
  display: block;
  width: 132px;
  height: auto;
  margin: 8px auto 0;
}

.heading .small {
  font-family: var(--font-head);
  font-size: 14px;
  color: var(--main-deep);
}

/* ---- トップの絵 ---- */
.hero .wrap {
  grid-template-columns: minmax(0, 1fr);
  gap: 26px;
  justify-items: center;
}

.hero-art {
  width: min(100%, 860px);
  border-radius: 26px 34px 24px 38px / 34px 24px 38px 26px;
  background: var(--paper);
}

.hero-art img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: inherit;
}

.hero-copy,
.hero-copy p {
  text-align: center;
  margin-left: auto;
  margin-right: auto;
}

.hero-copy .kicker {
  font-family: var(--font-head);
  border: 0;
  background: color-mix(in srgb, var(--sub) 45%, var(--paper));
  border-radius: 14px 18px 12px 16px / 16px 12px 18px 14px;
  color: var(--ink);
}

.hero-copy h1 {
  font-size: clamp(26px, 6vw, 40px);
}

/* ---- カテゴリの絵 ---- */
.cat-card {
  background:
    radial-gradient(90% 70% at 50% 18%, color-mix(in srgb, var(--sub) 26%, transparent), transparent 70%),
    var(--paper);
}

.cat-grid li:nth-child(3n + 2) .cat-card {
  background:
    radial-gradient(90% 70% at 50% 18%, color-mix(in srgb, var(--accent) 26%, transparent), transparent 70%),
    var(--paper);
}

.cat-grid li:nth-child(3n) .cat-card {
  background:
    radial-gradient(90% 70% at 50% 18%, color-mix(in srgb, var(--pink) 28%, transparent), transparent 70%),
    var(--paper);
}

.cat-card svg {
  width: 68px;
  height: 68px;
  color: var(--ink);
}

/* 管理画面の「イラスト」でカテゴリの絵を登録したとき */
.cat-card .cat-image {
  width: 104px;
  height: 104px;
  object-fit: contain;
}

.page-art .cat-image {
  display: block;
  width: 100%;
}

/* ---- 掲載者カード:絵本の登場人物紹介 ---- */
.mama-card {
  padding: 18px 16px 20px;
  box-shadow: none;
  background:
    radial-gradient(80% 50% at 90% 100%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%),
    var(--paper);
}

.mama-grid li:nth-child(3n + 2) .mama-card {
  background:
    radial-gradient(80% 50% at 10% 100%, color-mix(in srgb, var(--pink) 24%, transparent), transparent 70%),
    var(--paper);
}

.mama-grid li:nth-child(3n) .mama-card {
  background:
    radial-gradient(80% 50% at 90% 100%, color-mix(in srgb, var(--sub) 26%, transparent), transparent 70%),
    var(--paper);
}

/* 写真をとめる、マスキングテープ */
.mama-card::before {
  content: '';
  position: absolute;
  top: -11px;
  left: 50%;
  z-index: 1;
  width: 86px;
  height: 24px;
  background: repeating-linear-gradient(
    -45deg,
    color-mix(in srgb, var(--pink) 80%, transparent) 0 7px,
    color-mix(in srgb, var(--pink) 50%, transparent) 7px 14px
  );
  transform: translateX(-50%) rotate(-3deg);
  opacity: 0.9;
}

.mama-grid li:nth-child(3n + 2) .mama-card::before {
  background: repeating-linear-gradient(
    -45deg,
    color-mix(in srgb, var(--sub) 85%, transparent) 0 7px,
    color-mix(in srgb, var(--sub) 55%, transparent) 7px 14px
  );
  transform: translateX(-50%) rotate(2deg);
}

.mama-grid li:nth-child(3n) .mama-card::before {
  background: repeating-linear-gradient(
    -45deg,
    color-mix(in srgb, var(--main) 80%, transparent) 0 7px,
    color-mix(in srgb, var(--main) 50%, transparent) 7px 14px
  );
}

.mama-card .photo {
  border: 2px solid color-mix(in srgb, var(--ink) 55%, transparent);
  border-radius: 14px 18px 12px 16px / 16px 12px 18px 14px;
}

.mama-card .name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 21px;
}

/* 名前の横の、小さな葉っぱ */
.mama-card .name::before,
.story-block h2::before {
  content: '';
  flex: none;
  width: 15px;
  height: 15px;
  background: var(--main);
  border: 1.5px solid var(--ink);
  border-radius: 2px 80% 4px 80%;
  transform: rotate(-12deg);
}

.ribbon {
  z-index: 2;
}

/* ---- プロフィール:一人の物語を読むように ---- */
.profile-photo {
  border: 0;
  box-shadow: none;
  outline: 10px solid color-mix(in srgb, var(--accent) 30%, transparent);
  outline-offset: 6px;
}

.profile-head h1 {
  font-size: clamp(28px, 6.5vw, 38px);
}

.story-block h2 {
  font-size: 21px;
  padding-bottom: 6px;
  background: linear-gradient(transparent calc(100% - 3px), color-mix(in srgb, var(--line) 80%, transparent) 0) no-repeat;
  background-size: 100% 100%;
}

/* コーナーの間の、枝のかざり */
.story-block + .story-block::before {
  content: '';
  display: block;
  width: 120px;
  height: 22px;
  margin: 0 auto 34px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 22' fill='none' stroke='%235a3d28' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='M8 12 C36 6 84 16 112 10'/%3E%3Cpath d='M30 10 q-3 -9 6 -8 q1 7 -6 8Z M52 11 q5 8 -4 9 q-3 -6 4 -9Z M74 13 q-2 -9 7 -8 q0 7 -7 8Z M94 12 q5 7 -3 9 q-3 -6 3 -9Z' fill='%238fb37a'/%3E%3Ccircle cx='16' cy='10' r='3' fill='%23f3c63f'/%3E%3Ccircle cx='106' cy='9' r='3' fill='%23f3c63f'/%3E%3Ccircle cx='62' cy='7' r='2.4' fill='%23eeb4b8'/%3E%3C/svg%3E")
    center / contain no-repeat;
}

.letter {
  box-shadow: none;
}

.editor-note {
  border-left: 0;
  border-radius: 16px 22px 14px 20px / 20px 14px 22px 16px;
  background:
    radial-gradient(70% 120% at 0% 50%, color-mix(in srgb, var(--lavender) 34%, transparent), transparent 70%),
    var(--paper);
}

.sample-box {
  border-radius: 16px 22px 14px 20px / 20px 14px 22px 16px;
}

/* ---- フッター:花のかざり ---- */
.site-footer .flowers {
  display: block;
  width: min(86%, 420px);
  margin: 0 auto -6px;
}

.site-footer .inner {
  background: color-mix(in srgb, var(--main) 26%, var(--bg));
}

.site-footer .wave {
  color: color-mix(in srgb, var(--main) 26%, var(--bg));
}

/* ---- 文章ページ ---- */
.prose h2 {
  display: flex;
  align-items: center;
  gap: 8px;
}

.prose h2::before {
  content: '';
  flex: none;
  width: 14px;
  height: 14px;
  background: var(--accent);
  border: 1.5px solid var(--ink);
  border-radius: 50% 46% 54% 48%;
}

/* ---------- 図鑑の表紙(トップページで最初に出る) ---------- */
/* 中身は src/_includes/cover.njk。html に has-cover の印があるときだけ表示される。
   分厚い図鑑に見えるよう、表紙・背表紙・ページの束を、立体の箱として組み立てている。 */
.cover {
  display: none;
}

html.has-cover {
  overflow: hidden;
}

html.has-cover .cover {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 52px;
  overflow: hidden;
  background-color: var(--bg);
  background-image: radial-gradient(color-mix(in srgb, var(--line) 45%, transparent) 1px, transparent 1.4px);
  background-size: 22px 22px;
  transition: opacity 1s ease;
}

/* 本を置く台。--w が本の横幅、--d が本の厚み。厚みを変えたいときは 0.22 の数字を変える */
.cover-stage {
  --w: min(58vw, 44vh, 330px);
  --d: calc(var(--w) * 0.22);
  --cloth: var(--main-deep); /* 背表紙の布の色 */
  position: relative;
  width: var(--w);
  aspect-ratio: 1086 / 1448;
  margin-left: calc(var(--d) * 0.6);
  perspective: 1500px;
}

/* 本のうしろの、やわらかい光 */
.cover-halo {
  position: absolute;
  inset: -24%;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--sun) 55%, transparent) 0%, transparent 68%);
  animation: cover-breathe 3.6s ease-in-out infinite;
}

/* 本の下の影 */
.cover-shadow {
  position: absolute;
  left: -16%;
  right: -10%;
  bottom: -9%;
  height: 11%;
  background: radial-gradient(ellipse at center, color-mix(in srgb, var(--ink) 42%, transparent), transparent 70%);
  filter: blur(7px);
}

/* 本ぜんたい(少しななめから見た向き) */
.book3d {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transform: rotateX(-14deg) rotateY(25deg);
  transition: transform 1.3s cubic-bezier(0.5, 0, 0.3, 1);
  animation: cover-float 5s ease-in-out infinite;
}

.book3d > * {
  position: absolute;
}

/* 裏表紙 */
.book-back {
  inset: 0;
  background: var(--cloth);
  border: 2px solid var(--ink);
  border-radius: 3px 9px 9px 3px;
  transform: translateZ(calc(var(--d) / -2));
}

/* 背表紙 */
.book-spine {
  top: 0;
  left: 0;
  width: var(--d);
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(90deg, rgb(0 0 0 / 0.22), transparent 22%, rgb(255 255 255 / 0.14) 50%, transparent 78%, rgb(0 0 0 / 0.2)),
    var(--cloth);
  border: 2px solid var(--ink);
  border-radius: 4px;
  transform: translateX(-50%) rotateY(-90deg);
}

/* 背表紙の金色の帯 */
.book-spine::before,
.book-spine::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 3.2%;
  background: var(--accent);
  border-block: 1.5px solid var(--ink);
}

.book-spine::before {
  top: 9%;
}

.book-spine::after {
  bottom: 9%;
}

.book-spine span {
  writing-mode: vertical-rl;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: calc(var(--d) * 0.36);
  letter-spacing: 0.22em;
  color: var(--paper);
  white-space: nowrap;
}

/* ページの束(右側と上側)。細い線が、紙の重なりに見える */
.book-pages-right {
  top: 4px;
  bottom: 4px;
  left: 100%;
  width: calc(var(--d) - 8px);
  background: repeating-linear-gradient(90deg, #fffdf4 0 2px, #e0d3b3 2px 3px);
  border-block: 1.5px solid color-mix(in srgb, var(--ink) 50%, transparent);
  transform: translateX(-50%) translateX(-7px) rotateY(90deg);
}

.book-pages-top {
  top: 0;
  left: 2px;
  right: 7px;
  height: calc(var(--d) - 8px);
  background: repeating-linear-gradient(0deg, #fffdf4 0 2px, #e0d3b3 2px 3px);
  /* 表紙のふちより 4px だけ内側。ここを大きくすると、上から見たときに表紙にかくれてしまう */
  transform: translateY(-50%) translateY(4px) rotateX(90deg);
}

/* 表紙の下の、1ページ目(ひらくと光る) */
.book-inner {
  inset: 4px 7px 4px 2px;
  background:
    radial-gradient(circle at 50% 50%, #fff 0%, color-mix(in srgb, var(--sun) 40%, #fffdf4) 70%),
    var(--paper);
  border: 1.5px solid color-mix(in srgb, var(--ink) 50%, transparent);
  transform: translateZ(calc(var(--d) / 2 - 5px));
}

/* 表紙(左を軸にしてひらく) */
.book-front {
  inset: 0;
  transform-style: preserve-3d;
  transform-origin: left center;
  transform: translateZ(calc(var(--d) / 2));
  transition: transform 1.7s cubic-bezier(0.55, 0.05, 0.25, 1);
}

.book-front > * {
  position: absolute;
  inset: 0;
  border: 2.5px solid var(--ink);
  border-radius: 3px 10px 10px 3px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
}

/* 表紙のおもて */
.book-front-face {
  background: var(--paper);
}

.book-front-face img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 背表紙からつづく布と、開くための溝 */
.book-front-face::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 6.5%;
  background:
    linear-gradient(90deg, transparent 72%, rgb(0 0 0 / 0.28) 84%, transparent 100%),
    var(--cloth);
  border-right: 1.5px solid var(--ink);
}

/* 表紙のつや */
.book-front-face::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, rgb(255 255 255 / 0.22) 0%, transparent 28%, transparent 72%, rgb(0 0 0 / 0.07) 100%);
  pointer-events: none;
}

/* 表紙のうら(見返し) */
.book-front-inside {
  background:
    radial-gradient(color-mix(in srgb, var(--accent) 55%, transparent) 2px, transparent 2.6px) 0 0 / 22px 22px,
    var(--soft);
  transform: rotateY(180deg);
}

/* タップするための、すきとおったボタン(本ぜんたいをおおう) */
.cover-open {
  position: absolute;
  inset: -10%;
  z-index: 3;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.cover-open:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 0;
  border-radius: 18px;
}

/* まわりで光る小さな星 */
.cover-star {
  position: absolute;
  width: 14px;
  height: 14px;
  background: var(--sun);
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
  animation: cover-twinkle 2.6s ease-in-out infinite;
}

.cover-star.s1 {
  top: -10%;
  right: -12%;
}

.cover-star.s2 {
  bottom: 6%;
  left: -30%;
  width: 10px;
  height: 10px;
  animation-delay: 0.9s;
}

.cover-star.s3 {
  top: 24%;
  right: -22%;
  width: 9px;
  height: 9px;
  animation-delay: 1.7s;
}

.cover-hint {
  margin: 0;
  font-family: var(--font-head);
  font-size: 15px;
  letter-spacing: 0.3em;
  color: var(--ink-soft);
  animation: cover-breathe 2.4s ease-in-out infinite;
}

/* ひらくときに画面いっぱいに広がる光 */
.cover-glow {
  position: absolute;
  left: 50%;
  top: 46%;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0%, #fff 30%, color-mix(in srgb, var(--sun) 45%, #fff) 52%, transparent 72%);
  transform: translate(-50%, -50%) scale(0);
  opacity: 0;
  pointer-events: none;
  transition: transform 1.5s cubic-bezier(0.4, 0, 0.6, 1) 0.55s, opacity 0.7s ease 0.55s;
}

/* --- ひらく動き --- */
.cover.is-opening .book3d {
  animation: none;
  transform: rotateX(-6deg) rotateY(10deg);
}

.cover.is-opening .book-front {
  transform: translateZ(calc(var(--d) / 2)) rotateY(-150deg);
}

.cover.is-opening .cover-glow {
  transform: translate(-50%, -50%) scale(190);
  opacity: 1;
}

.cover.is-opening .cover-hint,
.cover.is-opening .cover-star {
  animation: none;
  opacity: 0;
  transition: opacity 0.3s;
}

.cover.is-leaving {
  opacity: 0;
  pointer-events: none;
}

@keyframes cover-float {
  0%,
  100% {
    transform: rotateX(-14deg) rotateY(25deg) translateY(0);
  }
  50% {
    transform: rotateX(-13deg) rotateY(21deg) translateY(-8px);
  }
}

@keyframes cover-breathe {
  0%,
  100% {
    opacity: 0.45;
  }
  50% {
    opacity: 1;
  }
}

@keyframes cover-twinkle {
  0%,
  100% {
    opacity: 0.15;
    transform: scale(0.6) rotate(0deg);
  }
  50% {
    opacity: 1;
    transform: scale(1.15) rotate(20deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .book3d {
    animation: none !important;
  }
}


/* 表紙がひらいたあと、読み上げソフト用に見出しへ移動する。そのときの枠線は出さない */
h1[tabindex='-1']:focus {
  outline: none;
}

.cover-again {
  display: block;
  margin: 28px auto 0;
  padding: 4px 8px;
  font: inherit;
  font-size: 13px;
  color: var(--ink-soft);
  background: none;
  border: 0;
  border-bottom: 1.5px dashed var(--line);
  cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
  .cover-book,
  .cover-halo,
  .cover-star,
  .cover-hint {
    animation: none !important;
  }

  .cover-glow {
    display: none;
  }

  html.has-cover .cover {
    transition: opacity 0.4s ease !important;
  }

  * {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
