/* Explain: Styles for page components including tribute form, memory wall, and media elements. */
/* ---------- Header ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 60;
    backdrop-filter: blur(14px);
    background: rgba(247, 244, 236, 0.78);
    border-bottom: 1px solid var(--border-color);
    transition: background 0.3s ease;
}

.site-header.is-scrolled {
    background: rgba(247, 244, 236, 0.95);
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 2.35rem;
    height: 2.35rem;
    border-radius: 9999px;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.15rem;
    flex: 0 0 auto;
}

.brand-name {
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--text-color);
    white-space: nowrap;
}

.nav-link {
    position: relative;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.25s ease;
}

.nav-link:hover {
    color: var(--primary-color);
}

.nav-link::after {
    content: '';
    position: absolute;
    inset-inline-start: 0;
    bottom: -7px;
    height: 2px;
    width: 0;
    background: var(--primary-color);
    transition: width 0.3s ease;
}

.nav-link:hover::after {
    width: 100%;
}

.mobile-link {
    display: block;
    padding: 0.75rem 0;
    color: var(--text-muted);
    text-decoration: none;
    border-bottom: 1px solid var(--border-color);
    transition: color 0.25s ease;
}

.mobile-link:hover {
    color: var(--primary-color);
}

.menu-toggle {
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
    background: var(--surface-color);
    color: var(--text-color);
    cursor: pointer;
    transition: border-color 0.25s ease, color 0.25s ease;
}

.menu-toggle:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* ---------- Buttons ---------- */
.btn-gold,
.btn-outline {
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 9999px;
    font-weight: 600;
    font-size: 0.95rem;
    min-height: 44px;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease, background 0.3s ease;
}

.btn-gold {
    background: linear-gradient(135deg, var(--primary-color), #e6c552);
    color: #12100a;
    border: 1px solid transparent;
}

.btn-gold:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 34px rgba(201, 162, 39, 0.35);
}

.btn-outline {
    background: transparent;
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn-outline:hover {
    border-color: var(--secondary-color);
    color: var(--secondary-color);
    transform: translateY(-2px);
}

/* ---------- Section headings ---------- */
.section-eyebrow {
    letter-spacing: 0.32em;
    text-transform: uppercase;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--secondary-color);
}

.section-title {
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--text-color);
    line-height: 1.15;
}

.section-title .hl {
    color: var(--primary-color);
}

.section-lead {
    color: var(--text-muted);
    max-width: 46rem;
}

/* ---------- Hero ---------- */
.hero-title {
    font-family: var(--font-heading);
    font-weight: 900;
    font-size: clamp(2.6rem, 9vw, 5.75rem);
    line-height: 1.05;
    background: linear-gradient(135deg, #f7e9b8, var(--primary-color) 55%, #a8841b);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.hero-sub {
    color: #d9d5c8;
    max-width: 40rem;
    margin-inline: auto;
}

.hero-statement {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: clamp(1.05rem, 2.6vw, 1.5rem);
    line-height: 1.55;
    color: #f3e3ac;
    max-width: 48rem;
    margin-inline: auto;
    text-wrap: balance;
}

.legacy-statement {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: clamp(1.15rem, 3.2vw, 1.6rem);
    line-height: 1.5;
    color: var(--primary-color);
    text-wrap: balance;
}

.hero-scrim {
    background: linear-gradient(180deg, rgba(11, 11, 13, 0.88), rgba(11, 11, 13, 0.6) 42%, rgba(11, 11, 13, 0.97));
}

.scroll-cue {
    color: var(--primary-color);
    font-size: 1.4rem;
    animation: cue-bounce 2.2s ease-in-out infinite;
}

@keyframes cue-bounce {
    0%, 100% { transform: translateY(0); opacity: 0.65; }
    50% { transform: translateY(9px); opacity: 1; }
}

/* ---------- Portrait & stats ---------- */
.portrait-frame {
    position: relative;
    aspect-ratio: 4 / 5;
    width: 100%;
    overflow: hidden;
    border-radius: 1rem;
    border: 1px solid var(--border-color);
    background: var(--surface-2);
}

.portrait-frame::after {
    content: '';
    position: absolute;
    inset: 0;
    box-shadow: inset 0 0 90px rgba(0, 0, 0, 0.55);
    pointer-events: none;
}

.stat-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 0.85rem;
    padding: 1rem 1.1rem;
}

