/* ==========================================================================
   TMI Blog Section
   Card-based grid layout with featured images.
   Font sizes scaled for readability, with 3 responsive breakpoints:
     Desktop: > 999px
     Tablet:  744px – 999px
     Mobile:  < 743px
   ========================================================================== */

/* ── Base / Reset (scoped to #page_blog) ─────────────────────────────── */
#page_blog {
  font-family: "Noto Sans JP", sans-serif;
  font-size: 14px;
  color: #313440;
  line-height: 180%;
}
#page_blog *, #page_blog *::before, #page_blog *::after {
  box-sizing: border-box;
}
#page_blog ul, #page_blog li {
  list-style: none;
  margin: 0;
  padding: 0;
}
#page_blog a {
  color: #2164E6;
  text-decoration: none;
}
#page_blog img {
  border: 0;
  vertical-align: bottom;
  height: auto !important;
  max-width: 100%;
}

/* ── Blog Layout (#page_blog #blog) ──────────────────────────────────── */
#page_blog #blog {
  width: 1080px;
  margin: 0 auto 3rem;
  overflow: hidden;
}
#page_blog #blog.tmi-shortcode {
  width: 100%;
  margin-bottom: 1.5rem;
}

#page_blog .blog-flex {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2.5rem;
}

/* Index area (left/main column) */
#page_blog .blog-index_area {
  flex: 1 1 auto;
  min-width: 0;
}
#page_blog .blog-index_area .ttl_style01 { margin-bottom: 1.5rem; }

/* Category filter dropdown */
#page_blog .blog-category_list_box {
  display: flex;
  align-items: center;
  margin-bottom: 1.5rem;
}
#page_blog .blog-category_list_box .ttl {
  margin-right: 1rem;
  font-size: 13px;
  font-weight: 500;
}
#page_blog .blog-category_list_box select {
  font-size: 12px;
  border: 1px solid #C6CFDE;
  background-color: #fff;
  color: #313440;
  border-radius: 5px;
  padding: 0.3rem 0.5rem;
}

/* ── Blog Card Grid ──────────────────────────────────────────────────── */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.blog-card {
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.blog-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}
.blog-card a {
  display: block;
  color: #313440;
  text-decoration: none;
}

