/* ============================================================
   Yichen Xu — personal website
   Dark, tech/art hybrid theme. Bilingual (EN / 中文) via [data-i18n]
   in index.html + js/i18n.js. Edit variables below to re-theme.
   ============================================================ */

:root {
  --bg: #f8f8f6;
  --bg-raised: #ffffff;
  --bg-card: #ffffff;
  --border: #e2e2de;
  --text: #14161b;
  --text-muted: #52565f;
  --text-faint: #90939c;

  --bg-rgb: 248, 248, 246;

  --accent-a: #0891b2;   /* cyan   — "tech" */
  --accent-b: #7c3aed;   /* violet — "art"  */
  --accent-a-soft: #06b6d4;
  --accent-b-soft: #8b5cf6;
  --accent-gradient: linear-gradient(120deg, var(--accent-a), var(--accent-b));

  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --font-sans: var(--font-mono);
  --font-zh: "Noto Sans SC", var(--font-mono);

  --content-width: 1040px;
  --radius: 14px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

html[lang="zh"] body { font-family: var(--font-zh); line-height: 1.85; }

::selection { background: var(--accent-b); color: #fff; }

.wrap {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 24px;
}

h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 0.5em; font-weight: 700; letter-spacing: -0.015em; }
h2 { font-size: clamp(1.6rem, 2.5vw, 2rem); }
h3 { font-size: 1.12rem; letter-spacing: -0.01em; }
html[lang="zh"] h1, html[lang="zh"] h2, html[lang="zh"] h3, html[lang="zh"] h4 { letter-spacing: 0; }
p { margin: 0 0 1em; color: var(--text-muted); }
code { font-family: var(--font-mono); background: var(--bg-raised); border: 1px solid var(--border); border-radius: 4px; padding: 0.1em 0.4em; font-size: 0.92em; color: var(--accent-b); }
a { color: var(--accent-a); text-decoration: none; }
a:hover { text-decoration: underline; }

.eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  color: var(--accent-a);
  margin-bottom: 0.9em;
}
.eyebrow::before { content: "// "; opacity: 0.55; }

.section-head { margin-bottom: 2.2rem; }
.section-head p.lede { max-width: 60ch; }

/* ---------- nav ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(var(--bg-rgb), 0.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
}

.brand {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.brand span { color: var(--accent-a); }

.nav {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
}

.nav a {
  color: var(--text-muted);
  font-size: 0.92rem;
}
.nav a:hover { color: var(--text); text-decoration: none; }
.nav a.active { color: var(--text); }
.nav a.active { position: relative; }
.nav a.active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -14px;
  height: 2px;
  background: var(--accent-gradient);
}

.lang-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 0.78rem;
}
.lang-toggle button {
  background: none;
  border: none;
  color: var(--text-faint);
  padding: 6px 12px;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
}
.lang-toggle button.active {
  background: var(--accent-gradient);
  color: #06070a;
  font-weight: 700;
}

.nav-toggle-btn {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 6px 10px;
  cursor: pointer;
}

@media (max-width: 760px) {
  .nav-links { display: none; width: 100%; order: 3; padding-top: 10px; gap: 14px; }
  .nav-links.open { display: flex; flex-direction: column; }
  .header-inner { flex-wrap: wrap; }
  .nav-toggle-btn { display: inline-block; }
}

/* ---------- hero ---------- */

.hero {
  position: relative;
  padding: 90px 0 70px;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 20%, black 40%, transparent 90%);
  opacity: 0.45;
  pointer-events: none;
}

.hero-grid {
  position: relative;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 44px;
  align-items: center;
}

@media (max-width: 680px) {
  .hero-grid { grid-template-columns: 1fr; text-align: center; justify-items: center; }
}

.hero-photo {
  position: relative;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  flex-shrink: 0;
}

.hero-photo .ring {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  background: var(--accent-gradient);
  opacity: 0.55;
  filter: blur(14px);
}

.photo-placeholder {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--bg-raised);
  border: 1.5px dashed var(--text-faint);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--text-faint);
  text-align: center;
  overflow: hidden;
}

