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

:root {
  --color-cream: #f5ede1;
  --color-text: #3d2e26;
  --color-header-bar: #79463f;
  --color-bubble-bg: #eab200;
  --color-yellow: #ffda44;
  --color-yellow-shadow: #f5c400;
  --color-orange: #ff8c32;
  --color-orange-hover: #ff7a18;
  --color-instagram-cta: #ea7d00;
  --color-instagram-cta-edge: #c26800;
  --color-grid-line: #e9e9e9;
  --font: "M PLUS Rounded 1c", "Hiragino Maru Gothic ProN", "Hiragino Sans",
    sans-serif;
  --font-mono: "Roboto Mono", ui-monospace, monospace;
  --font-modal: "Mochiy Pop One", "Hiragino Maru Gothic ProN", sans-serif;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--color-text);
  background: var(--color-cream);
  line-height: 1.7;
}

img {
  max-width: 100%;
  height: auto;
  vertical-align: middle;
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

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

/* --- Header --- */
.site-header {
  background: var(--color-header-bar);
  padding: 0.65rem 1.25rem;
}

.site-header__title {
  margin: 0;
  color: #fff;
  font-family: var(--font-modal);
  font-weight: 400;
  font-size: clamp(0.95rem, 2vw, 1.1rem);
  letter-spacing: 0.04em;
}

/* --- Footer --- */
.site-footer {
  height: 40px;
  min-height: 40px;
  margin: 0;
  padding: 0;
  background: var(--color-header-bar);
  border: none;
}

/* --- Hero (書き出し画像) --- */
.hero {
  margin: 0;
  padding: 0;
  background: var(--color-cream);
  line-height: 0;
}

.hero__img {
  display: block;
  width: 100%;
  height: auto;
}

/* --- Section shell --- */
.section-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 3rem;
}

.section-inner--instagram {
  max-width: 880px;
}

/* 2つの吹き出しの横幅を揃える */
.section-heading-wrap {
  width: 100%;
  max-width: 880px;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 2rem;
}

.section-heading-wrap .section-label {
  margin: 0;
}

.section-grid-bg {
  position: relative;
  background-color: #fff;
  /* 方眼：#E9E9E9・やや太め、微妙なオフセット二重線でざらっとした質感 */
  background-image: linear-gradient(
      var(--color-grid-line) 3px,
      transparent 3px
    ),
    linear-gradient(90deg, var(--color-grid-line) 3px, transparent 3px),
    linear-gradient(rgba(233, 233, 233, 0.42) 2px, transparent 2px),
    linear-gradient(90deg, rgba(233, 233, 233, 0.42) 2px, transparent 2px);
  background-size: 36px 36px, 36px 36px, 36px 36px, 36px 36px;
  background-position: 0 0, 0 0, 0.9px 1.1px, 0.9px 1.1px;
}

.section-grid-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 128 128'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

.section-cream {
  background: var(--color-cream);
}

/* --- 吹き出し見出し（図鑑・Instagram 共通） --- */
.section-label {
  display: flex;
  justify-content: center;
  margin: 0 auto 2rem;
}

.section-label__text--bubble {
  position: relative;
  display: block;
  width: 100%;
  max-width: 460px;
  margin-left: auto;
  margin-right: auto;
  background: var(--color-bubble-bg);
  color: #fff;
  font-family: var(--font-mono);
  font-weight: 700;
  font-style: normal;
  font-synthesis: none;
  font-size: 20px;
  text-align: center;
  padding: 0.85rem 1.5rem 1rem;
  border-radius: 999px;
  box-shadow: 0 4px 0 rgba(150, 110, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  text-shadow: none;
}

.section-label__text--bubble::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -14px;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 14px solid transparent;
  border-right: 14px solid transparent;
  border-top: 16px solid var(--color-bubble-bg);
}

.section-label__br-sp {
  display: none;
}

@media (max-width: 767px) {
  .section-label__text--bubble {
    font-size: 18px;
  }

  .section-label__br-sp {
    display: block;
  }

  /* SP：図鑑・Instagram の吹き出しの高さを揃える */
  .zukan .section-label__text--bubble,
  .instagram .section-label__text--bubble {
    box-sizing: border-box;
    min-height: 5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.58rem 1.35rem 0.65rem;
  }

  .zukan .section-label__text--bubble {
    line-height: 1.3;
  }

  /* SP：Instagram 見出しの改行（ビションフリーゼの／リアルな…）の行間を詰める */
  .instagram .section-label__text--bubble {
    line-height: 1.12;
  }
}

