:root {
    --bg-color: #fff;
    --theme-color: #007b43;

    --primary-text: #2b2b2b;
    --theme-text: #fff;

    --stack-foreground: 1;
    --stack-background: -1;

    --header-height: 0px;
    --scroll-margin: var(--header-height);
}

:where(html) {
    font-size: 100%;
    interpolate-size: allow-keywords;
}

@media (prefers-reduced-motion: no-preference) {
    :where(html) {
        scroll-behavior: smooth;
    }
}

:where(body) {
    background-color: #f8fbf8;
    color: var(--primary-text);
    font-family: "Helvetica Neue", Arial, "Hiragino KakuGothic ProN", "Hiragino Sans", Meiryo, sans-serif;
    font-size: 1.125rem;
    min-height: 100vh;
}

:where(header a),
:where(footer a) {
    color: inherit;
    text-decoration: none;
}

[id], :focus {
    scroll-margin-block-start: var(--scroll-margin);
}

:where(time) {
    color: #999;
}

:where(.visually-hidden) {
    border: 0 !important;
    clip-path: inset(50%) !important;
    height: 1px !important;
    margin: 0 !important;
    opacity: 0 !important;
    overflow: hidden !important;
    padding: 0 !important;
    pointer-events: none !important;
    position: absolute !important;
    visibility: visible !important;
    white-space: nowrap !important;
    width: 1px !important;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after,
    *::backdrop {
        animation-delay: unset !important;
        animation-duration: 1ms !important;
        animation-iteration-count: unset !important;
        background-attachment: unset !important;
        scroll-behavior: unset !important;
        transition-delay: unset !important;
        transition-duration: 1ms !important;
        view-transition-name: none !important;
    }
}.button {
    display: grid;
    min-inline-size: fit-content;
    overflow: hidden;
    place-content: center;
    position: relative;
    z-index: var(--stack-foreground);

    &::after {
        content: "";
        display: block;
        height: 100%;
        left: -100%;
        position: absolute;
        top: 0;
        transition-duration: 0.8s;
        transition-property: left;
        width: 100%;
        z-index: var(--stack-background);
    }
}

/* サイズ */
.button.large {
    border: 1px solid;
    padding-block: 1.5em;
    padding-inline: 1em;
}

/* 色 */
.button.theme-color {
    background-color: var(--theme-color);
    color: var(--theme-text);

    &::after {
        background-color: #000;
    }

    &:focus-visible {
        outline: none;

        &::after {
            left: 100%;
        }
    }

    @media (any-hover: hover) {
        &:hover {
            &::after {
                left: 100%;
            }
        }
    }
}

.icon {
    border-radius: 2px;
    height: 2px;
    inset: 0;
    margin: auto;
    position: absolute;
    width: 24px;

    &::before,
    &::after {
        border-radius: 2px;
        content: "";
        display: block;
        height: 100%;
        position: absolute;
        width: 100%;
    }
}

.hamburger {
    background-color: currentColor;

    &:has( + .label) {
        top: -12px;
    }

    &::before,
    &::after {
        background-color: currentColor;
    }

    &::before {
        top: -8px;
    }

    &::after {
        top: 8px;
    }
}

.cancel {
    background-color: transparent;

    &::before,
    &::after {
        background-color: currentColor;
        top: 0;
    }

    &::before {
        rotate: 45deg;
    }

    &::after {
        rotate: -45deg;
    }
}.wrapper {
    margin-block-start: calc(var(--header-height) + 2rem);
    margin-block-end: 2rem;
}

.page-contents {
    background-color: var(--bg-color);
    border-radius: 32px;
    display: grid;
    margin-inline: 2%;
    padding-block: 2rem;
    padding-inline: 2%;
    row-gap: 2rem;
}

.article-header,
.section-header {
    display: grid;
    justify-content: center;
    margin-inline: auto;
    row-gap: 32px;

    .page-title {
        margin-block: 0;
    }
}

.article-list {
    display: grid;
    row-gap: 32px;
}