/* Card thumbnail */
.blog-card__thumbnail {
  width: 100%;
  height: 160px;
  overflow: hidden;
}
.blog-card__thumbnail img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  transition: transform 0.3s ease;
}
.blog-card:hover .blog-card__thumbnail img {
  transform: scale(1.05);
}
.blog-card__thumbnail--placeholder {
  background: linear-gradient(135deg, #E3EAF6 0%, #C6CFDE 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}
.blog-card__thumbnail--placeholder span {
  font-size: 18px;
  font-weight: 700;
  color: #8a95a8;
  letter-spacing: 2px;
}

/* Card body */
.blog-card__body {
  padding: 1rem 1.2rem 1.2rem;
}
.blog-card__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}
.blog-card__date {
  font-size: 12px;
  color: #58616E;
  font-weight: 500;
}
.blog-card__categories {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.blog-card__categories li {
  background-color: #eee;
  font-size: 10px;
  font-weight: 700;
  line-height: 100%;
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
}
.blog-card__categories li.tech { background-color: #B2DDFF; }
.blog-card__categories li.lifestyle { background-color: #A4E6BF; }
.blog-card__categories li.company { background-color: #F8F484; }
.blog-card__categories li.tips { background-color: #FFD4B2; }
.blog-card__categories li.info { background-color: #A4E6BF; }
.blog-card__categories li.event { background-color: #F8F484; }

/* Card title */
.blog-card__title {
  font-size: 14px;
  font-weight: 600;
  line-height: 150%;
  margin-bottom: 0.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Card excerpt */
.blog-card__excerpt {
  font-size: 12px;
  color: #58616E;
  line-height: 160%;
  margin-bottom: 0.6rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Card footer */
.blog-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.blog-card__author {
  font-size: 11px;
  color: #8a95a8;
  font-weight: 500;
}

/* ── Pagination ──────────────────────────────────────────────────────── */
.blog-paging {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  margin-top: 1rem;
}
.blog-paging_lists {
  display: flex;
  justify-content: center;
  gap: 0.3rem;
}
.blog-page-link {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #2164E6;
  width: 32px;
  height: 32px;
  text-decoration: none;
  color: #2164E6;
  transition: 0.3s ease;
  font-size: 13px;
  font-weight: 700;
  border-radius: 4px;
}
.blog-page-link:hover {
  background-color: #2164E6;
  color: #fff;
}
.blog-current_page {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #2164E6;
  background-color: #2164E6;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  width: 32px;
  height: 32px;
  border-radius: 4px;
}
.blog-paging_ellipsis {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  font-size: 14px;
  color: #58616E;
  user-select: none;
}

/* ── Table enhancements inside blog content ──────────────────────────── */
#page_blog #blockeditor table {
  width: 100%;
  font-size: 13px;
  margin-bottom: 2.5rem;
  border-collapse: collapse;
}
#page_blog #blockeditor table th {
  border: 1px solid #5395CE;
  background-color: #DBEEFF;
  padding: 0.8rem 1rem;
  line-height: 150%;
  font-weight: 600;
}
#page_blog #blockeditor table td {
  border: 1px solid #5395CE;
  padding: 0.8rem 1rem;
  line-height: 150%;
}
/* Alternating row colors */
#page_blog #blockeditor table tbody tr:nth-child(even) td {
  background-color: #F5F9FF;
}
#page_blog #blockeditor table tbody tr:hover td {
  background-color: #E8F2FF;
}

/* ── Blog Sidebar (right column) ─────────────────────────────────────── */
.blog-sidebar {
  flex: 0 0 220px;
  box-sizing: border-box;
}
.blog-sidebar__section {
  background-color: #F5F7FA;
  border-radius: 8px;
  padding: 1.2rem;
  margin-bottom: 1.5rem;
}
.blog-sidebar__section h3 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 0.8rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #18D064;
}
.blog-sidebar__section ul li {
  margin-bottom: 2px;
}
.blog-sidebar__section ul li a {
  display: block;
  color: #313440;
  font-size: 13px;
  font-weight: 500;
  padding: 0.5rem 0.6rem;
  text-decoration: none;
  background-color: #fff;
  border-radius: 4px;
  transition: 0.2s ease;
}
.blog-sidebar__section ul li a:hover {
  background-color: #E3EAF6;
}

/* Tag cloud */
.blog-tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.blog-tag {
  display: inline-block;
  background-color: #fff;
  border: 1px solid #C6CFDE;
  color: #58616E;
  font-size: 11px;
  font-weight: 500;
  padding: 0.3rem 0.6rem;
  border-radius: 20px;
  text-decoration: none;
  transition: 0.2s ease;
}
.blog-tag:hover {
  background-color: #2164E6;
  border-color: #2164E6;
  color: #fff !important;
}

/* Archive sidebar "Older" toggle */
.blog-archive-older-toggle > a {
  background-color: #E3EAF6 !important;
  font-weight: 600 !important;
}
.blog-archive-older-toggle > a:hover {
  background-color: #d4dded !important;
}
#tmi-blog-older-years { padding: 0; margin: 0; }
#tmi-blog-older-years li { margin-bottom: 2px; }

/* ── Single Blog Post (#single_blog) ─────────────────────────────────── */
#page_blog #single_blog {
  width: 780px;
  margin: 0 auto 5rem;
}

.single_blog__hero {
  margin-bottom: 2rem;
  border-radius: 8px;
  overflow: hidden;
}
.single_blog__hero-img {
  width: 100%;
  height: auto;
  display: block;
}

#page_blog #single_blog .ttl_style01 {
  margin-bottom: 1rem;
  font-size: 24px;
}
.single_blog__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
  padding-bottom: 0;
  border-bottom: none;
}
.single_blog__date {
  font-size: 13px;
  color: #58616E;
}
.single_blog__author {
  font-size: 13px;
  color: #8a95a8;
  font-style: italic;
}

.single_blog__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid #E3EAF6;
}
.single_blog__tags--top {
  margin-bottom: 2rem;
  padding-top: 0;
  border-top: none;
  border-bottom: 1px solid #E3EAF6;
  padding-bottom: 1.5rem;
}

#page_blog #single_blog .btn_style01.back {
  width: 260px;
  margin: 0 auto 4rem;
}
#page_blog #single_blog .btn_style01.back a {
  color: #fff;
}

/* ── Breadcrumbs ─────────────────────────────────────────────────────── */
#page_blog .topicpath-nav { margin: 0.5rem 5% 1.5rem; }
#page_blog .topicpath-nav ul { display: flex; flex-wrap: wrap; }
#page_blog .topicpath-nav ul li { margin: 0.2rem 0.6rem 0.2rem 0; font-size: 12px; }
#page_blog .topicpath-nav ul li a { padding-right: 14px; color: #2164E6; }

/* AJAX pagination wrapper transition */
.tmi-blog-ajax-wrap {
  transition: opacity 0.2s ease;
}

/* Shortcode-specific overrides */
#blog.tmi-shortcode .blog-index_area .ttl_style01 { margin-bottom: 1.2rem; }
#blog.tmi-shortcode .blog-sidebar { display: none; }

/* ==========================================================================
   TABLET (744px – 999px)
   ========================================================================== */
@media screen and (max-width: 999px) {
  #page_blog { font-size: 13px; }

  #page_blog #blog { width: 95%; }

  .blog-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.2rem;
  }

  .blog-card__thumbnail { height: 140px; }
  .blog-card__thumbnail img { height: 140px; }
  .blog-card__title { font-size: 13px; }
  .blog-card__excerpt { font-size: 11px; }
  .blog-card__date { font-size: 11px; }
  .blog-card__categories li { font-size: 9px; }

  .blog-sidebar { flex: 0 0 180px; }
  .blog-sidebar__section h3 { font-size: 13px; }
  .blog-sidebar__section ul li a { font-size: 12px; }

  #page_blog #single_blog { width: 90%; }
  #page_blog #single_blog .ttl_style01 { font-size: 20px; }
}

