/* 基本設定：マレーシアをイメージした明るく温かいカラー */
:root {
    --primary-yellow: #FFCD00; /* マレーシア国旗の月と星 */
    --accent-red: #D1102D;    /* 情熱的な赤 */
    --deep-blue: #003087;      /* 誠実な紺色 */
    --tropical-green: #00A651; /* 豊かな自然 */
    --bg-cream: #FFFDF5;       /* 柔らかい背景色 */
    --text-color: #333;
}

body {
    font-family: 'Zen Maru Gothic', sans-serif;
    background-color: var(--bg-cream);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

/* ヘッダーのスタイル */
header {
    background-color: var(--deep-blue);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-yellow);
}

nav ul {
    list-style: none;
    display: flex;
    gap: 15px;
    margin: 0;
    padding: 0;
    color: var(--primary-yellow);
}

nav a {
    text-decoration: none;
    color: var(--primary-yellow);
    font-weight: bold;
    transition: color 0.3s;
}

nav a:hover {
    color: var(--accent-red);
}

/* コンテンツ表示の制御 */
/* すべてのページセクションを中央に寄せる */
.page {
    display: none; 
    padding: 2rem;
    max-width: 900px;  /* コンテンツの最大幅を少し広めに設定 */
    margin-left: auto;  /* ◀ 左の余白を自動計算 */
    margin-right: auto; /* ◀ 右の余白を自動計算 */
    animation: fadeIn 0.5s ease;
}

.page.active {
    display: block; 
}

/* --- スマホ・タブレット用スタイル (Media Queries) --- */

@media (max-width: 768px) {
    header {
        flex-wrap: wrap;
        padding: 0.8rem 1rem;
    }

    .menu-toggle {
        display: block; /* スマホのみ表示 */
        background: none;
        border: none;
        font-size: 1.5rem;
        color: var(--primary-yellow);
        cursor: pointer;
    }

    nav {
        display: none; /* 初期状態は隠す */
        width: 100%;
        margin-top: 10px;
    }

    nav.active {
        display: block; /* ボタン押下で表示 */
    }

    nav ul {
        flex-direction: column;
        gap: 10px;
        background: #fff;
        padding: 1rem;
        border-radius: 10px;
        box-shadow: 0 4px 10px rgba(0,0,0,0.1);
        color: var(--text-color);
    }

    .hero h1 {
        font-size: 1.5rem;
    }

    .page {
        padding: 1rem; /* 余白を狭くしてコンテンツを広く */
    }

    .places-grid, .food-grid {
        grid-template-columns: 1fr; /* スマホでは1列にする */
    }

    #kl-time {
        font-size: 2rem;
    }
}

/* PC用：メニューボタンを隠す */
@media (min-width: 769px) {
    .menu-toggle {
        display: none;
    }
    nav {
        display: block !important;
    }
}

