/* Design tokens */
:root {
  --bg: #FCFCFA;
  --text: #1C1917;
  --text-muted: #78716C;
  --accent: #B45309;
  --border: #EDEAE6;
  --glass: rgba(252, 252, 250, 0.82);
  --font-serif-en: "Instrument Serif", Georgia, serif;
  --font-serif-zh: "Noto Serif SC", "Songti SC", Georgia, serif;
  --max-width: 680px;
  --section-pad: 48px;
}

@media (min-width: 768px) {
  :root {
    --section-pad: 64px;
  }
}

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

html {
  scroll-behavior: smooth;
}

html[lang="en"] body {
  font-family: var(--font-serif-en);
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-size: 20px;
  line-height: 1.65;
  min-height: 100vh;
  overflow-x: hidden;
}

@media (min-width: 768px) {
  body {
    font-size: 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* 3D background */
#bg-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  #bg-canvas {
    display: none;
  }

  body {
    background: linear-gradient(165deg, #FDFDFB 0%, #FCFCFA 50%, #F8F7F4 100%);
  }
}

.content-layer {
  position: relative;
  z-index: 1;
}

/* Skip link */
.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  z-index: 1000;
  padding: 8px 16px;
  background: var(--text);
  color: var(--bg);
  text-decoration: none;
  font-size: 16px;
  border-radius: 4px;
}

.skip-link:focus {
  top: 16px;
}

/* Language toggle — floating, no border */
.lang-toggle--float {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 6px;
}

.lang-toggle button {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 2px;
  transition: color 0.2s;
}

.lang-toggle button[aria-pressed="true"] {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.lang-toggle button:hover,
.lang-toggle button:focus-visible {
  color: var(--accent);
}

.lang-toggle span {
  color: var(--border);
  font-size: 14px;
}

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

/* One-page condensed layout */
.one-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0;
}

/* Hero */
.hero {
  padding: 48px 0 32px;
}

.hero-title {
  font-size: clamp(56px, 11vw, 112px);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin-bottom: 40px;
  animation: fadeUp 0.7s ease forwards;
}

/* Live age (ryo.lu style, age only) */
.age-value {
  font-family: ui-monospace, "SF Mono", "Cascadia Code", monospace;
  font-size: clamp(14px, 2vw, 18px);
  font-weight: 400;
  color: var(--text-muted);
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  overflow-x: auto;
  white-space: nowrap;
  animation: fadeUp 0.7s 0.12s ease forwards;
  opacity: 0;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Compact sections */
.section-compact {
  padding: 24px 0;
}

.about-line {
  font-size: clamp(22px, 3.5vw, 28px);
  font-weight: 400;
  line-height: 1.5;
  color: var(--text);
  font-style: italic;
}

.contact-list--inline {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 24px 40px;
}

.contact-list--inline a {
  font-size: clamp(18px, 2.5vw, 22px);
}

.contact-list--inline svg {
  display: none;
}

/* Sections */
.section {
  padding: var(--section-pad) 0;
}

.section-header {
  display: flex;
  align-items: baseline;
  gap: 20px;
  margin-bottom: 48px;
}

.section-number {
  font-size: 16px;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.05em;
}

.section-title {
  font-size: clamp(40px, 6vw, 56px);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.section-body p + p {
  margin-top: 1.25em;
}

.section-body a {
  color: var(--accent);
  text-decoration: none;
  background-image: linear-gradient(var(--accent), var(--accent));
  background-size: 0% 1px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  transition: background-size 0.3s ease;
}

.section-body a:hover,
.section-body a:focus-visible {
  background-size: 100% 1px;
}

/* Scroll reveal */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
  }
}

/* Contact links */
.contact-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.contact-list a {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: clamp(22px, 3vw, 28px);
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  transition: color 0.2s;
}

.contact-list a:hover,
.contact-list a:focus-visible {
  color: var(--accent);
}

.contact-list svg {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
}

/* Page header (projects / blog) */
.page-header {
  padding: calc(var(--section-pad) * 0.6) 0 calc(var(--section-pad) * 0.4);
}

.page-title {
  font-size: clamp(48px, 8vw, 72px);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 16px;
}

.page-subtitle {
  font-size: 22px;
  color: var(--text-muted);
  font-style: italic;
}

/* Cards */
.card-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 48px;
  padding-bottom: var(--section-pad);
}

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

.card-tag {
  font-size: 14px;
  font-weight: 500;
  color: var(--accent);
  margin-bottom: 12px;
  letter-spacing: 0.03em;
}

.card-title {
  font-size: clamp(26px, 4vw, 32px);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}

.card-title a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s;
}

.card-title a:hover,
.card-title a:focus-visible {
  color: var(--accent);
}

.card-desc {
  color: var(--text-muted);
  margin-bottom: 16px;
  max-width: 560px;
}

.card-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
}

.card-link:hover,
.card-link:focus-visible {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.card-meta {
  font-size: 15px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* Blog post */
.post-content {
  padding-bottom: var(--section-pad);
}

.post-content h2 {
  font-size: clamp(32px, 5vw, 40px);
  font-weight: 600;
  margin: 1.5em 0 0.75em;
  letter-spacing: -0.02em;
}

.post-content p {
  margin-bottom: 1.25em;
}

.post-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  color: var(--accent);
  text-decoration: none;
  margin-bottom: 48px;
}

.post-back:hover,
.post-back:focus-visible {
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* Footer */
.site-footer {
  padding: 32px 0;
  text-align: center;
  font-size: 14px;
  color: var(--text-muted);
}

/* Focus styles */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
