/* ═══════════════════════════════════════════
   Agent Company · Editorial v2
   ═══════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300..900;1,9..144,300..900&family=IBM+Plex+Mono:wght@400;500&family=Noto+Serif+SC:wght@400;500;700&family=Source+Serif+4:ital,opsz,wght@0,8..60,300..900;1,8..60,300..900&display=swap');

:root {
  --cream: #FAF9F5;
  --ink: #1F1B18;
  --coral: #C15F3C;
  --sage: #E8E2D2;
  --sage-deep: #D4CCBA;
  --muted: #8A857D;
  --rule: #D6D1C7;
  --card-bg: #FFFFFF;
  --v-fin: #6B7A2F; --v-trust: #B8860B; --v-ip: #D4790E;
  --v-acad: #2A8A7A; --v-life: #C4647A; --v-dev: #5B6ABF; --v-trad: #8B6C5C;
  --bg: var(--cream); --fg: var(--ink); --accent: var(--coral);
  --bg2: var(--sage); --card: var(--card-bg);
  --f-display: 'Fraunces', Georgia, serif;
  --f-body-zh: 'Noto Serif SC', 'Songti SC', serif;
  --f-body-en: 'Source Serif 4', Georgia, serif;
  --f-mono: 'IBM Plex Mono', 'Menlo', monospace;
  --s-page: clamp(1.5rem, 5vw, 6rem);
  --s-section: clamp(5rem, 12vh, 10rem);
  --max-w: 1200px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dur: 0.35s;
}

[data-theme="dark"] {
  --bg: #141210; --fg: #EDE9E3; --accent: #E2845F;
  --bg2: #1E1B17; --card: #1E1B17; --card-bg: #1E1B17;
  --rule: #332E28; --muted: #9A958D; --sage: #1E1B17; --sage-deep: #2A2520;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body {
  background: var(--bg); color: var(--fg);
  font-family: var(--f-body-zh); line-height: 1.75;
  transition: background 0.5s var(--ease), color 0.5s var(--ease);
  overflow-x: hidden; position: relative;
}
[lang="en"] body { font-family: var(--f-body-en); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
img { display: block; max-width: 100%; }

/* Content sits above GL canvas */
.topbar, main, footer { position: relative; z-index: 1; }

/* Bilingual */
[data-zh] { display: inline; } [data-en] { display: none; }
[lang="en"] [data-zh] { display: none; } [lang="en"] [data-en] { display: inline; }
.zh-block { display: block; } .en-block { display: none; }
[lang="en"] .zh-block { display: none; } [lang="en"] .en-block { display: block; }

/* ═══════ TOPBAR ═══════ */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100; height: 56px;
  display: flex; align-items: center; padding: 0 var(--s-page);
  background: transparent; border-bottom: 1px solid transparent;
  transition: background 0.4s, border-color 0.4s, backdrop-filter 0.4s;
}
.topbar.scrolled {
  background: oklch(from var(--bg) l c h / 0.9);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-bottom-color: var(--rule);
}

.topbar-brand {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--f-mono); font-size: 12px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--fg); text-decoration: none;
}
.topbar-brand:hover { text-decoration: none; }

.brand-logo { flex-shrink: 0; transition: transform 0.4s var(--ease); }
.topbar-brand:hover .brand-logo { transform: rotate(30deg) scale(1.1); }

.topbar-nav { display: flex; align-items: center; margin-left: auto; list-style: none; }
.topbar-nav a {
  font-family: var(--f-mono); font-size: 11px; color: var(--muted);
  padding: 8px 16px; transition: color var(--dur); text-decoration: none;
  letter-spacing: 0.04em;
}
.topbar-nav a:hover { color: var(--fg); text-decoration: none; }

.topbar-right { display: flex; align-items: center; gap: 8px; margin-left: 20px; }

