/* LIFExLABS Ghost theme - Tech / Life / Being / Productivity */

:root {
    --accent: var(--ghost-accent-color, #4f46e5);
    --c-tech: #2563eb;
    --c-life: #ea7a0c;
    --c-being: #7c3aed;
    --c-prod: #059669;

    --bg: #fafaf7;
    --surface: #ffffff;
    --soft: #f2f1ec;
    --text: #18181b;
    --text-2: #3f3f46;
    --muted: #71717a;
    --line: #e7e5df;
    --shadow: 0 1px 2px rgba(24, 24, 27, .04), 0 8px 24px rgba(24, 24, 27, .06);

    --font-body: var(--gh-font-body, "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif);
    --font-heading: var(--gh-font-heading, var(--font-body));
    --font-mono: ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;

    --radius: 18px;
    --maxw: 1160px;
    --narrow: 720px;
    --wide: 1040px;
    --header-h: 68px;
    color-scheme: light;
}

html[data-color-scheme="dark"] {
    --bg: #0f1012;
    --surface: #17181b;
    --soft: #1e1f23;
    --text: #ededf0;
    --text-2: #c9c9d1;
    --muted: #9a9aa4;
    --line: #2a2b31;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .35);
    color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
    html[data-color-scheme="auto"] {
        --bg: #0f1012;
        --surface: #17181b;
        --soft: #1e1f23;
        --text: #ededf0;
        --text-2: #c9c9d1;
        --muted: #9a9aa4;
        --line: #2a2b31;
        --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .35);
        color-scheme: dark;
    }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.7;
    letter-spacing: -0.01em;
    word-break: keep-all;
    overflow-wrap: break-word;
    -webkit-font-smoothing: antialiased;
    transition: background-color .25s ease, color .25s ease;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; }
h1, h2, h3, h4 { font-family: var(--font-heading); letter-spacing: -0.025em; line-height: 1.3; margin: 0; }

.site { min-height: 100vh; display: flex; flex-direction: column; }
.site-main { flex: 1; }
.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.container-narrow { width: 100%; max-width: calc(var(--narrow) + 48px); margin: 0 auto; padding: 0 24px; }
.container-wide { width: 100%; max-width: calc(var(--wide) + 48px); margin: 0 auto; padding: 0 24px; }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 40px; padding: 0 18px; border: 0; border-radius: 999px;
    background: var(--text); color: var(--bg);
    font-size: 14px; font-weight: 700; cursor: pointer; white-space: nowrap;
    transition: transform .15s ease, opacity .15s ease;
}
.btn:hover { transform: translateY(-1px); opacity: .9; }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; padding: 0; border: 0; border-radius: 12px;
    background: transparent; color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { background: var(--soft); color: var(--text); }
.icon-sun { display: none; }
html[data-color-scheme="dark"] .icon-sun { display: block; }
html[data-color-scheme="dark"] .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
    html[data-color-scheme="auto"] .icon-sun { display: block; }
    html[data-color-scheme="auto"] .icon-moon { display: none; }
}

/* Reading progress */
.progress { position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 60; pointer-events: none; }
.progress-bar {
    height: 100%; transform-origin: 0 50%; transform: scaleX(0);
    background: linear-gradient(90deg, var(--c-tech), var(--c-being), var(--c-life), var(--c-prod));
}

/* Header */
.site-header {
    position: sticky; top: 0; z-index: 50;
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: saturate(160%) blur(14px);
    -webkit-backdrop-filter: saturate(160%) blur(14px);
    border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 28px; height: var(--header-h); }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; letter-spacing: -0.02em; flex-shrink: 0; }
.brand-logo { height: 32px; width: auto; }
.brand-mark { display: grid; grid-template-columns: repeat(2, 9px); gap: 3px; }
.brand-mark i { width: 9px; height: 9px; border-radius: 3px; }
.brand-mark i:nth-child(1) { background: var(--c-tech); }
.brand-mark i:nth-child(2) { background: var(--c-life); }
.brand-mark i:nth-child(3) { background: var(--c-being); }
.brand-mark i:nth-child(4) { background: var(--c-prod); }

