/* ============================================================
   PerlitePro Design System — base.css
   CSS Custom Properties + Reset + Typography + Utilities
   ============================================================ */

/* ---- Design Tokens ---- */
:root {
  /* Colors */
  --c-forest:       #1E4D3B;
  --c-forest-dark:  #16382A;
  --c-moss:         #2E6B50;
  --c-ochre:        #C98A2D;
  --c-ochre-dark:   #A9721F;
  --c-ochre-light:  rgba(201,138,45,.12);
  --c-charcoal:     #2A2A27;
  --c-ink-muted:    #6B6B63;
  --c-warm-white:   #FAF7F1;
  --c-card:         #FFFFFF;
  --c-perlite:      #F2EEE6;
  --c-border:       #E3DCCE;
  --c-flag-good:    #1F7A4D;
  --c-error:        #B3372C;

  /* Typography */
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
               Roboto, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Noto Sans SC",
               "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", "Fira Code", "Cascadia Code",
               Consolas, "Courier New", monospace;

  /* Type scale */
  --text-xs:    0.75rem;    /* 12px */
  --text-sm:    0.875rem;   /* 14px */
  --text-base:  1rem;       /* 16px */
  --text-lg:    1.125rem;   /* 18px */
  --text-xl:    1.25rem;    /* 20px */
  --text-2xl:   1.5rem;     /* 24px */
  --text-3xl:   2rem;       /* 32px */

  /* Fluid headings */
  --h1-size:    clamp(2.1rem, 4.5vw, 3.5rem);
  --h2-size:    clamp(1.6rem, 3vw, 2.4rem);
  --h3-size:    1.3rem;

  /* Spacing scale (4px base) */
  --space-1:  0.25rem;   /* 4px */
  --space-2:  0.5rem;    /* 8px */
  --space-3:  0.75rem;   /* 12px */
  --space-4:  1rem;      /* 16px */
  --space-5:  1.25rem;   /* 20px */
  --space-6:  1.5rem;    /* 24px */
  --space-8:  2rem;      /* 32px */
  --space-10: 2.5rem;    /* 40px */
  --space-12: 3rem;      /* 48px */
  --space-16: 4rem;      /* 64px */
  --space-20: 5rem;      /* 80px */
  --space-24: 6rem;      /* 96px */
  --space-32: 8rem;      /* 128px */

  /* Section padding */
  --section-py: clamp(3rem, 7vw, 6rem);

  /* Radii */
  --radius-sm:  6px;
  --radius-md:  8px;
  --radius-lg:  12px;
  --radius-xl:  20px;
  --radius-full: 999px;

  /* Shadows */
  --shadow-card:  0 1px 2px rgba(42,42,39,.06),
                  0 8px 24px rgba(42,42,39,.08);
  --shadow-hover: 0 2px 4px rgba(42,42,39,.08),
                  0 16px 40px rgba(42,42,39,.12);
  --shadow-nav:   0 4px 16px rgba(42,42,39,.14);

  /* Layout */
  --container: min(1140px, 92vw);
  --header-h: 72px;
  --util-h: 36px;
}

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

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

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--c-charcoal);
  background: var(--c-warm-white);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Chinese text gets looser line-height */
[lang="zh-CN"] body,
body:has(html[lang="zh-CN"]) {
  line-height: 1.75;
}

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

a {
  color: var(--c-moss);
  text-decoration: none;
  transition: color .2s;
}
a:hover { color: var(--c-forest-dark); }

ul, ol { list-style: none; }

table {
  border-collapse: collapse;
  width: 100%;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: none;
}

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

:focus:not(:focus-visible) { outline: none; }

/* ---- Typography ---- */
h1, h2, h3, h4, h5, h6 {
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--c-forest-dark);
}

/* Chinese headings override */
[lang="zh-CN"] h1,
[lang="zh-CN"] h2,
[lang="zh-CN"] h3,
[lang="zh-CN"] h4 { font-weight: 700; line-height: 1.35; letter-spacing: 0; }

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

p { margin-bottom: var(--space-4); }

.lede {
  font-size: var(--text-lg);
  color: var(--c-ink-muted);
  max-width: 60ch;
}

/* Eyebrow label above headings */
.eyebrow {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--c-ochre);
  margin-bottom: var(--space-3);
}

/* ---- Utilities ---- */
.container {
  width: var(--container);
  margin-inline: auto;
}

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

.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  background: var(--c-forest);
  color: #fff;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  z-index: 10000;
  font-weight: 700;
}
.skip-link:focus { top: var(--space-2); }

/* Section block */
.section {
  padding-block: var(--section-py);
}

.section--alt {
  background: var(--c-perlite);
}

.section--dark {
  background: var(--c-forest-dark);
  color: #fff;
}
.section--dark h2, .section--dark h3 { color: #fff; }
.section--dark .lede { color: rgba(255,255,255,.7); }

/* Section heading grouping */
.section-head {
  text-align: center;
  margin-bottom: var(--space-12);
}
.section-head .eyebrow { margin-bottom: var(--space-2); }
.section-head .lede { margin-inline: auto; }

/* Grid helpers */
.grid-2 { display: grid; gap: var(--space-6); }
.grid-3 { display: grid; gap: var(--space-6); }
.grid-4 { display: grid; gap: var(--space-6); }

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

/* Breadcrumbs */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--c-ink-muted);
  padding-block: var(--space-4);
  flex-wrap: wrap;
}
.breadcrumb a { color: var(--c-ink-muted); }
.breadcrumb a:hover { color: var(--c-moss); }
.breadcrumb .sep { color: var(--c-border); user-select: none; }

/* Page header strip (below nav, above content) */
.page-hero {
  background: var(--c-forest);
  color: #fff;
  padding-block: var(--space-12) var(--space-8);
}
.page-hero h1 { color: #fff; }
.page-hero .lede { color: rgba(255,255,255,.75); }

/* Print */
@media print {
  .no-print { display: none !important; }
  body { font-size: 11pt; color: #000; background: #fff; }
  a { color: #000; text-decoration: underline; }
}
