/* =========================================================
   Blog Theme — Minimal editorial, Noto Sans TC (400/600)
   ========================================================= */

:root {
    --ink:          #1a1a1a;
    --ink-soft:     #3a3a3a;
    --muted:        #8a8a8a;
    --line:         #ececec;
    --paper:        #fbfaf7;
    --paper-2:      #f4f2ec;
    --card:         #ffffff;
    --accent:       #FFC503;
    --accent-soft:  #fff3b0;
    --link:         #1a1a1a;
    --link-hover:   #0099FF;
    --tech-blue:    #0099FF;

    --font-base: "Noto Sans TC", -apple-system, BlinkMacSystemFont,
                 "Segoe UI", "PingFang TC", "Microsoft JhengHei", sans-serif;

    --container: 1200px;
    --narrow:    720px;
    --radius:    4px;
    --ease:      cubic-bezier(.2,.7,.2,1);
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: var(--font-base);
    font-weight: 400;
    font-size: 16px;
    line-height: 1.8;
    color: var(--ink);
    background: var(--paper);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    letter-spacing: .02em;
}

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

a { color: var(--link); text-decoration: none; transition: color .2s var(--ease); }
a:hover { color: var(--link-hover); }

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-base);
    font-weight: 600;
    line-height: 1.35;
    color: var(--ink);
    margin: 1.4em 0 .5em;
    letter-spacing: .01em;
}
h1 { font-size: clamp(1.8rem, 3.4vw, 2.4rem); }
h2 { font-size: clamp(1.35rem, 2.2vw, 1.7rem); }
h3 { font-size: 1.2rem; }

strong, b { font-weight: 600; }

p { margin: 0 0 1.1em; }

blockquote {
    margin: 1.8em 0;
    padding: .2em 0 .2em 1.4em;
    border-left: 3px solid var(--accent);
    color: var(--ink-soft);
    font-size: 1.125rem;
}

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

code, pre { font-family: "JetBrains Mono", Consolas, Monaco, monospace; font-size: .92em; }
pre {
    background: #1a1a1a; color: #f0ead6;
    padding: 1.2em 1.4em; border-radius: var(--radius);
    overflow: auto; line-height: 1.6;
}
:not(pre) > code { background: var(--paper-2); padding: .12em .45em; border-radius: 3px; color: var(--accent); }

.container { max-width: var(--container); margin: 0 auto; padding: 0 28px; }

