:root {
    --color-bg: #f5f6f8;
    --color-surface: #ffffff;
    --color-text: #1a1f2e;
    --color-muted: #5c6478;
    --color-primary: #1a4a8a;
    --color-primary-light: #2563a8;
    --color-accent: #c9a227;
    --color-accent-hover: #b08e1f;
    --color-sale: #1e6b4a;
    --color-rent: #1e4a6b;
    --shadow-sm: 0 2px 8px rgba(30, 58, 95, 0.08);
    --shadow-md: 0 8px 32px rgba(30, 58, 95, 0.12);
    --radius: 12px;
    --font: 'Microsoft JhengHei', 'PingFang TC', 'Segoe UI', sans-serif;
}

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

html { scroll-behavior: smooth; }

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

main { flex: 1; }

a { color: var(--color-primary-light); text-decoration: none; }
a:hover { text-decoration: underline; }

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

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

/* Header */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(30, 58, 95, 0.08);
    box-shadow: var(--shadow-sm);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 72px;
}

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

.logo-img {
    height: 44px;
    width: auto;
    display: block;
}

.logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}

.logo-name-zh {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--color-primary);
}

.logo-name-en {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--color-muted);
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.main-nav a {
    padding: 8px 16px;
    color: var(--color-muted);
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: color 0.2s, background 0.2s;
}

.main-nav a:hover,
.main-nav a.active { color: var(--color-primary); background: rgba(30, 58, 95, 0.06); text-decoration: none; }

.nav-cta {
    background: var(--color-primary) !important;
    color: #fff !important;
}

.nav-cta:hover { background: var(--color-primary-light) !important; }

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.nav-toggle span {
    width: 24px;
    height: 2px;
    background: var(--color-primary);
}

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

.hero-bg {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(105deg, rgba(30, 58, 95, 0.92) 0%, rgba(30, 58, 95, 0.75) 45%, rgba(30, 58, 95, 0.4) 100%),
        url('https://images.unsplash.com/photo-1560518883-ce09059eeffa?w=1600&q=80') center/cover no-repeat;
}

.hero-content {
    position: relative;
    z-index: 1;
    color: #fff;
    padding: 80px 24px 64px;
}

.hero-tag {
    font-size: 0.85rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-accent);
    margin-bottom: 16px;
}

.hero h1 {
    font-size: clamp(2rem, 5vw, 3.25rem);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 16px;
}

.hero h1 span { color: var(--color-accent); }

.hero-lead {
    font-size: 1.1rem;
    opacity: 0.9;
    max-width: 520px;
    margin-bottom: 32px;
}

.hero-search {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    max-width: 640px;
    background: rgba(255, 255, 255, 0.12);
    padding: 12px;
    border-radius: var(--radius);
    backdrop-filter: blur(8px);
    margin-bottom: 40px;
}

.hero-search input,
.hero-search select {
    flex: 1;
    min-width: 140px;
    padding: 14px 16px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
}

.hero-stats {
    display: flex;
    gap: 48px;
    flex-wrap: wrap;
}

.hero-stats strong {
    display: block;
    font-size: 1.75rem;
    color: var(--color-accent);
}

.hero-stats span { font-size: 0.9rem; opacity: 0.85; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, transform 0.15s;
}

.btn-primary {
    background: var(--color-accent);
    color: #1a1f2e;
}

.btn-primary:hover {
    background: var(--color-accent-hover);
    text-decoration: none;
}

.btn-light {
    background: #fff;
    color: var(--color-primary);
}