/* ヒーローセクション（トップページ） */
.hero {
    text-align: center;
    padding: 1rem 1rem;
    background: linear-gradient(135deg, var(--primary-yellow), #ffe574);
    border-radius: 20px;
    margin-bottom: 1rem;
}

/* スライドショーのコンテナ */
/* スライドを包む外枠 */
.slideshow-container {
    width: 100%;
    overflow: hidden; /* はみ出た分を隠す */
    position: relative;
    padding:0 0 20px 0;
}

.slides-wrapper {
    display: flex !important;
    flex-wrap: nowrap !important;
    /* transitionはJS側で制御するので、ここでは初期値のみ */
    will-change: transform;
}

.slide-item {
    width: 100%; 
    flex-shrink: 0;
    margin: 0 15px;
    opacity: 0.3;
    transform: scale(0.85);
    transition: opacity 0.8s ease, transform 0.8s ease; /* 透明度と拡大だけCSSで制御 */
    position: relative;
}

.slide-item.center {
    opacity: 1;
    transform: scale(1);
}

.slide-item img {
    width: 100%;
    height: 500px;
    object-fit: cover;
    border-radius: 20px;
    display: block; /* 余計な隙間を消す */
}

.slide-text {
    position: absolute;
    bottom: 20px;       /* 帯にするなら下ぴったり（0）に付けるのがおすすめです */
    left: 0;         /* 左端から */
    width: 100%;     /* 右端まで（幅100%） */
    
    color: white;
    background: rgba(0,0,0,0.6); /* 帯にするなら少し濃いめ（0.6）が締まります */
    
    padding: 2px 10px;        /* 上下15px、左右10pxの余白 */
    text-align: center;       /* 文字は中央に寄せる */
    
    /* 帯状にするため、角丸（border-radius）は削除します */
    
    font-size: 0.9rem;
    opacity: 1;               /* 表示 */
    transition: 0.5s;
    
    z-index: 10;              /* 画像より前に出す */
    box-sizing: border-box;  /* paddingを含めて100%にするおまじない */
}


/* スマホ用設定（768px以下）を一括管理 */
@media (max-width: 60vw) {
    .slide-item { min-width: 85%; }

    .slide-item img {
        height: 50px; /* ここを希望の高さ（半分の値）に変更 */
        object-fit: cover;
    }

    .slideshow-container {
        width: 100vw;
        margin-left: calc(-50vw + 50%);
        margin-right: calc(-50vw + 50%);
        padding: 0;
    }
}

.gm-style-iw-button {
    display: none !important;
}

/* 1. InfoWindow全体の枠と×ボタンを制御 */
.gm-style-iw-c {
    padding: 0 !important; /* 標準の余白をゼロに */
    border-radius: 12px !important;
}

/* 2. 右上の×ボタンを強制的に非表示にする */
.gm-ui-hover-text, 
.gm-style-iw-t::after, 
.gm-style-iw-button__container,
.gm-style-iw-button, 
.gm-style-iw-button-icon {
    display: none !important;
}

/* 3. 中身のスクロールバーや余白を消す */
.gm-style-iw-d {
    overflow: hidden !important;
    padding: 0 !important;
    max-height: none !important;
}

.custom-hover-box {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px;
    background: white;
    min-width: 280px;
}

.hover-img {
    width: 85px;
    height: 85px;
    border-radius: 10px;
    object-fit: cover;
    border: 3px solid #deb887;
    flex-shrink: 0;
}

.hover-name {
    font-size: 1.1rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 4px;
}

.hover-title {
    font-size: 0.85rem;
    color:#666;
    line-height: 1.4;
}

.custom-popup {
    position: fixed;
    display: none;
    background: white;
    padding: 10px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    z-index: 9999 !important; /* 地図やヘッダーより上に */
    pointer-events: none;
    align-items: center;
    gap: 15px;
    width: 320px;
    border: 1px solid #eee;
    left: 0; /* JSで上書きされる前の初期値 */
    top: 0;
}


#popup-img {
    width: 110px !important; /* 写真を大きく固定 */
    height: 110px !important;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid #deb887;
    flex-shrink: 0;
}

.popup-content h4 {
    margin: 0 0 5px;
    font-size: 1.1rem;
    color: #333;
}

.popup-content p {
    margin: 0;
    font-size: 0.85rem;
    color: #666;
}

/* カード型レイアウト（場所・食事） */
.card {
    background: white;
    border-radius: 15px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    border-left: 5px solid var(--tropical-green);
}

/* 今日のマレー語セクション */
.phrase-box {
    background-color: white;
    padding: 2rem;
    text-align: center;
    border-radius: 15px;
    border: 3px dashed var(--primary-yellow);
}

.phrase-box h3 {
    font-size: 2rem;
    color: var(--deep-blue);
    margin-bottom: 0.5rem;
}

.hidden {
    display: none;
}

/* ボタンの共通スタイル */
.btn {
    background-color: var(--deep-blue);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    margin-top: 1rem;
}

.btn:hover {
    opacity: 0.8;
}

/* 前後ナビゲーションのコンテナ */
.article-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding: 10px 0;
}

/* 矢印ボタン本体 */
.nav-btn {
    background: #deb887;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: 0.3s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.nav-btn:hover {
    background: #c5a075;
}

.nav-btn:disabled {
    background: #eee;
    color: #ccc;
    cursor: not-allowed;
}

/* モバイル用の調整 */
@media (max-width: 768px) {
    .nav-btn {
        padding: 8px 15px;
        font-size: 1rem;
    }
}

