/*
Theme Name: BKT School Theme
Theme URI: https://bkt-school.duckdns.org
Author: โรงเรียนบ้านเขากระแต
Author URI: https://bkt-school.duckdns.org
Description: Custom theme for Baan Khao Kra-Tae School — Modern Thai School
Version: 1.0
License: GNU General Public License v2
Text Domain: bkt-theme
*/

/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --green-dark:   #155730;
  --green-main:   #1a6b3c;
  --green-mid:    #2d9b5a;
  --green-light:  #e8f5ee;
  --green-pale:   #f4f9f5;
  --green-border: #c8e0cf;
  --gold:         #d4a017;
  --white:        #ffffff;
  --text-dark:    #1a2e22;
  --text-mid:     #4a6357;
  --text-muted:   #7a9585;
  --border:       rgba(0,0,0,0.08);
  --shadow-sm:    0 1px 4px rgba(0,0,0,0.06);
  --shadow-md:    0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg:    0 8px 32px rgba(0,0,0,0.10);
  --radius-sm:    6px;
  --radius-md:    10px;
  --radius-lg:    14px;
  --font-thai:    'Sarabun', 'Noto Sans Thai', sans-serif;
  --transition:   0.2s ease;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-thai);
  font-size: 16px;
  color: var(--text-dark);
  background: var(--white);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }

/* ===== TYPOGRAPHY ===== */
h1, h2, h3, h4 { font-weight: 600; line-height: 1.3; color: var(--text-dark); }
h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); }
h2 { font-size: clamp(1.3rem, 3vw, 1.7rem); }
h3 { font-size: 1.1rem; }

/* ===== CONTAINER ===== */
.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

/* ===== TOP BAR ===== */
.topbar {
  background: var(--green-dark);
  color: rgba(255,255,255,0.75);
  font-size: 12px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.topbar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.topbar a { color: rgba(255,255,255,0.75); transition: color var(--transition); }
.topbar a:hover { color: white; }
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 16px; }

/* ===== HEADER / NAV ===== */
.site-header {
  background: var(--green-main);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 20px;
}
.site-logo { display: flex; align-items: center; gap: 12px; }
.logo-emblem {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.3);
}
.logo-emblem img { width: 40px; height: 40px; object-fit: contain; }

/* Fix WordPress custom logo — prevent centering override */
.site-logo .custom-logo-link { display: contents; }
.site-logo .custom-logo-link img { width: 40px; height: 40px; object-fit: contain; display: block; }
.site-header .wp-block-site-logo { margin: 0; }
.logo-text-abbr {
  font-size: 11px;
  font-weight: 700;
  color: var(--green-main);
  text-align: center;
  line-height: 1.2;
}
.logo-text { color: white; }
.logo-text strong { display: block; font-size: 14px; font-weight: 600; line-height: 1.3; }
.logo-text span { font-size: 11px; opacity: 0.75; font-weight: 400; }

.main-nav ul { display: flex; align-items: center; gap: 4px; }
.main-nav a {
  color: rgba(255,255,255,0.85);
  font-size: 13px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
}
.main-nav a:hover,
.main-nav .current-menu-item > a {
  background: rgba(255,255,255,0.15);
  color: white;
}

.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: white;
}
.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: white;
  margin: 4px 0;
  border-radius: 2px;
  transition: var(--transition);
}

/* ===== HERO ===== */
.hero {
  background: linear-gradient(160deg, var(--green-main) 0%, var(--green-dark) 100%);
  padding: 56px 0 44px;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}
.hero-content { position: relative; text-align: center; }
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.9);
  font-size: 12px;
  padding: 5px 14px;
  border-radius: 20px;
  margin-bottom: 14px;
  border: 1px solid rgba(255,255,255,0.2);
}
.hero h1 { color: white; font-size: clamp(1.6rem, 4vw, 2.4rem); margin-bottom: 4px; }
.hero-en { color: rgba(255,255,255,0.65); font-size: 13px; letter-spacing: 1px; margin-bottom: 14px; }

.hero-motto {
  display: inline-block;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--radius-md);
  padding: 10px 22px;
  margin-bottom: 10px;
}
.hero-motto p { color: white; font-size: 14px; font-weight: 600; }
.hero-motto span { color: rgba(255,255,255,0.65); font-size: 12px; display: block; margin-top: 2px; }

