/* ==========================================================================
   1. レイヤー定義（resetのみ宣言）
   ========================================================================== */
@layer reset;

/* ==========================================================================
   2. リセットレイヤー（reset グループ）
   （既存のリセットと、ボタンリセットをこの中にカプセル化します）
   ========================================================================== */
@layer reset {

  /* 既存の全体リセット */
  * {
    margin: 0;
    padding: 0;
    font-weight: normal;
    box-sizing: border-box;
  }

  /* ボタン専用リセット */
  button.p-info__help-button,
  button.p-info__read-all-button,
  button.p-info__day-button,
  button.p-info__book-dots,
  button.p-info__book-menu-item {
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    outline: none;
    cursor: pointer;
    color: inherit;
    font-family: inherit;
    font-size: inherit;
    text-align: inherit;
  }
}

/* --- スタイル前処理 --- */
/* 画像 */
.p-info__book-dots-icon {
  width: 100%;
  display: block;
}

/* ページ全体 */
main {
  color: var(--text-body);
}

/* ===================================================================
   お知らせ（暫定）
=================================================================== */
.p-newrelease-attention {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  flex: 1 0 0;

  /* 調整 */
  margin-block: 16px;
}

.p-newrelease-attention__title {
  /* レイアウト */
  display: flex;
  align-items: flex-start;
  gap: 4px;
  align-self: stretch;

  /* スタイル */
  color: var(--text-body);
  font-family: "Hiragino Kaku Gothic ProN";
  font-size: 13px;
  font-style: normal;
  font-weight: 600;
  line-height: 120%; /* 15.6px */
}

.p-newrelease-attention__badge {
  display: flex;
  padding: 3px 6px;
  justify-content: center;
  align-items: center;
  gap: -1px;
  border-radius: 2px;
  background: var(--text-body);
}

.p-newrelease-attention__badge--important {
  color: var(--white);
  text-align: center;
  font-family: var(--font-hiragino, "Hiragino Kaku Gothic ProN");
  font-size: 11px;
  font-style: normal;
  font-weight: 600;
  line-height: 100%; /* 11px */
}

.p-newrelease-attention__text {
  color: var(--text-body);
  font-family: "Hiragino Kaku Gothic ProN";
  font-size: 12px;
  font-style: normal;
  font-weight: 300;
  line-height: 140%; /* 16.8px */
}


/* =======================
    ツールバー
  ======================== */
/* ツールバー全体のコンテナ：左右端に要素を押し出す */
.p-info__toolbar {
	display: flex;
	justify-content: space-between; /* 左右に最大の間隔を開けて配置 */
	align-items: center;            /* 縦方向の中央揃え */
	width: 100%;
  padding: 16px var(--side-p);
  background: var(--base);
  border-top: 1px solid var(--border-low);
  border-bottom: 1px solid var(--border-low);
}

/* ヘルプボタン：テキストとヘルプ画像を横並び・中央揃えにする */
.p-info__help-button {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	background: transparent;
	border: none;
	padding: 0;
	cursor: pointer;
}

/* ヘルプ画像自体のサイズ調整 */
.p-info__help-icon {
	width: 16px;                    /* 画像の幅 */
	height: 16px;                   /* 画像の高さ */
	vertical-align: middle;
}

/* 右端のボタンコンテナ（隠れていない時のみ機能） */
.p-info__toolbar-right {
	display: flex;
	align-items: center;
}

/* 全て既読ボタン（c-button などの共通スタイルがあればそれに準拠） */
.p-info__read-all-button,
.p-info__day-button {
	background: transparent;
	border: none;
	padding: 0;
	cursor: pointer;
  font-size: 13px;
	color: var(--text-link-blue);
}

/* 日別の表示 */

.p-info__day-head {
  display: flex;
  align-content: center;
  align-items: center;
  justify-content: space-between;
  /* 追従用 */
  position: -webkit-sticky;
  position: sticky;
  top: var(--header-h, 0px);
  z-index: 4;
  background-color: var(--bg-main, #ffffff);
  margin-bottom: 0;
  padding: 16px 0;

  /* sticky状態を監視するコンテナにする */
  container-type: scroll-state;
  container-name: day-head;
}

/* stickyで上端に固定されている状態 ブラウザ対応あるのでお試し。 */
@container day-head scroll-state(stuck: top) {
  .p-info__day-count {
    display: none;
  }
}

.p-info__day-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 0;
}

/* カートと三点リーダーの親コンテナ */
.p-info__book-sub {
  display: flex;
  align-items: center;    /* 縦方向の中央揃え */
  width: 100%;            /* 横幅を親要素に合わせる */
  gap: 4px;               /* 要素間の余白（px指定） */
}

/* カートボタン（存在するときのみ適用される） */
.p-info__book-cart {
  flex-grow: 1;           /* 残りの横幅をすべて埋める設定 */
}

/* 三点リーダー（ボタン） */
.p-info__book-dots {
  margin-left: auto;      /* カートの有無に関わらず、自身を常に一番右端へ押し出す */
  flex-shrink: 0;         /* 押し潰されるのを防ぐ */
  width: 32px;            /* ボタン自体のクリックエリア（仮: 32px） */
  height: 32px;           /* ボタン自体のクリックエリア（仮: 32px） */
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* 三点リーダー内のアイコン画像 */
.p-info__book-dots-icon {
  width: 20px;
  height: 20px;
}

/* --- ドロップダウン --- */
/* メニューを開く親コンテナを相対配置の基準にする */
.p-info__book-actions {
  position: relative;
}

/* 操作メニュー（ドロップダウン）：.c-select_option_wrap のスタイルを融合 */
.p-info__book-menu {
  position: absolute;
  top: calc(100% + 8px); /* ボタンの下に 8px 浮かせた配置 */
  right: 0;              /* デフォルト：右端を揃える */
  z-index: 5;
  
  /* 融合したデザインスタイル */
  width: max-content;
  min-width: 120px;
  max-height: 400px;
  overflow-y: auto;
  padding: 8px 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.90);     /* 美しい半透明白 */
  box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.24); /* 共通の影 */
  backdrop-filter: blur(12px);                /* 背景をぼかすエフェクト */
  transform: translateZ(0);                   /* ぼかしの描画を滑らかにする */
  user-select: none;
}

