/* ============================================================
   Resona — 設計系統（學術／研究文件風格）

   取向：以論文與研究報告的排版語彙為基礎——
   襯線標題、細線分隔、編號章節、克制的用色。
   刻意避免行銷式的漸層、光暈、浮動卡片與強調色塊。
   ============================================================ */

:root {
  /* 墨色階 */
  --ink:      #16202a;
  --ink-2:    #4a5761;
  --ink-3:    #78848c;

  /* 紙色階（微暖，接近印刷用紙） */
  --paper:    #fbfaf7;
  --paper-2:  #f3f1ec;
  --surface:  #ffffff;

  /* 主色：靛藍墨。僅用於連結、標記與少量強調 */
  --teal-800: #1c3243;
  --teal-700: #26455a;
  --teal-600: #2f5468;
  --teal-400: #6f8b9b;
  --teal-200: #c3cfd6;
  --teal-100: #e8edf0;

  /* 註記色：低彩度的赭。用於限制說明與註腳，不作為裝飾 */
  --gold:     #7d5f2e;
  --gold-300: #c1a677;
  --gold-100: #f4f0e6;

  --line:     #ddd8cd;
  --line-2:   rgba(22, 32, 42, 0.12);

  /* 圓角：研究文件不需要圓角，僅保留極小值避免銳利感 */
  --r-sm: 2px;
  --r:    3px;
  --r-lg: 4px;

  /* 陰影：幾乎不使用，僅在深色畫布上做最小限度的分離 */
  --sh-1: none;
  --sh-2: 0 1px 2px rgba(22, 32, 42, 0.06);
  --sh-3: 0 2px 14px -8px rgba(22, 32, 42, 0.35);

  --sans: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei",
          "Hiragino Sans GB", -apple-system, "Segoe UI", system-ui, sans-serif;
  /* 標題與數字用襯線體，是本頁學術調性的主要來源 */
  --serif: "Noto Serif TC", "Source Han Serif TC", "Songti TC", "Songti SC",
           "SimSun", Georgia, "Times New Roman", serif;

  --ease: cubic-bezier(0.22, 0.7, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.9;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img, svg { max-width: 100%; display: block; }
::selection { background: var(--teal-100); color: var(--ink); }

:focus-visible {
  outline: 2px solid var(--teal-600);
  outline-offset: 2px;
}

.container { width: min(1080px, 90%); margin-inline: auto; }
.container--narrow { width: min(720px, 90%); }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}

/* ============================================================
   文字系統
   ============================================================ */

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 700;
  line-height: 1.5;
  text-wrap: balance;
  letter-spacing: 0.01em;
}
h1 { font-size: clamp(1.72rem, 3.2vw, 2.5rem); line-height: 1.4; }
h2 { font-size: clamp(1.32rem, 2.2vw, 1.72rem); }
h3 { font-size: 1.06rem; line-height: 1.6; }

/* 章節編號標籤 */
.eyebrow {
  display: block;
  font-family: var(--serif);
  font-size: 0.82rem; font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--ink-3);
  margin-bottom: 0.7em;
}

/* 區塊標頭 */
.head { max-width: 40em; margin-bottom: 2.5rem; }
.head--center { margin-inline: auto; text-align: center; }
.head__lead {
  margin-top: 0.9rem;
  font-size: 0.98rem;
  color: var(--ink-2);
  max-width: 42em;
}

/* ============================================================
   按鈕：方正、細邊框，接近文件中的操作連結
   ============================================================ */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5em;
  padding: 0.72em 1.35em;
  border-radius: var(--r-sm);
  font: inherit; font-size: 0.94rem; font-weight: 600;
  letter-spacing: 0.04em;
  text-decoration: none;
  border: 1px solid var(--ink);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.18s var(--ease), color 0.18s var(--ease),
              border-color 0.18s var(--ease);
}
.btn--primary { color: var(--paper); background: var(--ink); }
.btn--primary:hover { background: var(--teal-800); border-color: var(--teal-800); }
.btn--ghost {
  color: var(--ink);
  border-color: var(--line);
  background: transparent;
}
.btn--ghost:hover { border-color: var(--ink); }
.btn--small { padding: 0.5em 1em; font-size: 0.88rem; }