.hero-addr {
  color: rgba(255,255,255,0.6);
  font-size: 12px;
  margin-bottom: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.hero-addr svg { width: 14px; height: 14px; flex-shrink: 0; }

.hero-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 28px; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 20px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: transform var(--transition), box-shadow var(--transition), opacity var(--transition);
  font-family: var(--font-thai);
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-white { background: white; color: var(--green-main); }
.btn-outline { background: transparent; color: white; border: 1px solid rgba(255,255,255,0.45); }
.btn-outline:hover { background: rgba(255,255,255,0.1); }
.btn-primary { background: var(--green-main); color: white; }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.hero-gallery {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  max-width: 700px;
  margin: 0 auto;
}
.gallery-slot {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius-md);
  aspect-ratio: 4/3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: rgba(255,255,255,0.6);
  font-size: 11px;
  overflow: hidden;
  transition: background var(--transition);
}
.gallery-slot:hover { background: rgba(255,255,255,0.13); }
.gallery-slot img { width: 100%; height: 100%; object-fit: cover; border-radius: var(--radius-md); }
.gallery-slot svg { width: 24px; height: 24px; }

/* ===== STATS BAR ===== */
.stats-bar {
  background: var(--green-pale);
  border-top: 1px solid var(--green-border);
  border-bottom: 1px solid var(--green-border);
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}
.stat-item {
  padding: 18px 10px;
  text-align: center;
  border-right: 1px solid var(--green-border);
}
.stat-item:last-child { border-right: none; }
.stat-num { font-size: 26px; font-weight: 700; color: var(--green-main); line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ===== VISION STRIP ===== */
.vision-strip {
  background: var(--green-pale);
  border-bottom: 1px solid var(--green-border);
  padding: 28px 0;
}
.vision-inner { text-align: center; }
.section-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--green-light);
  color: var(--green-main);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 10px;
  border: 1px solid var(--green-border);
}
.section-tag svg { width: 13px; height: 13px; }
.vision-text {
  font-size: 14px;
  color: var(--text-mid);
  line-height: 1.8;
  max-width: 780px;
  margin: 0 auto 18px;
  font-style: italic;
}
.vision-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  max-width: 780px;
  margin: 0 auto;
}
.vision-card {
  background: white;
  border: 1px solid var(--green-border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  text-align: left;
}
.vision-card-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--green-main);
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.vision-card-label svg { width: 13px; height: 13px; }
.vision-card p { font-size: 12px; color: var(--text-mid); line-height: 1.7; }

/* ===== SECTION HEADER ===== */
.section { padding: 40px 0; }
.section-alt { background: var(--green-pale); }
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-dark);
}
.section-title::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 20px;
  background: var(--green-main);
  border-radius: 2px;
}
.see-all {
  font-size: 13px;
  color: var(--green-main);
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
  transition: gap var(--transition);
}
.see-all:hover { gap: 8px; }

/* ===== NEWS CARDS ===== */
.news-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.news-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}
.news-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}
.news-img {
  height: 140px;
  background: var(--green-light);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}
.news-img img { width: 100%; height: 100%; object-fit: cover; }
.news-img-placeholder { color: var(--green-mid); }
.news-img-placeholder svg { width: 36px; height: 36px; opacity: 0.5; }
.news-tag-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: var(--green-main);
  color: white;
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 500;
}
.news-body { padding: 14px 16px; }
.news-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--text-dark);
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.news-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
}
.news-meta svg { width: 13px; height: 13px; flex-shrink: 0; }

