/* =========================================================
   Post scope base + reset (scoped)
   - Only affects inside .p-post-scope
   - Pure CSS (no SCSS)
   - Safe for existing pages (no html/body/global override)
========================================================= */

/* --- Base ------------------------------------------------ */

.p-post-scope {
  line-height: 1.7;
}

/* box-sizing */
.p-post-scope :where(*, *::before, *::after) {
  box-sizing: border-box;
}

/* media elements */
.p-post-scope :where(img, svg, video, canvas) {
  max-width: 100%;
  height: auto;
  vertical-align: middle;
}

/* links */
.p-post-scope :where(a) {
  color: inherit;
  text-decoration: none;
}

/* lists */
.p-post-scope :where(ul, ol) {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* text blocks */
.p-post-scope :where(p, figure) {
  margin: 0;
}

/* --- Reset ------------------------------------------------ */

/* Remove default margin */
.p-post-scope :where(h1, h2, h3, h4, h5, p, ul, ol, figure, blockquote, dl, dd) {
  margin: 0;
}

/* Make images easier to work with */
.p-post-scope img {
  max-width: 100%;
  width: auto;
  height: auto;
  display: block;
}

.p-post-scope .entry-content .atj-slide-gallery {
  --atj-slide-gap: 10px;
  --atj-slide-image-height: 190px;
  --atj-slide-image-height-mobile: 220px;
  position: relative;
  width: 100% !important;
  max-width: 100% !important;
  margin: 24px 0 !important;
  overflow: visible;
}

.p-post-scope .entry-content .atj-slide-gallery__viewport {
  width: 100% !important;
  max-width: 100% !important;
  overflow: hidden;
}

.p-post-scope .entry-content .atj-slide-gallery__track {
  display: flex !important;
  align-items: center;
  gap: var(--atj-slide-gap);
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  list-style: none !important;
  transform: translate3d(0, 0, 0);
  transition: transform 0.35s ease;
}

.p-post-scope .entry-content .atj-slide-gallery__item {
  flex: 0 0 var(--atj-slide-item-basis, calc((100% - (var(--atj-slide-gap) * 2)) / 3)) !important;
  min-width: 0;
  margin: 0 !important;
  padding: 0 !important;
  list-style: none !important;
}

.p-post-scope .entry-content .atj-slide-gallery__figure {
  margin: 0 !important;
}

.p-post-scope .entry-content .atj-slide-gallery__item img {
  display: block !important;
  width: 100% !important;
  max-width: none !important;
  height: var(--atj-slide-image-height) !important;
  object-fit: contain;
  border-radius: 5px;
  background: #f5f5f5;
}

.p-post-scope .entry-content .atj-slide-gallery__caption {
  margin-top: 8px;
  color: #666;
  font-size: 13px;
  line-height: 1.6;
  text-align: center;
}

.p-post-scope .entry-content .atj-slide-gallery__button {
  position: absolute;
  z-index: 2;
  top: calc(50% - 14px);
  width: 28px;
  height: 28px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #ccc;
  cursor: pointer;
}

.p-post-scope .entry-content .atj-slide-gallery__button::before {
  content: "";
  position: absolute;
  top: 8px;
  width: 12px;
  height: 12px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
}

.p-post-scope .entry-content .atj-slide-gallery__button--prev {
  left: -30px;
}

.p-post-scope .entry-content .atj-slide-gallery__button--prev::before {
  left: 10px;
  transform: rotate(-135deg);
}

.p-post-scope .entry-content .atj-slide-gallery__button--next {
  right: -30px;
}

.p-post-scope .entry-content .atj-slide-gallery__button--next::before {
  right: 10px;
  transform: rotate(45deg);
}

.p-post-scope .entry-content .atj-slide-gallery__button:disabled {
  opacity: 0.28;
  cursor: default;
}

.p-post-scope .entry-content .atj-slide-gallery__dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
}

.p-post-scope .entry-content .atj-slide-gallery__dot {
  width: 5px;
  height: 5px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: #d0d0d0;
  cursor: pointer;
}

.p-post-scope .entry-content .atj-slide-gallery__dot.is-active {
  background: #707070;
}

@media (max-width: 1024px) {
  .p-post-scope .entry-content .atj-slide-gallery__button--prev {
    left: 8px;
  }

  .p-post-scope .entry-content .atj-slide-gallery__button--next {
    right: 8px;
  }
}

@media (max-width: 767px) {
  .p-post-scope .entry-content .atj-slide-gallery__item {
    flex-basis: 100% !important;
  }

  .p-post-scope .entry-content .atj-slide-gallery__item img {
    height: var(--atj-slide-image-height-mobile) !important;
  }
}

/* Natural flow and rhythm in articles by default */
.p-post-scope article>*+* {
  /* margin-top: 1em; */
}

/* Inherit fonts for inputs and buttons */
.p-post-scope :where(input, button, textarea, select) {
  font: inherit;
}

/* picture */
.p-post-scope picture {
  display: block;
  width: 100%;
  height: 100%;
}

/* dialog reset */
.p-post-scope dialog {
  width: unset;
  max-width: unset;
  height: unset;
  max-height: unset;
  padding: unset;
  color: unset;
  background-color: unset;
  border: unset;
  overflow: unset;
}