.btn-sm {
  font-family: var(--f-mono); font-size: 11px; padding: 5px 14px;
  border-radius: 3px; border: 1px solid var(--rule); background: transparent;
  color: var(--fg); cursor: pointer; transition: all var(--dur) var(--ease);
  white-space: nowrap; text-decoration: none; display: inline-block;
}
.btn-sm:hover { border-color: var(--fg); text-decoration: none; }
.btn-sm.primary { background: var(--accent); color: var(--cream); border-color: var(--accent); }
.btn-sm.primary:hover { filter: brightness(1.1); }
[data-theme="dark"] .btn-sm.primary { color: #141210; }

.icon-btn {
  background: none; border: none; color: var(--muted); cursor: pointer;
  width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
  transition: color var(--dur);
}
.icon-btn:hover { color: var(--fg); }
.icon-btn svg { width: 16px; height: 16px; }

.lang-btn {
  font-family: var(--f-mono); font-size: 10px; background: none; border: none;
  color: var(--muted); cursor: pointer; padding: 4px 6px; letter-spacing: 0.05em;
}
.lang-btn:hover { color: var(--fg); }

.menu-btn { display: none; background: none; border: none; color: var(--fg); cursor: pointer; padding: 8px; }

/* ═══════ MOBILE NAV ═══════ */
.mobile-nav {
  display: none; position: fixed; inset: 0; z-index: 99; background: var(--bg);
  flex-direction: column; align-items: center; justify-content: center; gap: 2.5rem;
}
.mobile-nav.open { display: flex; }
.mobile-nav a {
  font-family: var(--f-display); font-size: 1.8rem; color: var(--fg);
  text-decoration: none; font-variation-settings: "opsz" 48;
}
.mobile-nav-close {
  position: absolute; top: 16px; right: var(--s-page);
  background: none; border: none; color: var(--fg); font-size: 1.5rem; cursor: pointer;
}

/* ═══════ WRAP ═══════ */
.wrap { max-width: var(--max-w); margin: 0 auto; padding: 0 var(--s-page); }
.wrap-wide { max-width: 1400px; margin: 0 auto; padding: 0 var(--s-page); }

/* ═══════ HERO ═══════ */
.hero {
  min-height: 100vh; display: flex; flex-direction: column; justify-content: center;
  padding: calc(56px + 4rem) 0 var(--s-section);
}

.hero-inner {
  display: grid; grid-template-columns: 1fr 340px; gap: 4rem; align-items: end;
  position: relative; z-index: 1;
}

.hero-kicker {
  font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 2rem;
  display: flex; align-items: center; gap: 12px;
}
.hero-kicker::before {
  content: ''; width: 32px; height: 1px; background: var(--rule);
}

.hero-h1 {
  font-family: var(--f-display); font-size: clamp(3rem, 6.5vw, 5.5rem);
  font-weight: 300; line-height: 1.1; margin-bottom: 1.8rem;
  font-variation-settings: "opsz" 120;
}

.hero-accent {
  display: block; font-weight: 600; font-style: italic;
  color: var(--accent); font-variation-settings: "opsz" 144;
  position: relative;
}
.hero-accent::after {
  content: ''; position: absolute; bottom: 0.05em; left: 0;
  width: 100%; height: 3px; background: var(--accent); opacity: 0.3;
}

.hero-dek {
  font-size: clamp(0.95rem, 1.5vw, 1.1rem); max-width: 640px;
  color: var(--muted); line-height: 1.9; margin-bottom: 2.5rem;
}

.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-cta .btn-sm { font-size: 12px; padding: 8px 20px; }

/* Hero sidebar — live stats */
.hero-stats {
  border-left: 1px solid var(--rule); padding-left: 2rem;
}
.stat-row {
  padding: 1rem 0; border-bottom: 1px solid var(--rule);
}
.stat-row:last-child { border-bottom: none; }
.stat-num {
  font-family: var(--f-display); font-size: 2.4rem; font-weight: 300;
  font-variation-settings: "opsz" 72; line-height: 1;
}
.stat-label {
  font-family: var(--f-mono); font-size: 10px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.08em; margin-top: 0.2rem;
}

/* Marquee tags */
.hero-marquee {
  margin-top: 3rem; overflow: hidden; border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule); padding: 10px 0;
  position: relative; z-index: 1;
}
.marquee-track {
  display: flex; gap: 2rem; animation: marquee 30s linear infinite;
  width: max-content;
}
@keyframes marquee { to { transform: translateX(-50%); } }
.marquee-tag {
  font-family: var(--f-mono); font-size: 11px; color: var(--muted);
  white-space: nowrap; display: flex; align-items: center; gap: 6px;
}
.marquee-tag::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0;
}
.marquee-tag[data-v="fin"]::before { background: var(--v-fin); }
.marquee-tag[data-v="trust"]::before { background: var(--v-trust); }
.marquee-tag[data-v="ip"]::before { background: var(--v-ip); }
.marquee-tag[data-v="acad"]::before { background: var(--v-acad); }
.marquee-tag[data-v="life"]::before { background: var(--v-life); }
.marquee-tag[data-v="dev"]::before { background: var(--v-dev); }
.marquee-tag[data-v="trad"]::before { background: var(--v-trad); }

