:root {
  --bg: oklch(94% 0.025 145);
  --card-bg: oklch(98% 0.008 90);
  --text: oklch(30% 0.035 140);
  --text-muted: oklch(48% 0.025 140);
  --accent: oklch(58% 0.09 45);
  --shadow: oklch(30% 0.03 140 / 0.4);
}

* { box-sizing: border-box; }

/* Memorial candle */
.memorial-candle {
  position: fixed;
  top: 14px;
  left: 18px;
  width: 34px;
  height: 62px;
  z-index: 50;
  pointer-events: none;
}

.memorial-candle .flame-glow {
  fill: oklch(75% 0.14 60 / 0.55);
  filter: blur(4px);
  transform-origin: 17px 20px;
  animation: candle-glow 3.2s ease-in-out infinite;
}

.memorial-candle .flame-outer {
  fill: var(--accent);
  transform-origin: 17px 20px;
  animation: candle-flicker-outer 2.6s ease-in-out infinite;
}

.memorial-candle .flame-inner {
  fill: oklch(88% 0.1 85);
  transform-origin: 17px 24px;
  animation: candle-flicker-inner 2.1s ease-in-out infinite;
}

@keyframes candle-glow {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  30% { opacity: 0.75; transform: scale(1.08); }
  55% { opacity: 0.4; transform: scale(0.94); }
  80% { opacity: 0.65; transform: scale(1.04); }
}

@keyframes candle-flicker-outer {
  0%, 100% { transform: scaleY(1) scaleX(1) rotate(0deg); }
  22% { transform: scaleY(1.06) scaleX(0.96) rotate(-1.5deg); }
  48% { transform: scaleY(0.92) scaleX(1.04) rotate(1deg); }
  70% { transform: scaleY(1.04) scaleX(0.98) rotate(-0.5deg); }
  85% { transform: scaleY(0.96) scaleX(1.02) rotate(1.5deg); }
}

@keyframes candle-flicker-inner {
  0%, 100% { transform: scaleY(1) rotate(0deg); opacity: 1; }
  25% { transform: scaleY(0.9) rotate(1deg); opacity: 0.9; }
  50% { transform: scaleY(1.08) rotate(-1deg); opacity: 1; }
  75% { transform: scaleY(0.95) rotate(0.5deg); opacity: 0.85; }
}

@media (prefers-reduced-motion: reduce) {
  .memorial-candle .flame-glow,
  .memorial-candle .flame-outer,
  .memorial-candle .flame-inner {
    animation: none;
  }
}

@media (max-width: 480px) {
  .memorial-candle { width: 26px; height: 48px; top: 10px; left: 12px; }
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Noto Serif Hebrew', 'Noto Serif', 'Times New Roman', serif;
}

html[dir="rtl"] header.site-header .lang-toggle {
  margin-inline-start: 0;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--text); text-decoration: none; }
a:hover { color: var(--accent); }

header.site-header {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 28px;
  padding: 28px 0;
}

header.site-header nav {
  display: flex;
  gap: 24px;
  font-size: 14px;
  letter-spacing: 0.06em;
}

header.site-header nav a.active {
  border-bottom: 1px solid var(--accent);
  padding-bottom: 3px;
}

header.site-header .lang-toggle {
  display: flex;
  gap: 14px;
  font-size: 12px;
  letter-spacing: 0.12em;
  margin-inline-start: 20px;
}

header.site-header .lang-toggle span {
  cursor: pointer;
}

header.site-header .lang-toggle span.active {
  color: var(--text);
  border-bottom: 1px solid var(--accent);
  padding-bottom: 3px;
}