.screen-reader-text { position: absolute !important; clip: rect(1px,1px,1px,1px); width: 1px; height: 1px; overflow: hidden; }
.skip-link { position: absolute; top: -40px; left: 0; background: var(--ink); color: #fff; padding: 8px 16px; z-index: 9999; }
.skip-link:focus { top: 0; }

/* ---------- header ---------- */
.site-header {
    border-bottom: 1px solid var(--line);
    background: var(--paper);
}
.site-header__inner {
    padding: 32px 28px; max-width: var(--container); margin: 0 auto;
    text-align: center;
}
.site-branding {
    display: inline-flex; flex-direction: column; align-items: center;
}
.custom-logo-link { display: inline-block; }
.site-title {
    margin: 0;
    font-size: 1.75rem; font-weight: 600; letter-spacing: .04em;
}
.site-title a { color: var(--ink); }
.site-title a:hover { color: var(--tech-blue); }
.site-description {
    margin: 6px 0 0; font-size: .875rem; color: var(--muted);
    letter-spacing: .18em;
}

/* ---------- nav bar (below header) ---------- */
.nav-bar {
    border-bottom: 1px solid var(--line);
    background: var(--paper);
    position: sticky; top: 0; z-index: 100;
    backdrop-filter: saturate(1.2) blur(8px);
    background: rgba(251, 250, 247, .92);
}
.nav-bar > .container {
    display: flex; justify-content: center;
    padding: 0 28px;
}
.main-navigation { display: flex; align-items: center; width: 100%; justify-content: center; }
.main-navigation > ul {
    list-style: none; margin: 0; padding: 0;
    display: flex; gap: 4px; flex-wrap: wrap; justify-content: center;
}
.main-navigation > ul > li { position: relative; }
.main-navigation a {
    position: relative; display: block;
    padding: 18px 22px;
    color: var(--ink-soft);
    font-size: 1rem; font-weight: 400;
}
.main-navigation a::after {
    content: ""; position: absolute; left: 22px; right: 22px; bottom: 12px;
    height: 1px; background: var(--tech-blue);
    transform: scaleX(0); transform-origin: right;
    transition: transform .3s var(--ease);
}
.main-navigation a:hover,
.main-navigation .current-menu-item > a,
.main-navigation .current-menu-ancestor > a,
.main-navigation .current-menu-parent > a { color: var(--tech-blue); }
.main-navigation a:hover::after,
.main-navigation .current-menu-item > a::after,
.main-navigation .current-menu-ancestor > a::after,
.main-navigation .current-menu-parent > a::after { transform: scaleX(1); transform-origin: left; }

/* prevent sub-menu overflow on edge items */
.main-navigation > ul > li:first-child > .sub-menu { left: 0; transform: translateX(0); }
.main-navigation > ul > li:first-child:hover > .sub-menu { transform: translateX(0); }
.main-navigation > ul > li:last-child > .sub-menu { left: auto; right: 0; transform: translateX(0); }
.main-navigation > ul > li:last-child:hover > .sub-menu { transform: translateX(0); }

/* has-children indicator */
.main-navigation .menu-item-has-children > a { padding-right: 32px; }
.main-navigation .menu-item-has-children > a::before {
    content: ""; position: absolute; right: 18px; top: 50%;
    width: 6px; height: 6px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: translateY(-70%) rotate(45deg);
    transition: transform .2s var(--ease);
}
.main-navigation .menu-item-has-children:hover > a::before { transform: translateY(-30%) rotate(225deg); }

/* sub-menu (level 2) */
.main-navigation .sub-menu {
    list-style: none; margin: 0; padding: 8px 0;
    position: absolute; top: 100%; left: 50%;
    min-width: 200px;
    transform: translate(-50%, 8px);
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 6px;
    box-shadow: 0 16px 32px rgba(0,0,0,.08);
    opacity: 0; visibility: hidden;
    transition: opacity .2s var(--ease), transform .2s var(--ease), visibility 0s .2s;
    z-index: 200;
}
.main-navigation li:hover > .sub-menu,
.main-navigation li:focus-within > .sub-menu {
    opacity: 1; visibility: visible;
    transform: translate(-50%, 0);
    transition: opacity .2s var(--ease), transform .2s var(--ease);
}
.main-navigation .sub-menu li { width: 100%; }
.main-navigation .sub-menu a {
    padding: 10px 20px; white-space: nowrap; font-size: .9375rem;
}
.main-navigation .sub-menu a::after { display: none; }
.main-navigation .sub-menu a:hover { background: var(--paper-2); color: var(--tech-blue); }

.menu-toggle {
    display: none; background: none; border: 0; cursor: pointer;
    width: 42px; height: 42px; position: relative; border-radius: 50%;
}
.menu-toggle:hover { background: var(--paper-2); }
.menu-toggle__bar,
.menu-toggle__bar::before,
.menu-toggle__bar::after {
    content: ""; position: absolute; left: 10px; right: 10px; height: 1.5px; background: var(--ink);
    transition: transform .3s var(--ease), top .3s var(--ease), opacity .2s;
}
.menu-toggle__bar { top: 50%; transform: translateY(-50%); }
.menu-toggle__bar::before { top: -7px; }
.menu-toggle__bar::after  { top:  7px; }
.menu-toggle[aria-expanded="true"] .menu-toggle__bar { background: transparent; }
.menu-toggle[aria-expanded="true"] .menu-toggle__bar::before { top: 0; transform: rotate(45deg); }
.menu-toggle[aria-expanded="true"] .menu-toggle__bar::after  { top: 0; transform: rotate(-45deg); }

.header-search .search-form { display: flex; align-items: center; }
.header-search .search-field {
    padding: 8px 14px; border: 1px solid var(--line); background: transparent;
    border-radius: 999px; font: inherit; font-size: 1rem;
    width: 180px; transition: width .3s var(--ease), border-color .2s;
}
.header-search .search-field:focus { outline: none; border-color: var(--ink); width: 220px; }
.header-search .search-submit {
    margin-left: -40px; padding: 6px 14px; background: transparent;
    border: 0; cursor: pointer; color: var(--muted); font-size: .875rem;
}

/* ---------- breadcrumb ---------- */
.breadcrumb-bar {
    background: transparent;
}
.breadcrumb {
    max-width: var(--container);
    margin: 0 auto;
    padding: 16px 28px;
    font-size: .875rem;
    color: var(--muted);
    display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
}
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--tech-blue); }
.breadcrumb__sep { color: var(--line); }
.breadcrumb__current {
    color: var(--ink);
}

