:root {
    --color-main: #1f2937;
    --color-accent: #2563eb;
    --color-text: #222222;
    --color-bg: #ffffff;
    --color-border: #e5e7eb;
    --footer-bg: #111827;
    --content-width: 1200px;
    --content-padding: 24px;
    --font-size-base: 16px;
    --header-height: 80px;
    --header-logo-width: 180px;
    --header-logo-width-sp: 140px;
    --border-radius: 8px;
    --button-radius: 8px;
}

html {
    font-size: var(--font-size-base);
}

body {
    background: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-family, "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif);
    line-height: 1.8;
}

.l-container {
    width: min(calc(100% - (var(--content-padding) * 2)), var(--content-width));
    margin-inline: auto;
}

.l-header {
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg);
}

.l-header__inner {
    min-height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
}

.l-header__logo .custom-logo-link {
    display: block;
}

.l-header__logo .custom-logo {
    width: var(--header-logo-width);
    height: auto;
}

.l-header__site-name {
    font-size: 1.25rem;
    font-weight: 700;
}

.l-header__menu,
.l-footer__menu {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    list-style: none;
}

.l-main {
    min-height: 60vh;
}

.l-footer {
    padding-block: 40px;
    background: var(--footer-bg);
    color: #fff;
}

.l-footer__inner {
    display: grid;
    gap: 24px;
}

.c-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 10px 20px;
    border-radius: var(--button-radius, 8px);
    background: var(--color-main);
    color: #fff;
}

.c-button:hover {
    background: var(--color-accent);
}

.c-entry,
.p-archive,
.p-single,
.p-page,
.p-404,
.p-front-content {
    padding-block: 64px;
}

.c-entry__title,
.p-archive__title,
.p-404__title {
    margin-bottom: 24px;
    line-height: 1.4;
}

.c-entry__content > * + * {
    margin-top: 1.5em;
}

.c-post-card {
    display: grid;
    grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
    gap: 32px;
    padding-block: 32px;
    border-bottom: 1px solid var(--color-border);
}

.c-post-card__thumbnail img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: var(--border-radius);
}

.c-post-card__date,
.c-entry__meta {
    color: #6b7280;
    font-size: .875rem;
}

.c-post-card__title {
    margin-top: 8px;
    font-size: 1.25rem;
    line-height: 1.5;
}

.c-post-card__excerpt {
    margin-top: 12px;
}

