/* Memorial site — warm, respectful aesthetic */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --cream:    #faf7f2;
    --warm-white: #fff9f4;
    --gold:     #b8955a;
    --gold-lt:  #d4af75;
    --text:     #2c2420;
    --text-muted: #6b5e57;
    --border:   #e8ddd5;
    --card-bg:  #ffffff;
    --shadow:   0 2px 12px rgba(44,36,32,.08);
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
    background: var(--cream);
    color: var(--text);
    font-family: Georgia, 'Times New Roman', serif;
    line-height: 1.7;
    min-height: 100vh;
}

a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Site header ── */

.site-header {
    background: var(--text);
    color: #f5ece4;
    text-align: center;
    padding: 3rem 1rem 2.5rem;
    border-bottom: 4px solid var(--gold);
}

.site-header h1 {
    font-size: clamp(1.8rem, 5vw, 3rem);
    font-weight: normal;
    letter-spacing: .04em;
    margin-bottom: .4rem;
}

.site-header .dates {
    color: var(--gold-lt);
    font-size: 1.05rem;
    letter-spacing: .08em;
}

.site-header .tagline {
    margin-top: .9rem;
    font-style: italic;
    color: #c9b8ae;
    font-size: 1rem;
}

/* ── Navigation ── */

.site-nav {
    background: #3a2e28;
    text-align: center;
    padding: .6rem;
}

.site-nav a {
    color: #e8d8cc;
    margin: 0 1.2rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: .92rem;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.site-nav a:hover { color: var(--gold-lt); text-decoration: none; }

/* ── Layout containers ── */

.container {
    max-width: 760px;
    margin: 0 auto;
    padding: 0 1rem;
}

.page-section {
    padding: 2.5rem 0;
}

/* ── Memory wall ── */

.wall-intro {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 2rem;
    font-size: 1.05rem;
}

.post-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
    overflow: hidden;
}

.post-header {
    padding: 1.2rem 1.5rem .8rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: .4rem;
}

.post-author {
    font-size: 1.05rem;
    font-weight: bold;
    color: var(--text);
}

.post-date {
    font-size: .82rem;
    color: var(--text-muted);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.post-body {
    padding: 1.2rem 1.5rem;
    font-size: 1rem;
    line-height: 1.75;
}

.post-body p { margin: .8rem 0; }
.post-body p:first-child { margin-top: 0; }
.post-body p:last-child { margin-bottom: 0; }
.post-body strong { font-weight: 700; }
.post-body em { font-style: italic; }
.post-body u { text-decoration: underline; }
.post-body ol, .post-body ul { margin: 1rem 0 1rem 1.5rem; }
.post-body li { margin: .4rem 0; }
.post-body a { color: var(--gold); text-decoration: underline; word-break: break-word; }
.post-body a:hover { color: #a07840; }

/* ── Unified media grid (photos + ready videos) ── */

.media-grid {
    display: grid;
    gap: 6px;
    padding: 1rem 1.5rem 1.5rem;
}

/* Tile count → column layout (every tile is consistent 4:3) */
.media-grid.count-1 {
    grid-template-columns: minmax(0, 480px);
    justify-content: center;
}
.media-grid.count-2  { grid-template-columns: 1fr 1fr; }
.media-grid.count-3  { grid-template-columns: 1fr 1fr 1fr; }
.media-grid.count-many {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.media-thumb {
    position: relative;
    display: block;
    border: none;
    padding: 0;
    margin: 0;
    background: #000;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    aspect-ratio: 4 / 3;
    transition: transform .15s, box-shadow .15s;
    box-shadow: 0 2px 8px rgba(0,0,0,.12);
}

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

.media-thumb:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0,0,0,.22);
}
.media-thumb:hover .video-play-icon {
    transform: translate(-50%, -50%) scale(1.08);
}

.video-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 64px;
    height: 64px;
    pointer-events: none;
    transition: transform .15s;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,.4));
}

.video-play-icon svg { width: 100%; height: 100%; display: block; }

/* Pending video notice — separate area, matched padding */
.video-pending-list {
    padding: 0 1.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: .6rem;
}

.video-pending {
    background: #f5ede6;
    border: 1px dashed var(--border);
    border-radius: 4px;
    padding: 1.2rem;
    text-align: center;
    color: var(--text-muted);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: .9rem;
}

/* ── Submit form ── */

.form-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    box-shadow: var(--shadow);
    padding: 2rem 2rem 2.5rem;
}

.form-card h2 {
    font-size: 1.5rem;
    font-weight: normal;
    margin-bottom: .4rem;
    color: var(--text);
}

.form-card .form-intro {
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 1.8rem;
    font-size: .95rem;
}

.form-group {
    margin-bottom: 1.4rem;
}

.form-group label {
    display: block;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: .85rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: .5rem;
}

.form-group input[type=text],
.form-group input[type=password],
.form-group textarea {
    width: 100%;
    padding: .75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 3px;
    font-family: Georgia, serif;
    font-size: 1rem;
    background: var(--warm-white);
    color: var(--text);
    transition: border-color .15s;
    -webkit-appearance: none;
}

.form-group input[type=text]:focus,
.form-group input[type=password]:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--gold);
    background: #fff;
}

.form-group textarea { resize: vertical; min-height: 140px; }

/* Quill editor styling */
#editor-container {
    font-family: Georgia, serif;
    font-size: 1rem;
    background: #fff;
}

.ql-toolbar {
    border: 1px solid var(--border) !important;
    border-radius: 3px 3px 0 0 !important;
    background: var(--warm-white) !important;
    padding: .5rem !important;
}

