:root {
    --header-height: 8rem;
    --news-height: 21rem;
    --key-visual-height: calc(100vh - var(--header-height) - var(--news-height));
    --key-visual-height: calc(100svh - var(--header-height) - var(--news-height));
    
    --content-padding: var(--content-padding-calc);
}

@media screen and (max-height: 600px) {
    :root {
        --key-visual-height: calc(100svh - var(--header-height));
    }
}

/*@media screen and (max-width: 900px) {
    :root {
    }
}*/

#container {
    display: flex;
    flex-direction: column;
}

header {
    position: relative;
    height: var(--header-height);
    background: linear-gradient(#4C834C, #264226);
    /*background: var(--theme-color);*/
    display: grid;
    grid-template-columns: auto 2rem auto 1rem auto;
    grid-template-areas: "title . date . detail";
    padding: 0 4rem;
    align-content: center;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: bold;
}

header::before {
    content: "";
    display: inline-block;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    background: linear-gradient(rgba(0,0,0,.2),transparent 50%,rgba(0,0,0,.2));
}

header > .title {
    justify-self: start;
    grid-area: title;
    display: grid;
    /*grid-template-rows: 1.6rem 3.8rem;*/
    grid-template-rows: auto auto;
}

header > .title > .upper {
    align-self: end;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.2rem;
    line-height: 1.6rem;
    height: 1.6rem;
}

header > .title > .upper > .year {
    font-weight: bold;
    color: #fff;
}

header > .title > .upper > .highlight {
    text-align: center;
    font-weight: bold;
    height: 100%;
    background-color: #fff;
    color: var(--theme-color);
    padding: 0 4rem;
}

header > .title > .name {
    align-self: start;
    font-size: 3rem;
    line-height: 3.8rem;
    font-weight: bold;
}

header > .date {
    grid-area: date;
    width: 7rem;
    height: 4.4rem;
    position: relative;
}

header > .date {
    display: flex;
    align-items: flex-end;
}

header > .date > div:nth-child(1) {
    width: 140px;
    height: 92px;
    flex: 1;
}

header > .date > div:nth-child(2) {
    width: 1.5rem;
    height: 1.5rem;
    font-size: 1.2rem;
    line-height: 1.5rem;
}

header > .date > div > .month {
    font-size: 1.4rem;
    line-height: 1.4rem;
    position: absolute;
    top: 0;
    left: 0;
}

header > .date > div > .month::after {
    content: "/";
    font-size: 1.6rem;
    line-height: 1.6rem;
    position: absolute;
    top: 1.1rem;
    left: 1.7rem;
}

header > .date > div > .day {
    position: absolute;
    font-size: 2.8rem;
    line-height: 2.8rem;
    bottom: 0;
    right: 1.5rem;
}

header > .date > div > .weekday {
    margin-left: 0.5rem;
    display: block;
    text-align: center;
    bottom: 0.25rem;
    left: 5rem;
    width: 100%;
    height: 100%;
    background-color: #fff;
    color: var(--theme-color);
}

header > .detail {
    grid-area: detail;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0 1rem;
    padding: 0.25rem 0;
}

header > .detail > div {
    font-size: 1.4rem;
    line-height: 1.6rem;
    padding: 0.4rem 0;
    padding-left: 2.1rem;
    position: relative;
}

header > .detail > div::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);

    background-repeat: no-repeat;
    background-position: 0% 50%;
    background-size: 90%;

    width: 1.6rem;
    height: 1.6rem;
}

header > .detail > div.time::before {
    background-image: url(/img/header-icon/time.svg);
}

header > .detail > div.place::before {
    background-image: url(/img/header-icon/place.svg);
}

#key-visual {
    position: relative;
    height: var(--key-visual-height);
    width: 100%;
    overflow: hidden;
}

#key-visual::before {
    position: absolute;
    display: block;
    content: "";
    background-color: rgba(30, 30, 30, 0.4);
    z-index: 30;
    width: 100%;
    height: 100%;
    background-image:
    radial-gradient(#111 30%, transparent 30%);
    background-size: 0.15rem 0.15rem;
}

@keyframes key-visual-fadeIn {
    0% {
        opacity: 0;
    }

    80% {
        opacity: 0;
    }
  
    100% {
        opacity: 1;
    }
}

