/* 字讀 TextView — 網站主樣式、排版結構、響應式與動態效果 */

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}

a {
  color: var(--focus);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
}

button, input, select {
  font: inherit;
  color: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

code {
  font-family: var(--font-mono);
  font-size: 0.88em;
}

.container {
  width: min(1140px, calc(100% - 2.5rem));
  margin-inline: auto;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--brand-navy);
  color: var(--brand-white);
  padding: 0.6rem 1rem;
  border-radius: 0 0 8px 0;
  z-index: 100;
}
.skip-link:focus {
  left: 0;
}

/* ── Top Reading Progress Bar ── */
.read-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  z-index: 80;
  pointer-events: none;
  background: transparent;
}

.read-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--focus), var(--brand-mint));
  transition: width 0.08s linear;
}

/* ── Header & Navigation ── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  transition: box-shadow 0.2s ease, background-color 0.25s ease;
}

.site-header.scrolled {
  box-shadow: var(--shadow-sm);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4.25rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  color: var(--ink);
  font-weight: 800;
  letter-spacing: 0.01em;
}

.brand-icon {
  width: 2.25rem;
  height: 2.25rem;
  flex: none;
  display: block;
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

.brand-text {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  font-size: 1.15rem;
}

.brand-en {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-links a {
  text-decoration: none;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 500;
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.nav-links a:hover,
.nav-links a[aria-current="location"] {
  background: var(--hover);
  color: var(--ink);
}

.nav-links a[aria-current="location"] {
  font-weight: 700;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.site-theme-picker {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-elevated);
}

.swatch-btn {
  width: 1.25rem;
  height: 1.25rem;
  padding: 0;
  border-radius: 50%;
  border: 1.5px solid var(--muted);
  cursor: pointer;
  transition: transform 0.15s ease, outline-color 0.15s ease;
}
.swatch-btn:hover { transform: scale(1.1); }
.swatch-btn[data-theme="light"] { background: #ffffff; }
.swatch-btn[data-theme="sepia"] { background: #f2e8d5; }
.swatch-btn[data-theme="dark"] { background: #13243b; }
.swatch-btn[aria-pressed="true"] {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.mobile-menu-btn {
  display: none;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface-elevated);
  color: var(--ink);
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.mobile-drawer {
  display: none;
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 0.75rem 1.25rem 1rem;
}

.mobile-drawer.open {
  display: block;
}

.mobile-drawer nav {
  display: grid;
  gap: 0.35rem;
}

.mobile-drawer a {
  text-decoration: none;
  color: var(--ink);
  font-weight: 600;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
}

.mobile-drawer a:hover {
  background: var(--hover);
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.62rem 1.2rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.92rem;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.14s ease, background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  white-space: nowrap;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: color-mix(in srgb, var(--accent) 85%, #000);
  box-shadow: 0 2px 10px color-mix(in srgb, var(--accent) 32%, transparent);
}

.btn-primary:hover {
  filter: brightness(0.95);
  box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 40%, transparent);
}

.btn-secondary {
  background: var(--surface-elevated);
  color: var(--ink);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--hover);
  border-color: var(--focus);
}

.btn-lg {
  padding: 0.82rem 1.55rem;
  font-size: 1rem;
  border-radius: 12px;
}

.btn svg {
  width: 1.1em;
  height: 1.1em;
  flex: none;
}

/* ── Hero ── */
.hero {
  padding: clamp(3.2rem, 7vw, 5.5rem) 0 clamp(2.5rem, 5vw, 3.8rem);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: -120px 0 auto;
  height: 460px;
  background: radial-gradient(62% 72% at 50% 0%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 72%);
  pointer-events: none;
}

.hero-inner {
  position: relative;
  text-align: center;
  max-width: 820px;
  margin-inline: auto;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.34rem 0.9rem;
  border-radius: 999px;
  background: var(--badge-bg);
  color: var(--badge-ink);
  border: 1px solid color-mix(in srgb, var(--focus) 24%, transparent);
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 1.4rem;
}

.eyebrow-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--focus);
}

.hero h1 {
  margin: 0 0 1.15rem;
  font-family: var(--font-serif);
  font-size: clamp(2.15rem, 5.2vw, 3.6rem);
  font-weight: 700;
  line-height: 1.24;
  letter-spacing: 0.015em;
  text-wrap: balance;
}

.hero h1 .highlight {
  position: relative;
  display: inline-block;
  z-index: 1;
}

.hero h1 .highlight::after {
  content: '';
  position: absolute;
  left: -0.05em;
  right: -0.05em;
  bottom: 0.1em;
  height: 0.28em;
  background: color-mix(in srgb, var(--accent) 55%, transparent);
  border-radius: 4px;
  z-index: -1;
}

