/*
Theme Name: Ashhan Child
Theme URI: https://ashhan.com
Description: Minimal Korean longform blog child theme for 한승환 (ASH Han).
  Substack/Medium aesthetic — Pretendard, off-white background, deep forest green accent.
Author: 한승환
Template: generatepress
Version: 1.0.0
Text Domain: ashhan-child
*/

/* ==========================================================================
   Pretendard — self-host (via jsdelivr CDN fallback, with local preload)
   ========================================================================== */
@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.min.css');

/* ==========================================================================
   Design tokens
   ========================================================================== */
:root {
    /* Light mode */
    --bg: #FAFAF7;
    --fg: #1A1A1A;
    --fg-muted: #5A5A55;
    --fg-subtle: #8A8A82;
    --border: #E8E6E0;
    --accent: #1F4F3F;           /* deep forest green */
    --accent-hover: #2D6E6E;     /* subtle teal (hover) */
    --surface: #FFFFFF;
    --code-bg: #F0EFEA;

    --font-sans: 'Pretendard', -apple-system, 'Noto Sans KR', sans-serif;
    --font-serif: 'Pretendard', Georgia, 'Noto Serif KR', serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', Consolas, monospace;

    --content-width: 720px;
    --reading-width: 680px;

    --radius: 4px;
    --radius-lg: 8px;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0F0F0E;
        --fg: #E8E6E0;
        --fg-muted: #A8A8A0;
        --fg-subtle: #6A6A62;
        --border: #2A2A28;
        --accent: #4A8878;           /* slightly brighter in dark */
        --accent-hover: #6FA597;
        --surface: #1A1A18;
        --code-bg: #1F1F1D;
    }
}

body.dark-mode {
    --bg: #0F0F0E;
    --fg: #E8E6E0;
    --fg-muted: #A8A8A0;
    --fg-subtle: #6A6A62;
    --border: #2A2A28;
    --accent: #4A8878;
    --accent-hover: #6FA597;
    --surface: #1A1A18;
    --code-bg: #1F1F1D;
}

/* ==========================================================================
   Base
   ========================================================================== */
body {
    background-color: var(--bg);
    color: var(--fg);
    font-family: var(--font-sans);
    font-size: 17px;
    line-height: 1.85;
    letter-spacing: -0.011em;
    font-feature-settings: 'ss01' on, 'ss02' on;
}

a { color: var(--accent); text-decoration: none; transition: color 0.15s ease; }
a:hover { color: var(--accent-hover); }

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-sans);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--fg);
    line-height: 1.3;
}

/* ==========================================================================
   Header
   ========================================================================== */
.site-header {
    background-color: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 20px 0;
}

.inside-header {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.site-branding {
    display: flex;
    align-items: center;
    gap: 12px;
}

.site-logo img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.main-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
}

.main-title a { color: var(--fg); }

.site-description {
    font-size: 13px;
    color: var(--fg-muted);
    margin: 2px 0 0 0;
}

.main-navigation {
    font-size: 15px;
}

.main-navigation .main-nav ul {
    display: flex;
    gap: 24px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.main-navigation .main-nav a {
    color: var(--fg);
    padding: 4px 0;
    font-weight: 500;
}

.main-navigation .main-nav a:hover { color: var(--accent); }

/* ==========================================================================
   Hero (front page)
   ========================================================================== */
.ashhan-hero {
    max-width: var(--reading-width);
    margin: 60px auto 80px;
    padding: 0 20px;
    text-align: center;
}

.ashhan-hero h1 {
    font-size: 44px;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--fg);
    margin: 0 0 20px;
}

.ashhan-hero p {
    font-size: 17px;
    color: var(--fg-muted);
    margin: 0;
    line-height: 1.7;
}

/* ==========================================================================
   Post list (front page + archive + category)
   ========================================================================== */
.site-main {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 20px;
}

.post-list-item {
    display: flex;
    align-items: flex-start;
    gap: 24px;
    padding: 24px 0 48px;
    border-bottom: 1px solid var(--border);
}

.post-list-item:last-child { border-bottom: 0; }

.post-list-item__body {
    flex: 1;
    min-width: 0;
}

.post-list-item__meta {
    font-size: 13px;
    color: var(--fg-subtle);
    margin-bottom: 8px;
    display: flex;
    gap: 8px;
    align-items: center;
}

.post-list-item__category {
    color: var(--accent);
    font-weight: 500;
}

.post-list-item__title {
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 10px;
    line-height: 1.35;
    letter-spacing: -0.02em;
}