/* フッターとSNS */
footer {
    background-color: #333;
    color: white;
    padding: 40px 20px;
    text-align: center;
}

.footer-container {
    max-width: 1000px;
    margin: 0 auto;
}

/* 区切り線 */
.footer-divider {
    border: 0;
    border-top: 1px solid #555;
    margin: 30px 0;
}

/* お役立ちリンクのタイトル */
.useful-links h4 {
    color: var(--primary-yellow);
    margin-bottom: 20px;
    font-size: 1.2rem;
}

/* リンクを横並びにするレイアウト（Flexbox） */
.link-grid {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 20px;
    text-align: left; /* リスト内は左寄せで見やすく */
}

.link-group h5 {
    font-size: 1rem;
    margin-bottom: 10px;
    color: #eee;
    border-bottom: 1px solid var(--primary-yellow);
    display: inline-block;
}

.link-group ul {
    list-style: none;
    padding: 0;
}

.link-group ul li {
    margin: 8px 0;
}

.link-group ul li a {
    color: #bbb;
    text-decoration: none;
    font-size: 0.85rem;
    transition: 0.3s;
}

.link-group ul li a:hover {
    color: var(--primary-yellow);
}

/* スマホ表示の調整 */
@media (max-width: 768px) {
    .link-grid {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
}

.sns-btn {
    display: inline-block;
    padding: 5px 15px;
    margin: 0 5px;
    border-radius: 5px;
    text-decoration: none;
    color: white;
    font-size: 0.9rem;
}

.x-btn { background-color: #000; }
.ig-btn { background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888); }

/* フェードインアニメーション */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* マップコンテナ（親） */
#map-container {
    position: relative;
    overflow: hidden; /* ポップアップがはみ出さないように */
}

/* ホバーポップアップ本体（初期状態は非表示） */
.map-tooltip {
    position: absolute;
    background: white;
    padding: 10px;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 10px;
    pointer-events: none; /* マウスイベントを透過させて、地図の操作を邪魔しない */
    opacity: 0; /* 透明 */
    transform: translate(-50%, -110%) scale(0.9); /* 位置調整とアニメーション初期値 */
    transition: all 0.2s ease-out; /* ふわっと表示 */
    z-index: 10; /* 地図より上に */
    width: 250px; /* 横幅 */
}

/* 表示時のスタイル */
.map-tooltip.visible {
    opacity: 1;
    transform: translate(-50%, -110%) scale(1);
}

/* ポップアップ内の写真（丸くする） */
.tooltip-img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover; /* 画像を綺麗に収める */
    border: 2px solid #deb887; /* Sachiさんのテーマカラー */
}

/* テキスト部分 */
.tooltip-content {
    flex: 1;
}

.tooltip-name {
    margin: 0;
    font-size: 1rem;
    color: #333;
    font-weight: bold;
}

.tooltip-title {
    margin: 3px 0 0;
    font-size: 0.8rem;
    color: #666;
    display: -webkit-box; /* 2行で省略 */
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}


/* マレー語詳細の装飾 */
.phrase-card {
    background: #fff;
    padding: 3rem; /* 内側の余白をたっぷり取る */
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
    max-width: 700px; /* カードが広がりすぎないように制限 */
    margin: 0 auto;   /* カード自体を中央寄せ */
    text-align: center; /* 基本は中央揃え */
}

.pronunciation {
    color: var(--accent-red);
    font-weight: bold;
    font-size: 0.9rem;
}

.meaning {
    font-size: 1.2rem;
    background: var(--primary-yellow);
    display: inline-block;
    padding: 2px 10px;
    border-radius: 5px;
}

.nuance-box, .example-box, .tips {
    margin-top: 1.5rem;
    text-align: left;
    border-top: 1px solid #eee;
    padding-top: 1rem;
}

.chat {
    background: #f9f9f9;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 5px;
    font-size: 0.95rem;
}

.chat span {
    font-weight: bold;
    color: var(--deep-blue);
}

.tips {
    background: #fff9e6;
    padding: 1rem;
    border-radius: 10px;
    border: 1px solid var(--primary-yellow);
}

/* マレーシア時計のスタイル */
.malaysia-clock {
    background: rgba(0, 48, 135, 0.1); /* 深紺色を薄く */
    border: 2px solid var(--deep-blue);
    display: inline-block;
    padding: 15px 30px;
    border-radius: 50px;
    margin-top: 20px;
    backdrop-filter: blur(5px);
}

