/*
Theme Name:  열린인간
Theme URI:   https://openhuman.kr
Description: 한국어 블로그를 위한 독립 테마. 목록은 카드 그리드, 본문은 읽기에만 집중하는 단일 칼럼.
Author:      openhuman
Version: 2.6
License:     GPL-2.0-or-later
Text Domain: openhuman
Tags:        blog, one-column, custom-menu, featured-images
*/

/* ===============================================================
   토큰
   =============================================================== */
:root {
    /* 글꼴: 웹폰트를 부르지 않는다. 서버가 2 OCPU라 요청 하나가 아깝고,
       본문용으로는 OS 기본 한글 글꼴이 이미 충분히 좋다. */
    --sans: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard",
            "Noto Sans KR", "Malgun Gothic", "맑은 고딕", system-ui, sans-serif;
    --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "D2Coding", monospace;

    --bg:          #ffffff;
    --surface:     #f6f6f4;
    --text:        #16181d;
    --muted:       #6b7078;
    --line:        #e6e6e2;
    --accent:      #0f6b5c;
    --accent-soft: #e8f3f0;

    --wrap:        1120px;
    --wrap-wide:   900px;
    --wrap-narrow: 680px;

    --radius: 10px;
}

/* ===============================================================
   기본
   =============================================================== */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    font-size: 17px;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

img, svg, video { max-width: 100%; height: auto; display: block; }

a { color: inherit; }

.wrap        { width: 100%; max-width: var(--wrap);        margin-inline: auto; padding-inline: 20px; }
.wrap-wide   { width: 100%; max-width: var(--wrap-wide);   margin-inline: auto; padding-inline: 20px; }
.wrap-narrow { width: 100%; max-width: var(--wrap-narrow); margin-inline: auto; padding-inline: 20px; }

.skip-link {
    position: absolute; left: -9999px;
    padding: .6em 1em; background: var(--text); color: #fff; border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus { left: 0; top: 0; z-index: 100; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }

/* ===============================================================
   머리말
   =============================================================== */
.site-header {
    border-bottom: 1px solid var(--line);
    background: var(--bg);
}

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

.wordmark {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.035em;
    text-decoration: none;
}

.site-nav .nav-list {
    display: flex;
    gap: 1.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: .9375rem;
}

.site-nav a {
    text-decoration: none;
    color: var(--muted);
    transition: color .15s;
}
.site-nav a:hover { color: var(--text); }

/* ===============================================================
   페이지 머리
   =============================================================== */
.page-intro {
    padding: 4.5rem 0 3rem;
    border-bottom: 1px solid var(--line);
    margin-bottom: 3rem;
}

.page-intro-title {
    margin: 0;
    font-size: 2.25rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1.2;
    word-break: keep-all;
}

.page-intro-text {
    margin: .75rem 0 0;
    color: var(--muted);
    font-size: 1.0625rem;
    word-break: keep-all;
}

/* ===============================================================
   카드 그리드
   =============================================================== */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
    gap: 2.75rem 2rem;
    padding-bottom: 4rem;
}

.card-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.card-media {
    overflow: hidden;
    border-radius: var(--radius);
    background: var(--surface);
    aspect-ratio: 16 / 9;
}

.card-media img {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform .4s cubic-bezier(.2, .6, .2, 1);
}

.card-link:hover .card-media img { transform: scale(1.04); }

/* 썸네일이 없는 글도 카드가 허전하지 않게. 제목에서 뽑은 색상값이라
   같은 글은 언제나 같은 색이 나온다. */
.card-media-blank {
    display: block;
    width: 100%; height: 100%;
    background:
        linear-gradient(135deg,
            hsl(var(--hue) 24% 93%) 0%,
            hsl(calc(var(--hue) + 40) 22% 88%) 100%);
}

.card-body { padding-top: 1.1rem; }

.card-title {
    margin: .55rem 0 0;
    font-size: 1.1875rem;
    font-weight: 700;
    line-height: 1.45;
    letter-spacing: -0.028em;
    word-break: keep-all;
    transition: color .15s;
}

