/* =====================================================================
   三道哲学 · Tria Tao Philosophy · Site Stylesheet v1
   Design system + global layout. Page-specific styles inline in each page.
   ===================================================================== */

/* -------------------------------------------------------------------
   Design tokens
   ------------------------------------------------------------------- */
:root {
  /* Background depths — warm charcoal-brown (Pixila inspired) */
  --bg:        #16130e;
  --bg-mid:    #1d1a14;
  --bg-card:   #221e16;
  --bg-elevated: #2b261c;

  /* Foreground */
  --ink:        #ebe2cc;
  --ink-dim:    #8f8675;
  --ink-faint:  #8f836a;
  --ink-trace:  #2a2520;

  /* Lines & dividers */
  --line:        #2b261c;
  --line-bright: #3d362b;

  /* Accent — burnished gold (warmer, less pale) */
  --gold:        #c8964a;
  --gold-bright: #e6b76b;
  --gold-deep:   #8b6420;
  --gold-faint:  rgba(200, 150, 74, 0.24);
  --gold-glow:   rgba(230, 183, 107, 0.38);

  /* Theme variant colors — for section-level background switching */
  --tan:         #c9a565;
  --tan-mid:     #b89252;
  --tan-deep:    #8b6420;
  --tan-ink:     #1d1a14;
  --cream:       #ebe3d0;
  --cream-mid:   #d5cdb6;
  --cream-ink:   #1d1a14;

  /* Typography stacks */
  --serif-en: 'EB Garamond', 'Cormorant Garamond', 'Cardo', Georgia, serif;
  --serif-cn: 'Noto Serif SC', 'Source Han Serif SC', 'Songti SC', 'SimSun', 'STSong', serif;
  --mono:     'JetBrains Mono', 'IBM Plex Mono', 'SF Mono', monospace;

  /* Display stacks · 古典学者 + 古籍排版 */
  --serif-display-en: 'Hoefler Text', 'EB Garamond', 'Cormorant Garamond', 'Cardo', Georgia, serif;
  --serif-display-cn: 'KingHwaOldSong', 'Noto Serif SC', 'Source Han Serif SC', 'STZhongsong', 'Songti SC', 'SimSun', serif;

  /* Spacing scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 16px;
  --space-4: 24px;
  --space-5: 40px;
  --space-6: 64px;
  --space-7: 96px;
  --space-8: 160px;

  /* Container */
  --container-max: 1280px;
  --container-text: 720px;
}

/* -------------------------------------------------------------------
   Reset & base
   ------------------------------------------------------------------- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html {
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif-cn);
  font-weight: 300;
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
a   { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
ul  { list-style: none; }
input, textarea { font: inherit; color: inherit; }

/* -------------------------------------------------------------------
   Typography utilities
   ------------------------------------------------------------------- */
.font-serif-en { font-family: var(--serif-en); }
.font-serif-cn { font-family: var(--serif-cn); }
.font-mono     { font-family: var(--mono); }

.kicker {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 300;
  letter-spacing: 0.36em;
  color: var(--gold);
  text-transform: uppercase;
}

.h1-en {
  font-family: var(--serif-display-en);
  font-weight: 400;
  font-size: clamp(48px, 6vw, 84px);
  line-height: 1.05;
  letter-spacing: 0.02em;
  color: var(--ink);
}

.h1-cn {
  font-family: var(--serif-display-cn);
  font-weight: 400;
  font-size: clamp(18px, 2vw, 22px);
  letter-spacing: 0.5em;
  color: var(--ink-dim);
}

.h2-en {
  font-family: var(--serif-display-en);
  font-weight: 400;
  font-style: italic;
  font-size: clamp(28px, 3.5vw, 44px);
  line-height: 1.15;
  letter-spacing: 0.02em;
  color: var(--ink);
}

.h2-cn {
  font-family: var(--serif-display-cn);
  font-weight: 400;
  font-size: clamp(20px, 2.4vw, 28px);
  letter-spacing: 0.32em;
  color: var(--ink);
}

