/*
Theme Name: NARCI Casebook
Theme URI: https://narci.org
Author: NARCI
Description: 전세·학교폭력·교통사고 판례 해설을 위한 빠르고 읽기 쉬운 한국어 WordPress 테마입니다.
Version: 1.0.0
Requires at least: 6.6
Requires PHP: 8.2
Text Domain: narci-casebook
*/

:root {
    --narci-bg: #f5f6f8;
    --narci-surface: #ffffff;
    --narci-text: #172033;
    --narci-muted: #5d6678;
    --narci-line: #dfe3ea;
    --narci-brand: #163f7a;
    --narci-brand-dark: #0f2d59;
    --narci-accent: #c18416;
    --narci-soft-blue: #edf4ff;
    --narci-soft-gold: #fff7e5;
    --narci-danger-soft: #fff2ef;
    --narci-radius: 18px;
    --narci-shadow: 0 16px 40px rgba(27, 42, 70, 0.08);
    --narci-content: 760px;
    --narci-wide: 1180px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--narci-bg);
    color: var(--narci-text);
    font-family: Pretendard, "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 17px;
    line-height: 1.78;
    word-break: keep-all;
    overflow-wrap: anywhere;
}

a {
    color: var(--narci-brand);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.2em;
}

a:hover,
a:focus-visible {
    color: var(--narci-brand-dark);
}

img {
    max-width: 100%;
    height: auto;
}

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

button,
input[type="submit"] {
    cursor: pointer;
}

:focus-visible {
    outline: 3px solid rgba(193, 132, 22, 0.55);
    outline-offset: 3px;
}

.screen-reader-text,
.skip-link:not(:focus) {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link:focus {
    position: fixed;
    z-index: 9999;
    top: 14px;
    left: 14px;
    padding: 10px 16px;
    border-radius: 8px;
    background: var(--narci-surface);
    color: var(--narci-brand-dark);
    box-shadow: var(--narci-shadow);
}

.site-header {
    position: sticky;
    z-index: 100;
    top: 0;
    border-bottom: 1px solid rgba(223, 227, 234, 0.92);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(14px);
}

.admin-bar .site-header {
    top: 32px;
}

.header-inner,
.site-main,
.footer-inner {
    width: min(calc(100% - 40px), var(--narci-wide));
    margin-inline: auto;
}

.header-inner {
    display: flex;
    min-height: 76px;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
}

.site-branding {
    display: flex;
    min-width: 210px;
    flex-direction: column;
    line-height: 1.2;
}

.site-title {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(1.35rem, 2.4vw, 1.75rem);
    font-weight: 800;
    letter-spacing: -0.03em;
}

.site-title a {
    color: var(--narci-brand-dark);
    text-decoration: none;
}

.site-description {
    margin: 5px 0 0;
    color: var(--narci-muted);
    font-size: 0.78rem;
    letter-spacing: -0.02em;
}

.primary-nav ul,
.footer-nav ul {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 0;
    margin: 0;
    list-style: none;
}

.primary-nav a {
    color: var(--narci-text);
    font-size: 0.94rem;
    font-weight: 700;
    text-decoration: none;
}

.primary-nav a:hover,
.primary-nav .current-menu-item > a,
.primary-nav .current-category-ancestor > a {
    color: var(--narci-brand);
}

.site-main {
    padding-block: 44px 72px;
}

.hero {
    display: grid;
    overflow: hidden;
    margin-bottom: 32px;
    border-radius: 26px;
    background: linear-gradient(135deg, var(--narci-brand-dark), var(--narci-brand));
    color: #fff;
    box-shadow: var(--narci-shadow);
    grid-template-columns: minmax(0, 1.45fr) minmax(260px, 0.55fr);
}

.hero-copy {
    padding: clamp(34px, 6vw, 72px);
}

.hero-kicker {
    display: inline-flex;
    padding: 6px 11px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 999px;
    margin-bottom: 18px;
    background: rgba(255, 255, 255, 0.1);
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.hero h1 {
    max-width: 760px;
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2.15rem, 5vw, 4.5rem);
    line-height: 1.08;
    letter-spacing: -0.05em;
}

.hero p {
    max-width: 660px;
    margin: 22px 0 0;
    color: rgba(255, 255, 255, 0.84);
    font-size: clamp(1rem, 2vw, 1.18rem);
}

.hero-side {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 34px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(7, 24, 52, 0.42));
}

.hero-side strong {
    display: block;
    margin-bottom: 10px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.35rem;
}

.hero-side p {
    margin: 0;
    font-size: 0.9rem;
}

