/* Explain: Styles for the 'Deaths of Atareb' section, including cards, filters, and detail modal. */
/* ------------------------------------------------------------------
   وفيات الأتارب (Deaths) — a solemn charcoal-navy identity used by the
   homepage sidebar block and the deaths section: the two latest deaths,
   a collapsible add form, search + year filter, cards and a detail view.
   ------------------------------------------------------------------ */

.deaths-section {
    background: var(--death-bg);
}

/* ---- Homepage sidebar block ---- */
.deaths-block {
    padding: 1.25rem;
    background: linear-gradient(180deg, var(--death-surface) 0%, var(--death-bg) 100%);
    border: 1px solid var(--death-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--death-shadow);
    color: var(--death-text);
}

.deaths-block-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 800;
    line-height: 1.5;
    color: var(--death-text);
}

.deaths-block-title i {
    color: var(--death-accent);
}

a.deaths-block-title {
    transition: color 0.25s ease;
}

a.deaths-block-title:hover,
a.deaths-block-title:focus-visible {
    color: var(--death-accent-strong);
}

.deaths-block-sub {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    line-height: 1.8;
    color: var(--death-muted);
}

.deaths-mini {
    display: grid;
    gap: 0.6rem;
    margin-top: 1rem;
    margin-bottom: 0;
    padding: 0;
    list-style: none;
}

.deaths-mini-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--death-border);
    border-radius: var(--radius-sm);
    transition: border-color 0.25s ease, background-color 0.25s ease;
}

.deaths-mini-row:hover {
    background: rgba(255, 255, 255, 0.09);
    border-color: var(--death-accent);
}

.deaths-mini-thumb {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    flex: none;
    overflow: hidden;
    border-radius: 0.6rem;
    background: var(--death-surface-2);
    color: var(--death-muted);
    font-size: 1rem;
}

.deaths-mini-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.deaths-mini-name {
    display: block;
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.6;
    color: var(--death-text);
    overflow-wrap: anywhere;
}

.deaths-mini-row:hover .deaths-mini-name {
    color: var(--death-accent-strong);
}

.deaths-mini-date {
    display: block;
    margin-top: 0.1rem;
    font-size: 0.72rem;
    color: var(--death-muted);
}

.deaths-mini-empty {
    margin-top: 0.9rem;
    padding: 0.9rem 0.75rem;
    font-size: 0.84rem;
    line-height: 1.8;
    text-align: center;
    color: var(--death-muted);
    border: 1px dashed var(--death-border);
    border-radius: var(--radius-sm);
}

/* ---- Collapsible add form (details / summary) ---- */
.deaths-acc {
    margin-top: 1rem;
}

.deaths-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    min-height: 2.75rem;
    padding: 0.6rem 1rem;
    border: 1px solid var(--death-accent);
    border-radius: 999px;
    background: transparent;
    color: var(--death-accent-strong);
    font-family: var(--font-heading);
    font-size: 0.92rem;
    font-weight: 800;
    line-height: 1.5;
    cursor: pointer;
    list-style: none;
    transition: all 0.25s ease;
}

.deaths-toggle::-webkit-details-marker {
    display: none;
}

.deaths-toggle:hover,
.deaths-acc[open] .deaths-toggle {
    background: rgba(143, 163, 184, 0.18);
    color: var(--death-on);
}

.deaths-toggle-chevron {
    transition: transform 0.25s ease;
}

.deaths-acc[open] .deaths-toggle-chevron {
    transform: rotate(180deg);
}

.deaths-form {
    display: grid;
    gap: 0.8rem;
    margin-top: 1rem;
}

.deaths-label {
    display: block;
    margin-bottom: 0.3rem;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--death-muted);
}

.deaths-form .input,
.deaths-form .file-input,
.deaths-tools .input,
.deaths-tools .select {
    background: var(--death-surface-2);
    border-color: var(--death-border);
    color: var(--death-text);
}

.deaths-form .input::placeholder,
.deaths-tools .input::placeholder {
    color: var(--death-muted);
}

.deaths-tools .select option {
    background: var(--death-surface-2);
    color: var(--death-text);
}

.deaths-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 2.75rem;
    padding: 0.7rem 1.2rem;
    border: 1px solid var(--death-accent);
    border-radius: 999px;
    background: rgba(143, 163, 184, 0.16);
    color: var(--death-text);
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.25s ease;
}

.deaths-submit:hover {
    background: rgba(143, 163, 184, 0.3);
    color: var(--death-on);
    transform: translateY(-2px);
}

