/* ═══════════════════════════════════════════
   初见 · Design System — "手写情书"
   A shared foundation for every page.
   ═══════════════════════════════════════════ */

/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,600;1,300;1,400&family=Ma+Shan+Zheng&family=Noto+Serif+SC:wght@200;300;400;500;600;700&family=ZCOOL+XiaoWei&display=swap');

/* ── Variables ── */
:root {
  /* Palette */
  --cream:        #fdf6f0;
  --cream-deep:   #f5ece2;
  --parchment:    #f9f1e8;
  --rose:         #d4878f;
  --rose-light:   #f0c4c8;
  --rose-deep:    #b8636b;
  --rose-blush:   #fae8ea;
  --wine:         #7a3b44;
  --gold:         #c9a96e;
  --gold-light:   #e8d5a8;
  --ink:          #3a2f35;
  --ink-light:    #6b5a5e;
  --ink-faint:    #a8959a;
  --warm-white:   #fffaf7;
  --shadow-color: rgba(122, 59, 68, 0.08);

  /* Typography */
  --font-display: 'Cormorant Garamond', 'Noto Serif SC', serif;
  --font-body:    'Noto Serif SC', 'ZCOOL XiaoWei', serif;
  --font-hand:    'Ma Shan Zheng', cursive;
  --font-mono:    'DM Mono', 'Courier New', monospace;

  /* Spacing */
  --space-xs:  4px;
  --space-sm:  8px;
  --space-md:  16px;
  --space-lg:  24px;
  --space-xl:  40px;
  --space-2xl: 64px;

  /* Radius */
  --radius-sm:  8px;
  --radius-md:  14px;
  --radius-lg:  20px;
  --radius-xl:  28px;

  /* Shadows */
  --shadow-soft:   0 2px 20px var(--shadow-color);
  --shadow-card:   0 1px 8px rgba(0,0,0,0.04), 0 4px 20px var(--shadow-color);
  --shadow-hover:  0 8px 40px rgba(122, 59, 68, 0.12);
  --shadow-lifted: 0 20px 60px rgba(122, 59, 68, 0.15);

  /* Transitions */
  --ease-out:   cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration:   0.35s;
}

/* ── Reset ── */
*, *::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);
  background-color: var(--cream);
  color: var(--ink);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.7;
  font-weight: 400;
}

/* ── Paper Texture (subtle noise) ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
  background-size: 200px;
}

/* ── Selection ── */
::selection {
  background: var(--rose-light);
  color: var(--wine);
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--rose-light);
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover { background: var(--rose); }

/* ═══════════════════════════════════════════
   Typography
   ═══════════════════════════════════════════ */

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.2;
}

.hand {
  font-family: var(--font-hand);
}

/* ═══════════════════════════════════════════
   Navigation Bar (shared across pages)
   ═══════════════════════════════════════════ */

.topnav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: rgba(253, 246, 240, 0.85);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid rgba(212, 135, 143, 0.1);
  transition: background var(--duration) var(--ease-out);
}

.topnav--transparent {
  background: transparent;
  backdrop-filter: none;
  border-bottom: none;
}

.topnav__back {
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: var(--ink-light);
  font-size: 0.78rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-family: var(--font-display);
  font-weight: 600;
  transition: color var(--duration) var(--ease-out);
}

.topnav__back:hover { color: var(--rose); }

.topnav__back svg {
  width: 16px; height: 16px;
  transition: transform var(--duration) var(--ease-out);
}

.topnav__back:hover svg { transform: translateX(-3px); }

.topnav__logo {
  font-family: var(--font-hand);
  font-size: 1.3rem;
  color: var(--rose);
  letter-spacing: 2px;
  user-select: none;
}

.topnav__actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* ═══════════════════════════════════════════
   Buttons
   ═══════════════════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 22px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: all var(--duration) var(--ease-out);
}

.btn--primary {
  background: linear-gradient(135deg, var(--rose), var(--rose-deep));
  color: white;
  box-shadow: 0 4px 16px rgba(212, 135, 143, 0.3);
}

.btn--primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(212, 135, 143, 0.4);
}

.btn--ghost {
  background: transparent;
  color: var(--ink-light);
  border: 1px solid rgba(212, 135, 143, 0.25);
}

.btn--ghost:hover {
  border-color: var(--rose);
  color: var(--rose);
  background: var(--rose-blush);
}

.btn--sm {
  padding: 6px 14px;
  font-size: 0.75rem;
}