.clock-label {
    display: block;
    font-size: 0.8rem;
    color: var(--deep-blue);
    font-weight: bold;
    margin-bottom: 5px;
}

#kl-time {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--accent-red);
    font-family: 'Courier New', Courier, monospace; /* デジタル時計風 */
    line-height: 1;
}

#kl-date {
    font-size: 0.9rem;
    color: var(--text-color);
}

/* 場所ページのレイアウト */
/* タイトルなども中央揃えにする */
.section-title {
    text-align: center;
    margin-bottom: 2rem;
    width: 100%;
}

.places-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); /* 幅300px以上で自動配置 */
    gap: 2rem;
    padding: 10px;
}

.place-card {
    background: white;
    border-radius: 20px;
    overflow: hidden; /* 角丸からはみ出る画像やマップをカット */
    box-shadow: 0 10px 25px rgba(0,0,0,0.08);
    transition: transform 0.3s ease;
}

.place-card:hover {
    transform: translateY(-5px); /* ホバー時にふわっと浮く */
}

.place-image img {
    width: 100%;
    height: 200px;
    object-fit: cover; /* 画像を比率維持で切り抜き */
    display: block;
}

.place-info {
    padding: 1.5rem;
}

.place-info h3 {
    margin-top: 0;
    color: var(--deep-blue);
    font-size: 1.2rem;
}

.place-info p {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 1rem;
}

.map-embed {
    border-radius: 10px;
    overflow: hidden;
    background: #eee;
}

/* スライダーのコンテナ */
.place-slider {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 0px;
    padding-bottom: 15px;
    -webkit-overflow-scrolling: touch; /* iOSスワイプ改善 */
}

/* 各写真のサイズ */
.place-slider img {
    flex: 0 0 100%; /* 1枚ずつ表示 */
    width: 100%;
    height: 400px;
    object-fit: cover;
    scroll-snap-align: start;
    cursor: zoom-in;
}

@media (max-width: 769px) {
    .place-slider img { height: 250px; }
}



/* スクロールバーのカスタマイズ（任意） */
.place-slider::-webkit-scrollbar {
    height: 6px;
}
.place-slider::-webkit-scrollbar-thumb {
    background: #deb887;
    border-radius: 10px;
}

/* 写真を入れる枠（コンテナ）の設定 */
.food-image-container {
    position: relative;
    width: 100%;
    height: 400px; /* 写真の高さを固定（お好みで調整） */
    background:transparent; /* ここを #f0f0f0 から透明に変更 */
    overflow: hidden;
    border-radius: 8px; /* 角を少し丸くする */
    margin-bottom: 15px;
}

/* スマホ表示の調整 */
@media (max-width: 768px) {
    .food-image-container {
        position: relative;
        height: 200px;
        background: #eee;
    }
}

#latest-food-container {
    min-height: 400px;
}

/* 料理写真と外観写真の共通設定 */
.img-food, .img-shop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; /* 枠いっぱいにきれいに収める */
    transition: opacity 0.3s ease; /* 切り替えをふわっとさせる */
}

.img-food.active, .img-shop.active {
    z-index: 2;
}

/* 写真切り替えボタン（写真の右下に配置） */
.photo-switcher {
    position: absolute !important;
    bottom: 10px !important;
    right: 10px !important;
    background: transparent !important; /* 背景を透明に強制 */
    background-color: transparent !important;
    border: none !important;
    padding: 0 !important;
    display: flex !important;
    gap: 8px !important;
}

/* 写真切り替えボタンの親要素を完全に透明にする */
#latest-container .photo-switcher {
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
}

.photo-switcher button {
    padding: 6px 14px;
    border: 1px solid rgba(255, 255, 255, 0.5); /* 軽く白枠をつける（写真の上で見やすくするため） */
    background: rgba(255, 255, 255, 0.8); /* ボタン自体の背景は白っぽく */
    cursor: pointer;
    border-radius: 20px;
    font-size: 0.75rem;
    color: #333;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    transition: all 0.2s ease;
}

