/* 
 * 社團法人屏東縣原始點關懷協會 - 全站樣式表 (styles.css)
 * 遵循高齡無障礙、WCAG AA 級標準、大字體、高對比與響應式配置。
 */

/* ==========================================================================
   1. 設計標記與 CSS 變數 (Design Tokens & CSS Variables)
   ========================================================================== */
:root {
  /* 色彩系統 (高對比與溫暖調性，避開醫療藍/商業紫) */
  --color-bg: #ffffff;
  --color-bg-alt: #f9fafb;
  --color-bg-warn: #fef3c7; /* 淺琥珀黃，免責聲明背景 */
  --color-text-primary: #1f2937; /* 深灰黑，與白底對比達 15:1 */
  --color-text-secondary: #4b5563; /* 中灰，對比度 > 6.5:1 */
  --color-brand: #d97706; /* 暖琥珀橘，主要 CTA 與按鈕色 */
  --color-brand-hover: #b45309;
  --color-border: #e5e7eb;
  --color-border-warn: #f59e0b;
  --color-focus: #d97706;

  /* 字級系統 (高齡友善特大化，內文 18px，無 12px 灰色小字) */
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Microsoft JhengHei", "蘋方-繁", sans-serif;
  --font-size-base: 18px; /* 內文基準 18px */
  --font-size-sm: 16px; /* 頁尾與次要標註不得低於 15px */
  --font-size-md: 20px;
  --font-size-lg: 24px;
  --font-size-xl: 28px;
  --font-size-h1: clamp(1.8rem, 4vw, 2.5rem); /* 響應式大標題 */
  
  --line-height-body: 1.8; /* 寬裕行高防跳行 */
  --line-height-heading: 1.4;

  /* 佈局與間距 */
  --max-width-content: 65ch; /* 限制內文單行寬度約 30 字，避免長輩視線移動困難 */
  --max-width-container: 1100px;
  --rounded-md: 8px;
  --transition-fast: 0.2s ease;
}

/* ==========================================================================
   2. 基礎重設 (Reset & Base Styles)
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: var(--font-size-base);
  font-family: var(--font-family);
  color: var(--color-text-primary);
  background-color: var(--color-bg);
  line-height: var(--line-height-body);
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: var(--line-height-heading);
  color: var(--color-text-primary);
  margin-bottom: 0.8em;
}

h1 { font-size: var(--font-size-h1); }
h2 { font-size: var(--font-size-xl); margin-top: 1.5em; border-left: 6px solid var(--color-brand); padding-left: 12px; }
h3 { font-size: var(--font-size-lg); margin-top: 1.2em; }

p, ul, ol {
  margin-bottom: 1.2em;
}

ul, ol {
  padding-left: 1.5rem;
}

li {
  margin-bottom: 0.5em;
}

a {
  color: var(--color-brand);
  text-decoration: underline;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-brand-hover);
}

/* 鍵盤操作無障礙焦點指標 */
:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 3px;
}

/* 無障礙：跳過主要導覽 (Skip Link) */
.skip-link {
  position: absolute;
  top: -100px;
  left: 0;
  background: var(--color-brand);
  color: #fff;
  padding: 8px 16px;
  z-index: 100;
  text-decoration: none;
  font-weight: bold;
  transition: top 0.2s;
}

.skip-link:focus {
  top: 0;
}

/* ==========================================================================
   3. 全局版面配置 (Global Layout)
   ========================================================================== */
