.grave-page {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    font-family: "Segoe UI", system-ui, sans-serif;
    background: #e4e6ea;
    color: #1a1a1a;
    box-sizing: border-box;
}

.grave-page--has-map {
    background: transparent;
}

.grave-page *,
.grave-page *::before,
.grave-page *::after {
    box-sizing: border-box;
}


.grave-map-wrap {
    position: fixed;
    inset: 0;
    z-index: 0;
    background: #dfe3e8;
}

.grave-map {
    width: 100%;
    height: 100%;
}

.grave-map-pin {
    background: transparent !important;
    border: 0 !important;
}

.grave-map-pin__wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 220px;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.35));
}

.grave-map-pin__bubble {
    background: #146c43;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.25;
    padding: .4rem .7rem;
    border-radius: 10px;
    white-space: nowrap;
    max-width: 218px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.grave-map-pin__needle {
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 10px solid #146c43;
    margin-top: -1px;
}

.grave-map-legend {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 400;
    background: rgba(255, 255, 255, 0.94);
    border-radius: 8px;
    padding: .4rem .6rem;
    font-size: .72rem;
    display: flex;
    gap: .55rem;
    flex-wrap: wrap;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}


.grave-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 500;
    max-height: 42vh;
    background: #f3f4f6;
    border-radius: 22px 22px 0 0;
    box-shadow: 0 -6px 28px rgba(0, 0, 0, 0.14);
    display: flex;
    flex-direction: column;
    transition: max-height 0.35s ease;
    overflow: hidden;
}

.grave-panel--has-bg {
    --grave-frame-radius: 12px;
    background: transparent !important;
    border-radius: var(--grave-frame-radius);
    border: 2px solid rgba(255, 255, 255, 0.92);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.grave-panel--has-bg .grave-panel__bg {
    border-radius: calc(var(--grave-frame-radius) - 2px);
    overflow: hidden;
}

.grave-panel__bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.grave-panel__bg img,
.grave-panel__bg video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    display: block;
}

.grave-panel__bg--video video {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 1s ease-in-out;
}

.grave-panel__bg--video video.is-active {
    opacity: 1;
}

.grave-panel--has-bg .grave-panel__handle,
.grave-panel--has-bg .grave-panel__scroll {
    position: relative;
    z-index: 2;
}

.grave-panel.is-expanded {
    max-height: 92vh;
    max-height: 92dvh;
}

.grave-panel__handle {
    flex-shrink: 0;
    padding: .55rem 0 .25rem;
    cursor: pointer;
    text-align: center;
}

.grave-arrow {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-left: 2.5px solid #146c43;
    border-top: 2.5px solid #146c43;
    transform: rotate(45deg);
    transition: transform 0.25s ease;
}

.grave-panel.is-expanded .grave-arrow {
    transform: rotate(225deg);
}

.grave-panel__scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 0 1.15rem 1.5rem;
    scrollbar-gutter: stable;
}

.grave-panel__inner {
    width: 100%;
    max-width: 380px;
    margin: 0 auto;
}


.grave-panel-top {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 1.35rem;
    padding-top: .15rem;
    text-align: center;
}

.grave-home-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    line-height: 0;
}

.grave-home-logo img,
.grave-home-logo .app-logo {
    width: clamp(130px, 26vw, 220px);
    height: auto;
    max-width: min(100%, 240px);
    aspect-ratio: 1 / 1;
    object-fit: contain;
}


.grave-hero {
    text-align: center;
    margin-bottom: 1rem;
}

.grave-person-name {
    margin: 0;
    font-size: clamp(1.25rem, 4.5vw, 1.55rem);
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #111;
    line-height: 1.3;
}

.grave-person-years {
    margin: .45rem 0 0;
    font-size: 1rem;
    font-weight: 600;
    color: #111;
    letter-spacing: 0.06em;
}

.grave-person-views {
    margin: .85rem 0 0;
    font-size: .8rem;
    font-weight: 650;
    color: #146c43;
    letter-spacing: .01em;
}

.grave-panel--has-bg .grave-person-views {
    color: #0d5234;
}