.hero-lead {
  margin: 0 auto 2rem;
  max-width: 640px;
  font-size: clamp(1.02rem, 1.8vw, 1.18rem);
  color: var(--muted);
  line-height: 1.85;
  text-wrap: pretty;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.hero-meta {
  font-size: 0.84rem;
  color: var(--muted);
  margin: 0 0 2.4rem;
}

.trust-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
  max-width: 780px;
  margin-inline: auto;
  padding-top: 1.6rem;
  border-top: 1px solid var(--border);
}

.trust-item {
  text-align: center;
  padding: 0.5rem;
}

.trust-num {
  display: block;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
}

.trust-label {
  font-size: 0.82rem;
  color: var(--muted);
}

/* ── Sections ── */
section {
  padding: clamp(3rem, 6vw, 5rem) 0;
  scroll-margin-top: 4.5rem;
}

.section-head {
  max-width: 680px;
  margin: 0 auto 2.5rem;
  text-align: center;
}

.section-kicker {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--focus);
  margin-bottom: 0.45rem;
}

.section-head h2 {
  margin: 0 0 0.7rem;
  font-family: var(--font-serif);
  font-size: clamp(1.65rem, 3.2vw, 2.3rem);
  line-height: 1.3;
}

.section-head p {
  margin: 0;
  color: var(--muted);
  font-size: 1.02rem;
}

/* ── Scroll Reveal ── */
.js-enabled [data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}

.js-enabled [data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

/* ── Features Grid ── */
.features-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem;
}

.feature-card {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.6rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  transition: transform 0.2s var(--ease-out), border-color 0.2s ease, box-shadow 0.2s ease;
}

.feature-card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--focus) 55%, var(--border));
  box-shadow: var(--shadow-md);
}

.feature-icon {
  width: 2.65rem;
  height: 2.65rem;
  border-radius: 11px;
  background: var(--badge-bg);
  color: var(--badge-ink);
  display: grid;
  place-items: center;
  margin-bottom: 0.2rem;
}

.feature-icon svg {
  width: 1.35rem;
  height: 1.35rem;
}

.feature-card h3 {
  margin: 0;
  font-size: 1.12rem;
  line-height: 1.35;
}

.feature-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.93rem;
  line-height: 1.72;
}

.feature-tags {
  margin-top: auto;
  padding-top: 0.55rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tag {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.18rem 0.55rem;
  border-radius: 6px;
  background: var(--bg);
  border: 1px solid var(--border-soft);
  color: var(--muted);
}

/* ── Options & Typography Split ── */
.split-panel {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 1.5rem;
  align-items: stretch;
}

.surface-card {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.8rem;
  box-shadow: var(--shadow-sm);
}

.surface-card h3 {
  margin: 0 0 0.5rem;
  font-family: var(--font-serif);
  font-size: 1.35rem;
}

.surface-card > p {
  margin: 0 0 1.3rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.list-rows {
  display: grid;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.list-row {
  display: grid;
  grid-template-columns: 6.4rem minmax(0, 1fr);
  gap: 0.85rem;
  align-items: baseline;
  padding: 0.72rem 0.9rem;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
}

.list-row dt {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--ink);
}

.list-row dd {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
}

/* ── Export Formats Grid ── */
.export-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1rem;
}

.export-card {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.25rem 1.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  transition: border-color 0.18s ease, transform 0.18s var(--ease-out);
}

.export-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--focus) 50%, var(--border));
}

.export-badge {
  display: inline-flex;
  width: fit-content;
  padding: 0.16rem 0.55rem;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--badge-bg);
  color: var(--badge-ink);
}

.export-card h3 {
  margin: 0.2rem 0 0;
  font-size: 1.02rem;
}

.export-card p {
  margin: 0;
  font-size: 0.87rem;
  color: var(--muted);
  line-height: 1.65;
}

/* ── Install Steps ── */
.install-tabs-wrap {
  text-align: center;
}

.install-tabs {
  display: inline-flex;
  padding: 4px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  margin: 0 auto 2rem;
  gap: 4px;
}

.install-tabs button {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0.52rem 1.15rem;
  border-radius: 9px;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.install-tabs button[aria-selected="true"] {
  background: var(--accent);
  color: var(--accent-ink);
}

.steps-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem;
}

.steps-grid[hidden] {
  display: none;
}

.step-card {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.6rem;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.step-num {
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 999px;
  background: var(--brand-navy);
  color: var(--brand-mint);
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 0.95rem;
  display: grid;
  place-items: center;
}

html[data-site-theme="dark"] .step-num {
  background: var(--accent);
  color: var(--accent-ink);
}

.step-card h3 {
  margin: 0;
  font-size: 1.08rem;
}

.step-card p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.72;
}