.btn-light:hover { background: #f0f0f0; text-decoration: none; }

.btn-ghost {
    background: transparent;
    color: var(--color-primary);
    border: 1px solid var(--color-primary);
}

.btn-ghost:hover { background: rgba(30, 58, 95, 0.06); text-decoration: none; }

.btn-whatsapp {
    background: #25d366;
    color: #fff;
}

.btn-whatsapp:hover { background: #1fb855; text-decoration: none; }

.btn-block { width: 100%; margin-top: 8px; }

/* Sections */
.section { padding: 64px 0; }
.section-alt { background: var(--color-surface); }
.section-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 16px;
}

.section-head h2 { font-size: 1.75rem; color: var(--color-primary); }
.section-sub { color: var(--color-muted); margin-top: 8px; }
.text-center { text-align: center; }
.link-more { font-weight: 600; color: var(--color-primary); }

/* Property grid */
.property-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.property-grid-3 { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

.property-grid-home {
    grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 900px) {
    .property-grid-home { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 560px) {
    .property-grid-home { grid-template-columns: 1fr; }
}

.property-card {
    background: var(--color-surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.25s, transform 0.25s;
}

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

.card-image-wrap {
    position: relative;
    display: block;
    aspect-ratio: 4/3;
    overflow: hidden;
}

.card-image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s;
}

.property-card:hover .card-image-wrap img { transform: scale(1.05); }

.badge {
    position: absolute;
    top: 12px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
}

.badge-sale { left: 12px; background: var(--color-sale); }
.badge-rent { left: 12px; background: var(--color-rent); }
.badge-cat { right: 12px; background: rgba(0, 0, 0, 0.55); }

.card-body { padding: 20px; }
.card-district { font-size: 0.85rem; color: var(--color-muted); margin-bottom: 6px; }
.card-body h3 { font-size: 1.1rem; margin-bottom: 8px; }
.card-body h3 a { color: var(--color-text); text-decoration: none; }
.card-body h3 a:hover { color: var(--color-primary); }
.card-price { font-size: 1.2rem; font-weight: 700; color: var(--color-primary); margin-bottom: 6px; }
.card-meta { font-size: 0.85rem; color: var(--color-muted); }

/* Services */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 24px;
    margin-top: 40px;
}

.service-card {
    padding: 28px;
    background: var(--color-bg);
    border-radius: var(--radius);
    border: 1px solid rgba(30, 58, 95, 0.08);
}

.service-icon { font-size: 2rem; margin-bottom: 12px; }
.service-card h3 { font-size: 1.1rem; margin-bottom: 8px; color: var(--color-primary); }
.service-card p { font-size: 0.95rem; color: var(--color-muted); }

/* CTA band */
.cta-band {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
    color: #fff;
}

.cta-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
}

.cta-inner h2 { font-size: 1.5rem; margin-bottom: 8px; }
.cta-inner p { opacity: 0.9; }

/* Page hero */
.page-hero {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
    color: #fff;
    padding: 64px 0;
}

.page-hero-sm { padding: 48px 0; }
.page-hero h1 { font-size: 2rem; margin-bottom: 8px; }
.page-hero p { opacity: 0.9; }

/* Listings layout */
.layout-with-sidebar {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 32px;
    align-items: start;
}

.filters-panel {
    background: var(--color-surface);
    padding: 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 96px;
}

.filters-form label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-muted);
    margin-bottom: 16px;
}

.filters-form input,
.filters-form select,
.contact-form input,
.contact-form select,
.contact-form textarea {
    display: block;
    width: 100%;
    margin-top: 6px;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
}

.empty-state {
    padding: 48px;
    text-align: center;
    background: var(--color-surface);
    border-radius: var(--radius);
    color: var(--color-muted);
}

/* Detail page */
.breadcrumb {
    font-size: 0.9rem;
    color: var(--color-muted);
    margin-bottom: 24px;
}

.detail-layout {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 32px;
    margin-bottom: 40px;
}

.gallery-main {
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    margin-bottom: 12px;
}

.detail-main-img {
    width: 100%;
    display: block;
    aspect-ratio: 16/10;
    object-fit: cover;
}

.gallery-thumbs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.gallery-thumb {
    padding: 0;
    border: 2px solid transparent;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    background: none;
    width: 72px;
    height: 54px;
    flex-shrink: 0;
}

.gallery-thumb.active {
    border-color: var(--color-accent);
}

.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.gallery-placeholder {
    aspect-ratio: 16/10;
    background: #e8e6e3;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-muted);
    margin-bottom: 24px;
}

.detail-videos {
    margin-top: 8px;
}

.detail-videos h2 {
    font-size: 1.15rem;
    color: var(--color-primary);
    margin-bottom: 16px;
}

.video-item {
    margin-bottom: 20px;
}

.video-embed-wrap {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    border-radius: var(--radius);
    overflow: hidden;
    background: #000;
}

.video-embed-wrap iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.video-local {
    width: 100%;
    max-height: 420px;
    border-radius: var(--radius);
    background: #000;
}

.detail-sidebar {
    background: var(--color-surface);
    padding: 28px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    height: fit-content;
    position: sticky;
    top: 96px;
}

.detail-badges { margin-bottom: 12px; }
.detail-badges .badge { position: static; display: inline-block; margin-right: 8px; }

.detail-sidebar h1 { font-size: 1.5rem; margin-bottom: 12px; }
.detail-price { font-size: 1.75rem; font-weight: 700; color: var(--color-primary); margin-bottom: 20px; }