.grave-location {
    margin: 0;
}

.grave-location__row {
    display: grid;
    grid-template-columns: minmax(5.5rem, 38%) 1fr;
    gap: .35rem .75rem;
    padding: .45rem 0;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.grave-location__row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.grave-location__row:first-child {
    padding-top: 0;
}

.grave-location dt {
    margin: 0;
    font-size: .84rem;
    color: #64748b;
    font-weight: 500;
}

.grave-location dd {
    margin: 0;
    font-size: .95rem;
    color: #0f172a;
}

.grave-location dd strong {
    color: var(--grave-green, #0c6b42);
    font-weight: 700;
}

.grave-location__sub {
    display: block;
    margin-top: .15rem;
    font-size: .84rem;
    color: #64748b;
    font-weight: 400;
}

.grave-location__actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-top: 1rem;
}

.grave-loc-btn {
    appearance: none;
    border: 1px solid rgba(20, 108, 67, 0.3);
    background: rgba(255, 255, 255, 0.92);
    color: #146c43;
    font: inherit;
    font-size: .84rem;
    font-weight: 650;
    padding: .55rem .85rem;
    border-radius: 10px;
    cursor: pointer;
}

.grave-loc-btn--primary {
    background: #146c43;
    border-color: #146c43;
    color: #fff;
}

.grave-loc-btn:hover {
    filter: brightness(0.97);
}

.grave-location__hint {
    margin: .85rem 0 0;
    font-size: .82rem;
    color: #64748b;
    line-height: 1.4;
}

.grave-photo-block {
    width: 100%;
    margin-top: 1.35rem;
}

.grave-photo-wrap {
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
}

.grave-photo-btn {
    display: block;
    width: 100%;
    padding: 0;
    border: none;
    background: none;
    cursor: zoom-in;
}

.grave-photo {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 12px;
    background: #d8dce2;
    display: block;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.grave-photo--empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: .88rem;
    aspect-ratio: 4 / 3;
}

.grave-page-actions {
    display: flex;
    flex-direction: column;
    gap: .55rem;
    margin: .15rem 0 .85rem;
}

.grave-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .55rem;
    width: 100%;
    padding: .75rem 1rem;
    border: 1.5px solid rgba(20, 108, 67, 0.28);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.82);
    color: #146c43;
    font-family: inherit;
    font-size: .84rem;
    font-weight: 700;
    text-decoration: none;
    line-height: 1.3;
    text-align: center;
    transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}

.grave-page-btn__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 1.35rem;
    height: 1.35rem;
}

.grave-page-btn__icon svg {
    display: block;
    width: 1.25rem;
    height: 1.25rem;
}

.grave-page-btn:hover {
    color: #0d5234;
    text-decoration: none;
    background: rgba(20, 108, 67, 0.08);
    border-color: rgba(20, 108, 67, 0.45);
}

.grave-page-btn--shop {
    background: #146c43;
    border-color: #146c43;
    color: #fff;
}

.grave-page-btn--shop:hover {
    background: #0d5234;
    border-color: #0d5234;
    color: #fff;
}

.grave-panel--has-bg .grave-page-btn {
    background: rgba(255, 255, 255, 0.48);
    border-color: rgba(255, 255, 255, 0.55);
}

.grave-panel--has-bg .grave-page-btn:hover {
    background: rgba(255, 255, 255, 0.62);
}

.grave-panel--has-bg .grave-page-btn--shop {
    background: #146c43;
    border-color: #146c43;
    color: #fff;
}

.grave-panel--has-bg .grave-page-btn--shop:hover {
    background: #0d5234;
    border-color: #0d5234;
}


.grave-map-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    width: 100%;
    max-width: 300px;
    margin: .65rem auto 0;
    padding: .55rem 0;
    border: none;
    background: transparent;
    color: #146c43;
    font-family: inherit;
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    cursor: pointer;
    line-height: 1.3;
}

.grave-map-link:hover {
    color: #0d5234;
    text-decoration: underline;
}