.h3-cn {
  font-family: var(--serif-cn);
  font-weight: 400;
  font-size: 20px;
  letter-spacing: 0.2em;
  color: var(--ink);
}

.subtitle {
  font-family: var(--serif-en);
  font-style: italic;
  font-size: 16px;
  letter-spacing: 0.02em;
  color: var(--ink-dim);
}

.eyebrow {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.32em;
  color: var(--ink-faint);
  text-transform: uppercase;
}

.body-text {
  font-family: var(--serif-cn);
  font-size: 16px;
  line-height: 1.85;
  color: var(--ink-dim);
}

.body-text strong { color: var(--ink); font-weight: 400; }
.body-text em { font-style: italic; color: var(--gold); }

.quote-cn {
  font-family: var(--serif-cn);
  font-size: 22px;
  line-height: 1.6;
  letter-spacing: 0.15em;
  color: var(--ink);
}

.quote-cn::before { content: '「'; color: var(--gold); margin-right: 0.1em; }
.quote-cn::after  { content: '」'; color: var(--gold); margin-left: 0.1em; }

::selection { background: var(--gold-faint); color: var(--gold-bright); }

/* -------------------------------------------------------------------
   Layout containers
   ------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

@media (max-width: 768px) {
  .container { padding: 0 var(--space-4); }
}

.container-text {
  max-width: var(--container-text);
  margin: 0 auto;
}

.section {
  padding: var(--space-7) 0;
  position: relative;
}

.section-tight {
  padding: var(--space-6) 0;
}

/* -------------------------------------------------------------------
   Skip to content — 键盘可达 · 默认隐藏，focus 时滑入
   ------------------------------------------------------------------- */
.skip-link {
  position: fixed !important;
  top: 0;
  left: 50%;
  transform: translate(-50%, -150%);
  z-index: 300 !important;
  display: inline-block;
  padding: 12px 24px;
  background: var(--bg-elevated);
  border: 1px solid var(--gold);
  color: var(--gold-bright);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
  transition: transform 240ms cubic-bezier(0.16, 1, 0.3, 1);
}

.skip-link:focus {
  transform: translate(-50%, 14px);
  outline: none;
}

@media (prefers-reduced-motion: reduce) {
  .skip-link { transition: none; }
}

/* 跳转落点不显示焦点描边（已用 skip-link 自身表达），但保留键盘焦点语义 */
[id="main"]:focus { outline: none; }

/* 仅供屏幕阅读器的隐藏文本（表格 caption、补充标签等）*/
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

/* -------------------------------------------------------------------
   Global navigation
   ------------------------------------------------------------------- */
.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: var(--space-4) 0;
  transition: background 400ms ease, backdrop-filter 400ms ease;
}

/* Subtle gradient on initial state so nav reads against bright image tops */
.site-nav::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(22, 19, 14, 0.55) 0%, rgba(22, 19, 14, 0) 100%);
  pointer-events: none;
  transition: opacity 400ms ease;
  z-index: -1;
}

.site-nav.scrolled::before { opacity: 0; }

.site-nav.scrolled {
  background: rgba(22, 19, 14, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

/* Safety text-shadow on nav so it reads against any bg image */
.site-nav .container > * {
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.55);
}
.site-nav.scrolled .container > * { text-shadow: none; }

.site-nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-logo {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  color: var(--ink);
  font-family: var(--serif-display-cn);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: 0.22em;
  letter-spacing: 0.35em;
  font-weight: 400;
}

.site-logo .logo-en {
  font-family: 'Hoefler Text', Georgia, serif;
  font-style: normal;
  font-weight: 400;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--ink-dim);
  margin-top: 1px;
}