@scope (.article-body) {
    h2 {
        background-color: var(--theme-color);
        color: var(--theme-text);
        font-size: 1.5rem;
        margin-block: 4rem;
        overflow: hidden;
        padding: 0.5em;
        position: relative;

        &::before,
        &::after {
            background-color: currentColor;
            content: "";
            display: block;
            height: 1px;
            left: 0;
            position: absolute;
            width: 100%;
        }

        &::before {
            top: 4px;
        }

        &::after {
            bottom: 4px;
        }
    }

    h3 {
        background-color: #f8fbf8;
        border-block-end: 1px solid var(--theme-color);
        border-inline-start: 4px solid var(--theme-color);
        font-weight: normal;
        margin-block: 2.5rem;
        padding-block: 0.25em;
        padding-inline-start: 0.75em;
    }

    p {
        margin-bottom: 16px;
        margin-inline: 2%;
    }

    ul:not(:where(.toc *)),
    ol:not(:where(.toc *)) {
        column-gap: 16px;
        display: grid;
        grid-template-columns: max-content auto;
        margin-block: 2rem;
        margin-inline: 4%;
        row-gap: 8px;
    }

    li {
        align-items: center;
        display: grid;
        grid-column: 1 / -1;
        grid-template-columns: subgrid;
    }

    ul {
        li {
            &::before {
                background-color: var(--theme-color);
                border-radius: 50%;
                content: "";
                height: 0.5em;
                width: 0.5em;
            }
        }
    }

    a:not(:where(.toc *)) {
        color: revert;
        text-decoration: revert;
        text-underline-offset: 0.25em;
    }

    pre {
        border-radius: 16px;
        margin-block: 3rem;
        white-space: pre-wrap;
    }

    code {
        display: block;
        padding-block: 2rem;
        padding-inline: 1rem;
    }
}

.article-footer {
    border-block-start: 1px solid;
    display: grid;
    justify-content: end;
    padding-block-start: 1rem;
    padding-inline: 2%;
    row-gap: 16px;

    time {
        justify-self: end;
    }
}

@media (min-width: 768px) {
    .wrapper {
        margin-block-start: 2rem;
        margin-inline: auto;
        max-inline-size: 900px;

        /* 投稿ページでサイドバーがある場合 */
        &:has(.sidebar) {
            align-items: start;
            column-gap: 16px;
            display: grid;
            grid-template-areas:
                "breadcrumb breadcrumb"
                "main sidebar";
            grid-template-columns: 75% auto;
            
            .sidebar {
                grid-area: sidebar;
            }

            .main-contents {
                grid-area: main;
            }
        }
    }

    .article-header {
        max-inline-size: 80%;
    }
}.global-footer {
    background-color: #000;
    color: #fff;
    position: sticky;
    top: 100%;
}

.footer-contents {
    display: grid;
    padding-block: 3rem;
    padding-inline: 4%;
    row-gap: 2rem;
}

.cta {
    display: grid;
    margin-inline: auto;
    max-inline-size: 80%;
    row-gap: 16px;
    width: 100%;
}

@scope (.footer-contents) {
    .footer-menu {
        border-block-start: 1px solid;
        padding-block-start: 2rem;

        .menu {
            display: flex;
            flex-wrap: wrap;
            font-size: 1rem;
            gap: 8px;
            justify-content: center;

            .menu-item {
                white-space: nowrap;

                a {
                    display: block;
                    padding-block: 0.5rem;

                    &:focus-visible {
                        outline: none;
                        text-decoration: revert;
                        text-underline-offset: 0.25em;
                    }

                    @media (any-hover: hover) {
                        &:hover {
                            text-decoration: revert;
                            text-underline-offset: 0.25em;
                        }
                    }
                }
            }
        }
    }
}

.copyright {
    display: grid;
    justify-content: center;

    small {
        font-size: 14px;
    }
}

@media (min-width: 768px) {
    .cta {
        column-gap: 24px;
        grid-auto-flow: column;
        max-inline-size: 768px;
        row-gap: 24px;
    }
}.global-header {
    align-items: center;
    background-color: var(--bg-color);
    box-shadow: 0 0 8px 6px rgb(0 0 0 / 0.1);
    position: fixed;
    top: 0;
    width: 100%;
    z-index: var(--stack-foreground);
}

.header-contents {
    align-items: center;
    display: grid;
    grid-template-columns: 48px auto 48px;
    padding-block: 16px;
    padding-inline: 4%;
}