.post-list-item__title a { color: var(--fg); }
.post-list-item__title a:hover { color: var(--accent); }

.post-list-item__excerpt {
    font-size: 15px;
    color: var(--fg-muted);
    line-height: 1.75;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-list-item__thumb {
    flex-shrink: 0;
    width: 128px;
    height: 128px;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--code-bg);
}

.post-list-item__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Mobile: thumb below */
@media (max-width: 640px) {
    .post-list-item {
        flex-direction: column;
        gap: 16px;
    }
    .post-list-item__thumb {
        width: 100%;
        height: auto;
        aspect-ratio: 16 / 9;
    }
}

/* Infinite scroll loading indicator */
.ashhan-loading-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 40px 0;
}

.ashhan-loading-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--fg-subtle);
    animation: ashhan-dot 1.4s infinite ease-in-out both;
}

.ashhan-loading-dots span:nth-child(2) { animation-delay: 0.16s; }
.ashhan-loading-dots span:nth-child(3) { animation-delay: 0.32s; }

@keyframes ashhan-dot {
    0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
    40% { opacity: 1; transform: scale(1); }
}

/* ==========================================================================
   Single post
   ========================================================================== */
.single .entry-header {
    max-width: var(--reading-width);
    margin: 60px auto 32px;
    padding: 0 20px;
    text-align: center;
}

.single .entry-title {
    font-size: 34px;
    font-weight: 700;
    letter-spacing: -0.025em;
    margin: 0 0 16px;
    line-height: 1.3;
}

.single .entry-meta {
    font-size: 13px;
    color: var(--fg-subtle);
    display: flex;
    justify-content: center;
    gap: 8px;
}

.single .entry-meta a { color: var(--accent); }

.single .entry-content {
    max-width: var(--reading-width);
    margin: 0 auto;
    padding: 0 20px;
    font-size: 18px;
    line-height: 1.85;
    color: var(--fg);
}

.single .entry-content p { margin: 0 0 1.5em; }
.single .entry-content h2 {
    font-size: 28px;
    margin: 2em 0 0.8em;
    padding-top: 0.4em;
    border-top: 0;
}
.single .entry-content h3 { font-size: 22px; margin: 1.6em 0 0.6em; }

.single .entry-content blockquote {
    border-left: 3px solid var(--accent);
    padding: 4px 0 4px 20px;
    margin: 2em 0;
    color: var(--fg-muted);
    font-style: normal;
    background: transparent;
}

.single .entry-content pre,
.single .entry-content code {
    font-family: var(--font-mono);
    background: var(--code-bg);
    font-size: 0.92em;
}

.single .entry-content pre {
    padding: 16px 20px;
    border-radius: var(--radius);
    overflow-x: auto;
    line-height: 1.6;
    margin: 1.5em 0;
}

.single .entry-content code {
    padding: 2px 6px;
    border-radius: 3px;
}

.single .entry-content pre code { padding: 0; background: transparent; }

.single .entry-content img,
.single .entry-content figure {
    max-width: 100%;
    height: auto;
    margin: 2em auto;
    border-radius: var(--radius);
    display: block;
}

.single .entry-content figcaption {
    font-size: 13px;
    color: var(--fg-subtle);
    text-align: center;
    margin-top: 8px;
}

.single .entry-content a {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-color: rgba(31, 79, 63, 0.3);
    text-underline-offset: 3px;
}
.single .entry-content a:hover {
    text-decoration-color: var(--accent);
}

/* Prev/Next post nav */
.single .post-navigation {
    max-width: var(--reading-width);
    margin: 60px auto 40px;
    padding: 32px 20px 0;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    gap: 20px;
    font-size: 14px;
}

.single .post-navigation a {
    color: var(--fg-muted);
    display: block;
}

.single .post-navigation a:hover { color: var(--accent); }

.single .post-navigation .nav-previous::before { content: '← '; }
.single .post-navigation .nav-next::after { content: ' →'; }

/* Author bio card */
.ashhan-author-bio {
    max-width: var(--reading-width);
    margin: 40px auto;
    padding: 24px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    display: flex;
    gap: 16px;
    align-items: center;
}

.ashhan-author-bio img {
    width: 56px;
    height: 56px;
    border-radius: 50%;
}

.ashhan-author-bio__name { font-weight: 700; margin: 0 0 4px; }
.ashhan-author-bio__desc { font-size: 14px; color: var(--fg-muted); margin: 0; line-height: 1.6; }

