/* ════════════════════════════════════════════════════════════
   KIAA — Shared design system
   謙系列共用樣式：色票 / 霧色世界 / 十字游標 / 頂列 / 頁尾 / 通用元件
   ════════════════════════════════════════════════════════════ */

:root {
  --bg: #ffffff;
  --ink: #0a0a0a;
  --soft: #4a4a4a;
  --mute: #888;
  --line: #d8d8d8;
  --line-soft: #ececec;
  --accent: #0a0a0a;
  --hover-bg: #f6f5f1;
  --mist-a: #e1eae9;
  --mist-b: #e4ebe9;
  --sans: "Inter", "Noto Sans TC", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --serif: "Noto Serif TC", serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}
*,*:before,*:after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); }
html { scroll-behavior: smooth; }

/* page-wide faint mist — every page shares one misty world */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(80% 50% at 50% 0%, rgba(225,234,233,.5) 0%, transparent 60%),
    radial-gradient(90% 55% at 50% 100%, rgba(228,235,233,.55) 0%, transparent 62%),
    linear-gradient(180deg, #fbfcfb 0%, #ffffff 22%, #ffffff 78%, #f8faf9 100%);
}

/* whole page is always visible — never gate base visibility on an animation timeline */
body { opacity: 1; }
body {
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  letter-spacing: .01em;
  cursor: none;
}
a, button, [class*="card"], [class*="row"] { cursor: none; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--ink); color: var(--bg); }
body::-webkit-scrollbar { width: 0; }

main, .topbar, footer.strip { position: relative; z-index: 1; }

/* ── Cross-hair cursor ─────────────────────────────────────── */
.xh-v, .xh-h {
  position: fixed; pointer-events: none; z-index: 9999;
  background: rgba(0, 0, 0, 0.18);
  transition: opacity .25s;
  will-change: transform;
}
.xh-v { top: 0; left: 0; width: 1px; height: 100vh; transform: translateX(-1px); }
.xh-h { top: 0; left: 0; height: 1px; width: 100vw; transform: translateY(-1px); }
.xh-dot {
  position: fixed; pointer-events: none; z-index: 9999;
  width: 18px; height: 18px;
  border: 1.5px solid rgba(0, 0, 0, 0.7);
  transform: translate(-50%, -50%);
  transition: width .2s, height .2s, background .2s, border-color .2s;
  background: transparent;
}
.xh-dot.hover { width: 40px; height: 40px; background: var(--accent); border-color: var(--accent); }
.xh-label {
  position: fixed; pointer-events: none; z-index: 9999;
  font-family: var(--mono); font-size: 9px;
  letter-spacing: .25em; text-transform: uppercase;
  color: var(--accent); background: var(--bg);
  padding: 4px 7px; border: 1px solid var(--accent);
  transform: translate(20px, 14px);
  opacity: 0; transition: opacity .2s;
  white-space: nowrap;
}
.xh-label.show { opacity: 1; }

/* ── Top bar ───────────────────────────────────────────────── */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: grid; grid-template-columns: 1fr auto 1fr;
  padding: 14px 28px;
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  font-family: var(--mono); font-size: 11px;
  letter-spacing: .12em; text-transform: uppercase;
}
.topbar .brand { display: flex; gap: 10px; align-items: center; }
.topbar .brand img { width: 18px; height: 18px; }
.topbar nav { display: flex; gap: 22px; justify-content: center; }
.topbar nav a { padding: 4px 0; position: relative; transition: color .25s; white-space: nowrap; }
.topbar nav a::after {
  content: ""; position: absolute; left: 0; right: 100%; bottom: 0;
  height: 1px; background: var(--accent);
  transition: right .4s cubic-bezier(.2,.8,.2,1);
}
.topbar nav a:hover, .topbar nav a.active { color: var(--accent); }
.topbar nav a:hover::after, .topbar nav a.active::after { right: 0; }
.topbar .right {
  text-align: right; color: var(--mute);
  display: flex; gap: 16px; justify-content: flex-end; align-items: center;
}
.topbar .right .live::before {
  content: ""; display: inline-block;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); margin-right: 6px; vertical-align: middle;
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .25; } }

