/* ===== CSS Variables ===== */
:root {
    --bg: #ffffff;
    --bg-alt: #f7f8fa;
    --text: #1a1a2e;
    --text-muted: #6b7280;
    --header-bg: rgba(255,255,255,0.95);
    --card-bg: #ffffff;
    --border: #e5e7eb;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #059669;
    --youth-color: #7c3aed;
    --newlywed-color: #db2777;
    --longterm-color: #0891b2;
    --national-color: #059669;
    --jeonse-color: #d97706;
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -1px rgba(0,0,0,0.04);
    --shadow-md: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: 0.2s ease;
}

[data-theme="dark"] {
    --bg: #0f172a;
    --bg-alt: #1e293b;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --header-bg: rgba(15,23,42,0.95);
    --card-bg: #1e293b;
    --border: #334155;
}

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

body {
    font-family: 'Pretendard', 'Noto Sans KR', -apple-system, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    transition: background var(--transition), color var(--transition);
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; }
img { max-width: 100%; }

/* ===== Header ===== */
header {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    background: var(--header-bg);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
}

nav {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    height: 64px;
    display: flex;
    align-items: center;
    gap: 2rem;
}

.logo {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--primary);
    white-space: nowrap;
}

nav ul {
    display: flex;
    gap: 0.5rem;
    flex: 1;
}

nav ul li a {
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: all var(--transition);
}

nav ul li a:hover {
    color: var(--primary);
    background: rgba(37,99,235,0.08);
}

.nav-controls { display: flex; gap: 8px; }

.theme-toggle {
    background: none;
    border: 1.5px solid var(--border);
    color: var(--text-muted);
    padding: 0.4rem 0.9rem;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all var(--transition);
    white-space: nowrap;
}

.theme-toggle:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* ===== Hero ===== */
.hero {
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 50%, #7c3aed 100%);
    min-height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 80px 2rem 4rem;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('https://images.unsplash.com/photo-1560518883-ce09059ee41f?q=80&w=1974&auto=format&fit=crop') center/cover;
    opacity: 0.08;
}

.hero-content {
    position: relative;
    max-width: 800px;
}

.hero-badge {
    display: inline-block;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    color: rgba(255,255,255,0.9);
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
}

.hero-content h1 {
    font-size: clamp(2rem, 5vw, 3.2rem);
    font-weight: 800;
    color: #fff;
    line-height: 1.3;
    margin-bottom: 1.2rem;
}

.hero-content p {
    font-size: clamp(1rem, 2vw, 1.2rem);
    color: rgba(255,255,255,0.85);
    margin-bottom: 2.5rem;
    line-height: 1.7;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-primary {
    background: #fff;
    color: var(--primary);
    padding: 0.9rem 2rem;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: 0 4px 14px rgba(0,0,0,0.2);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.25);
}

.btn-secondary {
    background: transparent;
    color: #fff;
    padding: 0.9rem 2rem;
    border: 2px solid rgba(255,255,255,0.6);
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-secondary:hover {
    background: rgba(255,255,255,0.15);
    border-color: #fff;
}

/* ===== Stats Bar ===== */
.stats-bar {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 3rem;
    flex-wrap: wrap;
}

.stat-item {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.stat-num {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--primary);
}

.stat-label {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.stat-divider {
    width: 1px;
    height: 40px;
    background: var(--border);
}

/* ===== Section Common ===== */
.section-header {
    text-align: center;
    margin-bottom: 3rem;
}

.section-header h2 {
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    font-weight: 800;
    margin-bottom: 0.75rem;
}

.section-header p {
    color: var(--text-muted);
    font-size: 1rem;
}

/* ===== Housing Types ===== */
.housing-types {
    padding: 5rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.type-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2.5rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    scrollbar-width: none;
}

.type-tabs::-webkit-scrollbar { display: none; }

.tab-btn {
    padding: 0.6rem 1.2rem;
    border: 1.5px solid var(--border);
    border-radius: 50px;
    background: none;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition);
}

.tab-btn:hover { border-color: var(--primary); color: var(--primary); }

.tab-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.tab-content { display: none; }
.tab-content.active { display: block; }

.housing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
}

.housing-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform var(--transition), box-shadow var(--transition);
}

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

