/* =========================================================
   143HUB GLOBAL THEME
   Version: 3.1.0 (Theme Flicker Fix)
   ========================================================= */

:root {
    color-scheme: light; /* ✅ Browser ko batao light mode default hai */
    --primary: #e91e63;
    --primary-hover: #c2185b;
    --secondary: #9c27b0;
    --body-bg: #ffffff;
    --surface: #ffffff;
    --surface-2: #f8f9fb;
    --text: #202124;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --success: #198754;
    --danger: #dc3545;
    --warning: #f59e0b;
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, .05);
    --shadow-md: 0 8px 30px rgba(0, 0, 0, .08);
    --radius-sm: 7px;
    --radius-md: 11px;
    --radius-lg: 17px;
    --radius-xl: 24px;
    --container: 1180px;
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;
    --space-7: 48px;
    --space-8: 64px;
    --font-body: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-heading: Inter, ui-sans-serif, system-ui, sans-serif;
    --font-emoji: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', 'Android Emoji', 'EmojiSymbols', sans-serif;
}

/* DARK MODE */
html[data-theme="dark"] {
    color-scheme: dark; /* ✅ Browser ko batao dark mode active hai */
    --body-bg: #101114;
    --surface: #181a1f;
    --surface-2: #202229;
    --text: #f3f4f6;
    --text-muted: #a1a1aa;
    --border: #2e3139;
    --shadow-sm: 0 2px 12px rgba(0, 0, 0, .25);
    --shadow-md: 0 10px 35px rgba(0, 0, 0, .35);
}

@media (prefers-color-scheme: dark) {
    html[data-theme="system"] {
        color-scheme: dark;
        --body-bg: #101114;
        --surface: #181a1f;
        --surface-2: #202229;
        --text: #f3f4f6;
        --text-muted: #a1a1aa;
        --border: #2e3139;
        --shadow-sm: 0 2px 12px rgba(0, 0, 0, .25);
        --shadow-md: 0 10px 35px rgba(0, 0, 0, .35);
    }
}

/* ... (baaki CSS same rahega) ... */

/* RESET */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    min-height: 100vh;
    background: var(--body-bg);
    color: var(--text);
    font-family: var(--font-body);
    line-height: 1.6;
    transition: background-color .2s ease, color .2s ease;
}
button, a, input, textarea { font: inherit; }
button { cursor: pointer; }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }

/* ACCESSIBILITY */
:focus-visible {
    outline: 3px solid rgba(233, 30, 99, .35);
    outline-offset: 3px;
}

/* CONTAINER */
.container {
    width: min(calc(100% - 32px), var(--container));
    margin-inline: auto;
}

/* =========================================================
   HEADER
   ========================================================= */

.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}
.navbar {
    min-height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}
.logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 900;
    font-size: 21px;
    white-space: nowrap;
}
.logo-mark {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    font-size: 14px;
    font-weight: 900;
    box-shadow: 0 6px 18px rgba(233, 30, 99, .22);
}
.nav-links {
    display: flex;
    align-items: center;
    gap: 6px;
}
.nav-links a {
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
    transition: background .2s ease, color .2s ease;
}
.nav-links a:hover,
.nav-links a.active {
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 8%, transparent);
}
.nav-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* THEME BUTTON */
.theme-button {
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    border-radius: 10px;
    display: grid;
    place-items: center;
    font-size: 17px;
}

/* MOBILE MENU BUTTON */
.menu-button {
    display: none;
    width: 42px;
    height: 42px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    border-radius: 10px;
}

/* =========================================================
   USER MENU / DROPDOWN
   ========================================================= */

.user-menu-wrapper {
    position: relative;
    display: inline-block;
}

