/* ============================================================
   main.css — Hipponylab Homepage
   Core variables, reset, base typography, layout utilities
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Merriweather:ital,wght@0,400;0,700;1,400&family=Inter:wght@400;500;600&display=swap');

/* ── CSS Custom Properties ─────────────────────────────────── */
:root {
  /* Brand colours */
  --color-brand-blue:    #2A6DB5;
  --color-brand-dark:    #1A3A5C;
  --color-brand-light:   #EAF2FB;

  /* Neutrals */
  --color-bg:            #FFFFFF;
  --color-surface:       #F7F9FC;
  --color-border:        #DDE3ED;
  --color-text-primary:  #1C2333;
  --color-text-secondary:#4A5568;
  --color-text-muted:    #718096;

  /* Accent */
  --color-accent:        #E07B39;

  /* Funding area colours */
  --color-fund-nsfc:     #C0392B;  /* red    — NSFC */
  --color-fund-ministry: #1A5276;  /* blue   — MOE */
  --color-fund-univ:     #1E8449;  /* green  — NBU */
  --color-fund-zjnsf:    #0E7490;  /* teal   — ZJNSF */
  --color-fund-other:    #6C3483;  /* purple — other */

  /* Typography */
  --font-heading: 'Merriweather', Georgia, 'PingFang SC', 'Microsoft YaHei', serif;
  --font-body:    'Inter', 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;

  /* Spacing */
  --space-xs:  0.25rem;
  --space-sm:  0.5rem;
  --space-md:  1rem;
  --space-lg:  2rem;
  --space-xl:  4rem;
  --space-2xl: 7rem;

  /* Layout */
  --max-width:  1160px;
  --nav-height: 64px;

  /* Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(26, 58, 92, 0.12);
  --shadow-lg: 0 8px 32px rgba(26, 58, 92, 0.16);
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-body);
  color: var(--color-text-primary);
  background: var(--color-bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: var(--color-brand-blue);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

ul {
  list-style: none;
}

/* Smooth scroll offset for sticky nav */
[id] {
  scroll-margin-top: calc(var(--nav-height) + 20px);
}

/* ── Base Typography ───────────────────────────────────────── */
h1, h2, h3, h4, h5 {
  font-family: var(--font-heading);
  color: var(--color-brand-dark);
  line-height: 1.25;
  font-weight: 700;
}

h1 { font-size: clamp(1.75rem, 3vw, 2.5rem); }
h2 { font-size: clamp(1.4rem, 2.5vw, 2rem); }
h3 { font-size: clamp(1.1rem, 2vw, 1.35rem); }
h4 { font-size: 1rem; }

p {
  color: var(--color-text-secondary);
  margin-bottom: var(--space-md);
}

p:last-child {
  margin-bottom: 0;
}

strong {
  color: var(--color-text-primary);
  font-weight: 600;
}

/* ── Layout Utilities ──────────────────────────────────────── */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

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

.section--alt {
  background: var(--color-surface);
}

.section--brand {
  background: var(--color-brand-light);
}

.section__header {
  margin-bottom: var(--space-xl);
}

.section__title {
  margin-bottom: var(--space-sm);
}

.section__subtitle {
  font-size: 1.05rem;
  color: var(--color-text-muted);
  max-width: 640px;
}

/* ── Visually Hidden (accessibility) ──────────────────────── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
}

/* ── Image Placeholder ─────────────────────────────────────── */
.img-placeholder {
  width: 100%;
  background: linear-gradient(135deg, var(--color-brand-light) 0%, var(--color-border) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-align: center;
  border-radius: var(--radius-sm);
}
