/* Public Site Styles */
@font-face {
    font-family: 'TH SarabunPSK';
    src: url('../fonts/THSarabunNew.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
}
@font-face {
    font-family: 'TH SarabunPSK';
    src: url('../fonts/THSarabunNew-Bold.woff2') format('woff2');
    font-weight: bold;
    font-style: normal;
}

* { box-sizing: border-box; }

:root {
    --site-font:         'TH SarabunPSK', 'Sarabun', sans-serif;
    --site-font-heading: 'TH SarabunPSK', 'Sarabun', sans-serif;
    --site-font-nav:     'TH SarabunPSK', 'Sarabun', sans-serif;
    --site-font-size:         18px;
    --site-font-size-heading: 28px;
    --site-font-size-nav:     15px;
    --color-primary:    #1d4ed8;
    --color-secondary:  #1e40af;
    --color-accent:     #f59e0b;
    --color-text:       #1f2937;
    --color-bg:         #f9fafb;
    --color-header-bg:  #ffffff;
    --color-footer-bg:  #1f2937;
    --color-header-text:#1f2937;
    --btn-bg:           #1d4ed8;
    --btn-radius:       8px;
    --header-bg:        #ffffff;
    --footer-bg:        #1f2937;
}

html, body,
body *, body *::before, body *::after {
    font-family: var(--site-font) !important;
}

body {
    font-family: var(--site-font) !important;
    font-size: var(--site-font-size, 18px) !important;
    color: var(--color-text, #1f2937) !important;
    background: var(--color-bg, #f9fafb) !important;
}

/* Container */
.container { width: 100%; max-width: 1200px; margin: 0 auto; }

/* ── Page row grid layout (Tailwind tailwind.min.css ไม่มีครบ) ── */
.grid { display: grid; }
.gap-6 { gap: 1.5rem; }
.min-w-0 { min-width: 0; }

/* Grid template columns */
.col-span-1  { grid-column: span 1  / span 1; }
.col-span-2  { grid-column: span 2  / span 2; }
.col-span-3  { grid-column: span 3  / span 3; }
.col-span-4  { grid-column: span 4  / span 4; }
.col-span-5  { grid-column: span 5  / span 5; }
.col-span-6  { grid-column: span 6  / span 6; }
.col-span-7  { grid-column: span 7  / span 7; }
.col-span-8  { grid-column: span 8  / span 8; }
.col-span-9  { grid-column: span 9  / span 9; }
.col-span-10 { grid-column: span 10 / span 10; }
.col-span-11 { grid-column: span 11 / span 11; }
.col-span-12 { grid-column: span 12 / span 12; }

/* Responsive: mobile = full width, desktop (lg) = col-span */
@media (min-width: 1024px) {
    .lg\:col-span-1  { grid-column: span 1  / span 1; }
    .lg\:col-span-2  { grid-column: span 2  / span 2; }
    .lg\:col-span-3  { grid-column: span 3  / span 3; }
    .lg\:col-span-4  { grid-column: span 4  / span 4; }
    .lg\:col-span-5  { grid-column: span 5  / span 5; }
    .lg\:col-span-6  { grid-column: span 6  / span 6; }
    .lg\:col-span-7  { grid-column: span 7  / span 7; }
    .lg\:col-span-8  { grid-column: span 8  / span 8; }
    .lg\:col-span-9  { grid-column: span 9  / span 9; }
    .lg\:col-span-10 { grid-column: span 10 / span 10; }
    .lg\:col-span-11 { grid-column: span 11 / span 11; }
    .lg\:col-span-12 { grid-column: span 12 / span 12; }
}

/* Grid template columns */
.grid-cols-1  { grid-template-columns: repeat(1,  minmax(0, 1fr)); }
.grid-cols-2  { grid-template-columns: repeat(2,  minmax(0, 1fr)); }
.grid-cols-3  { grid-template-columns: repeat(3,  minmax(0, 1fr)); }
.grid-cols-4  { grid-template-columns: repeat(4,  minmax(0, 1fr)); }
.grid-cols-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }
@media (min-width: 768px) {
    .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
    .lg\:grid-cols-1  { grid-template-columns: repeat(1,  minmax(0, 1fr)); }
    .lg\:grid-cols-2  { grid-template-columns: repeat(2,  minmax(0, 1fr)); }
    .lg\:grid-cols-3  { grid-template-columns: repeat(3,  minmax(0, 1fr)); }
    .lg\:grid-cols-4  { grid-template-columns: repeat(4,  minmax(0, 1fr)); }
    .lg\:grid-cols-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }
}

/* Gap utilities */
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.gap-8 { gap: 2rem; }

/* Prose content */
.prose { line-height: 1.8; }
.prose h1, .prose h2, .prose h3, .prose h4 { font-weight: bold; margin: 1.2em 0 0.6em; color: #1f2937; }
.prose h1 { font-size: 2em; }
.prose h2 { font-size: 1.6em; }
.prose h3 { font-size: 1.3em; }
.prose p { margin: 0.8em 0; }
.prose ul, .prose ol { padding-left: 1.5em; margin: 0.8em 0; }
.prose li { margin: 0.3em 0; }
.prose table { width: 100%; border-collapse: collapse; margin: 1em 0; }
.prose table th, .prose table td { border: 1px solid #e5e7eb; padding: 8px 12px; text-align: left; }
.prose table th { background: #f9fafb; font-weight: 600; }
.prose img { max-width: 100%; height: auto; border-radius: 0.5rem; margin: 0.5em 0; }
.prose a { color: var(--color-primary, #1d4ed8); text-decoration: underline; }
.prose blockquote { border-left: 4px solid var(--color-primary, #1d4ed8); padding-left: 1em; color: #6b7280; margin: 1em 0; font-style: italic; }
.prose pre { background: #1f2937; color: #e5e7eb; padding: 1em; border-radius: 0.5rem; overflow-x: auto; font-size: 0.85em; }

/* Hero gradient presets */
.bg-gradient-to-r { background-image: linear-gradient(to right, var(--tw-gradient-stops)); }
.from-blue-700   { --tw-gradient-from: #1d4ed8; --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to, rgba(29,78,216,0)); }
.to-indigo-800   { --tw-gradient-to: #3730a3; }
.from-green-700  { --tw-gradient-from: #15803d; --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to, rgba(21,128,61,0)); }
.to-teal-800     { --tw-gradient-to: #0f766e; }
.from-purple-700 { --tw-gradient-from: #7e22ce; --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to, rgba(126,34,206,0)); }
.from-red-600    { --tw-gradient-from: #dc2626; --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to, rgba(220,38,38,0)); }
.to-rose-700     { --tw-gradient-to: #be123c; }
.from-orange-500 { --tw-gradient-from: #f97316; --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to, rgba(249,115,22,0)); }
.to-amber-600    { --tw-gradient-to: #d97706; }
.from-gray-700   { --tw-gradient-from: #374151; --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to, rgba(55,65,81,0)); }
.to-gray-900     { --tw-gradient-to: #111827; }

/* Line clamp */
.line-clamp-2 {
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-clamp: 2;
}

/* Owl Carousel customization */
.owl-banner .owl-nav button { 
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.8) !important;
    width: 44px;
    height: 44px;
    border-radius: 50% !important;
    font-size: 1.5rem !important;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #1f2937 !important;
    transition: all 0.2s;
}
.owl-banner .owl-nav button.owl-prev { left: 16px; }
.owl-banner .owl-nav button.owl-next { right: 16px; }
.owl-banner .owl-nav button:hover { background: rgba(255,255,255,1) !important; }
.owl-banner .owl-dots { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); }
.owl-banner .owl-dot span { background: rgba(255,255,255,0.6) !important; }
.owl-banner .owl-dot.active span { background: #fff !important; }

/* Primary button using CSS variable */
.btn-site, .btn-primary {
    background: var(--btn-bg, #1d4ed8) !important;
    border-radius: var(--btn-radius, 8px) !important;
    color: #fff !important;
    transition: filter 0.2s, opacity 0.2s;
}
.btn-site:hover, .btn-primary:hover {
    filter: brightness(1.12) !important;
    opacity: .92;
}

/* Card hover effect */
article:hover { transform: translateY(-2px); transition: all 0.2s; }

/* Block card/list/table: hover ใช้ --color-primary */
.block-card-title:hover { color: var(--color-primary, #1d4ed8) !important; }
.block-list-item:hover .block-list-title { color: var(--color-primary, #1d4ed8) !important; }
.block-list-item:hover { border-color: var(--color-primary, #1d4ed8) !important; opacity: .9; }
.block-table-row:hover { background: color-mix(in srgb, var(--color-primary, #1d4ed8) 6%, #fff) !important; }
.block-table-link:hover { color: var(--color-primary, #1d4ed8) !important; }

/* Header / Footer — use computed bg (may be gradient) */
header { box-shadow: 0 1px 3px rgba(0,0,0,0.08); background: var(--header-bg, var(--color-header-bg, #ffffff)) !important; }
footer { background: var(--footer-bg, var(--color-footer-bg, #1f2937)) !important; }
/* Heading font */
h1,h2,h3,h4,h5,h6 { font-family: var(--site-font-heading) !important; }

/* Nav dropdown hover */
.nav-sub-link:hover { background: color-mix(in srgb, var(--color-primary, #1d4ed8) 8%, #fff) !important; color: var(--color-primary, #1d4ed8) !important; }

/* Desktop nav dropdown */
nav ul li { position: relative; }
nav ul li ul {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: #fff;
    min-width: 200px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.10);
    border: 1px solid #f1f5f9;
    border-radius: 0.5rem;
    padding: 4px 0;
    z-index: 50;
}
nav ul li:hover > ul { display: block; }
/* Sub-sub dropdown: open to the right */
nav ul li ul li ul {
    top: 0;
    left: 100%;
    border-radius: 0.5rem;
}
nav ul li ul li:hover > ul { display: block; }
nav ul li ul a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    font-size: 0.875rem;
    color: #374151;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}
nav ul li ul a:hover { background: color-mix(in srgb, var(--color-primary, #1d4ed8) 8%, #fff); color: var(--color-primary, #1d4ed8); }

/* Mobile nav */
#mobile-menu a { display: block; padding: 8px 16px; font-size: 0.9rem; color: #374151; transition: color 0.15s; }
#mobile-menu a:hover { color: var(--color-primary, #1d4ed8); }

/* Breadcrumb */
nav[aria-label="Breadcrumb"] a:hover { color: #fff; }

/* Pagination */
nav.flex.items-center.justify-center a {
    min-width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 0.875rem;
    transition: all 0.15s;
}

/* Section heading border */
h2.section-title {
    position: relative;
    padding-left: 1rem;
    border-left: 4px solid var(--color-primary, #1d4ed8);
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

/* Responsive */
@media (max-width: 768px) {
    body { font-size: 16px; }
    .prose h1 { font-size: 1.6em; }
    .prose h2 { font-size: 1.4em; }
}

/* Footer */
footer a { transition: color 0.15s; }
footer a:hover { color: #fff; }
