:root {
  --ink: #172A3A;            /* Memory Blue - dominant: text, buttons, headers */
  --ink-soft: #4A5763;       /* secondary text - navy-tinted grey, not raw taupe
                                 (raw taupe fails AA as text, 2.44:1 on ivory) */
  --paper: #F5F1E8;          /* Warm Ivory - default page background */
  --paper-raised: #ffffff;   /* Pure White - cards & photos only */
  --line: #DED7C7;           /* card borders */
  --line-soft: #EFE9DC;      /* inner dividers */
  --taupe: #A89B7A;          /* Eternal Taupe - non-text uses only (surfaces,
                                 dividers, icon tints); fails AA as text */
  --accent: #C7A25A;         /* Heritage Gold - decorative accent only. Never
                                 text under 18px, never twice in one block */
  --accent-label: #8C7A4E;   /* darkened gold for small label/eyebrow text
                                 (AA-large only, 3.72:1 - not for body copy) */
  --accent-soft: color-mix(in srgb, var(--taupe) 16%, var(--paper));
  --radius: 14px;
  --shadow: 0 10px 30px -18px rgba(23, 42, 58, 0.35);
}

* { box-sizing: border-box; }
/* <picture> (WebP + fallback, see webp_variant_url) disappears from the
   box model entirely so every existing "img { width/height: 100% }" rule
   keeps sizing the real <img> exactly as it did before this wrapper
   existed - no per-component CSS needed to accommodate it. */
picture { display: contents; }

body {
  margin: 0;
  font-family: "Jost", Futura, "Century Gothic", sans-serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.6;
}

h1, h2, h3 {
  font-family: "Jost", Futura, "Century Gothic", sans-serif;
  font-weight: 300;
  color: var(--ink);
  margin: 0 0 0.5em;
}

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

.muted { color: var(--ink-soft); font-size: 0.9em; }
.empty-state { color: var(--ink-soft); font-style: italic; }

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 2rem;
  border-bottom: 1px solid var(--line);
  background: var(--paper-raised);
  position: sticky;
  top: 0;
  z-index: 10;
}
.header-nav { display: flex; align-items: center; gap: 1rem; }
.lang-switcher { position: relative; }
.lang-current { font-size: 0.85rem; color: var(--ink-soft); cursor: pointer; padding: 0.4rem 0.2rem; }
.lang-menu {
  display: none;
  position: absolute; top: 100%; inset-inline-end: 0;
  background: var(--paper-raised); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow); padding: 0.4rem; min-width: 140px; z-index: 20;
}
.lang-switcher:hover .lang-menu, .lang-switcher:focus-within .lang-menu, .lang-switcher.is-open .lang-menu { display: flex; flex-direction: column; }
.lang-current { background: none; border: none; font-family: inherit; }
.lang-menu a { padding: 0.4rem 0.6rem; border-radius: 6px; text-decoration: none; color: var(--ink); font-size: 0.85rem; }
.lang-menu a:hover { background: var(--accent-soft); }
.lang-menu a.is-active { font-weight: 600; color: var(--ink); }

html[dir="rtl"] .timeline { border-left: none; border-right: 2px solid var(--accent-soft); }
html[dir="rtl"] .timeline li::before { left: auto; right: -6.5px; }
html[dir="rtl"] .drag-handle { transform: scaleX(-1); }
.brand { display: inline-flex; align-items: center; gap: 0.55rem; text-decoration: none; }
.brand-word {
  font-family: "Jost", Futura, "Century Gothic", sans-serif;
  font-size: 16px;
  font-weight: 300;
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  text-transform: uppercase;
  color: var(--ink);
}

main { max-width: 920px; margin: 0 auto; padding: 2.5rem 1.5rem 5rem; }

.site-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--ink-soft);
  font-size: 0.85rem;
  border-top: 1px solid var(--line);
}

