/* ============================================================
   articles.css — SUKWEBCRAFT Content / Article page styles
   Design system: matches index.html tokens exactly
   ============================================================ */

:root {
  --red: #E24B4A;
  --red-dark: #C13B3A;
  --red-soft: #FBEAE8;
  --ink: #1A1715;
  --ink-2: #544E4A;
  --muted: #857C76;
  --bg: #FAF8F6;
  --cream: #F3ECE4;
  --line: #E8E0D8;
  --white: #FFFFFF;
  --shadow: 0 1px 2px rgba(26,23,21,.04), 0 12px 32px -12px rgba(26,23,21,.16);
  --shadow-lg: 0 2px 4px rgba(26,23,21,.05), 0 30px 60px -24px rgba(26,23,21,.24);
  --radius: 18px;
  --maxw: 1180px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; overflow-x: hidden; }
body {
  font-family: "IBM Plex Sans Thai", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1, h2, h3, .display {
  font-family: "Bai Jamjuree", "IBM Plex Sans Thai", sans-serif;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -.01em;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }
.mono { font-family: "IBM Plex Mono", monospace; }

/* ── Language visibility (same as index.html) ── */
[data-en] { display: none; }
body.en [data-en] { display: revert; }
body.en [data-th] { display: none; }
span[data-en] { display: none; }
body.en span[data-en] { display: inline; }
body.en span[data-th] { display: none; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 28px; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: "Bai Jamjuree", sans-serif; font-weight: 600; font-size: 16px;
  padding: 14px 24px; border-radius: 999px; border: 1.5px solid transparent;
  cursor: pointer; transition: .18s ease; white-space: nowrap;
  text-decoration: none; line-height: 1;
}
.btn-primary { background: var(--red); color: #fff; box-shadow: 0 8px 20px -8px rgba(226,75,74,.7); }
.btn-primary:hover { background: var(--red-dark); transform: translateY(-2px); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--ink); background: var(--white); }
.btn-line { background: #06C755; color: #fff; }
.btn-line:hover { filter: brightness(.93); transform: translateY(-2px); }
.btn-sm { font-size: 14px; padding: 10px 20px; }

/* ============================================================
   NAV
   ============================================================ */
header.nav {
  position: sticky; top: 0; z-index: 60;
  background: rgba(250,248,246,.82);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  transition: .25s;
}
header.nav.scrolled { border-color: var(--line); background: rgba(250,248,246,.95); }

.nav-row {
  display: flex; align-items: center; justify-content: space-between;
  height: 74px; gap: 20px;
}
.logo { display: flex; align-items: center; }
.logo img { height: 40px; width: auto; display: block; }

.nav-links { display: flex; align-items: center; gap: 28px; }
.nav-links a {
  font-size: 15.5px; color: var(--ink-2); font-weight: 500; transition: .15s;
}
.nav-links a:hover { color: var(--red); }
.nav-links a.active { color: var(--red); font-weight: 600; }

.nav-actions { display: flex; align-items: center; gap: 12px; }

.lang {
  display: flex; border: 1.5px solid var(--line); border-radius: 999px;
  overflow: hidden; font-family: "Bai Jamjuree"; font-weight: 600; font-size: 13px;
}
.lang button {
  padding: 7px 12px; background: transparent; border: 0;
  cursor: pointer; color: var(--muted); transition: .15s;
}
.lang button.active { background: var(--ink); color: #fff; }

.burger {
  display: none; background: transparent; border: 1.5px solid var(--line);
  border-radius: 10px; width: 42px; height: 42px; cursor: pointer; font-size: 18px;
}

/* Mobile nav dropdown */
@media (max-width: 680px) {
  .nav-links {
    display: none;
    position: absolute; top: 74px; left: 0; right: 0;
    flex-direction: column;
    background: var(--white); border-bottom: 1px solid var(--line);
    padding: 18px 24px; gap: 18px; z-index: 59;
  }
  .nav-links.open { display: flex; }
  .burger { display: block; }
  .nav-actions .btn.hide-sm { display: none; }
}

/* ============================================================
   BREADCRUMB
   ============================================================ */
.breadcrumb {
  background: var(--white);
  border-bottom: 1px solid var(--line);
  padding: 13px 0;
}
.bc-inner {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--muted);
}
.bc-inner a { color: var(--muted); transition: color .15s; }
.bc-inner a:hover { color: var(--red); }
.bc-sep { color: var(--line); font-size: 11px; }
.bc-current { color: var(--ink); font-weight: 500; }

/* ============================================================
   HERO (short)
   ============================================================ */
.hero-articles {
  padding: 58px 0 48px;
  position: relative; overflow: hidden;
}
.hero-articles::before {
  content: "";
  position: absolute; top: -120px; right: -140px;
  width: 500px; height: 500px; border-radius: 50%;
  background: radial-gradient(circle at center, rgba(226,75,74,.11), transparent 62%);
  pointer-events: none; z-index: 0;
}
.hero-articles .wrap { position: relative; z-index: 1; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: "Bai Jamjuree"; font-weight: 600; font-size: 13px;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--red); background: var(--red-soft);
  padding: 7px 14px; border-radius: 999px; margin-bottom: 18px;
}
.hero-articles h1 {
  font-size: clamp(28px, 4vw, 46px);
  margin-bottom: 14px; max-width: 22em;
}
.hero-articles .lead {
  font-size: 17px; color: var(--ink-2);
  max-width: 50em; line-height: 1.75;
}

/* ============================================================
   ARTICLES SECTION (card grid)
   ============================================================ */
.articles-section { padding: 48px 0 80px; }

.articles-header {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 28px; gap: 16px; flex-wrap: wrap;
}
.art-count {
  font-family: "IBM Plex Mono"; font-size: 12px;
  color: var(--muted); letter-spacing: .06em; text-transform: uppercase;
}
.label {
  font-family: "Bai Jamjuree"; font-weight: 600; font-size: 13px;
  letter-spacing: .1em; text-transform: uppercase; color: var(--red);
  display: block;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.art-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px 26px 22px;
  display: flex; flex-direction: column;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease, opacity .15s ease;
  position: relative; overflow: hidden;
  cursor: pointer;
  -webkit-user-select: none; user-select: none;
}
.art-card::before {
  content: "";
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--red); transform: scaleX(0); transform-origin: left;
  transition: transform .3s cubic-bezier(.2,.8,.2,1);
}
.art-card:hover::before { transform: scaleX(1); }
.art-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
  border-color: #DECFC0;
}