.photo-placeholder svg { width: 40px; height: 40px; opacity: 0.6; }
.photo-placeholder .ph-label {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  padding: 0 10px;
  line-height: 1.4;
}

.hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  margin-bottom: 0.2em;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  display: inline-block;
}
.hero h1::after {
  content: "_";
  -webkit-text-fill-color: var(--accent-b);
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .hero h1::after { animation: none; } }

.hero .tagline {
  color: var(--text);
  font-size: 1.15rem;
  margin-bottom: 0.9em;
}

.hero-text { max-width: 62ch; }
@media (max-width: 680px) { .hero-text { max-width: 100%; } }

.hero-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 1.3em;
}
@media (max-width: 680px) { .hero-links { justify-content: center; } }

.pill-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 16px;
  font-size: 0.85rem;
  color: var(--text);
  background: var(--bg-raised);
}
.pill-link:hover { border-color: var(--accent-a); text-decoration: none; color: var(--accent-a); }

/* ---------- sections ---------- */

.section {
  padding: 64px 0;
  border-top: 1px solid var(--border);
}
.section-first { border-top: none; padding-top: 56px; }

/* ---------- home hub grid ---------- */

.hub-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
@media (max-width: 900px) { .hub-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .hub-grid { grid-template-columns: 1fr; } }

.hub-card {
  display: block;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  background: var(--bg-card);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(20,22,27,0.03);
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.hub-card:hover {
  border-color: var(--accent-a);
  text-decoration: none;
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(20,22,27,0.08);
}
.hub-card h3 { margin-bottom: 0.35em; color: var(--text); }
.hub-card h3::before { content: "> "; color: var(--accent-a); font-weight: 400; }
.hub-card p { margin: 0; font-size: 0.9rem; }

/* ---------- about ---------- */

.about-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}
@media (max-width: 680px) { .about-grid { grid-template-columns: 1fr; gap: 26px; } }

.about-block h3 {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-a);
  margin-bottom: 0.9em;
}

.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li { margin-bottom: 0.9em; color: var(--text); }
.plain-list .meta { display: block; color: var(--text-faint); font-size: 0.85rem; margin-top: 2px; }

/* ---------- generic grid gallery (chip + photography) ---------- */

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
@media (max-width: 900px) { .gallery-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .gallery-grid { grid-template-columns: 1fr; } }

.tile {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-card);
  aspect-ratio: 4 / 3;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.tile-art {
  position: absolute;
  inset: 0;
}

/* chip die placeholder art — layered gradients per index for variety */
.chip-art { background: var(--bg-card); }
.chip-art::before, .chip-art::after {
  content: "";
  position: absolute;
  inset: 0;
}
.chip-art::before {
  background-image:
    repeating-linear-gradient(90deg, rgba(8,145,178,0.22) 0 2px, transparent 2px 14px),
    repeating-linear-gradient(0deg, rgba(124,58,237,0.18) 0 2px, transparent 2px 18px);
}
.chip-art::after {
  background: radial-gradient(circle at 30% 30%, rgba(8,145,178,0.20), transparent 55%),
              radial-gradient(circle at 75% 70%, rgba(124,58,237,0.20), transparent 55%);
}
.tile:nth-of-type(3n+2) .chip-art::before { filter: hue-rotate(35deg); }
.tile:nth-of-type(3n+3) .chip-art::before { filter: hue-rotate(-35deg); }

/* photography placeholder art — softer organic gradients */
.photo-art { background: var(--bg-card); }
.photo-art::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 25% 30%, rgba(124,58,237,0.22), transparent 60%),
              radial-gradient(circle at 75% 75%, rgba(8,145,178,0.20), transparent 60%),
              linear-gradient(160deg, #f1f0ee, #e7e6e2);
}
.tile:nth-of-type(2n) .photo-art::before { filter: hue-rotate(60deg); }
.tile:nth-of-type(3n) .photo-art::before { filter: hue-rotate(-50deg); }