.site-nav { flex: 1; min-width: 0; }
.site-nav .nav { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.site-nav .nav a {
    display: block; padding: 8px 12px; border-radius: 10px;
    font-size: 15px; font-weight: 600; color: var(--muted);
    transition: color .15s ease, background-color .15s ease;
}
.site-nav .nav a:hover { color: var(--text); background: var(--soft); }
.site-nav .nav-current a { color: var(--text); }
.header-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.link-signin { font-size: 14px; font-weight: 600; color: var(--muted); padding: 0 8px; }
.link-signin:hover { color: var(--text); }
.menu-toggle { display: none; }

@media (max-width: 900px) {
    .menu-toggle { display: inline-flex; }
    .link-signin { display: none; }
    .site-nav {
        position: fixed; top: var(--header-h); left: 0; right: 0;
        background: var(--bg); border-bottom: 1px solid var(--line);
        padding: 12px 16px 20px; display: none;
    }
    .menu-open .site-nav { display: block; }
    .site-nav .nav { flex-direction: column; }
    .site-nav .nav a { font-size: 17px; padding: 12px; }
}
@media (max-width: 520px) {
    .header-inner { gap: 12px; }
    .brand-name { font-size: 15px; }
    .header-actions .btn { height: 36px; padding: 0 14px; font-size: 13px; }
}

/* Hero */
.hero { position: relative; overflow: hidden; padding: 96px 0 72px; border-bottom: 1px solid var(--line); }
.hero-glow {
    position: absolute; inset: -40% -10% auto -10%; height: 140%;
    background:
        radial-gradient(40% 50% at 15% 30%, color-mix(in srgb, var(--c-tech) 18%, transparent), transparent 70%),
        radial-gradient(35% 45% at 85% 20%, color-mix(in srgb, var(--c-being) 16%, transparent), transparent 70%),
        radial-gradient(35% 45% at 70% 90%, color-mix(in srgb, var(--c-life) 14%, transparent), transparent 70%),
        radial-gradient(30% 40% at 30% 95%, color-mix(in srgb, var(--c-prod) 14%, transparent), transparent 70%);
    filter: blur(10px); pointer-events: none;
}
.hero-inner { position: relative; max-width: 860px; text-align: center; }
.eyebrow {
    margin: 0 0 18px; font-size: 13px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
    color: var(--muted);
}
.hero-title { font-size: clamp(34px, 5.6vw, 60px); font-weight: 800; line-height: 1.2; letter-spacing: -0.035em; }
.hero-subtitle { margin: 20px auto 0; max-width: 620px; font-size: clamp(16px, 2vw, 19px); color: var(--text-2); }

.subscribe-form { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: 460px; margin: 34px auto 0; }
.subscribe-form input {
    flex: 1; min-width: 200px; height: 46px; padding: 0 18px;
    border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text);
    font: inherit; font-size: 15px; outline: none;
}
.subscribe-form input:focus { border-color: var(--text); }
.subscribe-form .btn { height: 46px; }
.form-msg { display: none; width: 100%; margin: 6px 0 0; font-size: 14px; }
.subscribe-form.success .form-success { display: block; color: var(--c-prod); }
.subscribe-form.error .form-error { display: block; color: #dc2626; }
.subscribe-form.loading .btn { opacity: .6; pointer-events: none; }

/* Sections */
.section { padding-top: 64px; }
.section:last-child { padding-bottom: 96px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.section-title { font-size: 24px; font-weight: 800; }
.section-desc { margin: 0; color: var(--muted); font-size: 15px; }

/* Topic cards */
.topic-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.topic-card {
    --tag-color: var(--accent);
    position: relative; display: flex; flex-direction: column; gap: 6px;
    padding: 24px; border-radius: var(--radius);
    background: var(--surface); border: 1px solid var(--line);
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
    overflow: hidden;
}
.topic-card::after {
    content: ""; position: absolute; inset: auto 0 0 0; height: 4px;
    background: var(--tag-color); transform: scaleX(.25); transform-origin: 0 50%;
    transition: transform .3s ease;
}
.topic-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--tag-color) 40%, var(--line)); }
.topic-card:hover::after { transform: scaleX(1); }
.topic-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; margin-bottom: 10px; border-radius: 13px;
    color: var(--tag-color); background: color-mix(in srgb, var(--tag-color) 12%, transparent);
}
.topic-icon svg { width: 22px; height: 22px; }
.topic-en { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--tag-color); }
.topic-name { font-size: 22px; font-weight: 800; letter-spacing: -0.03em; }
.topic-desc { font-size: 14px; line-height: 1.6; color: var(--muted); }
.topic-count { margin-top: auto; padding-top: 14px; font-size: 13px; font-weight: 600; color: var(--text-2); }

@media (max-width: 1000px) { .topic-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .topic-grid { grid-template-columns: 1fr; } }

