:root {
  color-scheme: light;
  --ink: #133d40;
  --deep: #0b3d42;
  --teal: #135d62;
  --muted: #4e6663;
  --gold: #987235;
  --gold-line: #d7c39a;
  --cream: #fbf8ef;
  --white: #fffdf8;
  --mist: #e9f0e9;
  --line: #d6ddd0;
  --serif: Georgia, "Times New Roman", serif;
  --sans: "Aptos", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { height: 100%; overflow: hidden; overscroll-behavior: none; }
body { display: grid; place-items: center; height: 100vh; height: 100dvh; margin: 0; overflow: hidden; font: 400 1rem/1.42 var(--sans); background: radial-gradient(ellipse at 50% 20%, #edf0e6 5%, #d6e0d6 85%); color: var(--ink); }
a { color: inherit; }
button { font: inherit; color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a:focus-visible, button:focus-visible, [tabindex="0"]:focus-visible { outline: 3px solid #ae6d19; outline-offset: -3px; }
h1, h2, p, figure, blockquote { margin: 0; }
img { max-width: 100%; }
svg.icon { display: block; width: 1.18rem; height: 1.18rem; flex: 0 0 auto; }
.skip { position: fixed; top: .3rem; left: .3rem; z-index: 10; padding: .6rem .9rem; background: var(--white); transform: translateY(-160%); }
.skip:focus { transform: none; }
.shell { position: relative; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; width: min(100%, 430px); height: 100%; min-height: 0; overflow: clip; background: var(--cream); }
@media (min-width: 490px) {
  .shell { height: min(calc(100dvh - 24px), 850px); border: 1px solid #bec9bb; border-radius: 24px; box-shadow: 0 25px 65px #1c403b26, 0 4px 12px #1c403b14; }
}
.masthead { position: relative; display: grid; place-items: center; padding: max(.47rem, env(safe-area-inset-top)) .85rem .53rem; background: radial-gradient(ellipse at 50% 22%, #333027, #101b1b 57%); color: #fff5de; }
.masthead::after { position: absolute; top: 100%; left: 0; width: 6px; height: 430px; content: ''; background: #164f46 url("assets/textile.png") center top / 6px auto repeat-y; transform: rotate(-90deg) translateX(-6px); transform-origin: top left; pointer-events: none; z-index: 2; }
.brand { display: flex; flex-direction: column; align-items: center; min-height: 44px; gap: .25rem; padding-inline: .38rem; text-decoration: none; }
.brand strong { font: 700 1.23rem/1.14 var(--serif); text-align: center; }
.brand:focus-visible { outline-color: #ffcf83; outline-offset: 2px; }
.memorial-candle { position: relative; display: block; width: 1.7rem; height: 2.05rem; }
.memorial-candle::before { position: absolute; bottom: 0; left: 50%; width: .7rem; height: .93rem; content: ''; border-radius: 38% 34% 13% 13% / 18% 17% 10% 10%; background: linear-gradient(90deg, #b59b70, #fff2d3 45%, #dbc19b 81%, #bda37b); box-shadow: 0 1px 4px #070b0b80; transform: translateX(-50%); }
.memorial-candle::after { position: absolute; bottom: .85rem; left: calc(50% - 1px); width: 2px; height: .28rem; content: ''; background: #4c3220; border-radius: 2px; }
.candle-flame { position: absolute; z-index: 1; bottom: 1.01rem; left: calc(50% - .25rem); width: .5rem; height: .86rem; border-radius: 64% 36% 55% 45% / 76% 70% 30% 24%; background: radial-gradient(ellipse at 50% 76%, #fffcea 0%, #ffe49b 42%, #ffab49 76%, #d8732f 100%); box-shadow: 0 0 .5rem #ffb653ad, 0 0 1.2rem #ffad5675; transform-origin: 50% 100%; }
@media (prefers-reduced-motion: no-preference) {
  .candle-flame { animation: candle-burn 3.1s ease-in-out infinite; }
}
@keyframes candle-burn {
  0%, 100% { transform: rotate(-3deg) scale(1); }
  25% { transform: rotate(5deg) scale(.96, 1.06); }
  55% { transform: rotate(-5deg) scale(1.04, .95); }
  78% { transform: rotate(2deg) scale(.98, 1.03); }
}
.screen { position: relative; min-height: 0; overflow: clip; }
.screen:focus { outline: none; }
.bottom-nav { position: relative; z-index: 2; display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: .14rem; padding: .31rem max(.25rem, env(safe-area-inset-right)) max(.33rem, env(safe-area-inset-bottom)) max(.25rem, env(safe-area-inset-left)); border-top: 1px solid #b39b65; background: var(--deep); }
.bottom-nav:has(#sound-toggle:not([hidden])) { grid-template-columns: minmax(0, 1fr) minmax(0, 1.18fr) repeat(3, minmax(0, 1fr)) minmax(45px, .83fr); }
.bottom-nav :is(a, button) { display: flex; min-height: 50px; flex-direction: column; align-items: center; justify-content: center; gap: .27rem; padding: .15rem .04rem; border: 1px solid transparent; border-radius: 8px; color: #f1f4e8; font-size: clamp(.58rem, 2.55vw, .7rem); font-weight: 650; line-height: 1.1; text-decoration: none; text-align: center; overflow-wrap: anywhere; }
.bottom-nav :is(a, button):hover { background: #ffffff20; }
.bottom-nav a[aria-current] { background: #f4e9cf; color: var(--deep); border-color: #d8c091; font-weight: 780; }
#sound-toggle { background: #23524f; border-color: #739487; color: #fff1d2; cursor: pointer; }
#sound-toggle[data-playing="true"] { background: #385b4a; border-color: #d7bd83; }
.nav-icon svg { width: 1.2rem; height: 1.2rem; }
.home { display: grid; grid-template-rows: minmax(0,1fr) auto; height: 100%; }
.portrait { display: grid; grid-template-rows: minmax(0, 1fr) auto; min-height: 0; overflow: hidden; background: #102d25; }
.portrait-stage { position: relative; min-height: 0; overflow: hidden; }
.portrait-stage > :is(svg, img) { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: contain; }
.portrait-year { padding: .3rem .5rem .45rem; color: #fff4de; font: 600 clamp(1.85rem, 7.8vw, 2.65rem)/1.05 var(--serif); letter-spacing: .045em; text-align: center; white-space: nowrap; }
.portrait-year span { color: #d9bd82; font-weight: 400; }
.home-content { position: relative; text-align: center; padding: .9rem .72rem .95rem; background: linear-gradient(#fffdf8, var(--cream)); border-top: 1px solid var(--gold-line); }
.eyebrow { color: var(--teal); font-size: .61rem; font-weight: 780; letter-spacing: .15em; text-transform: uppercase; }
.home h1 { margin: .28rem 0 .24rem; font: 500 clamp(1.55rem, 6.6vw, 2.14rem)/1.06 var(--serif); letter-spacing: -.04em; }
.home h1 span { color: var(--deep); font-weight: 700; }
.memorial-name { color: var(--muted); font-size: .73rem; }
.home-date { margin: .49rem 0 .36rem; font-size: .78rem; font-weight: 730; color: var(--deep); }
.home-date span { margin-inline: .22rem; color: var(--gold); }
.home-quote { font: italic .83rem/1.3 var(--serif); color: var(--muted); }
.home-quote span { font-size: .7rem; white-space: nowrap; }
.page { display: grid; grid-template-rows: auto auto minmax(0,1fr); width: 100%; height: 100%; min-height: 0; padding: .45rem .77rem .66rem; }
.back { justify-self: start; display: inline-flex; align-items: center; gap: .16rem; min-height: 40px; color: var(--teal); text-decoration: none; font-weight: 730; font-size: .76rem; }
.back .icon { width: .94rem; height: .94rem; }
.page-head { margin: 0 0 .65rem; }
.page h1 { margin: .15rem 0 .18rem; font: 500 clamp(1.48rem, 6.1vw, 1.92rem)/1.06 var(--serif); letter-spacing: -.028em; }
.page-sub, .note { font-size: .74rem; color: var(--muted); line-height: 1.34; }
.note { margin-top: .4rem; }
.page-body { display: flex; flex-direction: column; min-height: 0; gap: .38rem; overflow: clip; }
.tabs { display: grid; flex: 0 0 auto; gap: .3rem; margin-bottom: .1rem; }
.tabs.days { grid-template-columns: repeat(4, minmax(0,1fr)); }
.tabs.pair { grid-template-columns: repeat(2, minmax(0,1fr)); }
.tab { display: grid; place-content: center; min-height: 44px; padding: .28rem .12rem; text-align: center; text-decoration: none; border: 1px solid var(--line); border-radius: 7px; background: var(--white); font-size: .77rem; font-weight: 730; line-height: 1.06; }
.tab small { margin-bottom: .14rem; font-size: .64rem; }
.tab[aria-current] { color: var(--white); background: var(--deep); border-color: var(--deep); }
.paged, .map-panel, .gallery { display: flex; flex-direction: column; flex: 1; min-height: 0; gap: .34rem; }
.deck { flex: 1; min-height: 0; overflow: clip; }
.card-list { display: grid; align-content: start; gap: .32rem; }
.schedule-row, .list-row { display: flex; align-items: center; gap: .43rem; min-height: 48px; padding: .39rem .52rem; text-decoration: none; background: var(--white); border: 1px solid var(--line); border-radius: 7px; }
.schedule-row:hover, .list-row:hover { border-color: var(--teal); }
.schedule-row strong, .list-row strong { display: block; font-weight: 730; font-size: .78rem; line-height: 1.18; overflow-wrap: anywhere; }
.schedule-row small, .list-row small { display: block; font-size: .68rem; color: var(--muted); margin-top: .14rem; line-height: 1.22; }
.schedule-row > .icon, .list-row > .icon { margin-left: auto; width: .84rem; height: .84rem; }
.time { flex: 0 0 3.4rem; color: var(--teal); font-weight: 770; font-size: .69rem; line-height: 1.19; padding-right: .3rem; border-right: 1px solid var(--line); }
.detail-card, .reading, .condolence-card { padding: .72rem; background: var(--white); border: 1px solid var(--line); border-radius: 8px; }
.detail-card { font-size: .84rem; }
.detail-card p + p, .reading p + p { margin-top: .65rem; }
.detail-card h2 { font: 500 1.21rem/1.1 var(--serif); margin: .22rem 0 .46rem; }
.reading { font: 400 .99rem/1.46 var(--serif); overflow-wrap: anywhere; }
.action { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; gap: .35rem; padding: .49rem .63rem; border: 1px solid var(--deep); border-radius: 7px; text-decoration: none; background: var(--deep); color: var(--white); font-size: .77rem; font-weight: 730; cursor: pointer; }
.action:hover { background: #14555a; }
.action.secondary { background: var(--white); color: var(--deep); border-color: var(--line); }
.action.secondary:hover { background: var(--mist); }
.action:disabled { opacity: .48; cursor: default; }
.action-row { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .48rem; }
.full { width: 100%; }
.pager { flex: 0 0 auto; display: flex; justify-content: space-between; align-items: center; gap: .4rem; min-height: 44px; }
.pager .action { min-width: 46px; }
.counter { color: var(--muted); font-size: .72rem; font-weight: 720; font-variant-numeric: tabular-nums; }
.map-crop { display: grid; place-items: center; width: 100%; height: 100%; min-height: 0; overflow: clip; }
.map-crop svg { display: block; width: 100%; height: 100%; }
.map-teaser, .map-window { display: block; flex: 1; min-height: 0; overflow: clip; border: 1px solid var(--gold-line); border-radius: 8px; background: #e6eee0; }
.map-teaser { margin-block: .18rem; }
.map-controls { flex: 0 0 auto; display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: .28rem; }
.map-controls .action { padding-inline: .2rem; font-size: .68rem; text-align: center; }
.map-controls .action[aria-pressed="true"] { color: var(--white); background: var(--deep); border-color: var(--deep); }
.memory-actions { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .43rem; }
.tile { display: flex; min-height: 64px; align-items: center; gap: .37rem; padding: .49rem .42rem; border: 1px solid var(--line); border-radius: 8px; background: var(--white); text-decoration: none; }
.tile:hover { border-color: var(--teal); }
.tile-icon { display: grid; width: 25px; height: 25px; place-items: center; flex: 0 0 auto; color: var(--teal); background: var(--mist); border-radius: 5px; }
.tile-icon .icon { width: .9rem; height: .9rem; }
.tile strong { display: block; line-height: 1.12; font-size: .76rem; font-weight: 750; }
.tile small { display: block; margin-top: .17rem; font-size: .62rem; line-height: 1.12; color: var(--muted); }
.tile > .icon { margin-left: auto; width: .72rem; height: .72rem; }
.gallery-frame { display: grid; flex: 1; min-height: 0; place-items: center; overflow: clip; border: 1px solid #284d47; border-radius: 8px; background: #163d3d; touch-action: pan-y; }
.gallery-frame img { display: block; width: 100%; height: 100%; max-height: 100%; min-height: 0; object-fit: contain; }
.booklet { display: flex; flex-direction: column; flex: 1; gap: .44rem; min-height: 0; }
.booklet-cover { flex: 1; min-height: 0; display: grid; place-items: center; }
.booklet img { display: block; max-height: 100%; width: 100%; height: 100%; min-height: 0; object-fit: contain; }
.booklet .action-row { margin-top: 0; flex: 0 0 auto; }
.condolence-card { font-size: .82rem; }
.condolence-card .symbol { display: grid; place-items: center; width: 38px; height: 38px; background: var(--mist); border-radius: 50%; margin-bottom: .43rem; }
.condolence-card blockquote { margin: .58rem 0; padding-left: .55rem; border-left: 2px solid var(--gold-line); font: 400 .96rem/1.36 var(--serif); }
.no-script { position: fixed; z-index: 4; bottom: 5rem; left: 1rem; right: 1rem; background: var(--white); padding: 1rem; border: 1px solid var(--line); }
@media (max-height: 580px) {
  .masthead { padding-top: max(.32rem, env(safe-area-inset-top)); padding-bottom: .38rem; }
  .bottom-nav :is(a, button) { min-height: 45px; }
  .page { padding-top: .34rem; padding-bottom: .48rem; }
  .back { min-height: 34px; }
  .page-head { margin-bottom: .48rem; }
  .home-content { padding-block: .63rem; }
  .tile > .icon { display: none; }
}
@media (max-height: 440px) {
  .home-quote, .home .eyebrow { display: none; }
  .page h1 { font-size: 1.28rem; }
  .page-head { margin-bottom: .34rem; }
  .reading, .detail-card { padding: .46rem; }
  .booklet .action-row { justify-content: center; }
}
