/* ============================================
   CHLEE Blog - Editorial Dark Theme
   ============================================ */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;700;900&family=Playfair+Display:ital,wght@0,700;0,900;1,700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── CSS Variables ── */
:root {
    /* Colors */
    --bg-primary: #0a0a0b;
    --bg-secondary: #111113;
    --bg-card: #18181b;
    --bg-card-hover: #1f1f23;
    --bg-input: #111113;
    --border: #27272a;
    --border-hover: #3f3f46;
    --border-accent: #e4a853;

    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --text-accent: #e4a853;

    --accent: #e4a853;
    --accent-hover: #d4963f;
    --accent-glow: rgba(228, 168, 83, 0.15);

    --danger: #ef4444;
    --danger-hover: #dc2626;
    --success: #22c55e;

    /* Typography */
    --font-display: 'Playfair Display', Georgia, serif;
    --font-body: 'Noto Sans KR', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Spacing */
    --container-max: 860px;
    --container-wide: 1100px;
    --header-height: 72px;

    /* Effects */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --transition: 0.2s ease;
}

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

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.7;
    min-height: 100vh;
    font-size: 15px;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color var(--transition);
}

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

/* ── Background Texture ── */
body::before {
    content: '';
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background:
        radial-gradient(ellipse at 20% 0%, rgba(228,168,83,0.04) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 100%, rgba(228,168,83,0.03) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}

/* ── Layout ── */
.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 24px;
    position: relative;
    z-index: 1;
}

.container--wide {
    max-width: var(--container-wide);
}

/* ── Header ── */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(10, 10, 11, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    height: var(--header-height);
}

.header__inner {
    max-width: var(--container-wide);
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

.header__logo {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 900;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.header__logo-mark {
    width: 32px;
    height: 32px;
    background: var(--accent);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 900;
    color: var(--bg-primary);
}

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

.header__nav a {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition);
}

.header__nav a:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.05);
}

.header__nav a.active {
    color: var(--text-accent);
}

/* ── Button ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn--primary {
    background: var(--accent);
    color: var(--bg-primary);
}

.btn--primary:hover {
    background: var(--accent-hover);
    box-shadow: 0 0 20px var(--accent-glow);
}

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

.btn--ghost:hover {
    color: var(--text-primary);
    border-color: var(--border-hover);
    background: rgba(255,255,255,0.03);
}

.btn--danger {
    background: transparent;
    color: var(--danger);
    border: 1px solid rgba(239,68,68,0.3);
}

.btn--danger:hover {
    background: rgba(239,68,68,0.1);
    border-color: var(--danger);
}

.btn--sm {
    padding: 6px 14px;
    font-size: 13px;
}

.btn--lg {
    padding: 14px 32px;
    font-size: 15px;
}

/* ── Page Hero / Title Area ── */
.page-hero {
    padding: 60px 0 40px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 40px;
}

.page-hero__eyebrow {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-accent);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.page-hero__title {
    font-family: var(--font-display);
    font-size: 42px;
    font-weight: 900;
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.page-hero__subtitle {
    font-size: 16px;
    color: var(--text-secondary);
    margin-top: 12px;
    line-height: 1.6;
}

.page-hero__actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 24px;
}

/* ── Post List ── */
.post-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-bottom: 80px;
}

.post-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 20px;
    align-items: start;
    padding: 24px 0;
    border-bottom: 1px solid var(--border);
    transition: all var(--transition);
    cursor: pointer;
}

.post-item:hover {
    padding-left: 12px;
}

.post-item:hover .post-item__title {
    color: var(--text-accent);
}

