:root {
    /* Color Palette - Light/Cream/Gold Theme (Default) */
    --c-bg: #f8f9fa;      /* Off-white/light gray background */
    --c-surface: #ffffff; /* White surface for cards */
    --c-text: #2c3338;    /* Dark gray main text */
    --c-text-muted: #667580; /* Muted gray text */
    --c-accent: #b59b56;  /* Soft gold, slightly darker for better contrast */
    --c-accent-dark: #8c763d;
    --c-border: rgba(181, 155, 86, 0.25); /* Darker gold border for visibility */
    --c-header-bg: rgba(248, 249, 250, 0.9);
    --c-bg-rgb: 248, 249, 250;
    --c-on-accent: #2c3338;
    --c-disabled: #c0c4c8;
    --c-glass-bg: rgba(0, 0, 0, 0.03);
    --c-glass-hover: rgba(0, 0, 0, 0.08);
    --c-border-glass: rgba(0, 0, 0, 0.05);
    --c-border-glass-strong: rgba(0, 0, 0, 0.1);
    --c-shadow: rgba(0,0,0,0.1);
    --c-shadow-strong: rgba(0,0,0,0.2);
    --c-hero-shadow: 0 0 30px rgba(255,255,255,0.9), 0 0 15px rgba(255,255,255,1), 0 4px 20px rgba(255,255,255,0.8);
    --c-bg-transparent: rgba(248, 249, 250, 0.85);

    /* Typography */
    --f-serif: 'Noto Serif JP', serif;
    --f-sans: 'Noto Sans JP', sans-serif;
    
    /* Transitions */
    --transition-slow: 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
    --transition-fast: 0.3s ease;
}

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

html {
    /* scroll-behavior: smooth; (removed to prevent conflict with Lenis) */
}

body {
    background-color: var(--c-bg);
    color: var(--c-text);
    font-family: var(--f-sans);
    line-height: 1.8;
    overflow-x: hidden;
}

.serif {
    font-family: var(--f-serif);
    font-weight: 300;
}

.center {
    text-align: center;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 5vw;
}

.section-padding {
    padding: 10rem 0;
}

/* Header */
header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 0.5rem 5vw;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    transition: background-color var(--transition-fast), padding var(--transition-fast);
}

header.scrolled {
    background-color: var(--c-header-bg);
    backdrop-filter: blur(10px);
    padding: 1rem 5vw;
    border-bottom: 1px solid var(--c-border);
}

.logo {
    display: flex;
    align-items: center;
}

.logo img {
    height: clamp(50px, 8vh, 80px);
    width: auto;
    max-width: none !important; /* Prevent global max-width from squishing it */
    display: block;
    transition: height 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

header.scrolled .logo img {
    height: clamp(40px, 6vh, 60px);
}

nav ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap; /* A11Y: Wrap on large text */
    gap: clamp(0.5rem, 2vw, 3rem);
    align-items: center;
}

nav a {
    text-decoration: none;
    color: var(--c-accent);
    font-size: clamp(0.7rem, 1vw, 0.9rem);
    letter-spacing: clamp(0px, 0.1vw, 0.1em);
    transition: color var(--transition-fast);
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    min-height: 2.75rem; /* A11Y: 44px tap target */
    padding: 0.5rem;
}

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

.lang-switcher {
    display: flex;
    gap: 0.8rem;
    margin-left: 2rem;
}

.lang-btn {
    background: transparent;
    border: 1px solid var(--c-border);
    color: var(--c-text-muted);
    padding: 0.3rem 0.6rem;
    font-size: 0.875rem; /* A11Y: Slightly larger base font */
    min-height: 2.75rem; /* A11Y: 44px tap target */
    min-width: 2.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.lang-btn:hover, .lang-btn.active {
    border-color: var(--c-accent);
    color: var(--c-accent);
    background: rgba(218, 192, 126, 0.1);
}

/* Mobile Menu Toggle */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 2.5rem; /* A11Y */
    min-height: 2.5rem; /* A11Y */
    padding: 0.5rem 0; /* Align lines within larger tap box */
    cursor: pointer;
    z-index: 1001;
}

.menu-toggle .bar {
    min-height: 0.125rem;
    width: 100%;
    background-color: var(--c-text);
    transition: all 0.3s ease;
}

