:root {
    --paper: #fcfbf8;
    --surface: #ffffff;
    --ink: #172033;
    --muted: #687083;
    --line: #e6e3dc;
    --accent: #d25b3f;
    --accent-dark: #a93d28;
    --navy: #243554;
    --soft: #f2eee7;
    --success: #287a56;
    --danger: #b83232;
    --radius: 16px;
    --shadow: 0 18px 55px rgba(24, 32, 49, .08);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: Pretendard, "Noto Sans KR", "Apple SD Gothic Neo", system-ui, -apple-system, sans-serif;
    font-size: 16px;
    line-height: 1.7;
    word-break: keep-all;
}
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
button, input, textarea, select { font: inherit; }
img { display: block; max-width: 100%; height: auto; }
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -.035em; }
p { margin: 0; }
code { padding: .1rem .35rem; border-radius: 4px; background: #eeeae2; font-family: Consolas, monospace; font-size: .9em; }

.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 100; padding: .7rem 1rem; background: var(--ink); color: white; }
.skip-link:focus { top: 1rem; }
.site-header { position: relative; z-index: 20; border-bottom: 1px solid var(--line); background: rgba(252, 251, 248, .96); }
.header-inner { display: flex; align-items: center; gap: 2rem; width: min(1180px, calc(100% - 40px)); min-height: 84px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: .75rem; min-width: max-content; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--navy); color: white; font-family: Georgia, serif; font-size: 1.25rem; }
.brand strong, .brand small { display: block; }
.brand strong { letter-spacing: -.02em; }
.brand small { color: var(--muted); font-size: .7rem; line-height: 1.2; }
.primary-nav { display: flex; align-items: center; justify-content: center; gap: 1.7rem; flex: 1; }
.primary-nav a, .admin-link { color: #3f4859; font-size: .9rem; font-weight: 650; text-decoration: none; }
.primary-nav a:hover, .admin-link:hover { color: var(--accent); }
.admin-link { padding: .45rem .85rem; border: 1px solid var(--ink); border-radius: 99px; }
.admin-link.subtle { color: var(--muted); border-color: var(--line); }
.site-main { min-height: calc(100vh - 300px); }
.site-footer { margin-top: 7rem; border-top: 1px solid var(--line); background: #f5f2ec; }
.footer-inner { display: grid; grid-template-columns: 1.2fr 1fr auto; align-items: end; gap: 2rem; width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 3rem 0; }
.footer-inner p { max-width: 440px; margin-top: .35rem; color: var(--muted); font-size: .9rem; }
.footer-inner nav { display: flex; flex-wrap: wrap; gap: 1.2rem; }
.footer-inner nav a { color: var(--muted); font-size: .85rem; }
.footer-inner small { color: #858b97; }

.hero { display: grid; grid-template-columns: 1.6fr .75fr; gap: clamp(2rem, 7vw, 7rem); align-items: center; width: min(1180px, calc(100% - 40px)); min-height: 600px; margin: 0 auto; padding: 5rem 0; }
.hero-copy h1 { max-width: 760px; margin: .8rem 0 1.4rem; font-family: Georgia, "Noto Serif KR", serif; font-size: clamp(2.8rem, 6vw, 5.5rem); font-weight: 500; }
.hero-copy p { max-width: 650px; margin-bottom: 2rem; color: var(--muted); font-size: 1.08rem; }
.eyebrow { display: inline-block; color: var(--accent); font-size: .72rem; font-weight: 800; letter-spacing: .16em; text-decoration: none; }
.hero-note { min-height: 345px; padding: 2.2rem; border-radius: 120px 120px var(--radius) var(--radius); background: var(--navy); color: white; box-shadow: var(--shadow); }
.hero-note span, .hero-note small { display: block; color: #bcc7db; font-size: .72rem; letter-spacing: .12em; }
.hero-note strong { display: block; margin: 4rem 0; font-family: Georgia, "Noto Serif KR", serif; font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 500; line-height: 1.45; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 45px; padding: .6rem 1.25rem; border: 1px solid var(--accent); border-radius: 99px; background: var(--accent); color: white; font-weight: 700; text-decoration: none; cursor: pointer; }
.button:hover { border-color: var(--accent-dark); background: var(--accent-dark); }
.button.secondary { border-color: var(--line); background: transparent; color: var(--ink); }
.button.secondary:hover { border-color: var(--ink); }
.button.full { width: 100%; }

.content-section, .category-strip { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 5rem 0; }
.content-section { border-top: 1px solid var(--line); }
.section-heading, .panel-heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 2.2rem; }
.section-heading h2 { margin-top: .35rem; font-family: Georgia, "Noto Serif KR", serif; font-size: 2.2rem; font-weight: 500; }
.section-heading > span { color: var(--muted); font-size: .85rem; }
.post-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem; }
.post-card { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); transition: transform .2s ease, box-shadow .2s ease; }
.post-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.post-card-body { display: flex; flex-direction: column; min-height: 290px; padding: 1.7rem; text-decoration: none; }
.post-card h2 { margin: .8rem 0 .8rem; overflow-wrap: anywhere; word-break: break-word; font-size: 1.35rem; }
.post-card p { display: -webkit-box; overflow: hidden; overflow-wrap: anywhere; word-break: break-word; color: var(--muted); font-size: .93rem; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.post-card footer { display: flex; justify-content: space-between; gap: 1rem; margin-top: auto; padding-top: 1.5rem; color: var(--muted); font-size: .8rem; }
.post-card footer span { color: var(--accent); font-weight: 700; }
.category-strip { display: grid; grid-template-columns: .7fr 1.3fr; gap: 4rem; }
.category-strip h2 { margin-top: .5rem; font-family: Georgia, "Noto Serif KR", serif; font-size: 2rem; font-weight: 500; }
.category-strip nav { border-top: 1px solid var(--line); }
.category-strip nav a { display: grid; grid-template-columns: .5fr 1fr; gap: 1rem; padding: 1.25rem 0; border-bottom: 1px solid var(--line); text-decoration: none; }
.category-strip nav a:hover strong { color: var(--accent); }
.category-strip nav span { color: var(--muted); font-size: .9rem; }
.empty-state { padding: 4rem 2rem; border: 1px dashed #cbc6bc; border-radius: var(--radius); text-align: center; }
.empty-state p { margin-top: .5rem; color: var(--muted); }

.page-header { width: min(850px, calc(100% - 40px)); margin: 0 auto; padding: 6rem 0 4rem; text-align: center; }
.page-header h1 { margin: .7rem 0 1rem; font-family: Georgia, "Noto Serif KR", serif; font-size: clamp(2.5rem, 6vw, 4.5rem); font-weight: 500; }
.page-header p { color: var(--muted); font-size: 1.05rem; }
.article-shell { width: min(780px, calc(100% - 40px)); margin: 0 auto; padding: 6rem 0 2rem; }
.article-header { padding-bottom: 2.8rem; border-bottom: 1px solid var(--line); }
.article-header h1 { margin: .8rem 0 1.3rem; font-family: Georgia, "Noto Serif KR", serif; font-size: clamp(2.4rem, 6vw, 4rem); font-weight: 500; }
.article-summary { overflow-wrap: anywhere; color: var(--muted); font-size: 1.15rem; }
.article-meta { display: flex; flex-wrap: wrap; gap: .7rem 1.2rem; margin-top: 1.6rem; color: #7b8290; font-size: .8rem; }
.article-content { min-width: 0; padding: 3.4rem 0; font-family: "Noto Serif KR", Georgia, serif; font-size: 1.05rem; line-height: 1.95; overflow-wrap: anywhere; word-break: break-word; }
.article-content > * { max-width: 100%; }
.article-content p, .article-content li, .article-content a, .article-content blockquote { overflow-wrap: anywhere; word-break: break-word; }
.article-content h2 { margin: 3.2rem 0 1.1rem; font-family: Pretendard, "Noto Sans KR", sans-serif; font-size: 1.75rem; }
.article-content h3 { margin: 2.4rem 0 .9rem; font-family: Pretendard, "Noto Sans KR", sans-serif; font-size: 1.3rem; }
.article-content p, .article-content ul, .article-content ol, .article-content pre, .article-content blockquote { margin: 1.2rem 0; }
.article-content a { color: var(--accent-dark); }
.article-content img { width: auto; margin: 2.5rem auto .5rem; border-radius: 10px; box-shadow: var(--shadow); }
.article-content blockquote { padding: .6rem 0 .6rem 1.4rem; border-left: 3px solid var(--accent); color: #4f5868; }
.article-content pre { overflow-x: auto; padding: 1.2rem; border-radius: 10px; background: #202838; color: #f6f7f9; }
.article-content pre code { padding: 0; background: transparent; }
.article-content table { display: block; overflow-x: auto; width: 100%; border-collapse: collapse; }
.article-content th, .article-content td { padding: .7rem; border: 1px solid var(--line); }
.article-footer { padding: 2rem; border-radius: var(--radius); background: var(--soft); text-align: center; }
.article-footer p { margin-bottom: 1rem; }
.article-admin-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .65rem; margin-top: 1.5rem; padding-top: 1.2rem; border-top: 1px dashed var(--line); }
.article-admin-actions > span { margin-right: auto; color: var(--muted); font-size: .78rem; font-weight: 750; }
.button.danger { border-color: var(--danger); background: var(--danger); }
.button.danger:hover { border-color: #8d2020; background: #8d2020; }
.inline-error { margin-top: .7rem; color: var(--danger); font-size: .85rem; }
.prose-page { width: min(780px, calc(100% - 40px)); margin: 0 auto; padding: 6rem 0 1rem; }
.prose-page header { margin-bottom: 4rem; }
.prose-page header h1 { margin: .7rem 0 1rem; font-family: Georgia, "Noto Serif KR", serif; font-size: clamp(2.4rem, 6vw, 4rem); font-weight: 500; }
.prose-page header p, .prose-page section p { color: #535c6b; }
.prose-page section { margin: 2.8rem 0; }
.prose-page section h2 { margin-bottom: .8rem; font-size: 1.45rem; }
.contact-card { padding: 2rem; border-radius: var(--radius); background: var(--navy); color: white; }
.contact-card p { color: #cbd3e1 !important; }
.contact-card a { display: inline-block; margin: .3rem 0 1rem; color: #ffd1c7; font-size: 1.25rem; }
.not-found { width: min(700px, calc(100% - 40px)); margin: 0 auto; padding: 8rem 0; text-align: center; }
.not-found h1 { margin: .7rem 0; font-family: Georgia, serif; font-size: 2.7rem; }
.not-found p { margin-bottom: 1.5rem; color: var(--muted); }

.admin-shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 3.5rem 0; }
.admin-shell.wide { width: min(1320px, calc(100% - 40px)); }
.admin-heading { display: flex; align-items: end; justify-content: space-between; gap: 2rem; margin-bottom: 2.5rem; }
.admin-heading h1 { margin: .3rem 0; font-size: 2.4rem; }
.admin-heading p { color: var(--muted); }
.admin-heading nav { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: .8rem; }
.admin-heading nav > a:not(.button), .link-button { padding: .35rem; border: 0; background: none; color: var(--muted); font-weight: 650; text-decoration: none; cursor: pointer; }
.admin-heading form { display: inline-flex; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.stat-grid article, .admin-panel { padding: 1.6rem; border: 1px solid var(--line); border-radius: var(--radius); background: white; }
.stat-grid span { display: block; color: var(--muted); font-size: .85rem; }
.stat-grid strong { display: block; margin-top: .35rem; font-size: 2rem; }
.admin-panel h2 { margin-bottom: 1.2rem; font-size: 1.25rem; }
.admin-panel > p { color: var(--muted); }
.admin-columns { display: grid; grid-template-columns: .8fr 1.2fr; align-items: start; gap: 1.2rem; }
.field { margin-bottom: 1.25rem; }
.field label { display: block; margin-bottom: .35rem; font-size: .85rem; font-weight: 750; }
.field input, .field textarea, .field select { width: 100%; padding: .72rem .85rem; border: 1px solid #cbcbd0; border-radius: 8px; background: white; color: var(--ink); }
.field textarea { min-height: 100px; resize: vertical; }
.field small, .upload-row small { display: block; margin-top: .35rem; color: var(--muted); font-size: .75rem; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--accent); outline: 3px solid rgba(210, 91, 63, .14); }
.valid.modified:not([type=checkbox]) { border-color: var(--success); }
.invalid { border-color: var(--danger) !important; }
.validation-message, .validation-errors { color: var(--danger); font-size: .82rem; }
.button-row { display: flex; align-items: center; flex-wrap: wrap; gap: .7rem; margin-top: 1rem; }
.button-row.compact { flex-wrap: nowrap; margin: 0; }
.text-button { padding: .3rem; border: 0; background: none; color: var(--navy); font-weight: 700; text-decoration: none; cursor: pointer; }
.text-button.danger { color: var(--danger); }
.manage-list article, .post-table article { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 0; border-top: 1px solid var(--line); }
.post-table article { position: relative; transition: background-color .15s ease; }
.post-table article:hover { background: #faf8f4; }
.post-row-link { min-width: 0; flex: 1; text-decoration: none; }
.post-row-link::after { position: absolute; inset: 0; content: ""; }
.post-row-link:focus-visible { border-radius: 4px; outline: 3px solid rgba(210, 91, 63, .2); outline-offset: 4px; }
.post-table .button-row { position: relative; z-index: 1; }
.manage-list article:first-child, .post-table article:first-child { border-top: 0; }
.manage-list strong, .manage-list small, .post-table strong, .post-table small { display: block; }
.manage-list small, .post-table small { color: var(--muted); font-size: .78rem; }
.status-message { margin-bottom: 1rem; padding: .8rem 1rem; border-radius: 8px; background: #e9f5ee; color: var(--success); }
.status-message.error { background: #fff0ee; color: var(--danger); }
.status-badge { display: inline-block; margin-right: .5rem; padding: .15rem .5rem; border-radius: 99px; background: #e9e9ed; color: var(--muted); font-size: .68rem; font-weight: 800; }
.status-badge.published { background: #e4f4ea; color: var(--success); }
.editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; align-items: start; gap: 1.3rem; }
.editor-main, .editor-sidebar { padding: 1.5rem; border: 1px solid var(--line); border-radius: var(--radius); background: white; }
.title-input { font-size: 1.35rem !important; font-weight: 750; }
.editor-field-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.editor-field-heading span { color: var(--muted); font-size: .75rem; }
.editor-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: .35rem; padding: .55rem; border: 1px solid #cbcbd0; border-bottom: 0; border-radius: 8px 8px 0 0; background: #f8f7f4; }
.editor-toolbar button { display: inline-grid; place-items: center; min-width: 38px; height: 34px; padding: 0 .55rem; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--ink); font-size: .82rem; font-weight: 750; cursor: pointer; }
.editor-toolbar button:hover { border-color: #d8d4cc; background: white; }
.editor-toolbar button:focus-visible { border-color: var(--accent); outline: 3px solid rgba(210, 91, 63, .14); }
.toolbar-underline { text-decoration: underline; text-underline-offset: 3px; }
.toolbar-divider { width: 1px; height: 22px; margin: 0 .2rem; background: #d8d4cc; }
.rich-content-editor.article-content { overflow-y: auto; min-height: 520px; max-height: 75vh; padding: 2rem 2.25rem; border: 1px solid #cbcbd0; border-radius: 0 0 8px 8px; background: white; font-size: 1rem; }
.rich-content-editor:focus { border-color: var(--accent); outline: 3px solid rgba(210, 91, 63, .14); }
.rich-content-editor:empty::before { color: #9298a3; content: attr(data-placeholder); pointer-events: none; }
.rich-content-editor > :first-child { margin-top: 0; }
.rich-content-editor > :last-child { margin-bottom: 0; }
.rich-content-editor img { cursor: default; }
.rich-content-editor img[data-uploading="true"] { opacity: .55; outline: 3px dashed var(--accent); outline-offset: 4px; }
.markdown-source { display: none; }
.editor-status { min-height: 1.5rem; padding-top: .35rem; color: var(--success); font-size: .78rem; }
.editor-status.error { color: var(--danger); }
.image-uploader { margin-top: 1.5rem; padding: 1.3rem; border-radius: 10px; background: var(--soft); }
.image-uploader h2, .seo-checklist h2 { margin-bottom: 1rem; font-size: 1rem; }
.uploader-guide { margin: -.45rem 0 1rem; color: var(--muted); font-size: .82rem; }
.field small kbd { padding: .05rem .3rem; border: 1px solid #cbc6bc; border-radius: 4px; background: white; box-shadow: 0 1px 0 #bbb5aa; font-size: .72rem; }
.upload-row { display: flex; align-items: center; flex-wrap: wrap; gap: .8rem; }
.upload-row small { margin: 0; }
.upload-message { margin-top: .8rem; color: var(--success); font-size: .85rem; }
.check-field { display: flex; align-items: flex-start; gap: .7rem; margin: 1.2rem 0; cursor: pointer; }
.check-field input { margin-top: .35rem; }
.check-field strong, .check-field small { display: block; }
.check-field small { color: var(--muted); font-size: .75rem; }
.seo-checklist { margin: 1.5rem 0; padding-top: 1.3rem; border-top: 1px solid var(--line); }
.seo-checklist ul { padding-left: 1.2rem; color: var(--muted); font-size: .8rem; }
.editor-sidebar .button + .button { margin-top: .65rem; }

/* Identity pages */
.login-page { width: min(480px, calc(100% - 40px)); margin: 0 auto; padding: 6rem 0; }
.login-card { padding: 2rem; border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: var(--shadow); }
.login-card h1 { margin: .5rem 0; font-size: 2rem; }
.login-card > p { margin-bottom: 1.8rem; color: var(--muted); }
.login-card .back-link { display: block; margin-top: 1.3rem; color: var(--muted); font-size: .85rem; text-align: center; }
.site-main > h1, .site-main > .row, .site-main > form { width: min(520px, calc(100% - 40px)); margin-right: auto; margin-left: auto; }
.site-main > h1 { margin-top: 4rem; }
.row { margin-top: 1rem; }
.row section { padding: 1.5rem; border: 1px solid var(--line); border-radius: var(--radius); background: white; }
.form-control { width: 100%; padding: .75rem; border: 1px solid #cbcbd0; border-radius: 8px; }
.form-label { display: block; margin: .8rem 0 .3rem; }
.btn { display: inline-flex; justify-content: center; width: 100%; margin-top: 1rem; padding: .75rem; border: 0; border-radius: 99px; background: var(--accent); color: white; font-weight: 700; }
.text-danger { color: var(--danger); }

#blazor-error-ui { position: fixed; right: 1rem; bottom: 1rem; z-index: 1000; display: none; padding: .8rem 1rem; border-radius: 8px; background: #fff3cd; box-shadow: var(--shadow); }
#blazor-error-ui .dismiss { margin-left: .6rem; border: 0; background: none; cursor: pointer; }

@media (max-width: 900px) {
    .header-inner { flex-wrap: wrap; gap: .8rem; padding: 1rem 0; }
    .primary-nav { order: 3; justify-content: flex-start; overflow-x: auto; width: 100%; padding-top: .7rem; border-top: 1px solid var(--line); }
    .primary-nav a { white-space: nowrap; }
    .admin-link { margin-left: auto; }
    .hero { grid-template-columns: 1fr; min-height: auto; }
    .hero-note { min-height: 260px; border-radius: var(--radius); }
    .hero-note strong { margin: 2rem 0; }
    .post-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .category-strip { grid-template-columns: 1fr; gap: 2rem; }
    .footer-inner { grid-template-columns: 1fr; align-items: start; }
    .admin-heading { align-items: flex-start; flex-direction: column; }
    .admin-heading nav { justify-content: flex-start; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .admin-columns, .editor-layout { grid-template-columns: 1fr; }
    .editor-sidebar { position: static; }
}

@media (max-width: 600px) {
    body { word-break: normal; }
    .header-inner, .hero, .content-section, .category-strip, .footer-inner, .admin-shell, .admin-shell.wide { width: min(100% - 28px, 1180px); }
    .brand small { display: none; }
    .primary-nav { gap: 1.1rem; }
    .hero { padding: 4rem 0; }
    .hero-copy h1 { font-size: 2.65rem; }
    .post-grid { grid-template-columns: 1fr; }
    .content-section { padding: 3.5rem 0; }
    .category-strip nav a { grid-template-columns: 1fr; gap: .2rem; }
    .article-shell, .prose-page { width: min(100% - 32px, 780px); padding-top: 4rem; }
    .article-content { font-size: 1rem; }
    .page-header { padding-top: 4rem; }
    .stat-grid { grid-template-columns: 1fr 1fr; }
    .manage-list article, .post-table article { align-items: flex-start; flex-direction: column; }
    .section-heading, .panel-heading { align-items: flex-start; flex-direction: column; }
    .editor-field-heading { align-items: flex-start; flex-direction: column; gap: .1rem; }
    .rich-content-editor.article-content { padding-right: 1.25rem; padding-left: 1.25rem; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { transition-duration: .01ms !important; }
}
