/* ═══════════════════════════════════════════
   CIRCA — Global Brand Styles
   循物 — 闲置流转，美好延续
═══════════════════════════════════════════ */

/* ── Brand Colors ── */
:root {
  /* Primary */
  --bg: #FAF8F5;
  --surface: #F0EFE9;
  --card: #FFFFFF;
  --text: #111111;
  --text-secondary: #6B6B6B;
  --text-muted: #9B9B9B;
  --border: #E5E4E0;
  
  /* Accent */
  --accent: #C8FF00;
  --accent-hover: #B8EF00;
  --accent-muted: rgba(200, 255, 0, 0.15);
  
  /* Dark Mode */
  --dark-bg: #0A0A0A;
  --dark-surface: #141414;
  --dark-card: #1A1A1A;
  --dark-text: #F5F5F5;
  --dark-text-secondary: #8A8A8A;
  --dark-border: #2A2A2A;
  
  /* Status */
  --success: #22C55E;
  --warning: #F59E0B;
  --error: #EF4444;
  
  /* Typography */
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body: 'DM Sans', -apple-system, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', monospace;
  
  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;
  
  /* Radius */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.08);
  --shadow-xl: 0 24px 80px rgba(0,0,0,0.12);
  
  /* Transitions */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  
  /* Z-index */
  --z-base: 1;
  --z-header: 100;
  --z-modal: 200;
  --z-toast: 300;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

::selection {
  background: var(--accent);
  color: var(--text);
}

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

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

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

/* ── Typography ── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 1.1;
}

.display-xl {
  font-family: var(--font-display);
  font-size: clamp(3rem, 10vw, 8rem);
  font-weight: 300;
  letter-spacing: -0.03em;
  line-height: 0.95;
}

.display-lg {
  font-family: var(--font-display);
  font-size: clamp(2rem, 6vw, 4.5rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1;
}

.display-md {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  font-weight: 400;
  letter-spacing: -0.01em;
}

.body-lg {
  font-size: 1.125rem;
  line-height: 1.6;
}

.body-sm {
  font-size: 0.875rem;
  line-height: 1.5;
}

.caption {
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ── Utility Classes ── */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-xl);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: var(--radius-full);
  transition: all 0.3s var(--ease-out);
  white-space: nowrap;
}

.btn-primary {
  background: var(--text);
  color: var(--bg);
}

.btn-primary:hover {
  background: #2A2A2A;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

.btn-accent {
  background: var(--accent);
  color: var(--text);
}

.btn-accent:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(200, 255, 0, 0.3);
}

.btn-outline {
  border: 1.5px solid var(--border);
  color: var(--text);
  background: transparent;
}

.btn-outline:hover {
  border-color: var(--text);
  background: var(--text);
  color: var(--bg);
}

.btn-ghost {
  color: var(--text-secondary);
}

.btn-ghost:hover {
  color: var(--text);
  background: rgba(0,0,0,0.04);
}

/* ── Form Elements ── */
.input {
  width: 100%;
  padding: var(--space-md);
  font-size: 1rem;
  font-family: inherit;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
  outline: none;
}

.input:focus {
  border-color: var(--text);
  box-shadow: 0 0 0 4px rgba(0,0,0,0.04);
}

.input::placeholder {
  color: var(--text-muted);
}

/* ── Cards ── */
.card {
  background: var(--card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all 0.4s var(--ease-out);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
}

/* ── Badge ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-xs) var(--space-sm);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: var(--radius-full);
  background: var(--surface);
  color: var(--text-secondary);
}

.badge-accent {
  background: var(--accent-muted);
  color: var(--text);
}

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  z-index: var(--z-modal);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  background: var(--card);
  border-radius: var(--radius-lg);
  z-index: calc(var(--z-modal) + 1);
  overflow: auto;
  opacity: 0;
  visibility: hidden;
  transition: all 0.4s var(--ease-out);
}

.modal.active {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

/* ── Toast ── */
.toast-container {
  position: fixed;
  bottom: var(--space-xl);
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.toast {
  padding: var(--space-md) var(--space-lg);
  background: var(--text);
  color: var(--bg);
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 500;
  animation: toastIn 0.4s var(--spring) forwards;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ── Loading ── */
.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Page Transitions ── */
.page {
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.6s var(--ease-out);
}

.page.active {
  opacity: 1;
  transform: translateY(0);
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ── Safe Area (Mobile) ── */
@supports (padding: env(safe-area-inset-bottom)) {
  .safe-bottom {
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* ── Dark Mode ── */
@media (prefers-color-scheme: dark) {
  :root:not(.light-mode) {
    --bg: var(--dark-bg);
    --surface: var(--dark-surface);
    --card: var(--dark-card);
    --text: var(--dark-text);
    --text-secondary: var(--dark-text-secondary);
    --border: var(--dark-border);
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.3);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.4);
  }
}
