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

:root {
    --bg: #f4f4f7;
    --card-bg: #ffffff;
    --text: #1f2330;
    --muted: #6b7080;
    --accent: #4a6cf7;
    --accent-text: #ffffff;
    --radius: 14px;
    --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

body {
    margin: 0;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

/* ---------- Header ---------- */
.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    /*background: var(--header-bg, var(--accent));*/
    color: var(--header-text, var(--accent-text));
    box-shadow: 0 2px 8px rgb(0 0 0 / 0.15);
}
.site-title {
    font-size: clamp(1.6rem, 6vw, 2.4rem);
    font-weight: 800;
    letter-spacing: 0.02em;
}
.site-header button {
    background: rgb(255 255 255 / 0.2);
    color: inherit;
}

/* ---------- Page and cards ---------- */
.page {
    max-width: 720px;
    margin: 0 auto;
    padding: 1rem;
    display: grid;
    gap: 1rem;
}
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    box-shadow: 0 1px 3px rgb(0 0 0 / 0.06);
}
.card h2 { margin: 0 0 0.5rem; font-size: 1.15rem; }
.empty { color: var(--muted); margin: 0; }

/* ---------- Forms ---------- */
button {
    font: inherit;
    padding: 0.6rem 1rem;
    border: 0;
    border-radius: calc(var(--radius) / 2);
    background: var(--accent);
    color: var(--accent-text);
    cursor: pointer;
}
textarea, input {
    font: inherit;
    width: 100%;
    padding: 0.6rem;
    border: 1px solid #ccc;
    border-radius: calc(var(--radius) / 2);
}

/* ---------- Wall posts ---------- */
.post + .post {
    border-top: 1px solid rgb(0 0 0 / 0.08);
    margin-top: 0.75rem;
    padding-top: 0.75rem;
}
.post-meta {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    font-size: 0.85rem;
    color: var(--muted);
}
.post-body { margin-top: 0.25rem; }
.badge {
    background: var(--accent);
    color: var(--accent-text);
    border-radius: 999px;
    padding: 0 0.5rem;
    font-size: 0.75rem;
    font-weight: 700;
}

/* ---------- Hero (newest message) ---------- */
.hero {
    text-align: center;
    padding: 1rem 0.5rem;
    color: var(--hero-text, var(--text));
    text-shadow: var(--hero-shadow, none);
}
.hero-message {
    margin: 0;
    font-size: clamp(1.4rem, 5vw, 2.2rem);
    font-weight: 700;
    line-height: 1.3;
}
.hero-meta {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin: 0.5rem 0 0;
    font-size: 0.9rem;
    opacity: 0.8;
}
.older {
    margin-top: 1rem;
    text-align: left;
    text-shadow: none;
    color: var(--text);
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 0.75rem 1.25rem;
}
.older summary { cursor: pointer; color: var(--muted); }

/* ---------- Questions ---------- */
.question + .question {
    border-top: 1px solid rgb(0 0 0 / 0.08);
    margin-top: 1rem;
    padding-top: 1rem;
}
.question-text {
    display: flex;
    gap: 0.5rem;
    align-items: baseline;
    margin: 0 0 0.5rem;
    font-weight: 600;
}

.stack { display: grid; gap: 0.5rem; }
.stack button { justify-self: start; }

.past { margin-top: 1rem; }
.past summary { cursor: pointer; color: var(--muted); }
.qa p { margin: 0.25rem 0; }
.qa + .qa {
    border-top: 1px solid rgb(0 0 0 / 0.08);
    margin-top: 0.75rem;
    padding-top: 0.75rem;
}

/* ---------- Flash messages ---------- */
.flash {
    margin: 0;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    background: var(--card-bg);
    border-left: 4px solid var(--accent);
    box-shadow: 0 1px 3px rgb(0 0 0 / 0.06);
}

/* ---------- Small actions and checkbox ---------- */
.inline-actions {
    display: inline-block;
    margin: 0.5rem 0.5rem 0 0;
}
button.small {
    padding: 0.3rem 0.75rem;
    font-size: 0.85rem;
}
button.danger {
    background: #c0392b;
    color: #ffffff;
}

.check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}
.check input { width: auto; }

