/* ============================================
   dongnai.land — THE ARCHITECTURAL PRECISION
   Native CSS | Tonal Layering | Inter Precision
   ============================================ */

@import url('variables.css');

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body { 
    font-family: var(--font-primary); 
    line-height: 1.6; 
    color: var(--color-text-primary); 
    background: var(--color-surface); 
    -webkit-font-smoothing: antialiased;
    letter-spacing: var(--tracking-tight);
    overflow-x: hidden;
    width: 100%;
}
a { color: var(--color-primary); text-decoration: none; transition: var(--transition-base); }
img { max-width: 100%; height: auto; display: block; border-radius: var(--radius-global); }
ul { list-style: none; }

/* --- Layout --- */
.main-container { 
    max-width: 1600px; 
    margin: 0 auto; 
    padding: 0 var(--space-lg); 
}
@media (max-width: 768px) {
    .main-container { padding: 0 16px; }
}
.section-padding { padding: var(--space-3xl) 0; }
@media (max-width: 768px) {
    /* Tighten vertical whitespace for WebApp feel */
    .section-padding { padding: 24px 0; }
}

/* --- Tonal Elevation (The No-Line Rule) --- */
.bg-surface { background-color: var(--color-surface); }
.bg-surface-secondary { background-color: var(--color-surface-container-low); }
.bg-surface-tertiary { background-color: var(--color-surface-container); }
.bg-inverse-surface { background-color: #161c26; color: white; }

/* --- Typography Hierarchy --- */
.text-xs { font-size: var(--text-xs); line-height: 1.4; }
.text-sm { font-size: var(--text-sm); line-height: 1.5; }
.text-base { font-size: var(--text-base); line-height: 1.6; }
.text-lg { font-size: var(--text-lg); line-height: 1.6; }
.text-xl { font-size: var(--text-xl); line-height: 1.4; font-weight: 700; }
.text-2xl { font-size: var(--text-2xl); line-height: 1.3; font-weight: 800; }
.text-3xl { font-size: var(--text-3xl); line-height: 1.2; font-weight: 900; }

.font-bold { font-weight: 700; }
.font-black { font-weight: 700; }
.tracking-tight { letter-spacing: var(--tracking-tight); }
.tracking-tighter { letter-spacing: var(--tracking-tighter); }

.text-primary { color: var(--color-primary); }
.text-secondary { color: var(--color-text-secondary); }
.text-tertiary { color: var(--color-text-tertiary); }
.text-white { color: #ffffff; }

/* --- Desktop Homepage Refinement --- */
@media (min-width: 768px) {
    .homepage-main .font-black { font-weight: 700; }
    .homepage-main .text-xl { font-size: var(--text-xl); line-height: 1.4; }
    .homepage-main .p-5 { padding: .8rem; }
    .homepage-main .font-bold { font-weight: 600; }
    .homepage-main .uppercase { text-transform: inherit; }
    .listing-title { font-size: 1.1rem !important; font-weight: 600 !important; }
}

/* ============================================
   HEADER — Sticky Glassmorphism
   ============================================ */
.site-header {
    position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
    background: rgba(249, 249, 255, 0.8); /* var(--surface) with opacity */
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    transition: var(--transition-premium);
}
.site-header.scrolled {
    background: var(--surface-container-lowest);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.05);
}
.header-inner {
    display: flex; justify-content: space-between; align-items: center;
    height: 80px;
}
.site-logo {
    font-size: 1.5rem; font-weight: 900; color: var(--primary);
    letter-spacing: -0.04em;
}
.site-nav ul { display: flex; gap: 32px; }
.site-nav a {
    color: var(--on-surface-variant); font-weight: 600; font-size: 0.875rem;
    transition: var(--transition-premium);
}
.site-nav a:hover, .site-nav a.active {
    color: var(--primary);
}

/* ============================================
   HERO — Architectural Plane
   ============================================ */
.hero-section {
    position: relative;
    height: 640px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background-color: var(--color-on-primary);
}
.hero-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
}
.hero-bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.7);
}
.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(13, 28, 45, 0.4) 0%, rgba(13, 28, 45, 0) 100%);
    z-index: 1;
}
.hero-content {
    position: relative;
    z-index: 10;
    text-align: center;
    width: 100%;
    max-width: 896px;
    color: white;
}
.hero-title {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 900;
    line-height: 1.1;
    letter-spacing: var(--tracking-tighter);
    margin-bottom: var(--space-md);
    text-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.hero-description {
    font-size: var(--text-lg);
    font-weight: 500;
    opacity: 0.9;
    margin-bottom: var(--space-xl);
}

/* --- Search Hub --- */
.hero-search-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(24px);
    border-radius: var(--radius-lg);
    padding: var(--space-xs);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.1);
    color: var(--color-text-primary);
}
.search-tabs {
    display: flex;
    gap: var(--space-xs);
    padding: var(--space-xs);
}
.search-tab-btn {
    padding: var(--space-xs) var(--space-lg);
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    font-weight: 700;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: var(--transition-fast);
}
.search-tab-btn.active {
    background: var(--color-primary);
    color: white;
}
.search-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr auto;
    gap: var(--space-xs);
    padding: var(--space-xs);
}
.search-field {
    text-align: left;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-right: 1px solid rgba(0, 0, 0, 0.05);
    padding: 0 var(--space-sm);
}
.search-field:nth-last-child(2) {
    border-right: none;
}
.search-field label {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-text-tertiary);
}
.search-input, .search-select {
    width: 100%;
    border: none;
    background: transparent;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--color-text-primary);
    outline: none;
    padding: var(--space-sm) 0;
    transition: color var(--transition-fast);
}
.search-input::placeholder {
    color: var(--color-text-tertiary);
    font-weight: 500;
}
.search-select option {
    font-weight: 500;
}
.search-submit-btn {
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    padding: 0 var(--space-lg);
    height: 48px;
    font-weight: 700;
    font-size: var(--text-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: var(--transition-base);
}
@media (max-width: 768px) {
    .search-form-grid { grid-template-columns: 1fr; gap: 0; }
    .search-field { padding: 8px 12px; border-right: none; border-bottom: 1px solid rgba(0,0,0,0.05); }
    .search-field:nth-last-child(2) { border-bottom: none; }
    .hero-search-container { border-radius: 0; margin-top: 24px; padding: 0; }
    .search-tabs { padding: 4px; gap: 4px; }
    .search-tab-btn { padding: 8px 16px; border-radius: 4px; }
    .search-submit-btn { border-radius: 0; height: 56px; }
    .hero-stats { justify-content: center; text-align: center; }
    .stat-item { flex-direction: column; gap: 4px; }
    .hero-section { height: auto; padding: var(--space-2xl) 0; }
    .hero-title { font-size: 1.75rem; line-height: 1.25; }
    .hero-description { font-size: 0.875rem; margin-top: 12px; }
}

/* ============================================
   CAROUSEL — Peek Pattern
   ============================================ */
.peek-carousel-container {
    overflow: visible !important;
}
.swiper-slide {
    height: auto;
    transition: transform var(--transition-base);
}
.nav-btn {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    background: var(--color-surface-container-lowest);
    border: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-base);
    color: var(--color-primary);
}
.nav-btn:hover {
    background: var(--color-primary);
    color: white;
    box-shadow: var(--shadow-md);
}

