/* ===================================
   Warm Ink & Paper — Japandi Editorial
   =================================== */

@import url('https://fonts.googleapis.com/css2?family=Crimson+Pro:ital,wght@0,400;0,600;1,400&family=Noto+Sans+SC:wght@300;400;500;700&display=swap');

/* --- Tokens --- */
:root {
  --bg: #F5F1EB;
  --bg-grain: 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.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  --surface: #FFFFFF;
  --surface-border: #E8E3DA;
  --text: #1D1D1F;
  --text-secondary: #7A756D;
  --text-tertiary: #A8A29C;
  --accent: #C06C3E;
  --accent-hover: #A85A30;
  --accent-light: rgba(192, 108, 62, 0.08);
  --accent-glow: rgba(192, 108, 62, 0.15);
  --sidebar-bg: #1A1A1E;
  --sidebar-surface: rgba(255, 255, 255, 0.06);
  --sidebar-text: #CDC8BF;
  --sidebar-text-bright: #F0ECE4;
  --sidebar-accent: #D4835E;
  --overlay: rgba(26, 26, 30, 0.45);
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.03);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.06), 0 1px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.08);
  --transition: cubic-bezier(0.4, 0, 0.2, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* --- Reset --- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: 'Noto Sans SC', -apple-system, 'PingFang SC', sans-serif;
  font-weight: 400;
  color: var(--text);
  background-color: var(--bg);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* grain overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: var(--bg-grain);
  background-repeat: repeat;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.5;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { background: none; border: none; cursor: pointer; font: inherit; color: inherit; }
ul { list-style: none; }

/* --- Header --- */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  display: flex;
  align-items: center;
  padding: 0 20px;
  background: rgba(245, 241, 235, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 100;
  border-bottom: 1px solid rgba(0,0,0,0.04);
}

.menu-btn {
  width: 40px;
  height: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border-radius: var(--radius-sm);
  transition: background 0.2s var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.menu-btn:active { background: rgba(0,0,0,0.05); }

.menu-btn span {
  display: block;
  width: 18px;
  height: 1.5px;
  background: var(--text);
  border-radius: 2px;
  transition: all 0.35s var(--transition);
  transform-origin: center;
}

/* hamburger → X animation */
.menu-open .menu-btn span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.menu-open .menu-btn span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.menu-open .menu-btn span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

.header-title {
  flex: 1;
  text-align: center;
  font-family: 'Crimson Pro', serif;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--text);
  margin-right: 40px; /* balance the hamburger */
}

/* --- Sidebar Overlay --- */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s var(--transition), visibility 0.4s;
  -webkit-tap-highlight-color: transparent;
}
.menu-open .sidebar-overlay { opacity: 1; visibility: visible; }

/* --- Sidebar --- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  max-width: 80vw;
  background: var(--sidebar-bg);
  z-index: 300;
  transform: translateX(-105%);
  transition: transform 0.45s var(--transition);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.menu-open .sidebar { transform: translateX(0); }

.sidebar-header {
  padding: 48px 24px 28px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.sidebar-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,0.1);
}

.sidebar-name {
  font-family: 'Crimson Pro', serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--sidebar-text-bright);
  letter-spacing: 0.3px;
}

.sidebar-tagline {
  font-size: 11px;
  color: var(--sidebar-text);
  margin-top: 2px;
  font-weight: 300;
  letter-spacing: 0.5px;
}

/* nav items */
.sidebar-nav { flex: 1; padding: 8px 12px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-size: 14px;
  font-weight: 400;
  transition: all 0.25s var(--transition);
  -webkit-tap-highlight-color: transparent;
  position: relative;
}
.nav-item:active,
.nav-item:hover { background: var(--sidebar-surface); color: var(--sidebar-text-bright); }

.nav-item.active {
  background: var(--sidebar-surface);
  color: var(--sidebar-accent);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--sidebar-accent);
  border-radius: 0 3px 3px 0;
}

.nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
}
.nav-item.active .nav-icon { opacity: 1; }

/* expandable group */
.nav-group-header {
  cursor: pointer;
  user-select: none;
}

.nav-group-arrow {
  margin-left: auto;
  width: 16px;
  height: 16px;
  transition: transform 0.3s var(--transition);
  opacity: 0.5;
}
.nav-group.expanded .nav-group-arrow { transform: rotate(180deg); }

.nav-group-children {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s var(--transition);
}
.nav-group.expanded .nav-group-children { max-height: 200px; }