.btn {
  display: inline-block;
  padding: 0.7rem 1.4rem;
  border-radius: 999px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
  font-weight: 500;
  cursor: pointer;
  font-size: 0.95rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-primary { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-small { padding: 0.5rem 1rem; font-size: 0.85rem; }
.btn-tiny { padding: 0.35rem 0.8rem; font-size: 0.78rem; border-radius: 999px; }

.hero { text-align: center; padding: 3rem 0 2.5rem; }
.hero h1 { font-size: 2.4rem; max-width: 700px; margin: 0 auto 0.6em; }
.lede { color: var(--ink-soft); max-width: 620px; margin: 0 auto 1.6rem; font-size: 1.05rem; }
.home-search { display: flex; justify-content: center; gap: 0.5rem; max-width: 420px; margin: 1.6rem auto 0; }
.home-search input { flex: 1; padding: 0.6rem 0.9rem; border: 1px solid var(--line); border-radius: 999px; font-size: 0.95rem; }

.memorial-grid-section h2 { margin-bottom: 1rem; }
.memorial-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; }
.memorial-card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.memorial-card-portrait {
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Jost", Futura, "Century Gothic", sans-serif;
  font-weight: 300;
  font-size: 2rem;
}
.memorial-card-portrait img { width: 100%; height: 100%; object-fit: cover; }
.card-placeholder { position: relative; width: 64px; height: 64px; display: flex; align-items: center; justify-content: center; }
.card-placeholder-icon { position: absolute; inset: 0; opacity: 0.28; color: var(--ink-soft); }
.card-placeholder-icon svg { width: 100%; height: 100%; }
.card-initials { position: relative; z-index: 1; letter-spacing: 0.03em; color: var(--ink); }
.memorial-card-body { padding: 0.8rem 1rem; display: flex; flex-direction: column; gap: 0.2rem; }
.memorial-card-location { font-size: 0.82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.form-page { max-width: 640px; margin: 0 auto; }
.stack-form { display: flex; flex-direction: column; gap: 1rem; margin-top: 1.5rem; }
.stack-form label { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.9rem; color: var(--ink-soft); font-weight: 500; min-width: 0; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; min-width: 0; }
.form-row > label { min-width: 0; }
input[type=text], input[type=url], input[type=color], input[type=email], input[type=search], textarea, select {
  font-family: inherit;
  font-size: 1rem;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-raised);
  color: var(--ink);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
textarea { resize: vertical; }
.consent-box { background: var(--accent-soft); border-radius: var(--radius); padding: 1rem 1.2rem; }
.checkbox-label { display: flex; gap: 0.6rem; align-items: flex-start; font-weight: 400; font-size: 0.92rem; color: var(--ink); }
.checkbox-label.small { font-size: 0.85rem; }
.checkbox-label input { margin-top: 0.25rem; flex-shrink: 0; }

.legal-box { display: flex; flex-direction: column; gap: 0.9rem; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; background: var(--paper-raised); }
.legal-language-notice { margin: 0; font-size: 0.82rem; }
.legal-box .checkbox-label span { font-size: 0.85rem; line-height: 1.45; color: var(--ink-soft); }

.legal-page { max-width: 720px; margin: 0 auto; }
.legal-page h2 { margin-top: 2rem; font-size: 1.15rem; }
.legal-page ul { padding-left: 1.2rem; }
.legal-page li { margin-bottom: 0.4rem; }

.banner { background: var(--accent-soft); border-radius: var(--radius); padding: 0.9rem 1.2rem; margin-bottom: 1.5rem; font-size: 0.95rem; }
.banner a { margin-left: 0.5rem; font-weight: 600; }
.banner-success { border: 1px solid var(--accent); }

.owner-bar {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.6rem 1rem;
  margin-bottom: 1.5rem;
  font-size: 0.88rem;
}

.owner-bar-preview {
  background: color-mix(in srgb, var(--theme-color, #172A3A) 12%, var(--paper-raised));
  border-color: var(--theme-color, var(--line));
}

.memorial-hero { text-align: center; padding-bottom: 2rem; border-bottom: 1px solid var(--line); margin-bottom: 2rem; }
.memorial-cover { position: relative; height: 140px; border-radius: var(--radius); margin-bottom: -48px; background-size: cover; background-position: center; }
.memorial-portrait {
  position: relative;
  width: 96px; height: 96px; border-radius: 50%;
  background: var(--paper-raised);
  border: 4px solid var(--paper-raised);
  margin: 0 auto 1rem;
  display: flex; align-items: center; justify-content: center;
  font-family: "Jost", Futura, "Century Gothic", sans-serif; font-weight: 300; font-size: 2.2rem;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.memorial-portrait img { width: 100%; height: 100%; object-fit: cover; }

.edit-pencil {
  display: inline-flex; align-items: center; justify-content: center;
  text-decoration: none; color: var(--ink-soft); font-size: 0.85em;
  opacity: 0.6; border-radius: 50%;
}
.edit-pencil:hover { opacity: 1; }
.edit-pencil-cover, .edit-pencil-portrait {
  position: absolute; width: 28px; height: 28px;
  background: var(--ink, #172A3A); color: #fff; opacity: 0.85;
}
.edit-pencil-cover { top: 8px; right: 8px; }
.edit-pencil-portrait { bottom: -2px; right: -2px; border: 2px solid var(--paper-raised); }

/* LinkedIn-style photo editing affordance: hovering the cover banner or the
   profile circle shows its own darken overlay + pointer cursor, so each
   photo reads as independently clickable — the pencil badge stays put. */
.memorial-cover.owner-editable-photo, .memorial-portrait.owner-editable-photo { cursor: pointer; }
.memorial-cover.owner-editable-photo::before {
  content: ""; position: absolute; inset: 0; border-radius: var(--radius);
  background: rgba(0, 0, 0, 0); transition: background 0.15s ease;
}
.memorial-cover.owner-editable-photo:hover::before,
.memorial-cover.owner-editable-photo:focus-visible::before { background: rgba(0, 0, 0, 0.18); }
.memorial-portrait.owner-editable-photo img { transition: filter 0.15s ease; }
.memorial-portrait.owner-editable-photo:hover img,
.memorial-portrait.owner-editable-photo:focus-visible img { filter: brightness(0.8); }
.memorial-portrait.owner-editable-photo:focus-visible, .memorial-cover.owner-editable-photo:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.btn-icon-only { display: inline-flex; align-items: center; justify-content: center; padding: 0.5rem; }

.suggestion-box { margin-top: 1.2rem; font-size: 0.9rem; }
.suggestion-box summary { cursor: pointer; color: var(--ink-soft); }
.suggestion-box summary:hover { color: var(--ink); }
.suggestion-form { margin-top: 0.8rem; max-width: 480px; }
.honeypot-field { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; left: -9999px; }

.invite-emails-label { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.88rem; color: var(--ink-soft); margin: 1rem 0 0.6rem; }
.invite-emails-label textarea { width: 100%; box-sizing: border-box; }

dialog.edit-modal {
  width: min(560px, 90vw);
  max-height: 85vh;
  overflow-y: auto;
  border: none;
  border-radius: var(--radius);
  padding: 1.6rem;
  background: var(--paper-raised);
  box-shadow: var(--shadow);
}
dialog.edit-modal::backdrop { background: rgba(20, 18, 14, 0.55); }
.edit-modal-close-form { display: flex; justify-content: flex-end; margin: -0.4rem -0.4rem 0.4rem 0; }
.edit-modal-close {
  border: none; background: transparent; font-size: 1.1rem; line-height: 1; cursor: pointer;
  color: var(--ink-soft); padding: 0.3rem 0.5rem; border-radius: 6px;
}
.edit-modal-close:hover { background: var(--paper); color: var(--ink); }
.edit-modal-body h2:first-child, .edit-modal-body h3:first-child { margin-top: 0; }
.memorial-hero h1 { font-size: 2rem; }
.nickname { color: var(--ink-soft); font-style: italic; font-size: 0.7em; }
.dates { color: var(--ink-soft); margin: 0.2rem 0 1rem; }
.presentation-box {
  max-width: 560px; margin: 1rem auto 0; padding: 1rem 1.2rem;
  background: var(--accent-soft); border-radius: var(--radius); font-style: italic;
}
.share-row { display: flex; justify-content: center; gap: 0.6rem; margin-top: 1.2rem; flex-wrap: wrap; }
.share-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px;
  padding: 0; border-radius: 999px; border: 1px solid var(--line);
  background: var(--paper-raised); color: var(--ink-soft); text-decoration: none; cursor: pointer;
}
.share-btn:hover { background: var(--accent-soft); color: var(--ink); }
.translate-btn { background: none; border: none; color: var(--ink); font-size: 0.82rem; cursor: pointer; padding: 0.2rem 0; text-decoration: underline; }
.translate-note { font-size: 0.82rem; font-style: italic; margin-top: 0.2rem; }
.auto-translation { margin-top: 0.4rem; padding: 0.6rem 0.8rem; background: var(--accent-soft); border-radius: 8px; }
.auto-translation-label { font-size: 0.78rem; font-style: italic; color: var(--ink-soft); margin: 0 0 0.3rem; }
.auto-translation p:last-child { margin: 0; }

.module { padding: 2rem 0; border-bottom: 1px solid var(--line); }
.module:last-child { border-bottom: none; }

.timeline { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--accent-soft); }
.timeline li { padding: 0 0 1.4rem 1.2rem; position: relative; }
.timeline li::before {
  content: ""; position: absolute; left: -6.5px; top: 4px;
  width: 11px; height: 11px; border-radius: 50%; background: var(--accent);
}
.timeline-date { display: block; font-size: 0.8rem; color: var(--accent-label); font-weight: 600; }

.media-year-heading { margin: 1.5rem 0 0.6rem; font-size: 1.05rem; color: var(--ink-soft); }
.media-year-heading:first-of-type { margin-top: 0.5rem; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 0.8rem; }
.media-grid img { width: 100%; height: 140px; object-fit: cover; border-radius: 10px; }
.media-figure[data-lightbox] { cursor: zoom-in; }
.media-figure[data-lightbox] img { transition: opacity 0.15s ease; }
.media-figure[data-lightbox]:hover img { opacity: 0.85; }
.media-figure { position: relative; }
.album-owner-controls { position: absolute; top: 0.4rem; left: 0.4rem; right: 0.4rem; display: flex; justify-content: space-between; z-index: 3; }
.album-owner-controls form { margin: 0; }
.media-grid figcaption { font-size: 0.8rem; color: var(--ink-soft); margin-top: 0.3rem; }
.mood-chip {
  display: inline-flex; align-items: center; gap: 0.3rem; margin-left: 0.35rem; padding: 0.05rem 0.55rem 0.05rem 0.4rem;
  border-radius: 999px; background: var(--accent-soft); color: var(--ink);
  font-size: 0.75rem; font-style: normal;
}
.mood-chip::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }

.lightbox {
  position: fixed; inset: 0; background: rgba(10, 9, 7, 0.92); z-index: 100;
  display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 1rem; padding: 3rem 4rem;
}
.lightbox[hidden] { display: none; }
.lightbox-image { max-width: 100%; max-height: 75vh; object-fit: contain; border-radius: 6px; }
.lightbox-caption { color: var(--paper); font-size: 0.9rem; text-align: center; max-width: 60ch; }
.lightbox-close, .lightbox-prev, .lightbox-next {
  position: absolute; background: rgba(255, 255, 255, 0.12); color: #fff; border: none; border-radius: 50%;
  cursor: pointer; font-size: 1.4rem; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
}
.lightbox-close:hover, .lightbox-prev:hover, .lightbox-next:hover { background: rgba(255, 255, 255, 0.24); }
.lightbox-close { top: 1.2rem; right: 1.2rem; }
.lightbox-prev { left: 1.2rem; top: 50%; transform: translateY(-50%); }
.lightbox-next { right: 1.2rem; top: 50%; transform: translateY(-50%); }

.family-list, .places-list, .letters-list, .archives-list, .testimonials-list, .fact-history { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 0.9rem; }
.testimonials-list li { background: var(--paper-raised); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }

.testimonial-form { margin-top: 1.5rem; max-width: 480px; }

.customize-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; gap: 1rem; flex-wrap: wrap; }
.customize-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1.2rem; align-items: start; }
.panel { background: var(--paper-raised); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem; }
.panel .stack-form { margin-top: 1rem; }
.panel-intro { margin-top: -0.4rem; margin-bottom: 0.8rem; font-size: 0.88rem; line-height: 1.4; }
.field-hint { margin-top: -0.5rem; font-size: 0.8rem; }
.editor-toolbar { display: block; margin-bottom: 0.3rem; }
.editor-toolbar .btn-tiny { padding: 0.2rem 0.6rem; }
.editor-bold-btn { font-weight: 700; }
.prose { text-align: justify; line-height: 1.6; }
.panel-warning { border-color: #c9a13b; background: color-mix(in srgb, #c9a13b 8%, var(--paper-raised)); }

.completeness-leads { list-style: none; padding: 0; margin: 0.6rem 0 1.6rem; display: flex; flex-direction: column; gap: 0.4rem; }
.completeness-leads li {
  padding: 0.5rem 0.8rem; border-radius: 8px; background: var(--accent-soft);
  font-size: 0.88rem; color: var(--ink);
}
.module-list { list-style: none; padding: 0; margin: 1rem 0; display: flex; flex-direction: column; gap: 0.5rem; }
.module-item {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.6rem 0.8rem; border: 1px solid var(--line); border-radius: 10px;
  background: var(--paper); cursor: grab;
}
.module-item.is-inactive { opacity: 0.5; }
.module-item .module-name { flex: 1; font-weight: 500; }
.drag-handle { color: var(--ink-soft); }

.media-manage-list { list-style: none; padding: 0; margin: 1rem 0; display: flex; flex-direction: column; gap: 0.5rem; }
.media-manage-item {
  display: flex; align-items: flex-start; gap: 0.7rem;
  padding: 0.6rem 0.8rem; border: 1px solid var(--line); border-radius: 10px;
  background: var(--paper); cursor: grab;
}
.media-manage-thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; flex-shrink: 0; }
.media-manage-thumb-generic {
  display: flex; align-items: center; justify-content: center; text-align: center;
  font-size: 0.7rem; background: var(--accent-soft); color: var(--ink-soft);
}
.media-manage-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.2rem; }
.media-edit-details summary { cursor: pointer; font-size: 0.9rem; }
.media-edit-details .stack-form { margin-top: 0.6rem; }
.inline-form { margin: 0; }
.move-buttons { display: flex; gap: 0.2rem; }

