:root {
    --ink: #1f2522;
    --muted: #68736d;
    --paper: #f7f3ed;
    --panel: #fffaf4;
    --line: #ded5c9;
    --accent: #46685a;
    --accent-dark: #314c42;
    --danger: #9a3d34;
    --success: #386b4d;
    --shadow: 0 24px 70px rgba(31, 37, 34, 0.16);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--paper);
}

button,
.button,
input,
textarea {
    font: inherit;
}

a {
    color: inherit;
}

.public-page {
    background:
        radial-gradient(circle at top left, rgba(205, 169, 94, 0.18), transparent 34rem),
        linear-gradient(180deg, #f8fbff 0%, #f7f1ea 55%, #fffaf4 100%);
}

.memorial-page {
    width: min(100%, 980px);
    margin: 0 auto;
    padding: 18px 14px 34px;
}

.eyebrow {
    margin: 0 0 12px;
    color: inherit;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.memorial-hero {
    position: relative;
    overflow: hidden;
    min-height: calc(100vh - 36px);
    display: grid;
    align-content: end;
    gap: 18px;
    border-radius: 8px;
    padding: 18px;
    color: #fffaf4;
    background:
        linear-gradient(180deg, rgba(22, 31, 49, 0.05) 0%, rgba(22, 31, 49, 0.48) 48%, rgba(22, 31, 49, 0.92) 100%),
        #27344b;
    box-shadow: var(--shadow);
}

.memorial-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background: url("../images/3.jpeg") center 18% / cover no-repeat;
    opacity: 0.96;
}

.portrait-frame,
.hero-copy {
    position: relative;
    z-index: 1;
}

.portrait-frame {
    width: min(68vw, 260px);
    aspect-ratio: 1;
    align-self: start;
    border: 5px solid rgba(255, 250, 244, 0.84);
    border-radius: 999px;
    overflow: hidden;
    box-shadow: 0 16px 42px rgba(18, 24, 36, 0.28);
}

.portrait-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
}

.hero-copy {
    max-width: 620px;
    padding-top: 22vh;
}

h1,
h2 {
    margin: 0;
    letter-spacing: 0;
}

h1 {
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2.85rem, 15vw, 5.8rem);
    line-height: 0.94;
    font-weight: 500;
}

h2 {
    font-size: 1.35rem;
}

.hero-text {
    width: min(100%, 430px);
    margin: 14px 0 0;
    color: rgba(255, 250, 244, 0.88);
    font-size: 1.05rem;
    line-height: 1.6;
}

.tribute-banner,
.memory-card,
.schedule-section {
    margin-top: 16px;
}

.tribute-banner,
.memory-card {
    overflow: hidden;
    border-radius: 8px;
    border: 1px solid rgba(198, 184, 161, 0.78);
    background: white;
    box-shadow: 0 18px 44px rgba(31, 37, 34, 0.1);
}

.tribute-banner img,
.memory-card img {
    display: block;
    width: 100%;
    height: auto;
}

.memory-card {
    padding: 8px;
}

.memory-card img {
    border-radius: 6px;
}

.schedule-section {
    padding: 24px 18px;
    border-radius: 8px;
    border: 1px solid rgba(198, 184, 161, 0.78);
    background: rgba(255, 250, 244, 0.92);
}

.schedule-section .eyebrow {
    color: #8c6744;
}

.schedule-section h2 {
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(1.75rem, 9vw, 3rem);
    font-weight: 500;
}

.timeline {
    display: grid;
    gap: 12px;
    margin-top: 18px;
}

.timeline-item {
    display: grid;
    grid-template-columns: 84px minmax(0, 1fr);
    gap: 13px;
    padding: 15px 0;
    border-top: 1px solid var(--line);
}

.timeline-item time {
    color: #8c6744;
    font-weight: 900;
}

.timeline-item h3 {
    margin: 0;
    font-size: 1rem;
}

.timeline-item p {
    margin: 6px 0 0;
    color: var(--muted);
    line-height: 1.55;
}

.rsvp-panel,
.login-panel,
.admin-section,
.stats-grid > div {
    background: rgba(255, 250, 244, 0.96);
    border: 1px solid rgba(222, 213, 201, 0.9);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.rsvp-panel {
    margin-top: 16px;
    padding: 24px 18px;
}

.muted,
.guest-line {
    color: var(--muted);
    line-height: 1.6;
}

.rsvp-form,
.admin-form {
    display: grid;
    gap: 14px;
    margin-top: 22px;
}

label,
legend {
    font-weight: 700;
    font-size: 0.92rem;
}

input,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: white;
    color: var(--ink);
    padding: 12px 13px;
}

input:focus,
textarea:focus {
    outline: 3px solid rgba(70, 104, 90, 0.22);
    border-color: var(--accent);
}

fieldset {
    border: 0;
    padding: 0;
    margin: 6px 0 0;
    display: grid;
    gap: 10px;
}

.choice {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 12px;
    background: white;
}

.choice input {
    width: auto;
}

button,
.button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-height: 44px;
    border: 0;
    border-radius: 6px;
    padding: 0 18px;
    color: white;
    background: var(--accent);
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
}

