/* sAIge — mobile-first custom styles (supplementing Bootstrap 5). */

:root {
    --sg-border: #eff3f4;
    --sg-border-strong: #cfd9de;
    --sg-muted: #536471;
    --sg-muted-soft: #8b98a5;
    --sg-accent: #1d9bf0;
    --sg-bg: #ffffff;
    --sg-surface: #ffffff;
    --sg-surface-soft: #f7f9f9;
    --sg-text: #0f1419;
}

body {
    background: var(--sg-bg);
    color: var(--sg-text);
    font-family: "Segoe UI", "Helvetica Neue", Helvetica, sans-serif;
}

.sg-brand {
    font-weight: 700;
    letter-spacing: -0.02em;
}

.sg-card {
    background: var(--sg-surface);
    border: 1px solid var(--sg-border);
    border-radius: 18px;
}

.sg-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    background: #ddd;
}

.sg-avatar-lg {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    background: #ddd;
}

.sg-muted {
    color: var(--sg-muted);
}

.sg-btn-primary {
    background-color: var(--sg-accent);
    border-color: var(--sg-accent);
    color: #fff;
}
.sg-btn-primary:hover {
    background-color: #1a8cd8;
    border-color: #1a8cd8;
    color: #fff;
}

/* Mobile-first layout: single column, generous tap targets. */
.sg-shell {
    width: min(1280px, calc(100vw - 24px));
    margin: 0 auto;
    display: block;
}

.sg-main {
    max-width: 680px;
    margin: 0 auto;
    padding: 12px 0 24px;
}

.sg-mobile-nav {
    position: sticky;
    top: 0;
    z-index: 1030;
    background: rgba(255,255,255,0.88);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--sg-border);
    margin-bottom: 12px;
}

.sg-mobile-nav-inner {
    width: min(680px, calc(100vw - 24px));
    margin: 0 auto;
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sg-mobile-brand,
.sg-mobile-link {
    color: var(--sg-text);
    text-decoration: none;
    font-weight: 700;
}

.sg-feed-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 16px 12px;
}

.sg-page-title {
    font-size: 1.35rem;
    line-height: 1.1;
    margin: 0;
    font-weight: 800;
}

.sg-page-subtitle {
    color: var(--sg-muted);
    font-size: 0.92rem;
    margin-top: 2px;
}

.sg-hero-card,
.sg-profile-header,
.sg-side-card {
    background: var(--sg-surface);
    border: 1px solid var(--sg-border);
    border-radius: 20px;
    padding: 20px;
}

.sg-side-title {
    font-size: 1.1rem;
    font-weight: 800;
    margin: 0 0 8px;
}

.sg-side-copy {
    color: var(--sg-muted);
    margin: 0;
    line-height: 1.45;
}

.sg-form-footer {
    font-size: 0.9rem;
    color: var(--sg-muted);
}

.form-control, .btn {
    min-height: 44px;
}

/* -------------------- Phase 2: posts, composer, feed -------------------- */
.sg-card { padding: 14px 16px; }
.sg-card .sg-card { padding: 12px; }

.sg-feed > .sg-card {
    border-radius: 0;
    border-left: 1px solid var(--sg-border);
    border-right: 1px solid var(--sg-border);
    border-top: 0;
    margin-bottom: 0 !important;
}

.sg-feed > .sg-card:first-child {
    border-top: 1px solid var(--sg-border);
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
}

.sg-feed > .sg-card:last-child {
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
}

.sg-post-card .sg-post-body {
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    margin-top: 4px;
    font-size: 0.97rem;
    line-height: 1.45;
}

.sg-post-meta-wrap {
    line-height: 1.4;
}

.sg-name-link:hover,
.sg-handle:hover {
    text-decoration: underline !important;
}

.sg-handle {
    color: var(--sg-muted);
}

.sg-score-badge {
    display: inline-flex;
    align-items: center;
    margin-left: 8px;
    padding: 1px 7px;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    border: 1px solid transparent;
    vertical-align: middle;
}

.sg-score-high {
    color: #0f766e;
    background: #ecfeff;
    border-color: #99f6e4;
}

.sg-score-medium,
.sg-score-low,
.sg-score-unknown {
    color: #4b5563;
    background: #f3f4f6;
    border-color: #d1d5db;
}

.sg-score-spam,
.sg-score-abusive {
    color: #991b1b;
    background: #fef2f2;
    border-color: #fecaca;
}

.sg-verified-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #1d9bf0;
    vertical-align: text-bottom;
    margin-left: 4px;
}

.sg-verified-badge svg {
    display: block;
}

