/* ChivaCare TMS — Premium Medical Theme (clean white + cool neutrals + depth) */
:root {
  /* Medical palette — clinical white, deep navy, teal accent */
  --primary: #00377a;        /* deeper professional navy */
  --primary-2: #0a5dba;
  --primary-soft: #dbe6f5;
  --primary-tint: #f4f7fb;   /* very faint cool gray-blue, almost white */
  --accent: #0c8aa8;         /* deeper, more clinical teal */
  --accent-2: #14a3c4;
  --accent-soft: #e1f0f4;
  --gold: #b8945a;
  --ink: #0a1628;
  --ink-2: #3d4a5f;
  --ink-3: #6e7a8f;
  --ink-4: #b0bbcd;
  --line: #dde3ec;
  --line-soft: #ecf0f5;
  --bg: #ffffff;
  --bg-2: #f8fafc;           /* neutral cool gray, not blue */
  --bg-3: #f1f4f8;
  --white: #ffffff;
  /* Legacy aliases */
  --navy: #00377a;
  --navy-deep: #001f4a;
  --navy-2: #0a5dba;
  --teal: #0c8aa8;
  --teal-soft: #e1f0f4;
  --cream: #f8fafc;
  --cream-2: #f1f4f8;
  --line-1: #dde3ec;
  --muted: #3d4a5f;
  --muted-2: #6e7a8f;
  --yellow: #f4c430;
  --sky-soft: #e1f0f4;

  /* Layered shadows for real depth */
  --shadow-xs: 0 1px 2px rgba(10,22,40,.04), 0 1px 1px rgba(10,22,40,.03);
  --shadow-sm: 0 2px 4px rgba(10,22,40,.04), 0 4px 12px rgba(10,22,40,.06);
  --shadow-md: 0 4px 8px rgba(10,22,40,.05), 0 12px 32px rgba(10,22,40,.10);
  --shadow-lg: 0 8px 16px rgba(10,22,40,.06), 0 32px 64px rgba(10,22,40,.14);
  --shadow-xl: 0 12px 24px rgba(10,22,40,.08), 0 48px 96px rgba(10,22,40,.18);
  --shadow-image: 0 2px 4px rgba(10,22,40,.05), 0 12px 28px rgba(10,22,40,.12), 0 24px 56px rgba(10,22,40,.10);
  --ring-primary: 0 0 0 1px rgba(0,55,122,.08);
  --radius: 10px;
  --radius-lg: 14px;
  --radius-pill: 999px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Prompt", "IBM Plex Sans Thai", "Noto Sans Thai", "Sarabun", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: var(--white);
  color: var(--ink-2);
  font-size: 17px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-weight: 300;
  letter-spacing: 0;
}
img { max-width: 100%; display: block; }
a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* Headings — Prompt SemiBold for hospital authority */
h1, h2, h3, h4, h5 {
  font-family: "Prompt", "IBM Plex Sans Thai", "Noto Sans Thai", sans-serif;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -.2px;
  line-height: 1.25;
}
h1 { font-weight: 500; letter-spacing: -.5px; }
strong, b { font-weight: 500; color: var(--ink); }

.wrap { max-width: 1280px; margin: 0 auto; padding: 0 32px; }

