/* =========================================
   基本設定 & 変数
   ========================================= */
:root {
    --bg-color: #ffffff;
    --text-main: #333333;
    --text-sub: #888888;
    --border-light: #eeeeee;
    --border-dark: #333333;
    --accent-color: #000000;
    --button-bg: #a9a9a9;
    --font-serif: "Sawarabi Mincho", "Hiragino Mincho ProN", serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-serif);
    line-height: 1.6;
    overflow-x: hidden;
}

main {
    margin: 0 auto;
}

/* =========================================
   ナビゲーション
   ========================================= */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid #f5f5f5;
    z-index: 1000;
}

.nav-brand a {
    font-size: 1.4rem;
    color: var(--text-main);
    text-decoration: none;
    letter-spacing: 0.1em;
}

.nav-menu {
    cursor: pointer;
    font-size: 1.2rem;
    transition: opacity 0.3s;
}

.nav-menu:hover {
    opacity: 0.5;
}

/* サイドメニュー */
.side-menu {
    position: fixed;
    top: 0;
    right: -300px;
    width: 300px;
    height: 100%;
    background: var(--bg-color);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.03);
    transition: right 0.5s cubic-bezier(0.25, 1, 0.5, 1);
    z-index: 2000;
    padding: 100px 40px;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.side-menu.open {
    right: 0;
}

.side-menu a {
    text-decoration: none;
    color: var(--text-main);
    font-size: 1.1rem;
    border-bottom: 1px solid transparent;
    padding-bottom: 5px;
    width: fit-content;
    transition: border-color 0.3s;
}

.side-menu a:hover {
    border-bottom-color: var(--border-dark);
}

/* =========================================
   メインコンテンツ (縦書き一覧)
   ========================================= */
.tanka-container {
    display: block;
    column-width: 80px;
    column-gap: 5px;
    width: 95%;
    margin: 90px auto 50px;
    padding: 0;
    height: auto;
    overflow: visible;
    scroll-behavior: smooth;
}

.tanka-container::-webkit-scrollbar {
    height: 4px;
}

.tanka-container::-webkit-scrollbar-thumb {
    background: #f0f0f0;
}

.tanka-card {
    display: inline-block;
    width: fit-content;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    margin: 0 0 5px 0;
    padding: 15px 15px;
    border: 1px solid #eee;
    background: #fff;
    cursor: pointer;
    line-height: 2;
    transition: all 0.3s ease;
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
    letter-spacing: 0.15em;
    white-space: nowrap;
}

.tanka-card:hover {
    transform: scale(1.03);
    border-color: #333;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
    color: var(--text-sub);
}

.tanka-card-box {
    width: fit-content;
}

/* 文字サイズのバリエーション */
.size-sm {
    font-size: 0.7rem;
    opacity: 1;
}

.size-sm1 {
    font-size: 0.95rem;
    opacity: 1;
}

.size-md {
    font-size: 1.1rem;
    opacity: 0.9;
}

.size-md1 {
    font-size: 1.35rem;
    opacity: 0.9;
}

.size-lg {
    font-size: 1.55rem;
    opacity: 0.8;
}

.size-lg1 {
    font-size: 1.8rem;
    opacity: 0.8;
}

/* =========================================
   詳細表示 (ポップアップ)
   ========================================= */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.98);
    z-index: 4000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    padding: 60px;
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    margin: 0 auto;
    animation: fadeInUp 0.6s cubic-bezier(0.25, 1, 0.5, 1);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-body {
    display: flex;
    gap: 35px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}

.modal-tanka-section {
    display: flex;
    justify-content: center;
    align-items: center;
    width: fit-content;
    margin: 0 auto;
}


.modal-tanka-section .vertical-text {
    writing-mode: vertical-rl;
    min-height: 300px;
    max-height: 70vh;
    font-size: 2rem;
    line-height: 2;
    letter-spacing: 0.2em;
    margin-bottom: 20px;
    margin: 0;
}