.step-action {
  margin-top: auto;
}

.step-action .btn {
  width: 100%;
}

.copy-box {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0.65rem 0.5rem 0.85rem;
  border-radius: 9px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  overflow-x: auto;
}

.copy-box code {
  white-space: nowrap;
}

.copy-box-note {
  justify-content: center;
  color: var(--muted);
  font-family: var(--font-sans);
}

.copy-btn {
  flex: none;
  border: 1px solid var(--border);
  background: var(--surface-elevated);
  color: var(--ink);
  border-radius: 6px;
  padding: 0.24rem 0.58rem;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.copy-btn:hover {
  background: var(--hover);
}

.shortcuts-bar {
  margin-top: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.1rem 1.4rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.shortcut-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.88rem;
  color: var(--muted);
}

.shortcut-item strong {
  color: var(--ink);
}

kbd {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  background: var(--surface-elevated);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
}

/* ── Privacy & Permissions ── */
.perm-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.perm-card {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.35rem;
}

.perm-code {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 700;
  padding: 0.22rem 0.6rem;
  border-radius: 7px;
  background: var(--badge-bg);
  color: var(--badge-ink);
  margin-bottom: 0.65rem;
}

.perm-card p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.privacy-note {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--focus);
  border-radius: 12px;
  padding: 1.15rem 1.35rem;
  font-size: 0.92rem;
  color: var(--muted);
}

.privacy-note strong {
  color: var(--ink);
}

/* ── FAQ ── */
.faq-list {
  max-width: 820px;
  margin-inline: auto;
  display: grid;
  gap: 0.8rem;
}

.faq-item {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: 13px;
  overflow: hidden;
  transition: border-color 0.18s ease;
}

.faq-item[open] {
  border-color: color-mix(in srgb, var(--focus) 50%, var(--border));
}

.faq-item summary {
  list-style: none;
  padding: 1.05rem 1.35rem;
  font-weight: 700;
  font-size: 0.98rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: '+';
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--focus);
  flex: none;
  line-height: 1;
}

.faq-item[open] summary::after {
  content: '−';
}

.faq-item p {
  margin: 0;
  padding: 0 1.35rem 1.15rem;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.75;
}

/* ── Bottom CTA ── */
.cta-banner {
  background: var(--brand-navy);
  color: var(--brand-white);
  border-radius: var(--radius-lg);
  padding: clamp(2.2rem, 5vw, 3.4rem) clamp(1.5rem, 4vw, 3rem);
  text-align: center;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(118, 226, 193, 0.25);
}

.cta-banner::after {
  content: '';
  position: absolute;
  inset: auto -20% -60% -20%;
  height: 220px;
  background: radial-gradient(50% 100% at 50% 100%, rgba(118, 226, 193, 0.22), transparent 72%);
  pointer-events: none;
}

.cta-banner h2 {
  position: relative;
  margin: 0 0 0.7rem;
  font-family: var(--font-serif);
  font-size: clamp(1.6rem, 3.4vw, 2.25rem);
  color: #ffffff;
}

.cta-banner p {
  position: relative;
  margin: 0 auto 1.65rem;
  max-width: 540px;
  color: #cbd7e6;
}

.cta-banner .hero-cta {
  position: relative;
  margin-bottom: 0;
}

.cta-banner .btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: #f8fafc;
  border-color: rgba(255, 255, 255, 0.22);
}

.cta-banner .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: var(--brand-mint);
}

/* ── Footer & Back to Top ── */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 2.2rem 0;
  margin-top: 2rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  font-size: 0.88rem;
  color: var(--muted);
}

.footer-brand-icon {
  width: 1.75rem;
  height: 1.75rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.15rem;
}

.footer-links a {
  color: var(--muted);
  text-decoration: none;
}

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

.back-to-top {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-elevated);
  color: var(--ink);
  box-shadow: var(--shadow-md);
  display: grid;
  place-items: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s var(--ease-out), visibility 0.2s ease, background-color 0.15s ease;
  z-index: 40;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.back-to-top:hover {
  background: var(--hover);
  border-color: var(--focus);
}

/* ── Responsive ── */
@media (max-width: 960px) {
  .nav-links {
    display: none;
  }
  .mobile-menu-btn {
    display: inline-flex;
  }
  .features-grid,
  .steps-grid,
  .perm-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .split-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .container {
    width: calc(100% - 1.5rem);
  }
  .trust-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .features-grid,
  .steps-grid,
  .perm-grid {
    grid-template-columns: 1fr;
  }
  .list-row {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }
  .nav-actions .btn-download-nav {
    padding: 0.5rem 0.85rem;
    font-size: 0.84rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
  .js-enabled [data-reveal] {
    opacity: 1;
    transform: none;
  }
}
