/* Breakthrough Wall
 * Breakthrough Wall is the brand; the palette quietly matches Blue Flame
 * Minerals (Branding/BlueFlame_Brand_Guide.pdf via the STR map app):
 *   Deep Navy #0C3269 · Royal #2F5DBF · Ocean #006AB5 · Cyan #00AEEF · Gold #FBB040
 *   Headings Rubik · Body Work Sans
 */
:root {
    --navy: #0C3269;
    --navy-dark: #082958;
    --royal: #2F5DBF;
    --royal-dark: #224DA9;
    --ocean: #006AB5;
    --cyan: #00AEEF;
    --gold: #FBB040;
    --gold-dark: #E89A22;
    --bg: #F5F7FA;
    --card: #FFFFFF;
    --border: #D8DEE5;
    --text: #313131;
    --muted: #6B7280;
    --error: #C62828;
    --radius: 14px;
}

* { box-sizing: border-box; }
html, body {
    margin: 0; min-height: 100%;
    font-family: "Work Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    font-weight: 400; font-size: 16px;
    color: var(--text); background: var(--bg);
    -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: "Rubik", sans-serif; }
button { font-family: inherit; }
.hidden { display: none !important; }

/* ── Icons ───────────────────────────────────────────────────────── */
.icon { width: 18px; height: 18px; flex-shrink: 0; vertical-align: -3px; }
.icon-sm { width: 14px; height: 14px; }
.kind-chip, .modal-tab, .act-btn, #media-pick, .media-ok {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
}
.act-like .icon-heart { transition: fill .15s, transform .15s; }
.act-btn.liked { color: var(--gold-dark); }
.act-btn.liked .icon-heart { fill: var(--gold); stroke: var(--gold-dark); transform: scale(1.08); }

/* ── Top bar ─────────────────────────────────────────────────────── */
#topbar {
    position: sticky; top: 0; z-index: 100;
    display: flex; align-items: center; justify-content: space-between;
    height: 58px; padding: 0 16px;
    padding-top: env(safe-area-inset-top);
    background: linear-gradient(180deg, var(--navy) 0%, var(--navy-dark) 100%);
    border-bottom: 2px solid var(--gold);
    box-shadow: 0 2px 10px rgba(0,0,0,.18);
    color: white;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark { height: 30px; width: 30px; filter: drop-shadow(0 0 8px rgba(251,176,64,.35)); }
.brand-name {
    font-family: "Rubik", sans-serif; font-weight: 800; font-size: 19px;
    letter-spacing: .4px; white-space: nowrap;
}
.brand-accent { color: var(--gold); }

/* ── Hero ────────────────────────────────────────────────────────── */
#hero {
    padding: 34px 20px 30px; text-align: center; color: white;
    background:
        radial-gradient(ellipse at top left, rgba(0,174,239,.25), transparent 55%),
        radial-gradient(ellipse at bottom right, rgba(251,176,64,.18), transparent 55%),
        linear-gradient(135deg, var(--navy-dark) 0%, var(--navy) 55%, var(--royal) 100%);
}
#hero h1 {
    margin: 0 0 8px; font-size: clamp(26px, 6vw, 40px);
    font-weight: 800; letter-spacing: .3px;
}
.hero-gold { color: var(--gold); }
#hero p {
    margin: 0 auto; max-width: 480px;
    font-size: 15px; font-weight: 300; color: rgba(255,255,255,.85); line-height: 1.5;
}

/* ── Layout ──────────────────────────────────────────────────────── */
#wall {
    max-width: 560px; margin: -18px auto 40px; padding: 0 12px;
    display: flex; flex-direction: column; gap: 14px;
}
#feed { display: flex; flex-direction: column; gap: 14px; }
.card {
    background: var(--card); border-radius: var(--radius);
    box-shadow: 0 2px 10px rgba(12,50,105,.08), 0 1px 2px rgba(0,0,0,.06);
    overflow: hidden;
}