.grave-map-link__icon {
    flex-shrink: 0;
}


.grave-details {
    width: 100%;
}

.grave-card {
    background: #fff;
    border-radius: 14px;
    padding: 1rem 1.1rem;
    margin-bottom: .75rem;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
    text-align: center;
}

.grave-panel--has-bg .grave-card {
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.45);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.07);
}

.grave-card__title {
    margin: 0 0 .65rem;
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #374151;
}

.grave-others-list {
    list-style: none;
    margin: 0;
    padding: 0;
    text-align: left;
}

.grave-others-list li {
    padding: .5rem 0;
    border-bottom: 1px solid #eef0f3;
    font-size: .9rem;
}

.grave-others-list li:last-child {
    border-bottom: none;
}

.grave-others-list a {
    font-weight: 600;
    color: #146c43;
    text-decoration: none;
}

.grave-others-years {
    color: #6b7280;
    font-size: .85rem;
}

.grave-bio {
    margin: 0;
    font-size: .92rem;
    line-height: 1.65;
    color: #374151;
    text-align: left;
}

.grave-card--contact {
    text-align: left;
    padding: 1.1rem 1.15rem 1.15rem;
}

.grave-card--contact .grave-card__title {
    text-align: left;
    margin-bottom: .5rem;
}

.grave-contact-name {
    margin: 0 0 .55rem;
    font-size: .95rem;
    font-weight: 700;
    line-height: 1.35;
    color: #111;
    letter-spacing: 0.02em;
}

.grave-contact-hours {
    display: flex;
    align-items: center;
    gap: .45rem;
    margin: 0 0 .85rem;
    font-size: .84rem;
    color: #64748b;
    line-height: 1.4;
}

.grave-contact-hours__icon {
    flex-shrink: 0;
    color: #94a3b8;
}

.grave-contact-call {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    width: 100%;
    margin: .2rem 0 0;
    padding: .58rem .85rem;
    border: 1.5px solid rgba(20, 108, 67, 0.28);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.72);
    color: #146c43;
    font-family: inherit;
    font-size: .76rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    text-decoration: none;
    line-height: 1.3;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.grave-contact-call:hover {
    color: #0d5234;
    text-decoration: none;
    background: rgba(20, 108, 67, 0.07);
    border-color: rgba(20, 108, 67, 0.45);
}

.grave-contact-call:active {
    background: rgba(20, 108, 67, 0.11);
}

.grave-contact-call__icon {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    opacity: 0.9;
}

.grave-panel--has-bg .grave-contact-call {
    background: rgba(255, 255, 255, 0.42);
    border-color: rgba(255, 255, 255, 0.55);
}

.grave-panel--has-bg .grave-contact-call:hover {
    background: rgba(255, 255, 255, 0.58);
    border-color: rgba(20, 108, 67, 0.35);
}

.grave-qr {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .55rem;
}

.grave-qr img {
    width: 110px;
    height: 110px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    background: #fff;
}

.grave-panel--has-bg .grave-qr img {
    background: rgba(255, 255, 255, 0.5);
    border-color: rgba(255, 255, 255, 0.45);
}

.grave-qr span {
    font-size: .78rem;
    color: #6b7280;
    max-width: 220px;
    line-height: 1.4;
}

.grave-platform-footer.platform-footer {
    margin-top: .5rem;
    padding-top: .75rem;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.grave-platform-footer.platform-footer p {
    color: #6b7280;
    font-size: .72rem;
}


.grave-photo-lightbox {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    background: rgba(15, 23, 42, 0.88);
}

.grave-photo-lightbox[hidden] {
    display: none !important;
}

.grave-photo-lightbox__img {
    max-width: min(92vw, 720px);
    max-height: 88vh;
    object-fit: contain;
    border-radius: 10px;
}

.grave-photo-lightbox__close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 50%;
    background: #fff;
    font-size: 1.6rem;
    cursor: pointer;
}

body.grave-lightbox-open {
    overflow: hidden;
}


