:root {
    --primary-color: #d32f2f;
    --bg-color: #fcfbf9;
    --sidebar-bg: #212121;
    --sidebar-text: #ffffff;
    --sidebar-hover: #424242;
    --text-color: #333333;
    --font-heading: 'Playfair Display', serif;
    --font-body: 'Noto Sans JP', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    display: flex;
    font-family: var(--font-body);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    height: 100vh;
    overflow: hidden;
}

.sidebar {
    width: 320px;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 2rem 0;
    flex-shrink: 0;
    z-index: 1000;
    position: relative;
    transition: width 0.2s ease;
}

/* Enable flyouts on hover while maintaining scrollability */
.sidebar:hover {
    overflow-x: visible;
    width: 620px; /* Expanded width to contain submenus */
    margin-right: -300px; /* Negative margin prevents content from shifting */
}

/* Ensure the dark background only stays on the left 320px */
.sidebar::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 320px;
    height: 100%;
    background-color: var(--sidebar-bg);
    z-index: -1;
}

.sidebar h2 {
    width: 320px; /* Keep header centered on the visible part */
    font-family: var(--font-heading);
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
    text-align: center;
    border-bottom: 2px solid var(--primary-color);
    padding: 0 1.5rem 0.5rem 1.5rem;
}

.sidebar-list {
    width: 320px; /* Keep list constrained to the visible part */
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-item {
    margin-bottom: 0.2rem;
    position: relative;
    padding: 0 1rem;
}

.sidebar-link {
    color: #ffffff;
    text-decoration: none;
    display: block;
    padding: 0.8rem 1rem;
    border-radius: 4px;
    transition: background-color 0.2s, color 0.2s;
    font-size: 1.05rem;
    font-weight: bold;
}

.sidebar-link:hover {
    background-color: var(--sidebar-hover);
    color: var(--primary-color);
}

.sidebar-sublist {
    position: absolute;
    left: 100%;
    top: -5px; /* Default: aligns near the top of the item */
    width: 300px;
    background-color: #2c2c2c;
    padding: 1.2rem;
    margin: 0;
    list-style: none;
    border: 1px solid #444;
    border-left: 4px solid var(--primary-color);
    box-shadow: 15px 0 35px rgba(0,0,0,0.5);
    display: none;
    z-index: 1001;
    border-radius: 0 8px 8px 8px;
}

/* For the last few items, flip the menu to open upwards to avoid clipping at the bottom */
.sidebar-item:nth-last-child(-n+7) .sidebar-sublist {
    top: auto;
    bottom: -5px;
    border-radius: 8px 8px 8px 0;
}

.sidebar-item:hover .sidebar-sublist {
    display: block;
}

.sidebar-subitem-l2, .sidebar-subitem-l3 {
    margin-bottom: 0.6rem;
}

.sidebar-subitem-l3 {
    padding-left: 1rem;
    border-left: 1px solid #555;
}

.sidebar-sublink {
    color: #cccccc;
    text-decoration: none;
    display: block;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.9rem;
    line-height: 1.4;
}

.sidebar-sublink:hover {
    color: #fff;
    background-color: var(--primary-color);
    transform: translateX(8px);
}

.content {
    flex-grow: 1;
    padding: 3rem 22rem 3rem 5rem; /* Extra right padding for the in-page TOC sidebar */
    overflow-y: auto;
    height: 100vh;
    position: relative;
}

h1, h2, h3, .title {
    font-family: var(--font-heading);
    color: #2c3e50;
    margin-bottom: 1rem;
    margin-top: 2rem;
}

h1 {
    font-size: 2.5rem;
    color: var(--primary-color);
    border-bottom: 1px solid #ddd;
    padding-bottom: 0.5rem;
}

h2 {
    font-size: 2rem;
}

h3 {
    font-size: 1.5rem;
}

p {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.title {
    font-size: 3.5rem;
    color: var(--primary-color);
    text-align: center;
    border: none;
    margin-top: 0;
}

.subtitle {
    font-size: 1.5rem;
    text-align: center;
    color: #666;
    margin-bottom: 3rem;
    font-family: var(--font-heading);
    font-style: italic;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: #f1f1f1; 
}
::-webkit-scrollbar-thumb {
    background: #888; 
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #555; 
}

@media (max-width: 768px) {
    body {
        flex-direction: column;
        overflow: auto;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        padding: 1.5rem 1rem;
        position: static;
        overflow: visible;
    }

    .sidebar h2 {
        font-size: 1.5rem;
    }

    .sidebar-sublist {
        position: static; /* No flyout on mobile */
        width: 100%;
        box-shadow: none;
        border-radius: 0;
        border-left: 2px solid var(--primary-color);
        padding-left: 1.5rem;
        background-color: transparent;
        display: none;
        margin-bottom: 1rem;
    }

    .sidebar-item:hover .sidebar-sublist,
    .sidebar-item:focus-within .sidebar-sublist {
        display: block;
    }
    
    .content {
        padding: 2rem 1rem;
        height: auto;
        overflow: visible;
    }
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    background-color: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

th {
    background-color: #f8f9fa;
    font-weight: bold;
    color: #2c3e50;
}

tr:hover {
    background-color: #f5f5f5;
}

.content-image {
    max-width: 600px;
    width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 2rem auto;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    display: block;
}

.full-width-image {
    max-width: 100%;
    width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 2rem 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: block;
    cursor: zoom-in;
    transition: transform 0.2s ease;
}

.full-width-image:hover {
    transform: scale(1.01);
}

/* Lightbox Styles */
.lightbox-overlay {
    display: none;
    position: fixed;
    z-index: 9999;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.9);
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lightbox-overlay.active {
    display: flex;
    opacity: 1;
}

.lightbox-content {
    max-width: 95vw;
    max-height: 95vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    cursor: zoom-out;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    user-select: none;
    transition: color 0.2s;
}

.lightbox-close:hover {
    color: #ccc;
}

.page-navigation-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-navigation-container.bottom {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid #ddd;
}

.page-navigation-container.top {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #ddd;
}

.nav-btn {
    display: inline-block;
    padding: 12px 24px;
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 1.1rem;
    font-weight: bold;
    transition: background-color 0.2s, transform 0.2s;
}

.nav-btn.next {
    margin-left: auto;
}

.nav-btn:hover {
    background-color: #b71c1c;
    color: white;
}

.nav-btn.prev:hover {
    transform: translateX(-4px);
}

.nav-btn.next:hover {
    transform: translateX(4px);
}

@media (max-width: 768px) {
    .page-navigation-container {
        flex-direction: column;
        gap: 1rem;
    }
    .page-navigation-container.bottom {
        margin-top: 2rem;
        padding-top: 1rem;
        border-top: 1px solid #ddd;
    }
    .page-navigation-container.top {
        margin-bottom: 2rem;
        padding-bottom: 1rem;
        border-bottom: 1px solid #ddd;
    }
    .nav-btn {
        padding: 10px 20px;
        font-size: 1rem;
        width: 100%;
        text-align: center;
    }
    .nav-btn.next {
        margin-left: 0;
    }
}

/* Interactive TOC Styles */
.interactive-toc {
    background-color: #fff;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    margin: 2rem 0;
}

.toc-intro {
    font-style: italic;
    color: #666;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 1rem;
}

.toc-list-l1 {
    list-style: none;
    padding: 0;
}

.toc-item-l1 {
    margin-bottom: 1.5rem;
}

.toc-link-l1 {
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--primary-color);
    text-decoration: none;
    display: block;
    margin-bottom: 0.5rem;
    transition: color 0.2s;
}

.toc-link-l1:hover {
    color: #b71c1c;
    text-decoration: underline;
}

.toc-list-l2 {
    list-style: none;
    padding-left: 1.5rem;
    border-left: 2px solid #f0f0f0;
}

.toc-item-l2 {
    margin-bottom: 0.5rem;
}

.toc-link-l2 {
    font-size: 1.1rem;
    color: #2c3e50;
    text-decoration: none;
    font-weight: bold;
}

.toc-item-l3 {
    margin-bottom: 0.3rem;
    padding-left: 1.5rem;
}

.toc-link-l3 {
    font-size: 1rem;
    color: #444;
    text-decoration: none;
}

.toc-item-l4 {
    margin-bottom: 0.2rem;
    padding-left: 3rem;
}

.toc-link-l4 {
    font-size: 0.95rem;
    color: #666;
    text-decoration: none;
}

.toc-link-l2:hover, .toc-link-l3:hover, .toc-link-l4:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

/* Destination Banner Styles */
.destination-banner {
    position: relative;
    width: 100%;
    max-width: 800px;
    margin: 2rem auto;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
}

.banner-image {
    width: 100%;
    height: 480px;
    object-fit: cover;
    display: block;
}

.banner-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 4rem 3rem 2.5rem 3rem;
    background: linear-gradient(to top, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.6) 60%, transparent 100%);
    color: white;
}

