/*
Theme Name: 算理塾テーマ
Author: Megumi Odajma
Version: 1.0
*/

:root {
    --theme-color: #336699;
    --title-color: #264766;
    --pale-color: #99b8ff;
    --pale-color-transparent: rgb(153, 184, 255, 0.6);
    --line-color: linear-gradient(to right, #66cc99 30%, #3366cc 70%);
    ---kv-bg: linear-gradient(135deg, rgba(102, 170, 255, 0.3), rgba(204, 221, 238, 0.3));
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Noto Sans JP', sans-serif;
    line-height: 1.8;
    letter-spacing: 0.05em;
    color: #333;
}

ul li::marker {
    content: none;
}

ul,
ul li {
    list-style: none;
}

img.aligncenter {
    display: block;
    margin-inline: auto;
    margin-block: 1em;
}

.gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
}

.gallery-item {
    width: calc(50% - 0.5rem);
    box-sizing: border-box;
}

.gallery-item img {
    width: 100%;
    height: auto;
    display: block;
}

@media screen and (max-width: 768px) {
    .gallery {
        flex-direction: column;
        align-items: center;
    }

    .gallery-item {
        width: 100% !important;
        max-width: 100% !important;
    }
}

.sp {
    display: none;
}

@media screen and (max-width: 768px) {
    .sp {
        display: inline;
    }
}

header {
    background: rgba(204, 223, 255, 0.8);
    color: white;
    padding: 0.6rem 1rem;
    position: absolute;
    top: 0;
    z-index: 1000;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}

header h1 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.8rem;
    letter-spacing: 0.1em;
}

.logo {
    height: 50px;
}

header h1 a {
    color: inherit;
    text-decoration: none;
}

header h1 a:hover {
    opacity: 0.8;
}

.nav-toggle {
    display: none;
}

.nav-toggle-label {
    display: none;
    cursor: pointer;
    width: 36px;
    height: 24px;
    position: relative;
}

.nav-toggle-label span {
    display: block;
    height: 3px;
    width: 100%;
    background: #336699;
    border-radius: 2px;
    position: absolute;
    left: 0;
    transition: 0.3s ease;
}

.nav-toggle-label span:nth-child(1) {
    top: 0;
}

.nav-toggle-label span:nth-child(2) {
    top: 9px;
}

.nav-toggle-label span:nth-child(3) {
    top: 18px;
}

header nav {
    display: flex;
}

header nav ul {
    display: flex;
    list-style: none;
    gap: 1rem;
}

header nav a {
    display: block;
    position: relative;
    color: #336699;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    padding: 1rem;
}

header nav a::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0.5rem;
    width: 100%;
    height: 2px;
    background: #336699;
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 0.3s ease;
    pointer-events: none;
}

header nav a:hover::after {
    transform: scaleX(1);
}

@media (max-width: 768px) {
    .nav-toggle-label {
        display: block;
    }

    header nav {
        position: absolute;
        top: 64px;
        left: 0;
        width: 100%;
        background: rgba(204, 223, 255, 0.95);
        display: none;
        flex-direction: column;
    }

    .nav-toggle:checked+.nav-toggle-label+nav {
        display: flex;
    }

    header nav ul {
        flex-direction: column;
        gap: 0;
    }

    header nav li {
        border-top: 1px solid rgba(255, 255, 255, 0.2);
        text-align: center;
    }

    header nav a::after {
        display: none;
    }
}

.mainvisual {
    padding-top: 80px;
    background: url('main_key.jpg') no-repeat center center / cover;
    height: 560px;
    position: relative;
    margin-bottom: 80px;
}

.mainvisual::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(204, 223, 255, 0.3), rgba(255, 255, 255, 0.2));
    z-index: 0;
}

.mainvisual::after {
    content: "";
    position: absolute;
    bottom: -80px;
    left: 0;
    width: 100%;
    height: 80px;
    background: #fff;
    transform: skewY(-2deg);
    transform-origin: top left;
    pointer-events: none;
    z-index: 1;
}