/* ============================================================
   頁首
   ============================================================ */

.nav {
  position: sticky; top: 0; z-index: 60;
  background: rgba(251, 250, 247, 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.nav--stuck { border-bottom-color: var(--line-2); }
.nav__inner { display: flex; align-items: center; gap: 1.5rem; padding: 0.85rem 0; }

.nav__logo {
  display: inline-flex; align-items: baseline; gap: 0.5rem;
  font-family: var(--serif);
  font-weight: 700; font-size: 1.14rem; letter-spacing: 0.04em;
  color: var(--ink); text-decoration: none;
  flex: none;
}
.nav__mark { width: 22px; height: 22px; color: var(--teal-600); align-self: center; }
.nav__sub {
  font-family: var(--sans);
  font-size: 0.76rem; font-weight: 400; letter-spacing: 0.04em;
  color: var(--ink-3);
  border-left: 1px solid var(--line);
  padding-left: 0.6rem;
}
.nav__links { display: flex; gap: 1.25rem; margin-left: auto; }
.nav__links a {
  color: var(--ink-2); text-decoration: none;
  font-size: 0.9rem;
  padding: 0.15em 0;
  border-bottom: 1px solid transparent;
  transition: color 0.18s var(--ease), border-color 0.18s var(--ease);
}
.nav__links a:hover { color: var(--ink); border-bottom-color: var(--ink-3); }
.nav__toggle { display: none; }

/* ============================================================
   首段：標題頁（模仿論文首頁的排版）
   ============================================================ */

.hero { border-bottom: 1px solid var(--line); background: var(--paper); }
.hero__inner {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  align-items: start;
  gap: 3.5rem;
  padding: 4.5rem 0 3.5rem;
}

.hero__meta {
  font-family: var(--serif);
  font-size: 0.82rem; letter-spacing: 0.12em;
  color: var(--ink-3);
  padding-bottom: 1.2rem;
  margin-bottom: 1.6rem;
  border-bottom: 1px solid var(--line);
}
.hero h1 em { font-style: normal; }
.hero__sub {
  margin-top: 1.4rem;
  font-size: 1rem;
  color: var(--ink-2);
  max-width: 34em;
}

/* 摘要區 */
.abstract {
  margin-top: 1.8rem;
  border-left: 2px solid var(--teal-600);
  padding: 0.1rem 0 0.1rem 1.3rem;
}
.abstract h2 {
  font-size: 0.84rem; letter-spacing: 0.16em;
  color: var(--ink-3); font-weight: 600;
  margin-bottom: 0.5rem;
}
.abstract p { font-size: 0.95rem; color: var(--ink-2); }

.hero__actions { display: flex; gap: 0.75rem; margin-top: 2rem; flex-wrap: wrap; align-items: center; }

.hero__badges {
  display: flex; gap: 1.4rem 2rem; flex-wrap: wrap;
  margin-top: 2rem; padding-top: 1.3rem;
  border-top: 1px solid var(--line);
  list-style: none;
  color: var(--ink-2); font-size: 0.86rem;
}
.hero__badges li { display: flex; align-items: center; gap: 0.5em; }
.hero__badges svg { width: 14px; height: 14px; color: var(--teal-600); flex: none; }

/* ---- 圖一：呼吸節拍器與 HRV 波形 ---- */
.figure {
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 1.6rem 1.4rem 1.1rem;
}
.figure__caption {
  margin-top: 1.1rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--line);
  font-size: 0.8rem; line-height: 1.7;
  color: var(--ink-3);
}
.figure__caption b {
  font-family: var(--serif); font-weight: 700;
  color: var(--ink-2); margin-right: 0.4em;
}

.orbwrap {
  position: relative;
  width: min(240px, 70%); aspect-ratio: 1;
  margin-inline: auto;
  display: grid; place-items: center;
}
.orb-ring {
  position: absolute; border-radius: 50%;
  border: 1px solid var(--teal-200);
  animation: breathe 10s var(--ease) infinite;
}
.orb-ring.r1 { inset: 0;   animation-delay: 0.3s; }
.orb-ring.r2 { inset: 12%; animation-delay: 0.18s; }
.orb-ring.r3 { inset: 24%; animation-delay: 0.08s; border-style: dashed; border-color: var(--teal-400); }
.orb-core {
  position: absolute; inset: 34%;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--teal-700);
  animation: breathe 10s var(--ease) infinite;
}
.orb-core span {
  color: #fff; font-size: 0.8rem; font-weight: 600;
  letter-spacing: 0.2em; text-indent: 0.2em;
}
@keyframes breathe {
  0%, 100% { transform: scale(0.84); }
  46%, 54% { transform: scale(1); }
}