.deaths-msg {
    font-size: 0.83rem;
    font-weight: 700;
    text-align: center;
    color: var(--death-muted);
}

.deaths-msg.is-ok {
    color: #a3d2a5;
}

.deaths-msg.is-error {
    color: #eda9a0;
}

.deaths-note {
    font-size: 0.72rem;
    line-height: 1.7;
    text-align: center;
    color: var(--death-muted);
}

.deaths-block-foot {
    margin-top: 1.1rem;
    padding-top: 0.85rem;
    border-top: 1px dashed var(--death-border);
    text-align: center;
    font-family: var(--font-heading);
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--death-accent);
}

/* ---- Page hero ---- */
.deaths-hero {
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid var(--death-border);
}

.deaths-hero-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.deaths-hero-scrim {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(21, 26, 32, 0.88) 0%, rgba(21, 26, 32, 0.94) 55%, var(--death-bg) 100%);
}

.deaths-hero-title {
    margin-top: 1rem;
    font-family: var(--font-heading);
    font-size: 2.1rem;
    font-weight: 800;
    line-height: 1.35;
    color: var(--death-text);
}

@media (min-width: 640px) {
    .deaths-hero-title {
        font-size: 2.75rem;
    }
}

.deaths-hero-sub {
    margin-top: 0.85rem;
    max-width: 44rem;
    font-size: 1rem;
    line-height: 2;
    color: var(--death-muted);
}

.deaths-hero-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 2.75rem;
    padding: 0.8rem 1.5rem;
    border: 1px solid var(--death-accent);
    border-radius: 999px;
    background: rgba(143, 163, 184, 0.18);
    color: var(--death-text);
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 800;
    line-height: 1.5;
    cursor: pointer;
    transition: all 0.25s ease;
}

.deaths-hero-cta:hover {
    background: rgba(143, 163, 184, 0.32);
    color: var(--death-on);
    transform: translateY(-2px);
}

.deaths-hero-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 2.75rem;
    padding: 0.8rem 1.5rem;
    border: 1px solid var(--death-border);
    border-radius: 999px;
    color: var(--death-muted);
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.5;
    transition: all 0.25s ease;
}

.deaths-hero-link:hover {
    border-color: var(--death-accent);
    color: var(--death-text);
}

/* ---- Registry: head, search, filter, cards ---- */
.deaths-head {
    display: grid;
    gap: 1rem;
}

@media (min-width: 768px) {
    .deaths-head {
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: end;
    }
}

.deaths-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.3rem 0.85rem;
    border: 1px solid var(--death-border);
    border-radius: 999px;
    background: rgba(143, 163, 184, 0.14);
    color: var(--death-accent-strong);
    font-size: 0.78rem;
    font-weight: 700;
}

.deaths-title {
    margin-top: 0.85rem;
    font-family: var(--font-heading);
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1.4;
    color: var(--death-text);
}

.deaths-sub {
    margin-top: 0.5rem;
    max-width: 42rem;
    font-size: 0.95rem;
    line-height: 1.9;
    color: var(--death-muted);
}

.deaths-tools {
    display: grid;
    gap: 0.85rem;
    margin-top: 1.75rem;
    padding: 1rem;
    background: var(--death-surface);
    border: 1px solid var(--death-border);
    border-radius: var(--radius-lg);
}

@media (min-width: 768px) {
    .deaths-tools {
        grid-template-columns: minmax(0, 1fr) minmax(0, 15rem);
        align-items: end;
    }
}

.deaths-count {
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--death-muted);
}

.deaths-grid {
    display: grid;
    gap: 1rem;
    margin-top: 1.25rem;
    grid-template-columns: minmax(0, 1fr);
}

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

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

.death-card {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    overflow: hidden;
    padding: 0;
    text-align: start;
    background: var(--death-surface);
    border: 1px solid var(--death-border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.death-card:hover,
.death-card:focus-visible {
    transform: translateY(-4px);
    border-color: var(--death-accent);
    box-shadow: var(--death-shadow);
}

.death-card.is-target {
    border-color: var(--death-accent-strong);
    box-shadow: 0 0 0 3px rgba(143, 163, 184, 0.35);
}

.death-card.is-filtered-out {
    display: none !important;
}

.death-card-media {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: var(--death-surface-2);
}

.death-card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

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

.death-card-initial {
    font-family: var(--font-heading);
    font-size: 2.4rem;
    font-weight: 800;
    color: var(--death-accent);
}

.death-card-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 0.35rem;
    padding: 1rem 1.1rem 1.15rem;
}

.death-card-name {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 800;
    line-height: 1.6;
    color: var(--death-text);
    overflow-wrap: anywhere;
}

.death-card:hover .death-card-name {
    color: var(--death-accent-strong);
}

.death-card-dates {
    display: grid;
    gap: 0.2rem;
    font-size: 0.78rem;
    line-height: 1.7;
    color: var(--death-muted);
}

.death-card-more {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: auto;
    padding-top: 0.7rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--death-accent);
}

