:root {
  --bg: #ffffff;
  --bg-soft: #f7f6f3;
  --bg-card: #ffffff;
  --text: #1e2a32;
  --text-soft: #4a5862;
  --text-muted: #7d8a91;
  --accent: #8b6e3f;
  --accent-soft: #d9c79f;
  --border: #e6e3dc;
  --shadow: 0 1px 2px rgba(20,30,40,.04), 0 8px 24px rgba(20,30,40,.06);
  --radius: 14px;
  --font-serif: "Cormorant Garamond", "Noto Serif SC", "Source Han Serif SC", "Songti SC", Georgia, "Times New Roman", serif;
  --font-sans: "Inter", "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --max-w: 980px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color .15s ease, color .15s ease;
}
a:hover { border-bottom-color: var(--accent); }

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

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 600;
  color: var(--text);
  line-height: 1.25;
  margin: 0 0 .6em;
  letter-spacing: -.01em;
}
h1 { font-size: clamp(2rem, 4vw + 1rem, 3.4rem); }
h2 { font-size: clamp(1.6rem, 2vw + 1rem, 2.2rem); margin-top: 2.5rem; }
h3 { font-size: 1.4rem; margin-top: 2rem; }
h4 { font-size: 1.15rem; }

p { margin: 0 0 1.1em; color: var(--text-soft); }
strong { color: var(--text); }

/* ============ Header / Nav ============ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255,255,255,.92);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav-wrap {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 14px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.brand {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: .01em;
  border-bottom: 0;
}
.brand:hover { border-bottom: 0; color: var(--accent); }
.brand small {
  display: block;
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: .72rem;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 2px;
}

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
  color: var(--text);
}
.nav-toggle svg { display: block; width: 22px; height: 22px; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-links a {
  display: inline-block;
  padding: 8px 14px;
  font-size: .95rem;
  color: var(--text-soft);
  border: 1px solid transparent;
  border-radius: 999px;
  border-bottom: 0;
}
.nav-links a:hover { color: var(--text); background: var(--bg-soft); }
.nav-links a.active { color: var(--text); background: var(--bg-soft); }
.nav-links .icon-link { padding: 6px 8px; }
.nav-links .icon-link svg { width: 20px; height: 20px; display: block; }

/* ============ Hero ============ */
.hero {
  text-align: center;
  padding: clamp(48px, 8vw, 96px) 22px;
  max-width: var(--max-w);
  margin: 0 auto;
  border-bottom: 1px solid var(--border);
}
.hero .eyebrow {
  font-size: .78rem;
  letter-spacing: .25em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 14px;
}
.hero h1 { margin-bottom: .25em; }
.hero .dates {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  color: var(--text-muted);
  font-style: italic;
}
.hero p.lead {
  max-width: 640px;
  margin: 24px auto 0;
  font-size: 1.1rem;
  color: var(--text-soft);
}

/* Hero with background photo */
.hero-photo {
  position: relative;
  max-width: none;
  width: 100%;
  padding: 0;
  margin: 0;
  border-bottom: 0;
  overflow: hidden;
  background: #0a0e14;
  min-height: clamp(360px, 55vh, 560px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.hero-photo .hero-bg {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 35% 40%;
  display: block;
  z-index: 0;
}
.hero-photo .hero-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: rgba(10, 14, 20, .55);
  pointer-events: none;
}
.hero-photo .hero-inner {
  position: relative;
  z-index: 2;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: clamp(56px, 8vw, 96px) 22px;
  text-align: center;
  color: #fff;
}
.hero-photo .eyebrow {
  color: #f5e6b8;
  text-shadow: 0 1px 12px rgba(0,0,0,.9);
}
.hero-photo h1 {
  color: #ffffff;
  text-shadow: 0 2px 12px rgba(0,0,0,.85), 0 0 32px rgba(0,0,0,.5);
}
.hero-photo .dates {
  color: #ffffff;
  text-shadow: 0 1px 10px rgba(0,0,0,.85);
}
.hero-photo p.lead {
  color: #ffffff;
  text-shadow: 0 1px 10px rgba(0,0,0,.85);
}

/* ============ Containers ============ */
main { padding-bottom: 80px; }
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 22px;
}
.narrow { max-width: 760px; margin: 0 auto; padding: 0 22px; }

