/*
 * SiamSEOsav — stylesheet.css (override / additions)
 * Inherits main.css, customize.css, stylesheet.css from SiamBBsav2 via phpBB parent-style lookup.
 * Only put NEW or CHANGED rules here.
 */

/* ===== CSS CUSTOM PROPERTIES ===== */
:root {
  --sa-brand-red:   #e32119;
  --sa-brand-gold:  #f5a623;
  --sa-brand-dark:  #5b3a29;
  --sa-focus-ring:  0 0 0 3px rgba(227,33,25,.35);
  --sa-radius:      .5rem;
  --sa-transition:  .18s ease;
}

/* ===== ACCESSIBILITY: visible focus rings ===== */
:focus-visible {
  outline: 2px solid var(--sa-brand-red);
  outline-offset: 2px;
  box-shadow: var(--sa-focus-ring);
}
a:focus-visible { border-radius: 2px; }

/* ===== SKIP LINK ===== */
.visually-hidden-focusable:focus {
  position: fixed;
  top: .5rem;
  left: .5rem;
  z-index: 9999;
  padding: .4em .8em;
  background: var(--sa-brand-red);
  color: #fff;
  border-radius: var(--sa-radius);
  font-weight: 700;
}

/* ===== TYPOGRAPHY ===== */
body {
  font-family: "Open Sans", "Noto Sans Thai", Tahoma, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Heading hierarchy for SEO */
h1.topic-title,
h1.forum-title {
  font-size: clamp(1.15rem, 2.5vw, 1.4rem);
  line-height: 1.3;
}
h2.forum-title,
h2 { font-size: clamp(1rem, 2vw, 1.2rem); }

/* ===== NAVBAR & HEADER ===== */
#HeaderNavigation {
  border-bottom: 2px solid var(--sa-brand-gold);
}
#HeaderNavigation .navbar-brand img,
.site_logo {
  /* already defined in parent — no change needed */
}

/* ===== FORUM LIST ===== */
/* ไม่ override bg-forum-head1/bg-forum-head2 — ใช้ค่า white.css ของ parent (#FFC400, #FFE387) */
.forabg:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,.10);
}

/* Latest-topics list — minimal override ที่ไม่ทำลาย hanging-indent ใน ilist.css */
.i-forumlist {
  overflow: hidden;  /* ป้องกัน horizontal overflow จากชื่อกระทู้ยาว */
}
/* ไม่ reset margin-left ของ ul — ให้ ilist.css จัดการ text-indent: -10px */
.i-forumlist a {
  color: #3a2a1a;
  text-decoration: none;
}
.i-forumlist a:hover { color: var(--sa-brand-red); }

/* ===== HERO SLIDER + HIGHLIGHT PANEL ===== */
.sa-hero {
  display: grid;
  grid-template-columns: 1.65fr 1fr;
  gap: 16px;
  --hero-h: 456px;
  margin-bottom: 32px;
}
.sa-hero--full { grid-template-columns: 1fr; }