.card-link:hover .card-title { color: var(--accent); }

.card-excerpt {
    margin: .55rem 0 0;
    color: var(--muted);
    font-size: .9375rem;
    line-height: 1.7;
    word-break: keep-all;

    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-meta {
    margin: .8rem 0 0;
    color: var(--muted);
    font-size: .8125rem;
    display: flex; gap: .5rem;
}

.chip {
    display: inline-block;
    padding: .2em .65em;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    text-decoration: none;
}

/* ===============================================================
   본문
   =============================================================== */
.entry-header {
    padding: 4.5rem 0 0;
    text-align: center;
}

.entry-title {
    margin: 1rem 0 0;
    font-size: 2.375rem;
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: -0.04em;
    word-break: keep-all;
}

.entry-meta {
    margin: 1rem 0 0;
    color: var(--muted);
    font-size: .875rem;
    display: flex; gap: .5rem; justify-content: center;
}

.entry-hero {
    margin: 3rem auto 0;
}
.entry-hero img { border-radius: var(--radius); }

/* 한글은 라틴 문자보다 글자당 획이 많아 같은 행간에서도 빽빽해 보인다.
   행간을 1.9까지 올리고 자간을 살짝 좁혀 덩어리감을 줄인다. */
.entry-content {
    padding: 3.25rem 20px 4rem;
    font-size: 1.0625rem;
    line-height: 1.9;
    letter-spacing: -0.003em;
    word-break: keep-all;          /* 한글 단어 중간에서 줄이 끊기지 않게 */
    overflow-wrap: break-word;
}

.entry-content > * + * { margin-top: 1.55em; }
.entry-content p { margin: 0; }

.entry-content h2,
.entry-content h3,
.entry-content h4 {
    line-height: 1.4;
    letter-spacing: -0.032em;
    font-weight: 700;
    word-break: keep-all;
}

.entry-content h2 {
    margin-top: 2.6em;
    padding-bottom: .3em;
    border-bottom: 1px solid var(--line);
    font-size: 1.5rem;
}

.entry-content h3 { margin-top: 2.1em; font-size: 1.1875rem; }

.entry-content a {
    color: var(--accent);
    text-underline-offset: .2em;
    text-decoration-thickness: 1px;
}

.entry-content ul,
.entry-content ol { padding-left: 1.35em; }
.entry-content li + li { margin-top: .45em; }

.entry-content blockquote {
    margin-left: 0; margin-right: 0;
    padding: .1em 0 .1em 1.25em;
    border-left: 3px solid var(--line);
    color: var(--muted);
}

.entry-content hr {
    margin: 3em 0;
    border: 0;
    border-top: 1px solid var(--line);
}

/* 코드 — 기술 글에서 가장 자주 깨지는 부분이다.
   긴 줄은 잘리지 않고 자기 영역 안에서만 가로 스크롤되어야 한다. */
.entry-content code,
.entry-content kbd {
    padding: .15em .42em;
    border-radius: 4px;
    background: var(--surface);
    font-family: var(--mono);
    font-size: .875em;
}

.entry-content pre {
    padding: 1.1em 1.25em;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    overflow-x: auto;
    line-height: 1.65;
}

.entry-content pre code {
    padding: 0; background: none; font-size: .8438rem;
}

/* 표 — 비교표가 좁은 화면에서 넘칠 때 페이지 전체가 밀리지 않게 감싼다. */
.entry-content table {
    display: block;
    width: 100%;
    overflow-x: auto;
    border-collapse: collapse;
    font-size: .9375rem;
}

.entry-content th,
.entry-content td {
    padding: .6em .85em;
    border: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

.entry-content th {
    background: var(--surface);
    font-weight: 600;
    white-space: nowrap;
}

/* 대가성 문구 — 필수 플러그인이 넣는다.
   광고임이 한눈에 보여야 하므로 본문과 뚜렷하게 구분되는 색을 쓴다. */
.affiliate-disclosure {
    margin: 0 0 2.25em;
    padding: .9em 1.1em;
    border-left: 3px solid #d29922;
    border-radius: 0 var(--radius) var(--radius) 0;
    background: #fff8e5;
    color: #6b5416;
    font-size: .9375rem;
    line-height: 1.65;
}

/* ===============================================================
   글 아래
   =============================================================== */
.tag-list {
    display: flex; flex-wrap: wrap; gap: .5rem;
    margin: 0; padding: 0 20px 3rem; list-style: none;
    font-size: .8125rem;
}
.tag-list a {
    display: inline-block;
    padding: .25em .7em;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    text-decoration: none;
}

.post-nav {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
    padding: 2.5rem 20px 4.5rem;
    border-top: 1px solid var(--line);
}

.post-nav-item {
    padding: 1.1rem 1.25rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    text-decoration: none;
    transition: border-color .15s;
}
.post-nav-item:hover { border-color: var(--accent); }
.post-nav-item.is-next { text-align: right; }

.post-nav-label { display: block; color: var(--muted); font-size: .75rem; }
.post-nav-title {
    display: block; margin-top: .3rem;
    font-weight: 600; font-size: .9375rem; line-height: 1.5;
    word-break: keep-all;
}

/* ===============================================================
   페이지 넘김 / 기타
   =============================================================== */
.pagination {
    display: flex; justify-content: center; gap: .5rem;
    padding-bottom: 4.5rem;
    font-size: .9375rem;
}
.pagination .page-numbers {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 2.4em; height: 2.4em;
    padding: 0 .6em;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    text-decoration: none;
}
.pagination .page-numbers.current {
    background: var(--text); border-color: var(--text); color: #fff;
}
.screen-reader-text { position: absolute; left: -9999px; }

.empty { padding: 4rem 0 6rem; color: var(--muted); text-align: center; }

.button {
    display: inline-block;
    padding: .7em 1.4em;
    border-radius: var(--radius);
    background: var(--text);
    color: #fff;
    text-decoration: none;
    font-size: .9375rem;
}

/* ===============================================================
   꼬리말
   =============================================================== */
.site-footer {
    border-top: 1px solid var(--line);
    background: var(--surface);
}

.footer-inner {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: 1rem; flex-wrap: wrap;
    padding-block: 2.5rem;
    color: var(--muted);
    font-size: .875rem;
}

.footer-name { margin: 0; font-weight: 700; color: var(--text); letter-spacing: -0.03em; }
.footer-note { margin: 0; }

/* ===============================================================
   모바일
   방문자 대부분이 인스타에서 넘어오므로 모바일이 기본이다.
   =============================================================== */
@media (max-width: 768px) {
    body { font-size: 16px; }

    .header-inner { min-height: 60px; }

    .page-intro { padding: 2.75rem 0 2rem; margin-bottom: 2rem; }
    .page-intro-title { font-size: 1.75rem; }

    .card-grid { grid-template-columns: 1fr; gap: 2.25rem; }

    .entry-header { padding-top: 2.75rem; text-align: left; }
    .entry-title { font-size: 1.75rem; }
    .entry-meta { justify-content: flex-start; }

    .entry-content { padding-top: 2.25rem; font-size: 1rem; line-height: 1.85; }
    .entry-content h2 { font-size: 1.3125rem; }
    .entry-content h3 { font-size: 1.0938rem; }
    .entry-content pre { font-size: .8125rem; }

    .post-nav-item.is-next { text-align: left; }
}

/* ===============================================================
   임베드
   워드프레스의 responsive-embeds 지원을 쓰지 않는다. body에
   wp-embed-responsive 클래스를 남겨 정체를 알려주기 때문이다.
   =============================================================== */
.entry-content iframe,
.entry-content embed,
.entry-content object,
.entry-content video {
    display: block;
    width: 100%;
    max-width: 100%;
    border-radius: var(--radius);
}

.entry-content .wp-block-embed__wrapper { position: relative; }

.entry-content figure.wp-block-embed iframe {
    aspect-ratio: 16 / 9;
    height: auto;
}

/* ===============================================================
   상품 카탈로그
   =============================================================== */

/* 카드 사진 위의 번호. Threads 에서 안내한 번호를 눈으로 찾는 용도다. */
.product-card .card-media { position: relative; }

.product-number {
    position: absolute;
    top: .6rem; left: .6rem;
    min-width: 1.9em;
    padding: .15em .5em;
    font-size: .9375rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    text-align: center;
    color: #fff;
    background: rgba(22, 24, 29, .82);
    border-radius: 999px;
}

.product-oneliner {
    margin: .35em 0 0;
    color: var(--muted);
    font-size: .9375rem;
    line-height: 1.6;
}

/* --- 상품 낱개 --- */

.product-single { padding-block: 2.5rem 4rem; }

.product-head { margin-bottom: 1.5rem; }

.product-title {
    margin: .4em 0 .2em;
    font-size: clamp(1.6rem, 4vw, 2.1rem);
    line-height: 1.3;
}

.product-lead {
    margin: 0;
    color: var(--muted);
    font-size: 1.0625rem;
}

.product-figure { margin: 0 0 1.5rem; }

/* 상품 사진은 정사각형인 경우가 많은데, 그대로 두면 사진 하나가 첫 화면을
   전부 차지해서 구매 버튼이 접힘 아래로 밀린다. 여기 오는 사람은 이미 살
   마음이 있으므로 사진보다 버튼이 먼저 보여야 한다.
   잘라내지 않고(contain) 높이만 제한한다 — 포장 글씨가 정보이기 때문이다. */
.product-figure img {
    border-radius: var(--radius);
    max-height: min(46vh, 380px);
    width: auto;
    max-width: 100%;
    margin-inline: auto;
    object-fit: contain;
}

.product-downside {
    margin: 2rem 0;
    padding: 1rem 1.2rem;
    background: var(--surface);
    border-radius: var(--radius);
}
.product-downside h2 { margin: 0 0 .3em; font-size: 1rem; }
.product-downside p  { margin: 0; color: var(--muted); }

.product-buy { margin: 2.5rem 0 1rem; }

.product-buy-link {
    display: block;
    padding: .9em 1.2em;
    text-align: center;
    text-decoration: none;
    font-weight: 600;
    color: #fff;
    background: var(--accent);
    border-radius: var(--radius);
}
.product-buy-link:hover { filter: brightness(1.08); }

.product-back { margin: 2rem 0 0; color: var(--muted); font-size: .9375rem; }

/* 상품 카드에 사진이 없을 때. 회색 덩어리로 두면 목록이 고장난 것처럼 보인다.
   사진을 올릴 때까지 버티는 용도이지, 사진을 대신하려는 것이 아니다. */
.product-card .card-media-blank {
    position: relative;
    background: linear-gradient(135deg,
        hsl(var(--hue) 30% 94%), hsl(var(--hue) 24% 88%));
}
.product-card .card-media-blank::after {
    content: "사진 준비 중";
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    color: var(--muted); font-size: .875rem;
}

/* 사진 바로 아래 구매 버튼. 아래쪽 버튼보다 위 여백을 줄여 사진에 붙인다. */
.product-buy-top { margin: 0 0 2rem; }

/* 모바일 고정 구매 바.
   좁은 화면에서만 띄운다 — 데스크톱은 스크롤이 짧아 위 버튼으로 충분하다. */
.product-sticky {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 50;
    padding: .7rem 16px calc(.7rem + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    backdrop-filter: blur(8px);
    border-top: 1px solid var(--line);
}
.product-sticky[hidden] { display: none; }
.product-sticky .product-buy-link { padding: .8em 1.2em; }

@media (min-width: 641px) {
    .product-sticky { display: none !important; }
}

/* 고정 바가 마지막 내용을 가리지 않게 아래 여백을 준다. */
@media (max-width: 640px) {
    .product-single { padding-bottom: 7rem; }
}
