#editor {
  margin-bottom: 0;
  font-size: 16px;
  letter-spacing: 0.05em;
  line-height: calc(24 / 16);
  position: relative;
  color: #000;
}

#editor #editor {
  overflow: hidden;
}

#editor * span {
  font-size: 1em;
}

/* main.css 的 reset 會把 b/strong 的粗體歸零，這裡補回；顏色不鎖，編輯器色板才有效 */
#editor b,
#editor strong {
  font-size: 1em !important;
  font-weight: bold;
}

#editor h2 {
  letter-spacing: 0.05em;
  margin-top: 64px;
  margin-bottom: 0;
  color: #000;
  font-size: 40px;
  line-height: calc(56 / 40);
}

#editor h2:first-child {
  margin-top: 0;
}

#editor h3 {
  letter-spacing: 0.05em;
  font-size: 32px;
  color: #000;
  line-height: calc(48 / 32);
  margin-top: 32px;
  margin-bottom: 0;
}

#editor h3:first-child {
  margin-top: 0;
}

#editor h4 {
  font-size: 28px;
  letter-spacing: 0.05em;
  color: #000;
  line-height: calc(40 / 28);
  margin-top: 32px;
  margin-bottom: 0;
}

#editor h4:first-child {
  margin-top: 0;
}

#editor h5 {
  font-size: 24px;
  letter-spacing: 0.05em;
  color: #000;
  line-height: calc(36 / 24);
  margin-top: 32px;
  margin-bottom: 0;
}

#editor h5:first-child {
  margin-top: 0;
}

#editor h6 {
  font-size: 20px;
  letter-spacing: 0.05em;
  color: #000;
  line-height: calc(32 / 20);
  margin-top: 32px;
  margin-bottom: 0;
}

#editor h6:first-child {
  margin-top: 0;
}

#editor p,
#editor table tr td,
#editor ol li,
#editor ul li,
#editor blockquote {
  margin-bottom: 0;
  font-size: 16px;
  letter-spacing: 0.05em;
  line-height: calc(24 / 16);
  position: relative;
  margin-top: 32px;
  color: #000;
}

#editor p:first-child {
  margin-top: 0;
}

#editor p img {
  display: block;
  width: 100%;
  margin: 0 auto;
}

#editor span {
  color: #000;
  margin-bottom: 0;
  position: relative;
}

#editor span:first-child {
  margin-top: 0;
}

#editor span img {
  display: block;
  width: 100%;
  margin: 0 auto;
}

#editor s,
#editor strike {
  text-decoration: line-through;
}

#editor i,
#editor em {
  font-style: italic;
}

#editor a {
  display: inline;
  margin-bottom: 0;
  font-size: 1em;
  letter-spacing: 0.05em;
  line-height: 2;
  text-decoration: underline;
  text-decoration-color: #000;
  text-underline-offset: 3px;
  color: #000;
  transition: 0.3s;
}

@media (hover: hover) {
  #editor a:hover {
    color: var(--color-link-hover);
  }
}

#editor img {
  display: block;
  width: 100%;
  margin: 0 auto;
}

#editor ol,
#editor ul {
  margin: 0;
  padding: 0;
  margin-top: 32px;
  margin-left: 20px;
}

#editor ol:first-child,
#editor ul:first-child {
  margin-top: 0;
}

#editor ol li,
#editor ul li {
  list-style-position: initial;
  padding: 0;
  margin-top: 0 !important;
}

#editor ul {
  list-style: disc;
}

#editor ol {
  list-style: decimal;
}

#editor pre {
  display: block;
  color: #000;
  font-size: 14px;
  line-height: 2;
  letter-spacing: 0.05em;
  white-space: normal;
  margin: 0;
  margin-top: 5px;
  margin-bottom: 10px;
  padding: 0;
}

#editor pre:first-child {
  margin-top: 0;
}

#editor pre a {
  cursor: pointer;
}

#editor hr {
  margin: 64px auto;
}

#editor blockquote {
  margin: 0;
  border: solid 1px #ddd;
  border-radius: 0;
  padding: 25px 40px;
  margin-top: 64px;
  color: #000;
  text-align: justify;
  background-color: rgba(var(--color-primary-rgb), 0.05);
}

#editor blockquote h1,
#editor blockquote h2,
#editor blockquote h3,
#editor blockquote h4,
#editor blockquote h5,
#editor blockquote p,
#editor blockquote ul,
#editor blockquote ol {
  margin-top: 0px;
}

#editor blockquote:first-child {
  margin-top: 0;
}

#editor blockquote .title_wrap {
  margin-bottom: 10px;
}

#editor table {
  width: 100%;
  margin-top: 32px;
  table-layout: fixed;
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

#editor table:first-child {
  margin-top: 0;
}