.banner-title {
    margin: 0;
    font-size: 3.8rem;
    font-family: var(--font-heading);
    color: #fff;
    border: none;
    padding: 0;
    text-shadow: 2px 4px 10px rgba(0,0,0,0.8), 0 0 20px rgba(0,0,0,0.6);
    letter-spacing: 1px;
    line-height: 1.2;
}

.banner-subtitle {
    margin: 0.8rem 0 0 0;
    font-size: 1.4rem;
    font-style: italic;
    color: #fdfdfd;
    opacity: 1;
    text-shadow: 1px 2px 6px rgba(0,0,0,0.9), 0 0 10px rgba(0,0,0,0.7);
}

.banner-caption {
    text-align: center;
    font-size: 0.9rem;
    color: #666;
    margin-top: -1rem;
    margin-bottom: 2rem;
    font-style: italic;
}

@media (max-width: 768px) {
    .banner-title {
        font-size: 2.5rem;
    }
    .banner-subtitle {
        font-size: 1.1rem;
    }
    .banner-image {
        height: 350px;
    }
    .banner-overlay {
        padding: 2rem 1.5rem 1.5rem 1.5rem;
    }
}

/* Page Mini-TOC (Sticky Right Sidebar) */
.page-mini-toc {
    position: fixed;
    right: 2rem;
    top: 5rem;
    width: 280px;
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    border-left: 4px solid var(--primary-color);
    border-radius: 8px;
    padding: 1.2rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    z-index: 1000;
    max-height: calc(100vh - 10rem);
    overflow-y: auto;
}