/* ---------- layout ---------- */
.site-content { padding: 70px 0 80px; }
.content-grid {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 28px;
}

/* ---------- post list (3-column card grid) ---------- */
.post-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 48px 36px;
}

.post-card {
    position: relative;
    background: transparent;
    border: 0;
    transition: transform .3s var(--ease);
    display: flex;
}
.post-card:hover { transform: translateY(-3px); }

.post-card__body {
    padding: 4px 0 0;
    display: flex;
    flex-direction: column;
    width: 100%;
}

.post-card__cat {
    display: inline-block;
    align-self: flex-start;
    margin-bottom: 10px;
    color: var(--muted);
    font-size: .875rem;
    font-weight: 600;
    letter-spacing: .14em;
    position: relative; z-index: 2;
}
.post-card__cat:hover { color: var(--tech-blue); }

.post-card .entry-title {
    margin: 0 0 14px;
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: .01em;
    word-break: break-word;
    overflow-wrap: break-word;
}
.post-card .entry-title a { color: var(--ink); }
.post-card:hover .entry-title a { color: var(--tech-blue); }

.entry-summary {
    color: var(--ink-soft); font-size: 1rem; line-height: 1.75;
    margin: 0 0 20px; font-size: 16px;
}
.entry-summary p { margin: 0; }

.post-card__meta {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: .875rem;
    color: var(--muted);
    letter-spacing: .06em;
}
.post-card__read { color: var(--ink); font-weight: 600; transition: color .2s var(--ease); }
.post-card:hover .post-card__read { color: var(--tech-blue); }

.post-card__link {
    position: absolute; inset: 0; z-index: 1;
    text-indent: -9999px;
}

.post-card--compact { padding: 0; }

/* ---------- single / page ---------- */
.post-single, .page-single {
    max-width: 100%;
    margin: 0 auto;
    background: transparent;
    border: 0;
    padding: 0;
}
.post-single .entry-header, .page-single .entry-header { text-align: center; margin-bottom: 40px; }
.post-single .entry-title, .page-single .entry-title {
    font-size: clamp(1.8rem, 3.6vw, 2.6rem);
    margin: 0 0 20px;
    line-height: 1.35;
    font-weight: 600;
}
.post-single .entry-meta {
    font-size: .875rem; letter-spacing: .18em;
    color: var(--muted);
    display: flex; justify-content: center; gap: 20px; flex-wrap: wrap;
}

.post-thumbnail {
    margin: 20px 0 50px;
}
.post-thumbnail img {
    width: 100%;
    max-height: 560px; object-fit: cover;
    border-radius: var(--radius);
}

.entry-content {
    font-size: 1.125rem;
    line-height: 1.9;
    color: var(--ink-soft);
}
.entry-content li { margin-bottom: .5em; }
.entry-content p { margin: 0 0 1.4em; }
.entry-content h2, .entry-content h3, .entry-content h4 {
    color: var(--ink); margin-top: 2em; font-weight: 600;
}
.entry-content img { border-radius: var(--radius); margin: 1.6em 0; }
.entry-content a {
    color: var(--ink);
    background-image: linear-gradient(var(--tech-blue), var(--tech-blue));
    background-size: 100% 1px; background-repeat: no-repeat; background-position: 0 100%;
}
.entry-content a:hover { color: var(--tech-blue); }

.entry-footer {
    max-width: 100%; margin: 60px auto 0;
    padding-top: 30px; border-top: 1px solid var(--line);
    text-align: center;
}
.tag-links a {
    display: inline-block; margin: 4px;
    padding: 5px 14px;
    background: transparent; border: 1px solid var(--line);
    border-radius: 999px; font-size: .875rem;
    color: var(--ink-soft); letter-spacing: .05em;
}
.tag-links a:hover { border-color: var(--tech-blue); color: var(--tech-blue); }

/* ---------- pagination / post nav ---------- */
.navigation.pagination {
    margin-top: 60px; text-align: center;
}
.page-numbers {
    display: inline-block; padding: 10px 16px; margin: 0 4px;
    border: 0; border-bottom: 1px solid transparent;
    color: var(--ink-soft); background: transparent;
    font-size: 1rem;
}
.page-numbers.current { color: var(--tech-blue); border-bottom-color: var(--tech-blue); font-weight: 600; }
.page-numbers:hover { color: var(--tech-blue); border-bottom-color: var(--tech-blue); }