#key-visual-player {
    position: absolute;
    width: max(110vw, var(--key-visual-height) * 1.3 * 16 / 9);
    height: calc(max(110vw, var(--key-visual-height) * 1.3 * 16 / 9) * 9 / 16);
    left: -20%;
    top: calc(var(--key-visual-height) / 2 - calc(max(110vw, var(--key-visual-height) * 1.3 * 16 / 9) * 9 / 16 / 2));
    border: none;
    animation: key-visual-fadeIn 2.5s ease-in-out;
    z-index: 10;
}

#key-visual-player.disabled {
    display: none;
}

#key-visual-img-slideshow {
    position: relative;
    width: 100%;
    height: 100%;
}

#key-visual-img-slideshow > img {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 110%;
    height: 110%;
    object-fit: cover;
    transform: translateX(-50%) translateY(-50%);
    z-index: 1;
    visibility: collapse;
    opacity: 0;
}

@keyframes slideshow-move {
    0% {
        transform: translateX(-50%) translateX(-1.5rem) translateY(-50%);
    }

    100% {
        transform: translateX(-50%) translateX(1.5rem) translateY(-50%);
    }
}

#key-visual-img-slideshow > img.show {
    visibility: visible;
    opacity: 1;
    animation: slideshow-move 8s linear;
    transition: opacity 1s ease-in-out;
}

#key-visual-img-slideshow > img.show.after {
    z-index: 2;
    opacity: 0;
}

#key-visual-img-slideshow > span {
    position: absolute;
    z-index: 31;
    opacity: 0;
    visibility: collapse;
    transition: 1s ease-in-out;
    bottom: 0.3rem;
    right: 0.3rem;
    color: #fff;
    letter-spacing: 0.025rem;

    display: none;
    /* YouTubeを貫通して表示するバグ。キャプションのみnoneにすることで最悪キャプションだけ犠牲にして表示できる */
}

#key-visual:has(#key-visual-player.disabled) #key-visual-img-slideshow > span {
    display: inline;
}

#key-visual-img-slideshow > span.show {
    opacity: 1;
    visibility: visible;
}

@media screen and (max-width: 900px) {
    #key-visual-img-slideshow > span {
        display: inline;
    }
}

@media screen and (max-width: 1900px) {
    header {
        grid-template-columns: auto 1rem auto;
        grid-template-areas:
        "title . date"
        "detail detail detail";
    }

    header > .detail {
        flex-direction: row;
        padding: 0;
    }

    header > .date {
        justify-self: end;
    }

    header > .title {
        grid-area: title;
        display: grid;
    }

    header > .title > .name {
        font-size: 2.5rem;
        line-height: 3rem;
    }

    header > .detail > div {
        font-size: 0.9rem;
        line-height: 1.4rem;
        padding-left: 1.75rem;
    }

    header > .detail > div::before {
        width: 1.4rem;
        height: 1.4rem;
    }
}

@media screen and (max-width: 1200px) {
    header {
        padding: 0 3rem;
    }

    header > .title > .upper > .year {
        font-size: 1.0rem;
        line-height: 1.2rem;
    }

    header > .title > .upper > .highlight {
        font-size: 1.0rem;
        line-height: 1.2rem;
        height: 1.2rem;
        padding: 0 3rem;
    }

    header > .title > .name {
        font-size: 2rem;
        line-height: 2.4rem;
    }
}

@media screen and (max-width: 900px) {
    #all-wrapper {
        display: flex;
        flex-direction: column;
    }

    #nav-head:not(.scrolled) {
        background-color: transparent;
    }

    header {
        order: 0;
        padding: 0 0.5rem;
        grid-template-columns: auto 1rem auto;
    }

    #key-visual {
        order: -1;
    }

    #key-visual-player {
        /* 通信節約 */
        display: none;
        animation: none;
    }
}

#news {
    height: var(--news-height);
}

h1 {
    text-align: center;
}

h1 > span:nth-child(2) {
    display: flex;
    justify-content: center;
    align-items: center;
}

div.bg-h1 {
    left: calc(1rem + var(--content-padding));
}

/* 3にしたのはあきらめただけ */
#about > div.article:nth-child(3) > h2 {
    margin-top: 0;
    padding-top: 0;
}

#content {
    padding: 0;
}

#content > div {
    position: relative;
    padding: 0 var(--content-padding);
}

#content > div:not(#news) {
    padding-top: 1rem;
    padding-bottom: 1rem;
}

#content > #news {
    padding-bottom: 0;
}

#content > #news > div.article {
    padding-top: 0;
}

#news-list-container-index {
    display: flex;
    flex-direction: column;
}

