:root {
    color-scheme: light;
    --ink: #17212b;
    --muted: #66717d;
    --line: #dfe5ea;
    --surface: #ffffff;
    --surface-soft: #f4f7f9;
    --brand: #0d6659;
    --brand-dark: #084b42;
    --accent: #d8efe8;
    --danger: #9b2c2c;
    --danger-bg: #fff1f1;
    --success: #176b45;
    --success-bg: #eaf8f0;
    --shadow: 0 14px 38px rgba(23, 33, 43, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, "Noto Sans KR", sans-serif;
    line-height: 1.7;
    color: var(--ink);
    background: var(--surface-soft);
}

a {
    color: inherit;
}

.container {
    width: min(900px, calc(100% - 40px));
    margin: 0 auto;
    padding: 40px 0 88px;
}

.container--wide {
    width: min(1120px, calc(100% - 40px));
}

.container--admin {
    width: min(1040px, calc(100% - 40px));
}

.top-nav {
    margin-bottom: 28px;
}

.top-nav a,
.text-link,
.card-link {
    color: var(--brand);
    font-weight: 700;
    text-decoration: none;
}

.top-nav a:hover,
.text-link:hover,
.card-link:hover {
    color: var(--brand-dark);
    text-decoration: underline;
}

h1,
h2,
h3 {
    letter-spacing: -0.025em;
}

h1 {
    margin: 0 0 16px;
    font-size: clamp(2rem, 5vw, 3.25rem);
    line-height: 1.2;
}

.eyebrow,
.step-label {
    margin: 0 0 8px;
    color: var(--brand);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.12em;
}

.lead {
    max-width: 680px;
    margin: 0;
    color: var(--muted);
    font-size: 1.08rem;
}

.masthead {
    padding: 44px 0 50px;
}

.filter-panel {
    display: grid;
    grid-template-columns: minmax(210px, 0.65fr) minmax(0, 1.8fr);
    gap: 32px;
    margin-bottom: 44px;
    padding: 26px 28px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.filter-intro h2 {
    margin: 0;
    font-size: 1.35rem;
}

.filter-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 160px auto;
    align-items: end;
    gap: 12px;
}

.filter-form .field {
    margin-bottom: 0;
}

.filter-button {
    width: auto;
}

.result-summary {
    display: flex;
    align-items: center;
    gap: 12px;
}

.clear-filter {
    color: var(--brand);
    font-size: 0.86rem;
    font-weight: 700;
    text-decoration: none;
}

.clear-filter:hover {
    text-decoration: underline;
}

.post-list {
    padding-top: 30px;
    border-top: 1px solid var(--line);
}

.section-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
}

.section-heading h2 {
    margin: 0;
    font-size: clamp(1.55rem, 3vw, 2rem);
    line-height: 1.25;
}

.section-heading--compact {
    align-items: center;
    margin-bottom: 12px;
}

.post-count,
.model-badge {
    flex: 0 0 auto;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 5px 12px;
    color: var(--muted);
    background: var(--surface);
    font-size: 0.84rem;
    font-weight: 700;
}

.post-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px;
}

.post-card,
.empty-state {
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.post-card {
    display: flex;
    min-height: 300px;
    flex-direction: column;
    overflow: hidden;
    transition: border-color 160ms ease, transform 160ms ease;
}

.post-card-content {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    padding: 28px;
}

.post-card-image {
    display: block;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #e8efed;
}

.post-card-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 220ms ease;
}

.post-card:hover .post-card-image img {
    transform: scale(1.02);
}

.post-card:hover {
    border-color: #a9c9c1;
    transform: translateY(-2px);
}

.post-card h3 {
    margin: 4px 0 14px;
    font-size: 1.4rem;
    line-height: 1.38;
}

.post-card h3 a {
    text-decoration: none;
}

.post-card h3 a:hover {
    color: var(--brand);
}

.post-summary {
    display: -webkit-box;
    margin: 0 0 24px;
    overflow: hidden;
    color: var(--muted);
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.card-link {
    margin-top: auto;
}

.empty-state {
    grid-column: 1 / -1;
    padding: 48px 28px;
    text-align: center;
}

.empty-state h3,
.empty-state p {
    margin: 0;
}

.empty-state p {
    margin-top: 6px;
    color: var(--muted);
}

.empty-state .card-link {
    display: inline-block;
    margin-top: 18px;
}

.meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.meta span,
.meta time {
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 3px 10px;
    color: #41505e;
    background: var(--surface-soft);
    font-size: 0.8rem;
    font-weight: 700;
}

.seo-badge {
    display: inline-flex;
    border: 1px solid;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 0.76rem;
    font-weight: 800;
}

.seo-badge--ok {
    border-color: #a6d8bb;
    color: var(--success);
    background: var(--success-bg);
}

.seo-badge--check {
    border-color: #e4c777;
    color: #775b12;
    background: #fff8dd;
}

.seo-issues {
    display: block;
    margin-top: 8px;
    color: #775b12;
}

.summary {
    padding: 18px 20px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
}

.article-thumbnail {
    margin: 28px 0;
}

.article-thumbnail img {
    display: block;
    width: 100%;
    max-height: 560px;
    border-radius: 14px;
    object-fit: cover;
}

.article-body h2 {
    margin-top: 42px;
    font-size: 1.55rem;
}

.article-body h3 {
    margin-top: 30px;
    font-size: 1.25rem;
}

.article-body p {
    margin: 16px 0;
}

.article-body li {
    margin: 6px 0;
}

hr {
    border: 0;
    border-top: 1px solid var(--line);
    margin: 28px 0;
}

pre {
    overflow-x: auto;
    padding: 14px;
    background: var(--surface);
}

.admin-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 32px;
}

