/* ============================================================
   HOMEPAGE CSS - Optimized for Performance
   ============================================================ */

/* Mobile-first approach - all styles for mobile by default */
.hero {
    background: linear-gradient(160deg, #0A0A0A 0%, #1A0F05 60%, #0A0A0A 100%);
    padding: 30px 0 40px;
    text-align: center;
    border-bottom: 1px solid rgba(212, 175, 55, 0.1);
    contain: strict;
    min-height: 300px;
    position: relative;
    overflow: hidden;
    margin-left: 0;
    margin-right: 0;
}

.hero-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
    position: relative;
    z-index: 1;
    min-height: 280px;
    contain: layout style;
}

.hero h1 {
    color: #D4AF37;
    font-size: 1.6rem;
    margin-bottom: 6px;
    line-height: 1.2;
    word-break: break-word;
}

.hero p {
    color: #888888;
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.hero-price-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 16px;
    min-height: 200px;
    contain: layout style;
}

.hero-price-card-main {
    grid-column: span 2;
    min-height: 120px;
    contain: layout style;
    background: linear-gradient(135deg, #1A1A1A, #2A1A0A);
    border-radius: 14px;
    padding: 16px 20px;
    border: 1px solid rgba(212, 175, 55, 0.15);
    position: relative;
    box-sizing: border-box;
}

.hero-price-card-main::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #D4AF37, transparent);
    pointer-events: none;
}

.hero-price-card-main .price-label {
    color: #888888;
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.hero-price-card-main .price-value {
    font-size: 2.2rem;
    font-weight: 900;
    color: #D4AF37;
    line-height: 1.1;
}

.hero-price-card-main .price-sub {
    color: #666666;
    font-size: 0.7rem;
}

.hero-price-card-main .price-change {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 600;
    margin-top: 4px;
}

.hero-price-card-main .price-change.positive {
    color: #22C55E;
    background: rgba(34, 197, 94, 0.1);
}

.hero-price-card-main .price-change.negative {
    color: #EF4444;
    background: rgba(239, 68, 68, 0.1);
}

.hero-price-card {
    min-height: 100px;
    contain: layout style;
    background: rgba(255,255,255,0.02);
    border-radius: 10px;
    padding: 12px 10px;
    text-align: center;
    border: 1px solid rgba(255,255,255,0.04);
    box-sizing: border-box;
}

.hero-price-card .carat-label {
    color: #D4AF37;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
}

.hero-price-card .carat-price {
    color: #FFFFFF;
    font-size: 1rem;
    font-weight: 700;
    margin: 2px 0;
}

.hero-price-card .carat-change {
    font-size: 0.55rem;
    font-weight: 600;
}

.hero-price-card .carat-change.positive { color: #22C55E; }
.hero-price-card .carat-change.negative { color: #EF4444; }

/* Features Section */
.features {
    padding: 30px 0;
    margin-left: 0;
    margin-right: 0;
}

.features-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.features-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.feature-card {
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.04);
    border-radius: 10px;
    padding: 16px;
    text-align: center;
    min-height: 120px;
}

.feature-icon {
    font-size: 1.8rem;
    display: block;
    margin-bottom: 6px;
}

.feature-card h3 {
    color: #D4AF37;
    font-size: 0.85rem;
    margin-bottom: 4px;
}

.feature-card p {
    color: #888888;
    font-size: 0.7rem;
    line-height: 1.4;
}

/* Gold Price Grid */
.price-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 0;
    max-width: 1200px;
    margin: 16px auto;
    min-height: 120px;
}

.price-card {
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.04);
    border-radius: 10px;
    padding: 12px;
    text-align: center;
    min-height: 100px;
}

