/* =========================================================================
 * Base：reset + 排版 + 基礎元素
 * ====================================================================== */

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img, svg, video, canvas { max-width: 100%; height: auto; display: block; }
img { border-radius: inherit; }

a {
  color: var(--c-accent-strong);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease);
}
a:hover { color: var(--c-accent); }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--c-text);
  margin: 0 0 var(--sp-30);
}
h1 { font-size: var(--fs-3xl); }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-lg); }

p { margin: 0 0 var(--sp-30); }
p:last-child { margin-bottom: 0; }

ul, ol { margin: 0 0 var(--sp-30); padding-left: 1.25em; }

hr {
  border: 0;
  border-top: 1px solid var(--c-border);
  margin: var(--sp-50) 0;
}

small { font-size: var(--fs-sm); color: var(--c-text-muted); }

/* 表單基礎 */
input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--c-bg);
  border: 1.5px solid var(--c-border-strong);
  border-radius: var(--r-md);
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px var(--c-accent-soft);
}
::placeholder { color: var(--c-accent); opacity: 0.85; }

/* 可見鍵盤焦點（無障礙底線） */
:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* 螢幕閱讀器專用 */
.screen-reader-text {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--c-text); color: #fff;
  padding: 0.6rem 1rem; border-radius: 0 0 var(--r-sm) 0;
  z-index: 1000;
}
.skip-link:focus { left: 0; color: #fff; }

/* RTL 起手式（Phase 4 補完） */
[dir="rtl"] ul, [dir="rtl"] ol { padding-left: 0; padding-right: 1.25em; }
