/* Header, buttons, paper docks, lists, clauses, FAQ, dialog, footer. */

/* ------------------------------------------------------------------ header */
.site-header {
  position: fixed; inset: 0 0 auto; z-index: 50; height: var(--header);
  display: flex; align-items: center; gap: 20px;
  padding-inline: max(var(--gutter), env(safe-area-inset-left)) max(var(--gutter), env(safe-area-inset-right));
  background: rgba(7, 16, 32, 0.78);
  -webkit-backdrop-filter: blur(18px) saturate(1.4); backdrop-filter: blur(18px) saturate(1.4);
  border-bottom: 1px solid var(--hair);
}
.brand { display: flex; align-items: center; height: 44px; flex: none; }
.brand img { height: 28px; width: auto; }
.site-nav { display: flex; gap: 2px; margin-inline: auto; }
.site-nav a {
  position: relative; display: inline-flex; align-items: center; min-height: 44px; padding: 0 15px; border-radius: 999px; font-size: 14px; color: var(--text-2);
  transition: color var(--t-fast), background var(--t-fast);
}
.site-nav a:hover { color: var(--text-1); background: rgba(156, 193, 255, 0.06); }
.site-nav a.is-active { color: var(--text-1); background: rgba(156, 193, 255, 0.1); }
.header-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.chapter-guide {
  display: flex; align-items: center; gap: 6px; height: 50px; padding: 0 2px 0 16px;
  border: 1px solid var(--hair); border-radius: 999px; background: rgba(255, 255, 255, 0.02);
}
.chapter-meta { display: flex; align-items: baseline; gap: 9px; font-size: 13px; color: var(--text-2); white-space: nowrap; min-width: 8.8em; }
.chapter-meta b { font: 500 12px/1 var(--mono); color: var(--blue-soft); letter-spacing: 0.04em; }
.chapter-track { width: 54px; height: 2px; border-radius: 2px; background: var(--hair-2); overflow: hidden; }
.chapter-track i { display: block; height: 100%; background: var(--blue-soft); transform-origin: left; transform: scaleX(var(--journey-progress, 0)); }
.chapter-guide button { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; color: var(--text-2); font-size: 18px; transition: background var(--t-fast), color var(--t-fast); }
.chapter-guide button:hover:not(:disabled) { background: rgba(156, 193, 255, 0.1); color: var(--text-1); }
.motion-toggle {
  display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--hair); font-size: 13px; color: var(--text-2); white-space: nowrap;
  transition: border-color var(--t-fast), color var(--t-fast);
}
.motion-toggle svg { font-size: 16px; }
.motion-toggle:hover, .motion-toggle[aria-pressed="true"] { color: var(--text-1); border-color: var(--hair-3); }
/* 登录 (3.2): a quiet text link before the trial button; phones keep it in the footer only. */
.header-login {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: 999px;
  font-size: 14px; color: var(--text-2); white-space: nowrap; transition: color var(--t-fast), background var(--t-fast);
}
.header-login:hover { color: var(--text-1); background: rgba(156, 193, 255, 0.06); }
.header-cta {
  display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 20px; border-radius: 999px;
  background: var(--paper); color: var(--paper-ink); font-size: 14px; font-weight: 600; white-space: nowrap;
  transition: background var(--t-fast), transform var(--t-base) var(--ease-out);
}
.header-cta:hover { background: #fff; }
.header-cta svg { font-size: 14px; transition: transform var(--t-base) var(--ease-out); }
.header-cta:hover svg { transform: translate(2px, -2px); }

/* ----------------------------------------------------------------- buttons */
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.actions.is-center { justify-content: center; }
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  min-height: 54px; padding: 0 24px 0 28px; border-radius: 999px;
  font-size: 15px; font-weight: 600; letter-spacing: 0.04em; white-space: nowrap;
  transition: background var(--t-base), box-shadow var(--t-base), color var(--t-base), transform var(--t-base) var(--ease-out);
}
.button svg { font-size: 16px; transition: transform var(--t-slow) var(--ease-out); }
.button:hover svg { transform: translate(2px, -2px); }
.button:active { transform: scale(0.98); }
.button-primary { background: var(--blue); color: #fff; box-shadow: var(--shadow-glow), inset 0 1px 0 rgba(255, 255, 255, 0.22); }
.button-primary:hover { background: var(--blue-bright); }
.button-quiet { color: var(--text-1); background: rgba(156, 193, 255, 0.06); box-shadow: inset 0 0 0 1px var(--hair-2); }
.button-quiet:hover { background: rgba(156, 193, 255, 0.12); }
.button-quiet:hover svg { transform: translateY(3px); }
.button-outline { color: var(--text-1); box-shadow: inset 0 0 0 1px var(--hair-3); padding-inline: 28px; }
.button-outline:hover { background: rgba(156, 193, 255, 0.08); }

/* Pointer light: a soft spotlight that follows the cursor across a surface. */
[data-glow] { position: relative; isolation: isolate; }
[data-glow]::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: -1; opacity: 0;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), rgba(156, 193, 255, 0.09), transparent 60%);
  transition: opacity var(--t-slow);
}
[data-glow]:hover::before { opacity: 1; }

