/*================== header ==================*/

/* ================== PC / COMMON ================== */
#header-nomal{
    font-size: 14px;
    position: fixed;
    top: 0;
    z-index: 998;
    height: 100px;
    width: 100%;
    background-color:#222;
    min-width: 1000px;
}

#header-nomal.fixed {
    height: 80px;
    background-color:#fff;
    min-width: 1000px;
}

#header-nomal a {font-size: 20px;font-weight: 500;}

#logo{
    position: absolute;
    top: 0;
    left: 20px;
    height: 100%;
    text-align: center;
}

#logo img{
    height: 70%;
    margin-top: 10px;
}
#logo img.logogray{ display: none; }
#header-nomal.fixed #logo img.logowhite{ display: none; }
#header-nomal.fixed #logo img.logogray{ display: block; }

#logo p{
    color: #fff;
    margin-top: 2px;
    font-size: 10px;
}
#logo a{
    text-decoration: none;
    display: block;
    width: 100%;
    height:100%;
}

#header-nomal.fixed #logo p{
    display: none;
}

/* PCは従来通り、SPでは下のmediaで上書きする */
.nav-wrap{
    width: 100%;
    height: 100%;
}

#upper-nav ul li,
#bottom-nav ul li{
    min-width: 152px;
}

#upper-nav{
    position: absolute;
    width: 90%;
    top: 0;
    right: 0;
    height: 50px;
    text-align: right;
}

#bottom-nav {
    position: absolute;
    width:90%;
    min-width: 980px;
    height: 30px;
    bottom: 5px;
    right: 0;
    left: 111px;
}

#upper-nav ul, #bottom-nav>ul {
    margin-right: 20px;
    padding: 0;
    text-align: right;
    margin-bottom: 0;
}

#upper-nav ul li, #bottom-nav ul li {
    display: inline-block;
    width: 15%;
    text-align: center;
}

#upper-nav ul li{
    height: 50px;
    line-height: 50px;
    border-left: 1px solid #9c2b29;
    border-bottom: 1px solid #9c2b29;
}
#header-nomal.fixed #upper-nav ul li{
    height: 30px;
    line-height: 30px;
}

#upper-nav ul li:last-child{
    border-right: 1px solid #9c2b29;
}

#upper-nav ul li:nth-of-type(4){
    background-color: rgba(156,43,41,0.5);
}

#bottom-nav>ul>li {
    border-right: 1px solid #9c2b29;
    padding:0 5px 0 0;
}
.border-top{ display: none; }

#bottom-nav>ul>li:first-child {
    border-left: 1px solid #9c2b29;
    padding-left: 5px;
}

#upper-nav ul li:hover{
    background-color: #9c2b29;
}

#upper-nav ul li a, #bottom-nav ul li a {
    color: #fff;
    display: inline-block;
    width: 100%;
    height: 100%;
    border-bottom:initial;
}
#header-nomal.fixed #upper-nav ul li a,
#header-nomal.fixed #bottom-nav ul li a {
    color: #3c3c3c;
}

#upper-nav ul li a:hover, #bottom-nav ul li a:hover { text-decoration: none; }
#header-nomal #upper-nav ul li a:hover{ color:#fff; }

#bottom-nav>ul>li>a:hover {
    background-color: rgba(255,255,255,0.7);
    color:#9c2b29;
    border-bottom:5px solid #9c2b29;
}
#bottom-nav>ul>li>a{
    border-bottom:5px solid rgba(0,0,0,0);
}

#header-nomal.fixed #bottom-nav>ul>li>a:hover {
    background-color: rgba(156,43,41,0.3);
}

/*================================================================== Drop Down (PC: hover) ==================*/
.dropdown{ *zoom: 1; }
.dropdown:before, .dropdown:after{ content:""; display:table; }
.dropdown:after{ clear:both; }

.dropdown li{
  position: relative;
  text-align: center;
}
.dropdown li ul{
  position: absolute;
  right: 0;
  margin-top: 5px;
  min-width: 190px!important;
  z-index: 9999;
  border-left:1px solid #888;
  border-bottom:1px solid #888;
  border-right:1px solid #888;
  background-color: rgba(255,255,255,0.9);
}
.dropdown li ul li{
  width: 98%!important;
  border-bottom: 1px solid #666;
}
.dropdown li ul li:last-child{ border-bottom: none; }

