/* Celebrating EEU — memorial site
   Palette taken from the family's seal and funeral artwork: ivory paper, forest green, burnished gold. */
:root {
  --ivory: #F7F2E6;
  --paper: #FCF9F2;
  --forest: #14301F;
  --forest-deep: #0D2216;
  --gold: #A9843A;
  --gold-light: #D8BD7E;
  --ink: #1D2721;
  --muted: #5B655E;
  --rule: rgba(169, 132, 58, .38);
  --display: "Cormorant Garamond", "Cormorant", Garamond, "Times New Roman", serif;
  --text: "Source Serif 4", "Source Serif Pro", Georgia, "Times New Roman", serif;
  --wrap: 1180px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(76px + var(--safe-t)); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ivory);
  color: var(--ink);
  font-family: var(--text);
  font-size: 1.0625rem;
  line-height: 1.7;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  padding-bottom: var(--safe-b);
}
[hidden] { display: none !important; }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
h1, h2, h3 { text-wrap: balance; font-family: var(--display); font-weight: 500; line-height: 1.1; margin: 0; letter-spacing: -.005em; }
p { margin: 0 0 1em; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 2px; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 1rem; top: -4rem; background: var(--gold-light); color: var(--forest); padding: .6rem 1rem; z-index: 100; text-decoration: none; }
.skip:focus { top: calc(1rem + var(--safe-t)); }
.wrap { width: min(100% - 2.5rem, var(--wrap)); margin-inline: auto; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: .7rem 1.5rem;
  font-family: var(--text); font-size: 1rem; font-weight: 600; letter-spacing: .01em;
  text-decoration: none; border: 1px solid transparent; border-radius: 2px; cursor: pointer;
  transition: background-color .2s, color .2s, border-color .2s;
}
.btn--sm { min-height: 38px; padding: .4rem 1rem; font-size: .9rem; }
.btn--gold { background: var(--gold-light); color: var(--forest-deep); }
.btn--gold:hover { background: #E6CF97; }
.btn--ghost { border-color: rgba(216, 189, 126, .55); color: var(--ivory); }
.btn--ghost:hover { border-color: var(--gold-light); background: rgba(216, 189, 126, .08); }
.btn--forest { background: var(--forest); color: var(--ivory); }
.btn--forest:hover { background: var(--forest-deep); }
.btn--forest[disabled] { opacity: .6; cursor: progress; }
.btn--line { border-color: var(--rule); color: var(--forest); background: transparent; }
.btn--line:hover { border-color: var(--gold); }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; }