.art-num {
  font-family: "IBM Plex Mono"; font-size: 11.5px;
  color: var(--red); letter-spacing: .06em; text-transform: uppercase;
  margin-bottom: 13px; display: block;
}
.art-date {
  font-family: "IBM Plex Mono"; font-size: 11px;
  color: var(--muted); letter-spacing: .04em;
  margin-bottom: 14px; display: block;
}
.art-card h2 {
  font-size: clamp(16px, 1.8vw, 20px);
  margin-bottom: 10px; line-height: 1.3;
}
.art-card .teaser {
  font-size: 14px; color: var(--ink-2);
  line-height: 1.7; flex: 1; margin-bottom: 18px;
}
.art-card .tags {
  display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 18px;
}
.art-tag {
  font-family: "IBM Plex Mono"; font-size: 10.5px;
  background: var(--cream); color: var(--muted);
  padding: 4px 10px; border-radius: 6px;
}
.read-btn { align-self: flex-start; }

/* ============================================================
   SEO STORE  — crawlable by Google bot, invisible to humans
   NEVER use display:none here
   ============================================================ */
.seo-store {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.seo-store-wrap { position: relative; }

/* ============================================================
   CARD EXPANSION OVERLAY  (Shared Element Transition)
   ============================================================ */

/* Cards are fully clickable — cursor & user-select set on base .art-card above */
.art-card:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 3px;
  border-radius: var(--radius);
}
/* Source card fades out when overlay opens */
.card-out {
  opacity: 0 !important;
  pointer-events: none;
  transition: opacity .15s ease !important;
}