.menu-toggle.active .bar:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}
.menu-toggle.active .bar:nth-child(2) {
    opacity: 0;
}
.menu-toggle.active .bar:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

.nav-btn {
    background: transparent;
    border: 1px solid var(--c-accent);
    color: var(--c-accent);
    padding: 0.6rem 1.5rem;
    border-radius: 40px;
    cursor: pointer;
    font-family: var(--f-sans);
    font-size: 1rem; /* A11Y */
    min-height: 2.75rem; /* A11Y */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    letter-spacing: 0.05em;
    transition: all var(--transition-fast);
}

.nav-btn:hover {
    background: var(--c-accent);
    color: var(--c-on-accent);
}

/* Hero Section */
#hero {
    min-height: 100dvh;
    width: 100%;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding-top: clamp(100px, 15vh, 140px); /* Avoid header overlap robustly */
}

.slideshow {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    opacity: 0;
    transform: scale(1.05);
    transition: opacity 2s ease-in-out, transform 8s linear;
}

.slide.active {
    opacity: 1;
    transform: scale(1);
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* 常にダークモードの背景色（13, 19, 24）ベースの暗いグラデーションにする */
    background: linear-gradient(
        to bottom,
        rgba(13, 19, 24, 0.6) 0%,
        rgba(13, 19, 24, 0.1) 40%,
        rgba(13, 19, 24, 0.3) 80%,
        rgba(13, 19, 24, 1) 100%
    );
    z-index: 2;
}

.hero-content {
    position: relative;
    z-index: 3;
    text-align: center;
    width: 100%;
    padding: 0 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    flex: 1;
}

.hero-main-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    margin-top: auto;
    margin-bottom: auto;
    flex: 1;
    gap: 2rem;
    width: 100%;
}

.hero-caption {
    font-size: clamp(0.85rem, 3.5vw, 1.2rem);
    color: #dac07e; /* 常にゴールドに固定 */
    letter-spacing: clamp(0.1em, 0.2vw, 0.3em);
    margin: 0;
    line-height: 1.6;
}

.hero-title {
    color: #e6ebef; /* 常に白文字に固定 */
    font-size: clamp(1.6rem, 6.5vw, 5rem);
    line-height: 1.4;
    text-shadow: 0 10px 30px rgba(0,0,0,0.8); /* 常に暗いシャドウに固定 */
    letter-spacing: 0.05em;
    margin: 0;
}

.scroll-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
    padding-bottom: 2rem;
}

.scroll-indicator span {
    font-size: 0.8rem;
    letter-spacing: 0.2em;
    color: #dac07e; /* 常にゴールドに固定 */
}

.scroll-indicator .line {
    width: 1px;
    min-height: 5.0rem;
    background: linear-gradient(to bottom, #dac07e, transparent); /* 常にゴールドフェードに固定 */
}

/* Animations */
.fade-in-up {
    visibility: hidden;
    opacity: 0;
}

.delay-1 {
}

.delay-2 {
}

/* @keyframes removed for GSAP */

.scroll-reveal {
    visibility: hidden;
    opacity: 0;
}

/* Loading Screen */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--c-bg);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
}

.loading-logo {
    font-size: 1.5rem;
    letter-spacing: 0.2em;
    color: var(--c-text);
}

/* About Section */
.about-lead {
    text-align: center;
    max-width: 900px;
    margin: 0 auto 12rem;
    padding: 0 1rem 8rem;
    border-bottom: 1px solid var(--c-border);
}

.about-lead-title {
    font-size: clamp(2.4rem, 8vw, 4.5rem);
    color: var(--c-text);
    line-height: 1.1;
    margin-bottom: 3.5rem;
    letter-spacing: 0.1em;
    font-weight: 700;
}

.about-lead-divider {
    width: 40px;
    min-height: 0.125rem;
    background: var(--c-accent);
    margin: 0 auto 4rem;
    opacity: 0.8;
}

.about-lead-content {
    max-width: 720px;
    margin: 0 auto;
}

.about-lead-body {
    font-size: clamp(1rem, 1.2vw, 1.2rem);
    color: var(--c-text);
    line-height: 2.4;
    text-align: justify;
    text-justify: inter-character;
    letter-spacing: 0.05em;
    margin-bottom: 2.5rem;
    font-weight: 400;
    opacity: 0.85;
}

