/* 共通スタイル - Header, Footer, 基本レイアウト */

/* リセットCSS */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 基本設定 */
body {
    font-family: 'Noto Serif JP', serif;
    line-height: 1.6;
    color: #333;
    background-color: #fafafa;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-size: 16px; /* 基本フォントサイズを明示的に設定 */
}

/* アクセシビリティ用クラス */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* メインコンテンツ */
main {
    flex: 1;
}

/* ヘッダー */
.site-header {
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 80px;
}

.header-logo a {
    text-decoration: none;
    color: inherit;
}

/* パンくずナビ */
.breadcrumb {
    background-color: #f8f8f8;
    padding: 1rem 0;
}

.breadcrumb-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap; /* スマートフォンで折り返し */
}

.breadcrumb-item {
    margin-right: 1rem;
    position: relative;
}

.breadcrumb-item:not(:last-child)::after {
    content: '>';
    margin-left: 1rem;
    color: #666;
}

.breadcrumb-item a {
    color: #8B4513;
    text-decoration: none;
    transition: color 0.3s ease;
}

.breadcrumb-item a:hover,
.breadcrumb-item a:focus {
    color: #5D2F0A;
}

.breadcrumb-item[aria-current="page"] {
    color: #666;
}

.site-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: #8B4513;
    margin: 0;
}

/* ナビゲーション */
.main-navigation {
    display: flex;
}

.nav-menu {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-item {
    margin-left: 2rem;
}

.nav-link {
    text-decoration: none;
    color: #333;
    font-weight: 500;
    padding: 0.5rem 0;
    transition: color 0.3s ease;
    position: relative;
}

.nav-link:hover,
.nav-link:focus {
    color: #8B4513;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: #8B4513;
    transition: width 0.3s ease;
}

.nav-link:hover::after,
.nav-link:focus::after {
    width: 100%;
}

/* ハンバーガーメニュー */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    z-index: 1001;
}

.menu-toggle-icon {
    display: block;
    width: 25px;
    height: 20px;
    position: relative;
}

.menu-toggle-icon span {
    display: block;
    width: 100%;
    height: 2px;
    background-color: #333;
    transition: all 0.3s ease;
    position: absolute;
}

.menu-toggle-icon span:nth-child(1) {
    top: 0;
}

.menu-toggle-icon span:nth-child(2) {
    top: 50%;
    transform: translateY(-50%);
}

.menu-toggle-icon span:nth-child(3) {
    bottom: 0;
}

/* フッター */
.site-footer {
    background-color: #2c1810;
    color: #fff;
    padding: 3rem 0 1rem;
    margin-top: auto;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.footer-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section {
    margin-bottom: 2rem;
}

.footer-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: #D2B48C;
}

.contact-info p {
    margin-bottom: 0.5rem;
    color: #fff;
}

.contact-info a {
    color: #D2B48C;
    text-decoration: none;
    transition: color 0.3s ease;
}

.contact-info a:hover,
.contact-info a:focus {
    color: #fff;
}

.opening-hours h4 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    color: #D2B48C;
}

.footer-menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.footer-menu li {
    margin-bottom: 0.5rem;
}

.footer-menu a {
    color: #fff;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-menu a:hover,
.footer-menu a:focus {
    color: #D2B48C;
}

.footer-bottom {
    border-top: 1px solid #444;
    padding-top: 1rem;
    text-align: center;
    font-size: 0.9rem;
    color: #ccc;
}

.copyright,
.update-info {
    margin-bottom: 0.5rem;
}

/* ページトップボタン */
.page-top-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background-color: #8B4513;
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
}

.page-top-btn.is-visible {
    opacity: 1;
    visibility: visible;
}

.page-top-btn:hover,
.page-top-btn:focus {
    background-color: #5D2F0A;
    transform: translateY(-2px);
}