/* ==========================================================================
   Comments
   ========================================================================== */
.comments-area {
    max-width: var(--reading-width);
    margin: 60px auto;
    padding: 0 20px;
}

.comments-title {
    font-size: 20px;
    margin: 0 0 24px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.ashhan-moderation-notice {
    background: var(--code-bg);
    color: var(--fg-muted);
    font-size: 13px;
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 24px;
    border-left: 3px solid var(--accent);
}

.comment-list {
    list-style: none;
    padding: 0;
    margin: 0 0 32px;
}

.comment-list .comment {
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}

.comment-list .children {
    list-style: none;
    padding-left: 24px;
    margin-top: 12px;
    border-left: 1px solid var(--border);
}

.comment-author {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
}

.comment-metadata {
    font-size: 12px;
    color: var(--fg-subtle);
    margin-bottom: 8px;
}

.comment-content {
    font-size: 15px;
    line-height: 1.7;
}

.comment-respond {
    margin-top: 32px;
}

.comment-form label {
    font-size: 13px;
    color: var(--fg-muted);
    display: block;
    margin-bottom: 4px;
}

.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
    width: 100%;
    padding: 10px 12px;
    font-family: var(--font-sans);
    font-size: 15px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--fg);
    margin-bottom: 16px;
}

.comment-form textarea {
    min-height: 120px;
    line-height: 1.6;
}

.comment-form input[type="submit"] {
    background: var(--accent);
    color: #fff;
    border: 0;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.15s ease;
}

.comment-form input[type="submit"]:hover { background: var(--accent-hover); }

/* ==========================================================================
   Archive pages (category/tag)
   ========================================================================== */
.page-header {
    max-width: var(--content-width);
    margin: 40px auto 20px;
    padding: 0 20px;
    text-align: center;
}

.page-title {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 8px;
}

.archive-description {
    font-size: 14px;
    color: var(--fg-muted);
    margin: 0;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
    max-width: var(--content-width);
    margin: 80px auto 0;
    padding: 40px 20px 60px;
    border-top: 1px solid var(--border);
    text-align: center;
}

.ashhan-footer-categories {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px 20px;
    margin: 0 0 20px;
    font-size: 13px;
}

.ashhan-footer-categories a { color: var(--fg-muted); }
.ashhan-footer-categories a:hover { color: var(--accent); }

.ashhan-footer-social {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin: 0 0 20px;
    font-size: 13px;
}

.ashhan-footer-social a { color: var(--fg-muted); }
.ashhan-footer-social a:hover { color: var(--accent); }

.site-info {
    font-size: 12px;
    color: var(--fg-subtle);
}

/* ==========================================================================
   Utility: hide GeneratePress defaults we don't want
   ========================================================================== */
.sidebar, .widget-area { display: none; }

.entry-content > .alignleft,
.entry-content > .alignright {
    max-width: 45%;
}

/* Remove GeneratePress featured image (we show in post list only) */
.single .entry-image { display: none; }

/* Hide GeneratePress credits & default pagination when infinite scroll works */
.site-info .copyright:not(.ashhan-copyright),
.generate-back-to-top,
footer[role="contentinfo"] .copyright a[href*="generatepress"],
.site-info > a[href*="generatepress"] { display: none !important; }

/* Hide default WP numeric pagination (infinite scroll handles this) */
.paging-navigation,
.nav-links,
.navigation.pagination { display: none !important; }

/* Re-show post navigation on single posts (prev/next) */
.single .post-navigation,
.single .post-navigation .nav-links { display: flex !important; }

/* Force hide GP built-in footer credits */
.site-info { font-size: 12px; color: var(--fg-subtle); }
.site-info a[href*="generatepress"] { display: none !important; }

/* TOC sidebar (desktop only) */
.ashhan-toc {
    position: fixed;
    top: 120px;
    right: 24px;
    width: 200px;
    max-height: calc(100vh - 180px);
    overflow-y: auto;
    font-size: 13px;
    line-height: 1.6;
    padding: 16px;
    background: transparent;
}

.ashhan-toc__title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--fg-subtle);
    margin: 0 0 12px;
}

.ashhan-toc ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ashhan-toc li { margin: 4px 0; }
.ashhan-toc li.toc-h3 { padding-left: 12px; }

.ashhan-toc a {
    color: var(--fg-muted);
    display: block;
    padding: 2px 0;
    border-left: 2px solid transparent;
    padding-left: 8px;
    margin-left: -10px;
    transition: all 0.15s ease;
}