/* Full-screen overlay — starts clipped to card position via inline clip-path */
.art-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--bg);
  overflow: hidden;
  will-change: clip-path;
  -webkit-tap-highlight-color: transparent;
}

/* Sticky top bar */
.ov-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 20px;
  background: rgba(250,248,246,.92);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}

.ov-back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  font-family: "Bai Jamjuree", sans-serif;
  font-weight: 600;
  color: var(--ink-2);
  background: none;
  border: none;
  cursor: pointer;
  padding: 7px 12px;
  border-radius: 10px;
  transition: color .15s, background .15s;
  line-height: 1;
}
.ov-back:hover { color: var(--red); background: var(--cream); }

.ov-close {
  width: 38px;
  height: 38px;
  background: var(--cream);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  color: var(--ink);
  transition: background .15s;
  flex: none;
}
.ov-close:hover { background: var(--line); }
.ov-close:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

/* Article content area */
.ov-body {
  max-width: 760px;
  margin: 0 auto;
  padding: 44px 28px 96px;
  min-height: calc(100dvh - 57px);
}

/* Loading indicator */
.ov-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40vh;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12.5px;
  color: var(--muted);
  letter-spacing: .08em;
  text-transform: uppercase;
}

/* Content fades in after overlay expansion */
.ov-body .modal-body {
  padding: 0;
  overflow-y: visible;
  max-width: none;
  opacity: 0;
  transform: translateY(14px);
  transition: none;
}
.ov-body.content-ready .modal-body {
  opacity: 1;
  transform: none;
  transition: opacity .35s ease, transform .35s ease;
}

/* Hide the "back to articles" link inside overlay (we have the bar) */
.ov-body .art-back { display: none; }

/* Lock body scroll when overlay is open */
body.ov-lock { overflow: hidden; }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 26px 16px;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0;
  background: var(--white); z-index: 2;
  border-radius: 22px 22px 0 0;
}
.modal-title {
  font-family: "Bai Jamjuree"; font-weight: 600; font-size: 14px;
  color: var(--muted); letter-spacing: .04em; text-transform: uppercase;
}
.modal-close {
  background: var(--cream); border: none; border-radius: 50%;
  width: 36px; height: 36px; font-size: 17px;
  cursor: pointer; display: grid; place-items: center;
  color: var(--ink); flex: none; transition: .15s; line-height: 1;
}
.modal-close:hover { background: var(--line); }

.modal-body { padding: 26px 26px 36px; overflow-y: auto; }

/* Article content rendered inside modal */
.modal-body .art-num { margin-bottom: 12px; }
.modal-body .tags { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 22px; }

.modal-body h2 {
  font-size: clamp(22px, 3vw, 30px);
  margin-bottom: 20px; line-height: 1.2;
}
.modal-body h3 {
  font-size: 18px; margin: 28px 0 10px;
  color: var(--ink);
}
.modal-body p {
  font-size: 15.5px; color: var(--ink-2);
  line-height: 1.8; margin-bottom: 14px;
}
.modal-body ul, .modal-body ol {
  padding-left: 22px; margin-bottom: 14px;
}
.modal-body li {
  font-size: 15.5px; color: var(--ink-2);
  line-height: 1.75; margin-bottom: 7px;
}
.modal-body strong { color: var(--ink); }

/* Single article page layout */
.single-article { padding: 56px 0 80px; }
.single-article .modal-body { padding: 0; overflow-y: visible; max-width: 740px; }
.art-back { margin-top: 32px; }