.ql-container {
    border: 1px solid var(--border) !important;
    border-top: none !important;
    border-radius: 0 0 3px 3px !important;
    font-family: Georgia, serif;
}

.ql-editor { font-size: 1rem; padding: 1rem; }
.ql-editor.ql-blank::before { color: var(--text-muted); font-style: italic; }
.ql-toolbar.ql-snow .ql-formats { margin-right: 0 !important; }

.file-label {
    display: inline-block;
    padding: .6rem 1.2rem;
    background: #f0e8e0;
    border: 1px solid var(--border);
    border-radius: 3px;
    cursor: pointer;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: .9rem;
    color: var(--text);
    transition: background .15s;
}

.file-label:hover { background: #e8ddd5; }

.file-input-hidden { display: none; }

.file-hint {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: .82rem;
    color: var(--text-muted);
    margin-top: .5rem;
}

/* Video upload progress area */
#video-progress-list {
    margin-top: .8rem;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.video-progress-item {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: .85rem;
}

.video-progress-item .vp-name {
    color: var(--text);
    margin-bottom: .25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 400px;
}

.progress-bar-wrap {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--gold);
    width: 0%;
    transition: width .2s;
    border-radius: 3px;
}

.vp-status {
    margin-top: .2rem;
    color: var(--text-muted);
    font-size: .78rem;
}

.vp-status.done   { color: #5a8a5a; }
.vp-status.error  { color: #8a5a5a; }

/* Submit button */
.btn-submit {
    display: inline-block;
    padding: .85rem 2.5rem;
    background: var(--gold);
    color: #fff;
    border: none;
    border-radius: 3px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: .04em;
    cursor: pointer;
    transition: background .15s;
    -webkit-appearance: none;
}

.btn-submit:hover:not(:disabled) { background: #a07840; }

.btn-submit:disabled {
    opacity: .55;
    cursor: not-allowed;
}

/* ── Success page ── */

.success-box {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-top: 4px solid var(--gold);
    border-radius: 4px;
    box-shadow: var(--shadow);
    padding: 3rem 2rem;
    text-align: center;
}

.success-box h2 {
    font-size: 1.7rem;
    font-weight: normal;
    margin-bottom: .8rem;
}

.success-box p {
    color: var(--text-muted);
    margin-bottom: 1.2rem;
}

/* ── Unified media lightbox ── */

#media-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.92);
    z-index: 9999;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 0 0;
}

#media-lightbox.open { display: flex; }

.ml-stage {
    flex: 1;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    padding: 0 4rem;
}

.ml-stage img {
    max-width: 100%;
    max-height: 78vh;
    object-fit: contain;
    border-radius: 2px;
    display: block;
}

.ml-stage mux-player {
    border-radius: 3px;
    overflow: hidden;
    display: block;
    /* width/height set in JS based on aspect ratio + viewport */
}

.ml-close {
    position: absolute;
    top: 1rem;
    right: 1.4rem;
    background: none;
    border: none;
    color: #fff;
    font-size: 2.2rem;
    cursor: pointer;
    line-height: 1;
    opacity: .8;
    z-index: 2;
    padding: .2rem .6rem;
}
.ml-close:hover { opacity: 1; }

.ml-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(0,0,0,.5);
    border: 1px solid rgba(255,255,255,.25);
    color: #fff;
    font-size: 2.2rem;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, transform .15s;
}
.ml-arrow:hover { background: rgba(0,0,0,.8); transform: translateY(-50%) scale(1.05); }
.ml-prev { left: 1.5rem; }
.ml-next { right: 1.5rem; }
.ml-arrow:disabled,
#media-lightbox.single .ml-arrow { display: none; }

.ml-counter {
    color: rgba(255,255,255,.7);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: .85rem;
    margin: .6rem 0;
    letter-spacing: .04em;
}
#media-lightbox.single .ml-counter { display: none; }

.ml-thumbs {
    display: flex;
    gap: .4rem;
    padding: .6rem 1rem 1rem;
    max-width: 100vw;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.3) transparent;
}
#media-lightbox.single .ml-thumbs { display: none; }

.ml-thumb {
    flex: 0 0 auto;
    width: 80px;
    height: 60px;
    border: 2px solid transparent;
    border-radius: 3px;
    background: #111;
    padding: 0;
    cursor: pointer;
    overflow: hidden;
    position: relative;
    transition: border-color .15s, transform .15s;
}
.ml-thumb:hover { transform: translateY(-2px); }
.ml-thumb.active { border-color: var(--gold); }
.ml-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.ml-thumb.is-video::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-left: 10px solid #fff;
    border-top: 7px solid transparent;
    border-bottom: 7px solid transparent;
    transform: translate(-40%, -50%);
    filter: drop-shadow(0 1px 3px rgba(0,0,0,.7));
}

@media (max-width: 600px) {
    .ml-stage { padding: 0 .5rem; }
    .ml-arrow { width: 44px; height: 44px; font-size: 1.8rem; }
    .ml-prev { left: .5rem; }
    .ml-next { right: .5rem; }
    .ml-thumb { width: 64px; height: 48px; }
}

/* ── Footer ── */

.site-footer {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: .82rem;
    border-top: 1px solid var(--border);
    margin-top: 3rem;
}

/* ── Responsive ── */

@media (max-width: 600px) {
    .form-card { padding: 1.5rem 1.2rem 2rem; }
    .post-header { padding: 1rem 1.2rem .7rem; }
    .post-body { padding: 1rem 1.2rem; }
    .media-grid { padding: .8rem 1.2rem 1.2rem; gap: 4px; }
    .video-pending-list { padding: 0 1.2rem 1.2rem; }
    .video-play-icon { width: 48px; height: 48px; }
}