/* 主页 header：三旋金标 + 字标横排（仅带 .has-mark 的 logo，其余页不受影响） */
.site-logo.has-mark {
  flex-direction: row;
  align-items: center;
  gap: 11px;
}
.site-logo.has-mark .logo-mark {
  width: 40px;
  height: auto;
  flex: 0 0 auto;
  display: block;
}
.site-logo.has-mark .logo-text {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.site-nav-links {
  display: flex;
  gap: var(--space-5);
  align-items: center;
}

.site-nav-link {
  font-family: var(--serif-cn);
  font-size: 13px;
  letter-spacing: 0.3em;
  color: var(--ink);
  position: relative;
  padding: 4px 0;
  transition: color 300ms ease;
}

.site-nav-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  width: 0;
  height: 1px;
  background: var(--gold);
  transition: width 300ms ease, left 300ms ease;
}

.site-nav-link:hover {
  color: var(--gold-bright);
}

.site-nav-link:hover::after,
.site-nav-link.active::after {
  width: 100%;
  left: 0;
}

.site-nav-link.active {
  color: var(--gold);
}

@media (max-width: 768px) {
  .site-nav { padding: var(--space-3) 0; }
  .site-nav-links { gap: var(--space-3); }
  .site-nav-link  { font-size: 11px; letter-spacing: 0.2em; }
  /* 扩展触控热区到 ~44px，不改视觉布局（WCAG 2.5.5/移动可用性）*/
  .site-nav-link::before { content: ''; position: absolute; top: -14px; bottom: -14px; left: -5px; right: -5px; }
  .site-logo .logo-en { display: none; }
  .site-logo { font-size: 14px; letter-spacing: 0.22em; }
  /* 强 制 inline grid 在 mobile 塌 成 单 列 · 避 免 内 容 超 出 viewport */
  .grid-mobile-1col { grid-template-columns: 1fr !important; }
}
@media (max-width: 460px) {
  /* 紧凑机型 · iPhone SE / 早期 Android · 让 nav 不溢出 */
  .site-logo { font-size: 12.5px; letter-spacing: 0.16em; }
  .site-nav-links { gap: 10px; }
  .site-nav-link  { font-size: 10px; letter-spacing: 0.10em; }
}

/* -------------------------------------------------------------------
   Mobile · 装 饰 动 画 关 闭
   stars/dust/meteor/mist 在小屏 GPU 压力大、视觉收益低；
   保留 Ken Burns drift（图本身已经在动，无额外 DOM）。
   ------------------------------------------------------------------- */
@media (max-width: 768px) {
  .stars-overlay,
  .tyndall-overlay,
  .dust-overlay,
  .meteor-overlay,
  .closing-mist { display: none !important; }
}

/* -------------------------------------------------------------------
   Hero pattern (per-page hero with image background)
   ------------------------------------------------------------------- */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh; /* iOS Safari 地址栏跳动 fix · dynamic viewport */
  display: flex;
  align-items: center;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: 1;
}

/* Atmospheric overlay over hero image: vignette + slight color wash */
.hero-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom, transparent 0%, transparent 50%, var(--bg) 100%),
    radial-gradient(ellipse 100% 100% at 50% 50%, transparent 40%, rgba(22, 19, 14, 0.55) 100%);
}

.hero-content {
  position: relative;
  z-index: 2;
  width: 100%;
  padding: var(--space-7) 0 var(--space-7);
}

.hero-content .container {
  max-width: var(--container-max);
}

.hero-title-block {
  max-width: 640px;
}

.hero-scroll-hint {
  position: absolute;
  bottom: var(--space-5);
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.32em;
  color: var(--ink-dim);
  text-transform: uppercase;
  animation: hint-pulse 3s ease-in-out infinite;
}

.hero-scroll-hint::after {
  content: '';
  display: block;
  width: 1px;
  height: 24px;
  background: linear-gradient(to bottom, var(--gold-faint), transparent);
}

@keyframes hint-pulse {
  0%, 100% { opacity: 0.4; transform: translateX(-50%) translateY(0); }
  50%      { opacity: 0.8; transform: translateX(-50%) translateY(4px); }
}