.about-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6rem;
    align-items: center;
}

.section-title {
    font-size: clamp(2rem, 3.5vw, 3rem);
    color: var(--c-accent);
    line-height: 1.5;
    margin-bottom: 3rem;
}

.about-text p {
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    color: var(--c-text-muted);
}

.about-image {
    position: relative;
}

.about-image img {
    width: 100%;
    height: auto;
    border-radius: 4px;
    display: block;
    position: relative;
    z-index: 2;
}

.image-frame {
    position: absolute;
    top: -20px;
    left: 20px;
    width: 100%;
    height: 100%;
    border: 1px solid var(--c-accent);
    z-index: 1;
}

/* Stats */
.stats-container {
    display: flex;
    justify-content: space-around;
    margin-top: 8rem;
    padding-top: 4rem;
    border-top: 1px solid var(--c-border);
}

.stat-item {
    text-align: center;
}

.stat-number {
    font-size: 4rem;
    color: var(--c-accent);
    line-height: 1;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.9rem;
    letter-spacing: 0.1em;
    color: var(--c-text-muted);
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(var(--c-bg-rgb), 0.95);
    backdrop-filter: blur(10px);
}

.modal.show {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: 8px;
    padding: 3rem;
    width: 90%;
    max-width: 850px; /* 900pxから850pxへ縮小し、文字が広がりすぎないように */
    max-height: 90dvh;
    overflow-y: auto;
    position: relative;
    /* transition removed to prevent bugs with direct display toggling */
}

/* モーダル内のテキスト（参拝辞典など）の文字組み最適化 */
.modal-body {
    line-height: 2.2;
    letter-spacing: 0.05em;
    font-size: 1.05rem;
    color: var(--c-text);
}
.modal-body p {
    margin-bottom: 2rem;
}
@media (max-width: 768px) {
    .modal-content {
        padding: 2rem 1.5rem; /* スマホでは左右のパディングを少し絞りつつ確保 */
        width: 95%;
    }
}

.modal.show .modal-content {
    transform: translateY(0);
}

.close-btn {
    position: absolute;
    top: 1.5rem;
    right: 2rem;
    color: var(--c-accent);
    font-size: 2rem;
    font-weight: 300;
    cursor: pointer;
    transition: color 0.3s;
}

.close-btn:hover {
    color: var(--c-accent);
}

.map-btn {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    text-align: center;
    padding: 1rem;
    min-height: 3.5rem; /* A11Y: Large tap target for main action */
    background: var(--c-accent);
    color: var(--c-on-accent);
    border: none;
    font-weight: 600;
    font-size: 1.1rem; /* A11Y */
    transition: transform var(--transition-fast), filter var(--transition-fast);
}

.map-btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
}

@media (max-width: 768px) {
    .detail-content-grid { grid-template-columns: 1fr; gap: 3rem; }
    .about-grid { grid-template-columns: 1fr; gap: 3rem; }
    .about-lead { margin-bottom: 6rem; padding-bottom: 5rem; }
    .about-lead-title { font-size: 2.4rem; }
    
    .menu-toggle { display: flex; }
    
    .nav-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        height: 100dvh;
        background-color: var(--c-bg);
        border-left: 1px solid var(--c-border);
        transition: right var(--transition-fast);
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        overflow-y: auto;
        padding-top: 6rem;
        padding-bottom: 2rem;
        z-index: 1000;
        align-items: center;
    }
    
    .nav-menu.active { right: 0; }
    
    .nav-menu ul {
        flex-direction: column;
        gap: 1.5rem;
        width: 100%;
        align-items: center;
    }

    .stats-container { flex-direction: column; gap: 3rem; }
}

/* Routes Section */
#route-container {
    display: flex;
    flex-direction: column;
    gap: 4rem;
}

.route-card {
    display: flex;
    background: var(--c-bg);
    border: 1px solid var(--c-border);
    border-radius: 8px;
    overflow: hidden;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.route-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px var(--c-shadow);
    border-color: rgba(218, 192, 126, 0.4);
}