.detail-facts { list-style: none; margin-bottom: 20px; }
.detail-facts li {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
    font-size: 0.95rem;
}

.detail-facts span { color: var(--color-muted); }

.detail-features { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }

.tag {
    padding: 4px 12px;
    background: rgba(30, 58, 95, 0.08);
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--color-primary);
}

.detail-description h2 { font-size: 1.25rem; margin-bottom: 12px; color: var(--color-primary); }
.related-section { margin-top: 48px; }
.related-section h2 { margin-bottom: 24px; color: var(--color-primary); }

/* About */
.prose { max-width: 720px; }
.prose p { margin-bottom: 16px; color: var(--color-muted); }
.prose h2 { margin: 32px 0 16px; color: var(--color-primary); }

.promise-list { list-style: none; }
.promise-list li { padding: 12px 0; border-bottom: 1px solid #eee; }

.stats-row {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    margin-top: 24px;
}

.stat-box {
    flex: 1;
    min-width: 140px;
    padding: 24px;
    background: var(--color-surface);
    border-radius: var(--radius);
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.stat-box strong { display: block; font-size: 2rem; color: var(--color-accent); }
.stat-box span { font-size: 0.9rem; color: var(--color-muted); }

/* Contact */
.contact-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 40px;
    align-items: start;
}

.contact-form {
    background: var(--color-surface);
    padding: 32px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.contact-form label {
    display: block;
    margin-bottom: 20px;
    font-weight: 600;
    font-size: 0.9rem;
}

.req { color: #c0392b; }

.contact-info h2 { font-size: 1.25rem; margin-bottom: 16px; color: var(--color-primary); }
.contact-info p { margin-bottom: 12px; font-size: 0.95rem; color: var(--color-muted); }


.alert {
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 24px;
    grid-column: 1 / -1;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* Footer */
.site-footer {
    background: var(--color-primary);
    color: rgba(255, 255, 255, 0.85);
    margin-top: auto;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 32px;
    padding: 48px 24px 32px;
}

.footer-grid h4 {
    color: var(--color-accent);
    font-size: 0.9rem;
    margin-bottom: 12px;
}

.footer-grid ul { list-style: none; }
.footer-grid li { margin-bottom: 8px; font-size: 0.9rem; }

.footer-grid a { color: rgba(255, 255, 255, 0.9); }
.footer-logo {
    height: 36px;
    width: auto;
    margin-bottom: 10px;
    display: block;
}
.footer-name-en {
    font-size: 0.8rem;
    letter-spacing: 0.03em;
    opacity: 0.85;
    margin-bottom: 8px;
}
.footer-address-en { font-size: 0.85rem; opacity: 0.8; }
.license-note { font-size: 0.85rem; line-height: 1.5; }
.license-note strong { color: #fff; }

.about-intro {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    margin-bottom: 24px;
}

.about-logo {
    height: 72px;
    width: auto;
    flex-shrink: 0;
}

.contact-facts { list-style: none; }
.contact-facts li {
    padding: 12px 0;
    border-bottom: 1px solid #eee;
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 12px;
}
.contact-facts span { color: var(--color-muted); font-weight: 600; }
.contact-facts small { color: var(--color-muted); }

.license-inline {
    font-size: 0.85rem;
    color: var(--color-muted);
    margin-top: 8px;
}

.map-embed {
    margin-top: 20px;
    border-radius: var(--radius);
    overflow: hidden;
    height: 220px;
    box-shadow: var(--shadow-sm);
}

.map-embed iframe {
    width: 100%;
    height: 100%;
    border: 0;
}

.footer-bottom {
    padding: 16px 24px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    font-size: 0.85rem;
    opacity: 0.75;
}

/* Responsive */
@media (max-width: 900px) {
    .layout-with-sidebar,
    .detail-layout,
    .contact-layout {
        grid-template-columns: 1fr;
    }

    .filters-panel,
    .detail-sidebar {
        position: static;
    }
}

@media (max-width: 768px) {
    .logo-name-en { display: none; }
    .logo-img { height: 38px; }

    .nav-toggle { display: flex; }

    .main-nav {
        display: none;
        position: absolute;
        top: 72px;
        left: 0;
        right: 0;
        flex-direction: column;
        background: #fff;
        padding: 16px;
        box-shadow: var(--shadow-md);
    }

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

    .hero-search { flex-direction: column; }
    .hero-stats { gap: 24px; }
    .about-intro { flex-direction: column; align-items: center; text-align: center; }
}