/* 圖中的量測標註 */
.chip {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem;
  border-top: 1px solid var(--line);
  padding: 0.7rem 0.1rem 0;
  margin-top: 1.1rem;
}
.chip--wave { display: block; }
.chip__label {
  font-size: 0.74rem; letter-spacing: 0.1em;
  color: var(--ink-3);
}
.chip__value {
  font-family: var(--serif);
  font-size: 1.15rem; line-height: 1.2; font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.chip__value small { font-size: 0.7em; color: var(--ink-3); margin-left: 0.15em; }
.chip--wave svg { width: 100%; height: 42px; margin-top: 0.5rem; color: var(--teal-600); }

/* ============================================================
   關鍵詞條
   ============================================================ */

.strip {
  background: var(--paper-2);
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
}
.strip__inner {
  display: flex; align-items: baseline; gap: 0.6rem 1.4rem; flex-wrap: wrap;
  padding: 0.95rem 0; font-size: 0.86rem;
}
.strip__inner dt {
  font-family: var(--serif); font-weight: 700;
  letter-spacing: 0.1em; color: var(--ink);
}
.strip__inner dd { color: var(--ink-2); }
.strip__inner dd::after { content: "；"; color: var(--ink-3); }
.strip__inner dd:last-child::after { content: ""; }

/* ============================================================
   章節
   ============================================================ */

.section { padding: 4.5rem 0; border-bottom: 1px solid var(--line); }
.section--alt { background: var(--paper-2); }
.section--dark {
  background: var(--ink);
  color: #c6cfd6;
  border-bottom-color: var(--ink);
}
.section--dark .eyebrow { color: #8b9aa5; }
.section--dark h2 { color: #fff; }
.section--dark .head__lead { color: #a8b4bd; }

/* ============================================================
   條列項目（原卡片，改為文件式的分欄段落）
   ============================================================ */

.cards { display: grid; gap: 2rem 2.5rem; }
.cards--3 { grid-template-columns: repeat(3, 1fr); }

.card {
  position: relative;
  background: transparent;
  border: none;
  border-top: 1px solid var(--line);
  padding: 1.2rem 0 0;
}
.card h3 { margin-bottom: 0.5rem; }
.card p { color: var(--ink-2); font-size: 0.93rem; }

/* 步驟編號 */
.card__num {
  font-family: var(--serif);
  font-size: 0.82rem; font-weight: 600; letter-spacing: 0.16em;
  color: var(--ink-3);
  margin-bottom: 0.6rem;
}
/* 圖示縮小、去色，僅作為視覺定位 */
.card__icon {
  width: 26px; height: 26px; margin-bottom: 0.9rem;
  color: var(--teal-600);
}
.card__icon svg { width: 100%; height: 100%; }

/* 深色章節中的條目 */
.section--dark .card { border-top-color: rgba(255, 255, 255, 0.22); }
.section--dark .card h3 { color: #fff; }
.section--dark .card p { color: #a8b4bd; }

.card__time {
  display: block;
  font-family: var(--serif);
  font-size: 0.78rem; letter-spacing: 0.12em;
  color: #97a6b0;
  margin-bottom: 0.45rem;
}

.section__cta {
  margin-top: 2.5rem;
  padding-top: 1.6rem;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  display: flex; gap: 1rem; flex-wrap: wrap; align-items: center;
}
.section--dark .section__cta .btn--primary {
  background: var(--paper); color: var(--ink); border-color: var(--paper);
}
.section--dark .section__cta .btn--primary:hover { background: #fff; border-color: #fff; }
.section--dark .section__cta .btn--ghost {
  border-color: rgba(255, 255, 255, 0.35); color: #d7e0e6;
}
.section--dark .section__cta .btn--ghost:hover { border-color: #fff; color: #fff; }
.section__cta small { color: #8b9aa5; font-size: 0.84rem; }

/* ============================================================
   理論背景（雙欄：正文 ＋ 參數表）
   ============================================================ */

.science { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 3.5rem; align-items: start; }
.science__copy > p { margin-top: 1.05em; color: var(--ink-2); font-size: 0.97rem; }
.science__copy strong { color: var(--ink); font-weight: 700; }

/* 註記段落（研究限制、免責聲明） */
.disclaimer {
  margin-top: 2rem !important;
  font-size: 0.87rem;
  border-left: 2px solid var(--gold-300);
  background: var(--gold-100);
  padding: 0.9rem 1.1rem;
  color: var(--gold) !important;
}

/* 參數表 */
.stats__caption {
  font-family: var(--serif);
  font-size: 0.82rem; letter-spacing: 0.1em;
  color: var(--ink-3);
  margin-bottom: 0.7rem;
}
.stats__body { border-top: 1px solid var(--ink); }
.stat {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1.2rem;
  padding: 0.85rem 0.1rem;
  border-bottom: 1px solid var(--line);
}
.stat__value {
  font-family: var(--serif);
  font-size: 1.24rem; font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  order: 2;
}
.stat__label {
  font-size: 0.87rem; color: var(--ink-2); line-height: 1.6;
}

/* ============================================================
   規格表
   ============================================================ */

.specs { display: grid; grid-template-columns: 1fr 1fr; gap: 0 3rem; }
.specs dl { border-top: 1px solid var(--ink); }
.specs dl > div {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1.5rem;
  padding: 0.8rem 0.1rem;
  border-bottom: 1px solid var(--line);
}
.specs dt { font-weight: 600; white-space: nowrap; font-size: 0.9rem; color: var(--ink-2); }
.specs dd { text-align: right; font-size: 0.9rem; font-variant-numeric: tabular-nums; }

/* ============================================================
   研究參與（原預購區）
   ============================================================ */

.enroll__card {
  max-width: 640px;
  margin: 0 auto;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 2rem 2rem 1.8rem;
}
.enroll__list { list-style: none; margin: 1.4rem 0 1.8rem; }
.enroll__list li {
  display: flex; align-items: flex-start; gap: 0.7em;
  padding: 0.4rem 0;
  color: var(--ink-2); font-size: 0.93rem;
  border-bottom: 1px solid var(--line-2);
}
.enroll__list li:last-child { border-bottom: none; }
.enroll__list svg { width: 15px; height: 15px; color: var(--teal-600); flex: none; margin-top: 0.55em; }

.enroll__form { display: flex; gap: 0.6rem; }
.enroll__form input {
  flex: 1; min-width: 0;
  padding: 0.72em 0.9em;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font: inherit; font-size: 0.93rem;
  background: var(--paper);
  transition: border-color 0.18s var(--ease);
}
.enroll__form input::placeholder { color: var(--ink-3); }
.enroll__form input:focus { outline: none; border-color: var(--teal-600); }
.enroll__fineprint { font-size: 0.82rem; color: var(--ink-3); margin-top: 0.9rem; }
.enroll__form--done {
  justify-content: flex-start; font-size: 0.95rem;
  color: var(--teal-800);
  border-left: 2px solid var(--teal-600);
  padding: 0.6em 0.9em;
  background: var(--teal-100);
}

/* ============================================================
   常見問題
   ============================================================ */

.faq {
  border-bottom: 1px solid var(--line);
}
.faq:first-of-type { border-top: 1px solid var(--ink); }
.faq summary {
  cursor: pointer; list-style: none;
  font-family: var(--serif);
  font-weight: 700; font-size: 1rem;
  padding: 1.05rem 2.5rem 1.05rem 0;
  position: relative;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: ""; position: absolute; right: 0.3rem; top: 50%;
  width: 11px; height: 11px; margin-top: -5.5px;
  background:
    linear-gradient(var(--ink-3), var(--ink-3)) center/100% 1px no-repeat,
    linear-gradient(var(--ink-3), var(--ink-3)) center/1px 100% no-repeat;
  transition: transform 0.25s var(--ease);
}
.faq[open] summary::after { transform: rotate(135deg); }
.faq p {
  color: var(--ink-2); font-size: 0.93rem;
  padding: 0 0 1.3rem;
  max-width: 46em;
}

/* ============================================================
   頁尾
   ============================================================ */

.footer { background: var(--paper-2); color: var(--ink-2); }
.footer__inner {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 2.5rem; flex-wrap: wrap;
  padding: 3rem 0 1.8rem;
}
.nav__logo--footer { color: var(--ink); }
.footer__tag { margin-top: 0.5rem; font-size: 0.88rem; max-width: 24em; }
.footer__links { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.footer__links a {
  color: var(--ink-2); text-decoration: none; font-size: 0.88rem;
  border-bottom: 1px solid transparent;
  transition: border-color 0.18s var(--ease);
}
.footer__links a:hover { border-bottom-color: var(--ink-3); }
.footer__legal {
  border-top: 1px solid var(--line);
  padding: 1.2rem 0 2.2rem;
  font-size: 0.8rem; color: var(--ink-3);
  line-height: 1.8;
}

/* ============================================================
   進場動畫：僅保留極輕微的淡入
   ============================================================ */

.reveal {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.5s var(--ease), transform 0.5s var(--ease);
  transition-delay: var(--d, 0s);
}
.reveal.is-in { opacity: 1; transform: none; }

/* ============================================================
   響應式
   ============================================================ */

@media (max-width: 980px) {
  .hero__inner { grid-template-columns: 1fr; gap: 2.5rem; padding: 3rem 0 3rem; }
  .science { grid-template-columns: 1fr; gap: 2.5rem; }
  .cards--3 { grid-template-columns: 1fr; }
  .specs { grid-template-columns: 1fr; gap: 0; }
  .specs dl + dl { border-top: none; }
  .section { padding: 3.25rem 0; }
  .head { margin-bottom: 2rem; }

  .nav__links, .nav .btn, .nav__sub { display: none; }
  .nav__toggle {
    display: flex; flex-direction: column; justify-content: center; gap: 4px;
    margin-left: auto;
    width: 38px; height: 38px;
    background: transparent;
    border: 1px solid var(--line); border-radius: var(--r-sm);
    cursor: pointer;
  }
  .nav__toggle span {
    display: block; width: 17px; height: 1px; margin-inline: auto;
    background: var(--ink);
    transition: transform 0.25s var(--ease), opacity 0.18s var(--ease);
  }
  .nav--open .nav__toggle span:nth-child(1) { transform: translateY(5px) rotate(45deg); }
  .nav--open .nav__toggle span:nth-child(2) { opacity: 0; }
  .nav--open .nav__toggle span:nth-child(3) { transform: translateY(-5px) rotate(-45deg); }
  .nav--open .nav__links {
    display: flex; flex-direction: column; gap: 0;
    position: absolute; top: 100%; left: 0; right: 0;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    padding: 0.5rem 5% 1rem;
  }
  .nav--open .nav__links a {
    padding: 0.7rem 0; font-size: 0.96rem;
    border-bottom: 1px solid var(--line-2);
  }
}

@media (max-width: 620px) {
  .enroll__form { flex-direction: column; }
  .enroll__form input, .enroll__form .btn { width: 100%; }
  .footer__links { gap: 0.8rem 1.4rem; }
  .strip__inner { font-size: 0.82rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}