.route-card.special {
    background: var(--c-surface);
    border-color: rgba(181, 155, 86, 0.3);
}

.route-card.special:hover {
    border-color: var(--c-accent-dark);
    box-shadow: 0 20px 50px var(--c-shadow-strong);
}

.route-card.special .route-img {
    filter: sepia(0.2) contrast(1.1);
}

.route-img {
    flex: 0 0 40%;
    background-size: cover;
    background-position: center;
    min-min-height: 18.75rem;
}

.route-info {
    flex: 1;
    padding: 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.route-subtitle {
    color: var(--c-accent);
    font-size: 0.9rem;
    letter-spacing: 0.2em;
    margin-bottom: 1rem;
}

.route-title {
    font-size: 2rem;
    color: var(--c-text);
    margin-bottom: 1.5rem;
}

.route-desc {
    color: var(--c-text-muted);
    margin-bottom: 2rem;
}

.route-meta {
    font-size: 0.85rem;
    color: var(--c-text-muted);
    border-top: 1px dashed var(--c-border);
    padding-top: 1rem;
    margin-top: auto;
}

/* Archive Search & Filter */
.search-filter-container {
    max-width: 800px;
    margin: 0 auto 4rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: center;
}

.shrine-search-input {
    width: 100%;
    padding: 1rem 1.5rem;
    background: var(--c-glass-bg);
    border: 1px solid var(--c-border);
    border-radius: 4px;
    color: var(--c-text);
    font-size: 1rem;
    outline: none;
    transition: border-color var(--transition-fast), background var(--transition-fast);
}

.shrine-search-input:focus {
    border-color: var(--c-accent);
    background: var(--c-glass-hover);
}

/* Ruby (Furigana) Styles */
ruby {
    ruby-position: over;
    ruby-align: center;
}

rt {
    font-size: 0.6em;
    color: var(--c-text-muted);
    letter-spacing: 0.05em;
    font-family: var(--f-sans);
    font-weight: 400;
}

/* Search Suggestions */
.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: rgba(var(--c-bg-rgb), 0.85);
    backdrop-filter: blur(12px);
    border: 1px solid var(--c-border);
    border-radius: 4px;
    margin-top: 0.5rem;
    max-min-height: 18.75rem;
    overflow-y: auto;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-fast);
    box-shadow: 0 10px 30px var(--c-shadow);
}

.search-suggestions.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.suggestion-item {
    padding: 1rem 1.5rem;
    cursor: pointer;
    border-bottom: 1px solid var(--c-border-glass);
    transition: background var(--transition-fast);
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover:not(.no-result) {
    background: rgba(218, 192, 126, 0.1);
}

.filter-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    justify-content: center;
    padding: 0.5rem; /* A11Y */
}

.filter-tag {
    background: transparent;
    border: 1px solid rgba(218, 192, 126, 0.3);
    color: var(--c-text-muted);
    padding: 0.4rem 1rem;
    min-height: 2.75rem; /* A11Y: 44px tap target */
    display: inline-flex;
    align-items: center;
    border-radius: 40px;
    cursor: pointer;
    font-size: 1rem; /* A11Y */
    transition: all var(--transition-fast);
}

.filter-tag:hover {
    border-color: var(--c-accent);
    color: var(--c-text);
}

.filter-tag.active {
    background: var(--c-accent);
    color: var(--c-on-accent);
    border-color: var(--c-accent);
}

/* エリアカラードット */
.filter-tag[style*="--dot-color"]::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--dot-color);
    margin-right: 6px;
    flex-shrink: 0;
}
.filter-tag.active[style*="--dot-color"]::before {
    background: var(--c-on-accent);
}

/* 125 Archive Cards Grid */
.archive-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
}

.archive-card {
position: relative;
border-radius: 4px;
overflow: hidden;
display: flex;
flex-direction: column;
    border: 1px solid var(--c-border-glass-strong);
    background: var(--c-surface);
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.6s ease;
    animation: cardFadeIn 0.6s ease-out forwards;
}

@keyframes cardFadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.archive-card:hover {
    transform: translateY(-5px);
}

.archive-card-img {
width: 100%;
aspect-ratio: 16/9;
/* height: 100%; removed */
    object-fit: cover;
    transition: transform 1.5s ease;
}