.header-logo {
    justify-self: center;
    margin-block: 0;
}

.site-title {
    font-size: 2rem;
    font-weight: bold;
}

@media (min-width: 768px) {
    .global-header {
        position: revert;
    }

    .header-contents {
        grid-template-columns: max-content auto;
        justify-content: space-between;
        margin-inline: auto;
        max-inline-size: 1280px;
    }

    @scope (.header-contents) {
        .main-menu {
            .menu {
                column-gap: 1rem;
                display: flex;
                
                .menu-item {
                    a {
                        display: grid;
                        font-size: 0.875rem;
                        padding: 0.5rem 1rem;
                        position: relative;
                        transition-duration: 0.3s;
                        transition-property: font-size;
                        white-space: nowrap;

                        &::before {
                            content: attr(data-en);
                            font-size: 1.5rem;
                            font-weight: bold;
                            transition-duration: 0.3s;
                            transition-property: scale;
                        }

                        &::after {
                            background-color: currentColor;
                            bottom: 0;
                            content: "";
                            display: block;
                            height: 1px;
                            left: 0;
                            position: absolute;
                            scale: 0 1;
                            transition-duration: 0.3s;
                            transition-property: scale;
                            width: 100%;
                        }

                        &:focus-visible {
                            outline: none;

                            &::after {
                                scale: 1;   
                            }
                        }

                        @media (any-hover: hover) {
                            &:hover {
                                &::after {
                                    scale: 1;
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}.sidebar {
    display: none;
}

@media (min-width: 768px) {
    .sidebar {
        display: revert;
        position: sticky;
        top: 2rem;;
    }
}.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    font-size: 1rem;
    gap: 16px;
    grid-area: breadcrumb;
    margin-block: 2rem;
    padding-inline: 2%;

    li {
        position: relative;

        &:not(:last-of-type) {
            &::after {
                background-color: currentColor;
                content: "";
                display: block;
                height: 100%;
                position: absolute;
                right: -8px;
                top: 0;
                transform: skew(-20deg);
                width: 1px;
            }
        }

        a {
            color: revert;
            display: block;
            text-decoration: revert;
            text-underline-offset: 0.25em;
        }
    }
}

@media (min-width: 768px) {
    .breadcrumb {
        margin-block-start: 0;
    }
}.card {
    border-radius: 32px;
    box-shadow: 0 4px 6px 6px rgb(0 0 0 / 0.1);
    overflow: hidden;

    a {
        align-items: center;
        display: grid;
        gap: 8px;
        grid-template-areas:
            "thumbnail title"
            "text text";
        grid-template-columns: 30% 1fr;
        padding: 8px;
    }
}

.card-title {
    font-size: 1.5rem;
    grid-area: title;
}

.card-thumbnail {
    aspect-ratio: 1 / 1;
    background-color: var(--theme-color);
    border-radius: 24px;
    grid-area: thumbnail;
    overflow: hidden;

    img {
        aspect-ratio: 1 / 1;
        object-fit: contain;
        height: auto;
        width: 100%;
    }
}

.card-text {
    border-block-start: 1px solid;
    grid-area: text;
    font-size: 1rem;
    padding-block: 1rem;
    padding-inline: 2%;
}

@media (min-width: 768px) {
    .card {
        a {
            grid-template-areas:
                "thumbnail title"
                "thumbnail text";
        }
    }
}.menu-drawer {
    height: 100vh;
    margin-block: 0;
    margin-inline: 0;
    overflow: hidden;
    padding-block: 16px;
    padding-inline: 4%;
    transition-behavior: allow-discrete;
    transition-duration: 0.3s;
    transition-property: display, translate;
    translate: -100% 0;
    width: 80vw;

    &[open] {
        display: grid;
        grid-template-rows: max-content auto;
        translate: 0;
        row-gap: 16px;

        @starting-style {
            translate: -100% 0;
        }
    }

    &::backdrop {
        background-color: rgb(0 0 0 / 0.3);
        opacity: 0;
        transition-behavior: allow-discrete;
        transition-duration: 0.3s;
        transition-property: display, opacity;
    }

    &[open]::backdrop {
        opacity: 1;

        @starting-style {
            opacity: 0;
        }
    }
}

/* OPEN・CLOSEボタン */
.open-drawer,
.close-drawer {
    appearance: none;
    border: 0;
    border-radius: 4px;
    height: 48px;
    position: relative;
    transition-duration: 0.3s;
    transition-property: background-color, color;
    width: 48px;

    &:focus-visible {
        background-color: var(--theme-color);
        color: var(--theme-text);
        outline: none;
    }

    @media (any-hover: hover) {
        &:hover {
            background-color: var(--theme-color);
            color: var(--theme-text);
        }
    }
}

.open-drawer {
    display: grid;
    justify-items: center;

    .label {
        bottom: 0;
        font-size: 12px;
        position: absolute;
    }
}

.drawer-inner {
    display: grid;
    grid-template-rows: max-content auto; 
    row-gap: 32px;
}

@scope (.drawer-inner) {
    .main-menu {
        .menu {
            border-block-start: 1px solid;
            
            .menu-item {
                border-block-end: 1px solid;

                a {
                    align-items: center;
                    column-gap: 8px;
                    display: grid;
                    font-size: 0.875rem;
                    grid-template-areas:
                        "en icon"
                        ". icon";
                    grid-template-columns: auto max-content;
                    padding-block: 1em;
                    padding-inline: 32px 16px;
                    position: relative;
                    transition-duration: 0.3s;
                    transition-property: background-color;
                    
                    &::before {
                        content: attr(data-en);
                        font-size: 1.5rem;
                        font-weight: bold;
                        grid-area: en;
                    }

                    &::after {
                        background-color: var(--theme-color);
                        clip-path: polygon(20% 25%, 40% 25%, 75% 50%, 40% 75%, 20% 75%, 55% 50%);
                        content: "";
                        grid-area: icon;
                        height: 32px;
                        transition-duration: 0.3s;
                        transition-property: translate;
                        width: 16px;
                    }

                    &:focus-visible {
                        background-color: #f8fbf8;
                        outline: none;

                        &::after {
                            translate: 8px 0;
                        }
                    }

                    @media (any-hover: hover) {
                        &:hover {
                            background-color: #f8fbf8;

                            &::after {
                                translate: 8px 0;
                            }
                        }
                    }
                }
            }
        }
    }
}

/* PCではNENUボタンを非表示にする */
@media (min-width: 768px) {
    .open-drawer {
        display: none;
    }
}

/* 背面のスクロールを制御する */
:root:has(dialog[open]) {
    overflow: hidden;
    scrollbar-gutter: stable;
}.hero {
    aspect-ratio: 1 / 1;
    display: grid;
    height: auto;
    margin-block-end: 2rem;
    place-content: center;
    width: 100%;

    p {
        animation: fade-in-from-bottom 1.2s ease-in-out forwards;
    }
}

@media (min-width: 768px) {
    .hero {
        aspect-ratio: unset;
        height: calc(100vh - var(--header-height) - 2rem);
    }
}

@keyframes fade-in-from-bottom {
    from {
        opacity: 0;
        translate: 0 100%;
    }

    to {
        opacity: 1;
        translate: 0;
    }
}.news {
    background-color: #d6e9ca;
    border-radius: 32px;
    display: grid;
    margin-inline: 2%;
    outline: 1px solid #fff;
    outline-offset: -4px;
    padding-block: 2%;
    padding-inline: 4%;
}

.news-item {
    display: grid;
    padding-block: 16px;
    row-gap: 4px;

    &:not(:last-of-type) {
        border-block-end: 2px dashed #999;
    }
}

@media (min-width: 768px) {
    .news {
        column-gap: 16px;
        grid-template-columns: max-content auto;
        margin-inline: 0;
    }

    .news-item {
        align-items: center;
        grid-column: 1 / -1;
        grid-template-columns: subgrid;
    }
}.profile-image {
    margin-inline: 16%;

    img {
        border-radius: 50%;
        width: 100%;
    }
}

@media (min-width: 768px) {
    .profile-image {
        margin-inline: auto;
        width: 400px;
    }
}.skip-link {
    left: 4px;
    position: fixed;
    top: 4px;
    z-index: 10;

    &:not(:focus-within) {
        block-size: 1px;
        inline-size: 1px;
        opacity: 0;
        overflow: clip;
        pointer-events: none;
    }

    a {
        align-items: center;
        background-color: var(--theme-color);
        border-radius: 4px;
        color: var(--theme-text);
        column-gap: 8px;
        display: grid;
        grid-template-columns: auto 16px;
        padding: 0.5rem 1rem;

        &::after {
            background-color: currentColor;
            clip-path: polygon(20% 25%, 40% 25%, 75% 50%, 40% 75%, 20% 75%, 55% 50%);
            content: "";
            height: 100%;
            width: 16px;
        }

        &:focus-visible {
            outline: none;
        }
    }
}.social-links {
    --icon-x: url("/images/social/x.svg");
    --icon-instagram: url("/images/social/instagram.svg");
    --icon-github: url("/images/social/github.svg");

    column-gap: 16px;
    display: grid;
    grid-auto-flow: column;
    justify-content: center;

    a {
        border-radius: 8px;
        display: grid;
        padding: 12px;
        transition-duration: 0.3s;
        transition-property: background-color, color;
        width: 48px;

        &::before {
            aspect-ratio: 1;
            background-color: currentColor;
            content: "";
            display: block;
            height: auto;
            mask: var(--icon) no-repeat center / contain;
            width: 100%;
        }

        &:focus-visible {
            background-color: var(--theme-color);
            color: var(--theme-text);
            outline: none;
        }

        @media (any-hover: hover) {
            &:hover {
                background-color: var(--theme-color);
                color: var(--theme-text);
            }
        }
    }
}.categories,
.tags {
    display: grid;
    gap: 16px;
    grid-auto-flow: column;
    justify-content: center;
}

.categories {
    a {
        background-color: var(--theme-color);
        color: var(--theme-text);
        border-radius: 16px;
        display: block;
        outline: 1px solid;
        outline-offset: -2px;
        padding-block: 0.5rem;
        padding-inline: 1.5rem;
    }
}

.tags {
    a {
        color: revert;
        column-gap: 4px;
        display: grid;
        grid-auto-flow: column;
        padding-block: 0.25rem;
        position: relative;

        &::before {
            content: "#";
        }

        &::after {
            background-color: currentColor;
            bottom: 0.125em;
            content: "";
            display: block;
            height: 1px;
            left: 0;
            position: absolute;
            width: 100%;
        }
    }
}.toc {
    &.sp-only {
        margin-block: 3rem;
    }
}

.toc-list:where(.sp-only *) {
    background-color: #f8fbf8;
}

.toc-list:where(.sidebar *) {
    background-color: var(--bg-color);
}

.toc-list {
    border: 2px solid var(--theme-color);
    border-radius: 32px;
    display: block;
    padding-block: 2rem;
    padding-inline: 1rem;

    .list-item {
        padding-inline-start: 1rem;
        position: relative;

        &::before {
            background-color: var(--theme-color);
            border-radius: 50%;
            content: "";
            display: block;
            height: 8px;
            left: 0;
            outline: 1px solid var(--theme-color);
            position: absolute;
            top: 1em;
            transition-duration: 0.3s;
            transition-property: outline-offset;
            translate: 0 -50%;
            width: 8px;
        }

        &:not(:last-of-type) {
            &::after {
                background-color: var(--theme-color);
                content: "";
                display: block;
                height: 100%;
                left: 4px;
                position: absolute;
                top: calc(1em + 4px);
                width: 1px;
            }
        }

        &:has(a[aria-current]) {
            &::before {
                outline-offset: 2px;
            }
        }

        a {
            display: block;
            padding-block: 0.25em;
        }
    }
}

.toc-sublist {
    .list-item {
        border-block-end: 1px dashed var(--theme-color);

        &::before {
            content: revert;
        }

        &:not(:last-of-type) {
            &::after {
                content: revert;
            }
        }
    }
}

/* サイドバー内の目次 */
.sidebar {
    .toc {
        font-size: 1rem;
    }

    .toc-sublist {
        margin-inline: 0;
    }
}.pc-only {
    display: none;
}

@media (min-width: 768px) {
    .sp-only {
        display: none;
    }

    .pc-only {
        display: revert;
    }
}