.p-post-scope dialog:focus-visible {
  outline: none;
}

/* Form reset */
.p-post-scope :where(input, button, select, textarea) {
  margin: 0;
  padding: 0;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  border: none;
  border-radius: 0;
  font: inherit;
  outline: none;
}

.p-post-scope textarea {
  resize: vertical;
}

.p-post-scope input[type="checkbox"],
.p-post-scope input[type="radio"] {
  display: none;
}

.p-post-scope :where(input[type="submit"], input[type="button"], label, button, select) {
  cursor: pointer;
}

.p-post-scope select::-ms-expand {
  display: none;
}

/* link (scoped) */
.p-post-scope a {
  color: var(--text-black);
  cursor: pointer;
  transition: opacity 0.3s;
}

.p-post-scope a[href^="tel:"] {
  pointer-events: none;
}

.p-post-scope .entry-content h1 {
  font-size: 28px;
  font-weight: var(--fw-bold);
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.p-post-scope .entry-content p {
  overflow-wrap: anywhere;
}

/* Keep the caption wrapper at the image width so alignment moves both together. */
.p-post-scope .entry-content .wp-caption {
  max-width: 100% !important;
}

.p-post-scope .entry-content figure.wp-block-image:is(.aligncenter, .alignleft, .alignright),
.p-post-scope .entry-content .wp-block-image > figure:is(.aligncenter, .alignleft, .alignright) {
  width: fit-content;
  max-width: 100%;
}

.p-post-scope .entry-content :is(.wp-caption, figure.wp-block-image, .wp-block-image > figure).aligncenter {
  float: none;
  clear: both;
  margin-inline: auto;
}

.p-post-scope .entry-content :is(.wp-caption, figure.wp-block-image, .wp-block-image > figure).alignleft {
  float: left;
  margin-inline: 0 1rem;
}

.p-post-scope .entry-content :is(.wp-caption, figure.wp-block-image, .wp-block-image > figure).alignright {
  float: right;
  margin-inline: 1rem 0;
}

.p-post-scope .entry-content :is(.wp-caption, figure.wp-block-image, .wp-block-image > figure).aligncenter > :is(.wp-caption-text, figcaption) {
  text-align: center;
}

.p-post-scope .entry-content .wp-caption img {
  max-width: 100%;
  width: auto;
}

.p-post-scope .entry-content img[style*="--atj-content-image-max-width"] {
  width: auto !important;
  max-width: min(100%, var(--atj-content-image-max-width)) !important;
  height: auto !important;
}

.p-post-scope .p-post-single__layout > *,
.p-post-scope .entry-content {
  min-width: 0;
}

.p-post-scope .entry-content .wp-block-table,
.p-post-scope .entry-content > table {
  display: block;
  width: 100%;
  max-width: 100% !important;
  overflow-x: auto;
}

.p-post-scope .entry-content .wp-block-table table {
  width: 100%;
  max-width: 100% !important;
  table-layout: fixed;
}

.p-post-scope .entry-content > table {
  table-layout: fixed;
  border-collapse: collapse;
}

.p-post-scope .entry-content table th,
.p-post-scope .entry-content table td {
  width: auto;
  max-width: none;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.p-post-scope .entry-content table col,
.p-post-scope .entry-content table colgroup {
  width: auto !important;
  max-width: none !important;
}

.p-post-scope .entry-content table.atj-editable-table,
.p-post-scope .entry-content .wp-block-table table.atj-editable-table,
.p-event-article-single .entry-content table.atj-editable-table,
.p-event-article-single .entry-content .wp-block-table table.atj-editable-table {
  width: var(--atj-table-width, 100%) !important;
  max-width: 100% !important;
  table-layout: fixed;
}

.p-post-scope .entry-content table.atj-editable-table th,
.p-post-scope .entry-content table.atj-editable-table td,
.p-event-article-single .entry-content table.atj-editable-table th,
.p-event-article-single .entry-content table.atj-editable-table td {
  overflow-wrap: anywhere;
  word-break: break-word;
}

@media (max-width: 767px) {
  .p-post-scope .entry-content h1 {
    font-size: 22px;
  }

  .p-post-scope .entry-content .wp-block-table {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  .p-post-scope .entry-content .wp-block-table table,
  .p-post-scope .entry-content > table {
    min-width: 640px;
    max-width: none !important;
    table-layout: auto;
  }

  .p-post-scope .entry-content > table {
    width: 100% !important;
    min-width: 0;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  .p-post-scope .entry-content > table > thead,
  .p-post-scope .entry-content > table > tbody,
  .p-post-scope .entry-content > table > tfoot {
    display: table;
    width: max-content;
    min-width: 640px;
  }
}


/* Elementor kit hover を投稿スコープ内だけ無効化（または上書き） */
.p-post-scope a:hover,
.p-post-scope a:focus-visible {
  color: inherit;
  text-decoration: none;
  opacity: 0.7;
  /* 必要なら（嫌なら消してOK） */
}

@media (max-width: 767px) {
  .p-post-scope a[href^="tel:"] {
    pointer-events: auto;
  }
}
