/* ========================================================
   cooma books - Main Stylesheet
   Theme: Day ("ぬくもりの絵本部屋") & Night ("夜空とお月さま")
   ======================================================== */

:root {
  /* 共通のフォント・トランジション */
  --font-base: "M PLUS 1p", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Hiragino Maru Gothic ProN", Meiryo, sans-serif;
  --transition-theme: background-color 0.4s ease, color 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
}

/* ========================================================
   ☀️ 昼モード（ぬくもりの絵本部屋）
   ======================================================== */
[data-theme="day"] {
  --bg-page: #FAF5EE;
  --bg-gradient: radial-gradient(circle at 50% 10%, #FFF9F0 0%, #FAF4ED 60%, #F3ECE1 100%);
  --bg-header: rgba(255, 255, 255, 0.85);
  --bg-card: #FFFFFF;
  --bg-card-subtle: #FBF8F3;
  --bg-badge: #FFFFFF;
  --bg-footer: #EDE4D8;

  --text-main: #3F332B;
  --text-muted: #7A6C62;
  --text-heading: #2D221A;
  --text-footer: #5A4E46;

  --accent: #2E97D4;
  --accent-hover: #1E7EBA;
  --accent-warm: #E26A4A;
  --border-color: rgba(63, 51, 43, 0.08);

  --btn-amazon-bg: #E47936;
  --btn-amazon-hover: #CC6524;
  --btn-amazon-text: #FFFFFF;
  --btn-amazon-shadow: 0 4px 14px rgba(228, 121, 54, 0.35);

  --btn-sub-bg: #F4ECE1;
  --btn-sub-text: #5A483C;
  --btn-sub-hover: #E7DCce;

  --shadow-card: 0 10px 25px -5px rgba(80, 60, 45, 0.08), 0 4px 10px rgba(80, 60, 45, 0.04);
  --shadow-card-hover: 0 16px 32px -5px rgba(80, 60, 45, 0.14), 0 6px 14px rgba(80, 60, 45, 0.06);
  --shadow-book: 0 8px 20px rgba(70, 50, 40, 0.15);
  --logo-shadow: 0 4px 12px rgba(46, 151, 212, 0.2);

  --toggle-bg: #EAE1D3;
  --tab-active-bg: #FFFFFF;
  --tab-active-text: #2D221A;
  --tab-active-shadow: 0 2px 8px rgba(70, 50, 40, 0.12);
  --tab-inactive-text: #7A6C62;
  --tab-inactive-hover: #3F332B;

  --link-color: #2E97D4;
  --link-hover: #E26A4A;
}

/* ========================================================
   🌙 夜モード（夜空とお月さま）
   ======================================================== */
[data-theme="night"] {
  --bg-page: #0C1523;
  --bg-gradient: radial-gradient(circle at 50% 15%, #18263D 0%, #0E1828 50%, #070D16 100%);
  --bg-header: rgba(14, 23, 38, 0.85);
  --bg-card: #162235;
  --bg-card-subtle: #1C2B42;
  --bg-badge: #FFFFFF;
  --bg-footer: #080D16;

  --text-main: #E3E9F3;
  --text-muted: #9DAEC3;
  --text-heading: #FFFFFF;
  --text-footer: #8797AC;

  --accent: #58C5D4;
  --accent-hover: #3BAAB9;
  --accent-warm: #EFC060;
  --border-color: rgba(239, 192, 96, 0.18);

  --btn-amazon-bg: #E8A838;
  --btn-amazon-hover: #D19125;
  --btn-amazon-text: #1A1305;
  --btn-amazon-shadow: 0 4px 16px rgba(232, 168, 56, 0.4);

  --btn-sub-bg: #223249;
  --btn-sub-text: #D5E0EE;
  --btn-sub-hover: #2C3E59;

  --shadow-card: 0 12px 28px -5px rgba(0, 0, 0, 0.5), 0 0 15px rgba(88, 197, 212, 0.08);
  --shadow-card-hover: 0 18px 36px -5px rgba(0, 0, 0, 0.6), 0 0 24px rgba(239, 192, 96, 0.2);
  --shadow-book: 0 8px 24px rgba(0, 0, 0, 0.6);
  --logo-shadow: 0 0 16px rgba(88, 197, 212, 0.45);

  --toggle-bg: #141F32;
  --tab-active-bg: #23354F;
  --tab-active-text: #F3CA68;
  --tab-active-shadow: 0 2px 10px rgba(0, 0, 0, 0.4), 0 0 10px rgba(243, 202, 104, 0.25);
  --tab-inactive-text: #8FA1B7;
  --tab-inactive-hover: #E3E9F3;

  --link-color: #58C5D4;
  --link-hover: #EFC060;
}

/* ========================================================
   ベースリセット & タイポグラフィ
   ======================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-page);
  background-image: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-main);
  font-family: var(--font-base);
  line-height: 1.75;
  transition: var(--transition-theme);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--link-color);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--link-hover);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ========================================================
   ヘッダー & ナビゲーション
   ======================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-header);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  transition: var(--transition-theme);
}

.header-container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-decoration: none;
}

/* 恐竜ロゴを昼夜問わず引き立てるバッジ */
.logo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  background: var(--bg-badge);
  border-radius: 50%;
  box-shadow: var(--logo-shadow);
  padding: 4px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  flex-shrink: 0;
}

.brand-link:hover .logo-badge {
  transform: rotate(-6deg) scale(1.06);
}

.logo-badge img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-info {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-heading);
  line-height: 1.2;
}