/* ── Composer card ───────────────────────────────────────────────── */
.composer-card { padding: 14px 16px; border-top: 3px solid var(--gold); }
.composer-row { display: flex; align-items: center; gap: 10px; }
.composer-prompt {
    flex: 1; text-align: left; padding: 11px 16px;
    background: var(--bg); color: var(--muted);
    border: 1px solid var(--border); border-radius: 999px;
    font-size: 15px; cursor: pointer; transition: border-color .15s, background .15s;
}
.composer-prompt:hover { border-color: var(--cyan); background: #EEF6FC; }
.composer-kinds { display: flex; gap: 8px; margin-top: 12px; }
.kind-chip {
    flex: 1; padding: 8px 4px; font-size: 13px; font-weight: 600;
    background: white; color: var(--navy);
    border: 1px solid var(--border); border-radius: 8px; cursor: pointer;
    transition: border-color .15s, background .15s, transform .05s;
}
.kind-chip:hover { border-color: var(--cyan); background: #EEF6FC; }
.kind-chip:active { transform: translateY(1px); }

/* ── Posts ───────────────────────────────────────────────────────── */
.post-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px 8px; }
.post-author { flex: 1; min-width: 0; }
.post-author .name { font-weight: 600; font-size: 14.5px; color: var(--navy); }
.post-author .meta { font-size: 12px; color: var(--muted); margin-top: 1px; }
.post-delete {
    background: none; border: none; color: #B7BEC9;
    cursor: pointer; padding: 6px 8px; border-radius: 6px; line-height: 1;
    display: inline-flex; align-items: center;
}
.post-delete:hover { color: var(--error); background: #FFEBEE; }

.post-body { padding: 2px 16px 12px; font-size: 15px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: break-word; }
.post-media { width: 100%; display: block; background: #0B1B33; }
.post-media video { width: 100%; max-height: 70vh; display: block; }
.post-media img { width: 100%; max-height: 70vh; object-fit: contain; display: block; }

.post-actions {
    display: flex; align-items: center; gap: 4px;
    padding: 6px 10px; border-top: 1px solid #EEF1F5;
}
.act-btn {
    display: flex; align-items: center; gap: 6px;
    padding: 8px 12px; background: none; border: none; border-radius: 8px;
    font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer;
    transition: background .15s, color .15s;
}
.act-btn:hover { background: var(--bg); color: var(--navy); }
.act-btn .heart { font-size: 16px; line-height: 1; }
.act-btn.liked { color: var(--gold-dark); }
.act-btn.liked .heart { transform: scale(1.1); }

/* ── Comments ────────────────────────────────────────────────────── */
.comments { border-top: 1px solid #EEF1F5; padding: 10px 14px 12px; background: #FAFBFD; }
.comment { display: flex; gap: 9px; padding: 6px 0; }
.comment-bubble {
    flex: 1; background: white; border: 1px solid #E7EBF1;
    border-radius: 12px; padding: 8px 12px; min-width: 0;
}
.comment-bubble .who { font-size: 12.5px; font-weight: 600; color: var(--navy); }
.comment-bubble .who .when { font-weight: 400; color: var(--muted); margin-left: 6px; font-size: 11.5px; }
.comment-bubble .what { font-size: 14px; line-height: 1.45; margin-top: 2px; white-space: pre-wrap; overflow-wrap: break-word; }
.comment-delete { background: none; border: none; color: #B7BEC9; cursor: pointer; padding: 0 4px; vertical-align: -2px; }
.comment-delete:hover { color: var(--error); }
.comment-form { display: flex; gap: 8px; margin-top: 8px; }
.comment-form input {
    flex: 1; padding: 9px 14px; font-size: 14px; font-family: inherit;
    border: 1px solid var(--border); border-radius: 999px;
}
.comment-form input:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(0,174,239,.15); }
.comment-form button {
    padding: 9px 16px; border: none; border-radius: 999px;
    background: var(--royal); color: white; font-weight: 600; font-size: 13.5px; cursor: pointer;
}
.comment-form button:hover { background: var(--royal-dark); }

/* ── Avatars ─────────────────────────────────────────────────────── */
.avatar {
    width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    font-family: "Rubik", sans-serif; font-weight: 700; font-size: 14px;
    color: white; background: var(--royal); border: none;
}
.avatar-sm { width: 34px; height: 34px; font-size: 13px; }
.avatar-lg { width: 64px; height: 64px; font-size: 22px; }
.avatar { background-size: cover; background-position: center; }
.avatar-btn { cursor: pointer; box-shadow: 0 0 0 2px rgba(255,255,255,.35); }
.avatar-btn:hover { box-shadow: 0 0 0 2px var(--gold); }

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn {
    padding: 10px 18px; font-size: 14px; font-weight: 600;
    border-radius: 8px; cursor: pointer; letter-spacing: .2px;
    transition: background .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--gold); border: none; color: var(--navy-dark); }
.btn-primary:hover { background: var(--gold-dark); }
.btn-primary:disabled { background: #E5D9C3; color: #9A8F7A; cursor: wait; }
.btn-ghost { background: transparent; border: 1px solid rgba(127,140,160,.45); color: inherit; }
.btn-ghost:hover { border-color: var(--cyan); color: var(--ocean); }
#topbar .btn-ghost { color: white; border-color: rgba(255,255,255,.4); }
#topbar .btn-ghost:hover { border-color: var(--gold); color: var(--gold); }

/* ── Feed status ─────────────────────────────────────────────────── */
.feed-status { text-align: center; color: var(--muted); font-size: 14px; padding: 26px 0; }
#load-more { margin: 0 auto 10px; color: var(--ocean); }

/* ── Modals ──────────────────────────────────────────────────────── */
.modal-backdrop {
    position: fixed; inset: 0; z-index: 200;
    background: rgba(8,25,52,.55); backdrop-filter: blur(3px);
    display: flex; align-items: center; justify-content: center; padding: 18px;
}
.modal {
    position: relative; width: 100%; max-width: 400px;
    max-height: calc(100vh - 40px); overflow-y: auto;
    background: white; border-radius: 16px; padding: 48px 22px 22px;
    border-top: 4px solid var(--gold);
    box-shadow: 0 24px 60px rgba(0,0,0,.35);
}
.modal-close {
    position: absolute; top: 10px; right: 10px;
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    background: none; border: none; border-radius: 50%;
    font-size: 22px; color: var(--muted);
    cursor: pointer; line-height: 1; padding: 0;
}
.modal-close:hover { color: var(--navy); background: var(--bg); }
.modal-title { margin: 0 0 14px; font-size: 19px; font-weight: 700; color: var(--navy); }
.modal-tabs { display: flex; gap: 6px; margin-bottom: 16px; }
.modal-tab {
    flex: 1; padding: 9px 6px; font-size: 13.5px; font-weight: 600;
    background: var(--bg); color: var(--muted);
    border: 1px solid var(--border); border-radius: 8px; cursor: pointer;
}
.modal-tab.active { background: var(--navy); color: white; border-color: var(--navy); }
.modal-foot { margin-top: 14px; font-size: 12px; color: var(--muted); text-align: center; }

/* ── Social sign-in ──────────────────────────────────────────────── */
.sso-buttons { display: flex; flex-direction: column; gap: 9px; margin-bottom: 14px; }
.btn-sso {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    padding: 11px 14px; font-size: 14px; font-weight: 600;
    color: var(--text); text-decoration: none;
    background: white; border: 1px solid var(--border); border-radius: 8px;
    transition: border-color .15s, background .15s, transform .05s;
}
.btn-sso:hover { border-color: var(--cyan); background: #F7FBFE; }
.btn-sso:active { transform: translateY(1px); }
.sso-divider {
    display: flex; align-items: center; gap: 10px;
    margin-top: 4px; font-size: 11.5px; color: var(--muted);
    text-transform: uppercase; letter-spacing: .6px;
}
.sso-divider::before, .sso-divider::after {
    content: ""; flex: 1; height: 1px; background: var(--border);
}

/* ── Avatar editing (profile modal) ──────────────────────────────── */
.avatar-edit { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.avatar-edit-btns { display: flex; gap: 8px; }
.avatar-edit-btns .btn { padding: 8px 14px; font-size: 13px; }

.auth-form { display: flex; flex-direction: column; gap: 10px; }
.auth-form label { font-size: 13px; font-weight: 600; color: var(--navy); display: flex; flex-direction: column; gap: 4px; }
.label-muted { font-weight: 400; color: var(--muted); }
.auth-form input, #form-post textarea, .post-editor textarea {
    padding: 11px 14px; font-size: 15px; font-family: inherit;
    border: 1px solid var(--border); border-radius: 8px; width: 100%;
}
.auth-form input:focus, #form-post textarea:focus, .post-editor textarea:focus {
    outline: none; border-color: var(--cyan);
    box-shadow: 0 0 0 3px rgba(0,174,239,.15);
}

/* ── Post editor (inline) ────────────────────────────────────────── */
.post-editor { padding: 2px 16px 12px; display: flex; flex-direction: column; gap: 8px; }
.post-editor-btns { display: flex; gap: 8px; justify-content: flex-end; }
.post-editor-btns .btn { padding: 8px 16px; font-size: 13.5px; }
.form-error {
    color: var(--error); font-size: 13px;
    background: #FFEBEE; border: 1px solid #FFCDD2;
    padding: 8px 12px; border-radius: 8px;
}
.profile-email { font-size: 13px; color: var(--muted); padding: 2px 2px 4px; }

/* ── Composer modal ──────────────────────────────────────────────── */
#form-post { display: flex; flex-direction: column; gap: 12px; }
.media-zone {
    border: 2px dashed var(--border); border-radius: 12px;
    padding: 16px; text-align: center;
    display: flex; flex-direction: column; gap: 8px; align-items: center;
}
.media-hint { font-size: 12.5px; color: var(--muted); }
.media-preview { width: 100%; }
.media-preview video, .media-preview img {
    width: 100%; max-height: 300px; border-radius: 10px; object-fit: contain; background: #0B1B33;
}
.media-ok { font-size: 13px; color: #1B7F3B; font-weight: 600; }
.btn-post { font-size: 15px; padding: 12px; }

/* ── Footer ──────────────────────────────────────────────────────── */
#footer {
    margin-top: auto; padding: 26px 20px calc(30px + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, var(--navy) 0%, var(--navy-dark) 100%);
    color: rgba(255,255,255,.75);
    display: flex; flex-direction: column; align-items: center; gap: 12px;
    text-align: center;
}
.footer-brand { display: flex; align-items: center; gap: 8px; font-family: "Rubik", sans-serif; font-weight: 700; color: white; }
.footer-brand img { height: 24px; width: 24px; }
.footer-tag { font-size: 12px; color: rgba(255,255,255,.55); letter-spacing: .3px; }

/* ── Toast ───────────────────────────────────────────────────────── */
.toast {
    position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
    z-index: 300; max-width: 90vw;
    background: var(--navy-dark); color: white;
    padding: 11px 20px; border-radius: 999px;
    font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.3);
    border-left: 3px solid var(--gold);
}

body { display: flex; flex-direction: column; min-height: 100vh; }

@media (min-width: 640px) {
    #hero { padding: 46px 20px 40px; }
    #wall { margin-top: -22px; }
}