.modal-info-section {
    flex: 1;
    min-width: 200px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.book-title {
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.author-name {
    color: var(--text-sub);
    margin-bottom: 30px;
}

.impression-box {
    padding: 20px 0;
    border-top: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 30px;
    color: #555;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    line-height: 1.8;
}

.modal-actions {
    display: flex;
    gap: 20px;
}

.btn-interest,
.btn-read,
.links-area a {
    background: none;
    border: 1px solid var(--border-dark);
    padding: 10px 25px;
    cursor: pointer;
    color: var(--text-main);
    font-family: var(--font-serif);
    transition: background 0.3s, color 0.3s;
}

.links-area {
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
}

.links-area a {
    text-decoration: none;
    color: #000000;
}

.btn-interest:hover,
.btn-read:hover,
.links-area a:hover {
    background: var(--accent-color);
    color: #fff;
}

.close-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    font-size: 3rem;
    background: none;
    border: none;
    cursor: pointer;
    color: #ccc;
    transition: color 0.3s;
    line-height: 1;
    z-index: 10;
}

.close-btn:hover {
    color: var(--text-main);
}

/* =========================================
   投稿フォーム (全画面)
   ========================================= */
.post-form {
    position: fixed;
    top: 100%;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-color);
    transition: top 0.5s cubic-bezier(0.25, 1, 0.5, 1);
    z-index: 3000;
    overflow-y: auto;
}

.post-form.active {
    top: 0;
}

.form-header {
    position: sticky;
    top: 0;
    background: #fff;
    padding: 30px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f5f5f5;
}

.post-form form {
    max-width: 600px;
    margin: 60px auto;
    padding: 0 40px;
    display: flex;
    flex-direction: column;
    gap: 35px;
}

.post-form input[type="text"],
.post-form input[type="url"],
.post-form textarea {
    width: 100%;
    border: none;
    border-bottom: 1px solid #ddd;
    padding: 15px 5px;
    font-size: 1rem;
    font-family: var(--font-serif);
    background: transparent;
    transition: border-color 0.3s;
}

.post-form input[name="tanka"] {
    font-size: 1.6rem;
    letter-spacing: 0.1em;
}

.post-form input:focus,
.post-form textarea:focus {
    outline: none;
    border-bottom-color: var(--border-dark);
}

.submit-btn {
    background: var(--button-bg);
    color: #fff;
    padding: 18px;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    font-family: var(--font-serif);
    letter-spacing: 0.2em;
    transition: opacity 0.3s;
}

.submit-btn:hover {
    opacity: 0.8;
}

.close-form-btn {
    font-size: 2rem;
    background: none;
    border: none;
    cursor: pointer;
    color: #ccc;
    transition: color 0.3s;
    text-align: right;
}

.close-form-btn:hover {
    color: var(--text-main);
}

/* =========================================
   共通パーツ
   ========================================= */
.fab {
    position: fixed;
    bottom: 40px;
    right: 40px;
    width: 60px;
    height: 60px;
    background: var(--button-bg);
    color: #fff;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    z-index: 500;
    transition: transform 0.3s;
}

.fab:hover {
    transform: scale(1.1);
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 120px 40px 60px;
}

.page-title {
    font-size: 2rem;
    font-weight: normal;
    margin-bottom: 60px;
    text-align: center;
    letter-spacing: 0.2em;
}

.mypage-section h2 {
    font-size: 1.2rem;
    font-weight: normal;
    margin-bottom: 30px;
    color: var(--text-sub);
}

.mypage-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 40px;
}

.tanka-card-mini {
    padding: 30px;
    border: 1px solid #f0f0f0;
    transition: border-color 0.3s;
    cursor: pointer;
}

.tanka-card-mini:hover {
    border-color: var(--border-dark);
}

.policy-text ul {
    padding-left: 20px;
    margin: 15px 0;
}

.policy-text li {
    margin-bottom: 10px;
}

/* =========================================
   レスポンシブ対応
   ========================================= */
@media (max-width: 768px) {
    .modal-content {
        padding: 60px 20px 40px;
        width: 95%;
    }

    .modal-tanka-section .vertical-text {
        font-size: 1.5rem;
        min-height: 250px;
        letter-spacing: 0.15em;
    }

    .modal-body {
        flex-direction: column;
        gap: 20px;
        justify-content: center;
        align-items: center;
    }

    .modal-tanka-section {
        width: fit-content;
    }

    .modal-info-section {
        width: 100%;
        min-width: unset;
    }

    .close-btn {
        top: 10px;
        right: 10px;
        font-size: 2.5rem;
    }
}