/* ---------- Top bar ---------- */
.bar {
  position: fixed; inset: 0 0 auto; z-index: 50;
  display: flex; align-items: center; gap: 1.5rem;
  padding: calc(.6rem + var(--safe-t)) 1.25rem .6rem;
  background: rgba(13, 34, 22, .94);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(216, 189, 126, .2);
  color: var(--ivory);
  transform: translateY(-110%); transition: transform .35s ease;
}
.bar.is-on { transform: none; }
.bar__home { display: flex; align-items: center; gap: .7rem; text-decoration: none; font-family: var(--display); font-size: 1.2rem; font-weight: 500; white-space: nowrap; }
.bar__nav { display: flex; gap: 1.6rem; margin-left: auto; font-size: .95rem; }
.bar__nav a { text-decoration: none; color: rgba(247, 242, 230, .78); }
.bar__nav a:hover { color: var(--gold-light); }
@media (max-width: 900px) { .bar__nav { display: none; } .bar .btn { margin-left: auto; } }
@media (max-width: 480px) { .bar__home span { display: none; } }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  background:
    radial-gradient(60% 70% at 28% 50%, rgba(169, 132, 58, .16), transparent 70%),
    var(--forest);
  color: var(--ivory);
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  align-items: center; gap: clamp(1.5rem, 4vw, 4.5rem);
  min-height: min(100svh, 860px);
  padding: calc(3rem + var(--safe-t)) clamp(1.25rem, 5vw, 5rem) 4rem;
}
.hero__art { position: relative; width: min(100%, 600px); aspect-ratio: 1; justify-self: center; display: grid; place-items: center; }
.rosette { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.rosette circle { fill: none; stroke: var(--gold-light); stroke-opacity: .32; stroke-width: .9; vector-effect: non-scaling-stroke; }
.hero__portrait {
  position: relative; margin: 0; width: 58%; aspect-ratio: 1; border-radius: 50%;
  padding: 7px; background: var(--forest);
  box-shadow: 0 0 0 1.5px var(--gold-light), 0 30px 60px -20px rgba(0, 0, 0, .55);
}
.hero__portrait img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

.hero__text { max-width: 34rem; }
.hero__honour { font-family: var(--display); font-style: italic; font-size: clamp(1.35rem, 2.2vw, 1.7rem); color: var(--gold-light); margin-bottom: .4rem; }
.hero__name { font-size: clamp(2.9rem, 6.2vw, 5.4rem); font-weight: 500; line-height: .98; letter-spacing: -.015em; }
.hero__con { font-size: .55em; color: var(--gold-light); letter-spacing: .02em; }
.hero__dates { margin: 1.6rem 0 .5rem; padding-top: 1.2rem; border-top: 1px solid rgba(216, 189, 126, .45); width: fit-content; font-size: 1.08rem; letter-spacing: .02em; color: rgba(247, 242, 230, .88); }
.hero__roles { font-family: var(--display); font-style: italic; font-size: 1.3rem; color: rgba(247, 242, 230, .72); margin-bottom: 2rem; }
.hero__actions { display: flex; flex-wrap: wrap; gap: .8rem; }
.hero__count { margin: 1.4rem 0 0; font-size: .95rem; }
.hero__count a { color: var(--gold-light); text-underline-offset: 4px; text-decoration-color: rgba(216, 189, 126, .4); }

/* The single orchestrated moment: the rosette draws itself around the portrait. */
@media (prefers-reduced-motion: no-preference) {
  .rosette circle { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 2.4s cubic-bezier(.5, 0, .2, 1) forwards; animation-delay: calc(var(--i) * 45ms + .2s); }
  .hero__portrait { animation: rise 1.4s ease .1s both; }
  .hero__text { animation: rise 1.4s ease .5s both; }
  @keyframes draw { to { stroke-dashoffset: 0; } }
  @keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
}

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; text-align: center; min-height: auto; padding-top: calc(2.5rem + var(--safe-t)); gap: .5rem; }
  .hero__art { width: min(100%, 420px); }
  .hero__text { margin-inline: auto; }
  .hero__dates { margin-inline: auto; }
  .hero__actions { justify-content: center; }
}

/* ---------- Remembrance ---------- */
.remember { background: var(--ivory); padding: clamp(4rem, 9vw, 7.5rem) 1.25rem; }
.remember__inner { max-width: 40rem; margin: 0 auto; text-align: center; font-family: var(--display); font-size: clamp(1.35rem, 2.4vw, 1.75rem); line-height: 1.5; color: var(--forest); }
.remember__inner p { margin-bottom: 1.2em; text-wrap: balance; }
.remember__last { font-style: italic; color: var(--gold); margin-bottom: 0 !important; }

/* ---------- Section heads ---------- */
.sec-head { max-width: 40rem; margin-bottom: clamp(2.5rem, 5vw, 3.75rem); }
.sec-head h2 { font-size: clamp(2.3rem, 4.6vw, 3.6rem); color: var(--forest); margin-bottom: .9rem; }
.sec-head p { color: var(--muted); font-size: 1.08rem; margin: 0; }
.sec-head--light h2 { color: var(--ivory); }
.sec-head--light p { color: rgba(247, 242, 230, .7); }