.container {
  width: 100%;
  max-width: var(--max-width-container);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.main-content {
  flex-grow: 1;
  padding: 3rem 0;
}

.prose {
  max-width: var(--max-width-content);
  margin-left: 0;
}

/* ==========================================================================
   4. Header & Footer
   ========================================================================== */
.site-header {
  border-bottom: 4px solid var(--color-brand);
  background-color: var(--color-bg);
  padding: 1.5rem 0;
  position: sticky;
  top: 0;
  z-index: 50;
}

.site-header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

.site-logo {
  font-size: var(--font-size-lg);
  font-weight: 800;
  color: var(--color-text-primary);
  text-decoration: none;
  margin-right: 1.5rem;
}

.site-nav ul {
  display: flex;
  list-style: none;
  padding: 0;
  margin: 0;
  flex-wrap: wrap;
}

.site-nav li {
  margin: 0.25rem 0.75rem;
}

.site-nav a {
  text-decoration: none;
  font-weight: 700;
  color: var(--color-text-primary);
  padding: 0.5rem 0.25rem;
  border-bottom: 2px solid transparent;
}

.site-nav a:hover,
.site-nav a.active {
  color: var(--color-brand);
  border-bottom: 2px solid var(--color-brand);
}

.site-footer {
  background-color: var(--color-bg-alt);
  border-top: 1px solid var(--color-border);
  padding: 3rem 0;
  margin-top: 4rem;
  font-size: var(--font-size-sm);
}

.site-footer-links {
  display: flex;
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem 0;
  flex-wrap: wrap;
}

.site-footer-links li {
  margin-right: 1.5rem;
}

.site-footer-links a {
  color: var(--color-text-secondary);
  text-decoration: none;
  font-weight: 700;
}

.site-footer-links a:hover {
  text-decoration: underline;
  color: var(--color-brand);
}

/* ==========================================================================
   5. UI 元件 (UI Components)
   ========================================================================== */
/* 按鈕與連結區 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px; /* 觸控目標高度 */
  padding: 0 1.5rem;
  background-color: var(--color-brand);
  color: #ffffff;
  text-decoration: none;
  font-weight: 700;
  border-radius: var(--rounded-md);
  border: none;
  cursor: pointer;
  transition: background-color var(--transition-fast), transform var(--transition-fast);
}

.btn:hover {
  background-color: var(--color-brand-hover);
  color: #ffffff;
  transform: translateY(-2px);
}

.btn-secondary {
  background-color: var(--color-text-primary);
}

.btn-secondary:hover {
  background-color: #000000;
}

.btn-disabled {
  background-color: #d1d5db;
  color: #9ca3af;
  cursor: not-allowed;
  pointer-events: none;
}

/* 免責與非醫療聲明警告框 */
.notice-box {
  background-color: var(--color-bg-warn);
  border: 2px solid var(--color-border-warn);
  border-left: 8px solid var(--color-border-warn);
  padding: 1.5rem;
  border-radius: var(--rounded-md);
  margin: 2rem 0;
}

.notice-box p {
  margin-bottom: 0;
  font-weight: 700;
}

/* 資訊卡片區 */
.info-card {
  background-color: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-left: 6px solid var(--color-brand);
  padding: 1.5rem;
  border-radius: var(--rounded-md);
  margin-bottom: 1.5rem;
}

.info-card h3 {
  margin-top: 0;
}

.info-card p:last-child {
  margin-bottom: 0;
}

/* 雙欄與大網格配置 (排版防擁擠) */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
  margin: 2.5rem 0;
}

@media (min-width: 768px) {
  .grid-2 {
    grid-template-columns: 1fr 1fr;
  }
}

/* ==========================================================================
   6. 行動端懸浮 Sticky CTA
   ========================================================================== */
.sticky-cta-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background-color: var(--color-bg);
  border-top: 3px solid var(--color-brand);
  padding: 0.75rem 1.5rem;
  display: flex;
  gap: 1rem;
  z-index: 100;
  box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.05);
}

.sticky-cta-bar .btn {
  flex: 1;
  font-size: var(--font-size-sm);
  min-height: 48px;
}

/* 桌上型隱藏手機底部懸浮 */
@media (min-width: 768px) {
  .sticky-cta-bar {
    display: none;
  }
}

/* 給手機版內容預留底部空間避免被 Sticky 覆蓋 */
.main-content {
  padding-bottom: 6rem;
}

/* ==========================================================================
   7. 其他無障礙設定
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