/* Trash-icon delete buttons: delete immediately on click, no
   confirmation step (the family asked for this explicitly — a photo or
   album should be gone the moment they click, not after a second click
   or a dialog). */
.btn-icon-trash {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--paper); color: var(--ink-soft); cursor: pointer; flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease;
}
.btn-icon-trash:hover { background: #c0392b; color: #fff; border-color: #c0392b; }

/* Album covers: a couple of the album's OWN other photos peek out behind
   the cover — real pictures, never a blank filler card — offset toward
   one corner only (not fanned both ways) for a calmer, more regular
   "stack" read. margin-bottom on the container reserves room for the
   overflow so it never bleeds into the album name below. */
.album-cover-stack { position: relative; display: block; aspect-ratio: 1 / 1; margin-bottom: 20px; }
.album-cover-back {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  border-radius: 10px; border: 2px solid var(--paper-raised);
  box-shadow: 0 2px 5px rgba(20, 16, 8, 0.14);
}
.album-cover-back-1 { transform: translate(8%, 8%); z-index: 0; }
.album-cover-back-2 { transform: translate(15%, 15%); z-index: -1; filter: brightness(0.93); }
.album-cover-thumb {
  position: relative; z-index: 2; display: block; width: 100%; height: 100%;
  object-fit: cover; border-radius: 10px; box-shadow: 0 3px 8px rgba(20, 16, 8, 0.18);
}
.album-cover-thumb-empty { background: var(--accent-soft); }

.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1.4rem 1.6rem; margin: 1.2rem 0 1.8rem; }
.album-card { display: flex; flex-direction: column; gap: 0.35rem; text-decoration: none; color: inherit; }
.album-card:hover .album-cover-thumb { transform: scale(1.03); transition: transform 0.15s ease; }
.album-card-name { font-weight: 600; }
.album-card-count { font-size: 0.8rem; }