/* Post cards */
.post-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px 24px; }
.featured-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
@media (max-width: 1000px) { .post-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .post-grid, .featured-grid { grid-template-columns: 1fr; } }

.post-card { display: flex; flex-direction: column; min-width: 0; }
.post-card-image {
    --tag-color: var(--accent);
    position: relative; display: block; aspect-ratio: 16 / 10; overflow: hidden;
    border-radius: 14px; background: var(--soft); margin-bottom: 16px;
}
.post-card-image img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.post-card:hover .post-card-image img { transform: scale(1.03); }
.post-card-image.is-empty {
    display: flex; align-items: flex-end; padding: 18px;
    background:
        radial-gradient(80% 80% at 100% 0%, color-mix(in srgb, var(--tag-color) 30%, transparent), transparent 70%),
        linear-gradient(135deg, color-mix(in srgb, var(--tag-color) 14%, var(--surface)), var(--soft));
}
.post-card-image.is-empty span { font-size: 22px; font-weight: 800; color: var(--tag-color); letter-spacing: -0.03em; }
.post-card.is-featured .post-card-image { aspect-ratio: 16 / 9; }
.post-card.is-featured .post-card-title { font-size: 24px; }

.tag-pill {
    --tag-color: var(--accent);
    align-self: flex-start; display: inline-flex; align-items: center; gap: 6px;
    font-size: 13px; font-weight: 700; color: var(--tag-color); margin-bottom: 8px;
}
.tag-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--tag-color); }
.post-card-title { font-size: 19px; font-weight: 700; line-height: 1.4; }
.post-card-title a { background-image: linear-gradient(currentColor, currentColor); background-size: 0 1px; background-repeat: no-repeat; background-position: 0 100%; transition: background-size .25s ease; }
.post-card:hover .post-card-title a { background-size: 100% 1px; }
.post-card-excerpt {
    margin: 8px 0 0; color: var(--muted); font-size: 15px; line-height: 1.65;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.post-meta, .article-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 12px; font-size: 13px; color: var(--muted); }
.dot { opacity: .6; }

/* Pagination */
.pagination { display: flex; align-items: center; justify-content: space-between; margin-top: 56px; padding-top: 24px; border-top: 1px solid var(--line); font-size: 15px; }
.page-link { font-weight: 700; }
.page-link:hover { color: var(--accent); }
.page-number { color: var(--muted); }

/* Archive */
.archive-header { --tag-color: var(--accent); padding: 72px 0 8px; }
.archive-header .eyebrow { color: var(--tag-color); }
.archive-title { font-size: clamp(32px, 5vw, 48px); font-weight: 800; }
.archive-desc { margin: 14px 0 0; max-width: 640px; font-size: 18px; color: var(--text-2); }
.archive-count { margin: 12px 0 0; font-size: 14px; color: var(--muted); }
.author-head { display: flex; align-items: center; gap: 24px; }
.author-avatar { width: 88px; height: 88px; border-radius: 50%; object-fit: cover; }

/* Article */
.article { padding: 64px 0 24px; }
.article-header { margin-bottom: 40px; }
.article-title { font-size: clamp(30px, 4.6vw, 44px); font-weight: 800; line-height: 1.28; letter-spacing: -0.035em; }
.article-excerpt { margin: 18px 0 0; font-size: 19px; line-height: 1.6; color: var(--text-2); }
.article-meta { margin-top: 24px; font-size: 14px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.meta-author { font-weight: 700; color: var(--text); }
.article-image { margin: 0 auto 48px; }
.article-image img { width: 100%; border-radius: var(--radius); }
.article-image figcaption { margin-top: 12px; text-align: center; font-size: 14px; color: var(--muted); }
.article-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 48px; }
.article-tags a { padding: 6px 12px; border-radius: 999px; background: var(--soft); font-size: 14px; font-weight: 600; color: var(--text-2); }
.article-tags a:hover { color: var(--text); }
.cta {
    margin-top: 56px; padding: 36px 28px; text-align: center;
    border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line);
}
.container-narrow.cta { max-width: var(--narrow); }
.cta h3 { font-size: 21px; font-weight: 800; }
.cta p { margin: 8px 0 20px; color: var(--muted); }
.article-comments { margin-top: 56px; }
.related { border-top: 1px solid var(--line); margin-top: 48px; }