/* ===== TWO COLUMN LAYOUT ===== */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* ===== DOWNLOAD LIST ===== */
.download-list {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.download-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.download-item:last-child { border-bottom: none; }
.download-item:hover { background: var(--green-pale); }
.file-icon {
  width: 36px;
  height: 36px;
  background: var(--green-light);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--green-main);
}
.file-icon svg { width: 18px; height: 18px; }
.file-info { flex: 1; min-width: 0; }
.file-name { font-size: 13px; font-weight: 500; color: var(--text-dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-meta { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.btn-download {
  background: var(--green-light);
  color: var(--green-main);
  border: none;
  border-radius: var(--radius-sm);
  padding: 5px 11px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  transition: background var(--transition);
  font-family: var(--font-thai);
  text-decoration: none;
}
.btn-download:hover { background: var(--green-border); }
.btn-download svg { width: 13px; height: 13px; }

/* ===== YOUTUBE SECTION ===== */
.yt-main-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 10px;
}
.yt-thumb {
  background: #111;
  aspect-ratio: 16/9;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}
.yt-thumb iframe { width: 100%; height: 100%; border: none; }
.yt-play-btn {
  width: 52px;
  height: 52px;
  background: #ff0000;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
}
.yt-play-btn svg { width: 22px; height: 22px; color: white; margin-left: 3px; }
.yt-body { padding: 12px 14px; }
.yt-title { font-size: 13px; font-weight: 500; color: var(--text-dark); margin-bottom: 4px; }
.yt-meta { font-size: 11px; color: var(--text-muted); display: flex; align-items: center; gap: 5px; }
.yt-meta svg { width: 14px; height: 14px; color: #cc0000; }
.yt-list { display: flex; flex-direction: column; gap: 8px; }
.yt-list-item {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  transition: background var(--transition);
}
.yt-list-item:hover { background: var(--green-pale); }
.yt-list-icon {
  width: 32px;
  height: 32px;
  background: #ffe8e8;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.yt-list-icon svg { width: 16px; height: 16px; color: #cc0000; }

/* ===== FOOTER ===== */
.site-footer {
  background: var(--green-main);
  padding: 36px 0 0;
  margin-top: 0;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 30px;
  padding-bottom: 28px;
}
.footer-brand { display: flex; flex-direction: column; gap: 10px; }
.footer-logo { display: flex; align-items: center; gap: 10px; }
.footer-logo-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.footer-logo-circle img { width: 36px; height: 36px; object-fit: contain; }
.footer-logo-text { color: white; font-size: 13px; font-weight: 600; line-height: 1.3; }
.footer-logo-text span { display: block; font-size: 10px; font-weight: 400; opacity: 0.7; }
.footer-desc { color: rgba(255,255,255,0.65); font-size: 12px; line-height: 1.8; }
.footer-col h4 { color: white; font-size: 13px; font-weight: 600; margin-bottom: 12px; }
.footer-col p, .footer-col a {
  color: rgba(255,255,255,0.65);
  font-size: 12px;
  line-height: 2;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  transition: color var(--transition);
}
.footer-col a:hover { color: white; }
.footer-col svg { width: 13px; height: 13px; flex-shrink: 0; margin-top: 4px; }

.footer-bottom {
  background: var(--green-dark);
  padding: 12px 0;
  border-top: 1px solid rgba(255,255,255,0.1);
}
.footer-bottom-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.footer-bottom p { color: rgba(255,255,255,0.45); font-size: 11px; }
.footer-bottom a { color: rgba(255,255,255,0.45); font-size: 11px; transition: color var(--transition); }
.footer-bottom a:hover { color: rgba(255,255,255,0.8); }

/* ===== MOBILE MENU ===== */
.mobile-nav {
  display: none;
  background: var(--green-dark);
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.35s ease;
}
.mobile-nav.open { max-height: 400px; }
.mobile-nav ul { padding: 8px 0; }
.mobile-nav a {
  display: block;
  padding: 10px 20px;
  color: rgba(255,255,255,0.85);
  font-size: 14px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.mobile-nav a:hover { background: rgba(255,255,255,0.07); color: white; }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .main-nav { display: none; }
  .hamburger { display: flex; flex-direction: column; }
  .mobile-nav { display: block; }
  .hero-gallery { grid-template-columns: repeat(2, 1fr); }
  .news-grid { grid-template-columns: repeat(2, 1fr); }
  .vision-cards { grid-template-columns: 1fr 1fr; }
  .two-col { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 600px) {
  .hero { padding: 36px 0 28px; }
  .news-grid { grid-template-columns: 1fr; }
  .hero-gallery { grid-template-columns: repeat(2, 1fr); }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .vision-cards { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .topbar-right { display: none; }
  .footer-bottom-inner { flex-direction: column; text-align: center; }
}

/* ===== GOOGLE FONTS FALLBACK ===== */
@import url('https://fonts.googleapis.com/css2?family=Sarabun:wght@300;400;500;600;700&display=swap');
