/* ============================================
   Reset, Typography, Layout, .prose
   ============================================ */

/* ---- Modern reset ---- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background var(--transition-slow), color var(--transition-slow);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

main {
  flex: 1;
}

img, video, canvas {
  display: block;
  max-width: 100%;
}

a {
  color: var(--primary-light);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-pink);
}

ul, ol {
  list-style: none;
}

button {
  font: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

/* ---- Fluid typography ---- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
}

h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.5rem); }
h3 { font-size: clamp(1.25rem, 2.5vw, 1.75rem); }
h4 { font-size: clamp(1.1rem, 2vw, 1.35rem); }

p {
  font-size: clamp(1rem, 1.5vw, 1.125rem);
}

small {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* ---- Layout ---- */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.section {
  padding: var(--space-4xl) 0;
}

.section-header {
  text-align: center;
  margin-bottom: var(--space-3xl);
}

.section-header h2 {
  margin-bottom: var(--space-sm);
}

.section-header p {
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto;
}

/* ---- Grid helpers ---- */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-xl);
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-xl);
}

@media (min-width: 640px) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
}

/* ---- Prose (article content) ---- */
.prose {
  max-width: 720px;
  margin: 0 auto;
  font-size: clamp(1rem, 1.5vw, 1.125rem);
  line-height: 1.8;
  color: var(--text);
}

.prose h1, .prose h2, .prose h3, .prose h4 {
  margin-top: 2em;
  margin-bottom: 0.75em;
}

.prose p {
  margin-bottom: 1.25em;
}

.prose a {
  color: var(--primary-light);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.prose a:hover {
  color: var(--accent-pink);
}

.prose ul, .prose ol {
  margin-bottom: 1.25em;
  padding-left: 1.5em;
}

.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }

.prose li {
  margin-bottom: 0.5em;
}

.prose blockquote {
  border-left: 4px solid var(--primary);
  padding: var(--space-md) var(--space-lg);
  margin: var(--space-xl) 0;
  background: var(--bg-alt);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic;
  color: var(--text-muted);
}

.prose code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--bg-alt);
  padding: 0.15em 0.4em;
  border-radius: 4px;
}

.prose pre {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-lg);
  overflow-x: auto;
  margin-bottom: 1.5em;
}

.prose pre code {
  background: none;
  padding: 0;
}

.prose img {
  border-radius: var(--radius-md);
  margin: var(--space-xl) 0;
}

.prose hr {
  border: none;
  border-top: 2px solid var(--border);
  margin: var(--space-2xl) 0;
}

/* ---- Page header (used on listing pages) ---- */
.page-header {
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  color: var(--text);
  padding: var(--space-4xl) 0 var(--space-3xl);
  text-align: center;
}

.page-header h1 {
  color: var(--text);
}

.page-header p {
  color: var(--text-muted);
  max-width: 600px;
  margin: var(--space-sm) auto 0;
}

/* ---- Gradient text utility ---- */
.gradient-text {
  background: var(--hero-gradient);
  background-size: 400% 400%;
  animation: gradient-shift 12s ease infinite;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ---- i18n content blocks ---- */
[data-lang-content] { display: none; }
html[data-lang="en"] [data-lang-content="en"] { display: block; }
html[data-lang="zh"] [data-lang-content="zh"] { display: block; }
html[data-lang="en"] span[data-lang-content="en"],
html[data-lang="en"] a[data-lang-content="en"] { display: inline; }
html[data-lang="zh"] span[data-lang-content="zh"],
html[data-lang="zh"] a[data-lang-content="zh"] { display: inline; }
html[data-lang="en"] div.hero-buttons[data-lang-content="en"],
html[data-lang="en"] div.tags[data-lang-content="en"],
html[data-lang="en"] div.social-links[data-lang-content="en"] { display: flex; }
html[data-lang="zh"] div.hero-buttons[data-lang-content="zh"],
html[data-lang="zh"] div.tags[data-lang-content="zh"],
html[data-lang="zh"] div.social-links[data-lang-content="zh"] { display: flex; }

/* ---- Visually hidden ---- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}