.album-manage-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1rem; margin: 1.2rem 0 1.6rem; }
.album-manage-card {
  border: 1px solid var(--line); border-radius: 10px; padding: 0.7rem;
  background: var(--paper);
}
.album-manage-summary {
  display: flex; flex-direction: column; gap: 0.35rem; cursor: pointer; list-style: none;
}
.album-manage-summary::-webkit-details-marker { display: none; }
.album-manage-info { display: flex; flex-direction: column; gap: 0.1rem; }
.album-manage-info strong { display: block; font-size: 0.85rem; overflow-wrap: anywhere; }
.album-manage-photos {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 0.5rem;
  margin: 0.8rem 0; padding-top: 0.8rem; border-top: 1px solid var(--line);
}
.album-manage-photo { position: relative; }
.album-manage-photo-thumb { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 8px; display: block; }
.album-manage-photo.is-cover .album-manage-photo-thumb { outline: 2px solid #C7A25A; outline-offset: 1px; }
.album-manage-photo form.inline-form { position: absolute; top: 0.25rem; right: 0.25rem; }
.album-manage-photo .btn-icon-trash { width: 26px; height: 26px; background: rgba(250, 247, 242, 0.92); }
.album-manage-photo form.album-cover-set-form { position: absolute; top: 0.25rem; left: 0.25rem; margin: 0; }
.btn-icon-star {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line);
  background: rgba(250, 247, 242, 0.92); color: var(--ink-soft); cursor: pointer;
}
.btn-icon-star:hover { background: #C7A25A; color: #fff; border-color: #C7A25A; }
.btn-icon-add {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--paper); color: var(--ink-soft); cursor: pointer; flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease;
}
.btn-icon-add:hover { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn-icon-add input[type="file"] { display: none; }

.album-rename-form { display: flex; gap: 0.4rem; align-items: center; margin-bottom: 0.4rem; }
.album-rename-input {
  flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 6px;
  padding: 0.35rem 0.6rem; font: inherit; background: var(--paper);
}
.album-rename-input-title { font-family: "Jost", Futura, "Century Gothic", sans-serif; font-size: 1.4rem; font-weight: 300; }
.album-cover-badge {
  position: absolute; top: 0.25rem; left: 0.25rem; display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%; background: #C7A25A; color: #fff;
}
.album-manage-actions { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }

.album-page { max-width: 900px; margin: 0 auto; padding: 2rem 1.2rem; }
.album-back { margin-bottom: 0.4rem; }
.album-back a { color: var(--ink-soft); text-decoration: none; }
.album-back a:hover { text-decoration: underline; }
.move-buttons button:disabled { opacity: 0.3; cursor: not-allowed; }

.contributors-credit { font-size: 0.85rem; font-style: italic; }
.follow-box { margin-top: 1.2rem; padding-top: 1.2rem; border-top: 1px solid var(--line); }
.follow-box h3 { font-size: 1.05rem; margin-bottom: 0.2rem; }
.follow-form { display: flex; gap: 0.5rem; margin-top: 0.6rem; max-width: 380px; }
.follow-form input { flex: 1; padding: 0.55rem 0.8rem; border: 1px solid var(--line); border-radius: 999px; font-size: 0.9rem; }
.checklist-panel { background: var(--accent-soft); }
.checklist { list-style: none; padding: 0; margin: 0.8rem 0 0; display: flex; flex-direction: column; gap: 0.5rem; }
.checklist a { color: var(--ink); text-decoration: none; font-size: 0.95rem; }
.checklist li.is-done a { color: var(--ink-soft); text-decoration: line-through; }

.portrait-form { display: flex; align-items: center; gap: 0.8rem; margin-bottom: 1.2rem; }
.portrait-preview {
  position: relative;
  width: 72px; height: 72px; border-radius: 50%; overflow: hidden;
  background: var(--accent-soft); display: flex; align-items: center; justify-content: center;
  font-family: "Jost", Futura, "Century Gothic", sans-serif; font-weight: 300; font-size: 1.6rem; flex-shrink: 0;
  cursor: grab; touch-action: none;
}
.portrait-preview.dragging-position { cursor: grabbing; }
.portrait-preview img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.portrait-preview input[type="file"] { display: none; }
.portrait-edit-badge {
  position: absolute; bottom: 0; right: 0; width: 26px; height: 26px; border-radius: 50%;
  background: var(--ink, #172A3A); color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; border: 2px solid var(--paper-raised); cursor: pointer;
}
.portrait-hint { font-size: 0.82rem; }

.cover-form { margin-bottom: 0.8rem; }
.cover-preview {
  position: relative;
  display: block;
  height: 140px; border-radius: var(--radius); cursor: grab; touch-action: none;
  background: var(--accent-soft) center/cover no-repeat;
  border: 1px dashed var(--line);
  overflow: hidden;
}
.cover-preview.dragging-position { cursor: grabbing; }
.cover-upload-form { margin: 0; }
.cover-preview input[type="file"] { display: none; }
/* A distinct circular camera badge in the corner (LinkedIn-style cover
   editor) instead of a low-contrast text pill sitting on top of
   whatever the photo happens to show — it needs to stay visible and
   findable regardless of how busy the photo underneath is. */
.cover-edit-badge {
  position: absolute; bottom: 0.7rem; right: 0.7rem; z-index: 2;
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.95); color: var(--ink);
  border: 1px solid rgba(0, 0, 0, 0.08); box-shadow: 0 2px 8px rgba(20, 16, 8, 0.3);
  cursor: pointer; transition: transform 0.15s ease, background 0.15s ease;
}
.cover-edit-badge:hover { background: #fff; transform: scale(1.07); }
.cover-preview + .field-hint { margin-top: 0.5rem; }

.suggestion-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; margin: -0.4rem 0 0.4rem; }
.suggestion-chips .muted { width: 100%; font-size: 0.8rem; }
.suggestion-chips-label { display: inline-flex; align-items: center; gap: 0.3rem; }
.chip {
  border: 1px solid var(--line); background: var(--paper); border-radius: 999px;
  padding: 0.35rem 0.8rem; font-size: 0.8rem; cursor: pointer; color: var(--ink-soft);
  max-width: 100%; text-align: left; white-space: normal;
}
.chip:hover { background: var(--accent-soft); color: var(--ink); border-color: var(--accent); }
.names-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 0.6rem; margin: 0.8rem 0; }
.names-list li { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 0.6rem 0.8rem; display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; }
.names-actions { display: flex; gap: 0.4rem; margin-top: 0.4rem; }
.featured-parts-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; margin: 0.8rem 0; }
.featured-parts-list li { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 0.5rem 0.8rem; }
.checkbox-row { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; }
.checkbox-row input[type="checkbox"] { width: auto; }