#news-list-container-index > a.internal-link {
    margin-top: 0.5rem;
    align-self: self-end;
}

#content > div:nth-child(2n+1) {
    background-color: var(--bg-color);
}

#content > div:nth-child(2n+1) > div.article {
    padding-left: 8.5rem;
    padding-right: 3.5rem;
}

#content > div:nth-child(2n) > div.article {
    padding-left: 4.5rem;
    padding-right: 7.5rem;
}

#content > div:nth-child(2n) {
    background-color: var(--light-gray-bg);
}

#content > div:nth-child(2n) > div.bg-h1 {
    color: #fff;
    left: auto;
    right: calc(1rem + var(--content-padding));
    transform-origin: right top;
    transform: rotate(-90deg) translateY(-100%);
}

#content > div > div.bg-h1 {
    opacity: 1;
}

@media screen and (max-width: 1200px) {
    #content > div > div.bg-h1 {
        opacity: 0.5;
    }
    
    #content > div:nth-child(n) > div.article {
        padding: 1rem 2rem;
    }
}

@media screen and (max-width: 900px) {
    #content > div:nth-child(n) > div.article {
        padding: 1rem;
    }

    #content > div > div.bg-h1:not(.mb-rotate) {
        transform: none;
    }

    #content > div > div.bg-h1:not(.mb-rotate) {
        top: -1rem;
        left: 0.25rem;
    }

    #content > div > div.bg-h1.mb-rotate {
        right: 0.25rem;
    }
}

/*#news-list-container-index {

}*/

#news > h1 {
    padding: 1.25rem 0 0.75rem;
}

#about div.about-wrapper {
    display: grid;
    grid-template-columns: 24rem 1fr;
}

#about div.about-wrapper > div.text-container p {
    line-height: 1.8rem;
}

#about div.about-wrapper > div.img-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-end;
}

#about div.about-wrapper > div.img-container img {
    width: 90%;
}

@media screen and (max-width: 900px) {
    #about div.about-wrapper {
        display: flex;
        flex-direction: column;
    }

    #about div.about-wrapper > div {
        margin: 2rem 0;
    }

    #about div.about-wrapper > div:nth-child(1) {
        margin-top: 0;
    }

    #about > div.article:nth-child(1) > h2 {
        margin-top: 0;
        padding-top: 0;
    }

    #about div.about-wrapper > div.img-container {
        align-items: center;
    }

    #about div.about-wrapper > div.img-container > img {
        max-height: 18rem;
        object-fit: contain;
    }
}

#access-wrapper {
    display: flex;
    justify-content: space-between;
}

#access-wrapper > .text-container {
    min-width: 20rem;
}

#access-wrapper > .text-container > div.place {
    font-weight: bold;
    font-size: 1.25rem;
}

#access-wrapper > .text-container > p.address {
    margin-top: 0.25rem;
}

#access-wrapper > .text-container > p.station > span {
    font-weight: bold;
}

#access-wrapper > .map-container {
    flex: 1;
    display: flex;
    justify-content: flex-end;
}

#access-wrapper > .map-container > iframe {
    /*width: 600px;
    height: 450px;*/
    width: 100%;
    height: 100%;
    border: none;
}

@media screen and (max-width: 1200px) {
    #access-wrapper {
        flex-direction: column;
    }

    #access-wrapper > .text-container {
        width: 100%;
        margin-bottom: 2rem;
    }

    #access-wrapper > .map-container {
        width: 100%;
        height: 25rem;
        flex: auto;
    }
}

#loading-screen {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #fff;
    z-index: 50000;
    transition: 1s ease-in-out;
    visibility: visible;
    display: flex;
    justify-content: center;
    align-items: center;
}

#loading-screen.loaded {
    opacity: 0;
    visibility: collapse;
}

#loading-screen .logo {
    height: calc(1.76rem * 2);
    line-height: calc(1.76rem * 2);
    padding-left: calc(0.7rem * 2);
    opacity: 0;
    visibility: collapse;
    transition: .25s ease-in-out;
}

#loading-screen .logo.show {
    opacity: 1;
    visibility: visible;
}

#loading-screen .logo > .year {
    left: calc(0.64rem * 2);
    font-size: calc(1.76rem / 3 * 2);
    transform: rotate(-90deg) translateY(calc(-0.96rem * 2));
}

#loading-screen .logo > .name {
    font-size: calc(1.6rem * 2);
}