.price-card .carat {
    color: #D4AF37;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}

.price-card .price {
    color: #FFFFFF;
    font-size: 1.1rem;
    font-weight: 700;
}

.price-card .change {
    font-size: 0.6rem;
    font-weight: 600;
}

.price-card .change.positive { color: #22C55E; }
.price-card .change.negative { color: #EF4444; }

/* Main Price Card */
.price-main {
    grid-column: span 2;
    background: linear-gradient(135deg, #1A1A1A, #2A1A0A);
    border: 1px solid rgba(212, 175, 55, 0.15);
    border-radius: 14px;
    padding: 20px;
    text-align: center;
    position: relative;
    min-height: 140px;
}

.price-main .label {
    color: #888888;
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.price-main .value {
    font-size: 2.4rem;
    font-weight: 900;
    color: #D4AF37;
    line-height: 1.1;
}

.price-main .sub {
    color: #666666;
    font-size: 0.7rem;
}

.price-main .change-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 600;
    margin-top: 4px;
}

.price-main .change-badge.positive {
    color: #22C55E;
    background: rgba(34, 197, 94, 0.1);
}

.price-main .change-badge.negative {
    color: #EF4444;
    background: rgba(239, 68, 68, 0.1);
}

/* Currency Table - Horizontal Scroll */
.currency-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 16px auto;
    padding: 0;
    max-width: 1200px;
    min-height: 200px;
    position: relative;
    contain: layout style;
}

.currency-table-wrapper table {
    width: 100%;
    min-width: 600px;
    border-collapse: collapse;
    font-size: 0.75rem;
    contain: layout style;
}

.currency-table-wrapper th {
    color: #D4AF37;
    padding: 8px 10px;
    text-align: center;
    border-bottom: 2px solid rgba(212, 175, 55, 0.15);
    font-size: 0.55rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.currency-table-wrapper td {
    padding: 6px 10px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    color: #FFFFFF;
    font-size: 0.7rem;
    white-space: nowrap;
    vertical-align: middle;
}

.currency-table-wrapper tbody tr {
    height: 40px;
    contain: layout style;
}

/* History Grid */
.history-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding: 0;
    max-width: 1200px;
    margin: 16px auto;
}

.history-item {
    text-align: center;
    padding: 8px 4px;
    background: rgba(255,255,255,0.02);
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.03);
}

.history-item .day {
    font-size: 0.45rem;
    color: #888888;
    text-transform: uppercase;
}

.history-item .date {
    font-size: 0.5rem;
    color: #666666;
}

.history-item .price {
    font-size: 0.65rem;
    font-weight: 700;
    color: #FFFFFF;
    margin-top: 2px;
}

.history-item.today {
    border-color: rgba(212, 175, 55, 0.2);
    background: rgba(212, 175, 55, 0.04);
}

.history-item.today .price {
    color: #D4AF37;
}

/* Cities Grid */
.cities-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 0;
    max-width: 1200px;
    margin: 16px auto;
}

.city-item {
    text-align: center;
    padding: 12px 8px;
    background: rgba(255,255,255,0.02);
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.04);
    text-decoration: none;
    color: #FFFFFF;
    transition: all 0.3s;
}

.city-item .flag {
    font-size: 1.2rem;
    display: block;
}

.city-item .name {
    font-size: 0.65rem;
    font-weight: 600;
    margin-top: 4px;
    color: #CCCCCC;
}

/* Section Titles */
.section-title {
    color: #D4AF37;
    font-size: 1.1rem;
    font-weight: 700;
    margin: 24px auto 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 1200px;
    padding: 0;
}

.section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, rgba(212, 175, 55, 0.2), transparent);
}

/* Content Section */
.content-section {
    background: rgba(255,255,255,0.02);
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.04);
    padding: 16px;
    margin: 16px auto;
    max-width: 1200px;
    overflow: hidden;
}

.content-section h2 {
    color: #D4AF37;
    font-size: 1.1rem;
    margin-top: 0;
}

.content-section p {
    color: #AAAAAA;
    line-height: 1.7;
    font-size: 0.85rem;
}

/* Read More Button */
.read-more-btn {
    background: none;
    border: 1px solid rgba(212, 175, 55, 0.2);
    color: #D4AF37;
    padding: 6px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    transition: all 0.3s;
    margin-top: 10px;
}

.read-more-btn:hover {
    background: rgba(212, 175, 55, 0.05);
}

.gold-content-hidden {
    display: none;
}

.gold-content-hidden.show {
    display: block;
}

/* Ad Containers */
.ad-container {
    padding: 0;
    margin: 16px auto;
    max-width: 1200px;
    min-height: 100px;
    position: relative;
    contain: layout style;
}

.ad-inner {
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 10px;
    padding: 12px;
    text-align: center;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 100%;
}

.ad-label {
    position: absolute;
    top: 2px;
    right: 8px;
    font-size: 0.4rem;
    color: #444444;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Quick Links */
.quick-links {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 0;
    max-width: 1200px;
    margin: 16px auto;
}

.quick-link {
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.04);
    border-radius: 10px;
    padding: 14px;
    text-align: center;
    color: #FFFFFF;
    text-decoration: none;
    transition: all 0.3s;
}

.quick-link .label {
    font-size: 0.7rem;
    color: #888888;
}

.quick-link .carat {
    font-size: 1.1rem;
    font-weight: 700;
    color: #D4AF37;
}

/* ============================================================
   TABLET STYLES
   ============================================================ */