.mainvisual .catch-copy {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 1.2em 0;
    color: #fff;
    text-align: right;
    font-size: 1.8rem;
    font-weight: bold;
    letter-spacing: 0.05em;
    text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.4);
    transform: skewY(-2deg);
}

@media (max-width: 768px) {
    .mainvisual {
        height: 400px;
    }

    .mainvisual .catch-copy {
        font-size: 1.2em;
        padding: 0.5em 0;
    }
}

.page-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 120px;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    height: 300px;
}

.page-header h1 {
    position: absolute;
    left: 24%;
    z-index: 1;
    font-size: 2rem;
    font-weight: bold;
    color: var(--title-color);
    background: rgba(255, 255, 255, 0.85);
    padding: 0.5rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    max-width: max-content;
}

.page-header .kv-img {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 100%;
    max-width: 70%;
    height: 100%;
    margin-left: auto;
    border-top-left-radius: 60px;
    border-bottom-left-radius: 60px;
    object-fit: cover;
    z-index: 0;
    background-blend-mode: overlay;
    background-color: var(--kv-bg);
    background-size: cover;
    background-position: center;
}

@media (max-width: 768px) {
    .page-header {
        flex-wrap: wrap;
        height: 200px;
    }

    .page-header .kv-img {
        max-width: 80%;
        height: 200px;
    }

    .page-header h1 {
        left: 0;
        font-size: 1.6rem;
    }
}

section {
    padding: 2rem 1rem 3rem;
    max-width: 960px;
    margin: 2rem auto;
}

section.news-section {
    padding-top: 0;
}

@media (max-width: 768px) {
    section.news-section {
        padding-top: 0.6rem;
    }
}

h2 {
    position: relative;
    font-size: 1.4rem;
    border-bottom: 4px solid;
    border-image: var(--line-color);
    border-image-slice: 1;
    padding-left: 0.5em;
    padding-bottom: 0.3em;
    margin-bottom: 2rem;
}

h2::before {
    content: "";
    position: absolute;
    left: -0.2em;
    top: -0.3em;
    width: 1.5em;
    height: 1.5em;
    background-color: var(--pale-color-transparent);
    border-radius: 50%;
    z-index: -1;
}

@media screen and (max-width: 768px) {
    h2::before {
        top: -0.4em;
    }
}

h2.news {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
}

h2.news a {
    font-size: 1rem;
    color: #336699;
    text-decoration: none;
    padding: 0.5rem 1rem;
}

h2.news a:hover {
    text-decoration: underline;
}

h2.news a .arrow {
    margin-right: 0.5em;
    font-size: 0.9em;
}

main h3 {
    background-color: var(--title-color);
    color: #fff;
    font-weight: 500;
    padding: 0 0.5em;
    border-radius: 0.5em;
    display: inline-block;
    margin-top: 2em;
    margin-bottom: 0.5em;
    font-size: 1.2em;
}

.breadcrumb {
    font-size: 0.9rem;
    color: #666;
    max-width: 960px;
    margin: 0 auto;
}