/* ═══════ SECTION DIVIDER ═══════ */
.sec-div {
  font-family: var(--f-mono); font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.15em; color: var(--muted); padding: 0.8rem 0;
  border-bottom: 1px solid var(--rule); margin-bottom: 3rem;
  display: flex; align-items: center; gap: 12px;
}
.sec-div::after { content: ''; flex: 1; height: 1px; background: var(--rule); }

/* ═══════ PORTFOLIO ═══════ */
.portfolio { padding: var(--s-section) 0; }

/* Magazine layout: featured + grid */
.port-featured {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1px;
  background: var(--rule); border: 1px solid var(--rule); margin-bottom: 1px;
}
.port-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px;
  background: var(--rule); border: 1px solid var(--rule); border-top: none;
}

.p-card {
  background: var(--bg); padding: 2rem 2rem 1.5rem 2.4rem;
  position: relative; transition: background 0.4s var(--ease);
  display: flex; flex-direction: column;
}
.p-card:hover { background: var(--bg2); }

/* Vertical bar */
.p-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  transition: width 0.3s var(--ease);
}
.p-card:hover::before { width: 5px; }
.p-card[data-v="fin"]::before { background: var(--v-fin); }
.p-card[data-v="trust"]::before { background: var(--v-trust); }
.p-card[data-v="ip"]::before { background: var(--v-ip); }
.p-card[data-v="acad"]::before { background: var(--v-acad); }
.p-card[data-v="life"]::before { background: var(--v-life); }
.p-card[data-v="dev"]::before { background: var(--v-dev); }
.p-card[data-v="trad"]::before { background: var(--v-trad); }

.p-vert {
  font-family: var(--f-mono); font-size: 9px; text-transform: uppercase;
  letter-spacing: 0.12em; margin-bottom: 0.6rem; opacity: 0.7;
}
.p-card[data-v="fin"] .p-vert { color: var(--v-fin); }
.p-card[data-v="trust"] .p-vert { color: var(--v-trust); }
.p-card[data-v="ip"] .p-vert { color: var(--v-ip); }
.p-card[data-v="acad"] .p-vert { color: var(--v-acad); }
.p-card[data-v="life"] .p-vert { color: var(--v-life); }
.p-card[data-v="dev"] .p-vert { color: var(--v-dev); }
.p-card[data-v="trad"] .p-vert { color: var(--v-trad); }

.p-name {
  font-family: var(--f-display); font-weight: 500; font-variation-settings: "opsz" 36;
  margin-bottom: 0.15rem;
}
.port-featured .p-name { font-size: 1.6rem; }
.port-grid .p-name { font-size: 1.15rem; }

.p-url {
  font-family: var(--f-mono); font-size: 10px; color: var(--muted); margin-bottom: 0.5rem;
}
.p-url a { color: var(--muted); text-decoration: none; }
.p-url a:hover { color: var(--accent); }

.p-desc { font-size: 0.88rem; color: var(--muted); line-height: 1.7; flex: 1; }
.port-featured .p-desc { font-size: 0.95rem; }

.p-foot {
  display: flex; justify-content: space-between; align-items: center;
  border-top: 1px solid var(--rule); padding-top: 0.6rem; margin-top: 0.8rem;
  font-family: var(--f-mono); font-size: 10px; color: var(--muted); gap: 6px;
}