/* ============== Top bar ============== */
.topbar {
  background: var(--white);
  color: var(--ink-3);
  font-size: 13px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-soft);
}
.topbar .wrap { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.topbar a { color: var(--primary); }
.topbar .tb-right { display: flex; gap: 24px; align-items: center; }
.topbar .tb-right span { display: inline-flex; align-items: center; gap: 6px; }

/* ============== Header / Nav ============== */
.site-header {
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border-bottom: 1px solid var(--line-soft);
  position: sticky; top: 0; z-index: 50;
  transition: box-shadow .3s, border-color .3s;
}
.site-header.scrolled { box-shadow: 0 4px 24px rgba(10,31,61,.06); border-color: transparent; }
.site-header .wrap { display: flex; align-items: center; gap: 36px; padding-top: 18px; padding-bottom: 18px; transition: padding .3s; }
.site-header.scrolled .wrap { padding-top: 12px; padding-bottom: 12px; }
.brand { display: flex; align-items: center; gap: 14px; }
.brand img { height: 48px; width: auto; }
.brand .b-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand .b-text .b1 { font-weight: 700; color: var(--primary); font-size: 18px; letter-spacing: .2px; }
.brand .b-text .b2 { font-size: 11px; color: var(--ink-3); letter-spacing: 2px; text-transform: uppercase; margin-top: 2px; }

.nav { display: flex; gap: 4px; margin-left: auto; align-items: center; }
.nav a { padding: 10px 16px; border-radius: 8px; color: var(--ink-2); font-weight: 500; font-size: 15px; transition: .15s; position: relative; }
.nav a:hover { color: var(--primary); }
.nav a:not(.cta).active { color: var(--primary); }
.nav a:not(.cta)::after {
  content: ''; position: absolute; bottom: 4px; left: 16px; right: 16px; height: 2px;
  background: var(--primary); transform: scaleX(0); transform-origin: left; transition: transform .3s;
}
.nav a:not(.cta):hover::after, .nav a:not(.cta).active::after { transform: scaleX(1); }
.nav .cta {
  background: linear-gradient(135deg, #0a5dba 0%, #00377a 100%);
  color: #fff; padding: 11px 22px; margin-left: 8px;
  border-radius: var(--radius-pill); font-weight: 600;
  box-shadow: 0 1px 0 rgba(255,255,255,.18) inset, 0 4px 12px rgba(0,55,122,.18);
}
.nav .cta:hover {
  background: linear-gradient(135deg, #1469cc 0%, #0a4a96 100%);
  color: #fff; transform: translateY(-1px);
  box-shadow: 0 1px 0 rgba(255,255,255,.22) inset, 0 10px 24px rgba(0,55,122,.30);
}

.menu-toggle { display: none; background: transparent; border: 1px solid var(--line); padding: 8px 12px; border-radius: 10px; }

@media (max-width: 980px) {
  .nav { display: none; position: absolute; top: 100%; left: 0; right: 0; background: white; flex-direction: column; padding: 16px; border-bottom: 1px solid var(--line); box-shadow: var(--shadow-md); }
  .nav.open { display: flex; }
  .nav a { width: 100%; }
  .menu-toggle { display: inline-flex; margin-left: auto; }
}

/* ============== Buttons ============== */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 15px 30px; border-radius: var(--radius-pill);
  font-weight: 500; font-size: 16px; border: none;
  transition: .25s cubic-bezier(.2,.7,.2,1); line-height: 1;
  letter-spacing: .2px;
  font-family: "Prompt", "IBM Plex Sans Thai", sans-serif;
  position: relative; overflow: hidden;
}
.btn-primary {
  background: linear-gradient(135deg, #0a5dba 0%, #00377a 55%, #001f4a 100%);
  color: #fff;
  box-shadow: 0 1px 0 rgba(255,255,255,.18) inset, 0 6px 16px rgba(0,55,122,.22);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #1469cc 0%, #0a4a96 55%, #002857 100%);
  transform: translateY(-2px);
  box-shadow: 0 1px 0 rgba(255,255,255,.22) inset, 0 14px 32px rgba(0,55,122,.32);
  color: #fff;
}
.btn-outline { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline:hover {
  background: linear-gradient(135deg, #0a5dba 0%, #00377a 100%);
  color: #fff; border-color: transparent;
  box-shadow: 0 8px 20px rgba(0,55,122,.22);
}
.btn-ghost { background: transparent; color: var(--primary); border: 1.5px solid var(--line); }
.btn-ghost:hover { border-color: var(--primary); background: var(--primary-tint); }
.btn-line { background: linear-gradient(135deg, #06c755 0%, #04a945 100%); color: #fff; box-shadow: 0 1px 0 rgba(255,255,255,.2) inset, 0 6px 16px rgba(6,199,85,.24); }
.btn-line:hover { background: linear-gradient(135deg, #08d75e 0%, #05b94c 100%); color: #fff; transform: translateY(-2px); box-shadow: 0 1px 0 rgba(255,255,255,.22) inset, 0 12px 28px rgba(6,199,85,.34); }
.btn-yellow {
  background: linear-gradient(135deg, #0c8aa8 0%, #00377a 60%, #001f4a 100%);
  color: #fff;
  box-shadow: 0 1px 0 rgba(255,255,255,.2) inset, 0 6px 18px rgba(0,55,122,.25);
}
.btn-yellow:hover {
  background: linear-gradient(135deg, #14a3c4 0%, #0a4a96 60%, #002857 100%);
  color: #fff; transform: translateY(-2px);
  box-shadow: 0 1px 0 rgba(255,255,255,.24) inset, 0 14px 34px rgba(0,55,122,.34);
}

/* ============== Section helpers ============== */
.section { padding: 110px 0; }
.section-sm { padding: 72px 0; }
.eyebrow {
  display: inline-block; color: var(--accent); font-weight: 500;
  font-size: 13px; letter-spacing: 3px; text-transform: uppercase; margin-bottom: 20px;
  position: relative; padding-left: 32px;
  font-family: "Prompt", sans-serif;
}
.eyebrow::before {
  content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 22px; height: 1px; background: var(--accent);
}
h1, h2, h3, h4 { color: var(--ink); margin: 0; line-height: 1.25; font-weight: 500; letter-spacing: -.2px; }
h1 { font-size: clamp(40px, 5.2vw, 68px); font-weight: 500; line-height: 1.12; letter-spacing: -.8px; }
h2 { font-size: clamp(32px, 3.6vw, 48px); font-weight: 500; letter-spacing: -.4px; line-height: 1.2; }
h3 { font-size: clamp(20px, 1.8vw, 24px); font-weight: 500; }
p { color: var(--ink-2); font-weight: 300; }
.lead { font-size: 19px; color: var(--ink-2); line-height: 1.8; font-weight: 300; }

.section-head { max-width: 760px; margin-bottom: 64px; }
.section-head.center { margin-left: auto; margin-right: auto; text-align: center; }
.section-head h2 { margin-bottom: 18px; }

.pill {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--primary-tint); color: var(--primary);
  padding: 9px 18px; border-radius: var(--radius-pill);
  font-size: 13px; font-weight: 500; letter-spacing: .5px;
  border: 1px solid var(--primary-soft);
  font-family: "Prompt", sans-serif;
}
.pill-yellow { background: var(--accent-soft); color: #006d8e; border-color: #c4e3eb; }
.pill-teal { background: var(--primary-tint); color: var(--primary); }

/* Card */
.card {
  background: white; border-radius: var(--radius-lg); padding: 32px;
  box-shadow: var(--shadow-sm); border: 1px solid var(--line);
  transition: .3s cubic-bezier(.2,.7,.2,1);
}
.card:hover { box-shadow: var(--shadow-lg); transform: translateY(-4px); border-color: var(--primary-soft); }

/* Footer */
.site-footer {
  background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg-3) 100%);
  color: var(--ink-2); padding: 80px 0 28px; margin-top: 0;
  border-top: 1px solid var(--line);
}
.site-footer h4 { color: var(--ink); margin-bottom: 20px; font-size: 15px; font-weight: 600; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 48px; }
.footer-grid a { color: var(--ink-2); display: block; padding: 5px 0; font-size: 14px; transition: .15s; }
.footer-grid a:hover { color: var(--primary); }
.footer-grid p { color: var(--ink-3); font-size: 14px; line-height: 1.7; }
.footer-bottom { border-top: 1px solid var(--line); margin-top: 56px; padding-top: 28px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; font-size: 13px; color: var(--ink-3); }
.footer-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.footer-brand img { height: 52px; }
@media (max-width: 800px) { .footer-grid { grid-template-columns: 1fr 1fr; } }

/* Floating contact */
.floating-contact { position: fixed; right: 24px; bottom: 24px; display: flex; flex-direction: column; gap: 12px; z-index: 40; }
.floating-contact a {
  width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center;
  box-shadow: var(--shadow-md); transition: .25s; color: white; font-size: 20px; text-decoration: none;
  position: relative;
}
.floating-contact a:hover { transform: scale(1.08); box-shadow: var(--shadow-lg); }
.fc-line { background: #06c755; }
.fc-call { background: var(--primary); }
.fc-fb { background: #1877f2; }
.fc-line::after {
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  background: #06c755; animation: pulse-ring 2.4s cubic-bezier(.45,0,.55,1) infinite; z-index: -1;
}
@keyframes pulse-ring { 0% { transform: scale(1); opacity: .5; } 100% { transform: scale(1.7); opacity: 0; } }

/* Utility */
.grid { display: grid; gap: 28px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .section { padding: 72px 0; }
}

/* ========== Mobile fine-tuning ========== */
@media (max-width: 700px) {
  .wrap { padding: 0 20px; }
  body { font-size: 16px; line-height: 1.7; }
  h1 { font-size: clamp(30px, 8vw, 38px); letter-spacing: -.4px; line-height: 1.18; }
  h2 { font-size: clamp(26px, 6vw, 32px); letter-spacing: -.2px; }
  h3 { font-size: 19px; }
  .lead { font-size: 16px; line-height: 1.7; }
  .section { padding: 56px 0; }
  .section-sm { padding: 48px 0; }
  .section-head { margin-bottom: 40px; }
  .btn { padding: 13px 22px; font-size: 14px; }
  .topbar { font-size: 12px; padding: 8px 0; }
  .topbar .tb-left { display: none; }
  .topbar .tb-right { gap: 14px; width: 100%; justify-content: center; }
  .site-header .wrap { padding-top: 12px; padding-bottom: 12px; gap: 12px; }
  .brand img { height: 40px; }
  .brand .b-text .b1 { font-size: 16px; }
  .brand .b-text .b2 { font-size: 10px; letter-spacing: 1.2px; }
  .page-hero { padding: 56px 0 48px; }
  .floating-contact { right: 14px; bottom: 14px; gap: 10px; }
  .floating-contact a { width: 48px; height: 48px; font-size: 18px; }
  .site-footer { padding: 56px 0 24px; }
  .footer-grid { gap: 32px; }
}
@media (max-width: 480px) {
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
  .footer-bottom { flex-direction: column; align-items: flex-start; gap: 6px; }
}

/* Reveal — visible by default, JS can add .reveal-fade for opt-in entrance */
.reveal { opacity: 1; transform: none; }
.reveal.fade-up { opacity: 0; transform: translateY(24px); transition: opacity .9s cubic-bezier(.2,.7,.2,1), transform .9s cubic-bezier(.2,.7,.2,1); }
.reveal.fade-up.in { opacity: 1; transform: none; }

/* Page hero (subpages) — clean white version with depth */
.page-hero {
  background: var(--white); color: var(--ink); padding: 100px 0 90px;
  position: relative; overflow: hidden; border-bottom: 1px solid var(--line-soft);
}
.page-hero::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(900px 500px at 88% 10%, rgba(12,138,168,.06), transparent 60%),
    radial-gradient(800px 600px at 5% 85%, rgba(0,55,122,.05), transparent 55%);
}
.page-hero::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .3;
  background-image: linear-gradient(to right, rgba(0,55,122,.04) 1px, transparent 1px);
  background-size: 80px 80px;
  mask-image: linear-gradient(to bottom, transparent, black 20%, black 80%, transparent);
}
.page-hero > * { position: relative; z-index: 1; }
.page-hero h1, .page-hero p { color: var(--ink); position: relative; }
.page-hero p.lead { color: var(--ink-2); max-width: 720px; }
.page-hero .pill { background: white; border: 1px solid var(--line); box-shadow: var(--shadow-xs); }
.page-hero .pill-yellow { background: white; color: var(--accent); border-color: var(--accent-soft); box-shadow: var(--shadow-xs); }

/* Site header logo polish */
.site-header { background: rgba(255,255,255,.95); }
.brand img { filter: drop-shadow(0 1px 2px rgba(10,22,40,.08)); }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .reveal { opacity: 1; transform: none; }
}