.brand-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

/* ========================================================
   昼夜モード切替（セグメント・ピル型スイッチ）
   ======================================================== */
.theme-segment {
  display: inline-flex;
  align-items: center;
  background: var(--toggle-bg);
  border: 1px solid var(--border-color);
  border-radius: 30px;
  padding: 3px;
  gap: 3px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.08);
  transition: var(--transition-theme);
  user-select: none;
}

.theme-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: transparent;
  color: var(--tab-inactive-text);
  border: none;
  border-radius: 24px;
  padding: 0.4rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: var(--font-base);
  cursor: pointer;
  transition: background-color 0.25s ease, color 0.25s ease, box-shadow 0.25s ease, transform 0.15s ease;
  line-height: 1.2;
}

.theme-tab:hover {
  color: var(--tab-inactive-hover);
}

.theme-tab.active {
  background: var(--tab-active-bg);
  color: var(--tab-active-text);
  box-shadow: var(--tab-active-shadow);
  transform: scale(1.02);
  cursor: default;
}

.theme-tab:active:not(.active) {
  transform: scale(0.96);
}

.tab-icon {
  font-size: 1rem;
  line-height: 1;
  display: inline-block;
  transition: transform 0.3s ease;
}

.theme-tab:hover .tab-icon {
  transform: rotate(15deg);
}

/* ========================================================
   ヒーローセクション（ストーリー性のある導入）
   ======================================================== */
.hero-section {
  text-align: center;
  padding: 3rem 1.25rem 2rem;
  max-width: 800px;
  margin: 0 auto;
}

.hero-tagline {
  display: inline-block;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 0.3rem 1rem;
  border-radius: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--accent);
  margin-bottom: 1rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.hero-title {
  font-size: 2.1rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text-heading);
  margin-bottom: 0.75rem;
}

.hero-description {
  font-size: 1rem;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.8;
}

/* ========================================================
   メインコンテンツレイアウト
   ======================================================== */
.main-content {
  flex: 1;
  max-width: 1080px;
  width: 100%;
  margin: 0 auto;
  padding: 0 1.25rem 4rem;
  display: flex;
  flex-direction: column;
  gap: 3.5rem;
}

.section-heading {
  text-align: center;
  margin-bottom: 2rem;
}

.section-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-heading);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  position: relative;
  padding-bottom: 0.5rem;
}

.section-title::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 48px;
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
}

.section-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
}

/* ========================================================
   絵本カードグリッド（全面刷新）
   ======================================================== */
.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 2rem;
  justify-content: center;
  max-width: 960px;
  margin: 0 auto;
  width: 100%;
}

.book-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  transition: var(--transition-theme), transform 0.3s ease;
  position: relative;
  overflow: hidden;
}

.book-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-card-hover);
}

/* 言語バッジ */
.book-badge {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  background: var(--bg-card-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  z-index: 2;
}

/* 表紙画像エリア（object-containで絶対に切れない・潰れない） */
.book-cover-wrapper {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1.05;
  background: var(--bg-card-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1.25rem;
  overflow: hidden;
  position: relative;
  transition: transform 0.3s ease;
}

.book-card:hover .book-cover-wrapper {
  transform: scale(1.02);
}

.book-cover-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-book);
  transition: transform 0.3s ease;
}

