/**
 * Remembrance / Death Records — timeline UI (home-page aligned)
 */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@500;600;700;800&family=Inter:wght@400;500;600;700&display=swap');

:root {
    --rm-primary: #0d7377;
    --rm-primary-light: #14a098;
    --rm-primary-dark: #074f51;
    --rm-bg: #f8fafc;
    --rm-card: #ffffff;
    --rm-text: #0f172a;
    --rm-text-secondary: #475569;
    --rm-muted: #64748b;
    --rm-border: #e2e8f0;
    --rm-shadow: 0 10px 30px -8px rgba(15, 23, 42, 0.14);
    --rm-font-display: 'Plus Jakarta Sans', system-ui, sans-serif;
    --rm-font-body: 'Inter', system-ui, sans-serif;
}

.remembrance-page {
    font-family: var(--rm-font-body);
    background: var(--rm-bg);
    color: var(--rm-text);
    min-height: 60vh;
}

.rm-hero {
    background: linear-gradient(135deg, var(--rm-primary) 0%, var(--rm-primary-dark) 100%);
    padding: 48px 0 56px;
    color: #fff;
    position: relative;
    overflow: hidden;
}

.rm-hero::before {
    content: '';
    position: absolute;
    top: -40%;
    right: -12%;
    width: 48%;
    height: 180%;
    background: rgba(255, 255, 255, 0.04);
    transform: rotate(18deg);
    pointer-events: none;
}

.rm-hero .container { position: relative; z-index: 1; }

.rm-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    list-style: none;
    padding: 0;
    margin: 0 0 18px;
    font-size: 0.85rem;
}

.rm-breadcrumb a { color: rgba(255, 255, 255, 0.75); text-decoration: none; }
.rm-breadcrumb a:hover { color: #fff; }
.rm-breadcrumb span { color: rgba(255, 255, 255, 0.45); }
.rm-breadcrumb .current { color: rgba(255, 255, 255, 0.95); }

.rm-hero-title {
    font-family: var(--rm-font-display);
    font-size: clamp(1.75rem, 4vw, 2.4rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    margin: 0 0 10px;
}

.rm-hero-sub {
    margin: 0;
    max-width: 520px;
    color: rgba(255, 255, 255, 0.82);
    line-height: 1.55;
}

.rm-hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 22px;
}

.rm-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.18);
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* Toolbar */
.rm-toolbar {
    margin-top: -28px;
    position: relative;
    z-index: 2;
    padding-bottom: 8px;
}

.rm-toolbar-card {
    background: var(--rm-card);
    border: 1px solid var(--rm-border);
    border-radius: 18px;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
    padding: 16px 18px;
}

.rm-search {
    position: relative;
}

.rm-search i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--rm-muted);
}

.rm-search input {
    width: 100%;
    border: 1.5px solid var(--rm-border);
    border-radius: 12px;
    padding: 11px 14px 11px 40px;
    background: var(--rm-bg);
    font-size: 0.95rem;
    outline: none;
}

