/* =========================================================
   清屿科技 · Tsingyu AI
   Editorial blog / research journal — frontier AI research
   ========================================================= */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, h5, p, ul, ol { margin: 0; padding: 0; }
ul, ol { list-style: none; }
img { display: block; max-width: 100%; }
button { font: inherit; cursor: pointer; background: none; border: 0; color: inherit; padding: 0; }
hr { border: 0; height: 1px; background: var(--line); margin: 0; }

/* ─────────── Tokens ─────────── */
:root {
  --paper:     #fafaf8;
  --paper-2:   #f4f2ec;
  --paper-3:   #eeece4;
  --white:     #ffffff;

  --ink:       #14130f;
  --ink-2:     #3a3832;
  --ink-3:     #6e6c64;
  --muted:     #94918a;
  --muted-2:   #b5b2a9;

  --line:      #e3e0d4;
  --line-soft: #edebd9;
  --line-strong: #c9c5b6;

  --accent:      #1e40af;
  --accent-soft: #3b58c3;
  --accent-deep: #16317c;

  --container: 1080px;
  --gutter: clamp(20px, 4vw, 56px);

  --display: "Source Serif 4", "Iowan Old Style", "Times New Roman", serif;
  --sans: "Source Sans 3", -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Chinese stack — Latin first so embedded English (paper titles,
     authors, slogans) uses Source Serif/Sans; CJK falls through per-char. */
  --display-cn: "Source Serif 4", "Songti SC", "STSong",
    "Noto Serif CJK SC", "Source Han Serif SC", serif;
  --sans-cn: "Source Sans 3", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", -apple-system, sans-serif;
}

/* ─────────── Chinese page overrides ─────────── */
html[lang="zh"] body { font-family: var(--sans-cn); letter-spacing: 0; }
html[lang="zh"] .masthead-title,
html[lang="zh"] .masthead-lede,
html[lang="zh"] .entry-title,
html[lang="zh"] .entry-dek,
html[lang="zh"] .colophon-mark {
  font-family: var(--display-cn);
  letter-spacing: 0;
}
html[lang="zh"] .colophon-mark { font-style: normal; }
html[lang="zh"] .brand-mark { font-style: normal; font-family: var(--display-cn); }

/* ─────────── Base ─────────── */
html { background: var(--paper); }
body {
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.65;
  letter-spacing: -0.003em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern", "liga", "ss01";
}
::selection { background: var(--accent); color: var(--white); }

/* ─────────── Primitives ─────────── */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding-inline: var(--gutter);
}
.eyebrow {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 400;
}
.eyebrow b { color: var(--ink-2); font-weight: 500; }
.eyebrow .sep { color: var(--accent); margin: 0 8px; }
.accent { color: var(--accent); }

/* ─────────── Topbar ─────────── */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.brand {
  display: inline-flex; align-items: baseline; gap: 12px;
  color: var(--ink);
}
.brand-mark {
  font-family: var(--display);
  font-style: italic;
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.005em;
  color: var(--ink);
}
.brand-sub {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.nav {
  display: flex; gap: 28px;
  font-family: var(--mono);
  font-size: 13.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.nav a { position: relative; padding: 4px 0; transition: color .2s ease; }
.nav a::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: -1px;
  height: 1px; background: var(--accent);
  transform: scaleX(0); transform-origin: left;
  transition: transform .25s ease;
}
.nav a:hover { color: var(--accent); }
.nav a:hover::after { transform: scaleX(1); }
.nav .lang {
  color: var(--ink); font-weight: 500;
  padding-left: 14px; margin-left: 4px;
  border-left: 1px solid var(--line-strong);
}
@media (max-width: 640px) { .nav { gap: 18px; } }

/* ─────────── Masthead ─────────── */
.masthead {
  padding: clamp(64px, 10vh, 120px) 0 clamp(40px, 6vh, 64px);
}
.masthead .eyebrow {
  display: block;
  margin-bottom: 28px;
  opacity: 0;
  animation: rise 0.6s cubic-bezier(0.22, 0.61, 0.36, 1) 0.05s forwards;
}
.masthead-title {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(46px, 7vw, 96px);
  line-height: 1.0;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 28px;
  opacity: 0;
  animation: rise 0.7s cubic-bezier(0.22, 0.61, 0.36, 1) 0.18s forwards;
}
.masthead-title .stop { color: var(--accent); }
.masthead-lede {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(19px, 2.2vw, 27px);
  line-height: 1.5;
  letter-spacing: -0.01em;
  color: var(--ink-2);
  max-width: 44ch;
  margin-bottom: 24px;
  opacity: 0;
  animation: rise 0.6s cubic-bezier(0.22, 0.61, 0.36, 1) 0.34s forwards;
}
.masthead-lede .accent { color: var(--accent); font-style: italic; }
html[lang="zh"] .masthead-lede .accent { font-style: normal; }

/* English signature slogan (used on the zh masthead) */
.masthead-slogan-en {
  font-family: "Source Serif 4", serif;
  font-size: clamp(16px, 1.7vw, 20px);
  line-height: 1.4;
  letter-spacing: -0.01em;
  color: var(--ink-3);
  max-width: 44ch;
  opacity: 0;
  animation: rise 0.6s cubic-bezier(0.22, 0.61, 0.36, 1) 0.46s forwards;
}
.masthead-slogan-en .accent { color: var(--accent); font-style: italic; }

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes blink { 50% { opacity: 0; } }

/* ─────────── Sections + Feed ─────────── */
.section { margin-top: clamp(44px, 6vh, 72px); }
.section:first-of-type { margin-top: clamp(16px, 2vh, 28px); }

.section-bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid var(--line-strong);
  padding-top: 18px;
  margin-bottom: clamp(6px, 1vh, 12px);
}
.section-bar .label { display: flex; align-items: baseline; gap: 16px; }
.section-bar .num {
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}
.section-bar .name {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(24px, 2.8vw, 34px);
  line-height: 1;
  letter-spacing: -0.012em;
  color: var(--ink);
}