.archive-card:hover .archive-card-img {
    transform: scale(1.05);
}

.archive-card-overlay {
position: relative;
background: var(--c-surface);
display: flex;
flex-direction: column;
justify-content: flex-start;
padding: 1.5rem;
pointer-events: auto;
flex-grow: 1;
}

.visited-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(var(--c-bg-rgb), 0.85);
    backdrop-filter: blur(4px);
    border: 1px solid var(--c-accent);
    color: var(--c-accent);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: bold;
    letter-spacing: 0.1em;
    z-index: 10;
    box-shadow: 0 4px 10px var(--c-shadow);
}

.archive-card-rank {
    font-size: 0.75rem;
    color: var(--c-accent);
    border: 1px solid rgba(218, 192, 126, 0.5);
    padding: 2px 8px;
    border-radius: 2px;
    display: inline-block;
    align-self: flex-start;
    margin-bottom: 0.5rem;
    letter-spacing: 0.1em;
}

.archive-card-num {
font-size: 0.75rem;
color: var(--c-text-muted);
    margin-left: 10px;
    letter-spacing: 0.1em;
}

.archive-card-title {
    font-size: 1.25rem;
    color: var(--c-text);
    font-weight: bold;
    margin-bottom: 0.3rem;
    font-family: var(--f-serif);
    line-height: 1.3;
    margin-top: 0;
}

.archive-card-furigana {
    font-size: 0.65rem;
    color: #8c98a4; /* A calm, subdued grayish-blue that fits well with muted themes */
    margin-top: 0.4rem;
    margin-bottom: 0.1rem;
    letter-spacing: 0.05em;
    font-weight: normal;
}

.archive-card-suffix {
    font-size: 0.75rem;
    color: var(--c-text-muted);
    font-weight: normal;
    margin-left: 4px;
}

.archive-card.unvisited .archive-card-title {
color: var(--c-text-muted);
}

.archive-card-loc {
font-size: 0.85rem;
color: var(--c-text-muted);
}

/* Shrine Modal Inner Styles */
.modal-layout {
    display: flex;
    gap: 3rem;
}

.modal-img {
    flex: 0 0 45%;
    border-radius: 4px;
    background-size: cover;
    background-position: center;
    min-min-height: 25.0rem;
}

.modal-info {
    flex: 1;
}

.modal-badge {
    color: var(--c-accent);
    letter-spacing: 0.2em;
    font-size: 0.9rem;
}

.modal-title {
    font-size: 2.2rem;
    color: var(--c-text);
    margin: 0.5rem 0 0.2rem;
}

.modal-furi {
    font-size: 0.85rem;
    color: var(--c-text-muted);
    letter-spacing: 0.1em;
    margin-bottom: 2rem;
}

.modal-data-row {
    background: var(--c-glass-bg);
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 2rem;
    border-left: 3px solid var(--c-accent);
}

.modal-data-row .label {
    display: block;
    font-size: 0.8rem;
    color: var(--c-text-muted);
    margin-bottom: 0.3rem;
}

.modal-data-row .value {
    font-size: 1.1rem;
    color: var(--c-text);
}

.modal-history p {
    color: var(--c-text-muted);
    margin-bottom: 2rem;
}

.modal-access {
    background: var(--c-glass-bg);
    padding: 1.5rem;
    border-radius: 4px;
    border: 1px solid var(--c-glass-bg);
}

.modal-access strong {
    display: block;
    color: var(--c-accent);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.modal-access p {
    font-size: 0.95rem;
    color: var(--c-text-muted);
}

@media (max-width: 768px) {
    .route-card { flex-direction: column; }
    .route-img { min-min-height: 15.625rem; }
    .modal-layout { flex-direction: column; }
    .modal-img { min-min-height: 18.75rem; }
    .modal-content { padding: 2rem; }
}

/* Walking Guide Styles */
.walking-guide h3 {
    font-size: 1.4rem;
    letter-spacing: 0.1em;
}

.walking-guide ul li {
    line-height: 1.6;
    position: relative;
    margin-bottom: 0.8rem;
}

/* Route Shrine List item spacing */
.route-shrine-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--c-border-glass);
    transition: background 0.3s;
    text-decoration: none;
    color: var(--c-text);
}

