:root {
    --gold: #C9A227;
    --gold-light: #E8D48B;
    --gold-dark: #9A7B1A;
    --midnight: #0D1B2A;
    --midnight-light: #1B2D45;
    --velvet: #8B1A1A;
    --velvet-light: #B52D2D;
    --cream: #F5F0E1;
    --cream-dark: #E8DFC8;
    --purple: #4A148C;
    --text: #2C2C2C;
    --text-light: #6B7280;
    --white: #FFFFFF;
    --shadow: 0 4px 24px rgba(13, 27, 42, 0.12);
    --shadow-lg: 0 8px 40px rgba(13, 27, 42, 0.18);
    --radius: 12px;
    --radius-sm: 8px;
    --font-display: 'Playfair Display', Georgia, serif;
    --font-body: 'Source Sans 3', -apple-system, BlinkMacSystemFont, sans-serif;
    --transition: 0.25s ease;
}

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

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    color: var(--text);
    background: var(--cream);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--velvet); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--gold-dark); }

h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.25;
    color: var(--midnight);
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.25rem;
}

/* Header */
.site-header {
    background: var(--midnight);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0;
    gap: 1rem;
    position: relative;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--white);
    text-decoration: none;
}

.logo img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid var(--gold);
}

.logo-text {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.2;
}

.logo-text span {
    display: block;
    font-size: 0.7rem;
    font-family: var(--font-body);
    font-weight: 400;
    color: var(--gold-light);
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--white);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
    z-index: 2;
    line-height: 1;
}

.main-nav ul {
    display: flex;
    list-style: none;
    gap: 0.25rem;
    align-items: center;
}

.main-nav a:not(.btn) {
    color: rgba(255, 255, 255, 0.85);
    padding: 0.5rem 1rem;
    border-radius: 0;
    font-weight: 500;
    font-size: 0.95rem;
    transition: color var(--transition);
    background: none;
}

.main-nav a:not(.btn):hover,
.main-nav a:not(.btn).active {
    color: var(--gold-light);
    background: none;
    text-decoration: underline;
    text-underline-offset: 4px;
    text-decoration-color: rgba(201, 162, 39, 0.5);
}

.nav-auth {
    display: flex;
    gap: 0.5rem;
    margin-left: 0.5rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.5rem;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    line-height: 1.4;
}

.btn-primary {
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: var(--midnight);
    box-shadow: 0 2px 8px rgba(201, 162, 39, 0.35);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--gold-light), var(--gold));
    color: var(--midnight);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(201, 162, 39, 0.45);
}

.btn-secondary {
    background: transparent;
    color: var(--white);
    border: 2px solid rgba(255,255,255,0.3);
}

.btn-secondary:hover {
    border-color: var(--gold);
    color: var(--gold-light);
}

.btn-outline {
    background: transparent;
    color: var(--midnight);
    border: 2px solid var(--midnight);
}

.btn-outline:hover {
    background: var(--midnight);
    color: var(--white);
}

.btn-velvet {
    background: var(--velvet);
    color: var(--white);
}

.btn-velvet:hover {
    background: var(--velvet-light);
    color: var(--white);
}

.btn-sm { padding: 0.4rem 1rem; font-size: 0.85rem; }
.btn-lg { padding: 0.85rem 2rem; font-size: 1.05rem; }
.btn-block { width: 100%; }

/* Hero */
.hero {
    position: relative;
    min-height: 520px;
    display: flex;
    align-items: center;
    overflow: hidden;
    background: var(--midnight);
}

.hero-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    opacity: 0.45;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(13,27,42,0.92) 0%, rgba(74,20,140,0.4) 50%, rgba(139,26,26,0.3) 100%);
}

.hero-content {
    position: relative;
    z-index: 2;
    padding: 4rem 0;
    max-width: 680px;
}

.hero h1 {
    font-size: clamp(2.2rem, 5vw, 3.5rem);
    color: var(--white);
    margin-bottom: 1rem;
}

.hero h1 em {
    font-style: normal;
    color: var(--gold);
}

