:root {
  --bg: #f6f3ee;
  --surface: #ffffff;
  --ink: #2b2924;
  --ink-soft: #6b6558;
  --line: #d8cfc0;
  --accent: #8a6d3b;
  --accent-soft: #cdbfa0;
  --shadow: 0 6px 24px rgba(43, 41, 36, 0.08);
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1a17;
    --surface: #242220;
    --ink: #eae6dd;
    --ink-soft: #a89f8d;
    --line: #3c382f;
    --accent: #d9b877;
    --accent-soft: #4a4436;
    --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, "Segoe UI", "Noto Sans", "Noto Sans Tamil", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
}

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

.lang-switch {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 50;
  display: flex;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px;
  box-shadow: var(--shadow);
}
.lang-switch a {
  display: inline-block;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  text-decoration: none;
  color: var(--ink-soft);
}
.lang-switch a.active {
  background: var(--accent);
  color: #fff;
}

.hero {
  text-align: center;
  padding: 64px 20px 48px;
  max-width: 720px;
  margin: 0 auto;
}
.hero-photo {
  width: 176px;
  height: 176px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--surface);
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}
.hero-photo-placeholder {
  width: 176px;
  height: 176px;
  border-radius: 50%;
  background: var(--accent-soft);
  margin: 0 auto 24px;
}
.hero-tagline {
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.8rem;
  margin: 0 0 8px;
}
.hero-name {
  font-size: 2.4rem;
  margin: 0 0 8px;
  font-weight: 600;
}
.hero-dates {
  color: var(--ink-soft);
  font-size: 1rem;
  margin: 0 0 20px;
}
.hero-intro {
  color: var(--ink-soft);
  font-size: 1.05rem;
  white-space: pre-line;
}

.timeline {
  position: relative;
  max-width: 900px;
  margin: 0 auto;
  padding: 20px 20px 80px;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 20px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--line);
}
@media (min-width: 720px) {
  .timeline::before { left: 50%; margin-left: -1px; }
}

.entry {
  position: relative;
  padding-left: 52px;
  margin-bottom: 40px;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.entry.visible { opacity: 1; transform: translateY(0); }

.entry::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 6px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--bg);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

@media (min-width: 720px) {
  .entry { width: 46%; padding-left: 0; padding-right: 40px; margin-left: 0; }
  .entry::before { left: auto; right: -9px; }
  .entry:nth-child(odd) { margin-left: 54%; padding-right: 0; padding-left: 40px; }
  .entry:nth-child(odd)::before { left: -9px; right: auto; }
}

.entry-date {
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.03em;
  margin-bottom: 4px;
}
.entry-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.entry-title {
  margin: 0 0 8px;
  font-size: 1.2rem;
}
.entry-description {
  color: var(--ink-soft);
  white-space: pre-line;
  margin: 0 0 12px;
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
}
.media-item {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 1 / 1;
  background: var(--accent-soft);
}
.media-item img, .media-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.media-item.is-video::after {
  content: "▶";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.4rem;
  background: rgba(0,0,0,0.25);
}

.empty-state {
  text-align: center;
  color: var(--ink-soft);
  padding: 40px 20px;
}

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(10, 9, 7, 0.92);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}
.lightbox.open { display: flex; }
.lightbox img, .lightbox video {
  max-width: 100%;
  max-height: 85vh;
  border-radius: 8px;
}
.lightbox-caption {
  position: absolute;
  bottom: 24px;
  color: #eee;
  text-align: center;
  width: 100%;
  font-size: 0.9rem;
}
.lightbox-close {
  position: absolute;
  top: 16px;
  right: 24px;
  color: #fff;
  font-size: 2rem;
  cursor: pointer;
  background: none;
  border: none;
}

/* --- Admin --- */
.admin-wrap {
  max-width: 760px;
  margin: 40px auto;
  padding: 0 20px 60px;
}
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 24px;
}
.card h2 { margin-top: 0; }
label {
  display: block;
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin: 14px 0 4px;
}
label:first-child { margin-top: 0; }
input[type=text], input[type=date], input[type=password], input[type=file], textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
}
textarea { min-height: 90px; resize: vertical; }
button, .btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 9px 18px;
  border-radius: 8px;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
  margin-top: 14px;
}
button.secondary, .btn.secondary { background: transparent; color: var(--ink-soft); border: 1px solid var(--line); }
button.danger { background: #a4453b; }
.row-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.row-actions form { display: inline; }
.row-actions button { margin-top: 0; padding: 6px 10px; font-size: 0.85rem; }
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; }
.flash.ok { background: #dcecd8; color: #2f5c2a; }
.flash.err { background: #f4d9d6; color: #8a2f24; }
.highlight-row { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 16px; }
.highlight-row:first-child { border-top: none; padding-top: 0; margin-top: 0; }
.admin-media-thumb { width: 70px; height: 70px; object-fit: cover; border-radius: 6px; }
.admin-media-list { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0; }
.admin-media-item { text-align: center; font-size: 0.75rem; }
