/*
Theme Name: TrustBaseTH
Theme URI: https://trustbaseth.com
Author: ThinkLab
Author URI: https://thinklab.co.th
Description: Thai-first custom marketing theme for TrustBaseTH, ported from the approved Open Design artifact.
Version: 1.0.0
Requires at least: 6.4
Requires PHP: 8.0
Text Domain: trustbaseth
*/

/* The approved visual system remains inline in front-page.php for exact parity. */

.admin-bar .nav {
  top: 32px;
}

.admin-bar .mobile-nav {
  top: calc(var(--nav-h) + 32px);
}

@media screen and (max-width: 782px) {
  .admin-bar .nav {
    top: 46px;
  }

  .admin-bar .mobile-nav {
    top: calc(var(--nav-h) + 46px);
  }
}

:root {
  --tb-brand: #3b5bff;
  --tb-brand-dark: #2540d9;
  --tb-ink: #0e1116;
  --tb-muted: #6b7280;
  --tb-canvas: #f6f7f9;
  --tb-border: #e5e7eb;
  --tb-surface: #fff;
  --tb-radius: 20px;
  --tb-shadow: 0 12px 40px rgba(14, 17, 22, 0.08);
  --tb-font: "Inter", "Noto Sans Thai", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}

html[data-lang="th"] [data-en],
html[data-lang="en"] [data-th] {
  display: none !important;
}

.tb-content-site {
  margin: 0;
  background: var(--tb-canvas);
  color: var(--tb-ink);
  font-family: var(--tb-font);
  -webkit-font-smoothing: antialiased;
}

.tb-content-site *,
.tb-content-site *::before,
.tb-content-site *::after {
  box-sizing: border-box;
}

.tb-content-site a {
  color: inherit;
  text-decoration: none;
}

.tb-site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--tb-border);
  backdrop-filter: blur(14px);
}

.admin-bar .tb-site-header {
  top: 32px;
}

.tb-site-header__inner {
  width: min(1200px, calc(100% - 48px));
  min-height: 72px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}

.tb-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.tb-brand img {
  display: block;
}

.tb-brand span span {
  color: var(--tb-brand);
}

.tb-desktop-nav,
.tb-header-actions {
  display: flex;
  align-items: center;
  gap: 22px;
}

.tb-desktop-nav a {
  color: var(--tb-muted);
  font-size: 14px;
  font-weight: 600;
}

.tb-desktop-nav a:hover {
  color: var(--tb-ink);
}

.tb-header-actions {
  gap: 10px;
}

.tb-lang {
  border: 0;
  border-radius: 999px;
  padding: 7px 11px;
  background: var(--tb-canvas);
  color: var(--tb-muted);
  font: 700 12px/1 var(--tb-font);
}

.tb-login,
.tb-header-cta {
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 700;
}

.tb-login {
  border: 1px solid var(--tb-border);
}

.tb-header-cta {
  background: var(--tb-brand);
  color: #fff !important;
  box-shadow: 0 4px 14px rgba(59, 91, 255, 0.24);
}

.tb-menu-button {
  display: none;
  border: 0;
  background: transparent;
  padding: 8px;
}

.tb-mobile-nav {
  display: none;
}

.tb-main {
  min-height: 65vh;
}

.tb-page-hero {
  padding: 88px 24px 56px;
  text-align: center;
  background: linear-gradient(180deg, #fff, var(--tb-canvas));
}

.tb-page-hero__inner {
  width: min(780px, 100%);
  margin: 0 auto;
}

.tb-eyebrow {
  display: inline-flex;
  padding: 6px 13px;
  border-radius: 999px;
  background: rgba(59, 91, 255, 0.08);
  color: var(--tb-brand);
  font-size: 13px;
  font-weight: 700;
}

.tb-page-hero h1 {
  margin: 18px 0 14px;
  font-size: clamp(36px, 5vw, 58px);
  line-height: 1.08;
  letter-spacing: -0.04em;
}

.tb-page-hero p {
  margin: 0 auto;
  max-width: 680px;
  color: var(--tb-muted);
  font-size: 18px;
  line-height: 1.75;
}

.tb-content-wrap {
  width: min(1120px, calc(100% - 48px));
  margin: 0 auto;
  padding: 64px 0 96px;
}

.tb-article {
  width: min(820px, 100%);
  margin: 0 auto;
  padding: clamp(28px, 5vw, 56px);
  background: var(--tb-surface);
  border: 1px solid var(--tb-border);
  border-radius: var(--tb-radius);
  box-shadow: var(--tb-shadow);
}

.tb-article__meta {
  margin-bottom: 20px;
  color: var(--tb-muted);
  font-size: 14px;
}

.tb-prose {
  color: #374151;
  font-size: 16px;
  line-height: 1.85;
}

.tb-prose h2,
.tb-prose h3 {
  color: var(--tb-ink);
  line-height: 1.3;
}

.tb-prose h2 {
  margin: 40px 0 12px;
  font-size: 25px;
}

.tb-prose h3 {
  margin: 28px 0 10px;
}

.tb-prose a {
  color: var(--tb-brand);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.tb-prose img {
  max-width: 100%;
  height: auto;
  border-radius: 16px;
}

.tb-post-grid,
.tb-resource-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}

.tb-blog-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 30px;
}

