:root {
    --ink: #23211d;
    --ink-soft: #625848;
    --paper: #f3f0e7;
    --paper-deep: #e7e0cd;
    --line: #dcd3ba;
    --white: #ffffff;
    --accent: #1f6f6b;
    --accent-deep: #17514e;
    --rust: #bb5330;
    --rust-deep: #93401f;
    --error: #a13a2c;
    --error-bg: #f8e9e5;
    --success: #1f6f6b;
    --success-bg: #e5f1ef;
    --notice: #93401f;
    --notice-bg: #f6ece0;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: Georgia, 'Times New Roman', serif;
    background: var(--paper);
    color: var(--ink);
    line-height: 1.6;
}

.wrap {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
}

a { color: var(--accent-deep); }
a:hover { color: var(--accent); }

h1, h2, h3 { font-weight: normal; color: var(--ink); }

/* Header */
.site-header {
    background: var(--white);
    border-bottom: 1px solid var(--line);
}
.site-header__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    gap: 12px;
}
.brand { text-decoration: none; line-height: 1.2; }
.brand__name { display: block; font-size: 1.25rem; color: var(--ink); letter-spacing: 0.02em; }
.brand__sub { display: block; font-size: 0.8rem; color: var(--ink-soft); font-style: italic; }
.main-nav { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; font-size: 0.95rem; }
.main-nav a { text-decoration: none; color: var(--ink-soft); }
.main-nav a:hover { color: var(--accent-deep); }
.nav-cta {
    background: var(--accent-deep);
    color: var(--white) !important;
    padding: 8px 14px;
    border-radius: 4px;
}
.nav-cta:hover { background: var(--accent); }

/* Alerts */
.alert {
    padding: 14px 16px;
    border-radius: 6px;
    margin: 20px 0;
    border: 1px solid transparent;
}
.alert ul { margin: 0; padding-left: 20px; }
.alert--success { background: var(--success-bg); border-color: #bfe0da; color: var(--success); }
.alert--error { background: var(--error-bg); border-color: #eecac2; color: var(--error); }
.alert--notice { background: var(--notice-bg); border-color: var(--line); color: var(--notice); }

/* Hero */
.hero { text-align: center; padding: 48px 0 32px; }
.hero__photo img {
    width: 100%;
    max-width: 480px;
    height: 280px;
    object-fit: cover;
    border-radius: 10px;
    border: 4px solid var(--white);
    box-shadow: 0 4px 18px rgba(0,0,0,0.12);
    margin-bottom: 24px;
}
.hero__name { font-size: 2.2rem; margin: 0 0 6px; }
.hero__dates { color: var(--ink-soft); font-style: italic; margin: 0 0 18px; }
.hero__epitaph { max-width: 560px; margin: 0 auto 24px; color: var(--ink-soft); }

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 4px;
    text-decoration: none;
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
    border: none;
}
.btn--primary { background: var(--accent-deep); color: var(--white); }
.btn--primary:hover { background: var(--accent); color: var(--white); }
.btn--small { padding: 7px 14px; font-size: 0.85rem; border-radius: 4px; }
.btn--approve { background: var(--success); color: var(--white); }
.btn--approve:hover { background: #245c41; }
.btn--reject { background: var(--error); color: var(--white); }
.btn--reject:hover { background: #7f2323; }

/* Section titles */
.section-title {
    font-size: 1.6rem;
    border-bottom: 1px solid var(--line);
    padding-bottom: 10px;
    margin: 40px 0 24px;
}
.empty-state { color: var(--ink-soft); font-style: italic; }

/* Memory grid */
.memory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 24px;
}
.memory-card {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.memory-card__photo { display: block; position: relative; }
.memory-card__photo img { width: 100%; height: 180px; object-fit: cover; display: block; }
.memory-card__photo-count {
    position: absolute;
    right: 8px;
    bottom: 8px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-family: sans-serif;
}
.memory-card__body { padding: 16px 18px; flex: 1; display: flex; flex-direction: column; }
.memory-card__title { margin: 0 0 8px; font-size: 1.15rem; }
.memory-card__title a { text-decoration: none; color: var(--ink); }
.memory-card__excerpt { color: var(--ink-soft); font-size: 0.95rem; flex: 1; }
.memory-card__meta { font-size: 0.8rem; color: var(--ink-soft); font-style: italic; margin: 8px 0; }
.memory-card__link { font-size: 0.9rem; text-decoration: none; }

/* Memory full page */
.memory-full__meta { color: var(--ink-soft); font-style: italic; margin-top: -8px; }
.memory-full__photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin: 20px 0; }
.memory-full__photos img { width: 100%; border-radius: 6px; }
.memory-full__body { white-space: pre-line; }

/* Comments */
.comment-list { list-style: none; padding: 0; margin: 0; }
.comment { padding: 14px 0; border-bottom: 1px solid var(--line); }
.comment__body { margin: 0 0 6px; }
.comment__meta { font-size: 0.8rem; color: var(--ink-soft); font-style: italic; margin: 0; }

/* Forms */
.card-form {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 24px;
    margin-top: 16px;
}
.form-row { margin-bottom: 18px; }
.form-row label { display: block; margin-bottom: 6px; font-size: 0.95rem; }
.form-row .hint { color: var(--ink-soft); font-size: 0.82rem; font-style: italic; font-weight: normal; }
.form-row input[type=text],
.form-row input[type=email],
.form-row input[type=password],
.form-row textarea,
.form-row input[type=file] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 4px;
    font-family: inherit;
    font-size: 1rem;
    background: var(--paper);
    color: var(--ink);
}
.form-row textarea { resize: vertical; }
.form-row--checkbox label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    cursor: pointer;
}
.form-row--checkbox input[type=checkbox] { width: auto; flex: none; }
.form-row--checkbox .hint { display: block; margin: 6px 0 0 26px; }
.badge-lock {
    display: inline-block;
    font-size: 0.75rem;
    font-style: normal;
    color: var(--rust-deep);
    background: var(--notice-bg);
    border: 1px solid var(--line);
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 6px;
}
.form-page--narrow .card-form { max-width: 420px; }
.form-page__intro { color: var(--ink-soft); }
.form-page__footer { margin-top: 16px; font-size: 0.9rem; }

/* Admin */
.admin-item {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
    margin-bottom: 16px;
}
.admin-item__meta { font-size: 0.85rem; color: var(--ink-soft); font-style: italic; }
.admin-item__photos { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.admin-item__photos img { width: 100px; height: 100px; object-fit: cover; border-radius: 4px; }
.admin-item__actions { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.admin-item__actions form { display: inline; }
.admin-item__preview { font-size: 0.85rem; }

/* Footer */
.site-footer {
    margin-top: 60px;
    padding: 24px 0;
    border-top: 1px solid var(--line);
    color: var(--ink-soft);
    font-size: 0.85rem;
    text-align: center;
}

@media (max-width: 640px) {
    .hero__name { font-size: 1.7rem; }
    .site-header__inner { flex-direction: column; align-items: flex-start; }
}