.post-item__number {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.post-item__title {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.4;
    color: var(--text-primary);
    transition: color var(--transition);
    margin-bottom: 8px;
}

.post-item__excerpt {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-item__meta {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    padding-top: 4px;
}

/* ── Empty State ── */
.empty-state {
    text-align: center;
    padding: 80px 20px;
}

.empty-state__icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.4;
}

.empty-state__title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state__desc {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 24px;
}

/* ── Write Form ── */
.write-form {
    padding-bottom: 80px;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 15px;
    transition: all var(--transition);
    outline: none;
}

.form-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-input--title {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 700;
    padding: 16px 0;
    background: transparent;
    border: none;
    border-bottom: 2px solid var(--border);
    border-radius: 0;
}

.form-input--title:focus {
    border-color: var(--accent);
    box-shadow: none;
}

.form-textarea {
    width: 100%;
    min-height: 400px;
    padding: 20px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.8;
    resize: vertical;
    transition: all var(--transition);
    outline: none;
}

.form-textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-textarea::placeholder {
    color: var(--text-muted);
}

.form-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.form-actions__right {
    display: flex;
    gap: 10px;
}

.char-count {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-muted);
}

/* ── Detail Page ── */
.post-detail {
    padding-bottom: 80px;
}

.post-detail__header {
    padding: 60px 0 32px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 40px;
}

.post-detail__category {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-accent);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 16px;
}

.post-detail__title {
    font-family: var(--font-display);
    font-size: 38px;
    font-weight: 900;
    line-height: 1.2;
    letter-spacing: -0.02em;
    margin-bottom: 20px;
}

.post-detail__meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 14px;
    color: var(--text-muted);
}

.post-detail__meta-divider {
    width: 4px;
    height: 4px;
    background: var(--text-muted);
    border-radius: 50%;
}

.post-detail__body {
    font-size: 16px;
    line-height: 2;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-word;
}

.post-detail__body p {
    margin-bottom: 1.5em;
}

.post-detail__actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 40px;
    margin-top: 40px;
    border-top: 1px solid var(--border);
}

.post-detail__actions-right {
    display: flex;
    gap: 10px;
}

/* ── Toast Notification ── */
.toast {
    position: fixed;
    bottom: 32px;
    right: 32px;
    padding: 14px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    transform: translateY(120%);
    opacity: 0;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1000;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast--success {
    border-left: 3px solid var(--success);
}

.toast--error {
    border-left: 3px solid var(--danger);
}

/* ── Confirm Modal ── */
.modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 999;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    max-width: 400px;
    width: 90%;
    box-shadow: var(--shadow-lg);
}

.modal__title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
}

.modal__desc {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 24px;
    line-height: 1.6;
}

.modal__actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ── Footer ── */
.footer {
    border-top: 1px solid var(--border);
    padding: 32px 0;
    text-align: center;
    position: relative;
    z-index: 1;
}

.footer__text {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-muted);
}

/* ── Animations ── */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-in {
    animation: fadeInUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 0;
}

.animate-in:nth-child(1) { animation-delay: 0.05s; }
.animate-in:nth-child(2) { animation-delay: 0.1s; }
.animate-in:nth-child(3) { animation-delay: 0.15s; }
.animate-in:nth-child(4) { animation-delay: 0.2s; }
.animate-in:nth-child(5) { animation-delay: 0.25s; }
.animate-in:nth-child(6) { animation-delay: 0.3s; }
.animate-in:nth-child(7) { animation-delay: 0.35s; }
.animate-in:nth-child(8) { animation-delay: 0.4s; }

/* ── Scrollbar ── */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-hover);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .page-hero__title {
        font-size: 30px;
    }

    .post-detail__title {
        font-size: 28px;
    }

    .form-input--title {
        font-size: 22px;
    }

    .post-item {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .post-item__meta {
        padding-top: 0;
    }

    .header__nav span.nav-label {
        display: none;
    }

    .form-actions {
        flex-direction: column;
        gap: 16px;
        align-items: stretch;
    }

    .form-actions__right {
        justify-content: flex-end;
    }

    .post-detail__actions {
        flex-direction: column;
        gap: 16px;
        align-items: stretch;
    }

    .post-detail__actions-right {
        justify-content: flex-end;
    }
}