.tb-blog-filters a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 16px;
  border: 1px solid var(--tb-border);
  border-radius: 999px;
  background: #fff;
  color: var(--tb-muted);
  font-size: 14px;
  font-weight: 700;
}

.tb-blog-filters a:hover,
.tb-blog-filters a.is-active {
  border-color: var(--tb-brand);
  background: var(--tb-brand);
  color: #fff;
}

.tb-post-card,
.tb-resource-card {
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--tb-border);
  border-radius: var(--tb-radius);
  box-shadow: 0 6px 24px rgba(14, 17, 22, 0.05);
}

.tb-post-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.tb-post-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 38px rgba(14, 17, 22, 0.09);
}

.tb-post-card--featured {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
}

.tb-post-card__image {
  display: block;
  aspect-ratio: 16 / 10;
  min-height: 230px;
  background: linear-gradient(135deg, rgba(59, 91, 255, 0.12), rgba(59, 91, 255, 0.025));
}

.tb-post-card--featured .tb-post-card__image {
  min-height: 330px;
  aspect-ratio: auto;
}

.tb-post-card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tb-post-placeholder {
  display: flex;
  width: 100%;
  height: 100%;
  min-height: inherit;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #8794aa;
  font-size: 13px;
  font-weight: 700;
}

.tb-post-placeholder svg {
  width: 44px;
  height: 44px;
}

.tb-post-card__body,
.tb-resource-card {
  padding: 26px;
}

.tb-post-card--featured .tb-post-card__body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(30px, 5vw, 54px);
}

.tb-post-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  color: var(--tb-muted);
  font-size: 13px;
}

.tb-post-card__meta span {
  color: var(--tb-brand);
  font-weight: 800;
}

.tb-post-card__meta span + time::before {
  content: "·";
  margin-right: 10px;
  color: var(--tb-border);
}

.tb-post-card h2,
.tb-resource-card h2 {
  margin: 10px 0;
  font-size: 21px;
  line-height: 1.35;
}

.tb-post-card--featured h2 {
  font-size: clamp(26px, 3vw, 36px);
}

.tb-post-card p,
.tb-resource-card p {
  color: var(--tb-muted);
  line-height: 1.7;
}

.tb-post-card__excerpt {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}

.tb-text-link {
  display: inline-flex;
  margin-top: 12px;
  color: var(--tb-brand) !important;
  font-weight: 700;
}

.tb-pagination {
  margin-top: 40px;
  text-align: center;
}

.tb-empty {
  grid-column: 1 / -1;
  padding: clamp(48px, 8vw, 88px) 24px;
  text-align: center;
  background:
    radial-gradient(circle at 50% 0%, rgba(59, 91, 255, 0.12), transparent 45%),
    #fff;
  border: 1px solid var(--tb-border);
  border-radius: var(--tb-radius);
}

.tb-empty__icon {
  display: inline-flex;
  width: 64px;
  height: 64px;
  align-items: center;
  justify-content: center;
  border-radius: 20px;
  background: rgba(59, 91, 255, 0.08);
  color: var(--tb-brand);
}

.tb-empty__icon svg {
  width: 30px;
  height: 30px;
}

.tb-empty h2 {
  margin: 20px 0 10px;
  font-size: clamp(26px, 4vw, 38px);
}

.tb-empty p {
  max-width: 650px;
  margin: 0 auto;
  color: var(--tb-muted);
  line-height: 1.8;
}

.tb-empty__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 28px;
}

.tb-button-primary,
.tb-button-secondary {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  padding: 11px 22px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 800;
}

.tb-button-primary {
  background: var(--tb-brand);
  color: #fff !important;
  box-shadow: 0 6px 18px rgba(59, 91, 255, 0.22);
}