#editor table tr td {
  padding: 15px 10px;
  border: solid 1px #707070;
  vertical-align: middle;
}

#editor table img {
  max-width: 300px;
  margin: 0 auto;
}

@media (max-width: 768px) {
  #editor h2 {
    font-size: 35px;
  }

  #editor h3 {
    font-size: 30px;
  }

  #editor h4 {
    font-size: 26px;
  }

  #editor h5 {
    font-size: 23px;
  }

  #editor h6 {
    font-size: 20px;
  }

  #editor p img {
    width: 100% !important;
    height: auto !important;
  }

  #editor blockquote {
    padding: 20px 30px;
  }

  #editor table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    border: none;
    width: max-content;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
  }

  #editor table img {
    min-width: 200px;
    max-width: 100%;
  }
}

/* 圖說 */
#editor figure {
  position: relative;
  margin-top: 32px;
}

#editor figure::after {
  content: "";
  display: block;
  clear: both;
}

#editor figcaption {
  margin-bottom: 0;
  font-size: 14px;
  letter-spacing: 0.05em;
  line-height: calc(20 / 14);
  position: relative;
  margin-top: 10px;
}

/* 嵌入媒體 */
#editor .instagram_container {
  margin-top: 32px;
}

#editor .instagram_container iframe {
  margin: 0 auto;
  max-width: 420px;
  width: calc(100% - 2px);
  height: 710px;
  border-radius: 3px;
  border: 1px solid rgb(219, 219, 219);
  box-shadow: none;
  display: block;
  padding: 0px;
  background: white;
}

#editor .video_container {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  height: 0;
  margin: 32px auto 0;
}

#editor .video_container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

@media (max-width: 768px) {
  #editor iframe {
    width: 100%;
  }

  #editor .video_container {
    width: 100%;
    padding-bottom: 56.25%;
  }
}

/* 圖片並排 */
#editor .editor_images_sidebyside {
  margin-top: 40px;
}

#editor .editor_images_sidebyside:first-child {
  margin-top: 0;
}

#editor .editor_images_sidebyside .sidebyside-title {
  font-size: 1.25em;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-align: center;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid rgba(0, 0, 0, 0.1);
}

#editor .editor_images_sidebyside .sidebyside_wrap {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  width: 100%;
}

#editor .editor_images_sidebyside .sidebyside_wrap .item {
  width: 20%;
  padding: 12% 10px 0;
  position: relative;
}

#editor .editor_images_sidebyside .sidebyside_wrap .item img {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: auto;
  max-width: 80%;
  max-height: 72%;
}

#editor .editor_images_sidebyside .sidebyside_wrap .item::before {
  content: "";
  width: 1px;
  height: 30px;
  background-color: #707070;
  display: block;
  position: absolute;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
}

#editor .editor_images_sidebyside .sidebyside_wrap .item:nth-child(5n)::before {
  display: none;
}

#editor .editor_images_sidebyside .sidebyside_wrap .item:last-child::before {
  display: none;
}

@media (max-width: 768px) {

  /* 圖片並排：768 以下 3 欄，取消 absolute 讓圖片自然撐高 */
  #editor .editor_images_sidebyside .sidebyside_wrap {
    gap: 20px 0;
  }

  #editor .editor_images_sidebyside .sidebyside_wrap .item {
    width: 33.3333%;
    padding: 0 10px;
  }

  #editor .editor_images_sidebyside .sidebyside_wrap .item img {
    position: static;
    transform: none;
    display: block;
    width: 55%;
    max-width: none;
    max-height: none;
    height: auto;
    margin: 0 auto;
  }

  #editor .editor_images_sidebyside .sidebyside_wrap .item::before {
    height: 18px;
  }

  #editor .editor_images_sidebyside .sidebyside_wrap .item:nth-child(5n)::before {
    display: block;
  }

  #editor .editor_images_sidebyside .sidebyside_wrap .item:nth-child(3n)::before {
    display: none;
  }
}

@media (max-width: 480px) {

  /* 圖片並排：480 以下 2 欄 */
  #editor .editor_images_sidebyside .sidebyside_wrap .item {
    width: 50%;
  }

  #editor .editor_images_sidebyside .sidebyside_wrap .item:nth-child(3n)::before {
    display: block;
  }

  #editor .editor_images_sidebyside .sidebyside_wrap .item:nth-child(2n)::before {
    display: none;
  }
}

/* 輪播 */
#editor .carousel-gallery-v3 {
  margin-top: 32px;
  position: relative;
}

#editor .carousel-gallery-v3 .carousel-stage {
  position: relative;
  max-width: 990px;
  margin: 0 auto;
  border-radius: 10px;
  outline: none;
}