.grave-page--no-map {
    background: linear-gradient(160deg, #0a3d28 0%, #146c43 45%, #1fa868 100%);
}

.grave-page--no-map .grave-map-wrap {
    display: none;
}

.grave-page--no-map .grave-panel {
    position: relative;
    max-height: none;
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    border-radius: 0;
    box-shadow: none;
}

.grave-page--no-map .grave-panel__handle {
    display: none;
}

.dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.15rem;
    vertical-align: middle;
}

.dot-free { background: #22c55e; }
.dot-reserved { background: #eab308; }
.dot-occupied { background: #ef4444; }

.only-mobile { display: block; }
.only-desktop { display: none; }


@media (min-width: 900px) {
    .only-mobile { display: none !important; }
    .only-desktop { display: block !important; }

    .grave-page--has-map {
        display: block;
        height: 100vh;
        height: 100dvh;
        overflow: hidden;
    }

    .grave-panel {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(420px, 38vw);
        max-height: none;
        height: auto;
        border-radius: 0;
        box-shadow: none;
    }

    .grave-page--has-map .grave-panel--has-bg {
        top: 4px;
        left: 4px;
        bottom: 4px;
        width: min(calc(420px - 8px), calc(38vw - 8px));
        margin: 0;
        max-height: none;
        height: auto;
        border-radius: var(--grave-frame-radius);
        box-shadow: 0 4px 18px rgba(0, 0, 0, 0.1);
    }

    .grave-map-wrap {
        position: fixed;
        inset: 0;
        z-index: 0;
        height: auto;
    }

    .grave-panel__scroll {
        padding: 1rem 1.1rem 1.35rem;
        display: flex;
        justify-content: center;
    }

    .grave-panel__inner {
        max-width: 100%;
    }

    .grave-person-name {
        font-size: 1.45rem;
    }

    .grave-photo-wrap,
    .grave-map-link {
        max-width: 320px;
    }

    .grave-page--no-map {
        display: block;
        overflow: auto;
    }

    .grave-page--no-map .grave-panel {
        max-width: 480px;
        margin: 0 auto;
        min-height: 100vh;
        box-shadow: 0 0 40px rgba(0, 0, 0, 0.12);
    }

    .grave-page--no-map .grave-panel--has-bg {
        margin: 6px auto;
        min-height: calc(100vh - 12px);
        min-height: calc(100dvh - 12px);
        border-radius: var(--grave-frame-radius);
    }
}

@media (max-width: 899px) {
    .grave-page--has-map .grave-panel {
        padding-bottom: env(safe-area-inset-bottom);
        /* Leave ~half the screen for the map so location is readable on phone */
        max-height: min(42vh, calc(100dvh - 12px));
    }

    .grave-page--has-map .grave-panel.is-expanded {
        max-height: min(92vh, 100dvh);
    }

    .grave-panel-top .grave-home-logo .app-logo {
        width: clamp(96px, 26vw, 140px);
        max-width: min(100%, 160px);
    }

    .grave-panel-top {
        margin-bottom: .65rem;
    }

    .grave-hero {
        position: relative;
        z-index: 1;
        padding-top: .15rem;
    }

    .grave-person-name {
        font-size: clamp(1.05rem, 4.2vw, 1.35rem);
        letter-spacing: 0.08em;
        word-break: break-word;
    }

    .grave-page--has-map .grave-panel--has-bg {
        left: max(4px, env(safe-area-inset-left));
        right: max(4px, env(safe-area-inset-right));
        bottom: max(4px, env(safe-area-inset-bottom));
        border-radius: var(--grave-frame-radius);
        background: transparent !important;
        box-shadow: 0 4px 18px rgba(0, 0, 0, 0.1);
    }

    .grave-panel__scroll {
        padding-left: max(1.15rem, env(safe-area-inset-left));
        padding-right: max(1.15rem, env(safe-area-inset-right));
        padding-bottom: max(1.25rem, env(safe-area-inset-bottom));
    }

    .grave-page--has-map .leaflet-bottom.leaflet-right {
        bottom: calc(var(--grave-panel-offset, 42vh) + 8px);
        transition: bottom 0.35s ease;
    }
}
