/* ============================================
   Simon Xu — Personal Website
   Clean, minimal, content-first design
   ============================================ */

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

:root {
  --color-bg: #fafaf9;
  --color-bg-alt: #f5f4f1;
  --color-bg-dark: #1a1a1a;
  --color-text: #1a1a1a;
  --color-text-secondary: #6b6b6b;
  --color-text-light: #999;
  --color-accent: #2d2d2d;
  --color-accent-hover: #000;
  --color-border: #e5e5e3;
  --color-tag-bg: #edecea;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --font-serif-cn: 'Noto Serif SC', 'Songti SC', 'SimSun', serif;
  --max-width: 720px;
  --max-width-wide: 1080px;
  --nav-height: 64px;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a {
  color: var(--color-text);
  text-decoration: none;
  transition: opacity 0.2s;
}

a:hover {
  opacity: 0.7;
}

img {
  max-width: 100%;
  height: auto;
}

/* --- Container --- */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* --- Navigation --- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: rgba(250, 250, 249, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
  z-index: 100;
}

.nav-inner {
  max-width: var(--max-width-wide);
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.nav-logo:hover {
  opacity: 1;
}

.nav-links {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 32px;
}

.nav-links a {
  font-size: 14px;
  color: var(--color-text-secondary);
  font-weight: 450;
}

.nav-links a:hover {
  color: var(--color-text);
  opacity: 1;
}

.nav-cta {
  background: var(--color-text);
  color: #fff !important;
  padding: 8px 18px;
  border-radius: 6px;
  font-size: 13px !important;
}

.nav-cta:hover {
  background: var(--color-accent-hover) !important;
  opacity: 1 !important;
}

/* --- Language Toggle --- */
.nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.lang-toggle {
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 13px;
  font-family: var(--font-sans);
  font-weight: 500;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.lang-toggle:hover {
  color: var(--color-text);
  border-color: var(--color-text);
}

/* --- Chinese font overrides --- */
body.lang-cn .hero-title,
body.lang-cn .post-title,
body.lang-cn .research-title,
body.lang-cn .subscribe-title,
body.lang-cn .about-text,
body.lang-cn .section-description,
body.lang-cn .post-body p,
body.lang-cn .post-body h2,
body.lang-cn .post-header h1 {
  font-family: var(--font-serif-cn);
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  flex-direction: column;
  gap: 5px;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-text);
  border-radius: 1px;
  transition: transform 0.3s, opacity 0.3s;
}

/* --- Hero --- */
.hero {
  padding: 160px 0 100px;
  text-align: center;
}

.hero-title {
  font-family: var(--font-serif);
  font-size: clamp(32px, 5vw, 52px);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin-bottom: 24px;
  color: var(--color-text);
}

.hero-subtitle {
  font-size: 18px;
  line-height: 1.7;
  color: var(--color-text-secondary);
  max-width: 540px;
  margin: 0 auto 36px;
}

.hero-links {
  display: flex;
  justify-content: center;
  gap: 24px;
}

.hero-links a {
  font-size: 15px;
  color: var(--color-text-secondary);
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 2px;
}

.hero-links a:hover {
  color: var(--color-text);
  border-color: var(--color-text);
  opacity: 1;
}

/* --- Sections --- */
.section {
  padding: 80px 0;
}

.section-alt {
  background: var(--color-bg-alt);
}

.section-dark {
  background: var(--color-bg-dark);
  color: #fff;
}

.section-label {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-light);
  margin-bottom: 8px;
}

.section-description {
  font-family: var(--font-serif);
  font-size: 20px;
  color: var(--color-text-secondary);
  margin-bottom: 48px;
  line-height: 1.5;
}

/* --- About --- */
.about-grid {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 48px;
  align-items: start;
}

.photo-placeholder {
  width: 200px;
  height: 200px;
  background: var(--color-bg-alt);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-size: 48px;
  font-weight: 500;
  color: var(--color-text-light);
  border: 1px solid var(--color-border);
}

.about-text {
  font-family: var(--font-serif);
  font-size: 18px;
  line-height: 1.8;
  color: var(--color-text-secondary);
  margin-bottom: 16px;
}

.about-text:last-of-type {
  margin-bottom: 24px;
}

.about-links {
  display: flex;
  gap: 20px;
}

.about-links a {
  font-size: 14px;
  color: var(--color-text-secondary);
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 2px;
}

.about-links a:hover {
  color: var(--color-text);
  border-color: var(--color-text);
  opacity: 1;
}

/* --- Post List --- */
.post-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.post-card {
  padding: 32px 0;
  border-bottom: 1px solid var(--color-border);
}

.post-card:first-child {
  border-top: 1px solid var(--color-border);
}

.post-date {
  font-size: 13px;
  color: var(--color-text-light);
  font-weight: 450;
}

.post-title {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 500;
  margin: 6px 0 10px;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.post-title a {
  text-decoration: none;
}

.post-title a:hover {
  opacity: 0.65;
}

.post-excerpt {
  font-size: 15px;
  line-height: 1.65;
  color: var(--color-text-secondary);
  margin-bottom: 12px;
}

.post-tag {
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-secondary);
  background: var(--color-tag-bg);
  padding: 4px 12px;
  border-radius: 100px;
}

.view-all {
  display: inline-block;
  margin-top: 32px;
  font-size: 14px;
  color: var(--color-text-secondary);
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 2px;
}

.view-all:hover {
  color: var(--color-text);
  border-color: var(--color-text);
  opacity: 1;
}

/* --- Research Grid --- */
.research-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}

.research-card {
  padding: 32px 0;
  border-bottom: 1px solid var(--color-border);
}