.admin-header .text-link {
    flex: 0 0 auto;
    padding-top: 10px;
}

.admin-nav {
    display: flex;
    align-items: center;
    gap: 18px;
}

.editor-form {
    display: grid;
    gap: 24px;
}

.admin-section {
    padding: 30px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.admin-section--ai {
    border-top: 4px solid var(--brand);
    background: linear-gradient(135deg, #ffffff 0%, #f2faf7 100%);
}

.section-description {
    margin: 0 0 24px;
    color: var(--muted);
}

.field-grid {
    display: flex;
    align-items: flex-end;
    gap: 16px;
}

.field-grid--ai {
    margin-bottom: 18px;
}

.field-grid--details {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(150px, 0.7fr) minmax(150px, 0.7fr);
}

.field {
    display: grid;
    gap: 7px;
    margin-bottom: 20px;
    color: #354453;
    font-size: 0.92rem;
    font-weight: 700;
}

.field small {
    color: var(--muted);
    font-weight: 400;
}

.thumbnail-field {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 220px;
    gap: 22px;
    align-items: start;
}

.thumbnail-preview {
    display: grid;
    gap: 7px;
    color: #354453;
    font-size: 0.92rem;
    font-weight: 700;
}

.thumbnail-preview img {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    border: 1px solid var(--line);
    border-radius: 10px;
    object-fit: cover;
}

.field--grow {
    flex: 1 1 auto;
}

input,
select,
textarea,
button {
    font: inherit;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid #cbd4dc;
    border-radius: 10px;
    padding: 11px 13px;
    color: var(--ink);
    background: var(--surface);
}

input:focus,
select:focus,
textarea:focus {
    outline: 3px solid rgba(13, 102, 89, 0.15);
    border-color: var(--brand);
}

textarea {
    resize: vertical;
    line-height: 1.65;
}

.body-editor {
    min-height: 420px;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 10px 18px;
    font-weight: 800;
    cursor: pointer;
}

.button--primary,
.button--publish {
    color: #fff;
    background: var(--brand);
}

.button--secondary {
    border-color: #9fc8be;
    color: var(--brand-dark);
    background: var(--accent);
}

.button--secondary:hover {
    border-color: var(--brand);
    background: #c7e7df;
}

.button--primary:hover,
.button--publish:hover {
    background: var(--brand-dark);
}

.button--publish {
    min-width: 180px;
}

.button--ghost {
    border-color: var(--line);
    color: var(--muted);
    background: var(--surface);
}

.button--ghost:hover {
    border-color: #aebac4;
    color: var(--ink);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.button-link {
    line-height: 1.4;
    text-decoration: none;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    border: 1px solid;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 0.78rem;
    font-weight: 800;
}

.status-badge--draft {
    border-color: #e4c777;
    color: #775b12;
    background: #fff8dd;
}

.status-badge--published {
    border-color: #a6d8bb;
    color: var(--success);
    background: var(--success-bg);
}

.admin-post-list {
    display: grid;
}

.admin-post-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 22px 0;
    border-top: 1px solid var(--line);
}

.admin-post-thumbnail {
    width: 104px;
    aspect-ratio: 16 / 10;
    flex: 0 0 auto;
    border-radius: 10px;
    object-fit: cover;
}

.admin-post-row:first-child {
    padding-top: 4px;
    border-top: 0;
}

.admin-post-row:last-child {
    padding-bottom: 4px;
}

.admin-post-main {
    min-width: 0;
}

.admin-post-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 700;
}

.admin-post-main h3 {
    margin: 8px 0 4px;
    font-size: 1.15rem;
}

.admin-post-main p {
    display: -webkit-box;
    margin: 0;
    overflow: hidden;
    color: var(--muted);
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.admin-post-actions {
    display: flex;
    flex: 0 0 auto;
    gap: 8px;
}

.analytics-section {
    margin-top: 24px;
}

.analytics-table-wrap {
    overflow-x: auto;
}

.analytics-table {
    width: 100%;
    min-width: 620px;
    border-collapse: collapse;
    font-variant-numeric: tabular-nums;
}

.analytics-table th,
.analytics-table td {
    border-bottom: 1px solid var(--line);
    padding: 13px 12px;
    text-align: left;
    vertical-align: top;
}

.analytics-table th {
    color: var(--muted);
    background: var(--surface-soft);
    font-size: 0.82rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.analytics-table tbody tr:last-child td {
    border-bottom: 0;
}

.analytics-table a {
    color: var(--brand);
    font-weight: 700;
}

.analytics-form,
.cta-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(140px, 1fr));
    align-items: end;
    gap: 14px;
}

.analytics-form .field,
.cta-form .field {
    margin-bottom: 0;
}

.analytics-field--wide,
.cta-url-field {
    grid-column: span 2;
}

.generated-url {
    display: grid;
    gap: 6px;
    margin-top: 20px;
    border: 1px solid #9fc8be;
    border-radius: 12px;
    padding: 14px 16px;
    background: var(--accent);
    overflow-wrap: anywhere;
}

.generated-url a,
.cta-row a {
    color: var(--brand-dark);
}

.retention-note {
    margin: 18px 0 0;
    color: var(--muted);
    font-size: 0.86rem;
}

.cta-list {
    display: grid;
}

.cta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 20px 0;
    border-top: 1px solid var(--line);
}

