/*
Theme Name: WatlumSchool Theme
Theme URI: https://example.com/watlumschool
Author: You
Author URI: https://example.com
Description: A modern, responsive WordPress theme for schools with customizable branding, navbar, footer, and primary color.
Version: 1.0.0
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: watlumschool
Tags: education, school, responsive, custom-logo, custom-colors
*/

/* CSS Variables (customized via Customizer) */
:root {
  --primary-color: #0ea5e9; /* default primary color */
  --text-color: #0f172a;
  --muted-color: #475569;
  --bg-color: #ffffff;
  --header-bg: #ffffffaa;
  --footer-bg: #0f172a;
  --footer-text: #e2e8f0;
  /* Motion */
  --motion-duration: .25s;
  --motion-ease: cubic-bezier(.2,.6,.2,1);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
/* Prevent horizontal scrollbar flicker during menu animations */
html { overflow-x: clip; }
body {
  color: var(--text-color);
  background: var(--bg-color);
  font-family: var(--primary-font, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Noto Sans Thai", "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji");
  line-height: 1.6;
  /* Sticky footer layout */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--primary-color); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; }
/* Make .container inside .footer-bottom full width */
.footer-bottom.container {
  max-width: 100vw !important;
  width: 100vw !important;
  margin: 0 !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

/* Make the main footer inner row span the full viewport so the map can sit flush to the right edge */
.site-footer .footer-inner.container {
  max-width: 100vw !important;
  width: 100vw !important;
  margin: 0 !important;
  padding-left: 32px; /* keep some inner spacing */
  padding-right: 32px;
}

/* Give the map column a fixed width so it stays anchored to the right */
.site-footer .footer-map {
  flex: 0 0 300px;
  max-width: 420px;
  justify-content: flex-end;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  backdrop-filter: saturate(180%) blur(12px);
  background: var(--header-bg);
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; }
.branding { display: flex; align-items: center; gap: 12px; min-width: 0; }
.branding-logo img { height: 40px; width: auto; }
.branding-text { display: flex; flex-direction: column; min-width: 0; }
.site-title { font-size: 1.125rem; font-weight: 700; margin: 0; color: var(--text-color); }
.site-title a { color: inherit; text-decoration: none; }
.site-description { margin: 0; color: var(--muted-color); font-size: 0.875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Banner */
.site-banner { position: relative; width: 100%; min-height: var(--banner-height, 300px); background-size: cover; background-position: center; background-repeat: no-repeat; }
.site-banner::before { content: ""; position: absolute; inset: 0; background: rgba(0,0,0, calc(var(--banner-overlay, 30)/100)); }
.map-container {
  float: right;
  margin-right: 0px; /* ปรับระยะห่างตามต้องการ */
}
.site-banner .banner-inner { position: relative; z-index: 1; display: flex; align-items: center; min-height: var(--banner-height, 300px); }
.site-banner .banner-title { color: #fff; margin: 0; font-size: clamp(1.25rem, 2.4vw + 0.8rem, 2rem); text-shadow: 0 2px 6px rgba(0,0,0,.25); }

/* Navbar */
.navbar { display: flex; align-items: center; gap: 8px; position: relative; }
.menu-toggle {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-color);
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  line-height: 0;
}
.menu-toggle svg { display: block; width: 22px; height: 22px; }
.menu-toggle:focus-visible { outline: 2px solid var(--primary-color); outline-offset: 3px; }

/* Animated hamburger -> X */
.menu-toggle { position: relative; }
.menu-toggle .burger { position: relative; display: block; width: 22px; height: 2px; background: currentColor; border-radius: 2px; margin: 0 auto; transition: transform var(--motion-duration) var(--motion-ease), background var(--motion-duration) var(--motion-ease); }
.menu-toggle .burger::before,
.menu-toggle .burger::after { content: ""; position: absolute; left: 0; width: 22px; height: 2px; background: currentColor; border-radius: 2px; transform-origin: center; transition: transform var(--motion-duration) var(--motion-ease), top var(--motion-duration) var(--motion-ease), opacity var(--motion-duration) var(--motion-ease); }
.menu-toggle .burger::before { top: -7px; }
.menu-toggle .burger::after { top: 7px; }
.menu-toggle.is-open .burger { background: transparent; }
.menu-toggle.is-open .burger::before { top: 0; transform: rotate(45deg); }
.menu-toggle.is-open .burger::after { top: 0; transform: rotate(-45deg); }

/* removed: language switcher styles */

.primary-nav { display: block; }
.primary-menu { list-style: none; margin: 0; padding: 0; display: flex; gap: 8px; }
.primary-menu li { position: relative; }
.primary-menu a { display: block; padding: 10px 12px; border-radius: 8px; color: var(--text-color); }
.primary-menu a:hover, .primary-menu .current-menu-item > a { background: color-mix(in oklab, var(--primary-color) 12%, white); color: #0b1324; text-decoration: none; }

/* Submenus */
.primary-menu .sub-menu, .primary-menu .children { display: block; position: absolute; top: 100%; left: 0; min-width: 320px; background: #fff; padding: 6px; margin: 0; list-style: none; box-shadow: 0 10px 30px rgba(2,6,23,0.12); border: 1px solid rgba(2,6,23,0.06); border-radius: 10px; z-index: 1000; opacity: 0; transform: translateY(6px); visibility: hidden; pointer-events: none; transition: opacity var(--motion-duration) var(--motion-ease), transform var(--motion-duration) var(--motion-ease), visibility 0s linear var(--motion-duration); contain: layout paint; will-change: transform, opacity; }
.primary-menu li:hover > .sub-menu,
.primary-menu li:hover > .children,
.primary-menu li:focus-within > .sub-menu,
.primary-menu li:focus-within > .children { opacity: 1; transform: translateY(0); visibility: visible; pointer-events: auto; transition-delay: 0s, 0s, 0s; }
.primary-menu .sub-menu a, .primary-menu .children a { border-radius: 8px; display: flex; align-items: center; gap: 10px; padding: 10px 14px; }
/* (reverted) no extra hover slide for submenu links */
.primary-menu .sub-menu a::before, .primary-menu .children a::before {
  content: "";
  width: 14px; height: 14px; flex: 0 0 14px;
  background-color: var(--primary-color);
  /* right-chevron icon via mask so it inherits color */
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 6l6 6-6 6'/%3E%3C/svg%3E") no-repeat center / contain;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 6l6 6-6 6'/%3E%3C/svg%3E") no-repeat center / contain;
}
.primary-menu .menu-item-has-children > a::after, .primary-menu .page_item_has_children > a::after { content: "▾"; margin-left: 6px; font-size: 0.8em; }
/* (reverted) no hover rotation for carets on desktop */

/* (reverted) remove desktop underline hover animation */

/* Mobile nav */
@media (max-width: 900px) {
  .navbar { position: static; }
  .menu-toggle { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 38px; padding: 0; background: transparent; border: none; }
  .primary-nav { position: absolute; left: 0; right: 0; top: 100%; background: #fff; box-shadow: 0 10px 30px rgba(2,6,23,0.08); border-bottom: 1px solid rgba(2,6,23,0.06); visibility: hidden; opacity: 0; transform: translateY(-8px); transition: opacity var(--motion-duration) var(--motion-ease), transform var(--motion-duration) var(--motion-ease), visibility 0s linear var(--motion-duration); }
  .primary-nav.is-open { visibility: visible; opacity: 1; transform: translateY(0); transition-delay: 0s, 0s, 0s; }
  .primary-menu { flex-direction: column; padding: 4px 0; }
  .primary-menu > li { border-bottom: 1px solid rgba(2,6,23,0.08); }
  .primary-menu > li:last-child { border-bottom: 0; }
  .primary-menu > li > a { border-radius: 0; background: transparent !important; color: var(--text-color); padding: 14px 16px; }
  .primary-menu > li > a:hover { background: color-mix(in oklab, var(--primary-color) 8%, white); text-decoration: none; }
  /* Align caret to the right and rotate when open */
  .primary-menu .menu-item-has-children > a,
  .primary-menu .page_item_has_children > a { position: relative; padding-right: 40px; cursor: pointer; }
  .primary-menu .menu-item-has-children > a::after,
  .primary-menu .page_item_has_children > a::after { position: absolute; right: 12px; transition: transform .2s ease; }
  .primary-menu .menu-item-has-children.open > a::after,
  .primary-menu .page_item_has_children.open > a::after { transform: rotate(180deg); }
  .primary-menu .sub-menu, .primary-menu .children { position: static; display: block; box-shadow: none; border: 0; padding: 0 0 0 10px; margin: 0; max-height: 0; overflow: hidden; opacity: 0; visibility: hidden; pointer-events: none; transition: max-height var(--motion-duration) var(--motion-ease), opacity var(--motion-duration) var(--motion-ease), margin var(--motion-duration) var(--motion-ease); }
  .primary-menu .menu-item-has-children.open > .sub-menu,
  .primary-menu .page_item_has_children.open > .children { max-height: 1000px; opacity: 1; margin: 4px 0 8px; visibility: visible; pointer-events: auto; }
}

/* Footer */
.site-footer { 
  background: var(--footer-bg); 
  color: var(--footer-text); 
  margin-top: 48px; 
  width: 100vw;
  margin-left: 50%;
  transform: translateX(-50%);
}
.footer-inner { padding: 32px 0; }
.footer-inner, .footer-bottom { padding-left: 16px; padding-right: 16px; }
/* Footer columns layout */
.footer-inner {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center; /* vertically center content (moves left content down beside the map) */
  gap: 32px;
}
.footer-contact {
  flex: 1 1 300px;
  min-width: 220px;
}
.footer-map {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  margin-left: auto;
  max-width: 700px;
}
.footer-map iframe {
  width: 100%;
  height: 220px;
  border: 0;
  border-radius: 12px;
  box-shadow: 0 2px 16px rgba(0,0,0,0.10);
}
@media (max-width: 900px) {
  .footer-inner {
    flex-direction: column;
    gap: 20px;
    align-items: flex-start; /* restore stacked alignment on small screens */
  }
  .footer-map {
    max-width: 100%;
    justify-content: center;
  }
  .footer-map iframe {
    height: 180px;
  }
}
@media (max-width: 600px) {
  .footer-inner {
    flex-direction: column;
    gap: 12px;
    padding: 20px 0;
  }
  .footer-map iframe {
    height: 140px;
  }
}
@media (max-width: 600px) {
  /* Mobile: show only logo icon, hide title and slogan */
  .branding-text { display: none; }
  /* Keep logo away from edges */
  .site-header .container { padding-left: 16px; padding-right: 16px; }
  .footer-inner { padding: 20px 0; }
  .footer-heading { font-size: 1rem; }
  .footer-text { font-size: 0.95rem; }
  .footer-bottom { font-size: 0.8rem; }
  /* Reset full-width footer on mobile */
  .site-footer { 
    width: 100%; 
    margin-left: 0; 
    transform: none; 
  }
  /* Break out of centered container on small screens so © year sits closer to the left edge */
  .site-footer .footer-bottom { max-width: 100%; width: 100%; margin-left: 0; margin-right: 0; padding-left: 12px; padding-right: 12px; }
  /* Show only the bottom section of the footer on mobile */
  .site-footer .footer-inner { display: none; }
  /* Vertically center the copyright line */
  .site-footer .footer-bottom { display: flex; align-items: center; padding-top: 10px; padding-bottom: 10px; min-height: 44px; }
  .site-footer .footer-bottom p { margin: 0; line-height: 1.4; }
}
@media (min-width: 1024px) {
  .site-footer {
    width: 100vw;
    max-width: 100vw;
    margin-left: 0;
    margin-right: 0;
    left: 50%;
    right: 50%;
    position: relative;
    transform: translateX(-50%);
    border-radius: 0;
  }
    .site-footer .footer-inner {
      text-align: left;
      margin-left: 0;
      margin-right: 0;
      padding-left: 32px;
    }
    .site-footer .footer-bottom {
      display: flex;
      justify-content: center;
      align-items: center;
      text-align: center;
      margin-left: 0;
      margin-right: 0;
      padding-left: 0;
      width: 100%;
      box-sizing: border-box;
    }
}
.footer-heading { margin: 0 0 2px; font-size: 1.125rem; color: #ffffff; }
.footer-text { margin: 0; opacity: 0.92; white-space: pre-line; }
 .footer-bottom {
  border-top: 1px solid color-mix(in oklab, var(--footer-text) 18%, transparent);
  padding: 12px 0 0 0;
  font-size: 0.875rem;
  opacity: 0.85;
  width: 100vw;
  margin-left: 0;
  margin-right: 0;
  box-sizing: border-box;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
 }
 .site-footer a { color: color-mix(in oklab, var(--footer-text) 92%, white); }
 .site-footer a:hover { color: #fff; text-decoration: underline; }

/* Typography tweaks */
h1, h2, h3, h4, h5 { line-height: 3; color: var(--text-color); }
p { margin: 0 0 1rem; }

/* Sticky footer behavior */
main.site-main { flex: 1 1 auto; }
.site-footer { margin-top: auto; }

.cookie-notice {
  position: fixed; right: 16px; bottom: 16px; z-index: 2000;
  transform: translateY(140%); transition: transform .3s ease;
  background: transparent; pointer-events: none;
}
.cookie-notice.is-visible { transform: translateY(0); }
.cookie-notice .inner.card {
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; gap: 10px 14px;
  pointer-events: all; padding: 16px; max-width: 380px;
  margin-left: auto; /* anchor right */
  background: #ffffff; color: #0f172a;
  border: 1px solid rgba(2,6,23,0.08); border-radius: 16px;
  box-shadow: 0 15px 35px rgba(2,6,23,0.15);
}
.cookie-notice .icon { grid-row: 1 / span 2; width: 44px; height: 44px; border-radius: 12px; background: color-mix(in oklab, var(--primary-color) 16%, #fde68a); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.cookie-notice .icon svg { width: 36px; height: 36px; display: block; }
.cookie-notice .title { margin: 0; align-self: center; font-size: 1.1rem; font-weight: 700; }
.cookie-notice .message { grid-column: 2; }
.cookie-notice .message p { margin: 0; color: #334155; }
.cookie-notice .actions { grid-column: 2; display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin-top: 10px; flex: 0 0 auto; }
.cookie-notice .btn-secondary { display: inline-block; text-align: center; background: #fff; color: #0f172a; border: 1px solid rgba(15,23,42,0.2); padding: 12px 18px; border-radius: 12px; cursor: pointer; font-family: var(--primary-font, inherit); font-weight: 600; font-size: 0.985rem; line-height: 1; min-height: 44px; min-width: 118px; letter-spacing: .2px; }
.cookie-notice .btn-secondary:hover { background: #f8fafc; }
.cookie-notice .btn-primary { text-align: center; background: var(--primary-color); color: #fff; border: none; padding: 12px 18px; border-radius: 12px; cursor: pointer; font-family: var(--primary-font, inherit); font-weight: 600; font-size: 0.985rem; line-height: 1; min-height: 44px; min-width: 118px; letter-spacing: .2px; box-shadow: 0 1px 0 rgba(0,0,0,0.05); }
.cookie-notice .btn-primary:hover { filter: brightness(0.97); }
.cookie-notice .message { flex: 1; }
.cookie-notice .message p { margin: 0; }
.cookie-notice .btn-primary:focus-visible, .cookie-notice .btn-secondary:focus-visible { outline: 2px solid color-mix(in oklab, var(--primary-color) 65%, white); outline-offset: 2px; }
.cookie-notice .inner.card, .cookie-notice .title, .cookie-notice .message, .cookie-notice .actions { font-family: var(--primary-font, inherit); }
@media (max-width: 720px) {
  .cookie-notice { right: 12px; left: 12px; bottom: 12px; }
  .cookie-notice .inner.card { max-width: 100%; grid-template-columns: auto 1fr; }
}

/* Back to Top button */
.back-to-top {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 1500;
  width: 44px; height: 44px;
  border-radius: 999px;
  background: var(--primary-color);
  color: #fff;
  border: none;
  display: grid; place-items: center;
  box-shadow: 0 10px 24px rgba(2,6,23,0.18), 0 2px 6px rgba(2,6,23,0.08);
  cursor: pointer;
  opacity: 0; transform: translateY(12px) scale(0.96);
  pointer-events: none;
  transition: opacity var(--motion-duration, .25s) var(--motion-ease, cubic-bezier(.2,.6,.2,1)), transform var(--motion-duration, .25s) var(--motion-ease, cubic-bezier(.2,.6,.2,1));
}
.back-to-top:hover { filter: brightness(0.96); }
.back-to-top:focus-visible { outline: 2px solid color-mix(in oklab, var(--primary-color) 65%, white); outline-offset: 2px; }
.back-to-top.is-visible { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
@media (max-width: 600px) {
  .back-to-top { right: 12px; bottom: 12px; width: 40px; height: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  .back-to-top { transition: none; }
}

/* Desktop/laptop (hover-capable, fine pointer) bounce-in for dropdowns */
@media (hover: hover) and (pointer: fine) {
  @keyframes dropdown-bounce-in {
    0%   { opacity: 0; transform: translateY(12px) scale(0.96); }
    55%  { opacity: 1; transform: translateY(-4px) scale(1.02); }
    75%  { opacity: 1; transform: translateY(2px) scale(0.997); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
  }
  .primary-menu .sub-menu, .primary-menu .children {
  transform: translateY(12px) scale(0.96);
  transform-origin: top center;
  transition: none !important;
  animation: none;
    will-change: transform, opacity;
  }
  .primary-menu li:hover > .sub-menu,
  .primary-menu li:hover > .children,
  .primary-menu li:focus-within > .sub-menu,
  .primary-menu li:focus-within > .children {
    opacity: 1; visibility: visible; pointer-events: auto; transition: none !important;
  animation: dropdown-bounce-in 360ms cubic-bezier(.22,1.2,.36,1) both !important;
  }
}

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  /* ยกเลิกการปิด transition/animation ทั่วทั้งเว็บ เพื่อให้ card มี animation ได้ */
  /* หากต้องการปิดเฉพาะเมนู dropdown ให้ระบุ selector เฉพาะจุด */
}

/* Tablet header spacing: keep logo and menu icon away from edges */
@media (min-width: 601px) and (max-width: 1024px) {
  .site-header .container { padding-left: 24px; padding-right: 24px; }
  .site-footer .footer-bottom { padding-left: 24px; padding-right: 24px; }
  /* Inset the mobile menu area on tablets so highlighted rows don't hit the right edge */
  .primary-nav { padding-left: 12px; padding-right: 12px; }
  .primary-menu .sub-menu, .primary-menu .children { padding-right: 12px; }
  .primary-menu .sub-menu a, .primary-menu .children a { padding-right: 20px; border-radius: 10px; }

  /* Make the footer map larger on tablets */
  /* Stack footer content and make map bleed full-width */
  .site-footer .footer-inner {
  flex-direction: column;
  align-items: flex-start !important;
  gap: 0 !important; /* no extra gap between blocks */
  padding-top: 20px !important; /* slight breathing room from top edge */
  padding-bottom: 0 !important;
  }

  .site-footer .footer-map {
    position: relative;
    left: auto;
    transform: none;
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
    margin-top: -24px; /* pull map further upward */
    padding-left: 0;
    padding-right: 0;
    box-sizing: border-box;
  }
  /* bring the contact block closer to the map on tablets */
  .site-footer .footer-contact { margin-bottom: 0 !important; }
  .site-footer .footer-heading { margin-bottom: 0 !important; }
  .site-footer .footer-text { margin-bottom: 0 !important; line-height: 1.4 !important; }
  /* disable flex-grow when footer stacks on tablets so contact doesn't push the map down */
  .site-footer .footer-contact { flex: 0 0 auto !important; }
  .site-footer .footer-map iframe {
  width: 100%;
  height: 220px; /* reduced height for tablet */
    border-radius: 12px; /* consistent rounding */
    display: block;
  margin-bottom: 20px !important;
  }
  /* ensure no extra height or alignment pushes the map down */
  .site-footer .footer-map, .site-footer .footer-contact { align-self: stretch !important; }
  /* Make the bottom footer sit closer to the map on tablets */
  .site-footer .footer-bottom {
  padding-top: 8px !important; /* subtle separation from the map */
  }
}

/* Narrow tablet portrait range: add side gaps to menu items */
@media (min-width: 601px) and (max-width: 900px) {
  .primary-menu > li > a { margin: 0 12px; border-radius: 10px; }
  .primary-menu .sub-menu a, .primary-menu .children a { margin-right: 12px; }
}

/* Content */
main .post { padding: 24px 0; border-bottom: 1px solid rgba(15, 23, 42, 0.08); }
.post-title { margin: 0 0 8px; }
.post-meta { color: var(--muted-color); font-size: 0.875rem; margin-bottom: 8px; }

/* Utility */
.btn-primary { background: var(--primary-color); color: #fff; border: none; padding: 10px 14px; border-radius: 8px; }
.btn-primary:hover { filter: brightness(0.95); }

/* --- Search Modal --- */
.search-toggle {
  background: transparent; border: none; color: var(--text-color); cursor: pointer; padding: 8px; border-radius: 10px; line-height: 0;
}
.search-toggle:hover { background: color-mix(in oklab, var(--primary-color) 10%, white); }
.search-toggle { display: inline-flex; align-items: center; gap: 8px; }
.search-toggle__label { font-size: 0.95rem; line-height: 1; }

.search-modal-open { overflow: hidden; }
.search-modal { position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center; }
/* Respect hidden attribute so it doesn't appear until opened */
.search-modal[hidden] { display: none !important; }
.search-modal__backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.5); opacity: 0; transition: opacity var(--motion-duration, .25s) var(--motion-ease, cubic-bezier(.2,.6,.2,1)); }
/* Keep modal width, but reduce inner right padding so input can be longer */
.search-modal__dialog { position: relative; width: min(720px, 94vw); background: #fff; border-radius: 12px; box-shadow: 0 25px 70px rgba(2,6,23,0.25); padding: 18px 24px 24px 18px; border: 1px solid rgba(2,6,23,0.08); min-height: 160px; font-family: var(--primary-font, inherit); transform: translateY(8px) scale(.98); opacity: 0; transition: transform var(--motion-duration, .25s) var(--motion-ease, cubic-bezier(.2,.6,.2,1)), opacity var(--motion-duration, .25s) var(--motion-ease, cubic-bezier(.2,.6,.2,1)); }
/* Visible state */
.search-modal.is-visible .search-modal__backdrop { opacity: 1; }
.search-modal.is-visible .search-modal__dialog { transform: translateY(0) scale(1); opacity: 1; }
/* Full-width horizontal divider inside the modal (flush to both edges) */
.search-modal__dialog::before { content: ""; position: absolute; left: 0; right: 0; top: 52px; height: 1px; background: rgba(2,6,23,0.12); }
.search-modal__close { position: absolute; top: 10px; right: 10px; background: #fff; border: 1px solid rgba(2,6,23,0.1); border-radius: 10px; width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }

/* Header area (title + status) */
.search-modal__header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 2px 8px 0 8px; }
.search-modal__title { font-weight: 600; color: #0f172a; }
.search-modal__status { color: #64748b; font-size: 0.9rem; }

/* Content spacing below divider */
.search-modal__content { margin-top: 0; padding-top: 36px; padding-right: 0; font-family: var(--primary-font, inherit); }
.search-hint { margin-top: 10px; color: var(--muted-color); font-size: 0.9rem; }

/* Form layout */
.search-form { display: flex; gap: 0; font-family: var(--primary-font, inherit); width: 100%; }
/* In modal: hide submit and make input full width */
.search-modal .search-form .search-submit { display: none; }
.search-form .search-input-wrapper { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 8px; border: 1px solid rgba(2,6,23,0.12); padding: 12px 14px; border-radius: 999px; font-family: var(--primary-font, inherit); background: #fff; width: 100%; }
.search-form .search-icon { color: var(--primary-color); }
.search-form .search-field { flex: 1 1 auto; border: none; outline: none; font-size: 1rem; font-family: var(--primary-font, inherit); }
.search-form .search-submit { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 8px; padding: 12px 18px; border-radius: 12px; background: var(--primary-color); color: #fff; border: none; cursor: pointer; font-family: var(--primary-font, inherit); }
.search-form .search-submit:hover { filter: brightness(0.96); }

/* Utility: full-bleed container (spans entire viewport width) */
.full-bleed {
  width: 100vw !important;
  max-width: 100vw !important;
  margin-left: 50% !important;
  transform: translateX(-50%) !important;
}
/* Elementor containers: ensure inner wrapper spans too */
.full-bleed > .e-con-inner,
.elementor .full-bleed > .elementor-container,
.elementor .full-bleed > .e-con { width: 100%; }
/* Optional inner padding for breathing room */
.full-bleed > .e-con-inner { padding-left: 32px; padding-right: 32px; }
@media (max-width: 600px) { .full-bleed > .e-con-inner { padding-left: 16px; padding-right: 16px; } }

/* Results under input */
.search-modal__results { margin-top: 12px; }
.search-modal__no-results { color: #64748b; font-size: 0.95rem; padding: 6px 8px; }
.search-modal__list { list-style: none; margin: 0; padding: 0; }
.search-modal__item { border: 1px solid rgba(2,6,23,0.08); border-radius: 10px; margin-bottom: 8px; background: #fff; box-shadow: 0 4px 12px rgba(2,6,23,0.06); }
.search-modal__item a { display: block; padding: 10px 12px; border-radius: 10px; color: #0f172a; }
.search-modal__item a:hover { background: color-mix(in oklab, var(--primary-color) 10%, white); text-decoration: none; }

/* Visually hidden helper */
.screen-reader-text { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); border: 0; }

@media (max-width: 600px) {
  .search-modal__dialog { padding: 16px 20px 20px 16px; min-height: 150px; width: min(100%, 96vw); }
  .search-modal__dialog::before { left: 0; right: 0; top: 48px; }
  .search-modal__content { padding-right: 0; padding-top: 34px; }
}

/* Mobile: Post Layout Widget improvements */
@media (max-width: 600px) {
  /* card wrapper - targets common widget/container patterns */
  .post-layout-widget .post-card,
  .post-layout-widget .post,
  main .post,
  .post-card {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 20px rgba(2,6,23,0.08);
    margin: 0 0 18px;
    padding: 0; /* inner padding handled by .card-content / .entry-content */
  }

  /* Thumbnail / image: crop with object-fit for consistent heights */
  .post-layout-widget .post-card .post-thumbnail img,
  .post-layout-widget .post .post-thumbnail img,
  main .post .post-thumbnail img,
  .post .post-thumbnail img {
    display: block;
    width: 100%;
    height: 160px;
    object-fit: cover;
    background: linear-gradient(180deg,#f3f4f6,#ffffff);
  }

  /* Content spacing */
  .post-layout-widget .card-content,
  .post-layout-widget .entry-content,
  main .post .entry-content,
  .post-card .card-content {
    padding: 14px;
  }

  /* Title and meta */
  .post-layout-widget .post-title,
  main .post .post-title,
  .post-card .post-title,
  .post-title {
    font-size: 1rem;
    line-height: 1.25;
    margin: 0 0 8px;
    color: var(--text-color);
    font-weight: 700;
    display: -webkit-box;
    /* Preferred standard property for compatibility with linters / newer browsers */
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .post-layout-widget .post-meta,
  main .post .post-meta,
  .post-card .post-meta,
  .post-meta {
  font-size: 0.78rem;
    color: var(--muted-color);
    margin-bottom: 12px;
  }

  /* Read more button: prominent, rounded, comfortable tappable area */
  .post-layout-widget .read-more,
  .post-layout-widget .btn-read,
  main .post .read-more,
  .post-card .read-more,
  .read-more,
  .btn-read {
    display: inline-block;
    background: #f59e0b; /* orange like screenshot */
    color: #fff;
    padding: 10px 18px;
    border-radius: 10px;
    font-weight: 600;
    text-align: center;
    min-width: 120px;
    box-shadow: 0 2px 0 rgba(0,0,0,0.04);
  }

  /* Footer area of card to align button nicely */
  .post-layout-widget .card-footer,
  main .post .card-footer,
  .post-card .card-footer {
    padding: 12px 14px 18px;
    display: flex;
    justify-content: flex-start;
    gap: 12px;
  }

  /* Smaller typography for very small screens */
  @media (max-width: 420px) {
    .post-layout-widget .post-title,
    main .post .post-title,
    .post-card .post-title,
    .post-title {
      font-size: 0.95rem;
    }
    .post-layout-widget .post-meta,
    .post-meta { font-size: 0.72rem; }

    /* Make the 'ดูทั้งหมด' (view all) button full width and compact on narrow phones */
    .post-layout-widget .view-all,
    .post-layout-widget .btn-view-all,
    .view-all,
    .btn-view-all {
      display: block;
      width: 100%;
      text-align: center;
      padding: 10px 14px;
      border-radius: 10px;
      background: color-mix(in oklab, #f59e0b 90%, white);
      color: #0b1324;
      font-weight: 700;
      margin-top: 8px;
    }
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .search-modal__backdrop, .search-modal__dialog { transition: none; }
}