.sa-slider {
  position: relative; overflow: hidden; border-radius: 14px;
  background: #0b0b0b; height: var(--hero-h);
}
.sa-slides { display: flex; height: 100%; transition: transform .5s ease; }
.sa-slide  { flex: 0 0 100%; min-width: 0; height: 100%; position: relative; }
.sa-slide a { display: block; height: 100%; position: relative; }
.sa-slide img { display: block; width: 100%; height: 100%; object-fit: contain; }
.sa-slide-cap {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 50px 60px 18px 18px;
  background: linear-gradient(transparent, rgba(0,0,0,.88));
  color: #fff;
}
.sa-slide-badge {
  display: inline-block; background: var(--sa-brand-red); color: #fff;
  font-size: 11px; font-weight: 800; padding: 3px 10px; border-radius: 999px; margin-bottom: 8px;
  max-width: calc(100% - 70px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  vertical-align: middle;
}
.sa-slide-cap h2 {
  margin: 0; font-size: 19px; font-weight: 800; line-height: 1.35;
  text-shadow: 0 1px 4px rgba(0,0,0,.6);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.sa-arrow {
  position: absolute; top: calc(50% - 18px); z-index: 3;
  width: 36px; height: 36px; border: 0; border-radius: 50%; cursor: pointer;
  background: rgba(255,255,255,.82); color: #222; font-size: 21px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.3); transition: .15s;
}
.sa-arrow:hover { background: #fff; }
.sa-arrow-prev { left: 10px; } .sa-arrow-next { right: 10px; }
.sa-dots-wrap {
  position: absolute; left: 0; right: 0; bottom: 9px; z-index: 3;
  display: flex; gap: 7px; justify-content: center;
}
.sa-dot-btn {
  width: 8px; height: 8px; padding: 0; border: 0; border-radius: 50%; cursor: pointer;
  background: rgba(255,255,255,.5); transition: .2s;
}
.sa-dot-btn.is-active { background: #fff; width: 20px; border-radius: 999px; }

.sa-hero-right {
  background: #1a1d24; border-radius: 14px; overflow: hidden;
  display: flex; flex-direction: column; height: var(--hero-h);
}
.sa-hero-right-hd {
  padding: 11px 14px; flex: none;
  font-size: 11.5px; font-weight: 700; color: rgba(255,255,255,.55);
  letter-spacing: .6px; text-transform: uppercase;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.sa-hi-item {
  display: flex; gap: 11px; padding: 13px 14px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  flex: 1; align-items: center; text-decoration: none;
  transition: background .12s; min-height: 0;
}
.sa-hi-item:hover { background: rgba(255,255,255,.06); }
.sa-hi-item:last-child { border-bottom: 0; }
.sa-hi-thumb {
  flex: none; width: 92px; height: 64px;
  border-radius: 8px; overflow: hidden; background: #2a2d35;
}
.sa-hi-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.sa-hi-no-thumb  { flex: none; width: 6px; height: 0; }
.sa-hi-body { flex: 1; min-width: 0; }
.sa-hi-cat {
  display: inline-block; background: var(--sa-brand-red); color: #fff;
  font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 999px; margin-bottom: 5px;
  max-width: min(220px, 100%); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  vertical-align: middle;
}
.sa-hi-title {
  font-size: 13px; font-weight: 700; color: #dde0e8; margin: 0 0 5px; line-height: 1.38;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.sa-hi-meta { font-size: 11px; color: rgba(255,255,255,.35); }

/* Hero Responsive */
@media (max-width: 900px) {
  .sa-hero { grid-template-columns: 1fr; --hero-h: auto; }
  .sa-slider, .sa-slides, .sa-slide, .sa-slide a { height: auto; }
  .sa-slide img { height: auto; aspect-ratio: 16/9; }
  .sa-hero-right { height: auto; }
  .sa-hi-item { flex: none; }
}
@media (max-width: 600px) {
  .sa-slide-cap h2 { font-size: 15px; }
  .sa-slide-cap { padding: 35px 50px 14px 14px; }
  .sa-arrow { width: 30px; height: 30px; font-size: 18px; }
}
@media (max-width: 480px) {
  .sa-slide-cap { padding: 18px 42px 10px 12px; }
  .sa-slide-badge { font-size: 9px; padding: 2px 7px; margin-bottom: 4px; }
  .sa-slide-cap h2 { font-size: 13px; -webkit-line-clamp: 1; }
  .sa-hi-thumb { width: 90px; height: 68px; }
}

/* ===== TOPIC PAGE ===== */
.post {
  border: 1px solid #e8e1d8;
  border-radius: var(--sa-radius);
  transition: box-shadow var(--sa-transition);
}
.post:hover { box-shadow: 0 2px 6px rgba(0,0,0,.07); }

/* Post content images — responsive + lazy */
.content img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

/* ===== SHARE BUTTONS (URL-based, no SDK) ===== */
.sa-share-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 12px; border-radius: 4px; text-decoration: none;
  font-size: 14px; font-weight: 600; color: #fff; margin-right: 6px;
  transition: opacity .15s;
}
.sa-share-btn:hover { opacity: .85; color: #fff; }
.sa-share-fb   { background: #1877F2; }
.sa-share-line { background: #06C755; margin-right: 0; }

/* ===== ADS: clear floats + spacing ===== */
.sa-ad-block {
  margin: 1rem 0;
  text-align: center;
  overflow: hidden;
}
/* Prevent CLS: reserve space for typical ad sizes */
.sa-ad-leaderboard { min-height: 90px; }
.sa-ad-rectangle   { min-height: 250px; }

/* ===== FOOTER ===== */
#page-footer {
  border-top: 3px solid var(--sa-brand-gold);
}
/* ไม่ override padding/text-indent ของ .i-footerlist — ให้ ilist.css จัดการ hanging indent */
.i-footerlist a:hover { color: var(--sa-brand-red); }

/* ===== RESPONSIVE IMPROVEMENTS ===== */
@media (max-width: 767.98px) {
  .btn, a.nav-link:not(.dropdown-toggle) { min-height: 44px; display: flex; align-items: center; }
  a.nav-link.dropdown-toggle { min-height: 44px; }
  .i-forumlist ul li { line-height: 32px; }
  .post { margin-bottom: .5rem; }
  .forum-description { display: block !important; }
}

/* Prevent horizontal scroll on small screens */
@media (max-width: 575.98px) {
  .container-xxl { overflow-x: hidden; }
  /* .container-fluid ถูกตัดออก — navbar ใช้ .container-fluid ด้วย
     overflow:hidden จะ clip dropdown-menu ที่ positioned absolute ทำให้มองไม่เห็น */
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* ===== PRINT STYLES ===== */
@media print {
  #HeaderNavigation, #page-footer, .action-bar, .sa-ad-block,
  .post-buttons, #phpbb_alert, #phpbb_confirm, .scrollup { display: none !important; }
  .content { font-size: 11pt; }
  a[href]::after { content: " (" attr(href) ")"; font-size: 9pt; color: #666; }
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ===== HIGH CONTRAST / DARK MODE HINT ===== */
@media (prefers-color-scheme: dark) {
  /* phpBB Bootstrap already handles dark mode via data-bs-theme.
     Add custom overrides here if needed in future. */
}