.death-marker-picker { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.5rem; margin: 0.8rem 0; }
.death-marker-option {
  display: flex; align-items: center; gap: 0.5rem; cursor: pointer;
  background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 0.5rem 0.7rem; font-size: 0.85rem;
}
.death-marker-option input[type="radio"] { width: auto; }
.death-marker-preview { display: inline-flex; align-items: center; justify-content: center; width: 1.4em; color: var(--ink-soft); }
.death-marker-glyph { display: inline-flex; vertical-align: -2px; }
.death-marker-om { font-size: 1.15em; line-height: 1; font-family: "Nirmala UI", "Noto Sans Devanagari", "ITF Devanagari", sans-serif; }
.surname { font-variant: small-caps; letter-spacing: 0.04em; }
.memorial-hero h1 .surname { color: var(--accent); }
.alt-names { color: var(--ink-soft); font-size: 0.95rem; margin: 0.2rem 0 0.6rem; }
.name-note { font-size: 0.85em; font-style: italic; }
.generate-draft-form { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.generate-draft-form p { margin: 0.4rem 0 0; }
.permalink-row { display: flex; gap: 0.5rem; margin-top: 0.8rem; align-items: flex-start; }
.permalink-row input, .permalink-row textarea { flex: 1; padding: 0.6rem 0.8rem; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--ink-soft); font-size: 0.85rem; font-family: inherit; resize: vertical; }