/* -------------------------------------------------------------- paper dock
   The DOM slot where the travelling page lands. While WebGL draws the page, the slot
   shows a dashed outline that brightens as the page approaches; with reduced motion
   or without WebGL the static page is shown instead. */
.paper-dock { --w: 84px; position: relative; flex: none; width: var(--w); aspect-ratio: 116 / 148; }
.paper-slot, .paper-static { position: absolute; inset: 0; }
.paper-slot svg { width: 100%; height: 100%; overflow: visible; }
.paper-slot path {
  fill: rgba(156, 193, 255, calc(var(--paper-approach, 0) * 0.07));
  stroke: var(--blue-soft); stroke-width: 1.2; stroke-dasharray: 4 5; vector-effect: non-scaling-stroke;
  opacity: calc(0.32 + var(--paper-approach, 0) * 0.6);
  transition: opacity var(--t-base);
}
.paper-dock.is-landed .paper-slot { opacity: 0; transition: opacity 0.5s var(--ease-out) 0.1s; }
.paper-static { opacity: 0; filter: drop-shadow(0 12px 16px rgba(1, 5, 14, 0.5)); }
.paper-static svg { width: 100%; height: 100%; }
.paper-dock::after {
  content: ""; position: absolute; left: 6%; right: 6%; bottom: -12px; height: 1px; background: var(--blue-soft);
  transform-origin: center; transform: scaleX(calc(0.25 + var(--paper-approach, 0) * 0.5)); opacity: calc(0.25 + var(--paper-approach, 0) * 0.4);
  transition: transform 0.9s var(--ease-out), opacity 0.9s var(--ease-out);
}
.paper-dock.is-landed::after { transform: scaleX(1); opacity: 0.9; }
html:not(.js) .paper-static, .motion-reduced .paper-static, .world-failed .paper-static { opacity: 1; }
html:not(.js) .paper-slot, .motion-reduced .paper-slot, .world-failed .paper-slot { display: none; }
.motion-reduced .paper-dock::after, .world-failed .paper-dock::after { transform: scaleX(1); opacity: 0.6; }

.dock-note, .origin-card {
  display: flex; align-items: center; gap: 24px; padding: 22px 26px 26px 22px;
  border: 1px solid var(--hair); border-radius: var(--r-m);
  background: linear-gradient(160deg, rgba(156, 193, 255, 0.06), rgba(156, 193, 255, 0.01));
}
.dock-note p, .origin-card p { font: 500 clamp(17px, 1.3vw, 20px)/1.55 var(--serif); color: var(--text-1); transition: color 0.6s; }
.dock-note small, .origin-card small { display: block; margin-top: 6px; font-size: 13px; color: var(--text-3); }
.dock-note:has(.is-landed), .origin-card:has(.is-landed) { border-color: var(--hair-2); }

