/* ============================================================
   Base Styles — Reset, Typography, Layout
   ============================================================ */

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

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

body {
  font-family: var(--font-body);
  font-size: var(--text-body);
  line-height: 1.6;
  color: var(--fg);
  background-color: var(--bg);
  transition: background-color var(--duration-slow) var(--ease-out),
              color var(--duration-slow) var(--ease-out);
  overflow-x: hidden;
}

img, video { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font: inherit; border: none; background: none; color: inherit; }
ul, ol { list-style: none; }

/* Typography */
.font-display {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.font-body {
  font-family: var(--font-body);
  font-weight: 400;
}

.font-mono {
  font-family: var(--font-mono);
  font-weight: 400;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

h1 { font-size: var(--text-h1); font-weight: 700; }
h2 { font-size: var(--text-h2); }
h3 { font-size: var(--text-h3); }

p { max-width: 65ch; font-weight: 300; }

.text-display { font-size: var(--text-display); }
.text-h1 { font-size: var(--text-h1); }
.text-h2 { font-size: var(--text-h2); }
.text-h3 { font-size: var(--text-h3); }
.text-body { font-size: var(--text-body); }
.text-body-lg { font-size: var(--text-body-lg); }
.text-small { font-size: var(--text-small); }
.text-caption { font-size: var(--text-caption); }
.text-label {
  font-size: var(--text-label);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.text-muted { color: var(--fg-muted); }
.text-secondary { color: var(--fg-secondary); }
.text-accent { color: var(--accent); }

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

.container--wide {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.grid {
  display: grid;
  gap: var(--space-lg);
}

.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }

.flex { display: flex; }
.flex--center { align-items: center; justify-content: center; }
.flex--between { align-items: center; justify-content: space-between; }
.flex--col { flex-direction: column; }

/* Responsive grid */
@media (max-width: 1024px) {
  .grid--4 { grid-template-columns: repeat(3, 1fr); }
  .grid--3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .grid--4, .grid--3, .grid--2 { grid-template-columns: repeat(2, 1fr); }
  :root { --gutter: 16px; }
}

@media (max-width: 480px) {
  .grid--4, .grid--3, .grid--2 { grid-template-columns: 1fr; }
}

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

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

/* Trilingual inline display */
.lang-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.lang-inline {
  display: inline-flex;
  gap: var(--space-md);
  flex-wrap: wrap;
  align-items: baseline;
}

.lang-inline span {
  position: relative;
}

.lang-inline span:not(:last-child)::after {
  content: '·';
  margin-left: var(--space-md);
  color: var(--fg-muted);
}

/* Language-aware content */
.lang-fr, .lang-en, .lang-zh,
.lang-block-fr, .lang-block-en, .lang-block-zh {
  display: none !important;
}

[data-lang="fr"] .lang-fr { display: inline !important; }
[data-lang="fr"] .lang-block-fr { display: block !important; }

[data-lang="en"] .lang-en { display: inline !important; }
[data-lang="en"] .lang-block-en { display: block !important; }

[data-lang="zh"] .lang-zh { display: inline !important; }
[data-lang="zh"] .lang-block-zh { display: block !important; }

/* Separator */
hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--space-2xl) 0;
}

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

/* Selection */
::selection {
  background: var(--accent-muted);
  color: var(--fg);
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--fg-muted); }

/* Page transition */
.page-enter {
  opacity: 1;
  transform: translateY(0);
}

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