/* ==========================================================================
   iFormCare / Charity Pharma — Site stylesheet
   Design system: Medical Blue + Clean White
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Noto+Sans+TC:wght@300;400;500;700;900&display=swap');

:root {
  --brand-50:  #eef5fc;
  --brand-100: #d7e8f7;
  --brand-200: #b0d0ee;
  --brand-300: #7fb2e1;
  --brand-400: #4a8ece;
  --brand-500: #1f6db5;
  --brand-600: #135796;
  --brand-700: #0e4477;
  --brand-800: #0b3459;
  --brand-900: #072540;
  --accent-400: #22c9dc;
  --accent-500: #0fb5c9;
  --accent-600: #0891a2;
  --ink: #0f172a;
  --muted: #64748b;
  --header-h: 72px;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: 'Noto Sans TC', 'Inter', -apple-system, BlinkMacSystemFont,
               'Segoe UI', 'PingFang TC', 'Microsoft JhengHei', sans-serif;
  color: var(--ink);
  background: #ffffff;
  line-height: 1.75;
  letter-spacing: .01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, .font-display {
  letter-spacing: -0.01em;
  line-height: 1.3;
}

/* --- Selection & focus ------------------------------------------------- */
::selection { background: var(--brand-600); color: #fff; }

a:focus-visible, button:focus-visible,
input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 3px;
  border-radius: 4px;
}

/* --- Scrollbar --------------------------------------------------------- */
@media (min-width: 1024px) {
  ::-webkit-scrollbar { width: 11px; height: 11px; }
  ::-webkit-scrollbar-track { background: #f1f5f9; }
  ::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 99px; border: 3px solid #f1f5f9; }
  ::-webkit-scrollbar-thumb:hover { background: var(--brand-400); }
}

/* --- Header ------------------------------------------------------------ */
.site-header {
  background: rgba(255, 255, 255, .82);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid rgba(15, 23, 42, .07);
  transition: box-shadow .3s ease, background .3s ease;
}
.site-header.is-scrolled {
  background: rgba(255, 255, 255, .95);
  box-shadow: 0 8px 30px -12px rgba(7, 37, 64, .22);
}

.nav-link {
  position: relative;
  padding: .5rem .85rem;
  font-size: .9375rem;
  font-weight: 500;
  color: #334155;
  border-radius: .5rem;
  transition: color .2s ease, background .2s ease;
}
.nav-link:hover { color: var(--brand-600); background: var(--brand-50); }
.nav-link.is-active { color: var(--brand-700); font-weight: 700; }
.nav-link.is-active::after {
  content: '';
  position: absolute;
  left: .85rem; right: .85rem; bottom: .1rem;
  height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, var(--brand-500), var(--accent-500));
}

/* Mobile drawer */
.mobile-nav {
  max-height: 0;
  overflow: hidden;
  transition: max-height .4s cubic-bezier(.4, 0, .2, 1);
}
.mobile-nav.is-open { max-height: 34rem; }

.burger span {
  display: block; height: 2px; width: 22px; border-radius: 2px;
  background: var(--brand-800);
  transition: transform .3s ease, opacity .2s ease;
}
.burger.is-open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.burger.is-open span:nth-child(2) { opacity: 0; }
.burger.is-open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* --- Hero -------------------------------------------------------------- */
.hero {
  position: relative;
  isolation: isolate;
  background:
    linear-gradient(105deg, rgba(7, 37, 64, .94) 0%, rgba(11, 52, 89, .88) 42%, rgba(15, 87, 150, .68) 100%),
    url('../img/hero-area.jpg') center 38% / cover no-repeat;
}
.hero::after {
  content: '';
  position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(900px 420px at 82% 18%, rgba(34, 201, 220, .22), transparent 68%),
    radial-gradient(700px 380px at 8% 92%, rgba(31, 109, 181, .28), transparent 70%);
}
.hero-sub {
  position: relative;
  background: linear-gradient(120deg, var(--brand-900) 0%, var(--brand-700) 58%, var(--brand-600) 100%);
}
.hero-sub::after {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(720px 320px at 88% 10%, rgba(34, 201, 220, .20), transparent 70%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40'%3E%3Cpath d='M0 39.5H40M39.5 0V40' stroke='rgba(255,255,255,.05)' stroke-width='1'/%3E%3C/svg%3E");
  pointer-events: none;
}

/* ECG line accent */
.ecg-line { stroke-dasharray: 1200; stroke-dashoffset: 1200; animation: ecg 4.5s ease-in-out infinite; }
@keyframes ecg {
  0%   { stroke-dashoffset: 1200; opacity: 0; }
  12%  { opacity: 1; }
  70%  { stroke-dashoffset: 0; opacity: 1; }
  100% { stroke-dashoffset: 0; opacity: 0; }
}

/* --- Reveal on scroll --------------------------------------------------- */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity .7s cubic-bezier(.16, 1, .3, 1), transform .7s cubic-bezier(.16, 1, .3, 1);
  will-change: opacity, transform;
}
.reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .ecg-line { animation: none; stroke-dashoffset: 0; }
  html { scroll-behavior: auto; }
}