/* CTA block inside article */
.art-cta {
  background: var(--ink); color: #fff;
  border-radius: 16px; padding: 28px 24px 22px;
  margin-top: 34px;
}
.art-cta .cta-head {
  font-family: "Bai Jamjuree"; font-weight: 700; font-size: 18px;
  margin-bottom: 6px;
}
.art-cta .cta-sub {
  font-size: 14px; color: #C9C1BB; margin-bottom: 18px; line-height: 1.6;
}
.art-cta .cta-btns { display: flex; gap: 11px; flex-wrap: wrap; align-items: center; }
.art-cta .btn-line { font-size: 14px; padding: 11px 20px; }
.cta-link {
  font-size: 14px; font-family: "Bai Jamjuree"; font-weight: 600;
  color: rgba(255,255,255,.7); text-decoration: underline;
  text-underline-offset: 3px; transition: color .15s;
}
.cta-link:hover { color: #fff; }

/* ============================================================
   FOOTER
   ============================================================ */
footer {
  background: var(--bg);
  border-top: 1px solid var(--line);
  padding: 52px 0 28px;
}
.foot-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1.3fr;
  gap: 36px; margin-bottom: 38px;
}
.foot-grid h4 {
  font-family: "Bai Jamjuree"; font-size: 14px;
  letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 14px;
}
.foot-grid ul { list-style: none; display: flex; flex-direction: column; gap: 9px; }
.foot-grid a, .foot-grid li { font-size: 14px; color: var(--ink-2); }
.foot-grid a:hover { color: var(--red); }
.foot-about p { font-size: 14px; color: var(--ink-2); margin: 12px 0; max-width: 32em; }
.foot-bottom {
  border-top: 1px solid var(--line); padding-top: 20px;
  display: flex; justify-content: space-between; align-items: center;
  gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted);
}
.foot-bottom .links { display: flex; gap: 18px; flex-wrap: wrap; }

/* ============================================================
   FLOATING CONTACT BUTTONS
   ============================================================ */
