/* ===== Confucius Articles — Shared Styles ===== */
@import url('https://fonts.googleapis.com/css2?family=Noto+Serif:ital,wght@0,400;0,700;1,400&family=Noto+Sans:wght@400;600;700&display=swap');

:root {
  --ink: #2c2c2c;
  --ink-light: #555;
  --bg: #faf8f5;
  --bg-card: #fff;
  --accent: #8b4513;
  --accent-light: #d4a76a;
  --accent-bg: #f9f3eb;
  --border: #e0d5c5;
  --serif: 'Noto Serif', 'Georgia', serif;
  --sans: 'Noto Sans', 'Helvetica Neue', sans-serif;
  --max-w: 860px;
  --gutter: clamp(1rem, 4vw, 3rem);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 17px; scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

/* ===== Hero ===== */
.hero {
  text-align: center;
  padding: clamp(3rem, 10vw, 6rem) var(--gutter) clamp(2rem, 6vw, 4rem);
  background: linear-gradient(175deg, #f5ede3 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--border);
  position: relative;
}
.hero::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M30 5 L55 30 L30 55 L5 30Z' fill='none' stroke='%23d4a76a' stroke-width='.4' opacity='.12'/%3E%3C/svg%3E") repeat;
  pointer-events: none;
}
.hero-content { position: relative; z-index: 1; max-width: var(--max-w); margin: 0 auto; }
.hero .cn-char {
  font-family: var(--serif);
  font-size: clamp(3rem, 10vw, 6rem);
  color: var(--accent);
  line-height: 1.1;
  margin-bottom: .3rem;
  letter-spacing: .15em;
}
.hero h1 {
  font-family: var(--serif);
  font-size: clamp(1.6rem, 4vw, 2.6rem);
  font-weight: 700;
  color: var(--ink);
  margin-bottom: .6rem;
}
.hero .subtitle {
  font-size: clamp(.95rem, 2vw, 1.15rem);
  color: var(--ink-light);
  max-width: 600px;
  margin: 0 auto;
}
.hero .keyword {
  display: inline-block;
  margin-top: 1rem;
  padding: .3em 1em;
  background: var(--accent);
  color: #fff;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  border-radius: 2px;
}

/* ===== Layout ===== */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--gutter);
}
article { padding: clamp(2rem, 5vw, 4rem) 0; }

/* ===== Sections ===== */
.section-divider {
  text-align: center;
  margin: 3rem 0 2rem;
  position: relative;
}
.section-divider::before {
  content: '';
  position: absolute;
  top: 50%; left: 0; right: 0;
  height: 1px;
  background: var(--border);
}
.section-divider span {
  position: relative;
  background: var(--bg);
  padding: 0 1.2rem;
  font-size: .75rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}

h2 {
  font-family: var(--serif);
  font-size: clamp(1.4rem, 3.5vw, 2rem);
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--ink);
}
h3 {
  font-family: var(--serif);
  font-size: clamp(1.1rem, 2.5vw, 1.4rem);
  font-weight: 700;
  margin: 2rem 0 .6rem;
  color: var(--accent);
}
p { margin-bottom: 1rem; }

/* ===== Quote Block ===== */
.quote-block {
  background: var(--accent-bg);
  border-left: 4px solid var(--accent);
  padding: 1.5rem 1.8rem;
  margin: 2rem 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--ink);
  position: relative;
}
.quote-block::before {
  content: '"';
  position: absolute;
  top: -.2rem; left: .6rem;
  font-size: 3.5rem;
  color: var(--accent-light);
  opacity: .4;
  font-style: normal;
  line-height: 1;
}
.quote-block .source {
  display: block;
  margin-top: .8rem;
  font-size: .85rem;
  font-style: normal;
  color: var(--ink-light);
}

/* ===== Concept Cards ===== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.2rem;
  margin: 2rem 0;
}
.concept-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.6rem;
  transition: box-shadow .25s, transform .25s;
}
.concept-card:hover {
  box-shadow: 0 6px 24px rgba(0,0,0,.08);
  transform: translateY(-2px);
}
.concept-card .card-icon {
  font-size: 2rem;
  margin-bottom: .5rem;
}
.concept-card h4 {
  font-family: var(--serif);
  font-size: 1.1rem;
  margin-bottom: .4rem;
  color: var(--ink);
}
.concept-card p {
  font-size: .92rem;
  color: var(--ink-light);
  margin: 0;
  line-height: 1.65;
}

/* ===== Key Points List ===== */
.key-points {
  list-style: none;
  margin: 1.5rem 0;
  padding: 0;
}
.key-points li {
  padding: .6rem 0 .6rem 2rem;
  position: relative;
  border-bottom: 1px solid #eee;
}
.key-points li:last-child { border-bottom: none; }
.key-points li::before {
  content: '◈';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-size: .9rem;
}
.key-points strong {
  color: var(--ink);
}

/* ===== Highlight Box ===== */
.highlight-box {
  background: var(--accent-bg);
  border-radius: 6px;
  padding: 1.8rem;
  margin: 2rem 0;
  border: 1px solid var(--border);
}
.highlight-box h3 { margin-top: 0; }

/* ===== Timeline (for biographical content) ===== */
.timeline { margin: 2rem 0; }
.timeline-item {
  display: flex;
  gap: 1.2rem;
  padding: 1rem 0;
  border-bottom: 1px solid #eee;
}
.timeline-item:last-child { border-bottom: none; }
.timeline-year {
  flex-shrink: 0;
  width: 80px;
  font-weight: 700;
  color: var(--accent);
  font-size: .95rem;
}
.timeline-desc {
  font-size: .95rem;
  color: var(--ink-light);
}