/* Fallback gradient if hero image not yet provided */
.hero-bg-fallback {
  background:
    radial-gradient(ellipse 60% 40% at 50% 35%, rgba(200, 150, 74, 0.10), transparent 70%),
    radial-gradient(ellipse 80% 60% at 30% 70%, rgba(80, 70, 50, 0.10), transparent 70%),
    radial-gradient(ellipse 50% 70% at 70% 60%, rgba(180, 130, 80, 0.06), transparent 70%),
    var(--bg);
}

/* -------------------------------------------------------------------
   亮图色温统一 · 让两张偏冷亮图融入暖金/炭棕色系（全站按资源生效）
   《雅典学院》壁画 academy.jpg + 希腊神殿 cliff.jpg：原图偏冷蓝，
   加暖调 sepia + 轻度降饱和/降亮，与全站暖色域呼应。
   不替换图片，纯滤镜可逆；属性选择器自动覆盖所有用到这两张图的页面。
   ------------------------------------------------------------------- */
img[src$="academy.jpg"] {
  filter: sepia(0.24) saturate(0.86) brightness(0.92) contrast(1.03);
}
img[src$="cliff.jpg"] {
  filter: sepia(0.28) saturate(0.82) brightness(0.93) contrast(1.02);
}

/* -------------------------------------------------------------------
   Section dividers
   ------------------------------------------------------------------- */
.divider-line {
  border: none;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--line-bright) 20%, var(--line-bright) 80%, transparent);
  margin: var(--space-6) 0;
}

.divider-dot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--ink-faint);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.32em;
  margin: var(--space-6) 0;
}

.divider-dot::before,
.divider-dot::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
  max-width: 120px;
}

/* -------------------------------------------------------------------
   Section anchor cards (used on homepage)
   ------------------------------------------------------------------- */
.anchor-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
}

@media (min-width: 1024px) {
  .anchor-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.anchor-card {
  position: relative;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border: 1px solid var(--line);
  cursor: pointer;
  transition: border-color 400ms ease, transform 600ms ease;
  display: block;
}

.anchor-card:hover {
  border-color: var(--gold-faint);
}

.anchor-card-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  transition: transform 1200ms ease;
}

.anchor-card:hover .anchor-card-bg {
  transform: scale(1.05);
}

.anchor-card-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(22, 19, 14, 0.92) 0%, rgba(22, 19, 14, 0.5) 40%, rgba(22, 19, 14, 0.2) 100%);
  transition: background 400ms ease;
}

.anchor-card:hover .anchor-card-bg::after {
  background: linear-gradient(to top, rgba(22, 19, 14, 0.88) 0%, rgba(22, 19, 14, 0.4) 50%, rgba(22, 19, 14, 0.1) 100%);
}

.anchor-card-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--space-4);
  z-index: 2;
}

.anchor-card-num {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.32em;
  color: var(--gold);
  margin-bottom: 8px;
}

.anchor-card-cn {
  font-family: var(--serif-cn);
  font-size: 24px;
  font-weight: 400;
  letter-spacing: 0.32em;
  color: var(--ink);
  margin-bottom: 4px;
}

.anchor-card-en {
  font-family: var(--serif-en);
  font-style: italic;
  font-size: 14px;
  color: var(--ink-dim);
  letter-spacing: 0.04em;
  margin-bottom: 10px;
}

.anchor-card-blurb {
  font-family: var(--serif-cn);
  font-size: 13px;
  line-height: 1.7;
  color: var(--ink-dim);
  letter-spacing: 0.1em;
  max-width: 24ch;
}