.stat-value {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ---------- Timeline ---------- */
.timeline {
    position: relative;
}

.timeline::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 1.15rem;
    width: 2px;
    background: linear-gradient(180deg, transparent, var(--gold-line) 6%, var(--gold-line) 94%, transparent);
}

.tl-item {
    position: relative;
    padding-left: 3.25rem;
    padding-bottom: 2.75rem;
}

.tl-dot {
    position: absolute;
    top: 1.4rem;
    left: 1.15rem;
    margin-left: -0.475rem;
    width: 0.95rem;
    height: 0.95rem;
    border-radius: 9999px;
    background: var(--primary-color);
    box-shadow: 0 0 0 5px rgba(201, 162, 39, 0.12), 0 0 18px rgba(201, 162, 39, 0.55);
    z-index: 2;
}

.tl-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 1.25rem;
    transition: border-color 0.35s ease, transform 0.35s ease, box-shadow 0.35s ease;
}

.tl-card:hover {
    border-color: rgba(201, 162, 39, 0.5);
    transform: translateY(-4px);
    box-shadow: var(--shadow-soft);
}

.tl-year {
    display: inline-block;
    font-family: var(--font-heading);
    font-size: 1.55rem;
    font-weight: 700;
    color: var(--primary-color);
    letter-spacing: 0.04em;
}

.tl-title {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 700;
    margin-top: 0.35rem;
    color: var(--text-color);
}

.tl-text {
    margin-top: 0.5rem;
    color: var(--text-muted);
    font-size: 0.95rem;
}

@media (min-width: 768px) {
    .timeline::before {
        left: 50%;
        margin-left: -1px;
    }

    .tl-item {
        width: 50%;
        padding-left: 0;
        padding-bottom: 3.5rem;
    }

    .tl-item:nth-child(odd) {
        padding-left: 3rem;
    }

    .tl-item:nth-child(even) {
        margin-left: 50%;
        padding-right: 3rem;
    }

    .tl-item:nth-child(odd) .tl-dot {
        left: 0;
        margin-left: -0.475rem;
    }

    .tl-item:nth-child(even) .tl-dot {
        left: auto;
        right: 0;
        margin-left: 0;
        margin-right: -0.475rem;
    }
}

/* ---------- Media frames ---------- */
.media-frame {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
    background: var(--surface-2);
    cursor: pointer;
    padding: 0;
}

.media-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.media-frame:hover img {
    transform: scale(1.05);
}

.media-badge {
    position: absolute;
    inset-inline-end: 0.6rem;
    bottom: 0.6rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.6rem;
    border-radius: 9999px;
    background: rgba(11, 11, 13, 0.75);
    color: var(--primary-color);
    font-size: 0.7rem;
    border: 1px solid var(--gold-line);
}

/* ---------- Gallery ---------- */
.gallery-item {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 4 / 5;
    overflow: hidden;
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
    background: var(--surface-2);
    cursor: pointer;
    padding: 0;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease, filter 0.6s ease;
    filter: saturate(0.85);
}

.gallery-item:hover img {
    transform: scale(1.07);
    filter: saturate(1.1);
}

.gallery-item::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 55%, rgba(11, 11, 13, 0.75));
    opacity: 0;
    transition: opacity 0.35s ease;
}

.gallery-item:hover::after {
    opacity: 1;
}

/* ---------- Lightbox ---------- */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(4, 4, 5, 0.92);
    backdrop-filter: blur(8px);
}

.lightbox.is-open {
    display: flex;
}

.lightbox-close {
    position: absolute;
    top: 1.25rem;
    inset-inline-end: 1.25rem;
    display: grid;
    place-items: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 9999px;
    border: 1px solid var(--border-color);
    background: var(--surface-color);
    color: var(--text-color);
    font-size: 1.1rem;
    cursor: pointer;
    transition: border-color 0.25s ease, color 0.25s ease;
}

.lightbox-close:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.lightbox-figure {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.85rem;
    max-width: min(92vw, 1040px);
    margin: 0;
}

.lightbox-figure img {
    max-height: 76vh;
    max-width: 100%;
    width: auto;
    border-radius: 0.85rem;
    box-shadow: var(--shadow-soft);
    transition: opacity 0.3s ease;
    opacity: 1;
}

.lb-spinner {
    position: absolute;
    top: 45%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none;
    color: var(--primary-color);
    font-size: 1.9rem;
}

.lightbox.is-loading .lb-spinner {
    display: block;
}

.lightbox.is-loading .lightbox-figure img {
    opacity: 0;
}