.float {
  position: fixed; right: 22px; bottom: 22px;
  z-index: 55; display: flex; flex-direction: column; gap: 12px;
}
.float a {
  width: 56px; height: 56px; border-radius: 50%;
  display: grid; place-items: center;
  color: #fff; font-size: 23px;
  box-shadow: var(--shadow-lg); transition: .18s;
}
.float a:hover { transform: scale(1.08); }
.float .l { background: #06C755; }
.float .p { background: var(--red); }

/* ============================================================
   COOKIE BANNER (PDPA)
   ============================================================ */
.cookie {
  position: fixed; left: 22px; right: 22px; bottom: 22px; z-index: 80;
  max-width: 520px;
  background: var(--white); border: 1px solid var(--line);
  border-radius: 18px; box-shadow: var(--shadow-lg);
  padding: 22px 24px; display: none;
}
.cookie.show { display: block; animation: rise .4s ease; }
@keyframes rise {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
.cookie h4 { font-size: 16px; margin-bottom: 6px; }
.cookie p { font-size: 13.5px; color: var(--ink-2); margin-bottom: 16px; }
.cookie p a { color: var(--red); text-decoration: underline; }
.cookie .row { display: flex; gap: 10px; }
.cookie .btn { font-size: 14px; padding: 10px 18px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 860px) {
  .card-grid { grid-template-columns: 1fr; }
  .foot-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 680px) {
  .wrap { padding: 0 18px; }
  .foot-grid { grid-template-columns: 1fr; }
  .modal-header, .modal-body { padding-left: 18px; padding-right: 18px; }
  .art-cta .cta-btns { flex-direction: column; align-items: flex-start; }
  .ov-body { padding: 28px 18px 80px; }
  .ov-bar { padding: 11px 14px; }
}

/* ── Sticky CTA bar (mobile) ── */
.sticky-bar { display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 70; background: var(--white); border-top: 1.5px solid var(--line); padding: 12px 18px; align-items: center; justify-content: space-between; gap: 12px; box-shadow: 0 -4px 20px rgba(26,23,21,.1); }
.sticky-left { display: flex; flex-direction: column; gap: 1px; }
.sticky-left .sticky-sub { font-size: 11.5px; color: var(--muted); }
.sticky-left .sticky-main { font-family: "Bai Jamjuree", sans-serif; font-weight: 600; font-size: 15px; color: var(--ink); }
.sticky-btn { padding: 12px 22px; font-size: 15px; white-space: nowrap; }
.btn-line { background: #06C755; color: #fff; }
.btn-line:hover { filter: brightness(.94); }
@media (max-width: 640px) {
  .sticky-bar { display: flex; }
  body { padding-bottom: 68px; }
  #_b { bottom: 80px !important; }
}

/* ============================================================
   PAGINATION — Mobile-first responsive
   Mobile  <768px : full-width link (thumb-zone)
   Desktop ≥1024px: numbered buttons
   ============================================================ */

.pagi-wrap {
  margin-top: 2.75rem;
  padding-bottom: 1rem;
}

/* ── Mobile: full-width link ── */
.pagi-mobile {
  padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
}

.btn-pagi {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 52px;
  padding: 0.875rem 1.25rem;
  gap: 8px;
  background: transparent;
  border: 1.5px solid var(--red);
  border-radius: 14px;
  font-family: "Bai Jamjuree", sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--red);
  text-decoration: none;
  text-align: center;
  touch-action: manipulation;
  transition: background 0.15s ease, color 0.15s ease;
}
.btn-pagi:hover,
.btn-pagi:focus-visible {
  background: var(--red);
  color: var(--white);
  outline: 2px solid var(--red);
  outline-offset: 2px;
}
.btn-pagi:active { transform: scale(0.98); }

.pagi-count {
  margin-top: 0.625rem;
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  letter-spacing: 0.03em;
}

/* ── Desktop: numbered pagination (hidden on mobile) ── */
.pagination-numbered {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 0.25rem 0 0.5rem;
}

.pg-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 0.75rem;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  font-family: "Bai Jamjuree", sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-2);
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}
.pg-btn:hover:not(.pg-disabled):not(.pg-current),
.pg-btn:focus-visible:not(.pg-disabled):not(.pg-current) {
  background: var(--cream);
  border-color: var(--muted);
  color: var(--ink);
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

.pg-btn.pg-current {
  background: var(--red);
  border-color: transparent;
  color: var(--white);
  font-weight: 700;
  pointer-events: none;
}

.pg-btn.pg-prev,
.pg-btn.pg-next {
  font-size: 20px;
  line-height: 1;
  color: var(--red);
  border-color: var(--red-soft);
  background: var(--red-soft);
  padding: 0 0.875rem;
}
.pg-btn.pg-prev:hover,
.pg-btn.pg-next:hover {
  background: var(--red);
  border-color: transparent;
  color: var(--white);
}

.pg-btn.pg-disabled {
  color: var(--muted);
  border-color: var(--line);
  background: transparent;
  opacity: 0.4;
  pointer-events: none;
  cursor: not-allowed;
}

.pg-info {
  font-size: 12px;
  color: var(--muted);
  margin-left: 0.625rem;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

/* ── Breakpoints ── */
@media (min-width: 768px) {
  .btn-pagi { max-width: 420px; margin: 0 auto; }
}
@media (min-width: 1024px) {
  .pagi-mobile { display: none; }
  .pagination-numbered { display: flex; }
}

/* ── BACK TO TOP ── */
.btt {
  position: fixed;
  right: 24px;
  bottom: 96px;          /* 24px chatbot + 58px height + 14px gap */
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--white);
  border: 1.5px solid var(--line);
  box-shadow: var(--shadow);
  color: var(--ink);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  z-index: 9000;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .25s, transform .25s, box-shadow .2s;
  pointer-events: none;
}
.btt.show { opacity: 1; transform: translateY(0); pointer-events: auto; }
.btt:hover { box-shadow: var(--shadow-lg); }
.btt svg { width: 18px; height: 18px; }
@media (max-width: 640px) { .btt { bottom: 154px; } } /* 80px chatbot override + 58px + 16px */
