/* obituary.my — hand-written styles. Mobile first. Warm muted neutrals + soft gold accent. */

:root {
    --bg: #faf7f1;
    --surface: #ffffff;
    --ink: #2e2a24;
    --muted: #6f675c;
    --line: #e6ded1;
    --gold: #b98a2f;
    --gold-dark: #96690f;
    --gold-soft: #f6ecd7;
    --error: #a4342c;
    --success: #2f6b3a;
    --radius: 10px;
    --maxw: 1100px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 18px;
    line-height: 1.65;
}

/* Type scale trims on small screens */
h1, h2, h3 { line-height: 1.25; margin: 0 0 0.6em; font-weight: 600; }
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }

a { color: var(--gold-dark); }
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
    outline: 3px solid var(--gold);
    outline-offset: 2px;
}

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 1.1rem; }

/* Skip link */
.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    background: var(--ink);
    color: #fff;
    padding: 0.8rem 1.2rem;
    z-index: 100;
    border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* Screen-reader-only text */
.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0);
    white-space: nowrap; border: 0;
}

/* Header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.header-inner {
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem; padding: 0.8rem 1.1rem;
}
.brand {
    font-size: 1.35rem; font-weight: 700; color: var(--ink);
    text-decoration: none; letter-spacing: 0.02em;
}
.nav-list {
    list-style: none; margin: 0; padding: 0;
    display: flex; align-items: center; gap: 1rem;
}
.nav-list a { text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 48px; padding: 0.7rem 1.4rem;
    background: var(--gold); color: #fff; border: 1px solid var(--gold);
    border-radius: var(--radius); font-size: 1.05rem; font-family: inherit;
    cursor: pointer; text-decoration: none; line-height: 1.2;
}
.btn:hover { background: var(--gold-dark); border-color: var(--gold-dark); color: #fff; }
.btn-small { min-height: 44px; padding: 0.5rem 1rem; font-size: 0.95rem; }
.btn-outline { background: transparent; color: var(--gold-dark); }
.btn-outline:hover { background: var(--gold-soft); color: var(--gold-dark); }
.btn-danger { background: #fff; color: var(--error); border-color: var(--error); }
.btn-danger:hover { background: var(--error); color: #fff; }
.btn[disabled] { opacity: 0.6; cursor: not-allowed; }

/* Alerts */
.alert {
    border-radius: var(--radius); padding: 0.9rem 1.1rem; margin: 1rem 0;
    border: 1px solid;
}
.alert-success { background: #eef5ee; border-color: var(--success); color: var(--success); }
.alert-error { background: #f9ecea; border-color: var(--error); color: var(--error); }
.alert-info { background: var(--gold-soft); border-color: var(--gold); color: var(--ink); }

/* Hero */
.hero {
    background: var(--surface); border-bottom: 1px solid var(--line);
    padding: 2.2rem 0; margin-bottom: 2rem;
}
.hero h1 { font-size: 2.1rem; margin-bottom: 0.3em; }
.hero p.lead { color: var(--muted); font-size: 1.15rem; }

.search-form { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1.2rem; }
.search-form input[type="search"] {
    flex: 1 1 220px; min-height: 52px; padding: 0.6rem 1rem;
    border: 1px solid var(--line); border-radius: var(--radius);
    font-size: 1.05rem; font-family: inherit; background: #fff;
}

/* Sections */
.section { margin: 0 0 2.5rem; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

/* Memorial cards */
.memorial-grid {
    display: grid; gap: 1.2rem;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.mem-card {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); overflow: hidden;
    display: flex; flex-direction: column;
}
.mem-card a.card-link { text-decoration: none; color: inherit; display: flex; flex-direction: column; height: 100%; }
.mem-portrait { aspect-ratio: 1 / 1; background: var(--gold-soft); }
.mem-portrait img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mem-body { padding: 1rem 1.1rem; }
.mem-name { font-size: 1.2rem; margin: 0 0 0.25em; }
.mem-meta { color: var(--muted); font-size: 0.95rem; margin: 0; }

.badge {
    display: inline-block; font-size: 0.78rem; font-family: system-ui, sans-serif;
    padding: 0.15rem 0.55rem; border-radius: 999px; margin-right: 0.4rem;
    vertical-align: middle;
}
.badge-premium { background: var(--gold); color: #fff; }
.badge-verified { background: #e7f0e7; color: var(--success); border: 1px solid var(--success); }
.badge-sample { background: #eee; color: var(--muted); border: 1px solid var(--muted); }

/* Trust strip */
.trust-strip {
    display: flex; flex-wrap: wrap; gap: 0.8rem 1.6rem;
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 1rem 1.3rem; margin: 0 0 2.5rem;
    font-size: 1rem; color: var(--muted);
}
.trust-strip span::before { content: "✓ "; color: var(--gold-dark); font-weight: 700; }

/* Featured */
.featured { border: 2px solid var(--gold); }

/* Browse filters */
.filter-bar {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 1rem; margin-bottom: 1.5rem;
    display: flex; flex-wrap: wrap; gap: 0.7rem; align-items: end;
}
.filter-bar .form-group { margin: 0; min-width: 150px; flex: 1 1 150px; }

.pagination { display: flex; gap: 0.5rem; justify-content: center; margin-top: 2rem; flex-wrap: wrap; }
.pagination a, .pagination span {
    min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--line); border-radius: 8px; padding: 0.3rem 0.8rem;
    background: var(--surface); text-decoration: none; color: var(--ink);
}
.pagination span.current { background: var(--gold); color: #fff; border-color: var(--gold); }

/* Memorial page */
.memorial-hero { display: grid; gap: 1.5rem; margin: 1.5rem 0 2rem; }
@media (min-width: 720px) {
    .memorial-hero { grid-template-columns: 300px 1fr; align-items: start; }
}
.portrait-large { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: var(--gold-soft); }
.portrait-large img { width: 100%; display: block; }
.mem-dates { color: var(--muted); margin: 0.4em 0; }
.life-story { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem 1.4rem; }

.gallery { display: grid; gap: 0.8rem; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.gallery-item { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); padding: 0; cursor: zoom-in; }
.gallery-item img { width: 100%; aspect-ratio: 1/1; object-fit: cover; display: block; }
.gallery-item figcaption { font-size: 0.85rem; color: var(--muted); padding: 0.4rem 0.6rem; }

/* Lightbox */
.lightbox {
    position: fixed; inset: 0; background: rgba(20, 16, 10, 0.9);
    display: none; align-items: center; justify-content: center;
    flex-direction: column; z-index: 200; padding: 1rem;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 92vw; max-height: 80vh; border-radius: 8px; }
.lightbox-cap { color: #f3ede0; margin-top: 0.8rem; }
.lightbox-close {
    position: absolute; top: 1rem; right: 1rem;
    background: #fff; border: none; border-radius: 50%;
    width: 48px; height: 48px; font-size: 1.4rem; cursor: pointer;
}

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline-item {
    border-left: 3px solid var(--gold); padding: 0 0 1.2rem 1.2rem;
    margin-left: 0.4rem; position: relative;
}
.timeline-item::before {
    content: ""; position: absolute; left: -8px; top: 0.35em;
    width: 13px; height: 13px; border-radius: 50%; background: var(--gold);
}
.timeline-year { font-weight: 700; color: var(--gold-dark); }

/* Condolences */
.condolence {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 1rem 1.2rem; margin-bottom: 1rem;
}
.condolence .who { font-weight: 700; }
.condolence .when { color: var(--muted); font-size: 0.9rem; }

/* Candle box */
.candle-box {
    background: var(--surface); border: 1px solid var(--gold);
    border-radius: var(--radius); padding: 1.4rem; text-align: center; margin: 2rem 0;
}
.candle-count { font-size: 2.2rem; color: var(--gold-dark); font-weight: 700; }
.candle-flame { font-size: 2.5rem; }

/* Tribute shop */
.shop { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem; margin: 2rem 0; }
.shop-options { display: grid; gap: 0.8rem; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin: 1rem 0; }
.shop-option {
    border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem;
    cursor: pointer; display: block;
}
.shop-option input { margin-right: 0.5rem; }
.shop-option:has(input:checked) { border-color: var(--gold); background: var(--gold-soft); }
.order-summary { font-size: 1.2rem; font-weight: 700; margin: 1rem 0; }
.shop-note { color: var(--muted); font-size: 0.95rem; }

/* Forms */
.form-group { margin-bottom: 1.1rem; }
.form-group label { display: block; font-weight: 700; margin-bottom: 0.35rem; }
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group input[type="date"],
.form-group input[type="number"],
.form-group input[type="password"],
.form-group select,
.form-group textarea {
    width: 100%; min-height: 48px; padding: 0.6rem 0.8rem;
    border: 1px solid var(--line); border-radius: 8px;
    font-size: 1rem; font-family: inherit; background: #fff; color: var(--ink);
}
.form-group textarea { min-height: 140px; }
.form-hint { color: var(--muted); font-size: 0.9rem; margin-top: 0.25rem; }
.form-actions { margin-top: 1.4rem; display: flex; gap: 0.8rem; flex-wrap: wrap; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; margin: 0 0 1.4rem; }
legend { font-weight: 700; padding: 0 0.5rem; }

.tier-cards { display: grid; gap: 0.9rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.tier-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; cursor: pointer; display: block; }
.tier-card:has(input:checked) { border-color: var(--gold); background: var(--gold-soft); }
.tier-card .price { font-size: 1.4rem; font-weight: 700; color: var(--gold-dark); }

.timeline-row { display: grid; gap: 0.6rem; grid-template-columns: 110px 1fr; margin-bottom: 0.8rem; align-items: start; }
.timeline-row .form-group { margin: 0; }
@media (max-width: 560px) { .timeline-row { grid-template-columns: 1fr; } }

/* Tables (admin) */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; background: var(--surface); font-size: 0.95rem; }
table.table th, table.table td { border: 1px solid var(--line); padding: 0.6rem 0.75rem; text-align: left; vertical-align: top; }
table.table th { background: var(--gold-soft); }
.inline-form { display: inline; }
.inline-form .btn-small { margin: 0.1rem; }

/* Admin */
.admin-shell { display: grid; gap: 1.5rem; margin: 1.5rem 0; }
@media (min-width: 860px) { .admin-shell { grid-template-columns: 220px 1fr; } }
.admin-nav { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; align-self: start; }
.admin-nav ul { list-style: none; margin: 0; padding: 0; }
.admin-nav a { display: block; padding: 0.6rem 0.4rem; text-decoration: none; min-height: 44px; }
.admin-nav a.active { font-weight: 700; color: var(--ink); }
.stat-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin: 1rem 0 2rem; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; text-align: center; }
.stat .num { font-size: 2rem; font-weight: 700; color: var(--gold-dark); }

/* Footer */
.site-footer { border-top: 1px solid var(--line); margin-top: 3rem; padding: 1.6rem 0 2.5rem; color: var(--muted); }
.footer-small { font-size: 0.9rem; }

@media (min-width: 720px) { h1 { font-size: 2.5rem; } .hero h1 { font-size: 2.6rem; } }
