/* Memorial Page */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg: #12120f;
    --bg-elevated: rgba(17, 17, 17, 0.85);
    --border: #2a2820;
    --text: #e0e0e0;
    --text-dim: #888;
    --accent: #d4c5a9;
    --accent-dim: #8a7d5a;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Thin memorial ribbon across the top */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent);
    z-index: 10;
}

/* Nav Bar */
.nav-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1.5rem;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
}

.nav-bar a {
    color: var(--accent-dim);
    text-decoration: none;
    font-size: 0.8rem;
    transition: color 0.15s;
}

.nav-bar a:hover { color: var(--accent); }

.nav-bar .nav-brand {
    color: var(--text-dim);
    font-size: 0.8rem;
}

.nav-bar .nav-brand strong { color: var(--accent); }

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    flex: 1;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 3rem;
    padding-top: 0.5rem;
}

.footer-nav {
    font-size: 0.8rem;
    margin-bottom: 0.75rem;
}

.footer-nav a {
    color: var(--accent-dim);
    text-decoration: none;
}

.footer-nav a:hover { color: var(--accent); }

h1 {
    font-size: 2rem;
    font-weight: 300;
    color: var(--text);
    margin: 0.75rem 0 0.5rem;
}

h1 strong {
    font-weight: 600;
    color: var(--accent);
}

.subtitle {
    font-size: 0.9rem;
    color: var(--text-dim);
    line-height: 1.5;
}

.count {
    font-size: 0.8rem;
    color: var(--accent-dim);
    margin-top: 1rem;
    letter-spacing: 0.05em;
}

/* Event Sections */
.event {
    margin-bottom: 3rem;
}

.event-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.event-date {
    display: block;
    font-size: 0.8rem;
    letter-spacing: 0.15em;
    color: var(--accent);
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

.event-title {
    font-size: 1.1rem;
    font-weight: 400;
    color: var(--text);
    margin-bottom: 0.25rem;
}

.event-location {
    font-size: 0.85rem;
    color: var(--text-dim);
}

.event-description {
    font-size: 0.85rem;
    color: var(--text-dim);
    max-width: 600px;
    margin: 0.75rem auto 0;
    line-height: 1.6;
}

/* Subgroup Labels */
.subgroup {
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin: 2rem 0 1.25rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

/* Memorial Entry */
.entry {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1.5rem;
    margin-bottom: 1.25rem;
}

.entry-body {
    display: flex;
    gap: 1.5rem;
}

.hero-photo {
    width: 160px;
    height: 200px;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.hero-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
}

.initials {
    font-size: 2.5rem;
    font-weight: 200;
    color: var(--accent-dim);
    opacity: 0.4;
    letter-spacing: 0.1em;
    user-select: none;
}

.entry-info {
    flex: 1;
    min-width: 0;
}

.entry-rank {
    display: block;
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--accent-dim);
    margin-bottom: 0.15rem;
}

.entry-name {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.entry-vitals {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

.entry-vitals p {
    margin: 0;
}

.entry-narrative {
    font-size: 0.85rem;
    color: var(--text);
    line-height: 1.7;
}

.entry-narrative p {
    margin: 0 0 0.5rem;
}

.entry-narrative p:last-child {
    margin-bottom: 0;
}

/* Photo Thumbnails Row */
.photo-row {
    display: flex;
    gap: 0.5rem;
    margin: 1.25rem -1.5rem -1.5rem;
    padding: 0.75rem 1.5rem;
    border-top: 1px solid rgba(42, 40, 32, 0.5);
    background: rgba(0, 0, 0, 0.25);
    border-radius: 0 0 4px 4px;
    flex-wrap: wrap;
}

.thumb {
    width: 72px;
    height: 72px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 2px;
    overflow: hidden;
}

.thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
}

/* Lightbox */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    cursor: pointer;
}

.lightbox[hidden] {
    display: none;
}

.lightbox img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 2px;
}

/* Footer — closing line override */
footer .closing { color: var(--text); font-style: italic; margin-bottom: 0.75rem; }

/* View Toggle */
.view-toggle {
    display: flex;
    justify-content: center;
    gap: 0;
    margin-top: 1.25rem;
}

.view-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 0.35rem 1rem;
    cursor: pointer;
    font-family: inherit;
    transition: color 0.15s, border-color 0.15s;
}

.view-btn:first-child {
    border-radius: 3px 0 0 3px;
}

.view-btn:last-child {
    border-radius: 0 3px 3px 0;
    border-left: none;
}

.view-btn.active {
    color: var(--accent);
    border-color: var(--accent-dim);
}

.view-btn:hover:not(.active) {
    color: var(--text);
}

/* Grid View */
.grid-view {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
    max-width: 800px;
    margin: 0 auto;
    padding: 0 1.5rem 2rem;
}

.grid-view[hidden] {
    display: none;
}

.grid-item {
    position: relative;
    aspect-ratio: 4 / 5;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    cursor: pointer;
}

.grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s;
}