.ashhan-toc a:hover,
.ashhan-toc a.active {
    color: var(--accent);
    border-left-color: var(--accent);
}

@media (max-width: 1200px) {
    .ashhan-toc { display: none; }
}

/* ==========================================================================
   Dark mode toggle button
   ========================================================================== */
.ashhan-darkmode-toggle {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--fg-muted);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    margin-left: 16px;
    padding: 0;
    line-height: 1;
    font-size: 14px;
}

.ashhan-darkmode-toggle:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.ashhan-darkmode-toggle svg { width: 16px; height: 16px; }

/* ==========================================================================
   Share buttons (single post)
   ========================================================================== */
.ashhan-share {
    max-width: var(--reading-width);
    margin: 48px auto 0;
    padding: 24px 20px 0;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: var(--fg-muted);
}

.ashhan-share__label {
    margin-right: 4px;
}

.ashhan-share__btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--fg-muted);
    background: var(--surface);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.15s ease;
    cursor: pointer;
    font-family: inherit;
}

.ashhan-share__btn:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.ashhan-share__btn svg { width: 14px; height: 14px; }

.ashhan-share__copied {
    color: var(--accent);
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.ashhan-share__copied.visible { opacity: 1; }

/* About page portrait */
.ashhan-about-portrait {
    margin: 0 0 28px 0;
}
.ashhan-about-portrait img {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
body.dark-mode .ashhan-about-portrait img {
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

/* ============================================================
   Typography tuning (2026-04-20) — feedback: fonts feel large
   ============================================================ */

/* Body text */
.entry-content,
.entry-content p {
    font-size: 17px;
    line-height: 1.75;
}

/* Single post title */
.entry-title {
    font-size: 30px !important;
    line-height: 1.3;
}

/* Headings inside body */
.entry-content h2 {
    font-size: 24px !important;
    line-height: 1.4;
    margin-top: 1.6em;
    margin-bottom: 0.6em;
}
.entry-content h3 {
    font-size: 20px !important;
    line-height: 1.4;
    margin-top: 1.4em;
    margin-bottom: 0.5em;
}

/* Blockquote — inline with body, distinguished only by border + indent */
.entry-content blockquote,
.entry-content blockquote p {
    font-size: 17px;
    line-height: 1.75;
}

/* Home post-list cards */
.post-list-item__title,
.post-list-item__title a {
    font-size: 20px;
    line-height: 1.4;
}

/* Hero — desktop default + mobile shrink */
.ashhan-hero h1,
.ashhan-hero .hero-title {
    font-size: 40px;
}
@media (max-width: 640px) {
    .ashhan-hero h1,
    .ashhan-hero .hero-title {
        font-size: 30px;
        line-height: 1.3;
    }
}

/* Mobile overflow guard for excerpt area */
.post-list-item__excerpt {
    overflow: hidden;
    word-break: break-word;
}
.post-list-item__excerpt img,
.post-list-item__excerpt iframe {
    display: none;
}

/* Hide GeneratePress featured-image block on single posts (CSS safety net) */
.single .featured-image,
.single .post-image,
.single article > .post-image {
    display: none !important;
}

/* Collapsible TOC block (Brunch [목차]) */
.brunch-toc {
    margin: 0 0 32px 0;
    padding: 14px 18px;
    background: rgba(31, 79, 63, 0.04);
    border-left: 3px solid var(--accent);
    border-radius: 4px;
    font-size: 14px;
}
.brunch-toc summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--accent);
    list-style: none;
    user-select: none;
}
.brunch-toc summary::-webkit-details-marker { display: none; }
.brunch-toc summary::before {
    content: "▸ ";
    display: inline-block;
    transition: transform 0.15s ease;
}
.brunch-toc[open] summary::before {
    content: "▾ ";
}
.brunch-toc ul {
    margin: 12px 0 0 0;
    padding: 0;
    list-style: none;
}
.brunch-toc li {
    padding: 3px 0;
    line-height: 1.5;
}
.brunch-toc li.toc-h2 { margin-top: 8px; }
.brunch-toc li.toc-h2:first-child { margin-top: 0; }
.brunch-toc li.toc-h3 { padding-left: 14px; color: var(--text-muted, #5a5a55); }
.brunch-toc li.toc-p { padding-left: 28px; color: var(--text-muted, #8a8a82); font-size: 13px; }
body.dark-mode .brunch-toc {
    background: rgba(255, 255, 255, 0.04);
}