.dropdown>li>ul>li>a{
    padding-right: 10px;
    color: #333!important;
    text-align: center;
    vertical-align: middle;
    line-height: 1.5;
    white-space: nowrap;
}
.dropdown li ul li { line-height: 50px; }
.dropdown>li>ul>li>a:hover{ color:#9c2b29!important; }

#fadedown li ul{
  opacity: 0;
  visibility: hidden;
  transition: .5s;
  -webkit-transition:.5s;
}
#fadedown li:hover ul{
  top: 100%;
  visibility: visible;
  opacity: 1;
}

.only_mobile,
#bottom-nav ul li.only_mobile{ display: none; }

/*================================================================== Mobile-menu ==================*/
#mobile-menu {
    display:none;
    position:absolute;
    right:25px;
    top:22px;
    width:30px;
    height:25px;
    cursor:pointer;
}
.fixed #mobile-menu{ top: 13px; }

#mobile-menu div { position:relative; }
#mobile-menu span {
    display:block;
    position:absolute;
    width:100%;
    border-bottom:solid 3px #999;
    -webkit-transition: .35s ease-in-out;
    -moz-transition: .35s ease-in-out;
    transition: .35s ease-in-out;
}
#mobile-menu span:nth-child(1) { top:0; }
#mobile-menu span:nth-child(2) { top:11px; }
#mobile-menu span:nth-child(3) { top:22px; }

#header-nomal.fixed #mobile-menu span {
    border-bottom:solid 3px #666;
}

/*========================================================= media screen 1030px =============================*/
@media screen and (max-width: 1030px){

    .only_mobile,
    #bottom-nav ul li.only_mobile{ display: block; }

    /* SPではmin-width固定を解除 */
    #header-nomal, #header-nomal.fixed{
        min-width: 320px;
        height: 70px;
    }
    #header-nomal{
        top: 30px;
        background-color:#222;
    }
    #header-nomal.fixed{ height: 50px; }

    .fixed #logo img{ margin-top:5px; }

    #logo p {
        position: fixed;
        top: 41px;
        left: 123px;
        font-size: 30px;
        font-weight: 300;
    }
    #header-nomal.fixed #logo p{
        display:block;
        top: 32px;
        left: 91px;
        color: #888;
    }

    /* nav-wrap を画面全体のメニューコンテナにする */
    .nav-wrap{
        position: fixed;
        top: 70px; /* ヘッダー直下 */
        left: 0;
        width: 100%;
        height: calc(100vh - 70px);
        background: rgba(0,0,0,0); /* 開いた時に暗くしたければ下で変更 */
        overflow: visible;
        pointer-events: none; /* 閉じてる時はページ操作を邪魔しない */
        z-index: 20000;
    }
    #header-nomal.open-mobilenav .nav-wrap{
        pointer-events: auto;
        /* background: rgba(0,0,0,.35); */ /* ←必要ならON */
    }

    /* upper-nav（上段）は固定のまま、4等分で必ず見えるように */
    #upper-nav{
        position: fixed;
        top: 0;
        width:100%;
        text-align: center;
        right: 0;
        z-index: 21000;
    }
    #upper-nav ul{
        margin:0;
        padding: 0;
        border-top:1px solid #9c2b29;
        background-color:#555;
        text-align: center;
        display: flex;
        justify-content: space-between;
    }
    #upper-nav ul li{
        height: 30px;
        line-height: 30px;
        min-width: 0;
        width: 25% !important; /* PCの width:15% を確実に上書き */
    }

    #header-nomal.fixed #upper-nav ul li a{
        color: #fff;
    }

    #header-nomal a {
        font-size: 17px;
        font-weight: 600;
    }

    /* bottom-nav（ハンバーガーで出すメニュー） */
    #bottom-nav{
        position: absolute;      /* fixedから外す */
        top: 0;
        right: 0;
        left: auto;
        bottom: auto;            /* PCの bottom を無効化 */
        width: 165px;
        min-width: 0;            /* PCの min-width を無効化 */
        height: auto;            /* PCの height:30px を無効化 */

        /* 重要：背景を外して、枠が下まで伸びても見えなくする */
        background: transparent;

        font-size: 17px;
        text-align: left;
        z-index: 22000;

        /* 右からスライド */
        transform: translateX(100%);
        transition: .35s ease-in-out;

        /* ★コンテナ自体は伸びてもOKにしておく */
        max-height: none;
        overflow: visible;
    }

    /* open-mobilenavは header に付くのでこれが正解 */
    #header-nomal.open-mobilenav #bottom-nav{
        transform: translateX(0);
    }

    /* 白背景は ul 側へ（中身の高さで止まる） */
    #bottom-nav>ul{
        margin:0;
        padding: 6px 0;
        background-color: rgba(255,255,255,0.92);

        /* 長い場合にだけスクロール */
        max-height: calc(100vh - 90px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .border-top{
        display: block;
        border-bottom: 1px solid #9c2b29;
        margin-left:10px;
    }

    #bottom-nav>ul>li{
        display:block;
        border:none;
        padding:15px 0 15px 7px;
        min-width: 100%;
        text-align: left;
    }
    #bottom-nav>ul>li:hover{
        background-color: rgba(156,43,41,0.3);
        border-left:10px solid #9c2b29;
    }

    #bottom-nav>ul>li:first-child{
        border:none;
        padding-left: 10px;
    }
    #bottom-nav>ul>li:first-child:hover{
        border-left: 10px solid #9c2b29;
    }

    #bottom-nav>ul>li>a{
        color: #222;
        pointer-events: auto;
    }

    /* SPはhover前提を捨てて、タップで開けるようにする（focus-within） */
    .dropdown li ul{
        position: static;
        right: auto;
        margin: 0;
        width: 100%;
        border-top: 1px solid #888;
        text-align: left;
        display: none; /* 初期は閉じる */
        opacity: 1;
        visibility: visible;
        background: rgba(255,255,255,0.92);
    }
    #fadedown li:hover ul{ /* hoverは残してもOK（PC互換） */
        top: auto;
        visibility: visible;
        opacity: 1;
    }
    #fadedown li:focus-within > ul{
        display: block;
    }

    /* サブメニュー文字 */
    #bottom-nav>ul>li>ul>li>a{
        text-align: left !important;
        white-space: normal;
        padding: 12px 12px;
    }

    /* 旧調整は無効化 */
    .dropdown_mag{ margin-top: 0 !important; }

    /* hamburger */
    #mobile-menu { display:block; z-index: 25000; }

    .open-mobilenav #mobile-menu span:nth-child(1) {
        top: 11px;
        -webkit-transform:rotate(-45deg);
        -moz-transform:rotate(-45deg);
        transform:rotate(-45deg);
    }
    .open-mobilenav #mobile-menu span:nth-child(2),
    .open-mobilenav #mobile-menu span:nth-child(3) {
        top: 11px;
        -webkit-transform:rotate(45deg);
        -moz-transform:rotate(45deg);
        transform:rotate(45deg);
    }

    /* ☓印 */
    #mobile-menu span{
        border-bottom-color: #9c2b29;
    }
    #header-nomal.fixed #mobile-menu span{
        border-bottom-color: #9c2b29;
    }

    /* =========================================================
       CDAマガジン
    ========================================================= */

    /* サブメニューは基本閉じる */
    #bottom-nav ul.dropdown > li > ul.dropdown_mag{
        display: none;
    }

    /* 親aを「開閉専用」にするので遷移させない */
    #bottom-nav ul.dropdown > li > a[href$="/magazine"]{
        pointer-events: none;
    }

    /* 常時開き */
    #bottom-nav ul.dropdown > li > a[href$="/magazine"] + ul.dropdown_mag{
        display: block;
    }
}