.breadcrumb a {
    color: var(--pale-color);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

main a {
    color: var(--theme-color);
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.2s ease;
}

main a:hover {
    color: var(--pale-color);
}

main p span {
    color: var(--title-color);
}

main.page ul {
    list-style: none;
    margin: 1.5em;
}

main.page ul li {
    position: relative;
    margin-left: 1.5em;
    margin-bottom: 0.5rem;
}

main.page ul li::before {
    content: "";
    position: absolute;
    top: 0.4em;
    left: -1.5em;
    width: 0.9em;
    height: 0.9em;
    background-color: var(--pale-color);
    border-radius: 50%;
}

main blockquote {
    margin: 1.5em;
    padding-left: 1em;
    border-left: 4px solid var(--pale-color);
    color: #555;
    font-style: nomal;
    background-color: #f9f9f9;
}

@media (max-width: 768px) {
    main blockquote {
        margin: 1em;
    }
}

main table {
    table-layout: fixed;
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 2em 0;
    font-size: 0.95em;
    text-align: center;
    border-radius: 0.5em;
    overflow: hidden;
}

main table thead th {
    background-color: var(--title-color);
    color: #fff;
    padding: 0.6em 1em;
    font-weight: bold;
}

main table tbody td {
    padding: 0.6em 1em;
    border-top: 1px solid var(--theme-color);
    background-color: #f5f5f5;
    color: #333;
}

main table tbody tr:nth-child(even) td {
    background-color: #f0f6ff;
}

@media (max-width: 768px) {

    .transpose tr th,
    .transpose tr td {
        background-color: #f5f5f5;
        border-top: 1px solid var(--title-color);
        padding: 0.6em 0.4em;
        white-space: nowrap;
    }

    .transpose tr:first-child th,
    .transpose tr:first-child td {
        background-color: var(--title-color);
        color: #fff;
        font-weight: bold;
        width: auto !important;
    }

    .transpose tr:nth-child(n+2) th {
        font-weight: normal;
    }

    .transpose tr:nth-child(n+2):nth-child(odd) th,
    .transpose tr:nth-child(n+2):nth-child(odd) td {
        background-color: #f0f6ff;
    }
}

@media (max-width: 768px) {

    table.class-info thead,
    table.class-info tbody,
    table.class-info th,
    table.class-info td,
    table.class-info tr {
        display: block;
        width: 100%;
    }

    table.class-info thead {
        display: none;
    }

    table.class-info tbody tr {
        margin-bottom: 1.5em;
        border: 2px solid var(--title-color);
        border-radius: 0.5em;
        overflow: hidden;
    }

    table.class-info tbody td {
        display: block;
        text-align: right;
        padding: 0.8em 1em;
        border: none;
        border-top: 1px solid var(--theme-color);
        background: #fff;
    }

    table.class-info tbody tr:nth-child(even) td {
        background-color: #fff;
    }

    table.class-info tbody tr td:first-child {
        background: var(--title-color);
        color: #fff;
        font-weight: bold;
        text-align: center;
        justify-content: center;
        font-size: 1.1em;
        border-top: none;
    }

    table.class-info tbody tr td:first-child a {
        text-decoration: none;
        color: #fff;
    }

    table.class-info tbody tr td:first-child a::after {
        content: "▶";
        font-size: 0.8em;
        margin-left: 0.4em;
    }

    table.class-info tbody td::before {
        display: block;
        content: attr(data-label);
        font-weight: bold;
        color: var(--title-color);
        text-align: left;
        margin-bottom: 0.3em;
    }

    table.class-info tbody td:first-child::before {
        content: "";
    }
}

.step-wrap {
    counter-reset: count;
    margin: 3em 1em 1em 2em;
    position: relative;
}

@media (max-width: 768px) {
    .step-wrap {
        margin: 2em 0;
    }
}

.step-content {
    padding: 1.3em 0 0.3em 1em;
    margin: 0 0 1em 1em;
    position: relative;
    border-top: solid 2px var(--pale-color-transparent);
}

.step-content::before {
    content: "";
    display: block;
    position: absolute;
    bottom: 0;
    left: -4px;
    border-style: solid;
    border-width: 17px 8px 0 8px;
    border-color: var(--pale-color-transparent) transparent transparent transparent;
}

.step-content::after {
    content: "";
    display: block;
    height: calc(100% - 36px);
    border-left: dashed 4px var(--pale-color-transparent);
    position: absolute;
    top: 16px;
    left: 2px;
}

.step-label {
    padding: 3px 20px 3px 15px;
    color: #fff;
    font-weight: bold;
    position: absolute;
    top: -18px;
    left: -20px;
    background: var(--theme-color);
    border-radius: 20px;
    z-index: 1;
}

.step-label::after {
    counter-increment: count;
    content: counter(count);
    position: relative;
    left: 0.3em;
}

.step-title {
    font-weight: bold;
    font-size: 120%;
    color: var(--title-color);
    padding-left: 1em;
}

.step-body {
    margin-top: 0.5em;
    padding: 0 0 1em 2em;
}

.step-wrap> :last-child {
    box-shadow: 5px 7px 0 -5px var(--pale-color-transparent);
}

.step-wrap> :last-child::before,
.step-wrap> :last-of-type::after {
    display: none;
}

.card-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

@media (max-width: 768px) {
    .card-list {
        grid-template-columns: 1fr;
    }
}

.card-list ul {
    list-style: none;
}

.card {
    display: block;
    position: relative;
    background: #fff;
    border-radius: 12px;
    box-shadow:
        0 2px 4px rgba(0, 0, 0, 0.08),
        0 4px 12px rgba(0, 0, 0, 0.05);
    padding: 1.5rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    color: inherit;
    text-decoration: none;
    margin-bottom: 1rem;
    height: 13rem;
    font-weight: normal;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow:
        0 4px 6px rgba(0, 0, 0, 0.12),
        0 8px 20px rgba(0, 0, 0, 0.08);
}

.card h4 {
    font-size: 1.1rem;
    color: var(--title-color);
    margin-bottom: 0.5rem;
    font-weight: bold;
}

.card time {
    font-size: 1rem;
    color: #666;
    display: block;
    margin-bottom: 0.5rem;
}

.card p {
    font-size: 0.9rem;
    color: #666;
}

.card::before {
    content: "";
    position: absolute;
    top: -10px;
    right: -6px;
    width: 32px;
    height: 32px;
    background: url('pin-icon.png') no-repeat center/contain;
}

.card.extra {
    background-color: #f9fbff;
    border: 1px solid var(--theme-color);
}

@media (max-width: 768px) {
    .card {
        height: auto;
    }
}

.post-date {
    text-align: right;
}

.btn {
    display: block;
    background: #336699;
    color: white;
    padding: 0.8rem 1.5rem;
    text-decoration: none;
    border-radius: 9999px;
    font-size: 1rem;
    font-weight: bold;
    transition: background 0.2s ease, color 0.2s ease, border 0.2s ease;
    border: 2px solid transparent;
    text-align: center;
    margin: 2rem auto;
    min-width: 280px;
    max-width: 320px;
    width: max-content;
    white-space: nowrap;
}

.btn:hover {
    background: white;
    color: #336699;
    border: 2px solid #336699;
}

.contact {
    padding-bottom: 1rem;
}

footer {
    background: #eee;
    text-align: center;
    padding: 1rem;
    font-size: 0.8rem;
    clear: both;
}

footer a {
    margin-left: 1rem;
    color: #336699;
    text-decoration: none;
    font-weight: 500;
}

footer a:hover {
    text-decoration: underline;
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin: 2rem auto;
    flex-wrap: wrap;
}

.pagination .page-numbers {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    border: 1px solid #336699;
    border-radius: 4px;
    color: #336699;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.pagination .page-numbers:hover {
    background: #336699;
    color: #fff;
}

.pagination .page-numbers.current {
    background: #336699;
    color: #fff;
    pointer-events: none;
}

.anchor-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 1em;
    margin: 1.8rem 0 4rem !important;
    list-style: none;
}

