/* ヘッダー専用CSS */

.site-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.navbar-custom {
    padding: 1rem 0;
}

.navbar-brand {
    color: white !important;
    text-decoration: none;
    transition: all 0.3s ease;
}

.navbar-brand:hover {
    color: #ffd700 !important;
    transform: scale(1.05);
}

.site-name {
    font-size: 1.75rem;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.navbar-tagline {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-top: 0.25rem;
}

.site-logo {
    max-height: 50px;
    margin-right: 0.5rem;
    filter: drop-shadow(1px 1px 2px rgba(0,0,0,0.3));
}

/* ヘッダー広告セクション */
.header-ads-section {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    padding: 3rem 0;
    margin-top: 0;
    border-top: 1px solid #dee2e6;
}

.header-ads-title {
    color: #495057;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.header-ad-wrapper {
    height: 100%;
}

.header-ad-card {
    background: white;
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
    border: 1px solid #e9ecef;
}

.header-ad-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    color: inherit;
    text-decoration: none;
}

/* 統一された画像コンテナ - はみ出し防止 */
.header-ad-image {
    height: 200px;
    border-radius: 0.5rem;
    overflow: hidden;
    margin-bottom: 1rem;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.header-ad-image img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain; /* はみ出し防止 */
    object-position: center;
}

/* RAW広告用の統一コンテナ - はみ出し防止 */
.header-ad-raw {
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden; /* はみ出し防止 */
    border-radius: 0.5rem;
    background: #f8f9fa;
    padding: 0.5rem;
    position: relative;
}

.header-ad-raw img {
    max-width: calc(100% - 1rem);
    max-height: calc(100% - 1rem);
    width: auto;
    height: auto;
    object-fit: contain; /* はみ出し防止 */
    object-position: center;
}

.header-ad-raw iframe,
.header-ad-raw object,
.header-ad-raw embed {
    max-width: 100%;
    max-height: 100%;
}

.header-ad-placeholder {
    background: linear-gradient(45deg, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2rem;
    height: 200px;
    border-radius: 0.5rem;
}

.header-ad-content {
    flex-grow: 1;
    margin-bottom: 1rem;
}

.header-ad-title {
    font-weight: bold;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    line-height: 1.4;
    color: #212529;
    /* テキストのはみ出し防止 */
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.header-ad-desc {
    color: #6c757d;
    font-size: 0.9rem;
    line-height: 1.5;
    /* テキストのはみ出し防止 */
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.header-ad-btn {
    background: linear-gradient(45deg, #ff6b35, #f7931e);
    border: none;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 2rem;
    font-weight: bold;
    width: 100%;
    transition: all 0.3s ease;
}

.header-ad-btn:hover {
    background: linear-gradient(45deg, #e55a2e, #e08618);
    transform: scale(1.02);
    color: white;
}

/* カルーセルコントロール */
.carousel-control-prev,
.carousel-control-next {
    width: 5%;
    opacity: 0.8;
}

.carousel-control-prev:hover,
.carousel-control-next:hover {
    opacity: 1;
}

.carousel-indicators {
    margin-bottom: 0;
}

.carousel-indicators button {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid white;
    background-color: transparent;
}

.carousel-indicators .active {
    background-color: white;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .site-name {
        font-size: 1.5rem;
    }
    
    .navbar-tagline {
        font-size: 0.8rem;
    }
    
    .header-ads-section {
        padding: 2rem 0;
    }
    
    .header-ad-card {
        padding: 1rem;
    }
    
    .header-ad-image,
    .header-ad-raw,
    .header-ad-placeholder {
        height: 150px;
    }
    
    .header-ad-title {
        font-size: 1rem;
        -webkit-line-clamp: 2;
    }
    
    .header-ad-desc {
        font-size: 0.85rem;
        -webkit-line-clamp: 2;
    }
    
    .header-ad-btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .header-ad-image,
    .header-ad-raw,
    .header-ad-placeholder {
        height: 120px;
    }
    
    .header-ad-title {
        font-size: 0.95rem;
        -webkit-line-clamp: 1;
    }
    
    .header-ad-desc {
        font-size: 0.8rem;
        -webkit-line-clamp: 1;
    }
}

/* アニメーション */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.site-header {
    animation: fadeInDown 0.6s ease;
}

.header-ads-section {
    animation: fadeInDown 0.8s ease;
}

.header-ad-card {
    animation: fadeInDown 0.6s ease;
}

/* はみ出し防止の共通ルール */
.header-ad-wrapper {
    overflow: hidden;
    border-radius: 1rem;
}

.header-ad-wrapper * {
    max-width: 100% !important;
}

/* 特殊な広告コンテンツの制御 */
.header-ad-raw table {
    width: 100% !important;
    max-width: 100% !important;
    table-layout: fixed;
}

.header-ad-raw table td,
.header-ad-raw table th {
    word-wrap: break-word;
    overflow: hidden;
}