* {
    margin: 0;
    padding: 0;
    box-sizing: border-box; /* borderとpaddingを内側に */
}

::selection {
    background-color: #364f6f;
    color: var(--primary-color);
}

:root {
    --primary-color: #e7dac4;
    --secondary-color: #f26138;
    --card-color: #232323;
    --content-max-width: 1200px;
    --blog-text-color: #9a9183;
    --blog-h-color: #c0b5a3;
    --blog-font-family: 'Noto Sans JP', sans-serif;
    --primary-font-family: 'Noto Serif JP', 'Georgia', serif;
    --button-hover-color: #225683;
    --button-color: #2f2f2f;
}

body {
    font-family: var(--primary-font-family);
    line-height: 1.6;
    background-color: #111923; /* デフォルト背景色 */
    color: var(--primary-color); /* デフォルト文字色 */
}

/* ========== デフォルトスタイル ========== */
h1, h2 {
    font-family: var(--primary-font-family);
    text-align: center;
    color: #f6e2bf;

    margin-bottom: 15px;
    padding-bottom: 5px;

    border-bottom: 2px solid #424242;
}

h1 {
    font-size: 2em;
}

/* spanで囲った切れ目を優先的に改行対象に */
h1 span {
    display: inline-block;
}

h2 span {
    display: inline-block;
}

p {
    font-family: var(--primary-font-family);
    margin-bottom: 10px;
}

hr {
    border-color: var(--blog-text-color);
    margin-bottom: 1.5em;
}

a {
    text-decoration: none;
    color: var(--secondary-color);
}

blockquote {
    padding: 8px 16px;
    margin: 24px 0;
}

/* ========== ヘッダ ========== */
header {
    background-color: var(--card-color); /* ヘッダ部分の背景色 */

    padding: 20px;

    text-align: center;
    font-size: 2rem;

    border-bottom: 4px solid #444;
}

.title {
    color: var(--primary-color);
}

nav a {
    position: relative;

    color: var(--secondary-color);
    font-weight: bold;

    margin: 0 15px;
}

nav a::after {
    content: "";

    position: absolute;
    left: 0;
    bottom: 0;

    height: 2px;
    width: 100%;

    background: linear-gradient(to right, transparent, var(--secondary-color), transparent);
    opacity: 0;

    transition: opacity 0.2s ease;
}

nav a:hover::after {
    opacity: 1;

    transition: opacity 0.2s ease;
}

/* ========== フッター ========== */
footer {
    text-align: center;
    margin-top: 20px;
    color: #757575;
    font-size: 0.9rem;
    border-top: 1px solid #333;
    padding-top: 10px;
}

