.temple-hero {
  min-height: 390px;
  background-image:
    linear-gradient(135deg, rgba(26, 22, 16, 0.92) 0%, rgba(45, 36, 24, 0.84) 58%, rgba(26, 22, 16, 0.76) 100%),
    url("https://www.buddhaparisa.org/img/banner.jpg");
  background-position: center 44%;
  background-size: cover;
}

.temple-hero::before {
  background:
    radial-gradient(ellipse 52% 70% at 88% 42%, rgba(200, 169, 110, 0.18) 0%, transparent 70%),
    linear-gradient(90deg, rgba(26, 22, 16, 0.2), rgba(26, 22, 16, 0.1));
}

.temple-hero-inner,
.temple-crumb,
.temples-main,
.temple-categories-section {
  max-width: 1100px;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

.temple-hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.4rem;
}

.temple-hero-stats span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 36px;
  padding: 0 0.9rem;
  border: 1px solid rgba(200, 169, 110, 0.34);
  background: rgba(26, 22, 16, 0.36);
  color: rgba(250, 247, 240, 0.82);
  font-size: 0.96rem;
  line-height: 1;
}

.temple-hero-stats strong {
  color: var(--gold);
  font-weight: 500;
}

.temples-main {
  padding-top: 2.5rem;
  padding-bottom: 0;
}

.temple-categories-section {
  padding-top: 2.6rem;
  padding-bottom: 3rem;
}

.temple-search-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.88fr);
  gap: 1.4rem;
  align-items: end;
  margin-bottom: 2.6rem;
  padding: 1.5rem;
  border: 1px solid var(--border);
  background: var(--cream-d);
}

.temple-search-copy p,
.temple-overview-text p {
  margin: 0;
  color: var(--ink-mid);
  font-size: 1.06rem;
  line-height: 1.9;
}

.temple-search-form {
  display: grid;
  gap: 0.5rem;
}

.temple-search-form label {
  color: var(--ink-soft);
  font-size: 0.98rem;
}

.temple-search-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  border: 1px solid var(--border);
  background: var(--cream);
}

.temple-search-control input,
.temple-search-control button {
  min-height: 46px;
  border: 0;
  font-family: "Noto Sans Thai", "Sarabun", sans-serif;
  font-size: 1rem;
}

.temple-search-control input {
  width: 100%;
  min-width: 0;
  padding: 0 1rem;
  background: transparent;
  color: var(--ink);
}

.temple-search-control input:focus {
  outline: 2px solid rgba(200, 169, 110, 0.5);
  outline-offset: -2px;
}

.temple-search-control button {
  padding: 0 1.25rem;
  background: var(--gold);
  color: #fff;
  cursor: pointer;
  font-weight: 500;
}

.temple-search-control button:hover {
  background: var(--gold-dk);
}

.temple-recent {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
  padding-top: 0.4rem;
}

.temple-recent span {
  color: var(--ink-soft);
  font-size: 0.96rem;
}

.temple-recent a {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  padding: 0 0.8rem;
  border: 1px solid var(--border);
  color: var(--gold-dk);
  background: rgba(250, 247, 240, 0.5);
  text-decoration: none;
  font-size: 0.96rem;
}

.temple-recent a:hover {
  border-color: var(--gold);
  background: var(--cream);
}

.temple-overview {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
  align-items: start;
  margin-bottom: 2.8rem;
}

.temple-overview-visual {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 0.3rem;
}

.temple-overview-visual img {
  display: block;
  width: min(100%, 520px);
  max-width: 520px;
  height: auto;
}

.temple-category-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  border: 1px solid var(--border);
  background: var(--border);
}

.temple-category-card {
  position: relative;
  display: block;
  min-height: 210px;
  overflow: hidden;
  background: var(--ink);
  color: var(--cream);
  text-decoration: none;
}

.temple-category-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.74;
  transform: scale(1.01);
  transition: transform 0.35s, opacity 0.35s;
}