.hero p {
    font-size: 1.15rem;
    color: rgba(255,255,255,0.85);
    margin-bottom: 2rem;
    line-height: 1.7;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Sections */
.section {
    padding: 4rem 0;
}

.section-header {
    text-align: center;
    margin-bottom: 3rem;
}

.section-header h2 {
    font-size: clamp(1.75rem, 3vw, 2.5rem);
    margin-bottom: 0.75rem;
}

.section-header p {
    color: var(--text-light);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
}

.section-dark {
    background: var(--midnight);
    color: var(--cream);
}

.section-dark h2,
.section-dark h3 { color: var(--white); }

.section-dark p { color: rgba(245,240,225,0.8); }

/* Feature cards */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.feature-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    transition: transform var(--transition), box-shadow var(--transition);
    text-align: center;
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.feature-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1.25rem;
    background: linear-gradient(135deg, var(--gold-light), var(--gold));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
}

.feature-card h3 {
    margin-bottom: 0.75rem;
    font-size: 1.25rem;
}

.feature-card p {
    color: var(--text-light);
    font-size: 0.95rem;
}

/* Membership tiers */
.tiers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
    align-items: start;
}

.tier-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    position: relative;
    border: 2px solid transparent;
    transition: all var(--transition);
}

.tier-card:hover {
    border-color: var(--gold);
    transform: translateY(-2px);
}

.tier-card.featured {
    border-color: var(--gold);
    box-shadow: var(--shadow-lg);
}

.tier-card.featured::before {
    content: 'Most Popular';
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--gold);
    color: var(--midnight);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.25rem 1rem;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tier-card.current {
    border-color: var(--velvet);
}

.tier-name {
    font-family: var(--font-display);
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.tier-price {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--midnight);
    margin-bottom: 0.25rem;
}

.tier-price small {
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-light);
}

.tier-desc {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--cream-dark);
}

.tier-features {
    list-style: none;
    margin-bottom: 1.5rem;
}

.tier-features li {
    padding: 0.4rem 0;
    font-size: 0.9rem;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.tier-features li::before {
    content: '✦';
    color: var(--gold);
    flex-shrink: 0;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.2rem 0.65rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.badge-fan { background: #E5E7EB; color: #374151; }
.badge-gold { background: #FEF3C7; color: #92400E; }
.badge-inner { background: #FEE2E2; color: #991B1B; }
.badge-legend { background: #EDE9FE; color: #5B21B6; }

/* Posts / Feed */
.feed-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    padding: 2rem 0 4rem;
}

.feed-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.post-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 1.5rem;
    transition: box-shadow var(--transition);
}

.post-card:hover { box-shadow: var(--shadow-lg); }

.post-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 1.5rem 0;
}

.post-avatar,
a.post-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold-light), var(--gold));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--midnight);
    font-size: 1.1rem;
    flex-shrink: 0;
    text-decoration: none;
}

.post-meta h4 {
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.1rem;
}

.post-meta h4 a { color: var(--midnight); }
.post-meta h4 a:hover { color: var(--velvet); }

.post-meta time {
    font-size: 0.8rem;
    color: var(--text-light);
}

.post-body {
    padding: 1rem 1.5rem;
}

.post-body h3 {
    font-size: 1.15rem;
    margin-bottom: 0.5rem;
}

.post-body p {
    color: var(--text);
    white-space: pre-wrap;
}

.post-image {
    margin: 0.75rem 0 0;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.post-locked {
    background: linear-gradient(135deg, var(--midnight-light), var(--midnight));
    color: var(--cream);
    padding: 2rem;
    text-align: center;
    border-radius: var(--radius-sm);
    margin: 0.75rem 0 0;
}

.post-actions {
    display: flex;
    gap: 1.5rem;
    padding: 0.75rem 1.5rem 1.25rem;
    border-top: 1px solid var(--cream-dark);
}

.post-action {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 0.9rem;
    cursor: pointer;
    transition: color var(--transition);
    font-family: var(--font-body);
}

.post-action:hover,
.post-action.liked { color: var(--velvet); }

.visibility-tag {
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    background: var(--cream);
    border-radius: 4px;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Forms */
.form-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2.5rem;
    max-width: 480px;
    margin: 2rem auto 4rem;
}

.form-card h1 {
    text-align: center;
    margin-bottom: 0.5rem;
    font-size: 1.75rem;
}

.form-subtitle {
    text-align: center;
    color: var(--text-light);
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

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

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
    color: var(--midnight);
}

.form-control {
    width: 100%;
    padding: 0.7rem 1rem;
    border: 2px solid var(--cream-dark);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 1rem;
    transition: border-color var(--transition);
    background: var(--white);
}

.form-control:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.15);
}

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

