:root {
  --cream: #faf6f0;
  --paper: #ffffff;
  --ink: #2c2a26;
  --ink-soft: #5a564e;
  --accent: #3f5d54;      /* deep sage green */
  --accent-soft: #e7efe9;
  --gold: #b08d57;
  --line: #e6ddd0;
  --shadow: 0 10px 30px rgba(44, 42, 38, 0.08);
  --radius: 14px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: 'Lora', Georgia, 'Times New Roman', serif;
  line-height: 1.65;
}

h1, h2, h3, .display {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.2px;
}

a { color: var(--accent); }

.container {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Nav ---------- */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(250, 246, 240, 0.9);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.site-nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  padding-bottom: 14px;
}
.site-nav .brand {
  font-family: 'Playfair Display', serif;
  font-size: 1.15rem;
  color: var(--accent);
  text-decoration: none;
}
.site-nav .links { display: flex; gap: 22px; }
.site-nav .links a {
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 0.95rem;
}
.site-nav .links a.active,
.site-nav .links a:hover { color: var(--accent); }

/* ---------- Hero ---------- */
.hero {
  text-align: center;
  padding: 64px 24px 40px;
}
.hero .portrait {
  width: 190px;
  height: 190px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 26px;
  box-shadow: var(--shadow);
  border: 6px solid var(--paper);
}
.hero h1 { font-size: 2.4rem; margin: 0 0 6px; }
.hero .dates { color: var(--ink-soft); font-size: 1.05rem; margin-bottom: 14px; }
.hero .tagline {
  max-width: 520px;
  margin: 0 auto;
  color: var(--ink-soft);
  font-style: italic;
}

/* ---------- Sections / cards ---------- */
section { padding: 36px 0; }
.card {
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 30px;
}
.section-title {
  font-size: 1.5rem;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* ---------- Candle widget ---------- */
.candle-widget {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 28px 0 8px;
  flex-wrap: wrap;
}
.candle-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 1rem;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.15s ease, background 0.15s ease;
}
.candle-btn:hover { background: #33473f; transform: translateY(-1px); }
.candle-btn:disabled { opacity: 0.6; cursor: default; transform: none; }
.candle-count { color: var(--ink-soft); font-size: 0.95rem; }

/* ---------- Buttons / forms ---------- */
.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
}
.btn:hover { background: #33473f; }
.btn.secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}
.btn.danger { background: #8a3b3b; }
.btn.danger:hover { background: #6f2f2f; }

label { display: block; font-size: 0.9rem; color: var(--ink-soft); margin: 14px 0 6px; }
input[type="text"], input[type="email"], textarea, input[type="password"] {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: inherit;
  font-size: 1rem;
  background: #fffdfa;
}
textarea { min-height: 120px; resize: vertical; }
input[type="file"] { margin-top: 4px; }
.field-hint { font-size: 0.8rem; color: var(--ink-soft); margin-top: 4px; }
.hp-field { position: absolute; left: -9999px; opacity: 0; height: 0; }

/* ---------- Memories list ---------- */
.memory {
  border-bottom: 1px solid var(--line);
  padding: 20px 0;
  display: flex;
  gap: 18px;
}
.memory:last-child { border-bottom: none; }
.memory .photo {
  width: 84px;
  height: 84px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
}
.memory .meta { font-size: 0.85rem; color: var(--gold); margin-bottom: 4px; }
.memory .meta .name { color: var(--ink); font-weight: 600; }
.memory .msg { white-space: pre-wrap; }
.memory .when { font-size: 0.78rem; color: var(--ink-soft); margin-top: 6px; }

.status-msg { text-align: center; color: var(--ink-soft); padding: 20px 0; }

/* ---------- Gallery ---------- */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}
.gallery-grid img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(20, 18, 14, 0.9);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 24px;
  flex-direction: column;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 90vw; max-height: 78vh; border-radius: 8px; }
.lightbox .caption { color: #f2ede4; margin-top: 14px; text-align: center; }
.lightbox .close { position: absolute; top: 20px; right: 28px; color: #fff; font-size: 2rem; cursor: pointer; background: none; border: none; }

/* ---------- Admin ---------- */
.admin-item { border: 1px solid var(--line); border-radius: 10px; padding: 18px; margin-bottom: 16px; background: var(--paper); }
.admin-item .actions { display: flex; gap: 10px; margin-top: 14px; }
.gate { max-width: 360px; margin: 80px auto; text-align: center; }

/* ---------- Footer ---------- */
footer {
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.85rem;
  padding: 40px 24px 60px;
}

@media (max-width: 560px) {
  .hero h1 { font-size: 1.9rem; }
  .memory { flex-direction: column; }
  .memory .photo { width: 100%; height: 200px; }
}