.tb-button-secondary {
  border: 1px solid var(--tb-border);
  background: #fff;
  color: var(--tb-ink) !important;
}

.tb-faq-search {
  position: relative;
  width: min(620px, 100%);
  margin: -26px auto 52px;
}

.tb-faq-search svg {
  position: absolute;
  left: 18px;
  top: 50%;
  width: 20px;
  height: 20px;
  transform: translateY(-50%);
  color: var(--tb-muted);
}

.tb-faq-search input {
  width: 100%;
  min-height: 56px;
  padding: 12px 18px 12px 52px;
  border: 1px solid var(--tb-border);
  border-radius: 15px;
  background: #fff;
  color: var(--tb-ink);
  font: inherit;
  box-shadow: 0 10px 30px rgba(14, 17, 22, 0.07);
}

.tb-faq-search input:focus {
  outline: 3px solid rgba(59, 91, 255, 0.12);
  border-color: var(--tb-brand);
}

.tb-faq-layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 46px;
  align-items: start;
}

.tb-faq-categories {
  position: sticky;
  top: 110px;
  display: grid;
  gap: 5px;
}

.tb-faq-categories p {
  margin-bottom: 8px;
  color: var(--tb-muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.tb-faq-categories a {
  padding: 11px 13px;
  border-radius: 10px;
  color: var(--tb-muted);
  font-size: 14px;
  font-weight: 700;
}

.tb-faq-categories a:hover {
  background: rgba(59, 91, 255, 0.08);
  color: var(--tb-brand);
}

.tb-faq-sections {
  display: grid;
  gap: 36px;
}

.tb-faq-section {
  scroll-margin-top: 110px;
}

.tb-faq-section h2 {
  margin: 0 0 14px;
  font-size: 22px;
}

.tb-faq-section h2::after {
  content: "";
  display: block;
  width: 44px;
  height: 3px;
  margin-top: 8px;
  border-radius: 99px;
  background: var(--tb-brand);
}

.tb-faq-list {
  display: grid;
  gap: 10px;
}

.tb-faq-list details {
  background: #fff;
  border: 1px solid var(--tb-border);
  border-radius: 16px;
  padding: 0 20px;
  box-shadow: 0 3px 12px rgba(14, 17, 22, 0.025);
}

.tb-faq-list summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  cursor: pointer;
  padding: 20px 0;
  font-weight: 750;
  list-style: none;
}

.tb-faq-list summary svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  color: var(--tb-muted);
  transition: transform 0.2s ease, color 0.2s ease;
}

.tb-faq-list details[open] {
  border-color: rgba(59, 91, 255, 0.32);
  box-shadow: 0 12px 28px rgba(59, 91, 255, 0.075);
}

.tb-faq-list details[open] summary {
  color: var(--tb-brand);
}

.tb-faq-list details[open] summary svg {
  transform: rotate(180deg);
  color: var(--tb-brand);
}

.tb-faq-list summary::-webkit-details-marker {
  display: none;
}

.tb-faq-list details p {
  margin: 0;
  padding: 0 0 22px;
  color: var(--tb-muted);
  line-height: 1.75;
}

.tb-faq-cta {
  display: flex;
  align-items: center;
  gap: 28px;
  margin-top: 64px;
  padding: clamp(30px, 5vw, 50px);
  border-radius: 22px;
  background: var(--tb-ink);
  color: #fff;
}

.tb-faq-cta > div {
  flex: 1;
}

.tb-faq-cta h2 {
  margin: 16px 0 8px;
  font-size: clamp(26px, 4vw, 38px);
  line-height: 1.3;
}

.tb-faq-cta p {
  max-width: 680px;
  color: rgba(255, 255, 255, 0.65);
  line-height: 1.75;
}

.tb-booking-grid {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 30px;
  align-items: start;
}

.tb-booking-aside,
.tb-booking-form {
  padding: clamp(26px, 4vw, 42px);
  background: #fff;
  border: 1px solid var(--tb-border);
  border-radius: var(--tb-radius);
  box-shadow: 0 8px 30px rgba(14, 17, 22, 0.05);
}

.tb-booking-aside h2,
.tb-booking-form h2 {
  margin-top: 0;
}

.tb-booking-aside p {
  color: var(--tb-muted);
  line-height: 1.75;
}

.tb-booking-points {
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 14px;
}

.tb-booking-points li {
  display: flex;
  gap: 10px;
}