.rm-search input:focus {
    border-color: var(--rm-primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(13, 115, 119, 0.12);
}

.rm-year-pills {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
    padding: 12px 2px 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.rm-year-pill {
    flex: 0 0 auto;
    border: 1px solid var(--rm-border);
    background: #fff;
    color: var(--rm-text-secondary);
    border-radius: 999px;
    padding: 7px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.rm-year-pill:hover {
    border-color: var(--rm-primary);
    color: var(--rm-primary);
}

.rm-year-pill.active {
    background: var(--rm-primary);
    border-color: var(--rm-primary);
    color: #fff;
}

.rm-year-pill .count {
    opacity: 0.7;
    font-weight: 500;
    margin-left: 4px;
}

/* Timeline */
.rm-section {
    padding: 28px 0 64px;
}

.rm-timeline {
    position: relative;
    max-width: 860px;
    margin: 0 auto;
    padding: 12px 0 40px;
}

.rm-timeline::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, rgba(13, 115, 119, 0.15), rgba(13, 115, 119, 0.45), rgba(13, 115, 119, 0.15));
    transform: translateX(-50%);
    border-radius: 999px;
}

.rm-year-block {
    position: relative;
    margin-bottom: 8px;
}

.rm-year-mark {
    position: relative;
    z-index: 2;
    display: flex;
    justify-content: center;
    margin: 28px 0 18px;
}

.rm-year-mark span {
    font-family: var(--rm-font-display);
    font-weight: 800;
    font-size: 0.95rem;
    letter-spacing: 0.04em;
    background: var(--rm-primary);
    color: #fff;
    padding: 8px 18px;
    border-radius: 999px;
    box-shadow: 0 8px 20px rgba(13, 115, 119, 0.28);
}

.rm-nodes {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 4px 0 18px;
}

.rm-node {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 36px 1fr;
    align-items: center;
    gap: 0;
    min-height: 44px;
    border: none;
    background: transparent;
    width: 100%;
    padding: 0;
    cursor: pointer;
    text-align: left;
}

.rm-node:focus-visible {
    outline: none;
}

.rm-node:focus-visible .rm-dot {
    transform: translate(-50%, -50%) scale(1.35);
    box-shadow: 0 0 0 6px rgba(13, 115, 119, 0.18), 0 8px 20px rgba(13, 115, 119, 0.35);
}

.rm-date-side,
.rm-name-side {
    min-width: 0;
}

/* Odd rows: date left, name right */
.rm-node:nth-child(odd) .rm-date-side {
    grid-column: 1;
    text-align: right;
    padding-right: 14px;
}

.rm-node:nth-child(odd) .rm-name-side {
    grid-column: 3;
    text-align: left;
    padding-left: 14px;
}

/* Even rows: name left, date right */
.rm-node:nth-child(even) .rm-date-side {
    grid-column: 3;
    text-align: left;
    padding-left: 14px;
}

.rm-node:nth-child(even) .rm-name-side {
    grid-column: 1;
    text-align: right;
    padding-right: 14px;
}

.rm-dot-wrap {
    grid-column: 2;
    position: relative;
    height: 100%;
    min-height: 44px;
}

.rm-dot {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 3px solid #fff;
    background: var(--rm-primary);
    box-shadow: 0 0 0 3px rgba(13, 115, 119, 0.22), 0 4px 12px rgba(13, 115, 119, 0.25);
    padding: 0;
    z-index: 3;
    pointer-events: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.rm-node:hover .rm-dot,
.rm-node.is-active .rm-dot {
    transform: translate(-50%, -50%) scale(1.35);
    background: #0a5c5f;
    box-shadow: 0 0 0 6px rgba(13, 115, 119, 0.18), 0 8px 20px rgba(13, 115, 119, 0.35);
}

.rm-date-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--rm-muted);
    letter-spacing: 0.02em;
    display: block;
}

.rm-person-row {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    max-width: 100%;
}

.rm-node:nth-child(even) .rm-person-row {
    flex-direction: row-reverse;
    margin-left: auto;
}

.rm-person-photo {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    background: linear-gradient(135deg, #e6f4f4, #f1f5f9);
    border: 2px solid #fff;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.1);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--rm-primary);
    font-size: 0.85rem;
}

.rm-person-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.rm-person-name {
    font-family: var(--rm-font-display);
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--rm-text);
    line-height: 1.25;
    margin: 0;
    transition: color 0.2s ease;
}

.rm-person-sub {
    margin: 2px 0 0;
    font-size: 0.75rem;
    color: var(--rm-muted);
}

.rm-node:hover .rm-person-name,
.rm-node.is-active .rm-person-name {
    color: var(--rm-primary);
}

/* Empty */
.rm-empty {
    text-align: center;
    padding: 64px 20px;
    background: #fff;
    border: 1px solid var(--rm-border);
    border-radius: 18px;
}