/*========================================================= media screen 768px =============================*/
@media screen and (max-width: 768px){
    #header-nomal, #header-nomal.fixed{ height: 60px; }
    #header-nomal.fixed{ height:50px; }
    #logo p { top: 38px; left: 94px; }
    #header-nomal.fixed #logo p{ top: 35px; font-size:25px; }

    /* nav-wrap / bottom-nav の top をヘッダー高さに追従 */
    .nav-wrap{ top: 60px; height: calc(100vh - 60px); }
}

/*========================================================= media screen 516px =============================*/
@media screen and (max-width: 516px){
    #header-nomal, #header-nomal.fixed{ height: 50px; }
    #header-nomal.fixed{ height:40px; }
    #logo p { top: 41px; left: 75px; font-size: 20px; }
    #header-nomal.fixed #logo p{ top: 33px; left: 66px; font-size:20px; }
    #mobile-menu{ top: 16px; }
    .fixed #mobile-menu{ top: 9px; }

    .nav-wrap{ top: 50px; height: calc(100vh - 50px); }
}

/*========================================================= media screen 480px =============================*/
@media screen and (max-width: 480px){
    #header-nomal a{ font-size: 14px; }
}

/*========================================================= media screen 350px =============================*/
@media screen and (max-width: 350px){
    #logo p { top: 42px; left: 73px; font-size: 16px; }
    #header-nomal.fixed #logo p{ top: 37px; left: 61px; font-size: 14px; }
}