/* --- Components --------------------------------------------------------- */
.card {
  background: #fff;
  border: 1px solid #e7edf4;
  border-radius: 1rem;
  transition: transform .35s cubic-bezier(.16, 1, .3, 1), box-shadow .35s ease, border-color .35s ease;
}
.card:hover {
  transform: translateY(-5px);
  border-color: var(--brand-200);
  box-shadow: 0 26px 50px -28px rgba(7, 37, 64, .40);
}

.eyebrow {
  display: inline-flex; align-items: center; gap: .5rem;
  font-size: .8125rem; font-weight: 700; letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--brand-600);
}
.eyebrow::before {
  content: ''; width: 26px; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, var(--brand-500), var(--accent-500));
}
.eyebrow-light { color: var(--accent-400); }
.eyebrow-light::before { background: linear-gradient(90deg, var(--accent-400), rgba(255,255,255,.35)); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .8rem 1.6rem;
  border-radius: .625rem;
  font-weight: 700; font-size: .9375rem; line-height: 1;
  transition: transform .2s ease, box-shadow .25s ease, background .25s ease, color .25s ease;
  white-space: nowrap;
}
.btn-primary { background: var(--brand-600); color: #fff; box-shadow: 0 12px 24px -12px rgba(19, 87, 150, .8); }
.btn-primary:hover { background: var(--brand-700); transform: translateY(-2px); box-shadow: 0 18px 32px -14px rgba(19, 87, 150, .9); }
.btn-ghost { border: 1px solid rgba(255, 255, 255, .38); color: #fff; }
.btn-ghost:hover { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .7); transform: translateY(-2px); }
.btn-outline { border: 1px solid var(--brand-200); color: var(--brand-700); background: #fff; }
.btn-outline:hover { border-color: var(--brand-500); background: var(--brand-50); transform: translateY(-2px); }

.tag {
  display: inline-flex; align-items: center;
  padding: .3rem .7rem;
  font-size: .75rem; font-weight: 600; letter-spacing: .02em;
  border-radius: 99px;
  background: var(--brand-50);
  color: var(--brand-700);
  border: 1px solid var(--brand-100);
}

.link-underline {
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0% 1.5px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size .35s cubic-bezier(.16, 1, .3, 1);
}
.link-underline:hover { background-size: 100% 1.5px; }

.rule-grad { height: 1px; background: linear-gradient(90deg, transparent, var(--brand-200), transparent); }

/* Timeline */
.timeline { position: relative; }
.timeline::before {
  content: ''; position: absolute; left: 11px; top: 6px; bottom: 6px; width: 2px;
  background: linear-gradient(180deg, var(--brand-400), var(--accent-500), transparent);
}
.timeline-dot {
  /* li 為定位基準，而縮排 (pl-11 = 2.75rem) 加在 ol 上，
     故需往左拉回一個縮排寬度，才會對齊 ::before 的軸線 */
  position: absolute; left: -2.75rem; top: 4px;
  width: 24px; height: 24px; border-radius: 99px;
  background: #fff; border: 2px solid var(--brand-500);
  display: grid; place-items: center;
}
.timeline-dot::after { content: ''; width: 8px; height: 8px; border-radius: 99px; background: var(--brand-500); }

/* Forms */
.field {
  width: 100%;
  padding: .75rem .95rem;
  font: inherit; font-size: .9375rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid #dbe4ee;
  border-radius: .625rem;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.field::placeholder { color: #94a3b8; }
.field:focus { outline: none; border-color: var(--brand-500); box-shadow: 0 0 0 4px rgba(31, 109, 181, .12); }

/* Footer */
.footer-link { color: #b9cbdd; transition: color .2s ease; }
.footer-link:hover { color: #fff; }

/* Print */
@media print {
  .site-header, .no-print { display: none !important; }
  body { color: #000; }
}
