/**
 * landing.css — Public Landing Page (index.php) design system
 * Modern / Minimal / Premium / Educational — GOV Portal x Linear x Stripe x shadcn direction.
 * Loaded only on index.php. Works alongside Tailwind utilities (layout/spacing) — this file owns
 * design tokens, glass/gradient effects, animation and anything Tailwind's default palette can't express.
 */

:root {
  --lp-primary: #2563eb;
  --lp-primary-600: #2563eb;
  --lp-primary-700: #1d4ed8;
  --lp-primary-500: #3b82f6;
  --lp-secondary: #eff6ff;
  --lp-accent: #0891b2;
  --lp-success: #22c55e;
  --lp-warning: #f59e0b;
  --lp-danger: #ef4444;

  --lp-bg: #f8fafc;
  --lp-surface: #ffffff;
  --lp-surface-2: #f1f5f9;
  --lp-border: #e5e7eb;
  --lp-text: #0f172a;
  --lp-text-muted: #64748b;
  --lp-nav-bg: rgba(255, 255, 255, 0.8);

  --lp-radius-sm: 14px;
  --lp-radius: 18px;
  --lp-radius-lg: 24px;

  --lp-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 1px rgba(15, 23, 42, 0.03);
  --lp-shadow: 0 8px 24px -8px rgba(15, 23, 42, 0.12), 0 2px 8px -2px rgba(15, 23, 42, 0.06);
  --lp-shadow-lg: 0 24px 48px -16px rgba(37, 99, 235, 0.22), 0 8px 24px -8px rgba(15, 23, 42, 0.1);

  --lp-glass-bg: rgba(255, 255, 255, 0.72);
  --lp-glass-border: rgba(255, 255, 255, 0.5);

  --lp-ease: cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="dark"] {
  /* โทนกรมท่า/darkblue อิง #00083d แทนโทนดำ/เทาเดิม */
  --lp-bg: #00083d;
  --lp-surface: #0d1660;
  --lp-surface-2: #142074;
  --lp-border: #223a8f;
  --lp-text: #eef1ff;
  --lp-text-muted: #a3ade0;
  --lp-nav-bg: rgba(0, 8, 61, 0.75);
  --lp-glass-bg: rgba(13, 22, 96, 0.65);
  --lp-glass-border: rgba(255, 255, 255, 0.08);
  --lp-shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.45), 0 2px 8px -2px rgba(0, 0, 0, 0.3);
  --lp-shadow-lg: 0 24px 48px -16px rgba(37, 99, 235, 0.35), 0 8px 24px -8px rgba(0, 0, 0, 0.4);
}

/* ---------- Page-width container ----------
   Fluid, full-width up to very large monitors (must fully fill 1920x1080 and beyond) — only a soft
   ceiling at 2400px so line length stays sane on ultra-wide/4K+ displays. Not the old 1280px Tailwind cap. */
.lp-container { width: 100%; max-width: 2400px; margin-left: auto; margin-right: auto; padding-left: 1rem; padding-right: 1rem; }
@media (min-width: 768px) { .lp-container { padding-left: 2rem; padding-right: 2rem; } }
@media (min-width: 1536px) { .lp-container { padding-left: 3rem; padding-right: 3rem; } }
@media (min-width: 1920px) { .lp-container { padding-left: 4rem; padding-right: 4rem; } }

/* ---------- Base ---------- */
.lp-page { background: var(--lp-bg); color: var(--lp-text); font-family: 'Prompt', 'Sarabun', sans-serif; }
/* :where() keeps this at zero specificity so component classes (.lp-btn-primary, .lp-nav-link, etc.)
   always win regardless of source order — a plain ".lp-page a" would tie/beat single-class component
   rules on specificity and silently override their intended text color (found via contrast audit). */
.lp-page :where(a) { color: inherit; }
.lp-page :focus-visible { outline: 2px solid var(--lp-primary-500); outline-offset: 2px; border-radius: 6px; }
.lp-muted { color: var(--lp-text-muted); }
.lp-surface { background: var(--lp-surface); }
.lp-surface-2 { background: var(--lp-surface-2); }
.lp-border { border-color: var(--lp-border); }

/* ---------- Skip link (a11y) ---------- */
.lp-skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--lp-primary); color: #fff; padding: 0.75rem 1.25rem; border-radius: 0 0 12px 0; font-weight: 600;
}
.lp-skip-link:focus { left: 0; }