.user-icon-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px 5px 5px;
    border-radius: 50px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    font-weight: 600;
}
.user-icon-btn:hover {
    border-color: var(--primary);
    background: color-mix(in srgb, var(--primary) 5%, var(--surface));
}
.user-icon-btn.logged-in {
    padding: 4px 12px 4px 4px;
}
.user-icon-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary);
    flex-shrink: 0;
}
.user-icon-default {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    border-radius: 50%;
    background: var(--surface-2);
    border: 1px solid var(--border);
}
.user-name {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dropdown-arrow {
    font-size: 10px;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}
.user-icon-btn[aria-expanded="true"] .dropdown-arrow {
    transform: rotate(180deg);
}

/* Dropdown Menu */
.user-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 260px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 9999;
    overflow: hidden;
}
.user-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Dropdown Header */
.dropdown-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 18px;
    background: var(--surface-2);
}
.dropdown-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary);
    flex-shrink: 0;
}
.dropdown-user-icon {
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    border-radius: 50%;
    background: var(--surface);
    border: 1px solid var(--border);
    flex-shrink: 0;
}
.dropdown-user-info {
    flex: 1;
    min-width: 0;
}
.dropdown-user-name {
    font-weight: 700;
    font-size: 14px;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dropdown-user-status {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Dropdown Items */
.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 18px;
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.15s ease;
}
.dropdown-item:hover {
    background: color-mix(in srgb, var(--primary) 8%, transparent);
    color: var(--primary);
}
.dropdown-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}
.dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 5px 0;
}
.dropdown-item-primary {
    color: var(--primary);
    font-weight: 700;
}
.dropdown-item-primary:hover {
    background: color-mix(in srgb, var(--primary) 12%, transparent);
}
.dropdown-item-danger {
    color: var(--danger);
}
.dropdown-item-danger:hover {
    background: color-mix(in srgb, var(--danger) 10%, transparent);
    color: var(--danger);
}

/* Mobile User Info */
.mobile-user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
}
.mobile-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary);
}
.mobile-user-name {
    font-weight: 700;
    font-size: 14px;
}
.mobile-user-status {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* =========================================================
   BUTTONS
   ========================================================= */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 17px;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    font-weight: 700;
    font-size: 14px;
    transition: transform .15s ease, background .2s ease, border-color .2s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    box-shadow: 0 7px 20px rgba(233, 30, 99, .18);
}
.btn-outline {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border);
}
.btn-small {
    padding: 6px 15px;
    font-size: 13px;
    min-height: auto;
    border-radius: 50px;
}

/* =========================================================
   HERO
   ========================================================= */

.hero {
    padding: clamp(55px, 8vw, 100px) 0 clamp(45px, 7vw, 80px);
}
.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(300px, .85fr);
    gap: 55px;
    align-items: center;
}
.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 11px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--primary) 9%, transparent);
    color: var(--primary);
    font-size: 13px;
    font-weight: 800;
    margin-bottom: 17px;
}
.hero h1 {
    margin: 0;
    max-width: 780px;
    font-family: var(--font-heading);
    font-size: clamp(38px, 6vw, 70px);
    line-height: 1.04;
    letter-spacing: -2.8px;
}
.gradient-text {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.hero-description {
    max-width: 650px;
    margin: 22px 0 0;
    color: var(--text-muted);
    font-size: clamp(16px, 2vw, 19px);
    line-height: 1.75;
}
.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 11px;
    margin-top: 30px;
}

/* HERO SIDE CARD */
.hero-card {
    padding: 30px;
    border: 1px solid var(--border);
    background: linear-gradient(145deg, var(--surface), var(--surface-2));
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}
.hero-card::before {
    content: "";
    position: absolute;
    width: 180px;
    height: 180px;
    top: -80px;
    right: -60px;
    background: var(--primary);
    opacity: .08;
    border-radius: 50%;
}
.heart { font-size: 46px; margin-bottom: 15px; }
.hero-card h2 { margin: 0 0 9px; font-size: 24px; }
.hero-card p { margin: 0; color: var(--text-muted); line-height: 1.7; }

/* =========================================================
   SECTION
   ========================================================= */

.section { padding: clamp(48px, 7vw, 80px) 0; }
.section-alt { background: var(--surface-2); }
.section-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 27px;
}
.section-heading h2 {
    margin: 0;
    font-size: clamp(26px, 4vw, 36px);
    letter-spacing: -.8px;
}
.section-heading p {
    margin: 6px 0 0;
    color: var(--text-muted);
    max-width: 650px;
}
.section-link {
    color: var(--primary);
    font-weight: 700;
    font-size: 14px;
    white-space: nowrap;
}

