.page-heading,
.memory-detail-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 28px;
    margin-bottom: 32px;
}

.page-heading h1,
.memory-detail-heading h1 {
    font-size: clamp(42px, 6vw, 68px);
}

.primary-button.button-link,
.secondary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 50px;
    padding: 0 20px;
    border-radius: 13px;
    font-weight: 900;
    text-decoration: none;
    white-space: nowrap;
}

.secondary-button {
    border: 1px solid var(--sage);
    background: transparent;
    color: var(--sage-dark);
}

.memory-editor-card,
.memory-story-card,
.timeline-empty {
    padding: clamp(24px, 5vw, 42px);
    border: 1px solid var(--line);
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: var(--shadow);
}

.memory-editor-card {
    max-width: 880px;
}

.memory-form {
    display: grid;
    gap: 22px;
}

textarea {
    width: 100%;
    resize: vertical;
    min-height: 220px;
    padding: 14px;
    border: 1px solid #cbc4b9;
    border-radius: 12px;
    background: white;
    color: var(--ink);
    font: inherit;
    line-height: 1.6;
}

textarea:focus {
    outline: 3px solid rgba(83, 121, 102, 0.18);
    border-color: var(--sage);
}

.date-section {
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #faf8f3;
}

.date-section[hidden] {
    display: none;
}

.date-unknown-note {
    display: grid;
    gap: 4px;
    color: var(--muted);
}

.date-unknown-note strong {
    color: var(--ink);
}

.filter-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 30px;
}

.filter-tabs a {
    padding: 9px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: white;
    color: var(--muted);
    font-size: 14px;
    font-weight: 800;
    text-decoration: none;
}

.filter-tabs a.active {
    border-color: var(--sage);
    background: var(--sage-soft);
    color: var(--sage-dark);
}

.timeline-empty {
    display: grid;
    justify-items: center;
    max-width: 740px;
    margin: 50px auto;
    text-align: center;
}

.timeline-empty p {
    max-width: 580px;
    color: var(--muted);
}

.timeline-list {
    position: relative;
    display: grid;
    gap: 24px;
    max-width: 900px;
    margin: 0 auto;
    padding-left: 38px;
}

.timeline-list::before {
    position: absolute;
    top: 8px;
    bottom: 8px;
    left: 11px;
    width: 2px;
    background: var(--line);
    content: "";
}

.timeline-entry {
    position: relative;
}

.timeline-marker {
    position: absolute;
    top: 29px;
    left: -34px;
    width: 16px;
    height: 16px;
    border: 4px solid var(--cream);
    border-radius: 50%;
    background: var(--sage);
    box-shadow: 0 0 0 1px var(--sage);
}

.timeline-card {
    padding: 26px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 12px 32px rgba(51, 57, 68, 0.08);
}

.timeline-card h2 {
    margin-top: 7px;
}

.timeline-card h2 a {
    color: var(--ink);
    text-decoration: none;
}

.timeline-card h2 a:hover {
    color: var(--sage-dark);
}

.timeline-card > p {
    margin: 13px 0 0;
    color: var(--muted);
}

.timeline-meta,
.timeline-footer,
.memory-detail-meta,
.memory-byline,
.memory-record-details {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.memory-date-label {
    color: var(--gold);
    font-size: 13px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.status-badge {
    display: inline-flex;
    padding: 5px 9px;
    border-radius: 999px;
    background: var(--sage-soft);
    color: var(--sage-dark);
    font-size: 12px;
    font-weight: 900;
}

.status-badge.draft {
    background: var(--gold-soft);
    color: #765324;
}

.status-badge.archived {
    background: #ececec;
    color: #555;
}

.timeline-footer {
    justify-content: space-between;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 13px;
}

.memory-detail-heading {
    align-items: flex-start;
}

.memory-detail-heading h1 {
    margin-top: 12px;
}

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

.memory-byline {
    margin: 16px 0 0;
    color: var(--muted);
}

.memory-story-card {
    max-width: 900px;
}

.memory-story-text {
    color: var(--ink);
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(20px, 2.5vw, 25px);
    line-height: 1.75;
}

.memory-record-details {
    margin-top: 34px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 13px;
}

.danger-zone {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    max-width: 900px;
    margin-top: 24px;
    padding: 20px;
    border: 1px solid #e2bcbc;
    border-radius: 18px;
    background: var(--red-soft);
}

.danger-zone strong,
.danger-zone span {
    display: block;
}

.danger-zone span {
    margin-top: 4px;
    color: #7f5555;
}

.danger-button {
    min-height: 44px;
    padding: 0 16px;
    border: 1px solid var(--red);
    border-radius: 11px;
    background: white;
    color: var(--red);
    font-weight: 900;
    white-space: nowrap;
    cursor: pointer;
}

.action-card[href] {
    color: inherit;
    text-decoration: none;
    transition:
        transform 120ms ease,
        border-color 120ms ease;
}

.action-card[href]:hover {
    transform: translateY(-2px);
    border-color: var(--sage);
}

.muted {
    color: var(--muted);
}

@media (max-width: 760px) {
    .page-heading,
    .memory-detail-heading,
    .danger-zone {
        align-items: stretch;
        flex-direction: column;
    }

    .memory-detail-actions {
        width: 100%;
    }

    .memory-detail-actions > * {
        flex: 1;
    }

    .timeline-list {
        padding-left: 28px;
    }

    .timeline-list::before {
        left: 7px;
    }

    .timeline-marker {
        left: -28px;
    }
}
