/* ==========================================================================
   Remembering Olayiwola Abiola — site styles
   Themes: ivory (default) · midnight · adire · forest
   ========================================================================== */

:root,
[data-theme="ivory"] {
  --bg: #fbf8f3;
  --bg-2: #f3ede3;
  --surface: #ffffff;
  --ink: #241d16;
  --ink-2: #4b4237;
  --muted: #7b7063;
  --line: #e6ddcf;
  --accent: #9a7433;
  --accent-hover: #845f22;
  --accent-ink: #ffffff;
  --accent-soft: #f4ebdb;
  --gold: #b08a44;
  --hero-bg: #f3ece0;
  --hero-ink: #241d16;
  --hero-muted: #6f6457;
  --pattern: rgba(154, 116, 51, 0.075);
  --night: #17130f;
  --night-ink: #f3ece0;
  --shadow: 0 1px 2px rgba(36, 29, 22, 0.04), 0 8px 28px rgba(36, 29, 22, 0.07);
  color-scheme: light;
}

[data-theme="midnight"] {
  --bg: #0f141d;
  --bg-2: #131a26;
  --surface: #172030;
  --ink: #efe9df;
  --ink-2: #d2cbbf;
  --muted: #9b958a;
  --line: #273246;
  --accent: #d2b06c;
  --accent-hover: #e0c287;
  --accent-ink: #15120c;
  --accent-soft: rgba(210, 176, 108, 0.12);
  --gold: #d2b06c;
  --hero-bg: #0b1018;
  --hero-ink: #f2ece2;
  --hero-muted: #aaa397;
  --pattern: rgba(210, 176, 108, 0.08);
  --night: #080b11;
  --night-ink: #f2ece2;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 30px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

[data-theme="adire"] {
  --bg: #f5f2eb;
  --bg-2: #ebe6da;
  --surface: #ffffff;
  --ink: #141c33;
  --ink-2: #353f5c;
  --muted: #69708a;
  --line: #dbd6ca;
  --accent: #2b3c72;
  --accent-hover: #1f2d5a;
  --accent-ink: #ffffff;
  --accent-soft: #e4e8f3;
  --gold: #b88a3e;
  --hero-bg: #1a2447;
  --hero-ink: #f4efe4;
  --hero-muted: #b9bfd4;
  --pattern: rgba(244, 239, 228, 0.085);
  --night: #111830;
  --night-ink: #f4efe4;
  --shadow: 0 1px 2px rgba(20, 28, 51, 0.05), 0 8px 28px rgba(20, 28, 51, 0.08);
  color-scheme: light;
}

[data-theme="forest"] {
  --bg: #f6f4ee;
  --bg-2: #ece9de;
  --surface: #ffffff;
  --ink: #18221c;
  --ink-2: #39473e;
  --muted: #6a7469;
  --line: #dcd8ca;
  --accent: #2e5a45;
  --accent-hover: #234837;
  --accent-ink: #ffffff;
  --accent-soft: #e2ece5;
  --gold: #b08a3e;
  --hero-bg: #1e382c;
  --hero-ink: #f3eee2;
  --hero-muted: #b8c6bc;
  --pattern: rgba(243, 238, 226, 0.08);
  --night: #122119;
  --night-ink: #f3eee2;
  --shadow: 0 1px 2px rgba(24, 34, 28, 0.05), 0 8px 28px rgba(24, 34, 28, 0.08);
  color-scheme: light;
}

:root {
  --serif: "Cormorant Garamond", "Cormorant", Georgia, "Times New Roman", serif;
  --sans: "Source Sans 3", "Source Sans Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 16px;
  --radius-sm: 10px;
  --header-h: 72px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, video, svg { display: block; max-width: 100%; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 500; line-height: 1.12; margin: 0 0 .5em; color: var(--ink); letter-spacing: .005em; }
h1 { font-size: clamp(2.6rem, 6vw, 4.6rem); }
h2 { font-size: clamp(2rem, 4vw, 2.9rem); }
h3 { font-size: 1.6rem; }
p { margin: 0 0 1em; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--accent-soft); color: var(--ink); }

.container { width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 760px; }
.center { text-align: center; }
.i { width: 1.1em; height: 1.1em; flex: none; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.eyebrow {
  font-family: var(--sans);
  font-size: .76rem;
  font-weight: 600;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 .9rem;
}
.ornament { width: 160px; height: 14px; color: var(--gold); margin: 18px auto; }
.lead { font-size: 1.2rem; color: var(--ink-2); }

.skip-link { position: absolute; left: -9999px; top: 8px; z-index: 100; background: var(--surface); padding: 8px 14px; border-radius: 8px; }
.skip-link:focus { left: 12px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  border: 1px solid transparent; border-radius: 999px;
  padding: .78em 1.5em; font-weight: 600; font-size: .95rem; line-height: 1.2;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background .2s, color .2s, border-color .2s, transform .15s, box-shadow .2s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); color: var(--accent-ink); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-sm { padding: .55em 1.1em; font-size: .88rem; }
.btn[disabled] { opacity: .6; cursor: progress; }
.link-arrow { display: inline-flex; gap: .4em; align-items: center; font-weight: 600; text-decoration: none; letter-spacing: .02em; }
.link-arrow::after { content: "→"; transition: transform .2s; }
.link-arrow:hover::after { transform: translateX(4px); }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.nav { display: flex; align-items: center; justify-content: space-between; height: var(--header-h); gap: 16px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); min-width: 0; }
.monogram {
  width: 42px; height: 42px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  border: 1px solid var(--gold); color: var(--gold);
  font-family: var(--serif); font-size: 1.1rem; font-weight: 600; letter-spacing: .04em;
  box-shadow: inset 0 0 0 3px var(--bg), inset 0 0 0 4px color-mix(in srgb, var(--gold) 35%, transparent);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.brand-text small { font-size: .66rem; letter-spacing: .26em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.brand-text span { font-family: var(--serif); font-size: 1.28rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-links a {
  color: var(--ink-2); text-decoration: none; font-size: .95rem; font-weight: 500;
  padding: 8px 12px; border-radius: 8px; position: relative;
}
.nav-links a:hover { color: var(--ink); }
.nav-links a[aria-current="page"] { color: var(--ink); }
.nav-links a[aria-current="page"]::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: 2px; height: 1px; background: var(--gold);
}
.nav-candle { margin-left: 10px; }
.nav-toggle { display: none; background: none; border: 0; width: 44px; height: 44px; border-radius: 10px; cursor: pointer; padding: 11px 10px; }
.nav-toggle span { display: block; height: 1.5px; background: var(--ink); margin: 5px 0; transition: transform .25s, opacity .25s; }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

@media (max-width: 920px) {
  .nav-toggle { display: block; }
  .nav-links {
    position: absolute; left: 0; right: 0; top: var(--header-h);
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--bg); border-bottom: 1px solid var(--line);
    padding: 8px 20px 20px; box-shadow: var(--shadow);
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 14px 4px; border-bottom: 1px solid var(--line); border-radius: 0; font-size: 1.05rem; }
  .nav-links a[aria-current="page"]::after { display: none; }
  .nav-links a[aria-current="page"] { color: var(--accent); }
  .nav-candle { margin: 16px 0 0; }
}

/* ---------- Adire-inspired pattern ---------- */
.pattern-layer {
  position: absolute; inset: 0; pointer-events: none;
  background-color: var(--pattern);
  -webkit-mask-image: url("/assets/img/adire.svg");
  mask-image: url("/assets/img/adire.svg");
  -webkit-mask-size: 150px 150px; mask-size: 150px 150px;
}

/* ---------- Hero (home) ---------- */
.hero {
  position: relative; overflow: hidden;
  background: var(--hero-bg); color: var(--hero-ink);
  padding: clamp(48px, 8vw, 104px) 0 clamp(56px, 9vw, 112px);
}
.hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at 30% 40%, transparent 30%, color-mix(in srgb, var(--hero-bg) 70%, transparent) 80%);
}
.hero-inner {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(32px, 6vw, 88px); align-items: center;
}
.portrait-frame {
  justify-self: center;
  width: min(100%, 380px);
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--gold) 70%, transparent);
  border-radius: 999px 999px 22px 22px;
  position: relative;
}
.portrait-frame::before {
  content: ""; position: absolute; inset: -9px;
  border: 1px solid color-mix(in srgb, var(--gold) 28%, transparent);
  border-radius: 999px 999px 28px 28px;
  pointer-events: none;
}
.portrait {
  width: 100%; height: auto; aspect-ratio: 4 / 5; object-fit: cover;
  border-radius: 999px 999px 12px 12px;
  background: color-mix(in srgb, var(--hero-ink) 8%, var(--hero-bg));
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
}
.hero-text .eyebrow { color: var(--gold); }
.hero-name {
  color: var(--hero-ink);
  font-size: clamp(2.9rem, 7.2vw, 5.6rem);
  font-weight: 500; line-height: .98; margin: 0;
  letter-spacing: -.005em;
}
.hero-text .ornament { margin: 26px 0; }
.hero-dates {
  font-family: var(--serif); font-size: clamp(1.25rem, 2.2vw, 1.6rem);
  color: var(--hero-ink); margin: 0 0 6px; letter-spacing: .02em;
}
.hero-places { color: var(--hero-muted); font-size: .98rem; margin: 0; }
.hero-epitaph {
  font-family: var(--serif); font-style: italic; font-size: clamp(1.25rem, 2.1vw, 1.55rem);
  color: var(--hero-muted); margin: 24px 0 0; max-width: 34em; line-height: 1.45;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 34px; }