@media (max-width: 768px) {
    .anchor-links {
        gap: 0.5em;
    }
}

.anchor-links li {
    display: flex;
    align-items: center;
}

.anchor-links li::before {
    content: none !important;
    display: none !important;
}

.anchor-links li a {
    text-decoration: none;
    color: var(--theme-color);
    transition: color 0.3s;
    position: relative;
    padding-left: 1.2em;
}

.anchor-links a::before {
    content: '';
    width: 0.4em;
    height: 0.4em;
    border: 0;
    border-bottom: solid 2px var(--theme-color);
    border-right: solid 2px var(--theme-color);
    transform: rotate(45deg);
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    margin: auto;
}

.anchor-links li a:hover {
    color: var(--pale-color);
}

.anchor-links li a:hover::before {
    border-bottom: solid 2px var(--pale-color);
    border-right: solid 2px var(--pale-color);
}

.chat-box {
    display: flex;
    align-items: flex-start;
    gap: 1em;
    margin: 1.5em 0;
}

.chat-box.left {
    flex-direction: row;
}

.chat-box.right {
    flex-direction: row-reverse;
}

.chat-box img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid transparent;
}

.chat-box.left img {
    border-color: #eafaf2;
}

.chat-box.right img {
    border-color: #eef4fa;
}

.chat-box .msg {
    position: relative;
    padding: 1em;
    border-radius: 10px;
    line-height: 1.6;
    width: 100%;
    max-width: 520px;
}