.feed { /* entries provide their own dividers */ }

.entry {
  display: grid;
  grid-template-columns: 132px 1fr;
  gap: clamp(20px, 3vw, 44px);
  padding: clamp(28px, 3.6vh, 40px) 0;
  border-bottom: 1px solid var(--line);
  position: relative;
  transition: background .2s ease;
}
/* hover wash bleeds gently into the gutter without shifting the dividers */
.entry::before {
  content: "";
  position: absolute;
  inset: 0 calc(var(--gutter) * -0.4);
  background: var(--paper-2);
  opacity: 0;
  transition: opacity .2s ease;
  z-index: 0;
}
.entry:hover::before { opacity: 1; }
.entry > * { position: relative; z-index: 1; }

.entry-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 7px;
}
.entry-date {
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: 0.03em;
  color: var(--ink);
  font-feature-settings: "tnum";
}
.entry-cat {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

.entry-title {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(26px, 3vw, 38px);
  line-height: 1.16;
  letter-spacing: -0.014em;
  color: var(--ink);
  margin-bottom: 12px;
}
.entry-title .it { font-style: italic; color: var(--accent); }

.entry-dek {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(17px, 1.9vw, 20px);
  line-height: 1.5;
  letter-spacing: -0.005em;
  color: var(--ink-2);
  max-width: 60ch;
  margin-bottom: 16px;
}

.entry-byline {
  font-family: var(--sans);
  font-size: 14.5px;
  color: var(--muted);
}
.entry-byline b { color: var(--ink-2); font-weight: 500; }

.entry-metrics {
  display: flex;
  width: max-content;
  max-width: 100%;
  gap: 40px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.entry-metric { display: flex; flex-direction: column; gap: 8px; }
.entry-metric .v {
  font-family: var(--display);
  font-weight: 500;
  font-size: 30px;
  line-height: 1;
  letter-spacing: -0.018em;
  color: var(--ink);
  font-feature-settings: "tnum";
}
.entry-metric .v .u { color: var(--accent); margin-left: 1px; font-weight: 400; }
.entry-metric .k {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.entry-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink);
}
.entry-link .arr {
  width: 18px; height: 1px;
  background: currentColor;
  position: relative;
  transition: width .25s ease;
}
.entry-link .arr::after {
  content: "";
  position: absolute; right: 0; top: -3px;
  width: 6px; height: 6px;
  border-top: 1px solid currentColor;
  border-right: 1px solid currentColor;
  transform: rotate(45deg);
}
.entry:hover .entry-link { color: var(--accent); }
.entry:hover .entry-link .arr { width: 30px; }

/* Coming-soon entry — not yet a link */
.entry.is-soon { cursor: default; }
.entry.is-soon:hover::before { opacity: 0; }
.entry-soon {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}
.entry-soon::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: soon-pulse 2.4s ease-in-out infinite;
}
@keyframes soon-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.3; }
}

@media (max-width: 720px) {
  .entry { grid-template-columns: 1fr; gap: 14px; }
  .entry-meta {
    flex-direction: row; align-items: baseline; gap: 16px; padding-top: 0;
  }
}

/* ─────────── Colophon ─────────── */
.colophon {
  position: relative;
  border-top: 1px solid var(--line-strong);
  padding: clamp(56px, 8vh, 96px) 0 clamp(36px, 4vh, 48px);
  background: var(--paper);
}
.colophon-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: clamp(28px, 4vw, 64px);
  margin-bottom: clamp(40px, 6vh, 72px);
}
@media (max-width: 720px) {
  .colophon-grid { grid-template-columns: 1fr; gap: 28px; }
}
.colophon-mark {
  font-family: var(--display);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(34px, 4.2vw, 52px);
  line-height: 1;
  letter-spacing: -0.012em;
  color: var(--ink);
  margin-bottom: 16px;
}
.colophon-mark .stop { color: var(--accent); }
.colophon-tag {
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.colophon-col h4 {
  font-family: var(--mono);
  font-size: 13.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 18px;
  font-weight: 500;
}
.colophon-col ul li { padding: 5px 0; font-size: 15.5px; color: var(--ink-2); }
.colophon-col a { transition: color .2s ease; }
.colophon-col a:hover { color: var(--accent); }

.colophon-base {
  padding-top: 24px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.colophon-base b { color: var(--ink-2); font-weight: 500; }
.colophon-base .accent { color: var(--accent); }

/* ─────────── Reduced motion ─────────── */
@media (prefers-reduced-motion: reduce) {
  .masthead .eyebrow,
  .masthead-title,
  .masthead-lede,
  .masthead-slogan-en { opacity: 1; animation: none; transform: none; }
}