.hero .btn-ghost { color: var(--hero-ink); border-color: color-mix(in srgb, var(--hero-ink) 30%, transparent); }
.hero .btn-ghost:hover { border-color: var(--gold); color: var(--gold); }
[data-theme="adire"] .hero .btn-primary,
[data-theme="forest"] .hero .btn-primary { background: var(--gold); color: #fff; }
[data-theme="adire"] .hero .btn-primary:hover,
[data-theme="forest"] .hero .btn-primary:hover { background: color-mix(in srgb, var(--gold) 85%, #000); }
.candle-tally { display: flex; align-items: center; gap: 8px; color: var(--hero-muted); font-size: .95rem; margin-top: 18px; }
.candle-tally .i { color: var(--gold); }
.candle-tally strong { color: var(--hero-ink); font-weight: 600; }

@media (max-width: 860px) {
  .hero-inner { grid-template-columns: 1fr; text-align: center; }
  .portrait-frame { width: min(66%, 270px); }
  .hero-text .ornament { margin: 22px auto; }
  .hero-epitaph { margin-left: auto; margin-right: auto; }
  .hero-actions, .candle-tally { justify-content: center; }
}

/* ---------- Page hero (inner pages) ---------- */
.page-hero {
  position: relative; overflow: hidden;
  background: var(--hero-bg); color: var(--hero-ink);
  padding: clamp(56px, 8vw, 96px) 0 clamp(48px, 7vw, 80px);
  text-align: center;
}
.page-hero .container { position: relative; z-index: 1; }
.page-hero h1 { color: var(--hero-ink); margin: 0; }
.page-hero p.sub { color: var(--hero-muted); font-size: 1.12rem; max-width: 40em; margin: 14px auto 0; }
.page-hero .ornament { margin-bottom: 0; }

/* ---------- Sections ---------- */
.section { padding: clamp(56px, 8vw, 104px) 0; }
.section-alt { background: var(--bg-2); }
/* Two plain sections in a row share one gap (hidden sections don't count). */
.section:not([hidden]):not(.section-alt):not(.candles-section):not(.page-hero) + .section:not(.section-alt):not(.candles-section) { padding-top: 0; }
.section-head { text-align: center; margin-bottom: clamp(32px, 5vw, 52px); }
.section-head h2 { margin: 0; }
.section-head p { color: var(--muted); margin: 12px auto 0; max-width: 36em; }
.section-foot { text-align: center; margin-top: 36px; display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

.intro-text { font-family: var(--serif); font-size: clamp(1.35rem, 2.4vw, 1.7rem); line-height: 1.55; color: var(--ink-2); }
.intro-text p { margin-bottom: .8em; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* Next event teaser */
.event-teaser { display: grid; grid-template-columns: auto 1fr auto; gap: 28px; align-items: center; padding: 28px 32px; }
.date-badge {
  width: 88px; text-align: center; border-right: 1px solid var(--line); padding-right: 24px;
  font-family: var(--serif); line-height: 1;
}
.date-badge .d { font-size: 3rem; font-weight: 500; color: var(--accent); }
.date-badge .m { font-family: var(--sans); font-size: .78rem; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); margin-top: 6px; font-weight: 600; }
.event-teaser h3 { margin: 0 0 4px; }
.event-teaser p { margin: 0; color: var(--muted); }
@media (max-width: 680px) {
  .event-teaser { grid-template-columns: auto 1fr; padding: 22px; gap: 18px; }
  .event-teaser .btn { grid-column: 1 / -1; }
  .date-badge { width: 70px; padding-right: 16px; }
}

/* ---------- Tributes ---------- */
.tribute-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 24px; align-items: start; }
.tribute-grid.cols-2 { grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); }
@media (max-width: 420px) { .tribute-grid, .tribute-grid.cols-2 { grid-template-columns: 1fr; } }
.tribute { margin: 0; padding: 30px 28px 24px; position: relative; min-width: 0; }
.tribute::before {
  content: "\201C"; position: absolute; top: 4px; left: 20px;
  font-family: var(--serif); font-size: 4.4rem; line-height: 1; color: color-mix(in srgb, var(--gold) 45%, transparent);
}
.tribute.has-photo::before { display: none; }
.tribute.featured { border-color: color-mix(in srgb, var(--gold) 55%, var(--line)); }
.tribute .msg { position: relative; color: var(--ink-2); font-size: 1.02rem; line-height: 1.75; white-space: pre-line; overflow-wrap: anywhere; }
.tribute .msg.clamped { display: -webkit-box; -webkit-line-clamp: 9; -webkit-box-orient: vertical; overflow: hidden; }
.tribute .more { background: none; border: 0; color: var(--accent); font-weight: 600; padding: 0; cursor: pointer; font-size: .92rem; margin-top: -4px; }
.tribute .photo { margin: 6px 0 16px; border-radius: var(--radius-sm); overflow: hidden; cursor: zoom-in; border: 0; padding: 0; display: block; width: 100%; background: var(--bg-2); }
.tribute .photo img { width: 100%; height: auto; max-height: 320px; object-fit: cover; }
.byline { display: flex; gap: 12px; align-items: center; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: .9rem; letter-spacing: .03em;
}
.byline .who { min-width: 0; line-height: 1.3; }
.byline .who strong { display: block; font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.byline .who span { font-size: .86rem; color: var(--muted); }
.badge { display: inline-block; font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; font-weight: 700; color: var(--gold); margin-bottom: 6px; }

/* ---------- Photo strip / gallery ---------- */
.photo-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.photo-strip .tile:nth-child(1) { grid-column: span 2; grid-row: span 2; }
.photo-strip.few .tile:nth-child(1) { grid-column: auto; grid-row: auto; }
@media (max-width: 700px) {
  .photo-strip { grid-template-columns: repeat(2, 1fr); }
  .photo-strip .tile:nth-child(5) { display: none; }
}
.tile {
  position: relative; display: block; border: 0; padding: 0; cursor: zoom-in;
  border-radius: var(--radius-sm); overflow: hidden; background: var(--bg-2); width: 100%;
  aspect-ratio: 1;
}
.tile img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s cubic-bezier(.2,.7,.2,1), filter .3s; }
.tile:hover img { transform: scale(1.04); }
.tile .play {
  position: absolute; inset: 0; margin: auto; width: 56px; height: 56px; border-radius: 50%;
  background: rgba(0,0,0,.5); display: grid; place-items: center; color: #fff;
  backdrop-filter: blur(4px);
}
.tile .play::before { content: ""; border-left: 16px solid #fff; border-top: 10px solid transparent; border-bottom: 10px solid transparent; margin-left: 4px; }

/* Justified rows: every row fills the width and photos keep their real proportions. */
.justified { --row: 230px; display: flex; flex-wrap: wrap; gap: 10px; }
.justified::after { content: ""; flex-grow: 999999; }
.justified .tile { width: auto; flex-grow: var(--ar, 1); flex-basis: calc(var(--ar, 1) * var(--row)); aspect-ratio: var(--ar, 1); }
@media (max-width: 640px) { .justified { --row: 130px; gap: 6px; } }

.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 32px; }
.chip {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  border-radius: 999px; padding: 7px 16px; font-size: .9rem; cursor: pointer; font-weight: 500;
}
.chip:hover { border-color: var(--accent); }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.chip .n { opacity: .65; margin-left: 4px; font-size: .82em; }

/* ---------- Candles ---------- */
.candles-section {
  background: var(--night); color: var(--night-ink); position: relative; overflow: hidden;
}
.candles-section::before {
  content: ""; position: absolute; left: 50%; top: 40%; width: 900px; height: 500px; transform: translate(-50%, -50%);
  background: radial-gradient(ellipse, rgba(255, 176, 77, 0.10), transparent 65%); pointer-events: none;
}
.candles-section .container { position: relative; }
.candles-section h2 { color: var(--night-ink); }
.candles-section .section-head p { color: color-mix(in srgb, var(--night-ink) 65%, transparent); }
.candle-wall {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 28px 12px;
  max-width: 900px; margin: 0 auto 40px;
}
.candle-item { width: 96px; text-align: center; font-size: .8rem; color: color-mix(in srgb, var(--night-ink) 72%, transparent); line-height: 1.3; }
.candle-item .nm { display: block; margin-top: 10px; overflow-wrap: anywhere; }
.candle-item.new { animation: rise .9s cubic-bezier(.2,.7,.2,1); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.candle { position: relative; width: 30px; height: 78px; margin: 0 auto; }
.candle .wax {
  position: absolute; bottom: 0; left: 0; right: 0; height: 52px; border-radius: 4px 4px 6px 6px;
  background: linear-gradient(90deg, #e9dfcc, #fff9ee 45%, #e3d6be);
  box-shadow: inset 0 -6px 8px rgba(0,0,0,.08);
}
.candle .wax::before { content: ""; position: absolute; top: -3px; left: 0; right: 0; height: 7px; border-radius: 50%; background: #f6eedf; }
.candle .wick { position: absolute; left: 50%; bottom: 52px; width: 2px; height: 7px; margin-left: -1px; background: #3a2b1e; border-radius: 1px; }
.candle .flame {
  position: absolute; left: 50%; bottom: 56px; width: 12px; height: 22px; margin-left: -6px;
  border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%;
  background: radial-gradient(ellipse at 50% 72%, #fff 0 18%, #ffe7a3 32%, #ffb347 60%, rgba(255, 120, 30, .0) 75%);
  transform-origin: 50% 90%;
  animation: flicker 2.6s ease-in-out infinite;
  filter: drop-shadow(0 0 6px rgba(255, 190, 90, .85));
}
.candle .glow {
  position: absolute; left: 50%; bottom: 40px; width: 90px; height: 90px; margin-left: -45px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 190, 90, .28), transparent 65%);
  animation: glow 2.6s ease-in-out infinite; pointer-events: none;
}
.candle-item:nth-child(3n) .flame, .candle-item:nth-child(3n) .glow { animation-duration: 3.1s; animation-delay: -.7s; }
.candle-item:nth-child(4n+1) .flame, .candle-item:nth-child(4n+1) .glow { animation-duration: 2.2s; animation-delay: -1.3s; }
.candle.lg { transform: scale(1.5); margin: 22px auto 30px; }
@keyframes flicker {
  0%, 100% { transform: scale(1, 1) rotate(-1deg); }
  25% { transform: scale(.94, 1.06) rotate(1.5deg); }
  50% { transform: scale(1.04, .95) rotate(-1.5deg); }
  75% { transform: scale(.97, 1.04) rotate(1deg); }
}
@keyframes glow { 0%, 100% { opacity: .85; } 50% { opacity: 1; transform: scale(1.06); } }
.candle-count-big { font-family: var(--serif); font-size: 1.3rem; margin-bottom: 26px; color: color-mix(in srgb, var(--night-ink) 80%, transparent); }
.candle-count-big strong { font-size: 2.2rem; color: #ffd28a; font-weight: 500; margin-right: 6px; }

/* ---------- Prose (life story) ---------- */
.prose { font-size: 1.12rem; line-height: 1.85; color: var(--ink-2); }
.prose > :first-child { margin-top: 0; }
.prose.dropcap > p:first-child::first-letter {
  float: left; font-family: var(--serif); font-size: 4.6em; line-height: .8; margin: .08em .1em 0 0; color: var(--gold);
}
.prose h3, .prose h4 { color: var(--ink); margin: 1.6em 0 .4em; }
.prose h3 { font-size: 1.85rem; }
.prose h4 { font-size: 1.4rem; }
.prose blockquote {
  margin: 1.6em 0; padding: .2em 0 .2em 1.4em; border-left: 2px solid var(--gold);
  font-family: var(--serif); font-style: italic; font-size: 1.35em; line-height: 1.5; color: var(--ink);
}
.prose ul { padding-left: 1.2em; }
.prose strong { color: var(--ink); }

.facts { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px 40px; margin: 0 0 8px; }
.fact { text-align: center; }
.fact small { display: block; font-size: .72rem; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.fact span { font-family: var(--serif); font-size: 1.3rem; color: var(--ink); }

/* Timeline */
.timeline { position: relative; max-width: 760px; margin: 0 auto; padding-left: 0; list-style: none; }
.timeline::before { content: ""; position: absolute; left: 120px; top: 6px; bottom: 6px; width: 1px; background: var(--line); }
.timeline li { display: grid; grid-template-columns: 120px 1fr; gap: 0 36px; padding-bottom: 34px; position: relative; }
.timeline li::before {
  content: ""; position: absolute; left: 120px; top: 12px; width: 11px; height: 11px; margin-left: -5px;
  border-radius: 50%; background: var(--bg); border: 1px solid var(--gold); box-shadow: 0 0 0 4px var(--bg);
}
.section-alt .timeline li::before { background: var(--bg-2); box-shadow: 0 0 0 4px var(--bg-2); }
.timeline .yr { font-family: var(--serif); font-size: 1.6rem; color: var(--gold); text-align: right; padding-right: 24px; line-height: 1.2; }
.timeline h3 { font-size: 1.35rem; margin: 2px 0 4px; }
.timeline p { margin: 0; color: var(--muted); }
@media (max-width: 600px) {
  .timeline::before, .timeline li::before { left: 6px; }
  .timeline li { grid-template-columns: 1fr; padding-left: 32px; }
  .timeline .yr { text-align: left; font-size: 1.35rem; }
}

/* Oriki */
.oriki { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; }
.oriki .yo { font-family: var(--serif); font-style: italic; font-size: 1.4rem; line-height: 1.6; color: var(--ink); white-space: pre-line; }
.oriki .en { color: var(--muted); font-size: 1.05rem; line-height: 1.8; white-space: pre-line; }
.oriki h4 { font-family: var(--sans); font-size: .74rem; letter-spacing: .2em; text-transform: uppercase; color: var(--gold); font-weight: 600; }
@media (max-width: 760px) { .oriki { grid-template-columns: 1fr; gap: 28px; } }

/* ---------- Stories ---------- */
.story { overflow: hidden; margin-bottom: 28px; }
.story-cover { display: block; width: 100%; border: 0; padding: 0; cursor: zoom-in; background: var(--bg-2); }
.story-cover img { width: 100%; max-height: 420px; object-fit: cover; }
.story-body { padding: clamp(24px, 4vw, 40px); }
.story h3 { font-size: clamp(1.7rem, 3vw, 2.2rem); margin-bottom: 6px; }
.story .meta { color: var(--muted); font-size: .92rem; margin-bottom: 18px; }
.story .text { white-space: pre-line; color: var(--ink-2); line-height: 1.8; overflow-wrap: anywhere; }
.story .text.clamped { display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.story .thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; margin-top: 20px; }

/* ---------- Service ---------- */
.events { display: grid; gap: 22px; }
.event { display: grid; grid-template-columns: 120px 1fr; overflow: hidden; }
.event .when {
  background: var(--accent-soft); display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px 10px; text-align: center; font-family: var(--serif); line-height: 1;
}
.event .when .wd { font-family: var(--sans); font-size: .72rem; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.event .when .d { font-size: 3.2rem; color: var(--accent); margin: 6px 0; }
.event .when .m { font-family: var(--sans); font-size: .78rem; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-2); font-weight: 600; }
.event .info { padding: 26px 30px; }
.event h3 { margin-bottom: 8px; }
.event .row { display: flex; gap: 10px; color: var(--ink-2); margin: 4px 0; }
.event .row b { font-weight: 600; color: var(--ink); min-width: 56px; }
.event .notes { margin-top: 12px; color: var(--muted); white-space: pre-line; }
.event .actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.event.past { opacity: .62; }
.event.past .when .d { color: var(--muted); }
@media (max-width: 600px) {
  .event { grid-template-columns: 1fr; }
  .event .when { flex-direction: row; gap: 12px; padding: 14px; justify-content: flex-start; padding-left: 24px; }
  .event .when .d { font-size: 2rem; margin: 0; }
  .event .info { padding: 22px 24px; }
}
.swatches { display: flex; flex-wrap: wrap; gap: 18px; justify-content: center; margin-top: 20px; }
.swatch { text-align: center; font-size: .88rem; color: var(--ink-2); }
.swatch i { display: block; width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 8px; border: 1px solid var(--line); box-shadow: inset 0 0 0 4px var(--surface); }
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 22px; }
.info-card { padding: 30px; }
.info-card h3 { font-size: 1.5rem; }

/* ---------- Forms ---------- */
.compose { padding: clamp(24px, 4vw, 40px); }
.compose h2, .compose h3 { margin-bottom: 4px; }
.compose .hint { color: var(--muted); margin-bottom: 24px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 18px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.field label { display: block; font-size: .86rem; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.field label .opt { font-weight: 400; color: var(--muted); }
.field .help { font-size: .82rem; color: var(--muted); margin-top: 5px; }
.input, .field input[type="text"], .field input[type="email"], .field input[type="password"], .field input[type="url"],
.field input[type="date"], .field input[type="time"], .field select, .field textarea {
  width: 100%; font: inherit; font-size: 1rem; color: var(--ink);
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 11px 14px; transition: border-color .2s, box-shadow .2s, background .2s;
}
.field textarea { min-height: 150px; resize: vertical; line-height: 1.6; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--accent); background: var(--surface);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.form-foot { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; margin-top: 22px; }
.form-foot .note { font-size: .85rem; color: var(--muted); margin: 0; max-width: 32em; }
.ts-slot:empty { display: none; }
.ts-slot { margin-top: 18px; }
.form-error { color: #b3261e; background: color-mix(in srgb, #b3261e 8%, transparent); padding: 10px 14px; border-radius: 10px; margin-top: 16px; font-size: .95rem; }
[data-theme="midnight"] .form-error { color: #ffb4ab; }
.form-success { text-align: center; padding: 24px 12px; }
.form-success .candle.lg { margin: 34px auto 46px; }
.form-success h3 { margin-bottom: 6px; }
.form-success p { color: var(--muted); }

.dropzone, .field label.dropzone {
  font-size: .95rem; font-weight: 400; margin: 0; position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  border: 1.5px dashed var(--line); border-radius: var(--radius); padding: 26px 16px; text-align: center;
  color: var(--muted); cursor: pointer; background: var(--bg); transition: border-color .2s, background .2s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone strong { color: var(--accent); }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.previews { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin-top: 14px; }
.preview { position: relative; border-radius: var(--radius-sm); overflow: hidden; background: var(--bg-2); border: 1px solid var(--line); }
.preview img, .preview video { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.preview .ph { width: 100%; aspect-ratio: 1; display: grid; place-items: center; color: var(--muted); font-size: .85rem; }
.preview input { border: 0; border-top: 1px solid var(--line); border-radius: 0; padding: 8px 10px; font-size: .85rem; width: 100%; background: var(--surface); color: var(--ink); }
.preview .rm {
  position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border-radius: 50%; border: 0;
  background: rgba(0,0,0,.6); color: #fff; cursor: pointer; font-size: 16px; line-height: 1;
}
.progress { height: 6px; border-radius: 6px; background: var(--line); overflow: hidden; margin-top: 16px; }
.progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.progress-label { font-size: .85rem; color: var(--muted); margin-top: 6px; }

.toggle-compose { display: flex; justify-content: center; margin-bottom: 36px; }

/* ---------- Dialogs & lightbox ---------- */
dialog.modal {
  border: 0; padding: 0; border-radius: 20px; width: min(94vw, 460px);
  background: var(--surface); color: var(--ink); box-shadow: 0 30px 80px rgba(0,0,0,.35);
}
dialog.modal::backdrop { background: rgba(10, 8, 6, .62); backdrop-filter: blur(3px); }
.modal-inner { padding: 34px 30px 30px; text-align: center; position: relative; }
.modal-inner h3 { font-size: 1.9rem; margin-bottom: 2px; }
.modal-inner .sub { color: var(--muted); margin-bottom: 20px; }
.modal-inner .field { text-align: left; }
.modal-close {
  position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; border-radius: 50%;
  border: 0; background: transparent; cursor: pointer; font-size: 22px; color: var(--muted);
}
.modal-close:hover { background: var(--bg-2); color: var(--ink); }
.candle-stage { background: var(--night); border-radius: 14px; padding: 6px 0 2px; margin: 0 0 22px; }

.lightbox {
  position: fixed; inset: 0; z-index: 200; background: rgba(8, 7, 6, .94);
  display: grid; grid-template-rows: 1fr auto; color: #f2ece2;
}
.lightbox .stage { position: relative; display: grid; place-items: center; padding: 56px 64px 8px; min-height: 0; }
.lightbox img, .lightbox video { max-width: 100%; max-height: calc(100vh - 150px); object-fit: contain; border-radius: 6px; }
.lightbox iframe { width: min(100%, 1100px); aspect-ratio: 16/9; border: 0; border-radius: 6px; }
.lightbox .cap { text-align: center; padding: 14px 20px 22px; font-size: .95rem; color: #d8d1c5; min-height: 60px; }
.lightbox .cap strong { color: #fff; font-weight: 600; }
.lightbox .cap .count { display: block; font-size: .78rem; letter-spacing: .14em; color: #9c958a; margin-top: 4px; }
.lb-btn {
  position: absolute; z-index: 2; width: 48px; height: 48px; border-radius: 50%; border: 0;
  background: rgba(255,255,255,.08); color: #fff; font-size: 24px; cursor: pointer; display: grid; place-items: center;
}
.lb-btn:hover { background: rgba(255,255,255,.18); }
.lb-close { top: 12px; right: 12px; }
.lb-prev { left: 12px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 12px; top: 50%; transform: translateY(-50%); }
@media (max-width: 640px) {
  .lightbox .stage { padding: 56px 8px 8px; }
  .lb-prev, .lb-next { top: auto; bottom: -58px; transform: none; }
}

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); opacity: 0; z-index: 300;
  background: var(--ink); color: var(--bg); padding: 12px 20px; border-radius: 999px; font-size: .95rem;
  transition: opacity .25s, transform .25s; pointer-events: none; box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Music */
.music-btn {
  position: fixed; left: 18px; bottom: 18px; z-index: 60;
  display: flex; align-items: center; gap: 10px; border-radius: 999px; padding: 8px 16px 8px 8px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); cursor: pointer; color: var(--ink);
  font-size: .85rem; max-width: calc(100vw - 36px);
}
.music-btn .disc { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; flex: none; }
.music-btn .disc svg { width: 14px; height: 14px; }
.music-btn .t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.music-btn[aria-pressed="true"] .disc { animation: spin 4s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.bars { display: inline-flex; gap: 2px; align-items: flex-end; height: 12px; }
.bars i { width: 2px; background: var(--accent); animation: bar 1s ease-in-out infinite; }
.bars i:nth-child(2) { animation-delay: -.3s; } .bars i:nth-child(3) { animation-delay: -.6s; }
@keyframes bar { 0%, 100% { height: 3px; } 50% { height: 12px; } }

/* Anniversary banner */
.remembrance-banner {
  background: var(--accent-soft); color: var(--ink); text-align: center; padding: 12px 20px;
  font-family: var(--serif); font-size: 1.15rem; border-bottom: 1px solid var(--line);
}
.remembrance-banner .i { display: inline-block; vertical-align: -2px; color: var(--gold); margin-right: 6px; }

/* Empty states */
.empty { text-align: center; color: var(--muted); padding: 40px 20px; border: 1px dashed var(--line); border-radius: var(--radius); }
.empty h3 { color: var(--ink-2); font-size: 1.5rem; }
.loading { text-align: center; color: var(--muted); padding: 40px; }
.skeleton { background: linear-gradient(90deg, var(--bg-2), var(--surface), var(--bg-2)); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: var(--radius); }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Footer ---------- */
.site-footer { background: var(--bg-2); border-top: 1px solid var(--line); padding: 64px 0 40px; text-align: center; }
.closing { font-family: var(--serif); font-style: italic; font-size: clamp(1.6rem, 3.4vw, 2.3rem); color: var(--ink); margin: 6px 0 36px; }
.share-block { margin-bottom: 36px; }
.share-buttons { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.share-btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); text-decoration: none;
  font-size: .9rem; font-weight: 500; cursor: pointer;
}
.share-btn:hover { border-color: var(--accent); color: var(--accent); }
.footer-nav { display: flex; flex-wrap: wrap; gap: 6px 22px; justify-content: center; margin-bottom: 18px; }
.footer-nav a { color: var(--muted); text-decoration: none; font-size: .92rem; }
.footer-nav a:hover { color: var(--ink); }
.footer-note { color: var(--muted); font-size: .85rem; margin: 0; }
.footer-note a { color: var(--muted); }

/* Gate (private mode) */
.gate { min-height: 100vh; display: grid; place-items: center; background: var(--hero-bg); color: var(--hero-ink); position: relative; padding: 24px; }
.gate .card { position: relative; z-index: 1; padding: 40px 34px; max-width: 440px; width: 100%; text-align: center; color: var(--ink); }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* ---------- Print: condolence book ---------- */
@media print {
  @page { margin: 18mm 16mm; }
  body { background: #fff; color: #000; font-size: 11.5pt; }
  .site-header, .site-footer, .no-print, .music-btn, .toggle-compose, #compose, .btn, .remembrance-banner, .live-banner, .tshare, #shared-wrap, #family-wrap { display: none !important; }
  .page-hero { background: #fff !important; color: #000; padding: 0 0 18pt; }
  .page-hero h1, .page-hero p.sub { color: #000 !important; }
  .pattern-layer { display: none; }
  .print-title { display: block !important; }
  .tribute-grid { display: block; }
  .tribute { box-shadow: none; border: 0; border-bottom: .5pt solid #bbb; border-radius: 0; padding: 14pt 0; page-break-inside: avoid; }
  .tribute::before { display: none; }
  .tribute .msg.clamped { -webkit-line-clamp: unset; display: block; }
  .tribute .more { display: none; }
  .byline { border: 0; padding-top: 6pt; margin-top: 6pt; }
  .avatar { display: none; }
}
.print-title { display: none; }

/* ---------- Updates, livestream, family tributes, contributions ---------- */
.updates-strip { padding: 36px 0 0; }
.updates-strip + .section { padding-top: clamp(40px, 6vw, 72px) !important; }
.updates-list { display: grid; gap: 16px; }
.update { padding: 22px 26px; border-left: 3px solid var(--gold); }
.update.pinned { background: var(--accent-soft); }
.update-meta { font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
.update h3 { font-size: 1.5rem; margin-bottom: 6px; }
.update-body { white-space: pre-line; color: var(--ink-2); margin-bottom: 14px; }
.update .share-btn { font-size: .82rem; padding: 6px 12px; }

.live-banner {
  display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap;
  padding: 11px 20px; background: #b3261e; color: #fff; text-decoration: none; font-size: .95rem; text-align: center;
}
.live-banner:hover { color: #fff; background: #9c1f18; }
.live-banner.replay { background: var(--accent); color: var(--accent-ink); }
.live-banner.replay:hover { background: var(--accent-hover); color: var(--accent-ink); }
.live-banner .dot, .stream-label .dot { width: 9px; height: 9px; border-radius: 50%; background: #fff; display: inline-block; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

.stream { margin: 16px 0 4px; border-radius: 12px; overflow: hidden; background: #000; aspect-ratio: 16 / 9; }
.stream iframe { width: 100%; height: 100%; border: 0; display: block; }
.stream-poster { position: relative; display: block; width: 100%; height: 100%; padding: 0; border: 0; cursor: pointer; background: #000; }
.stream-poster img { width: 100%; height: 100%; object-fit: cover; opacity: .72; }
.stream-play {
  position: absolute; left: 50%; top: 50%; width: 68px; height: 68px; margin: -34px 0 0 -34px; border-radius: 50%;
  background: rgba(0,0,0,.6); border: 2px solid rgba(255,255,255,.85);
}
.stream-play::before { content: ""; position: absolute; left: 27px; top: 21px; border-left: 20px solid #fff; border-top: 12px solid transparent; border-bottom: 12px solid transparent; }
.stream-label {
  position: absolute; left: 14px; bottom: 14px; display: inline-flex; align-items: center; gap: 8px;
  background: rgba(0,0,0,.66); color: #fff; padding: 6px 12px; border-radius: 999px; font-size: .85rem; font-weight: 600;
}
.stream.is-live .stream-label { background: #b3261e; }
.event.live { border-color: #b3261e; box-shadow: 0 0 0 3px rgba(179,38,30,.12), var(--shadow); }
.live-badge { color: #b3261e; }
.local-time { color: var(--accent) !important; font-size: .95rem; }
.event .row.local-time b { color: var(--accent); }

.tribute .byline { position: relative; }
.tribute .tshare {
  margin-left: auto; align-self: center; width: 34px; height: 34px; border-radius: 50%; flex: none;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer; display: grid; place-items: center;
}
.tribute .tshare:hover { color: var(--accent); border-color: var(--accent); }
.byline .who .behalf { display: block; font-style: italic; }
.tribute.family { border-top: 3px solid var(--gold); }
.tribute.highlight { border-color: var(--gold); box-shadow: 0 0 0 4px color-mix(in srgb, var(--gold) 18%, transparent), var(--shadow); }
.family-wrap { margin-bottom: 64px; }

.accounts { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.account { padding: 22px 24px; }
.acct-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px solid var(--line); }
.acct-row:last-of-type { border-bottom: 0; }
.acct-row span { color: var(--muted); font-size: .88rem; min-width: 120px; }
.acct-row strong { font-weight: 600; }
.acct-row .mono { font-variant-numeric: tabular-nums; letter-spacing: .06em; font-size: 1.1rem; }
.acct-row .btn { margin-left: auto; }
.acct-extra { color: var(--muted); font-size: .9rem; margin: 10px 0 0; white-space: pre-line; }

.lb-play { top: 12px; right: 70px; font-size: 16px; }
.lightbox img.fade { animation: lbfade .6s ease; }
@keyframes lbfade { from { opacity: 0; } to { opacity: 1; } }
.lightbox.playing .cap { opacity: .7; }
.gallery-tools { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin: -16px 0 28px; }