.temple-category-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(26, 22, 16, 0.08) 0%, rgba(26, 22, 16, 0.82) 100%),
    linear-gradient(90deg, rgba(26, 22, 16, 0.34), transparent 58%);
}

.temple-category-card span {
  position: absolute;
  left: 1rem;
  right: 1rem;
  bottom: 1rem;
  z-index: 1;
  font-family: "Noto Serif Thai", serif;
  font-size: 1.12rem;
  font-weight: 500;
  line-height: 1.45;
  text-shadow: 0 2px 12px rgba(26, 22, 16, 0.55);
}

.temple-category-card:hover img {
  opacity: 0.9;
  transform: scale(1.05);
}

.temple-category-card:hover span {
  color: var(--gold);
}

.temple-search-results-main {
  padding-bottom: 0;
}

.temple-results-search {
  margin-bottom: 2.5rem;
}

.temple-results-section {
  margin-bottom: 0;
}

.temple-results-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: end;
  margin-bottom: 1rem;
}

.temple-results-count {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  padding: 0 0.9rem;
  border: 1px solid var(--border);
  background: var(--cream-d);
  color: var(--gold-dk);
  font-size: 0.95rem;
  white-space: nowrap;
}

.temple-results-list {
  display: grid;
  border: 1px solid var(--border);
  background: var(--border);
  gap: 1px;
}

.temple-result-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  min-height: 74px;
  padding: 0.9rem 1rem;
  background: var(--cream);
  color: var(--ink-mid);
  text-decoration: none;
  transition: background 0.18s, color 0.18s;
}

.temple-result-row:hover {
  background: var(--cream-d);
  color: var(--ink);
}

.temple-result-main {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
}

.temple-result-name {
  overflow: hidden;
  color: var(--ink);
  font-family: "Noto Serif Thai", serif;
  font-size: 1.18rem;
  font-weight: 500;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.temple-result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.65rem;
  color: var(--ink-soft);
  font-size: 0.92rem;
  line-height: 1.35;
}

.temple-result-meta span {
  display: inline-flex;
  align-items: center;
}

.temple-result-province {
  color: var(--gold-dk);
  font-size: 0.98rem;
  white-space: nowrap;
}

.temple-result-empty {
  display: grid;
  gap: 0.45rem;
  padding: 1.2rem;
  border: 1px solid var(--border);
  background: var(--cream-d);
  color: var(--ink-mid);
}

.temple-result-empty strong {
  color: var(--ink);
  font-family: "Noto Serif Thai", serif;
  font-size: 1.2rem;
  font-weight: 500;
}

.temple-result-empty span {
  color: var(--ink-soft);
  font-size: 0.98rem;
  line-height: 1.7;
}

.ai-hero {
  background-image:
    linear-gradient(135deg, rgba(23, 20, 16, 0.93) 0%, rgba(58, 43, 25, 0.84) 58%, rgba(24, 22, 20, 0.78) 100%),
    url("https://www.buddhaparisa.org/img/banner.jpg");
}

.temple-overview-text a,
.temple-search-copy a {
  color: var(--gold-dk);
  text-decoration: underline;
  text-underline-offset: 0.16em;
}

.ai-overview-visual {
  align-items: stretch;
  padding-top: 0;
}

.ai-symbol {
  display: grid;
  width: min(100%, 430px);
  min-height: 300px;
  place-items: center;
  border: 1px solid var(--border);
  background:
    radial-gradient(circle at 50% 24%, rgba(200, 169, 110, 0.18), transparent 34%),
    linear-gradient(145deg, var(--cream-d), var(--cream));
  color: var(--ink);
  text-align: center;
}

.ai-symbol span {
  align-self: end;
  color: var(--ink-soft);
  font-family: "Noto Sans Thai", "Sarabun", sans-serif;
  font-size: 1rem;
}