.tb-booking-points li::before {
  content: "✓";
  color: #16a34a;
  font-weight: 900;
}

.tb-field {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.tb-field label {
  font-weight: 700;
  font-size: 14px;
}

.tb-field input,
.tb-field select,
.tb-field textarea {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  padding: 13px 14px;
  color: var(--tb-ink);
  background: #fff;
  font: 500 15px/1.4 var(--tb-font);
}

.tb-field textarea {
  min-height: 130px;
  resize: vertical;
}

.tb-field--trap {
  position: absolute !important;
  left: -9999px !important;
}

.tb-submit {
  border: 0;
  border-radius: 999px;
  padding: 14px 24px;
  background: var(--tb-brand);
  color: #fff;
  font: 750 15px/1 var(--tb-font);
  cursor: pointer;
}

.tb-notice {
  margin-bottom: 24px;
  padding: 14px 16px;
  border-radius: 12px;
  font-weight: 650;
}

.tb-notice--success {
  color: #166534;
  background: #dcfce7;
}

.tb-notice--error {
  color: #991b1b;
  background: #fee2e2;
}

.tb-site-footer {
  padding: 64px 24px 28px;
  color: rgba(255, 255, 255, 0.68);
  background: var(--tb-ink);
}

.tb-site-footer__grid {
  width: min(1120px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr repeat(3, 1fr);
  gap: 36px;
}

.tb-brand--footer {
  color: #fff !important;
}

.tb-site-footer p {
  max-width: 330px;
  line-height: 1.7;
}

.tb-site-footer h2 {
  margin: 0 0 16px;
  color: #fff;
  font-size: 14px;
}

.tb-site-footer__grid > div:not(:first-child) {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tb-site-footer a:hover {
  color: #fff;
}

.tb-site-footer__bottom {
  width: min(1120px, 100%);
  margin: 44px auto 0;
  padding-top: 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 13px;
}

@media (max-width: 900px) {
  .tb-desktop-nav {
    display: none;
  }

  .tb-menu-button {
    display: inline-flex;
  }

  .tb-mobile-nav.is-open {
    display: grid;
    gap: 2px;
    padding: 14px 24px 20px;
    border-top: 1px solid var(--tb-border);
    background: #fff;
  }

  .tb-mobile-nav a {
    padding: 10px 0;
    border-bottom: 1px solid var(--tb-border);
    font-weight: 650;
  }

  .tb-post-grid,
  .tb-resource-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tb-post-card--featured {
    grid-template-columns: 1fr;
  }

  .tb-post-card--featured .tb-post-card__image {
    min-height: 280px;
  }

  .tb-faq-layout {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .tb-faq-categories {
    position: static;
    display: flex;
    overflow-x: auto;
    padding-bottom: 6px;
  }

  .tb-faq-categories p {
    display: none !important;
  }

  .tb-faq-categories a {
    flex: 0 0 auto;
    border: 1px solid var(--tb-border);
    background: #fff;
  }

  .tb-booking-grid {
    grid-template-columns: 1fr;
  }

  .tb-site-footer__grid {
    grid-template-columns: 1.5fr 1fr 1fr;
  }

  .tb-site-footer__grid > div:last-child {
    grid-column: 2;
  }
}

@media (max-width: 767px) {
  .admin-bar .tb-site-header {
    top: 46px;
  }

  .tb-site-header__inner {
    width: calc(100% - 32px);
    min-height: 66px;
  }

  .tb-brand {
    gap: 8px;
    font-size: 17px;
  }

  .tb-brand img {
    width: 30px;
    height: 30px;
  }

  .tb-login,
  .tb-header-cta {
    display: none !important;
  }

  .tb-page-hero {
    padding: 60px 20px 40px;
  }

  .tb-page-hero p {
    font-size: 16px;
  }

  .tb-content-wrap {
    width: calc(100% - 32px);
    padding: 40px 0 64px;
  }

  .tb-post-grid,
  .tb-resource-grid {
    grid-template-columns: 1fr;
  }

  .tb-post-card--featured {
    display: block;
  }

  .tb-post-card--featured .tb-post-card__image {
    min-height: 220px;
  }

  .tb-faq-search {
    margin: -12px auto 34px;
  }

  .tb-faq-cta {
    align-items: flex-start;
    flex-direction: column;
  }

  .tb-site-footer__grid {
    grid-template-columns: 1fr;
  }

  .tb-site-footer__grid > div:last-child {
    grid-column: auto;
  }
}