/* ---------- Timeline ---------- */
.life { background: var(--paper); padding: clamp(4rem, 8vw, 6.5rem) 0; border-top: 1px solid var(--rule); }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 2.5rem; }
.timeline li { display: grid; grid-template-columns: 4.6rem 1fr; gap: 1rem; padding: 1.05rem 0; border-top: 1px solid var(--rule); }
.timeline__year { font-family: var(--display); font-size: 1.6rem; line-height: 1.1; color: var(--gold); font-weight: 600; font-variant-numeric: oldstyle-nums; }
.timeline p { margin: 0; font-size: .97rem; line-height: 1.55; }
@media (max-width: 1000px) { .timeline { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .timeline { grid-template-columns: 1fr; } }

/* ---------- Story ---------- */
.story { background: var(--ivory); padding: clamp(4rem, 8vw, 6.5rem) 0; }
.story__grid { max-width: 66rem; display: grid; grid-template-columns: 15rem minmax(0, 1fr); gap: clamp(2rem, 6vw, 6rem); align-items: start; }
.story__toc { position: sticky; top: calc(96px + var(--safe-t)); }
.story__toc h2 { font-size: 2.4rem; color: var(--forest); margin-bottom: 1.2rem; }
.story__toc ol { list-style: none; margin: 0; padding: 0; counter-reset: ch; }
.story__toc li { counter-increment: ch; }
.story__toc a { display: grid; grid-template-columns: 2rem 1fr; padding: .38rem 0; text-decoration: none; color: var(--muted); font-size: .95rem; line-height: 1.4; }
.story__toc a::before { content: counter(ch, upper-roman); font-family: var(--display); color: var(--gold); font-weight: 600; }
.story__toc a:hover, .story__toc a.is-current { color: var(--forest); }
.story__body { max-width: 41rem; }
.chapter { padding-bottom: 3rem; margin-bottom: 3rem; border-bottom: 1px solid var(--rule); }
.chapter--last { border-bottom: 0; margin-bottom: 0; }
.chapter__num { font-family: var(--display); font-size: 1.15rem; font-weight: 600; color: var(--gold); margin-bottom: .2rem; letter-spacing: .08em; }
.chapter h3 { font-size: clamp(2rem, 3.6vw, 2.7rem); color: var(--forest); margin-bottom: 1.3rem; }
.chapter h3 span { display: block; font-size: .5em; font-style: italic; color: var(--muted); margin-top: .35rem; font-weight: 400; }
.chapter .lede { font-size: 1.2rem; line-height: 1.65; }
.chapter p { hyphens: auto; }
.chapter__more { animation: open .45s ease; }
@keyframes open { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.more-btn {
  background: none; border: 0; padding: .2rem 0; cursor: pointer;
  font: 600 .98rem var(--text); color: var(--forest);
  text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 5px; text-decoration-thickness: 1px;
}
.more-btn:hover { color: var(--gold); }
.pull { margin: 2.2rem 0; padding: 0 0 0 1.6rem; border-left: 2px solid var(--gold); }
.pull p { font-family: var(--display); font-style: italic; font-size: clamp(1.6rem, 3vw, 2.1rem); line-height: 1.3; color: var(--forest); margin-bottom: .6rem; }
.pull footer { font-size: .92rem; color: var(--muted); }
.epitaph { font-family: var(--display); font-style: italic; font-size: 1.55rem; color: var(--gold); margin-top: 1.6rem; }
@media (max-width: 860px) {
  .story__grid { grid-template-columns: 1fr; }
  .story__toc { position: static; }
  .story__toc ol { columns: 2; column-gap: 1.5rem; }
}
@media (max-width: 480px) { .story__toc ol { columns: 1; } }

/* ---------- Legacy ---------- */
.legacy { background: var(--forest); color: var(--ivory); padding: clamp(4rem, 8vw, 6.5rem) 0; position: relative; }
.ledger { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2.6rem 2.2rem; margin: 0; }
.ledger div { border-top: 1px solid rgba(216, 189, 126, .4); padding-top: 1.1rem; }
.ledger dt { font-family: var(--display); font-size: clamp(2.3rem, 3.8vw, 3.1rem); line-height: 1; color: var(--gold-light); font-weight: 500; margin-bottom: .6rem; font-variant-numeric: lining-nums; }
.ledger dd { margin: 0; font-size: .97rem; line-height: 1.55; color: rgba(247, 242, 230, .78); }
@media (max-width: 1000px) { .ledger { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .ledger { grid-template-columns: 1fr; } }

/* ---------- Gallery ---------- */
.gallery { background: var(--paper); padding: clamp(4rem, 8vw, 6.5rem) 0; }
.gallery__grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .9rem; }
.gallery__item { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; aspect-ratio: 4 / 5; overflow: hidden; }
.gallery__item img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.gallery__item:hover img { transform: scale(1.03); }
.lightbox { border: 0; padding: 0; background: transparent; max-width: min(94vw, 1100px); max-height: 92vh; }
.lightbox::backdrop { background: rgba(8, 20, 13, .92); }
.lightbox figure { margin: 0; }
.lightbox img { max-height: 82vh; width: auto; margin: 0 auto; }
.lightbox figcaption { color: var(--ivory); text-align: center; padding: .8rem; font-style: italic; }
.lightbox__close { position: fixed; top: calc(1rem + var(--safe-t)); right: 1rem; width: 48px; height: 48px; border-radius: 50%; border: 1px solid rgba(216,189,126,.5); background: transparent; color: var(--ivory); font-size: 1.8rem; cursor: pointer; }

/* ---------- Arrangements ---------- */
.arr { background: var(--ivory); padding: clamp(4rem, 8vw, 6.5rem) 0; }
.events { list-style: none; margin: 0; padding: 0; max-width: 58rem; }
.event { display: grid; grid-template-columns: 15rem 1fr; gap: 2rem; padding: 2.2rem 0; border-top: 1px solid var(--rule); position: relative; }
.event:last-child { border-bottom: 1px solid var(--rule); }
.event::before { content: "✦"; position: absolute; top: -.72rem; left: 0; font-size: .85rem; color: var(--gold); background: var(--ivory); padding-right: .6rem; line-height: 1.4; }
.event__day { display: block; font-family: var(--display); font-style: italic; font-size: 1.3rem; color: var(--gold); }
.event__date { display: block; font-family: var(--display); font-size: 1.9rem; line-height: 1.15; color: var(--forest); font-weight: 500; }
.event__time { display: block; margin-top: .3rem; font-weight: 600; color: var(--ink); }
.event h3 { font-size: clamp(1.8rem, 3vw, 2.3rem); color: var(--forest); margin-bottom: .6rem; }
.event p { color: var(--muted); }
.event__links { display: flex; flex-wrap: wrap; gap: .4rem 1.6rem; }
.event__links a, .event__links .linkbtn { font-weight: 600; font-size: .95rem; color: var(--forest); text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 5px; min-height: 32px; }
@media (max-width: 640px) { .event { grid-template-columns: 1fr; gap: .8rem; } }

/* ---------- Tributes ---------- */
.tributes { background: var(--paper); padding: clamp(4rem, 8vw, 6.5rem) 0; border-top: 1px solid var(--rule); }
.tributes__grid { display: grid; grid-template-columns: minmax(0, 25rem) minmax(0, 1fr); gap: clamp(2.5rem, 6vw, 5.5rem); align-items: start; }
.write h2 { font-size: clamp(2.3rem, 4.6vw, 3.4rem); color: var(--forest); margin-bottom: .9rem; }
.write__intro { color: var(--muted); margin-bottom: 1.8rem; }
.form { display: grid; gap: 1.1rem; }
.field { display: grid; gap: .35rem; }
.field-row { display: grid; gap: 1.1rem; }
.field label { font-weight: 600; font-size: .93rem; color: var(--forest); }
.opt { font-weight: 400; color: var(--muted); font-style: italic; }
.field input, .field select, .field textarea, .wall__filters select, .wall__filters input {
  width: 100%; font: 400 1rem/1.5 var(--text); color: var(--ink);
  background: #fff; border: 1px solid #CFC6B2; border-radius: 2px; padding: .7rem .8rem; min-height: 46px;
}
.field textarea { resize: vertical; min-height: 10rem; line-height: 1.6; }
.field input[type="file"] { padding: .55rem .6rem; font-size: .93rem; cursor: pointer; }
.field__hint { margin: 0; font-size: .86rem; color: var(--muted); }
.field input:focus, .field select:focus, .field textarea:focus, .wall__filters select:focus, .wall__filters input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(169, 132, 58, .22); }
.field [aria-invalid="true"] { border-color: #A3402F; }
.field__meta { margin: 0; font-size: .82rem; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.field__err { margin: 0; font-size: .88rem; color: #A3402F; min-height: 0; }
.field__err:empty { display: none; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form .btn { justify-self: start; min-width: 12rem; }
.form__status { margin: 0; font-size: .98rem; }
.form__status:empty { display: none; }
.form__status.is-ok { padding: 1rem 1.1rem; background: rgba(20, 48, 31, .06); border-left: 3px solid var(--forest); color: var(--forest); }
.form__status.is-err { color: #A3402F; }
.share { margin-top: 2rem; background: none; border: 0; padding: 0; font: 600 .95rem var(--text); color: var(--forest); cursor: pointer; text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 5px; }

.wall__tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; padding-bottom: 1.2rem; border-bottom: 1px solid var(--forest); }
.wall__count { margin: 0; font-family: var(--display); font-size: 1.45rem; color: var(--forest); }
.wall__filters { display: flex; gap: .6rem; flex-wrap: wrap; }
.wall__filters select { width: auto; min-height: 42px; padding: .45rem .7rem; font-size: .95rem; }
.wall__filters input { width: 14rem; min-height: 42px; padding: .45rem .7rem; font-size: .95rem; }
@media (max-width: 520px) { .wall__filters, .wall__filters input, .wall__filters select { width: 100%; } }
.wall__list { list-style: none; margin: 0; padding: 0; }
.trib { padding: 2rem 0; border-bottom: 1px solid var(--rule); }
.trib--featured { background: var(--ivory); padding: 2rem 1.6rem; border-left: 3px solid var(--gold); margin-top: 1.2rem; border-bottom: 0; }
.trib--new { animation: arrive .8s ease; }
@keyframes arrive { from { background: rgba(216, 189, 126, .35); } to { background: transparent; } }
.trib__pin { font-family: var(--display); font-style: italic; color: var(--gold); font-size: 1.05rem; margin-bottom: .6rem; }
.trib__msg { white-space: pre-line; font-size: 1.04rem; line-height: 1.75; margin-bottom: 1.1rem; }
.trib__msg.is-clamped { display: -webkit-box; -webkit-line-clamp: 9; -webkit-box-orient: vertical; overflow: hidden; }
.trib__toggle { background: none; border: 0; padding: 0; margin: -.4rem 0 1rem; font: 600 .92rem var(--text); color: var(--forest); cursor: pointer; text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 4px; }
.trib__file { display: inline-block; margin: 0 0 1.1rem; font-weight: 600; font-size: .95rem; color: var(--forest); text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 4px; }
.trib__name { font-family: var(--display); font-size: 1.45rem; font-weight: 600; color: var(--forest); line-height: 1.2; margin: 0; }
.trib__title { margin: .1rem 0 0; color: var(--ink); font-size: .95rem; }
.trib__meta { margin: .2rem 0 0; color: var(--muted); font-size: .88rem; }
.wall__empty { padding: 2.5rem 0; color: var(--muted); font-style: italic; }
#wall-more { margin-top: 2rem; }
@media (max-width: 900px) { .tributes__grid { grid-template-columns: 1fr; } }

/* ---------- Footer ---------- */
.foot { background: var(--forest-deep); color: var(--ivory); text-align: center; padding: 4.5rem 1.25rem calc(3.5rem + var(--safe-b)); }
.foot img { width: 110px; margin: 0 auto 1.6rem; }
.foot__rip { font-family: var(--display); font-style: italic; font-size: clamp(1.6rem, 3vw, 2.1rem); color: var(--gold-light); margin-bottom: .4rem; }
.foot__by { color: rgba(247, 242, 230, .6); margin: 0; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media print {
  .bar, .hero__actions, .write form, .wall__tools, #wall-more, .share, .more-btn { display: none !important; }
  .chapter__more[hidden] { display: block !important; }
  .hero, .legacy, .foot { background: #fff !important; color: #000 !important; }
}