.topic-grid {
    display: grid;
    gap: 18px;
    margin-bottom: 38px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.topic-card {
    position: relative;
    overflow: hidden;
    min-height: 190px;
    padding: 28px;
    border: 1px solid var(--narci-line);
    border-radius: var(--narci-radius);
    background: var(--narci-surface);
    box-shadow: 0 9px 24px rgba(32, 49, 79, 0.05);
    transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.topic-card:hover {
    border-color: rgba(22, 63, 122, 0.38);
    box-shadow: var(--narci-shadow);
    transform: translateY(-3px);
}

.topic-card::before {
    display: block;
    width: 42px;
    height: 5px;
    border-radius: 999px;
    margin-bottom: 28px;
    background: var(--narci-accent);
    content: "";
}

.topic-card h2 {
    margin: 0 0 8px;
    font-size: 1.24rem;
    line-height: 1.35;
    letter-spacing: -0.035em;
}

.topic-card p {
    margin: 0;
    color: var(--narci-muted);
    font-size: 0.9rem;
}

.topic-card a {
    color: inherit;
    text-decoration: none;
}

.topic-card a::after {
    position: absolute;
    inset: 0;
    content: "";
}

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

.section-heading h2,
.archive-header h1,
.search-header h1 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(1.75rem, 3vw, 2.5rem);
    line-height: 1.2;
    letter-spacing: -0.04em;
}

.section-heading p,
.archive-description {
    margin: 0;
    color: var(--narci-muted);
    font-size: 0.9rem;
}

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

.post-card {
    display: flex;
    overflow: hidden;
    min-height: 100%;
    flex-direction: column;
    border: 1px solid var(--narci-line);
    border-radius: var(--narci-radius);
    background: var(--narci-surface);
    box-shadow: 0 8px 22px rgba(28, 43, 69, 0.045);
}

.post-card-image {
    display: block;
    aspect-ratio: 12 / 7;
    overflow: hidden;
    background: linear-gradient(135deg, var(--narci-soft-blue), var(--narci-soft-gold));
}

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

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

.post-card-placeholder {
    display: grid;
    width: 100%;
    height: 100%;
    place-items: center;
    color: var(--narci-brand);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.04em;
}

.post-card-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    padding: 24px;
}

.category-badge {
    align-self: flex-start;
    padding: 4px 9px;
    border-radius: 999px;
    margin-bottom: 13px;
    background: var(--narci-soft-blue);
    color: var(--narci-brand);
    font-size: 0.72rem;
    font-weight: 800;
    text-decoration: none;
}

.post-card h2,
.post-card h3 {
    margin: 0;
    font-size: 1.2rem;
    line-height: 1.48;
    letter-spacing: -0.035em;
}

.post-card h2 a,
.post-card h3 a {
    color: var(--narci-text);
    text-decoration: none;
}

.post-card-excerpt {
    margin: 14px 0 20px;
    color: var(--narci-muted);
    font-size: 0.9rem;
}

.post-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    margin-top: auto;
    color: var(--narci-muted);
    font-size: 0.76rem;
}

.content-layout {
    display: grid;
    align-items: start;
    gap: 38px;
    grid-template-columns: minmax(0, 1fr) 300px;
}

.article-shell,
.page-shell,
.archive-shell,
.search-shell,
.not-found-shell {
    border: 1px solid var(--narci-line);
    border-radius: 24px;
    background: var(--narci-surface);
    box-shadow: var(--narci-shadow);
}

.article-shell,
.page-shell,
.not-found-shell {
    padding: clamp(28px, 5vw, 64px);
}

.archive-shell,
.search-shell {
    padding: clamp(24px, 4vw, 44px);
}

.article-header {
    max-width: var(--narci-content);
    margin: 0 auto 34px;
}

.breadcrumbs {
    margin-bottom: 18px;
    color: var(--narci-muted);
    font-size: 0.78rem;
}

.breadcrumbs a {
    color: inherit;
}

.article-title,
.page-title {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2.1rem, 5vw, 3.9rem);
    line-height: 1.2;
    letter-spacing: -0.055em;
}

.article-deck {
    margin: 22px 0 0;
    color: var(--narci-muted);
    font-size: clamp(1rem, 2vw, 1.16rem);
}

.article-header .post-meta {
    margin-top: 22px;
}

.article-featured-image {
    overflow: hidden;
    max-width: 940px;
    border-radius: 18px;
    margin: 0 auto 38px;
}

.entry-content {
    max-width: var(--narci-content);
    margin-inline: auto;
}

.entry-content > * {
    max-width: 100%;
}

.entry-content h2,
.entry-content h3,
.entry-content h4 {
    color: var(--narci-brand-dark);
    line-height: 1.35;
    letter-spacing: -0.04em;
    scroll-margin-top: 110px;
}

.entry-content h2 {
    padding-top: 16px;
    margin: 2.35em 0 0.85em;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(1.55rem, 3vw, 2.15rem);
}

.entry-content h3 {
    margin: 1.85em 0 0.7em;
    font-size: 1.25rem;
}

.entry-content p,
.entry-content ul,
.entry-content ol,
.entry-content blockquote,
.entry-content table {
    margin-top: 0;
    margin-bottom: 1.4em;
}

.entry-content blockquote {
    padding: 18px 22px;
    border-left: 5px solid var(--narci-accent);
    border-radius: 0 12px 12px 0;
    background: var(--narci-soft-gold);
    color: #40351f;
}