/* ---------- Cards ---------- */
.lp-card {
  background: var(--lp-surface);
  border: 1px solid var(--lp-border);
  border-radius: var(--lp-radius);
  box-shadow: var(--lp-shadow-sm);
  transition: transform 0.25s var(--lp-ease), box-shadow 0.25s var(--lp-ease), border-color 0.25s var(--lp-ease);
}
.lp-card-hover:hover {
  transform: translateY(-4px);
  box-shadow: var(--lp-shadow);
  border-color: var(--lp-primary-500);
}

/* ---------- Glass effect ---------- */
.lp-glass {
  background: var(--lp-glass-bg);
  border: 1px solid var(--lp-glass-border);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border-radius: var(--lp-radius-lg);
  box-shadow: var(--lp-shadow-lg);
}

/* ---------- Nav ---------- */
.lp-nav {
  background: var(--lp-nav-bg);
  border-bottom: 1px solid var(--lp-border);
  backdrop-filter: blur(12px) saturate(160%);
  -webkit-backdrop-filter: blur(12px) saturate(160%);
}
.lp-nav-link {
  position: relative;
  color: var(--lp-text);
  text-decoration: none;
  font-weight: 500;
  padding: 0.5rem 0.75rem;
  border-radius: 10px;
  transition: color 0.2s var(--lp-ease), background-color 0.2s var(--lp-ease);
}
.lp-nav-link:hover { background: var(--lp-secondary); color: var(--lp-primary-700); }
.lp-nav-link.is-active { color: var(--lp-primary-600); }
.lp-nav-link.is-active::after {
  content: ''; position: absolute; left: 0.75rem; right: 0.75rem; bottom: -1px; height: 2px;
  background: var(--lp-primary-600); border-radius: 2px;
}
[data-theme="dark"] .lp-nav-link:hover { background: rgba(59, 130, 246, 0.15); }

.lp-search {
  display: flex; align-items: center; gap: 0.5rem;
  background: var(--lp-surface-2); border: 1px solid var(--lp-border); border-radius: 12px;
  padding: 0.45rem 0.75rem; color: var(--lp-text-muted); transition: border-color .2s var(--lp-ease);
}
.lp-search:focus-within { border-color: var(--lp-primary-500); color: var(--lp-text); }
.lp-search input { background: transparent; border: 0; outline: 0; font: inherit; color: inherit; width: 100%; }