.route-shrine-item:hover {
    background: rgba(218, 192, 126, 0.05);
    color: var(--c-accent);
}

/* === MAP PAGE UI IMPROVEMENTS === */
.btn-checkin {
    font-size: 1.05rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.05em;
}

.btn-checkin:disabled {
    opacity: 0.6;
}

/* Transport Method Cards */
#transport-methods > div {
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

#transport-methods > div:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

/* Progress Bar Visibility */
#bar-progress {
    font-size: 1.1rem !important;
    font-weight: 600;
}

/* Mobile Responsive Improvements */
@media (max-width: 768px) {
    .map-search {
        width: calc(100% - 80px) !important;
        font-size: 1rem;
    }
    
    .map-search input {
        font-size: 1rem !important;
    }
    
    .map-legend {
        font-size: 0.9rem;
    }
    
    .bs-title {
        font-size: 1.4rem !important;
    }
    
    .bs-desc {
        font-size: 1rem !important;
    }
    
    .control-btn {
        padding: 10px !important;
    }
}

/* --- Column Typography & Layout Optimization --- */
.column-article-container {
    max-width: 850px;
    margin: 0 auto;
    padding: 0 2rem;
}

.column-article-text {
    font-size: 1.15rem;
    line-height: 2.2;
    color: var(--c-text);
    text-align: justify;
    text-justify: inter-character;
    word-break: break-all;
    letter-spacing: 0.03em;
}

.column-article-text p {
    margin-bottom: 2.5rem;
}

.column-article-text h2 {
    font-size: 1.8rem;
    color: var(--c-accent);
    margin: 5rem 0 2.5rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid var(--c-border);
    position: relative;
    font-family: var(--f-serif);
}

.column-article-text h2::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 60px;
    min-height: 0.125rem;
    background: var(--c-accent);
}

.references-box {
    margin-top: 8rem;
    padding: 4rem;
    background: rgba(var(--c-bg-rgb), 0.3);
    border: 1px solid var(--c-border);
    border-radius: 4px;
}

.references-title {
    font-size: 1.1rem;
    color: var(--c-accent);
    margin-bottom: 2rem;
    letter-spacing: 0.1em;
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--f-serif);
}

.references-title::before {
    content: '';
    display: inline-block;
    width: 24px;
    min-height: 0.0625rem;
    background: var(--c-accent);
}

.reference-item {
    font-size: 0.95rem;
    color: var(--c-text-muted);
    margin-bottom: 0.8rem;
    list-style: none;
    padding-left: 1.5rem;
    position: relative;
}

.reference-item::before {
    content: '・';
    position: absolute;
    left: 0;
}

/* Ruby Typography */
ruby {
    ruby-align: center;
}

rt {
    font-size: 0.55em;
    letter-spacing: 0.1em;
    color: var(--c-text-muted);
    transform: translateY(-0.1em);
    font-family: var(--f-serif);
}

.detail-main-text {
    text-align: justify;
    text-justify: inter-character;
    line-height: 2.2;
    letter-spacing: 0.05em;
    font-size: 1.1rem;
    max-width: 800px; /* 文字の行長が長くなりすぎないように制限 */
    margin: 0 auto;
}

/* スマホ等でのテキストの左右余白を確保 */
@media (max-width: 768px) {
    .detail-main-text {
        font-size: 1.05rem;
        line-height: 2;
        padding: 0 1rem;
    }
}

@media (max-width: 768px) {
    .column-article-container {
        padding: 0 1.5rem;
    }
    .column-article-text {
        font-size: 1.05rem;
        line-height: 2;
    }
    .column-article-text h2 {
        font-size: 1.5rem;
        margin-top: 4rem;
    }
    .references-box {
        padding: 2rem;
        margin-top: 5rem;
    }
}



/* === Responsive Hardening for Various Aspect Ratios === */
img, video, canvas, iframe {
    max-width: 100%;
    height: auto;
}

h1, h2, h3, h4, h5, h6, p, span, div, a, li, dd, dt, th, td {
    overflow-wrap: break-word;
    word-break: auto-phrase;
}

@supports not (word-break: auto-phrase) {
    h1, h2, h3, h4, h5, h6, p, span, div, a, li, dd, dt, th, td {
        word-break: normal;
        word-wrap: break-word;
    }
}