.photo-switcher button.active {
    background: #deb887; /* ベージュ */
    color: white;
    border-color: #deb887;
    font-weight: bold;
}

/* 価格タグ */
.price-tag {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.9rem;
    z-index: 5;
}

.map-link {
    display: inline-block;
    padding: 10px 15px;
    background-color: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 5px;
    color: #d2a679;
    text-decoration: none;
    font-size: 0.9rem;
    margin-top: 10px;
}

.map-link:hover {
    background-color: #eee;
}

.archive-list {
    list-style: none;
    padding: 0;
    text-align: left;
    max-width: 800px;
    margin: 0 auto;
}
.archive-list li {
    padding: 10px;
    border-bottom: 1px solid #eee;
    display: flex;
    gap: 20px;
}
.archive-list .date {
    color: #888;
    font-size: 0.9rem;
    min-width: 100px;
}
.archive-list a {
    color: #333;
    text-decoration: none;
}
.archive-list a:hover {
    color: var(--primary-yellow);
    text-decoration: underline;
}

.archive-item:hover {
    background-color: #fff9f0 !important; /* 薄いベージュ */
    transition: background-color 0.2s ease;
}

.archive-item strong:hover {
    color: #deb887; /* タイトルの色を変える */
}

.archive-item {
    transition: transform 0.1s ease;
}

.archive-item:active {
    transform: scale(0.98); /* クリックした瞬間に少し沈む演出 */
}

.archive-item strong {
    color: #444;
    text-decoration: none;
}

.archive-item:hover strong {
    text-decoration: underline; /* ホバーで下線を表示 */
}

/* 過去のフレーズ一覧の枠も中央に寄せる */
#archive {
    max-width: 700px;   /* リストが広がりすぎないように制限 */
    margin: 2rem auto;  /* 上下に2rem、左右は中央寄せ */
    padding: 2rem;
    background-color: #fff;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

/* リスト内の文字が左端に当たらないようにパディングを追加 */
#phrase-list {
    padding-left: 1.5rem; /* 左側にしっかり余白を作る */
    padding-right: 1.5rem;
}

/* 各リスト項目 */
#phrase-list li {
    padding: 15px 0;
    border-bottom: 1px solid #eee;
    transition: background 0.3s;
}

/* リンクをクリックしやすく、少し内側に寄せる */
#phrase-list li a {
    display: block;
    padding-left: 5px; 
    text-decoration: none;
    color: var(--text-color);
}

#phrase-list li:hover {
    background-color: #fffde7; /* ホバー時に少し色を変えて反応を出す */
}

/* 拡大表示用の背景（flexで中央揃え） */
#photo-modal {
    display: none;
    position: fixed;
    z-index: 2000; /* 最前面に */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95); /* より黒く */
    align-items: center;
    justify-content: center;
    /* スマホのスワイプ操作のために touch-action を調整（任意） */
    touch-action: pan-y; 
}

/* 拡大画像 */
#photo-modal img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    transition: transform 0.3s ease; /* 切り替え時のアニメーション */
}

/* 矢印ボタンの設定を強化 */
.modal-prev, .modal-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3000 !important; /* 画像（2000）より上に */
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    padding: 20px 15px;
    font-size: 40px;
    cursor: pointer;
}

/* 画像自体のクリックで閉じないように調整（画像以外をクリックで閉じる場合） */
#modal-img {
    position: relative;
    z-index: 2500;
    pointer-events: auto; /* 画像へのクリックは有効に */
}

.modal-prev:hover, .modal-next:hover {
    background: rgba(255, 255, 255, 0.3);
}

.modal-prev { left: 10px; }
.modal-next { right: 10px; }

/* 閉じるボタン */
.close-btn {
    position: absolute;
    top: 15px;
    right: 25px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 35px;
    cursor: pointer;
    z-index: 2020;
}
.close-btn:hover { color: white; }

/* キャプション（番号表示） */
#modal-caption {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    background: rgba(0,0,0,0.5);
    padding: 5px 10px;
    border-radius: 4px;
}

/* スマホ表示の調整 */
@media (max-width: 768px) {
    .modal-prev, .modal-next {
        font-size: 24px;
        padding: 10px 5px;
        background: rgba(255, 255, 255, 0.05); /* より薄く */
    }
}