.rm-empty i {
    font-size: 2.4rem;
    color: var(--rm-muted);
    margin-bottom: 12px;
}

.rm-empty h2 {
    font-family: var(--rm-font-display);
    font-size: 1.3rem;
    margin: 0 0 8px;
}

.rm-empty p { color: var(--rm-muted); margin: 0; }

.rm-hidden { display: none !important; }

/* Modal */
.rm-modal .modal-content {
    border: none;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(15, 23, 42, 0.2);
}

.rm-modal-top {
    background: linear-gradient(135deg, var(--rm-primary), var(--rm-primary-dark));
    color: #fff;
    padding: 28px 24px 24px;
    text-align: center;
    position: relative;
}

.rm-modal-top .btn-close {
    position: absolute;
    top: 14px;
    right: 14px;
    filter: invert(1);
    opacity: 0.8;
}

.rm-modal-photo {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    background: #fff;
    margin: 0 auto 14px;
    display: block;
}

.rm-modal-photo-placeholder {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    margin: 0 auto 14px;
    background: rgba(255, 255, 255, 0.15);
    border: 4px solid rgba(255, 255, 255, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
}

.rm-modal-name {
    font-family: var(--rm-font-display);
    font-weight: 800;
    font-size: 1.45rem;
    margin: 0 0 4px;
}

.rm-modal-father {
    margin: 0;
    opacity: 0.85;
    font-size: 0.95rem;
}

.rm-modal-body {
    padding: 22px 24px 26px;
}

.rm-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.rm-detail-item {
    background: var(--rm-bg);
    border: 1px solid var(--rm-border);
    border-radius: 12px;
    padding: 12px 14px;
}

.rm-detail-item.full { grid-column: 1 / -1; }

.rm-detail-item label {
    display: block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--rm-muted);
    font-weight: 600;
    margin-bottom: 4px;
}

.rm-detail-item span {
    font-family: var(--rm-font-display);
    font-weight: 700;
    color: var(--rm-text);
    font-size: 0.95rem;
}

.rm-sons,
.rm-notes {
    margin-top: 16px;
}

.rm-sons h6,
.rm-notes h6 {
    font-family: var(--rm-font-display);
    font-size: 0.9rem;
    font-weight: 700;
    margin: 0 0 10px;
    color: var(--rm-text);
}

.rm-son-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.rm-son-tag {
    background: rgba(13, 115, 119, 0.08);
    color: var(--rm-primary-dark);
    border: 1px solid rgba(13, 115, 119, 0.15);
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 0.82rem;
    font-weight: 600;
}

.rm-notes p {
    margin: 0;
    color: var(--rm-text-secondary);
    line-height: 1.65;
    font-size: 0.92rem;
}

@media (max-width: 767px) {
    .rm-timeline::before { left: 18px; }

    .rm-node {
        grid-template-columns: 36px 1fr;
        gap: 2px 10px;
        min-height: 52px;
    }

    .rm-node:nth-child(odd) .rm-date-side,
    .rm-node:nth-child(even) .rm-date-side,
    .rm-node:nth-child(odd) .rm-name-side,
    .rm-node:nth-child(even) .rm-name-side {
        grid-column: 2;
        text-align: left;
        padding: 0;
    }

    .rm-dot-wrap {
        grid-column: 1;
        grid-row: 1 / span 2;
    }

    .rm-dot { left: 50%; }

    .rm-date-side { grid-row: 1; }
    .rm-name-side { grid-row: 2; }

    .rm-person-row,
    .rm-node:nth-child(even) .rm-person-row {
        flex-direction: row;
        margin-left: 0;
    }

    .rm-year-mark { justify-content: flex-start; padding-left: 48px; }
    .rm-detail-grid { grid-template-columns: 1fr; }
    .rm-toolbar { margin-top: -20px; }
}
