:root {
  --act-purple: #49308B;
  --act-lemon: #BDD130;
  --act-outline: #6F6F6F;
  --act-line: #E5E5E5;
  --act-icon-bg: #E1779529;
  --act-skeleton: #E4E4E4;
}

/* ===== Activity archive (archive-activity.php) ===== */

/* ----- Hero : พื้นเขียว + แถบม่วง + ดอกไม้มุมซ้าย/ขวา ----- */
.act-hero {
  position: relative;
  overflow: hidden;
  padding-bottom: 160px;
  background:
    url(../images/act_hero_corner.webp) right bottom / auto 100px no-repeat,
    url(../images/act_hero_r.webp) right 16px bottom / auto 160px no-repeat,
    url(../images/act_hero_l.webp) left 16px bottom 60px / auto 100px no-repeat,
    linear-gradient(var(--act-purple), var(--act-purple)) left bottom / 100% 62px no-repeat,
    var(--green);
  /* ดอกไม้มุมซ้าย (กลับด้านของมุมขวา) */
  &::before {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 120px;
    height: 100px;
    background: url(../images/act_hero_corner.webp) right bottom / auto 100% no-repeat;
    transform: scaleX(-1);
    pointer-events: none;
  }
}
.act-breadcrumb,
.act-breadcrumb a {
  color: var(--white);
}
.act-breadcrumb a:hover {
  opacity: .8;
}
.act-hero-text {
  position: relative;
  z-index: 1;
  padding: 2.5rem .5rem 0;
  text-shadow: 0 4px 4px #00000029;
}
.act-hero-title {
  font-size: 2rem;
  line-height: 1.1875;
  color: var(--act-lemon);
}
.act-hero-desc {
  margin-top: .25rem;
  line-height: 1.625;
}

/* ----- List ----- */
.act-list {
  position: relative;
  z-index: 1;
  margin-top: -1rem;
  padding-top: 2.5rem;
  border-radius: 1rem 1rem 0 0;
  background-color: var(--bg-body);
  box-shadow: 0 -4px 12px #0000000A;
}
.act-cats {
  display: flex;
  gap: .5rem;
  width: calc(100% + 1rem);
  margin: 0 -1rem 1.5rem 0;
  padding: 2px 1rem 2px 2px;
  overflow-x: auto;
  scrollbar-width: none;
  &::-webkit-scrollbar {
    display: none;
  }
}
.act-cat-btn {
  flex-shrink: 0;
  padding: .5rem .75rem;
  border: 1px solid var(--act-line);
  border-radius: .5rem;
  font-weight: 500;
  line-height: 1.625;
  color: var(--black-variant);
  background-color: transparent;
  white-space: nowrap;
  transition: border-color var(--trans-2), background-color var(--trans-2);
  &:hover {
    background-color: var(--btn-white-hov);
  }
  &.active {
    border-color: var(--pink);
    color: var(--black);
  }
}

.act-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  transition: opacity var(--trans-2);
  &.is-loading {
    opacity: .4;
    pointer-events: none;
  }
}
.act-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--act-line);
  border-radius: .5rem;
  background-color: var(--white);
  box-shadow: 0 4px 24px #0000000A;
}
.act-card-img {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden; /* ไม่ให้รูปแนวตั้งดันกล่องเกิน 16:9 */
  background-color: var(--act-skeleton);
}
.act-card-img img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.act-tag {
  position: absolute;
  top: .75rem;
  left: .75rem;
  padding: .25rem .5rem;
  border-radius: .25rem;
  font-size: .875rem;
  color: var(--white);
  white-space: nowrap;
}
.act-card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: .75rem;
  padding: 1rem 1rem 0;
}
.act-card-title {
  min-height: 3.5rem; /* 2 บรรทัด ให้ทุกใบในแถวเดียวกันตรงกัน */
  font-size: 1.25rem;
  line-height: 1.4;
}
.act-card-title a {
  color: var(--black);
  transition: color var(--trans-2);
  &:hover {
    color: var(--primary);
  }
}
.act-card-meta {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  margin: 0;
  padding: 0;
  list-style: none;
  line-height: 1.5;
  color: var(--act-outline);
}
.act-card-meta li {
  display: flex;
  align-items: center;
  gap: .5rem;
}
.act-card-icon {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
}
.act-card-actions {
  display: flex;
  gap: .5rem;
  margin-top: auto;
  padding: 1rem;
}
.act-card-actions .act-btn {
  flex: 1 0 0;
}

/* ----- Buttons ----- */
.act-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .25rem;
  min-width: 80px;
  min-height: 40px;
  padding: .5rem 1rem;
  border: 1px solid #00000040;
  border-radius: 999px;
  white-space: nowrap;
  transition: background-color var(--trans-2);
}
.act-btn-primary {
  font-size: .875rem;
  color: var(--white);
  background-color: var(--primary);
  &:hover {
    color: var(--white);
    background-color: var(--btn-primary-hov);
  }
}
.act-btn-outline {
  color: var(--black);
  background-color: transparent;
  &:hover {
    color: var(--black);
    background-color: var(--btn-white-hov);
  }
}
.act-card .act-btn-outline {
  border-color: #24242429;
  color: var(--act-outline);
  box-shadow: 0 4px 24px #0000000A;
}
.act-btn.is-disabled {
  opacity: .4;
  cursor: not-allowed;
  pointer-events: none;
}
.act-btn-soon {
  color: var(--white);
  background-color: #9CA3AF;
  border-color: #9CA3AF;
  cursor: not-allowed;
  pointer-events: none;
  img {
    filter: brightness(0) invert(1);
  }
}
.act-btn-lg {
  min-height: 56px;
  padding: .5rem 1.5rem;
  font-size: 1rem;
}