header.site-header .lang-toggle span:not(.active) {
  color: var(--text-muted);
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

footer.site-footer {
  padding: 24px 0;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

footer.site-footer .footer-credit {
  font-size: 10px;
  opacity: 0.7;
  margin-top: 4px;
}

/* Home */
.home-main {
  justify-content: center;
  gap: 28px;
  padding: 40px 20px;
}

.portrait-frame {
  padding: 14px;
  background: var(--card-bg);
  box-shadow: 0 18px 40px -22px var(--shadow);
}

.portrait-frame img {
  display: block;
  width: 240px;
  height: auto;
  object-fit: cover;
}

.home-name {
  font-size: 38px;
  font-weight: 500;
  color: var(--text);
  text-align: center;
}

.home-years {
  font-size: 16px;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-align: center;
}

.home-line {
  font-size: 16px;
  font-style: italic;
  color: var(--text-muted);
  text-align: center;
  max-width: 480px;
}

/* Gallery */
.gallery-main {
  display: block;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 24px 60px;
}

.add-photo-link {
  display: inline-block;
  font-size: 14px;
  letter-spacing: 0.03em;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 8px 16px;
  margin-top: 10px;
}

.add-photo-link:hover {
  background: var(--accent);
  color: var(--card-bg);
}

.decade-heading {
  direction: ltr;
  text-align: start;
  font-size: 22px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--text);
  margin: 40px 0 16px;
  border-bottom: 1px solid var(--card-bg);
  padding-bottom: 8px;
}

.decade-heading:first-of-type {
  margin-top: 10px;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

.photo-thumb {
  display: block;
  cursor: pointer;
  border: none;
  padding: 0;
  background: none;
}

.photo-thumb img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  background: var(--card-bg);
  box-shadow: 0 6px 16px -10px var(--shadow);
  display: block;
  transition: opacity 0.15s ease;
}

.photo-thumb:hover img,
.photo-thumb:focus-visible img {
  opacity: 0.85;
}

/* Lightbox */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: oklch(15% 0.01 140 / 0.92);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.lightbox.open {
  display: flex;
}

body.lightbox-locked {
  overflow: hidden;
}

.lightbox img {
  max-width: 92vw;
  max-height: 82vh;
  box-shadow: 0 20px 60px oklch(0% 0 0 / 0.5);
}

.lightbox-caption {
  display: none;
  max-width: 70vw;
  margin-top: 16px;
  color: oklch(96% 0.01 90);
  font-size: 15px;
  text-align: center;
  white-space: pre-line;
}

.lightbox button {
  position: absolute;
  background: none;
  border: none;
  color: oklch(96% 0.01 90);
  cursor: pointer;
  font-family: 'Noto Serif', serif;
  line-height: 1;
}

.lightbox-close {
  top: 20px;
  inset-inline-end: 24px;
  font-size: 36px;
}

.lightbox-prev,
.lightbox-next {
  top: 50%;
  transform: translateY(-50%);
  font-size: 48px;
  padding: 12px 18px;
}

.lightbox-prev { left: 8px; }
.lightbox-next { right: 8px; }

.lightbox button:hover {
  color: var(--accent);
}

/* Memories */
.memories-main {
  display: block;
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 20px 24px 60px;
}

.memories-main > * + * {
  margin-top: 32px;
}

.memory-card {
  background: var(--card-bg);
  padding: 20px 24px;
  margin-bottom: 16px;
  box-shadow: 0 6px 16px -10px var(--shadow);
}

.memory-body {
  white-space: pre-line;
  line-height: 1.6;
  margin-bottom: 10px;
}

.memory-byline {
  font-size: 13px;
  color: var(--text-muted);
  letter-spacing: 0.03em;
}

.memory-empty {
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
  padding: 20px 0 10px;
}

.memory-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
  padding-top: 24px;
  border-top: 1px solid var(--card-bg);
}

.memory-form-title {
  font-size: 18px;
  font-weight: 500;
  margin-bottom: 4px;
}

.memory-form input[type="text"],
.memory-form textarea {
  font-family: inherit;
  font-size: 15px;
  padding: 10px 12px;
  border: 1px solid oklch(80% 0.02 140);
  background: var(--card-bg);
  color: var(--text);
  resize: vertical;
}

.memory-form button {
  align-self: flex-start;
  font-family: inherit;
  font-size: 14px;
  letter-spacing: 0.04em;
  padding: 10px 20px;
  background: var(--accent);
  color: var(--card-bg);
  border: none;
  cursor: pointer;
}

.memory-form button:hover {
  opacity: 0.9;
}

.mf-status {
  font-size: 13px;
  color: var(--text-muted);
  min-height: 18px;
}

.mf-file-label {
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 6px;
  scroll-margin-top: 24px;
}

.mf-file-label input[type="file"] {
  font-family: inherit;
  font-size: 13px;
}

.mf-photo-list {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mf-photo-item {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mf-note {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}

.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

@media (max-width: 480px) {
  header.site-header { flex-direction: column; gap: 10px; }
  .home-name { font-size: 30px; }
}