.post-navigation {
    max-width: 100%; margin: 70px auto 0;
    display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
}
.post-navigation .nav-next { text-align: right; }
.post-navigation a {
    display: block; padding: 20px 0;
    border-top: 1px solid var(--line);
    font-size: 1.05rem; color: var(--ink); font-weight: 600;
}
.post-navigation a:hover { color: var(--tech-blue); }


/* ---------- FAQ ---------- */
.post-faq {
    margin-top: 60px;
    padding-top: 40px;
    border-top: 1px solid var(--line);
}
.post-faq__title {
    margin: 0 0 24px;
    font-size: 1.5rem;
    font-weight: 600;
}
.post-faq__list { display: flex; flex-direction: column; gap: 8px; }
.post-faq__item {
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    transition: border-color .2s;
}
.post-faq__item[open] { border-color: var(--tech-blue); }
.post-faq__q {
    cursor: pointer;
    padding: 16px 22px;
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--ink);
    list-style: none;
    position: relative;
    padding-right: 48px;
}
.post-faq__q::-webkit-details-marker { display: none; }
.post-faq__q::after {
    content: "+";
    position: absolute; right: 22px; top: 50%;
    transform: translateY(-50%);
    font-size: 1.4rem; color: var(--muted);
    transition: transform .2s var(--ease), color .2s;
}
.post-faq__item[open] .post-faq__q::after { content: "−"; color: var(--tech-blue); }
.post-faq__a {
    padding: 0 22px 18px;
    color: var(--ink-soft);
    font-size: 1rem;
    line-height: 1.8;
}
.post-faq__a p { margin: 0 0 .8em; }
.post-faq__a p:last-child { margin-bottom: 0; }

/* ---------- References ---------- */
.post-references {
    margin-top: 60px;
    padding-top: 40px;
    border-top: 1px solid var(--line);
}
.post-references__title {
    margin: 0 0 20px;
    font-size: 1.5rem;
    font-weight: 600;
}
.post-references__list {
    margin: 0; padding-left: 1.4em;
    color: var(--ink-soft);
    font-size: 1rem;
    line-height: 1.85;
}
.post-references__item { margin-bottom: 8px; }
.post-references__item a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.post-references__item a:hover { color: var(--tech-blue); text-decoration-color: var(--tech-blue); }
.post-references__src { color: var(--muted); font-size: .9375rem; }

/* ---------- related posts (YARPP) ---------- */
.related-posts {
    padding-top: 50px;
    border-top: 1px solid var(--line);
}
.related-posts__title {
    margin: 0 0 32px;
    font-size: 1.5rem;
    font-weight: 600;
}
/* 隱藏 YARPP 預設殘留樣式 */
.yarpp-related > p { display: none; }

/* ---------- comments ---------- */
.comments-area {
    max-width: 100%; margin: 70px auto 0;
    padding: 0; background: transparent; border: 0;
}
.comments-title {
    font-size: 1.4rem; font-weight: 600;
    margin-bottom: 30px;
}
.comment-list { list-style: none; padding: 0; margin: 0 0 40px; }
.comment-body { padding: 20px 0; border-bottom: 1px solid var(--line); }
.comment-author img { border-radius: 50%; margin-right: 12px; vertical-align: middle; }
.comment-metadata { font-size: .875rem; color: var(--muted); letter-spacing: .1em; }

.comment-form label { display: block; font-size: .875rem; color: var(--muted); letter-spacing: .1em; margin-bottom: 6px; }
.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
    width: 100%; padding: 12px 14px;
    border: 1px solid var(--line); background: var(--card);
    border-radius: var(--radius); font: inherit;
    transition: border-color .2s;
}
.comment-form input:focus, .comment-form textarea:focus { outline: none; border-color: var(--ink); }
.comment-form textarea { min-height: 140px; resize: vertical; }
.form-submit .submit {
    background: var(--ink); color: #fff; border: 0;
    padding: 12px 28px;
    border-radius: 999px; cursor: pointer;
    font-size: 1rem; letter-spacing: .12em; font-weight: 600;
    transition: background .2s, transform .2s var(--ease);
}
.form-submit .submit:hover { background: var(--accent); transform: translateY(-1px); }