.section-grid-bg .section-inner {
  position: relative;
  z-index: 1;
}

/* --- Book grid --- */
.book-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1.25rem, 4vw, 2.5rem);
  max-width: 920px;
  margin-left: auto;
  margin-right: auto;
}

@media (min-width: 900px) {
  .book-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.book-card {
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 8px;
  transform-origin: 50% 80%;
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
  will-change: transform;
}

.book-card:hover {
  transform: perspective(720px) rotate(-7deg) translateY(-4px);
}

.book-card:focus-visible {
  outline: 3px solid var(--color-orange);
  outline-offset: 4px;
}

.book-card:active {
  transform: perspective(720px) rotate(-4deg) translateY(-1px);
}

.book-card__img {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 10px 18px rgba(60, 40, 30, 0.18));
}

@media (prefers-reduced-motion: reduce) {
  .book-card {
    transition: none;
  }

  .book-card:hover,
  .book-card:active {
    transform: none;
  }
}

/* --- Instagram 埋め込み --- */
/* Instagramボタン〜フッターまでの余白（SP約40px / PC約60px） */
.instagram .section-inner {
  padding-bottom: 40px;
}

@media (min-width: 768px) {
  .instagram .section-inner {
    padding-bottom: 60px;
  }
}

/* 埋め込みブロックとボタンの間に約30px */
.instagram__embed-stack {
  max-width: 880px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 30px;
}

.instagram__embed-main {
  width: 100%;
  min-width: 0;
}

.instagram__embed-shell {
  width: 100%;
  max-width: 100%;
  margin: 0;
  background: #e8e8e8;
  overflow: hidden;
  line-height: 0;
  font-size: 0;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.instagram__iframe-main {
  display: block;
  width: 100%;
  max-width: 100%;
  min-height: min(720px, 85vh);
  border: 0;
  background: #e8e8e8;
  vertical-align: bottom;
}

@media (max-width: 899px) {
  .instagram .section-inner--instagram {
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }

  .instagram__iframe-main {
    min-height: min(560px, 78vh);
  }
}

@media (max-width: 479px) {
  .instagram__embed-stack {
    max-width: 100%;
  }

  .instagram__iframe-main {
    min-height: min(480px, 72vh);
  }
}

/* 投稿グリッド（最大15件・BICHON_INSTAGRAM_POSTS 使用時） */
.instagram-feed__grid {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

@media (min-width: 480px) {
  .instagram-feed__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
}

@media (min-width: 900px) {
  .instagram-feed__grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
  }
}

.instagram-feed__cell {
  margin: 0;
  padding: 0;
  min-width: 0;
  background: #e8e8e8;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
  line-height: 0;
  font-size: 0;
}

.instagram-feed__cell[hidden] {
  display: none !important;
}

.instagram-feed__iframe {
  display: block;
  width: 100%;
  max-width: 100%;
  height: 560px;
  border: 0;
  background: #e8e8e8;
  vertical-align: bottom;
}

@media (max-width: 899px) {
  .instagram-feed__iframe {
    height: min(500px, 72vh);
  }
}

@media (max-width: 479px) {
  .instagram-feed__iframe {
    height: min(460px, 68vh);
  }
}

/* Instagram：ラベルはボタン中央、「>」は右端から20px（英字 >） */
.instagram-cta {
  position: relative;
  display: block;
  width: 368px;
  max-width: calc(100% - 2rem);
  margin: 0;
  padding: 1rem 3rem;
  background: var(--color-instagram-cta);
  color: #fff;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  border-radius: 0;
  box-shadow: none;
  transition: transform 0.18s ease, background 0.18s ease, filter 0.18s ease;
}

.instagram-cta__label {
  display: block;
  text-align: center;
}

.instagram-cta__chevron {
  position: absolute;
  top: 50%;
  right: 20px;
  transform: translateY(-50%);
  font-weight: 700;
  line-height: 1;
  font-family: var(--font-mono);
}

.instagram-cta:hover {
  background: #f08f18;
  transform: translateY(-4px) scale(1.03);
  filter: brightness(1.04);
}

.instagram-cta:active {
  transform: translateY(2px) scale(0.98);
  filter: brightness(0.98);
}

/* --- Modal --- */
.modal-root[hidden] {
  display: none;
}

.modal-root:not([hidden]) {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  overflow-y: auto;
}

.modal-root__backdrop {
  position: fixed;
  inset: 0;
  background: rgba(55, 55, 55, 0.72);
  cursor: pointer;
}

.modal {
  position: relative;
  z-index: 1;
  width: min(920px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.modal__surface {
  position: relative;
  width: 100%;
}

/* ×は角丸パネルと重ならないよう、パネル直上の行に右寄せで配置 */
.modal__close-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  min-height: 44px;
  margin-bottom: 0.35rem;
  padding-right: 0.15rem;
}

.modal__close-floating {
  position: relative;
  z-index: 3;
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  display: grid;
  place-items: center;
  border-radius: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.modal__close-icon {
  display: block;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.35));
}

.modal__close-floating:hover {
  opacity: 0.88;
  transform: scale(1.06);
}

.modal__close-floating:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 4px;
}

