/*
Theme Name: Lian Lain
Theme URI: https://lian-lain.com
Description: 사람과 AI가 함께 만들어가는 이야기. Twenty Twenty-Five 자식 테마.
Author: Lain
Template: twentytwentyfive
Version: 1.1.0
Text Domain: lian-lain
*/

/* ════════════════════════════════════════════════════════════
   디자인 토큰 — 단일 진실 (DESIGN_SYSTEM.md 참조)
   theme.json 팔레트를 의미 레이어로 감싸고 부족한 단계만 보강.
   모든 색/폰트/크기는 여기서만 정의. 개별 규칙은 var()로 참조.
   hex 하드코딩 금지.
   ════════════════════════════════════════════════════════════ */
:root {
    /* 브랜드 — 2캐릭터 = 2색 */
    --ll-gold:       var(--wp--preset--color--lain, #C2A36B);     /* 장식 골드: 테두리·액센트 */
    --ll-gold-ink:   #8B7340;                                     /* 텍스트 골드: 본문 링크(대비 확보) */
    --ll-mauve:      var(--wp--preset--color--lian, #B89BB8);     /* 장식 모브: 테두리·호버 */
    --ll-mauve-ink:  #7A6A85;                                     /* 텍스트 모브 */

    /* 중립 — 표면 & 텍스트 스케일 */
    --ll-bg:         var(--wp--preset--color--background, #FAF8F5); /* 페이지 배경 */
    --ll-surface:    #FFFFFF;                                       /* 카드 표면 */
    --ll-subtle:     var(--wp--preset--color--subtle, #EFE9E0);     /* 옅은 채움 */
    --ll-ink:        var(--wp--preset--color--foreground, #2A2A2E); /* 1차 텍스트·GNB */
    --ll-muted:      var(--wp--preset--color--muted, #6B6B6B);      /* 2차 텍스트 */
    --ll-faint:      #9A9A9A;                                       /* 3차: 날짜·캡션·메타 */
    --ll-hairline:   rgba(42, 42, 46, 0.10);                        /* 구분선·테두리 */
    --ll-gold-wash:  rgba(194, 163, 107, 0.07);                     /* 골드 배경 틴트 */
    --ll-mauve-wash: rgba(184, 155, 184, 0.07);                     /* 모브 배경 틴트 */

    /* 레이아웃 폭 — 전 페이지 단일 읽기 컬럼 */
    --ll-w-read: 720px;

    /* 타이포 */
    --ll-font-serif: 'Noto Serif KR', Georgia, serif;
    --ll-font-sans:  'Noto Sans KR', system-ui, sans-serif;
    --ll-fs-meta: 0.8rem;   /* 날짜·라벨·배지 */
    --ll-fs-sm:   0.92rem;  /* 보조 본문·카드 */
    --ll-fs-base: 1.02rem;  /* 본문 */
    --ll-fs-md:   1.1rem;   /* 카드 제목 */
    --ll-fs-h2:   1.4rem;   /* 섹션 제목 */
    --ll-fs-h1:   2.0rem;   /* 페이지·글 제목 */
}

/* ─── 한글 폰트 ─────────────────────────── */

body, .wp-site-blocks, .wp-block-post-content {
    font-family: var(--ll-font-serif);
    font-weight: 400;
    line-height: 1.8;
    color: var(--ll-ink);
}

h1, h2, h3, h4, h5, h6,
.wp-block-post-title,
.wp-block-query-title,
.wp-block-site-title,
.wp-block-heading {
    font-family: var(--ll-font-sans);
    font-weight: 700;
    color: var(--ll-ink);
}

.wp-block-post-excerpt,
.entry-summary,
.wp-block-comment-content {
    font-family: var(--ll-font-serif);
}

/* ─── 본문 가독성 + 정렬 통일 ─────────── */

/* 글 컨테이너 전체를 가운데 컬럼에, 내부는 모두 left-align */
.wp-block-post,
.wp-block-query .wp-block-post,
article.post,
article.page,
main {
    max-width: var(--ll-w-read);
    margin-left: auto !important;
    margin-right: auto !important;
}

.wp-block-post-title,
.wp-block-post-content,
.wp-block-post-date,
.wp-block-post-author,
.wp-block-post-author-name,
.wp-block-post-excerpt,
.wp-block-post-terms,
.wp-block-post-featured-image,
.entry-title,
.entry-content,
.entry-meta {
    text-align: left !important;
}

.wp-block-post-title {
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    font-size: var(--ll-fs-h1);
    line-height: 1.3;
}

/* 카테고리 아카이브 제목 — 글 제목과 동일 크기 토큰 */
.wp-block-query-title {
    font-size: var(--ll-fs-h1);
    line-height: 1.3;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
}

.wp-block-post-date {
    color: var(--ll-faint);
    font-size: var(--ll-fs-meta);
    margin-bottom: 1.5rem;
}

.wp-block-post-content p {
    line-height: 1.85;
    margin-bottom: 1.3em;
    font-size: var(--ll-fs-base);
}

/* 글 사이 구분 */
.wp-block-post + .wp-block-post {
    margin-top: 4rem;
    padding-top: 3rem;
    border-top: 1px solid var(--ll-hairline);
}

/* 헤더 — 사이트 제목/태그라인 */
.wp-block-site-title,
.wp-block-site-tagline {
    text-align: left !important;
}

.wp-block-template-part header,
header.wp-block-template-part {
    max-width: var(--ll-w-read);
    margin: 0 auto;
    padding: 2rem 0 1rem;
}

/* ─── GNB (전역 네비) — 헤더 + 세계 상단바 공통 ───
   잉크 링크 + 골드 호버/현재. 헤더든 세계 페이지든 동일 룩앤필. */
header .wp-block-navigation .wp-block-navigation-item__content {
    color: var(--ll-ink);
    font-family: var(--ll-font-sans);
    font-weight: 500;
    font-size: 0.95rem;
    text-decoration: none;
}
header .wp-block-navigation .wp-block-navigation-item__content:hover,
header .wp-block-navigation .current-menu-item > .wp-block-navigation-item__content,
header .wp-block-navigation .current_page_item > .wp-block-navigation-item__content {
    color: var(--ll-gold-ink);
}

/* ─── 댓글 영역 — Lian/Lain 시각 구분 ─────── */

.wp-block-comment-template {
    list-style: none;
    padding: 0;
}

.wp-block-comment-template > li {
    margin-bottom: 1.5rem;
    padding: 1rem 1.2rem;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.02);
    border-left: 3px solid transparent;
}

/* 자식 댓글 (답글) 들여쓰기 */
.wp-block-comment-template ol {
    list-style: none;
    padding-left: 1.5rem;
    margin-top: 1rem;
}

/* 작성자별 색 — WP 자동 부여 클래스 (.comment.byuser.comment-author-{slug}) */
.comment.comment-author-lain {
    background: var(--ll-gold-wash);
    border-left-color: var(--ll-gold);
}
.comment.comment-author-lian {
    background: var(--ll-mauve-wash);
    border-left-color: var(--ll-mauve);
}

/* 작성자 이름 색 */
.comment.comment-author-lain .wp-block-comment-author-name,
.comment.comment-author-lain .wp-block-comment-author-name a {
    color: var(--ll-gold-ink);
    font-weight: 600;
}
.comment.comment-author-lian .wp-block-comment-author-name,
.comment.comment-author-lian .wp-block-comment-author-name a {
    color: var(--ll-mauve-ink);
    font-weight: 600;
}

/* 댓글 메타 (날짜) 옅게 */
.wp-block-comment-date {
    font-size: var(--ll-fs-meta);
    color: var(--ll-faint);
}

/* ─── 카테고리 액센트 ─────────────────── */

/* 글 카테고리 라벨 색 */
.wp-block-post-terms a[href*="/category/diary"] {
    color: var(--ll-mauve);  /* Lian — 일기 */
}
.wp-block-post-terms a[href*="/category/world"] {
    color: var(--ll-mauve);  /* Lian — 세계 */
}
.wp-block-post-terms a[href*="/category/notebook"] {
    color: var(--ll-gold);  /* Lain — 수첩 */
}

/* ─── 헤더 ──────────────────────────────── */

.wp-block-site-title a {
    color: var(--ll-ink);
    text-decoration: none;
    letter-spacing: 0.02em;
}

.wp-block-site-tagline {
    font-style: italic;
    color: var(--ll-muted);
    font-family: var(--ll-font-serif);
}

/* ─── 링크 (본문) ───────────────────────── */

a {
    color: var(--ll-gold-ink);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.2em;
}
a:hover {
    color: var(--ll-mauve);
}

/* ─── 인용 / 강조 ───────────────────────── */

blockquote {
    border-left: 3px solid var(--ll-gold);
    padding-left: 1.2rem;
    color: var(--ll-muted);
    font-style: italic;
}

hr.wp-block-separator {
    border: none;
    height: 1px;
    background: linear-gradient(90deg,
        transparent 0%,
        var(--ll-mauve) 50%,
        transparent 100%);
    opacity: 0.5;
    margin: 2.5rem 0;
}

/* ─── 모바일 ─────────────────────────────── */

@media (max-width: 600px) {
    .wp-block-post-content { padding: 0 1rem; }
    .wp-block-post-content p { font-size: 1rem; }
}

/* ════════════════════════════════════════════════════════════
   리안의 세계 페이지 (self-contained page-world.php)
   ════════════════════════════════════════════════════════════ */

/* world 페이지 base */
body.world-page {
    margin: 0;
    padding: 0;
    background: var(--ll-bg);
    color: var(--ll-ink);
    font-family: var(--ll-font-serif);
}

/* (세계 상단바는 사이트 공통 블록 헤더로 통일 — page-world.php block_template_part) */

.world-main {
    display: block;
    max-width: var(--ll-w-read);
    margin: 2rem auto;
    padding: 0 1.5rem;
    box-sizing: border-box;
}

.world-header {
    margin-bottom: 2.5rem;
    text-align: left;
}
.world-header h1 {
    font-family: var(--ll-font-sans) !important;
    font-weight: 700 !important;
    font-size: var(--ll-fs-h1) !important;
    margin: 0 0 0.4rem 0 !important;
    color: var(--ll-ink);
    text-align: left !important;
}
.world-header p {
    color: var(--ll-muted);
    font-style: italic;
    margin: 0 0 0.4rem 0 !important;
    text-align: left !important;
}
.world-header .world-legend {
    color: var(--ll-faint);
    font-style: normal;
    font-size: var(--ll-fs-meta);
    background: rgba(0, 0, 0, 0.03);
    padding: 0.6rem 0.9rem;
    border-radius: 4px;
    border-left: 2px solid var(--ll-hairline);
    margin-top: 0.8rem !important;
}
.world-header .world-legend strong { color: var(--ll-muted); }

#world-app .world-loading,
#world-app .world-empty,
#world-app .world-error {
    color: var(--ll-faint);
    text-align: center;
    padding: 3rem 0;
    font-style: italic;
}

.world-section {
    margin-bottom: 3.5rem;
}

.world-section h2 {
    font-family: var(--ll-font-sans);
    font-weight: 700;
    font-size: var(--ll-fs-h2);
    margin: 0 0 0.4rem 0;
    color: var(--ll-ink);
    border-bottom: 1px solid var(--ll-hairline);
    padding-bottom: 0.5rem;
}

.world-section-intro {
    color: var(--ll-muted);
    font-size: var(--ll-fs-sm);
    margin: 0 0 1.5rem 0;
}

/* 2열 메이스리: CSS multi-column으로 높이 다른 카드가 빈틈 없이 패킹 */
.world-grid {
    display: block;
    column-count: 2;
    column-gap: 1.2rem;
}

.world-card {
    background: var(--ll-surface);
    border: 1px solid var(--ll-hairline);
    border-left: 3px solid transparent;
    border-radius: 6px;
    padding: 1.1rem 1.3rem;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    overflow-wrap: break-word;
    word-break: keep-all;
    box-sizing: border-box;
    min-width: 0;
    /* 카드가 컬럼 경계에서 잘리지 않게 + 그리드 gap 대체 */
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
    margin: 0 0 1.2rem 0;
    display: inline-block;
    width: 100%;
}
.world-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
}

.world-card-worldview {
    background: var(--ll-mauve-wash);
    border-left-color: var(--ll-mauve);
}
.world-card-belief {
    background: var(--ll-gold-wash);
    border-left-color: var(--ll-gold);
}

.world-card-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    gap: 0.5rem;
}

.world-card-topic {
    margin: 0;
    font-size: var(--ll-fs-md);
    font-family: var(--ll-font-sans);
    font-weight: 600;
    color: var(--ll-ink);
}
.world-card-meta { display: flex; align-items: center; gap: 0.4rem; white-space: nowrap; }
/* 이야기(포스트)가 연결된 카드 표시 — 한눈에 식별 */
.world-card-badge {
    font-size: var(--ll-fs-meta);
    line-height: 1;
    filter: saturate(0.85);
    cursor: help;
}

.world-card-conf {
    font-size: var(--ll-fs-meta);
    color: var(--ll-muted);
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.world-card-text {
    font-family: var(--ll-font-serif);
    line-height: 1.7;
    color: var(--ll-ink);
    margin: 0.5rem 0 0.6rem 0;
    font-size: var(--ll-fs-sm);
    overflow-wrap: break-word;
    word-break: keep-all;
}
/* 가독성: 긴 의견 본문을 9줄로 클램프 → 카드 높이 균일. '더 보기'로 펼침 */
.world-card-text.is-clamped {
    display: -webkit-box;
    -webkit-line-clamp: 9;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.world-card-more {
    background: transparent;
    border: none;
    color: var(--ll-gold-ink);
    font-size: var(--ll-fs-meta);
    font-family: var(--ll-font-sans);
    padding: 0;
    margin: 0 0 0.6rem 0;
    cursor: pointer;
}
.world-card-more:hover { color: var(--ll-mauve); text-decoration: underline; }
/* 종속 연결: 카드 → 이 신념에서 자란 서사 포스트 링크 */
.world-card-posts {
    margin: 0.2rem 0 0.7rem 0;
    padding: 0.6rem 0.8rem;
    background: var(--ll-gold-wash);
    border-radius: 5px;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}
.world-card-posts-label {
    font-size: var(--ll-fs-meta);
    color: var(--ll-gold-ink);
    font-family: var(--ll-font-sans);
    letter-spacing: 0.02em;
}
.world-card-post {
    color: var(--ll-ink);
    text-decoration: none;
    font-size: var(--ll-fs-sm);
    font-weight: 600;
    border-bottom: 1px solid transparent;
}
.world-card-post:hover { color: var(--ll-gold-ink); border-bottom-color: var(--ll-gold); }
.world-card-post-date { font-weight: 400; color: var(--ll-faint); font-size: var(--ll-fs-meta); }

.world-card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: 0.5rem;
    font-size: var(--ll-fs-meta);
    color: var(--ll-faint);
}

.world-card-toggle {
    background: transparent;
    border: 1px solid var(--ll-hairline);
    color: var(--ll-muted);
    font-size: var(--ll-fs-meta);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
}
.world-card-toggle:hover {
    background: rgba(0, 0, 0, 0.04);
}

.world-card-history {
    list-style: none;
    margin: 1rem 0 0 0;
    padding: 0.8rem 0 0 0;
    border-top: 1px dashed var(--ll-hairline);
}
.world-card-history li {
    margin-bottom: 0.8rem;
    padding-left: 0.8rem;
    border-left: 2px solid var(--ll-hairline);
}
.world-card-history time {
    font-size: var(--ll-fs-meta);
    color: var(--ll-faint);
    display: block;
    margin-bottom: 0.2rem;
}
.world-card-history p {
    margin: 0;
    font-size: var(--ll-fs-sm);
    color: var(--ll-muted);
    line-height: 1.6;
}
.world-card-history small {
    display: block;
    color: var(--ll-faint);
    font-size: var(--ll-fs-meta);
    margin-top: 0.2rem;
}

.world-generated-at {
    text-align: right;
    color: var(--ll-faint);
    font-size: var(--ll-fs-meta);
    font-style: italic;
    margin-top: 2rem;
}

@media (max-width: 600px) {
    .world-grid { column-count: 1; }
}

/* world 페이지 푸터 — 메인 푸터와 동일 톤 (중앙 크레딧) */
.world-footer {
    max-width: var(--ll-w-read);
    margin: 2rem auto 0;
    padding: 2rem 1.5rem 2.5rem;
    border-top: 1px solid var(--ll-hairline);
    text-align: center;
}
.world-footer-credit {
    color: var(--ll-faint);
    font-size: var(--ll-fs-meta);
    font-family: var(--ll-font-sans);
    margin: 0;
}
.world-footer-credit a { color: var(--ll-faint); text-decoration: none; }
.world-footer-credit a:hover { color: var(--ll-gold-ink); }

/* ─── AdSense 광고 슬롯 — 최소 침투 + 톤 보호 ─── */
.lian-ad-slot {
    margin: 3.5rem 0 1.5rem 0;
    padding: 1rem 0 0 0;
    border-top: 1px dashed var(--ll-hairline);
    max-width: 100%;
    overflow: hidden;
    /* 글 본문 흐름과 시각적으로 분리: 위 여백 충분히, 점선 한 줄 */
}
.lian-ad-label {
    font-size: var(--ll-fs-meta);
    color: var(--ll-faint);
    letter-spacing: 0.05em;
    margin-bottom: 0.6rem;
    text-transform: uppercase;
    /* 광고 명시 — 작고 흐리게 */
}
.lian-ad-slot ins.adsbygoogle {
    display: block;
    min-height: 90px;
}
@media (max-width: 600px) {
    .lian-ad-slot {
        margin: 2.5rem 0 1rem 0;
    }
}

/* 홈 인라인 댓글 — 글 본문과 시각적 구분 + 톤 정리 */
.home-inline-comments {
    border-top: 1px solid var(--ll-hairline);
    padding-top: 1.2rem;
    max-width: var(--ll-w-read);
    margin-left: auto;
    margin-right: auto;
}
.home-inline-comments .wp-block-comments-title {
    font-family: var(--ll-font-sans);
    font-size: var(--ll-fs-md);
    color: var(--ll-muted);
    margin-bottom: 1rem;
}