/* ---------- page header (archive/search) ---------- */
.page-header {
    text-align: center;
    padding: 10px 0 40px;
    margin: 0 auto 50px;
    max-width: 100%;
    border-bottom: 1px solid var(--line);
    background: transparent;
}
.page-header .page-title {
    font-size: clamp(1.6rem, 3vw, 2.2rem); margin: 0; font-weight: 600;
}
.search .page-header .page-title span { color: var(--accent); }
.archive-description { color: var(--muted); margin-top: 10px; }

/* ---------- footer ---------- */
.site-footer {
    background: var(--ink);
    margin-top: 80px;
    padding: 28px;
    text-align: center;
}
.site-footer__copy {
    margin: 0;
    font-size: .875rem; letter-spacing: .08em;
    color: rgba(255,255,255,.45);
}
.site-footer__copy a { color: rgba(255,255,255,.7); }
.site-footer__copy a:hover { color: #66CCFF; }

/* ---------- privacy policy ---------- */
.privacy-wrap {
    max-width: 780px; margin: 0 auto; padding: 60px 28px 100px;
}
.privacy-header { text-align: center; margin-bottom: 56px; }
.privacy-header h1 { font-size: clamp(1.8rem, 3vw, 2.4rem); margin: 0 0 12px; }
.privacy-updated { color: var(--muted); font-size: .875rem; letter-spacing: .1em; margin: 0; }
.privacy-body section { margin-bottom: 44px; }
.privacy-body h2 {
    font-size: 1.2rem; font-weight: 600; margin: 0 0 14px;
    padding-bottom: 10px; border-bottom: 1px solid var(--line);
}
.privacy-body p, .privacy-body li { color: var(--ink-soft); line-height: 1.9; }
.privacy-body ul { padding-left: 1.4em; margin: 10px 0; }
.privacy-body li { margin-bottom: .5em; }

/* ---------- 404 / no results ---------- */
.error-404, .no-results {
    text-align: center; max-width: 560px; margin: 60px auto;
    padding: 60px 28px;
}
.error-404 .page-title, .no-results .page-title {
    font-size: clamp(1.6rem, 3vw, 2rem); margin: 0 0 12px; font-weight: 600;
}
.error-404 .page-content > p, .no-results .page-content > p {
    color: var(--muted); margin: 0 0 32px; font-size: 1rem;
}
.error-404 .search-form, .no-results .search-form {
    display: flex; align-items: center;
    border: 1px solid var(--line); border-radius: 999px;
    overflow: hidden; background: var(--card);
    transition: border-color .2s;
}
.error-404 .search-form:focus-within, .no-results .search-form:focus-within {
    border-color: var(--tech-blue);
}
.error-404 .search-form label, .no-results .search-form label { flex: 1; }
.error-404 .search-field, .no-results .search-field {
    width: 100%; padding: 13px 20px;
    border: 0; background: transparent; font: inherit; font-size: 1rem;
    outline: none;
}
.error-404 .search-submit, .no-results .search-submit {
    flex-shrink: 0;
    padding: 13px 24px;
    background: var(--ink); color: #fff; border: 0;
    font: inherit; font-size: .9375rem; font-weight: 600;
    cursor: pointer; letter-spacing: .06em;
    transition: background .2s;
}
.error-404 .search-submit:hover, .no-results .search-submit:hover {
    background: var(--tech-blue);
}

/* ---------- hero (full-bleed) ---------- */
.hero-full {
    width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
}

/* ---------- responsive ---------- */
@media (max-width: 1024px) {
    .post-list { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
    .site-content { padding: 44px 0 60px; }
    .menu-toggle { display: block; }
    .main-navigation #primary-menu {
        display: none;
        position: absolute; top: 100%; left: 0; right: 0;
        flex-direction: column;
        background: var(--paper);
        border-top: 1px solid var(--line);
        padding: 14px 28px 24px;
        box-shadow: 0 20px 40px rgba(0,0,0,.06);
    }
    .main-navigation.toggled #primary-menu { display: flex; }
    .main-navigation #primary-menu li { border-bottom: 1px solid var(--line); }
    .main-navigation #primary-menu li:last-child { border-bottom: 0; }
    .main-navigation #primary-menu a { padding: 12px 0; margin: 0; }
    .header-search { display: none; }
    .site-header__inner { position: relative; padding: 16px 20px; }

    .post-list { grid-template-columns: 1fr; gap: 20px; }

    .post-navigation { grid-template-columns: 1fr; }
    .post-navigation .nav-next { text-align: left; }
}