/* レスポンシブデザイン */
@media (max-width: 1024px) {
    .header-container {
        padding: 0 15px;
    }
    
    .site-title {
        font-size: 1.6rem;
    }
    
    .nav-item {
        margin-left: 1.5rem;
    }
}

@media (max-width: 768px) {
    body {
        font-size: 14px; /* スマートフォンでの基本フォントサイズを調整 */
    }
    
    .header-container {
        padding: 0 15px;
        min-height: 70px;
    }
    
    .site-title {
        font-size: 1.4rem;
    }
    
    .menu-toggle {
        display: block;
    }
    
    .main-navigation {
        position: fixed;
        top: 0;
        left: -100%;
        width: 100%;
        height: 100vh;
        background-color: #fff;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: left 0.3s ease;
        z-index: 999;
    }
    
    .main-navigation.is-open {
        left: 0;
    }
    
    .nav-menu {
        flex-direction: column;
        text-align: center;
        width: 100%;
    }
    
    .nav-item {
        margin: 0;
        width: 100%;
    }
    
    .nav-link {
        font-size: 1.2rem;
        padding: 1rem;
        display: block;
        border-bottom: 1px solid #eee;
    }
    
    .nav-link:last-child {
        border-bottom: none;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .page-top-btn {
        width: 50px;
        height: 50px;
        bottom: 20px;
        right: 20px;
        font-size: 1.2rem;
    }
    
    /* パンくずナビの調整 */
    .breadcrumb-list {
        padding: 0 15px;
    }
    
    .breadcrumb-item {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    body {
        font-size: 13px; /* より小さい画面でのフォントサイズ */
    }
    
    .header-container {
        padding: 0 10px;
        min-height: 60px;
    }
    
    .site-title {
        font-size: 1.2rem;
    }
    
    .footer-container {
        padding: 0 15px;
    }
    
    .page-top-btn {
        width: 45px;
        height: 45px;
        bottom: 15px;
        right: 15px;
        font-size: 1rem;
    }
    
    /* パンくずナビの調整 */
    .breadcrumb {
        padding: 0.5rem 0;
    }
    
    .breadcrumb-list {
        padding: 0 10px;
    }
    
    .breadcrumb-item {
        font-size: 0.8rem;
        margin-right: 0.5rem;
    }
    
    .breadcrumb-item:not(:last-child)::after {
        margin-left: 0.5rem;
    }
}

/* タブレット向けの調整 */
@media (min-width: 769px) and (max-width: 1024px) {
    .header-container {
        padding: 0 20px;
    }
    
    .site-title {
        font-size: 1.7rem;
    }
    
    .nav-item {
        margin-left: 1.8rem;
    }
    
    .footer-content {
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
    }
}

/* 大画面向けの調整 */
@media (min-width: 1200px) {
    .header-container {
        padding: 0 30px;
    }
    
    .site-title {
        font-size: 2rem;
    }
    
    .nav-item {
        margin-left: 2.5rem;
    }
    
    .footer-container {
        padding: 0 30px;
    }
}

/* 横画面（ランドスケープ）向けの調整 */
@media (max-height: 500px) and (orientation: landscape) {
    .header-container {
        min-height: 60px;
    }
    
    .site-title {
        font-size: 1.3rem;
    }
    
    .main-navigation {
        height: 100vh;
        padding-top: 60px;
    }
    
    .nav-link {
        padding: 0.8rem;
        font-size: 1.1rem;
    }
}

/* 高解像度ディスプレイ向けの調整 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .menu-toggle-icon span {
        height: 1.5px;
    }
    
    .nav-link::after {
        height: 1.5px;
    }
}

/* プリント用の調整 */
@media print {
    .site-header,
    .main-navigation,
    .page-top-btn {
        display: none;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.4;
    }
    
    .site-footer {
        background-color: #fff;
        color: #000;
        border-top: 1px solid #000;
    }
}

/* タッチデバイス向けの最適化 */
.touch-device .nav-link {
    min-height: 44px; /* iOS推奨の最小タッチターゲットサイズ */
    display: flex;
    align-items: center;
    justify-content: center;
}

.touch-device .menu-toggle {
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.touch-device .page-top-btn {
    min-width: 44px;
    min-height: 44px;
}

.touch-device .btn-primary,
.touch-device .btn-outline {
    min-height: 44px;
    padding: 0.75rem 1.5rem;
}

.touch-device .form-input,
.touch-device .form-select,
.touch-device .form-textarea {
    min-height: 44px;
    font-size: 16px; /* iOSでズームを防ぐ */
}

/* タッチデバイスでのホバー効果を無効化 */
@media (hover: none) and (pointer: coarse) {
    .nav-link:hover::after,
    .nav-link:focus::after {
        width: 0;
    }
    
    .quick-link-item:hover,
    .facility-item:hover,
    .gallery-item:hover .gallery-img,
    .service-item:hover,
    .memorial-item:hover,
    .app-step:hover,
    .feature-item:hover {
        transform: none;
    }
    
    .hero-img:hover,
    .hero-image img:hover,
    .greeting-img:hover,
    .greeting-full-img:hover,
    .teachings-img:hover,
    .facility-img:hover,
    .gallery-img:hover,
    .step-img:hover,
    .service-icon img:hover,
    .method-icon img:hover {
        transform: none;
    }
}

/* タッチデバイスでのアクティブ状態 */
@media (hover: none) and (pointer: coarse) {
    .nav-link:active {
        background-color: rgba(139, 69, 19, 0.1);
    }
    
    .btn-primary:active,
    .btn-outline:active {
        transform: scale(0.98);
    }
    
    .quick-link-item:active,
    .facility-item:active,
    .service-item:active,
    .memorial-item:active,
    .app-step:active,
    .feature-item:active {
        transform: scale(0.98);
    }
}

/* スクロールの最適化 */
@media (hover: none) and (pointer: coarse) {
    html {
        -webkit-overflow-scrolling: touch;
    }
    
    body {
        -webkit-overflow-scrolling: touch;
    }
}

/* フォーカス表示の改善 */
.nav-link:focus-visible,
.btn-primary:focus-visible,
.btn-outline:focus-visible,
.menu-toggle:focus-visible {
    outline: 2px solid #8B4513;
    outline-offset: 2px;
}

/* 高コントラストモード対応 */
@media (prefers-contrast: high) {
    .nav-link::after {
        background-color: #000;
    }
    
    .btn-primary {
        border: 2px solid #000;
    }
    
    .btn-outline {
        border: 2px solid #000;
        color: #000;
    }
}

/* モーション軽減設定対応 */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .hero-img,
    .hero-image img,
    .greeting-img,
    .greeting-full-img,
    .teachings-img,
    .facility-img,
    .gallery-img,
    .step-img,
    .service-icon img,
    .method-icon img {
        transition: none;
    }
    
    .quick-link-item,
    .facility-item,
    .gallery-item,
    .service-item,
    .memorial-item,
    .app-step,
    .feature-item {
        transition: none;
    }
    
    .nav-link::after {
        transition: none;
    }
    
    .page-top-btn {
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }
}

/* ダークモード対応（将来の拡張用） */
@media (prefers-color-scheme: dark) {
    /* ダークモードの設定をここに追加可能 */
}

/* 印刷時の最適化 */
@media print {
    .touch-device .nav-link {
        min-height: auto;
    }
    
    .touch-device .menu-toggle {
        min-width: auto;
        min-height: auto;
    }
    
    .touch-device .page-top-btn {
        min-width: auto;
        min-height: auto;
    }
    
    .touch-device .btn-primary,
    .touch-device .btn-outline {
        min-height: auto;
    }
    
    .touch-device .form-input,
    .touch-device .form-select,
    .touch-device .form-textarea {
        min-height: auto;
    }
}