/* Content */
.gh-content {
    display: grid;
    grid-template-columns: [full-start] minmax(24px, 1fr) [wide-start] minmax(0, calc((var(--wide) - var(--narrow)) / 2)) [main-start] min(var(--narrow), calc(100% - 48px)) [main-end] minmax(0, calc((var(--wide) - var(--narrow)) / 2)) [wide-end] minmax(24px, 1fr) [full-end];
    font-size: 18px; line-height: 1.85; color: var(--text-2);
}
.gh-content > * { grid-column: main-start / main-end; margin: 0; }
.gh-content > * + * { margin-top: 1.4em; }
.gh-content > .kg-width-wide { grid-column: wide-start / wide-end; }
.gh-content > .kg-width-full { grid-column: full-start / full-end; }
.gh-content > .kg-width-full img { border-radius: 0; width: 100%; }
.gh-content h2, .gh-content h3, .gh-content h4 { color: var(--text); }
.gh-content > h2 { margin-top: 2.2em; font-size: 1.55em; font-weight: 800; }
.gh-content > h3 { margin-top: 1.9em; font-size: 1.25em; font-weight: 700; }
.gh-content > h4 { margin-top: 1.6em; font-size: 1.08em; font-weight: 700; }
.gh-content > h2 + *, .gh-content > h3 + *, .gh-content > h4 + * { margin-top: .7em; }
.gh-content a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.gh-content strong { color: var(--text); font-weight: 700; }
.gh-content ul, .gh-content ol { padding-left: 1.3em; }
.gh-content li + li { margin-top: .4em; }
.gh-content blockquote:not([class]) {
    padding: 4px 0 4px 22px; border-left: 3px solid var(--accent);
    font-size: 1.08em; color: var(--text);
}
.gh-content blockquote.kg-blockquote-alt { text-align: center; font-size: 1.35em; font-style: normal; color: var(--text); padding: 0 1em; border: 0; }
.gh-content hr { width: 100%; height: 1px; border: 0; background: var(--line); margin-top: 2.6em; margin-bottom: 1.2em; }
.gh-content code:not(pre code) {
    padding: .15em .4em; border-radius: 6px; background: var(--soft);
    font-family: var(--font-mono); font-size: .86em; color: var(--text);
}
.gh-content pre {
    overflow-x: auto; padding: 20px 22px; border-radius: 14px;
    background: #111318; color: #e6e6ea; border: 1px solid var(--line);
    font-family: var(--font-mono); font-size: 14px; line-height: 1.7;
}
.gh-content table { width: 100%; border-collapse: collapse; font-size: .92em; display: block; overflow-x: auto; }
.gh-content th, .gh-content td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.gh-content th { color: var(--text); font-weight: 700; }
.gh-content figure img { border-radius: 12px; }
.gh-content figcaption { margin-top: 10px; text-align: center; font-size: 14px; color: var(--muted); }
.gh-content .kg-callout-card { border-radius: 14px; }
.gh-content .kg-bookmark-card, .gh-content .kg-bookmark-container { border-radius: 14px; }

/* Error */
.error-page { padding: 120px 24px; text-align: center; }
.error-code { margin: 0; font-size: 96px; font-weight: 900; line-height: 1; letter-spacing: -0.05em; background: linear-gradient(90deg, var(--c-tech), var(--c-being), var(--c-life), var(--c-prod)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.error-page .archive-desc { margin: 16px auto 28px; }

/* Footer */
.site-footer { margin-top: 48px; border-top: 1px solid var(--line); background: var(--surface); }
.footer-inner { display: flex; justify-content: space-between; gap: 40px; padding-top: 48px; padding-bottom: 32px; }
.footer-desc { margin: 12px 0 0; max-width: 360px; font-size: 14px; color: var(--muted); }
.footer-links { display: flex; gap: 48px; }
.footer-links .nav { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.footer-links .nav a { font-size: 14px; color: var(--muted); }
.footer-links .nav a:hover { color: var(--text); }
.footer-bottom { display: flex; justify-content: space-between; padding-top: 20px; padding-bottom: 32px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.footer-bottom a:hover { color: var(--text); }
@media (max-width: 720px) {
    .footer-inner { flex-direction: column; }
    .footer-bottom { flex-direction: column; gap: 6px; }
    .hero { padding: 72px 0 56px; }
    .section { padding-top: 48px; }
    .gh-content { font-size: 17px; }
}

/* Topic colors (fallback when tag accent color is not set) */
.topic-tech { --tag-color: var(--c-tech); }
.topic-life { --tag-color: var(--c-life); }
.topic-reflection { --tag-color: var(--c-being); }
.topic-productivity { --tag-color: var(--c-prod); }