/* ========== 汎用 ========== */
.flex-center {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 特殊化 */
.flex-column {
    flex-direction: column;
}

.english {
    font-family: 'Georgia', serif;
}

button, .button {
    background-color: var(--button-color);
    color: var(--primary-color);
    font-family: var(--blog-font-family);
    text-align: center;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
}

/* メインコンテンツ */
main {
    margin: 20px;
    padding: 20px;
}

/* ========== カード ========== */
/* カードリスト */
.cards {
    flex-wrap: wrap;
    gap: 20px;
}

.cards-column {
    flex-direction: column;
}

.cards-column .card {
    width: 100%;
}

.cards-links {
}

.cards-works {
}

/* カード単体 */
.card {
    background-color: var(--card-color);
    border-radius: 4px;
    padding: 15px;
    max-width: 800px;
}

.card-outline {
    border: 2px solid #90846f;
    background-color: unset;
    color: #f6e2bf;
    padding: 10px;
}

.card-clickable {
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.card-clickable:hover {
    transform: scale(1.01);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

/* Links */
.card-link {
    border-radius: 12px;
    background-color: var(--button-color);

    max-width: 600px;

    font-size: 20px;
    font-weight: bold;
}

.card-link i {
    margin-right: 10px;

    font-size: 30px;
}

/* Works */
.card-work {
    height: 300px;
}

/* Others */
.card-others {
    height: 100px;
}

/* カードサムネ */
.card-thumbnail {
    overflow: hidden;
    flex: 0 0 35%;
    height: 100%;
    position: relative;
}

.card-thumbnail img {
    position: absolute;
    display: block;
    height: 500px;
    object-fit: cover;
    margin: auto;
}

/* カードタイトル */
.card-title {
    flex: 1 0 65%;
    padding-left: 10px;
    font-size: 1.2em;
}

.card-title span {
    display: inline-block;
}

/* ========== ギャラリー ========== */

.gallery {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: end;
    gap: 15px;

    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: 20px;
}

.gallery-item {
    flex: 1 1 calc(20% - 15px);
    max-width: calc(20% - 15px);

    border-radius: 3px;

    overflow: hidden;
}

/* 横長画像対応 */
.gallery-item-autosize {
    flex: 0 0 auto;
    max-width: 800px;
}

.gallery-item img {
    width: 100%;
    height: auto;
    object-fit: contain;

    display: block;
}

.gallery-item p {
    text-align: center;
    margin: 5px;
}

.thumbnail {
    width: 100%;
    cursor: pointer;

    transition: transform 0.2s;
}

.thumbnail-character {
    max-height: 350px;
}

.thumbnail:hover {
    transform: scale(1.02);
}

/* ========== モーダル ========== */

.modal {
    display: none;

    position: fixed;
    z-index: 1;
    left: 0;
    top: 0;

    width: 100%;
    height: 100%;

    overflow: auto;

    background-color: rgba(0, 0, 0, 0.9);

    opacity: 0;
    transition: opacity 0.5s ease;
}

.modal.show {
    opacity: 1;
    transition: opacity 0.5s ease;
}

.modal-content {
    display: flex;

    margin: auto;
    padding: 50px;

    max-width: var(--content-max-width);
    max-height: 100%;
}

.modal-content img {
    object-fit: contain;
    max-width: 100%;
}

.modal-img {
    flex: 0 0 50%;
}

.modal-img img {
    height: 100%;
    width: 100%;
    object-fit: contain;
}

.modal-text {
    flex: 1 0 50%;
    margin: 50px auto;
}

.close {
    position: absolute;
    top: 20px;
    right: 20px;

    color: #ddd;

    font-size: 40px;
    font-weight: bold;

    cursor: pointer;
}

/* ========== PC情報 ========== */
:root {
    --losted-color: #b21523;
}

.losted {
    font-size: 2em;
    text-align: center;
    font-weight: bold;
    color: var(--losted-color);
}

.losted-chara {
    color: var(--losted-color);
}

/* ========== 日記一覧 ========== */

.diaries {
    max-width: 600px;
    margin: auto;
}

.diaries ul {
    list-style: none;
}

.diaries li {
    margin: 10px 0;
}

.diaries h2 {
    text-align: start;
}

.diaries a {
    color: var(--primary-color);
}

.diaries a:hover {
    text-decoration: underline;
    color: var(--secondary-color);
}

/* ========== 日記本文 ========== */

.container {
    display: flex;
    gap: 20px;
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: 20px;
}

/* 本文 */
.main-content {
    flex: 0 1 70%;
    min-width: 200px;
}

.main-content h1, .main-content h2, .main-content h3, .main-content h4 {
    font-family: var(--blog-font-family);
    color: var(--blog-h-color);

    text-align: start;
}

.date {
    font-family: var(--blog-font-family);
    color: var(--blog-h-color);

    text-align: end;

    display: block;
}

.main-content p {
    font-family: var(--blog-font-family);
    color: var(--blog-text-color);

    margin-bottom: 1.5em;
}

.main-content ul {
    padding-left: 1.5em;
    margin: 1em 0;
}

.main-content p + ul {
    margin-top: 0;
}

.main-content p:has(+ ul) {
    margin-bottom: 0;
}

.main-content ol {
    padding-left: 1.5em;
    margin: 1em 0;
}

.main-content li {
    font-family: var(--blog-font-family);
    color: var(--blog-text-color);
}

.main-content img {
    width: 100%;
}

.main-content blockquote {
    position: relative;
}

.main-content blockquote::before {
    content: "";
    background-color: #635e57; 
    height: 100%;
    width: 4px;
    position: absolute;
    left: 0;
    top: 0;
}

.main-content blockquote > :last-child {
    margin-bottom: 0;
}

.main-content th {
    width: 6em;
    vertical-align: top;
}

/* サイドバー */
.sidebar {
    flex: 0 0 30%;
    min-width: 200px;
}

.month-list li {
    list-style: none;
}

.month-list button {
    font-family: var(--primary-font-family);
    font-size: 1.2rem;

    width: 100%;
    padding: 5px 10px;

    transition: all 0.2s ease-in-out;
}

.month-list button:hover {
    background-color: var(--button-hover-color);
}

.post-list {
    padding: 10px;
    list-style: none;
}

.post-list-default {
    display: none;
}

.post-list a {
    color: var(--primary-color);
}

.post-list a:hover {
    text-decoration: underline;
    color: var(--secondary-color);
}

.post-list.show {
    animation: fadeIn 0.2s ease-in-out;
    opacity: 1;
}

.post-list.hidden {
    animation: fadeOut 0.2s ease-in-out;
    opacity: 0;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* コードブロック対応 */
code[class*=language-], pre[class*=language-] {
    color: #c0b5a3;
}

/* 一番上までスクロール */
.scroll-to-top {
    width: 100%;
    font-family: var(--blog-font-family);
    color: var(--secondary-color);
    padding: 5px 20px;
    border-radius: 12px;

    transition: transform 0.1s ease;
}

.scroll-to-top:hover {
    transform: scale(1.01);
    background-color: var(--button-color);
}

/* ========== トップページ ========== */
/* 最近の記事 */
.post-item {
    display: flex;
    justify-content: space-between;
}

.post-item #date {
    flex: 0 0 90px;
}

/* 本文 */
.page-content {
    margin: 20px auto;
}

/* 戻るボタン */
.back-button {
    display: flex;
    justify-content: end;
}

.back-button a {
    padding: 5px 20px;
    border-radius: 12px;
}

.back-button a:hover {
    color: var(--secondary-color);
    transform: scale(1.02);
}

/* ========== 作った曲 ========== */
.music-description {
    font-family: var(--blog-font-family);
    color: var(--blog-text-color);
    margin: 0;
    padding: 0 2%;
    width: 100%;
}

.mini-img {
    max-width: 300px;
}

@media (max-width: 700px) {
    header {
        font-size: 1.5rem;
    }

    main {
        padding: 0;
    }
    
    nav a {
        margin: 0 10px;
    }

    /* カード */
    .card-link {
        font-size: 16px;
    }

    .card-link i {
        font-size: 24px;
    }

    .card-work {
        height: 200px;
    }

    .card-others {
        height: 100px;
    }

    .card-thumbnail {
        flex: 0 0 20%;
        display: flex;
        justify-content: center;
    }

    .card-thumbnail img {
        height: 300px;
    }

    .card-thumbnail-others img {
        height: 500px;
    }

    .card-title {
        flex: 1 0 80%;
        font-size: 90%;
    }

    /* ギャラリー */
    .gallery-item {
        flex: 1 1 45%;
        max-width: 50%;
    }

    /* モーダル */
    .modal-content {
        flex-direction: column;
    }

    /* 日記 */
    .container {
        flex-direction: column;
        padding: 0;
    }
}