/* 書誌情報 */
.book-info {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.book-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-heading);
  line-height: 1.4;
  margin-bottom: 0.75rem;
}

.book-desc {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.75;
  margin-bottom: 1.5rem;
  flex: 1;
}

/* ボタン群 */
.book-actions {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: auto;
}

.btn-amazon-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--btn-amazon-bg);
  color: var(--btn-amazon-text) !important;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.9rem 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: var(--btn-amazon-shadow);
  transition: background-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
  text-align: center;
  line-height: 1.3;
}

.btn-amazon-primary:hover {
  background: var(--btn-amazon-hover);
  transform: translateY(-2px);
}

.btn-amazon-primary:active {
  transform: translateY(0);
}

.btn-amazon-sub {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--btn-sub-bg);
  color: var(--btn-sub-text) !important;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.65rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  transition: background-color 0.2s ease, transform 0.15s ease;
  text-align: center;
}

.btn-amazon-sub:hover {
  background: var(--btn-sub-hover);
  transform: translateY(-1px);
}

/* ========================================================
   ごあいさつ（About）セクション
   ======================================================== */
.about-card {
  max-width: 820px;
  margin: 0 auto;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 2.25rem 2rem;
  transition: var(--transition-theme);
}

.about-body {
  font-size: 1rem;
  line-height: 2;
  color: var(--text-main);
}

.about-body p {
  margin-bottom: 1.25rem;
}

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

.about-highlight {
  font-weight: 700;
  color: var(--accent);
}

/* ========================================================
   クリエイター関連リンク（crazy.blue, X, note）
   ======================================================== */
.portal-links-card {
  max-width: 820px;
  margin: 0 auto;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 2rem;
  text-align: center;
  transition: var(--transition-theme);
}

.portal-links-intro {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.portal-links-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  justify-content: center;
}

.link-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-card-subtle);
  color: var(--text-main) !important;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.7rem 1.2rem;
  border-radius: 30px;
  border: 1px solid var(--border-color);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  transition: background-color 0.2s ease, transform 0.15s ease, border-color 0.2s ease;
}

.link-button:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  background: var(--bg-card);
}

.link-button .icon {
  font-size: 1.15rem;
}

/* ========================================================
   フッター
   ======================================================== */
.site-footer {
  background: var(--bg-footer);
  border-top: 1px solid var(--border-color);
  color: var(--text-footer);
  padding: 2.5rem 1.25rem 2rem;
  transition: var(--transition-theme);
  margin-top: auto;
}

.footer-container {
  max-width: 820px;
  margin: 0 auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.footer-logo-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
}

.footer-logo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: var(--bg-badge);
  border-radius: 50%;
  padding: 3px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.footer-logo-badge img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.footer-brand-name {
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text-heading);
}

/* Amazonアソシエイト必須表記 */
.amazon-disclosure {
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--text-muted);
  background: var(--bg-card);
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  max-width: 680px;
  margin: 0 auto;
}

.footer-contact {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.footer-copyright {
  font-size: 0.82rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-color);
  padding-top: 1.25rem;
  margin-top: 0.5rem;
}

/* ========================================================
   レスポンシブ調整
   ======================================================== */
@media (max-width: 640px) {
  .header-container {
    padding: 0.75rem 1rem;
  }
  
  .brand-title {
    font-size: 1.25rem;
  }

  .brand-subtitle {
    display: none;
  }

  .theme-tab {
    padding: 0.35rem 0.65rem;
    font-size: 0.78rem;
  }

  .logo-badge {
    width: 44px;
    height: 44px;
  }

  .hero-title {
    font-size: 1.6rem;
  }

  .hero-section {
    padding: 2rem 1rem 1.5rem;
  }

  .main-content {
    gap: 2.5rem;
    padding: 0 1rem 3rem;
  }

  .books-grid {
    grid-template-columns: 1fr;
  }

  .book-card {
    padding: 1.25rem;
  }

  .about-card,
  .portal-links-card {
    padding: 1.5rem 1.25rem;
  }

  .portal-links-grid {
    flex-direction: column;
  }

  .link-button {
    width: 100%;
    justify-content: center;
  }
}
