/*
 * AI抱っこ Theme
 * Smartphone Stylesheet
 *
 * 対象: 767.98px 以下
 *
 * main.css の基本レイアウトを前提とし、
 * スマートフォン固有の差分だけを定義する。
 */

/*
 * 共通レイアウト
 */

.aidakko-layout > .aidakko-sidebar-left,
.aidakko-layout > .aidakko-main,
.aidakko-layout > .aidakko-sidebar-right {
    flex: 0 0 100%;
    width: 100%;
    max-width: 100%;
}

/*
 * トップページ
 */

:root {
    --aidakko-header-height: 66px;
}

/*
 * ヘッダーとフッターは常時表示し、
 * メイン領域だけをスクロールさせる。
 */

body.aidakko-front-page .front-header {
    flex: 0 0 auto;
    min-height: var(--aidakko-header-height);
}

body.aidakko-front-page .front-main {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

/*
 * ブランド表示
 */

.front-navbar .container-fluid {
    flex-wrap: wrap;
}

.front-navbar .navbar-brand {
    max-width: calc(100% - 4.5rem);
    margin-right: 0;
    overflow: hidden;
    font-size: 1rem;
    text-overflow: ellipsis;
}

.front-navbar .brand-copy small {
    display: none;
}

/*
 * スマートフォンではハンバーガーメニューを使用
 */

.front-navbar .navbar-toggler {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-left: auto;
}

.front-primary-navigation,
.front-primary-navigation.collapse,
.front-primary-navigation.collapsing {
    display: none !important;
    flex: 0 0 100%;
    width: 100%;
    height: auto !important;
    margin: 0.75rem 0 0;
    padding: 0.75rem;
    overflow: visible;
    background: #ffffff;
    border: 1px solid var(--aidakko-border);
    border-radius: 0.9rem;
    box-shadow: 0 0.8rem 2rem rgba(111, 52, 75, 0.12);
}

.front-primary-navigation.show,
.front-primary-navigation.collapsing {
    display: block !important;
}

.front-primary-navigation .menu {
    display: grid;
    gap: 0.4rem;
    width: 100%;
    margin: 0;
}

.front-primary-navigation .menu > li {
    width: 100%;
}

.front-primary-navigation .menu > li > a,
.front-primary-navigation .menu > li > a:visited {
    width: 100%;
    padding: 0.8rem 0.9rem;
    color: var(--aidakko-primary-deep);
    background: var(--aidakko-primary-pale);
    border-color: var(--aidakko-border);
    border-radius: 0.5rem;
}

.front-primary-navigation .menu > li > a:hover,
.front-primary-navigation .menu > li > a:focus,
.front-primary-navigation .menu .current-menu-item > a,
.front-primary-navigation .menu .current_page_item > a,
.front-primary-navigation .menu .current-menu-ancestor > a {
    color: #ffffff;
    background: var(--aidakko-primary-dark);
    border-color: var(--aidakko-primary-dark);
    transform: none;
}

/*
 * スマートフォンの階層メニュー
 */

.primary-navigation .sub-menu,
.front-primary-navigation .sub-menu {
    position: static;
    display: block;
    min-width: 0;
    margin: 0.35rem 0 0 0.75rem;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.primary-navigation .sub-menu a,
.front-primary-navigation .sub-menu a {
    padding: 0.65rem 0.8rem;
    white-space: normal;
    background: #ffffff;
    border: 1px solid var(--aidakko-border);
    border-radius: 0.4rem;
}

/*
 * トップページのメイン領域
 *
 * front-main がスクロール領域なので、
 * 旧来の height: calc(100vh - ...) や margin-top は設定しない。
 */

.front-main {
    padding: 0.75rem;
}

.front-hero-shell {
    grid-template-columns: 1fr;
    gap: 0.85rem;
    height: auto;
    min-height: 0;
}

#aidakkoFrontCarousel,
#aidakkoFrontCarousel .carousel-inner,
#aidakkoFrontCarousel .carousel-item,
.front-slide-empty {
    height: clamp(18rem, 48vw, 28rem);
    min-height: 0;
}

.front-notice-panel {
    min-height: 18rem;
}

/*
 * スマートフォン縦向き
 */

@media (max-width: 575.98px) and (orientation: portrait) {
    #aidakkoFrontCarousel,
    #aidakkoFrontCarousel .carousel-inner,
    #aidakkoFrontCarousel .carousel-item,
    .front-slide-empty {
        height: 34vh;
        min-height: 13rem;
        max-height: 19rem;
        border-radius: 1rem;
    }

    .front-slide-overlay {
        background: linear-gradient(
            0deg,
            rgba(65, 25, 40, 0.58) 0%,
            rgba(65, 25, 40, 0.08) 72%
        );
    }

    .front-slide-caption {
        right: 1rem;
        bottom: 1.5rem;
        left: 1rem;
        width: auto;
    }

    .front-slide-caption h1,
    .front-slide-caption h2 {
        font-size: clamp(1.25rem, 6vw, 1.75rem);
    }

    .front-slide-caption p {
        display: -webkit-box;
        overflow: hidden;
        margin-top: 0.35rem;
        font-size: 0.82rem;
        line-height: 1.45;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
    }

    #aidakkoFrontCarousel .carousel-control-prev,
    #aidakkoFrontCarousel .carousel-control-next {
        width: 12%;
    }

    #aidakkoFrontCarousel .carousel-indicators {
        margin-bottom: 0.4rem;
    }

    .front-notice-panel {
        padding: 1.1rem;
        border-radius: 1rem;
    }

    .front-notice-header {
        padding-bottom: 0.8rem;
    }

    .front-notice-header h2 {
        font-size: 1.35rem;
    }

    .front-notice-header > p:last-child {
        margin-top: 0.55rem;
        font-size: 0.88rem;
    }

    .front-notice-list a {
        padding: 0.8rem 0.1rem;
    }
}

/*
 * スマートフォン横向き
 */

@media (orientation: landscape) {
    .front-slide-caption {
        right: 12%;
        bottom: 1.25rem;
        left: 12%;
        max-height: calc(100% - 2.5rem);
        padding: 0.6rem 0.85rem;
    }

    .front-slide-caption h1,
    .front-slide-caption h2 {
        margin-bottom: 0.25rem;
        font-size: 1.25rem;
    }

    .front-slide-caption p {
        font-size: 0.8rem;
        line-height: 1.4;
    }

    #aidakkoFrontCarousel .carousel-indicators {
        display: none;
    }
}

/*
 * WordPress管理バー
 *
 * 管理バー表示時も main の高さ・margin-top は再計算しない。
 * ヘッダー位置だけをWordPress管理バーの高さに合わせる。
 */

@media screen and (max-width: 782px) {
    body.admin-bar.aidakko-front-page .front-header {
        top: 46px;
    }
}
