@import url('https://fonts.googleapis.com/css2?family=BIZ+UDPGothic&family=Google+Sans:ital,opsz,wght@0,17..18,400..700;1,17..18,400..700&display=swap');
@import url('https://fonts.googleapis.com/icon?family=Material+Icons');

:root {
    --primary-color: #4CAF50;
    --secondary-color: #2E7D32;
    --text-color: #333;
    --bg-color: #f9f9f9;
    --card-bg: #ffffff;
    --header-height: 70px;
    --transition-speed: 0.3s;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Google Sans', 'BIZ UDPGothic', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.85;
    letter-spacing: 0.04em;
    overflow-x: hidden;
    /* 固定ヘッダーの分だけ余白を確保 */
    padding-top: var(--header-height);
}

/* Site Header */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--header-height);
    background: rgba(255, 255, 255, 0.80);
    /* 透過度を下げて視認性アップ */
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 5%;
    z-index: 9999;
    /* 確実に最前面 */
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.05);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.logo img {
    height: 50px;
    width: auto;
    display: block;
}

nav ul {
    display: flex;
    list-style: none;
    gap: 30px;
}

nav a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    letter-spacing: 0.05em;
    transition: all var(--transition-speed) ease;
    position: relative;
    padding: 5px 0;
}

nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-color);
    transition: width var(--transition-speed);
}

nav a:hover {
    color: var(--primary-color);
}

nav a:hover::after {
    width: 100%;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: all var(--transition-speed);
}

/* Banner */
.banner {
    width: 100%;
    height: 60vh;
    background: url('/images/background.webp') no-repeat center center/cover;
    position: relative;
    margin-top: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.banner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
}

.banner-content {
    position: relative;
    color: white;
    text-align: center;
    z-index: 1;
}

.banner-content h1 {
    font-size: 3rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-shadow: 2px 2px 10px rgba(0, 0, 0, 0.5);
    margin-bottom: 20px;
}

/* Slim Banner for Sub-pages */
.banner.banner-slim {
    height: 30vh;
}

.banner.banner-slim h1 {
    font-size: 2rem;
}

/* Main Content */
main {
    max-width: 1100px;
    margin: 40px auto;
    padding: 0 20px;
}

section {
    margin-bottom: 60px;
}

h2 {
    font-size: 2rem;
    margin-bottom: 30px;
    letter-spacing: 0.08em;
    line-height: 1.4;
    position: relative;
    padding-bottom: 10px;
}

h2::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 50px;
    height: 4px;
    background: var(--primary-color);
}

/* Note List */
.note-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
}

.note-card {
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform var(--transition-speed), box-shadow var(--transition-speed);
}

.note-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.note-card-content {
    padding: 20px;
}

.note-card-meta {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 10px;
}

.note-card-title {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    margin-bottom: 10px;
    color: var(--text-color);
}

.note-card-excerpt {
    font-size: 0.95rem;
    color: #666;
    line-height: 1.7;
    letter-spacing: 0.02em;
    margin-bottom: 20px;
}

.btn-readmore:hover {
    background-color: var(--secondary-color);
}

/* Common Button Styles */
.btn {
    display: inline-block;
    padding: 10px 25px;
    border-radius: 30px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: 0.05em;
    transition: all var(--transition-speed);
    cursor: pointer;
    border: none;
    text-align: center;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.2);
}

.btn-primary:hover {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.3);
}

.btn-outline {
    background-color: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline:hover {
    background-color: var(--primary-color);
    color: white;
}

.btn-secondary {
    background-color: #333;
    color: white;
}

.btn-secondary:hover {
    background-color: #555;
    transform: translateY(-2px);
}

/* Links Grid & Cards */
.links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
    margin-top: 30px;
}

.link-card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    text-align: left;
    transition: all var(--transition-speed);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border: 1px solid rgba(0, 0, 0, 0.03);
    text-decoration: none;
    color: inherit;
}

.link-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-color);
}

.link-icon {
    font-size: 3rem;
    margin-bottom: 15px;
    display: block;
    color: var(--primary-color);
    text-align: center;
}

.material-icons {
    font-size: inherit;
    vertical-align: middle;
}

.link-card h3 {
    margin-bottom: 10px;
    color: var(--secondary-color);
    font-size: 1.2rem;
    letter-spacing: 0.05em;
}

.link-card p {
    color: #666;
    font-size: 0.9rem;
    line-height: 1.7;
    letter-spacing: 0.02em;
    margin-bottom: 20px;
}

.link-url {
    font-size: 0.8rem;
    color: var(--primary-color);
    word-break: break-all;
    margin-top: auto;
}

.link-card img.link-banner {
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: 60px;
    margin: 0 auto 15px;
    display: block;
    border-radius: 4px;
    transition: transform 0.3s ease;
}

.link-card:hover img.link-banner {
    transform: scale(1.05);
}

/* Footer */
footer {
    background-color: #333;
    color: white;
    padding: 40px 0;
    text-align: center;
    letter-spacing: 0.05em;
}

