/* ============================================
   ZHICAI Design System — base.css
   CSS Variables + Reset + Typography + Global
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
  /* Brand Colors */
  --color-kraft:         #A67C52;
  --color-kraft-light:   #C4A882;
  --color-kraft-dark:    #8B6340;
  --color-coffee:        #3D2B1F;
  --color-warm-white:    #FAF6F1;
  --color-cream:         #F5EDE3;

  /* Accent Colors */
  --color-forest:        #2D6A4F;
  --color-forest-dark:   #1B4332;
  --color-forest-light:  #40916C;
  --color-gold:          #C9A84C;
  --color-gold-light:    #E0C872;

  /* Neutral Colors */
  --color-graphite:      #4A4A4A;
  --color-gray-600:      #6B7280;
  --color-gray-400:      #9CA3AF;
  --color-gray-200:      #E5E7EB;
  --color-gray-100:      #F3F4F6;
  --color-white:         #FFFFFF;
  --color-black:         #1A1A1A;

  /* Functional Colors */
  --color-cta:           var(--color-forest);
  --color-cta-hover:     var(--color-forest-dark);
  --color-text:          var(--color-graphite);
  --color-text-heading:  var(--color-coffee);
  --color-text-light:    var(--color-gray-600);
  --color-bg:            var(--color-warm-white);
  --color-bg-alt:        var(--color-cream);
  --color-border:        var(--color-gray-200);

  /* Typography */
  --font-heading:        'Playfair Display', 'Noto Serif SC', Georgia, serif;
  --font-body:           'Inter', 'Noto Sans SC', system-ui, -apple-system, sans-serif;
  --font-mono:           'DM Sans', 'Inter', sans-serif;

  /* Font Sizes (fluid) */
  --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:   1.875rem;   /* 30px */
  --text-4xl:   2.25rem;    /* 36px */
  --text-5xl:   3rem;       /* 48px */
  --text-6xl:   3.75rem;    /* 60px */

  /* Spacing */
  --space-1:   0.25rem;
  --space-2:   0.5rem;
  --space-3:   0.75rem;
  --space-4:   1rem;
  --space-5:   1.25rem;
  --space-6:   1.5rem;
  --space-8:   2rem;
  --space-10:  2.5rem;
  --space-12:  3rem;
  --space-16:  4rem;
  --space-20:  5rem;
  --space-24:  6rem;
  --space-32:  8rem;

  /* Border Radius */
  --radius-sm:   6px;
  --radius-md:   12px;
  --radius-lg:   16px;
  --radius-xl:   24px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm:   0 1px 2px rgba(61, 43, 31, 0.05);
  --shadow-md:   0 4px 12px rgba(61, 43, 31, 0.08);
  --shadow-lg:   0 8px 30px rgba(61, 43, 31, 0.12);
  --shadow-xl:   0 16px 50px rgba(61, 43, 31, 0.16);

  /* Transitions */
  --transition-fast:   150ms ease;
  --transition-base:   300ms ease;
  --transition-slow:   500ms ease;
  --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Layout */
  --container-max:  1280px;
  --container-pad:  var(--space-6);
  --nav-height:     80px;

  /* Z-index layers */
  --z-base:      1;
  --z-dropdown:  100;
  --z-sticky:    200;
  --z-fixed:     300;
  --z-overlay:   400;
  --z-modal:     500;
}

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

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

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.7;
  color: var(--color-text);
  background-color: var(--color-bg);
  overflow-x: hidden;
}

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

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

a:hover {
  color: var(--color-forest);
}

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

ul, ol {
  list-style: none;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  outline: none;
}

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

h1 { font-size: clamp(var(--text-4xl), 5vw, var(--text-6xl)); }
h2 { font-size: clamp(var(--text-3xl), 4vw, var(--text-5xl)); }
h3 { font-size: clamp(var(--text-2xl), 3vw, var(--text-4xl)); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-base); }

p {
  margin-bottom: var(--space-4);
  max-width: 72ch;
}

.text-center { text-align: center; }
.text-left   { text-align: left; }
.text-right  { text-align: right; }

/* --- Utility Classes --- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--container-pad);
  padding-right: var(--container-pad);
}

.section {
  padding-top: var(--space-24);
  padding-bottom: var(--space-24);
}

.section-title {
  text-align: center;
  margin-bottom: var(--space-4);
}

.section-subtitle {
  text-align: center;
  color: var(--color-text-light);
  font-size: var(--text-lg);
  max-width: 60ch;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: var(--space-16);
}

.bg-white    { background-color: var(--color-white); }
.bg-cream    { background-color: var(--color-cream); }
.bg-warm     { background-color: var(--color-warm-white); }
.bg-coffee   { background-color: var(--color-coffee); color: var(--color-warm-white); }
.bg-forest   { background-color: var(--color-forest); color: var(--color-warm-white); }

/* --- Selection --- */
::selection {
  background-color: var(--color-kraft-light);
  color: var(--color-coffee);
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--color-cream);
}

::-webkit-scrollbar-thumb {
  background: var(--color-kraft-light);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-kraft);
}

/* --- Scroll Reveal Animation --- */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }
.reveal-delay-5 { transition-delay: 0.5s; }

/* --- Accessibility --- */
.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;
}

.skip-to-content {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--color-forest);
  color: var(--color-white);
  padding: var(--space-2) var(--space-4);
  z-index: var(--z-modal);
  transition: top var(--transition-fast);
}

.skip-to-content:focus {
  top: 0;
}