@media (max-width: 768px) {
    :root {
        --content-padding: 20px;
    }

    .l-header__inner {
        min-height: 64px;
    }

    .l-header__logo .custom-logo {
        width: var(--header-logo-width-sp);
    }

    .l-header__nav {
        display: none;
    }

    .c-post-card {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

/* Content settings */
.c-entry { max-width: var(--article-width, 900px); margin-inline: auto; }
.c-entry__featured { margin: 0 0 28px; }
.c-entry__featured img { width: 100%; height: auto; display: block; }
.c-entry__featured--full { width: min(var(--content-width), calc(100vw - 2 * var(--content-padding))); max-width: none; position: relative; left: 50%; transform: translateX(-50%); }
.km-breadcrumb { padding-top: 22px; font-size: .85rem; }
.km-breadcrumb ol { display: flex; flex-wrap: wrap; gap: .5em; list-style: none; margin: 0; padding: 0; }
.km-breadcrumb li + li::before { content: ">"; margin-right: .5em; }
.km-breadcrumb li:first-child a, .woocommerce .woocommerce-breadcrumb a:first-of-type, .woocommerce-page .woocommerce-breadcrumb a:first-of-type { display: inline-flex; align-items: center; gap: .4em; }
.km-breadcrumb li:first-child a::before, .woocommerce .woocommerce-breadcrumb a:first-of-type::before, .woocommerce-page .woocommerce-breadcrumb a:first-of-type::before {
    content: ''; display: inline-block; width: 1em; height: 1em; flex: none; background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3 10 9-7 9 7v10a1 1 0 0 1-1 1h-5v-7H9v7H4a1 1 0 0 1-1-1V10Z'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3 10 9-7 9 7v10a1 1 0 0 1-1 1h-5v-7H9v7H4a1 1 0 0 1-1-1V10Z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.km-related { max-width: var(--article-width, 900px); margin: 0 auto 64px; }
.km-related__grid .c-post-card { grid-template-columns: minmax(0, 180px) minmax(0, 1fr); }
@media (max-width: 768px) { .km-related__grid .c-post-card { grid-template-columns: 1fr; } }

/* General and content panels */
.km-button-hover-lift .c-button:hover { transform: translateY(-3px); }
.km-button-hover-fade .c-button:hover { opacity: .78; }
.c-button { transition: transform .2s ease, opacity .2s ease, background-color .2s ease; }
/* WordPress のボタンブロック。WooCommerce ボタンは対象から外す。 */
.km-standard-button { transition: transform .2s ease, opacity .2s ease, background-color .2s ease, color .2s ease !important; }
.km-button-hover-lift .km-standard-button:hover { transform: translateY(-3px) !important; }
.km-button-hover-fade .km-standard-button:hover { opacity: .65 !important; }
.km-button-hover-invert .km-standard-button:not(.km-standard-button--outline) {
    border: 1px solid var(--km-button-original-bg, var(--color-main)) !important;
}
.km-button-hover-invert .km-standard-button:not(.km-standard-button--outline):hover {
    background: var(--km-button-original-color, #fff) !important;
    color: var(--km-button-original-bg, var(--color-main)) !important;
    border-color: var(--km-button-original-bg, var(--color-main)) !important;
}
.km-button-hover-invert .km-standard-button--outline:hover {
    background: var(--km-button-original-color) !important;
    color: var(--km-button-original-bg) !important;
    border-color: var(--km-button-original-color) !important;
    filter: none !important;
}
/* ブロックの色指定が強い場合や動的に追加されたボタンへのフォールバック。 */
.km-button-hover-invert .wp-block-button__link:hover:not(.km-standard-button--swapped) { filter: invert(1) !important; }
.km-button-hover-invert .c-button:hover:not(.km-standard-button--swapped) {
    background: #fff !important; color: var(--color-main) !important;
    border: 1px solid var(--color-main) !important;
}
.km-button-hover-invert .wc-block-grid__product-add-to-cart .wp-block-button__link:hover,
.km-button-hover-invert .wc-block-components-product-button .wp-block-button__link:hover { filter: none !important; }
@media (prefers-reduced-motion: reduce) {
    .km-standard-button { transition: none !important; }
    .km-button-hover-lift .km-standard-button:hover { transform: none !important; }
}
.km-no-animation .c-button, .km-no-animation .l-header, .km-no-animation .l-footer { animation: none !important; transition: none !important; }
.km-title-narrow .c-entry__title { max-width: 720px; margin-inline: auto; }
.km-title-full .c-entry__title { width: min(var(--content-width), calc(100vw - 2 * var(--content-padding))); max-width: none; position: relative; left: 50%; transform: translateX(-50%); }
.km-body-narrow .c-entry__content { max-width: 720px; margin-inline: auto; }
.km-body-border .c-entry__content { border: 1px solid var(--color-border); padding: clamp(20px, 4vw, 48px); }
/* 記事・固定ページ・トップページ本文の見出しブロックのみ。 */
.km-heading-h1-underline .p-front-content h1.wp-block-heading,
.km-heading-h2-underline .c-entry__content h2.wp-block-heading,
.km-heading-h2-underline .p-front-content h2.wp-block-heading,
.km-heading-h3-underline .c-entry__content h3.wp-block-heading,
.km-heading-h3-underline .p-front-content h3.wp-block-heading,
.km-heading-h4-underline .c-entry__content h4.wp-block-heading,
.km-heading-h4-underline .p-front-content h4.wp-block-heading,
.km-heading-h5-underline .c-entry__content h5.wp-block-heading,
.km-heading-h5-underline .p-front-content h5.wp-block-heading { border-bottom: 1px solid #a1a1aa; padding-bottom: .12em; }
.km-heading-h1-leftbar .p-front-content h1.wp-block-heading,
.km-heading-h2-leftbar .c-entry__content h2.wp-block-heading,
.km-heading-h2-leftbar .p-front-content h2.wp-block-heading,
.km-heading-h3-leftbar .c-entry__content h3.wp-block-heading,
.km-heading-h3-leftbar .p-front-content h3.wp-block-heading,
.km-heading-h4-leftbar .c-entry__content h4.wp-block-heading,
.km-heading-h4-leftbar .p-front-content h4.wp-block-heading,
.km-heading-h5-leftbar .c-entry__content h5.wp-block-heading,
.km-heading-h5-leftbar .p-front-content h5.wp-block-heading { position: relative; border-left: 0; padding-left: .8em; }
.km-heading-h1-leftbar .p-front-content h1.wp-block-heading::before,
.km-heading-h2-leftbar .c-entry__content h2.wp-block-heading::before,
.km-heading-h2-leftbar .p-front-content h2.wp-block-heading::before,
.km-heading-h3-leftbar .c-entry__content h3.wp-block-heading::before,
.km-heading-h3-leftbar .p-front-content h3.wp-block-heading::before,
.km-heading-h4-leftbar .c-entry__content h4.wp-block-heading::before,
.km-heading-h4-leftbar .p-front-content h4.wp-block-heading::before,
.km-heading-h5-leftbar .c-entry__content h5.wp-block-heading::before,
.km-heading-h5-leftbar .p-front-content h5.wp-block-heading::before { content: ""; position: absolute; top: .52em; left: 0; width: 6px; height: .9em; background: #a1a1aa; }
.km-heading-h1-band .p-front-content h1.wp-block-heading,
.km-heading-h2-band .c-entry__content h2.wp-block-heading,
.km-heading-h2-band .p-front-content h2.wp-block-heading,
.km-heading-h3-band .c-entry__content h3.wp-block-heading,
.km-heading-h3-band .p-front-content h3.wp-block-heading,
.km-heading-h4-band .c-entry__content h4.wp-block-heading,
.km-heading-h4-band .p-front-content h4.wp-block-heading,
.km-heading-h5-band .c-entry__content h5.wp-block-heading,
.km-heading-h5-band .p-front-content h5.wp-block-heading { background: #f7f7f8; border-radius: var(--border-radius); padding: .45em .7em; }
.km-heading-h1-accent .p-front-content h1.wp-block-heading,
.km-heading-h2-accent .c-entry__content h2.wp-block-heading,
.km-heading-h2-accent .p-front-content h2.wp-block-heading,
.km-heading-h3-accent .c-entry__content h3.wp-block-heading,
.km-heading-h3-accent .p-front-content h3.wp-block-heading,
.km-heading-h4-accent .c-entry__content h4.wp-block-heading,
.km-heading-h4-accent .p-front-content h4.wp-block-heading,
.km-heading-h5-accent .c-entry__content h5.wp-block-heading,
.km-heading-h5-accent .p-front-content h5.wp-block-heading { position: relative; padding-bottom: .2em; }
.km-heading-h1-accent .p-front-content h1.wp-block-heading::after,
.km-heading-h2-accent .c-entry__content h2.wp-block-heading::after,
.km-heading-h2-accent .p-front-content h2.wp-block-heading::after,
.km-heading-h3-accent .c-entry__content h3.wp-block-heading::after,
.km-heading-h3-accent .p-front-content h3.wp-block-heading::after,
.km-heading-h4-accent .c-entry__content h4.wp-block-heading::after,
.km-heading-h4-accent .p-front-content h4.wp-block-heading::after,
.km-heading-h5-accent .c-entry__content h5.wp-block-heading::after,
.km-heading-h5-accent .p-front-content h5.wp-block-heading::after { content: ""; position: absolute; bottom: 0; left: 0; width: 2.5em; max-width: 100%; height: 3px; background: #a1a1aa; }
.km-toc { border: 1px solid var(--color-border); padding: 20px; margin-bottom: 30px; }
.km-toc ol { margin: 8px 0 0; padding-left: 1.5em; }
.km-toc__h3 { margin-left: 1em; }
.km-toc__h4 { margin-left: 2em; }
.km-share, .km-follow { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-block: 24px; }
.km-share a, .km-follow a { display: inline-block; border: 1px solid var(--color-border); border-radius: var(--button-radius); padding: 5px 15px; }
.km-follow h2 { width: 100%; font-size: 1.15rem; }
.km-author { border-top: 1px solid var(--color-border); padding-top: 24px; margin-top: 36px; }
.km-author h2 { font-size: 1.15rem; }
.km-author .avatar { display: inline-block; border-radius: 50%; margin: 12px 14px 0 0; vertical-align: middle; }
.km-author p { margin-top: 12px; }
.km-related--cols-2 .km-related__grid, .km-related--cols-3 .km-related__grid { display: grid; gap: 20px; }
.km-related--cols-2 .km-related__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.km-related--cols-3 .km-related__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.km-related--cols-2 .c-post-card, .km-related--cols-3 .c-post-card { display: block; }
@media (max-width: 768px) { .km-related--cols-2 .km-related__grid, .km-related--cols-3 .km-related__grid { grid-template-columns: 1fr; } }
.km-no-animation .p-front-hero__slide, .km-no-animation .l-header__drawer, .km-no-animation .l-footer-fixed { transition: none !important; }

/* The static front page uses the site width while full-width blocks stay full bleed. */
.p-front-content > :not(.alignfull) {
    width: min(calc(100% - (var(--content-padding) * 2)), var(--content-width));
    margin-inline: auto;
}

/* Fluid content media and readable narrow-screen text. */
.c-entry__content :is(img, video, iframe, embed), .p-front-content :is(img, video, iframe, embed) { max-width: 100%; }
.c-entry__content :is(pre, table) { max-width: 100%; }
.c-entry__content pre { overflow-x: auto; }
@media (max-width: 768px) {
    .c-entry, .p-archive, .p-single, .p-page, .p-404, .p-front-content { padding-block: 36px; }
    .c-entry__title, .p-archive__title, .p-404__title, .c-entry__content { overflow-wrap: anywhere; }
    .c-entry__content table { display: block; overflow-x: auto; }
}

/* Customizable editorial text links; excludes buttons, menus, and product cards. */
:is(.c-entry__content, .wp-block-post-content, .entry-content) a:not(.button):not(.wp-block-button__link):not(.wp-element-button):not(.components-button):not([class*="km-wc-card"]):not(.wp-block-navigation-item__content) {
    color: var(--km-link-color, #2563eb);
    text-decoration-line: var(--km-link-underline, none);
    transition: color .2s ease;
}
:is(.c-entry__content, .wp-block-post-content, .entry-content) a:not(.button):not(.wp-block-button__link):not(.wp-element-button):not(.components-button):not([class*="km-wc-card"]):not(.wp-block-navigation-item__content):is(:hover, :focus-visible) {
    color: var(--km-link-hover-color, #1d4ed8);
    text-decoration-line: var(--km-link-hover-underline, underline);
}