/* ============================================
   DISTRICT GRID
   ============================================ */
.district-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-sm);
}
.district-card {
    position: relative;
    aspect-ratio: 1/1;
    border-radius: var(--radius-global);
    overflow: hidden;
}
.district-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform-origin: center center;
    transition: transform var(--transition-slow);
}
.district-card:hover img {
    transform: scale(1.1);
}
.district-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 40%, rgba(0,0,0,0.8));
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: var(--space-md);
    color: white;
    text-align: left;
}
@media (max-width: 1024px) { .district-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 768px) { .district-grid { grid-template-columns: repeat(2, 1fr); } }

/* ============================================
   TOOLS GRID
   ============================================ */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-md);
}
.tool-item {
    background: var(--color-surface-container-lowest);
    border: 1px solid var(--color-border);
    padding: var(--space-xl) var(--space-md);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: var(--transition-base);
}
.tool-item:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
    border-color: var(--color-primary);
}
.tool-icon {
    width: 64px;
    height: 64px;
    background: var(--color-surface-container-low);
    color: var(--color-primary);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-sm);
    transition: var(--transition-base);
}
.tool-item:hover .tool-icon {
    background: var(--color-primary);
    color: white;
}
@media (max-width: 768px) { .tools-grid { grid-template-columns: repeat(2, 1fr); } }

/* ============================================
   EDITORIAL — Market News
   ============================================ */
.editorial-grid {
    display: grid;
    grid-template-columns: 7fr 5fr;
    gap: var(--space-2xl);
}
.news-featured-card {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}
.news-thumb {
    aspect-ratio: 16/9;
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.news-item-mini {
    display: flex;
    gap: var(--space-md);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--color-border);
}
.news-item-mini:last-child { border-bottom: none; }
.news-mini-thumb {
    width: 120px;
    aspect-ratio: 4/3;
    border-radius: var(--radius-sm);
    overflow: hidden;
    flex-shrink: 0;
}
@media (max-width: 1024px) { .editorial-grid { grid-template-columns: 1fr; } }