.lightbox-caption {
    color: var(--text-muted);
    font-size: 0.95rem;
    text-align: center;
}

/* ---------- Memory cards (audio & video) ---------- */
.memory-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 1.25rem;
    transition: border-color 0.35s ease, transform 0.35s ease;
}

.memory-card:hover {
    border-color: rgba(46, 196, 182, 0.45);
    transform: translateY(-4px);
}

.memory-icon {
    display: grid;
    place-items: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 9999px;
    background: rgba(46, 196, 182, 0.12);
    color: var(--secondary-color);
    border: 1px solid rgba(46, 196, 182, 0.3);
}

.audio-player {
    width: 100%;
    margin-top: 0.9rem;
    filter: sepia(0.35) saturate(1.1) hue-rotate(-8deg);
}

.video-frame {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 0.75rem;
    overflow: hidden;
    border: 1px solid var(--border-color);
    background: #000;
    margin-top: 0.9rem;
}

.video-frame video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ---------- Map & places ---------- */
.map-frame {
    width: 100%;
    aspect-ratio: 16 / 11;
    border-radius: 1rem;
    overflow: hidden;
    border: 1px solid var(--border-color);
    background: var(--surface-2);
}

.map-frame iframe {
    width: 100%;
    height: 100%;
    border: 0;
    filter: invert(0.9) hue-rotate(180deg) saturate(0.6) brightness(0.95);
}

.place-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 0.85rem;
    padding: 1rem 1.1rem;
    transition: border-color 0.3s ease;
}

.place-card:hover {
    border-color: var(--gold-line);
}

.place-icon {
    color: var(--primary-color);
    font-size: 1.1rem;
}

/* ---------- Forms ---------- */
.field-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.4rem;
}

.field-input {
    width: 100%;
    padding: 0.75rem 0.9rem;
    border-radius: 0.7rem;
    border: 1px solid var(--border-color);
    background: var(--surface-2);
    color: var(--text-color);
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.field-input::placeholder {
    color: #6f6c64;
}

.field-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.16);
}

.form-status {
    min-height: 1.4rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.form-status.is-ok {
    color: var(--secondary-color);
}

.form-status.is-err {
    color: #e0776f;
}

.field-hint {
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.tribute-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding: 0;
    list-style: none;
}

.tribute-preview-item {
    width: 4.5rem;
    height: 4.5rem;
    border-radius: 0.6rem;
    overflow: hidden;
    border: 1px solid var(--border-color);
    background: var(--surface-2);
}

.tribute-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wall-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.wall-shot {
    width: 5.25rem;
    height: 5.25rem;
    border-radius: 0.6rem;
    overflow: hidden;
    border: 1px solid var(--border-color);
    background: var(--surface-2);
    padding: 0;
    cursor: pointer;
    transition: border-color 0.25s ease, transform 0.25s ease;
}

.wall-shot:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.wall-shot img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ---------- Footer ---------- */
.site-footer {
    border-top: 1px solid var(--border-color);
    background: var(--surface-color);
}

.footer-link {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.25s ease;
}

.footer-link:hover {
    color: var(--primary-color);
}

/* ---------- Scroll reveal ---------- */
.reveal {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal.is-visible {
    opacity: 1;
    transform: none;
}

/* ---------- Story page ---------- */
.chapter-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.45rem 1.05rem;
    border-radius: 9999px;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.9rem;
    text-decoration: none;
    transition: border-color 0.25s ease, color 0.25s ease, background 0.25s ease;
}

.chapter-chip:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: rgba(201, 162, 39, 0.08);
}

.chapter-era {
    display: inline-block;
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    color: var(--primary-color);
}

/* ---------- Memories wall ---------- */
.wall-quote {
    color: var(--gold-line);
    font-size: 1.5rem;
}

.wall-text {
    margin-top: 0.75rem;
    color: var(--text-color);
    font-size: 0.98rem;
    line-height: 1.7;
    white-space: pre-line;
    overflow-wrap: anywhere;
}

.wall-meta {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.wall-avatar {
    display: grid;
    place-items: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 9999px;
    background: rgba(201, 162, 39, 0.14);
    border: 1px solid var(--gold-line);
    color: var(--primary-color);
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.1rem;
    flex: 0 0 auto;
}

.wall-name {
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--text-color);
    font-size: 0.98rem;
}