.entry-content table {
    display: block;
    width: 100%;
    overflow-x: auto;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.entry-content th,
.entry-content td {
    padding: 12px 14px;
    border: 1px solid var(--narci-line);
    text-align: left;
}

.entry-content th {
    background: var(--narci-soft-blue);
}

.narci-case-source,
.narci-legal-notice {
    max-width: var(--narci-content);
    padding: 22px 24px;
    border-radius: 14px;
    margin: 30px auto 0;
}

.narci-case-source {
    border: 1px solid #cdddf5;
    background: var(--narci-soft-blue);
}

.narci-case-source h2 {
    margin: 0 0 12px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.25rem;
}

.narci-case-source ul {
    padding-left: 20px;
    margin: 0;
}

.narci-legal-notice {
    border: 1px solid #ead6ae;
    background: var(--narci-soft-gold);
    color: #493b20;
    font-size: 0.86rem;
}

.sidebar {
    position: sticky;
    top: 104px;
}

.widget {
    padding: 22px;
    border: 1px solid var(--narci-line);
    border-radius: 16px;
    margin-bottom: 18px;
    background: var(--narci-surface);
}

.widget:empty {
    display: none;
}

.widget-title {
    margin: 0 0 14px;
    font-size: 1rem;
}

.widget ul {
    padding-left: 18px;
    margin: 0;
}

.ad-slot {
    width: min(100%, var(--narci-wide));
    margin: 0 auto 28px;
}

.ad-slot .widget {
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.related-posts {
    max-width: var(--narci-content);
    padding-top: 32px;
    border-top: 1px solid var(--narci-line);
    margin: 42px auto 0;
}

.related-posts h2 {
    margin: 0 0 16px;
    font-family: Georgia, "Times New Roman", serif;
}

.related-list {
    display: grid;
    gap: 12px;
}

.related-list a {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    border: 1px solid var(--narci-line);
    border-radius: 12px;
    color: var(--narci-text);
    text-decoration: none;
}

.related-list time {
    flex: 0 0 auto;
    color: var(--narci-muted);
    font-size: 0.75rem;
}

.pagination,
.nav-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 32px;
}

.page-numbers {
    display: inline-grid;
    min-width: 42px;
    min-height: 42px;
    padding: 7px 11px;
    border: 1px solid var(--narci-line);
    border-radius: 10px;
    background: var(--narci-surface);
    color: var(--narci-text);
    place-items: center;
    text-decoration: none;
}

.page-numbers.current {
    border-color: var(--narci-brand);
    background: var(--narci-brand);
    color: #fff;
}

.search-form {
    display: flex;
    gap: 8px;
}

.search-field {
    min-width: 0;
    flex: 1;
    padding: 11px 13px;
    border: 1px solid var(--narci-line);
    border-radius: 10px;
    background: #fff;
}

.search-submit {
    padding: 10px 16px;
    border: 0;
    border-radius: 10px;
    background: var(--narci-brand);
    color: #fff;
    font-weight: 800;
}

.site-footer {
    padding: 42px 0;
    border-top: 1px solid var(--narci-line);
    background: #eef0f4;
}

.footer-inner {
    display: grid;
    align-items: start;
    gap: 24px;
    grid-template-columns: 1fr auto;
}

.footer-brand {
    max-width: 620px;
}

.footer-brand strong {
    display: block;
    margin-bottom: 8px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.25rem;
}

.footer-brand p,
.footer-meta {
    margin: 0;
    color: var(--narci-muted);
    font-size: 0.78rem;
}

.footer-nav ul {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px 16px;
}

.footer-nav a {
    color: var(--narci-muted);
    font-size: 0.78rem;
}

.empty-state {
    padding: 46px 20px;
    text-align: center;
}

.empty-state p {
    color: var(--narci-muted);
}

@media (max-width: 980px) {
    .primary-nav {
        display: none;
    }

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

    .hero-side {
        padding-top: 0;
    }

    .topic-grid,
    .post-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .content-layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
    }
}

@media (max-width: 782px) {
    .admin-bar .site-header {
        top: 46px;
    }
}

@media (max-width: 640px) {
    body {
        font-size: 16px;
        word-break: normal;
    }

    .header-inner,
    .site-main,
    .footer-inner {
        width: min(calc(100% - 24px), var(--narci-wide));
    }

    .site-description {
        display: none;
    }

    .site-main {
        padding-block: 22px 48px;
    }

    .hero-copy,
    .hero-side {
        padding: 28px 24px;
    }

    .topic-grid,
    .post-grid,
    .footer-inner {
        grid-template-columns: 1fr;
    }

    .topic-card {
        min-height: 0;
    }

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

    .article-shell,
    .page-shell,
    .archive-shell,
    .search-shell,
    .not-found-shell {
        border-radius: 18px;
    }

    .article-shell,
    .page-shell,
    .not-found-shell {
        padding: 28px 20px;
    }

    .archive-shell,
    .search-shell {
        padding: 24px 18px;
    }

    .footer-nav ul {
        justify-content: flex-start;
    }

    .related-list a {
        flex-direction: column;
        gap: 4px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