.footer-content {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

.footer-logo {
    height: 40px;
    margin-bottom: 20px;
}

footer a {
    color: #fff;
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
    .banner-content h1 {
        font-size: 2rem;
    }

    nav {
        margin-top: 10px;
    }

    nav ul {
        gap: 15px;
        font-size: 0.9rem;
    }
}

/* Note Page Specific */
.post-navigation {
    margin-bottom: 20px;
    padding-top: 20px;
    /* バナーが消えた後の上部余白 */
}

.btn-back {
    text-decoration: none;
    color: #666;
    font-size: 0.9rem;
    transition: color var(--transition-speed);
}

.btn-back:hover {
    color: var(--primary-color);
}

.post-detail {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    position: relative;
    z-index: 1;
}

/* Note記事詳細ページの背景を方眼にする */
body.is-post {
    background-color: #fff;
    background-image:
        linear-gradient(rgba(0, 0, 0, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 0, 0, 0.05) 1px, transparent 1px);
    background-size: 30px 30px;
}




.post-header-inner {
    margin-bottom: 30px;
    border-bottom: 1px solid #eee;
    padding-bottom: 20px;
}

.post-title-detail {
    font-size: 2rem;
    /* トップより小さめに設定 */
    margin: 10px 0;
    letter-spacing: 0.05em;
    line-height: 1.3;
    color: var(--text-color);
}

.post-tags {
    margin-top: 10px;
}

.tag {
    display: inline-block;
    background: #f0f0f0;
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    color: #666;
    text-decoration: none;
    margin-right: 5px;
}

.post-footer {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #eee;
    text-align: center;
}

.post-content h1,
.post-content h2,
.post-content h3 {
    margin-top: 40px;
    margin-bottom: 20px;
}

.post-content h2 {
    font-size: 1.6rem;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
    letter-spacing: 0.05em;
}

.post-content h3 {
    font-size: 1.3rem;
    border-left: 5px solid var(--primary-color);
    padding-left: 15px;
    color: var(--secondary-color);
    letter-spacing: 0.05em;
}

/* 画像・メディア要素の共通ベース */
.post-content img,
.post-content video,
.post-content figure {
    display: block;
    max-width: 100%;
    margin: 30px auto;
    border-radius: 12px;
}

/* 記事内画像サイズ定義 */
/* 大サイズ (デフォルト) */
.post-content img,
.post-content figure,
.post-content .size-l {
    width: 80%;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* 小サイズ (2枚並ぶ程度の大きさ) */
.post-content .size-s,
.post-content figure.size-s {
    width: 40%;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

/* 全幅サイズ (必要に応じて) */
.post-content .size-full {
    width: 100%;
}

/* 2枚並び用グリッド */
.img-grid {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin: 30px 0;
}

.img-grid figure,
.img-grid img {
    margin: 0 !important;
    flex: 1;
    width: 100% !important;
}

/* キャプション付き画像 (figure/figcaption) の調整 */
.post-content figure img {
    width: 100% !important;
    margin: 0 !important;
    box-shadow: none !important;
    /* figure自体にシャドウがあるため */
}

.post-content figcaption {
    text-align: center;
    font-size: 0.9rem;
    color: #666;
    margin-top: 10px;
    letter-spacing: 0.03em;
}

/* iframeのスタイリング（YouTube等） */
.post-content iframe:not(.twitter-tweet):not([id^="twitter-widget-"]) {
    display: block;
    width: 60%;
    max-width: 100%;
    margin: 30px auto;
    border: none;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* YouTubeなどは16:9に */
.post-content iframe[src*="youtube.com"],
.post-content iframe[src*="youtube-nocookie.com"] {
    aspect-ratio: 16 / 9;
}

/* Twitter埋め込みの最適化 */
.post-content .twitter-tweet {
    margin: 30px auto !important;
    max-width: 550px !important;
    /* PCでの自然な最大幅 */
    min-width: 0 !important;
}

/* Twitterウィジェット自体の装飾（はみ出し回避版） */
.post-content .twitter-tweet iframe {
    max-width: 100% !important;
    margin: 0 auto !important;
    display: block !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1) !important;
    border-radius: 12px !important;
    border: 1px solid rgba(0, 0, 0, 0.05) !important;
}

/* モバイル環境（全幅対応） */
@media (max-width: 768px) {

    .post-content img,
    .post-content video,
    .post-content iframe,
    .post-content figure,
    .post-content .img-small,
    .post-content .img-large {
        width: 100% !important;
        margin: 20px 0;
    }

    .img-grid {
        flex-direction: column;
    }
}

/* テーブルのラップ要素（スクロール用） */
.table-wrapper {
    width: 100%;
    overflow-x: auto;
    margin: 30px 0;
    -webkit-overflow-scrolling: touch;
    /* iOSでのスクロールを滑らかにする */
}

/* ノート専用テーブル（note-table） */
.post-content .note-table {
    width: auto;
    max-width: none;
    border-collapse: collapse;
    margin: 30px auto;
    background: #fff;
    border: 1px solid #ddd;
    table-layout: auto;
}

.vertical-text {
    writing-mode: vertical-rl;
    text-orientation: upright;
    white-space: nowrap;
    padding: 10px !important;
}

.post-content .note-table td,
.post-content .note-table th {
    padding: 12px;
    border: 1px solid #ccc;
    line-height: 1.4;
    word-break: normal;
    /* 折り返しを標準に戻し、必要ならスクロールさせる */
}

/* スマホ表示時の最適化 */
@media (max-width: 768px) {
    .post-content .note-table {
        width: max-content;
        /* セル幅を維持して横スクロールさせる */
        margin: 10px 0;
    }

    .post-content .note-table td {
        font-size: 0.8rem !important;
        padding: 6px !important;
    }
}

.post-content a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    position: relative;
    padding: 0 2px;
    background: rgba(76, 175, 80, 0.05);
    /* 薄い背景色 */
    border-radius: 4px;
    transition: all var(--transition-speed);
}

.post-content a:hover {
    background: rgba(76, 175, 80, 0.15);
    color: var(--secondary-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* 記事内リンクの下線アニメーション（お好みで） */
.post-content a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 1px;
    background: var(--primary-color);
    transform: scaleX(0);
    transition: transform var(--transition-speed);
    transform-origin: right bottom;
}

.post-content a:hover::after {
    transform: scaleX(1);
    transform-origin: left bottom;
}

.post-content ul {
    margin-left: 20px;
    margin-bottom: 20px;
}

.post-content li {
    list-style: none;
    /* Custom dot */
    position: relative;
    padding-left: 20px;
}

.post-content li::before {
    content: '・';
    position: absolute;
    left: 0;
}

/* Download Page & Content Cards */
.download-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 50px;
}

.download-card {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    text-align: center;
    transition: transform var(--transition-speed);
    max-width: 450px;
    margin: 0 auto;
}

.download-card:hover {
    transform: translateY(-5px);
}

.download-card h3 {
    margin-bottom: 15px;
    color: var(--secondary-color);
}

.download-card p {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 25px;
    line-height: 1.6;
    min-height: 3em;
}

.banner-preview {
    width: 100%;
    max-width: 400px;
    height: auto;
    margin: 0 auto 25px;
    display: block;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border: 1px solid #eee;
    transition: transform 0.3s ease;
}

.banner-preview:hover {
    transform: scale(1.02);
}

/* Message Boxes */
.msg-box {
    padding: 15px 20px;
    border-radius: 12px;
    margin: 25px 0;
    border-left: 6px solid #ccc;
    position: relative;
    line-height: 1.7;
    background: #f0f0f0;
}

.msg-info {
    background: #e3f2fd;
    border-color: #2196f3;
    color: #0d47a1;
}

.msg-success {
    background: #e8f5e9;
    border-color: #4caf50;
    color: #1b5e20;
}

.msg-warning {
    background: #fff3e0;
    border-color: #ff9800;
    color: #e65100;
}

.msg-danger {
    background: #ffebee;
    border-color: #f44336;
    color: #b71c1c;
}

.msg-note {
    background: #f3e5f5;
    border-color: #9c27b0;
    color: #4a148c;
}

/* Note Specific Elements */
.post-thumbnail {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    /* Fixed cropping issue (removed max-height and object-fit) */
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
    display: block;
}

.note-author {
    font-size: 0.8rem;
    color: #666;
    text-align: right;
    margin-top: 10px;
    display: block;
    background: #f2f2f2;
    padding: 3px 12px;
    border-radius: 20px;
    float: right;
    /* Align right as author name */
}

.note-author::before {
    content: 'by ';
}

.note-toc {
    background: #f7f7f7;
    border: 2px solid #e0e0e0;
    padding: 20px;
    border-radius: 10px;
    margin: 30px 0;
    max-width: 500px;
    /* Reduced width */
    width: 100%;
}

.note-toc-title {
    font-weight: bold;
    font-size: 1.1rem;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--secondary-color);
    border-bottom: 1px solid #ddd;
    padding-bottom: 8px;
}

.note-toc ul {
    list-style: none;
    padding-left: 0;
    margin-bottom: 0;
}

.note-toc ul ul {
    margin: 5px 0 10px 1.5rem;
    padding-left: 0.8rem;
    border-left: 2px solid #ddd;
}

.note-toc li {
    margin-bottom: 8px;
    line-height: 1.4;
}

.note-toc li a {
    text-decoration: none;
    color: #000 !important;
    transition: all 0.2s;
    font-size: 0.95rem;
    display: inline-block;
    padding: 3px 0;
}

.note-toc li a:hover {
    color: var(--primary-color);
    transform: translateX(5px);
}

/* Clearfix for author float */
.post-content::after {
    content: "";
    clear: both;
    display: table;
}