/* 【上下はみ出し時】上方向に開く補正スタイル */
.p-info__book-menu--top {
  top: auto;
  bottom: calc(100% + 8px); /* 上に 8px 浮かせた配置 */
}

/* 【左はみ出し時】左端を揃える補正スタイル */
.p-info__book-menu--left {
  right: auto;
  left: 0;
}

/* メニュー内の各操作項目（ボタン）：.c-select_option のスタイルを融合 */
.p-info__book-menu-item {
  display: block;
  width: 100%;
  min-width: 120px;
  padding: 12px 16px;
  box-sizing: border-box;
  text-align: left;
  background: transparent;
  border: none;
  cursor: pointer;
  
  /* 融合したフォント・カラースタイル */
  color: var(--text-body);
  font-size: var(--size-headline-small);
  font-weight: bold;
  line-height: 140%;
}

.p-info__book-menu-item:hover {
  background: var(--button-quarternary);
}

.p-info__day-empty {
  font-size: var(--size-body-large);
  line-height: 1.6;
}

/* ==========================================
  あなたの関連作品
  ========================================== */
.p-info__related {
  border-top: 1px solid var(--border-medium, #EAEAEA);
  background: var(--background-medium, #F8F8F8);
  border-bottom: 1px solid var(--border-medium, #EAEAEA);
  padding: 16px 0;
}

.p-info__related-slidewrap {
  margin-bottom: 0;
}

/* 関連作品の推薦元ヘッダー領域（Flexで横並び化） */
.p-info__kanren-head {
  display: flex;
  align-items: flex-start;
  gap: 4px;              /* 要素同士の間隔（px指定） */
  margin-bottom: 8px;
}

/* 関連作品の書影画像（パターン①：横幅固定・高さ自動追従で変形とカットを防止） */
.p-info__kanren-cover {
  width: 20px;            /* 書影の幅（px指定） */
  height: auto;           /* 画像本来の縦横比を完全に維持して自動調整 */
  border: 1px solid var(--border-low, #eaeaea); /* 境界線（px指定） */
  flex-shrink: 0;         /* 画像が縮むのを防止 */
}

/* 既存のアイコン画像も縮まないように保護 */
.p-info__kanren-img {
  flex-shrink: 0;
}

/* テキスト領域：省略記号をFlexbox内で有効化する調整 */
.p-info__kanren-text {
  flex-grow: 1;
  min-width: 0;           /* テキストを適切に縮め、はみ出し（...）を有効にします */
}

/* ==========================================
  データが無い時
  ========================================== */
/* data-info-target="message" を持ち、かつ hidden 属性が無い（表示されている）時のみ適用 */
.p-info__message:not([hidden]) {
  display: block;
  padding: 16px;
  font-size: 14px;
  color: var(--text-sub);
  text-align: center;
  max-width: 300px;
  margin: 32px auto;
}

/* ==========================================
  未ログイン時
  ========================================== */
.p-info__login-guide {
  padding: 32px 0;
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 16px;
}

.p-info__login-button {
  max-width: 300px;
  margin: 0 auto;
}

/* ==========================================
  モーダルダイアログ
  ========================================== */
/* モーダル表示時の背面スクロール抑止 */
body.is-modal-open {
	overflow: hidden;
}

/* モーダル本体（標準枠を解除して透過） */
.p-info-modal {
	position: fixed;
	inset: 0;
	margin: auto;
	padding: 0;
	border: none;
	background: transparent;
	width: 90%;
	max-width: 420px;
  color: var(--text-body);
}

.p-info-modal:not([open]) {
	display: none;
}

/* 背景オーバーレイ */
.p-info-modal::backdrop {
	background-color: rgba(0, 0, 0, 0.6);
}

/* コンテンツと下部ボタンを縦並びにするコンテナ */
.p-info-modal__container {
	display: flex;
	flex-direction: column;
	align-items: center;
	max-height: 90vh;
}

/* 背景つき表示要素（白背景・スクロール枠） */
.p-info-modal__window {
	width: 100%;
	background: #fff;
	border-radius: 24px;
	padding: 24px 20px;
	overflow-y: auto;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.p-info-modal__head {
	padding-bottom: 8px;
	margin-bottom: 16px;
}

.p-info-modal__title {
	margin: 0;
  font-size: var(--text-headline);
	font-weight: bold;
  text-align: center;
}

.p-info-modal__body p {
	margin: 0 0 24px;
	line-height: 1.6;
}

.p-info-modal__body p:last-child {
	margin-bottom: 0;
}

/* 枠外下部のボタンエリア */
.p-info-modal__action {
	margin-top: 16px;
	width: 100%;
	display: flex;
	justify-content: center;
}

/* 白文字・白枠の閉じるボタン（ベーススタイル） */
.p-info-modal__close {
  display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px; /* アイコンとテキストの間隔 */
	background: transparent;
	border: 1px solid #fff;
	color: #fff;
	border-radius: 9999px;
	padding: 8px 32px;
	font-size: 0.95rem;
	cursor: pointer;
	line-height: 1.4;
}

.p-info-modal__close-icon {
	width: 14px;
	height: 14px;
	vertical-align: middle;
}

.p-info-modal__close:hover {
	background: rgba(255, 255, 255, 0.1);
}