.wall-date {
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* ---------- Nav "More" dropdown ---------- */
.more-menu {
    position: absolute;
    top: calc(100% + 0.75rem);
    inset-inline-start: 0;
    min-width: 12rem;
    padding: 0.5rem;
    border-radius: 0.85rem;
    border: 1px solid var(--border-color);
    background: var(--surface-color);
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    z-index: 70;
}

.more-menu[hidden] {
    display: none;
}

.more-link {
    padding: 0.5rem 0.75rem;
    border-radius: 0.6rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.2s ease, color 0.2s ease;
}

.more-link:hover {
    background: rgba(201, 162, 39, 0.1);
    color: var(--primary-color);
}

/* ---------- Timeline links & list ---------- */
.tl-more {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary-color);
    text-decoration: none;
    transition: gap 0.25s ease, color 0.25s ease;
}

.tl-more:hover {
    gap: 0.7rem;
    color: var(--primary-hover);
}

.tl-list-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    background: var(--surface-color);
    text-decoration: none;
    transition: border-color 0.35s ease, transform 0.35s ease;
}

.tl-list-card:hover {
    border-color: rgba(201, 162, 39, 0.5);
    transform: translateY(-4px);
}

.tl-list-card .tl-more {
    margin-top: auto;
    padding-top: 1rem;
}

/* ---------- Timeline detail page ---------- */
.event-shot {
    aspect-ratio: 4 / 5;
}

.story-body {
    color: var(--text-muted);
    font-size: 1.05rem;
    line-height: 1.8;
}

.story-body p {
    margin-top: 1rem;
}

.story-body p:first-child {
    margin-top: 0;
}

.story-quote {
    display: flex;
    align-items: flex-start;
    gap: 0.9rem;
    margin-top: 1.75rem;
    padding: 1.25rem 1.4rem;
    border-inline-start: 3px solid var(--primary-color);
    border-radius: 1rem;
    background: var(--surface-color);
}

.story-quote i {
    color: var(--primary-color);
    font-size: 1.2rem;
    margin-top: 0.2rem;
}

.story-quote p {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    color: var(--text-color);
}

/* ---------- Header search ---------- */
.header-search {
    align-items: center;
    gap: 0.25rem;
    padding-block: 0.25rem;
    padding-inline: 0.85rem 0.4rem;
    border: 1px solid var(--border-color);
    border-radius: 9999px;
    background: var(--surface-color);
    transition: border-color 0.25s ease;
}

.header-search:focus-within {
    border-color: var(--primary-color);
}

.header-search-input {
    width: 100%;
    min-width: 0;
    border: 0;
    background: transparent;
    color: var(--text-color);
    font-family: inherit;
    font-size: 0.85rem;
    padding: 0.35rem 0;
}

.header-search-input::placeholder {
    color: #6f6c64;
}

.header-search-input:focus {
    outline: none;
}

.header-search-btn {
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    flex: 0 0 auto;
    border-radius: 9999px;
    border: 0;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.25s ease, background 0.25s ease;
}

.header-search-btn:hover {
    color: var(--primary-color);
    background: rgba(201, 162, 39, 0.1);
}

/* ---------- Search page ---------- */
.search-page-form {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    width: 100%;
    max-width: 40rem;
    margin-inline: auto;
    flex-wrap: wrap;
}

.search-page-input {
    flex: 1 1 14rem;
    min-width: 0;
    padding: 0.85rem 1.1rem;
    border-radius: 9999px;
    border: 1px solid var(--border-color);
    background: var(--surface-2);
    color: var(--text-color);
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.search-page-input::placeholder {
    color: #6f6c64;
}

.search-page-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.16);
}

.search-status {
    color: var(--text-muted);
    font-size: 0.95rem;
    text-align: center;
    overflow-wrap: anywhere;
}

.search-results {
    display: grid;
    gap: 1rem;
}

@media (min-width: 768px) {
    .search-results {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.search-result-card {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    padding: 1.1rem 1.25rem;
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    background: var(--surface-color);
    text-decoration: none;
    transition: border-color 0.3s ease, transform 0.3s ease;
}

.search-result-card:hover {
    border-color: rgba(201, 162, 39, 0.5);
    transform: translateY(-3px);
}

.search-result-thumb {
    flex: 0 0 auto;
    width: 4.5rem;
    height: 4.5rem;
    border-radius: 0.7rem;
    overflow: hidden;
    border: 1px solid var(--border-color);
    background: var(--surface-2);
}

.search-result-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.search-result-body {
    min-width: 0;
}

.search-result-group {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--secondary-color);
}

.search-result-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-color);
    margin-top: 0.25rem;
    overflow-wrap: anywhere;
}