.chat-box.left .msg {
    background: #eafaf2;
}

.chat-box.right .msg {
    background: #eef4fa;
}

.chat-box.left .msg::before {
    content: '';
    position: absolute;
    top: 1em;
    left: -12px;
    border: 6px solid transparent;
    border-right-color: #eafaf2;
}

.chat-box.right .msg::before {
    content: '';
    position: absolute;
    top: 1em;
    right: -12px;
    border: 6px solid transparent;
    border-left-color: #eef4fa;
}

.em {
    color: var(--theme-color);
    font-weight: bold;
    font-size: 1.1em;
    line-height: 1.2;
    padding: 0 0.1em;
}

small {
    font-size: 0.875em;
}

@media (max-width: 768px) {
    small {
        font-size: 0.75em;
    }
}

.post-nav {
    display: flex;
    justify-content: space-between;
    padding-top: 2em;
    border-top: 1px solid #ccc;
    font-size: 0.95em;
}

.post-nav-prev,
.post-nav-next {
    max-width: 48%;
}

.post-nav a {
    text-decoration: none;
    text-underline-offset: 2px;
    transition: color 0.2s ease;
}

.post-nav a:hover {
    text-decoration: underline;
}

.pagetop {
    position: fixed;
    bottom: 30px;
    right: 20px;
    width: 3rem;
    height: 3rem;
    background: var(--title-color);
    border-radius: 50%;
    display: none;
    z-index: 1000;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.pagetop.is-show {
    display: flex;
}

.pagetop i {
    font-size: 1.5rem;
    color: #fff;
    line-height: 1;
}

.pagetop:hover {
    color: var(--theme-color);
}

.tab-area {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 2rem;
}

.tab {
    padding: 0.5em 1em;
    border: 2px solid var(--pale-color);
    border-radius: 9999px;
    background-color: white;
    color: var(--theme-color);
    text-align: center;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    width: 280px;
}

.tab.active {
    background-color: var(--theme-color);
    border: 2px solid var(--theme-color);
    color: white;
    position: relative;
}

.tab.active::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -10px;
    border: 10px solid transparent;
    border-top: 10px solid var(--theme-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

iframe {
    padding: 2em 0;
    width: 100%;
}

body.theme-red,
.theme-red {
    --theme-color: #b82525;
    --title-color: #731c1c;
    --pale-color: #f7a3a3;
    --pale-color-transparent: rgb(247, 163, 163, 0.6);
    --line-color: linear-gradient(to right, #f6ae2d 30%, #b82525 70%);
    --kv-bg: linear-gradient(135deg, rgba(184, 37, 37, 0.3), rgba(255, 230, 230, 0.3));
}

body.theme-yellow,
.theme-yellow {
    --theme-color: #e6b800;
    --title-color: #998533;
    --pale-color: #ffdf66;
    --pale-color-transparent: rgb(255, 223, 102, 0.6);
    --line-color: linear-gradient(to right, #333 30%, #e6b800 70%);
    --kv-bg: linear-gradient(135deg, rgba(0, 0, 0, 0.3), rgba(255, 255, 200, 0.3));
}

body.theme-blue,
.theme-blue {
    --theme-color: #336699;
    --title-color: #264766;
    --pale-color: #99b8ff;
    --pale-color-transparent: rgb(153, 184, 255, 0.6);
    --line-color: linear-gradient(to right, #66cc99 30%, #3366cc 70%);
    --kv-bg: linear-gradient(135deg, rgba(102, 170, 255, 0.3), rgba(204, 221, 238, 0.3));
}

body.theme-green,
.theme-green {
    --theme-color: #66cc66;
    --title-color: #4d8b4d;
    --pale-color: #a6e6a6;
    --pale-color-transparent: rgb(166, 230, 166, 0.6);
    --line-color: linear-gradient(to right, #f6ae2d 30%, #66cc66 70%);
    --kv-bg: linear-gradient(135deg, rgba(102, 204, 102, 0.3), rgba(230, 255, 230, 0.3));
}