button:hover,
.button:hover {
    background: var(--accent-dark);
}

.button.ghost {
    color: var(--accent-dark);
    background: white;
    border: 1px solid var(--line);
}

.button.danger,
button.danger {
    color: white;
    background: var(--danger);
}

.button.danger:hover,
button.danger:hover {
    background: #7f3029;
}

.inline-form {
    display: inline;
    margin: 0;
}

.inline-form button {
    min-height: 36px;
    padding: 0 12px;
}

.notice {
    margin-bottom: 18px;
    border-radius: 6px;
    padding: 12px 14px;
    font-weight: 700;
}

.notice.success {
    color: var(--success);
    background: rgba(56, 107, 77, 0.1);
}

.notice.error {
    color: var(--danger);
    background: rgba(154, 61, 52, 0.1);
}

.admin-page {
    background: #f4f1ec;
}

.admin-shell {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 36px 0;
}

.login-panel {
    width: min(440px, 100%);
    margin: 10vh auto 0;
    padding: 30px;
}

.login-panel .eyebrow,
.admin-header .eyebrow {
    color: var(--accent);
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

.admin-header h1 {
    font-size: clamp(2rem, 4vw, 3.2rem);
    color: var(--ink);
}

.admin-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 14px;
}

.stats-grid > div {
    padding: 18px;
}

.stats-grid strong {
    display: block;
    font-size: 2rem;
}

.stats-grid span {
    color: var(--muted);
}

.admin-section {
    padding: 22px;
    margin-top: 14px;
    box-shadow: none;
}

.table-wrap {
    overflow-x: auto;
    margin-top: 16px;
}

table {
    width: 100%;
    min-width: 860px;
    border-collapse: collapse;
}

th,
td {
    text-align: left;
    padding: 12px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

th {
    color: var(--muted);
    font-size: 0.8rem;
    text-transform: uppercase;
}

.pill {
    display: inline-flex;
    border-radius: 999px;
    padding: 5px 9px;
    font-size: 0.78rem;
    font-weight: 800;
    background: #ece6dc;
}

.pill.yes {
    color: var(--success);
    background: rgba(56, 107, 77, 0.12);
}

.pill.no {
    color: var(--danger);
    background: rgba(154, 61, 52, 0.12);
}

.copy-cell,
.link-row {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) auto;
    gap: 8px;
}

.link-row {
    grid-template-columns: 150px minmax(240px, 1fr) auto;
    align-items: center;
    margin-top: 10px;
}

.copy-cell button,
.link-row button {
    min-height: 40px;
}

@media (max-width: 860px) {
    .admin-header,
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .admin-header {
        display: grid;
    }
}

@media (max-width: 560px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .link-row,
    .copy-cell {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 760px) {
    .memorial-page {
        padding: 28px;
    }

    .memorial-hero {
        min-height: 720px;
        padding: 34px;
    }

    .memorial-hero::before {
        background-position: center 24%;
    }

    .portrait-frame {
        width: 260px;
    }

    .hero-copy {
        padding-top: 260px;
    }

    .tribute-banner,
    .memory-card,
    .schedule-section,
    .rsvp-panel {
        margin-top: 22px;
    }

    .schedule-section,
    .rsvp-panel {
        padding: 34px;
    }

    .timeline {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0;
    }

    .timeline-item {
        grid-template-columns: 1fr;
        padding: 18px;
        border-top: 0;
        border-left: 1px solid var(--line);
    }

    .timeline-item:first-child {
        border-left: 0;
    }
}

/* Public memorial page redesign */
.public-page {
    background:
        radial-gradient(circle at 10% 0%, rgba(183, 203, 222, 0.75), transparent 26rem),
        radial-gradient(circle at 95% 18%, rgba(205, 169, 94, 0.18), transparent 22rem),
        linear-gradient(180deg, #eef6fc 0%, #faf7f1 52%, #f5efe7 100%);
}

.memorial-page {
    width: min(100%, 1120px);
    margin: 0 auto;
    padding: 14px;
}

.memorial-hero {
    position: relative;
    min-height: auto;
    display: grid;
    gap: 0;
    overflow: hidden;
    border: 1px solid rgba(45, 61, 93, 0.14);
    border-radius: 8px;
    padding: 0;
    color: #172345;
    background: rgba(255, 255, 255, 0.72);
    box-shadow: 0 24px 70px rgba(34, 49, 79, 0.16);
}

.memorial-hero::before {
    content: none;
}

.memorial-art {
    padding: 10px;
    background: #edf5fb;
}

.memorial-art img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 6px;
}

.memorial-hero .hero-copy {
    position: relative;
    z-index: 1;
    max-width: none;
    padding: 24px 20px 26px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(248, 251, 255, 0.94)),
        url("../images/1.jpg.jpeg") center / cover no-repeat;
}

.memorial-hero .hero-copy::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.82);
}

.memorial-hero .hero-copy > * {
    position: relative;
    z-index: 1;
}