/* =========================================================
   CARDS & GRIDS
   ========================================================= */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: color-mix(in srgb, var(--primary) 25%, var(--border));
}

/* STORY GRID */
.story-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}
.story-card { padding: 24px; }
.story-category {
    display: inline-flex;
    padding: 5px 9px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--primary) 8%, transparent);
    color: var(--primary);
    font-size: 12px;
    font-weight: 800;
}
.story-card h3 { margin: 17px 0 10px; font-size: 20px; line-height: 1.35; }
.story-card p { margin: 0; color: var(--text-muted); line-height: 1.7; }
.read-more {
    display: inline-flex;
    margin-top: 19px;
    color: var(--primary);
    font-size: 14px;
    font-weight: 800;
}

/* QUOTE GRID */
.quote-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}
.quote-card {
    padding: 28px;
    min-height: 210px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.quote-mark {
    color: var(--primary);
    font-size: 38px;
    line-height: 1;
    font-weight: 900;
}
.quote-text { margin: 10px 0 20px; font-size: 17px; line-height: 1.75; }
.quote-author {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 700;
}

/* CONTENT TYPES */
.type-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 15px;
}
.type-card { padding: 22px; text-align: center; }
.type-icon {
    width: 50px;
    height: 50px;
    margin: 0 auto 13px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: color-mix(in srgb, var(--primary) 9%, transparent);
    font-size: 24px;
}
.type-card h3 { margin: 0; font-size: 16px; }
.type-card p { margin: 7px 0 0; color: var(--text-muted); font-size: 13px; }

/* SUBMIT CTA */
.cta {
    padding: clamp(40px, 6vw, 65px);
    text-align: center;
    border-radius: var(--radius-xl);
    background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 12%, var(--surface)), color-mix(in srgb, var(--secondary) 10%, var(--surface)));
    border: 1px solid color-mix(in srgb, var(--primary) 15%, var(--border));
}
.cta h2 {
    margin: 0;
    font-size: clamp(27px, 5vw, 42px);
    letter-spacing: -1px;
}
.cta p {
    max-width: 650px;
    margin: 13px auto 25px;
    color: var(--text-muted);
}

/* =========================================================
   FOOTER
   ========================================================= */

.site-footer {
    padding: 50px 0 25px;
    border-top: 1px solid var(--border);
    background: var(--surface);
}
.footer-grid {
    display: grid;
    grid-template-columns: 1.5fr repeat(3, 1fr);
    gap: 35px;
}
.footer-brand p {
    max-width: 390px;
    color: var(--text-muted);
    line-height: 1.7;
}
.footer-title { margin: 0 0 14px; font-size: 14px; }
.footer-links {
    display: grid;
    gap: 9px;
}
.footer-links a {
    color: var(--text-muted);
    font-size: 14px;
}
.footer-links a:hover { color: var(--primary); }
.footer-bottom {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    gap: 15px;
    color: var(--text-muted);
    font-size: 13px;
}

/* MOBILE MENU LINKS */
.nav-links-mobile {
    display: block;
    padding: 11px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-weight: 650;
    text-decoration: none;
}
.nav-links-mobile:hover {
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 8%, transparent);
}

/* =========================================================
   CONTENT DISPLAY STYLES (For Stories, Letters, Confessions)
   ========================================================= */

.story-content,
.letter-content,
.confession-content,
.quote-text {
    font-size: 17px;
    line-height: 1.9;
    color: var(--text);
    word-wrap: break-word;
    overflow-wrap: break-word;
    font-family: var(--font-body), var(--font-emoji);
}

.story-content p,
.letter-content p,
.confession-content p {
    margin: 0 0 1.2em 0;
}
.story-content p:last-child,
.letter-content p:last-child,
.confession-content p:last-child {
    margin-bottom: 0;
}