.p-live { color: var(--v-acad); }
.p-live::before { content: '● '; }

.p-bug {
  font-family: var(--f-mono); font-size: 10px; background: none;
  border: 1px solid var(--rule); border-radius: 2px; padding: 2px 8px;
  color: var(--muted); cursor: pointer; transition: all var(--dur);
  text-decoration: none; line-height: 1.4;
}
.p-bug:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.p-idea { color: var(--muted); }
.p-idea:hover { border-color: var(--v-acad); color: var(--v-acad); }

/* ═══════ IDEAS & BUGS ═══════ */
.ideas-section { padding: var(--s-section) 0; background: var(--bg2); transition: background 0.5s; }
.ideas-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--rule); border: 1px solid var(--rule); }
.idea-card {
  background: var(--bg); padding: 2.5rem 2rem; transition: background var(--dur);
  display: flex; flex-direction: column;
}
.idea-card:hover { background: var(--bg2); }
.idea-icon { font-size: 1.8rem; margin-bottom: 1rem; }
.idea-card h3 {
  font-family: var(--f-display); font-size: 1.2rem; font-weight: 500;
  font-variation-settings: "opsz" 36; margin-bottom: 0.5rem;
}
.idea-card p { font-size: 0.88rem; color: var(--muted); line-height: 1.7; flex: 1; margin-bottom: 1.2rem; }
.idea-btn { align-self: flex-start; }

@media (max-width: 768px) {
  .ideas-grid { grid-template-columns: 1fr; }
}

/* ═══════ CAP TABLE ═══════ */
.cap-section {
  padding: var(--s-section) 0;
  background: var(--bg2); transition: background 0.5s;
}

.cap-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px;
  background: var(--rule); border: 1px solid var(--rule);
}
.cap-cell {
  background: var(--bg); padding: 2.5rem 2rem; text-align: center;
  transition: background var(--dur);
}
.cap-cell:hover { background: var(--bg2); }
.cap-num {
  font-family: var(--f-display); font-size: clamp(2rem, 4vw, 3.2rem);
  font-weight: 300; font-variation-settings: "opsz" 72; line-height: 1;
}
.cap-label {
  font-family: var(--f-mono); font-size: 10px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.08em; margin-top: 0.5rem;
}
.cap-actions {
  text-align: center; margin-top: 2rem;
  display: flex; justify-content: center; gap: 10px;
}

/* ═══════ UNLOCKS ═══════ */
.unlocks { padding: var(--s-section) 0; }

.u-list { list-style: none; }
.u-item {
  display: grid; grid-template-columns: 72px 1fr auto;
  gap: 1.5rem; padding: 1.3rem 0; border-bottom: 1px solid var(--rule);
  align-items: baseline; position: relative;
  transition: padding-left 0.3s var(--ease);
}
.u-item:first-child { border-top: 1px solid var(--rule); }
.u-item:hover { padding-left: 8px; }

.u-eid {
  font-family: var(--f-display); font-size: 1rem; font-weight: 400;
  font-variation-settings: "opsz" 36; color: var(--accent);
}
.u-body h3 {
  font-family: var(--f-display); font-size: 1.05rem; font-weight: 500;
  font-variation-settings: "opsz" 36; margin-bottom: 0.15rem;
}
.u-body p { font-size: 0.85rem; color: var(--muted); line-height: 1.6; }
.u-status {
  font-family: var(--f-mono); font-size: 10px; color: var(--muted);
  text-align: right; white-space: nowrap; letter-spacing: 0.04em;
}
.u-status.done { color: var(--v-acad); }
.u-status.wip { color: var(--v-trust); }

/* ═══════ TIMELINE ═══════ */
.tl-section { padding: var(--s-section) 0; background: var(--bg2); transition: background 0.5s; }

.tl-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0;
}
.tl-item {
  padding: 1.5rem 2rem; border-bottom: 1px solid var(--rule);
  position: relative; transition: background var(--dur);
}
.tl-item:hover { background: oklch(from var(--bg) l c h / 0.5); }
.tl-item:nth-child(odd) { border-right: 1px solid var(--rule); }

