/* 荒川電工 メインスタイルシート */

body, html {
    font-family: 'Helvetica Neue', Arial, 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', Meiryo, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f8f8f8;
    color: #333;
    height: 100%;
    width: 100%;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: 100%;
    transition: opacity 0.3s ease;
}

body.loaded .wrapper {
    opacity: 1;
}

/* ヘッダー */
header {
    background-color: rgba(255, 255, 255, 0.95);
    padding: 5px 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    height: 50px;
    display: flex;
    align-items: center;
    position: fixed;
    width: 100%;
    z-index: 1000;
    top: 0;
    transform: translateZ(0); /* ハードウェアアクセラレーション有効化 */
}

.header-container {
    width: 100%;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
}

.logo img {
    height: 40px;
    transform: translateZ(0); /* ハードウェアアクセラレーション有効化 */
}

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

nav ul li {
    margin-left: 20px;
}

nav ul li a {
    text-decoration: none;
    color: #333;
    font-weight: 500;
    transition: color 0.3s;
    font-size: 0.9rem;
}

nav ul li a:hover {
    color: #0066cc;
}

/* メインコンテンツ */
.main-content {
    flex: 1;
    width: 100%;
    margin-top: 50px; /* ヘッダーの高さ分 */
    margin-bottom: 50px; /* フッターの高さ分 */
    transform: translateZ(0); /* ハードウェアアクセラレーション有効化 */
}

.video-container {
    width: 100%;
    height: calc(100vh - 100px); /* ヘッダーとフッターの高さを引く */
    overflow: hidden;
    position: relative;
    background-color: #000;
    transform: translateZ(0); /* ハードウェアアクセラレーション有効化 */
}

.video-container:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 1;
}

.video-container video {
    width: 100%;
    height: 100%;
    object-fit: cover; /* 画面いっぱいに表示 */
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    will-change: transform; /* パフォーマンス向上 */
    backface-visibility: hidden; /* パフォーマンス向上 */
    transform: translateZ(0); /* ハードウェアアクセラレーション有効化 */
    opacity: 1; /* すぐに表示 */
    transition: opacity 0.3s ease;
}

.video-container.video-playing video {
    opacity: 1;
}

.content-overlay h1,
.content-overlay p,
.content-overlay,
.buffering .content-overlay:after {
    display: none;
}

@media (max-width: 768px) {
    .content-overlay h1,
    .content-overlay p {
        display: none;
    }
}

/* フッター */
footer {
    background-color: rgba(255, 255, 255, 0.95);
    padding: 5px 0;
    text-align: center;
    color: #666;
    box-shadow: 0 -2px 5px rgba(0,0,0,0.05);
    height: 50px;
    display: flex;
    align-items: center;
    position: fixed;
    bottom: 0;
    width: 100%;
    z-index: 1000;
    transform: translateZ(0); /* ハードウェアアクセラレーション有効化 */
}

.footer-container {
    width: 100%;
    margin: 0 auto;
    padding: 0 10px;
}

.footer-content {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-links {
    display: flex;
}

.footer-links a {
    color: #333;
    text-decoration: none;
    margin: 0 10px;
    transition: color 0.3s;
    font-size: 0.8rem;
}

.footer-links a:hover {
    color: #0066cc;
}

.copyright {
    color: #999;
    font-size: 0.8rem;
    margin: 0;
}

/* カテゴリメニュー */
.menu-container {
    display: flex;
    justify-content: center;
    width: 100%;
}

.category-menu {
    display: flex;
    justify-content: center;
}

.category-menu a {
    margin: 0 10px;
    color: #333;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
    font-size: 0.8rem;
}

.category-menu a:hover {
    color: #0066cc;
}

/* ハンバーガーメニュー */
.hamburger-menu {
  display: none; /* PCでは非表示 */
  background: none;
  border: none;
  cursor: pointer;
  padding: 10px;
  position: absolute;
  right: 15px;
  top: 7px;
  z-index: 1001;
  width: 44px;
  height: 36px;
  outline: none;
  -webkit-tap-highlight-color: rgba(0,0,0,0); /* タップ時のハイライト防止 */
}

.hamburger-menu span {
  display: block;
  width: 25px;
  height: 3px;
  background-color: #333;
  margin: 5px auto;
  transition: transform 0.3s, opacity 0.3s;
  border-radius: 1px; /* 線を少し丸める */
}

/* ハンバーガーメニュー展開時のアニメーション */
.hamburger-menu.is-active span:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}
.hamburger-menu.is-active span:nth-child(2) {
  opacity: 0;
}
.hamburger-menu.is-active span:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