#editor .carousel-gallery-v3 .carousel-stage:focus-visible {
  box-shadow: 0 0 0 2px rgba(var(--color-primary-rgb), 0.5);
}

#editor .carousel-gallery-v3 .carousel-frame {
  width: 100%;
  aspect-ratio: 1920 / 1080;
  border-radius: 10px;
  overflow: hidden;
  background: #f5f5f5;
  position: relative;
  cursor: grab;
}

#editor .carousel-gallery-v3 .carousel-stage.is-dragging .carousel-frame {
  cursor: grabbing;
}

#editor .carousel-gallery-v3 .carousel-track {
  display: flex;
  height: 100%;
  will-change: transform;
  transition: transform 0.6s ease;
  touch-action: pan-y;
  user-select: none;
}

#editor .carousel-gallery-v3 .carousel-slide {
  flex: 0 0 100%;
  height: 100%;
}

#editor .carousel-gallery-v3 .carousel-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
}

#editor .carousel-gallery-v3 .arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 50px;
  height: 50px;
  border: none;
  background-color: transparent;
  color: var(--color-text-white);
  font-size: 20px;
  font-weight: 500;
  letter-spacing: 0.05em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: 0.3s;
}

@media (hover: hover) {
  #editor .carousel-gallery-v3 .arrow:hover {
    transform: translateY(-50%) scale(1.15);
  }
}

#editor .carousel-gallery-v3 .arrow svg {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
}

#editor .carousel-gallery-v3 .prev-arrow {
  left: 24px;
}

#editor .carousel-gallery-v3 .next-arrow {
  right: 24px;
}

#editor .carousel-gallery-v3 .arrow:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

#editor .carousel-gallery-v3 .carousel-dots {
  margin-top: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

#editor .carousel-gallery-v3 .carousel-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: none;
  background: #ddd;
  cursor: pointer;
  padding: 0;
  transition: background 0.2s ease, opacity 0.2s ease;
}

#editor .carousel-gallery-v3 .carousel-dot.is-active {
  background: #000;
}

#editor .carousel-gallery-v3 .carousel-dot:focus-visible {
  outline: 2px solid rgba(var(--color-primary-rgb), 0.7);
  outline-offset: 2px;
}

@media (max-width: 768px) {
  #editor .carousel-gallery-v3 .arrow {
    width: 35px;
    height: 35px;
  }

  #editor .carousel-gallery-v3 .prev-arrow {
    left: 10px;
  }

  #editor .carousel-gallery-v3 .next-arrow {
    right: 10px;
  }

  #editor .carousel-gallery-v3 .carousel-dots {
    gap: 10px;
  }
}

/* 引用段落裡的編輯器 */
#editor .editor_quote h1,
#editor .editor_quote h2,
#editor .editor_quote h3,
#editor .editor_quote h4,
#editor .editor_quote h5,
#editor .editor_quote p,
#editor .editor_quote ul,
#editor .editor_quote ol {
  margin-top: 0px;
}

#editor .clearfix::after {
  content: "";
  display: block;
  clear: both;
}

/* 圖文樣式 */
#editor .image_text_labels_section {
  background-color: #EBEBEB;
  padding: 40px;
  margin: 60px 0;
}

#editor .image_text_title {
  margin-bottom: 20px;
}

#editor .image_text_labels_container {
  max-height: 800px;
  overflow-y: auto;
}

#editor .image_text_labels_box {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

#editor .image_text_label_card {
  display: flex;
  flex-direction: row;
  background-color: var(--color-bg-white);
  overflow: hidden;
  transition: 0.3s ease;
  text-decoration: none;
  color: inherit;
  position: relative;
}

#editor .image_text_label_image {
  flex: 0 0 40%;
  width: 40%;
  height: auto;
  overflow: hidden;
  position: relative;
}

#editor .image_text_label_image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  aspect-ratio: 4 / 3;
  transition: transform 0.6s ease;
  border: none;
  outline: none;
  border-radius: 0;
}

#editor .image_text_label_content {
  flex: 1;
  padding: 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

#editor .image_text_label_title {
  font-size: 1.5rem;
  font-weight: 600;
  color: #000;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

#editor .image_text_label_desc {
  font-size: 1rem;
  color: #000;
  line-height: 1.8;
  margin-bottom: 24px;
  margin-top: 15px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (hover: hover) {
  #editor .image_text_label_card:hover .image_text_label_image img {
    transform: scale(1.08);
  }
}

@media (max-width: 768px) {
  #editor .image_text_labels_section {
    padding: 30px;
  }

  #editor .image_text_label_content {
    padding: 30px 20px;
  }

  #editor .image_text_label_card {
    flex-direction: column;
  }

  #editor .image_text_label_image {
    flex: 0 0 auto;
    width: 100%;
  }
}