/* 参考書メインページ */

.main-content-area {
  justify-content: center;
  align-items: flex-start;
  background: url('../main_background_mobile.png') center/cover fixed;
}

.reference-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  width: 100%;
  padding: 1.5rem clamp(1rem, 4vw, 2.5rem);
  box-sizing: border-box;
  margin: 0 auto;
}

.reference-main {
  width: 100%;
  display: flex;
  justify-content: center;
}

.page-side-ad {
  display: none;
  width: clamp(160px, 15vw, 220px);
  flex: 0 1 clamp(160px, 15vw, 220px);
}

.page-side-ad ins.adsbygoogle {
  display: block;
  width: 100%;
}

.reference-container {
  display: flex;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 1rem 1.25rem;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  overflow-x: auto;
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  width: 100%;
  margin: 0 auto;
  min-width: 0;
}

.image-placeholder {
  width: 100%;
  height: 200px;
  background: linear-gradient(135deg, #d9eafd, #ffffff);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
  border-radius: 8px;
}

.reference-home-img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  display: block;
}

.section-title {
  font-size: 2rem;
  margin: 0 0 1rem;
}

.book-section {
  margin-bottom: 2rem;
  background: #fff;
  border-radius: 8px;
  padding: 1rem 1.5rem;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

@media (min-width: 1200px) {
  .reference-layout {
    flex-direction: row;
    align-items: flex-start;
    justify-content: center;
    gap: clamp(1.5rem, 2vw, 2.5rem);
    padding: 2rem clamp(1.5rem, 4vw, 3rem);
    max-width: min(1180px, 100%);
    width: 105%;
  }

  .page-side-ad {
    display: flex;
    justify-content: center;
    position: sticky;
    top: 110px;
  }

  .page-side-ad--left {
    justify-content: flex-end;
  }

  .page-side-ad--right {
    justify-content: flex-start;
  }

  .reference-main {
    width: auto;
  }

  .reference-container {
    max-width: clamp(620px, 60vw, 1220px);
    padding: clamp(1.25rem, 1.8vw, 1.75rem) clamp(1.5rem, 2.6vw, 2.25rem);
  }
}

.book-section h3 {
  margin-top: 0;
  margin-bottom: 1rem;
  border-bottom: 1px solid #eee;
  padding-bottom: 0.5rem;
}

.book-section ul {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.book-section li {
  margin-bottom: 0.75rem;
}

.book-section a {
  color: #0077cc;
  text-decoration: none;
  font-weight: 500;
}

.book-section a:hover {
  color: #005999;
  text-decoration: underline;
}

.latest-reference-section {
  margin-top: 3rem;
  background: #fff;
  border-radius: 8px;
  padding: 2rem 1.75rem;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.latest-reference-title {
  margin: 0 0 2rem;
  font-size: 1.6rem;
  font-weight: 700;
  padding-left: 1rem;
  position: relative;
}

.latest-reference-title::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 6px;
  border-radius: 3px;
  background: linear-gradient(180deg, #ffbb00, #ff7b00);
}

.latest-reference-groups {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.latest-reference-group {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.latest-reference-subheading {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  background: linear-gradient(90deg, #f7f7f7, #ffffff);
  border: 1px solid #e5e5e5;
  color: #333;
}

.latest-reference-list {
  --card-gap: 1.1rem;
  display: flex;
  gap: var(--card-gap);
  overflow-x: auto;
  padding: 0 0.5rem 0.75rem;
  margin: 0;
  scroll-snap-type: x proximity;
}

.latest-reference-list::-webkit-scrollbar {
  height: 8px;
}

.latest-reference-list::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 999px;
}

.latest-reference-list::-webkit-scrollbar-thumb {
  background: #c7c7c7;
  border-radius: 999px;
}

.reference-article-card {
  flex: 0 0 clamp(110px, calc((100% - 5 * var(--card-gap)) / 6), 150px);
  max-width: clamp(110px, calc((100% - 5 * var(--card-gap)) / 6), 150px);
  min-width: 110px;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  scroll-snap-align: start;
}

.reference-article-card:hover .reference-article-thumbnail {
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
  transform: translateY(-4px);
}

.reference-article-thumbnail {
  width: 100%;
  aspect-ratio: 2.6 / 4;
  background: #fff;
  border-radius: 6px;
  border: 1px solid #e5e5e5;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.reference-article-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
}

.reference-article-title {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.5;
  color: #333;
  text-align: center;
}

.reference-article-empty {
  margin: 0;
  color: #999;
  font-size: 0.95rem;
}

.ad-placeholder {
  width: 350px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 1rem;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.site-footer {
  text-align: center;
}

@media (max-width: 768px) {
  .latest-reference-section {
    padding: 1.5rem 1.25rem;
  }

  .latest-reference-title {
    font-size: 1.4rem;
    margin-bottom: 1.5rem;
  }

  .latest-reference-subheading {
    font-size: 1rem;
  }

  .latest-reference-list {
    --card-gap: 0.85rem;
    padding: 0 0.25rem 0.65rem;
    margin: 0;
  }

  .reference-article-card {
    flex: 0 0 calc((100% - 3 * var(--card-gap)) / 4);
    max-width: calc((100% - 3 * var(--card-gap)) / 4);
    min-width: 95px;
  }
}

@media (max-width: 480px) {
  .latest-reference-list {
    --card-gap: 0.75rem;
  }

  .reference-article-card {
    min-width: 90px;
  }
}

@media (min-width: 768px) {
  .main-content-area {
    background: url('../main_background.png') center/cover fixed;
  }

  .reference-container {
    width: 60vw;
    margin: 0 auto;
  }

  .latest-reference-list {
    --card-gap: 1.5rem;
  }
}