.deaths-empty {
    margin-top: 1.25rem;
    padding: 2rem 1.25rem;
    text-align: center;
    line-height: 1.9;
    color: var(--death-muted);
    border: 1px dashed var(--death-border);
    border-radius: var(--radius-lg);
}

.deaths-foot {
    margin-top: 2.25rem;
    padding-top: 1.25rem;
    border-top: 1px dashed var(--death-border);
    text-align: center;
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    color: var(--death-accent);
}

/* ---- Detail view (full record + photo at its largest size) ---- */
.deaths-modal {
    position: fixed;
    inset: 0;
    z-index: 85;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(8, 11, 14, 0.9);
}

.deaths-modal.is-open {
    display: flex;
}

.deaths-modal-panel {
    width: min(46rem, 96vw);
    max-height: 92vh;
    overflow-y: auto;
    padding: 1.5rem;
    background: var(--death-surface);
    border: 1px solid var(--death-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--death-shadow);
    color: var(--death-text);
}

.deaths-modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.deaths-modal-title {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 800;
    line-height: 1.6;
    color: var(--death-text);
    overflow-wrap: anywhere;
}

.deaths-modal-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.4rem;
    height: 2.4rem;
    flex: none;
    border: 1px solid var(--death-border);
    border-radius: 999px;
    background: var(--death-surface-2);
    color: var(--death-text);
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.deaths-modal-close:hover {
    background: rgba(143, 163, 184, 0.25);
    color: var(--death-on);
}

.deaths-modal-media {
    position: relative;
    width: min(100%, 34rem);
    aspect-ratio: 1 / 1;
    margin-top: 1rem;
    margin-inline: auto;
    overflow: hidden;
    background: var(--death-surface-2);
    border-radius: var(--radius-lg);
}

.deaths-modal-media[hidden] {
    display: none;
}

.deaths-modal-media img {
    position: relative;
    z-index: 1;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.deaths-modal-media img.is-loading {
    opacity: 0;
}

.deaths-modal-loader {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 6rem;
    color: var(--death-muted);
    font-size: 1.4rem;
}

/* ---- Fixed diagonal black mourning band on the photo (top-left corner) ---- */
.death-photo-ribbon {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 3;
    width: 9rem;
    height: 9rem;
    overflow: hidden;
    pointer-events: none;
}

.death-photo-ribbon > span {
    position: absolute;
    top: 2.2rem;
    left: -3rem;
    display: block;
    width: 12rem;
    padding: 0.35rem 0;
    background: #000000;
    color: #ffffff;
    font-family: var(--font-heading);
    font-size: 0.66rem;
    font-weight: 800;
    line-height: 1.5;
    letter-spacing: 0.02em;
    text-align: center;
    white-space: nowrap;
    transform: rotate(-45deg);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6);
}

/* Smaller copy of the band for the registry cards' square photo. */
.death-photo-ribbon--card {
    width: 6.3rem;
    height: 6.3rem;
}

.death-photo-ribbon--card > span {
    top: 1.55rem;
    left: -2.1rem;
    width: 8.4rem;
    padding: 0.24rem 0;
    font-size: 0.47rem;
}

@media (max-width: 480px) {
    .death-photo-ribbon--card {
        width: 5.4rem;
        height: 5.4rem;
    }

    .death-photo-ribbon--card > span {
        top: 1.32rem;
        left: -1.8rem;
        width: 7.2rem;
        padding: 0.2rem 0;
        font-size: 0.42rem;
    }
}

/* ---- Fixed mourning phrase shown above the name ---- */
.death-modal-phrase {
    font-family: var(--font-heading);
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1.7;
    color: var(--death-accent);
}

/* ---- Share block inside the record preview ---- */
.death-share-block {
    margin-top: 1.25rem;
    padding-top: 1.1rem;
    border-top: 1px dashed var(--death-border);
}

.death-share-title {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-family: var(--font-heading);
    font-size: 0.92rem;
    font-weight: 800;
    color: var(--death-text);
}

.death-share-title i {
    color: var(--death-accent);
}