.card-header {
    padding: 1.2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.card-header.youth { background: linear-gradient(135deg, #7c3aed, #a855f7); }
.card-header.newlywed { background: linear-gradient(135deg, #db2777, #f472b6); }
.card-header.longterm { background: linear-gradient(135deg, #0891b2, #38bdf8); }
.card-header.national { background: linear-gradient(135deg, #059669, #34d399); }
.card-header.jeonse { background: linear-gradient(135deg, #d97706, #fbbf24); }

.card-tag {
    font-size: 0.75rem;
    font-weight: 700;
    color: rgba(255,255,255,0.85);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.card-header h3 {
    font-size: 1.15rem;
    font-weight: 800;
    color: #fff;
}

.card-body {
    padding: 1.2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.card-info-row {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    font-size: 0.88rem;
}

.info-label {
    min-width: 65px;
    font-weight: 700;
    color: var(--text-muted);
    flex-shrink: 0;
    padding-top: 0.05rem;
}

.info-value { color: var(--text); flex: 1; }

.highlight-value {
    color: var(--primary);
    font-weight: 700;
}

.card-tip {
    margin-top: 0.5rem;
    padding: 0.7rem 0.9rem;
    background: var(--bg-alt);
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    color: var(--text-muted);
    border-left: 3px solid var(--primary);
}

/* ===== Eligibility Check ===== */
.eligibility {
    background: var(--bg-alt);
    padding: 5rem 2rem;
}

.eligibility-container {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.check-group { display: flex; flex-direction: column; gap: 0.75rem; }

.check-label {
    font-weight: 700;
    font-size: 1rem;
}

.check-options {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.check-btn {
    padding: 0.55rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: 50px;
    background: var(--card-bg);
    color: var(--text-muted);
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

.check-btn:hover { border-color: var(--primary); color: var(--primary); }

.check-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    font-weight: 600;
}

.eligibility-result {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.eligibility-result h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-muted);
}

.result-list { display: flex; flex-direction: column; gap: 0.5rem; }

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.92rem;
    font-weight: 600;
    background: var(--bg-alt);
    color: var(--text-muted);
}

.result-item.recommended {
    background: rgba(37,99,235,0.08);
    color: var(--primary);
}

.result-badge {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    background: var(--primary);
    color: #fff;
}

.result-badge.secondary {
    background: var(--text-muted);
}

.eligibility-result .btn-primary {
    background: var(--primary);
    color: #fff;
    align-self: flex-start;
    border-radius: var(--radius-sm);
    box-shadow: none;
}

/* ===== Comparison Table ===== */
.comparison {
    padding: 5rem 2rem;
    background: var(--bg);
}

.comparison .section-header { margin-bottom: 2.5rem; }

.table-container {
    max-width: 900px;
    margin: 0 auto;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

th, td {
    padding: 1.1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    text-align: center;
    font-size: 0.92rem;
}

tr:last-child td { border-bottom: none; }

th {
    background: var(--bg-alt);
    font-weight: 700;
    font-size: 0.9rem;
}

td:first-child { font-weight: 700; color: var(--text-muted); }

.highlight { color: var(--primary); font-weight: 700; }

th.highlight {
    background: var(--primary);
    color: #fff;
}

/* ===== FAQ ===== */
.faq-section {
    padding: 5rem 2rem;
    background: var(--bg-alt);
}

.faq-container {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.faq-item {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.faq-question {
    width: 100%;
    padding: 1.2rem 1.5rem;
    background: none;
    border: none;
    text-align: left;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    transition: background var(--transition);
}

.faq-question:hover { background: var(--bg-alt); }
.faq-item.open .faq-question { color: var(--primary); }

.faq-arrow {
    font-size: 0.7rem;
    color: var(--text-muted);
    transition: transform 0.2s;
    flex-shrink: 0;
}

.faq-item.open .faq-arrow { transform: rotate(180deg); }

.faq-answer {
    display: none;
    padding: 0 1.5rem 1.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.8;
}

.faq-answer p { margin-bottom: 0.5rem; }
.faq-answer p:last-child { margin-bottom: 0; }

.faq-answer ul, .faq-answer ol {
    padding-left: 1.2rem;
    margin: 0.5rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.faq-answer ul { list-style: disc; }
.faq-answer ol { list-style: decimal; }

.faq-answer strong { color: var(--text); }

.faq-item.open .faq-answer { display: block; }

/* ===== Subscribe ===== */
.subscribe {
    padding: 5rem 2rem;
    text-align: center;
    background: linear-gradient(135deg, #1e3a8a, #2563eb);
    color: #fff;
}

.subscribe h2 {
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 800;
    margin-bottom: 0.75rem;
}

.subscribe p {
    color: rgba(255,255,255,0.8);
    margin-bottom: 2.5rem;
    font-size: 1rem;
}

.subscribe form {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    max-width: 420px;
    margin: 0 auto;
}

.subscribe input {
    padding: 0.9rem 1.2rem;
    border: none;
    border-radius: var(--radius-sm);
    width: 100%;
    font-size: 0.95rem;
    background: rgba(255,255,255,0.15);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.3);
    outline: none;
    transition: all var(--transition);
}

.subscribe input::placeholder { color: rgba(255,255,255,0.6); }
.subscribe input:focus { background: rgba(255,255,255,0.2); border-color: rgba(255,255,255,0.6); }

.form-buttons {
    display: flex;
    gap: 0.75rem;
    width: 100%;
}

.subscribe button {
    flex: 1;
    padding: 0.9rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition);
}

.subscribe button[type="submit"] {
    background: #fff;
    color: var(--primary);
}

.subscribe button[type="submit"]:hover { background: #f0f4ff; }

#btn-experience {
    background: transparent;
    color: #fff;
    border: 2px solid rgba(255,255,255,0.5);
}

#btn-experience:hover { background: rgba(255,255,255,0.1); border-color: #fff; }

/* ===== Reviews ===== */
.reviews {
    padding: 5rem 2rem;
    background: var(--bg);
    max-width: 900px;
    margin: 0 auto;
}

/* ===== Contact ===== */
.contact {
    padding: 5rem 2rem;
    text-align: center;
    background: var(--bg-alt);
}

.contact h2 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.75rem;
}

.contact p {
    color: var(--text-muted);
    margin-bottom: 2.5rem;
}

.contact-form {
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.contact-form input,
.contact-form textarea {
    padding: 0.9rem 1.2rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--card-bg);
    color: var(--text);
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: border-color var(--transition);
}

.contact-form input:focus,
.contact-form textarea:focus { border-color: var(--primary); }

.contact-form textarea { height: 150px; resize: vertical; }

.contact-form button {
    background: var(--primary);
    color: #fff;
    padding: 0.9rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background var(--transition);
}

.contact-form button:hover { background: var(--primary-dark); }

/* ===== Footer ===== */
footer {
    background: #0f172a;
    color: rgba(255,255,255,0.7);
    padding: 3rem 2rem 1.5rem;
}

.footer-content {
    max-width: 1000px;
    margin: 0 auto 1.5rem;
    display: flex;
    gap: 3rem;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
}

.footer-brand .logo { color: #60a5fa; margin-bottom: 0.5rem; }
.footer-brand p { font-size: 0.85rem; }

.footer-info { max-width: 450px; }
.footer-info p { font-size: 0.82rem; line-height: 1.7; margin-bottom: 0.3rem; }
.footer-info strong { color: rgba(255,255,255,0.9); }

.footer-copy {
    text-align: center;
    font-size: 0.8rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 1.5rem;
    max-width: 1000px;
    margin: 0 auto;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    nav ul { display: none; }

    nav {
        padding: 0 1rem;
        gap: 1rem;
    }

    .hero { min-height: 75vh; padding: 80px 1.5rem 3rem; }

    .stats-bar { gap: 1.5rem; padding: 1.2rem; }
    .stat-divider { display: none; }
    .stat-num { font-size: 1.3rem; }

    .housing-types { padding: 3rem 1rem; }
    .housing-grid { grid-template-columns: 1fr; }

    .eligibility { padding: 3rem 1rem; }

    .comparison, .faq-section, .subscribe, .contact { padding: 3rem 1rem; }

    th, td { padding: 0.8rem 0.6rem; font-size: 0.82rem; }

    .form-buttons { flex-direction: column; }

    .footer-content { flex-direction: column; gap: 1.5rem; }
}

@media (max-width: 480px) {
    .hero-content h1 { font-size: 1.7rem; }
    .hero-buttons { flex-direction: column; }
    .btn-primary, .btn-secondary { width: 100%; }
    .check-btn { font-size: 0.82rem; padding: 0.5rem 0.8rem; }
}