/* ----- Loader / Skeleton ----- */
.act-loader {
  display: flex;
  justify-content: center;
  padding: 2.5rem 0;
  color: var(--grey);
}
.act-loader svg {
  animation: act-spin 1s steps(8) infinite;
}
@keyframes act-spin {
  to { transform: rotate(360deg); }
}


/* ===== Activity detail (single-activity.php / template-parts/content-activity.php) ===== */
.page-activity-detail {
  background-color: var(--white);
}
.act-detail-breadcrumb,
.act-detail-breadcrumb a {
  color: var(--act-outline);
}
.act-detail-breadcrumb a:hover {
  color: var(--primary);
}
.act-detail-breadcrumb-current {
  min-width: 0;
  max-width: 240px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.act-detail {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
  padding-top: 2.5rem;
}

/* ----- Title ----- */
.act-detail-head {
  padding: 1rem;
  border-radius: .75rem;
  background-color: var(--bg-body);
}
.act-detail-title {
  font-size: 1.5rem;
  line-height: 1.333;
  letter-spacing: .1px;
}
.act-detail-desc {
  margin-top: .5rem;
  line-height: 1.5;
}
.act-detail-btns {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.5rem;
}
/* มือถือ : ปุ่มเต็มความกว้าง ปุ่มหลักอยู่บน */
.act-detail-btns .act-btn {
  flex: 1 0 100%;
  max-width: 300px;
}
.act-detail-btns .act-btn-back {
  order: 1;
}

/* ----- Panels ----- */
.act-detail-body {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
  align-items: start;
}
.act-panel {
  overflow: hidden;
  border-radius: .5rem;
  background-color: var(--white);
  box-shadow: 0 4px 12px #00000014;
}
.act-panel-inner {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1rem;
}
.act-detail-img {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: .5rem;
  background-color: var(--act-skeleton);
}
.act-detail-img img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* กล่องเอกสาร : ระยะชิดกว่ากล่องรายละเอียด */
.act-detail-img + .act-panel-inner {
  gap: .5rem;
}
.act-panel-group {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.act-panel-title {
  font-size: 1.5rem;
  line-height: 1.333;
}
.act-panel-desc {
  line-height: 1.5;
}
.act-btn-download {
  align-self: flex-start;
  min-height: 48px;
  padding: .5rem 1.25rem;
}

/* แถวข้อมูล : มือถือ label + icon บรรทัดบน ค่าอยู่บรรทัดล่าง */
.act-info {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}
.act-info-row {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  & + & {
    padding-top: .75rem;
    border-top: 1px solid var(--act-line);
  }
}
.act-info-row dt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  font-weight: 400;
  color: var(--black-variant);
}
.act-info-row dd {
  margin: 0;
  font-weight: 600;
  color: var(--black);
  &.text-green {
    color: var(--green);
  }
}
.act-info-icon {
  display: flex;
  flex-shrink: 0;
  order: 1;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: .5rem;
  background-color: var(--act-icon-bg);
}
.act-info-icon img {
  width: 16px;
  height: 16px;
}

.act-contact {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  &:not(:first-child) {
    padding-top: 1.5rem;
    border-top: 1px solid var(--act-line);
  }
}
.act-phone {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: .5rem;
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--black);
  &:hover {
    color: var(--primary);
  }
}
.act-phone-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-color: var(--act-lemon);
}


@media (min-width: 576px) {
  .act-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 768px) {
  /* ----- archive ----- */
  .act-hero {
    background-size: auto 160px, auto 250px, auto 160px, 100% 62px, auto;
    background-position: right bottom, right 16px bottom, left 16px bottom 62px, left bottom, 0 0;
    &::before {
      width: 190px;
      height: 160px;
    }
  }
  .act-hero-title {
    font-size: 2.5rem;
    line-height: 1.25;
  }
  .act-hero-desc {
    line-height: normal;
  }
  .act-cats {
    flex-wrap: wrap;
    justify-content: center;
    width: auto;
    margin-right: 0;
    padding: 2px;
    overflow: visible;
  }

  /* ----- detail ----- */
  .act-detail-head {
    padding: 1.5rem;
  }
  .act-detail-title {
    font-size: 2rem;
    line-height: 1.25;
  }
  .act-detail-desc,
  .act-panel-desc {
    font-size: 1.125rem;
    line-height: 1.444;
  }
  .act-detail-btns .act-btn {
    flex: 0 0 auto;
    max-width: none;
  }
  .act-detail-btns .act-btn-back {
    order: 0;
  }
  .act-detail-body {
    gap: 1.5rem;
  }
  .act-panel-inner {
    padding: 1.5rem;
  }
  .act-panel-title {
    font-size: 1.75rem;
    line-height: 1.357;
  }

  /* แถวข้อมูล : icon + label ซ้าย ค่าชิดขวา */
  .act-info-row {
    flex-direction: row;
    align-items: center;
    gap: .75rem;
    min-height: 40px;
  }
  .act-info-row dt {
    justify-content: flex-start;
    flex-shrink: 0;
    width: 200px;
  }
  .act-info-row dd {
    flex: 1;
    text-align: right;
  }
  .act-info-icon {
    order: 0;
    width: 40px;
    height: 40px;
  }
  .act-info-icon img {
    width: 24px;
    height: 24px;
  }
}

@media (min-width: 992px) {
  .act-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .act-detail-body {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1200px) {
  .act-detail-title {
    font-size: 2.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .act-loader svg {
    animation: none;
  }
}