.nav-child {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px 10px 46px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-size: 13px;
  font-weight: 300;
  transition: all 0.25s var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.nav-child:active,
.nav-child:hover { background: var(--sidebar-surface); color: var(--sidebar-text-bright); }
.nav-child.active { color: var(--sidebar-accent); }

.nav-child-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--sidebar-text);
  opacity: 0.4;
  flex-shrink: 0;
}
.nav-child.active .nav-child-dot { background: var(--sidebar-accent); opacity: 1; }

/* sidebar footer */
.sidebar-footer {
  padding: 20px 24px;
  border-top: 1px solid rgba(255,255,255,0.06);
  font-size: 11px;
  color: rgba(255,255,255,0.2);
  font-weight: 300;
  letter-spacing: 0.5px;
}

/* --- Main Content --- */
.main {
  padding-top: 56px;
  min-height: 100vh;
  min-height: 100dvh;
}

/* --- About Page --- */
.about-hero {
  padding: 40px 24px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.avatar-wrapper {
  position: relative;
  margin-bottom: 24px;
}
.avatar-wrapper::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #E8A87C, var(--accent));
  opacity: 0.6;
  animation: avatarPulse 4s ease-in-out infinite;
}
@keyframes avatarPulse {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.02); }
}

.avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  position: relative;
  border: 3px solid var(--bg);
}

.about-name {
  font-family: 'Crimson Pro', serif;
  font-size: 28px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.about-tagline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 300;
  letter-spacing: 1px;
}
.about-tagline .dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--text-tertiary);
}

/* --- Section --- */
.section {
  padding: 32px 24px;
}

.section-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 16px;
}

.section-divider {
  width: 32px;
  height: 1px;
  background: var(--surface-border);
  margin: 0 auto 32px;
}

/* --- Bio --- */
.bio-text {
  font-size: 14px;
  line-height: 1.85;
  color: var(--text-secondary);
  font-weight: 300;
}

/* --- Contact Links --- */
.contact-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  transition: all 0.3s var(--transition);
  text-decoration: none;
}
.contact-item:active {
  transform: scale(0.98);
  box-shadow: var(--shadow-sm);
}

.contact-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--accent-light);
  color: var(--accent);
  flex-shrink: 0;
}

.contact-info {
  flex: 1;
  min-width: 0;
}
.contact-label {
  font-size: 11px;
  color: var(--text-tertiary);
  font-weight: 400;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}
.contact-value {
  font-size: 14px;
  color: var(--text);
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-arrow {
  color: var(--text-tertiary);
  flex-shrink: 0;
  transition: transform 0.3s var(--transition);
}
.contact-item:hover .contact-arrow { transform: translateX(3px); }

/* --- Product Card --- */
.product-card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all 0.3s var(--transition);
}

.product-card-header {
  padding: 20px 20px 16px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.product-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), #E8A87C);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(192, 108, 62, 0.25);
}

.product-name {
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 4px;
}

.product-subtitle {
  font-size: 12px;
  color: var(--accent);
  font-weight: 400;
  letter-spacing: 0.5px;
}

.product-desc {
  padding: 0 20px 20px;
  font-size: 13px;
  line-height: 1.8;
  color: var(--text-secondary);
  font-weight: 300;
}

.product-features {
  padding: 0 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.feature-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 300;
  line-height: 1.6;
}

.feature-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 7px;
  flex-shrink: 0;
  opacity: 0.7;
}

/* --- Blank page --- */
.blank-page {
  padding: 80px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  min-height: calc(100vh - 56px);
  min-height: calc(100dvh - 56px);
  justify-content: center;
}

.blank-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  margin-bottom: 8px;
}

.blank-title {
  font-family: 'Crimson Pro', serif;
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
}

.blank-desc {
  font-size: 13px;
  color: var(--text-tertiary);
  font-weight: 300;
  line-height: 1.7;
}

/* --- Animations --- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-in {
  opacity: 0;
  animation: fadeUp 0.6s var(--transition) forwards;
}
.animate-in:nth-child(1) { animation-delay: 0.05s; }
.animate-in:nth-child(2) { animation-delay: 0.12s; }
.animate-in:nth-child(3) { animation-delay: 0.19s; }
.animate-in:nth-child(4) { animation-delay: 0.26s; }
.animate-in:nth-child(5) { animation-delay: 0.33s; }
.animate-in:nth-child(6) { animation-delay: 0.40s; }

/* --- Footer --- */
.page-footer {
  padding: 24px;
  text-align: center;
  font-size: 11px;
  color: var(--text-tertiary);
  font-weight: 300;
  letter-spacing: 0.5px;
  border-top: 1px solid var(--surface-border);
  margin: 0 24px;
}

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 0; }

/* --- Safe area --- */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .main { padding-bottom: env(safe-area-inset-bottom); }
  .sidebar { padding-bottom: env(safe-area-inset-bottom); }
}
