:root {
  /* Modern Gallery Theme (Clean White & Minimalist) */
  --color-primary: #f9fafb; /* Ultra Light Grey Background */
  --color-secondary: #ffffff; /* Pure White for cards */
  --color-tertiary: #e5e7eb; /* Light Grey for borders */
  --color-accent: #b45309; /* Bronze/Dark Gold for contrast on white */
  --color-accent-light: #d97706;
  --color-accent-dark: #78350f;
  --color-text-primary: #111827; /* Near Black */
  --color-text-secondary: #4b5563; /* Dark Grey */
  --color-success: #059669;
  --color-warning: #d97706;
  --color-error: #dc2626;
  
  /* Fonts */
  --font-heading: 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;

  /* Spacing */
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2.5rem;
  --space-xl: 4rem;
  
  /* Layout */
  --container-max: 1200px;
  --content-width: 90%;
  --header-height: 70px;
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
}

/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  padding: 0;
  background-color: var(--color-primary);
  background-image: 
    radial-gradient(circle at 100% 0%, rgba(180, 83, 9, 0.03) 0%, transparent 25%),
    radial-gradient(circle at 0% 100%, rgba(180, 83, 9, 0.03) 0%, transparent 25%);
  color: var(--color-text-primary);
  font-family: var(--font-body);
  line-height: 1.7;
  font-weight: 400;
  overflow-x: hidden;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--color-text-primary);
  margin-top: 0;
  line-height: 1.3;
}

h1 { font-size: clamp(2.5rem, 5vw, 4rem); font-weight: 800; letter-spacing: -0.02em; }
h2 { font-size: clamp(1.8rem, 3vw, 2.5rem); margin-bottom: var(--space-lg); position: relative; display: inline-block; }
h2::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -10px;
  width: 60px;
  height: 4px;
  background: var(--color-accent);
  border-radius: 2px;
}

a { color: var(--color-accent); text-decoration: none; transition: all 0.3s ease; }
a:hover { color: var(--color-accent-light); }

/* Layout Containers */
.main {
  max-width: var(--container-max);
  width: var(--content-width);
  margin: 0 auto;
  padding-top: var(--space-xl);
  padding-bottom: var(--space-xl);
}

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

.section, .card, .work {
  opacity: 0; /* For animation */
  transform: translateY(30px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.section.visible, .card.visible, .work.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Header */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 5%;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-tertiary);
  transition: all 0.3s ease;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.brand {
  font-size: 1.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--color-text-primary) 0%, var(--color-text-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 1px;
}

.nav { display: none; gap: 2rem; }
.nav a { 
  color: var(--color-text-secondary); 
  font-weight: 500; 
  font-size: 0.95rem; 
  position: relative;
}
.nav a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--color-accent);
  transition: width 0.3s ease;
}
.nav a:hover { color: var(--color-accent); }
.nav a:hover::after { width: 100%; }

.menu-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: transparent;
  border: 1px solid var(--color-tertiary);
  color: var(--color-text-primary);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

@media(min-width: 768px) {
  .menu-toggle { display: none; }
  .nav { display: flex; }
}

/* Hero Section */
.hero {
  min-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: 
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.8) 0%, transparent 60%),
    linear-gradient(45deg, transparent 48%, var(--color-tertiary) 50%, transparent 52%);
  background-size: 100% 100%, 40px 40px;
  position: relative;
}

.hero h1 {
  font-size: 4rem;
  margin-bottom: var(--space-md);
  color: var(--color-text-primary);
  text-shadow: 2px 2px 0 rgba(0,0,0,0.05);
}

.hero-content {
  max-width: 800px;
  margin: 0 auto;
  position: relative;
  z-index: 10;
}

.hero .subtitle {
  font-size: 1.5rem;
  color: var(--color-text-secondary);
  max-width: 600px;
  margin: 0 auto var(--space-lg) auto;
}

.hero .intro {
  font-size: 1.1rem;
  color: var(--color-text-secondary);
  max-width: 700px;
  margin: 0 auto;
  text-align: justify;
}

/* Cards & Grid */
.grid, .cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-md);
}

.card, .work {
  background: var(--color-secondary);
  border: 1px solid var(--color-tertiary);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

.card::before, .work::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--color-accent), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.card:hover, .work:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  border-color: var(--color-accent-light);
}

.card:hover::before, .work:hover::before { opacity: 1; }

.work-cover {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-md);
  filter: brightness(0.8) contrast(1.1);
  transition: filter 0.3s ease;
}

.work:hover .work-cover { filter: brightness(1) contrast(1); }

.tags {
  font-size: 0.85rem;
  color: var(--color-accent);
  font-family: monospace;
  margin-bottom: var(--space-sm);
  display: block;
}

/* Scholars */
.scholar-photo {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 2px solid var(--color-accent);
  padding: 4px;
  background: var(--color-secondary);
  margin-bottom: var(--space-sm);
  transition: transform 0.3s ease;
}
.card:hover .scholar-photo { transform: rotate(5deg) scale(1.1); }

/* Chat Section */
.messages {
  background: var(--color-secondary);
  border: 1px solid var(--color-tertiary);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  height: 400px;
  overflow-y: auto;
  margin-bottom: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  scroll-behavior: smooth;
  box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.05);
}

.msg { display: flex; align-items: flex-start; gap: 12px; animation: fadeIn 0.3s ease; }
.msg.me { flex-direction: row-reverse; }

.msg .text {
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 0.95rem;
  max-width: 80%;
  line-height: 1.5;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.msg.ai .text {
  background: #f3f4f6;
  color: var(--color-text-primary);
  border-bottom-left-radius: 4px;
}

.msg.me .text {
  background: var(--color-accent);
  color: #fff;
  font-weight: 500;
  border-bottom-right-radius: 4px;
}

.chat-form {
  display: flex;
  gap: var(--space-xs);
  position: relative;
}

.chat-form input {
  flex: 1;
  background: #fff;
  border: 1px solid var(--color-tertiary);
  padding: 14px 20px;
  border-radius: 50px;
  color: var(--color-text-primary);
  font-family: inherit;
  transition: all 0.3s ease;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.chat-form input:focus {
  outline: none;
  background: #fff;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(180, 83, 9, 0.2);
}

.chat-form button {
  background: var(--color-accent);
  color: #fff;
  border: none;
  padding: 0 24px;
  border-radius: 50px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.chat-form button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px -1px rgba(180, 83, 9, 0.4);
}

/* Floating Chat */
#chat-float {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 380px;
  background: var(--color-secondary);
  border: 1px solid var(--color-tertiary);
  border-radius: var(--radius-md);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  z-index: 999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chat-float-header {
  background: #f3f4f6;
  padding: 12px 16px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--color-tertiary);
  color: var(--color-text-primary);
}

/* Footer */
.footer {
  text-align: center;
  padding: var(--space-xl) 0;
  border-top: 1px solid rgba(255,255,255,0.05);
  margin-top: var(--space-xl);
  font-size: 0.9rem;
  color: var(--color-text-secondary);
}

/* Animations */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes float { 0% { transform: translateY(0px); } 50% { transform: translateY(-10px); } 100% { transform: translateY(0px); } }

/* Utility */
.highlight { color: var(--color-accent); font-weight: 600; }

/* Responsive */
@media(max-width: 768px) {
  :root { --space-xl: 3rem; }
  h1 { font-size: 2.5rem; }
  .section { padding: var(--space-lg) 0; }
  #chat-float { width: calc(100% - 40px); bottom: 20px; right: 20px; }
}