.mini-toc-title {
    font-weight: bold;
    font-size: 1rem;
    color: #444;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0;
    margin-bottom: 0.8rem;
    border-bottom: 1px solid #ddd;
    padding-bottom: 0.4rem;
}

.page-mini-toc .toc-link-l2 {
    font-size: 0.85rem;
    color: #555;
    font-weight: normal;
}
.page-mini-toc .toc-link-l3 {
    font-size: 0.8rem;
    color: #777;
}

/* At-a-glance Card */
.at-a-glance-card {
    background-color: #fdfbf7;
    border: 1px solid #e5dfd3;
    border-radius: 12px;
    padding: 2rem;
    margin: 2rem auto;
    max-width: 800px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.at-a-glance-title {
    font-family: var(--font-heading);
    color: var(--primary-color);
    font-size: 1.5rem;
    margin-top: 0;
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--primary-color);
    display: inline-block;
    padding-bottom: 0.2rem;
}

.at-a-glance-content {
    font-size: 1.05rem;
    line-height: 1.8;
    color: #444;
}

@media (max-width: 1200px) {
    .content {
        padding: 3rem 5rem;
    }
    .page-mini-toc {
        position: static;
        width: 100%;
        max-width: 800px;
        margin: 2rem auto;
        box-shadow: none;
        border: 1px solid #eee;
        border-left: 4px solid var(--primary-color);
    }
}

.currency {
    font-weight: bold;
    color: green;
}