.cta-row:first-child {
    padding-top: 0;
    border-top: 0;
}

.cta-row:last-child {
    padding-bottom: 0;
}

.cta-row h3 {
    margin: 8px 0 2px;
}

.cta-row code {
    color: var(--muted);
}

.alert {
    margin: 0 0 20px;
    border: 1px solid;
    border-radius: 12px;
    padding: 13px 16px;
}

.alert--error {
    border-color: #edb7b7;
    color: var(--danger);
    background: var(--danger-bg);
}

.alert--success {
    border-color: #b9dfc9;
    color: var(--success);
    background: var(--success-bg);
}

.admin-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--line);
}

@media (max-width: 720px) {
    .container,
    .container--wide,
    .container--admin {
        width: min(100% - 28px, 1120px);
        padding-top: 24px;
    }

    .masthead {
        padding: 30px 0 36px;
    }

    .filter-panel,
    .filter-form {
        grid-template-columns: 1fr;
    }

    .filter-panel {
        gap: 20px;
        margin-bottom: 32px;
        padding: 22px;
    }

    .filter-button {
        width: 100%;
    }

    .result-summary {
        align-items: flex-start;
        flex-direction: column;
    }

    .post-grid {
        grid-template-columns: 1fr;
    }

    .post-card {
        min-height: auto;
    }

    .post-card-content {
        padding: 22px;
    }

    .admin-header,
    .section-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .admin-header .text-link {
        padding-top: 0;
    }

    .admin-nav {
        width: 100%;
        align-items: stretch;
        flex-direction: column;
        gap: 10px;
    }

    .admin-section {
        padding: 22px;
    }

    .field-grid,
    .field-grid--details,
    .thumbnail-field,
    .analytics-form,
    .cta-form {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0;
    }

    .analytics-form,
    .cta-form {
        gap: 14px;
    }

    .analytics-field--wide,
    .cta-url-field {
        grid-column: auto;
    }

    .field-grid--ai {
        margin-bottom: 0;
    }

    .button,
    .button--publish {
        width: 100%;
    }

    .admin-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .form-actions,
    .admin-post-row,
    .admin-post-actions,
    .cta-row {
        align-items: stretch;
        flex-direction: column;
    }

    .admin-post-actions {
        width: 100%;
    }

    .admin-post-thumbnail {
        width: 100%;
        max-height: 180px;
    }
}

/* Article comparison tables: preserve columns on narrow screens. */
.article-body table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; margin: 24px 0; font-size: .95rem; }
.article-body th, .article-body td { border: 1px solid var(--line); padding: 12px 14px; min-width: 100px; text-align: left; vertical-align: top; }
.article-body th { background: var(--accent); font-weight: 700; }

/* Retirement entry cards: homepage only. */
.retirement-entry { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:18px; margin-bottom:32px; }
.retirement-entry__card { display:flex; flex-direction:column; padding:26px; border:1px solid var(--line); border-radius:18px; background:var(--surface); color:var(--ink); text-decoration:none; }
.retirement-entry__card--calculator { background:var(--accent); border-color:var(--accent); }
.retirement-entry__label { color:var(--brand); font-size:.85rem; font-weight:700; }
.retirement-entry__card h2 { margin:10px 0; font-size:1.4rem; line-height:1.4; }
.retirement-entry__card p { margin:0 0 20px; color:var(--muted); line-height:1.7; }
.retirement-entry__action { margin-top:auto; color:var(--brand-dark); font-weight:700; }
.retirement-entry__card:hover { border-color:var(--brand); }
.retirement-entry__card:focus-visible { outline:3px solid var(--brand); outline-offset:4px; }
@media(max-width:640px) { .retirement-entry { grid-template-columns:1fr; } .retirement-entry__card { padding:22px; } }