.memorial-hero .eyebrow,
.rsvp-panel .eyebrow,
.schedule-section .eyebrow {
    color: #b18844;
}

.memorial-hero h1 {
    color: #172345;
    font-size: clamp(2.65rem, 16vw, 5.9rem);
    line-height: 0.92;
}

.hero-text {
    width: min(100%, 520px);
    margin: 16px 0 0;
    color: #44516f;
    font-size: 1.08rem;
    line-height: 1.65;
}

.hero-meta {
    display: grid;
    gap: 8px;
    margin-top: 18px;
}

.hero-meta span {
    display: inline-flex;
    align-items: center;
    min-height: 42px;
    border: 1px solid rgba(177, 136, 68, 0.34);
    border-radius: 6px;
    padding: 9px 12px;
    color: #263452;
    background: rgba(255, 255, 255, 0.78);
    font-weight: 750;
}

.tribute-banner,
.tribute-footer {
    margin-top: 14px;
    border-color: rgba(45, 61, 93, 0.12);
    box-shadow: 0 18px 44px rgba(34, 49, 79, 0.1);
}

.tribute-footer {
    overflow: hidden;
    border: 1px solid rgba(45, 61, 93, 0.12);
    border-radius: 8px;
    background: white;
}

.tribute-footer img {
    display: block;
    width: 100%;
    height: auto;
}

.schedule-section,
.rsvp-panel {
    margin-top: 14px;
    border: 1px solid rgba(45, 61, 93, 0.12);
    background: rgba(255, 255, 255, 0.88);
    box-shadow: 0 18px 44px rgba(34, 49, 79, 0.1);
}

.schedule-section h2,
.rsvp-panel h2 {
    color: #172345;
}

.timeline-item {
    border-top-color: rgba(45, 61, 93, 0.14);
}

.timeline-item time {
    color: #b18844;
}

.timeline-item h3 {
    color: #172345;
}

.choice {
    border-color: rgba(45, 61, 93, 0.16);
    background: rgba(255, 255, 255, 0.82);
}

.choice:has(input:checked) {
    border-color: rgba(177, 136, 68, 0.7);
    background: rgba(177, 136, 68, 0.1);
}

@media (min-width: 820px) {
    .memorial-page {
        padding: 28px;
    }

    .memorial-hero {
        grid-template-columns: minmax(380px, 0.96fr) minmax(0, 1fr);
        align-items: stretch;
    }

    .memorial-art {
        display: flex;
        align-items: center;
        padding: 18px;
    }

    .memorial-art img {
        height: 100%;
        max-height: 720px;
        object-fit: cover;
    }

    .memorial-hero .hero-copy {
        display: flex;
        flex-direction: column;
        justify-content: center;
        padding: 56px;
    }

    .hero-meta {
        grid-template-columns: max-content minmax(0, 1fr);
    }

    .tribute-banner,
    .schedule-section,
    .rsvp-panel,
    .tribute-footer {
        margin-top: 22px;
    }

    .timeline {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* Admin refinement */
.admin-page {
    background:
        radial-gradient(circle at 6% 0%, rgba(183, 203, 222, 0.5), transparent 28rem),
        linear-gradient(180deg, #f4f8fb 0%, #f7f1ea 100%);
}

.login-panel {
    border-color: rgba(45, 61, 93, 0.12);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(248, 251, 255, 0.95)),
        url("../images/1.jpg.jpeg") center / cover no-repeat;
    text-align: center;
}

.login-mark {
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    margin: 0 auto 16px;
    border: 1px solid rgba(177, 136, 68, 0.45);
    border-radius: 999px;
    color: #172345;
    background: rgba(255, 255, 255, 0.82);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.8rem;
}

.login-panel h1 {
    color: #172345;
    font-size: clamp(2rem, 8vw, 3.2rem);
}

.login-panel .admin-form {
    text-align: left;
}

.admin-header {
    padding: 20px;
    border: 1px solid rgba(45, 61, 93, 0.12);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.82);
    box-shadow: 0 18px 44px rgba(34, 49, 79, 0.08);
}

.admin-tabs {
    display: flex;
    gap: 8px;
    margin: 16px 0;
    padding: 6px;
    border: 1px solid rgba(45, 61, 93, 0.12);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.72);
}

.admin-tabs a {
    flex: 1;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-height: 42px;
    border-radius: 6px;
    color: #44516f;
    font-weight: 850;
    text-decoration: none;
}

.admin-tabs a.active {
    color: white;
    background: #172345;
}

.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
}

.section-heading .muted {
    margin: 6px 0 0;
}

.admin-section {
    border-color: rgba(45, 61, 93, 0.12);
    background: rgba(255, 255, 255, 0.9);
}

.admin-section h2 {
    color: #172345;
}

@media (min-width: 820px) {
    .memorial-art img {
        height: auto;
        max-height: none;
        object-fit: contain;
    }
}

@media (max-width: 680px) {
    .admin-actions,
    .section-heading {
        display: grid;
        grid-template-columns: 1fr;
    }

    .admin-tabs {
        display: grid;
        grid-template-columns: 1fr;
    }
}