/* ── Sub-page hero header (smaller than homepage intro) ──────── */
.page-hero {
  position: relative;
  padding: 138px 28px 56px;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
  isolation: isolate;
}
.page-hero .ph-clouds {
  position: absolute; left: 0; right: 0; bottom: -10px; height: 240px;
  z-index: 0; pointer-events: none;
  background: url('assets/cloud-strip.png') repeat-x 0 bottom;
  background-size: 2000px 280px;
  filter: brightness(1.05) saturate(.8) contrast(1.03);
  opacity: .5;
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 60%, transparent 100%);
          mask-image: linear-gradient(180deg, transparent 0%, #000 60%, transparent 100%);
  animation: cloudFlow 150s linear infinite;
}
@keyframes cloudFlow { from { background-position-x: 0; } to { background-position-x: 2000px; } }
.page-hero > * { position: relative; z-index: 1; }
.page-hero .crumb {
  font-family: var(--mono); font-size: 10.5px;
  letter-spacing: .2em; text-transform: uppercase; color: var(--mute);
  margin-bottom: 26px; display: flex; gap: 10px; align-items: center;
}
.page-hero .crumb a:hover { color: var(--accent); }
.page-hero .ph-brand {
  font-family: var(--mono); font-size: 11px; letter-spacing: .3em;
  text-transform: uppercase; color: var(--accent); margin-bottom: 16px;
}
.page-hero h1 {
  font-family: var(--serif); font-weight: 500;
  font-size: clamp(40px, 6vw, 84px); line-height: 1.02;
  letter-spacing: .02em; margin: 0;
}
.page-hero h1 .en {
  display: block; font-family: var(--sans); font-weight: 300;
  font-size: clamp(14px, 1.5vw, 19px); letter-spacing: .12em;
  color: var(--mute); margin-top: 16px; text-transform: uppercase;
}
.page-hero .lede {
  margin-top: 26px; max-width: 620px;
  font-family: var(--serif); font-size: 16px; line-height: 1.95; color: var(--soft);
  text-wrap: pretty;
}

/* ── Footer strip ──────────────────────────────────────────── */
footer.strip {
  position: relative;
  padding: 28px;
  border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
  font-family: var(--mono); font-size: 10.5px;
  color: var(--mute); letter-spacing: .15em; text-transform: uppercase;
}
footer.strip .right { display: flex; gap: 18px; }
footer.strip a { position: relative; padding-bottom: 1px; }
footer.strip a::after {
  content: ""; position: absolute; left: 0; right: 100%; bottom: -2px;
  height: 1px; background: var(--accent);
  transition: right .4s cubic-bezier(.2,.8,.2,1);
}
footer.strip a:hover { color: var(--accent); }
footer.strip a:hover::after { right: 0; }

/* ── Reveal on scroll ──────────────────────────────────────── */
/* Robust: opacity is ALWAYS 1 — we only animate transform, so a frozen/throttled
   timeline can never trap content invisible. Motion = a gentle slide-up. */
.reveal { transform: none; }
html.kiaa-js .reveal { transform: translateY(22px); transition: transform .9s cubic-bezier(.16,.84,.3,1); will-change: transform; }
html.kiaa-js .reveal.in { transform: none; }
@media (prefers-reduced-motion: reduce) { html.kiaa-js .reveal { transform: none; transition: none; } }

/* ── Entrance: hero header sequence ────────────────────── */
.kiaa-bar-enter { }
.kiaa-enter { transform: none; }
html.kiaa-js .kiaa-enter { transform: translateY(26px); }
html.kiaa-js .kiaa-enter.kiaa-in { transform: none; transition: transform 1.05s cubic-bezier(.16,.84,.3,1); }
@media (prefers-reduced-motion: reduce) { html.kiaa-js .kiaa-enter { transform: none; } }

/* big hero titles get a slightly richer rise */
html.kiaa-js .page-hero h1.kiaa-enter, html.kiaa-js .art-hero h1.kiaa-enter { transform: translateY(34px); }
html.kiaa-js .page-hero h1.kiaa-enter.kiaa-in, html.kiaa-js .art-hero h1.kiaa-enter.kiaa-in { transition: transform 1.2s cubic-bezier(.16,.84,.3,1); }

/* ── Misc shared ───────────────────────────────────────────── */
.num-ticker { font-variant-numeric: tabular-nums; display: inline-block; }

/* refined link underline sweep (lists, footers) reused via .sweep */
.sweep { position: relative; }
.sweep::after { content: ""; position: absolute; left: 0; right: 100%; bottom: -2px; height: 1px; background: var(--accent); transition: right .4s cubic-bezier(.2,.8,.2,1); }
.sweep:hover::after { right: 0; }

@media (max-width: 1000px) {
  .topbar { grid-template-columns: 1fr auto; }
  .topbar nav { display: none; }
  .page-hero { padding-top: 110px; }
}