/* ----------------------------------------------------------- numbered lists */
.clauses b { font: 500 12px/1 var(--mono); color: var(--blue-soft); letter-spacing: 0.08em; }


/* ----------------------------------------------------------------- clauses */
.clauses { display: grid; gap: 14px; counter-reset: clause; }
.clauses li {
  padding: 28px 30px 30px; border-radius: var(--r-m); border: 1px solid var(--hair);
  background: linear-gradient(170deg, rgba(156, 193, 255, 0.05), rgba(156, 193, 255, 0) 70%);
}
.clauses li > * { position: relative; z-index: 1; }
.clauses b { display: inline-block; padding: 6px 10px; border: 1px solid var(--hair-2); border-radius: 999px; letter-spacing: 0.18em; font-family: var(--sans); font-size: 12px; }
.clauses h3 { margin: 16px 0 8px; font: 500 clamp(20px, 1.7vw, 26px)/1.4 var(--serif); }
.clauses p { color: var(--text-2); font-size: 15px; }
.clauses li:nth-child(2) { --d: 90ms; }
.clauses li:nth-child(3) { --d: 180ms; }

/* ------------------------------------------------------------- segmented */
.segmented { display: inline-flex; padding: 4px; gap: 2px; border-radius: 999px; border: 1px solid var(--hair); background: rgba(3, 7, 15, 0.5); }
.segmented button { min-height: 40px; padding: 0 16px; border-radius: 999px; font-size: 13px; color: var(--text-2); transition: background var(--t-base), color var(--t-base); }
.segmented button:hover { color: var(--text-1); }
.segmented button[aria-pressed="true"] { background: var(--paper); color: var(--paper-ink); font-weight: 600; }