.page-title {
  text-align: center;
  padding: 64px 22px 24px;
  max-width: var(--max-w);
  margin: 0 auto;
}
.page-title .eyebrow {
  font-size: .78rem;
  letter-spacing: .25em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 12px;
}
.page-title h1 { margin: 0; }

/* ============ Section / Card ============ */
section { margin: 56px 0; }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(20px, 4vw, 40px);
  box-shadow: var(--shadow);
  margin: 32px 0;
}

.callout {
  background: linear-gradient(180deg, #fcf9f1 0%, #f7f6f3 100%);
  border: 1px solid var(--accent-soft);
  border-radius: var(--radius);
  padding: clamp(20px, 4vw, 36px);
  margin: 32px 0;
  text-align: center;
}
.callout h3 { margin-top: 0; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  font-weight: 500;
  font-size: 1rem;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  transition: transform .1s ease, box-shadow .15s ease, background .15s ease;
  text-decoration: none;
}
.btn:hover { background: #6f5630; border-color: #6f5630; border-bottom-color: #6f5630; transform: translateY(-1px); box-shadow: 0 4px 16px rgba(139,110,63,.25); }
.btn.btn-ghost {
  background: transparent;
  color: var(--accent);
  border-color: var(--accent);
}
.btn.btn-ghost:hover { background: var(--accent); color: #fff; }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 18px; }

/* Image grouping */
.media { margin: 32px 0; }
.media img { border-radius: 10px; box-shadow: var(--shadow); margin: 0 auto; }
.media .caption {
  text-align: center;
  color: var(--text-muted);
  font-size: .9rem;
  margin-top: 10px;
  font-style: italic;
}
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
  margin: 32px 0;
}
.media-grid img { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; aspect-ratio: 4/3; box-shadow: var(--shadow); }

/* Video / iframe wrapper */
.video {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border-radius: 10px;
  background: #000;
  box-shadow: var(--shadow);
  margin: 32px 0;
}
.video iframe {
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%; border: 0;
}

/* ============ Eulogy entries ============ */
.eulogy-entry {
  border-left: 3px solid var(--accent-soft);
  padding: 8px 0 8px 24px;
  margin: 48px 0;
}
.eulogy-entry h3 {
  margin: 0 0 12px;
  font-style: italic;
  color: var(--text);
}
.eulogy-entry h3::before, .eulogy-entry h3::after { content: "—"; color: var(--accent); margin: 0 8px; }

/* ============ Poem / Quote ============ */
.poem {
  text-align: center;
  font-family: var(--font-serif);
  font-size: 1.15rem;
  line-height: 1.9;
  color: var(--text-soft);
  margin: 32px auto;
  max-width: 560px;
}
.poem .author {
  display: block;
  margin-top: 18px;
  font-size: .95rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ============ Awards table ============ */
.awards-table {
  width: 100%;
  max-width: 480px;
  margin: 24px auto;
  border-collapse: collapse;
}
.awards-table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}
.awards-table td:first-child {
  font-family: var(--font-serif);
  color: var(--accent);
  font-weight: 600;
  width: 80px;
}

/* ============ Forms ============ */
.form-field { margin-bottom: 20px; }
.form-field label {
  display: block;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text);
}
.form-field input,
.form-field textarea {
  width: 100%;
  padding: 12px 14px;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.form-field input:focus,
.form-field textarea:focus {
  outline: 0;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(139,110,63,.15);
}
.form-field textarea { resize: vertical; min-height: 140px; }

/* ============ Nomination list ============ */
.nomination-list .nomination-item {
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}
.nomination-list .nomination-item:last-child { border-bottom: 0; }
.nomination-list .nomination-name {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.nomination-list .nomination-desc {
  color: var(--text-soft);
  white-space: pre-wrap;
}
.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 60px 20px;
  font-style: italic;
}

/* ============ Photo Gallery ============ */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin: 32px 0;
}
.gallery a {
  display: block;
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  background: var(--bg-soft);
  aspect-ratio: 1/1;
  cursor: zoom-in;
  border-bottom: 0;
  box-shadow: var(--shadow);
}
.gallery img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .35s ease, filter .25s ease;
}
.gallery a:hover img { transform: scale(1.04); filter: brightness(1.05); }

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 18, .92);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}
.lightbox.open { display: flex; }
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 10px;
  box-shadow: 0 10px 50px rgba(0,0,0,.5);
}
.lightbox .lb-btn {
  position: absolute;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.2);
  color: #fff;
  width: 48px; height: 48px;
  border-radius: 999px;
  font-size: 22px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s ease;
}
.lightbox .lb-btn:hover { background: rgba(255,255,255,.25); }
.lightbox .lb-close { top: 20px; right: 20px; }
.lightbox .lb-prev { left: 20px; top: 50%; transform: translateY(-50%); }
.lightbox .lb-next { right: 20px; top: 50%; transform: translateY(-50%); }
.lightbox .lb-counter {
  position: absolute;
  bottom: 20px; left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,.7);
  font-size: .9rem;
  background: rgba(0,0,0,.4);
  padding: 6px 14px;
  border-radius: 999px;
}