/* ==========================================================================
   MOBILE (< 743px)
   ========================================================================== */
@media screen and (max-width: 743px) {
  #page_blog { font-size: 12px; }

  #page_blog #blog { margin-bottom: 2rem; }
  #page_blog .blog-flex { display: block; }

  .blog-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .blog-card__thumbnail { height: 180px; }
  .blog-card__thumbnail img { height: 180px; }
  .blog-card__body { padding: 0.8rem 1rem 1rem; }
  .blog-card__title { font-size: 14px; }
  .blog-card__excerpt { font-size: 12px; }

  .blog-paging .blog-page-link,
  .blog-paging .blog-current_page { width: 28px; height: 28px; font-size: 11px; }
  .blog-paging_ellipsis { width: 24px; height: 28px; font-size: 12px; }

  #page_blog .blog-category_list_box { justify-content: center; }

  .blog-sidebar { margin-top: 2rem; }
  .blog-sidebar__section { padding: 1rem; }

  #page_blog #single_blog { width: 92%; margin-bottom: 3rem; }
  #page_blog #single_blog .ttl_style01 { font-size: 18px; margin-bottom: 0.8rem; }
  .single_blog__meta { margin-bottom: 1.5rem; padding-bottom: 1rem; }
  #page_blog #single_blog .btn_style01.back { width: 220px; margin-bottom: 3rem; }

  #page_blog .topicpath-nav ul li { font-size: 10px; }
}


/* ==========================================================================
   SINGLE POST: TOC + Content Layout
   ========================================================================== */

/* Two-column layout: TOC (left) + Content (right) */
.single_blog__layout {
  display: flex;
  align-items: flex-start;
  gap: 2.5rem;
  margin-bottom: 3rem;
}

/* Content area takes remaining space */
.single_blog__content {
  flex: 1 1 auto;
  min-width: 0;
}

/* ── Sticky TOC Sidebar ──────────────────────────────────────────────── */
.blog-toc {
  flex: 0 0 250px;
  position: sticky;
  top: 100px;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
}
.blog-toc__inner {
  background-color: #F5F7FA;
  border-radius: 8px;
  padding: 1.2rem 1rem 1.2rem 0.3rem;
  border-left: 3px solid #18D064;
}
.blog-toc__title {
  font-size: 14px;
  font-weight: 700;
  color: #313440;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #E3EAF6;
}
.blog-toc__list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.blog-toc__item {
  margin-bottom: 0.5rem;
}
.blog-toc__sublist {
  list-style: none;
  margin: 0.4rem 0 0.4rem 0;
  padding-left: 1rem !important;
  border-left: none;
  margin-left: 0;
}
.blog-toc__sublist .blog-toc__sublist {
  padding-left: 1rem !important;
}

.blog-toc__link {
  display: block;
  font-size: 12px;
  line-height: 160%;
  color: #58616E;
  text-decoration: none;
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
  transition: all 0.2s ease;
  border-left: 2px solid transparent;
}
.blog-toc__link:hover {
  color: #2164E6;
  background-color: #E3EAF6;
}
.blog-toc__link--active {
  color: #2164E6;
  font-weight: 600;
  background-color: #fff;
  border-left-color: #2164E6;
}
/* Top-level items (direct children of root list) are bolder */
.blog-toc__list > .blog-toc__item > .blog-toc__link {
  font-weight: 600;
  color: #313440;
  font-size: 12.5px;
  padding: 0.4rem 0.3rem;
}
/* Sub-items get progressively smaller/lighter */
.blog-toc__sublist .blog-toc__link {
  font-size: 11.5px;
  padding: 0.35rem 0.3rem;
}
.blog-toc__sublist .blog-toc__sublist .blog-toc__link {
  font-size: 11px;
  color: #6b7688;
  padding: 0.3rem 0.3rem;
}

/* TOC scrollbar styling */
.blog-toc::-webkit-scrollbar {
  width: 4px;
}
.blog-toc::-webkit-scrollbar-track {
  background: transparent;
}
.blog-toc::-webkit-scrollbar-thumb {
  background-color: #C6CFDE;
  border-radius: 4px;
}

/* ── Single blog width override (wider for TOC layout) ───────────────── */
#page_blog #single_blog {
  width: 1080px;
  margin: 0 auto 5rem;
}

/* ── Tablet: TOC moves above content ─────────────────────────────────── */
@media screen and (max-width: 999px) {
  .single_blog__layout {
    display: block;
  }
  .blog-toc {
    position: relative;
    top: 0;
    max-height: none;
    flex: none;
    margin-bottom: 2rem;
  }
  #page_blog #single_blog {
    width: 90%;
  }
}

/* ── Mobile: compact TOC ─────────────────────────────────────────────── */
@media screen and (max-width: 743px) {
  .blog-toc__inner {
    padding: 1rem;
  }
  .blog-toc__link {
    font-size: 11px;
    padding: 0.25rem 0.4rem;
  }
  .blog-toc__title {
    font-size: 12px;
  }
  #page_blog #single_blog {
    width: 92%;
  }
}