/* ═══════════════════════════════════════════
   Cards
   ═══════════════════════════════════════════ */

.card {
  background: var(--warm-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  transition: all var(--duration) var(--ease-out);
  overflow: hidden;
}

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

/* ═══════════════════════════════════════════
   Decorative Elements
   ═══════════════════════════════════════════ */

/* Wax seal stamp */
.seal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px; height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--rose), var(--wine));
  color: white;
  font-size: 1.2rem;
  box-shadow:
    0 2px 8px rgba(122, 59, 68, 0.25),
    inset 0 1px 2px rgba(255,255,255,0.2);
}

/* Divider line with ornament */
.divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: var(--space-xl) 0;
  color: var(--ink-faint);
  font-size: 0.75rem;
  letter-spacing: 3px;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--rose-light), transparent);
}

/* Handwritten annotation */
.annotation {
  font-family: var(--font-hand);
  color: var(--rose);
  font-size: 1rem;
  transform: rotate(-2deg);
  display: inline-block;
}

/* ═══════════════════════════════════════════
   Modal / Overlay
   ═══════════════════════════════════════════ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(58, 47, 53, 0.35);
  backdrop-filter: blur(10px);
  z-index: 500;
  display: none;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.modal-overlay.active { display: flex; }

.modal-box {
  background: var(--warm-white);
  border-radius: var(--radius-xl);
  padding: 36px;
  width: 100%;
  max-width: 440px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lifted);
  transform: scale(0.92) translateY(20px);
  opacity: 0;
  transition: all 0.4s var(--ease-spring);
}

.modal-overlay.active .modal-box {
  transform: scale(1) translateY(0);
  opacity: 1;
}

/* ═══════════════════════════════════════════
   Toast (replaces alert)
   ═══════════════════════════════════════════ */

.toast-container {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  padding: 14px 22px;
  border-radius: var(--radius-md);
  background: var(--warm-white);
  box-shadow: var(--shadow-hover);
  font-size: 0.88rem;
  color: var(--ink);
  border-left: 3px solid var(--rose);
  transform: translateX(120%);
  transition: transform 0.4s var(--ease-spring);
  max-width: 320px;
}

.toast.show { transform: translateX(0); }
.toast--success { border-left-color: #6abf8a; }
.toast--error   { border-left-color: var(--rose-deep); }

/* ═══════════════════════════════════════════
   Utilities
   ═══════════════════════════════════════════ */

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

.fade-in {
  animation: fadeIn 0.6s var(--ease-out) forwards;
  opacity: 0;
}

@keyframes fadeIn {
  to { opacity: 1; }
}

.slide-up {
  animation: slideUp 0.6s var(--ease-out) forwards;
  opacity: 0;
  transform: translateY(24px);
}

@keyframes slideUp {
  to { opacity: 1; transform: translateY(0); }
}

/* Staggered children */
.stagger > *:nth-child(1) { animation-delay: 0.05s; }
.stagger > *:nth-child(2) { animation-delay: 0.10s; }
.stagger > *:nth-child(3) { animation-delay: 0.15s; }
.stagger > *:nth-child(4) { animation-delay: 0.20s; }
.stagger > *:nth-child(5) { animation-delay: 0.25s; }
.stagger > *:nth-child(6) { animation-delay: 0.30s; }
.stagger > *:nth-child(7) { animation-delay: 0.35s; }
.stagger > *:nth-child(8) { animation-delay: 0.40s; }

/* ═══════════════════════════════════════════
   ICP Footer
   ═══════════════════════════════════════════ */

.icp-footer {
  position: fixed;
  left: 50%;
  bottom: 8px;
  transform: translateX(-50%);
  z-index: 80;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(253, 246, 240, 0.6);
  backdrop-filter: blur(8px);
  opacity: 0.5;
  transition: opacity 0.2s;
}

.icp-footer:hover { opacity: 0.9; }

.icp-footer a {
  color: var(--ink-faint);
  text-decoration: none;
  font-size: 11px;
  letter-spacing: 0.3px;
  font-family: var(--font-display);
}

.icp-footer a:hover { color: var(--rose); }

/* ═══════════════════════════════════════════
   Responsive
   ═══════════════════════════════════════════ */

@media (max-width: 768px) {
  .topnav {
    padding: 12px 16px;
  }

  .topnav__logo {
    font-size: 1.1rem;
  }

  .modal-box {
    padding: 24px 20px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    max-height: 90dvh;
  }

  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }
}