.search-result-snippet {
    margin-top: 0.4rem;
    color: var(--text-muted);
    font-size: 0.92rem;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

/* ---------- Family tree ---------- */
.gen-chip {
    display: inline-block;
    padding: 0.45rem 1.3rem;
    border-radius: 9999px;
    background: var(--surface-color);
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    font-weight: 700;
    font-size: 0.85rem;
    box-shadow: 0 4px 15px rgba(201, 162, 39, 0.15);
}

.family-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 14rem;
    padding: 1.5rem 1.15rem;
    text-align: center;
    cursor: pointer;
    font-family: inherit;
    color: var(--text-color);
}

.family-photo {
    display: grid;
    place-items: center;
    width: 7rem;
    height: 7rem;
    border-radius: 9999px;
    overflow: hidden;
    border: 2px solid var(--primary-color);
    background: var(--surface-2);
    margin-bottom: 1rem;
    transition: border-color 0.3s ease;
}

.family-card:hover .family-photo {
    border-color: var(--secondary-color);
}

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

.family-photo-fallback {
    color: var(--text-muted);
    font-size: 2rem;
}

.family-name {
    display: block;
}

.family-relation {
    display: block;
    margin-top: 0.3rem;
    color: var(--text-muted);
    font-size: 0.92rem;
}

.family-years {
    display: block;
    margin-top: 0.2rem;
    color: var(--primary-color);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.family-more {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 1rem;
    color: var(--secondary-color);
    font-size: 0.82rem;
    font-weight: 600;
    transition: gap 0.25s ease;
}

.family-card:hover .family-more {
    gap: 0.65rem;
}

.family-place {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin-top: 0.3rem;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.family-parent {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin-top: 0.3rem;
    color: var(--secondary-color);
    font-size: 0.8rem;
}

.family-modal-place {
    margin-top: 0.35rem;
    color: var(--text-muted);
    font-size: 0.92rem;
}

/* ---------- Family member modal ---------- */
.family-modal-figure {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    max-width: min(92vw, 30rem);
    margin: 0;
    text-align: center;
}

.family-modal-photo {
    position: relative;
    width: 9rem;
    height: 9rem;
    border-radius: 9999px;
    overflow: hidden;
    border: 2px solid var(--primary-color);
    background: var(--surface-2);
}

.family-modal-photo.is-empty {
    display: none;
}

.family-modal-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.3s ease;
}

.family-modal-photo.is-loading img {
    opacity: 0;
}

.family-modal-photo .lb-spinner {
    display: none;
}

.family-modal-photo.is-loading .lb-spinner {
    display: block;
}

.family-modal-body {
    width: 100%;
    padding: 1.5rem 1.4rem;
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    background: var(--surface-color);
}

.family-modal-name {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color);
}

.family-modal-rel {
    margin-top: 0.35rem;
    color: var(--secondary-color);
    font-size: 0.95rem;
}

.family-modal-years {
    margin-top: 0.2rem;
    color: var(--primary-color);
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.family-modal-bio {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1.75;
    white-space: pre-line;
}

@media (prefers-reduced-motion: reduce) {
    .reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .scroll-cue {
        animation: none;
    }
}

/* ---------- Media gallery page ---------- */
.gallery-video-fallback {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    background: var(--surface-2);
    color: var(--secondary-color);
    font-size: 2rem;
}

.lightbox-video {
    max-height: 76vh;
    max-width: 100%;
    width: auto;
    border-radius: 0.85rem;
    box-shadow: var(--shadow-soft);
    background: #000;
}

/* ---------- FAQ accordion ---------- */
.faq-item {
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    background: var(--surface-color);
    overflow: hidden;
    transition: border-color 0.3s ease;
}

.faq-item:hover {
    border-color: rgba(201, 162, 39, 0.5);
}

.faq-item[open] {
    border-color: var(--gold-line);
}

.faq-question {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.1rem 1.25rem;
    cursor: pointer;
    list-style: none;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text-color);
    transition: color 0.25s ease;
}

.faq-question::-webkit-details-marker {
    display: none;
}

.faq-question:hover {
    color: var(--primary-color);
}

.faq-chevron {
    flex: 0 0 auto;
    color: var(--primary-color);
    font-size: 0.8rem;
    transition: transform 0.3s ease;
}

.faq-item[open] .faq-chevron {
    transform: rotate(180deg);
}

.faq-answer {
    padding: 0 1.25rem 1.35rem;
    color: var(--text-muted);
    line-height: 1.75;
    font-size: 0.98rem;
}