/* ---------- Edit toggle ---------- */
details.edit {
    display: inline-block;
    margin-top: 0.5rem;
    vertical-align: top;
}
details.edit[open] { display: block; }
details.edit .when-open { display: none; }
details.edit[open] .when-open { display: inline; }
details.edit[open] .when-closed { display: none; }

details.edit summary {
    display: inline-block;
    list-style: none;
    cursor: pointer;
    padding: 0.3rem 0.75rem;
    font-size: 0.85rem;
    border-radius: calc(var(--radius) / 2);
    background: var(--accent);
    color: var(--accent-text);
}
details.edit summary::-webkit-details-marker { display: none; }

details.edit[open] summary { background: var(--muted); }
details.edit form { margin-top: 0.5rem; }

/* ---------- Media gallery ---------- */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 0.5rem;
}
.gallery-item { margin: 0; min-width: 0; }
.gallery-item img,
.gallery-item video {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: calc(var(--radius) / 2);
    background: #000;
}
.gallery-item figcaption {
    margin-top: 0.25rem;
    font-size: 0.8rem;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Thumbnails are buttons: remove the normal button look */
.gallery-thumb {
    display: block;
    position: relative;
    width: 100%;
    padding: 0;
    border: 0;
    background: none;
    border-radius: calc(var(--radius) / 2);
    cursor: pointer;
}
.gallery-thumb.is-video::after {
    content: "▶";
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 1.75rem;
    text-shadow: 0 1px 6px rgb(0 0 0 / 0.6);
    pointer-events: none;
}

/* ---------- Lightbox ---------- */
.lightbox {
    width: 100%;
    height: 100%;
    max-width: 100vw;
    max-height: 100dvh;
    padding: 0;
    border: 0;
    background: transparent;
    overflow: hidden;
}
.lightbox[open] {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}
.lightbox::backdrop { background: rgb(0 0 0 / 0.85); }

.lightbox-body img,
.lightbox-body video {
    display: block;
    max-width: 95vw;
    max-height: calc(100dvh - 6rem);
    width: auto;
    height: auto;
    border-radius: calc(var(--radius) / 2);
}
.lightbox-caption {
    margin: 0;
    padding: 0 1rem;
    color: #fff;
    text-align: center;
}
.lightbox-close {
    position: fixed;
    top: 0.75rem;
    right: 0.75rem;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    border-radius: 999px;
    font-size: 1.75rem;
    line-height: 1;
    background: rgb(255 255 255 / 0.15);
    color: #fff;
}

/* ---------- Login / password pages ---------- */
.auth-page {
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, #2c3e50 0%, #4ca1af 100%);   /* .auth-page */
}
.auth-card {
    width: 100%;
    max-width: 380px;
    padding: 2rem 1.75rem;
    background: rgb(255 255 255 / 0.75);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border: 1px solid rgb(255 255 255 / 0.6);
    border-radius: calc(var(--radius) * 1.5);
    box-shadow: 0 10px 30px rgb(0 0 0 / 0.12);
}
.auth-title {
    margin: 0;
    text-align: center;
    font-size: 1.75rem;
}
.auth-subtitle {
    margin: 0.25rem 0 1.5rem;
    text-align: center;
    color: var(--muted);
}
.auth-error {
    margin: 0 0 1rem;
    padding: 0.6rem 0.8rem;
    border-radius: calc(var(--radius) / 2);
    background: #fdecea;
    color: #a3261b;
    font-size: 0.9rem;
}

.field {
    display: grid;
    gap: 0.35rem;
    font-size: 0.9rem;
    font-weight: 600;
}
.field input {
    font-weight: 400;
    padding: 0.75rem 0.9rem;
    border: 1px solid rgb(0 0 0 / 0.12);
    background: rgb(255 255 255 / 0.9);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgb(74 108 247 / 0.2);
}

.auth-button {
    width: 100%;
    margin-top: 0.5rem;
    padding: 0.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, #2c3e50, #4ca1af);           /* .auth-button */
}

.auth-button:hover { filter: brightness(1.05); }

/* ---------- Larger screens ---------- */

@media (min-width: 768px) {
    .page { padding: 2rem; }
    .card { padding: 1.5rem 2rem; }
}
