@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+Thai:wght@400;500;600;700;800&family=Noto+Serif+Thai:wght@600;700&display=swap");

:root {
  --tfdp-ink: #3d2417;
  --tfdp-muted: #74645a;
  --tfdp-teal: #0d5655;
  --tfdp-teal-dark: #084342;
  --tfdp-orange: #d85a2b;
  --tfdp-cream: #fffaf2;
  --tfdp-line: #eadfce;
}

html { overflow-x: hidden; }
body { margin: 0 !important; }

.tfdp-header,
.tfdp-footer {
  box-sizing: border-box;
  font-family: "Noto Sans Thai", system-ui, sans-serif;
}

.tfdp-header *,
.tfdp-footer * { box-sizing: border-box; }
.tfdp-shell { width: min(100% - 40px, 1240px); margin-inline: auto; }

.tfdp-header {
  position: relative;
  z-index: 1000;
  min-height: 72px;
  background: rgba(255, 253, 249, .98);
  border-bottom: 1px solid #eee4d7;
  box-shadow: 0 2px 12px rgba(57, 35, 20, .04);
}

.tfdp-header .tfdp-shell {
  min-height: 72px;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  align-items: center;
  gap: 18px;
}

.tfdp-brand {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--tfdp-ink);
  text-decoration: none;
}
.tfdp-brand img { width: 46px; height: 46px; object-fit: contain; flex: none; }
.tfdp-brand span { min-width: 0; }
.tfdp-brand strong {
  display: block;
  font: 700 25px/1.05 Georgia, "Noto Serif Thai", serif;
  white-space: nowrap;
}
.tfdp-brand small { display: block; margin-top: 3px; color: #8b7b70; font-size: 11px; }

.tfdp-nav { display: flex; align-items: stretch; min-height: 72px; }
.tfdp-nav a {
  position: relative;
  min-height: 44px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  color: var(--tfdp-ink);
  font-family: "Noto Serif Thai", Georgia, serif;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

/* Keep the homepage and inner-page navigation in one looped Thai typeface. */
.tfd2-header .tfd2-nav a,
.tfd2-header .tfd2-mobile-menu a,
.tfdp-header .tfdp-nav a,
.tfdp-header .tfdp-mobile-menu a {
  font-family: "Noto Serif Thai", Georgia, serif !important;
  font-weight: 700 !important;
}
.tfd2-header .tfd2-nav a,
.tfdp-header .tfdp-nav a { font-size: 14px !important; }
.tfdp-nav a:hover,
.tfdp-nav a.is-active { color: var(--tfdp-orange); }
.tfdp-nav a.is-active::after {
  content: "";
  position: absolute;
  inset: auto 8px 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--tfdp-orange);
}

.tfdp-actions { display: flex; align-items: center; gap: 9px; }
.tfdp-actions a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-weight: 800;
}
.tfdp-saved {
  width: 44px;
  border: 1px solid var(--tfdp-line);
  border-radius: 50%;
  color: var(--tfdp-ink);
  font-size: 22px;
}
.tfdp-support {
  gap: 7px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--tfdp-teal);
  color: #fff;
  font-size: 13px;
}
.tfdp-support:hover { background: var(--tfdp-teal-dark); }
.tfdp-mobile { display: none; position: relative; }
.tfdp-mobile summary {
  width: 46px;
  height: 46px;
  border: 1px solid var(--tfdp-line);
  border-radius: 12px;
  display: grid;
  place-items: center;
  cursor: pointer;
  list-style: none;
  color: var(--tfdp-ink);
  background: #fff;
  font-size: 21px;
}
.tfdp-mobile summary::-webkit-details-marker { display: none; }
.tfdp-mobile-menu {
  position: absolute;
  top: 54px;
  right: 0;
  width: min(300px, calc(100vw - 24px));
  padding: 8px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  border: 1px solid var(--tfdp-line);
  border-radius: 16px;
  background: #fffdf9;
  box-shadow: 0 18px 44px rgba(54, 34, 20, .18);
}
.tfdp-mobile-menu a {
  min-height: 44px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  border-radius: 9px;
  color: var(--tfdp-ink);
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
  line-height: 1.35;
}
.tfdp-mobile-menu a:hover,
.tfdp-mobile-menu a.is-active { background: #fff1df; color: var(--tfdp-orange); }
.tfdp-mobile-menu a:nth-last-child(-n + 2) {
  margin-top: 4px;
  background: #f1f7f4;
  color: var(--tfdp-teal);
}

/* Hide the old per-page chrome after the unified shell is present. */
.tfdp-unified-page .tfd > .tfd-nav,
.tfdp-unified-page .tfd > .tfd-footer,
.tfdp-unified-page .tfd-privacy > .tfd-nav,
.tfdp-unified-page .tfd-privacy > .tfd-footer,
.tfdp-unified-page .tfd-info > .tfd-info-nav,
.tfdp-unified-page .tfd-info > .tfd-info-footer { display: none !important; }

.tfdp-unified-page .tfd,
.tfdp-unified-page .tfd-privacy,
.tfdp-unified-page .tfd-info,
.tfdp-unified-page .tfdsrc {
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
  left: auto !important;
  right: auto !important;
}

.tfdp-unified-page .tfd h1,
.tfdp-unified-page .tfd-privacy h1,
.tfdp-unified-page .tfd-info h1,
.tfdp-unified-page .tfdsrc h1 {
  font-size: clamp(32px, 4.2vw, 56px) !important;
  line-height: 1.13 !important;
  text-wrap: balance;
}

.tfdp-unified-page .tfd-hero,
.tfdp-unified-page .tfd-info-hero,
.tfdp-unified-page .tfdsrc-hero { padding-block: clamp(42px, 7vw, 78px) !important; }

.tfdp-unified-page .tfd button,
.tfdp-unified-page .tfd input,
.tfdp-unified-page .tfd select,
.tfdp-unified-page .tfd textarea,
.tfdp-unified-page .tfd-privacy button,
.tfdp-unified-page .tfd-privacy input,
.tfdp-unified-page .tfd-privacy select,
.tfdp-unified-page .tfdsrc button,
.tfdp-unified-page .tfdsrc input,
.tfdp-unified-page .tfdsrc select { min-height: 44px; }

.tfdp-unified-page .tfd-card a,
.tfdp-unified-page .tfd-event,
.tfdp-unified-page .tfd-info-actions a,
.tfdp-unified-page .tfd-policy a { min-height: 44px; }

/* The standalone information page previously used 100vw plus negative margins. */
.tfdp-unified-page .tfd-info,
.tfdp-unified-page .tfd-info-nav,
.tfdp-unified-page .tfd-info-hero,
.tfdp-unified-page .tfd-info-main,
.tfdp-unified-page .tfd-info-section,
.tfdp-unified-page .tfd-info-footer {
  box-sizing: border-box;
  max-width: 100% !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

/* Home page: keep all search fields and quick filters available at small sizes. */
.tfd2-pill { min-height: 44px !important; }
@media (max-width: 900px) {
  .tfd2-search { grid-template-columns: 1fr 1fr !important; }
  .tfd2-search .tfd2-field:nth-child(4) { display: flex !important; }
  .tfd2-search-btn { grid-column: 1 / -1; min-height: 48px; }
  .tfd2-pill:nth-child(n+5) { display: flex !important; }
}
@media (max-width: 640px) {
  .tfd2-hero { min-height: 0 !important; height: auto !important; }
  .tfd2-search { grid-template-columns: 1fr !important; }
  .tfd2-search .tfd2-field:nth-child(n+2) { display: flex !important; }
  .tfd2-search-btn { grid-column: auto; }
  .tfd2-pill:nth-child(n+5) { display: flex !important; }
}

/* Source directory pagination and mobile cards. */
.tfdp-page-hidden { display: none !important; }
.tfdp-source-pager {
  margin: 16px 0 8px;
  padding: 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid var(--tfdp-line);
  border-radius: 14px;
  background: #fff;
}
.tfdp-source-pager button,
.tfdp-source-pager select {
  min-height: 44px;
  border: 1px solid #ddcfbd;
  border-radius: 9px;
  background: #fff;
  color: var(--tfdp-ink);
  padding: 8px 13px;
  font: inherit;
}
.tfdp-source-pager button:disabled { opacity: .45; cursor: not-allowed; }
.tfdp-source-pager-status { min-width: 190px; text-align: center; color: var(--tfdp-muted); font-weight: 700; }
.tfdp-source-cards { display: none; }
.tfdp-source-card {
  padding: 16px;
  border: 1px solid var(--tfdp-line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 7px 20px rgba(66, 43, 24, .06);
}
.tfdp-source-card h2 { margin: 0 0 12px; color: var(--tfdp-ink); font-size: 20px; }
.tfdp-source-card dl { margin: 0; display: grid; gap: 9px; }
.tfdp-source-card div { display: grid; grid-template-columns: 105px 1fr; gap: 9px; align-items: start; }
.tfdp-source-card dt { color: var(--tfdp-muted); font-size: 12px; font-weight: 800; }
.tfdp-source-card dd { margin: 0; min-width: 0; color: var(--tfdp-ink); }
.tfdp-source-card a { min-height: 44px; display: inline-flex; align-items: center; }

/* Calendar keeps the month grid but adds a readable agenda on mobile. */
.tfdp-calendar-scroll { width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; }
.tfdp-calendar-scroll .tfd-calendar { min-width: 700px; }
.tfdp-calendar-agenda { display: none; margin: 16px 0; }
.tfdp-calendar-agenda h2 { margin: 0 0 10px; font-size: 24px; }
.tfdp-calendar-agenda-list { display: grid; gap: 9px; }
.tfdp-calendar-agenda a {
  min-height: 50px;
  padding: 11px 13px;
  display: grid;
  grid-template-columns: 48px 1fr;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--tfdp-line);
  border-radius: 11px;
  background: #fff;
  color: var(--tfdp-ink);
  text-decoration: none;
}
.tfdp-calendar-agenda a strong { color: var(--tfdp-orange); text-align: center; }
.tfdp-calendar-empty { padding: 16px; border-radius: 11px; background: #fff; color: var(--tfdp-muted); }

/* Report incorrect information. */
.tfdp-report {
  margin-top: 28px;
  padding: clamp(20px, 4vw, 34px);
  border: 1px solid #cfe0dc;
  border-radius: 18px;
  background: linear-gradient(135deg, #f1faf7, #fffaf2);
}
.tfdp-report-kicker { margin: 0 0 5px; color: var(--tfdp-teal); font-weight: 900; letter-spacing: .04em; }
.tfdp-report h2 { margin: 0 0 8px; color: var(--tfdp-ink); }
.tfdp-report-form { margin-top: 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.tfdp-report-form label { display: grid; gap: 6px; color: var(--tfdp-ink); font-weight: 700; }
.tfdp-report-form .full { grid-column: 1 / -1; }
.tfdp-report-form input,
.tfdp-report-form textarea {
  width: 100%;
  min-height: 46px;
  box-sizing: border-box;
  border: 1px solid #d9ccbb;
  border-radius: 9px;
  background: #fff;
  padding: 10px 12px;
  color: var(--tfdp-ink);
  font: inherit;
}
.tfdp-consent { grid-template-columns: auto 1fr !important; align-items: start; font-weight: 500 !important; }
.tfdp-consent input { width: 20px; min-height: 20px; margin-top: 2px; }
.tfdp-report-actions { display: flex !important; flex-wrap: wrap; align-items: center; gap: 10px; }
.tfdp-report-actions button,
.tfdp-report-actions a {
  min-height: 46px;
  padding: 10px 16px;
  display: inline-flex;
  align-items: center;
  border: 0;
  border-radius: 9px;
  font: inherit;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}
.tfdp-report-actions button { background: var(--tfdp-orange); color: #fff; }
.tfdp-report-actions a { border: 1px solid var(--tfdp-teal); color: var(--tfdp-teal); }
.tfdp-honeypot { position: absolute !important; left: -9999px !important; width: 1px !important; height: 1px !important; overflow: hidden !important; }
.tfdp-notice { padding: 12px 14px; border-radius: 9px; font-weight: 700; }
.tfdp-notice.success { background: #dff2e8; color: #185d41; }
.tfdp-notice.error { background: #fff0e8; color: #973f20; }

.tfdp-footer { margin-top: 0; background: #104f50; color: #dbe9e6; }
.tfdp-footer-grid {
  padding-block: 34px;
  display: grid;
  grid-template-columns: 1.5fr repeat(4, 1fr);
  gap: 28px;
}
.tfdp-footer h2 { margin: 0 0 9px; color: #fff; font-size: 14px; }
.tfdp-footer a { min-height: 32px; display: flex; align-items: center; color: #dbe9e6; text-decoration: none; font-size: 13px; }
.tfdp-footer a:hover { color: #fff; text-decoration: underline; }
.tfdp-footer-brand strong { color: #fff; font: 700 25px/1 Georgia, "Noto Serif Thai", serif; }
.tfdp-footer-brand p { max-width: 270px; margin: 12px 0 0; color: #bfd2cf; font-size: 13px; line-height: 1.7; }
.tfdp-footer-bottom {
  min-height: 48px;
  padding: 10px 20px;
  display: flex;
  justify-content: center;
  gap: 10px;
  border-top: 1px solid rgba(255,255,255,.14);
  color: #afc7c4;
  font-size: 12px;
}

@media (max-width: 1100px) {
  .tfdp-header .tfdp-shell { grid-template-columns: minmax(205px, 1fr) auto auto; gap: 10px; }
  .tfdp-brand small { display: none; }
  .tfdp-nav a { padding-inline: 7px; font-size: 12px; }
  .tfdp-support { width: 44px; padding: 0; font-size: 0; }
  .tfdp-support span { font-size: 20px; }
  .tfdp-footer-grid { grid-template-columns: 1.5fr repeat(3, 1fr); }
  .tfdp-footer-grid > div:last-child { display: none; }
}

@media (max-width: 900px) {
  .tfdp-header .tfdp-shell { grid-template-columns: 1fr auto auto; }
  .tfdp-nav { display: none; }
  .tfdp-mobile { display: block; }
  .tfdp-actions .tfdp-support { display: none; }
  .tfdp-footer-grid { grid-template-columns: 1.5fr 1fr 1fr; }
  .tfdp-footer-grid > div:nth-child(4) { display: none; }
}

@media (max-width: 720px) {
  .tfdp-shell { width: min(100% - 24px, 1240px); }
  .tfdp-header,
  .tfdp-header .tfdp-shell { min-height: 64px; }
  .tfdp-brand img { width: 39px; height: 39px; }
  .tfdp-brand strong { font-size: 20px; }
  .tfdp-actions { display: none; }
  .tfdp-mobile-menu {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: min(70vh, 420px);
    overflow-y: auto;
  }
  .tfdp-unified-page .tfd-hero,
  .tfdp-unified-page .tfd-info-hero,
  .tfdp-unified-page .tfdsrc-hero { padding: 42px 16px !important; }
  .tfdp-unified-page .tfd h1,
  .tfdp-unified-page .tfd-privacy h1,
  .tfdp-unified-page .tfd-info h1,
  .tfdp-unified-page .tfdsrc h1 { font-size: clamp(30px, 9vw, 36px) !important; }
  .tfdsrc-tablewrap { display: none !important; }
  .tfdp-source-cards { display: grid; gap: 12px; }
  .tfdp-source-pager { justify-content: stretch; }
  .tfdp-source-pager-status { order: -1; width: 100%; }
  .tfdp-source-pager button { flex: 1; }
  .tfdp-calendar-agenda { display: block; }
  .tfdp-report-form { grid-template-columns: 1fr; }
  .tfdp-report-form .full { grid-column: auto; }
  .tfdp-footer-grid { grid-template-columns: 1fr 1fr; gap: 22px; }
  .tfdp-footer-grid > div:first-child { grid-column: 1 / -1; }
  .tfdp-footer-grid > div:nth-child(4),
  .tfdp-footer-grid > div:nth-child(5) { display: block; }
  .tfdp-footer-bottom { flex-direction: column; align-items: center; gap: 2px; }
}

@media (max-width: 340px) {
  .tfdp-mobile-menu { width: calc(100vw - 48px); }
}