/* モバイルナビゲーション */
.nav-menu {
  display: none; /* 初期状態では非表示 */
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9); /* 背景を少し濃くする */
  z-index: 1000; /* 数値を上げる */
  transition: all 0.3s ease; /* transitionを追加 */
  opacity: 0;
  visibility: hidden; /* 可視性も管理 */
}

.nav-menu.is-active {
  display: block;
  opacity: 1;
  visibility: visible;
}

.nav-menu ul {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  list-style: none;
  padding: 0;
  margin: 0;
}

.nav-menu ul li {
  margin: 20px 0;
}

.nav-menu ul li a {
  color: white;
  text-decoration: none;
  font-size: 1.2rem;
  font-weight: 500;
  transition: color 0.3s;
}

.nav-menu ul li a:hover {
  color: #0066cc;
}

/* スクロール禁止 */
body.no-scroll {
  overflow: hidden;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .logo img {
        height: 30px;
    }
    
    .header-container nav {
        display: none; /* 通常のナビゲーションを非表示 */
    }
    
    .hamburger-menu {
        display: block; /* ハンバーガーメニューボタンを表示 */
        position: absolute; /* 位置を確実に設定 */
        right: 15px;
        top: 50%;
        transform: translateY(-50%);
    }
    
    /* ハンバーガーメニュー展開後のリスト表示調整 */
    .nav-menu.is-active {
        display: flex; /* ブロックではなくフレックスに変更 */
        align-items: center;
        justify-content: center;
    }
    
    .footer-links a, .category-menu a {
        font-size: 0.7rem;
        margin: 0 5px;
    }
}

/* 動画の最適化 */
.video-container.video-ready video {
    opacity: 1;
    transition: opacity 0.3s ease;
}

.video-container.video-playing video {
    opacity: 1;
}

/* 動画再生エラー表示 */
.video-container.fallback:before {
    content: '動画を再生できません';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 1.5rem;
    z-index: 30;
}

@keyframes pulse {
    0% { opacity: 0.3; }
    50% { opacity: 1; }
    100% { opacity: 0.3; }
}

@-webkit-keyframes pulse {
    0% { opacity: 0.3; }
    50% { opacity: 1; }
    100% { opacity: 0.3; }
}

/* デバイス別最適化 */
.device-mobile-phone .video-container video {
    object-fit: cover; /* モバイルでは画面いっぱいに表示 */
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
}

.device-tablet .video-container video {
    object-fit: cover; /* タブレットでは画面いっぱいに表示 */
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
}

/* タブレット縦向き */
@media (orientation: portrait) and (min-width: 768px) and (max-width: 1024px) {
    .device-tablet .video-container video {
        object-position: center; /* 中央に配置 */
        width: 100vw; /* ビューポート幅いっぱい */
        height: 100%; /* 高さいっぱい */
        position: absolute;
        top: 0;
        left: 0;
    }
    
    /* タブレット向けハンバーガーメニュー調整 */
    .hamburger-menu {
        right: 20px; /* 右端からの距離をタブレット用に調整 */
        width: 50px; /* サイズを少し大きく */
        height: 40px;
    }
    
    .hamburger-menu span {
        width: 30px; /* 線を少し太く */
        height: 4px; 
    }
    
    .nav-menu ul li a {
        font-size: 1.3rem; /* フォントサイズを適切に */
        padding: 12px 30px; /* タップエリアを広げる */
    }
}

/* スマホ縦向き */
@media (orientation: portrait) and (max-width: 767px) {
    .device-mobile-phone .video-container video {
        object-position: center; /* 中央に配置 */
        width: 100vw; /* ビューポート幅いっぱい */
        height: 100%; /* 高さいっぱい */
        position: absolute;
        top: 0;
        left: 0;
    }
    
    /* ハンバーガーメニュースマホ専用調整 */
    .hamburger-menu {
        right: 10px; /* 右端からの距離を調整 */
    }
    
    .nav-menu ul li {
        margin: 15px 0; /* メニュー項目の間隔を調整 */
    }
    
    .nav-menu ul li a {
        font-size: 1.1rem; /* フォントサイズを少し小さく */
        padding: 10px 25px; /* タップエリアを広げる */
        display: block; /* ブロック要素として表示 */
        background-color: rgba(0, 0, 0, 0.3); /* 背景色を少し付ける */
        border-radius: 4px; /* 角を丸める */
    }
}

/* ページ読み込み中の表示 */
.video-loading .video-container:before {
    content: '動画読み込み中...';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 1.2rem;
    z-index: 20;
}