.sg-post-card-nested {
    border: 1px solid var(--sg-border);
    border-radius: 16px;
    padding: 10px;
    background: var(--sg-surface);
}

.sg-post-img {
    width: 100%;
    max-height: 360px;
    object-fit: contain;
    background: #eee;
}

.sg-post-actions .sg-action {
    background: transparent;
    border: 0;
    color: var(--sg-muted);
    padding: 8px 10px;
    border-radius: 999px;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.sg-post-actions .sg-action:hover { color: var(--sg-accent); background: rgba(29,155,240,0.08); }
.sg-post-actions .sg-action-like.is-active { color: #e0245e; }
.sg-post-actions .sg-action-like.is-active:hover { background: rgba(224,36,94,0.08); }
.sg-post-actions .sg-action-repost.is-active { color: #17bf63; }
.sg-post-actions .sg-action-repost.is-active:hover { background: rgba(23,191,99,0.08); }

.sg-mention, .sg-hashtag {
    color: var(--sg-accent);
    text-decoration: none;
}
.sg-mention:hover, .sg-hashtag:hover { text-decoration: underline; }

.sg-composer .sg-composer-input {
    resize: none;
    font-size: 1.25rem;
    min-height: 88px;
    padding-left: 0;
    box-shadow: none;
}
.sg-composer-count { min-width: 3ch; text-align: right; }
.sg-composer-preview img { max-height: 120px; object-fit: contain; background: #f7f9f9; }

.sg-composer {
    border-radius: 20px;
    margin-bottom: 12px;
}

.sg-source-inputs {
    padding-top: 6px;
}

.sg-source-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--sg-muted-soft);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.sg-source-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.sg-source-input {
    min-height: 34px;
    max-width: 180px;
    border-radius: 999px;
    border-color: var(--sg-border);
    background: var(--sg-surface-soft);
    font-size: 0.82rem;
    padding: 4px 12px;
}

.sg-source-input:focus {
    border-color: var(--sg-accent);
    background: #fff;
    box-shadow: 0 0 0 2px rgba(29,155,240,0.10);
}

.sg-media-button {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid rgba(29,155,240,0.24);
    color: var(--sg-accent);
    font-weight: 700;
    background: rgba(29,155,240,0.08);
    cursor: pointer;
}

.sg-media-button:hover {
    background: rgba(29,155,240,0.14);
}

.sg-delete-btn:hover {
    color: #e11d48 !important;
}

.sg-reply-label {
    color: var(--sg-muted-soft);
}

.sg-flash-banner {
    border-radius: 16px;
    border-width: 1px;
    margin: 0 0 12px;
}

.sg-profile-tabs {
    border-bottom: 1px solid var(--sg-border);
}

.sg-profile-tabs .nav-link {
    border: 0;
    border-bottom: 3px solid transparent;
    border-radius: 0;
    color: var(--sg-muted);
    font-weight: 700;
}

.sg-profile-tabs .nav-link.active {
    color: var(--sg-text);
    border-bottom-color: var(--sg-accent);
    background: transparent;
}

@media (min-width: 992px) {
    .sg-shell {
        display: grid;
        grid-template-columns: 260px minmax(620px, 680px) 320px;
        gap: 24px;
        align-items: start;
    }

    .sg-main {
        padding-top: 0;
    }

    .sg-left-rail {
        display: flex;
        justify-content: flex-end;
        position: sticky;
        top: 0;
        min-height: 100vh;
    }

    .sg-left-rail-inner {
        width: 240px;
        display: flex;
        flex-direction: column;
        gap: 18px;
        padding: 12px 0 20px;
    }

    .sg-brand-orb {
        width: 52px;
        height: 52px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        background: var(--sg-text);
        color: #fff;
        text-decoration: none;
        font-weight: 800;
        font-size: 1.1rem;
    }

    .sg-side-nav {
        display: flex;
        flex-direction: column;
        gap: 6px;
    }

    .sg-side-link {
        display: inline-flex;
        align-items: center;
        min-height: 52px;
        padding: 0 18px;
        border-radius: 999px;
        color: var(--sg-text);
        text-decoration: none;
        font-size: 1.2rem;
        font-weight: 500;
    }

    .sg-side-link:hover {
        background: var(--sg-surface-soft);
    }

    .sg-profile-chip {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 14px 16px;
        border-radius: 20px;
        border: 1px solid var(--sg-border);
        background: var(--sg-surface);
    }

    .sg-right-rail {
        position: sticky;
        top: 12px;
        display: flex;
        flex-direction: column;
        gap: 16px;
        padding-top: 12px;
    }
}

.sg-thread-main { border-color: var(--sg-accent); }