/* -------------------------------------------------------------------
   Buttons / CTA
   ------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 14px 28px;
  font-family: var(--serif-cn);
  font-size: 14px;
  letter-spacing: 0.3em;
  color: var(--ink);
  border: 1px solid var(--line-bright);
  background: transparent;
  cursor: pointer;
  transition: all 400ms ease;
}

.btn:hover {
  border-color: var(--gold);
  color: var(--gold-bright);
}

.btn-arrow::after {
  content: '→';
  font-family: var(--serif-en);
  transition: transform 300ms ease;
}

.btn-arrow:hover::after { transform: translateX(4px); }

.btn-text {
  font-family: var(--serif-cn);
  font-size: 13px;
  letter-spacing: 0.3em;
  color: var(--ink-dim);
  border-bottom: 1px solid var(--gold-faint);
  padding-bottom: 4px;
  transition: color 400ms ease, border-color 400ms ease;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.btn-text::after { content: '→'; font-family: var(--serif-en); transition: transform 300ms ease; }
.btn-text:hover  { color: var(--gold-bright); border-color: var(--gold); }
.btn-text:hover::after { transform: translateX(4px); }

/* -------------------------------------------------------------------
   Card primitive
   ------------------------------------------------------------------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  padding: var(--space-5);
  position: relative;
  transition: border-color 400ms ease;
}

.card:hover { border-color: var(--gold-faint); }

.card-eyebrow {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.32em;
  color: var(--gold);
  text-transform: uppercase;
  margin-bottom: var(--space-3);
}

.card-title {
  font-family: var(--serif-cn);
  font-size: 22px;
  letter-spacing: 0.2em;
  margin-bottom: var(--space-2);
  color: var(--ink);
}

.card-subtitle {
  font-family: var(--serif-en);
  font-style: italic;
  font-size: 13px;
  color: var(--ink-dim);
  margin-bottom: var(--space-4);
}

/* -------------------------------------------------------------------
   Footer
   ------------------------------------------------------------------- */
.site-footer {
  padding: var(--space-7) 0 var(--space-6);
  border-top: 1px solid var(--line);
  margin-top: var(--space-7);
}

/* 页脚品牌落款：三旋金标（主）+ 三道哲学（次） */
.footer-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-5);
  border-bottom: 1px solid var(--line);
}
.footer-brand-mark {
  width: 78px;
  height: auto;
  display: block;
}
.footer-brand-name {
  font-family: var(--serif-display-cn);
  font-size: 19px;
  font-weight: 400;
  letter-spacing: 0.34em;
  color: var(--gold);
}

.site-footer .footer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--space-5);
  margin-bottom: var(--space-6);
}

@media (max-width: 768px) {
  .site-footer .footer-grid {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }
}

.footer-col-title {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.32em;
  color: var(--gold);
  text-transform: uppercase;
  margin-bottom: var(--space-3);
}

.footer-col-list { display: flex; flex-direction: column; gap: 10px; }
.footer-col-list a {
  font-family: var(--serif-cn);
  font-size: 14px;
  letter-spacing: 0.15em;
  color: var(--ink-dim);
  transition: color 300ms ease;
}
.footer-col-list a:hover { color: var(--gold); }

.site-footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: var(--space-4);
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--ink-faint);
  text-transform: uppercase;
}

@media (max-width: 768px) {
  .site-footer-bottom {
    flex-direction: column;
    gap: var(--space-2);
    text-align: center;
  }
}

/* -------------------------------------------------------------------
   Subtle ambient background — applied to body for all pages
   ------------------------------------------------------------------- */
.page-ambient::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 40% at 50% 0%, rgba(200, 150, 74, 0.05), transparent 70%),
    radial-gradient(ellipse 80% 50% at 50% 100%, rgba(80, 65, 45, 0.05), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.page-ambient > * { position: relative; z-index: 1; }
/* 修复：上一行同特异性且靠后，会把 .site-nav 的 fixed 覆盖成 relative，导致导航随页滚走。重新钉死为 fixed（更高特异性，与位置无关）。 */
.page-ambient > .site-nav { position: fixed; z-index: 100; }

/* -------------------------------------------------------------------
   Status badges
   ------------------------------------------------------------------- */
.badge-wip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--gold);
  border: 1px solid var(--gold-faint);
  border-radius: 99px;
}

.badge-wip::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--gold);
  border-radius: 50%;
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}

/* -------------------------------------------------------------------
   Print-friendly fallback (just in case)
   ------------------------------------------------------------------- */
@media print {
  body { background: white; color: black; }
  .site-nav, .site-footer, .hero-scroll-hint { display: none; }
}
