/* ===== CSS Variables ===== */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #eff6ff;
    --text: #1e293b;
    --text-muted: #64748b;
    --bg: #f8fafc;
    --surface: #ffffff;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
    --radius: 12px;
    --toggle-bg: #e2e8f0;
}

[data-theme="dark"] {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --primary-light: #1e3a5f;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --bg: #0f172a;
    --surface: #1e293b;
    --border: #334155;
    --shadow: 0 1px 3px rgba(0,0,0,0.3), 0 4px 12px rgba(0,0,0,0.25);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.4);
    --toggle-bg: #334155;
}

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

body {
    font-family: 'Pretendard', 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.7;
    transition: background-color 0.3s, color 0.3s;
    font-size: 16px;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

/* ===== Theme Toggle ===== */
#theme-toggle {
    position: fixed;
    top: 70px;
    right: 20px;
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 50%;
    background-color: var(--toggle-bg);
    color: var(--text);
    font-size: 1.1em;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: background-color 0.3s, transform 0.2s;
    z-index: 900;
}
#theme-toggle:hover { transform: scale(1.1); }

/* ===== Header & Nav ===== */
header {
    background-color: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.nav-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}

.logo {
    font-size: 1.35em;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.5px;
}
.logo span { color: var(--text); }

nav { display: flex; gap: 6px; }
nav a {
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 0.92em;
    font-weight: 500;
    color: var(--text-muted);
    transition: background-color 0.2s, color 0.2s;
}
nav a:hover, nav a.active {
    background-color: var(--primary-light);
    color: var(--primary);
    text-decoration: none;
}

/* ===== Layout ===== */
.page-wrapper {
    max-width: 1100px;
    margin: 0 auto;
    padding: 40px 24px 80px;
}

/* ===== Hero (Generator) ===== */
.hero {
    background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
    border-radius: var(--radius);
    padding: 50px 40px;
    text-align: center;
    color: #fff;
    margin-bottom: 48px;
}
.hero h1 { font-size: 2em; font-weight: 800; margin-bottom: 8px; }
.hero p { opacity: 0.88; margin-bottom: 32px; font-size: 1.05em; }

.numbers-display {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 28px;
    min-height: 60px;
    align-items: center;
}