@media (min-width: 768px) {
    .hero {
        padding: 50px 0 60px;
        min-height: 380px;
    }
    
    .hero-container {
        min-height: 340px;
        padding: 0 20px;
    }
    
    .hero h1 {
        font-size: 2.4rem;
    }
    
    .hero p {
        font-size: 1.1rem;
    }
    
    .hero-price-grid {
        grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
        gap: 12px;
        min-height: 200px;
    }
    
    .hero-price-card-main {
        grid-column: span 1;
        min-height: 140px;
        padding: 20px 24px;
    }
    
    .hero-price-card-main .price-value {
        font-size: 3rem;
    }
    
    .hero-price-card {
        min-height: 120px;
        padding: 14px 12px;
    }
    
    .features-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 16px;
    }
    
    .price-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 12px;
        min-height: 120px;
    }
    
    .price-main {
        grid-column: span 2;
        padding: 24px;
        min-height: 140px;
    }
    
    .price-main .value {
        font-size: 3rem;
    }
    
    .history-grid {
        grid-template-columns: repeat(7, 1fr);
    }
    
    .cities-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .quick-links {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .section-title {
        font-size: 1.3rem;
        margin-top: 30px;
        margin-bottom: 16px;
    }
    
    .ad-container {
        min-height: 120px;
    }
    
    .ad-inner {
        min-height: 80px;
    }
}

/* ============================================================
   DESKTOP STYLES
   ============================================================ */
@media (min-width: 1024px) {
    .hero {
        padding: 60px 0 70px;
        min-height: 450px;
    }
    
    .hero-container {
        min-height: 400px;
    }
    
    .hero h1 {
        font-size: 3rem;
    }
    
    .hero-price-grid {
        min-height: 220px;
        gap: 16px;
    }
    
    .hero-price-card-main {
        min-height: 160px;
        padding: 24px 30px;
    }
    
    .hero-price-card-main .price-value {
        font-size: 3.6rem;
    }
    
    .hero-price-card {
        min-height: 130px;
        padding: 18px 16px;
    }
    
    .price-main {
        min-height: 160px;
    }
    
    .price-main .value {
        font-size: 3.6rem;
    }
    
    .price-card {
        min-height: 110px;
    }
    
    .currency-table-wrapper {
        min-height: 280px;
    }
    
    .currency-table-wrapper tbody tr {
        height: 50px;
    }
    
    .ad-container {
        min-height: 130px;
    }
    
    .ad-inner {
        min-height: 90px;
    }
}

/* ============================================================
   UTILITY CLASSES
   ============================================================ */
.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.hidden { display: none; }

/* ============================================================
   PERFORMANCE OPTIMIZATIONS
   ============================================================ */

/* Reduce repaints and reflows */
* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Lazy load images */
img {
    loading: lazy;
    decoding: async;
}

/* Fix image loading - prevent shifts */
.header-logo-img {
    width: 120px;
    height: 40px;
    object-fit: contain;
}

/* Fix live dot - prevent flex shifts */
.header-live-dot {
    width: 10px;
    height: 10px;
    flex-shrink: 0;
    display: inline-block;
    background: #22C55E;
    border-radius: 50%;
}

/* Prevent layout shifts from animations */
.hero,
.hero-container,
.hero-price-grid,
.hero-price-card-main,
.hero-price-card,
.ad-container,
.ad-inner,
.currency-table-wrapper,
.currency-table-wrapper table,
.currency-table-wrapper tbody tr {
    animation: none !important;
    transition: none !important;
    transform: none !important;
}

/* Reduce animation complexity */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Optimize font loading */
@font-face {
    font-family: 'Inter';
    font-display: swap;
}
/* ============================================================
   DESKTOP CLS FIX - Remove ::before completely
   ============================================================ */

/* Remove the ::before pseudo-element that causes CLS */
.hero-section::before {
    display: none !important;
    content: none !important;
}

/* Use a static background with the glow effect instead */
.hero-section {
    background: linear-gradient(160deg, #0A0A0A 0%, #1A0F05 60%, #0A0A0A 100%);
    position: relative;
}

/* Add the glow as a separate static element */
.hero-section .hero-bg-glow {
    display: block !important;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, rgba(212, 175, 55, 0.03) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
    contain: strict;
}

/* Ensure the container is above the glow */
.hero-section .hero-container {
    position: relative;
    z-index: 1;
}

/* Desktop specific */
@media (min-width: 1024px) {
    .hero-section {
        min-height: 450px;
        padding: 60px 0 70px;
    }
    
    .hero-section .hero-container {
        min-height: 400px;
    }
    
    .hero-price-grid {
        min-height: 220px;
        gap: 16px;
    }
    
    .hero-price-card-main {
        min-height: 160px;
        padding: 24px 30px;
    }
    
    .hero-price-card {
        min-height: 130px;
        padding: 18px 16px;
    }
}