.research-card:first-child {
  border-top: 1px solid var(--color-border);
}

.research-type {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-light);
}

.research-title {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 500;
  margin: 6px 0 10px;
  line-height: 1.35;
}

.research-title a:hover {
  opacity: 0.65;
}

.research-excerpt {
  font-size: 15px;
  line-height: 1.65;
  color: var(--color-text-secondary);
  margin-bottom: 10px;
}

/* --- Subscribe --- */
.subscribe-container {
  text-align: center;
  max-width: 480px;
}

.subscribe-title {
  font-family: var(--font-serif);
  font-size: 32px;
  font-weight: 500;
  color: #fff;
  margin-bottom: 12px;
}

.subscribe-text {
  font-size: 16px;
  color: rgba(255, 255, 255, 0.65);
  margin-bottom: 32px;
  line-height: 1.7;
}

.subscribe-form {
  display: flex;
  gap: 10px;
  max-width: 400px;
  margin: 0 auto;
}

.subscribe-form input {
  flex: 1;
  padding: 12px 16px;
  font-size: 15px;
  font-family: var(--font-sans);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  outline: none;
  transition: border-color 0.2s;
}

.subscribe-form input::placeholder {
  color: rgba(255, 255, 255, 0.35);
}

.subscribe-form input:focus {
  border-color: rgba(255, 255, 255, 0.5);
}

.subscribe-form button {
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-sans);
  background: #fff;
  color: var(--color-bg-dark);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: opacity 0.2s;
}

.subscribe-form button:hover {
  opacity: 0.85;
}

.subscribe-note {
  margin-top: 16px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.35);
}

.subscribe-success p {
  font-size: 16px;
  color: rgba(255, 255, 255, 0.85);
  margin-top: 8px;
}

/* --- Footer --- */
.footer {
  padding: 32px 0;
  border-top: 1px solid var(--color-border);
}

.footer-inner {
  max-width: var(--max-width-wide);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--color-text-light);
}

.footer-links {
  display: flex;
  gap: 20px;
}

.footer-links a {
  font-size: 13px;
  color: var(--color-text-light);
}

/* --- Post Page --- */
.post-header {
  padding: 140px 0 40px;
  text-align: center;
}

.post-header .post-tag {
  margin-bottom: 12px;
  display: inline-block;
}

.post-header h1 {
  font-family: var(--font-serif);
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}

.post-header .post-date {
  display: block;
}

.post-body {
  padding: 40px 0 80px;
}

.post-body p {
  font-family: var(--font-serif);
  font-size: 18px;
  line-height: 1.85;
  color: var(--color-text-secondary);
  margin-bottom: 24px;
}

.post-body h2 {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 500;
  margin: 48px 0 16px;
  letter-spacing: -0.01em;
}

.post-body blockquote {
  border-left: 3px solid var(--color-border);
  padding-left: 24px;
  margin: 32px 0;
  font-style: italic;
  color: var(--color-text-light);
}

.post-body ul, .post-body ol {
  font-family: var(--font-serif);
  font-size: 18px;
  line-height: 1.85;
  color: var(--color-text-secondary);
  margin-bottom: 24px;
  padding-left: 24px;
}

.post-nav {
  padding: 40px 0;
  border-top: 1px solid var(--color-border);
  text-align: center;
}

.post-nav a {
  font-size: 14px;
  color: var(--color-text-secondary);
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 2px;
}

/* --- Article Photos --- */
.article-photo {
  margin: 48px 0;
  text-align: center;
}

.article-photo img {
  width: 100%;
  max-width: 100%;
  height: auto;
  min-height: 200px;
  border-radius: 8px;
  display: block;
  margin: 0 auto;
  background: #1a365d;
  object-fit: cover;
}

.article-photo figcaption {
  font-size: 13px;
  color: var(--color-text-light);
  margin-top: 12px;
  font-style: italic;
}

.article-subtitle {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 400;
  font-style: italic;
  color: var(--color-text-secondary);
  margin: 32px 0 24px;
  text-align: center;
}

.post-body h3 {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 500;
  margin: 36px 0 12px;
}

.highlight-text {
  font-size: 20px !important;
  font-weight: 500;
  color: var(--color-text) !important;
  text-align: center;
  margin: 40px 0 !important;
  font-style: italic;
}

.article-signature {
  margin-top: 48px !important;
  padding-top: 32px;
  border-top: 1px solid var(--color-border);
  font-weight: 500;
  color: var(--color-text) !important;
}

body.lang-cn .article-subtitle {
  font-family: var(--font-serif-cn);
}

body.lang-cn .post-body h3 {
  font-family: var(--font-serif-cn);
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .nav-toggle {
    display: flex;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    flex-direction: column;
    padding: 24px;
    gap: 20px;
  }

  .nav-links.active {
    display: flex;
  }

  .hero {
    padding: 120px 0 64px;
  }

  .hero-title {
    font-size: 28px;
  }

  .hero-subtitle {
    font-size: 16px;
  }

  .hero-links {
    flex-direction: column;
    gap: 12px;
  }

  .section {
    padding: 56px 0;
  }

  .about-grid {
    grid-template-columns: 1fr;
    gap: 32px;
    text-align: center;
  }

  .about-photo {
    display: flex;
    justify-content: center;
  }

  .photo-placeholder {
    width: 140px;
    height: 140px;
    font-size: 36px;
  }

  .about-links {
    justify-content: center;
  }

  .subscribe-form {
    flex-direction: column;
  }

  .footer-inner {
    flex-direction: column;
    gap: 16px;
    text-align: center;
  }

  .article-photo {
    margin: 32px -12px;
  }
}