.number-ball {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    font-size: 1.3em;
    font-weight: 800;
    color: #fff;
    box-shadow: 0 4px 10px rgba(0,0,0,0.25);
    animation: popIn 0.35s cubic-bezier(0.34,1.56,0.64,1) both;
}
.ball-yellow { background: #f59e0b; }
.ball-blue   { background: #3b82f6; }
.ball-red    { background: #ef4444; }
.ball-gray   { background: #6b7280; }
.ball-green  { background: #10b981; }

@keyframes popIn {
    from { transform: scale(0); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

.btn-generate {
    padding: 14px 40px;
    border: none;
    border-radius: 50px;
    background-color: #fff;
    color: var(--primary);
    font-size: 1.1em;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    transition: transform 0.2s, box-shadow 0.2s;
}
.btn-generate:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}

/* ===== Section Title ===== */
.section-title {
    font-size: 1.5em;
    font-weight: 800;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.section-title::after {
    content: '';
    flex: 1;
    height: 2px;
    background: var(--border);
}

/* ===== Article Cards ===== */
.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
    margin-bottom: 60px;
}

.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid var(--border);
}
.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    text-decoration: none;
}

.card-thumb {
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3em;
}
.thumb-blue   { background: linear-gradient(135deg, #dbeafe, #bfdbfe); }
.thumb-purple { background: linear-gradient(135deg, #ede9fe, #ddd6fe); }
.thumb-green  { background: linear-gradient(135deg, #d1fae5, #a7f3d0); }

.card-body { padding: 20px; }
.card-tag {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 50px;
    background: var(--primary-light);
    color: var(--primary);
    font-size: 0.78em;
    font-weight: 600;
    margin-bottom: 8px;
}
.card-title {
    font-size: 1.05em;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
    line-height: 1.4;
}
.card-desc {
    font-size: 0.88em;
    color: var(--text-muted);
    line-height: 1.6;
}

/* ===== Disqus ===== */
.disqus-section {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 32px;
    border: 1px solid var(--border);
    margin-top: 48px;
}

/* ===== Article Page ===== */
.article-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 40px;
    align-items: start;
}

.article-header {
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 2px solid var(--border);
}
.article-tag {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 50px;
    background: var(--primary-light);
    color: var(--primary);
    font-size: 0.85em;
    font-weight: 600;
    margin-bottom: 14px;
}
.article-title {
    font-size: 2em;
    font-weight: 800;
    line-height: 1.3;
    margin-bottom: 12px;
}
.article-meta {
    font-size: 0.88em;
    color: var(--text-muted);
}

.article-body { color: var(--text); }
.article-body h2 {
    font-size: 1.4em;
    font-weight: 700;
    margin: 36px 0 14px;
    padding-left: 14px;
    border-left: 4px solid var(--primary);
}
.article-body h3 {
    font-size: 1.1em;
    font-weight: 700;
    margin: 24px 0 10px;
}
.article-body p { margin-bottom: 18px; line-height: 1.85; }
.article-body ul, .article-body ol {
    margin: 0 0 18px 24px;
    line-height: 1.85;
}
.article-body li { margin-bottom: 6px; }
.article-body table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 24px;
    font-size: 0.95em;
}
.article-body th, .article-body td {
    padding: 10px 14px;
    border: 1px solid var(--border);
    text-align: left;
}
.article-body th {
    background: var(--primary-light);
    font-weight: 700;
    color: var(--primary);
}
.article-body tr:nth-child(even) td { background: var(--bg); }
.article-body .highlight-box {
    background: var(--primary-light);
    border-left: 4px solid var(--primary);
    border-radius: 8px;
    padding: 18px 20px;
    margin: 24px 0;
    color: var(--text);
}

/* ===== Sidebar ===== */
.sidebar { position: sticky; top: 80px; }
.sidebar-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 20px;
}
.sidebar-card h3 {
    font-size: 0.95em;
    font-weight: 700;
    margin-bottom: 14px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.sidebar-list { list-style: none; }
.sidebar-list li {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.92em;
}
.sidebar-list li:last-child { border-bottom: none; }

/* ===== About / Static Pages ===== */
.static-page h1 {
    font-size: 2em;
    font-weight: 800;
    margin-bottom: 8px;
}
.static-page .lead {
    font-size: 1.1em;
    color: var(--text-muted);
    margin-bottom: 40px;
}
.static-page h2 {
    font-size: 1.25em;
    font-weight: 700;
    margin: 32px 0 12px;
    padding-left: 12px;
    border-left: 4px solid var(--primary);
}
.static-page p, .static-page li { line-height: 1.85; margin-bottom: 14px; }
.static-page ul { margin-left: 24px; }

/* ===== Contact Form ===== */
.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: start;
}
.form-group { display: flex; flex-direction: column; margin-bottom: 18px; }
.form-group label { font-size: 0.88em; font-weight: 600; margin-bottom: 6px; color: var(--text-muted); }
.form-group input, .form-group textarea, .form-group select {
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 1em;
    font-family: inherit;
    background-color: var(--surface);
    color: var(--text);
    transition: border-color 0.2s;
    resize: vertical;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
    outline: none;
    border-color: var(--primary);
}
.btn-submit {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 10px;
    background-color: var(--primary);
    color: #fff;
    font-size: 1.05em;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s;
}
.btn-submit:hover { background-color: var(--primary-dark); transform: translateY(-1px); }

/* ===== Footer ===== */
footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 40px 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9em;
}
.footer-inner { max-width: 1100px; margin: 0 auto; }
.footer-links { display: flex; justify-content: center; gap: 24px; margin-bottom: 16px; flex-wrap: wrap; }
.footer-links a { color: var(--text-muted); }
.footer-links a:hover { color: var(--primary); }

/* ===== Breadcrumb ===== */
.breadcrumb {
    font-size: 0.85em;
    color: var(--text-muted);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--primary); }

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .hero { padding: 36px 20px; }
    .hero h1 { font-size: 1.5em; }
    .number-ball { width: 46px; height: 46px; font-size: 1.1em; }
    .article-layout { grid-template-columns: 1fr; }
    .sidebar { position: static; }
    .contact-grid { grid-template-columns: 1fr; }
    nav a span { display: none; }
    .article-title { font-size: 1.5em; }
}

@media (max-width: 480px) {
    .nav-inner { padding: 0 16px; }
    .page-wrapper { padding: 24px 16px 60px; }
    nav a { padding: 7px 10px; font-size: 0.85em; }
}