.grid-item:hover img {
    transform: scale(1.05);
}

.grid-item .grid-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 2rem 0.4rem 0.4rem;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    opacity: 0;
    transition: opacity 0.2s;
}

.grid-item:hover .grid-label {
    opacity: 1;
}

.grid-label-rank {
    display: block;
    font-size: 0.55rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent-dim);
}

.grid-label-name {
    font-size: 0.7rem;
    color: var(--text);
    line-height: 1.3;
}

.grid-initials {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 2rem;
    font-weight: 200;
    color: var(--accent-dim);
    opacity: 0.4;
    letter-spacing: 0.1em;
    user-select: none;
}

/* Viewer Overlay */
.viewer {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.96);
    z-index: 200;
    display: flex;
    flex-direction: column;
}

.viewer[hidden] {
    display: none;
}

.viewer-close {
    position: absolute;
    top: 1rem;
    right: 1.25rem;
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 2rem;
    cursor: pointer;
    z-index: 210;
    line-height: 1;
    padding: 0.25rem;
    transition: color 0.15s;
}

.viewer-close:hover {
    color: var(--text);
}

.viewer-counter {
    position: absolute;
    top: 1.25rem;
    left: 1.25rem;
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    color: var(--text-dim);
    z-index: 210;
}

.viewer-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    min-height: 0;
    padding: 3rem 0 0;
    gap: 2rem;
}

.viewer-photo {
    max-height: 60vh;
    max-width: 40vw;
    object-fit: contain;
    border-radius: 2px;
    flex-shrink: 0;
}

.nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 3rem;
    cursor: pointer;
    padding: 1rem;
    opacity: 0.4;
    transition: opacity 0.15s;
    z-index: 210;
    user-select: none;
}

.nav-btn:hover {
    opacity: 1;
}

.nav-prev {
    left: 0.5rem;
}

.nav-next {
    right: 0.5rem;
}

.viewer-info {
    max-width: 320px;
    max-height: 60vh;
    overflow-y: auto;
    text-align: left;
    padding: 0.5rem 0;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-dim) transparent;
}

.viewer-rank {
    display: block;
    font-size: 0.6rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--accent-dim);
    margin-bottom: 0.1rem;
}

.viewer-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--accent);
    line-height: 1.3;
}

.viewer-vitals {
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-top: 0.2rem;
}

.viewer-narrative {
    font-size: 0.8rem;
    color: var(--text-dim);
    line-height: 1.65;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.viewer-narrative p {
    margin: 0 0 0.5rem;
}

.viewer-narrative p:last-child {
    margin-bottom: 0;
}

/* Filmstrip */
.filmstrip {
    display: flex;
    gap: 3px;
    padding: 0.75rem 1rem;
    overflow-x: auto;
    scrollbar-width: none;
    justify-content: center;
    flex-shrink: 0;
    background: rgba(0, 0, 0, 0.5);
}

.filmstrip::-webkit-scrollbar {
    display: none;
}

.filmstrip-item {
    width: 48px;
    height: 60px;
    flex-shrink: 0;
    overflow: hidden;
    cursor: pointer;
    opacity: 0.35;
    transition: opacity 0.15s;
    border: 2px solid transparent;
    border-radius: 2px;
}

.filmstrip-item:hover {
    opacity: 0.7;
}

.filmstrip-item.active {
    opacity: 1;
    border-color: var(--accent);
}

.filmstrip-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Responsive — tablet */
@media (max-width: 768px) {
    .grid-view {
        grid-template-columns: repeat(5, 1fr);
        padding: 0 0.75rem 2rem;
    }
}

/* Responsive — mobile */
@media (max-width: 600px) {
    .container {
        padding: 1.5rem 1rem;
    }

    h1 {
        font-size: 1.6rem;
    }

    .entry {
        padding: 1.25rem 1rem;
    }

    .entry-body {
        flex-direction: column;
        align-items: center;
    }

    .hero-photo {
        width: 140px;
        height: 175px;
    }

    .entry-info {
        text-align: center;
    }

    .entry-narrative {
        text-align: left;
    }

    .photo-row {
        justify-content: center;
        margin: 1.25rem -1rem -1.25rem;
        padding: 0.75rem 1rem;
    }

    .thumb {
        width: 60px;
        height: 60px;
    }

    .grid-view {
        grid-template-columns: repeat(3, 1fr);
        padding: 0 3px 1.5rem;
    }

    .viewer-photo {
        max-width: 45vw;
        max-height: 35vh;
    }

    .nav-btn {
        font-size: 2rem;
        padding: 0.5rem;
    }

    .viewer-info {
        max-width: none;
        max-height: none;
        text-align: center;
        padding: 0.5rem 1rem 0;
        overflow-y: visible;
    }

    .viewer-narrative {
        text-align: left;
    }

    .viewer-main {
        flex-direction: column;
        padding: 3.5rem 1rem 0;
        overflow-y: auto;
    }

    .filmstrip-item {
        width: 36px;
        height: 45px;
    }
}