/* ============ Donation ============ */
.donation-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin: 32px 0;
}
@media (min-width: 720px) {
  .donation-options { grid-template-columns: 1fr 1fr; }
}
.donation-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  box-shadow: var(--shadow);
}
.donation-card h3 { margin-top: 0; }
.donation-card .addr {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--text-soft);
  margin: 16px 0;
}

/* ============ Footer ============ */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
  padding: 40px 22px 30px;
  text-align: center;
}
.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
}
.footer-social {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-bottom: 18px;
}
.footer-social a {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text-soft);
  border-bottom: 1px solid var(--border);
  transition: color .15s ease, border-color .15s ease, transform .1s ease;
}
.footer-social a:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-2px); }
.footer-social svg { width: 20px; height: 20px; }
.footer-text {
  color: var(--text-muted);
  font-size: .9rem;
}
.footer-text p { margin: 4px 0; color: var(--text-muted); }

/* ============ Responsive ============ */
@media (max-width: 768px) {
  body { font-size: 16px; }
  .nav-toggle { display: inline-flex; align-items: center; }
  .nav-links {
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    background: #fff;
    flex-direction: column;
    align-items: stretch;
    padding: 12px 16px 18px;
    border-bottom: 1px solid var(--border);
    gap: 2px;
    display: none;
    box-shadow: 0 8px 16px rgba(0,0,0,.04);
  }
  .nav-links.open { display: flex; }
  .nav-links a {
    width: 100%;
    border-radius: 10px;
    padding: 12px 14px;
  }
  .nav-links .icon-link { padding: 12px 14px; }
  .eulogy-entry { padding-left: 18px; }
  .gallery { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
}

/* Page-specific text content (bio, eulogy) */
.prose p { font-size: 1.05rem; }
.prose h2 { border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.prose img { margin: 24px auto; border-radius: 10px; box-shadow: var(--shadow); }

/* ============ Bilingual ============ */
html:not([lang="zh"]) [lang="zh"] { display: none; }
html[lang="zh"] [lang="en"] { display: none; }
html[lang="zh"] body { line-height: 1.85; }
html[lang="zh"] h1, html[lang="zh"] h2, html[lang="zh"] h3, html[lang="zh"] h4 {
  letter-spacing: .02em;
  font-weight: 600;
}
html[lang="zh"] .hero-photo h1 { letter-spacing: .06em; }
html[lang="zh"] .eyebrow { letter-spacing: .2em; }
html[lang="zh"] .brand { letter-spacing: .04em; }

.lang-switch {
  display: inline-flex;
  align-items: center;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px;
  margin-left: 8px;
  font-size: .85rem;
  border-bottom: 1px solid var(--border);
}
.lang-switch button {
  background: none;
  border: 0;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  color: var(--text-muted);
  font-family: inherit;
  font-weight: 500;
  font-size: .85rem;
  line-height: 1.4;
  transition: background .15s ease, color .15s ease;
}
.lang-switch button:hover { color: var(--text); }
.lang-switch button.active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 1px 3px rgba(20,30,40,.08);
}