/* --------------------------------------------------------------------- FAQ */
.faq-list { border-top: 1px solid var(--hair-2); }
.faq-list details { border-bottom: 1px solid var(--hair); }
.faq-list summary {
  display: grid; grid-template-columns: 56px 1fr 28px; align-items: center; gap: 10px;
  min-height: 76px; padding: 18px 8px 18px 0; cursor: pointer; list-style: none;
  font: 500 clamp(17px, 1.35vw, 20px)/1.5 var(--serif); position: relative; z-index: 1;
}
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary b { font: 500 12px/1 var(--mono); color: var(--text-3); letter-spacing: 0.06em; }
.faq-list summary svg { font-size: 18px; color: var(--blue-soft); transition: transform 0.45s var(--ease-out); justify-self: end; }
.faq-list details[open]:not(.is-closing) summary svg { transform: rotate(45deg); }
.faq-list details[open] summary b { color: var(--blue-soft); }
.faq-list .answer { overflow: hidden; position: relative; z-index: 1; }
.faq-list .answer p { padding: 0 44px 26px 66px; color: var(--text-2); max-width: 46em; }
.faq-list summary:hover span { color: #fff; }

/* ------------------------------------------------------------------ dialog */
dialog {
  width: min(520px, calc(100% - 32px)); padding: 0; border: 1px solid rgba(255, 255, 255, 0.5); border-radius: var(--r-l);
  background: var(--paper); color: var(--paper-ink); box-shadow: var(--shadow-lift);
}
dialog::backdrop { background: rgba(3, 7, 15, 0.72); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
dialog[open] { animation: dialog-in 0.5s var(--ease-out); }
@keyframes dialog-in { from { opacity: 0; transform: translateY(16px) scale(0.98); } }
dialog form { position: relative; display: grid; gap: 16px; padding: 38px 36px 34px; }
dialog .folio { margin: 0; color: var(--paper-ink-3); }
dialog .folio b { color: var(--blue); }
dialog h2 { font: 500 30px/1.3 var(--serif); letter-spacing: -0.02em; }
.dialog-lead { color: var(--paper-ink-2); font-size: 15px; margin-bottom: 4px; }
dialog label { display: grid; gap: 8px; font-size: 13px; font-weight: 600; color: var(--paper-ink-2); }
dialog input {
  height: 50px; padding: 0 16px; border-radius: var(--r-s); border: 1px solid var(--paper-line); background: #fff; color: var(--paper-ink);
  font-size: 16px; transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
dialog input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px rgba(36, 111, 241, 0.16); }
dialog .button-primary { margin-top: 6px; }
dialog .text-link { color: var(--blue); justify-self: start; }
.dialog-close { position: absolute; right: 14px; top: 14px; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; color: var(--paper-ink-2); }
.dialog-close svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.dialog-close:hover { background: var(--paper-2); }
.modal-open { overflow: hidden; }

/* ------------------------------------------------------------------ footer */
.site-footer { position: relative; z-index: 1; padding: clamp(72px, 9vw, 130px) 0 calc(40px + env(safe-area-inset-bottom)); border-top: 1px solid var(--hair); background: var(--ink-0); }
.footer-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 40px; padding-bottom: 56px; border-bottom: 1px solid var(--hair); }
.footer-logo { width: clamp(220px, 28vw, 380px); height: auto; }
.footer-tag { font: 500 var(--fs-display-m)/1.3 var(--serif); letter-spacing: -0.02em; text-align: right; color: var(--text-1); }
.footer-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; padding: 48px 0; border-bottom: 1px solid var(--hair); }
.footer-cols nav { display: grid; align-content: start; gap: 4px; }
.footer-cols h4 { font: 500 12px/1 var(--mono); letter-spacing: 0.18em; color: var(--text-3); margin-bottom: 14px; font-weight: 500; }
.footer-cols a, .footer-cols button { justify-self: start; min-height: 40px; display: inline-flex; align-items: center; color: var(--text-2); font-size: 15px; transition: color var(--t-fast); }
.footer-cols a:hover, .footer-cols button:hover { color: var(--text-1); }
.footnotes { padding: 36px 0; display: grid; gap: 10px; counter-reset: fn; max-width: 62em; }
.footnotes li { position: relative; padding-left: 28px; font-size: 13px; line-height: 1.75; color: var(--text-3); counter-increment: fn; scroll-margin-top: calc(var(--header) + 40px); }
.footnotes li::before { content: counter(fn); position: absolute; left: 0; top: 1px; font: 500 11px/1.9 var(--mono); color: var(--blue-soft); }
.footnotes li:target { color: var(--text-1); }
.footer-base { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; padding-top: 24px; border-top: 1px solid var(--hair); font: 400 12px/1.6 var(--mono); letter-spacing: 0.06em; color: var(--text-4); }

/* -------------------------------------------------------------- responsive */
@media (max-width: 1239.98px) {
  .site-nav { display: none; }
  .header-actions { margin-left: auto; }
}
@media (max-width: 779.98px) {
  .site-header { gap: 10px; padding-inline: max(16px, env(safe-area-inset-left)) max(16px, env(safe-area-inset-right)); }
  .brand img { height: 22px; }
  .chapter-guide { padding: 0; border: 0; background: none; gap: 0; }
  .chapter-meta, .chapter-track { display: none; }
  .chapter-guide button { width: 40px; height: 44px; border-radius: 10px; }
  .motion-toggle { width: 44px; padding: 0; justify-content: center; }
  .motion-toggle span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .header-cta { padding: 0 16px; font-size: 13px; }
  .button { min-height: 52px; }
      .clauses li { padding: 22px 20px 24px; }
  .faq-list summary { grid-template-columns: 44px 1fr 24px; min-height: 68px; }
  .faq-list .answer p { padding: 0 8px 22px 54px; }
  .footer-top { flex-direction: column; align-items: flex-start; }
  .footer-tag { text-align: left; }
  .footer-cols { grid-template-columns: 1fr 1fr; }
  dialog form { padding: 34px 22px 26px; }
}
@media (max-width: 599.98px) {
  .header-login { display: none; }
}
@media (max-width: 359.98px) {
  .chapter-guide { display: none !important; }
}