.ai-symbol strong {
  align-self: start;
  color: var(--gold-dk);
  font-family: "Noto Serif Thai", serif;
  font-size: clamp(4.5rem, 11vw, 8rem);
  font-weight: 500;
  line-height: 1;
}

.ai-feature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin-bottom: 2.6rem;
  border: 1px solid var(--border);
  background: var(--border);
}

.ai-feature-card {
  display: grid;
  align-content: start;
  gap: 0.7rem;
  min-height: 260px;
  padding: 1.35rem;
  background: var(--cream);
}

.ai-feature-card p,
.ai-line-panel p {
  margin: 0;
  color: var(--ink-mid);
  font-size: 1.02rem;
  line-height: 1.9;
}

.ai-warning-card {
  background: var(--cream-d);
}

.ai-line-panel {
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.55fr);
  align-items: center;
}

.ai-line-visual {
  display: grid;
  justify-items: center;
  gap: 0.85rem;
  padding: 1rem;
  border: 1px solid var(--border);
  background: rgba(250, 247, 240, 0.55);
  text-align: center;
}

.ai-line-qr {
  display: block;
  max-width: 220px;
  width: 100%;
  height: auto;
}

.ai-line-visual span {
  color: var(--ink-soft);
  font-size: 0.98rem;
}

.ai-line-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ai-line-button img {
  display: block;
}

.ai-examples-section {
  padding-top: 0;
}

.ai-examples-section .article-title {
  margin-bottom: 1rem;
}

.ai-example-grid .temple-category-card {
  min-height: 340px;
}

@media (max-width: 900px) {
  .temple-hero {
    min-height: 340px;
  }

  .temple-search-panel,
  .temple-overview,
  .ai-feature-grid {
    grid-template-columns: 1fr;
  }

  .temple-overview-visual {
    justify-self: center;
    justify-content: center;
    padding-top: 0.2rem;
    width: 100%;
  }

  .temple-overview-visual img {
    width: min(100%, 500px);
    max-width: 500px;
  }

  .ai-symbol {
    width: min(100%, 500px);
  }

  .temple-category-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .temple-hero-inner,
  .temple-crumb,
  .temples-main,
  .temple-categories-section {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .temple-categories-section {
    padding-left: clamp(1.35rem, 6vw, 1.75rem);
    padding-right: clamp(1.35rem, 6vw, 1.75rem);
  }

  .temple-hero {
    min-height: 360px;
    background-position: center top;
  }

  .temple-hero-stats {
    gap: 0.45rem;
  }

  .temple-hero-stats span {
    min-height: 34px;
    padding: 0 0.7rem;
    font-size: 0.9rem;
  }

  .temples-main {
    padding-top: 2rem;
  }

  .temple-search-panel {
    padding: 1rem;
  }

  .temple-overview {
    gap: 1rem;
  }

  .temple-overview-visual {
    justify-self: center;
    justify-content: center;
    padding-top: 0;
    width: 100%;
  }

  .temple-overview-visual img {
    width: min(96vw, 430px);
    max-width: 430px;
  }

  .ai-symbol {
    width: min(100%, 430px);
    min-height: 220px;
  }

  .ai-feature-card {
    min-height: 0;
    padding: 1rem;
  }

  .temple-search-control {
    grid-template-columns: 1fr;
  }

  .temple-search-control button {
    width: 100%;
  }

  .temple-category-grid {
    grid-template-columns: 1fr;
  }

  .temple-category-card {
    min-height: 180px;
  }

  .ai-example-grid .temple-category-card {
    min-height: 260px;
  }

  .temple-results-heading,
  .temple-result-row {
    grid-template-columns: 1fr;
  }

  .temple-results-count {
    justify-self: start;
  }

  .temple-result-row {
    gap: 0.5rem;
    min-height: 0;
  }

  .temple-result-name {
    white-space: normal;
  }

  .temple-result-province {
    white-space: normal;
  }
}