/* ---------- Memorial candles ---------- */
.candle-count-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1.15rem;
    border-radius: 9999px;
    border: 1px solid var(--gold-line);
    background: rgba(201, 162, 39, 0.1);
    color: var(--primary-color);
    font-weight: 700;
    font-size: 0.95rem;
}

.candle-form {
    max-width: 42rem;
    margin-inline: auto;
    margin-top: 3rem;
}

.candle-form .btn-gold {
    width: 100%;
}

.candle-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
    gap: 1rem;
}

.candle-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.4rem;
    padding: 1.35rem 0.9rem 1.1rem;
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    background: linear-gradient(180deg, var(--surface-2), var(--surface-color));
    transition: border-color 0.35s ease, transform 0.35s ease, box-shadow 0.35s ease;
}

.candle-card:hover {
    border-color: var(--gold-line);
    transform: translateY(-4px);
    box-shadow: 0 14px 34px rgba(201, 162, 39, 0.16);
}

.candle-flame {
    display: grid;
    place-items: center;
    width: 3rem;
    height: 3rem;
    border-radius: 9999px;
    background: radial-gradient(circle at 50% 62%, rgba(255, 196, 79, 0.4), rgba(201, 162, 39, 0.06));
    color: #ffc44f;
    font-size: 1.35rem;
    box-shadow: 0 0 22px rgba(255, 196, 79, 0.28);
    animation: candle-flicker 2.8s ease-in-out infinite;
}

@keyframes candle-flicker {
    0%, 100% {
        opacity: 0.8;
        transform: scale(0.97);
    }
    45% {
        opacity: 1;
        transform: scale(1.04);
    }
}

.candle-name {
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--text-color);
    font-size: 0.98rem;
    overflow-wrap: anywhere;
}

.candle-message {
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.55;
    white-space: pre-line;
    overflow-wrap: anywhere;
}

.candle-hebrew {
    color: var(--primary-color);
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.92rem;
    overflow-wrap: anywhere;
}

.candle-by {
    color: var(--text-muted);
    font-size: 0.82rem;
    overflow-wrap: anywhere;
}

.candle-date {
    color: var(--text-muted);
    font-size: 0.72rem;
    opacity: 0.8;
}

.candle-card.is-new {
    animation: candle-pop 0.7s ease;
}

@keyframes candle-pop {
    from { opacity: 0; transform: translateY(-12px) scale(0.94); }
    to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    .candle-card.is-new {
        animation: none;
    }
}

/* ---------- Updates signup (footer) ---------- */
.updates-signup {
    padding: 1.75rem 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: 1.25rem;
    background: linear-gradient(180deg, var(--surface-2), var(--surface-color));
}

.updates-form {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    flex-wrap: wrap;
    width: 100%;
    max-width: 34rem;
    margin: 1.5rem auto 0;
}

.updates-field {
    flex: 1 1 14rem;
    min-width: 0;
}

.updates-field .field-input {
    border-radius: 9999px;
    padding: 0.8rem 1.15rem;
}

/* ---------- Memory card generator ---------- */
.mem-card {
    position: relative;
    width: 100%;
    max-width: 24rem;
    margin-inline: auto;
    padding: 1.15rem;
    border-radius: 1.15rem;
    background: linear-gradient(160deg, var(--paper-color), var(--paper-color-alt));
    box-shadow: var(--shadow-soft);
}

.mem-card::after {
    content: '';
    position: absolute;
    inset: 0.65rem;
    border: 1px solid rgba(201, 162, 39, 0.75);
    border-radius: 0.85rem;
    pointer-events: none;
}

.mem-card-frame {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 2rem 1.35rem 2.25rem;
    border: 1px solid var(--paper-border);
    border-radius: 0.7rem;
    background: radial-gradient(circle at 50% 10%, rgba(201, 162, 39, 0.14), transparent 58%);
}

.mem-card-eyebrow {
    font-size: 0.72rem;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    font-weight: 600;
    color: #8a7b4a;
}

.mem-card-portrait {
    width: 8.5rem;
    height: 8.5rem;
    margin-top: 1.1rem;
    border-radius: 9999px;
    overflow: hidden;
    border: 3px solid var(--primary-color);
    background: var(--paper-color-alt);
    box-shadow: 0 10px 26px rgba(38, 32, 25, 0.22);
}

