/* Steeky shared theme. Loaded after each page's own styles so it wins ties. */
:root {
    --ink: #1f1a17;
    --ink-soft: #5c554f;
    --ink-faint: #8f8880;
    --paper: #f6f2ec;
    --surface: #ffffff;
    --line: #ebe5dc;
    --accent: #e8590c;
    --accent-dark: #c2410c;
    --accent-tint: #fff1e8;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(31, 26, 23, 0.04), 0 6px 18px rgba(31, 26, 23, 0.06);
    --shadow-hover: 0 2px 4px rgba(31, 26, 23, 0.05), 0 12px 28px rgba(31, 26, 23, 0.10);
    --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --h: 20;
}

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .page-title, .section-title, .group-title h1, .post-title {
    font-family: var(--font);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--ink);
}

a { text-underline-offset: 2px; }

/* ---------- Surfaces ---------- */
.group-card, .post-card, .sidebar, .about-section, .cta-section, .group-header-nav-card,
.post, .edit-form, .comments-section, .form-section, .table-container,
.left-sidebar, .right-sidebar, .posts-card, .friend-card, .request-card, .section,
.create-post-card, .settings-card, .post-item, .profile-header, .create-post-section,
.posts-section, .form-card, .group-info, .group-stats, .group-rules, .auth-container,
.group-header {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.group-info { color: var(--ink); }

nav, .navbar, .header { box-shadow: 0 1px 0 var(--line); }

.post-card, .group-card, .friend-card { transition: box-shadow .2s ease, transform .2s ease; }
.post-card:hover, .group-card:hover, .friend-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

/* ---------- Buttons ---------- */
button, .btn, .btn-primary, .btn-join, .btn-settings, .btn-upload, .btn-home {
    border-radius: 999px;
    font-weight: 600;
    letter-spacing: 0;
    transition: background .15s ease, color .15s ease, box-shadow .15s ease, transform .1s ease;
}
button:active, .btn:active { transform: scale(0.98); }

.btn-join, .btn-primary, .btn-upload, .create-post-button-wrapper button,
button[type="submit"], .btn-signup, .signup-btn, #createCommunityBtn, .create-community-btn {
    background: var(--accent);
    color: #fff;
    border: none;
}
.btn-join:hover, .btn-primary:hover, .btn-upload:hover:not(:disabled),
.create-post-button-wrapper button:hover, button[type="submit"]:hover,
#createCommunityBtn:hover, .create-community-btn:hover { background: var(--accent-dark); }
.btn-join.joined { background: var(--accent-tint); color: var(--accent-dark); box-shadow: inset 0 0 0 1px var(--accent); }
.btn-join.joined:hover { background: #ffe2d1; }

/* Secondary actions are quiet, not another solid orange block */
.btn-settings, .btn-secondary, .btn-cancel-upload {
    background: var(--surface);
    color: var(--ink);
    border: 1px solid var(--line);
    box-shadow: none;
}
.btn-settings:hover, .btn-secondary:hover, .btn-cancel-upload:hover:not(:disabled) {
    background: var(--paper);
    border-color: #d9d1c5;
}

input, textarea, select {
    border-radius: 10px;
    border-color: var(--line);
    background: #fff;
}
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(232, 89, 12, 0.16);
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Brand ---------- */
.logo, .navbar .logo, nav .logo, .nav-logo {
    font-family: var(--font);
    font-weight: 800;
    letter-spacing: -0.04em;
    color: var(--accent);
}

/* ---------- Community avatars ---------- */
.ci {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    border-radius: inherit;
    background: hsl(var(--h) 52% 42%);
    color: #fff;
    font-weight: 700;
    font-size: 0.55em;
    line-height: 1;
}
.post-community-icon, .community-icon {
    width: 38px !important; height: 38px !important;
    min-width: 38px;
    font-size: 38px !important;
    border-radius: 50%;
    overflow: hidden;
}
.post-community-icon img, .community-icon img { border-radius: 50% !important; }
.community-icon { width: 30px !important; height: 30px !important; min-width: 30px; font-size: 30px !important; }

.group-card .group-header { background: hsl(var(--h) 42% 34%); border: none; border-radius: var(--radius) var(--radius) 0 0; box-shadow: none; color: #fff; }
.group-card .group-icon {
    background-color: hsl(var(--h) 52% 46%);
    color: #fff; font-weight: 700;
    border-radius: 50%;
    border: 3px solid rgba(255,255,255,.85);
}
.group-icon-large {
    background-color: hsl(var(--h) 52% 42%) !important;
    color: #fff;
    border-radius: 50% !important;
    width: 88px !important; height: 88px !important;
    font-size: 40px !important;
    font-weight: 700;
    border: 4px solid var(--surface);
    box-shadow: 0 2px 8px rgba(31,26,23,.18);
}
.group-icon-wrapper { margin-top: 0; }
.edit-icon-btn {
    border-radius: 999px !important;
    background: var(--surface) !important;
    color: var(--ink) !important;
    border: 1px solid var(--line) !important;
    box-shadow: var(--shadow);
}

/* Community cover: per-community colour until one is uploaded */
.group-cover {
    background-color: hsl(var(--h) 42% 30%);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.group-cover::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,.28), transparent 55%);
    pointer-events: none;
}
.cover-actions { z-index: 1; }
.cover-actions button { border-radius: 999px; background: rgba(255,255,255,.92); color: var(--ink); backdrop-filter: blur(4px); }
.cover-actions button:hover { background: #fff; }
.group-info { overflow: visible; margin-top: 0; }

/* ---------- Feed cards ---------- */
.post-card { padding: 0; overflow: hidden; }
.post-card-header { padding: 16px 20px 6px; align-items: center; }
.post-community { gap: 12px; align-items: center; }
.post-community-info h4 { font-size: 0.9rem; font-weight: 500; color: var(--ink-soft); }
.post-community-name { color: var(--ink); font-weight: 700; text-decoration: none; }
.post-community-name:hover { color: var(--accent-dark); }
.post-time { color: var(--ink-faint); font-size: 0.8rem; }
.post-content-area { padding: 4px 20px 14px; }
.post-title { font-size: 1.2rem; line-height: 1.3; text-decoration: none; color: var(--ink); }
.post-title:hover { color: var(--accent-dark); }

.trend-badge {
    background: var(--accent-tint) !important;
    color: var(--accent-dark) !important;
    border-radius: 999px;
    font-weight: 600;
}

.post-actions {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 14px 12px;
    border-top: 1px solid var(--line);
    background: transparent;
}
.post-action {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    color: var(--ink-soft);
    font-size: 0.88rem; font-weight: 600;
    background: transparent;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}
.post-action:hover { background: var(--paper); color: var(--ink); }
.post-action--vote { background: var(--paper); }
.post-action--vote:hover { background: var(--accent-tint); color: var(--accent-dark); }
.post-action--vote-down:hover { background: #fdecec; color: #b42318; }
.post-action .action-count { font-variant-numeric: tabular-nums; }

.post-type-badge {
    border-radius: 999px; font-size: 0.7rem; font-weight: 700;
    padding: 2px 8px; margin-left: 8px; vertical-align: middle;
    background: var(--paper); color: var(--ink-soft);
}

.section-title, .page-title { font-size: 1.5rem; margin-bottom: 16px; }

/* ---------- Sidebars & navigation ---------- */
.left-sidebar, .sidebar, .group-header { padding: 14px; }
.sidebar-nav a, .group-header-nav a, .sidebar-link, .hamburger-item {
    gap: 0;
    padding: 10px 14px;
    border-radius: 10px;
    color: var(--ink);
    font-weight: 600;
    text-decoration: none;
    transition: background .15s ease, color .15s ease;
}
.sidebar-nav a:hover, .group-header-nav a:hover, .sidebar-link:hover, .hamburger-item:hover {
    background: var(--paper);
    color: var(--accent-dark);
}
.sidebar-link.active, .sidebar-nav a.active, .group-header-nav a.active {
    background: var(--accent-tint);
    color: var(--accent-dark);
}
.sidebar-section-title { color: var(--ink-faint); font-size: 0.72rem; letter-spacing: 0.08em; }
.community-item { border-radius: 10px; font-weight: 600; }
.community-item:hover { background: var(--paper); }

.sidebar-nav a::before, .group-header-nav a::before, .sidebar-link::before,
.hamburger-item::before, .dropdown-item[href]::before, .three-dot-item[href]::before {
    --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='3' fill='black'/%3E%3C/svg%3E");
    content: '';
    display: inline-block; vertical-align: -4px; margin-right: 12px;
    flex: 0 0 20px; width: 20px; height: 20px;
    background: currentColor;
    -webkit-mask: var(--icon) center / contain no-repeat;
    mask: var(--icon) center / contain no-repeat;
    opacity: .8;
}
a[href="/"]::before { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 11l9-8 9 8'/%3E%3Cpath d='M5 10v10h14V10'/%3E%3C/svg%3E"); }
a[href="/communities"]::before { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='8' r='3.5'/%3E%3Cpath d='M2.5 20c0-3.6 3-6 6.5-6s6.5 2.4 6.5 6'/%3E%3Cpath d='M16 4.7a3.5 3.5 0 010 6.6M18 14.4c2 .7 3.5 2.5 3.5 5.6'/%3E%3C/svg%3E"); }
a[href="/trending"]::before { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 17l6-6 4 4 8-8'/%3E%3Cpath d='M15 7h6v6'/%3E%3C/svg%3E"); }
a[href="/profile"]::before { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4 21c0-4.4 3.6-7 8-7s8 2.6 8 7'/%3E%3C/svg%3E"); }
a[href="/friend-posts"]::before { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12a8 8 0 01-11.6 7.1L3 21l1.9-5.4A8 8 0 1121 12z'/%3E%3C/svg%3E"); }
a[href="/friends"]::before { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 20s-7-4.4-7-10a4 4 0 017-2.6A4 4 0 0119 10c0 5.6-7 10-7 10z'/%3E%3C/svg%3E"); }
a[href="/admin"]::before { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3l8 3v6c0 4.5-3.2 7.8-8 9-4.8-1.2-8-4.5-8-9V6l8-3z'/%3E%3C/svg%3E"); }
a[href="/about"]::before { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 11v6M12 7.5v.01'/%3E%3C/svg%3E"); }
a[href="/create-community"]::before { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E"); }
a[href="/login"]::before { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 3h4a2 2 0 012 2v14a2 2 0 01-2 2h-4'/%3E%3Cpath d='M10 17l5-5-5-5M15 12H3'/%3E%3C/svg%3E"); }

/* Top bar */
.user-profile-btn { border-radius: 999px; }
.dropdown-menu, .user-dropdown { border-radius: 12px; box-shadow: var(--shadow-hover); border: 1px solid var(--line); }

/* Stats */
.group-stats .stat-number { color: var(--ink); font-weight: 800; }
.stat-number { font-variant-numeric: tabular-nums; }

/* Success / info banners */
.success-banner { border-radius: 12px; }

/* Footer */
footer { background: var(--ink); color: #d6d3d1; }
footer a { color: #fdba74; }
footer a:hover { color: #fff; }

@media (prefers-reduced-motion: reduce) {
    * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
    .post-card:hover, .group-card:hover, .friend-card:hover { transform: none; }
}

.create-post-button-wrapper button { background: var(--accent) !important; }
.create-post-button-wrapper button:hover { background: var(--accent-dark) !important; }

/* Links whose href is set by script or "#": match by id */
a[id*="Profile"]::before { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4 21c0-4.4 3.6-7 8-7s8 2.6 8 7'/%3E%3C/svg%3E"); }
a[id*="FriendPosts"]::before { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12a8 8 0 01-11.6 7.1L3 21l1.9-5.4A8 8 0 1121 12z'/%3E%3C/svg%3E"); }
a[id*="Friends"]::before, a#hamburgerFriends::before { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 20s-7-4.4-7-10a4 4 0 017-2.6A4 4 0 0119 10c0 5.6-7 10-7 10z'/%3E%3C/svg%3E"); }

/* Community cards */
.group-card .group-stats {
    background: transparent; border: none; box-shadow: none; padding: 0;
    display: flex; flex-wrap: wrap; gap: 4px 14px;
    font-size: 0.82rem; color: var(--ink-faint);
}
.group-card .group-action, .group-card a.group-action {
    background: var(--accent); border-radius: 999px; font-weight: 600;
}
.group-card .group-action:hover { background: var(--accent-dark); }
.group-card .group-description { color: var(--ink-soft); }