.slug-input-row {
  display: flex; align-items: stretch; border: 1px solid var(--line); border-radius: 8px; overflow: hidden;
  background: var(--paper); font-size: 0.85rem;
}
.slug-prefix { padding: 0.6rem 0.5rem 0.6rem 0.8rem; color: var(--ink-soft); background: var(--accent-soft); white-space: nowrap; display: flex; align-items: center; }
.slug-input-row input { border: none; background: transparent; padding: 0.6rem 0.8rem 0.6rem 0.2rem; flex: 1; min-width: 0; font-family: inherit; font-size: inherit; }
.slug-input-row input:focus { outline: none; }

.ceremony-actions { display: flex; align-items: center; gap: 1.2rem; margin-top: 1rem; flex-wrap: wrap; }
.ceremony-qrcode { border-radius: 8px; border: 1px solid var(--line); background: #fff; padding: 4px; }
.tribute-video-section { margin-top: 1.2rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.tribute-video-public { margin-top: 1.2rem; }
.tribute-video-preview, .tribute-video-player {
  display: block; max-width: 100%; width: 100%; max-height: 480px;
  border-radius: var(--radius); background: #000; margin-top: 0.6rem;
}
.tribute-video-actions { display: flex; gap: 0.6rem; margin-top: 0.6rem; }
.tribute-video-processing { color: var(--ink-soft); font-style: italic; }
.tribute-video-failed { color: #c0392b; }

.moderation-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 1rem; }
.moderation-actions { display: flex; gap: 0.5rem; margin-top: 0.4rem; }

.contributions-list { list-style: none; padding: 0; margin: 0.6rem 0; display: flex; flex-direction: column; gap: 0.4rem; }
.contributions-list li { background: var(--accent-soft); border-radius: 8px; padding: 0.5rem 0.7rem; font-size: 0.92rem; }
.contribution-credit { font-style: italic; }

.memory-profile-status { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; font-size: 0.9rem; margin-bottom: 1rem; }
.memory-profile-badge { display: inline-block; padding: 0.25rem 0.7rem; border-radius: 999px; font-weight: 600; font-size: 0.8rem; }
.memory-profile-structured { background: var(--line); }
.memory-profile-enriched { background: var(--accent-soft); }
.memory-profile-coherent { background: var(--theme-color, #172A3A); color: var(--paper); }

.discovery-actions { display: flex; gap: 0.8rem; margin: 1.2rem 0; flex-wrap: wrap; }
.fact-list { display: flex; flex-direction: column; gap: 1rem; }
.fact-card { background: var(--paper-raised); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem; }
.fact-content { font-size: 1.02rem; }
.fact-meta { display: flex; flex-wrap: wrap; gap: 1rem; font-size: 0.82rem; color: var(--ink-soft); margin: 0.6rem 0; }
.fact-meta dt { font-weight: 600; display: inline; }
.fact-meta dd { display: inline; margin: 0 0 0 0.3rem; }
.confidence { padding: 0.1rem 0.5rem; border-radius: 999px; background: var(--accent-soft); }
.manual-fact-details { margin: 1rem 0 1.6rem; border: 1px solid var(--line); border-radius: var(--radius); padding: 0.8rem 1rem; background: var(--paper); }
.manual-fact-details summary { cursor: pointer; font-weight: 600; }
.manual-fact-details .stack-form { margin-top: 0.8rem; }
.fact-conflict-group {
  border: 1px solid #C7A25A; border-radius: var(--radius); padding: 0.8rem;
  display: flex; flex-direction: column; gap: 1rem; background: rgba(201, 146, 47, 0.06);
}
.fact-conflict-note { margin: 0; font-size: 0.85rem; font-weight: 600; color: #8a6423; }
.fact-actions { display: flex; flex-direction: column; gap: 0.6rem; margin-top: 0.8rem; }
.fact-buttons { display: flex; gap: 0.5rem; }
.status { font-weight: 600; text-transform: capitalize; margin-right: 0.4rem; }
.registry-links { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 0.6rem; }
.registry-links a { display: inline-block; padding: 0.5rem 1rem; border: 1px solid var(--line); border-radius: 999px; background: var(--paper-raised); text-decoration: none; font-size: 0.88rem; }
.registry-links a:hover { background: var(--accent-soft); }

@media (max-width: 640px) {
  .site-header { padding: 1rem; }
  .form-row { grid-template-columns: 1fr; }
  .hero h1 { font-size: 1.8rem; }
}

/* Save confirmation toast: green, checkmark, auto-dismissing — for
   actions saved via fetch() in place (see panels.js), which would
   otherwise be silent since nothing on screen visibly reloads. */
.toast-container {
  position: fixed; bottom: 1.6rem; left: 50%; transform: translateX(-50%);
  z-index: 500; display: flex; flex-direction: column; gap: 0.5rem; align-items: center;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 0.5rem;
  background: #2e7d46; color: #fff; padding: 0.55rem 1.1rem; border-radius: 999px;
  font-size: 0.88rem; font-weight: 500; box-shadow: 0 6px 18px rgba(20, 16, 8, 0.22);
  opacity: 0; transform: translateY(12px); transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast.visible { opacity: 1; transform: translateY(0); }