.death-share-preview {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.7rem;
    padding: 0.6rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--death-border);
    border-radius: var(--radius-sm);
}

.death-share-preview-thumb {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3.5rem;
    height: 3.5rem;
    flex: none;
    overflow: hidden;
    border-radius: 0.5rem;
    background: var(--death-surface-2);
    color: var(--death-muted);
    font-size: 1.1rem;
}

.death-share-preview-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.death-share-preview-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.death-share-preview-name {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 800;
    line-height: 1.6;
    color: var(--death-text);
    overflow-wrap: anywhere;
}

.death-share-preview-link {
    margin-top: 0.15rem;
    font-size: 0.7rem;
    line-height: 1.6;
    color: var(--death-muted);
    overflow-wrap: anywhere;
}

.death-share-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.8rem;
}

.death-share-btn.share-btn {
    border-color: var(--death-border);
    background: rgba(255, 255, 255, 0.05);
    color: var(--death-accent-strong);
}

.death-share-btn.share-btn:hover,
.death-share-btn.share-btn:focus-visible {
    background: var(--death-accent);
    border-color: var(--death-accent);
    color: #0c0f12;
    transform: translateY(-2px);
}

.deaths-modal-dates {
    display: grid;
    gap: 0.6rem;
    margin-top: 1.1rem;
}

.deaths-modal-dates > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.6rem 0.85rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--death-border);
    border-radius: var(--radius-sm);
}

.deaths-modal-dates dt {
    font-size: 0.85rem;
    color: var(--death-muted);
}

.deaths-modal-dates dd {
    margin: 0;
    font-family: var(--font-heading);
    font-weight: 800;
    color: var(--death-text);
}

.deaths-modal-dua {
    margin-top: 1.1rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--death-border);
    text-align: center;
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.9;
    color: var(--death-accent);
}

@media (max-width: 480px) {
    .deaths-modal-panel {
        padding: 1.15rem;
    }
}

/* ---- Condolence messages inside the record preview ---- */
.death-condolences {
    margin-top: 1.25rem;
    padding-top: 1.1rem;
    border-top: 1px dashed var(--death-border);
}

.death-condolences-title {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-family: var(--font-heading);
    font-size: 0.98rem;
    font-weight: 800;
    color: var(--death-text);
}

.death-condolences-title i {
    color: var(--death-accent);
}

.death-condolences-list {
    display: grid;
    gap: 0.6rem;
    margin-top: 0.85rem;
}

.death-condolence {
    padding: 0.75rem 0.85rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--death-border);
    border-radius: var(--radius-sm);
}

.death-condolence-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}

.death-condolence-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    flex: none;
    border-radius: 999px;
    background: rgba(143, 163, 184, 0.2);
    color: var(--death-accent-strong);
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 800;
}

.death-condolence-name {
    min-width: 0;
    font-family: var(--font-heading);
    font-size: 0.88rem;
    font-weight: 800;
    color: var(--death-text);
    overflow-wrap: anywhere;
}

.death-condolence-date {
    margin-inline-start: auto;
    flex: none;
    font-size: 0.72rem;
    color: var(--death-muted);
}

.death-condolence-body {
    font-size: 0.88rem;
    line-height: 1.85;
    color: var(--death-muted);
    white-space: pre-line;
    overflow-wrap: anywhere;
}

.death-condolences-empty {
    margin-top: 0.8rem;
    font-size: 0.82rem;
    line-height: 1.8;
    text-align: center;
    color: var(--death-muted);
}

.death-condolences-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    min-height: 2.6rem;
    margin-top: 0.9rem;
    padding: 0.6rem 1rem;
    border: 1px solid var(--death-accent);
    border-radius: 999px;
    background: transparent;
    color: var(--death-accent-strong);
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 800;
    line-height: 1.5;
    cursor: pointer;
    transition: all 0.25s ease;
}

.death-condolences-toggle:hover,
.death-condolences-toggle[aria-expanded="true"] {
    background: rgba(143, 163, 184, 0.18);
    color: var(--death-on);
}

.death-condolences-form {
    display: grid;
    gap: 0.8rem;
    margin-top: 0.9rem;
}

.death-condolences-form .input,
.death-condolences-form .textarea {
    background: var(--death-surface-2);
    border-color: var(--death-border);
    color: var(--death-on);
}

.death-condolences-form .input::placeholder,
.death-condolences-form .textarea::placeholder {
    color: var(--death-accent-strong);
    opacity: 1;
}

.death-condolences-form.hidden {
    display: none;
}