/* ============================================
   FORMS — Consultation
   ============================================ */
.consultation-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-2xl);
    align-items: center;
}
.editorial-gradient {
    background: linear-gradient(135deg, var(--color-primary), #0066ff);
}
@media (max-width: 768px) { .consultation-grid { grid-template-columns: 1fr; } }

/* ============================================
   FOOTER
   ============================================ */
.site-footer {
    background: var(--bg-dark); color: var(--text-white);
    padding: 50px 0 30px;
}
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 40px; margin-bottom: 30px; }
.footer-brand { font-size: 1.4rem; font-weight: 700; margin-bottom: 14px; display: block; }
.footer-desc { color: #95a5a6; line-height: 1.7; font-size: 0.95rem; }
.footer-title { font-size: 1rem; font-weight: 700; margin-bottom: 16px; color: #fff; }
.footer-links { display: flex; flex-direction: column; gap: 10px; }
.footer-links a { color: #95a5a6; font-size: 0.9rem; transition: var(--transition); }
.footer-links a:hover { color: var(--accent); padding-left: 4px; }
.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.08);
    padding-top: 20px; text-align: center;
    color: #7f8c8d; font-size: 0.85rem;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
    .property-grid { grid-template-columns: repeat(2, 1fr); }
    .district-grid { grid-template-columns: repeat(2, 1fr); }
    .stats-bar { grid-template-columns: repeat(2, 1fr); }
    .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
    .header-inner { height: 60px; }
    .site-logo { font-size: 1.3rem; }
    .site-nav a { padding: 6px 12px; font-size: 0.85rem; }
    .hero { padding: 50px 20px 60px; }
    .hero h1 { font-size: 2rem; }
    .hero p { font-size: 1rem; }
    .hero-stats { gap: 25px; flex-wrap: wrap; }
    .hero-stat .num { font-size: 1.6rem; }
    .hero-search { flex-direction: column; border-radius: var(--radius); }
    .hero-search button { border-radius: 0; }
    .section { padding: 50px 0; }
    .section-header h2 { font-size: 1.6rem; }
}
@media (max-width: 600px) {
    .property-grid { grid-template-columns: 1fr; }
    .district-grid { grid-template-columns: 1fr; }
    .stats-bar { grid-template-columns: 1fr; padding: 24px; }
    .detail-meta { grid-template-columns: 1fr; }
    .footer-grid { grid-template-columns: 1fr; gap: 30px; }
    .header-inner { gap: 0; }
    .site-nav ul { gap: 4px; }
}

/* ============================================
   MOBILE HOMEPAGE REDESIGN (Exclusive Mobile UI)
   ============================================ */
@media (max-width: 767px) {
    /* Hide standard layout on Mobile Homepage */
    body.is-homepage > header {
        display: none !important;
    }

    /* Ensure footer displays on Mobile Homepage */
    body.is-homepage > footer {
        display: block !important;
        margin-bottom: 80px; /* buffer for mobile bottom nav */
    }

    body.is-homepage main {
        background: #f8f9ff;
    }

    /* Mobile Design Tokens */
    .no-scrollbar::-webkit-scrollbar { display: none; }
    .no-scrollbar { 
        -ms-overflow-style: none; 
        scrollbar-width: none; 
    }

    .sticky-header {
        transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    }
    .sticky-header.scrolled {
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(20px);
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
    }
    .sticky-header.hidden {
        transform: translateY(-100%);
    }

    .hero-slide {
        scroll-snap-align: start;
        flex-shrink: 0;
    }

    .featured-badge {
        background: linear-gradient(135deg, #ff7327 0%, #ff9500 100%);
        box-shadow: 0 4px 12px rgba(255, 115, 39, 0.3);
    }

    .property-card { transition: all 0.3s ease; }
    .property-card:active { transform: scale(0.98); }

    .category-btn { transition: all 0.2s ease; }
    .category-btn:active { transform: scale(0.95); }

    .gradient-text {
        background: linear-gradient(135deg, #00668a 0%, #00bfff 100%);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
    }

    .pb-safe { padding-bottom: env(safe-area-inset-bottom, 20px); }

    /* Keyframe Animations */
    @keyframes fadeInUp {
        from { opacity: 0; transform: translateY(20px); }
        to { opacity: 1; transform: translateY(0); }
    }
    .fade-in-up { animation: fadeInUp 0.4s ease-out; }

    @keyframes shimmer {
        0% { background-position: -1000px 0; }
        100% { background-position: 1000px 0; }
    }
    .shimmer {
        background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
        background-size: 1000px 100%;
        animation: shimmer 2s infinite;
    }
}
