/* =========================================
   BASE — Reset & Foundation
   ========================================= */

@import url('https://fonts.googleapis.com/css2?family=Josefin+Sans:wght@300;400;600;700&family=Noto+Sans+SC:wght@400;500;700&family=Roboto:wght@300;400;500&family=JetBrains+Mono:wght@400;500&display=swap');

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-height);
  font-size: 16px;
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
}

body {
  background-color: var(--color-bg);
  color: var(--color-text-primary);
  font-family: var(--font-body);
  font-size: var(--text-body);
  line-height: var(--leading-normal);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: var(--color-bg);
}
::-webkit-scrollbar-thumb {
  background: var(--color-border-bright);
  border-radius: var(--radius-none);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--color-blue-border);
}

/* --- Selection --- */
::selection {
  background: var(--color-accent);
  color: #14120f;
}

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

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  text-transform: uppercase;
  color: var(--color-text-primary);
}

h1 { font-size: var(--text-hero); }
h2 { font-size: var(--text-display); }
h3 { font-size: var(--text-heading); }
h4 { font-size: var(--text-subheading); }

/* CJK glyphs clip under the tight Latin tracking and line-height. */
html[lang="zh"] h1,
html[lang="zh"] h2,
html[lang="zh"] h3,
html[lang="zh"] h4 {
  letter-spacing: 0.04em;
  line-height: 1.2;
}

p {
  max-width: 72ch;
  line-height: var(--leading-relaxed);
  color: var(--color-text-secondary);
}

a {
  color: inherit;
  text-decoration: none;
}

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

ul, ol {
  list-style: none;
}

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

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

.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: clamp(1.5rem, 5vw, 4rem);
}

.container--narrow {
  max-width: var(--container-narrow);
}

.section {
  padding-block: var(--section-padding);
}

/* --- Geometric Shapes --- */
.shape-square {
  border-radius: 0;
}

.shape-circle {
  border-radius: var(--radius-full);
}

.shape-diamond {
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
}

.shape-triangle {
  clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
}

.shape-triangle-up {
  clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
  transform: rotate(180deg);
}