.hero {
    min-height: 100svh;
}

@media (max-width: 1024px) {
    .detail-content-grid {
        gap: 2rem;
    }
}

@media screen and (orientation: landscape) and (max-height: 600px) {
    .hero { min-height: 100vw; }
    .modal-content { max-height: 85svh; }
}



/* =========================================================
   社格強調 (正宮・別宮) の特別スタイル
   ========================================================= */

/* 吹き出し（ポップアップ・ラベル）の強調：枠と文字色のみ変更 */
.marker-label.seigu, .marker-label.bekku {
    border: 2px solid var(--c-accent);
    color: var(--c-accent);
    font-weight: 700;
}


/* =========================================================
   MapLibre Popup (ネームタグ) のスタイルオーバーライド
   ========================================================= */
.shrine-popup .maplibregl-popup-content {
    background: transparent;
    box-shadow: none;
    padding: 0;
    pointer-events: auto;
}
.shrine-popup .maplibregl-popup-tip {
    display: none;
}
.shrine-popup .marker-label {
    display: block !important;
    opacity: 1 !important;
    position: relative;
    pointer-events: auto;
    cursor: pointer;
}

/* エリアマーカー装飾（横長カプセルバッジ型） */
.area-capsule-marker {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 6px 14px 6px 10px;
    border-radius: 30px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.18);
    cursor: pointer;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
    gap: 8px;
}

.area-capsule-marker:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0,0,0,0.25);
    z-index: 100;
}

.area-capsule-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.area-capsule-content {
    display: flex;
    align-items: center;
    gap: 6px;
    line-height: 1;
}

.area-capsule-name {
    font-weight: 700;
    font-size: 0.95rem;
}

.area-capsule-count {
    font-size: 0.85em;
    color: #666;
    font-weight: 500;
}

/* ========================================================
   神社の詳細ページ用 新レイアウト（画像とタイトルの完全分離）
   ======================================================== */

/* 独立したヒーロー画像ブロック */
.shrine-hero-banner {
    width: 100%;
    /* 画面高の約半分を基準とし、極端な縦長・横長を防止 */
    height: 50dvh;
    min-height: 350px;
    max-height: 600px;
    margin-bottom: 2rem;
    overflow: hidden;
    background-color: var(--c-bg);
}

.shrine-hero-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* タイトルヘッダーブロック */
.shrine-title-block {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--c-border);
}