/* ===== Top Nav ===== */
.top-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250,248,245,.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 var(--gutter);
}
.top-nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  height: 52px;
  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
}
.top-nav-inner::-webkit-scrollbar { display: none; }
.nav-brand {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--accent);
  text-decoration: none;
  flex-shrink: 0;
}
.nav-links { display: flex; gap: 1.2rem; flex-shrink: 0; }
.nav-links a {
  font-size: .82rem;
  font-weight: 600;
  color: var(--ink-light);
  text-decoration: none;
  letter-spacing: .03em;
  padding: .3em 0;
  border-bottom: 2px solid transparent;
  transition: color .2s, border-color .2s;
}
.nav-links a:hover,
.nav-links a.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ===== Bottom Nav ===== */
.bottom-nav {
  border-top: 1px solid var(--border);
  padding: 2rem var(--gutter);
  background: #f5ede3;
}
.bottom-nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  text-align: center;
}
.bottom-nav-label {
  font-size: .7rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-light);
  margin-bottom: 1rem;
  font-weight: 600;
}
.bottom-nav-links {
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
}
.bottom-nav-links a {
  font-family: var(--serif);
  font-size: 1rem;
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  letter-spacing: .04em;
  transition: color .2s;
}
.bottom-nav-links a:hover { color: var(--accent); }

/* ===== Footer ===== */
.site-footer {
  text-align: center;
  padding: 1.5rem var(--gutter) 2.5rem;
  color: var(--ink-light);
  font-size: .82rem;
}
.site-footer a { color: var(--accent); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

/* ===== Responsive ===== */
/* ===== Animations ===== */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(28px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes slideIn {
  from { opacity: 0; transform: translateX(-20px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(.92); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes shimmer {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .6; }
}

/* Triggered on scroll via IntersectionObserver */
.anim-fade-up {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity .7s ease, transform .7s ease;
}
.anim-fade-up.visible {
  opacity: 1;
  transform: translateY(0);
}
.anim-fade-in {
  opacity: 0;
  transition: opacity .6s ease;
}
.anim-fade-in.visible {
  opacity: 1;
}
.anim-slide-in {
  opacity: 0;
  transform: translateX(-20px);
  transition: opacity .6s ease, transform .6s ease;
}
.anim-slide-in.visible {
  opacity: 1;
  transform: translateX(0);
}
.anim-scale-in {
  opacity: 0;
  transform: scale(.92);
  transition: opacity .5s ease, transform .5s ease;
}
.anim-scale-in.visible {
  opacity: 1;
  transform: scale(1);
}

/* Staggered children */
.stagger > *:nth-child(1) { transition-delay: 0s; }
.stagger > *:nth-child(2) { transition-delay: .08s; }
.stagger > *:nth-child(3) { transition-delay: .16s; }
.stagger > *:nth-child(4) { transition-delay: .24s; }
.stagger > *:nth-child(5) { transition-delay: .32s; }
.stagger > *:nth-child(6) { transition-delay: .40s; }

/* Quote card entrance */
.qc-enter {
  opacity: 0;
  transform: translateY(24px) scale(.97);
  transition: opacity .55s ease, transform .55s ease;
}
.qc-enter.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Glow on hover for quote cards */
.qc-glow {
  transition: box-shadow .35s, transform .35s, border-color .35s;
}
.qc-glow:hover {
  box-shadow: 0 8px 32px rgba(139,69,19,.12), 0 0 0 1px var(--accent-light);
  transform: translateY(-3px);
  border-color: var(--accent-light);
}

/* Hero text animation */
.hero-anim h1 {
  animation: fadeUp .8s ease both;
  animation-delay: .15s;
}
.hero-anim .subtitle {
  animation: fadeUp .8s ease both;
  animation-delay: .35s;
}
.hero-anim .keyword {
  animation: fadeUp .7s ease both;
  animation-delay: .55s;
}
.hero-anim .cn-char {
  animation: scaleIn .7s ease both;
  animation-delay: .05s;
}

/* Counter animation placeholder */
.count-up { font-variant-numeric: tabular-nums; }

/* Typing cursor */
.typing-cursor::after {
  content: '|';
  animation: pulse 1s infinite;
  color: var(--accent);
  margin-left: 2px;
}

/* Ripple effect on buttons/links */
.ripple {
  position: relative;
  overflow: hidden;
}
.ripple::after {
  content: '';
  position: absolute;
  width: 100%; height: 100%;
  top: 0; left: 0;
  background: radial-gradient(circle, rgba(139,69,19,.08) 10%, transparent 10%);
  background-size: 1000% 1000%;
  opacity: 0;
  transition: background .5s, opacity .5s;
}
.ripple:active::after {
  background-size: 0% 0%;
  opacity: 1;
  transition: 0s;
}

/* Scroll progress bar */
.scroll-progress {
  position: fixed;
  top: 52px; left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  z-index: 101;
  transition: width .15s;
  width: 0%;
}

/* Back to top */
.back-top {
  position: fixed;
  bottom: 2rem; right: 2rem;
  width: 44px; height: 44px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .3s, transform .3s;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
}
.back-top.show {
  opacity: 1;
  transform: translateY(0);
}
.back-top:hover {
  background: #6b3410;
}

@media (max-width: 600px) {
  html { font-size: 15px; }
  .card-grid { grid-template-columns: 1fr; }
  .timeline-item { flex-direction: column; gap: .3rem; }
  .quote-block { padding: 1.2rem; }
  .top-nav-inner { gap: 1rem; }
  .nav-links a { font-size: .75rem; }
  .bottom-nav-links { gap: 1.2rem; }
}