.tile-placeholder-tag {
  position: absolute;
  top: 12px;
  right: 12px;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  border: 1px dashed var(--text-faint);
  border-radius: 999px;
  padding: 3px 9px;
  background: rgba(var(--bg-rgb), 0.75);
  z-index: 2;
}

.tile-caption {
  position: relative;
  z-index: 2;
  padding: 14px 16px;
  background: linear-gradient(0deg, rgba(var(--bg-rgb),0.94), rgba(var(--bg-rgb),0));
}
.tile-caption h4 { margin: 0 0 2px; font-size: 0.98rem; }
.tile-caption .tile-meta { font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-faint); }

/* ---------- publications ---------- */

.pub-list { padding-left: 1.3em; }
.pub-list li { margin-bottom: 1.1em; color: var(--text); }
.pub-list em { color: var(--text-muted); font-style: italic; }
.subhead { margin-top: 2.4em; font-family: var(--font-mono); font-size: 0.85rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent-b); }

/* ---------- project cards ---------- */

.project-grid { display: grid; grid-template-columns: 1fr; gap: 20px; }

.project-card {
  position: relative;
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  background: var(--bg-card);
  box-shadow: 0 1px 2px rgba(20,22,27,0.03);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.project-card:hover {
  border-color: var(--accent-a);
  border-left-color: var(--accent-b);
  box-shadow: 0 10px 24px rgba(20,22,27,0.07);
  transform: translateY(-2px);
}

.project-period {
  font-family: var(--font-mono);
  color: var(--accent-a);
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  margin-bottom: 0.5em;
}
.project-period::before { content: "["; opacity: 0.55; }
.project-period::after { content: "]"; opacity: 0.55; }

.project-meta { color: var(--text-faint); font-size: 0.88rem; margin-top: -0.5em; margin-bottom: 0.8em; }

.project-tag {
  display: inline-block;
  font-size: 0.68rem;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-faint);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  margin-left: 8px;
  vertical-align: middle;
}

.project-pub { font-size: 0.88rem; color: var(--accent-b); margin-bottom: 0; }

/* ---------- experience timeline ---------- */

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline > li {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 20px;
  padding: 20px 0;
  border-top: 1px solid var(--border);
}
.timeline > li:first-child { border-top: none; }
@media (max-width: 680px) { .timeline > li { grid-template-columns: 1fr; gap: 4px; } }

.timeline-period { font-family: var(--font-mono); color: var(--text-faint); font-size: 0.85rem; font-weight: 600; padding-top: 0.2em; }
.timeline-body h3 { margin-bottom: 0.2em; color: var(--text); }

/* ---------- journey (growth path) ---------- */

.journey-line {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
}

.journey-line::before {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 15px;
  width: 2px;
  background: linear-gradient(var(--accent-a), var(--accent-b));
  opacity: 0.35;
}

.journey-stop {
  position: relative;
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 22px;
  padding-bottom: 40px;
}
.journey-stop:last-child { padding-bottom: 0; }

.journey-marker { display: flex; justify-content: center; padding-top: 6px; }

.journey-dot {
  position: relative;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent-a);
  z-index: 1;
}
.journey-stop:nth-child(2n) .journey-dot { border-color: var(--accent-b); }
.journey-dot::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1px dashed var(--accent-a);
  opacity: 0.4;
}
.journey-stop:nth-child(2n) .journey-dot::after { border-color: var(--accent-b); }

.journey-content {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  padding: 18px 22px;
  box-shadow: 0 1px 2px rgba(20,22,27,0.03);
}

.journey-coord {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-faint);
  letter-spacing: 0.03em;
  margin-bottom: 0.4em;
}

.journey-content h3 { margin-bottom: 0.15em; }
.journey-content .project-meta { margin-top: 0; margin-bottom: 0.7em; }

@media (max-width: 560px) {
  .journey-line::before { left: 11px; }
  .journey-stop { grid-template-columns: 24px 1fr; gap: 14px; }
}

/* ---------- footer ---------- */

.site-footer {
  padding: 32px 0 56px;
  color: var(--text-faint);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
}