/* ---------- Buttons ---------- */
.lp-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  font-weight: 600; font-size: 0.9rem; padding: 0.7rem 1.35rem; border-radius: 12px;
  text-decoration: none; border: 1px solid transparent; cursor: pointer;
  transition: transform 0.2s var(--lp-ease), box-shadow 0.2s var(--lp-ease), background-color 0.2s var(--lp-ease), border-color .2s var(--lp-ease);
}
.lp-btn:hover { transform: translateY(-2px); }
/* primary-600 (not -500) at both ends of the range keeps white text >= 4.5:1 (WCAG AA) everywhere on the gradient */
.lp-btn-primary { background: linear-gradient(135deg, var(--lp-primary-600), var(--lp-primary-700)); color: #fff; box-shadow: 0 10px 24px -8px rgba(37, 99, 235, 0.5); }
.lp-btn-primary:hover { box-shadow: 0 16px 32px -8px rgba(37, 99, 235, 0.55); }
.lp-btn-outline { background: var(--lp-surface); color: var(--lp-primary-600); border-color: var(--lp-primary-500); }
.lp-btn-outline:hover { background: var(--lp-secondary); }
[data-theme="dark"] .lp-btn-outline:hover { background: rgba(59, 130, 246, 0.15); }
.lp-btn-ghost { background: transparent; color: var(--lp-text); border-color: var(--lp-border); }
.lp-btn-ghost:hover { background: var(--lp-surface-2); }
.lp-btn-white { background: #fff; color: var(--lp-primary-700); }
.lp-btn-white:hover { background: #f1f5f9; }
.lp-btn-sm { padding: 0.5rem 1rem; font-size: 0.82rem; }
.lp-icon-btn {
  width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  background: var(--lp-surface); border: 1px solid var(--lp-border); color: var(--lp-text); cursor: pointer;
  transition: background-color .2s var(--lp-ease), transform .2s var(--lp-ease);
}
.lp-icon-btn:hover { background: var(--lp-surface-2); transform: translateY(-2px); }

/* ---------- Badges ---------- */
.lp-badge {
  display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.72rem; font-weight: 600;
  padding: 0.25rem 0.65rem; border-radius: 999px; background: var(--lp-secondary); color: var(--lp-primary-700);
}
.lp-badge-success { background: rgba(34, 197, 94, 0.12); color: #15803d; }
.lp-badge-warning { background: rgba(245, 158, 11, 0.14); color: #b45309; }
.lp-badge-danger { background: rgba(239, 68, 68, 0.12); color: #b91c1c; }
[data-theme="dark"] .lp-badge-success { color: #4ade80; }
[data-theme="dark"] .lp-badge-warning { color: #fbbf24; }
[data-theme="dark"] .lp-badge-danger { color: #f87171; }

/* ---------- Hero ---------- */
.lp-hero {
  position: relative; overflow: hidden; min-height: 560px;
  display: flex; align-items: center;
  background:
    radial-gradient(60% 60% at 85% 15%, rgba(6, 182, 212, 0.16), transparent 60%),
    radial-gradient(50% 50% at 10% 90%, rgba(59, 130, 246, 0.14), transparent 60%),
    var(--lp-bg);
}
.lp-hero-grid {
  position: absolute; inset: 0; opacity: 0.5;
  background-image: radial-gradient(var(--lp-border) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(65% 65% at 50% 40%, black, transparent);
}
.lp-eyebrow {
  display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.78rem; font-weight: 600;
  background: var(--lp-secondary); color: var(--lp-primary-700); padding: 0.4rem 0.9rem; border-radius: 999px;
}
[data-theme="dark"] .lp-eyebrow { background: rgba(59, 130, 246, 0.16); }
.lp-hero-title { font-size: clamp(1.9rem, 4vw, 3rem); font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; }
.lp-hero-title .lp-gradient-text {
  background: linear-gradient(120deg, var(--lp-primary-500), var(--lp-accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lp-hero-desc { color: var(--lp-text-muted); font-size: 1.05rem; line-height: 1.8; max-width: 42rem; }

/* Hero illustration (hand-authored SVG, used when no real photo file is present) */
.lp-hero-illustration { width: 100%; height: auto; filter: drop-shadow(0 24px 40px rgba(37, 99, 235, 0.25)); }
.lp-hero-photo { width: 100%; height: 100%; object-fit: cover; border-radius: var(--lp-radius-lg); aspect-ratio: 4 / 3; }
.lp-hero-visual { position: relative; }
.lp-float-blob {
  position: absolute; border-radius: 999px; filter: blur(2px); z-index: 0;
  animation: lp-float 7s ease-in-out infinite;
}
.lp-float-blob-a { width: 70px; height: 70px; background: var(--lp-accent); opacity: 0.25; top: 6%; right: 8%; animation-delay: .4s; }
.lp-float-blob-b { width: 46px; height: 46px; background: var(--lp-primary-500); opacity: 0.3; bottom: 10%; left: 4%; animation-delay: 1.2s; }
@keyframes lp-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-14px); } }

/* SVG gradient stops for the hero illustration (external stylesheet reaches into inline SVG) */
.lp-stop-primary-500 { stop-color: var(--lp-primary-500); }
.lp-stop-primary-700 { stop-color: var(--lp-primary-700); }
.lp-stop-accent { stop-color: var(--lp-accent); }

/* Floating glass overview card */
.lp-overview-card { position: relative; z-index: 1; padding: 1.35rem; }
.lp-overview-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem; }
.lp-stat-mini { display: flex; align-items: center; gap: 0.65rem; }
.lp-stat-icon {
  width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1.05rem; flex-shrink: 0;
}
.lp-stat-value { font-size: 1.35rem; font-weight: 700; line-height: 1; }
.lp-stat-label { font-size: 0.72rem; color: var(--lp-text-muted); font-weight: 500; margin-top: 0.25rem; }

/* ---------- Section headings ---------- */
.lp-section { padding: 4rem 0; }
.lp-section-tight { padding: 2.5rem 0; }
.lp-kicker { color: var(--lp-primary-600); font-weight: 600; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.06em; }
.lp-section-title { font-size: clamp(1.4rem, 2.6vw, 2rem); font-weight: 700; letter-spacing: -0.01em; margin-top: 0.4rem; }
.lp-section-desc { color: var(--lp-text-muted); margin-top: 0.5rem; max-width: 42rem; }

/* ---------- Quick service cards ---------- */
.lp-service-icon {
  width: 52px; height: 52px; border-radius: 16px; display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; margin-bottom: 1rem;
}

/* ---------- Named gradients (bold — used for the hero overview card only) ---------- */
.lp-grad-indigo { background: linear-gradient(135deg, #6366f1, #4338ca); color: #fff; }
.lp-grad-green { background: linear-gradient(135deg, #22c55e, #15803d); color: #fff; }
.lp-grad-orange { background: linear-gradient(135deg, #f97316, #c2410c); color: #fff; }
.lp-grad-cyan { background: linear-gradient(135deg, #06b6d4, #0e7490); color: #fff; }
.lp-grad-purple { background: linear-gradient(135deg, #c084fc, #9333ea); color: #fff; }
.lp-grad-amber { background: linear-gradient(135deg, #f59e0b, #b45309); color: #fff; }
.lp-grad-brand { background: linear-gradient(135deg, var(--lp-primary-500), var(--lp-primary-700)); color: #fff; }

/* ---------- Soft pastel icon badges (quick-service cards, guide cards — matches reference mockup) ---------- */
.lp-badge-purple { background: #ede9fe; color: #7c3aed; }
.lp-badge-blue { background: #dbeafe; color: #2563eb; }
.lp-badge-cyan { background: #cffafe; color: #0891b2; }
.lp-badge-green { background: #dcfce7; color: #16a34a; }
.lp-badge-indigo { background: #e0e7ff; color: #4f46e5; }
.lp-badge-amber { background: #fef3c7; color: #d97706; }
[data-theme="dark"] .lp-badge-purple { background: rgba(124, 58, 237, 0.18); color: #c4b5fd; }
[data-theme="dark"] .lp-badge-blue { background: rgba(37, 99, 235, 0.18); color: #93c5fd; }
[data-theme="dark"] .lp-badge-cyan { background: rgba(8, 145, 178, 0.18); color: #67e8f9; }
[data-theme="dark"] .lp-badge-green { background: rgba(22, 163, 74, 0.18); color: #86efac; }
[data-theme="dark"] .lp-badge-indigo { background: rgba(37, 99, 235, 0.18); color: #a5b4fc; }
[data-theme="dark"] .lp-badge-amber { background: rgba(217, 119, 6, 0.18); color: #fcd34d; }

/* ---------- Misc layout helpers (kept out of markup as style= attributes) ---------- */
.lp-list-plain { list-style: none; padding: 0; margin: 0; }
.lp-w-search { width: 180px; }
.lp-max-420 { max-width: 420px; }
.lp-desc-clamp { min-height: 2.6em; }
.lp-live-dot { font-size: 6px; }

/* ---------- Stat summary (public dashboard) ---------- */
.lp-stat-card { padding: 1.4rem; display: flex; flex-direction: column; gap: 0.75rem; }
.lp-stat-card .lp-stat-icon { width: 46px; height: 46px; border-radius: 13px; font-size: 1.2rem; }
.lp-stat-card .lp-stat-value { font-size: 1.9rem; }

/* ---------- Table (public schedule) ---------- */
.lp-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.lp-table caption { caption-side: top; text-align: left; padding-bottom: 0.75rem; font-weight: 600; }
.lp-table thead th {
  text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--lp-text-muted); padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--lp-border);
}
.lp-table tbody td { padding: 0.75rem; border-bottom: 1px solid var(--lp-border); vertical-align: middle; }
.lp-table tbody tr { transition: background-color .2s var(--lp-ease); }
.lp-table tbody tr:hover { background: var(--lp-surface-2); }
.lp-period-chip { display: inline-block; background: var(--lp-surface-2); font-size: 0.78rem; font-weight: 600; padding: 0.3rem 0.6rem; border-radius: 8px; }

/* ---------- Empty state ---------- */
.lp-empty { text-align: center; color: var(--lp-text-muted); padding: 3rem 1rem; }
.lp-empty i { font-size: 2.2rem; opacity: 0.4; display: block; margin-bottom: 0.75rem; }

/* ---------- News ---------- */
.lp-news-thumb {
  width: 100%; aspect-ratio: 16 / 9; border-radius: var(--lp-radius-sm); display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1.8rem; background: linear-gradient(135deg, var(--lp-primary-500), var(--lp-accent));
}
.lp-news-thumb-sm {
  width: 56px; height: 56px; border-radius: var(--lp-radius-sm); display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1.3rem; background: linear-gradient(135deg, var(--lp-primary-500), var(--lp-accent));
}

/* ---------- Alert (announcement) ---------- */
.lp-alert { display: flex; gap: 0.85rem; align-items: flex-start; border-radius: var(--lp-radius); padding: 1.1rem 1.3rem; border: 1px solid; }
.lp-alert-icon { width: 38px; height: 38px; border-radius: 11px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.lp-alert-info { background: rgba(6, 182, 212, 0.08); border-color: rgba(6, 182, 212, 0.3); }
.lp-alert-info .lp-alert-icon { background: rgba(6, 182, 212, 0.16); color: #0e7490; }
.lp-alert-warning { background: rgba(245, 158, 11, 0.08); border-color: rgba(245, 158, 11, 0.3); }
.lp-alert-warning .lp-alert-icon { background: rgba(245, 158, 11, 0.18); color: #b45309; }
.lp-alert-success { background: rgba(34, 197, 94, 0.08); border-color: rgba(34, 197, 94, 0.3); }
.lp-alert-success .lp-alert-icon { background: rgba(34, 197, 94, 0.18); color: #15803d; }

/* ---------- Guide (details/summary accordion) ---------- */
.lp-faq { border: 1px solid var(--lp-border); border-radius: var(--lp-radius-sm); overflow: hidden; background: var(--lp-surface); }
.lp-faq + .lp-faq { margin-top: 0.6rem; }
.lp-faq summary {
  list-style: none; cursor: pointer; padding: 1rem 1.1rem; font-weight: 600; font-size: 0.92rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.lp-faq summary::-webkit-details-marker { display: none; }
.lp-faq summary .bi { transition: transform 0.25s var(--lp-ease); color: var(--lp-primary-600); }
.lp-faq[open] summary .bi { transform: rotate(180deg); }
.lp-faq-body { padding: 0 1.1rem 1.1rem; color: var(--lp-text-muted); font-size: 0.88rem; line-height: 1.75; }
.lp-guide-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.65rem; }
.lp-guide-steps li { display: flex; gap: 0.75rem; align-items: flex-start; font-size: 0.88rem; }
.lp-guide-steps .lp-step-num {
  width: 24px; height: 24px; border-radius: 999px; background: var(--lp-secondary); color: var(--lp-primary-700);
  font-size: 0.72rem; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 1px;
}
[data-theme="dark"] .lp-guide-steps .lp-step-num { background: rgba(59, 130, 246, 0.18); }

/* ---------- Contact ---------- */
.lp-contact-row { display: flex; align-items: flex-start; gap: 0.85rem; }
.lp-contact-icon {
  width: 40px; height: 40px; border-radius: 12px; background: var(--lp-secondary); color: var(--lp-primary-700);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
[data-theme="dark"] .lp-contact-icon { background: rgba(59, 130, 246, 0.16); }

/* ---------- Footer ---------- */
.lp-footer { background: linear-gradient(180deg, #201c4d, #14112f); color: rgba(255, 255, 255, 0.82); }
.lp-footer a { text-decoration: none; color: rgba(255, 255, 255, 0.68); transition: color .2s var(--lp-ease); }
.lp-footer a:hover { color: #fff; }
.lp-footer-social {
  width: 38px; height: 38px; border-radius: 11px; background: rgba(255, 255, 255, 0.08);
  display: flex; align-items: center; justify-content: center; color: #fff !important; transition: background-color .2s var(--lp-ease), transform .2s var(--lp-ease);
}
.lp-footer-social:hover { background: rgba(255, 255, 255, 0.18); transform: translateY(-2px); }

/* ---------- Scroll reveal ----------
   Only hidden pre-emptively when JS confirms it's running (html.js-enabled, set by an early inline
   script — see index.php <head>) so content is never stuck invisible if JS fails/is disabled/is slow. */
html.js-enabled .lp-reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.6s var(--lp-ease), transform 0.6s var(--lp-ease); }
html.js-enabled .lp-reveal.is-visible { opacity: 1; transform: translateY(0); }
@media (prefers-reduced-motion: reduce) {
  html.js-enabled .lp-reveal { opacity: 1; transform: none; transition: none; }
  .lp-float-blob { animation: none; }
  .lp-btn:hover, .lp-card-hover:hover, .lp-icon-btn:hover { transform: none; }
}

/* ---------- Skeleton (used briefly while lazy images decode) ---------- */
.lp-skeleton {
  background: linear-gradient(100deg, var(--lp-surface-2) 30%, var(--lp-border) 50%, var(--lp-surface-2) 70%);
  background-size: 200% 100%; animation: lp-skeleton 1.4s ease-in-out infinite;
}
@keyframes lp-skeleton { to { background-position: -200% 0; } }

/* ---------- Responsive ---------- */
@media (max-width: 1023px) {
  .lp-hero { min-height: auto; padding: 3rem 0; }
}
@media (max-width: 640px) {
  .lp-section { padding: 2.75rem 0; }
  .lp-overview-grid { grid-template-columns: 1fr 1fr; gap: 0.6rem; }
}