.mem-card-portrait img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mem-card-name {
    margin-top: 1.25rem;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.55rem;
    line-height: 1.25;
    color: var(--ink-color);
    overflow-wrap: anywhere;
}

.mem-card-years {
    margin-top: 0.4rem;
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: 0.08em;
    color: #a8841b;
}

.mem-card-rule {
    display: block;
    width: 5.5rem;
    height: 1px;
    margin-top: 0.9rem;
    background: linear-gradient(90deg, transparent, var(--primary-color), transparent);
}

.mem-card-event {
    margin-top: 0.9rem;
    font-weight: 600;
    font-size: 1.05rem;
    color: #177f75;
    overflow-wrap: anywhere;
}

.mem-card-event.is-empty {
    color: var(--ink-muted);
    opacity: 0.7;
}

.mem-card-quote {
    margin-top: 1.4rem;
    font-family: var(--font-heading);
    font-size: 1.02rem;
    line-height: 1.7;
    color: var(--ink-muted);
    overflow-wrap: anywhere;
}

.mem-card-mark {
    margin-top: 1.6rem;
    color: var(--primary-color);
    font-size: 0.8rem;
}

.mem-card-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.65rem;
    margin-top: 1.5rem;
}

@media print {
    html.printing-card,
    html.printing-card body {
        background: #ffffff !important;
    }

    html.printing-card .site-header,
    html.printing-card .site-footer,
    html.printing-card main > section:not(#memory-card) {
        display: none !important;
    }

    html.printing-card #memory-card {
        padding-block: 0;
        background: none;
    }

    html.printing-card #memory-card .container-museum {
        max-width: none;
        padding-inline: 0;
    }

    html.printing-card #memoryCardIntro,
    html.printing-card #memoryCardForm,
    html.printing-card .mem-card-controls {
        display: none !important;
    }

    html.printing-card #memoryCardLayout {
        display: block;
        margin: 0;
    }

    html.printing-card #memoryCardArea {
        width: 100%;
    }

    html.printing-card #memoryCard {
        max-width: 21rem;
        margin: 1.5rem auto 0;
        box-shadow: none;
        page-break-inside: avoid;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* ---------- Hidden helper (robust for HTML hidden attribute) ---------- */
[hidden] {
    display: none !important;
}

/* ---------- Voice memory recorder ---------- */
.recorder-box {
    margin-top: 0.35rem;
    padding: 1.1rem 1.15rem 1.25rem;
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    background: var(--surface-2);
}

.rec-dot {
    display: inline-block;
    width: 0.85rem;
    height: 0.85rem;
    border-radius: 9999px;
    background: #e0534b;
    box-shadow: 0 0 0 0 rgba(224, 83, 75, 0.55);
    animation: rec-pulse 1.4s ease-out infinite;
}

@keyframes rec-pulse {
    0% { box-shadow: 0 0 0 0 rgba(224, 83, 75, 0.55); }
    70% { box-shadow: 0 0 0 12px rgba(224, 83, 75, 0); }
    100% { box-shadow: 0 0 0 0 rgba(224, 83, 75, 0); }
}

.rec-timer {
    font-variant-numeric: tabular-nums;
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.06em;
    color: #e0534b;
    min-width: 3.25rem;
    text-align: center;
}

.wall-audio {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--border-color);
}

.wall-audio-label {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
}

.wall-audio-label .wall-date {
    margin-inline-start: auto;
    white-space: nowrap;
}

.wall-video {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--border-color);
}

.wall-video-label {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
}

.wall-video-label .wall-date {
    margin-inline-start: auto;
    white-space: nowrap;
}

.wall-video-frame {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 0.75rem;
    overflow: hidden;
    border: 1px solid var(--border-color);
    background: #000;
}

.wall-video-frame video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.video-preview {
    width: 100%;
    max-width: 22rem;
    aspect-ratio: 16 / 9;
    border-radius: 0.75rem;
    overflow: hidden;
    border: 1px solid var(--border-color);
    background: #000;
}

.video-preview video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* ---------- Photo albums by period ---------- */
.album-years {
    display: inline-block;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.16em;
    color: var(--primary-color);
}