@media (max-width: 767px) {
  /* SP：モーダルオープン時の自動フォーカスで outline がボタン全域の四角になるため消す */
  .modal__close-floating:focus,
  .modal__close-floating:focus-visible {
    outline: none;
  }
}

.modal__inner {
  position: relative;
  width: 100%;
  background: var(--color-cream);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.28);
  padding-top: 2rem;
}

.modal__banner {
  position: relative;
  margin: 0 114px;
  text-align: center;
}

@media (max-width: 720px) {
  .modal__banner {
    margin: 0 clamp(1rem, 5vw, 3rem);
  }
}

.modal__banner-line {
  display: block;
  width: 100%;
  height: auto;
  vertical-align: middle;
}

.modal__banner-text {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  padding: 0 0.75rem;
  pointer-events: none;
}

.modal__title {
  margin: 0;
  font-family: var(--font-modal);
  font-size: clamp(1.15rem, 2.8vw, 1.6rem);
  font-weight: 400;
  line-height: 1.2;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}

.modal__subtitle {
  margin: 0.12rem 0 0;
  font-family: var(--font-modal);
  font-size: clamp(0.85rem, 2vw, 1.02rem);
  font-weight: 400;
  line-height: 1.25;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.modal__body {
  display: grid;
  gap: 1.5rem;
  padding: 1.5rem 1.5rem 2.25rem;
}

@media (min-width: 720px) {
  .modal__body {
    grid-template-columns: minmax(200px, 320px) 1fr;
    align-items: start;
    gap: 2rem;
    padding: 2rem 2.5rem 2.5rem;
  }
}

.modal__illust {
  justify-self: center;
}

.modal__illust-img {
  display: block;
  width: min(100%, 320px);
  height: auto;
}

.modal__text {
  margin: 0;
  font-family: var(--font-modal);
  font-size: clamp(0.85rem, 1.7vw, 0.98rem);
  font-weight: 400;
  line-height: 1.85;
}

.modal__text p {
  margin: 0 0 1rem;
}

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

.modal__text-list {
  margin: 0 0 1rem;
  padding-left: 1.35em;
  list-style-type: disc;
}

.modal__text-list:last-child {
  margin-bottom: 0;
}

.modal__text p strong {
  font-weight: 700;
}

.modal__close-pill {
  cursor: pointer;
  border: none;
  background: #fff;
  color: var(--color-text);
  font-family: var(--font-modal);
  font-weight: 400;
  font-size: 1rem;
  padding: 0.75rem 3rem;
  border-radius: 999px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.modal__close-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
}

.modal__close-pill:focus-visible {
  outline: 3px solid var(--color-orange);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .instagram-cta:hover,
  .instagram-cta:active,
  .modal__close-pill:hover {
    transform: none;
    filter: none;
  }

  .instagram-cta__chevron {
    transform: translateY(-50%);
  }

  .modal__close-floating:hover {
    transform: none;
  }
}