/* 品格あるNo.バッジ */
.shrine-badge {
    display: inline-block;
    background: rgba(218, 192, 126, 0.1);
    color: var(--c-accent, #dac07e);
    border: 1px solid rgba(218, 192, 126, 0.6);
    padding: 0.4rem 1.2rem;
    border-radius: 50px;
    font-size: 0.95rem;
    font-weight: bold;
    letter-spacing: 0.15em;
    margin-bottom: 1.2rem;
}

/* 神社名（クリーム背景に映える視認性の高い黒系） */
.shrine-title {
    font-size: clamp(2.2rem, 5vw, 3.5rem);
    color: var(--c-text);
    font-weight: 700;
    margin-bottom: 0.5rem;
    line-height: 1.3;
    text-shadow: none;
}

/* ルビ（ふりがな）がある場合の装飾 */
.shrine-title ruby rt {
    font-size: 0.4em;
    color: var(--c-accent, #dac07e);
    font-weight: normal;
}

/* タイトル直下のふりがな */
.shrine-furigana {
    font-size: 1.1rem;
    color: var(--c-accent, #dac07e);
    letter-spacing: 0.2em;
    opacity: 0.8;
}

/* ========================================================
   レスポンシブ対応（スマホ等でのレイアウト最適化）
   ======================================================== */
@media (max-width: 768px) {
    .shrine-hero-banner {
        height: 40dvh;
        min-height: 80px;
        margin-bottom: 1.5rem;
    }
    
    .shrine-title-block {
        /* スマホでは中央寄せにして美しく見せる */
        align-items: center;
        text-align: center;
        margin-bottom: 2rem;
        padding-bottom: 1.5rem;
    }
    
    .shrine-badge {
        margin-bottom: 1rem;
    }
}

/* ========================================================
   引用・参考文献の右端アコーディオンUI
   ======================================================== */
.shrine-references-container {
    display: flex;
    justify-content: flex-end;
    margin-top: 3rem;
    margin-bottom: 2rem;
    width: 100%;
}

.shrine-references {
    display: inline-block;
    text-align: right;
    max-width: 100%;
}

.shrine-references summary {
    display: inline-block;
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--c-text-muted);
    opacity: 0.6;
    background: var(--c-glass-bg);
    border: 1px solid var(--c-border-glass);
    padding: 0.4rem 1rem;
    border-radius: 50px;
    list-style: none;
    user-select: none;
    transition: all 0.3s ease;
}

.shrine-references summary::-webkit-details-marker {
    display: none;
}
.shrine-references summary::marker {
    display: none;
}

.shrine-references summary:hover {
    opacity: 1;
    background: var(--c-glass-hover);
}

.shrine-references-content {
    margin-top: 0.8rem;
    padding: 1.2rem;
    background: var(--c-glass-bg);
    border: 1px solid var(--c-border-glass);
    border-radius: 8px;
    text-align: right;
    font-size: 0.75rem;
    color: var(--c-text-muted);
    opacity: 0.7;
    line-height: 1.8;
}

.shrine-ref-item {
    margin-bottom: 0.4rem !important;
}
.shrine-ref-item:last-child {
    margin-bottom: 0 !important;
}


/* =========================================
   Safe Area & Mobile Footer Adjustments
   ========================================= */
/* Ensure footers and navigation menus don't overlap with iOS Home Bar or In-App Browser bottom bars */
footer {
    padding-bottom: max(3rem, calc(env(safe-area-inset-bottom) + 24px)) !important;
}

.nav-menu {
    padding-bottom: calc(env(safe-area-inset-bottom) + 16px);
}

/* Future-proof utility class for any bottom-fixed UI elements */
.safe-bottom {
    padding-bottom: calc(env(safe-area-inset-bottom) + 16px) !important;
}



/* Global Button Safety for Narrow Screens (360px etc) */
button, .btn, .filter-btn, .action-btn {
    word-break: keep-all;
    overflow-wrap: anywhere;
}


html, body {
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
}


/* Custom MapLibre compass styles */






.maplibregl-ctrl-bottom-right > .maplibregl-ctrl-group {
    margin-bottom: 450px !important; /* Adjusted to stack above .map-controls */
    margin-right: 15px !important;
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
}

.maplibregl-ctrl-compass {
    width: 50px !important;
    height: 50px !important;
    background: rgba(var(--c-bg-rgb), 0.7) !important;
    backdrop-filter: blur(15px) !important;
    -webkit-backdrop-filter: blur(15px) !important;
    border: 1px solid rgba(218, 192, 126, 0.4) !important;
    border-radius: 50% !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2) !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
}

.maplibregl-ctrl-compass:hover { 
    background: rgba(218, 192, 126, 0.2) !important; 
    transform: scale(1.05) !important; 
}

.maplibregl-ctrl-compass .maplibregl-ctrl-icon {
    width: 40px !important;
    height: 40px !important;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 40 40'%3E%3Cpath fill='%23dc3545' d='M20 3 L13 20 L27 20 Z'/%3E%3Cpath fill='%23ccc' d='M20 37 L13 20 L27 20 Z'/%3E%3C/svg%3E") !important;
    background-size: contain !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
}


/* 視界コーン（現在地マーカーの下敷き） */
.view-cone {
    position: absolute;
    width: 80px;
    height: 80px;
    background: conic-gradient(from 325deg, transparent 0deg, rgba(52, 152, 219, 0.4) 35deg, transparent 70deg);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(0deg);
    pointer-events: none;
    transform-origin: center center;
    transition: transform 0.1s linear;
}

/* 視界コーンコンテナ */
.user-marker-container {
    position: relative;
    width: 24px;
    height: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
}


/* Ensure native map controls stay above marker labels (which have z-index ~130) */

.maplibregl-ctrl-top-left,
.maplibregl-ctrl-top-right,
.maplibregl-ctrl-bottom-left,
.maplibregl-ctrl-bottom-right {
    z-index: 200 !important;
}
