/* ============================================================
   Design System Tokens — "The Living Archive"
   목포대학교 전통조경계획연구실
   ============================================================ */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;600;700;800&family=Inter:wght@400;500;600&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:wght,FILL@100..700,0..1&display=swap');

/* === 1. COLOR TOKENS === */
:root {
  /* Primary */
  --primary: #316342;
  --primary-container: #4a7c59;
  --on-primary: #ffffff;
  --on-primary-container: #e1ffe5;
  --primary-fixed: #b9efc5;
  --primary-fixed-dim: #9dd3aa;
  --on-primary-fixed: #00210e;
  --on-primary-fixed-variant: #1e5031;
  --inverse-primary: #9dd3aa;

  /* Secondary */
  --secondary: #6b5c4c;
  --secondary-container: #f4dfcb;
  --on-secondary: #ffffff;
  --on-secondary-container: #716252;
  --secondary-fixed: #f4dfcb;
  --secondary-fixed-dim: #d7c3b0;
  --on-secondary-fixed: #241a0e;
  --on-secondary-fixed-variant: #524436;

  /* Tertiary */
  --tertiary: #455e4f;
  --tertiary-container: #5d7767;
  --on-tertiary: #ffffff;
  --on-tertiary-container: #e1feea;
  --tertiary-fixed: #cce9d6;
  --tertiary-fixed-dim: #b1cdbb;
  --on-tertiary-fixed: #072014;
  --on-tertiary-fixed-variant: #334c3e;

  /* Surface (Tonal Layering) */
  --surface: #fff9ed;
  --surface-dim: #dfd9cd;
  --surface-bright: #fff9ed;
  --surface-container-lowest: #ffffff;
  --surface-container-low: #f9f3e6;
  --surface-container: #f3ede1;
  --surface-container-high: #eee8db;
  --surface-container-highest: #e8e2d6;
  --surface-variant: #e8e2d6;
  --surface-tint: #376847;

  /* On Surface */
  --on-surface: #1d1c14;
  --on-surface-variant: #414942;
  --on-background: #1d1c14;
  --background: #fff9ed;

  /* Outline */
  --outline: #717971;
  --outline-variant: #c1c9bf;

  /* Error */
  --error: #ba1a1a;
  --error-container: #ffdad6;
  --on-error: #ffffff;
  --on-error-container: #93000a;

  /* Inverse */
  --inverse-surface: #333028;
  --inverse-on-surface: #f6f0e4;

  /* === 2. TYPOGRAPHY TOKENS === */
  --font-headline: 'Manrope', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-label: 'Inter', sans-serif;

  /* Display */
  --display-lg: 800 4.5rem/1.05 var(--font-headline);
  --display-md: 800 3.5rem/1.1 var(--font-headline);
  --display-sm: 700 3rem/1.15 var(--font-headline);

  /* Headline */
  --headline-lg: 700 2rem/1.3 var(--font-headline);
  --headline-md: 700 1.75rem/1.3 var(--font-headline);
  --headline-sm: 700 1.5rem/1.3 var(--font-headline);

  /* Title */
  --title-lg: 600 1.375rem/1.4 var(--font-headline);
  --title-md: 600 1.125rem/1.4 var(--font-headline);
  --title-sm: 600 0.875rem/1.4 var(--font-headline);

  /* Body */
  --body-lg: 400 1.125rem/1.7 var(--font-body);
  --body-md: 400 1rem/1.7 var(--font-body);
  --body-sm: 400 0.875rem/1.6 var(--font-body);

  /* Label */
  --label-lg: 600 0.875rem/1.4 var(--font-label);
  --label-md: 500 0.75rem/1.4 var(--font-label);
  --label-sm: 500 0.6875rem/1.3 var(--font-label);

  /* === 3. SPACING SCALE === */
  --space-xs: 0.25rem;   /* 4px */
  --space-sm: 0.5rem;    /* 8px */
  --space-md: 1rem;      /* 16px */
  --space-lg: 1.5rem;    /* 24px */
  --space-xl: 2rem;      /* 32px */
  --space-2xl: 3rem;     /* 48px */
  --space-3xl: 4rem;     /* 64px */
  --space-4xl: 6rem;     /* 96px */
  --space-5xl: 8rem;     /* 128px */

  /* === 4. RADIUS === */
  --radius-xs: 0.125rem;  /* 2px */
  --radius-sm: 0.25rem;   /* 4px */
  --radius-md: 0.5rem;    /* 8px */
  --radius-lg: 0.75rem;   /* 12px */
  --radius-xl: 1rem;      /* 16px */
  --radius-2xl: 1.5rem;   /* 24px */
  --radius-full: 9999px;

  /* === 5. ELEVATION (Ambient Shadows) === */
  --shadow-xs: 0 2px 8px rgba(29, 28, 20, 0.03);
  --shadow-sm: 0 4px 16px rgba(29, 28, 20, 0.04);
  --shadow-md: 0 8px 24px rgba(29, 28, 20, 0.05);
  --shadow-lg: 0 12px 40px rgba(29, 28, 20, 0.06);
  --shadow-xl: 0 20px 60px rgba(29, 28, 20, 0.08);

  /* === 6. TRANSITIONS === */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.45, 0, 0.55, 1);
  --duration-fast: 200ms;
  --duration-normal: 300ms;
  --duration-slow: 500ms;
  --duration-slower: 700ms;

  /* === 7. LAYOUT === */
  --max-width: 1280px;
  --max-width-wide: 1440px;
  --gutter: 3rem;

  /* === 8. SIGNATURE GRADIENTS === */
  --gradient-primary: linear-gradient(135deg, #316342, #4a7c59);
  --gradient-growth: linear-gradient(90deg, var(--primary-fixed-dim), var(--primary));
  --gradient-scrim: linear-gradient(to bottom, rgba(29,28,20,0.4), rgba(29,28,20,0.1) 50%, rgba(29,28,20,0.6));
}

/* === GLOBAL RESET & BASE === */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

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

body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--on-surface);
  background-color: var(--surface);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

::selection {
  background-color: var(--primary-fixed);
  color: var(--on-primary-fixed);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

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

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

ul, ol {
  list-style: none;
}

/* Material Symbols config */
.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  vertical-align: middle;
  user-select: none;
}

/* Utility: screen reader only */
.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;
}

/* Scroll reveal animation base */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity var(--duration-slow) var(--ease-out),
              transform var(--duration-slow) var(--ease-out);
}

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

/* === CMS Loading: hide content until Firebase renders === */
main,
#footer {
  opacity: 0;
  transition: opacity var(--duration-slow) var(--ease-out);
}

body.cms-ready main,
body.cms-ready #footer {
  opacity: 1;
}

/* Fallback: if JS is disabled, show content immediately */
noscript ~ main,
noscript ~ #footer {
  opacity: 1 !important;
}

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

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