.story-content h1,
.letter-content h1,
.confession-content h1 {
    font-size: 28px;
    margin: 1.5em 0 0.8em 0;
    font-weight: 700;
    line-height: 1.3;
    color: var(--text);
}
.story-content h2,
.letter-content h2,
.confession-content h2 {
    font-size: 24px;
    margin: 1.4em 0 0.7em 0;
    font-weight: 700;
    line-height: 1.3;
    color: var(--text);
}
.story-content h3,
.letter-content h3,
.confession-content h3 {
    font-size: 20px;
    margin: 1.3em 0 0.6em 0;
    font-weight: 700;
    line-height: 1.3;
    color: var(--text);
}

.story-content strong,
.story-content b,
.letter-content strong,
.letter-content b,
.confession-content strong,
.confession-content b {
    font-weight: 700;
    color: var(--text);
}

.story-content em,
.story-content i,
.letter-content em,
.letter-content i,
.confession-content em,
.confession-content i {
    font-style: italic;
}

.story-content u,
.letter-content u,
.confession-content u {
    text-decoration: underline;
    text-decoration-color: var(--primary);
    text-underline-offset: 3px;
}

.story-content s,
.letter-content s,
.confession-content s {
    text-decoration: line-through;
    opacity: 0.7;
}

.story-content blockquote,
.letter-content blockquote,
.confession-content blockquote {
    margin: 1.5em 0;
    padding: 20px 25px;
    border-left: 4px solid var(--primary);
    background: var(--surface-2);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-style: italic;
    color: var(--text-muted);
    font-size: 1.05em;
}

.story-content ul,
.story-content ol,
.letter-content ul,
.letter-content ol,
.confession-content ul,
.confession-content ol {
    margin: 1.2em 0;
    padding-left: 2em;
}
.story-content li,
.letter-content li,
.confession-content li {
    margin: 0.5em 0;
    line-height: 1.7;
}
.story-content ul li,
.letter-content ul li,
.confession-content ul li {
    list-style-type: disc;
}
.story-content ol li,
.letter-content ol li,
.confession-content ol li {
    list-style-type: decimal;
}

.story-content a,
.letter-content a,
.confession-content a {
    color: var(--primary);
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: color 0.2s ease;
}
.story-content a:hover,
.letter-content a:hover,
.confession-content a:hover {
    color: var(--primary-hover);
    text-decoration: none;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 950px) {
    .nav-links { display: none; }
    .menu-button { display: grid; place-items: center; }
    .hero-grid { grid-template-columns: 1fr; }
    .story-grid,
    .quote-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .type-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .footer-grid { grid-template-columns: repeat(2, 1fr); }
    
    .user-name { display: none; }
    .user-icon-btn { padding: 4px; border-radius: 50%; }
    .user-icon-btn.logged-in { padding: 4px; }
    .dropdown-arrow { display: none; }
}

@media (max-width: 620px) {
    .container { width: min(calc(100% - 24px), var(--container)); }
    .navbar { min-height: 62px; }
    .logo { font-size: 18px; }
    .logo-mark { width: 36px; height: 36px; }
    .hero h1 { letter-spacing: -1.7px; }
    .hero-actions { flex-direction: column; }
    .hero-actions .btn { width: 100%; }
    .story-grid,
    .quote-grid,
    .type-grid,
    .footer-grid { grid-template-columns: 1fr; }
    .section-heading { align-items: start; flex-direction: column; }
    .footer-bottom { flex-direction: column; }
    .hero-card { padding: 24px; }
    
    .user-dropdown { width: 240px; right: -50px; }
    
    .story-content,
    .letter-content,
    .confession-content {
        font-size: 16px;
        line-height: 1.8;
    }
    
    .story-content h1,
    .letter-content h1 { font-size: 22px; }
    .story-content h2,
    .letter-content h2 { font-size: 20px; }
    .story-content h3,
    .letter-content h3 { font-size: 18px; }
    
    .story-content blockquote,
    .letter-content blockquote {
        padding: 15px 18px;
        font-size: 1em;
    }
}

/* REDUCED MOTION */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
    }
}