.form-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-light);
}

/* Alerts */
.alert {
    padding: 0.85rem 1.25rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
    font-weight: 500;
}

.alert-success {
    background: #D1FAE5;
    color: #065F46;
    border: 1px solid #A7F3D0;
}

.alert-error {
    background: #FEE2E2;
    color: #991B1B;
    border: 1px solid #FECACA;
}

/* Profile */
.profile-header {
    background: linear-gradient(135deg, var(--midnight), var(--midnight-light));
    padding: 3rem 0;
    color: var(--white);
}

.profile-header-inner {
    display: flex;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.profile-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--midnight);
    border: 4px solid var(--gold-light);
    flex-shrink: 0;
}

.profile-info h1 {
    color: var(--white);
    font-size: 2rem;
    margin-bottom: 0.25rem;
}

.profile-info .username {
    color: var(--gold-light);
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
}

.profile-bio {
    color: rgba(255,255,255,0.8);
    max-width: 500px;
}

/* Page content */
.page-content {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 3rem;
    margin: 2rem auto 4rem;
    max-width: 800px;
}

.page-content h1 {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 3px solid var(--gold);
}

.page-content p {
    margin-bottom: 1rem;
    line-height: 1.8;
}

/* Footer */
.site-footer {
    background: var(--midnight);
    color: rgba(255,255,255,0.7);
    padding: 3rem 0 1.5rem;
    margin-top: auto;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-brand .logo-text {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
}

.footer-brand p {
    font-size: 0.9rem;
    line-height: 1.6;
}

.footer-links h4 {
    color: var(--gold);
    font-family: var(--font-body);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 1rem;
}

.footer-links ul {
    list-style: none;
}

.footer-links li { margin-bottom: 0.5rem; }

.footer-links a {
    color: rgba(255,255,255,0.7);
    font-size: 0.9rem;
}

.footer-links a:hover { color: var(--gold-light); }

.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 1.5rem;
    text-align: center;
    font-size: 0.85rem;
}

/* Error page */
.error-page {
    text-align: center;
    padding: 6rem 0;
}

.error-page h1 {
    font-size: 6rem;
    color: var(--gold);
    line-height: 1;
}

.error-page h2 {
    margin: 1rem 0;
}

.error-page p {
    color: var(--text-light);
    margin-bottom: 2rem;
}

/* Community preview on homepage */
.community-preview {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: center;
}

.community-preview img {
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

.recent-posts-mini .post-card {
    margin-bottom: 1rem;
}

.recent-posts-mini .post-body {
    padding: 0.75rem 1.25rem 1rem;
}

.recent-posts-mini .post-body p {
    font-size: 0.9rem;
    color: var(--text-light);
}

/* Responsive */
@media (max-width: 992px) {
    .nav-toggle { display: block; }

    .main-nav {
        display: none;
        flex-direction: column;
        align-items: stretch;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--midnight-light);
        padding: 1rem 1.25rem 1.25rem;
        box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
        border-top: 1px solid rgba(201, 162, 39, 0.15);
        gap: 0;
    }

    .main-nav.open {
        display: flex;
    }

    .main-nav ul {
        flex-direction: column;
        align-items: stretch;
    }

    .main-nav a {
        display: block;
        padding: 0.75rem 1rem;
    }

    .nav-auth {
        flex-direction: column;
        margin-left: 0;
        margin-top: 0.5rem;
    }
}

@media (max-width: 768px) {
    .hero-content { padding: 2.5rem 0; }

    .community-preview {
        grid-template-columns: 1fr;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .profile-header-inner {
        flex-direction: column;
        text-align: center;
    }

    .form-card { padding: 1.5rem; margin: 1rem auto 3rem; }
    .page-content { padding: 1.5rem; margin: 1rem auto 3rem; }

    .feed-header { flex-direction: column; align-items: stretch; }
    .feed-header .btn { text-align: center; }
}

@media (max-width: 480px) {
    .hero-actions { flex-direction: column; }
    .hero-actions .btn { width: 100%; }
    .tiers-grid { grid-template-columns: 1fr; }
}