.album-desc {
    max-width: 32rem;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.album-photo {
    margin: 0;
}

.album-caption {
    margin-top: 0.5rem;
    color: var(--text-muted);
    font-size: 0.82rem;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

/* ---------- Archive page ---------- */
.archive-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    background: var(--surface-color);
    transition: border-color 0.35s ease, transform 0.35s ease, box-shadow 0.35s ease;
}

.archive-card:hover {
    border-color: rgba(201, 162, 39, 0.5);
    transform: translateY(-4px);
    box-shadow: var(--shadow-soft);
}

.archive-card .tl-title {
    margin-top: 0.65rem;
}

.archive-type {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.75rem;
    border-radius: 9999px;
    border: 1px solid var(--gold-line);
    background: rgba(201, 162, 39, 0.1);
    color: var(--primary-color);
    font-size: 0.72rem;
    font-weight: 600;
}

.archive-year {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--primary-color);
    letter-spacing: 0.04em;
}

.archive-desc {
    margin-top: 0.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

/* ---------- Language switcher ---------- */
.lang-switch {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
    padding: 0.15rem;
    border-radius: 9999px;
    border: 1px solid var(--border-color);
    background: var(--surface-color);
}

.lang-btn {
    min-width: 2.4rem;
    min-height: 2rem;
    padding: 0.25rem 0.6rem;
    border: 0;
    border-radius: 9999px;
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.25s ease, color 0.25s ease;
}

.lang-btn:hover {
    color: var(--primary-color);
}

.lang-btn.is-active {
    background: var(--primary-color);
    color: #12100a;
}

/* ---------- LTR reading adjustments (English mode) ---------- */
html[dir="ltr"] .book-body > p:first-of-type::first-letter {
    float: left;
    margin: 0.2rem 0.6rem 0 0;
}

html[dir="ltr"] .tl-actions .tl-more i,
html[dir="ltr"] .book-toc-arrow,
html[dir="ltr"] .tl-list-card .tl-more i {
    transform: scaleX(-1);
}

/* ---------- Family roots ---------- */
.roots-photo {
    margin: 0;
}

.roots-photo img {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    border-radius: 1rem;
    border: 1px solid var(--border-color);
    background: var(--surface-2);
}

.roots-photo figcaption {
    margin-top: 0.65rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.55;
}

.roots-parents {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
}

.roots-person {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 1rem 1.1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.9rem;
    background: var(--surface-color);
    transition: border-color 0.3s ease, transform 0.3s ease;
}

.roots-person:hover {
    border-color: var(--gold-line);
    transform: translateY(-3px);
}

.roots-person-icon,
.roots-sibling-icon {
    display: grid;
    place-items: center;
    width: 2.75rem;
    height: 2.75rem;
    flex: 0 0 auto;
    border-radius: 9999px;
    border: 1px solid var(--gold-line);
    background: rgba(201, 162, 39, 0.12);
    color: var(--primary-color);
    font-size: 1.05rem;
}

.roots-person-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.roots-person-name {
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--text-color);
    overflow-wrap: anywhere;
}

.roots-person-role {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.roots-sibling {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.6rem;
    padding: 1.5rem 1.15rem;
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    background: linear-gradient(180deg, var(--surface-2), var(--surface-color));
    transition: border-color 0.35s ease, transform 0.35s ease, box-shadow 0.35s ease;
}

.roots-sibling:hover {
    border-color: var(--gold-line);
    transform: translateY(-4px);
    box-shadow: 0 14px 34px rgba(201, 162, 39, 0.16);
}

.roots-sibling-name {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-color);
    overflow-wrap: anywhere;
}

.roots-sibling-note {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.55;
    overflow-wrap: anywhere;
}

/* ---------- Life in numbers ---------- */
.numbers-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

@media (min-width: 640px) {
    .numbers-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .numbers-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

.number-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.65rem;
    padding: 1.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    background: linear-gradient(180deg, var(--surface-2), var(--surface-color));
    transition: border-color 0.35s ease, transform 0.35s ease, box-shadow 0.35s ease;
}

.number-card:hover {
    border-color: var(--gold-line);
    transform: translateY(-4px);
    box-shadow: 0 14px 34px rgba(201, 162, 39, 0.16);
}

.number-icon {
    display: grid;
    place-items: center;
    width: 3rem;
    height: 3rem;
    border-radius: 9999px;
    border: 1px solid var(--gold-line);
    background: rgba(201, 162, 39, 0.12);
    color: var(--primary-color);
    font-size: 1.25rem;
}

.number-value {
    font-family: var(--font-heading);
    font-weight: 900;
    font-size: clamp(2rem, 6vw, 2.75rem);
    line-height: 1;
    color: var(--primary-color);
    font-variant-numeric: tabular-nums;
}

.number-label {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

@media (prefers-reduced-motion: reduce) {
    .number-card {
        transition: none;
        transform: none;
    }
}