.tl-when {
  font-family: var(--f-mono); font-size: 10px; color: var(--accent);
  text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 0.3rem;
}
.tl-what {
  font-family: var(--f-display); font-size: 1.05rem; font-weight: 500;
  font-variation-settings: "opsz" 36; margin-bottom: 0.2rem;
}
.tl-how { font-size: 0.85rem; color: var(--muted); line-height: 1.6; }

/* ═══════ TRUTH ═══════ */
.truth-section { padding: var(--s-section) 0; }

.truth-cols {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px;
  background: var(--rule); border: 1px solid var(--rule);
}
.truth-col { background: var(--bg); padding: 2.5rem 2rem; }

.truth-head {
  font-family: var(--f-display); font-size: 1.4rem; font-weight: 400;
  font-variation-settings: "opsz" 48; margin-bottom: 1.5rem;
  padding-bottom: 1rem;
}
.truth-col:nth-child(1) .truth-head { border-bottom: 2px solid var(--fg); }
.truth-col:nth-child(2) .truth-head { border-bottom: 2px solid var(--accent); color: var(--accent); }
.truth-col:nth-child(3) .truth-head { border-bottom: 2px solid var(--v-acad); color: var(--v-acad); }

.truth-list { list-style: none; }
.truth-list li {
  font-size: 0.9rem; line-height: 1.8; padding: 0.3rem 0 0.3rem 1.2em;
  position: relative;
}
.truth-list li::before {
  content: ''; position: absolute; left: 0; top: 0.85em;
  width: 4px; height: 4px; border-radius: 50%; background: var(--rule);
}

/* ═══════ FOOTER ═══════ */
.site-footer {
  padding: 3rem 0 2rem; border-top: 1px solid var(--rule);
}
.footer-inner {
  text-align: center;
}
.footer-mono {
  font-family: var(--f-mono); font-size: 10px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.05em; line-height: 2.2;
}
.footer-sig {
  font-family: var(--f-display); font-style: italic; font-size: 1rem;
  color: var(--muted); margin-top: 1.5rem; font-variation-settings: "opsz" 24;
}
.footer-sig em { color: var(--accent); }

/* ═══════ SCROLL REVEALS ═══════ */
.rv { opacity: 0; transform: translateY(20px); transition: opacity 0.8s var(--ease), transform 0.8s var(--ease); }
.rv.vis { opacity: 1; transform: translateY(0); }
/* Fallback: if JS hasn't run after 2s, show everything */
@media (scripting: none) { .rv { opacity: 1; transform: none; } }
.rv-d1 { transition-delay: 0.1s; }
.rv-d2 { transition-delay: 0.2s; }
.rv-d3 { transition-delay: 0.3s; }

/* ═══════ RESPONSIVE ═══════ */
@media (max-width: 1024px) {
  .hero-inner { grid-template-columns: 1fr; gap: 2rem; }
  .hero-stats { border-left: none; border-top: 1px solid var(--rule); padding-left: 0; padding-top: 1.5rem; display: grid; grid-template-columns: repeat(4,1fr); gap: 1px; }
  .stat-row { border-bottom: none; text-align: center; }
  .port-featured { grid-template-columns: 1fr; }
  .port-grid { grid-template-columns: repeat(2, 1fr); }
  .truth-cols { grid-template-columns: 1fr; }
  .tl-grid { grid-template-columns: 1fr; }
  .tl-item:nth-child(odd) { border-right: none; }
  .cap-grid { grid-template-columns: 1fr 1fr 1fr; }
}
@media (max-width: 768px) {
  .topbar-nav { display: none; }
  .menu-btn { display: block; }
  .hero-h1 { font-size: clamp(2.2rem, 9vw, 3.5rem); }
  .port-grid { grid-template-columns: 1fr; }
  .hero-stats { grid-template-columns: 1fr 1fr; }
  .u-item { grid-template-columns: 56px 1fr; }
  .u-status { grid-column: 2; }
  .cap-grid { grid-template-columns: 1fr; }
  .hero-cta { flex-direction: column; align-items: flex-start; }
}
